MailChimp for WordPress - Version 4.7.5

Version Description

Download this release

Release Info

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

Code changes from version 4.7.4 to 4.7.5

CHANGELOG.md CHANGED
@@ -1,6 +1,15 @@
1
  Changelog
2
  =========
3
 
 
 
 
 
 
 
 
 
 
4
  #### 4.7.4 - Dec 7, 2019
5
 
6
  **Fixes**
@@ -74,11 +83,11 @@ Changelog
74
 
75
  - Improved fetch and cache mechanism for retrieving Mailchimp account details, fetching data only when it is required.
76
  - Updated [Mithril](https://mithril.js.org/) and [CodeMirror](https://codemirror.net/) dependencies.
77
- - Decreased size of `forms-api.js` from 22KB to 9KB.
78
  - No longer requiring jQuery anywhere.
79
  - Increase API HTTP request timeout to 15 seconds.
80
 
81
- Please note that installing this update requires you to also update any add-ons like [Mailchimp Top Bar](https://wordpress.org/plugins/mailchimp-top-bar/) and [Mailchimp for WordPress Premium](https://mc4wp.com/premium-features/) (if installed).
82
 
83
 
84
  #### 4.5.5 - Sep 12, 2019
@@ -124,7 +133,7 @@ Please note that installing this update requires you to also update any add-ons
124
 
125
  - Accept more truthy values in custom integration for improved compatibility with third-party forms.
126
  - Update JavaScript dependencies.
127
- - Load Google reCaptcha script in footer (if needed).
128
 
129
 
130
  #### 4.5.1 - April 8, 2019
@@ -181,7 +190,7 @@ Please note that installing this update requires you to also update any add-ons
181
 
182
  **Improvements**
183
 
184
- - Write API request parameters to the debug log in case of connection timeouts.
185
  - Update JavaScript dependencies.
186
 
187
 
@@ -275,21 +284,21 @@ Please note that installing this update requires you to also update any add-ons
275
 
276
  - Remove obsolete `type` attribute from all `<script>` tags printed by the plugin.
277
  - Improved tooltips on settings pages.
278
- - Do not pre-check integration checkboxes by default.
279
- - Add textual warnings to settings that may affect [GDPR compliance](https://kb.mc4wp.com/gdpr-compliance/).
280
  - Update translation files.
281
 
282
  #### 4.2 - March 5, 2018
283
 
284
  **Additions**
285
 
286
- - Live form preview while editing form.
287
 
288
  **Improvements**
289
 
290
- - Improved [conditional fields logic](https://kb.mc4wp.com/conditional-fields-elements/).
291
  - Debug log now includes request & response data.
292
- - [Form JavaScript events](https://kb.mc4wp.com/javascript-form-events/) are fired in an isolated thread now, to prevent errors in event callbacks from breaking form functionality.
293
  - Don't send empty field values to Mailchimp when updating subscribers.
294
  - Show interest grouping ID in list overview on settings page.
295
 
@@ -358,7 +367,7 @@ Please note that installing this update requires you to also update any add-ons
358
 
359
  **Fixes**
360
 
361
- - Filter out empty array values when overriding selected Mailchimp lists via `_mc4wp_lists`.
362
 
363
  **Improvements**
364
 
@@ -374,7 +383,7 @@ Please note that installing this update requires you to also update any add-ons
374
  **Improvements**
375
 
376
  - Remove unused options from Ninja Forms integration.
377
- - Now logging all sign-ups from Ninja Forms integrations when using [Mailchimp for WordPress Premium](https://mc4wp.com/premium-features/).
378
 
379
  **Additions**
380
 
@@ -434,7 +443,7 @@ Please note that installing this update requires you to also update any add-ons
434
  **Additions**
435
 
436
  - Added campaign & template methods to API client class.
437
-
438
 
439
 
440
  #### 4.1.4 - June 15, 2017
@@ -561,7 +570,7 @@ Please note that installing this update requires you to also update any add-ons
561
 
562
  **Additions**
563
 
564
- - Add `data-hide-if` attribute logic to forms. See [conditionally hide form fields](https://kb.mc4wp.com/conditional-fields-elements/). Thanks to [Kurt Zenisek](http://kurtzenisek.com/).
565
  - Add hooks for delayed BuddyPress sign-up. Thanks to [Christian Wach](https://profiles.wordpress.org/needle).
566
 
567
 
@@ -613,7 +622,7 @@ Please note that installing this update requires you to also update any add-ons
613
  **Additions**
614
 
615
  - Add [MemberPress](https://www.memberpress.com/) integration.
616
- - Add missing e-commerce related API methods for next week's [WooCommerce Mailchimp e-commerce integration](https://mc4wp.com/kb/what-is-ecommerce360/) release.
617
 
618
 
619
  #### 4.0.4 - September 7, 2016
@@ -641,7 +650,7 @@ Please note that installing this update requires you to also update any add-ons
641
  **Additions**
642
 
643
  - Add pre-checked option to Ninja Forms integration.
644
- - You can now [conditionally hide fields or elements](https://mc4wp.com/kb/conditional-fields-elements/) using the `data-show-if` attribute.
645
 
646
 
647
  #### 4.0.2 - August 10, 2016
@@ -658,7 +667,7 @@ Please note that installing this update requires you to also update any add-ons
658
 
659
  #### 4.0 & 4.0.1 - August 9, 2016
660
 
661
- This release updates the plugin to version 3 of the Mailchimp API. Please [read through the upgrade guide](https://mc4wp.com/kb/upgrading-to-4-0/) before updating to make sure things keep working as expected for you.
662
 
663
  **Changes**
664
 
@@ -749,7 +758,7 @@ This release updates the plugin to version 3 of the Mailchimp API. Please [read
749
  **Fixes**
750
 
751
  - Form Preview mode replaced all titles on that page with "Form Preview".
752
- - API class fix for [eCommerce360 functionality](https://mc4wp.com/kb/what-is-ecommerce360/).
753
 
754
  **Improvements**
755
 
@@ -889,7 +898,7 @@ This release updates the plugin to version 3 of the Mailchimp API. Please [read
889
 
890
  **Additions**
891
 
892
- - Added [debug logging](https://mc4wp.com/kb/how-to-enable-log-debugging/), which shows all warnings & errors the plugin encountered in communicating with Mailchimp.
893
  - Add `get_lists_for_email( $email )` method to API class.
894
  - Add `MC4WP_Queue` class for better background processing of expensive operations.
895
 
@@ -999,15 +1008,15 @@ Added `mc4wp_use_sslverify` filter to disable or explicitly enable SSL certifica
999
 
1000
  **Improvements**
1001
 
1002
- - Add form-specific classes to preview form element. This allows the [Styles Builder](https://mc4wp.com/premium-features/) to work with the Form Preview.
1003
  - Form events are now triggered _after_ the page has finished loading, so all scripts are loaded & ready to use.
1004
  - Reset background-color in Form Themes stylesheets.
1005
 
1006
  #### 3.0.0 & 3.0.1 - November 23, 2015
1007
 
1008
- Version 3.0 is a total revamp of the plugin. For a quick overview of the changes, please [read this post on our blog](https://mc4wp.com/blog/whats-new-in-mailchimp-for-wordpress-the-big-three-o/).
1009
 
1010
- Before upgrading, please go through the [upgrade guide](https://mc4wp.com/kb/upgrading-to-3-0/) as some things have changed.
1011
 
1012
  **Breaking Changes**
1013
 
@@ -1026,7 +1035,7 @@ Before upgrading, please go through the [upgrade guide](https://mc4wp.com/kb/upg
1026
  - Events Manager: checkbox is now automatically added to booking forms.
1027
  - Tons of usability & accessibility improvements.
1028
  - Tons of code improvements: improved memory usage, 100+ new unit tests & better usage of various best practices.
1029
- - The [premium plugin](https://mc4wp.com/) is now an add-on of this plugin.
1030
 
1031
  **Additions**
1032
 
@@ -1045,7 +1054,7 @@ Before upgrading, please go through the [upgrade guide](https://mc4wp.com/kb/upg
1045
  **Improvements**
1046
 
1047
  - Usage tracking is now scheduled once a week (instead of daily).
1048
- - Preparations for [the upcoming Mailchimp for WordPress version 3.0 release](https://mc4wp.com/blog/breaking-backwards-compatibility-in-version-3-0/).
1049
  - Tested compatibility with WordPress 4.4
1050
 
1051
  #### 2.3.17 - October 22, 2015
@@ -1273,7 +1282,7 @@ Before upgrading, please go through the [upgrade guide](https://mc4wp.com/kb/upg
1273
  - Add `role` attribute to form elements
1274
  - Major code refactoring for easier unit testing and improved code readability.
1275
  - Use Composer for autoloading all plugin classes (PHP 5.2 compatible)
1276
- - You can now use [form variables in both forms, messages as checkbox label texts](https://mc4wp.com/kb/using-variables-in-your-form-or-messages/).
1277
 
1278
  **Additions**
1279
 
@@ -1288,7 +1297,7 @@ Before upgrading, please go through the [upgrade guide](https://mc4wp.com/kb/upg
1288
 
1289
  **Improvements**
1290
 
1291
- - Updated Italian, Russian & Turkish translations.
1292
 
1293
  #### 2.2.8 - March 24, 2015
1294
 
@@ -1388,7 +1397,7 @@ A huge thank you to [Stefan Oderbolz](http://metaodi.ch/) for various fixed and
1388
 
1389
  #### 2.2.3 - January 24, 2015
1390
 
1391
- Minor improvements and additions for compatibility with the [Mailchimp User Sync plugin](https://mc4wp.com/premium-features/).
1392
 
1393
  #### 2.2.2 - January 13, 2015
1394
 
1
  Changelog
2
  =========
3
 
4
+ #### 4.7.5 - Feb 10, 2020
5
+
6
+ - Add AMP compatibility to sign-up forms.
7
+ - Add settings key to WPML config so settings can easily by copied over to translated versions of a form.
8
+ - Optimize size & performance of JavaScript code, resulting in a file that is 40% smaller.
9
+ - Update CodeMirror to its latest version.
10
+ - Escape all string translations.
11
+
12
+
13
  #### 4.7.4 - Dec 7, 2019
14
 
15
  **Fixes**
83
 
84
  - Improved fetch and cache mechanism for retrieving Mailchimp account details, fetching data only when it is required.
85
  - Updated [Mithril](https://mithril.js.org/) and [CodeMirror](https://codemirror.net/) dependencies.
86
+ - Decreased size of `forms.js` from 22KB to 9KB.
87
  - No longer requiring jQuery anywhere.
88
  - Increase API HTTP request timeout to 15 seconds.
89
 
90
+ Please note that installing this update requires you to also update any add-ons like [Mailchimp Top Bar](https://wordpress.org/plugins/mailchimp-top-bar/) and [Mailchimp for WordPress Premium](https://www.mc4wp.com/premium-features/) (if installed).
91
 
92
 
93
  #### 4.5.5 - Sep 12, 2019
133
 
134
  - Accept more truthy values in custom integration for improved compatibility with third-party forms.
135
  - Update JavaScript dependencies.
136
+ - Load Google reCaptcha script in footer (if needed).
137
 
138
 
139
  #### 4.5.1 - April 8, 2019
190
 
191
  **Improvements**
192
 
193
+ - Write API request parameters to the debug log in case of connection timeouts.
194
  - Update JavaScript dependencies.
195
 
196
 
284
 
285
  - Remove obsolete `type` attribute from all `<script>` tags printed by the plugin.
286
  - Improved tooltips on settings pages.
287
+ - Do not pre-check integration checkboxes by default.
288
+ - Add textual warnings to settings that may affect [GDPR compliance](https://www.mc4wp.com/kb/gdpr-compliance/).
289
  - Update translation files.
290
 
291
  #### 4.2 - March 5, 2018
292
 
293
  **Additions**
294
 
295
+ - Live form preview while editing form.
296
 
297
  **Improvements**
298
 
299
+ - Improved [conditional fields logic](https://www.mc4wp.com/kb/conditional-fields-elements/).
300
  - Debug log now includes request & response data.
301
+ - [Form JavaScript events](https://www.mc4wp.com/kb/javascript-form-events/) are fired in an isolated thread now, to prevent errors in event callbacks from breaking form functionality.
302
  - Don't send empty field values to Mailchimp when updating subscribers.
303
  - Show interest grouping ID in list overview on settings page.
304
 
367
 
368
  **Fixes**
369
 
370
+ - Filter out empty array values when overriding selected Mailchimp lists via `_mc4wp_lists`.
371
 
372
  **Improvements**
373
 
383
  **Improvements**
384
 
385
  - Remove unused options from Ninja Forms integration.
386
+ - Now logging all sign-ups from Ninja Forms integrations when using [Mailchimp for WordPress Premium](https://www.mc4wp.com/premium-features/).
387
 
388
  **Additions**
389
 
443
  **Additions**
444
 
445
  - Added campaign & template methods to API client class.
446
+
447
 
448
 
449
  #### 4.1.4 - June 15, 2017
570
 
571
  **Additions**
572
 
573
+ - Add `data-hide-if` attribute logic to forms. See [conditionally hide form fields](https://www.mc4wp.com/kb/conditional-fields-elements/). Thanks to [Kurt Zenisek](http://kurtzenisek.com/).
574
  - Add hooks for delayed BuddyPress sign-up. Thanks to [Christian Wach](https://profiles.wordpress.org/needle).
575
 
576
 
622
  **Additions**
623
 
624
  - Add [MemberPress](https://www.memberpress.com/) integration.
625
+ - Add missing e-commerce related API methods for next week's [WooCommerce Mailchimp e-commerce integration](https://www.mc4wp.com/kb/what-is-ecommerce/) release.
626
 
627
 
628
  #### 4.0.4 - September 7, 2016
650
  **Additions**
651
 
652
  - Add pre-checked option to Ninja Forms integration.
653
+ - You can now [conditionally hide fields or elements](https://www.mc4wp.com/kb/conditional-fields-elements/) using the `data-show-if` attribute.
654
 
655
 
656
  #### 4.0.2 - August 10, 2016
667
 
668
  #### 4.0 & 4.0.1 - August 9, 2016
669
 
670
+ This release updates the plugin to version 3 of the Mailchimp API. Please [read through the upgrade guide](https://www.mc4wp.com/kb/upgrading-to-4-0/) before updating to make sure things keep working as expected for you.
671
 
672
  **Changes**
673
 
758
  **Fixes**
759
 
760
  - Form Preview mode replaced all titles on that page with "Form Preview".
761
+ - API class fix for [eCommerce360 functionality](https://www.mc4wp.com/kb/what-is-ecommerce/).
762
 
763
  **Improvements**
764
 
898
 
899
  **Additions**
900
 
901
+ - Added [debug logging](https://www.mc4wp.com/kb/how-to-enable-log-debugging/), which shows all warnings & errors the plugin encountered in communicating with Mailchimp.
902
  - Add `get_lists_for_email( $email )` method to API class.
903
  - Add `MC4WP_Queue` class for better background processing of expensive operations.
904
 
1008
 
1009
  **Improvements**
1010
 
1011
+ - Add form-specific classes to preview form element. This allows the [Styles Builder](https://www.mc4wp.com/premium-features/) to work with the Form Preview.
1012
  - Form events are now triggered _after_ the page has finished loading, so all scripts are loaded & ready to use.
1013
  - Reset background-color in Form Themes stylesheets.
1014
 
1015
  #### 3.0.0 & 3.0.1 - November 23, 2015
1016
 
1017
+ Version 3.0 is a total revamp of the plugin. For a quick overview of the changes, please [read this post on our blog](https://www.mc4wp.com/blog/whats-new-in-mailchimp-for-wordpress-the-big-three-o/).
1018
 
1019
+ Before upgrading, please go through the [upgrade guide](https://www.mc4wp.com/kb/upgrading-to-3-0/) as some things have changed.
1020
 
1021
  **Breaking Changes**
1022
 
1035
  - Events Manager: checkbox is now automatically added to booking forms.
1036
  - Tons of usability & accessibility improvements.
1037
  - Tons of code improvements: improved memory usage, 100+ new unit tests & better usage of various best practices.
1038
+ - The [premium plugin](https://www.mc4wp.com/) is now an add-on of this plugin.
1039
 
1040
  **Additions**
1041
 
1054
  **Improvements**
1055
 
1056
  - Usage tracking is now scheduled once a week (instead of daily).
1057
+ - Preparations for [the upcoming Mailchimp for WordPress version 3.0 release](https://www.mc4wp.com/blog/breaking-backwards-compatibility-in-version-3-0/).
1058
  - Tested compatibility with WordPress 4.4
1059
 
1060
  #### 2.3.17 - October 22, 2015
1282
  - Add `role` attribute to form elements
1283
  - Major code refactoring for easier unit testing and improved code readability.
1284
  - Use Composer for autoloading all plugin classes (PHP 5.2 compatible)
1285
+ - You can now use [form variables in both forms, messages as checkbox label texts](https://www.mc4wp.com/kb/using-variables-in-your-form-or-messages/).
1286
 
1287
  **Additions**
1288
 
1297
 
1298
  **Improvements**
1299
 
1300
+ - Updated Italian, Russian & Turkish translations.
1301
 
1302
  #### 2.2.8 - March 24, 2015
1303
 
1397
 
1398
  #### 2.2.3 - January 24, 2015
1399
 
1400
+ Minor improvements and additions for compatibility with the [Mailchimp User Sync plugin](https://www.mc4wp.com/premium-features/).
1401
 
1402
  #### 2.2.2 - January 13, 2015
1403
 
assets/js/admin.js CHANGED
@@ -1,4 +1,4 @@
1
- (function () { var require = undefined; var define = undefined; (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2
  'use strict'; // dependencies
3
 
4
  var _tlite = _interopRequireDefault(require("tlite"));
@@ -60,8 +60,8 @@ var helpers = {}; // polling
60
  helpers.debounce = function (func, wait, immediate) {
61
  var timeout;
62
  return function () {
63
- var context = this,
64
- args = arguments;
65
  var callNow = immediate && !timeout;
66
  clearTimeout(timeout);
67
  timeout = setTimeout(function () {
@@ -94,8 +94,8 @@ function fetch(evt) {
94
  state.working = true;
95
  state.done = false;
96
  m.request({
97
- method: "POST",
98
- url: ajaxurl + "?action=mc4wp_renew_mailchimp_lists",
99
  timeout: 600000 // 10 minutes, matching max_execution_time
100
 
101
  }).then(function (data) {
@@ -117,14 +117,14 @@ function fetch(evt) {
117
 
118
  function view() {
119
  return m('form', {
120
- method: "POST",
121
  onsubmit: fetch.bind(this)
122
  }, [m('p', [m('input', {
123
- type: "submit",
124
  value: state.working ? i18n.fetching_mailchimp_lists : i18n.renew_mailchimp_lists,
125
- className: "button",
126
  disabled: !!state.working
127
- }), m.trust(' &nbsp; '), state.working ? [m('span.mc4wp-loader', "Loading..."), m.trust(' &nbsp; ')] : '', state.done ? [state.success ? m('em.help.green', i18n.fetching_mailchimp_lists_done) : m('em.help.red', i18n.fetching_mailchimp_lists_error)] : ''])]);
128
  }
129
 
130
  var mount = document.getElementById('mc4wp-list-fetcher');
@@ -160,8 +160,8 @@ function showDetails(evt) {
160
 
161
  if (next.style.display === 'none') {
162
  m.request({
163
- method: "GET",
164
- url: ajaxurl + "?action=mc4wp_get_list_details&ids=" + listID
165
  }).then(function (details) {
166
  m.render(mount, view(details.shift()));
167
  });
@@ -204,7 +204,7 @@ if (table) {
204
  },{"mithril":13}],6:[function(require,module,exports){
205
  'use strict';
206
 
207
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
208
 
209
  var context = document.getElementById('mc4wp-admin');
210
  var listInputs = context.querySelectorAll('.mc4wp-list-input');
@@ -226,11 +226,11 @@ function updateSelectedLists() {
226
  selectedLists = [];
227
  [].forEach.call(listInputs, function (input) {
228
  // skip unchecked checkboxes
229
- if (typeof input.checked === "boolean" && !input.checked) {
230
  return;
231
  }
232
 
233
- if (_typeof(lists[input.value]) === "object") {
234
  selectedLists.push(lists[input.value]);
235
  }
236
  });
@@ -281,12 +281,12 @@ var showIfElements = document.querySelectorAll('[data-showif]');
281
 
282
  function toggleElement() {
283
  // do nothing with unchecked radio inputs
284
- if (this.getAttribute('type') === "radio" && !this.checked) {
285
  return;
286
  }
287
 
288
- var value = this.getAttribute("type") === "checkbox" ? this.checked : this.value;
289
- var conditionMet = value == config.value;
290
 
291
  if (hide) {
292
  element.style.display = conditionMet ? '' : 'none';
@@ -297,7 +297,7 @@ var showIfElements = document.querySelectorAll('[data-showif]');
297
 
298
 
299
  [].forEach.call(inputs, function (inputElement) {
300
- conditionMet ? inputElement.removeAttribute('readonly') : inputElement.setAttribute('readonly', 'readonly');
301
  });
302
  } // find checked element and call toggleElement function
303
 
@@ -349,7 +349,7 @@ function get(id) {
349
 
350
  function _open(tab, updateState) {
351
  // make sure we have a tab object
352
- if (typeof tab === "string") {
353
  tab = get(tab);
354
  }
355
 
@@ -372,14 +372,14 @@ function _open(tab, updateState) {
372
  }); // add `nav-tab-active` to this tab
373
 
374
  [].forEach.call(tab.nav, function (nav) {
375
- nav.className += " nav-tab-active";
376
  nav.blur();
377
  }); // show target tab
378
 
379
  tab.element.style.display = 'block';
380
- tab.element.className += " tab-active"; // create new URL
381
 
382
- var url = URL.setParameter(window.location.href, "tab", tab.id); // update hash
383
 
384
  if (history.pushState && updateState) {
385
  history.pushState(tab.id, '', url);
@@ -390,8 +390,8 @@ function _open(tab, updateState) {
390
 
391
  refererField.value = url; // if thickbox is open, close it.
392
 
393
- if (typeof tb_remove === "function") {
394
- tb_remove();
395
  } // refresh editor if open
396
 
397
 
@@ -404,7 +404,7 @@ function _open(tab, updateState) {
404
 
405
  function title(tab) {
406
  var title = document.title.split('-');
407
- document.title = document.title.replace(title[0], tab.title + " ");
408
  }
409
 
410
  function switchTab(evt) {
@@ -514,10 +514,10 @@ var URL = {
514
  var ret = [];
515
 
516
  for (var d in data) {
517
- ret.push(d + "=" + encodeURIComponent(data[d]));
518
  }
519
 
520
- return ret.join("&");
521
  },
522
  setParameter: function setParameter(url, key, value) {
523
  var data = URL.parse(url);
@@ -3033,4 +3033,3 @@ if (typeof module !== 'undefined' && module.exports) {
3033
  }
3034
 
3035
  },{}]},{},[1]);
3036
- })();
1
+ (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2
  'use strict'; // dependencies
3
 
4
  var _tlite = _interopRequireDefault(require("tlite"));
60
  helpers.debounce = function (func, wait, immediate) {
61
  var timeout;
62
  return function () {
63
+ var context = this;
64
+ var args = arguments;
65
  var callNow = immediate && !timeout;
66
  clearTimeout(timeout);
67
  timeout = setTimeout(function () {
94
  state.working = true;
95
  state.done = false;
96
  m.request({
97
+ method: 'POST',
98
+ url: ajaxurl + '?action=mc4wp_renew_mailchimp_lists',
99
  timeout: 600000 // 10 minutes, matching max_execution_time
100
 
101
  }).then(function (data) {
117
 
118
  function view() {
119
  return m('form', {
120
+ method: 'POST',
121
  onsubmit: fetch.bind(this)
122
  }, [m('p', [m('input', {
123
+ type: 'submit',
124
  value: state.working ? i18n.fetching_mailchimp_lists : i18n.renew_mailchimp_lists,
125
+ className: 'button',
126
  disabled: !!state.working
127
+ }), m.trust(' &nbsp; '), state.working ? [m('span.mc4wp-loader', 'Loading...'), m.trust(' &nbsp; ')] : '', state.done ? [state.success ? m('em.help.green', i18n.fetching_mailchimp_lists_done) : m('em.help.red', i18n.fetching_mailchimp_lists_error)] : ''])]);
128
  }
129
 
130
  var mount = document.getElementById('mc4wp-list-fetcher');
160
 
161
  if (next.style.display === 'none') {
162
  m.request({
163
+ method: 'GET',
164
+ url: ajaxurl + '?action=mc4wp_get_list_details&ids=' + listID
165
  }).then(function (details) {
166
  m.render(mount, view(details.shift()));
167
  });
204
  },{"mithril":13}],6:[function(require,module,exports){
205
  'use strict';
206
 
207
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
208
 
209
  var context = document.getElementById('mc4wp-admin');
210
  var listInputs = context.querySelectorAll('.mc4wp-list-input');
226
  selectedLists = [];
227
  [].forEach.call(listInputs, function (input) {
228
  // skip unchecked checkboxes
229
+ if (typeof input.checked === 'boolean' && !input.checked) {
230
  return;
231
  }
232
 
233
+ if (_typeof(lists[input.value]) === 'object') {
234
  selectedLists.push(lists[input.value]);
235
  }
236
  });
281
 
282
  function toggleElement() {
283
  // do nothing with unchecked radio inputs
284
+ if (this.type === 'radio' && !this.checked) {
285
  return;
286
  }
287
 
288
+ var value = this.type === 'checkbox' ? this.checked : this.value;
289
+ var conditionMet = String(value) === String(config.value);
290
 
291
  if (hide) {
292
  element.style.display = conditionMet ? '' : 'none';
297
 
298
 
299
  [].forEach.call(inputs, function (inputElement) {
300
+ inputElement.readOnly = !conditionMet;
301
  });
302
  } // find checked element and call toggleElement function
303
 
349
 
350
  function _open(tab, updateState) {
351
  // make sure we have a tab object
352
+ if (typeof tab === 'string') {
353
  tab = get(tab);
354
  }
355
 
372
  }); // add `nav-tab-active` to this tab
373
 
374
  [].forEach.call(tab.nav, function (nav) {
375
+ nav.className += ' nav-tab-active';
376
  nav.blur();
377
  }); // show target tab
378
 
379
  tab.element.style.display = 'block';
380
+ tab.element.className += ' tab-active'; // create new URL
381
 
382
+ var url = URL.setParameter(window.location.href, 'tab', tab.id); // update hash
383
 
384
  if (history.pushState && updateState) {
385
  history.pushState(tab.id, '', url);
390
 
391
  refererField.value = url; // if thickbox is open, close it.
392
 
393
+ if (typeof window.tb_remove === 'function') {
394
+ window.tb_remove();
395
  } // refresh editor if open
396
 
397
 
404
 
405
  function title(tab) {
406
  var title = document.title.split('-');
407
+ document.title = document.title.replace(title[0], tab.title + ' ');
408
  }
409
 
410
  function switchTab(evt) {
514
  var ret = [];
515
 
516
  for (var d in data) {
517
+ ret.push(d + '=' + encodeURIComponent(data[d]));
518
  }
519
 
520
+ return ret.join('&');
521
  },
522
  setParameter: function setParameter(url, key, value) {
523
  var data = URL.parse(url);
3033
  }
3034
 
3035
  },{}]},{},[1]);
 
assets/js/admin.min.js CHANGED
@@ -1,2 +1,2 @@
1
- !function i(l,a,s){function u(t,e){if(!a[t]){if(!l[t]){var n=!1;if(!e&&n)return n(t,!0);if(c)return c(t,!0);var r=new Error("Cannot find module '"+t+"'");throw r.code="MODULE_NOT_FOUND",r}var o=a[t]={exports:{}};l[t][0].call(o.exports,function(e){return u(l[t][1][e]||e)},o,o.exports,i,l,a,s)}return a[t].exports}for(var c=!1,e=0;e<s.length;e++)u(s[e]);return u}({1:[function(e,t,n){"use strict";var r,o=(r=e("tlite"))&&r.__esModule?r:{default:r},i=e("./admin/tabs.js"),l=e("./admin/settings.js"),a=e("./admin/helpers.js");(0,o.default)(function(e){return-1<e.className.indexOf("mc4wp-tooltip")}),e("./admin/list-fetcher.js"),e("./admin/fields/mailchimp-api-key.js"),e("./admin/list-overview.js"),e("./admin/show-if.js"),window.mc4wp=window.mc4wp||{},window.mc4wp.helpers=a,window.mc4wp.settings=l,window.mc4wp.tabs=i},{"./admin/fields/mailchimp-api-key.js":2,"./admin/helpers.js":3,"./admin/list-fetcher.js":4,"./admin/list-overview.js":5,"./admin/settings.js":6,"./admin/show-if.js":7,"./admin/tabs.js":8,tlite:35}],2:[function(e,t,n){"use strict";var r=document.getElementById("mailchimp_api_key");r&&r.addEventListener("change",function(e){var t=document.createElement("p");t.className="help red",t.innerText=window.mc4wp_vars.i18n.invalid_api_key,r.nextElementSibling.innerText===t.innerText&&r.nextElementSibling.parentElement.removeChild(r.nextElementSibling),r.value.match(/^[0-9a-zA-Z*]{32}-[a-z]{2}[0-9]{1,2}$/)||r.parentElement.insertBefore(t,r.nextElementSibling)})},{}],3:[function(e,t,n){"use strict";var r={debounce:function(r,o,i){var l;return function(){var e=this,t=arguments,n=i&&!l;clearTimeout(l),l=setTimeout(function(){l=null,i||r.apply(e,t)},o),n&&r.apply(e,t)}}};t.exports=r},{}],4:[function(e,t,n){"use strict";var r=window.mc4wp_vars,o=window.mc4wp_vars.i18n,i=window.mc4wp_vars.ajaxurl,l=e("mithril"),a={working:!1,done:!1,success:!1};function s(e){e&&e.preventDefault(),a.working=!0,a.done=!1,l.request({method:"POST",url:i+"?action=mc4wp_renew_mailchimp_lists",timeout:6e5}).then(function(e){a.success=!0,e&&window.setTimeout(function(){window.location.reload()},3e3)}).catch(function(e){a.success=!1}).finally(function(e){a.working=!1,a.done=!0,l.redraw()})}var u=document.getElementById("mc4wp-list-fetcher");u&&(r.mailchimp.api_connected&&0===r.mailchimp.lists.length&&s(),l.mount(u,{view:function(){return l("form",{method:"POST",onsubmit:s.bind(this)},[l("p",[l("input",{type:"submit",value:a.working?o.fetching_mailchimp_lists:o.renew_mailchimp_lists,className:"button",disabled:!!a.working}),l.trust(" &nbsp; "),a.working?[l("span.mc4wp-loader","Loading..."),l.trust(" &nbsp; ")]:"",a.done?[a.success?l("em.help.green",o.fetching_mailchimp_lists_done):l("em.help.red",o.fetching_mailchimp_lists_error)]:""])])}}))},{mithril:13}],5:[function(e,t,n){"use strict";var i=window.mc4wp_vars.ajaxurl,l=e("mithril");function r(e){e.preventDefault();var t=e.target,n=t.parentElement.parentElement.nextElementSibling,r=t.getAttribute("data-list-id"),o=n.querySelector("div");"none"===n.style.display?(l.request({method:"GET",url:i+"?action=mc4wp_get_list_details&ids="+r}).then(function(e){l.render(o,function(e){return[l("h3","Merge fields"),l("table.widefat.striped",[l("thead",[l("tr",[l("th","Name"),l("th","Tag"),l("th","Type")])]),l("tbody",e.merge_fields.map(function(e){return l("tr",[l("td",[e.name,e.required&&l("span.red","*")]),l("td",[l("code",e.tag)]),l("td",[e.type," ",e.options&&e.options.date_format?"("+e.options.date_format+")":"",e.options&&e.options.choices?"("+e.options.choices.join(", ")+")":""])])}))]),0<e.interest_categories.length&&[l("h3","Interest Categories"),l("table.striped.widefat",[l("thead",[l("tr",[l("th","Name"),l("th","Type"),l("th","Interests")])]),l("tbody",e.interest_categories.map(function(t){return l("tr",[l("td",[l("strong",t.title),l("br"),l("br"),"ID: ",l("code",t.id)]),l("td",t.type),l("td",[l("div.row",{style:"margin-bottom: 4px;"},[l("div.col.col-3",[l("strong",{style:"display: block; border-bottom: 1px solid #eee;"},"Name")]),l("div.col.col-3",[l("strong",{style:"display: block; border-bottom: 1px solid #eee;"},"ID")])]),Object.keys(t.interests).map(function(e){return l("div.row.tiny-margin",[l("div.col.col-3",t.interests[e]),l("div.col.col-3",[l("code",{title:"Interest ID"},e)]),l("br.clearfix.clear.cf")])})])])}))])]]}(e.shift()))}),n.style.display=""):n.style.display="none"}Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var o=document.getElementById("mc4wp-mailchimp-lists-overview");o&&o.addEventListener("click",function(e){e.target.matches(".mc4wp-mailchimp-list")&&r(e)})},{mithril:13}],6:[function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o=document.getElementById("mc4wp-admin").querySelectorAll(".mc4wp-list-input"),i=window.mc4wp_vars.mailchimp.lists,l=[],a={};function s(){return l=[],[].forEach.call(o,function(e){"boolean"==typeof e.checked&&!e.checked||"object"!==r(i[e.value])||l.push(i[e.value])}),function(){var e=document.querySelectorAll(".lists--only-selected > *");[].forEach.call(e,function(e){var t=0<function(t,n){return l.filter(function(e){return e[t]===n})}("id",e.getAttribute("data-list-id")).length;e.style.display=t?"":"none"})}(),function(e,t){a[e]=a[e]||[],a[e].forEach(function(e){return e.apply(null,t)})}("selectedLists.change",[l]),l}[].forEach.call(o,function(e){e.addEventListener("change",s)}),s(),t.exports={getSelectedLists:function(){return l},on:function(e,t){a[e]=a[e]||[],a[e].push(t)}}},{}],7:[function(e,t,n){"use strict";var r=document.querySelectorAll("[data-showif]");[].forEach.call(r,function(e){var n=JSON.parse(e.getAttribute("data-showif")),t=document.querySelectorAll('[name="'+n.element+'"]'),r=e.querySelectorAll("input,select,textarea:not([readonly])"),o=void 0===n.hide||n.hide;function i(){if("radio"!==this.getAttribute("type")||this.checked){var t=("checkbox"===this.getAttribute("type")?this.checked:this.value)==n.value;o?(e.style.display=t?"":"none",e.style.visibility=t?"":"hidden"):e.style.opacity=t?"":"0.4",[].forEach.call(r,function(e){t?e.removeAttribute("readonly"):e.setAttribute("readonly","readonly")})}}[].forEach.call(t,function(e){e.addEventListener("change",i),i.call(e)})})},{}],8:[function(e,t,n){"use strict";var i=e("./url.js"),o=document.getElementById("mc4wp-admin"),r=o.querySelectorAll(".tab"),l=o.querySelectorAll(".nav-tab"),a=o.querySelector('input[name="_wp_http_referer"]'),s=[];function u(e){for(var t=0;t<s.length;t++)if(s[t].id===e)return s[t];return null}function c(e,t){if("string"==typeof e&&(e=u(e)),!e)return!1;void 0===t&&(t=!0),[].forEach.call(r,function(e){e.className=e.className.replace("tab-active",""),e.style.display=" none"}),[].forEach.call(l,function(e){e.className=e.className.replace("nav-tab-active","")}),[].forEach.call(e.nav,function(e){e.className+=" nav-tab-active",e.blur()}),e.element.style.display="block",e.element.className+=" tab-active";var n=i.setParameter(window.location.href,"tab",e.id);return history.pushState&&t&&history.pushState(e.id,"",n),f(e),a.value=n,"function"==typeof tb_remove&&tb_remove(),window.mc4wp&&window.mc4wp.forms&&window.mc4wp.forms.editor&&window.mc4wp.forms.editor.refresh(),!0}function f(e){var t=document.title.split("-");document.title=document.title.replace(t[0],e.title+" ")}function d(e){var t=e.target,n=t.getAttribute("data-tab");if(!n){var r=t.className.match(/nav-tab-(\w+)?/);r&&(n=r[1])}if(!n){var o=i.parse(t.href);if(!o.tab)return;n=o.tab}return!c(n)||(e.preventDefault(),e.returnValue=!1)}Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),[].forEach.call(r,function(e,t){var n=e.id.substring(4),r=e.querySelector("h2:first-of-type").textContent;s.push({id:n,title:r,element:e,nav:o.querySelectorAll(".nav-tab-"+n),open:function(){return c(n)}})}),[].forEach.call(l,function(e){return e.addEventListener("click",d)}),document.body.addEventListener("click",function(e){e.target.matches(".tab-link")&&d(e)}),function(){var e=s.filter(function(e){return null!==e.element.offsetParent}).shift();if(e){var t=u(e.id.substring(4));t&&(history.replaceState&&null===history.state&&history.replaceState(t.id,""),f(t))}}(),window.addEventListener&&history.pushState&&window.addEventListener("popstate",function(e){return!e.state||c(e.state,!1)}),t.exports={open:c,get:u}},{"./url.js":9}],9:[function(e,t,n){"use strict";var o={parse:function(e){var t={},n=e.split("&");for(var r in n)if(n.hasOwnProperty(r)){var o=n[r].split("=");t[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return t},build:function(e){var t=[];for(var n in e)t.push(n+"="+encodeURIComponent(e[n]));return t.join("&")},setParameter:function(e,t,n){var r=o.parse(e);return r[t]=n,o.build(r)}};t.exports=o},{}],10:[function(e,t,n){"use strict";var s=e("../render/vnode");t.exports=function(r,e,t){var o=[],n=!1,i=!1;function l(){if(n)throw new Error("Nested m.redraw.sync() call");n=!0;for(var e=0;e<o.length;e+=2)try{r(o[e],s(o[e+1]),a)}catch(e){t.error(e)}n=!1}function a(){i||(i=!0,e(function(){i=!1,l()}))}return a.sync=l,{mount:function(e,t){if(null!=t&&null==t.view&&"function"!=typeof t)throw new TypeError("m.mount(element, component) expects a component, not a vnode");var n=o.indexOf(e);0<=n&&(o.splice(n,2),r(e,[],a)),null!=t&&(o.push(e,t),r(e,s(t),a))},redraw:a}}},{"../render/vnode":29}],11:[function(e,t,n){(function(E){"use strict";var k=e("../render/vnode"),l=e("../render/hyperscript"),T=e("../promise/promise"),i=e("../pathname/build"),S=e("../pathname/parse"),_=e("../pathname/compileTemplate"),j=e("../pathname/assign"),A={};t.exports=function(d,p){var s;function m(e,t,n){if(e=i(e,t),null!=s){s();var r=n?n.state:null,o=n?n.title:null;n&&n.replace?d.history.replaceState(r,o,x.prefix+e):d.history.pushState(r,o,x.prefix+e)}else d.location.href=x.prefix+e}var h,v,y,g,w=A,b=x.SKIP={};function x(e,t,n){if(null==e)throw new Error("Ensure the DOM element that was passed to `m.route` is not undefined");var r,u=0,c=Object.keys(n).map(function(e){if("/"!==e[0])throw new SyntaxError("Routes must start with a `/`");if(/:([^\/\.-]+)(\.{3})?:/.test(e))throw new SyntaxError("Route parameter names must be separated with either `/`, `.`, or `-`");return{route:e,component:n[e],check:_(e)}}),o="function"==typeof E?E:setTimeout,f=T.resolve(),i=!1;if((s=null)!=t){var l=S(t);if(!c.some(function(e){return e.check(l)}))throw new ReferenceError("Default route doesn't match any known routes")}function a(){i=!1;var e=d.location.hash;"#"!==x.prefix[0]&&(e=d.location.search+e,"?"!==x.prefix[0]&&"/"!==(e=d.location.pathname+e)[0]&&(e="/"+e));var l=e.concat().replace(/(?:%[a-f89][a-f0-9])+/gim,decodeURIComponent).slice(x.prefix.length),a=S(l);function s(){if(l===t)throw new Error("Could not resolve default route "+t);m(t,null,{replace:!0})}j(a.params,d.history.state),function t(n){for(;n<c.length;n++)if(c[n].check(a)){var r=c[n].component,e=c[n].route,o=r,i=g=function(e){if(i===g){if(e===b)return t(n+1);h=null==e||"function"!=typeof e.view&&"function"!=typeof e?"div":e,v=a.params,y=l,g=null,w=r.render?r:null,2===u?p.redraw():(u=2,p.redraw.sync())}};return void(r.view||"function"==typeof r?(r={},i(o)):r.onmatch?f.then(function(){return r.onmatch(a.params,l,e)}).then(i,s):i("div"))}s()}(0)}return s=function(){i||(i=!0,o(a))},"function"==typeof d.history.pushState?(r=function(){d.removeEventListener("popstate",s,!1)},d.addEventListener("popstate",s,!1)):"#"===x.prefix[0]&&(s=null,r=function(){d.removeEventListener("hashchange",a,!1)},d.addEventListener("hashchange",a,!1)),p.mount(e,{onbeforeupdate:function(){return!(!(u=u?2:1)||A===w)},oncreate:a,onremove:r,view:function(){if(u&&A!==w){var e=[k(h,v.key,v)];return w&&(e=w.render(e[0])),e}}})}return x.set=function(e,t,n){null!=g&&((n=n||{}).replace=!0),g=null,m(e,t,n)},x.get=function(){return y},x.prefix="#!",x.Link={view:function(e){var n,r,o=e.attrs.options,t={};j(t,e.attrs),t.selector=t.options=t.key=t.oninit=t.oncreate=t.onbeforeupdate=t.onupdate=t.onbeforeremove=t.onremove=null;var i=l(e.attrs.selector||"a",t,e.children);return(i.attrs.disabled=Boolean(i.attrs.disabled))?(i.attrs.href=null,i.attrs["aria-disabled"]="true",i.attrs.onclick=null):(n=i.attrs.onclick,r=i.attrs.href,i.attrs.href=x.prefix+r,i.attrs.onclick=function(e){var t;"function"==typeof n?t=n.call(e.currentTarget,e):null==n||"object"!=typeof n||"function"==typeof n.handleEvent&&n.handleEvent(e),!1===t||e.defaultPrevented||0!==e.button&&0!==e.which&&1!==e.which||e.currentTarget.target&&"_self"!==e.currentTarget.target||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey||(e.preventDefault(),e.redraw=!1,x.set(r,null,o))}),i}},x.param=function(e){return v&&null!=e?v[e]:v},x}}).call(this,e("timers").setImmediate)},{"../pathname/assign":15,"../pathname/build":16,"../pathname/compileTemplate":17,"../pathname/parse":18,"../promise/promise":20,"../render/hyperscript":25,"../render/vnode":29,timers:34}],12:[function(e,t,n){"use strict";var r=e("./render/hyperscript");r.trust=e("./render/trust"),r.fragment=e("./render/fragment"),t.exports=r},{"./render/fragment":24,"./render/hyperscript":25,"./render/trust":28}],13:[function(e,t,n){"use strict";function r(){return o.apply(this,arguments)}var o=e("./hyperscript"),i=e("./request"),l=e("./mount-redraw");r.m=o,r.trust=o.trust,r.fragment=o.fragment,r.mount=l.mount,r.route=e("./route"),r.render=e("./render"),r.redraw=l.redraw,r.request=i.request,r.jsonp=i.jsonp,r.parseQueryString=e("./querystring/parse"),r.buildQueryString=e("./querystring/build"),r.parsePathname=e("./pathname/parse"),r.buildPathname=e("./pathname/build"),r.vnode=e("./render/vnode"),r.PromisePolyfill=e("./promise/polyfill"),t.exports=r},{"./hyperscript":12,"./mount-redraw":14,"./pathname/build":16,"./pathname/parse":18,"./promise/polyfill":19,"./querystring/build":21,"./querystring/parse":22,"./render":23,"./render/vnode":29,"./request":30,"./route":32}],14:[function(e,t,n){"use strict";var r=e("./render");t.exports=e("./api/mount-redraw")(r,requestAnimationFrame,console)},{"./api/mount-redraw":10,"./render":23}],15:[function(e,t,n){"use strict";t.exports=Object.assign||function(t,n){n&&Object.keys(n).forEach(function(e){t[e]=n[e]})}},{}],16:[function(e,t,n){"use strict";var h=e("../querystring/build"),v=e("./assign");t.exports=function(e,r){if(/:([^\/\.-]+)(\.{3})?:/.test(e))throw new SyntaxError("Template parameter names *must* be separated");if(null==r)return e;var t=e.indexOf("?"),n=e.indexOf("#"),o=n<0?e.length:n,i=t<0?o:t,l=e.slice(0,i),a={};v(a,r);var s=l.replace(/:([^\/\.-]+)(\.{3})?/g,function(e,t,n){return delete a[t],null==r[t]?e:n?r[t]:encodeURIComponent(String(r[t]))}),u=s.indexOf("?"),c=s.indexOf("#"),f=c<0?s.length:c,d=u<0?f:u,p=s.slice(0,d);0<=t&&(p+=e.slice(t,o)),0<=u&&(p+=(t<0?"?":"&")+s.slice(u,f));var m=h(a);return m&&(p+=(t<0&&u<0?"?":"&")+m),0<=n&&(p+=e.slice(n)),0<=c&&(p+=(n<0?"":"&")+s.slice(c)),p}},{"../querystring/build":21,"./assign":15}],17:[function(e,t,n){"use strict";var a=e("./parse");t.exports=function(e){var r=a(e),o=Object.keys(r.params),i=[],l=new RegExp("^"+r.path.replace(/:([^\/.-]+)(\.{3}|\.(?!\.)|-)?|[\\^$*+.()|\[\]{}]/g,function(e,t,n){return null==t?"\\"+e:(i.push({k:t,r:"..."===n}),"..."===n?"(.*)":"."===n?"([^/]+)\\.":"([^/]+)"+(n||""))})+"$");return function(e){for(var t=0;t<o.length;t++)if(r.params[o[t]]!==e.params[o[t]])return!1;if(!i.length)return l.test(e.path);var n=l.exec(e.path);if(null==n)return!1;for(t=0;t<i.length;t++)e.params[i[t].k]=i[t].r?n[t+1]:decodeURIComponent(n[t+1]);return!0}}},{"./parse":18}],18:[function(e,t,n){"use strict";var l=e("../querystring/parse");t.exports=function(e){var t=e.indexOf("?"),n=e.indexOf("#"),r=n<0?e.length:n,o=t<0?r:t,i=e.slice(0,o).replace(/\/{2,}/g,"/");return i?("/"!==i[0]&&(i="/"+i),1<i.length&&"/"===i[i.length-1]&&(i=i.slice(0,-1))):i="/",{path:i,params:t<0?{}:l(e.slice(t+1,r))}}},{"../querystring/parse":22}],19:[function(e,t,n){(function(n){"use strict";var d=function(e){if(!(this instanceof d))throw new Error("Promise must be called with `new`");if("function"!=typeof e)throw new TypeError("executor must be a function");var i=this,l=[],a=[],o=t(l,!0),s=t(a,!1),u=i._instance={resolvers:l,rejectors:a},c="function"==typeof n?n:setTimeout;function t(r,o){return function t(n){var e;try{if(!o||null==n||"object"!=typeof n&&"function"!=typeof n||"function"!=typeof(e=n.then))c(function(){o||0!==r.length||console.error("Possible unhandled promise rejection:",n);for(var e=0;e<r.length;e++)r[e](n);l.length=0,a.length=0,u.state=o,u.retry=function(){t(n)}});else{if(n===i)throw new TypeError("Promise can't be resolved w/ itself");f(e.bind(n))}}catch(e){s(e)}}}function f(e){var n=0;function t(t){return function(e){0<n++||t(e)}}var r=t(s);try{e(t(o),r)}catch(e){r(e)}}f(e)};d.prototype.then=function(e,t){var o,i,l=this._instance;function n(t,e,n,r){e.push(function(e){if("function"!=typeof t)n(e);else try{o(t(e))}catch(e){i&&i(e)}}),"function"==typeof l.retry&&r===l.state&&l.retry()}var r=new d(function(e,t){o=e,i=t});return n(e,l.resolvers,o,!0),n(t,l.rejectors,i,!1),r},d.prototype.catch=function(e){return this.then(null,e)},d.prototype.finally=function(t){return this.then(function(e){return d.resolve(t()).then(function(){return e})},function(e){return d.resolve(t()).then(function(){return d.reject(e)})})},d.resolve=function(t){return t instanceof d?t:new d(function(e){e(t)})},d.reject=function(n){return new d(function(e,t){t(n)})},d.all=function(a){return new d(function(n,r){var o=a.length,i=0,l=[];if(0===a.length)n([]);else for(var e=0;e<a.length;e++)!function(t){function e(e){i++,l[t]=e,i===o&&n(l)}null==a[t]||"object"!=typeof a[t]&&"function"!=typeof a[t]||"function"!=typeof a[t].then?e(a[t]):a[t].then(e,r)}(e)})},d.race=function(r){return new d(function(e,t){for(var n=0;n<r.length;n++)r[n].then(e,t)})},t.exports=d}).call(this,e("timers").setImmediate)},{timers:34}],20:[function(n,r,e){(function(e){"use strict";var t=n("./polyfill");"undefined"!=typeof window?(void 0===window.Promise?window.Promise=t:window.Promise.prototype.finally||(window.Promise.prototype.finally=t.prototype.finally),r.exports=window.Promise):void 0!==e?(void 0===e.Promise?e.Promise=t:e.Promise.prototype.finally||(e.Promise.prototype.finally=t.prototype.finally),r.exports=e.Promise):r.exports=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./polyfill":19}],21:[function(e,t,n){"use strict";t.exports=function(e){if("[object Object]"!==Object.prototype.toString.call(e))return"";var r=[];for(var t in e)o(t,e[t]);return r.join("&");function o(e,t){if(Array.isArray(t))for(var n=0;n<t.length;n++)o(e+"["+n+"]",t[n]);else if("[object Object]"===Object.prototype.toString.call(t))for(var n in t)o(e+"["+n+"]",t[n]);else r.push(encodeURIComponent(e)+(null!=t&&""!==t?"="+encodeURIComponent(t):""))}}},{}],22:[function(e,t,n){"use strict";t.exports=function(e){if(""===e||null==e)return{};"?"===e.charAt(0)&&(e=e.slice(1));for(var t=e.split("&"),n={},r={},o=0;o<t.length;o++){var i=t[o].split("="),l=decodeURIComponent(i[0]),a=2===i.length?decodeURIComponent(i[1]):"";"true"===a?a=!0:"false"===a&&(a=!1);var s=l.split(/\]\[?|\[/),u=r;-1<l.indexOf("[")&&s.pop();for(var c=0;c<s.length;c++){var f=s[c],d=s[c+1],p=""==d||!isNaN(parseInt(d,10));if(""===f)null==n[l=s.slice(0,c).join()]&&(n[l]=Array.isArray(u)?u.length:0),f=n[l]++;else if("__proto__"===f)break;if(c===s.length-1)u[f]=a;else{var m=Object.getOwnPropertyDescriptor(u,f);null!=m&&(m=m.value),null==m&&(u[f]=m=p?[]:{}),u=m}}}return r}},{}],23:[function(e,t,n){"use strict";t.exports=e("./render/render")(window)},{"./render/render":27}],24:[function(e,t,n){"use strict";var r=e("../render/vnode"),o=e("./hyperscriptVnode");t.exports=function(){var e=o.apply(0,arguments);return e.tag="[",e.children=r.normalizeChildren(e.children),e}},{"../render/vnode":29,"./hyperscriptVnode":26}],25:[function(e,t,n){"use strict";var s=e("../render/vnode"),r=e("./hyperscriptVnode"),u=/(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g,c={},f={}.hasOwnProperty;function d(e){for(var t in e)if(f.call(e,t))return!1;return!0}t.exports=function(e){if(null==e||"string"!=typeof e&&"function"!=typeof e&&"function"!=typeof e.view)throw Error("The selector must be either a string or a component.");var t=r.apply(1,arguments);return"string"==typeof e&&(t.children=s.normalizeChildren(t.children),"["!==e)?function(e,t){var n=t.attrs,r=s.normalizeChildren(t.children),o=f.call(n,"class"),i=o?n.class:n.className;if(t.tag=e.tag,t.attrs=null,t.children=void 0,!d(e.attrs)&&!d(n)){var l={};for(var a in n)f.call(n,a)&&(l[a]=n[a]);n=l}for(var a in e.attrs)f.call(e.attrs,a)&&"className"!==a&&!f.call(n,a)&&(n[a]=e.attrs[a]);for(var a in null==i&&null==e.attrs.className||(n.className=null!=i?null!=e.attrs.className?String(e.attrs.className)+" "+String(i):i:null!=e.attrs.className?e.attrs.className:null),o&&(n.class=null),n)if(f.call(n,a)&&"key"!==a){t.attrs=n;break}return Array.isArray(r)&&1===r.length&&null!=r[0]&&"#"===r[0].tag?t.text=r[0].children:t.children=r,t}(c[e]||function(e){for(var t,n="div",r=[],o={};t=u.exec(e);){var i=t[1],l=t[2];if(""===i&&""!==l)n=l;else if("#"===i)o.id=l;else if("."===i)r.push(l);else if("["===t[3][0]){var a=t[6];a=a&&a.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\"),"class"===t[4]?r.push(a):o[t[4]]=""===a?a:a||!0}}return 0<r.length&&(o.className=r.join(" ")),c[e]={tag:n,attrs:o}}(e),t):(t.tag=e,t)}},{"../render/vnode":29,"./hyperscriptVnode":26}],26:[function(e,t,n){"use strict";var r=e("../render/vnode");t.exports=function(){var e,t=arguments[this],n=this+1;if(null==t?t={}:"object"==typeof t&&null==t.tag&&!Array.isArray(t)||(t={},n=this),arguments.length===n+1)e=arguments[n],Array.isArray(e)||(e=[e]);else for(e=[];n<arguments.length;)e.push(arguments[n++]);return r("",t.key,t,e)}},{"../render/vnode":29}],27:[function(e,t,n){"use strict";var $=e("../render/vnode");t.exports=function(e){var s,c=e&&e.document,t={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"};function f(e){return e.attrs&&e.attrs.xmlns||t[e.tag]}function u(e,t){if(e.state!==t)throw new Error("`vnode.state` must not be modified")}function d(e){var t=e.state;try{return this.apply(t,arguments)}finally{u(e,t)}}function p(){try{return c.activeElement}catch(e){return null}}function A(e,t,n,r,o,i,l){for(var a=n;a<r;a++){var s=t[a];null!=s&&C(e,s,o,l,i)}}function C(e,t,n,r,o){var i=t.tag;if("string"==typeof i)switch(t.state={},null!=t.attrs&&_(t.attrs,t,n),i){case"#":!function(e,t,n){t.dom=c.createTextNode(t.children),v(e,t.dom,n)}(e,t,o);break;case"<":a(e,t,r,o);break;case"[":!function(e,t,n,r,o){var i=c.createDocumentFragment();if(null!=t.children){var l=t.children;A(i,l,0,l.length,n,null,r)}t.dom=i.firstChild,t.domSize=i.childNodes.length,v(e,i,o)}(e,t,n,r,o);break;default:!function(e,t,n,r,o){var i=t.tag,l=t.attrs,a=l&&l.is,s=(r=f(t)||r)?a?c.createElementNS(r,i,{is:a}):c.createElementNS(r,i):a?c.createElement(i,{is:a}):c.createElement(i);if(t.dom=s,null!=l&&function(e,t,n){for(var r in t)x(e,r,null,t[r],n)}(t,l,r),v(e,s,o),!y(t)&&(null!=t.text&&(""!==t.text?s.textContent=t.text:t.children=[$("#",void 0,void 0,t.text,void 0,void 0)]),null!=t.children)){var u=t.children;A(s,u,0,u.length,n,null,r),"select"===t.tag&&null!=l&&function(e,t){if("value"in t)if(null===t.value)-1!==e.dom.selectedIndex&&(e.dom.value=null);else{var n=""+t.value;e.dom.value===n&&-1!==e.dom.selectedIndex||(e.dom.value=n)}"selectedIndex"in t&&x(e,"selectedIndex",null,t.selectedIndex,void 0)}(t,l)}}(e,t,n,r,o)}else!function(e,t,n,r,o){(function(e,t){var n;if("function"==typeof e.tag.view){if(e.state=Object.create(e.tag),null!=(n=e.state.view).$$reentrantLock$$)return;n.$$reentrantLock$$=!0}else{if(e.state=void 0,null!=(n=e.tag).$$reentrantLock$$)return;n.$$reentrantLock$$=!0,e.state=null!=e.tag.prototype&&"function"==typeof e.tag.prototype.view?new e.tag(e):e.tag(e)}if(_(e.state,e,t),null!=e.attrs&&_(e.attrs,e,t),e.instance=$.normalize(d.call(e.state.view,e)),e.instance===e)throw Error("A view cannot return the vnode it received as argument");n.$$reentrantLock$$=null})(t,n),null!=t.instance?(C(e,t.instance,n,r,o),t.dom=t.instance.dom,t.domSize=null!=t.dom?t.instance.domSize:0):t.domSize=0}(e,t,n,r,o)}var m={caption:"table",thead:"table",tbody:"table",tfoot:"table",tr:"tbody",th:"tr",td:"tr",colgroup:"table",col:"colgroup"};function a(e,t,n,r){var o=t.children.match(/^\s*?<(\w+)/im)||[],i=c.createElement(m[o[1]]||"div");"http://www.w3.org/2000/svg"===n?(i.innerHTML='<svg xmlns="http://www.w3.org/2000/svg">'+t.children+"</svg>",i=i.firstChild):i.innerHTML=t.children,t.dom=i.firstChild,t.domSize=i.childNodes.length,t.instance=[];for(var l,a=c.createDocumentFragment();l=i.firstChild;)t.instance.push(l),a.appendChild(l);v(e,a,r)}function h(e,t,n,r,o,i){if(t!==n&&(null!=t||null!=n))if(null==t||0===t.length)A(e,n,0,n.length,r,o,i);else if(null==n||0===n.length)z(e,t,0,t.length);else{var l=null!=t[0]&&null!=t[0].key,a=null!=n[0]&&null!=n[0].key,s=0,u=0;if(!l)for(;u<t.length&&null==t[u];)u++;if(!a)for(;s<n.length&&null==n[s];)s++;if(null===a&&null==l)return;if(l!=a)z(e,t,u,t.length),A(e,n,s,n.length,r,o,i);else if(a){for(var c,f,d,p,m,h=t.length-1,v=n.length-1;u<=h&&s<=v&&(d=t[h],p=n[v],d.key===p.key);)d!==p&&N(e,d,p,r,o,i),null!=p.dom&&(o=p.dom),h--,v--;for(;u<=h&&s<=v&&(c=t[u],f=n[s],c.key===f.key);)u++,s++,c!==f&&N(e,c,f,r,L(t,u,o),i);for(;u<=h&&s<=v&&s!==v&&c.key===p.key&&d.key===f.key;)q(e,d,m=L(t,u,o)),d!==f&&N(e,d,f,r,m,i),++s<=--v&&q(e,c,o),c!==p&&N(e,c,p,r,o,i),null!=p.dom&&(o=p.dom),u++,d=t[--h],p=n[v],c=t[u],f=n[s];for(;u<=h&&s<=v&&d.key===p.key;)d!==p&&N(e,d,p,r,o,i),null!=p.dom&&(o=p.dom),v--,d=t[--h],p=n[v];if(v<s)z(e,t,u,h+1);else if(h<u)A(e,n,s,v+1,r,o,i);else{var y,g,w=o,b=v-s+1,x=new Array(b),E=0,k=0,T=2147483647,S=0;for(k=0;k<b;k++)x[k]=-1;for(k=v;s<=k;k--){null==y&&(y=I(t,u,h+1));var _=y[(p=n[k]).key];null!=_&&(T=_<T?_:-1,d=t[x[k-s]=_],t[_]=null,d!==p&&N(e,d,p,r,o,i),null!=p.dom&&(o=p.dom),S++)}if(o=w,S!==h-u+1&&z(e,t,u,h+1),0===S)A(e,n,s,v+1,r,o,i);else if(-1===T)for(E=(g=function(e){var t=[0],n=0,r=0,o=0,i=O.length=e.length;for(o=0;o<i;o++)O[o]=e[o];for(o=0;o<i;++o)if(-1!==e[o]){var l=t[t.length-1];if(e[l]<e[o])O[o]=l,t.push(o);else{for(n=0,r=t.length-1;n<r;){var a=(n>>>1)+(r>>>1)+(n&r&1);e[t[a]]<e[o]?n=1+a:r=a}e[o]<e[t[n]]&&(0<n&&(O[o]=t[n-1]),t[n]=o)}}for(n=t.length,r=t[n-1];0<n--;)t[n]=r,r=O[r];return O.length=0,t}(x)).length-1,k=v;s<=k;k--)f=n[k],-1===x[k-s]?C(e,f,r,i,o):g[E]===k-s?E--:q(e,f,o),null!=f.dom&&(o=n[k].dom);else for(k=v;s<=k;k--)f=n[k],-1===x[k-s]&&C(e,f,r,i,o),null!=f.dom&&(o=n[k].dom)}}else{var j=t.length<n.length?t.length:n.length;for(s=s<u?s:u;s<j;s++)(c=t[s])===(f=n[s])||null==c&&null==f||(null==c?C(e,f,r,i,L(t,s+1,o)):null==f?P(e,c):N(e,c,f,r,L(t,s+1,o),i));t.length>j&&z(e,t,s,t.length),n.length>j&&A(e,n,s,n.length,r,o,i)}}}function N(e,t,n,r,o,i){var l=t.tag;if(l===n.tag){if(n.state=t.state,n.events=t.events,function(e,t){do{var n;if(null!=e.attrs&&"function"==typeof e.attrs.onbeforeupdate&&void 0!==(n=d.call(e.attrs.onbeforeupdate,e,t))&&!n)break;if("string"!=typeof e.tag&&"function"==typeof e.state.onbeforeupdate&&void 0!==(n=d.call(e.state.onbeforeupdate,e,t))&&!n)break;return!1}while(0);return e.dom=t.dom,e.domSize=t.domSize,e.instance=t.instance,e.attrs=t.attrs,e.children=t.children,e.text=t.text,!0}(n,t))return;if("string"==typeof l)switch(null!=n.attrs&&j(n.attrs,n,r),l){case"#":!function(e,t){e.children.toString()!==t.children.toString()&&(e.dom.nodeValue=t.children),t.dom=e.dom}(t,n);break;case"<":!function(e,t,n,r,o){t.children!==n.children?(g(e,t),a(e,n,r,o)):(n.dom=t.dom,n.domSize=t.domSize,n.instance=t.instance)}(e,t,n,i,o);break;case"[":!function(e,t,n,r,o,i){h(e,t.children,n.children,r,o,i);var l=0,a=n.children;if((n.dom=null)!=a){for(var s=0;s<a.length;s++){var u=a[s];null!=u&&null!=u.dom&&(null==n.dom&&(n.dom=u.dom),l+=u.domSize||1)}1!==l&&(n.domSize=l)}}(e,t,n,r,o,i);break;default:!function(e,t,n,r){var o=t.dom=e.dom;r=f(t)||r,"textarea"===t.tag&&(null==t.attrs&&(t.attrs={}),null!=t.text&&(t.attrs.value=t.text,t.text=void 0)),function(e,t,n,r){if(null!=n)for(var o in n)x(e,o,t&&t[o],n[o],r);var i;if(null!=t)for(var o in t)null==(i=t[o])||null!=n&&null!=n[o]||E(e,o,i,r)}(t,e.attrs,t.attrs,r),y(t)||(null!=e.text&&null!=t.text&&""!==t.text?e.text.toString()!==t.text.toString()&&(e.dom.firstChild.nodeValue=t.text):(null!=e.text&&(e.children=[$("#",void 0,void 0,e.text,void 0,e.dom.firstChild)]),null!=t.text&&(t.children=[$("#",void 0,void 0,t.text,void 0,void 0)]),h(o,e.children,t.children,n,null,r)))}(t,n,r,i)}else!function(e,t,n,r,o,i){if(n.instance=$.normalize(d.call(n.state.view,n)),n.instance===n)throw Error("A view cannot return the vnode it received as argument");j(n.state,n,r),null!=n.attrs&&j(n.attrs,n,r),null!=n.instance?(null==t.instance?C(e,n.instance,r,i,o):N(e,t.instance,n.instance,r,o,i),n.dom=n.instance.dom,n.domSize=n.instance.domSize):null!=t.instance?(P(e,t.instance),n.dom=void 0,n.domSize=0):(n.dom=t.dom,n.domSize=t.domSize)}(e,t,n,r,o,i)}else P(e,t),C(e,n,r,i,o)}function I(e,t,n){for(var r=Object.create(null);t<n;t++){var o=e[t];if(null!=o){var i=o.key;null!=i&&(r[i]=t)}}return r}var O=[];function L(e,t,n){for(;t<e.length;t++)if(null!=e[t]&&null!=e[t].dom)return e[t].dom;return n}function q(e,t,n){var r=c.createDocumentFragment();!function e(t,n,r){for(;null!=r.dom&&r.dom.parentNode===t;){if("string"!=typeof r.tag){if(null!=(r=r.instance))continue}else if("<"===r.tag)for(var o=0;o<r.instance.length;o++)n.appendChild(r.instance[o]);else if("["!==r.tag)n.appendChild(r.dom);else if(1===r.children.length){if(null!=(r=r.children[0]))continue}else for(var o=0;o<r.children.length;o++){var i=r.children[o];null!=i&&e(t,n,i)}break}}(e,r,t),v(e,r,n)}function v(e,t,n){null!=n?e.insertBefore(t,n):e.appendChild(t)}function y(e){if(null==e.attrs||null==e.attrs.contenteditable&&null==e.attrs.contentEditable)return!1;var t=e.children;if(null!=t&&1===t.length&&"<"===t[0].tag){var n=t[0].children;e.dom.innerHTML!==n&&(e.dom.innerHTML=n)}else if(null!=e.text||null!=t&&0!==t.length)throw new Error("Child node of a contenteditable must be trusted");return!0}function z(e,t,n,r){for(var o=n;o<r;o++){var i=t[o];null!=i&&P(e,i)}}function P(e,t){var n,r,o,i=0,l=t.state;if("string"!=typeof t.tag&&"function"==typeof t.state.onbeforeremove&&null!=(o=d.call(t.state.onbeforeremove,t))&&"function"==typeof o.then&&(i=1,n=o),t.attrs&&"function"==typeof t.attrs.onbeforeremove&&null!=(o=d.call(t.attrs.onbeforeremove,t))&&"function"==typeof o.then&&(i|=2,r=o),u(t,l),i){if(null!=n){var a=function(){1&i&&((i&=2)||s())};n.then(a,a)}null!=r&&(a=function(){2&i&&((i&=1)||s())},r.then(a,a))}else b(t),w(e,t);function s(){u(t,l),b(t),w(e,t)}}function g(e,t){for(var n=0;n<t.instance.length;n++)e.removeChild(t.instance[n])}function w(e,t){for(;null!=t.dom&&t.dom.parentNode===e;){if("string"!=typeof t.tag){if(null!=(t=t.instance))continue}else if("<"===t.tag)g(e,t);else{if("["!==t.tag&&(e.removeChild(t.dom),!Array.isArray(t.children)))break;if(1===t.children.length){if(null!=(t=t.children[0]))continue}else for(var n=0;n<t.children.length;n++){var r=t.children[n];null!=r&&w(e,r)}}break}}function b(e){if("string"!=typeof e.tag&&"function"==typeof e.state.onremove&&d.call(e.state.onremove,e),e.attrs&&"function"==typeof e.attrs.onremove&&d.call(e.attrs.onremove,e),"string"!=typeof e.tag)null!=e.instance&&b(e.instance);else{var t=e.children;if(Array.isArray(t))for(var n=0;n<t.length;n++){var r=t[n];null!=r&&b(r)}}}function x(e,t,n,r,o){if("key"!==t&&"is"!==t&&null!=r&&!i(t)&&(n!==r||function(e,t){return"value"===t||"checked"===t||"selectedIndex"===t||"selected"===t&&e.dom===p()||"option"===e.tag&&e.dom.parentNode===c.activeElement}(e,t)||"object"==typeof r)){if("o"===t[0]&&"n"===t[1])return S(e,t,r);if("xlink:"===t.slice(0,6))e.dom.setAttributeNS("http://www.w3.org/1999/xlink",t.slice(6),r);else if("style"===t)T(e.dom,n,r);else if(l(e,t,o)){if("value"===t){if(("input"===e.tag||"textarea"===e.tag)&&e.dom.value===""+r&&e.dom===p())return;if("select"===e.tag&&null!==n&&e.dom.value===""+r)return;if("option"===e.tag&&null!==n&&e.dom.value===""+r)return}"input"===e.tag&&"type"===t?e.dom.setAttribute(t,r):e.dom[t]=r}else"boolean"==typeof r?r?e.dom.setAttribute(t,""):e.dom.removeAttribute(t):e.dom.setAttribute("className"===t?"class":t,r)}}function E(e,t,n,r){if("key"!==t&&"is"!==t&&null!=n&&!i(t))if("o"!==t[0]||"n"!==t[1]||i(t))if("style"===t)T(e.dom,n,null);else if(!l(e,t,r)||"className"===t||"value"===t&&("option"===e.tag||"select"===e.tag&&-1===e.dom.selectedIndex&&e.dom===p())||"input"===e.tag&&"type"===t){var o=t.indexOf(":");-1!==o&&(t=t.slice(o+1)),!1!==n&&e.dom.removeAttribute("className"===t?"class":t)}else e.dom[t]=null;else S(e,t,void 0)}function i(e){return"oninit"===e||"oncreate"===e||"onupdate"===e||"onremove"===e||"onbeforeremove"===e||"onbeforeupdate"===e}function l(e,t,n){return void 0===n&&(-1<e.tag.indexOf("-")||null!=e.attrs&&e.attrs.is||"href"!==t&&"list"!==t&&"form"!==t&&"width"!==t&&"height"!==t)&&t in e.dom}var n=/[A-Z]/g;function r(e){return"-"+e.toLowerCase()}function k(e){return"-"===e[0]&&"-"===e[1]?e:"cssFloat"===e?"float":e.replace(n,r)}function T(e,t,n){if(t===n);else if(null==n)e.style.cssText="";else if("object"!=typeof n)e.style.cssText=n;else if(null==t||"object"!=typeof t)for(var r in e.style.cssText="",n)null!=(o=n[r])&&e.style.setProperty(k(r),String(o));else{for(var r in n){var o;null!=(o=n[r])&&(o=String(o))!==String(t[r])&&e.style.setProperty(k(r),o)}for(var r in t)null!=t[r]&&null==n[r]&&e.style.removeProperty(k(r))}}function o(){this._=s}function S(e,t,n){if(null!=e.events){if(e.events[t]===n)return;null==n||"function"!=typeof n&&"object"!=typeof n?(null!=e.events[t]&&e.dom.removeEventListener(t.slice(2),e.events,!1),e.events[t]=void 0):(null==e.events[t]&&e.dom.addEventListener(t.slice(2),e.events,!1),e.events[t]=n)}else null==n||"function"!=typeof n&&"object"!=typeof n||(e.events=new o,e.dom.addEventListener(t.slice(2),e.events,!1),e.events[t]=n)}function _(e,t,n){"function"==typeof e.oninit&&d.call(e.oninit,t),"function"==typeof e.oncreate&&n.push(d.bind(e.oncreate,t))}function j(e,t,n){"function"==typeof e.onupdate&&n.push(d.bind(e.onupdate,t))}return(o.prototype=Object.create(null)).handleEvent=function(e){var t,n=this["on"+e.type];"function"==typeof n?t=n.call(e.currentTarget,e):"function"==typeof n.handleEvent&&n.handleEvent(e),this._&&!1!==e.redraw&&(0,this._)(),!1===t&&(e.preventDefault(),e.stopPropagation())},function(e,t,n){if(!e)throw new TypeError("Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.");var r=[],o=p(),i=e.namespaceURI;null==e.vnodes&&(e.textContent=""),t=$.normalizeChildren(Array.isArray(t)?t:[t]);var l=s;try{s="function"==typeof n?n:void 0,h(e,e.vnodes,t,r,null,"http://www.w3.org/1999/xhtml"===i?void 0:i)}finally{s=l}e.vnodes=t,null!=o&&p()!==o&&"function"==typeof o.focus&&o.focus();for(var a=0;a<r.length;a++)r[a]()}}},{"../render/vnode":29}],28:[function(e,t,n){"use strict";var r=e("../render/vnode");t.exports=function(e){return null==e&&(e=""),r("<",void 0,void 0,e,void 0,void 0)}},{"../render/vnode":29}],29:[function(e,t,n){"use strict";function o(e,t,n,r,o,i){return{tag:e,key:t,attrs:n,children:r,text:o,dom:i,domSize:void 0,state:void 0,events:void 0,instance:void 0}}o.normalize=function(e){return Array.isArray(e)?o("[",void 0,void 0,o.normalizeChildren(e),void 0,void 0):null==e||"boolean"==typeof e?null:"object"==typeof e?e:o("#",void 0,void 0,String(e),void 0,void 0)},o.normalizeChildren=function(e){var t=[];if(e.length){for(var n=null!=e[0]&&null!=e[0].key,r=1;r<e.length;r++)if((null!=e[r]&&null!=e[r].key)!=n)throw new TypeError("Vnodes must either always have keys or never have keys!");for(r=0;r<e.length;r++)t[r]=o.normalize(e[r])}return t},t.exports=o},{}],30:[function(e,t,n){"use strict";var r=e("./promise/promise"),o=e("./mount-redraw");t.exports=e("./request/request")(window,r,o.redraw)},{"./mount-redraw":14,"./promise/promise":20,"./request/request":31}],31:[function(e,t,n){"use strict";var u=e("../pathname/build");t.exports=function(m,n,a){var l=0;function s(e){return new n(e)}function e(l){return function(t,r){"string"!=typeof t?t=(r=t).url:null==r&&(r={});var e=new n(function(n,e){l(u(t,r.params),r,function(e){if("function"==typeof r.type)if(Array.isArray(e))for(var t=0;t<e.length;t++)e[t]=new r.type(e[t]);else e=new r.type(e);n(e)},e)});if(!0===r.background)return e;var o=0;function i(){0==--o&&"function"==typeof a&&a()}return function t(n){var r=n.then;return n.constructor=s,n.then=function(){o++;var e=r.apply(n,arguments);return e.then(i,function(e){if(i(),0===o)throw e}),t(e)},n}(e)}}function h(e,t){for(var n in e.headers)if({}.hasOwnProperty.call(e.headers,n)&&t.test(n))return!0;return!1}return s.prototype=n.prototype,s.__proto__=n,{request:e(function(i,l,a,s){var e,t=null!=l.method?l.method.toUpperCase():"GET",n=l.body,r=!(null!=l.serialize&&l.serialize!==JSON.serialize||n instanceof m.FormData),u=l.responseType||("function"==typeof l.extract?"":"json"),o=new m.XMLHttpRequest,c=!1,f=o,d=o.abort;for(var p in o.abort=function(){c=!0,d.call(this)},o.open(t,i,!1!==l.async,"string"==typeof l.user?l.user:void 0,"string"==typeof l.password?l.password:void 0),r&&null!=n&&!h(l,/^content-type$/i)&&o.setRequestHeader("Content-Type","application/json; charset=utf-8"),"function"==typeof l.deserialize||h(l,/^accept$/i)||o.setRequestHeader("Accept","application/json, text/*"),l.withCredentials&&(o.withCredentials=l.withCredentials),l.timeout&&(o.timeout=l.timeout),o.responseType=u,l.headers)!{}.hasOwnProperty.call(l.headers,p)||o.setRequestHeader(p,l.headers[p]);o.onreadystatechange=function(e){if(!c&&4===e.target.readyState)try{var t,n=200<=e.target.status&&e.target.status<300||304===e.target.status||/^file:\/\//i.test(i),r=e.target.response;if("json"===u?e.target.responseType||"function"==typeof l.extract||(r=JSON.parse(e.target.responseText)):u&&"text"!==u||null==r&&(r=e.target.responseText),"function"==typeof l.extract?(r=l.extract(e.target,l),n=!0):"function"==typeof l.deserialize&&(r=l.deserialize(r)),n)a(r);else{try{t=e.target.responseText}catch(e){t=r}var o=new Error(t);o.code=e.target.status,o.response=r,s(o)}}catch(e){s(e)}},"function"==typeof l.config&&(o=l.config(o,l,i)||o)!==f&&(e=o.abort,o.abort=function(){c=!0,e.call(this)}),null==n?o.send():"function"==typeof l.serialize?o.send(l.serialize(n)):n instanceof m.FormData?o.send(n):o.send(JSON.stringify(n))}),jsonp:e(function(e,t,n,r){var o=t.callbackName||"_mithril_"+Math.round(1e16*Math.random())+"_"+l++,i=m.document.createElement("script");m[o]=function(e){delete m[o],i.parentNode.removeChild(i),n(e)},i.onerror=function(){delete m[o],i.parentNode.removeChild(i),r(new Error("JSONP request failed"))},i.src=e+(e.indexOf("?")<0?"?":"&")+encodeURIComponent(t.callbackKey||"callback")+"="+encodeURIComponent(o),m.document.documentElement.appendChild(i)})}}},{"../pathname/build":16}],32:[function(e,t,n){"use strict";var r=e("./mount-redraw");t.exports=e("./api/router")(window,r)},{"./api/router":11,"./mount-redraw":14}],33:[function(e,t,n){var r,o,i=t.exports={};function l(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(r===setTimeout)return setTimeout(t,0);if((r===l||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:l}catch(e){r=l}try{o="function"==typeof clearTimeout?clearTimeout:a}catch(e){o=a}}();var u,c=[],f=!1,d=-1;function p(){f&&u&&(f=!1,u.length?c=u.concat(c):d=-1,c.length&&m())}function m(){if(!f){var e=s(p);f=!0;for(var t=c.length;t;){for(u=c,c=[];++d<t;)u&&u[d].run();d=-1,t=c.length}u=null,f=!1,function(t){if(o===clearTimeout)return clearTimeout(t);if((o===a||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(t);try{o(t)}catch(e){try{return o.call(null,t)}catch(e){return o.call(this,t)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new h(e,t)),1!==c.length||f||s(m)},h.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],34:[function(s,e,u){(function(e,t){var r=s("process/browser.js").nextTick,n=Function.prototype.apply,o=Array.prototype.slice,i={},l=0;function a(e,t){this._id=e,this._clearFn=t}u.setTimeout=function(){return new a(n.call(setTimeout,window,arguments),clearTimeout)},u.setInterval=function(){return new a(n.call(setInterval,window,arguments),clearInterval)},u.clearTimeout=u.clearInterval=function(e){e.close()},a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(window,this._id)},u.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},u.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},u._unrefActive=u.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;0<=t&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},u.setImmediate="function"==typeof e?e:function(e){var t=l++,n=!(arguments.length<2)&&o.call(arguments,1);return i[t]=!0,r(function(){i[t]&&(n?e.apply(null,n):e.call(null),u.clearImmediate(t))}),t},u.clearImmediate="function"==typeof t?t:function(e){delete i[e]}}).call(this,s("timers").setImmediate,s("timers").clearImmediate)},{"process/browser.js":33,timers:34}],35:[function(e,t,n){function f(r){document.addEventListener("mouseover",function(e){var t=e.target,n=r(t);(n=n||(t=t.parentElement)&&r(t))&&f.show(t,n,!0)})}f.show=function(e,t,n){var r,o,i,l,a,s="data-tlite";function u(){f.hide(r,!0)}function c(){i=i||function(a,e,t){var s=document.createElement("span"),n=t.grav||a.getAttribute("data-tlite")||"n";s.innerHTML=e,a.appendChild(s);var u=n[0]||"",c=n[1]||"";function r(){s.className="tlite tlite-"+u+c;var e=a.offsetTop,t=a.offsetLeft;s.offsetParent===a&&(e=t=0);var n=a.offsetWidth,r=a.offsetHeight,o=s.offsetHeight,i=s.offsetWidth,l=t+n/2;s.style.top=("s"===u?e-o-10:"n"===u?e+r+10:e+r/2-o/2)+"px",s.style.left=("w"===c?t:"e"===c?t+n-i:"w"===u?t+n+10:"e"===u?t-i-10:l-i/2)+"px"}r();var o=s.getBoundingClientRect();return"s"===u&&o.top<0?(u="n",r()):"n"===u&&o.bottom>window.innerHeight?(u="s",r()):"e"===u&&o.left<0?(u="w",r()):"w"===u&&o.right>window.innerWidth&&(u="e",r()),s.className+=" tlite-visible",s}(r,a,o)}t=t||{},(e.tooltip||(o=t,(r=e).addEventListener("mousedown",u),r.addEventListener("mouseleave",u),r.tooltip={show:function(){a=r.title||r.getAttribute(s)||a,r.title="",r.setAttribute(s,""),a&&!l&&(l=setTimeout(c,n?150:1))},hide:function(e){if(n===e){l=clearTimeout(l);var t=i&&i.parentNode;t&&t.removeChild(i),i=void 0}}})).show()},f.hide=function(e,t){e.tooltip&&e.tooltip.hide(t)},void 0!==t&&t.exports&&(t.exports=f)},{}]},{},[1]);
2
  //# sourceMappingURL=admin.min.js.map
1
+ !function i(l,a,s){function u(t,e){if(!a[t]){if(!l[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(c)return c(t,!0);var r=new Error("Cannot find module '"+t+"'");throw r.code="MODULE_NOT_FOUND",r}var o=a[t]={exports:{}};l[t][0].call(o.exports,function(e){return u(l[t][1][e]||e)},o,o.exports,i,l,a,s)}return a[t].exports}for(var c="function"==typeof require&&require,e=0;e<s.length;e++)u(s[e]);return u}({1:[function(e,t,n){"use strict";var r,o=(r=e("tlite"))&&r.__esModule?r:{default:r};var i=e("./admin/tabs.js"),l=e("./admin/settings.js"),a=e("./admin/helpers.js");(0,o.default)(function(e){return-1<e.className.indexOf("mc4wp-tooltip")}),e("./admin/list-fetcher.js"),e("./admin/fields/mailchimp-api-key.js"),e("./admin/list-overview.js"),e("./admin/show-if.js"),window.mc4wp=window.mc4wp||{},window.mc4wp.helpers=a,window.mc4wp.settings=l,window.mc4wp.tabs=i},{"./admin/fields/mailchimp-api-key.js":2,"./admin/helpers.js":3,"./admin/list-fetcher.js":4,"./admin/list-overview.js":5,"./admin/settings.js":6,"./admin/show-if.js":7,"./admin/tabs.js":8,tlite:35}],2:[function(e,t,n){"use strict";var r=document.getElementById("mailchimp_api_key");r&&r.addEventListener("change",function(e){var t=document.createElement("p");t.className="help red",t.innerText=window.mc4wp_vars.i18n.invalid_api_key,r.nextElementSibling.innerText===t.innerText&&r.nextElementSibling.parentElement.removeChild(r.nextElementSibling),r.value.match(/^[0-9a-zA-Z*]{32}-[a-z]{2}[0-9]{1,2}$/)||r.parentElement.insertBefore(t,r.nextElementSibling)})},{}],3:[function(e,t,n){"use strict";var r={debounce:function(r,o,i){var l;return function(){var e=this,t=arguments,n=i&&!l;clearTimeout(l),l=setTimeout(function(){l=null,i||r.apply(e,t)},o),n&&r.apply(e,t)}}};t.exports=r},{}],4:[function(e,t,n){"use strict";var r=window.mc4wp_vars,o=window.mc4wp_vars.i18n,i=window.mc4wp_vars.ajaxurl,l=e("mithril"),a={working:!1,done:!1,success:!1};function s(e){e&&e.preventDefault(),a.working=!0,a.done=!1,l.request({method:"POST",url:i+"?action=mc4wp_renew_mailchimp_lists",timeout:6e5}).then(function(e){a.success=!0,e&&window.setTimeout(function(){window.location.reload()},3e3)}).catch(function(e){a.success=!1}).finally(function(e){a.working=!1,a.done=!0,l.redraw()})}var u=document.getElementById("mc4wp-list-fetcher");u&&(r.mailchimp.api_connected&&0===r.mailchimp.lists.length&&s(),l.mount(u,{view:function(){return l("form",{method:"POST",onsubmit:s.bind(this)},[l("p",[l("input",{type:"submit",value:a.working?o.fetching_mailchimp_lists:o.renew_mailchimp_lists,className:"button",disabled:!!a.working}),l.trust(" &nbsp; "),a.working?[l("span.mc4wp-loader","Loading..."),l.trust(" &nbsp; ")]:"",a.done?[a.success?l("em.help.green",o.fetching_mailchimp_lists_done):l("em.help.red",o.fetching_mailchimp_lists_error)]:""])])}}))},{mithril:13}],5:[function(e,t,n){"use strict";var i=window.mc4wp_vars.ajaxurl,l=e("mithril");function r(e){e.preventDefault();var t=e.target,n=t.parentElement.parentElement.nextElementSibling,r=t.getAttribute("data-list-id"),o=n.querySelector("div");"none"===n.style.display?(l.request({method:"GET",url:i+"?action=mc4wp_get_list_details&ids="+r}).then(function(e){l.render(o,function(e){return[l("h3","Merge fields"),l("table.widefat.striped",[l("thead",[l("tr",[l("th","Name"),l("th","Tag"),l("th","Type")])]),l("tbody",e.merge_fields.map(function(e){return l("tr",[l("td",[e.name,e.required&&l("span.red","*")]),l("td",[l("code",e.tag)]),l("td",[e.type," ",e.options&&e.options.date_format?"("+e.options.date_format+")":"",e.options&&e.options.choices?"("+e.options.choices.join(", ")+")":""])])}))]),0<e.interest_categories.length&&[l("h3","Interest Categories"),l("table.striped.widefat",[l("thead",[l("tr",[l("th","Name"),l("th","Type"),l("th","Interests")])]),l("tbody",e.interest_categories.map(function(t){return l("tr",[l("td",[l("strong",t.title),l("br"),l("br"),"ID: ",l("code",t.id)]),l("td",t.type),l("td",[l("div.row",{style:"margin-bottom: 4px;"},[l("div.col.col-3",[l("strong",{style:"display: block; border-bottom: 1px solid #eee;"},"Name")]),l("div.col.col-3",[l("strong",{style:"display: block; border-bottom: 1px solid #eee;"},"ID")])]),Object.keys(t.interests).map(function(e){return l("div.row.tiny-margin",[l("div.col.col-3",t.interests[e]),l("div.col.col-3",[l("code",{title:"Interest ID"},e)]),l("br.clearfix.clear.cf")])})])])}))])]]}(e.shift()))}),n.style.display=""):n.style.display="none"}Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var o=document.getElementById("mc4wp-mailchimp-lists-overview");o&&o.addEventListener("click",function(e){e.target.matches(".mc4wp-mailchimp-list")&&r(e)})},{mithril:13}],6:[function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o=document.getElementById("mc4wp-admin").querySelectorAll(".mc4wp-list-input"),i=window.mc4wp_vars.mailchimp.lists,l=[],a={};function s(){return l=[],[].forEach.call(o,function(e){"boolean"==typeof e.checked&&!e.checked||"object"!==r(i[e.value])||l.push(i[e.value])}),function(){var e=document.querySelectorAll(".lists--only-selected > *");[].forEach.call(e,function(e){var t=0<function(t,n){return l.filter(function(e){return e[t]===n})}("id",e.getAttribute("data-list-id")).length;e.style.display=t?"":"none"})}(),function(e,t){a[e]=a[e]||[],a[e].forEach(function(e){return e.apply(null,t)})}("selectedLists.change",[l]),l}[].forEach.call(o,function(e){e.addEventListener("change",s)}),s(),t.exports={getSelectedLists:function(){return l},on:function(e,t){a[e]=a[e]||[],a[e].push(t)}}},{}],7:[function(e,t,n){"use strict";var r=document.querySelectorAll("[data-showif]");[].forEach.call(r,function(n){var r=JSON.parse(n.getAttribute("data-showif")),e=document.querySelectorAll('[name="'+r.element+'"]'),o=n.querySelectorAll("input,select,textarea:not([readonly])"),i=void 0===r.hide||r.hide;function t(){if("radio"!==this.type||this.checked){var e="checkbox"===this.type?this.checked:this.value,t=String(e)===String(r.value);i?(n.style.display=t?"":"none",n.style.visibility=t?"":"hidden"):n.style.opacity=t?"":"0.4",[].forEach.call(o,function(e){e.readOnly=!t})}}[].forEach.call(e,function(e){e.addEventListener("change",t),t.call(e)})})},{}],8:[function(e,t,n){"use strict";var i=e("./url.js"),o=document.getElementById("mc4wp-admin"),r=o.querySelectorAll(".tab"),l=o.querySelectorAll(".nav-tab"),a=o.querySelector('input[name="_wp_http_referer"]'),s=[];function u(e){for(var t=0;t<s.length;t++)if(s[t].id===e)return s[t];return null}function c(e,t){if("string"==typeof e&&(e=u(e)),!e)return!1;void 0===t&&(t=!0),[].forEach.call(r,function(e){e.className=e.className.replace("tab-active",""),e.style.display=" none"}),[].forEach.call(l,function(e){e.className=e.className.replace("nav-tab-active","")}),[].forEach.call(e.nav,function(e){e.className+=" nav-tab-active",e.blur()}),e.element.style.display="block",e.element.className+=" tab-active";var n=i.setParameter(window.location.href,"tab",e.id);return history.pushState&&t&&history.pushState(e.id,"",n),f(e),a.value=n,"function"==typeof window.tb_remove&&window.tb_remove(),window.mc4wp&&window.mc4wp.forms&&window.mc4wp.forms.editor&&window.mc4wp.forms.editor.refresh(),!0}function f(e){var t=document.title.split("-");document.title=document.title.replace(t[0],e.title+" ")}function d(e){var t=e.target,n=t.getAttribute("data-tab");if(!n){var r=t.className.match(/nav-tab-(\w+)?/);r&&(n=r[1])}if(!n){var o=i.parse(t.href);if(!o.tab)return;n=o.tab}return!c(n)||(e.preventDefault(),e.returnValue=!1)}Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),[].forEach.call(r,function(e,t){var n=e.id.substring(4),r=e.querySelector("h2:first-of-type").textContent;s.push({id:n,title:r,element:e,nav:o.querySelectorAll(".nav-tab-"+n),open:function(){return c(n)}})}),[].forEach.call(l,function(e){return e.addEventListener("click",d)}),document.body.addEventListener("click",function(e){e.target.matches(".tab-link")&&d(e)}),function(){var e=s.filter(function(e){return null!==e.element.offsetParent}).shift();if(e){var t=u(e.id.substring(4));t&&(history.replaceState&&null===history.state&&history.replaceState(t.id,""),f(t))}}(),window.addEventListener&&history.pushState&&window.addEventListener("popstate",function(e){return!e.state||c(e.state,!1)}),t.exports={open:c,get:u}},{"./url.js":9}],9:[function(e,t,n){"use strict";var o={parse:function(e){var t={},n=e.split("&");for(var r in n)if(n.hasOwnProperty(r)){var o=n[r].split("=");t[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return t},build:function(e){var t=[];for(var n in e)t.push(n+"="+encodeURIComponent(e[n]));return t.join("&")},setParameter:function(e,t,n){var r=o.parse(e);return r[t]=n,o.build(r)}};t.exports=o},{}],10:[function(e,t,n){"use strict";var s=e("../render/vnode");t.exports=function(r,e,t){var o=[],n=!1,i=!1;function l(){if(n)throw new Error("Nested m.redraw.sync() call");n=!0;for(var e=0;e<o.length;e+=2)try{r(o[e],s(o[e+1]),a)}catch(e){t.error(e)}n=!1}function a(){i||(i=!0,e(function(){i=!1,l()}))}return a.sync=l,{mount:function(e,t){if(null!=t&&null==t.view&&"function"!=typeof t)throw new TypeError("m.mount(element, component) expects a component, not a vnode");var n=o.indexOf(e);0<=n&&(o.splice(n,2),r(e,[],a)),null!=t&&(o.push(e,t),r(e,s(t),a))},redraw:a}}},{"../render/vnode":29}],11:[function(e,t,n){(function(E){"use strict";var k=e("../render/vnode"),l=e("../render/hyperscript"),S=e("../promise/promise"),i=e("../pathname/build"),T=e("../pathname/parse"),_=e("../pathname/compileTemplate"),j=e("../pathname/assign"),A={};t.exports=function(d,p){var s;function m(e,t,n){if(e=i(e,t),null!=s){s();var r=n?n.state:null,o=n?n.title:null;n&&n.replace?d.history.replaceState(r,o,x.prefix+e):d.history.pushState(r,o,x.prefix+e)}else d.location.href=x.prefix+e}var h,v,y,g,w=A,b=x.SKIP={};function x(e,t,n){if(null==e)throw new Error("Ensure the DOM element that was passed to `m.route` is not undefined");var r,u=0,c=Object.keys(n).map(function(e){if("/"!==e[0])throw new SyntaxError("Routes must start with a `/`");if(/:([^\/\.-]+)(\.{3})?:/.test(e))throw new SyntaxError("Route parameter names must be separated with either `/`, `.`, or `-`");return{route:e,component:n[e],check:_(e)}}),o="function"==typeof E?E:setTimeout,f=S.resolve(),i=!1;if((s=null)!=t){var l=T(t);if(!c.some(function(e){return e.check(l)}))throw new ReferenceError("Default route doesn't match any known routes")}function a(){i=!1;var e=d.location.hash;"#"!==x.prefix[0]&&(e=d.location.search+e,"?"!==x.prefix[0]&&"/"!==(e=d.location.pathname+e)[0]&&(e="/"+e));var l=e.concat().replace(/(?:%[a-f89][a-f0-9])+/gim,decodeURIComponent).slice(x.prefix.length),a=T(l);function s(){if(l===t)throw new Error("Could not resolve default route "+t);m(t,null,{replace:!0})}j(a.params,d.history.state),function t(n){for(;n<c.length;n++)if(c[n].check(a)){var r=c[n].component,e=c[n].route,o=r,i=g=function(e){if(i===g){if(e===b)return t(n+1);h=null==e||"function"!=typeof e.view&&"function"!=typeof e?"div":e,v=a.params,y=l,g=null,w=r.render?r:null,2===u?p.redraw():(u=2,p.redraw.sync())}};return void(r.view||"function"==typeof r?(r={},i(o)):r.onmatch?f.then(function(){return r.onmatch(a.params,l,e)}).then(i,s):i("div"))}s()}(0)}return s=function(){i||(i=!0,o(a))},"function"==typeof d.history.pushState?(r=function(){d.removeEventListener("popstate",s,!1)},d.addEventListener("popstate",s,!1)):"#"===x.prefix[0]&&(s=null,r=function(){d.removeEventListener("hashchange",a,!1)},d.addEventListener("hashchange",a,!1)),p.mount(e,{onbeforeupdate:function(){return!(!(u=u?2:1)||A===w)},oncreate:a,onremove:r,view:function(){if(u&&A!==w){var e=[k(h,v.key,v)];return w&&(e=w.render(e[0])),e}}})}return x.set=function(e,t,n){null!=g&&((n=n||{}).replace=!0),g=null,m(e,t,n)},x.get=function(){return y},x.prefix="#!",x.Link={view:function(e){var n,r,o=e.attrs.options,t={};j(t,e.attrs),t.selector=t.options=t.key=t.oninit=t.oncreate=t.onbeforeupdate=t.onupdate=t.onbeforeremove=t.onremove=null;var i=l(e.attrs.selector||"a",t,e.children);return(i.attrs.disabled=Boolean(i.attrs.disabled))?(i.attrs.href=null,i.attrs["aria-disabled"]="true",i.attrs.onclick=null):(n=i.attrs.onclick,r=i.attrs.href,i.attrs.href=x.prefix+r,i.attrs.onclick=function(e){var t;"function"==typeof n?t=n.call(e.currentTarget,e):null==n||"object"!=typeof n||"function"==typeof n.handleEvent&&n.handleEvent(e),!1===t||e.defaultPrevented||0!==e.button&&0!==e.which&&1!==e.which||e.currentTarget.target&&"_self"!==e.currentTarget.target||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey||(e.preventDefault(),e.redraw=!1,x.set(r,null,o))}),i}},x.param=function(e){return v&&null!=e?v[e]:v},x}}).call(this,e("timers").setImmediate)},{"../pathname/assign":15,"../pathname/build":16,"../pathname/compileTemplate":17,"../pathname/parse":18,"../promise/promise":20,"../render/hyperscript":25,"../render/vnode":29,timers:34}],12:[function(e,t,n){"use strict";var r=e("./render/hyperscript");r.trust=e("./render/trust"),r.fragment=e("./render/fragment"),t.exports=r},{"./render/fragment":24,"./render/hyperscript":25,"./render/trust":28}],13:[function(e,t,n){"use strict";function r(){return o.apply(this,arguments)}var o=e("./hyperscript"),i=e("./request"),l=e("./mount-redraw");r.m=o,r.trust=o.trust,r.fragment=o.fragment,r.mount=l.mount,r.route=e("./route"),r.render=e("./render"),r.redraw=l.redraw,r.request=i.request,r.jsonp=i.jsonp,r.parseQueryString=e("./querystring/parse"),r.buildQueryString=e("./querystring/build"),r.parsePathname=e("./pathname/parse"),r.buildPathname=e("./pathname/build"),r.vnode=e("./render/vnode"),r.PromisePolyfill=e("./promise/polyfill"),t.exports=r},{"./hyperscript":12,"./mount-redraw":14,"./pathname/build":16,"./pathname/parse":18,"./promise/polyfill":19,"./querystring/build":21,"./querystring/parse":22,"./render":23,"./render/vnode":29,"./request":30,"./route":32}],14:[function(e,t,n){"use strict";var r=e("./render");t.exports=e("./api/mount-redraw")(r,requestAnimationFrame,console)},{"./api/mount-redraw":10,"./render":23}],15:[function(e,t,n){"use strict";t.exports=Object.assign||function(t,n){n&&Object.keys(n).forEach(function(e){t[e]=n[e]})}},{}],16:[function(e,t,n){"use strict";var h=e("../querystring/build"),v=e("./assign");t.exports=function(e,r){if(/:([^\/\.-]+)(\.{3})?:/.test(e))throw new SyntaxError("Template parameter names *must* be separated");if(null==r)return e;var t=e.indexOf("?"),n=e.indexOf("#"),o=n<0?e.length:n,i=t<0?o:t,l=e.slice(0,i),a={};v(a,r);var s=l.replace(/:([^\/\.-]+)(\.{3})?/g,function(e,t,n){return delete a[t],null==r[t]?e:n?r[t]:encodeURIComponent(String(r[t]))}),u=s.indexOf("?"),c=s.indexOf("#"),f=c<0?s.length:c,d=u<0?f:u,p=s.slice(0,d);0<=t&&(p+=e.slice(t,o)),0<=u&&(p+=(t<0?"?":"&")+s.slice(u,f));var m=h(a);return m&&(p+=(t<0&&u<0?"?":"&")+m),0<=n&&(p+=e.slice(n)),0<=c&&(p+=(n<0?"":"&")+s.slice(c)),p}},{"../querystring/build":21,"./assign":15}],17:[function(e,t,n){"use strict";var a=e("./parse");t.exports=function(e){var r=a(e),o=Object.keys(r.params),i=[],l=new RegExp("^"+r.path.replace(/:([^\/.-]+)(\.{3}|\.(?!\.)|-)?|[\\^$*+.()|\[\]{}]/g,function(e,t,n){return null==t?"\\"+e:(i.push({k:t,r:"..."===n}),"..."===n?"(.*)":"."===n?"([^/]+)\\.":"([^/]+)"+(n||""))})+"$");return function(e){for(var t=0;t<o.length;t++)if(r.params[o[t]]!==e.params[o[t]])return!1;if(!i.length)return l.test(e.path);var n=l.exec(e.path);if(null==n)return!1;for(t=0;t<i.length;t++)e.params[i[t].k]=i[t].r?n[t+1]:decodeURIComponent(n[t+1]);return!0}}},{"./parse":18}],18:[function(e,t,n){"use strict";var l=e("../querystring/parse");t.exports=function(e){var t=e.indexOf("?"),n=e.indexOf("#"),r=n<0?e.length:n,o=t<0?r:t,i=e.slice(0,o).replace(/\/{2,}/g,"/");return i?("/"!==i[0]&&(i="/"+i),1<i.length&&"/"===i[i.length-1]&&(i=i.slice(0,-1))):i="/",{path:i,params:t<0?{}:l(e.slice(t+1,r))}}},{"../querystring/parse":22}],19:[function(e,t,n){(function(n){"use strict";var d=function(e){if(!(this instanceof d))throw new Error("Promise must be called with `new`");if("function"!=typeof e)throw new TypeError("executor must be a function");var i=this,l=[],a=[],o=t(l,!0),s=t(a,!1),u=i._instance={resolvers:l,rejectors:a},c="function"==typeof n?n:setTimeout;function t(r,o){return function t(n){var e;try{if(!o||null==n||"object"!=typeof n&&"function"!=typeof n||"function"!=typeof(e=n.then))c(function(){o||0!==r.length||console.error("Possible unhandled promise rejection:",n);for(var e=0;e<r.length;e++)r[e](n);l.length=0,a.length=0,u.state=o,u.retry=function(){t(n)}});else{if(n===i)throw new TypeError("Promise can't be resolved w/ itself");f(e.bind(n))}}catch(e){s(e)}}}function f(e){var n=0;function t(t){return function(e){0<n++||t(e)}}var r=t(s);try{e(t(o),r)}catch(e){r(e)}}f(e)};d.prototype.then=function(e,t){var o,i,l=this._instance;function n(t,e,n,r){e.push(function(e){if("function"!=typeof t)n(e);else try{o(t(e))}catch(e){i&&i(e)}}),"function"==typeof l.retry&&r===l.state&&l.retry()}var r=new d(function(e,t){o=e,i=t});return n(e,l.resolvers,o,!0),n(t,l.rejectors,i,!1),r},d.prototype.catch=function(e){return this.then(null,e)},d.prototype.finally=function(t){return this.then(function(e){return d.resolve(t()).then(function(){return e})},function(e){return d.resolve(t()).then(function(){return d.reject(e)})})},d.resolve=function(t){return t instanceof d?t:new d(function(e){e(t)})},d.reject=function(n){return new d(function(e,t){t(n)})},d.all=function(a){return new d(function(n,r){var o=a.length,i=0,l=[];if(0===a.length)n([]);else for(var e=0;e<a.length;e++)!function(t){function e(e){i++,l[t]=e,i===o&&n(l)}null==a[t]||"object"!=typeof a[t]&&"function"!=typeof a[t]||"function"!=typeof a[t].then?e(a[t]):a[t].then(e,r)}(e)})},d.race=function(r){return new d(function(e,t){for(var n=0;n<r.length;n++)r[n].then(e,t)})},t.exports=d}).call(this,e("timers").setImmediate)},{timers:34}],20:[function(n,r,e){(function(e){"use strict";var t=n("./polyfill");"undefined"!=typeof window?(void 0===window.Promise?window.Promise=t:window.Promise.prototype.finally||(window.Promise.prototype.finally=t.prototype.finally),r.exports=window.Promise):void 0!==e?(void 0===e.Promise?e.Promise=t:e.Promise.prototype.finally||(e.Promise.prototype.finally=t.prototype.finally),r.exports=e.Promise):r.exports=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./polyfill":19}],21:[function(e,t,n){"use strict";t.exports=function(e){if("[object Object]"!==Object.prototype.toString.call(e))return"";var r=[];for(var t in e)o(t,e[t]);return r.join("&");function o(e,t){if(Array.isArray(t))for(var n=0;n<t.length;n++)o(e+"["+n+"]",t[n]);else if("[object Object]"===Object.prototype.toString.call(t))for(var n in t)o(e+"["+n+"]",t[n]);else r.push(encodeURIComponent(e)+(null!=t&&""!==t?"="+encodeURIComponent(t):""))}}},{}],22:[function(e,t,n){"use strict";t.exports=function(e){if(""===e||null==e)return{};"?"===e.charAt(0)&&(e=e.slice(1));for(var t=e.split("&"),n={},r={},o=0;o<t.length;o++){var i=t[o].split("="),l=decodeURIComponent(i[0]),a=2===i.length?decodeURIComponent(i[1]):"";"true"===a?a=!0:"false"===a&&(a=!1);var s=l.split(/\]\[?|\[/),u=r;-1<l.indexOf("[")&&s.pop();for(var c=0;c<s.length;c++){var f=s[c],d=s[c+1],p=""==d||!isNaN(parseInt(d,10));if(""===f)null==n[l=s.slice(0,c).join()]&&(n[l]=Array.isArray(u)?u.length:0),f=n[l]++;else if("__proto__"===f)break;if(c===s.length-1)u[f]=a;else{var m=Object.getOwnPropertyDescriptor(u,f);null!=m&&(m=m.value),null==m&&(u[f]=m=p?[]:{}),u=m}}}return r}},{}],23:[function(e,t,n){"use strict";t.exports=e("./render/render")(window)},{"./render/render":27}],24:[function(e,t,n){"use strict";var r=e("../render/vnode"),o=e("./hyperscriptVnode");t.exports=function(){var e=o.apply(0,arguments);return e.tag="[",e.children=r.normalizeChildren(e.children),e}},{"../render/vnode":29,"./hyperscriptVnode":26}],25:[function(e,t,n){"use strict";var s=e("../render/vnode"),r=e("./hyperscriptVnode"),u=/(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g,c={},f={}.hasOwnProperty;function d(e){for(var t in e)if(f.call(e,t))return!1;return!0}t.exports=function(e){if(null==e||"string"!=typeof e&&"function"!=typeof e&&"function"!=typeof e.view)throw Error("The selector must be either a string or a component.");var t=r.apply(1,arguments);return"string"==typeof e&&(t.children=s.normalizeChildren(t.children),"["!==e)?function(e,t){var n=t.attrs,r=s.normalizeChildren(t.children),o=f.call(n,"class"),i=o?n.class:n.className;if(t.tag=e.tag,t.attrs=null,t.children=void 0,!d(e.attrs)&&!d(n)){var l={};for(var a in n)f.call(n,a)&&(l[a]=n[a]);n=l}for(var a in e.attrs)f.call(e.attrs,a)&&"className"!==a&&!f.call(n,a)&&(n[a]=e.attrs[a]);for(var a in null==i&&null==e.attrs.className||(n.className=null!=i?null!=e.attrs.className?String(e.attrs.className)+" "+String(i):i:null!=e.attrs.className?e.attrs.className:null),o&&(n.class=null),n)if(f.call(n,a)&&"key"!==a){t.attrs=n;break}return Array.isArray(r)&&1===r.length&&null!=r[0]&&"#"===r[0].tag?t.text=r[0].children:t.children=r,t}(c[e]||function(e){for(var t,n="div",r=[],o={};t=u.exec(e);){var i=t[1],l=t[2];if(""===i&&""!==l)n=l;else if("#"===i)o.id=l;else if("."===i)r.push(l);else if("["===t[3][0]){var a=t[6];a=a&&a.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\"),"class"===t[4]?r.push(a):o[t[4]]=""===a?a:a||!0}}return 0<r.length&&(o.className=r.join(" ")),c[e]={tag:n,attrs:o}}(e),t):(t.tag=e,t)}},{"../render/vnode":29,"./hyperscriptVnode":26}],26:[function(e,t,n){"use strict";var r=e("../render/vnode");t.exports=function(){var e,t=arguments[this],n=this+1;if(null==t?t={}:"object"==typeof t&&null==t.tag&&!Array.isArray(t)||(t={},n=this),arguments.length===n+1)e=arguments[n],Array.isArray(e)||(e=[e]);else for(e=[];n<arguments.length;)e.push(arguments[n++]);return r("",t.key,t,e)}},{"../render/vnode":29}],27:[function(e,t,n){"use strict";var $=e("../render/vnode");t.exports=function(e){var s,c=e&&e.document,t={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"};function f(e){return e.attrs&&e.attrs.xmlns||t[e.tag]}function u(e,t){if(e.state!==t)throw new Error("`vnode.state` must not be modified")}function d(e){var t=e.state;try{return this.apply(t,arguments)}finally{u(e,t)}}function p(){try{return c.activeElement}catch(e){return null}}function A(e,t,n,r,o,i,l){for(var a=n;a<r;a++){var s=t[a];null!=s&&C(e,s,o,l,i)}}function C(e,t,n,r,o){var i=t.tag;if("string"==typeof i)switch(t.state={},null!=t.attrs&&_(t.attrs,t,n),i){case"#":!function(e,t,n){t.dom=c.createTextNode(t.children),v(e,t.dom,n)}(e,t,o);break;case"<":a(e,t,r,o);break;case"[":!function(e,t,n,r,o){var i=c.createDocumentFragment();if(null!=t.children){var l=t.children;A(i,l,0,l.length,n,null,r)}t.dom=i.firstChild,t.domSize=i.childNodes.length,v(e,i,o)}(e,t,n,r,o);break;default:!function(e,t,n,r,o){var i=t.tag,l=t.attrs,a=l&&l.is,s=(r=f(t)||r)?a?c.createElementNS(r,i,{is:a}):c.createElementNS(r,i):a?c.createElement(i,{is:a}):c.createElement(i);t.dom=s,null!=l&&function(e,t,n){for(var r in t)x(e,r,null,t[r],n)}(t,l,r);if(v(e,s,o),!y(t)&&(null!=t.text&&(""!==t.text?s.textContent=t.text:t.children=[$("#",void 0,void 0,t.text,void 0,void 0)]),null!=t.children)){var u=t.children;A(s,u,0,u.length,n,null,r),"select"===t.tag&&null!=l&&function(e,t){if("value"in t)if(null===t.value)-1!==e.dom.selectedIndex&&(e.dom.value=null);else{var n=""+t.value;e.dom.value===n&&-1!==e.dom.selectedIndex||(e.dom.value=n)}"selectedIndex"in t&&x(e,"selectedIndex",null,t.selectedIndex,void 0)}(t,l)}}(e,t,n,r,o)}else!function(e,t,n,r,o){(function(e,t){var n;if("function"==typeof e.tag.view){if(e.state=Object.create(e.tag),null!=(n=e.state.view).$$reentrantLock$$)return;n.$$reentrantLock$$=!0}else{if(e.state=void 0,null!=(n=e.tag).$$reentrantLock$$)return;n.$$reentrantLock$$=!0,e.state=null!=e.tag.prototype&&"function"==typeof e.tag.prototype.view?new e.tag(e):e.tag(e)}_(e.state,e,t),null!=e.attrs&&_(e.attrs,e,t);if(e.instance=$.normalize(d.call(e.state.view,e)),e.instance===e)throw Error("A view cannot return the vnode it received as argument");n.$$reentrantLock$$=null})(t,n),null!=t.instance?(C(e,t.instance,n,r,o),t.dom=t.instance.dom,t.domSize=null!=t.dom?t.instance.domSize:0):t.domSize=0}(e,t,n,r,o)}var m={caption:"table",thead:"table",tbody:"table",tfoot:"table",tr:"tbody",th:"tr",td:"tr",colgroup:"table",col:"colgroup"};function a(e,t,n,r){var o=t.children.match(/^\s*?<(\w+)/im)||[],i=c.createElement(m[o[1]]||"div");"http://www.w3.org/2000/svg"===n?(i.innerHTML='<svg xmlns="http://www.w3.org/2000/svg">'+t.children+"</svg>",i=i.firstChild):i.innerHTML=t.children,t.dom=i.firstChild,t.domSize=i.childNodes.length,t.instance=[];for(var l,a=c.createDocumentFragment();l=i.firstChild;)t.instance.push(l),a.appendChild(l);v(e,a,r)}function h(e,t,n,r,o,i){if(t!==n&&(null!=t||null!=n))if(null==t||0===t.length)A(e,n,0,n.length,r,o,i);else if(null==n||0===n.length)z(e,t,0,t.length);else{var l=null!=t[0]&&null!=t[0].key,a=null!=n[0]&&null!=n[0].key,s=0,u=0;if(!l)for(;u<t.length&&null==t[u];)u++;if(!a)for(;s<n.length&&null==n[s];)s++;if(null===a&&null==l)return;if(l!=a)z(e,t,u,t.length),A(e,n,s,n.length,r,o,i);else if(a){for(var c,f,d,p,m,h=t.length-1,v=n.length-1;u<=h&&s<=v&&(d=t[h],p=n[v],d.key===p.key);)d!==p&&N(e,d,p,r,o,i),null!=p.dom&&(o=p.dom),h--,v--;for(;u<=h&&s<=v&&(c=t[u],f=n[s],c.key===f.key);)u++,s++,c!==f&&N(e,c,f,r,L(t,u,o),i);for(;u<=h&&s<=v&&s!==v&&c.key===p.key&&d.key===f.key;)q(e,d,m=L(t,u,o)),d!==f&&N(e,d,f,r,m,i),++s<=--v&&q(e,c,o),c!==p&&N(e,c,p,r,o,i),null!=p.dom&&(o=p.dom),u++,d=t[--h],p=n[v],c=t[u],f=n[s];for(;u<=h&&s<=v&&d.key===p.key;)d!==p&&N(e,d,p,r,o,i),null!=p.dom&&(o=p.dom),v--,d=t[--h],p=n[v];if(v<s)z(e,t,u,h+1);else if(h<u)A(e,n,s,v+1,r,o,i);else{var y,g,w=o,b=v-s+1,x=new Array(b),E=0,k=0,S=2147483647,T=0;for(k=0;k<b;k++)x[k]=-1;for(k=v;s<=k;k--){null==y&&(y=I(t,u,h+1));var _=y[(p=n[k]).key];null!=_&&(S=_<S?_:-1,d=t[x[k-s]=_],t[_]=null,d!==p&&N(e,d,p,r,o,i),null!=p.dom&&(o=p.dom),T++)}if(o=w,T!==h-u+1&&z(e,t,u,h+1),0===T)A(e,n,s,v+1,r,o,i);else if(-1===S)for(E=(g=function(e){var t=[0],n=0,r=0,o=0,i=O.length=e.length;for(o=0;o<i;o++)O[o]=e[o];for(o=0;o<i;++o)if(-1!==e[o]){var l=t[t.length-1];if(e[l]<e[o])O[o]=l,t.push(o);else{for(n=0,r=t.length-1;n<r;){var a=(n>>>1)+(r>>>1)+(n&r&1);e[t[a]]<e[o]?n=1+a:r=a}e[o]<e[t[n]]&&(0<n&&(O[o]=t[n-1]),t[n]=o)}}n=t.length,r=t[n-1];for(;0<n--;)t[n]=r,r=O[r];return O.length=0,t}(x)).length-1,k=v;s<=k;k--)f=n[k],-1===x[k-s]?C(e,f,r,i,o):g[E]===k-s?E--:q(e,f,o),null!=f.dom&&(o=n[k].dom);else for(k=v;s<=k;k--)f=n[k],-1===x[k-s]&&C(e,f,r,i,o),null!=f.dom&&(o=n[k].dom)}}else{var j=t.length<n.length?t.length:n.length;for(s=s<u?s:u;s<j;s++)(c=t[s])===(f=n[s])||null==c&&null==f||(null==c?C(e,f,r,i,L(t,s+1,o)):null==f?P(e,c):N(e,c,f,r,L(t,s+1,o),i));t.length>j&&z(e,t,s,t.length),n.length>j&&A(e,n,s,n.length,r,o,i)}}}function N(e,t,n,r,o,i){var l=t.tag;if(l===n.tag){if(n.state=t.state,n.events=t.events,function(e,t){do{var n;if(null!=e.attrs&&"function"==typeof e.attrs.onbeforeupdate)if(void 0!==(n=d.call(e.attrs.onbeforeupdate,e,t))&&!n)break;if("string"!=typeof e.tag&&"function"==typeof e.state.onbeforeupdate)if(void 0!==(n=d.call(e.state.onbeforeupdate,e,t))&&!n)break;return!1}while(0);return e.dom=t.dom,e.domSize=t.domSize,e.instance=t.instance,e.attrs=t.attrs,e.children=t.children,e.text=t.text,!0}(n,t))return;if("string"==typeof l)switch(null!=n.attrs&&j(n.attrs,n,r),l){case"#":!function(e,t){e.children.toString()!==t.children.toString()&&(e.dom.nodeValue=t.children);t.dom=e.dom}(t,n);break;case"<":!function(e,t,n,r,o){t.children!==n.children?(g(e,t),a(e,n,r,o)):(n.dom=t.dom,n.domSize=t.domSize,n.instance=t.instance)}(e,t,n,i,o);break;case"[":!function(e,t,n,r,o,i){h(e,t.children,n.children,r,o,i);var l=0,a=n.children;if((n.dom=null)!=a){for(var s=0;s<a.length;s++){var u=a[s];null!=u&&null!=u.dom&&(null==n.dom&&(n.dom=u.dom),l+=u.domSize||1)}1!==l&&(n.domSize=l)}}(e,t,n,r,o,i);break;default:!function(e,t,n,r){var o=t.dom=e.dom;r=f(t)||r,"textarea"===t.tag&&(null==t.attrs&&(t.attrs={}),null!=t.text&&(t.attrs.value=t.text,t.text=void 0));(function(e,t,n,r){if(null!=n)for(var o in n)x(e,o,t&&t[o],n[o],r);var i;if(null!=t)for(var o in t)null==(i=t[o])||null!=n&&null!=n[o]||E(e,o,i,r)})(t,e.attrs,t.attrs,r),y(t)||(null!=e.text&&null!=t.text&&""!==t.text?e.text.toString()!==t.text.toString()&&(e.dom.firstChild.nodeValue=t.text):(null!=e.text&&(e.children=[$("#",void 0,void 0,e.text,void 0,e.dom.firstChild)]),null!=t.text&&(t.children=[$("#",void 0,void 0,t.text,void 0,void 0)]),h(o,e.children,t.children,n,null,r)))}(t,n,r,i)}else!function(e,t,n,r,o,i){if(n.instance=$.normalize(d.call(n.state.view,n)),n.instance===n)throw Error("A view cannot return the vnode it received as argument");j(n.state,n,r),null!=n.attrs&&j(n.attrs,n,r);null!=n.instance?(null==t.instance?C(e,n.instance,r,i,o):N(e,t.instance,n.instance,r,o,i),n.dom=n.instance.dom,n.domSize=n.instance.domSize):null!=t.instance?(P(e,t.instance),n.dom=void 0,n.domSize=0):(n.dom=t.dom,n.domSize=t.domSize)}(e,t,n,r,o,i)}else P(e,t),C(e,n,r,i,o)}function I(e,t,n){for(var r=Object.create(null);t<n;t++){var o=e[t];if(null!=o){var i=o.key;null!=i&&(r[i]=t)}}return r}var O=[];function L(e,t,n){for(;t<e.length;t++)if(null!=e[t]&&null!=e[t].dom)return e[t].dom;return n}function q(e,t,n){var r=c.createDocumentFragment();!function e(t,n,r){for(;null!=r.dom&&r.dom.parentNode===t;){if("string"!=typeof r.tag){if(null!=(r=r.instance))continue}else if("<"===r.tag)for(var o=0;o<r.instance.length;o++)n.appendChild(r.instance[o]);else if("["!==r.tag)n.appendChild(r.dom);else if(1===r.children.length){if(null!=(r=r.children[0]))continue}else for(var o=0;o<r.children.length;o++){var i=r.children[o];null!=i&&e(t,n,i)}break}}(e,r,t),v(e,r,n)}function v(e,t,n){null!=n?e.insertBefore(t,n):e.appendChild(t)}function y(e){if(null==e.attrs||null==e.attrs.contenteditable&&null==e.attrs.contentEditable)return!1;var t=e.children;if(null!=t&&1===t.length&&"<"===t[0].tag){var n=t[0].children;e.dom.innerHTML!==n&&(e.dom.innerHTML=n)}else if(null!=e.text||null!=t&&0!==t.length)throw new Error("Child node of a contenteditable must be trusted");return!0}function z(e,t,n,r){for(var o=n;o<r;o++){var i=t[o];null!=i&&P(e,i)}}function P(e,t){var n,r,o,i=0,l=t.state;"string"!=typeof t.tag&&"function"==typeof t.state.onbeforeremove&&null!=(o=d.call(t.state.onbeforeremove,t))&&"function"==typeof o.then&&(i=1,n=o);t.attrs&&"function"==typeof t.attrs.onbeforeremove&&null!=(o=d.call(t.attrs.onbeforeremove,t))&&"function"==typeof o.then&&(i|=2,r=o);if(u(t,l),i){if(null!=n){var a=function(){1&i&&((i&=2)||s())};n.then(a,a)}if(null!=r){a=function(){2&i&&((i&=1)||s())};r.then(a,a)}}else b(t),w(e,t);function s(){u(t,l),b(t),w(e,t)}}function g(e,t){for(var n=0;n<t.instance.length;n++)e.removeChild(t.instance[n])}function w(e,t){for(;null!=t.dom&&t.dom.parentNode===e;){if("string"!=typeof t.tag){if(null!=(t=t.instance))continue}else if("<"===t.tag)g(e,t);else{if("["!==t.tag&&(e.removeChild(t.dom),!Array.isArray(t.children)))break;if(1===t.children.length){if(null!=(t=t.children[0]))continue}else for(var n=0;n<t.children.length;n++){var r=t.children[n];null!=r&&w(e,r)}}break}}function b(e){if("string"!=typeof e.tag&&"function"==typeof e.state.onremove&&d.call(e.state.onremove,e),e.attrs&&"function"==typeof e.attrs.onremove&&d.call(e.attrs.onremove,e),"string"!=typeof e.tag)null!=e.instance&&b(e.instance);else{var t=e.children;if(Array.isArray(t))for(var n=0;n<t.length;n++){var r=t[n];null!=r&&b(r)}}}function x(e,t,n,r,o){if("key"!==t&&"is"!==t&&null!=r&&!i(t)&&(n!==r||function(e,t){return"value"===t||"checked"===t||"selectedIndex"===t||"selected"===t&&e.dom===p()||"option"===e.tag&&e.dom.parentNode===c.activeElement}(e,t)||"object"==typeof r)){if("o"===t[0]&&"n"===t[1])return T(e,t,r);if("xlink:"===t.slice(0,6))e.dom.setAttributeNS("http://www.w3.org/1999/xlink",t.slice(6),r);else if("style"===t)S(e.dom,n,r);else if(l(e,t,o)){if("value"===t){if(("input"===e.tag||"textarea"===e.tag)&&e.dom.value===""+r&&e.dom===p())return;if("select"===e.tag&&null!==n&&e.dom.value===""+r)return;if("option"===e.tag&&null!==n&&e.dom.value===""+r)return}"input"===e.tag&&"type"===t?e.dom.setAttribute(t,r):e.dom[t]=r}else"boolean"==typeof r?r?e.dom.setAttribute(t,""):e.dom.removeAttribute(t):e.dom.setAttribute("className"===t?"class":t,r)}}function E(e,t,n,r){if("key"!==t&&"is"!==t&&null!=n&&!i(t))if("o"!==t[0]||"n"!==t[1]||i(t))if("style"===t)S(e.dom,n,null);else if(!l(e,t,r)||"className"===t||"value"===t&&("option"===e.tag||"select"===e.tag&&-1===e.dom.selectedIndex&&e.dom===p())||"input"===e.tag&&"type"===t){var o=t.indexOf(":");-1!==o&&(t=t.slice(o+1)),!1!==n&&e.dom.removeAttribute("className"===t?"class":t)}else e.dom[t]=null;else T(e,t,void 0)}function i(e){return"oninit"===e||"oncreate"===e||"onupdate"===e||"onremove"===e||"onbeforeremove"===e||"onbeforeupdate"===e}function l(e,t,n){return void 0===n&&(-1<e.tag.indexOf("-")||null!=e.attrs&&e.attrs.is||"href"!==t&&"list"!==t&&"form"!==t&&"width"!==t&&"height"!==t)&&t in e.dom}var n=/[A-Z]/g;function r(e){return"-"+e.toLowerCase()}function k(e){return"-"===e[0]&&"-"===e[1]?e:"cssFloat"===e?"float":e.replace(n,r)}function S(e,t,n){if(t===n);else if(null==n)e.style.cssText="";else if("object"!=typeof n)e.style.cssText=n;else if(null==t||"object"!=typeof t)for(var r in e.style.cssText="",n){null!=(o=n[r])&&e.style.setProperty(k(r),String(o))}else{for(var r in n){var o;null!=(o=n[r])&&(o=String(o))!==String(t[r])&&e.style.setProperty(k(r),o)}for(var r in t)null!=t[r]&&null==n[r]&&e.style.removeProperty(k(r))}}function o(){this._=s}function T(e,t,n){if(null!=e.events){if(e.events[t]===n)return;null==n||"function"!=typeof n&&"object"!=typeof n?(null!=e.events[t]&&e.dom.removeEventListener(t.slice(2),e.events,!1),e.events[t]=void 0):(null==e.events[t]&&e.dom.addEventListener(t.slice(2),e.events,!1),e.events[t]=n)}else null==n||"function"!=typeof n&&"object"!=typeof n||(e.events=new o,e.dom.addEventListener(t.slice(2),e.events,!1),e.events[t]=n)}function _(e,t,n){"function"==typeof e.oninit&&d.call(e.oninit,t),"function"==typeof e.oncreate&&n.push(d.bind(e.oncreate,t))}function j(e,t,n){"function"==typeof e.onupdate&&n.push(d.bind(e.onupdate,t))}return(o.prototype=Object.create(null)).handleEvent=function(e){var t,n=this["on"+e.type];"function"==typeof n?t=n.call(e.currentTarget,e):"function"==typeof n.handleEvent&&n.handleEvent(e),this._&&!1!==e.redraw&&(0,this._)(),!1===t&&(e.preventDefault(),e.stopPropagation())},function(e,t,n){if(!e)throw new TypeError("Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.");var r=[],o=p(),i=e.namespaceURI;null==e.vnodes&&(e.textContent=""),t=$.normalizeChildren(Array.isArray(t)?t:[t]);var l=s;try{s="function"==typeof n?n:void 0,h(e,e.vnodes,t,r,null,"http://www.w3.org/1999/xhtml"===i?void 0:i)}finally{s=l}e.vnodes=t,null!=o&&p()!==o&&"function"==typeof o.focus&&o.focus();for(var a=0;a<r.length;a++)r[a]()}}},{"../render/vnode":29}],28:[function(e,t,n){"use strict";var r=e("../render/vnode");t.exports=function(e){return null==e&&(e=""),r("<",void 0,void 0,e,void 0,void 0)}},{"../render/vnode":29}],29:[function(e,t,n){"use strict";function o(e,t,n,r,o,i){return{tag:e,key:t,attrs:n,children:r,text:o,dom:i,domSize:void 0,state:void 0,events:void 0,instance:void 0}}o.normalize=function(e){return Array.isArray(e)?o("[",void 0,void 0,o.normalizeChildren(e),void 0,void 0):null==e||"boolean"==typeof e?null:"object"==typeof e?e:o("#",void 0,void 0,String(e),void 0,void 0)},o.normalizeChildren=function(e){var t=[];if(e.length){for(var n=null!=e[0]&&null!=e[0].key,r=1;r<e.length;r++)if((null!=e[r]&&null!=e[r].key)!=n)throw new TypeError("Vnodes must either always have keys or never have keys!");for(r=0;r<e.length;r++)t[r]=o.normalize(e[r])}return t},t.exports=o},{}],30:[function(e,t,n){"use strict";var r=e("./promise/promise"),o=e("./mount-redraw");t.exports=e("./request/request")(window,r,o.redraw)},{"./mount-redraw":14,"./promise/promise":20,"./request/request":31}],31:[function(e,t,n){"use strict";var u=e("../pathname/build");t.exports=function(m,n,a){var l=0;function s(e){return new n(e)}function e(l){return function(t,r){"string"!=typeof t?t=(r=t).url:null==r&&(r={});var e=new n(function(n,e){l(u(t,r.params),r,function(e){if("function"==typeof r.type)if(Array.isArray(e))for(var t=0;t<e.length;t++)e[t]=new r.type(e[t]);else e=new r.type(e);n(e)},e)});if(!0===r.background)return e;var o=0;function i(){0==--o&&"function"==typeof a&&a()}return function t(n){var r=n.then;n.constructor=s;n.then=function(){o++;var e=r.apply(n,arguments);return e.then(i,function(e){if(i(),0===o)throw e}),t(e)};return n}(e)}}function h(e,t){for(var n in e.headers)if({}.hasOwnProperty.call(e.headers,n)&&t.test(n))return!0;return!1}return s.prototype=n.prototype,s.__proto__=n,{request:e(function(i,l,a,s){var e,t=null!=l.method?l.method.toUpperCase():"GET",n=l.body,r=!(null!=l.serialize&&l.serialize!==JSON.serialize||n instanceof m.FormData),u=l.responseType||("function"==typeof l.extract?"":"json"),o=new m.XMLHttpRequest,c=!1,f=o,d=o.abort;for(var p in o.abort=function(){c=!0,d.call(this)},o.open(t,i,!1!==l.async,"string"==typeof l.user?l.user:void 0,"string"==typeof l.password?l.password:void 0),r&&null!=n&&!h(l,/^content-type$/i)&&o.setRequestHeader("Content-Type","application/json; charset=utf-8"),"function"==typeof l.deserialize||h(l,/^accept$/i)||o.setRequestHeader("Accept","application/json, text/*"),l.withCredentials&&(o.withCredentials=l.withCredentials),l.timeout&&(o.timeout=l.timeout),o.responseType=u,l.headers)!{}.hasOwnProperty.call(l.headers,p)||o.setRequestHeader(p,l.headers[p]);o.onreadystatechange=function(e){if(!c&&4===e.target.readyState)try{var t,n=200<=e.target.status&&e.target.status<300||304===e.target.status||/^file:\/\//i.test(i),r=e.target.response;if("json"===u?e.target.responseType||"function"==typeof l.extract||(r=JSON.parse(e.target.responseText)):u&&"text"!==u||null==r&&(r=e.target.responseText),"function"==typeof l.extract?(r=l.extract(e.target,l),n=!0):"function"==typeof l.deserialize&&(r=l.deserialize(r)),n)a(r);else{try{t=e.target.responseText}catch(e){t=r}var o=new Error(t);o.code=e.target.status,o.response=r,s(o)}}catch(e){s(e)}},"function"==typeof l.config&&(o=l.config(o,l,i)||o)!==f&&(e=o.abort,o.abort=function(){c=!0,e.call(this)}),null==n?o.send():"function"==typeof l.serialize?o.send(l.serialize(n)):n instanceof m.FormData?o.send(n):o.send(JSON.stringify(n))}),jsonp:e(function(e,t,n,r){var o=t.callbackName||"_mithril_"+Math.round(1e16*Math.random())+"_"+l++,i=m.document.createElement("script");m[o]=function(e){delete m[o],i.parentNode.removeChild(i),n(e)},i.onerror=function(){delete m[o],i.parentNode.removeChild(i),r(new Error("JSONP request failed"))},i.src=e+(e.indexOf("?")<0?"?":"&")+encodeURIComponent(t.callbackKey||"callback")+"="+encodeURIComponent(o),m.document.documentElement.appendChild(i)})}}},{"../pathname/build":16}],32:[function(e,t,n){"use strict";var r=e("./mount-redraw");t.exports=e("./api/router")(window,r)},{"./api/router":11,"./mount-redraw":14}],33:[function(e,t,n){var r,o,i=t.exports={};function l(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(r===setTimeout)return setTimeout(t,0);if((r===l||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:l}catch(e){r=l}try{o="function"==typeof clearTimeout?clearTimeout:a}catch(e){o=a}}();var u,c=[],f=!1,d=-1;function p(){f&&u&&(f=!1,u.length?c=u.concat(c):d=-1,c.length&&m())}function m(){if(!f){var e=s(p);f=!0;for(var t=c.length;t;){for(u=c,c=[];++d<t;)u&&u[d].run();d=-1,t=c.length}u=null,f=!1,function(t){if(o===clearTimeout)return clearTimeout(t);if((o===a||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(t);try{o(t)}catch(e){try{return o.call(null,t)}catch(e){return o.call(this,t)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new h(e,t)),1!==c.length||f||s(m)},h.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],34:[function(s,e,u){(function(e,t){var r=s("process/browser.js").nextTick,n=Function.prototype.apply,o=Array.prototype.slice,i={},l=0;function a(e,t){this._id=e,this._clearFn=t}u.setTimeout=function(){return new a(n.call(setTimeout,window,arguments),clearTimeout)},u.setInterval=function(){return new a(n.call(setInterval,window,arguments),clearInterval)},u.clearTimeout=u.clearInterval=function(e){e.close()},a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(window,this._id)},u.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},u.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},u._unrefActive=u.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;0<=t&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},u.setImmediate="function"==typeof e?e:function(e){var t=l++,n=!(arguments.length<2)&&o.call(arguments,1);return i[t]=!0,r(function(){i[t]&&(n?e.apply(null,n):e.call(null),u.clearImmediate(t))}),t},u.clearImmediate="function"==typeof t?t:function(e){delete i[e]}}).call(this,s("timers").setImmediate,s("timers").clearImmediate)},{"process/browser.js":33,timers:34}],35:[function(e,t,n){function f(r){document.addEventListener("mouseover",function(e){var t=e.target,n=r(t);(n=n||(t=t.parentElement)&&r(t))&&f.show(t,n,!0)})}f.show=function(e,t,n){var r,o,i,l,a,s="data-tlite";function u(){f.hide(r,!0)}function c(){i=i||function(a,e,t){var s=document.createElement("span"),n=t.grav||a.getAttribute("data-tlite")||"n";s.innerHTML=e,a.appendChild(s);var u=n[0]||"",c=n[1]||"";function r(){s.className="tlite tlite-"+u+c;var e=a.offsetTop,t=a.offsetLeft;s.offsetParent===a&&(e=t=0);var n=a.offsetWidth,r=a.offsetHeight,o=s.offsetHeight,i=s.offsetWidth,l=t+n/2;s.style.top=("s"===u?e-o-10:"n"===u?e+r+10:e+r/2-o/2)+"px",s.style.left=("w"===c?t:"e"===c?t+n-i:"w"===u?t+n+10:"e"===u?t-i-10:l-i/2)+"px"}r();var o=s.getBoundingClientRect();"s"===u&&o.top<0?(u="n",r()):"n"===u&&o.bottom>window.innerHeight?(u="s",r()):"e"===u&&o.left<0?(u="w",r()):"w"===u&&o.right>window.innerWidth&&(u="e",r());return s.className+=" tlite-visible",s}(r,a,o)}t=t||{},(e.tooltip||(o=t,(r=e).addEventListener("mousedown",u),r.addEventListener("mouseleave",u),r.tooltip={show:function(){a=r.title||r.getAttribute(s)||a,r.title="",r.setAttribute(s,""),a&&!l&&(l=setTimeout(c,n?150:1))},hide:function(e){if(n===e){l=clearTimeout(l);var t=i&&i.parentNode;t&&t.removeChild(i),i=void 0}}})).show()},f.hide=function(e,t){e.tooltip&&e.tooltip.hide(t)},void 0!==t&&t.exports&&(t.exports=f)},{}]},{},[1]);
2
  //# sourceMappingURL=admin.min.js.map
assets/js/admin.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["admin.js"],"names":["r","e","n","t","o","i","f","c","u","a","Error","code","p","exports","call","length","1","require","module","obj","_tlite","__esModule","default","tabs","settings","helpers","el","className","indexOf","window","mc4wp","./admin/fields/mailchimp-api-key.js","./admin/helpers.js","./admin/list-fetcher.js","./admin/list-overview.js","./admin/settings.js","./admin/show-if.js","./admin/tabs.js","tlite","2","field","document","getElementById","addEventListener","evt","node","createElement","innerText","mc4wp_vars","i18n","invalid_api_key","nextElementSibling","parentElement","removeChild","value","match","insertBefore","3","debounce","func","wait","immediate","timeout","context","this","args","arguments","callNow","clearTimeout","setTimeout","apply","4","config","ajaxurl","m","state","working","done","success","fetch","preventDefault","request","method","url","then","data","location","reload","redraw","mount","mailchimp","api_connected","lists","view","onsubmit","bind","type","fetching_mailchimp_lists","renew_mailchimp_lists","disabled","trust","fetching_mailchimp_lists_done","fetching_mailchimp_lists_error","mithril","5","showDetails","link","target","next","listID","getAttribute","querySelector","style","display","details","render","merge_fields","map","name","required","tag","options","date_format","choices","join","interest_categories","title","id","Object","keys","interests","shift","Element","prototype","matches","msMatchesSelector","webkitMatchesSelector","table","6","_typeof","Symbol","iterator","constructor","listInputs","querySelectorAll","selectedLists","listeners","updateSelectedLists","forEach","input","checked","push","rows","isSelected","searchKey","searchValue","filter","getSelectedListsWhere","toggleVisibleLists","event","emit","getSelectedLists","on","7","showIfElements","element","JSON","parse","parentElements","inputs","hide","undefined","toggleElement","conditionMet","visibility","opacity","inputElement","removeAttribute","setAttribute","8","URL","tabElements","tabNavElements","refererField","get","_open","tab","updateState","replace","nav","blur","setParameter","href","history","pushState","tb_remove","forms","editor","refresh","split","switchTab","tabId","urlParams","returnValue","substring","textContent","open","body","activeTab","offsetParent","replaceState","init","./url.js","9","query","hasOwnProperty","b","decodeURIComponent","build","ret","d","encodeURIComponent","key","10","Vnode","schedule","console","subscriptions","rendering","pending","sync","error","root","component","TypeError","index","splice","../render/vnode","11","setImmediate","Promise","buildPathname","parsePathname","compileTemplate","assign","sentinel","$window","mountRedraw","fireAsync","setPath","path","route","prefix","attrs","currentPath","lastUpdate","currentResolver","SKIP","defaultRoute","routes","onremove","compiled","SyntaxError","test","check","callAsync","resolve","scheduled","defaultData","some","ReferenceError","resolveRoute","hash","search","pathname","concat","slice","fail","params","loop","payload","matchedRoute","localComp","update","comp","onmatch","removeEventListener","onbeforeupdate","oncreate","vnode","set","Link","onclick","selector","oninit","onupdate","onbeforeremove","child","children","Boolean","result","currentTarget","handleEvent","defaultPrevented","button","which","ctrlKey","metaKey","shiftKey","altKey","param","../pathname/assign","../pathname/build","../pathname/compileTemplate","../pathname/parse","../promise/promise","../render/hyperscript","timers","12","hyperscript","fragment","./render/fragment","./render/hyperscript","./render/trust","13","jsonp","parseQueryString","buildQueryString","PromisePolyfill","./hyperscript","./mount-redraw","./pathname/build","./pathname/parse","./promise/polyfill","./querystring/build","./querystring/parse","./render","./render/vnode","./request","./route","14","requestAnimationFrame","./api/mount-redraw","15","source","16","template","queryIndex","hashIndex","queryEnd","pathEnd","resolved","variadic","String","newQueryIndex","newHashIndex","newQueryEnd","newPathEnd","querystring","../querystring/build","./assign","17","templateData","templateKeys","regexp","RegExp","extra","k","values","exec","./parse","18","../querystring/parse","19","executor","self","resolvers","rejectors","resolveCurrent","handler","rejectCurrent","instance","_instance","list","shouldAbsorb","execute","retry","executeOnce","runs","run","fn","onerror","onFulfilled","onRejection","resolveNext","rejectNext","handle","callback","promise","reject","catch","finally","reason","all","total","count","consume","race","20","global","./polyfill","21","object","toString","destructure","Array","isArray","22","string","charAt","entries","counters","entry","levels","cursor","pop","j","level","nextLevel","isNumber","isNaN","parseInt","desc","getOwnPropertyDescriptor","23","./render/render","24","hyperscriptVnode","normalizeChildren","./hyperscriptVnode","25","selectorParser","selectorCache","hasOwn","isEmpty","hasClass","class","newAttrs","text","execSelector","classes","attrValue","compileSelector","26","start","27","currentRedraw","$doc","nameSpace","svg","math","getNameSpace","xmlns","checkState","original","callHook","activeElement","createNodes","parent","vnodes","end","hooks","nextSibling","ns","createNode","initLifecycle","dom","createTextNode","insertNode","createText","createHTML","createDocumentFragment","firstChild","domSize","childNodes","createFragment","is","createElementNS","setAttr","setAttrs","maybeSetContentEditable","selectedIndex","normalized","setLateSelectAttrs","create","$$reentrantLock$$","normalize","initComponent","createComponent","possibleParents","caption","thead","tbody","tfoot","tr","th","td","colgroup","col","temp","innerHTML","appendChild","updateNodes","old","removeNodes","isOldKeyed","isKeyed","oldStart","v","oe","ve","topSibling","oldEnd","updateNode","getNextSibling","moveNodes","lisIndices","originalNextSibling","vnodesLength","oldIndices","li","pos","matched","getKeyMap","oldIndex","il","lisTemp","makeLisIndices","commonLength","removeNode","oldTag","events","force","shouldNotUpdate","updateLifecycle","nodeValue","updateText","removeHTML","updateHTML","updateFragment","val","removeAttr","updateAttrs","updateElement","updateComponent","frag","moveChildToFrag","parentNode","contenteditable","contentEditable","content","stateResult","attrsResult","mask","reallyRemove","isLifecycleMethod","attr","isFormAttribute","updateEvent","setAttributeNS","updateStyle","hasPropertyKey","nsLastIndex","uppercaseRegex","toLowerCase","capital","normalizeKey","cssText","setProperty","removeProperty","EventDict","_","ev","stopPropagation","active","namespace","namespaceURI","prevRedraw","focus","28","html","29","30","./promise/promise","./request/request","31","oncompletion","callbackCount","PromiseProxy","makeRequest","factory","background","complete","wrap","hasHeader","headers","__proto__","replacedAbort","toUpperCase","assumeJSON","serialize","FormData","responseType","extract","xhr","XMLHttpRequest","aborted","abort","async","user","password","setRequestHeader","deserialize","withCredentials","onreadystatechange","readyState","message","status","response","responseText","send","stringify","callbackName","Math","round","random","script","src","callbackKey","documentElement","32","./api/router","33","cachedSetTimeout","cachedClearTimeout","process","defaultSetTimout","defaultClearTimeout","runTimeout","fun","currentQueue","queue","draining","queueIndex","cleanUpNextTick","drainQueue","len","marker","runClearTimeout","Item","array","noop","nextTick","browser","env","argv","version","versions","addListener","once","off","removeListener","removeAllListeners","prependListener","prependOnceListener","binding","cwd","chdir","dir","umask","34","clearImmediate","Function","immediateIds","nextImmediateId","Timeout","clearFn","_id","_clearFn","setInterval","clearInterval","close","unref","ref","enroll","item","msecs","_idleTimeoutId","_idleTimeout","unenroll","_unrefActive","_onTimeout","process/browser.js","35","getTooltipOpts","opts","show","isAuto","tooltipEl","showTimer","fallbackAttrib","autoHide","fadeIn","grav","vertGrav","horzGrav","positionTooltip","top","offsetTop","left","offsetLeft","width","offsetWidth","height","offsetHeight","tooltipHeight","tooltipWidth","centerEl","rect","getBoundingClientRect","bottom","innerHeight","right","innerWidth","createTooltip","tooltip","isAutoHiding"],"mappings":"CAA4E,SAASA,EAAEC,EAAEC,EAAEC,GAAG,SAASC,EAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,IAAIE,GAAE,EAAoC,IAAID,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,GAAG,CAACQ,QAAQ,IAAIZ,EAAEI,GAAG,GAAGS,KAAKF,EAAEC,QAAQ,SAASb,GAAoB,OAAOI,EAAlBH,EAAEI,GAAG,GAAGL,IAAeA,IAAIY,EAAEA,EAAEC,QAAQb,EAAEC,EAAEC,EAAEC,GAAG,OAAOD,EAAEG,GAAGQ,QAAQ,IAAI,IAAIL,GAAE,EAAoCH,EAAE,EAAEA,EAAEF,EAAEY,OAAOV,IAAID,EAAED,EAAEE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GNV,IAEA,IAAIY,EAAOpB,EAAUqB,wBAkBrB,MAhBiB,MAAbf,GAAoBc,EAAKX,IAAM,GACjCH,EAAW,IACXE,KACsB,MAAbF,GAAoBc,EAAKE,OAAS7rB,OAAO8rB,aAClDjB,EAAW,IACXE,KACsB,MAAbF,GAAoBc,EAAKT,KAAO,GACzCL,EAAW,IACXE,KACsB,MAAbF,GAAoBc,EAAKI,MAAQ/rB,OAAOgsB,aACjDnB,EAAW,IACXE,KAGFR,EAAUzqB,WAAa,iBAEhByqB,EAzES0B,CAAcpsB,EAAIsa,EAAMiQ,GAlC1CA,EAAOA,GAAQ,IAEdvqB,EAAGqsB,UAEiB9B,EAFMA,GAEVvqB,EAFMA,GAOlBiB,iBAAiB,YAAa4pB,GACjC7qB,EAAGiB,iBAAiB,aAAc4pB,GA4B3B7qB,EAAGqsB,QAAU,CAClB7B,KA3BF,WACElQ,EAAOta,EAAGoG,OAASpG,EAAGoF,aAAawlB,IAAmBtQ,EACtDta,EAAGoG,MAAQ,GACXpG,EAAGwJ,aAAaohB,EAAgB,IAChCtQ,IAASqQ,IAAcA,EAAYhoB,WAAWmoB,EAAQL,EAAS,IAAM,KAwBrEzhB,KAjBF,SAAcsjB,GACZ,GAAI7B,IAAW6B,EAAc,CAC3B3B,EAAYjoB,aAAaioB,GACzB,IAAIjP,EAASgP,GAAaA,EAAUvJ,WACpCzF,GAAUA,EAAO/Z,YAAY+oB,GAC7BA,OAAYzhB,OA1BgBuhB,QA6GpC5pB,EAAMoI,KAAO,SAAUhJ,EAAIyqB,GACzBzqB,EAAGqsB,SAAWrsB,EAAGqsB,QAAQrjB,KAAKyhB,SAGV,IAAXjrB,GAA0BA,EAAOL,UAC1CK,EAAOL,QAAUyB,IAGjB,KAAK,GAAG,CAAC","file":"admin.min.js","sourcesContent":["(function () { var require = undefined; var define = undefined; (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){\n'use strict'; // dependencies\n\nvar _tlite = _interopRequireDefault(require(\"tlite\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nvar tabs = require('./admin/tabs.js');\n\nvar settings = require('./admin/settings.js');\n\nvar helpers = require('./admin/helpers.js');\n\n(0, _tlite[\"default\"])(function (el) {\n return el.className.indexOf('mc4wp-tooltip') > -1;\n});\n\nrequire('./admin/list-fetcher.js');\n\nrequire('./admin/fields/mailchimp-api-key.js');\n\nrequire('./admin/list-overview.js');\n\nrequire('./admin/show-if.js'); // expose some things\n\n\nwindow.mc4wp = window.mc4wp || {};\nwindow.mc4wp.helpers = helpers;\nwindow.mc4wp.settings = settings;\nwindow.mc4wp.tabs = tabs;\n\n},{\"./admin/fields/mailchimp-api-key.js\":2,\"./admin/helpers.js\":3,\"./admin/list-fetcher.js\":4,\"./admin/list-overview.js\":5,\"./admin/settings.js\":6,\"./admin/show-if.js\":7,\"./admin/tabs.js\":8,\"tlite\":35}],2:[function(require,module,exports){\n'use strict';\n\nfunction validate(evt) {\n var node = document.createElement('p');\n node.className = 'help red';\n node.innerText = window.mc4wp_vars.i18n.invalid_api_key;\n\n if (field.nextElementSibling.innerText === node.innerText) {\n field.nextElementSibling.parentElement.removeChild(field.nextElementSibling);\n }\n\n if (!field.value.match(/^[0-9a-zA-Z*]{32}-[a-z]{2}[0-9]{1,2}$/)) {\n field.parentElement.insertBefore(node, field.nextElementSibling);\n }\n}\n\nvar field = document.getElementById('mailchimp_api_key');\n\nif (field) {\n field.addEventListener('change', validate);\n}\n\n},{}],3:[function(require,module,exports){\n'use strict';\n\nvar helpers = {}; // polling\n\nhelpers.debounce = function (func, wait, immediate) {\n var timeout;\n return function () {\n var context = this,\n args = arguments;\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(function () {\n timeout = null;\n if (!immediate) func.apply(context, args);\n }, wait);\n if (callNow) func.apply(context, args);\n };\n};\n\nmodule.exports = helpers;\n\n},{}],4:[function(require,module,exports){\n'use strict';\n\nvar config = window.mc4wp_vars;\nvar i18n = window.mc4wp_vars.i18n;\nvar ajaxurl = window.mc4wp_vars.ajaxurl;\n\nvar m = require('mithril');\n\nvar state = {\n working: false,\n done: false,\n success: false\n};\n\nfunction fetch(evt) {\n evt && evt.preventDefault();\n state.working = true;\n state.done = false;\n m.request({\n method: \"POST\",\n url: ajaxurl + \"?action=mc4wp_renew_mailchimp_lists\",\n timeout: 600000 // 10 minutes, matching max_execution_time\n\n }).then(function (data) {\n state.success = true;\n\n if (data) {\n window.setTimeout(function () {\n window.location.reload();\n }, 3000);\n }\n })[\"catch\"](function (data) {\n state.success = false;\n })[\"finally\"](function (data) {\n state.working = false;\n state.done = true;\n m.redraw();\n });\n}\n\nfunction view() {\n return m('form', {\n method: \"POST\",\n onsubmit: fetch.bind(this)\n }, [m('p', [m('input', {\n type: \"submit\",\n value: state.working ? i18n.fetching_mailchimp_lists : i18n.renew_mailchimp_lists,\n className: \"button\",\n disabled: !!state.working\n }), m.trust(' &nbsp; '), state.working ? [m('span.mc4wp-loader', \"Loading...\"), m.trust(' &nbsp; ')] : '', state.done ? [state.success ? m('em.help.green', i18n.fetching_mailchimp_lists_done) : m('em.help.red', i18n.fetching_mailchimp_lists_error)] : ''])]);\n}\n\nvar mount = document.getElementById('mc4wp-list-fetcher');\n\nif (mount) {\n // start fetching right away when no lists but api key given\n if (config.mailchimp.api_connected && config.mailchimp.lists.length === 0) {\n fetch();\n }\n\n m.mount(mount, {\n view: view\n });\n}\n\n},{\"mithril\":13}],5:[function(require,module,exports){\n'use strict';\n\nvar ajaxurl = window.mc4wp_vars.ajaxurl;\n\nvar m = require('mithril');\n\nif (!Element.prototype.matches) {\n Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;\n}\n\nfunction showDetails(evt) {\n evt.preventDefault();\n var link = evt.target;\n var next = link.parentElement.parentElement.nextElementSibling;\n var listID = link.getAttribute('data-list-id');\n var mount = next.querySelector('div');\n\n if (next.style.display === 'none') {\n m.request({\n method: \"GET\",\n url: ajaxurl + \"?action=mc4wp_get_list_details&ids=\" + listID\n }).then(function (details) {\n m.render(mount, view(details.shift()));\n });\n next.style.display = '';\n } else {\n next.style.display = 'none';\n }\n}\n\nfunction view(data) {\n return [m('h3', 'Merge fields'), m('table.widefat.striped', [m('thead', [m('tr', [m('th', 'Name'), m('th', 'Tag'), m('th', 'Type')])]), m('tbody', data.merge_fields.map(function (f) {\n return m('tr', [m('td', [f.name, f.required && m('span.red', '*')]), m('td', [m('code', f.tag)]), m('td', [f.type, ' ', f.options && f.options.date_format ? '(' + f.options.date_format + ')' : '', f.options && f.options.choices ? '(' + f.options.choices.join(', ') + ')' : ''])]);\n }))]), data.interest_categories.length > 0 && [m('h3', 'Interest Categories'), m('table.striped.widefat', [m('thead', [m('tr', [m('th', 'Name'), m('th', 'Type'), m('th', 'Interests')])]), m('tbody', data.interest_categories.map(function (f) {\n return m('tr', [m('td', [m('strong', f.title), m('br'), m('br'), 'ID: ', m('code', f.id)]), m('td', f.type), m('td', [m('div.row', {\n style: 'margin-bottom: 4px;'\n }, [m('div.col.col-3', [m('strong', {\n style: 'display: block; border-bottom: 1px solid #eee;'\n }, 'Name')]), m('div.col.col-3', [m('strong', {\n style: 'display: block; border-bottom: 1px solid #eee;'\n }, 'ID')])]), Object.keys(f.interests).map(function (id) {\n return m('div.row.tiny-margin', [m('div.col.col-3', f.interests[id]), m('div.col.col-3', [m('code', {\n title: 'Interest ID'\n }, id)]), m('br.clearfix.clear.cf')]);\n })])]);\n }))])]];\n}\n\nvar table = document.getElementById('mc4wp-mailchimp-lists-overview');\n\nif (table) {\n table.addEventListener('click', function (evt) {\n if (!evt.target.matches('.mc4wp-mailchimp-list')) {\n return;\n }\n\n showDetails(evt);\n });\n}\n\n},{\"mithril\":13}],6:[function(require,module,exports){\n'use strict';\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar context = document.getElementById('mc4wp-admin');\nvar listInputs = context.querySelectorAll('.mc4wp-list-input');\nvar lists = window.mc4wp_vars.mailchimp.lists;\nvar selectedLists = [];\nvar listeners = {}; // functions\n\nfunction getSelectedListsWhere(searchKey, searchValue) {\n return selectedLists.filter(function (el) {\n return el[searchKey] === searchValue;\n });\n}\n\nfunction getSelectedLists() {\n return selectedLists;\n}\n\nfunction updateSelectedLists() {\n selectedLists = [];\n [].forEach.call(listInputs, function (input) {\n // skip unchecked checkboxes\n if (typeof input.checked === \"boolean\" && !input.checked) {\n return;\n }\n\n if (_typeof(lists[input.value]) === \"object\") {\n selectedLists.push(lists[input.value]);\n }\n });\n toggleVisibleLists();\n emit('selectedLists.change', [selectedLists]);\n return selectedLists;\n}\n\nfunction toggleVisibleLists() {\n var rows = document.querySelectorAll('.lists--only-selected > *');\n [].forEach.call(rows, function (el) {\n var listId = el.getAttribute('data-list-id');\n var isSelected = getSelectedListsWhere('id', listId).length > 0;\n el.style.display = isSelected ? '' : 'none';\n });\n}\n\nfunction emit(event, args) {\n listeners[event] = listeners[event] || [];\n listeners[event].forEach(function (f) {\n return f.apply(null, args);\n });\n}\n\nfunction on(event, func) {\n listeners[event] = listeners[event] || [];\n listeners[event].push(func);\n}\n\n[].forEach.call(listInputs, function (el) {\n el.addEventListener('change', updateSelectedLists);\n});\nupdateSelectedLists();\nmodule.exports = {\n getSelectedLists: getSelectedLists,\n on: on\n};\n\n},{}],7:[function(require,module,exports){\n'use strict';\n\nvar showIfElements = document.querySelectorAll('[data-showif]');\n[].forEach.call(showIfElements, function (element) {\n var config = JSON.parse(element.getAttribute('data-showif'));\n var parentElements = document.querySelectorAll('[name=\"' + config.element + '\"]');\n var inputs = element.querySelectorAll('input,select,textarea:not([readonly])');\n var hide = config.hide === undefined || config.hide;\n\n function toggleElement() {\n // do nothing with unchecked radio inputs\n if (this.getAttribute('type') === \"radio\" && !this.checked) {\n return;\n }\n\n var value = this.getAttribute(\"type\") === \"checkbox\" ? this.checked : this.value;\n var conditionMet = value == config.value;\n\n if (hide) {\n element.style.display = conditionMet ? '' : 'none';\n element.style.visibility = conditionMet ? '' : 'hidden';\n } else {\n element.style.opacity = conditionMet ? '' : '0.4';\n } // disable input fields to stop sending their values to server\n\n\n [].forEach.call(inputs, function (inputElement) {\n conditionMet ? inputElement.removeAttribute('readonly') : inputElement.setAttribute('readonly', 'readonly');\n });\n } // find checked element and call toggleElement function\n\n\n [].forEach.call(parentElements, function (el) {\n el.addEventListener('change', toggleElement);\n toggleElement.call(el);\n });\n});\n\n},{}],8:[function(require,module,exports){\n'use strict';\n\nvar URL = require('./url.js');\n\nvar context = document.getElementById('mc4wp-admin');\nvar tabElements = context.querySelectorAll('.tab');\nvar tabNavElements = context.querySelectorAll('.nav-tab');\nvar refererField = context.querySelector('input[name=\"_wp_http_referer\"]');\nvar tabs = [];\n\nif (!Element.prototype.matches) {\n Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;\n}\n\n[].forEach.call(tabElements, function (t, i) {\n var id = t.id.substring(4);\n var title = t.querySelector('h2:first-of-type').textContent;\n tabs.push({\n id: id,\n title: title,\n element: t,\n nav: context.querySelectorAll('.nav-tab-' + id),\n open: function open() {\n return _open(id);\n }\n });\n});\n\nfunction get(id) {\n for (var i = 0; i < tabs.length; i++) {\n if (tabs[i].id === id) {\n return tabs[i];\n }\n }\n\n return null;\n}\n\nfunction _open(tab, updateState) {\n // make sure we have a tab object\n if (typeof tab === \"string\") {\n tab = get(tab);\n }\n\n if (!tab) {\n return false;\n } // should we update state?\n\n\n if (updateState === undefined) {\n updateState = true;\n } // hide all tabs & remove active class\n\n\n [].forEach.call(tabElements, function (t) {\n t.className = t.className.replace('tab-active', '');\n t.style.display = ' none';\n });\n [].forEach.call(tabNavElements, function (t) {\n t.className = t.className.replace('nav-tab-active', '');\n }); // add `nav-tab-active` to this tab\n\n [].forEach.call(tab.nav, function (nav) {\n nav.className += \" nav-tab-active\";\n nav.blur();\n }); // show target tab\n\n tab.element.style.display = 'block';\n tab.element.className += \" tab-active\"; // create new URL\n\n var url = URL.setParameter(window.location.href, \"tab\", tab.id); // update hash\n\n if (history.pushState && updateState) {\n history.pushState(tab.id, '', url);\n } // update document title\n\n\n title(tab); // update referer field\n\n refererField.value = url; // if thickbox is open, close it.\n\n if (typeof tb_remove === \"function\") {\n tb_remove();\n } // refresh editor if open\n\n\n if (window.mc4wp && window.mc4wp.forms && window.mc4wp.forms.editor) {\n window.mc4wp.forms.editor.refresh();\n }\n\n return true;\n}\n\nfunction title(tab) {\n var title = document.title.split('-');\n document.title = document.title.replace(title[0], tab.title + \" \");\n}\n\nfunction switchTab(evt) {\n var link = evt.target; // get from data attribute\n\n var tabId = link.getAttribute('data-tab'); // get from classname\n\n if (!tabId) {\n var match = link.className.match(/nav-tab-(\\w+)?/);\n\n if (match) {\n tabId = match[1];\n }\n } // get from href\n\n\n if (!tabId) {\n var urlParams = URL.parse(link.href);\n\n if (!urlParams.tab) {\n return;\n }\n\n tabId = urlParams.tab;\n }\n\n var opened = _open(tabId);\n\n if (opened) {\n evt.preventDefault();\n evt.returnValue = false;\n return false;\n }\n\n return true;\n}\n\nfunction init() {\n var activeTab = tabs.filter(function (t) {\n return t.element.offsetParent !== null;\n }).shift();\n\n if (!activeTab) {\n return;\n }\n\n var tab = get(activeTab.id.substring(4));\n\n if (!tab) {\n return;\n } // check if tab is in html5 history\n\n\n if (history.replaceState && history.state === null) {\n history.replaceState(tab.id, '');\n } // update document title\n\n\n title(tab);\n}\n\n[].forEach.call(tabNavElements, function (el) {\n return el.addEventListener('click', switchTab);\n});\ndocument.body.addEventListener('click', function (evt) {\n if (!evt.target.matches('.tab-link')) {\n return;\n }\n\n switchTab(evt);\n});\ninit();\n\nif (window.addEventListener && history.pushState) {\n window.addEventListener('popstate', function (e) {\n if (!e.state) return true;\n var tabId = e.state;\n return _open(tabId, false);\n });\n}\n\nmodule.exports = {\n open: _open,\n get: get\n};\n\n},{\"./url.js\":9}],9:[function(require,module,exports){\n'use strict';\n\nvar URL = {\n parse: function parse(url) {\n var query = {};\n var a = url.split('&');\n\n for (var i in a) {\n if (!a.hasOwnProperty(i)) {\n continue;\n }\n\n var b = a[i].split('=');\n query[decodeURIComponent(b[0])] = decodeURIComponent(b[1]);\n }\n\n return query;\n },\n build: function build(data) {\n var ret = [];\n\n for (var d in data) {\n ret.push(d + \"=\" + encodeURIComponent(data[d]));\n }\n\n return ret.join(\"&\");\n },\n setParameter: function setParameter(url, key, value) {\n var data = URL.parse(url);\n data[key] = value;\n return URL.build(data);\n }\n};\nmodule.exports = URL;\n\n},{}],10:[function(require,module,exports){\n\"use strict\"\n\nvar Vnode = require(\"../render/vnode\")\n\nmodule.exports = function(render, schedule, console) {\n\tvar subscriptions = []\n\tvar rendering = false\n\tvar pending = false\n\n\tfunction sync() {\n\t\tif (rendering) throw new Error(\"Nested m.redraw.sync() call\")\n\t\trendering = true\n\t\tfor (var i = 0; i < subscriptions.length; i += 2) {\n\t\t\ttry { render(subscriptions[i], Vnode(subscriptions[i + 1]), redraw) }\n\t\t\tcatch (e) { console.error(e) }\n\t\t}\n\t\trendering = false\n\t}\n\n\tfunction redraw() {\n\t\tif (!pending) {\n\t\t\tpending = true\n\t\t\tschedule(function() {\n\t\t\t\tpending = false\n\t\t\t\tsync()\n\t\t\t})\n\t\t}\n\t}\n\n\tredraw.sync = sync\n\n\tfunction mount(root, component) {\n\t\tif (component != null && component.view == null && typeof component !== \"function\") {\n\t\t\tthrow new TypeError(\"m.mount(element, component) expects a component, not a vnode\")\n\t\t}\n\n\t\tvar index = subscriptions.indexOf(root)\n\t\tif (index >= 0) {\n\t\t\tsubscriptions.splice(index, 2)\n\t\t\trender(root, [], redraw)\n\t\t}\n\n\t\tif (component != null) {\n\t\t\tsubscriptions.push(root, component)\n\t\t\trender(root, Vnode(component), redraw)\n\t\t}\n\t}\n\n\treturn {mount: mount, redraw: redraw}\n}\n\n},{\"../render/vnode\":29}],11:[function(require,module,exports){\n(function (setImmediate){\n\"use strict\"\n\nvar Vnode = require(\"../render/vnode\")\nvar m = require(\"../render/hyperscript\")\nvar Promise = require(\"../promise/promise\")\n\nvar buildPathname = require(\"../pathname/build\")\nvar parsePathname = require(\"../pathname/parse\")\nvar compileTemplate = require(\"../pathname/compileTemplate\")\nvar assign = require(\"../pathname/assign\")\n\nvar sentinel = {}\n\nmodule.exports = function($window, mountRedraw) {\n\tvar fireAsync\n\n\tfunction setPath(path, data, options) {\n\t\tpath = buildPathname(path, data)\n\t\tif (fireAsync != null) {\n\t\t\tfireAsync()\n\t\t\tvar state = options ? options.state : null\n\t\t\tvar title = options ? options.title : null\n\t\t\tif (options && options.replace) $window.history.replaceState(state, title, route.prefix + path)\n\t\t\telse $window.history.pushState(state, title, route.prefix + path)\n\t\t}\n\t\telse {\n\t\t\t$window.location.href = route.prefix + path\n\t\t}\n\t}\n\n\tvar currentResolver = sentinel, component, attrs, currentPath, lastUpdate\n\n\tvar SKIP = route.SKIP = {}\n\n\tfunction route(root, defaultRoute, routes) {\n\t\tif (root == null) throw new Error(\"Ensure the DOM element that was passed to `m.route` is not undefined\")\n\t\t// 0 = start\n\t\t// 1 = init\n\t\t// 2 = ready\n\t\tvar state = 0\n\n\t\tvar compiled = Object.keys(routes).map(function(route) {\n\t\t\tif (route[0] !== \"/\") throw new SyntaxError(\"Routes must start with a `/`\")\n\t\t\tif ((/:([^\\/\\.-]+)(\\.{3})?:/).test(route)) {\n\t\t\t\tthrow new SyntaxError(\"Route parameter names must be separated with either `/`, `.`, or `-`\")\n\t\t\t}\n\t\t\treturn {\n\t\t\t\troute: route,\n\t\t\t\tcomponent: routes[route],\n\t\t\t\tcheck: compileTemplate(route),\n\t\t\t}\n\t\t})\n\t\tvar callAsync = typeof setImmediate === \"function\" ? setImmediate : setTimeout\n\t\tvar p = Promise.resolve()\n\t\tvar scheduled = false\n\t\tvar onremove\n\n\t\tfireAsync = null\n\n\t\tif (defaultRoute != null) {\n\t\t\tvar defaultData = parsePathname(defaultRoute)\n\n\t\t\tif (!compiled.some(function (i) { return i.check(defaultData) })) {\n\t\t\t\tthrow new ReferenceError(\"Default route doesn't match any known routes\")\n\t\t\t}\n\t\t}\n\n\t\tfunction resolveRoute() {\n\t\t\tscheduled = false\n\t\t\t// Consider the pathname holistically. The prefix might even be invalid,\n\t\t\t// but that's not our problem.\n\t\t\tvar prefix = $window.location.hash\n\t\t\tif (route.prefix[0] !== \"#\") {\n\t\t\t\tprefix = $window.location.search + prefix\n\t\t\t\tif (route.prefix[0] !== \"?\") {\n\t\t\t\t\tprefix = $window.location.pathname + prefix\n\t\t\t\t\tif (prefix[0] !== \"/\") prefix = \"/\" + prefix\n\t\t\t\t}\n\t\t\t}\n\t\t\t// This seemingly useless `.concat()` speeds up the tests quite a bit,\n\t\t\t// since the representation is consistently a relatively poorly\n\t\t\t// optimized cons string.\n\t\t\tvar path = prefix.concat()\n\t\t\t\t.replace(/(?:%[a-f89][a-f0-9])+/gim, decodeURIComponent)\n\t\t\t\t.slice(route.prefix.length)\n\t\t\tvar data = parsePathname(path)\n\n\t\t\tassign(data.params, $window.history.state)\n\n\t\t\tfunction fail() {\n\t\t\t\tif (path === defaultRoute) throw new Error(\"Could not resolve default route \" + defaultRoute)\n\t\t\t\tsetPath(defaultRoute, null, {replace: true})\n\t\t\t}\n\n\t\t\tloop(0)\n\t\t\tfunction loop(i) {\n\t\t\t\t// 0 = init\n\t\t\t\t// 1 = scheduled\n\t\t\t\t// 2 = done\n\t\t\t\tfor (; i < compiled.length; i++) {\n\t\t\t\t\tif (compiled[i].check(data)) {\n\t\t\t\t\t\tvar payload = compiled[i].component\n\t\t\t\t\t\tvar matchedRoute = compiled[i].route\n\t\t\t\t\t\tvar localComp = payload\n\t\t\t\t\t\tvar update = lastUpdate = function(comp) {\n\t\t\t\t\t\t\tif (update !== lastUpdate) return\n\t\t\t\t\t\t\tif (comp === SKIP) return loop(i + 1)\n\t\t\t\t\t\t\tcomponent = comp != null && (typeof comp.view === \"function\" || typeof comp === \"function\")? comp : \"div\"\n\t\t\t\t\t\t\tattrs = data.params, currentPath = path, lastUpdate = null\n\t\t\t\t\t\t\tcurrentResolver = payload.render ? payload : null\n\t\t\t\t\t\t\tif (state === 2) mountRedraw.redraw()\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tstate = 2\n\t\t\t\t\t\t\t\tmountRedraw.redraw.sync()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// There's no understating how much I *wish* I could\n\t\t\t\t\t\t// use `async`/`await` here...\n\t\t\t\t\t\tif (payload.view || typeof payload === \"function\") {\n\t\t\t\t\t\t\tpayload = {}\n\t\t\t\t\t\t\tupdate(localComp)\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (payload.onmatch) {\n\t\t\t\t\t\t\tp.then(function () {\n\t\t\t\t\t\t\t\treturn payload.onmatch(data.params, path, matchedRoute)\n\t\t\t\t\t\t\t}).then(update, fail)\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse update(\"div\")\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfail()\n\t\t\t}\n\t\t}\n\n\t\t// Set it unconditionally so `m.route.set` and `m.route.Link` both work,\n\t\t// even if neither `pushState` nor `hashchange` are supported. It's\n\t\t// cleared if `hashchange` is used, since that makes it automatically\n\t\t// async.\n\t\tfireAsync = function() {\n\t\t\tif (!scheduled) {\n\t\t\t\tscheduled = true\n\t\t\t\tcallAsync(resolveRoute)\n\t\t\t}\n\t\t}\n\n\t\tif (typeof $window.history.pushState === \"function\") {\n\t\t\tonremove = function() {\n\t\t\t\t$window.removeEventListener(\"popstate\", fireAsync, false)\n\t\t\t}\n\t\t\t$window.addEventListener(\"popstate\", fireAsync, false)\n\t\t} else if (route.prefix[0] === \"#\") {\n\t\t\tfireAsync = null\n\t\t\tonremove = function() {\n\t\t\t\t$window.removeEventListener(\"hashchange\", resolveRoute, false)\n\t\t\t}\n\t\t\t$window.addEventListener(\"hashchange\", resolveRoute, false)\n\t\t}\n\n\t\treturn mountRedraw.mount(root, {\n\t\t\tonbeforeupdate: function() {\n\t\t\t\tstate = state ? 2 : 1\n\t\t\t\treturn !(!state || sentinel === currentResolver)\n\t\t\t},\n\t\t\toncreate: resolveRoute,\n\t\t\tonremove: onremove,\n\t\t\tview: function() {\n\t\t\t\tif (!state || sentinel === currentResolver) return\n\t\t\t\t// Wrap in a fragment to preserve existing key semantics\n\t\t\t\tvar vnode = [Vnode(component, attrs.key, attrs)]\n\t\t\t\tif (currentResolver) vnode = currentResolver.render(vnode[0])\n\t\t\t\treturn vnode\n\t\t\t},\n\t\t})\n\t}\n\troute.set = function(path, data, options) {\n\t\tif (lastUpdate != null) {\n\t\t\toptions = options || {}\n\t\t\toptions.replace = true\n\t\t}\n\t\tlastUpdate = null\n\t\tsetPath(path, data, options)\n\t}\n\troute.get = function() {return currentPath}\n\troute.prefix = \"#!\"\n\troute.Link = {\n\t\tview: function(vnode) {\n\t\t\tvar options = vnode.attrs.options\n\t\t\t// Remove these so they don't get overwritten\n\t\t\tvar attrs = {}, onclick, href\n\t\t\tassign(attrs, vnode.attrs)\n\t\t\t// The first two are internal, but the rest are magic attributes\n\t\t\t// that need censored to not screw up rendering.\n\t\t\tattrs.selector = attrs.options = attrs.key = attrs.oninit =\n\t\t\tattrs.oncreate = attrs.onbeforeupdate = attrs.onupdate =\n\t\t\tattrs.onbeforeremove = attrs.onremove = null\n\n\t\t\t// Do this now so we can get the most current `href` and `disabled`.\n\t\t\t// Those attributes may also be specified in the selector, and we\n\t\t\t// should honor that.\n\t\t\tvar child = m(vnode.attrs.selector || \"a\", attrs, vnode.children)\n\n\t\t\t// Let's provide a *right* way to disable a route link, rather than\n\t\t\t// letting people screw up accessibility on accident.\n\t\t\t//\n\t\t\t// The attribute is coerced so users don't get surprised over\n\t\t\t// `disabled: 0` resulting in a button that's somehow routable\n\t\t\t// despite being visibly disabled.\n\t\t\tif (child.attrs.disabled = Boolean(child.attrs.disabled)) {\n\t\t\t\tchild.attrs.href = null\n\t\t\t\tchild.attrs[\"aria-disabled\"] = \"true\"\n\t\t\t\t// If you *really* do want to do this on a disabled link, use\n\t\t\t\t// an `oncreate` hook to add it.\n\t\t\t\tchild.attrs.onclick = null\n\t\t\t} else {\n\t\t\t\tonclick = child.attrs.onclick\n\t\t\t\thref = child.attrs.href\n\t\t\t\tchild.attrs.href = route.prefix + href\n\t\t\t\tchild.attrs.onclick = function(e) {\n\t\t\t\t\tvar result\n\t\t\t\t\tif (typeof onclick === \"function\") {\n\t\t\t\t\t\tresult = onclick.call(e.currentTarget, e)\n\t\t\t\t\t} else if (onclick == null || typeof onclick !== \"object\") {\n\t\t\t\t\t\t// do nothing\n\t\t\t\t\t} else if (typeof onclick.handleEvent === \"function\") {\n\t\t\t\t\t\tonclick.handleEvent(e)\n\t\t\t\t\t}\n\n\t\t\t\t\t// Adapted from React Router's implementation:\n\t\t\t\t\t// https://github.com/ReactTraining/react-router/blob/520a0acd48ae1b066eb0b07d6d4d1790a1d02482/packages/react-router-dom/modules/Link.js\n\t\t\t\t\t//\n\t\t\t\t\t// Try to be flexible and intuitive in how we handle links.\n\t\t\t\t\t// Fun fact: links aren't as obvious to get right as you\n\t\t\t\t\t// would expect. There's a lot more valid ways to click a\n\t\t\t\t\t// link than this, and one might want to not simply click a\n\t\t\t\t\t// link, but right click or command-click it to copy the\n\t\t\t\t\t// link target, etc. Nope, this isn't just for blind people.\n\t\t\t\t\tif (\n\t\t\t\t\t\t// Skip if `onclick` prevented default\n\t\t\t\t\t\tresult !== false && !e.defaultPrevented &&\n\t\t\t\t\t\t// Ignore everything but left clicks\n\t\t\t\t\t\t(e.button === 0 || e.which === 0 || e.which === 1) &&\n\t\t\t\t\t\t// Let the browser handle `target=_blank`, etc.\n\t\t\t\t\t\t(!e.currentTarget.target || e.currentTarget.target === \"_self\") &&\n\t\t\t\t\t\t// No modifier keys\n\t\t\t\t\t\t!e.ctrlKey && !e.metaKey && !e.shiftKey && !e.altKey\n\t\t\t\t\t) {\n\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\te.redraw = false\n\t\t\t\t\t\troute.set(href, null, options)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn child\n\t\t},\n\t}\n\troute.param = function(key) {\n\t\treturn attrs && key != null ? attrs[key] : attrs\n\t}\n\n\treturn route\n}\n\n}).call(this,require(\"timers\").setImmediate)\n},{\"../pathname/assign\":15,\"../pathname/build\":16,\"../pathname/compileTemplate\":17,\"../pathname/parse\":18,\"../promise/promise\":20,\"../render/hyperscript\":25,\"../render/vnode\":29,\"timers\":34}],12:[function(require,module,exports){\n\"use strict\"\n\nvar hyperscript = require(\"./render/hyperscript\")\n\nhyperscript.trust = require(\"./render/trust\")\nhyperscript.fragment = require(\"./render/fragment\")\n\nmodule.exports = hyperscript\n\n},{\"./render/fragment\":24,\"./render/hyperscript\":25,\"./render/trust\":28}],13:[function(require,module,exports){\n\"use strict\"\n\nvar hyperscript = require(\"./hyperscript\")\nvar request = require(\"./request\")\nvar mountRedraw = require(\"./mount-redraw\")\n\nvar m = function m() { return hyperscript.apply(this, arguments) }\nm.m = hyperscript\nm.trust = hyperscript.trust\nm.fragment = hyperscript.fragment\nm.mount = mountRedraw.mount\nm.route = require(\"./route\")\nm.render = require(\"./render\")\nm.redraw = mountRedraw.redraw\nm.request = request.request\nm.jsonp = request.jsonp\nm.parseQueryString = require(\"./querystring/parse\")\nm.buildQueryString = require(\"./querystring/build\")\nm.parsePathname = require(\"./pathname/parse\")\nm.buildPathname = require(\"./pathname/build\")\nm.vnode = require(\"./render/vnode\")\nm.PromisePolyfill = require(\"./promise/polyfill\")\n\nmodule.exports = m\n\n},{\"./hyperscript\":12,\"./mount-redraw\":14,\"./pathname/build\":16,\"./pathname/parse\":18,\"./promise/polyfill\":19,\"./querystring/build\":21,\"./querystring/parse\":22,\"./render\":23,\"./render/vnode\":29,\"./request\":30,\"./route\":32}],14:[function(require,module,exports){\n\"use strict\"\n\nvar render = require(\"./render\")\n\nmodule.exports = require(\"./api/mount-redraw\")(render, requestAnimationFrame, console)\n\n},{\"./api/mount-redraw\":10,\"./render\":23}],15:[function(require,module,exports){\n\"use strict\"\n\nmodule.exports = Object.assign || function(target, source) {\n\tif(source) Object.keys(source).forEach(function(key) { target[key] = source[key] })\n}\n\n},{}],16:[function(require,module,exports){\n\"use strict\"\n\nvar buildQueryString = require(\"../querystring/build\")\nvar assign = require(\"./assign\")\n\n// Returns `path` from `template` + `params`\nmodule.exports = function(template, params) {\n\tif ((/:([^\\/\\.-]+)(\\.{3})?:/).test(template)) {\n\t\tthrow new SyntaxError(\"Template parameter names *must* be separated\")\n\t}\n\tif (params == null) return template\n\tvar queryIndex = template.indexOf(\"?\")\n\tvar hashIndex = template.indexOf(\"#\")\n\tvar queryEnd = hashIndex < 0 ? template.length : hashIndex\n\tvar pathEnd = queryIndex < 0 ? queryEnd : queryIndex\n\tvar path = template.slice(0, pathEnd)\n\tvar query = {}\n\n\tassign(query, params)\n\n\tvar resolved = path.replace(/:([^\\/\\.-]+)(\\.{3})?/g, function(m, key, variadic) {\n\t\tdelete query[key]\n\t\t// If no such parameter exists, don't interpolate it.\n\t\tif (params[key] == null) return m\n\t\t// Escape normal parameters, but not variadic ones.\n\t\treturn variadic ? params[key] : encodeURIComponent(String(params[key]))\n\t})\n\n\t// In case the template substitution adds new query/hash parameters.\n\tvar newQueryIndex = resolved.indexOf(\"?\")\n\tvar newHashIndex = resolved.indexOf(\"#\")\n\tvar newQueryEnd = newHashIndex < 0 ? resolved.length : newHashIndex\n\tvar newPathEnd = newQueryIndex < 0 ? newQueryEnd : newQueryIndex\n\tvar result = resolved.slice(0, newPathEnd)\n\n\tif (queryIndex >= 0) result += template.slice(queryIndex, queryEnd)\n\tif (newQueryIndex >= 0) result += (queryIndex < 0 ? \"?\" : \"&\") + resolved.slice(newQueryIndex, newQueryEnd)\n\tvar querystring = buildQueryString(query)\n\tif (querystring) result += (queryIndex < 0 && newQueryIndex < 0 ? \"?\" : \"&\") + querystring\n\tif (hashIndex >= 0) result += template.slice(hashIndex)\n\tif (newHashIndex >= 0) result += (hashIndex < 0 ? \"\" : \"&\") + resolved.slice(newHashIndex)\n\treturn result\n}\n\n},{\"../querystring/build\":21,\"./assign\":15}],17:[function(require,module,exports){\n\"use strict\"\n\nvar parsePathname = require(\"./parse\")\n\n// Compiles a template into a function that takes a resolved path (without query\n// strings) and returns an object containing the template parameters with their\n// parsed values. This expects the input of the compiled template to be the\n// output of `parsePathname`. Note that it does *not* remove query parameters\n// specified in the template.\nmodule.exports = function(template) {\n\tvar templateData = parsePathname(template)\n\tvar templateKeys = Object.keys(templateData.params)\n\tvar keys = []\n\tvar regexp = new RegExp(\"^\" + templateData.path.replace(\n\t\t// I escape literal text so people can use things like `:file.:ext` or\n\t\t// `:lang-:locale` in routes. This is all merged into one pass so I\n\t\t// don't also accidentally escape `-` and make it harder to detect it to\n\t\t// ban it from template parameters.\n\t\t/:([^\\/.-]+)(\\.{3}|\\.(?!\\.)|-)?|[\\\\^$*+.()|\\[\\]{}]/g,\n\t\tfunction(m, key, extra) {\n\t\t\tif (key == null) return \"\\\\\" + m\n\t\t\tkeys.push({k: key, r: extra === \"...\"})\n\t\t\tif (extra === \"...\") return \"(.*)\"\n\t\t\tif (extra === \".\") return \"([^/]+)\\\\.\"\n\t\t\treturn \"([^/]+)\" + (extra || \"\")\n\t\t}\n\t) + \"$\")\n\treturn function(data) {\n\t\t// First, check the params. Usually, there isn't any, and it's just\n\t\t// checking a static set.\n\t\tfor (var i = 0; i < templateKeys.length; i++) {\n\t\t\tif (templateData.params[templateKeys[i]] !== data.params[templateKeys[i]]) return false\n\t\t}\n\t\t// If no interpolations exist, let's skip all the ceremony\n\t\tif (!keys.length) return regexp.test(data.path)\n\t\tvar values = regexp.exec(data.path)\n\t\tif (values == null) return false\n\t\tfor (var i = 0; i < keys.length; i++) {\n\t\t\tdata.params[keys[i].k] = keys[i].r ? values[i + 1] : decodeURIComponent(values[i + 1])\n\t\t}\n\t\treturn true\n\t}\n}\n\n},{\"./parse\":18}],18:[function(require,module,exports){\n\"use strict\"\n\nvar parseQueryString = require(\"../querystring/parse\")\n\n// Returns `{path, params}` from `url`\nmodule.exports = function(url) {\n\tvar queryIndex = url.indexOf(\"?\")\n\tvar hashIndex = url.indexOf(\"#\")\n\tvar queryEnd = hashIndex < 0 ? url.length : hashIndex\n\tvar pathEnd = queryIndex < 0 ? queryEnd : queryIndex\n\tvar path = url.slice(0, pathEnd).replace(/\\/{2,}/g, \"/\")\n\n\tif (!path) path = \"/\"\n\telse {\n\t\tif (path[0] !== \"/\") path = \"/\" + path\n\t\tif (path.length > 1 && path[path.length - 1] === \"/\") path = path.slice(0, -1)\n\t}\n\treturn {\n\t\tpath: path,\n\t\tparams: queryIndex < 0\n\t\t\t? {}\n\t\t\t: parseQueryString(url.slice(queryIndex + 1, queryEnd)),\n\t}\n}\n\n},{\"../querystring/parse\":22}],19:[function(require,module,exports){\n(function (setImmediate){\n\"use strict\"\n/** @constructor */\nvar PromisePolyfill = function(executor) {\n\tif (!(this instanceof PromisePolyfill)) throw new Error(\"Promise must be called with `new`\")\n\tif (typeof executor !== \"function\") throw new TypeError(\"executor must be a function\")\n\n\tvar self = this, resolvers = [], rejectors = [], resolveCurrent = handler(resolvers, true), rejectCurrent = handler(rejectors, false)\n\tvar instance = self._instance = {resolvers: resolvers, rejectors: rejectors}\n\tvar callAsync = typeof setImmediate === \"function\" ? setImmediate : setTimeout\n\tfunction handler(list, shouldAbsorb) {\n\t\treturn function execute(value) {\n\t\t\tvar then\n\t\t\ttry {\n\t\t\t\tif (shouldAbsorb && value != null && (typeof value === \"object\" || typeof value === \"function\") && typeof (then = value.then) === \"function\") {\n\t\t\t\t\tif (value === self) throw new TypeError(\"Promise can't be resolved w/ itself\")\n\t\t\t\t\texecuteOnce(then.bind(value))\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tcallAsync(function() {\n\t\t\t\t\t\tif (!shouldAbsorb && list.length === 0) console.error(\"Possible unhandled promise rejection:\", value)\n\t\t\t\t\t\tfor (var i = 0; i < list.length; i++) list[i](value)\n\t\t\t\t\t\tresolvers.length = 0, rejectors.length = 0\n\t\t\t\t\t\tinstance.state = shouldAbsorb\n\t\t\t\t\t\tinstance.retry = function() {execute(value)}\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (e) {\n\t\t\t\trejectCurrent(e)\n\t\t\t}\n\t\t}\n\t}\n\tfunction executeOnce(then) {\n\t\tvar runs = 0\n\t\tfunction run(fn) {\n\t\t\treturn function(value) {\n\t\t\t\tif (runs++ > 0) return\n\t\t\t\tfn(value)\n\t\t\t}\n\t\t}\n\t\tvar onerror = run(rejectCurrent)\n\t\ttry {then(run(resolveCurrent), onerror)} catch (e) {onerror(e)}\n\t}\n\n\texecuteOnce(executor)\n}\nPromisePolyfill.prototype.then = function(onFulfilled, onRejection) {\n\tvar self = this, instance = self._instance\n\tfunction handle(callback, list, next, state) {\n\t\tlist.push(function(value) {\n\t\t\tif (typeof callback !== \"function\") next(value)\n\t\t\telse try {resolveNext(callback(value))} catch (e) {if (rejectNext) rejectNext(e)}\n\t\t})\n\t\tif (typeof instance.retry === \"function\" && state === instance.state) instance.retry()\n\t}\n\tvar resolveNext, rejectNext\n\tvar promise = new PromisePolyfill(function(resolve, reject) {resolveNext = resolve, rejectNext = reject})\n\thandle(onFulfilled, instance.resolvers, resolveNext, true), handle(onRejection, instance.rejectors, rejectNext, false)\n\treturn promise\n}\nPromisePolyfill.prototype.catch = function(onRejection) {\n\treturn this.then(null, onRejection)\n}\nPromisePolyfill.prototype.finally = function(callback) {\n\treturn this.then(\n\t\tfunction(value) {\n\t\t\treturn PromisePolyfill.resolve(callback()).then(function() {\n\t\t\t\treturn value\n\t\t\t})\n\t\t},\n\t\tfunction(reason) {\n\t\t\treturn PromisePolyfill.resolve(callback()).then(function() {\n\t\t\t\treturn PromisePolyfill.reject(reason);\n\t\t\t})\n\t\t}\n\t)\n}\nPromisePolyfill.resolve = function(value) {\n\tif (value instanceof PromisePolyfill) return value\n\treturn new PromisePolyfill(function(resolve) {resolve(value)})\n}\nPromisePolyfill.reject = function(value) {\n\treturn new PromisePolyfill(function(resolve, reject) {reject(value)})\n}\nPromisePolyfill.all = function(list) {\n\treturn new PromisePolyfill(function(resolve, reject) {\n\t\tvar total = list.length, count = 0, values = []\n\t\tif (list.length === 0) resolve([])\n\t\telse for (var i = 0; i < list.length; i++) {\n\t\t\t(function(i) {\n\t\t\t\tfunction consume(value) {\n\t\t\t\t\tcount++\n\t\t\t\t\tvalues[i] = value\n\t\t\t\t\tif (count === total) resolve(values)\n\t\t\t\t}\n\t\t\t\tif (list[i] != null && (typeof list[i] === \"object\" || typeof list[i] === \"function\") && typeof list[i].then === \"function\") {\n\t\t\t\t\tlist[i].then(consume, reject)\n\t\t\t\t}\n\t\t\t\telse consume(list[i])\n\t\t\t})(i)\n\t\t}\n\t})\n}\nPromisePolyfill.race = function(list) {\n\treturn new PromisePolyfill(function(resolve, reject) {\n\t\tfor (var i = 0; i < list.length; i++) {\n\t\t\tlist[i].then(resolve, reject)\n\t\t}\n\t})\n}\n\nmodule.exports = PromisePolyfill\n\n}).call(this,require(\"timers\").setImmediate)\n},{\"timers\":34}],20:[function(require,module,exports){\n(function (global){\n\"use strict\"\n\nvar PromisePolyfill = require(\"./polyfill\")\n\nif (typeof window !== \"undefined\") {\n\tif (typeof window.Promise === \"undefined\") {\n\t\twindow.Promise = PromisePolyfill\n\t} else if (!window.Promise.prototype.finally) {\n\t\twindow.Promise.prototype.finally = PromisePolyfill.prototype.finally\n\t}\n\tmodule.exports = window.Promise\n} else if (typeof global !== \"undefined\") {\n\tif (typeof global.Promise === \"undefined\") {\n\t\tglobal.Promise = PromisePolyfill\n\t} else if (!global.Promise.prototype.finally) {\n\t\tglobal.Promise.prototype.finally = PromisePolyfill.prototype.finally\n\t}\n\tmodule.exports = global.Promise\n} else {\n\tmodule.exports = PromisePolyfill\n}\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"./polyfill\":19}],21:[function(require,module,exports){\n\"use strict\"\n\nmodule.exports = function(object) {\n\tif (Object.prototype.toString.call(object) !== \"[object Object]\") return \"\"\n\n\tvar args = []\n\tfor (var key in object) {\n\t\tdestructure(key, object[key])\n\t}\n\n\treturn args.join(\"&\")\n\n\tfunction destructure(key, value) {\n\t\tif (Array.isArray(value)) {\n\t\t\tfor (var i = 0; i < value.length; i++) {\n\t\t\t\tdestructure(key + \"[\" + i + \"]\", value[i])\n\t\t\t}\n\t\t}\n\t\telse if (Object.prototype.toString.call(value) === \"[object Object]\") {\n\t\t\tfor (var i in value) {\n\t\t\t\tdestructure(key + \"[\" + i + \"]\", value[i])\n\t\t\t}\n\t\t}\n\t\telse args.push(encodeURIComponent(key) + (value != null && value !== \"\" ? \"=\" + encodeURIComponent(value) : \"\"))\n\t}\n}\n\n},{}],22:[function(require,module,exports){\n\"use strict\"\n\nmodule.exports = function(string) {\n\tif (string === \"\" || string == null) return {}\n\tif (string.charAt(0) === \"?\") string = string.slice(1)\n\n\tvar entries = string.split(\"&\"), counters = {}, data = {}\n\tfor (var i = 0; i < entries.length; i++) {\n\t\tvar entry = entries[i].split(\"=\")\n\t\tvar key = decodeURIComponent(entry[0])\n\t\tvar value = entry.length === 2 ? decodeURIComponent(entry[1]) : \"\"\n\n\t\tif (value === \"true\") value = true\n\t\telse if (value === \"false\") value = false\n\n\t\tvar levels = key.split(/\\]\\[?|\\[/)\n\t\tvar cursor = data\n\t\tif (key.indexOf(\"[\") > -1) levels.pop()\n\t\tfor (var j = 0; j < levels.length; j++) {\n\t\t\tvar level = levels[j], nextLevel = levels[j + 1]\n\t\t\tvar isNumber = nextLevel == \"\" || !isNaN(parseInt(nextLevel, 10))\n\t\t\tif (level === \"\") {\n\t\t\t\tvar key = levels.slice(0, j).join()\n\t\t\t\tif (counters[key] == null) {\n\t\t\t\t\tcounters[key] = Array.isArray(cursor) ? cursor.length : 0\n\t\t\t\t}\n\t\t\t\tlevel = counters[key]++\n\t\t\t}\n\t\t\t// Disallow direct prototype pollution\n\t\t\telse if (level === \"__proto__\") break\n\t\t\tif (j === levels.length - 1) cursor[level] = value\n\t\t\telse {\n\t\t\t\t// Read own properties exclusively to disallow indirect\n\t\t\t\t// prototype pollution\n\t\t\t\tvar desc = Object.getOwnPropertyDescriptor(cursor, level)\n\t\t\t\tif (desc != null) desc = desc.value\n\t\t\t\tif (desc == null) cursor[level] = desc = isNumber ? [] : {}\n\t\t\t\tcursor = desc\n\t\t\t}\n\t\t}\n\t}\n\treturn data\n}\n\n},{}],23:[function(require,module,exports){\n\"use strict\"\n\nmodule.exports = require(\"./render/render\")(window)\n\n},{\"./render/render\":27}],24:[function(require,module,exports){\n\"use strict\"\n\nvar Vnode = require(\"../render/vnode\")\nvar hyperscriptVnode = require(\"./hyperscriptVnode\")\n\nmodule.exports = function() {\n\tvar vnode = hyperscriptVnode.apply(0, arguments)\n\n\tvnode.tag = \"[\"\n\tvnode.children = Vnode.normalizeChildren(vnode.children)\n\treturn vnode\n}\n\n},{\"../render/vnode\":29,\"./hyperscriptVnode\":26}],25:[function(require,module,exports){\n\"use strict\"\n\nvar Vnode = require(\"../render/vnode\")\nvar hyperscriptVnode = require(\"./hyperscriptVnode\")\n\nvar selectorParser = /(?:(^|#|\\.)([^#\\.\\[\\]]+))|(\\[(.+?)(?:\\s*=\\s*(\"|'|)((?:\\\\[\"'\\]]|.)*?)\\5)?\\])/g\nvar selectorCache = {}\nvar hasOwn = {}.hasOwnProperty\n\nfunction isEmpty(object) {\n\tfor (var key in object) if (hasOwn.call(object, key)) return false\n\treturn true\n}\n\nfunction compileSelector(selector) {\n\tvar match, tag = \"div\", classes = [], attrs = {}\n\twhile (match = selectorParser.exec(selector)) {\n\t\tvar type = match[1], value = match[2]\n\t\tif (type === \"\" && value !== \"\") tag = value\n\t\telse if (type === \"#\") attrs.id = value\n\t\telse if (type === \".\") classes.push(value)\n\t\telse if (match[3][0] === \"[\") {\n\t\t\tvar attrValue = match[6]\n\t\t\tif (attrValue) attrValue = attrValue.replace(/\\\\([\"'])/g, \"$1\").replace(/\\\\\\\\/g, \"\\\\\")\n\t\t\tif (match[4] === \"class\") classes.push(attrValue)\n\t\t\telse attrs[match[4]] = attrValue === \"\" ? attrValue : attrValue || true\n\t\t}\n\t}\n\tif (classes.length > 0) attrs.className = classes.join(\" \")\n\treturn selectorCache[selector] = {tag: tag, attrs: attrs}\n}\n\nfunction execSelector(state, vnode) {\n\tvar attrs = vnode.attrs\n\tvar children = Vnode.normalizeChildren(vnode.children)\n\tvar hasClass = hasOwn.call(attrs, \"class\")\n\tvar className = hasClass ? attrs.class : attrs.className\n\n\tvnode.tag = state.tag\n\tvnode.attrs = null\n\tvnode.children = undefined\n\n\tif (!isEmpty(state.attrs) && !isEmpty(attrs)) {\n\t\tvar newAttrs = {}\n\n\t\tfor (var key in attrs) {\n\t\t\tif (hasOwn.call(attrs, key)) newAttrs[key] = attrs[key]\n\t\t}\n\n\t\tattrs = newAttrs\n\t}\n\n\tfor (var key in state.attrs) {\n\t\tif (hasOwn.call(state.attrs, key) && key !== \"className\" && !hasOwn.call(attrs, key)){\n\t\t\tattrs[key] = state.attrs[key]\n\t\t}\n\t}\n\tif (className != null || state.attrs.className != null) attrs.className =\n\t\tclassName != null\n\t\t\t? state.attrs.className != null\n\t\t\t\t? String(state.attrs.className) + \" \" + String(className)\n\t\t\t\t: className\n\t\t\t: state.attrs.className != null\n\t\t\t\t? state.attrs.className\n\t\t\t\t: null\n\n\tif (hasClass) attrs.class = null\n\n\tfor (var key in attrs) {\n\t\tif (hasOwn.call(attrs, key) && key !== \"key\") {\n\t\t\tvnode.attrs = attrs\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif (Array.isArray(children) && children.length === 1 && children[0] != null && children[0].tag === \"#\") {\n\t\tvnode.text = children[0].children\n\t} else {\n\t\tvnode.children = children\n\t}\n\n\treturn vnode\n}\n\nfunction hyperscript(selector) {\n\tif (selector == null || typeof selector !== \"string\" && typeof selector !== \"function\" && typeof selector.view !== \"function\") {\n\t\tthrow Error(\"The selector must be either a string or a component.\");\n\t}\n\n\tvar vnode = hyperscriptVnode.apply(1, arguments)\n\n\tif (typeof selector === \"string\") {\n\t\tvnode.children = Vnode.normalizeChildren(vnode.children)\n\t\tif (selector !== \"[\") return execSelector(selectorCache[selector] || compileSelector(selector), vnode)\n\t}\n\n\tvnode.tag = selector\n\treturn vnode\n}\n\nmodule.exports = hyperscript\n\n},{\"../render/vnode\":29,\"./hyperscriptVnode\":26}],26:[function(require,module,exports){\n\"use strict\"\n\nvar Vnode = require(\"../render/vnode\")\n\n// Call via `hyperscriptVnode.apply(startOffset, arguments)`\n//\n// The reason I do it this way, forwarding the arguments and passing the start\n// offset in `this`, is so I don't have to create a temporary array in a\n// performance-critical path.\n//\n// In native ES6, I'd instead add a final `...args` parameter to the\n// `hyperscript` and `fragment` factories and define this as\n// `hyperscriptVnode(...args)`, since modern engines do optimize that away. But\n// ES5 (what Mithril requires thanks to IE support) doesn't give me that luxury,\n// and engines aren't nearly intelligent enough to do either of these:\n//\n// 1. Elide the allocation for `[].slice.call(arguments, 1)` when it's passed to\n// another function only to be indexed.\n// 2. Elide an `arguments` allocation when it's passed to any function other\n// than `Function.prototype.apply` or `Reflect.apply`.\n//\n// In ES6, it'd probably look closer to this (I'd need to profile it, though):\n// module.exports = function(attrs, ...children) {\n// if (attrs == null || typeof attrs === \"object\" && attrs.tag == null && !Array.isArray(attrs)) {\n// if (children.length === 1 && Array.isArray(children[0])) children = children[0]\n// } else {\n// children = children.length === 0 && Array.isArray(attrs) ? attrs : [attrs, ...children]\n// attrs = undefined\n// }\n//\n// if (attrs == null) attrs = {}\n// return Vnode(\"\", attrs.key, attrs, children)\n// }\nmodule.exports = function() {\n\tvar attrs = arguments[this], start = this + 1, children\n\n\tif (attrs == null) {\n\t\tattrs = {}\n\t} else if (typeof attrs !== \"object\" || attrs.tag != null || Array.isArray(attrs)) {\n\t\tattrs = {}\n\t\tstart = this\n\t}\n\n\tif (arguments.length === start + 1) {\n\t\tchildren = arguments[start]\n\t\tif (!Array.isArray(children)) children = [children]\n\t} else {\n\t\tchildren = []\n\t\twhile (start < arguments.length) children.push(arguments[start++])\n\t}\n\n\treturn Vnode(\"\", attrs.key, attrs, children)\n}\n\n},{\"../render/vnode\":29}],27:[function(require,module,exports){\n\"use strict\"\n\nvar Vnode = require(\"../render/vnode\")\n\nmodule.exports = function($window) {\n\tvar $doc = $window && $window.document\n\tvar currentRedraw\n\n\tvar nameSpace = {\n\t\tsvg: \"http://www.w3.org/2000/svg\",\n\t\tmath: \"http://www.w3.org/1998/Math/MathML\"\n\t}\n\n\tfunction getNameSpace(vnode) {\n\t\treturn vnode.attrs && vnode.attrs.xmlns || nameSpace[vnode.tag]\n\t}\n\n\t//sanity check to discourage people from doing `vnode.state = ...`\n\tfunction checkState(vnode, original) {\n\t\tif (vnode.state !== original) throw new Error(\"`vnode.state` must not be modified\")\n\t}\n\n\t//Note: the hook is passed as the `this` argument to allow proxying the\n\t//arguments without requiring a full array allocation to do so. It also\n\t//takes advantage of the fact the current `vnode` is the first argument in\n\t//all lifecycle methods.\n\tfunction callHook(vnode) {\n\t\tvar original = vnode.state\n\t\ttry {\n\t\t\treturn this.apply(original, arguments)\n\t\t} finally {\n\t\t\tcheckState(vnode, original)\n\t\t}\n\t}\n\n\t// IE11 (at least) throws an UnspecifiedError when accessing document.activeElement when\n\t// inside an iframe. Catch and swallow this error, and heavy-handidly return null.\n\tfunction activeElement() {\n\t\ttry {\n\t\t\treturn $doc.activeElement\n\t\t} catch (e) {\n\t\t\treturn null\n\t\t}\n\t}\n\t//create\n\tfunction createNodes(parent, vnodes, start, end, hooks, nextSibling, ns) {\n\t\tfor (var i = start; i < end; i++) {\n\t\t\tvar vnode = vnodes[i]\n\t\t\tif (vnode != null) {\n\t\t\t\tcreateNode(parent, vnode, hooks, ns, nextSibling)\n\t\t\t}\n\t\t}\n\t}\n\tfunction createNode(parent, vnode, hooks, ns, nextSibling) {\n\t\tvar tag = vnode.tag\n\t\tif (typeof tag === \"string\") {\n\t\t\tvnode.state = {}\n\t\t\tif (vnode.attrs != null) initLifecycle(vnode.attrs, vnode, hooks)\n\t\t\tswitch (tag) {\n\t\t\t\tcase \"#\": createText(parent, vnode, nextSibling); break\n\t\t\t\tcase \"<\": createHTML(parent, vnode, ns, nextSibling); break\n\t\t\t\tcase \"[\": createFragment(parent, vnode, hooks, ns, nextSibling); break\n\t\t\t\tdefault: createElement(parent, vnode, hooks, ns, nextSibling)\n\t\t\t}\n\t\t}\n\t\telse createComponent(parent, vnode, hooks, ns, nextSibling)\n\t}\n\tfunction createText(parent, vnode, nextSibling) {\n\t\tvnode.dom = $doc.createTextNode(vnode.children)\n\t\tinsertNode(parent, vnode.dom, nextSibling)\n\t}\n\tvar possibleParents = {caption: \"table\", thead: \"table\", tbody: \"table\", tfoot: \"table\", tr: \"tbody\", th: \"tr\", td: \"tr\", colgroup: \"table\", col: \"colgroup\"}\n\tfunction createHTML(parent, vnode, ns, nextSibling) {\n\t\tvar match = vnode.children.match(/^\\s*?<(\\w+)/im) || []\n\t\t// not using the proper parent makes the child element(s) vanish.\n\t\t// var div = document.createElement(\"div\")\n\t\t// div.innerHTML = \"<td>i</td><td>j</td>\"\n\t\t// console.log(div.innerHTML)\n\t\t// --> \"ij\", no <td> in sight.\n\t\tvar temp = $doc.createElement(possibleParents[match[1]] || \"div\")\n\t\tif (ns === \"http://www.w3.org/2000/svg\") {\n\t\t\ttemp.innerHTML = \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\">\" + vnode.children + \"</svg>\"\n\t\t\ttemp = temp.firstChild\n\t\t} else {\n\t\t\ttemp.innerHTML = vnode.children\n\t\t}\n\t\tvnode.dom = temp.firstChild\n\t\tvnode.domSize = temp.childNodes.length\n\t\t// Capture nodes to remove, so we don't confuse them.\n\t\tvnode.instance = []\n\t\tvar fragment = $doc.createDocumentFragment()\n\t\tvar child\n\t\twhile (child = temp.firstChild) {\n\t\t\tvnode.instance.push(child)\n\t\t\tfragment.appendChild(child)\n\t\t}\n\t\tinsertNode(parent, fragment, nextSibling)\n\t}\n\tfunction createFragment(parent, vnode, hooks, ns, nextSibling) {\n\t\tvar fragment = $doc.createDocumentFragment()\n\t\tif (vnode.children != null) {\n\t\t\tvar children = vnode.children\n\t\t\tcreateNodes(fragment, children, 0, children.length, hooks, null, ns)\n\t\t}\n\t\tvnode.dom = fragment.firstChild\n\t\tvnode.domSize = fragment.childNodes.length\n\t\tinsertNode(parent, fragment, nextSibling)\n\t}\n\tfunction createElement(parent, vnode, hooks, ns, nextSibling) {\n\t\tvar tag = vnode.tag\n\t\tvar attrs = vnode.attrs\n\t\tvar is = attrs && attrs.is\n\n\t\tns = getNameSpace(vnode) || ns\n\n\t\tvar element = ns ?\n\t\t\tis ? $doc.createElementNS(ns, tag, {is: is}) : $doc.createElementNS(ns, tag) :\n\t\t\tis ? $doc.createElement(tag, {is: is}) : $doc.createElement(tag)\n\t\tvnode.dom = element\n\n\t\tif (attrs != null) {\n\t\t\tsetAttrs(vnode, attrs, ns)\n\t\t}\n\n\t\tinsertNode(parent, element, nextSibling)\n\n\t\tif (!maybeSetContentEditable(vnode)) {\n\t\t\tif (vnode.text != null) {\n\t\t\t\tif (vnode.text !== \"\") element.textContent = vnode.text\n\t\t\t\telse vnode.children = [Vnode(\"#\", undefined, undefined, vnode.text, undefined, undefined)]\n\t\t\t}\n\t\t\tif (vnode.children != null) {\n\t\t\t\tvar children = vnode.children\n\t\t\t\tcreateNodes(element, children, 0, children.length, hooks, null, ns)\n\t\t\t\tif (vnode.tag === \"select\" && attrs != null) setLateSelectAttrs(vnode, attrs)\n\t\t\t}\n\t\t}\n\t}\n\tfunction initComponent(vnode, hooks) {\n\t\tvar sentinel\n\t\tif (typeof vnode.tag.view === \"function\") {\n\t\t\tvnode.state = Object.create(vnode.tag)\n\t\t\tsentinel = vnode.state.view\n\t\t\tif (sentinel.$$reentrantLock$$ != null) return\n\t\t\tsentinel.$$reentrantLock$$ = true\n\t\t} else {\n\t\t\tvnode.state = void 0\n\t\t\tsentinel = vnode.tag\n\t\t\tif (sentinel.$$reentrantLock$$ != null) return\n\t\t\tsentinel.$$reentrantLock$$ = true\n\t\t\tvnode.state = (vnode.tag.prototype != null && typeof vnode.tag.prototype.view === \"function\") ? new vnode.tag(vnode) : vnode.tag(vnode)\n\t\t}\n\t\tinitLifecycle(vnode.state, vnode, hooks)\n\t\tif (vnode.attrs != null) initLifecycle(vnode.attrs, vnode, hooks)\n\t\tvnode.instance = Vnode.normalize(callHook.call(vnode.state.view, vnode))\n\t\tif (vnode.instance === vnode) throw Error(\"A view cannot return the vnode it received as argument\")\n\t\tsentinel.$$reentrantLock$$ = null\n\t}\n\tfunction createComponent(parent, vnode, hooks, ns, nextSibling) {\n\t\tinitComponent(vnode, hooks)\n\t\tif (vnode.instance != null) {\n\t\t\tcreateNode(parent, vnode.instance, hooks, ns, nextSibling)\n\t\t\tvnode.dom = vnode.instance.dom\n\t\t\tvnode.domSize = vnode.dom != null ? vnode.instance.domSize : 0\n\t\t}\n\t\telse {\n\t\t\tvnode.domSize = 0\n\t\t}\n\t}\n\n\t//update\n\t/**\n\t * @param {Element|Fragment} parent - the parent element\n\t * @param {Vnode[] | null} old - the list of vnodes of the last `render()` call for\n\t * this part of the tree\n\t * @param {Vnode[] | null} vnodes - as above, but for the current `render()` call.\n\t * @param {Function[]} hooks - an accumulator of post-render hooks (oncreate/onupdate)\n\t * @param {Element | null} nextSibling - the next DOM node if we're dealing with a\n\t * fragment that is not the last item in its\n\t * parent\n\t * @param {'svg' | 'math' | String | null} ns) - the current XML namespace, if any\n\t * @returns void\n\t */\n\t// This function diffs and patches lists of vnodes, both keyed and unkeyed.\n\t//\n\t// We will:\n\t//\n\t// 1. describe its general structure\n\t// 2. focus on the diff algorithm optimizations\n\t// 3. discuss DOM node operations.\n\n\t// ## Overview:\n\t//\n\t// The updateNodes() function:\n\t// - deals with trivial cases\n\t// - determines whether the lists are keyed or unkeyed based on the first non-null node\n\t// of each list.\n\t// - diffs them and patches the DOM if needed (that's the brunt of the code)\n\t// - manages the leftovers: after diffing, are there:\n\t// - old nodes left to remove?\n\t// \t - new nodes to insert?\n\t// \t deal with them!\n\t//\n\t// The lists are only iterated over once, with an exception for the nodes in `old` that\n\t// are visited in the fourth part of the diff and in the `removeNodes` loop.\n\n\t// ## Diffing\n\t//\n\t// Reading https://github.com/localvoid/ivi/blob/ddc09d06abaef45248e6133f7040d00d3c6be853/packages/ivi/src/vdom/implementation.ts#L617-L837\n\t// may be good for context on longest increasing subsequence-based logic for moving nodes.\n\t//\n\t// In order to diff keyed lists, one has to\n\t//\n\t// 1) match nodes in both lists, per key, and update them accordingly\n\t// 2) create the nodes present in the new list, but absent in the old one\n\t// 3) remove the nodes present in the old list, but absent in the new one\n\t// 4) figure out what nodes in 1) to move in order to minimize the DOM operations.\n\t//\n\t// To achieve 1) one can create a dictionary of keys => index (for the old list), then iterate\n\t// over the new list and for each new vnode, find the corresponding vnode in the old list using\n\t// the map.\n\t// 2) is achieved in the same step: if a new node has no corresponding entry in the map, it is new\n\t// and must be created.\n\t// For the removals, we actually remove the nodes that have been updated from the old list.\n\t// The nodes that remain in that list after 1) and 2) have been performed can be safely removed.\n\t// The fourth step is a bit more complex and relies on the longest increasing subsequence (LIS)\n\t// algorithm.\n\t//\n\t// the longest increasing subsequence is the list of nodes that can remain in place. Imagine going\n\t// from `1,2,3,4,5` to `4,5,1,2,3` where the numbers are not necessarily the keys, but the indices\n\t// corresponding to the keyed nodes in the old list (keyed nodes `e,d,c,b,a` => `b,a,e,d,c` would\n\t// match the above lists, for example).\n\t//\n\t// In there are two increasing subsequences: `4,5` and `1,2,3`, the latter being the longest. We\n\t// can update those nodes without moving them, and only call `insertNode` on `4` and `5`.\n\t//\n\t// @localvoid adapted the algo to also support node deletions and insertions (the `lis` is actually\n\t// the longest increasing subsequence *of old nodes still present in the new list*).\n\t//\n\t// It is a general algorithm that is fireproof in all circumstances, but it requires the allocation\n\t// and the construction of a `key => oldIndex` map, and three arrays (one with `newIndex => oldIndex`,\n\t// the `LIS` and a temporary one to create the LIS).\n\t//\n\t// So we cheat where we can: if the tails of the lists are identical, they are guaranteed to be part of\n\t// the LIS and can be updated without moving them.\n\t//\n\t// If two nodes are swapped, they are guaranteed not to be part of the LIS, and must be moved (with\n\t// the exception of the last node if the list is fully reversed).\n\t//\n\t// ## Finding the next sibling.\n\t//\n\t// `updateNode()` and `createNode()` expect a nextSibling parameter to perform DOM operations.\n\t// When the list is being traversed top-down, at any index, the DOM nodes up to the previous\n\t// vnode reflect the content of the new list, whereas the rest of the DOM nodes reflect the old\n\t// list. The next sibling must be looked for in the old list using `getNextSibling(... oldStart + 1 ...)`.\n\t//\n\t// In the other scenarios (swaps, upwards traversal, map-based diff),\n\t// the new vnodes list is traversed upwards. The DOM nodes at the bottom of the list reflect the\n\t// bottom part of the new vnodes list, and we can use the `v.dom` value of the previous node\n\t// as the next sibling (cached in the `nextSibling` variable).\n\n\n\t// ## DOM node moves\n\t//\n\t// In most scenarios `updateNode()` and `createNode()` perform the DOM operations. However,\n\t// this is not the case if the node moved (second and fourth part of the diff algo). We move\n\t// the old DOM nodes before updateNode runs because it enables us to use the cached `nextSibling`\n\t// variable rather than fetching it using `getNextSibling()`.\n\t//\n\t// The fourth part of the diff currently inserts nodes unconditionally, leading to issues\n\t// like #1791 and #1999. We need to be smarter about those situations where adjascent old\n\t// nodes remain together in the new list in a way that isn't covered by parts one and\n\t// three of the diff algo.\n\n\tfunction updateNodes(parent, old, vnodes, hooks, nextSibling, ns) {\n\t\tif (old === vnodes || old == null && vnodes == null) return\n\t\telse if (old == null || old.length === 0) createNodes(parent, vnodes, 0, vnodes.length, hooks, nextSibling, ns)\n\t\telse if (vnodes == null || vnodes.length === 0) removeNodes(parent, old, 0, old.length)\n\t\telse {\n\t\t\tvar isOldKeyed = old[0] != null && old[0].key != null\n\t\t\tvar isKeyed = vnodes[0] != null && vnodes[0].key != null\n\t\t\tvar start = 0, oldStart = 0\n\t\t\tif (!isOldKeyed) while (oldStart < old.length && old[oldStart] == null) oldStart++\n\t\t\tif (!isKeyed) while (start < vnodes.length && vnodes[start] == null) start++\n\t\t\tif (isKeyed === null && isOldKeyed == null) return // both lists are full of nulls\n\t\t\tif (isOldKeyed !== isKeyed) {\n\t\t\t\tremoveNodes(parent, old, oldStart, old.length)\n\t\t\t\tcreateNodes(parent, vnodes, start, vnodes.length, hooks, nextSibling, ns)\n\t\t\t} else if (!isKeyed) {\n\t\t\t\t// Don't index past the end of either list (causes deopts).\n\t\t\t\tvar commonLength = old.length < vnodes.length ? old.length : vnodes.length\n\t\t\t\t// Rewind if necessary to the first non-null index on either side.\n\t\t\t\t// We could alternatively either explicitly create or remove nodes when `start !== oldStart`\n\t\t\t\t// but that would be optimizing for sparse lists which are more rare than dense ones.\n\t\t\t\tstart = start < oldStart ? start : oldStart\n\t\t\t\tfor (; start < commonLength; start++) {\n\t\t\t\t\to = old[start]\n\t\t\t\t\tv = vnodes[start]\n\t\t\t\t\tif (o === v || o == null && v == null) continue\n\t\t\t\t\telse if (o == null) createNode(parent, v, hooks, ns, getNextSibling(old, start + 1, nextSibling))\n\t\t\t\t\telse if (v == null) removeNode(parent, o)\n\t\t\t\t\telse updateNode(parent, o, v, hooks, getNextSibling(old, start + 1, nextSibling), ns)\n\t\t\t\t}\n\t\t\t\tif (old.length > commonLength) removeNodes(parent, old, start, old.length)\n\t\t\t\tif (vnodes.length > commonLength) createNodes(parent, vnodes, start, vnodes.length, hooks, nextSibling, ns)\n\t\t\t} else {\n\t\t\t\t// keyed diff\n\t\t\t\tvar oldEnd = old.length - 1, end = vnodes.length - 1, map, o, v, oe, ve, topSibling\n\n\t\t\t\t// bottom-up\n\t\t\t\twhile (oldEnd >= oldStart && end >= start) {\n\t\t\t\t\toe = old[oldEnd]\n\t\t\t\t\tve = vnodes[end]\n\t\t\t\t\tif (oe.key !== ve.key) break\n\t\t\t\t\tif (oe !== ve) updateNode(parent, oe, ve, hooks, nextSibling, ns)\n\t\t\t\t\tif (ve.dom != null) nextSibling = ve.dom\n\t\t\t\t\toldEnd--, end--\n\t\t\t\t}\n\t\t\t\t// top-down\n\t\t\t\twhile (oldEnd >= oldStart && end >= start) {\n\t\t\t\t\to = old[oldStart]\n\t\t\t\t\tv = vnodes[start]\n\t\t\t\t\tif (o.key !== v.key) break\n\t\t\t\t\toldStart++, start++\n\t\t\t\t\tif (o !== v) updateNode(parent, o, v, hooks, getNextSibling(old, oldStart, nextSibling), ns)\n\t\t\t\t}\n\t\t\t\t// swaps and list reversals\n\t\t\t\twhile (oldEnd >= oldStart && end >= start) {\n\t\t\t\t\tif (start === end) break\n\t\t\t\t\tif (o.key !== ve.key || oe.key !== v.key) break\n\t\t\t\t\ttopSibling = getNextSibling(old, oldStart, nextSibling)\n\t\t\t\t\tmoveNodes(parent, oe, topSibling)\n\t\t\t\t\tif (oe !== v) updateNode(parent, oe, v, hooks, topSibling, ns)\n\t\t\t\t\tif (++start <= --end) moveNodes(parent, o, nextSibling)\n\t\t\t\t\tif (o !== ve) updateNode(parent, o, ve, hooks, nextSibling, ns)\n\t\t\t\t\tif (ve.dom != null) nextSibling = ve.dom\n\t\t\t\t\toldStart++; oldEnd--\n\t\t\t\t\toe = old[oldEnd]\n\t\t\t\t\tve = vnodes[end]\n\t\t\t\t\to = old[oldStart]\n\t\t\t\t\tv = vnodes[start]\n\t\t\t\t}\n\t\t\t\t// bottom up once again\n\t\t\t\twhile (oldEnd >= oldStart && end >= start) {\n\t\t\t\t\tif (oe.key !== ve.key) break\n\t\t\t\t\tif (oe !== ve) updateNode(parent, oe, ve, hooks, nextSibling, ns)\n\t\t\t\t\tif (ve.dom != null) nextSibling = ve.dom\n\t\t\t\t\toldEnd--, end--\n\t\t\t\t\toe = old[oldEnd]\n\t\t\t\t\tve = vnodes[end]\n\t\t\t\t}\n\t\t\t\tif (start > end) removeNodes(parent, old, oldStart, oldEnd + 1)\n\t\t\t\telse if (oldStart > oldEnd) createNodes(parent, vnodes, start, end + 1, hooks, nextSibling, ns)\n\t\t\t\telse {\n\t\t\t\t\t// inspired by ivi https://github.com/ivijs/ivi/ by Boris Kaul\n\t\t\t\t\tvar originalNextSibling = nextSibling, vnodesLength = end - start + 1, oldIndices = new Array(vnodesLength), li=0, i=0, pos = 2147483647, matched = 0, map, lisIndices\n\t\t\t\t\tfor (i = 0; i < vnodesLength; i++) oldIndices[i] = -1\n\t\t\t\t\tfor (i = end; i >= start; i--) {\n\t\t\t\t\t\tif (map == null) map = getKeyMap(old, oldStart, oldEnd + 1)\n\t\t\t\t\t\tve = vnodes[i]\n\t\t\t\t\t\tvar oldIndex = map[ve.key]\n\t\t\t\t\t\tif (oldIndex != null) {\n\t\t\t\t\t\t\tpos = (oldIndex < pos) ? oldIndex : -1 // becomes -1 if nodes were re-ordered\n\t\t\t\t\t\t\toldIndices[i-start] = oldIndex\n\t\t\t\t\t\t\toe = old[oldIndex]\n\t\t\t\t\t\t\told[oldIndex] = null\n\t\t\t\t\t\t\tif (oe !== ve) updateNode(parent, oe, ve, hooks, nextSibling, ns)\n\t\t\t\t\t\t\tif (ve.dom != null) nextSibling = ve.dom\n\t\t\t\t\t\t\tmatched++\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tnextSibling = originalNextSibling\n\t\t\t\t\tif (matched !== oldEnd - oldStart + 1) removeNodes(parent, old, oldStart, oldEnd + 1)\n\t\t\t\t\tif (matched === 0) createNodes(parent, vnodes, start, end + 1, hooks, nextSibling, ns)\n\t\t\t\t\telse {\n\t\t\t\t\t\tif (pos === -1) {\n\t\t\t\t\t\t\t// the indices of the indices of the items that are part of the\n\t\t\t\t\t\t\t// longest increasing subsequence in the oldIndices list\n\t\t\t\t\t\t\tlisIndices = makeLisIndices(oldIndices)\n\t\t\t\t\t\t\tli = lisIndices.length - 1\n\t\t\t\t\t\t\tfor (i = end; i >= start; i--) {\n\t\t\t\t\t\t\t\tv = vnodes[i]\n\t\t\t\t\t\t\t\tif (oldIndices[i-start] === -1) createNode(parent, v, hooks, ns, nextSibling)\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tif (lisIndices[li] === i - start) li--\n\t\t\t\t\t\t\t\t\telse moveNodes(parent, v, nextSibling)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (v.dom != null) nextSibling = vnodes[i].dom\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfor (i = end; i >= start; i--) {\n\t\t\t\t\t\t\t\tv = vnodes[i]\n\t\t\t\t\t\t\t\tif (oldIndices[i-start] === -1) createNode(parent, v, hooks, ns, nextSibling)\n\t\t\t\t\t\t\t\tif (v.dom != null) nextSibling = vnodes[i].dom\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfunction updateNode(parent, old, vnode, hooks, nextSibling, ns) {\n\t\tvar oldTag = old.tag, tag = vnode.tag\n\t\tif (oldTag === tag) {\n\t\t\tvnode.state = old.state\n\t\t\tvnode.events = old.events\n\t\t\tif (shouldNotUpdate(vnode, old)) return\n\t\t\tif (typeof oldTag === \"string\") {\n\t\t\t\tif (vnode.attrs != null) {\n\t\t\t\t\tupdateLifecycle(vnode.attrs, vnode, hooks)\n\t\t\t\t}\n\t\t\t\tswitch (oldTag) {\n\t\t\t\t\tcase \"#\": updateText(old, vnode); break\n\t\t\t\t\tcase \"<\": updateHTML(parent, old, vnode, ns, nextSibling); break\n\t\t\t\t\tcase \"[\": updateFragment(parent, old, vnode, hooks, nextSibling, ns); break\n\t\t\t\t\tdefault: updateElement(old, vnode, hooks, ns)\n\t\t\t\t}\n\t\t\t}\n\t\t\telse updateComponent(parent, old, vnode, hooks, nextSibling, ns)\n\t\t}\n\t\telse {\n\t\t\tremoveNode(parent, old)\n\t\t\tcreateNode(parent, vnode, hooks, ns, nextSibling)\n\t\t}\n\t}\n\tfunction updateText(old, vnode) {\n\t\tif (old.children.toString() !== vnode.children.toString()) {\n\t\t\told.dom.nodeValue = vnode.children\n\t\t}\n\t\tvnode.dom = old.dom\n\t}\n\tfunction updateHTML(parent, old, vnode, ns, nextSibling) {\n\t\tif (old.children !== vnode.children) {\n\t\t\tremoveHTML(parent, old)\n\t\t\tcreateHTML(parent, vnode, ns, nextSibling)\n\t\t}\n\t\telse {\n\t\t\tvnode.dom = old.dom\n\t\t\tvnode.domSize = old.domSize\n\t\t\tvnode.instance = old.instance\n\t\t}\n\t}\n\tfunction updateFragment(parent, old, vnode, hooks, nextSibling, ns) {\n\t\tupdateNodes(parent, old.children, vnode.children, hooks, nextSibling, ns)\n\t\tvar domSize = 0, children = vnode.children\n\t\tvnode.dom = null\n\t\tif (children != null) {\n\t\t\tfor (var i = 0; i < children.length; i++) {\n\t\t\t\tvar child = children[i]\n\t\t\t\tif (child != null && child.dom != null) {\n\t\t\t\t\tif (vnode.dom == null) vnode.dom = child.dom\n\t\t\t\t\tdomSize += child.domSize || 1\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (domSize !== 1) vnode.domSize = domSize\n\t\t}\n\t}\n\tfunction updateElement(old, vnode, hooks, ns) {\n\t\tvar element = vnode.dom = old.dom\n\t\tns = getNameSpace(vnode) || ns\n\n\t\tif (vnode.tag === \"textarea\") {\n\t\t\tif (vnode.attrs == null) vnode.attrs = {}\n\t\t\tif (vnode.text != null) {\n\t\t\t\tvnode.attrs.value = vnode.text //FIXME handle multiple children\n\t\t\t\tvnode.text = undefined\n\t\t\t}\n\t\t}\n\t\tupdateAttrs(vnode, old.attrs, vnode.attrs, ns)\n\t\tif (!maybeSetContentEditable(vnode)) {\n\t\t\tif (old.text != null && vnode.text != null && vnode.text !== \"\") {\n\t\t\t\tif (old.text.toString() !== vnode.text.toString()) old.dom.firstChild.nodeValue = vnode.text\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (old.text != null) old.children = [Vnode(\"#\", undefined, undefined, old.text, undefined, old.dom.firstChild)]\n\t\t\t\tif (vnode.text != null) vnode.children = [Vnode(\"#\", undefined, undefined, vnode.text, undefined, undefined)]\n\t\t\t\tupdateNodes(element, old.children, vnode.children, hooks, null, ns)\n\t\t\t}\n\t\t}\n\t}\n\tfunction updateComponent(parent, old, vnode, hooks, nextSibling, ns) {\n\t\tvnode.instance = Vnode.normalize(callHook.call(vnode.state.view, vnode))\n\t\tif (vnode.instance === vnode) throw Error(\"A view cannot return the vnode it received as argument\")\n\t\tupdateLifecycle(vnode.state, vnode, hooks)\n\t\tif (vnode.attrs != null) updateLifecycle(vnode.attrs, vnode, hooks)\n\t\tif (vnode.instance != null) {\n\t\t\tif (old.instance == null) createNode(parent, vnode.instance, hooks, ns, nextSibling)\n\t\t\telse updateNode(parent, old.instance, vnode.instance, hooks, nextSibling, ns)\n\t\t\tvnode.dom = vnode.instance.dom\n\t\t\tvnode.domSize = vnode.instance.domSize\n\t\t}\n\t\telse if (old.instance != null) {\n\t\t\tremoveNode(parent, old.instance)\n\t\t\tvnode.dom = undefined\n\t\t\tvnode.domSize = 0\n\t\t}\n\t\telse {\n\t\t\tvnode.dom = old.dom\n\t\t\tvnode.domSize = old.domSize\n\t\t}\n\t}\n\tfunction getKeyMap(vnodes, start, end) {\n\t\tvar map = Object.create(null)\n\t\tfor (; start < end; start++) {\n\t\t\tvar vnode = vnodes[start]\n\t\t\tif (vnode != null) {\n\t\t\t\tvar key = vnode.key\n\t\t\t\tif (key != null) map[key] = start\n\t\t\t}\n\t\t}\n\t\treturn map\n\t}\n\t// Lifted from ivi https://github.com/ivijs/ivi/\n\t// takes a list of unique numbers (-1 is special and can\n\t// occur multiple times) and returns an array with the indices\n\t// of the items that are part of the longest increasing\n\t// subsequece\n\tvar lisTemp = []\n\tfunction makeLisIndices(a) {\n\t\tvar result = [0]\n\t\tvar u = 0, v = 0, i = 0\n\t\tvar il = lisTemp.length = a.length\n\t\tfor (var i = 0; i < il; i++) lisTemp[i] = a[i]\n\t\tfor (var i = 0; i < il; ++i) {\n\t\t\tif (a[i] === -1) continue\n\t\t\tvar j = result[result.length - 1]\n\t\t\tif (a[j] < a[i]) {\n\t\t\t\tlisTemp[i] = j\n\t\t\t\tresult.push(i)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tu = 0\n\t\t\tv = result.length - 1\n\t\t\twhile (u < v) {\n\t\t\t\t// Fast integer average without overflow.\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tvar c = (u >>> 1) + (v >>> 1) + (u & v & 1)\n\t\t\t\tif (a[result[c]] < a[i]) {\n\t\t\t\t\tu = c + 1\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tv = c\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (a[i] < a[result[u]]) {\n\t\t\t\tif (u > 0) lisTemp[i] = result[u - 1]\n\t\t\t\tresult[u] = i\n\t\t\t}\n\t\t}\n\t\tu = result.length\n\t\tv = result[u - 1]\n\t\twhile (u-- > 0) {\n\t\t\tresult[u] = v\n\t\t\tv = lisTemp[v]\n\t\t}\n\t\tlisTemp.length = 0\n\t\treturn result\n\t}\n\n\tfunction getNextSibling(vnodes, i, nextSibling) {\n\t\tfor (; i < vnodes.length; i++) {\n\t\t\tif (vnodes[i] != null && vnodes[i].dom != null) return vnodes[i].dom\n\t\t}\n\t\treturn nextSibling\n\t}\n\n\t// This covers a really specific edge case:\n\t// - Parent node is keyed and contains child\n\t// - Child is removed, returns unresolved promise in `onbeforeremove`\n\t// - Parent node is moved in keyed diff\n\t// - Remaining children still need moved appropriately\n\t//\n\t// Ideally, I'd track removed nodes as well, but that introduces a lot more\n\t// complexity and I'm not exactly interested in doing that.\n\tfunction moveNodes(parent, vnode, nextSibling) {\n\t\tvar frag = $doc.createDocumentFragment()\n\t\tmoveChildToFrag(parent, frag, vnode)\n\t\tinsertNode(parent, frag, nextSibling)\n\t}\n\tfunction moveChildToFrag(parent, frag, vnode) {\n\t\t// Dodge the recursion overhead in a few of the most common cases.\n\t\twhile (vnode.dom != null && vnode.dom.parentNode === parent) {\n\t\t\tif (typeof vnode.tag !== \"string\") {\n\t\t\t\tvnode = vnode.instance\n\t\t\t\tif (vnode != null) continue\n\t\t\t} else if (vnode.tag === \"<\") {\n\t\t\t\tfor (var i = 0; i < vnode.instance.length; i++) {\n\t\t\t\t\tfrag.appendChild(vnode.instance[i])\n\t\t\t\t}\n\t\t\t} else if (vnode.tag !== \"[\") {\n\t\t\t\t// Don't recurse for text nodes *or* elements, just fragments\n\t\t\t\tfrag.appendChild(vnode.dom)\n\t\t\t} else if (vnode.children.length === 1) {\n\t\t\t\tvnode = vnode.children[0]\n\t\t\t\tif (vnode != null) continue\n\t\t\t} else {\n\t\t\t\tfor (var i = 0; i < vnode.children.length; i++) {\n\t\t\t\t\tvar child = vnode.children[i]\n\t\t\t\t\tif (child != null) moveChildToFrag(parent, frag, child)\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfunction insertNode(parent, dom, nextSibling) {\n\t\tif (nextSibling != null) parent.insertBefore(dom, nextSibling)\n\t\telse parent.appendChild(dom)\n\t}\n\n\tfunction maybeSetContentEditable(vnode) {\n\t\tif (vnode.attrs == null || (\n\t\t\tvnode.attrs.contenteditable == null && // attribute\n\t\t\tvnode.attrs.contentEditable == null // property\n\t\t)) return false\n\t\tvar children = vnode.children\n\t\tif (children != null && children.length === 1 && children[0].tag === \"<\") {\n\t\t\tvar content = children[0].children\n\t\t\tif (vnode.dom.innerHTML !== content) vnode.dom.innerHTML = content\n\t\t}\n\t\telse if (vnode.text != null || children != null && children.length !== 0) throw new Error(\"Child node of a contenteditable must be trusted\")\n\t\treturn true\n\t}\n\n\t//remove\n\tfunction removeNodes(parent, vnodes, start, end) {\n\t\tfor (var i = start; i < end; i++) {\n\t\t\tvar vnode = vnodes[i]\n\t\t\tif (vnode != null) removeNode(parent, vnode)\n\t\t}\n\t}\n\tfunction removeNode(parent, vnode) {\n\t\tvar mask = 0\n\t\tvar original = vnode.state\n\t\tvar stateResult, attrsResult\n\t\tif (typeof vnode.tag !== \"string\" && typeof vnode.state.onbeforeremove === \"function\") {\n\t\t\tvar result = callHook.call(vnode.state.onbeforeremove, vnode)\n\t\t\tif (result != null && typeof result.then === \"function\") {\n\t\t\t\tmask = 1\n\t\t\t\tstateResult = result\n\t\t\t}\n\t\t}\n\t\tif (vnode.attrs && typeof vnode.attrs.onbeforeremove === \"function\") {\n\t\t\tvar result = callHook.call(vnode.attrs.onbeforeremove, vnode)\n\t\t\tif (result != null && typeof result.then === \"function\") {\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tmask |= 2\n\t\t\t\tattrsResult = result\n\t\t\t}\n\t\t}\n\t\tcheckState(vnode, original)\n\n\t\t// If we can, try to fast-path it and avoid all the overhead of awaiting\n\t\tif (!mask) {\n\t\t\tonremove(vnode)\n\t\t\tremoveChild(parent, vnode)\n\t\t} else {\n\t\t\tif (stateResult != null) {\n\t\t\t\tvar next = function () {\n\t\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\t\tif (mask & 1) { mask &= 2; if (!mask) reallyRemove() }\n\t\t\t\t}\n\t\t\t\tstateResult.then(next, next)\n\t\t\t}\n\t\t\tif (attrsResult != null) {\n\t\t\t\tvar next = function () {\n\t\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\t\tif (mask & 2) { mask &= 1; if (!mask) reallyRemove() }\n\t\t\t\t}\n\t\t\t\tattrsResult.then(next, next)\n\t\t\t}\n\t\t}\n\n\t\tfunction reallyRemove() {\n\t\t\tcheckState(vnode, original)\n\t\t\tonremove(vnode)\n\t\t\tremoveChild(parent, vnode)\n\t\t}\n\t}\n\tfunction removeHTML(parent, vnode) {\n\t\tfor (var i = 0; i < vnode.instance.length; i++) {\n\t\t\tparent.removeChild(vnode.instance[i])\n\t\t}\n\t}\n\tfunction removeChild(parent, vnode) {\n\t\t// Dodge the recursion overhead in a few of the most common cases.\n\t\twhile (vnode.dom != null && vnode.dom.parentNode === parent) {\n\t\t\tif (typeof vnode.tag !== \"string\") {\n\t\t\t\tvnode = vnode.instance\n\t\t\t\tif (vnode != null) continue\n\t\t\t} else if (vnode.tag === \"<\") {\n\t\t\t\tremoveHTML(parent, vnode)\n\t\t\t} else {\n\t\t\t\tif (vnode.tag !== \"[\") {\n\t\t\t\t\tparent.removeChild(vnode.dom)\n\t\t\t\t\tif (!Array.isArray(vnode.children)) break\n\t\t\t\t}\n\t\t\t\tif (vnode.children.length === 1) {\n\t\t\t\t\tvnode = vnode.children[0]\n\t\t\t\t\tif (vnode != null) continue\n\t\t\t\t} else {\n\t\t\t\t\tfor (var i = 0; i < vnode.children.length; i++) {\n\t\t\t\t\t\tvar child = vnode.children[i]\n\t\t\t\t\t\tif (child != null) removeChild(parent, child)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\tfunction onremove(vnode) {\n\t\tif (typeof vnode.tag !== \"string\" && typeof vnode.state.onremove === \"function\") callHook.call(vnode.state.onremove, vnode)\n\t\tif (vnode.attrs && typeof vnode.attrs.onremove === \"function\") callHook.call(vnode.attrs.onremove, vnode)\n\t\tif (typeof vnode.tag !== \"string\") {\n\t\t\tif (vnode.instance != null) onremove(vnode.instance)\n\t\t} else {\n\t\t\tvar children = vnode.children\n\t\t\tif (Array.isArray(children)) {\n\t\t\t\tfor (var i = 0; i < children.length; i++) {\n\t\t\t\t\tvar child = children[i]\n\t\t\t\t\tif (child != null) onremove(child)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t//attrs\n\tfunction setAttrs(vnode, attrs, ns) {\n\t\tfor (var key in attrs) {\n\t\t\tsetAttr(vnode, key, null, attrs[key], ns)\n\t\t}\n\t}\n\tfunction setAttr(vnode, key, old, value, ns) {\n\t\tif (key === \"key\" || key === \"is\" || value == null || isLifecycleMethod(key) || (old === value && !isFormAttribute(vnode, key)) && typeof value !== \"object\") return\n\t\tif (key[0] === \"o\" && key[1] === \"n\") return updateEvent(vnode, key, value)\n\t\tif (key.slice(0, 6) === \"xlink:\") vnode.dom.setAttributeNS(\"http://www.w3.org/1999/xlink\", key.slice(6), value)\n\t\telse if (key === \"style\") updateStyle(vnode.dom, old, value)\n\t\telse if (hasPropertyKey(vnode, key, ns)) {\n\t\t\tif (key === \"value\") {\n\t\t\t\t// Only do the coercion if we're actually going to check the value.\n\t\t\t\t/* eslint-disable no-implicit-coercion */\n\t\t\t\t//setting input[value] to same value by typing on focused element moves cursor to end in Chrome\n\t\t\t\tif ((vnode.tag === \"input\" || vnode.tag === \"textarea\") && vnode.dom.value === \"\" + value && vnode.dom === activeElement()) return\n\t\t\t\t//setting select[value] to same value while having select open blinks select dropdown in Chrome\n\t\t\t\tif (vnode.tag === \"select\" && old !== null && vnode.dom.value === \"\" + value) return\n\t\t\t\t//setting option[value] to same value while having select open blinks select dropdown in Chrome\n\t\t\t\tif (vnode.tag === \"option\" && old !== null && vnode.dom.value === \"\" + value) return\n\t\t\t\t/* eslint-enable no-implicit-coercion */\n\t\t\t}\n\t\t\t// If you assign an input type that is not supported by IE 11 with an assignment expression, an error will occur.\n\t\t\tif (vnode.tag === \"input\" && key === \"type\") vnode.dom.setAttribute(key, value)\n\t\t\telse vnode.dom[key] = value\n\t\t} else {\n\t\t\tif (typeof value === \"boolean\") {\n\t\t\t\tif (value) vnode.dom.setAttribute(key, \"\")\n\t\t\t\telse vnode.dom.removeAttribute(key)\n\t\t\t}\n\t\t\telse vnode.dom.setAttribute(key === \"className\" ? \"class\" : key, value)\n\t\t}\n\t}\n\tfunction removeAttr(vnode, key, old, ns) {\n\t\tif (key === \"key\" || key === \"is\" || old == null || isLifecycleMethod(key)) return\n\t\tif (key[0] === \"o\" && key[1] === \"n\" && !isLifecycleMethod(key)) updateEvent(vnode, key, undefined)\n\t\telse if (key === \"style\") updateStyle(vnode.dom, old, null)\n\t\telse if (\n\t\t\thasPropertyKey(vnode, key, ns)\n\t\t\t&& key !== \"className\"\n\t\t\t&& !(key === \"value\" && (\n\t\t\t\tvnode.tag === \"option\"\n\t\t\t\t|| vnode.tag === \"select\" && vnode.dom.selectedIndex === -1 && vnode.dom === activeElement()\n\t\t\t))\n\t\t\t&& !(vnode.tag === \"input\" && key === \"type\")\n\t\t) {\n\t\t\tvnode.dom[key] = null\n\t\t} else {\n\t\t\tvar nsLastIndex = key.indexOf(\":\")\n\t\t\tif (nsLastIndex !== -1) key = key.slice(nsLastIndex + 1)\n\t\t\tif (old !== false) vnode.dom.removeAttribute(key === \"className\" ? \"class\" : key)\n\t\t}\n\t}\n\tfunction setLateSelectAttrs(vnode, attrs) {\n\t\tif (\"value\" in attrs) {\n\t\t\tif(attrs.value === null) {\n\t\t\t\tif (vnode.dom.selectedIndex !== -1) vnode.dom.value = null\n\t\t\t} else {\n\t\t\t\tvar normalized = \"\" + attrs.value // eslint-disable-line no-implicit-coercion\n\t\t\t\tif (vnode.dom.value !== normalized || vnode.dom.selectedIndex === -1) {\n\t\t\t\t\tvnode.dom.value = normalized\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (\"selectedIndex\" in attrs) setAttr(vnode, \"selectedIndex\", null, attrs.selectedIndex, undefined)\n\t}\n\tfunction updateAttrs(vnode, old, attrs, ns) {\n\t\tif (attrs != null) {\n\t\t\tfor (var key in attrs) {\n\t\t\t\tsetAttr(vnode, key, old && old[key], attrs[key], ns)\n\t\t\t}\n\t\t}\n\t\tvar val\n\t\tif (old != null) {\n\t\t\tfor (var key in old) {\n\t\t\t\tif (((val = old[key]) != null) && (attrs == null || attrs[key] == null)) {\n\t\t\t\t\tremoveAttr(vnode, key, val, ns)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfunction isFormAttribute(vnode, attr) {\n\t\treturn attr === \"value\" || attr === \"checked\" || attr === \"selectedIndex\" || attr === \"selected\" && vnode.dom === activeElement() || vnode.tag === \"option\" && vnode.dom.parentNode === $doc.activeElement\n\t}\n\tfunction isLifecycleMethod(attr) {\n\t\treturn attr === \"oninit\" || attr === \"oncreate\" || attr === \"onupdate\" || attr === \"onremove\" || attr === \"onbeforeremove\" || attr === \"onbeforeupdate\"\n\t}\n\tfunction hasPropertyKey(vnode, key, ns) {\n\t\t// Filter out namespaced keys\n\t\treturn ns === undefined && (\n\t\t\t// If it's a custom element, just keep it.\n\t\t\tvnode.tag.indexOf(\"-\") > -1 || vnode.attrs != null && vnode.attrs.is ||\n\t\t\t// If it's a normal element, let's try to avoid a few browser bugs.\n\t\t\tkey !== \"href\" && key !== \"list\" && key !== \"form\" && key !== \"width\" && key !== \"height\"// && key !== \"type\"\n\t\t\t// Defer the property check until *after* we check everything.\n\t\t) && key in vnode.dom\n\t}\n\n\t//style\n\tvar uppercaseRegex = /[A-Z]/g\n\tfunction toLowerCase(capital) { return \"-\" + capital.toLowerCase() }\n\tfunction normalizeKey(key) {\n\t\treturn key[0] === \"-\" && key[1] === \"-\" ? key :\n\t\t\tkey === \"cssFloat\" ? \"float\" :\n\t\t\t\tkey.replace(uppercaseRegex, toLowerCase)\n\t}\n\tfunction updateStyle(element, old, style) {\n\t\tif (old === style) {\n\t\t\t// Styles are equivalent, do nothing.\n\t\t} else if (style == null) {\n\t\t\t// New style is missing, just clear it.\n\t\t\telement.style.cssText = \"\"\n\t\t} else if (typeof style !== \"object\") {\n\t\t\t// New style is a string, let engine deal with patching.\n\t\t\telement.style.cssText = style\n\t\t} else if (old == null || typeof old !== \"object\") {\n\t\t\t// `old` is missing or a string, `style` is an object.\n\t\t\telement.style.cssText = \"\"\n\t\t\t// Add new style properties\n\t\t\tfor (var key in style) {\n\t\t\t\tvar value = style[key]\n\t\t\t\tif (value != null) element.style.setProperty(normalizeKey(key), String(value))\n\t\t\t}\n\t\t} else {\n\t\t\t// Both old & new are (different) objects.\n\t\t\t// Update style properties that have changed\n\t\t\tfor (var key in style) {\n\t\t\t\tvar value = style[key]\n\t\t\t\tif (value != null && (value = String(value)) !== String(old[key])) {\n\t\t\t\t\telement.style.setProperty(normalizeKey(key), value)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Remove style properties that no longer exist\n\t\t\tfor (var key in old) {\n\t\t\t\tif (old[key] != null && style[key] == null) {\n\t\t\t\t\telement.style.removeProperty(normalizeKey(key))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Here's an explanation of how this works:\n\t// 1. The event names are always (by design) prefixed by `on`.\n\t// 2. The EventListener interface accepts either a function or an object\n\t// with a `handleEvent` method.\n\t// 3. The object does not inherit from `Object.prototype`, to avoid\n\t// any potential interference with that (e.g. setters).\n\t// 4. The event name is remapped to the handler before calling it.\n\t// 5. In function-based event handlers, `ev.target === this`. We replicate\n\t// that below.\n\t// 6. In function-based event handlers, `return false` prevents the default\n\t// action and stops event propagation. We replicate that below.\n\tfunction EventDict() {\n\t\t// Save this, so the current redraw is correctly tracked.\n\t\tthis._ = currentRedraw\n\t}\n\tEventDict.prototype = Object.create(null)\n\tEventDict.prototype.handleEvent = function (ev) {\n\t\tvar handler = this[\"on\" + ev.type]\n\t\tvar result\n\t\tif (typeof handler === \"function\") result = handler.call(ev.currentTarget, ev)\n\t\telse if (typeof handler.handleEvent === \"function\") handler.handleEvent(ev)\n\t\tif (this._ && ev.redraw !== false) (0, this._)()\n\t\tif (result === false) {\n\t\t\tev.preventDefault()\n\t\t\tev.stopPropagation()\n\t\t}\n\t}\n\n\t//event\n\tfunction updateEvent(vnode, key, value) {\n\t\tif (vnode.events != null) {\n\t\t\tif (vnode.events[key] === value) return\n\t\t\tif (value != null && (typeof value === \"function\" || typeof value === \"object\")) {\n\t\t\t\tif (vnode.events[key] == null) vnode.dom.addEventListener(key.slice(2), vnode.events, false)\n\t\t\t\tvnode.events[key] = value\n\t\t\t} else {\n\t\t\t\tif (vnode.events[key] != null) vnode.dom.removeEventListener(key.slice(2), vnode.events, false)\n\t\t\t\tvnode.events[key] = undefined\n\t\t\t}\n\t\t} else if (value != null && (typeof value === \"function\" || typeof value === \"object\")) {\n\t\t\tvnode.events = new EventDict()\n\t\t\tvnode.dom.addEventListener(key.slice(2), vnode.events, false)\n\t\t\tvnode.events[key] = value\n\t\t}\n\t}\n\n\t//lifecycle\n\tfunction initLifecycle(source, vnode, hooks) {\n\t\tif (typeof source.oninit === \"function\") callHook.call(source.oninit, vnode)\n\t\tif (typeof source.oncreate === \"function\") hooks.push(callHook.bind(source.oncreate, vnode))\n\t}\n\tfunction updateLifecycle(source, vnode, hooks) {\n\t\tif (typeof source.onupdate === \"function\") hooks.push(callHook.bind(source.onupdate, vnode))\n\t}\n\tfunction shouldNotUpdate(vnode, old) {\n\t\tdo {\n\t\t\tif (vnode.attrs != null && typeof vnode.attrs.onbeforeupdate === \"function\") {\n\t\t\t\tvar force = callHook.call(vnode.attrs.onbeforeupdate, vnode, old)\n\t\t\t\tif (force !== undefined && !force) break\n\t\t\t}\n\t\t\tif (typeof vnode.tag !== \"string\" && typeof vnode.state.onbeforeupdate === \"function\") {\n\t\t\t\tvar force = callHook.call(vnode.state.onbeforeupdate, vnode, old)\n\t\t\t\tif (force !== undefined && !force) break\n\t\t\t}\n\t\t\treturn false\n\t\t} while (false); // eslint-disable-line no-constant-condition\n\t\tvnode.dom = old.dom\n\t\tvnode.domSize = old.domSize\n\t\tvnode.instance = old.instance\n\t\t// One would think having the actual latest attributes would be ideal,\n\t\t// but it doesn't let us properly diff based on our current internal\n\t\t// representation. We have to save not only the old DOM info, but also\n\t\t// the attributes used to create it, as we diff *that*, not against the\n\t\t// DOM directly (with a few exceptions in `setAttr`). And, of course, we\n\t\t// need to save the children and text as they are conceptually not\n\t\t// unlike special \"attributes\" internally.\n\t\tvnode.attrs = old.attrs\n\t\tvnode.children = old.children\n\t\tvnode.text = old.text\n\t\treturn true\n\t}\n\n\treturn function(dom, vnodes, redraw) {\n\t\tif (!dom) throw new TypeError(\"Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.\")\n\t\tvar hooks = []\n\t\tvar active = activeElement()\n\t\tvar namespace = dom.namespaceURI\n\n\t\t// First time rendering into a node clears it out\n\t\tif (dom.vnodes == null) dom.textContent = \"\"\n\n\t\tvnodes = Vnode.normalizeChildren(Array.isArray(vnodes) ? vnodes : [vnodes])\n\t\tvar prevRedraw = currentRedraw\n\t\ttry {\n\t\t\tcurrentRedraw = typeof redraw === \"function\" ? redraw : undefined\n\t\t\tupdateNodes(dom, dom.vnodes, vnodes, hooks, null, namespace === \"http://www.w3.org/1999/xhtml\" ? undefined : namespace)\n\t\t} finally {\n\t\t\tcurrentRedraw = prevRedraw\n\t\t}\n\t\tdom.vnodes = vnodes\n\t\t// `document.activeElement` can return null: https://html.spec.whatwg.org/multipage/interaction.html#dom-document-activeelement\n\t\tif (active != null && activeElement() !== active && typeof active.focus === \"function\") active.focus()\n\t\tfor (var i = 0; i < hooks.length; i++) hooks[i]()\n\t}\n}\n\n},{\"../render/vnode\":29}],28:[function(require,module,exports){\n\"use strict\"\n\nvar Vnode = require(\"../render/vnode\")\n\nmodule.exports = function(html) {\n\tif (html == null) html = \"\"\n\treturn Vnode(\"<\", undefined, undefined, html, undefined, undefined)\n}\n\n},{\"../render/vnode\":29}],29:[function(require,module,exports){\n\"use strict\"\n\nfunction Vnode(tag, key, attrs, children, text, dom) {\n\treturn {tag: tag, key: key, attrs: attrs, children: children, text: text, dom: dom, domSize: undefined, state: undefined, events: undefined, instance: undefined}\n}\nVnode.normalize = function(node) {\n\tif (Array.isArray(node)) return Vnode(\"[\", undefined, undefined, Vnode.normalizeChildren(node), undefined, undefined)\n\tif (node == null || typeof node === \"boolean\") return null\n\tif (typeof node === \"object\") return node\n\treturn Vnode(\"#\", undefined, undefined, String(node), undefined, undefined)\n}\nVnode.normalizeChildren = function(input) {\n\tvar children = []\n\tif (input.length) {\n\t\tvar isKeyed = input[0] != null && input[0].key != null\n\t\t// Note: this is a *very* perf-sensitive check.\n\t\t// Fun fact: merging the loop like this is somehow faster than splitting\n\t\t// it, noticeably so.\n\t\tfor (var i = 1; i < input.length; i++) {\n\t\t\tif ((input[i] != null && input[i].key != null) !== isKeyed) {\n\t\t\t\tthrow new TypeError(\"Vnodes must either always have keys or never have keys!\")\n\t\t\t}\n\t\t}\n\t\tfor (var i = 0; i < input.length; i++) {\n\t\t\tchildren[i] = Vnode.normalize(input[i])\n\t\t}\n\t}\n\treturn children\n}\n\nmodule.exports = Vnode\n\n},{}],30:[function(require,module,exports){\n\"use strict\"\n\nvar PromisePolyfill = require(\"./promise/promise\")\nvar mountRedraw = require(\"./mount-redraw\")\n\nmodule.exports = require(\"./request/request\")(window, PromisePolyfill, mountRedraw.redraw)\n\n},{\"./mount-redraw\":14,\"./promise/promise\":20,\"./request/request\":31}],31:[function(require,module,exports){\n\"use strict\"\n\nvar buildPathname = require(\"../pathname/build\")\n\nmodule.exports = function($window, Promise, oncompletion) {\n\tvar callbackCount = 0\n\n\tfunction PromiseProxy(executor) {\n\t\treturn new Promise(executor)\n\t}\n\n\t// In case the global Promise is some userland library's where they rely on\n\t// `foo instanceof this.constructor`, `this.constructor.resolve(value)`, or\n\t// similar. Let's *not* break them.\n\tPromiseProxy.prototype = Promise.prototype\n\tPromiseProxy.__proto__ = Promise // eslint-disable-line no-proto\n\n\tfunction makeRequest(factory) {\n\t\treturn function(url, args) {\n\t\t\tif (typeof url !== \"string\") { args = url; url = url.url }\n\t\t\telse if (args == null) args = {}\n\t\t\tvar promise = new Promise(function(resolve, reject) {\n\t\t\t\tfactory(buildPathname(url, args.params), args, function (data) {\n\t\t\t\t\tif (typeof args.type === \"function\") {\n\t\t\t\t\t\tif (Array.isArray(data)) {\n\t\t\t\t\t\t\tfor (var i = 0; i < data.length; i++) {\n\t\t\t\t\t\t\t\tdata[i] = new args.type(data[i])\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse data = new args.type(data)\n\t\t\t\t\t}\n\t\t\t\t\tresolve(data)\n\t\t\t\t}, reject)\n\t\t\t})\n\t\t\tif (args.background === true) return promise\n\t\t\tvar count = 0\n\t\t\tfunction complete() {\n\t\t\t\tif (--count === 0 && typeof oncompletion === \"function\") oncompletion()\n\t\t\t}\n\n\t\t\treturn wrap(promise)\n\n\t\t\tfunction wrap(promise) {\n\t\t\t\tvar then = promise.then\n\t\t\t\t// Set the constructor, so engines know to not await or resolve\n\t\t\t\t// this as a native promise. At the time of writing, this is\n\t\t\t\t// only necessary for V8, but their behavior is the correct\n\t\t\t\t// behavior per spec. See this spec issue for more details:\n\t\t\t\t// https://github.com/tc39/ecma262/issues/1577. Also, see the\n\t\t\t\t// corresponding comment in `request/tests/test-request.js` for\n\t\t\t\t// a bit more background on the issue at hand.\n\t\t\t\tpromise.constructor = PromiseProxy\n\t\t\t\tpromise.then = function() {\n\t\t\t\t\tcount++\n\t\t\t\t\tvar next = then.apply(promise, arguments)\n\t\t\t\t\tnext.then(complete, function(e) {\n\t\t\t\t\t\tcomplete()\n\t\t\t\t\t\tif (count === 0) throw e\n\t\t\t\t\t})\n\t\t\t\t\treturn wrap(next)\n\t\t\t\t}\n\t\t\t\treturn promise\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction hasHeader(args, name) {\n\t\tfor (var key in args.headers) {\n\t\t\tif ({}.hasOwnProperty.call(args.headers, key) && name.test(key)) return true\n\t\t}\n\t\treturn false\n\t}\n\n\treturn {\n\t\trequest: makeRequest(function(url, args, resolve, reject) {\n\t\t\tvar method = args.method != null ? args.method.toUpperCase() : \"GET\"\n\t\t\tvar body = args.body\n\t\t\tvar assumeJSON = (args.serialize == null || args.serialize === JSON.serialize) && !(body instanceof $window.FormData)\n\t\t\tvar responseType = args.responseType || (typeof args.extract === \"function\" ? \"\" : \"json\")\n\n\t\t\tvar xhr = new $window.XMLHttpRequest(), aborted = false\n\t\t\tvar original = xhr, replacedAbort\n\t\t\tvar abort = xhr.abort\n\n\t\t\txhr.abort = function() {\n\t\t\t\taborted = true\n\t\t\t\tabort.call(this)\n\t\t\t}\n\n\t\t\txhr.open(method, url, args.async !== false, typeof args.user === \"string\" ? args.user : undefined, typeof args.password === \"string\" ? args.password : undefined)\n\n\t\t\tif (assumeJSON && body != null && !hasHeader(args, /^content-type$/i)) {\n\t\t\t\txhr.setRequestHeader(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\t\t}\n\t\t\tif (typeof args.deserialize !== \"function\" && !hasHeader(args, /^accept$/i)) {\n\t\t\t\txhr.setRequestHeader(\"Accept\", \"application/json, text/*\")\n\t\t\t}\n\t\t\tif (args.withCredentials) xhr.withCredentials = args.withCredentials\n\t\t\tif (args.timeout) xhr.timeout = args.timeout\n\t\t\txhr.responseType = responseType\n\n\t\t\tfor (var key in args.headers) {\n\t\t\t\tif ({}.hasOwnProperty.call(args.headers, key)) {\n\t\t\t\t\txhr.setRequestHeader(key, args.headers[key])\n\t\t\t\t}\n\t\t\t}\n\n\t\t\txhr.onreadystatechange = function(ev) {\n\t\t\t\t// Don't throw errors on xhr.abort().\n\t\t\t\tif (aborted) return\n\n\t\t\t\tif (ev.target.readyState === 4) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvar success = (ev.target.status >= 200 && ev.target.status < 300) || ev.target.status === 304 || (/^file:\\/\\//i).test(url)\n\t\t\t\t\t\t// When the response type isn't \"\" or \"text\",\n\t\t\t\t\t\t// `xhr.responseText` is the wrong thing to use.\n\t\t\t\t\t\t// Browsers do the right thing and throw here, and we\n\t\t\t\t\t\t// should honor that and do the right thing by\n\t\t\t\t\t\t// preferring `xhr.response` where possible/practical.\n\t\t\t\t\t\tvar response = ev.target.response, message\n\n\t\t\t\t\t\tif (responseType === \"json\") {\n\t\t\t\t\t\t\t// For IE and Edge, which don't implement\n\t\t\t\t\t\t\t// `responseType: \"json\"`.\n\t\t\t\t\t\t\tif (!ev.target.responseType && typeof args.extract !== \"function\") response = JSON.parse(ev.target.responseText)\n\t\t\t\t\t\t} else if (!responseType || responseType === \"text\") {\n\t\t\t\t\t\t\t// Only use this default if it's text. If a parsed\n\t\t\t\t\t\t\t// document is needed on old IE and friends (all\n\t\t\t\t\t\t\t// unsupported), the user should use a custom\n\t\t\t\t\t\t\t// `config` instead. They're already using this at\n\t\t\t\t\t\t\t// their own risk.\n\t\t\t\t\t\t\tif (response == null) response = ev.target.responseText\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (typeof args.extract === \"function\") {\n\t\t\t\t\t\t\tresponse = args.extract(ev.target, args)\n\t\t\t\t\t\t\tsuccess = true\n\t\t\t\t\t\t} else if (typeof args.deserialize === \"function\") {\n\t\t\t\t\t\t\tresponse = args.deserialize(response)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (success) resolve(response)\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\ttry { message = ev.target.responseText }\n\t\t\t\t\t\t\tcatch (e) { message = response }\n\t\t\t\t\t\t\tvar error = new Error(message)\n\t\t\t\t\t\t\terror.code = ev.target.status\n\t\t\t\t\t\t\terror.response = response\n\t\t\t\t\t\t\treject(error)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcatch (e) {\n\t\t\t\t\t\treject(e)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (typeof args.config === \"function\") {\n\t\t\t\txhr = args.config(xhr, args, url) || xhr\n\n\t\t\t\t// Propagate the `abort` to any replacement XHR as well.\n\t\t\t\tif (xhr !== original) {\n\t\t\t\t\treplacedAbort = xhr.abort\n\t\t\t\t\txhr.abort = function() {\n\t\t\t\t\t\taborted = true\n\t\t\t\t\t\treplacedAbort.call(this)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (body == null) xhr.send()\n\t\t\telse if (typeof args.serialize === \"function\") xhr.send(args.serialize(body))\n\t\t\telse if (body instanceof $window.FormData) xhr.send(body)\n\t\t\telse xhr.send(JSON.stringify(body))\n\t\t}),\n\t\tjsonp: makeRequest(function(url, args, resolve, reject) {\n\t\t\tvar callbackName = args.callbackName || \"_mithril_\" + Math.round(Math.random() * 1e16) + \"_\" + callbackCount++\n\t\t\tvar script = $window.document.createElement(\"script\")\n\t\t\t$window[callbackName] = function(data) {\n\t\t\t\tdelete $window[callbackName]\n\t\t\t\tscript.parentNode.removeChild(script)\n\t\t\t\tresolve(data)\n\t\t\t}\n\t\t\tscript.onerror = function() {\n\t\t\t\tdelete $window[callbackName]\n\t\t\t\tscript.parentNode.removeChild(script)\n\t\t\t\treject(new Error(\"JSONP request failed\"))\n\t\t\t}\n\t\t\tscript.src = url + (url.indexOf(\"?\") < 0 ? \"?\" : \"&\") +\n\t\t\t\tencodeURIComponent(args.callbackKey || \"callback\") + \"=\" +\n\t\t\t\tencodeURIComponent(callbackName)\n\t\t\t$window.document.documentElement.appendChild(script)\n\t\t}),\n\t}\n}\n\n},{\"../pathname/build\":16}],32:[function(require,module,exports){\n\"use strict\"\n\nvar mountRedraw = require(\"./mount-redraw\")\n\nmodule.exports = require(\"./api/router\")(window, mountRedraw)\n\n},{\"./api/router\":11,\"./mount-redraw\":14}],33:[function(require,module,exports){\n// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n},{}],34:[function(require,module,exports){\n(function (setImmediate,clearImmediate){\nvar nextTick = require('process/browser.js').nextTick;\nvar apply = Function.prototype.apply;\nvar slice = Array.prototype.slice;\nvar immediateIds = {};\nvar nextImmediateId = 0;\n\n// DOM APIs, for completeness\n\nexports.setTimeout = function() {\n return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);\n};\nexports.setInterval = function() {\n return new Timeout(apply.call(setInterval, window, arguments), clearInterval);\n};\nexports.clearTimeout =\nexports.clearInterval = function(timeout) { timeout.close(); };\n\nfunction Timeout(id, clearFn) {\n this._id = id;\n this._clearFn = clearFn;\n}\nTimeout.prototype.unref = Timeout.prototype.ref = function() {};\nTimeout.prototype.close = function() {\n this._clearFn.call(window, this._id);\n};\n\n// Does not start the time, just sets up the members needed.\nexports.enroll = function(item, msecs) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = msecs;\n};\n\nexports.unenroll = function(item) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = -1;\n};\n\nexports._unrefActive = exports.active = function(item) {\n clearTimeout(item._idleTimeoutId);\n\n var msecs = item._idleTimeout;\n if (msecs >= 0) {\n item._idleTimeoutId = setTimeout(function onTimeout() {\n if (item._onTimeout)\n item._onTimeout();\n }, msecs);\n }\n};\n\n// That's not how node.js implements it but the exposed api is the same.\nexports.setImmediate = typeof setImmediate === \"function\" ? setImmediate : function(fn) {\n var id = nextImmediateId++;\n var args = arguments.length < 2 ? false : slice.call(arguments, 1);\n\n immediateIds[id] = true;\n\n nextTick(function onNextTick() {\n if (immediateIds[id]) {\n // fn.call() is faster so we optimize for the common use-case\n // @see http://jsperf.com/call-apply-segu\n if (args) {\n fn.apply(null, args);\n } else {\n fn.call(null);\n }\n // Prevent ids from leaking\n exports.clearImmediate(id);\n }\n });\n\n return id;\n};\n\nexports.clearImmediate = typeof clearImmediate === \"function\" ? clearImmediate : function(id) {\n delete immediateIds[id];\n};\n}).call(this,require(\"timers\").setImmediate,require(\"timers\").clearImmediate)\n},{\"process/browser.js\":33,\"timers\":34}],35:[function(require,module,exports){\nfunction tlite(getTooltipOpts) {\n document.addEventListener('mouseover', function (e) {\n var el = e.target;\n var opts = getTooltipOpts(el);\n\n if (!opts) {\n el = el.parentElement;\n opts = el && getTooltipOpts(el);\n }\n\n opts && tlite.show(el, opts, true);\n });\n}\n\ntlite.show = function (el, opts, isAuto) {\n var fallbackAttrib = 'data-tlite';\n opts = opts || {};\n\n (el.tooltip || Tooltip(el, opts)).show();\n\n function Tooltip(el, opts) {\n var tooltipEl;\n var showTimer;\n var text;\n\n el.addEventListener('mousedown', autoHide);\n el.addEventListener('mouseleave', autoHide);\n\n function show() {\n text = el.title || el.getAttribute(fallbackAttrib) || text;\n el.title = '';\n el.setAttribute(fallbackAttrib, '');\n text && !showTimer && (showTimer = setTimeout(fadeIn, isAuto ? 150 : 1))\n }\n\n function autoHide() {\n tlite.hide(el, true);\n }\n\n function hide(isAutoHiding) {\n if (isAuto === isAutoHiding) {\n showTimer = clearTimeout(showTimer);\n var parent = tooltipEl && tooltipEl.parentNode;\n parent && parent.removeChild(tooltipEl);\n tooltipEl = undefined;\n }\n }\n\n function fadeIn() {\n if (!tooltipEl) {\n tooltipEl = createTooltip(el, text, opts);\n }\n }\n\n return el.tooltip = {\n show: show,\n hide: hide\n };\n }\n\n function createTooltip(el, text, opts) {\n var tooltipEl = document.createElement('span');\n var grav = opts.grav || el.getAttribute('data-tlite') || 'n';\n\n tooltipEl.innerHTML = text;\n\n el.appendChild(tooltipEl);\n\n var vertGrav = grav[0] || '';\n var horzGrav = grav[1] || '';\n\n function positionTooltip() {\n tooltipEl.className = 'tlite ' + 'tlite-' + vertGrav + horzGrav;\n\n var arrowSize = 10;\n var top = el.offsetTop;\n var left = el.offsetLeft;\n\n if (tooltipEl.offsetParent === el) {\n top = left = 0;\n }\n\n var width = el.offsetWidth;\n var height = el.offsetHeight;\n var tooltipHeight = tooltipEl.offsetHeight;\n var tooltipWidth = tooltipEl.offsetWidth;\n var centerEl = left + (width / 2);\n\n tooltipEl.style.top = (\n vertGrav === 's' ? (top - tooltipHeight - arrowSize) :\n vertGrav === 'n' ? (top + height + arrowSize) :\n (top + (height / 2) - (tooltipHeight / 2))\n ) + 'px';\n\n tooltipEl.style.left = (\n horzGrav === 'w' ? left :\n horzGrav === 'e' ? left + width - tooltipWidth :\n vertGrav === 'w' ? (left + width + arrowSize) :\n vertGrav === 'e' ? (left - tooltipWidth - arrowSize) :\n (centerEl - tooltipWidth / 2)\n ) + 'px';\n }\n\n positionTooltip();\n\n var rect = tooltipEl.getBoundingClientRect();\n\n if (vertGrav === 's' && rect.top < 0) {\n vertGrav = 'n';\n positionTooltip();\n } else if (vertGrav === 'n' && rect.bottom > window.innerHeight) {\n vertGrav = 's';\n positionTooltip();\n } else if (vertGrav === 'e' && rect.left < 0) {\n vertGrav = 'w';\n positionTooltip();\n } else if (vertGrav === 'w' && rect.right > window.innerWidth) {\n vertGrav = 'e';\n positionTooltip();\n }\n\n tooltipEl.className += ' tlite-visible';\n\n return tooltipEl;\n }\n};\n\ntlite.hide = function (el, isAuto) {\n el.tooltip && el.tooltip.hide(isAuto);\n};\n\nif (typeof module !== 'undefined' && module.exports) {\n module.exports = tlite;\n}\n\n},{}]},{},[1]);\n })();"]}
1
+ {"version":3,"sources":["admin.js"],"names":["r","e","n","t","o","i","f","c","require","u","a","Error","code","p","exports","call","length","1","module","obj","_tlite","__esModule","default","tabs","settings","helpers","el","className","indexOf","window","mc4wp","./admin/fields/mailchimp-api-key.js","./admin/helpers.js","./admin/list-fetcher.js","./admin/list-overview.js","./admin/settings.js","./admin/show-if.js","./admin/tabs.js","tlite","2","field","document","getElementById","addEventListener","evt","node","createElement","innerText","mc4wp_vars","i18n","invalid_api_key","nextElementSibling","parentElement","removeChild","value","match","insertBefore","3","debounce","func","wait","immediate","timeout","context","this","args","arguments","callNow","clearTimeout","setTimeout","apply","4","config","ajaxurl","m","state","working","done","success","fetch","preventDefault","request","method","url","then","data","location","reload","redraw","mount","mailchimp","api_connected","lists","view","onsubmit","bind","type","fetching_mailchimp_lists","renew_mailchimp_lists","disabled","trust","fetching_mailchimp_lists_done","fetching_mailchimp_lists_error","mithril","5","showDetails","link","target","next","listID","getAttribute","querySelector","style","display","details","render","merge_fields","map","name","required","tag","options","date_format","choices","join","interest_categories","title","id","Object","keys","interests","shift","Element","prototype","matches","msMatchesSelector","webkitMatchesSelector","table","6","_typeof","Symbol","iterator","constructor","listInputs","querySelectorAll","selectedLists","listeners","updateSelectedLists","forEach","input","checked","push","rows","isSelected","searchKey","searchValue","filter","getSelectedListsWhere","toggleVisibleLists","event","emit","getSelectedLists","on","7","showIfElements","element","JSON","parse","parentElements","inputs","hide","undefined","toggleElement","conditionMet","String","visibility","opacity","inputElement","readOnly","8","URL","tabElements","tabNavElements","refererField","get","_open","tab","updateState","replace","nav","blur","setParameter","href","history","pushState","tb_remove","forms","editor","refresh","split","switchTab","tabId","urlParams","returnValue","substring","textContent","open","body","activeTab","offsetParent","replaceState","init","./url.js","9","query","hasOwnProperty","b","decodeURIComponent","build","ret","d","encodeURIComponent","key","10","Vnode","schedule","console","subscriptions","rendering","pending","sync","error","root","component","TypeError","index","splice","../render/vnode","11","setImmediate","Promise","buildPathname","parsePathname","compileTemplate","assign","sentinel","$window","mountRedraw","fireAsync","setPath","path","route","prefix","attrs","currentPath","lastUpdate","currentResolver","SKIP","defaultRoute","routes","onremove","compiled","SyntaxError","test","check","callAsync","resolve","scheduled","defaultData","some","ReferenceError","resolveRoute","hash","search","pathname","concat","slice","fail","params","loop","payload","matchedRoute","localComp","update","comp","onmatch","removeEventListener","onbeforeupdate","oncreate","vnode","set","Link","onclick","selector","oninit","onupdate","onbeforeremove","child","children","Boolean","result","currentTarget","handleEvent","defaultPrevented","button","which","ctrlKey","metaKey","shiftKey","altKey","param","../pathname/assign","../pathname/build","../pathname/compileTemplate","../pathname/parse","../promise/promise","../render/hyperscript","timers","12","hyperscript","fragment","./render/fragment","./render/hyperscript","./render/trust","13","jsonp","parseQueryString","buildQueryString","PromisePolyfill","./hyperscript","./mount-redraw","./pathname/build","./pathname/parse","./promise/polyfill","./querystring/build","./querystring/parse","./render","./render/vnode","./request","./route","14","requestAnimationFrame","./api/mount-redraw","15","source","16","template","queryIndex","hashIndex","queryEnd","pathEnd","resolved","variadic","newQueryIndex","newHashIndex","newQueryEnd","newPathEnd","querystring","../querystring/build","./assign","17","templateData","templateKeys","regexp","RegExp","extra","k","values","exec","./parse","18","../querystring/parse","19","executor","self","resolvers","rejectors","resolveCurrent","handler","rejectCurrent","instance","_instance","list","shouldAbsorb","execute","retry","executeOnce","runs","run","fn","onerror","onFulfilled","onRejection","resolveNext","rejectNext","handle","callback","promise","reject","catch","finally","reason","all","total","count","consume","race","20","global","./polyfill","21","object","toString","destructure","Array","isArray","22","string","charAt","entries","counters","entry","levels","cursor","pop","j","level","nextLevel","isNumber","isNaN","parseInt","desc","getOwnPropertyDescriptor","23","./render/render","24","hyperscriptVnode","normalizeChildren","./hyperscriptVnode","25","selectorParser","selectorCache","hasOwn","isEmpty","hasClass","class","newAttrs","text","execSelector","classes","attrValue","compileSelector","26","start","27","currentRedraw","$doc","nameSpace","svg","math","getNameSpace","xmlns","checkState","original","callHook","activeElement","createNodes","parent","vnodes","end","hooks","nextSibling","ns","createNode","initLifecycle","dom","createTextNode","insertNode","createText","createHTML","createDocumentFragment","firstChild","domSize","childNodes","createFragment","is","createElementNS","setAttr","setAttrs","maybeSetContentEditable","selectedIndex","normalized","setLateSelectAttrs","create","$$reentrantLock$$","normalize","initComponent","createComponent","possibleParents","caption","thead","tbody","tfoot","tr","th","td","colgroup","col","temp","innerHTML","appendChild","updateNodes","old","removeNodes","isOldKeyed","isKeyed","oldStart","v","oe","ve","topSibling","oldEnd","updateNode","getNextSibling","moveNodes","lisIndices","originalNextSibling","vnodesLength","oldIndices","li","pos","matched","getKeyMap","oldIndex","il","lisTemp","makeLisIndices","commonLength","removeNode","oldTag","events","force","shouldNotUpdate","updateLifecycle","nodeValue","updateText","removeHTML","updateHTML","updateFragment","val","removeAttr","updateAttrs","updateElement","updateComponent","frag","moveChildToFrag","parentNode","contenteditable","contentEditable","content","stateResult","attrsResult","mask","reallyRemove","isLifecycleMethod","attr","isFormAttribute","updateEvent","setAttributeNS","updateStyle","hasPropertyKey","setAttribute","removeAttribute","nsLastIndex","uppercaseRegex","toLowerCase","capital","normalizeKey","cssText","setProperty","removeProperty","EventDict","_","ev","stopPropagation","active","namespace","namespaceURI","prevRedraw","focus","28","html","29","30","./promise/promise","./request/request","31","oncompletion","callbackCount","PromiseProxy","makeRequest","factory","background","complete","wrap","hasHeader","headers","__proto__","replacedAbort","toUpperCase","assumeJSON","serialize","FormData","responseType","extract","xhr","XMLHttpRequest","aborted","abort","async","user","password","setRequestHeader","deserialize","withCredentials","onreadystatechange","readyState","message","status","response","responseText","send","stringify","callbackName","Math","round","random","script","src","callbackKey","documentElement","32","./api/router","33","cachedSetTimeout","cachedClearTimeout","process","defaultSetTimout","defaultClearTimeout","runTimeout","fun","currentQueue","queue","draining","queueIndex","cleanUpNextTick","drainQueue","len","marker","runClearTimeout","Item","array","noop","nextTick","browser","env","argv","version","versions","addListener","once","off","removeListener","removeAllListeners","prependListener","prependOnceListener","binding","cwd","chdir","dir","umask","34","clearImmediate","Function","immediateIds","nextImmediateId","Timeout","clearFn","_id","_clearFn","setInterval","clearInterval","close","unref","ref","enroll","item","msecs","_idleTimeoutId","_idleTimeout","unenroll","_unrefActive","_onTimeout","process/browser.js","35","getTooltipOpts","opts","show","isAuto","tooltipEl","showTimer","fallbackAttrib","autoHide","fadeIn","grav","vertGrav","horzGrav","positionTooltip","top","offsetTop","left","offsetLeft","width","offsetWidth","height","offsetHeight","tooltipHeight","tooltipWidth","centerEl","rect","getBoundingClientRect","bottom","innerHeight","right","innerWidth","createTooltip","tooltip","isAutoHiding"],"mappings":"CAAY,SAASA,EAAEC,EAAEC,EAAEC,GAAG,SAASC,EAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,IAAIE,EAAE,mBAAmBC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Dra,EAAGoG,MAAQ,GACXpG,EAAGiiB,aAAa4I,EAAgB,IAChCxQ,IAASuQ,IAAcA,EAAYjoB,WAAWooB,EAAQL,EAAS,IAAM,KAwBrE1hB,KAjBF,SAAcujB,GACZ,GAAI7B,IAAW6B,EAAc,CAC3B3B,EAAYloB,aAAakoB,GACzB,IAAInP,EAASkP,GAAaA,EAAUzJ,WACpCzF,GAAUA,EAAO9Z,YAAYgpB,GAC7BA,OAAY1hB,OA1BgBwhB,QA6GpC7pB,EAAMoI,KAAO,SAAUhJ,EAAI0qB,GACzB1qB,EAAGssB,SAAWtsB,EAAGssB,QAAQtjB,KAAK0hB,SAGV,IAAXlrB,GAA0BA,EAAOJ,UAC1CI,EAAOJ,QAAUwB,IAGjB,KAAK,GAAG,CAAC","file":"admin.min.js","sourcesContent":["(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){\n'use strict'; // dependencies\n\nvar _tlite = _interopRequireDefault(require(\"tlite\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nvar tabs = require('./admin/tabs.js');\n\nvar settings = require('./admin/settings.js');\n\nvar helpers = require('./admin/helpers.js');\n\n(0, _tlite[\"default\"])(function (el) {\n return el.className.indexOf('mc4wp-tooltip') > -1;\n});\n\nrequire('./admin/list-fetcher.js');\n\nrequire('./admin/fields/mailchimp-api-key.js');\n\nrequire('./admin/list-overview.js');\n\nrequire('./admin/show-if.js'); // expose some things\n\n\nwindow.mc4wp = window.mc4wp || {};\nwindow.mc4wp.helpers = helpers;\nwindow.mc4wp.settings = settings;\nwindow.mc4wp.tabs = tabs;\n\n},{\"./admin/fields/mailchimp-api-key.js\":2,\"./admin/helpers.js\":3,\"./admin/list-fetcher.js\":4,\"./admin/list-overview.js\":5,\"./admin/settings.js\":6,\"./admin/show-if.js\":7,\"./admin/tabs.js\":8,\"tlite\":35}],2:[function(require,module,exports){\n'use strict';\n\nfunction validate(evt) {\n var node = document.createElement('p');\n node.className = 'help red';\n node.innerText = window.mc4wp_vars.i18n.invalid_api_key;\n\n if (field.nextElementSibling.innerText === node.innerText) {\n field.nextElementSibling.parentElement.removeChild(field.nextElementSibling);\n }\n\n if (!field.value.match(/^[0-9a-zA-Z*]{32}-[a-z]{2}[0-9]{1,2}$/)) {\n field.parentElement.insertBefore(node, field.nextElementSibling);\n }\n}\n\nvar field = document.getElementById('mailchimp_api_key');\n\nif (field) {\n field.addEventListener('change', validate);\n}\n\n},{}],3:[function(require,module,exports){\n'use strict';\n\nvar helpers = {}; // polling\n\nhelpers.debounce = function (func, wait, immediate) {\n var timeout;\n return function () {\n var context = this;\n var args = arguments;\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(function () {\n timeout = null;\n if (!immediate) func.apply(context, args);\n }, wait);\n if (callNow) func.apply(context, args);\n };\n};\n\nmodule.exports = helpers;\n\n},{}],4:[function(require,module,exports){\n'use strict';\n\nvar config = window.mc4wp_vars;\nvar i18n = window.mc4wp_vars.i18n;\nvar ajaxurl = window.mc4wp_vars.ajaxurl;\n\nvar m = require('mithril');\n\nvar state = {\n working: false,\n done: false,\n success: false\n};\n\nfunction fetch(evt) {\n evt && evt.preventDefault();\n state.working = true;\n state.done = false;\n m.request({\n method: 'POST',\n url: ajaxurl + '?action=mc4wp_renew_mailchimp_lists',\n timeout: 600000 // 10 minutes, matching max_execution_time\n\n }).then(function (data) {\n state.success = true;\n\n if (data) {\n window.setTimeout(function () {\n window.location.reload();\n }, 3000);\n }\n })[\"catch\"](function (data) {\n state.success = false;\n })[\"finally\"](function (data) {\n state.working = false;\n state.done = true;\n m.redraw();\n });\n}\n\nfunction view() {\n return m('form', {\n method: 'POST',\n onsubmit: fetch.bind(this)\n }, [m('p', [m('input', {\n type: 'submit',\n value: state.working ? i18n.fetching_mailchimp_lists : i18n.renew_mailchimp_lists,\n className: 'button',\n disabled: !!state.working\n }), m.trust(' &nbsp; '), state.working ? [m('span.mc4wp-loader', 'Loading...'), m.trust(' &nbsp; ')] : '', state.done ? [state.success ? m('em.help.green', i18n.fetching_mailchimp_lists_done) : m('em.help.red', i18n.fetching_mailchimp_lists_error)] : ''])]);\n}\n\nvar mount = document.getElementById('mc4wp-list-fetcher');\n\nif (mount) {\n // start fetching right away when no lists but api key given\n if (config.mailchimp.api_connected && config.mailchimp.lists.length === 0) {\n fetch();\n }\n\n m.mount(mount, {\n view: view\n });\n}\n\n},{\"mithril\":13}],5:[function(require,module,exports){\n'use strict';\n\nvar ajaxurl = window.mc4wp_vars.ajaxurl;\n\nvar m = require('mithril');\n\nif (!Element.prototype.matches) {\n Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;\n}\n\nfunction showDetails(evt) {\n evt.preventDefault();\n var link = evt.target;\n var next = link.parentElement.parentElement.nextElementSibling;\n var listID = link.getAttribute('data-list-id');\n var mount = next.querySelector('div');\n\n if (next.style.display === 'none') {\n m.request({\n method: 'GET',\n url: ajaxurl + '?action=mc4wp_get_list_details&ids=' + listID\n }).then(function (details) {\n m.render(mount, view(details.shift()));\n });\n next.style.display = '';\n } else {\n next.style.display = 'none';\n }\n}\n\nfunction view(data) {\n return [m('h3', 'Merge fields'), m('table.widefat.striped', [m('thead', [m('tr', [m('th', 'Name'), m('th', 'Tag'), m('th', 'Type')])]), m('tbody', data.merge_fields.map(function (f) {\n return m('tr', [m('td', [f.name, f.required && m('span.red', '*')]), m('td', [m('code', f.tag)]), m('td', [f.type, ' ', f.options && f.options.date_format ? '(' + f.options.date_format + ')' : '', f.options && f.options.choices ? '(' + f.options.choices.join(', ') + ')' : ''])]);\n }))]), data.interest_categories.length > 0 && [m('h3', 'Interest Categories'), m('table.striped.widefat', [m('thead', [m('tr', [m('th', 'Name'), m('th', 'Type'), m('th', 'Interests')])]), m('tbody', data.interest_categories.map(function (f) {\n return m('tr', [m('td', [m('strong', f.title), m('br'), m('br'), 'ID: ', m('code', f.id)]), m('td', f.type), m('td', [m('div.row', {\n style: 'margin-bottom: 4px;'\n }, [m('div.col.col-3', [m('strong', {\n style: 'display: block; border-bottom: 1px solid #eee;'\n }, 'Name')]), m('div.col.col-3', [m('strong', {\n style: 'display: block; border-bottom: 1px solid #eee;'\n }, 'ID')])]), Object.keys(f.interests).map(function (id) {\n return m('div.row.tiny-margin', [m('div.col.col-3', f.interests[id]), m('div.col.col-3', [m('code', {\n title: 'Interest ID'\n }, id)]), m('br.clearfix.clear.cf')]);\n })])]);\n }))])]];\n}\n\nvar table = document.getElementById('mc4wp-mailchimp-lists-overview');\n\nif (table) {\n table.addEventListener('click', function (evt) {\n if (!evt.target.matches('.mc4wp-mailchimp-list')) {\n return;\n }\n\n showDetails(evt);\n });\n}\n\n},{\"mithril\":13}],6:[function(require,module,exports){\n'use strict';\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar context = document.getElementById('mc4wp-admin');\nvar listInputs = context.querySelectorAll('.mc4wp-list-input');\nvar lists = window.mc4wp_vars.mailchimp.lists;\nvar selectedLists = [];\nvar listeners = {}; // functions\n\nfunction getSelectedListsWhere(searchKey, searchValue) {\n return selectedLists.filter(function (el) {\n return el[searchKey] === searchValue;\n });\n}\n\nfunction getSelectedLists() {\n return selectedLists;\n}\n\nfunction updateSelectedLists() {\n selectedLists = [];\n [].forEach.call(listInputs, function (input) {\n // skip unchecked checkboxes\n if (typeof input.checked === 'boolean' && !input.checked) {\n return;\n }\n\n if (_typeof(lists[input.value]) === 'object') {\n selectedLists.push(lists[input.value]);\n }\n });\n toggleVisibleLists();\n emit('selectedLists.change', [selectedLists]);\n return selectedLists;\n}\n\nfunction toggleVisibleLists() {\n var rows = document.querySelectorAll('.lists--only-selected > *');\n [].forEach.call(rows, function (el) {\n var listId = el.getAttribute('data-list-id');\n var isSelected = getSelectedListsWhere('id', listId).length > 0;\n el.style.display = isSelected ? '' : 'none';\n });\n}\n\nfunction emit(event, args) {\n listeners[event] = listeners[event] || [];\n listeners[event].forEach(function (f) {\n return f.apply(null, args);\n });\n}\n\nfunction on(event, func) {\n listeners[event] = listeners[event] || [];\n listeners[event].push(func);\n}\n\n[].forEach.call(listInputs, function (el) {\n el.addEventListener('change', updateSelectedLists);\n});\nupdateSelectedLists();\nmodule.exports = {\n getSelectedLists: getSelectedLists,\n on: on\n};\n\n},{}],7:[function(require,module,exports){\n'use strict';\n\nvar showIfElements = document.querySelectorAll('[data-showif]');\n[].forEach.call(showIfElements, function (element) {\n var config = JSON.parse(element.getAttribute('data-showif'));\n var parentElements = document.querySelectorAll('[name=\"' + config.element + '\"]');\n var inputs = element.querySelectorAll('input,select,textarea:not([readonly])');\n var hide = config.hide === undefined || config.hide;\n\n function toggleElement() {\n // do nothing with unchecked radio inputs\n if (this.type === 'radio' && !this.checked) {\n return;\n }\n\n var value = this.type === 'checkbox' ? this.checked : this.value;\n var conditionMet = String(value) === String(config.value);\n\n if (hide) {\n element.style.display = conditionMet ? '' : 'none';\n element.style.visibility = conditionMet ? '' : 'hidden';\n } else {\n element.style.opacity = conditionMet ? '' : '0.4';\n } // disable input fields to stop sending their values to server\n\n\n [].forEach.call(inputs, function (inputElement) {\n inputElement.readOnly = !conditionMet;\n });\n } // find checked element and call toggleElement function\n\n\n [].forEach.call(parentElements, function (el) {\n el.addEventListener('change', toggleElement);\n toggleElement.call(el);\n });\n});\n\n},{}],8:[function(require,module,exports){\n'use strict';\n\nvar URL = require('./url.js');\n\nvar context = document.getElementById('mc4wp-admin');\nvar tabElements = context.querySelectorAll('.tab');\nvar tabNavElements = context.querySelectorAll('.nav-tab');\nvar refererField = context.querySelector('input[name=\"_wp_http_referer\"]');\nvar tabs = [];\n\nif (!Element.prototype.matches) {\n Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;\n}\n\n[].forEach.call(tabElements, function (t, i) {\n var id = t.id.substring(4);\n var title = t.querySelector('h2:first-of-type').textContent;\n tabs.push({\n id: id,\n title: title,\n element: t,\n nav: context.querySelectorAll('.nav-tab-' + id),\n open: function open() {\n return _open(id);\n }\n });\n});\n\nfunction get(id) {\n for (var i = 0; i < tabs.length; i++) {\n if (tabs[i].id === id) {\n return tabs[i];\n }\n }\n\n return null;\n}\n\nfunction _open(tab, updateState) {\n // make sure we have a tab object\n if (typeof tab === 'string') {\n tab = get(tab);\n }\n\n if (!tab) {\n return false;\n } // should we update state?\n\n\n if (updateState === undefined) {\n updateState = true;\n } // hide all tabs & remove active class\n\n\n [].forEach.call(tabElements, function (t) {\n t.className = t.className.replace('tab-active', '');\n t.style.display = ' none';\n });\n [].forEach.call(tabNavElements, function (t) {\n t.className = t.className.replace('nav-tab-active', '');\n }); // add `nav-tab-active` to this tab\n\n [].forEach.call(tab.nav, function (nav) {\n nav.className += ' nav-tab-active';\n nav.blur();\n }); // show target tab\n\n tab.element.style.display = 'block';\n tab.element.className += ' tab-active'; // create new URL\n\n var url = URL.setParameter(window.location.href, 'tab', tab.id); // update hash\n\n if (history.pushState && updateState) {\n history.pushState(tab.id, '', url);\n } // update document title\n\n\n title(tab); // update referer field\n\n refererField.value = url; // if thickbox is open, close it.\n\n if (typeof window.tb_remove === 'function') {\n window.tb_remove();\n } // refresh editor if open\n\n\n if (window.mc4wp && window.mc4wp.forms && window.mc4wp.forms.editor) {\n window.mc4wp.forms.editor.refresh();\n }\n\n return true;\n}\n\nfunction title(tab) {\n var title = document.title.split('-');\n document.title = document.title.replace(title[0], tab.title + ' ');\n}\n\nfunction switchTab(evt) {\n var link = evt.target; // get from data attribute\n\n var tabId = link.getAttribute('data-tab'); // get from classname\n\n if (!tabId) {\n var match = link.className.match(/nav-tab-(\\w+)?/);\n\n if (match) {\n tabId = match[1];\n }\n } // get from href\n\n\n if (!tabId) {\n var urlParams = URL.parse(link.href);\n\n if (!urlParams.tab) {\n return;\n }\n\n tabId = urlParams.tab;\n }\n\n var opened = _open(tabId);\n\n if (opened) {\n evt.preventDefault();\n evt.returnValue = false;\n return false;\n }\n\n return true;\n}\n\nfunction init() {\n var activeTab = tabs.filter(function (t) {\n return t.element.offsetParent !== null;\n }).shift();\n\n if (!activeTab) {\n return;\n }\n\n var tab = get(activeTab.id.substring(4));\n\n if (!tab) {\n return;\n } // check if tab is in html5 history\n\n\n if (history.replaceState && history.state === null) {\n history.replaceState(tab.id, '');\n } // update document title\n\n\n title(tab);\n}\n\n[].forEach.call(tabNavElements, function (el) {\n return el.addEventListener('click', switchTab);\n});\ndocument.body.addEventListener('click', function (evt) {\n if (!evt.target.matches('.tab-link')) {\n return;\n }\n\n switchTab(evt);\n});\ninit();\n\nif (window.addEventListener && history.pushState) {\n window.addEventListener('popstate', function (e) {\n if (!e.state) return true;\n var tabId = e.state;\n return _open(tabId, false);\n });\n}\n\nmodule.exports = {\n open: _open,\n get: get\n};\n\n},{\"./url.js\":9}],9:[function(require,module,exports){\n'use strict';\n\nvar URL = {\n parse: function parse(url) {\n var query = {};\n var a = url.split('&');\n\n for (var i in a) {\n if (!a.hasOwnProperty(i)) {\n continue;\n }\n\n var b = a[i].split('=');\n query[decodeURIComponent(b[0])] = decodeURIComponent(b[1]);\n }\n\n return query;\n },\n build: function build(data) {\n var ret = [];\n\n for (var d in data) {\n ret.push(d + '=' + encodeURIComponent(data[d]));\n }\n\n return ret.join('&');\n },\n setParameter: function setParameter(url, key, value) {\n var data = URL.parse(url);\n data[key] = value;\n return URL.build(data);\n }\n};\nmodule.exports = URL;\n\n},{}],10:[function(require,module,exports){\n\"use strict\"\n\nvar Vnode = require(\"../render/vnode\")\n\nmodule.exports = function(render, schedule, console) {\n\tvar subscriptions = []\n\tvar rendering = false\n\tvar pending = false\n\n\tfunction sync() {\n\t\tif (rendering) throw new Error(\"Nested m.redraw.sync() call\")\n\t\trendering = true\n\t\tfor (var i = 0; i < subscriptions.length; i += 2) {\n\t\t\ttry { render(subscriptions[i], Vnode(subscriptions[i + 1]), redraw) }\n\t\t\tcatch (e) { console.error(e) }\n\t\t}\n\t\trendering = false\n\t}\n\n\tfunction redraw() {\n\t\tif (!pending) {\n\t\t\tpending = true\n\t\t\tschedule(function() {\n\t\t\t\tpending = false\n\t\t\t\tsync()\n\t\t\t})\n\t\t}\n\t}\n\n\tredraw.sync = sync\n\n\tfunction mount(root, component) {\n\t\tif (component != null && component.view == null && typeof component !== \"function\") {\n\t\t\tthrow new TypeError(\"m.mount(element, component) expects a component, not a vnode\")\n\t\t}\n\n\t\tvar index = subscriptions.indexOf(root)\n\t\tif (index >= 0) {\n\t\t\tsubscriptions.splice(index, 2)\n\t\t\trender(root, [], redraw)\n\t\t}\n\n\t\tif (component != null) {\n\t\t\tsubscriptions.push(root, component)\n\t\t\trender(root, Vnode(component), redraw)\n\t\t}\n\t}\n\n\treturn {mount: mount, redraw: redraw}\n}\n\n},{\"../render/vnode\":29}],11:[function(require,module,exports){\n(function (setImmediate){\n\"use strict\"\n\nvar Vnode = require(\"../render/vnode\")\nvar m = require(\"../render/hyperscript\")\nvar Promise = require(\"../promise/promise\")\n\nvar buildPathname = require(\"../pathname/build\")\nvar parsePathname = require(\"../pathname/parse\")\nvar compileTemplate = require(\"../pathname/compileTemplate\")\nvar assign = require(\"../pathname/assign\")\n\nvar sentinel = {}\n\nmodule.exports = function($window, mountRedraw) {\n\tvar fireAsync\n\n\tfunction setPath(path, data, options) {\n\t\tpath = buildPathname(path, data)\n\t\tif (fireAsync != null) {\n\t\t\tfireAsync()\n\t\t\tvar state = options ? options.state : null\n\t\t\tvar title = options ? options.title : null\n\t\t\tif (options && options.replace) $window.history.replaceState(state, title, route.prefix + path)\n\t\t\telse $window.history.pushState(state, title, route.prefix + path)\n\t\t}\n\t\telse {\n\t\t\t$window.location.href = route.prefix + path\n\t\t}\n\t}\n\n\tvar currentResolver = sentinel, component, attrs, currentPath, lastUpdate\n\n\tvar SKIP = route.SKIP = {}\n\n\tfunction route(root, defaultRoute, routes) {\n\t\tif (root == null) throw new Error(\"Ensure the DOM element that was passed to `m.route` is not undefined\")\n\t\t// 0 = start\n\t\t// 1 = init\n\t\t// 2 = ready\n\t\tvar state = 0\n\n\t\tvar compiled = Object.keys(routes).map(function(route) {\n\t\t\tif (route[0] !== \"/\") throw new SyntaxError(\"Routes must start with a `/`\")\n\t\t\tif ((/:([^\\/\\.-]+)(\\.{3})?:/).test(route)) {\n\t\t\t\tthrow new SyntaxError(\"Route parameter names must be separated with either `/`, `.`, or `-`\")\n\t\t\t}\n\t\t\treturn {\n\t\t\t\troute: route,\n\t\t\t\tcomponent: routes[route],\n\t\t\t\tcheck: compileTemplate(route),\n\t\t\t}\n\t\t})\n\t\tvar callAsync = typeof setImmediate === \"function\" ? setImmediate : setTimeout\n\t\tvar p = Promise.resolve()\n\t\tvar scheduled = false\n\t\tvar onremove\n\n\t\tfireAsync = null\n\n\t\tif (defaultRoute != null) {\n\t\t\tvar defaultData = parsePathname(defaultRoute)\n\n\t\t\tif (!compiled.some(function (i) { return i.check(defaultData) })) {\n\t\t\t\tthrow new ReferenceError(\"Default route doesn't match any known routes\")\n\t\t\t}\n\t\t}\n\n\t\tfunction resolveRoute() {\n\t\t\tscheduled = false\n\t\t\t// Consider the pathname holistically. The prefix might even be invalid,\n\t\t\t// but that's not our problem.\n\t\t\tvar prefix = $window.location.hash\n\t\t\tif (route.prefix[0] !== \"#\") {\n\t\t\t\tprefix = $window.location.search + prefix\n\t\t\t\tif (route.prefix[0] !== \"?\") {\n\t\t\t\t\tprefix = $window.location.pathname + prefix\n\t\t\t\t\tif (prefix[0] !== \"/\") prefix = \"/\" + prefix\n\t\t\t\t}\n\t\t\t}\n\t\t\t// This seemingly useless `.concat()` speeds up the tests quite a bit,\n\t\t\t// since the representation is consistently a relatively poorly\n\t\t\t// optimized cons string.\n\t\t\tvar path = prefix.concat()\n\t\t\t\t.replace(/(?:%[a-f89][a-f0-9])+/gim, decodeURIComponent)\n\t\t\t\t.slice(route.prefix.length)\n\t\t\tvar data = parsePathname(path)\n\n\t\t\tassign(data.params, $window.history.state)\n\n\t\t\tfunction fail() {\n\t\t\t\tif (path === defaultRoute) throw new Error(\"Could not resolve default route \" + defaultRoute)\n\t\t\t\tsetPath(defaultRoute, null, {replace: true})\n\t\t\t}\n\n\t\t\tloop(0)\n\t\t\tfunction loop(i) {\n\t\t\t\t// 0 = init\n\t\t\t\t// 1 = scheduled\n\t\t\t\t// 2 = done\n\t\t\t\tfor (; i < compiled.length; i++) {\n\t\t\t\t\tif (compiled[i].check(data)) {\n\t\t\t\t\t\tvar payload = compiled[i].component\n\t\t\t\t\t\tvar matchedRoute = compiled[i].route\n\t\t\t\t\t\tvar localComp = payload\n\t\t\t\t\t\tvar update = lastUpdate = function(comp) {\n\t\t\t\t\t\t\tif (update !== lastUpdate) return\n\t\t\t\t\t\t\tif (comp === SKIP) return loop(i + 1)\n\t\t\t\t\t\t\tcomponent = comp != null && (typeof comp.view === \"function\" || typeof comp === \"function\")? comp : \"div\"\n\t\t\t\t\t\t\tattrs = data.params, currentPath = path, lastUpdate = null\n\t\t\t\t\t\t\tcurrentResolver = payload.render ? payload : null\n\t\t\t\t\t\t\tif (state === 2) mountRedraw.redraw()\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tstate = 2\n\t\t\t\t\t\t\t\tmountRedraw.redraw.sync()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// There's no understating how much I *wish* I could\n\t\t\t\t\t\t// use `async`/`await` here...\n\t\t\t\t\t\tif (payload.view || typeof payload === \"function\") {\n\t\t\t\t\t\t\tpayload = {}\n\t\t\t\t\t\t\tupdate(localComp)\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (payload.onmatch) {\n\t\t\t\t\t\t\tp.then(function () {\n\t\t\t\t\t\t\t\treturn payload.onmatch(data.params, path, matchedRoute)\n\t\t\t\t\t\t\t}).then(update, fail)\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse update(\"div\")\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfail()\n\t\t\t}\n\t\t}\n\n\t\t// Set it unconditionally so `m.route.set` and `m.route.Link` both work,\n\t\t// even if neither `pushState` nor `hashchange` are supported. It's\n\t\t// cleared if `hashchange` is used, since that makes it automatically\n\t\t// async.\n\t\tfireAsync = function() {\n\t\t\tif (!scheduled) {\n\t\t\t\tscheduled = true\n\t\t\t\tcallAsync(resolveRoute)\n\t\t\t}\n\t\t}\n\n\t\tif (typeof $window.history.pushState === \"function\") {\n\t\t\tonremove = function() {\n\t\t\t\t$window.removeEventListener(\"popstate\", fireAsync, false)\n\t\t\t}\n\t\t\t$window.addEventListener(\"popstate\", fireAsync, false)\n\t\t} else if (route.prefix[0] === \"#\") {\n\t\t\tfireAsync = null\n\t\t\tonremove = function() {\n\t\t\t\t$window.removeEventListener(\"hashchange\", resolveRoute, false)\n\t\t\t}\n\t\t\t$window.addEventListener(\"hashchange\", resolveRoute, false)\n\t\t}\n\n\t\treturn mountRedraw.mount(root, {\n\t\t\tonbeforeupdate: function() {\n\t\t\t\tstate = state ? 2 : 1\n\t\t\t\treturn !(!state || sentinel === currentResolver)\n\t\t\t},\n\t\t\toncreate: resolveRoute,\n\t\t\tonremove: onremove,\n\t\t\tview: function() {\n\t\t\t\tif (!state || sentinel === currentResolver) return\n\t\t\t\t// Wrap in a fragment to preserve existing key semantics\n\t\t\t\tvar vnode = [Vnode(component, attrs.key, attrs)]\n\t\t\t\tif (currentResolver) vnode = currentResolver.render(vnode[0])\n\t\t\t\treturn vnode\n\t\t\t},\n\t\t})\n\t}\n\troute.set = function(path, data, options) {\n\t\tif (lastUpdate != null) {\n\t\t\toptions = options || {}\n\t\t\toptions.replace = true\n\t\t}\n\t\tlastUpdate = null\n\t\tsetPath(path, data, options)\n\t}\n\troute.get = function() {return currentPath}\n\troute.prefix = \"#!\"\n\troute.Link = {\n\t\tview: function(vnode) {\n\t\t\tvar options = vnode.attrs.options\n\t\t\t// Remove these so they don't get overwritten\n\t\t\tvar attrs = {}, onclick, href\n\t\t\tassign(attrs, vnode.attrs)\n\t\t\t// The first two are internal, but the rest are magic attributes\n\t\t\t// that need censored to not screw up rendering.\n\t\t\tattrs.selector = attrs.options = attrs.key = attrs.oninit =\n\t\t\tattrs.oncreate = attrs.onbeforeupdate = attrs.onupdate =\n\t\t\tattrs.onbeforeremove = attrs.onremove = null\n\n\t\t\t// Do this now so we can get the most current `href` and `disabled`.\n\t\t\t// Those attributes may also be specified in the selector, and we\n\t\t\t// should honor that.\n\t\t\tvar child = m(vnode.attrs.selector || \"a\", attrs, vnode.children)\n\n\t\t\t// Let's provide a *right* way to disable a route link, rather than\n\t\t\t// letting people screw up accessibility on accident.\n\t\t\t//\n\t\t\t// The attribute is coerced so users don't get surprised over\n\t\t\t// `disabled: 0` resulting in a button that's somehow routable\n\t\t\t// despite being visibly disabled.\n\t\t\tif (child.attrs.disabled = Boolean(child.attrs.disabled)) {\n\t\t\t\tchild.attrs.href = null\n\t\t\t\tchild.attrs[\"aria-disabled\"] = \"true\"\n\t\t\t\t// If you *really* do want to do this on a disabled link, use\n\t\t\t\t// an `oncreate` hook to add it.\n\t\t\t\tchild.attrs.onclick = null\n\t\t\t} else {\n\t\t\t\tonclick = child.attrs.onclick\n\t\t\t\thref = child.attrs.href\n\t\t\t\tchild.attrs.href = route.prefix + href\n\t\t\t\tchild.attrs.onclick = function(e) {\n\t\t\t\t\tvar result\n\t\t\t\t\tif (typeof onclick === \"function\") {\n\t\t\t\t\t\tresult = onclick.call(e.currentTarget, e)\n\t\t\t\t\t} else if (onclick == null || typeof onclick !== \"object\") {\n\t\t\t\t\t\t// do nothing\n\t\t\t\t\t} else if (typeof onclick.handleEvent === \"function\") {\n\t\t\t\t\t\tonclick.handleEvent(e)\n\t\t\t\t\t}\n\n\t\t\t\t\t// Adapted from React Router's implementation:\n\t\t\t\t\t// https://github.com/ReactTraining/react-router/blob/520a0acd48ae1b066eb0b07d6d4d1790a1d02482/packages/react-router-dom/modules/Link.js\n\t\t\t\t\t//\n\t\t\t\t\t// Try to be flexible and intuitive in how we handle links.\n\t\t\t\t\t// Fun fact: links aren't as obvious to get right as you\n\t\t\t\t\t// would expect. There's a lot more valid ways to click a\n\t\t\t\t\t// link than this, and one might want to not simply click a\n\t\t\t\t\t// link, but right click or command-click it to copy the\n\t\t\t\t\t// link target, etc. Nope, this isn't just for blind people.\n\t\t\t\t\tif (\n\t\t\t\t\t\t// Skip if `onclick` prevented default\n\t\t\t\t\t\tresult !== false && !e.defaultPrevented &&\n\t\t\t\t\t\t// Ignore everything but left clicks\n\t\t\t\t\t\t(e.button === 0 || e.which === 0 || e.which === 1) &&\n\t\t\t\t\t\t// Let the browser handle `target=_blank`, etc.\n\t\t\t\t\t\t(!e.currentTarget.target || e.currentTarget.target === \"_self\") &&\n\t\t\t\t\t\t// No modifier keys\n\t\t\t\t\t\t!e.ctrlKey && !e.metaKey && !e.shiftKey && !e.altKey\n\t\t\t\t\t) {\n\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\te.redraw = false\n\t\t\t\t\t\troute.set(href, null, options)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn child\n\t\t},\n\t}\n\troute.param = function(key) {\n\t\treturn attrs && key != null ? attrs[key] : attrs\n\t}\n\n\treturn route\n}\n\n}).call(this,require(\"timers\").setImmediate)\n},{\"../pathname/assign\":15,\"../pathname/build\":16,\"../pathname/compileTemplate\":17,\"../pathname/parse\":18,\"../promise/promise\":20,\"../render/hyperscript\":25,\"../render/vnode\":29,\"timers\":34}],12:[function(require,module,exports){\n\"use strict\"\n\nvar hyperscript = require(\"./render/hyperscript\")\n\nhyperscript.trust = require(\"./render/trust\")\nhyperscript.fragment = require(\"./render/fragment\")\n\nmodule.exports = hyperscript\n\n},{\"./render/fragment\":24,\"./render/hyperscript\":25,\"./render/trust\":28}],13:[function(require,module,exports){\n\"use strict\"\n\nvar hyperscript = require(\"./hyperscript\")\nvar request = require(\"./request\")\nvar mountRedraw = require(\"./mount-redraw\")\n\nvar m = function m() { return hyperscript.apply(this, arguments) }\nm.m = hyperscript\nm.trust = hyperscript.trust\nm.fragment = hyperscript.fragment\nm.mount = mountRedraw.mount\nm.route = require(\"./route\")\nm.render = require(\"./render\")\nm.redraw = mountRedraw.redraw\nm.request = request.request\nm.jsonp = request.jsonp\nm.parseQueryString = require(\"./querystring/parse\")\nm.buildQueryString = require(\"./querystring/build\")\nm.parsePathname = require(\"./pathname/parse\")\nm.buildPathname = require(\"./pathname/build\")\nm.vnode = require(\"./render/vnode\")\nm.PromisePolyfill = require(\"./promise/polyfill\")\n\nmodule.exports = m\n\n},{\"./hyperscript\":12,\"./mount-redraw\":14,\"./pathname/build\":16,\"./pathname/parse\":18,\"./promise/polyfill\":19,\"./querystring/build\":21,\"./querystring/parse\":22,\"./render\":23,\"./render/vnode\":29,\"./request\":30,\"./route\":32}],14:[function(require,module,exports){\n\"use strict\"\n\nvar render = require(\"./render\")\n\nmodule.exports = require(\"./api/mount-redraw\")(render, requestAnimationFrame, console)\n\n},{\"./api/mount-redraw\":10,\"./render\":23}],15:[function(require,module,exports){\n\"use strict\"\n\nmodule.exports = Object.assign || function(target, source) {\n\tif(source) Object.keys(source).forEach(function(key) { target[key] = source[key] })\n}\n\n},{}],16:[function(require,module,exports){\n\"use strict\"\n\nvar buildQueryString = require(\"../querystring/build\")\nvar assign = require(\"./assign\")\n\n// Returns `path` from `template` + `params`\nmodule.exports = function(template, params) {\n\tif ((/:([^\\/\\.-]+)(\\.{3})?:/).test(template)) {\n\t\tthrow new SyntaxError(\"Template parameter names *must* be separated\")\n\t}\n\tif (params == null) return template\n\tvar queryIndex = template.indexOf(\"?\")\n\tvar hashIndex = template.indexOf(\"#\")\n\tvar queryEnd = hashIndex < 0 ? template.length : hashIndex\n\tvar pathEnd = queryIndex < 0 ? queryEnd : queryIndex\n\tvar path = template.slice(0, pathEnd)\n\tvar query = {}\n\n\tassign(query, params)\n\n\tvar resolved = path.replace(/:([^\\/\\.-]+)(\\.{3})?/g, function(m, key, variadic) {\n\t\tdelete query[key]\n\t\t// If no such parameter exists, don't interpolate it.\n\t\tif (params[key] == null) return m\n\t\t// Escape normal parameters, but not variadic ones.\n\t\treturn variadic ? params[key] : encodeURIComponent(String(params[key]))\n\t})\n\n\t// In case the template substitution adds new query/hash parameters.\n\tvar newQueryIndex = resolved.indexOf(\"?\")\n\tvar newHashIndex = resolved.indexOf(\"#\")\n\tvar newQueryEnd = newHashIndex < 0 ? resolved.length : newHashIndex\n\tvar newPathEnd = newQueryIndex < 0 ? newQueryEnd : newQueryIndex\n\tvar result = resolved.slice(0, newPathEnd)\n\n\tif (queryIndex >= 0) result += template.slice(queryIndex, queryEnd)\n\tif (newQueryIndex >= 0) result += (queryIndex < 0 ? \"?\" : \"&\") + resolved.slice(newQueryIndex, newQueryEnd)\n\tvar querystring = buildQueryString(query)\n\tif (querystring) result += (queryIndex < 0 && newQueryIndex < 0 ? \"?\" : \"&\") + querystring\n\tif (hashIndex >= 0) result += template.slice(hashIndex)\n\tif (newHashIndex >= 0) result += (hashIndex < 0 ? \"\" : \"&\") + resolved.slice(newHashIndex)\n\treturn result\n}\n\n},{\"../querystring/build\":21,\"./assign\":15}],17:[function(require,module,exports){\n\"use strict\"\n\nvar parsePathname = require(\"./parse\")\n\n// Compiles a template into a function that takes a resolved path (without query\n// strings) and returns an object containing the template parameters with their\n// parsed values. This expects the input of the compiled template to be the\n// output of `parsePathname`. Note that it does *not* remove query parameters\n// specified in the template.\nmodule.exports = function(template) {\n\tvar templateData = parsePathname(template)\n\tvar templateKeys = Object.keys(templateData.params)\n\tvar keys = []\n\tvar regexp = new RegExp(\"^\" + templateData.path.replace(\n\t\t// I escape literal text so people can use things like `:file.:ext` or\n\t\t// `:lang-:locale` in routes. This is all merged into one pass so I\n\t\t// don't also accidentally escape `-` and make it harder to detect it to\n\t\t// ban it from template parameters.\n\t\t/:([^\\/.-]+)(\\.{3}|\\.(?!\\.)|-)?|[\\\\^$*+.()|\\[\\]{}]/g,\n\t\tfunction(m, key, extra) {\n\t\t\tif (key == null) return \"\\\\\" + m\n\t\t\tkeys.push({k: key, r: extra === \"...\"})\n\t\t\tif (extra === \"...\") return \"(.*)\"\n\t\t\tif (extra === \".\") return \"([^/]+)\\\\.\"\n\t\t\treturn \"([^/]+)\" + (extra || \"\")\n\t\t}\n\t) + \"$\")\n\treturn function(data) {\n\t\t// First, check the params. Usually, there isn't any, and it's just\n\t\t// checking a static set.\n\t\tfor (var i = 0; i < templateKeys.length; i++) {\n\t\t\tif (templateData.params[templateKeys[i]] !== data.params[templateKeys[i]]) return false\n\t\t}\n\t\t// If no interpolations exist, let's skip all the ceremony\n\t\tif (!keys.length) return regexp.test(data.path)\n\t\tvar values = regexp.exec(data.path)\n\t\tif (values == null) return false\n\t\tfor (var i = 0; i < keys.length; i++) {\n\t\t\tdata.params[keys[i].k] = keys[i].r ? values[i + 1] : decodeURIComponent(values[i + 1])\n\t\t}\n\t\treturn true\n\t}\n}\n\n},{\"./parse\":18}],18:[function(require,module,exports){\n\"use strict\"\n\nvar parseQueryString = require(\"../querystring/parse\")\n\n// Returns `{path, params}` from `url`\nmodule.exports = function(url) {\n\tvar queryIndex = url.indexOf(\"?\")\n\tvar hashIndex = url.indexOf(\"#\")\n\tvar queryEnd = hashIndex < 0 ? url.length : hashIndex\n\tvar pathEnd = queryIndex < 0 ? queryEnd : queryIndex\n\tvar path = url.slice(0, pathEnd).replace(/\\/{2,}/g, \"/\")\n\n\tif (!path) path = \"/\"\n\telse {\n\t\tif (path[0] !== \"/\") path = \"/\" + path\n\t\tif (path.length > 1 && path[path.length - 1] === \"/\") path = path.slice(0, -1)\n\t}\n\treturn {\n\t\tpath: path,\n\t\tparams: queryIndex < 0\n\t\t\t? {}\n\t\t\t: parseQueryString(url.slice(queryIndex + 1, queryEnd)),\n\t}\n}\n\n},{\"../querystring/parse\":22}],19:[function(require,module,exports){\n(function (setImmediate){\n\"use strict\"\n/** @constructor */\nvar PromisePolyfill = function(executor) {\n\tif (!(this instanceof PromisePolyfill)) throw new Error(\"Promise must be called with `new`\")\n\tif (typeof executor !== \"function\") throw new TypeError(\"executor must be a function\")\n\n\tvar self = this, resolvers = [], rejectors = [], resolveCurrent = handler(resolvers, true), rejectCurrent = handler(rejectors, false)\n\tvar instance = self._instance = {resolvers: resolvers, rejectors: rejectors}\n\tvar callAsync = typeof setImmediate === \"function\" ? setImmediate : setTimeout\n\tfunction handler(list, shouldAbsorb) {\n\t\treturn function execute(value) {\n\t\t\tvar then\n\t\t\ttry {\n\t\t\t\tif (shouldAbsorb && value != null && (typeof value === \"object\" || typeof value === \"function\") && typeof (then = value.then) === \"function\") {\n\t\t\t\t\tif (value === self) throw new TypeError(\"Promise can't be resolved w/ itself\")\n\t\t\t\t\texecuteOnce(then.bind(value))\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tcallAsync(function() {\n\t\t\t\t\t\tif (!shouldAbsorb && list.length === 0) console.error(\"Possible unhandled promise rejection:\", value)\n\t\t\t\t\t\tfor (var i = 0; i < list.length; i++) list[i](value)\n\t\t\t\t\t\tresolvers.length = 0, rejectors.length = 0\n\t\t\t\t\t\tinstance.state = shouldAbsorb\n\t\t\t\t\t\tinstance.retry = function() {execute(value)}\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (e) {\n\t\t\t\trejectCurrent(e)\n\t\t\t}\n\t\t}\n\t}\n\tfunction executeOnce(then) {\n\t\tvar runs = 0\n\t\tfunction run(fn) {\n\t\t\treturn function(value) {\n\t\t\t\tif (runs++ > 0) return\n\t\t\t\tfn(value)\n\t\t\t}\n\t\t}\n\t\tvar onerror = run(rejectCurrent)\n\t\ttry {then(run(resolveCurrent), onerror)} catch (e) {onerror(e)}\n\t}\n\n\texecuteOnce(executor)\n}\nPromisePolyfill.prototype.then = function(onFulfilled, onRejection) {\n\tvar self = this, instance = self._instance\n\tfunction handle(callback, list, next, state) {\n\t\tlist.push(function(value) {\n\t\t\tif (typeof callback !== \"function\") next(value)\n\t\t\telse try {resolveNext(callback(value))} catch (e) {if (rejectNext) rejectNext(e)}\n\t\t})\n\t\tif (typeof instance.retry === \"function\" && state === instance.state) instance.retry()\n\t}\n\tvar resolveNext, rejectNext\n\tvar promise = new PromisePolyfill(function(resolve, reject) {resolveNext = resolve, rejectNext = reject})\n\thandle(onFulfilled, instance.resolvers, resolveNext, true), handle(onRejection, instance.rejectors, rejectNext, false)\n\treturn promise\n}\nPromisePolyfill.prototype.catch = function(onRejection) {\n\treturn this.then(null, onRejection)\n}\nPromisePolyfill.prototype.finally = function(callback) {\n\treturn this.then(\n\t\tfunction(value) {\n\t\t\treturn PromisePolyfill.resolve(callback()).then(function() {\n\t\t\t\treturn value\n\t\t\t})\n\t\t},\n\t\tfunction(reason) {\n\t\t\treturn PromisePolyfill.resolve(callback()).then(function() {\n\t\t\t\treturn PromisePolyfill.reject(reason);\n\t\t\t})\n\t\t}\n\t)\n}\nPromisePolyfill.resolve = function(value) {\n\tif (value instanceof PromisePolyfill) return value\n\treturn new PromisePolyfill(function(resolve) {resolve(value)})\n}\nPromisePolyfill.reject = function(value) {\n\treturn new PromisePolyfill(function(resolve, reject) {reject(value)})\n}\nPromisePolyfill.all = function(list) {\n\treturn new PromisePolyfill(function(resolve, reject) {\n\t\tvar total = list.length, count = 0, values = []\n\t\tif (list.length === 0) resolve([])\n\t\telse for (var i = 0; i < list.length; i++) {\n\t\t\t(function(i) {\n\t\t\t\tfunction consume(value) {\n\t\t\t\t\tcount++\n\t\t\t\t\tvalues[i] = value\n\t\t\t\t\tif (count === total) resolve(values)\n\t\t\t\t}\n\t\t\t\tif (list[i] != null && (typeof list[i] === \"object\" || typeof list[i] === \"function\") && typeof list[i].then === \"function\") {\n\t\t\t\t\tlist[i].then(consume, reject)\n\t\t\t\t}\n\t\t\t\telse consume(list[i])\n\t\t\t})(i)\n\t\t}\n\t})\n}\nPromisePolyfill.race = function(list) {\n\treturn new PromisePolyfill(function(resolve, reject) {\n\t\tfor (var i = 0; i < list.length; i++) {\n\t\t\tlist[i].then(resolve, reject)\n\t\t}\n\t})\n}\n\nmodule.exports = PromisePolyfill\n\n}).call(this,require(\"timers\").setImmediate)\n},{\"timers\":34}],20:[function(require,module,exports){\n(function (global){\n\"use strict\"\n\nvar PromisePolyfill = require(\"./polyfill\")\n\nif (typeof window !== \"undefined\") {\n\tif (typeof window.Promise === \"undefined\") {\n\t\twindow.Promise = PromisePolyfill\n\t} else if (!window.Promise.prototype.finally) {\n\t\twindow.Promise.prototype.finally = PromisePolyfill.prototype.finally\n\t}\n\tmodule.exports = window.Promise\n} else if (typeof global !== \"undefined\") {\n\tif (typeof global.Promise === \"undefined\") {\n\t\tglobal.Promise = PromisePolyfill\n\t} else if (!global.Promise.prototype.finally) {\n\t\tglobal.Promise.prototype.finally = PromisePolyfill.prototype.finally\n\t}\n\tmodule.exports = global.Promise\n} else {\n\tmodule.exports = PromisePolyfill\n}\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"./polyfill\":19}],21:[function(require,module,exports){\n\"use strict\"\n\nmodule.exports = function(object) {\n\tif (Object.prototype.toString.call(object) !== \"[object Object]\") return \"\"\n\n\tvar args = []\n\tfor (var key in object) {\n\t\tdestructure(key, object[key])\n\t}\n\n\treturn args.join(\"&\")\n\n\tfunction destructure(key, value) {\n\t\tif (Array.isArray(value)) {\n\t\t\tfor (var i = 0; i < value.length; i++) {\n\t\t\t\tdestructure(key + \"[\" + i + \"]\", value[i])\n\t\t\t}\n\t\t}\n\t\telse if (Object.prototype.toString.call(value) === \"[object Object]\") {\n\t\t\tfor (var i in value) {\n\t\t\t\tdestructure(key + \"[\" + i + \"]\", value[i])\n\t\t\t}\n\t\t}\n\t\telse args.push(encodeURIComponent(key) + (value != null && value !== \"\" ? \"=\" + encodeURIComponent(value) : \"\"))\n\t}\n}\n\n},{}],22:[function(require,module,exports){\n\"use strict\"\n\nmodule.exports = function(string) {\n\tif (string === \"\" || string == null) return {}\n\tif (string.charAt(0) === \"?\") string = string.slice(1)\n\n\tvar entries = string.split(\"&\"), counters = {}, data = {}\n\tfor (var i = 0; i < entries.length; i++) {\n\t\tvar entry = entries[i].split(\"=\")\n\t\tvar key = decodeURIComponent(entry[0])\n\t\tvar value = entry.length === 2 ? decodeURIComponent(entry[1]) : \"\"\n\n\t\tif (value === \"true\") value = true\n\t\telse if (value === \"false\") value = false\n\n\t\tvar levels = key.split(/\\]\\[?|\\[/)\n\t\tvar cursor = data\n\t\tif (key.indexOf(\"[\") > -1) levels.pop()\n\t\tfor (var j = 0; j < levels.length; j++) {\n\t\t\tvar level = levels[j], nextLevel = levels[j + 1]\n\t\t\tvar isNumber = nextLevel == \"\" || !isNaN(parseInt(nextLevel, 10))\n\t\t\tif (level === \"\") {\n\t\t\t\tvar key = levels.slice(0, j).join()\n\t\t\t\tif (counters[key] == null) {\n\t\t\t\t\tcounters[key] = Array.isArray(cursor) ? cursor.length : 0\n\t\t\t\t}\n\t\t\t\tlevel = counters[key]++\n\t\t\t}\n\t\t\t// Disallow direct prototype pollution\n\t\t\telse if (level === \"__proto__\") break\n\t\t\tif (j === levels.length - 1) cursor[level] = value\n\t\t\telse {\n\t\t\t\t// Read own properties exclusively to disallow indirect\n\t\t\t\t// prototype pollution\n\t\t\t\tvar desc = Object.getOwnPropertyDescriptor(cursor, level)\n\t\t\t\tif (desc != null) desc = desc.value\n\t\t\t\tif (desc == null) cursor[level] = desc = isNumber ? [] : {}\n\t\t\t\tcursor = desc\n\t\t\t}\n\t\t}\n\t}\n\treturn data\n}\n\n},{}],23:[function(require,module,exports){\n\"use strict\"\n\nmodule.exports = require(\"./render/render\")(window)\n\n},{\"./render/render\":27}],24:[function(require,module,exports){\n\"use strict\"\n\nvar Vnode = require(\"../render/vnode\")\nvar hyperscriptVnode = require(\"./hyperscriptVnode\")\n\nmodule.exports = function() {\n\tvar vnode = hyperscriptVnode.apply(0, arguments)\n\n\tvnode.tag = \"[\"\n\tvnode.children = Vnode.normalizeChildren(vnode.children)\n\treturn vnode\n}\n\n},{\"../render/vnode\":29,\"./hyperscriptVnode\":26}],25:[function(require,module,exports){\n\"use strict\"\n\nvar Vnode = require(\"../render/vnode\")\nvar hyperscriptVnode = require(\"./hyperscriptVnode\")\n\nvar selectorParser = /(?:(^|#|\\.)([^#\\.\\[\\]]+))|(\\[(.+?)(?:\\s*=\\s*(\"|'|)((?:\\\\[\"'\\]]|.)*?)\\5)?\\])/g\nvar selectorCache = {}\nvar hasOwn = {}.hasOwnProperty\n\nfunction isEmpty(object) {\n\tfor (var key in object) if (hasOwn.call(object, key)) return false\n\treturn true\n}\n\nfunction compileSelector(selector) {\n\tvar match, tag = \"div\", classes = [], attrs = {}\n\twhile (match = selectorParser.exec(selector)) {\n\t\tvar type = match[1], value = match[2]\n\t\tif (type === \"\" && value !== \"\") tag = value\n\t\telse if (type === \"#\") attrs.id = value\n\t\telse if (type === \".\") classes.push(value)\n\t\telse if (match[3][0] === \"[\") {\n\t\t\tvar attrValue = match[6]\n\t\t\tif (attrValue) attrValue = attrValue.replace(/\\\\([\"'])/g, \"$1\").replace(/\\\\\\\\/g, \"\\\\\")\n\t\t\tif (match[4] === \"class\") classes.push(attrValue)\n\t\t\telse attrs[match[4]] = attrValue === \"\" ? attrValue : attrValue || true\n\t\t}\n\t}\n\tif (classes.length > 0) attrs.className = classes.join(\" \")\n\treturn selectorCache[selector] = {tag: tag, attrs: attrs}\n}\n\nfunction execSelector(state, vnode) {\n\tvar attrs = vnode.attrs\n\tvar children = Vnode.normalizeChildren(vnode.children)\n\tvar hasClass = hasOwn.call(attrs, \"class\")\n\tvar className = hasClass ? attrs.class : attrs.className\n\n\tvnode.tag = state.tag\n\tvnode.attrs = null\n\tvnode.children = undefined\n\n\tif (!isEmpty(state.attrs) && !isEmpty(attrs)) {\n\t\tvar newAttrs = {}\n\n\t\tfor (var key in attrs) {\n\t\t\tif (hasOwn.call(attrs, key)) newAttrs[key] = attrs[key]\n\t\t}\n\n\t\tattrs = newAttrs\n\t}\n\n\tfor (var key in state.attrs) {\n\t\tif (hasOwn.call(state.attrs, key) && key !== \"className\" && !hasOwn.call(attrs, key)){\n\t\t\tattrs[key] = state.attrs[key]\n\t\t}\n\t}\n\tif (className != null || state.attrs.className != null) attrs.className =\n\t\tclassName != null\n\t\t\t? state.attrs.className != null\n\t\t\t\t? String(state.attrs.className) + \" \" + String(className)\n\t\t\t\t: className\n\t\t\t: state.attrs.className != null\n\t\t\t\t? state.attrs.className\n\t\t\t\t: null\n\n\tif (hasClass) attrs.class = null\n\n\tfor (var key in attrs) {\n\t\tif (hasOwn.call(attrs, key) && key !== \"key\") {\n\t\t\tvnode.attrs = attrs\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif (Array.isArray(children) && children.length === 1 && children[0] != null && children[0].tag === \"#\") {\n\t\tvnode.text = children[0].children\n\t} else {\n\t\tvnode.children = children\n\t}\n\n\treturn vnode\n}\n\nfunction hyperscript(selector) {\n\tif (selector == null || typeof selector !== \"string\" && typeof selector !== \"function\" && typeof selector.view !== \"function\") {\n\t\tthrow Error(\"The selector must be either a string or a component.\");\n\t}\n\n\tvar vnode = hyperscriptVnode.apply(1, arguments)\n\n\tif (typeof selector === \"string\") {\n\t\tvnode.children = Vnode.normalizeChildren(vnode.children)\n\t\tif (selector !== \"[\") return execSelector(selectorCache[selector] || compileSelector(selector), vnode)\n\t}\n\n\tvnode.tag = selector\n\treturn vnode\n}\n\nmodule.exports = hyperscript\n\n},{\"../render/vnode\":29,\"./hyperscriptVnode\":26}],26:[function(require,module,exports){\n\"use strict\"\n\nvar Vnode = require(\"../render/vnode\")\n\n// Call via `hyperscriptVnode.apply(startOffset, arguments)`\n//\n// The reason I do it this way, forwarding the arguments and passing the start\n// offset in `this`, is so I don't have to create a temporary array in a\n// performance-critical path.\n//\n// In native ES6, I'd instead add a final `...args` parameter to the\n// `hyperscript` and `fragment` factories and define this as\n// `hyperscriptVnode(...args)`, since modern engines do optimize that away. But\n// ES5 (what Mithril requires thanks to IE support) doesn't give me that luxury,\n// and engines aren't nearly intelligent enough to do either of these:\n//\n// 1. Elide the allocation for `[].slice.call(arguments, 1)` when it's passed to\n// another function only to be indexed.\n// 2. Elide an `arguments` allocation when it's passed to any function other\n// than `Function.prototype.apply` or `Reflect.apply`.\n//\n// In ES6, it'd probably look closer to this (I'd need to profile it, though):\n// module.exports = function(attrs, ...children) {\n// if (attrs == null || typeof attrs === \"object\" && attrs.tag == null && !Array.isArray(attrs)) {\n// if (children.length === 1 && Array.isArray(children[0])) children = children[0]\n// } else {\n// children = children.length === 0 && Array.isArray(attrs) ? attrs : [attrs, ...children]\n// attrs = undefined\n// }\n//\n// if (attrs == null) attrs = {}\n// return Vnode(\"\", attrs.key, attrs, children)\n// }\nmodule.exports = function() {\n\tvar attrs = arguments[this], start = this + 1, children\n\n\tif (attrs == null) {\n\t\tattrs = {}\n\t} else if (typeof attrs !== \"object\" || attrs.tag != null || Array.isArray(attrs)) {\n\t\tattrs = {}\n\t\tstart = this\n\t}\n\n\tif (arguments.length === start + 1) {\n\t\tchildren = arguments[start]\n\t\tif (!Array.isArray(children)) children = [children]\n\t} else {\n\t\tchildren = []\n\t\twhile (start < arguments.length) children.push(arguments[start++])\n\t}\n\n\treturn Vnode(\"\", attrs.key, attrs, children)\n}\n\n},{\"../render/vnode\":29}],27:[function(require,module,exports){\n\"use strict\"\n\nvar Vnode = require(\"../render/vnode\")\n\nmodule.exports = function($window) {\n\tvar $doc = $window && $window.document\n\tvar currentRedraw\n\n\tvar nameSpace = {\n\t\tsvg: \"http://www.w3.org/2000/svg\",\n\t\tmath: \"http://www.w3.org/1998/Math/MathML\"\n\t}\n\n\tfunction getNameSpace(vnode) {\n\t\treturn vnode.attrs && vnode.attrs.xmlns || nameSpace[vnode.tag]\n\t}\n\n\t//sanity check to discourage people from doing `vnode.state = ...`\n\tfunction checkState(vnode, original) {\n\t\tif (vnode.state !== original) throw new Error(\"`vnode.state` must not be modified\")\n\t}\n\n\t//Note: the hook is passed as the `this` argument to allow proxying the\n\t//arguments without requiring a full array allocation to do so. It also\n\t//takes advantage of the fact the current `vnode` is the first argument in\n\t//all lifecycle methods.\n\tfunction callHook(vnode) {\n\t\tvar original = vnode.state\n\t\ttry {\n\t\t\treturn this.apply(original, arguments)\n\t\t} finally {\n\t\t\tcheckState(vnode, original)\n\t\t}\n\t}\n\n\t// IE11 (at least) throws an UnspecifiedError when accessing document.activeElement when\n\t// inside an iframe. Catch and swallow this error, and heavy-handidly return null.\n\tfunction activeElement() {\n\t\ttry {\n\t\t\treturn $doc.activeElement\n\t\t} catch (e) {\n\t\t\treturn null\n\t\t}\n\t}\n\t//create\n\tfunction createNodes(parent, vnodes, start, end, hooks, nextSibling, ns) {\n\t\tfor (var i = start; i < end; i++) {\n\t\t\tvar vnode = vnodes[i]\n\t\t\tif (vnode != null) {\n\t\t\t\tcreateNode(parent, vnode, hooks, ns, nextSibling)\n\t\t\t}\n\t\t}\n\t}\n\tfunction createNode(parent, vnode, hooks, ns, nextSibling) {\n\t\tvar tag = vnode.tag\n\t\tif (typeof tag === \"string\") {\n\t\t\tvnode.state = {}\n\t\t\tif (vnode.attrs != null) initLifecycle(vnode.attrs, vnode, hooks)\n\t\t\tswitch (tag) {\n\t\t\t\tcase \"#\": createText(parent, vnode, nextSibling); break\n\t\t\t\tcase \"<\": createHTML(parent, vnode, ns, nextSibling); break\n\t\t\t\tcase \"[\": createFragment(parent, vnode, hooks, ns, nextSibling); break\n\t\t\t\tdefault: createElement(parent, vnode, hooks, ns, nextSibling)\n\t\t\t}\n\t\t}\n\t\telse createComponent(parent, vnode, hooks, ns, nextSibling)\n\t}\n\tfunction createText(parent, vnode, nextSibling) {\n\t\tvnode.dom = $doc.createTextNode(vnode.children)\n\t\tinsertNode(parent, vnode.dom, nextSibling)\n\t}\n\tvar possibleParents = {caption: \"table\", thead: \"table\", tbody: \"table\", tfoot: \"table\", tr: \"tbody\", th: \"tr\", td: \"tr\", colgroup: \"table\", col: \"colgroup\"}\n\tfunction createHTML(parent, vnode, ns, nextSibling) {\n\t\tvar match = vnode.children.match(/^\\s*?<(\\w+)/im) || []\n\t\t// not using the proper parent makes the child element(s) vanish.\n\t\t// var div = document.createElement(\"div\")\n\t\t// div.innerHTML = \"<td>i</td><td>j</td>\"\n\t\t// console.log(div.innerHTML)\n\t\t// --> \"ij\", no <td> in sight.\n\t\tvar temp = $doc.createElement(possibleParents[match[1]] || \"div\")\n\t\tif (ns === \"http://www.w3.org/2000/svg\") {\n\t\t\ttemp.innerHTML = \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\">\" + vnode.children + \"</svg>\"\n\t\t\ttemp = temp.firstChild\n\t\t} else {\n\t\t\ttemp.innerHTML = vnode.children\n\t\t}\n\t\tvnode.dom = temp.firstChild\n\t\tvnode.domSize = temp.childNodes.length\n\t\t// Capture nodes to remove, so we don't confuse them.\n\t\tvnode.instance = []\n\t\tvar fragment = $doc.createDocumentFragment()\n\t\tvar child\n\t\twhile (child = temp.firstChild) {\n\t\t\tvnode.instance.push(child)\n\t\t\tfragment.appendChild(child)\n\t\t}\n\t\tinsertNode(parent, fragment, nextSibling)\n\t}\n\tfunction createFragment(parent, vnode, hooks, ns, nextSibling) {\n\t\tvar fragment = $doc.createDocumentFragment()\n\t\tif (vnode.children != null) {\n\t\t\tvar children = vnode.children\n\t\t\tcreateNodes(fragment, children, 0, children.length, hooks, null, ns)\n\t\t}\n\t\tvnode.dom = fragment.firstChild\n\t\tvnode.domSize = fragment.childNodes.length\n\t\tinsertNode(parent, fragment, nextSibling)\n\t}\n\tfunction createElement(parent, vnode, hooks, ns, nextSibling) {\n\t\tvar tag = vnode.tag\n\t\tvar attrs = vnode.attrs\n\t\tvar is = attrs && attrs.is\n\n\t\tns = getNameSpace(vnode) || ns\n\n\t\tvar element = ns ?\n\t\t\tis ? $doc.createElementNS(ns, tag, {is: is}) : $doc.createElementNS(ns, tag) :\n\t\t\tis ? $doc.createElement(tag, {is: is}) : $doc.createElement(tag)\n\t\tvnode.dom = element\n\n\t\tif (attrs != null) {\n\t\t\tsetAttrs(vnode, attrs, ns)\n\t\t}\n\n\t\tinsertNode(parent, element, nextSibling)\n\n\t\tif (!maybeSetContentEditable(vnode)) {\n\t\t\tif (vnode.text != null) {\n\t\t\t\tif (vnode.text !== \"\") element.textContent = vnode.text\n\t\t\t\telse vnode.children = [Vnode(\"#\", undefined, undefined, vnode.text, undefined, undefined)]\n\t\t\t}\n\t\t\tif (vnode.children != null) {\n\t\t\t\tvar children = vnode.children\n\t\t\t\tcreateNodes(element, children, 0, children.length, hooks, null, ns)\n\t\t\t\tif (vnode.tag === \"select\" && attrs != null) setLateSelectAttrs(vnode, attrs)\n\t\t\t}\n\t\t}\n\t}\n\tfunction initComponent(vnode, hooks) {\n\t\tvar sentinel\n\t\tif (typeof vnode.tag.view === \"function\") {\n\t\t\tvnode.state = Object.create(vnode.tag)\n\t\t\tsentinel = vnode.state.view\n\t\t\tif (sentinel.$$reentrantLock$$ != null) return\n\t\t\tsentinel.$$reentrantLock$$ = true\n\t\t} else {\n\t\t\tvnode.state = void 0\n\t\t\tsentinel = vnode.tag\n\t\t\tif (sentinel.$$reentrantLock$$ != null) return\n\t\t\tsentinel.$$reentrantLock$$ = true\n\t\t\tvnode.state = (vnode.tag.prototype != null && typeof vnode.tag.prototype.view === \"function\") ? new vnode.tag(vnode) : vnode.tag(vnode)\n\t\t}\n\t\tinitLifecycle(vnode.state, vnode, hooks)\n\t\tif (vnode.attrs != null) initLifecycle(vnode.attrs, vnode, hooks)\n\t\tvnode.instance = Vnode.normalize(callHook.call(vnode.state.view, vnode))\n\t\tif (vnode.instance === vnode) throw Error(\"A view cannot return the vnode it received as argument\")\n\t\tsentinel.$$reentrantLock$$ = null\n\t}\n\tfunction createComponent(parent, vnode, hooks, ns, nextSibling) {\n\t\tinitComponent(vnode, hooks)\n\t\tif (vnode.instance != null) {\n\t\t\tcreateNode(parent, vnode.instance, hooks, ns, nextSibling)\n\t\t\tvnode.dom = vnode.instance.dom\n\t\t\tvnode.domSize = vnode.dom != null ? vnode.instance.domSize : 0\n\t\t}\n\t\telse {\n\t\t\tvnode.domSize = 0\n\t\t}\n\t}\n\n\t//update\n\t/**\n\t * @param {Element|Fragment} parent - the parent element\n\t * @param {Vnode[] | null} old - the list of vnodes of the last `render()` call for\n\t * this part of the tree\n\t * @param {Vnode[] | null} vnodes - as above, but for the current `render()` call.\n\t * @param {Function[]} hooks - an accumulator of post-render hooks (oncreate/onupdate)\n\t * @param {Element | null} nextSibling - the next DOM node if we're dealing with a\n\t * fragment that is not the last item in its\n\t * parent\n\t * @param {'svg' | 'math' | String | null} ns) - the current XML namespace, if any\n\t * @returns void\n\t */\n\t// This function diffs and patches lists of vnodes, both keyed and unkeyed.\n\t//\n\t// We will:\n\t//\n\t// 1. describe its general structure\n\t// 2. focus on the diff algorithm optimizations\n\t// 3. discuss DOM node operations.\n\n\t// ## Overview:\n\t//\n\t// The updateNodes() function:\n\t// - deals with trivial cases\n\t// - determines whether the lists are keyed or unkeyed based on the first non-null node\n\t// of each list.\n\t// - diffs them and patches the DOM if needed (that's the brunt of the code)\n\t// - manages the leftovers: after diffing, are there:\n\t// - old nodes left to remove?\n\t// \t - new nodes to insert?\n\t// \t deal with them!\n\t//\n\t// The lists are only iterated over once, with an exception for the nodes in `old` that\n\t// are visited in the fourth part of the diff and in the `removeNodes` loop.\n\n\t// ## Diffing\n\t//\n\t// Reading https://github.com/localvoid/ivi/blob/ddc09d06abaef45248e6133f7040d00d3c6be853/packages/ivi/src/vdom/implementation.ts#L617-L837\n\t// may be good for context on longest increasing subsequence-based logic for moving nodes.\n\t//\n\t// In order to diff keyed lists, one has to\n\t//\n\t// 1) match nodes in both lists, per key, and update them accordingly\n\t// 2) create the nodes present in the new list, but absent in the old one\n\t// 3) remove the nodes present in the old list, but absent in the new one\n\t// 4) figure out what nodes in 1) to move in order to minimize the DOM operations.\n\t//\n\t// To achieve 1) one can create a dictionary of keys => index (for the old list), then iterate\n\t// over the new list and for each new vnode, find the corresponding vnode in the old list using\n\t// the map.\n\t// 2) is achieved in the same step: if a new node has no corresponding entry in the map, it is new\n\t// and must be created.\n\t// For the removals, we actually remove the nodes that have been updated from the old list.\n\t// The nodes that remain in that list after 1) and 2) have been performed can be safely removed.\n\t// The fourth step is a bit more complex and relies on the longest increasing subsequence (LIS)\n\t// algorithm.\n\t//\n\t// the longest increasing subsequence is the list of nodes that can remain in place. Imagine going\n\t// from `1,2,3,4,5` to `4,5,1,2,3` where the numbers are not necessarily the keys, but the indices\n\t// corresponding to the keyed nodes in the old list (keyed nodes `e,d,c,b,a` => `b,a,e,d,c` would\n\t// match the above lists, for example).\n\t//\n\t// In there are two increasing subsequences: `4,5` and `1,2,3`, the latter being the longest. We\n\t// can update those nodes without moving them, and only call `insertNode` on `4` and `5`.\n\t//\n\t// @localvoid adapted the algo to also support node deletions and insertions (the `lis` is actually\n\t// the longest increasing subsequence *of old nodes still present in the new list*).\n\t//\n\t// It is a general algorithm that is fireproof in all circumstances, but it requires the allocation\n\t// and the construction of a `key => oldIndex` map, and three arrays (one with `newIndex => oldIndex`,\n\t// the `LIS` and a temporary one to create the LIS).\n\t//\n\t// So we cheat where we can: if the tails of the lists are identical, they are guaranteed to be part of\n\t// the LIS and can be updated without moving them.\n\t//\n\t// If two nodes are swapped, they are guaranteed not to be part of the LIS, and must be moved (with\n\t// the exception of the last node if the list is fully reversed).\n\t//\n\t// ## Finding the next sibling.\n\t//\n\t// `updateNode()` and `createNode()` expect a nextSibling parameter to perform DOM operations.\n\t// When the list is being traversed top-down, at any index, the DOM nodes up to the previous\n\t// vnode reflect the content of the new list, whereas the rest of the DOM nodes reflect the old\n\t// list. The next sibling must be looked for in the old list using `getNextSibling(... oldStart + 1 ...)`.\n\t//\n\t// In the other scenarios (swaps, upwards traversal, map-based diff),\n\t// the new vnodes list is traversed upwards. The DOM nodes at the bottom of the list reflect the\n\t// bottom part of the new vnodes list, and we can use the `v.dom` value of the previous node\n\t// as the next sibling (cached in the `nextSibling` variable).\n\n\n\t// ## DOM node moves\n\t//\n\t// In most scenarios `updateNode()` and `createNode()` perform the DOM operations. However,\n\t// this is not the case if the node moved (second and fourth part of the diff algo). We move\n\t// the old DOM nodes before updateNode runs because it enables us to use the cached `nextSibling`\n\t// variable rather than fetching it using `getNextSibling()`.\n\t//\n\t// The fourth part of the diff currently inserts nodes unconditionally, leading to issues\n\t// like #1791 and #1999. We need to be smarter about those situations where adjascent old\n\t// nodes remain together in the new list in a way that isn't covered by parts one and\n\t// three of the diff algo.\n\n\tfunction updateNodes(parent, old, vnodes, hooks, nextSibling, ns) {\n\t\tif (old === vnodes || old == null && vnodes == null) return\n\t\telse if (old == null || old.length === 0) createNodes(parent, vnodes, 0, vnodes.length, hooks, nextSibling, ns)\n\t\telse if (vnodes == null || vnodes.length === 0) removeNodes(parent, old, 0, old.length)\n\t\telse {\n\t\t\tvar isOldKeyed = old[0] != null && old[0].key != null\n\t\t\tvar isKeyed = vnodes[0] != null && vnodes[0].key != null\n\t\t\tvar start = 0, oldStart = 0\n\t\t\tif (!isOldKeyed) while (oldStart < old.length && old[oldStart] == null) oldStart++\n\t\t\tif (!isKeyed) while (start < vnodes.length && vnodes[start] == null) start++\n\t\t\tif (isKeyed === null && isOldKeyed == null) return // both lists are full of nulls\n\t\t\tif (isOldKeyed !== isKeyed) {\n\t\t\t\tremoveNodes(parent, old, oldStart, old.length)\n\t\t\t\tcreateNodes(parent, vnodes, start, vnodes.length, hooks, nextSibling, ns)\n\t\t\t} else if (!isKeyed) {\n\t\t\t\t// Don't index past the end of either list (causes deopts).\n\t\t\t\tvar commonLength = old.length < vnodes.length ? old.length : vnodes.length\n\t\t\t\t// Rewind if necessary to the first non-null index on either side.\n\t\t\t\t// We could alternatively either explicitly create or remove nodes when `start !== oldStart`\n\t\t\t\t// but that would be optimizing for sparse lists which are more rare than dense ones.\n\t\t\t\tstart = start < oldStart ? start : oldStart\n\t\t\t\tfor (; start < commonLength; start++) {\n\t\t\t\t\to = old[start]\n\t\t\t\t\tv = vnodes[start]\n\t\t\t\t\tif (o === v || o == null && v == null) continue\n\t\t\t\t\telse if (o == null) createNode(parent, v, hooks, ns, getNextSibling(old, start + 1, nextSibling))\n\t\t\t\t\telse if (v == null) removeNode(parent, o)\n\t\t\t\t\telse updateNode(parent, o, v, hooks, getNextSibling(old, start + 1, nextSibling), ns)\n\t\t\t\t}\n\t\t\t\tif (old.length > commonLength) removeNodes(parent, old, start, old.length)\n\t\t\t\tif (vnodes.length > commonLength) createNodes(parent, vnodes, start, vnodes.length, hooks, nextSibling, ns)\n\t\t\t} else {\n\t\t\t\t// keyed diff\n\t\t\t\tvar oldEnd = old.length - 1, end = vnodes.length - 1, map, o, v, oe, ve, topSibling\n\n\t\t\t\t// bottom-up\n\t\t\t\twhile (oldEnd >= oldStart && end >= start) {\n\t\t\t\t\toe = old[oldEnd]\n\t\t\t\t\tve = vnodes[end]\n\t\t\t\t\tif (oe.key !== ve.key) break\n\t\t\t\t\tif (oe !== ve) updateNode(parent, oe, ve, hooks, nextSibling, ns)\n\t\t\t\t\tif (ve.dom != null) nextSibling = ve.dom\n\t\t\t\t\toldEnd--, end--\n\t\t\t\t}\n\t\t\t\t// top-down\n\t\t\t\twhile (oldEnd >= oldStart && end >= start) {\n\t\t\t\t\to = old[oldStart]\n\t\t\t\t\tv = vnodes[start]\n\t\t\t\t\tif (o.key !== v.key) break\n\t\t\t\t\toldStart++, start++\n\t\t\t\t\tif (o !== v) updateNode(parent, o, v, hooks, getNextSibling(old, oldStart, nextSibling), ns)\n\t\t\t\t}\n\t\t\t\t// swaps and list reversals\n\t\t\t\twhile (oldEnd >= oldStart && end >= start) {\n\t\t\t\t\tif (start === end) break\n\t\t\t\t\tif (o.key !== ve.key || oe.key !== v.key) break\n\t\t\t\t\ttopSibling = getNextSibling(old, oldStart, nextSibling)\n\t\t\t\t\tmoveNodes(parent, oe, topSibling)\n\t\t\t\t\tif (oe !== v) updateNode(parent, oe, v, hooks, topSibling, ns)\n\t\t\t\t\tif (++start <= --end) moveNodes(parent, o, nextSibling)\n\t\t\t\t\tif (o !== ve) updateNode(parent, o, ve, hooks, nextSibling, ns)\n\t\t\t\t\tif (ve.dom != null) nextSibling = ve.dom\n\t\t\t\t\toldStart++; oldEnd--\n\t\t\t\t\toe = old[oldEnd]\n\t\t\t\t\tve = vnodes[end]\n\t\t\t\t\to = old[oldStart]\n\t\t\t\t\tv = vnodes[start]\n\t\t\t\t}\n\t\t\t\t// bottom up once again\n\t\t\t\twhile (oldEnd >= oldStart && end >= start) {\n\t\t\t\t\tif (oe.key !== ve.key) break\n\t\t\t\t\tif (oe !== ve) updateNode(parent, oe, ve, hooks, nextSibling, ns)\n\t\t\t\t\tif (ve.dom != null) nextSibling = ve.dom\n\t\t\t\t\toldEnd--, end--\n\t\t\t\t\toe = old[oldEnd]\n\t\t\t\t\tve = vnodes[end]\n\t\t\t\t}\n\t\t\t\tif (start > end) removeNodes(parent, old, oldStart, oldEnd + 1)\n\t\t\t\telse if (oldStart > oldEnd) createNodes(parent, vnodes, start, end + 1, hooks, nextSibling, ns)\n\t\t\t\telse {\n\t\t\t\t\t// inspired by ivi https://github.com/ivijs/ivi/ by Boris Kaul\n\t\t\t\t\tvar originalNextSibling = nextSibling, vnodesLength = end - start + 1, oldIndices = new Array(vnodesLength), li=0, i=0, pos = 2147483647, matched = 0, map, lisIndices\n\t\t\t\t\tfor (i = 0; i < vnodesLength; i++) oldIndices[i] = -1\n\t\t\t\t\tfor (i = end; i >= start; i--) {\n\t\t\t\t\t\tif (map == null) map = getKeyMap(old, oldStart, oldEnd + 1)\n\t\t\t\t\t\tve = vnodes[i]\n\t\t\t\t\t\tvar oldIndex = map[ve.key]\n\t\t\t\t\t\tif (oldIndex != null) {\n\t\t\t\t\t\t\tpos = (oldIndex < pos) ? oldIndex : -1 // becomes -1 if nodes were re-ordered\n\t\t\t\t\t\t\toldIndices[i-start] = oldIndex\n\t\t\t\t\t\t\toe = old[oldIndex]\n\t\t\t\t\t\t\told[oldIndex] = null\n\t\t\t\t\t\t\tif (oe !== ve) updateNode(parent, oe, ve, hooks, nextSibling, ns)\n\t\t\t\t\t\t\tif (ve.dom != null) nextSibling = ve.dom\n\t\t\t\t\t\t\tmatched++\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tnextSibling = originalNextSibling\n\t\t\t\t\tif (matched !== oldEnd - oldStart + 1) removeNodes(parent, old, oldStart, oldEnd + 1)\n\t\t\t\t\tif (matched === 0) createNodes(parent, vnodes, start, end + 1, hooks, nextSibling, ns)\n\t\t\t\t\telse {\n\t\t\t\t\t\tif (pos === -1) {\n\t\t\t\t\t\t\t// the indices of the indices of the items that are part of the\n\t\t\t\t\t\t\t// longest increasing subsequence in the oldIndices list\n\t\t\t\t\t\t\tlisIndices = makeLisIndices(oldIndices)\n\t\t\t\t\t\t\tli = lisIndices.length - 1\n\t\t\t\t\t\t\tfor (i = end; i >= start; i--) {\n\t\t\t\t\t\t\t\tv = vnodes[i]\n\t\t\t\t\t\t\t\tif (oldIndices[i-start] === -1) createNode(parent, v, hooks, ns, nextSibling)\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tif (lisIndices[li] === i - start) li--\n\t\t\t\t\t\t\t\t\telse moveNodes(parent, v, nextSibling)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (v.dom != null) nextSibling = vnodes[i].dom\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfor (i = end; i >= start; i--) {\n\t\t\t\t\t\t\t\tv = vnodes[i]\n\t\t\t\t\t\t\t\tif (oldIndices[i-start] === -1) createNode(parent, v, hooks, ns, nextSibling)\n\t\t\t\t\t\t\t\tif (v.dom != null) nextSibling = vnodes[i].dom\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfunction updateNode(parent, old, vnode, hooks, nextSibling, ns) {\n\t\tvar oldTag = old.tag, tag = vnode.tag\n\t\tif (oldTag === tag) {\n\t\t\tvnode.state = old.state\n\t\t\tvnode.events = old.events\n\t\t\tif (shouldNotUpdate(vnode, old)) return\n\t\t\tif (typeof oldTag === \"string\") {\n\t\t\t\tif (vnode.attrs != null) {\n\t\t\t\t\tupdateLifecycle(vnode.attrs, vnode, hooks)\n\t\t\t\t}\n\t\t\t\tswitch (oldTag) {\n\t\t\t\t\tcase \"#\": updateText(old, vnode); break\n\t\t\t\t\tcase \"<\": updateHTML(parent, old, vnode, ns, nextSibling); break\n\t\t\t\t\tcase \"[\": updateFragment(parent, old, vnode, hooks, nextSibling, ns); break\n\t\t\t\t\tdefault: updateElement(old, vnode, hooks, ns)\n\t\t\t\t}\n\t\t\t}\n\t\t\telse updateComponent(parent, old, vnode, hooks, nextSibling, ns)\n\t\t}\n\t\telse {\n\t\t\tremoveNode(parent, old)\n\t\t\tcreateNode(parent, vnode, hooks, ns, nextSibling)\n\t\t}\n\t}\n\tfunction updateText(old, vnode) {\n\t\tif (old.children.toString() !== vnode.children.toString()) {\n\t\t\told.dom.nodeValue = vnode.children\n\t\t}\n\t\tvnode.dom = old.dom\n\t}\n\tfunction updateHTML(parent, old, vnode, ns, nextSibling) {\n\t\tif (old.children !== vnode.children) {\n\t\t\tremoveHTML(parent, old)\n\t\t\tcreateHTML(parent, vnode, ns, nextSibling)\n\t\t}\n\t\telse {\n\t\t\tvnode.dom = old.dom\n\t\t\tvnode.domSize = old.domSize\n\t\t\tvnode.instance = old.instance\n\t\t}\n\t}\n\tfunction updateFragment(parent, old, vnode, hooks, nextSibling, ns) {\n\t\tupdateNodes(parent, old.children, vnode.children, hooks, nextSibling, ns)\n\t\tvar domSize = 0, children = vnode.children\n\t\tvnode.dom = null\n\t\tif (children != null) {\n\t\t\tfor (var i = 0; i < children.length; i++) {\n\t\t\t\tvar child = children[i]\n\t\t\t\tif (child != null && child.dom != null) {\n\t\t\t\t\tif (vnode.dom == null) vnode.dom = child.dom\n\t\t\t\t\tdomSize += child.domSize || 1\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (domSize !== 1) vnode.domSize = domSize\n\t\t}\n\t}\n\tfunction updateElement(old, vnode, hooks, ns) {\n\t\tvar element = vnode.dom = old.dom\n\t\tns = getNameSpace(vnode) || ns\n\n\t\tif (vnode.tag === \"textarea\") {\n\t\t\tif (vnode.attrs == null) vnode.attrs = {}\n\t\t\tif (vnode.text != null) {\n\t\t\t\tvnode.attrs.value = vnode.text //FIXME handle multiple children\n\t\t\t\tvnode.text = undefined\n\t\t\t}\n\t\t}\n\t\tupdateAttrs(vnode, old.attrs, vnode.attrs, ns)\n\t\tif (!maybeSetContentEditable(vnode)) {\n\t\t\tif (old.text != null && vnode.text != null && vnode.text !== \"\") {\n\t\t\t\tif (old.text.toString() !== vnode.text.toString()) old.dom.firstChild.nodeValue = vnode.text\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (old.text != null) old.children = [Vnode(\"#\", undefined, undefined, old.text, undefined, old.dom.firstChild)]\n\t\t\t\tif (vnode.text != null) vnode.children = [Vnode(\"#\", undefined, undefined, vnode.text, undefined, undefined)]\n\t\t\t\tupdateNodes(element, old.children, vnode.children, hooks, null, ns)\n\t\t\t}\n\t\t}\n\t}\n\tfunction updateComponent(parent, old, vnode, hooks, nextSibling, ns) {\n\t\tvnode.instance = Vnode.normalize(callHook.call(vnode.state.view, vnode))\n\t\tif (vnode.instance === vnode) throw Error(\"A view cannot return the vnode it received as argument\")\n\t\tupdateLifecycle(vnode.state, vnode, hooks)\n\t\tif (vnode.attrs != null) updateLifecycle(vnode.attrs, vnode, hooks)\n\t\tif (vnode.instance != null) {\n\t\t\tif (old.instance == null) createNode(parent, vnode.instance, hooks, ns, nextSibling)\n\t\t\telse updateNode(parent, old.instance, vnode.instance, hooks, nextSibling, ns)\n\t\t\tvnode.dom = vnode.instance.dom\n\t\t\tvnode.domSize = vnode.instance.domSize\n\t\t}\n\t\telse if (old.instance != null) {\n\t\t\tremoveNode(parent, old.instance)\n\t\t\tvnode.dom = undefined\n\t\t\tvnode.domSize = 0\n\t\t}\n\t\telse {\n\t\t\tvnode.dom = old.dom\n\t\t\tvnode.domSize = old.domSize\n\t\t}\n\t}\n\tfunction getKeyMap(vnodes, start, end) {\n\t\tvar map = Object.create(null)\n\t\tfor (; start < end; start++) {\n\t\t\tvar vnode = vnodes[start]\n\t\t\tif (vnode != null) {\n\t\t\t\tvar key = vnode.key\n\t\t\t\tif (key != null) map[key] = start\n\t\t\t}\n\t\t}\n\t\treturn map\n\t}\n\t// Lifted from ivi https://github.com/ivijs/ivi/\n\t// takes a list of unique numbers (-1 is special and can\n\t// occur multiple times) and returns an array with the indices\n\t// of the items that are part of the longest increasing\n\t// subsequece\n\tvar lisTemp = []\n\tfunction makeLisIndices(a) {\n\t\tvar result = [0]\n\t\tvar u = 0, v = 0, i = 0\n\t\tvar il = lisTemp.length = a.length\n\t\tfor (var i = 0; i < il; i++) lisTemp[i] = a[i]\n\t\tfor (var i = 0; i < il; ++i) {\n\t\t\tif (a[i] === -1) continue\n\t\t\tvar j = result[result.length - 1]\n\t\t\tif (a[j] < a[i]) {\n\t\t\t\tlisTemp[i] = j\n\t\t\t\tresult.push(i)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tu = 0\n\t\t\tv = result.length - 1\n\t\t\twhile (u < v) {\n\t\t\t\t// Fast integer average without overflow.\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tvar c = (u >>> 1) + (v >>> 1) + (u & v & 1)\n\t\t\t\tif (a[result[c]] < a[i]) {\n\t\t\t\t\tu = c + 1\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tv = c\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (a[i] < a[result[u]]) {\n\t\t\t\tif (u > 0) lisTemp[i] = result[u - 1]\n\t\t\t\tresult[u] = i\n\t\t\t}\n\t\t}\n\t\tu = result.length\n\t\tv = result[u - 1]\n\t\twhile (u-- > 0) {\n\t\t\tresult[u] = v\n\t\t\tv = lisTemp[v]\n\t\t}\n\t\tlisTemp.length = 0\n\t\treturn result\n\t}\n\n\tfunction getNextSibling(vnodes, i, nextSibling) {\n\t\tfor (; i < vnodes.length; i++) {\n\t\t\tif (vnodes[i] != null && vnodes[i].dom != null) return vnodes[i].dom\n\t\t}\n\t\treturn nextSibling\n\t}\n\n\t// This covers a really specific edge case:\n\t// - Parent node is keyed and contains child\n\t// - Child is removed, returns unresolved promise in `onbeforeremove`\n\t// - Parent node is moved in keyed diff\n\t// - Remaining children still need moved appropriately\n\t//\n\t// Ideally, I'd track removed nodes as well, but that introduces a lot more\n\t// complexity and I'm not exactly interested in doing that.\n\tfunction moveNodes(parent, vnode, nextSibling) {\n\t\tvar frag = $doc.createDocumentFragment()\n\t\tmoveChildToFrag(parent, frag, vnode)\n\t\tinsertNode(parent, frag, nextSibling)\n\t}\n\tfunction moveChildToFrag(parent, frag, vnode) {\n\t\t// Dodge the recursion overhead in a few of the most common cases.\n\t\twhile (vnode.dom != null && vnode.dom.parentNode === parent) {\n\t\t\tif (typeof vnode.tag !== \"string\") {\n\t\t\t\tvnode = vnode.instance\n\t\t\t\tif (vnode != null) continue\n\t\t\t} else if (vnode.tag === \"<\") {\n\t\t\t\tfor (var i = 0; i < vnode.instance.length; i++) {\n\t\t\t\t\tfrag.appendChild(vnode.instance[i])\n\t\t\t\t}\n\t\t\t} else if (vnode.tag !== \"[\") {\n\t\t\t\t// Don't recurse for text nodes *or* elements, just fragments\n\t\t\t\tfrag.appendChild(vnode.dom)\n\t\t\t} else if (vnode.children.length === 1) {\n\t\t\t\tvnode = vnode.children[0]\n\t\t\t\tif (vnode != null) continue\n\t\t\t} else {\n\t\t\t\tfor (var i = 0; i < vnode.children.length; i++) {\n\t\t\t\t\tvar child = vnode.children[i]\n\t\t\t\t\tif (child != null) moveChildToFrag(parent, frag, child)\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfunction insertNode(parent, dom, nextSibling) {\n\t\tif (nextSibling != null) parent.insertBefore(dom, nextSibling)\n\t\telse parent.appendChild(dom)\n\t}\n\n\tfunction maybeSetContentEditable(vnode) {\n\t\tif (vnode.attrs == null || (\n\t\t\tvnode.attrs.contenteditable == null && // attribute\n\t\t\tvnode.attrs.contentEditable == null // property\n\t\t)) return false\n\t\tvar children = vnode.children\n\t\tif (children != null && children.length === 1 && children[0].tag === \"<\") {\n\t\t\tvar content = children[0].children\n\t\t\tif (vnode.dom.innerHTML !== content) vnode.dom.innerHTML = content\n\t\t}\n\t\telse if (vnode.text != null || children != null && children.length !== 0) throw new Error(\"Child node of a contenteditable must be trusted\")\n\t\treturn true\n\t}\n\n\t//remove\n\tfunction removeNodes(parent, vnodes, start, end) {\n\t\tfor (var i = start; i < end; i++) {\n\t\t\tvar vnode = vnodes[i]\n\t\t\tif (vnode != null) removeNode(parent, vnode)\n\t\t}\n\t}\n\tfunction removeNode(parent, vnode) {\n\t\tvar mask = 0\n\t\tvar original = vnode.state\n\t\tvar stateResult, attrsResult\n\t\tif (typeof vnode.tag !== \"string\" && typeof vnode.state.onbeforeremove === \"function\") {\n\t\t\tvar result = callHook.call(vnode.state.onbeforeremove, vnode)\n\t\t\tif (result != null && typeof result.then === \"function\") {\n\t\t\t\tmask = 1\n\t\t\t\tstateResult = result\n\t\t\t}\n\t\t}\n\t\tif (vnode.attrs && typeof vnode.attrs.onbeforeremove === \"function\") {\n\t\t\tvar result = callHook.call(vnode.attrs.onbeforeremove, vnode)\n\t\t\tif (result != null && typeof result.then === \"function\") {\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tmask |= 2\n\t\t\t\tattrsResult = result\n\t\t\t}\n\t\t}\n\t\tcheckState(vnode, original)\n\n\t\t// If we can, try to fast-path it and avoid all the overhead of awaiting\n\t\tif (!mask) {\n\t\t\tonremove(vnode)\n\t\t\tremoveChild(parent, vnode)\n\t\t} else {\n\t\t\tif (stateResult != null) {\n\t\t\t\tvar next = function () {\n\t\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\t\tif (mask & 1) { mask &= 2; if (!mask) reallyRemove() }\n\t\t\t\t}\n\t\t\t\tstateResult.then(next, next)\n\t\t\t}\n\t\t\tif (attrsResult != null) {\n\t\t\t\tvar next = function () {\n\t\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\t\tif (mask & 2) { mask &= 1; if (!mask) reallyRemove() }\n\t\t\t\t}\n\t\t\t\tattrsResult.then(next, next)\n\t\t\t}\n\t\t}\n\n\t\tfunction reallyRemove() {\n\t\t\tcheckState(vnode, original)\n\t\t\tonremove(vnode)\n\t\t\tremoveChild(parent, vnode)\n\t\t}\n\t}\n\tfunction removeHTML(parent, vnode) {\n\t\tfor (var i = 0; i < vnode.instance.length; i++) {\n\t\t\tparent.removeChild(vnode.instance[i])\n\t\t}\n\t}\n\tfunction removeChild(parent, vnode) {\n\t\t// Dodge the recursion overhead in a few of the most common cases.\n\t\twhile (vnode.dom != null && vnode.dom.parentNode === parent) {\n\t\t\tif (typeof vnode.tag !== \"string\") {\n\t\t\t\tvnode = vnode.instance\n\t\t\t\tif (vnode != null) continue\n\t\t\t} else if (vnode.tag === \"<\") {\n\t\t\t\tremoveHTML(parent, vnode)\n\t\t\t} else {\n\t\t\t\tif (vnode.tag !== \"[\") {\n\t\t\t\t\tparent.removeChild(vnode.dom)\n\t\t\t\t\tif (!Array.isArray(vnode.children)) break\n\t\t\t\t}\n\t\t\t\tif (vnode.children.length === 1) {\n\t\t\t\t\tvnode = vnode.children[0]\n\t\t\t\t\tif (vnode != null) continue\n\t\t\t\t} else {\n\t\t\t\t\tfor (var i = 0; i < vnode.children.length; i++) {\n\t\t\t\t\t\tvar child = vnode.children[i]\n\t\t\t\t\t\tif (child != null) removeChild(parent, child)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\tfunction onremove(vnode) {\n\t\tif (typeof vnode.tag !== \"string\" && typeof vnode.state.onremove === \"function\") callHook.call(vnode.state.onremove, vnode)\n\t\tif (vnode.attrs && typeof vnode.attrs.onremove === \"function\") callHook.call(vnode.attrs.onremove, vnode)\n\t\tif (typeof vnode.tag !== \"string\") {\n\t\t\tif (vnode.instance != null) onremove(vnode.instance)\n\t\t} else {\n\t\t\tvar children = vnode.children\n\t\t\tif (Array.isArray(children)) {\n\t\t\t\tfor (var i = 0; i < children.length; i++) {\n\t\t\t\t\tvar child = children[i]\n\t\t\t\t\tif (child != null) onremove(child)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t//attrs\n\tfunction setAttrs(vnode, attrs, ns) {\n\t\tfor (var key in attrs) {\n\t\t\tsetAttr(vnode, key, null, attrs[key], ns)\n\t\t}\n\t}\n\tfunction setAttr(vnode, key, old, value, ns) {\n\t\tif (key === \"key\" || key === \"is\" || value == null || isLifecycleMethod(key) || (old === value && !isFormAttribute(vnode, key)) && typeof value !== \"object\") return\n\t\tif (key[0] === \"o\" && key[1] === \"n\") return updateEvent(vnode, key, value)\n\t\tif (key.slice(0, 6) === \"xlink:\") vnode.dom.setAttributeNS(\"http://www.w3.org/1999/xlink\", key.slice(6), value)\n\t\telse if (key === \"style\") updateStyle(vnode.dom, old, value)\n\t\telse if (hasPropertyKey(vnode, key, ns)) {\n\t\t\tif (key === \"value\") {\n\t\t\t\t// Only do the coercion if we're actually going to check the value.\n\t\t\t\t/* eslint-disable no-implicit-coercion */\n\t\t\t\t//setting input[value] to same value by typing on focused element moves cursor to end in Chrome\n\t\t\t\tif ((vnode.tag === \"input\" || vnode.tag === \"textarea\") && vnode.dom.value === \"\" + value && vnode.dom === activeElement()) return\n\t\t\t\t//setting select[value] to same value while having select open blinks select dropdown in Chrome\n\t\t\t\tif (vnode.tag === \"select\" && old !== null && vnode.dom.value === \"\" + value) return\n\t\t\t\t//setting option[value] to same value while having select open blinks select dropdown in Chrome\n\t\t\t\tif (vnode.tag === \"option\" && old !== null && vnode.dom.value === \"\" + value) return\n\t\t\t\t/* eslint-enable no-implicit-coercion */\n\t\t\t}\n\t\t\t// If you assign an input type that is not supported by IE 11 with an assignment expression, an error will occur.\n\t\t\tif (vnode.tag === \"input\" && key === \"type\") vnode.dom.setAttribute(key, value)\n\t\t\telse vnode.dom[key] = value\n\t\t} else {\n\t\t\tif (typeof value === \"boolean\") {\n\t\t\t\tif (value) vnode.dom.setAttribute(key, \"\")\n\t\t\t\telse vnode.dom.removeAttribute(key)\n\t\t\t}\n\t\t\telse vnode.dom.setAttribute(key === \"className\" ? \"class\" : key, value)\n\t\t}\n\t}\n\tfunction removeAttr(vnode, key, old, ns) {\n\t\tif (key === \"key\" || key === \"is\" || old == null || isLifecycleMethod(key)) return\n\t\tif (key[0] === \"o\" && key[1] === \"n\" && !isLifecycleMethod(key)) updateEvent(vnode, key, undefined)\n\t\telse if (key === \"style\") updateStyle(vnode.dom, old, null)\n\t\telse if (\n\t\t\thasPropertyKey(vnode, key, ns)\n\t\t\t&& key !== \"className\"\n\t\t\t&& !(key === \"value\" && (\n\t\t\t\tvnode.tag === \"option\"\n\t\t\t\t|| vnode.tag === \"select\" && vnode.dom.selectedIndex === -1 && vnode.dom === activeElement()\n\t\t\t))\n\t\t\t&& !(vnode.tag === \"input\" && key === \"type\")\n\t\t) {\n\t\t\tvnode.dom[key] = null\n\t\t} else {\n\t\t\tvar nsLastIndex = key.indexOf(\":\")\n\t\t\tif (nsLastIndex !== -1) key = key.slice(nsLastIndex + 1)\n\t\t\tif (old !== false) vnode.dom.removeAttribute(key === \"className\" ? \"class\" : key)\n\t\t}\n\t}\n\tfunction setLateSelectAttrs(vnode, attrs) {\n\t\tif (\"value\" in attrs) {\n\t\t\tif(attrs.value === null) {\n\t\t\t\tif (vnode.dom.selectedIndex !== -1) vnode.dom.value = null\n\t\t\t} else {\n\t\t\t\tvar normalized = \"\" + attrs.value // eslint-disable-line no-implicit-coercion\n\t\t\t\tif (vnode.dom.value !== normalized || vnode.dom.selectedIndex === -1) {\n\t\t\t\t\tvnode.dom.value = normalized\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (\"selectedIndex\" in attrs) setAttr(vnode, \"selectedIndex\", null, attrs.selectedIndex, undefined)\n\t}\n\tfunction updateAttrs(vnode, old, attrs, ns) {\n\t\tif (attrs != null) {\n\t\t\tfor (var key in attrs) {\n\t\t\t\tsetAttr(vnode, key, old && old[key], attrs[key], ns)\n\t\t\t}\n\t\t}\n\t\tvar val\n\t\tif (old != null) {\n\t\t\tfor (var key in old) {\n\t\t\t\tif (((val = old[key]) != null) && (attrs == null || attrs[key] == null)) {\n\t\t\t\t\tremoveAttr(vnode, key, val, ns)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfunction isFormAttribute(vnode, attr) {\n\t\treturn attr === \"value\" || attr === \"checked\" || attr === \"selectedIndex\" || attr === \"selected\" && vnode.dom === activeElement() || vnode.tag === \"option\" && vnode.dom.parentNode === $doc.activeElement\n\t}\n\tfunction isLifecycleMethod(attr) {\n\t\treturn attr === \"oninit\" || attr === \"oncreate\" || attr === \"onupdate\" || attr === \"onremove\" || attr === \"onbeforeremove\" || attr === \"onbeforeupdate\"\n\t}\n\tfunction hasPropertyKey(vnode, key, ns) {\n\t\t// Filter out namespaced keys\n\t\treturn ns === undefined && (\n\t\t\t// If it's a custom element, just keep it.\n\t\t\tvnode.tag.indexOf(\"-\") > -1 || vnode.attrs != null && vnode.attrs.is ||\n\t\t\t// If it's a normal element, let's try to avoid a few browser bugs.\n\t\t\tkey !== \"href\" && key !== \"list\" && key !== \"form\" && key !== \"width\" && key !== \"height\"// && key !== \"type\"\n\t\t\t// Defer the property check until *after* we check everything.\n\t\t) && key in vnode.dom\n\t}\n\n\t//style\n\tvar uppercaseRegex = /[A-Z]/g\n\tfunction toLowerCase(capital) { return \"-\" + capital.toLowerCase() }\n\tfunction normalizeKey(key) {\n\t\treturn key[0] === \"-\" && key[1] === \"-\" ? key :\n\t\t\tkey === \"cssFloat\" ? \"float\" :\n\t\t\t\tkey.replace(uppercaseRegex, toLowerCase)\n\t}\n\tfunction updateStyle(element, old, style) {\n\t\tif (old === style) {\n\t\t\t// Styles are equivalent, do nothing.\n\t\t} else if (style == null) {\n\t\t\t// New style is missing, just clear it.\n\t\t\telement.style.cssText = \"\"\n\t\t} else if (typeof style !== \"object\") {\n\t\t\t// New style is a string, let engine deal with patching.\n\t\t\telement.style.cssText = style\n\t\t} else if (old == null || typeof old !== \"object\") {\n\t\t\t// `old` is missing or a string, `style` is an object.\n\t\t\telement.style.cssText = \"\"\n\t\t\t// Add new style properties\n\t\t\tfor (var key in style) {\n\t\t\t\tvar value = style[key]\n\t\t\t\tif (value != null) element.style.setProperty(normalizeKey(key), String(value))\n\t\t\t}\n\t\t} else {\n\t\t\t// Both old & new are (different) objects.\n\t\t\t// Update style properties that have changed\n\t\t\tfor (var key in style) {\n\t\t\t\tvar value = style[key]\n\t\t\t\tif (value != null && (value = String(value)) !== String(old[key])) {\n\t\t\t\t\telement.style.setProperty(normalizeKey(key), value)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Remove style properties that no longer exist\n\t\t\tfor (var key in old) {\n\t\t\t\tif (old[key] != null && style[key] == null) {\n\t\t\t\t\telement.style.removeProperty(normalizeKey(key))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Here's an explanation of how this works:\n\t// 1. The event names are always (by design) prefixed by `on`.\n\t// 2. The EventListener interface accepts either a function or an object\n\t// with a `handleEvent` method.\n\t// 3. The object does not inherit from `Object.prototype`, to avoid\n\t// any potential interference with that (e.g. setters).\n\t// 4. The event name is remapped to the handler before calling it.\n\t// 5. In function-based event handlers, `ev.target === this`. We replicate\n\t// that below.\n\t// 6. In function-based event handlers, `return false` prevents the default\n\t// action and stops event propagation. We replicate that below.\n\tfunction EventDict() {\n\t\t// Save this, so the current redraw is correctly tracked.\n\t\tthis._ = currentRedraw\n\t}\n\tEventDict.prototype = Object.create(null)\n\tEventDict.prototype.handleEvent = function (ev) {\n\t\tvar handler = this[\"on\" + ev.type]\n\t\tvar result\n\t\tif (typeof handler === \"function\") result = handler.call(ev.currentTarget, ev)\n\t\telse if (typeof handler.handleEvent === \"function\") handler.handleEvent(ev)\n\t\tif (this._ && ev.redraw !== false) (0, this._)()\n\t\tif (result === false) {\n\t\t\tev.preventDefault()\n\t\t\tev.stopPropagation()\n\t\t}\n\t}\n\n\t//event\n\tfunction updateEvent(vnode, key, value) {\n\t\tif (vnode.events != null) {\n\t\t\tif (vnode.events[key] === value) return\n\t\t\tif (value != null && (typeof value === \"function\" || typeof value === \"object\")) {\n\t\t\t\tif (vnode.events[key] == null) vnode.dom.addEventListener(key.slice(2), vnode.events, false)\n\t\t\t\tvnode.events[key] = value\n\t\t\t} else {\n\t\t\t\tif (vnode.events[key] != null) vnode.dom.removeEventListener(key.slice(2), vnode.events, false)\n\t\t\t\tvnode.events[key] = undefined\n\t\t\t}\n\t\t} else if (value != null && (typeof value === \"function\" || typeof value === \"object\")) {\n\t\t\tvnode.events = new EventDict()\n\t\t\tvnode.dom.addEventListener(key.slice(2), vnode.events, false)\n\t\t\tvnode.events[key] = value\n\t\t}\n\t}\n\n\t//lifecycle\n\tfunction initLifecycle(source, vnode, hooks) {\n\t\tif (typeof source.oninit === \"function\") callHook.call(source.oninit, vnode)\n\t\tif (typeof source.oncreate === \"function\") hooks.push(callHook.bind(source.oncreate, vnode))\n\t}\n\tfunction updateLifecycle(source, vnode, hooks) {\n\t\tif (typeof source.onupdate === \"function\") hooks.push(callHook.bind(source.onupdate, vnode))\n\t}\n\tfunction shouldNotUpdate(vnode, old) {\n\t\tdo {\n\t\t\tif (vnode.attrs != null && typeof vnode.attrs.onbeforeupdate === \"function\") {\n\t\t\t\tvar force = callHook.call(vnode.attrs.onbeforeupdate, vnode, old)\n\t\t\t\tif (force !== undefined && !force) break\n\t\t\t}\n\t\t\tif (typeof vnode.tag !== \"string\" && typeof vnode.state.onbeforeupdate === \"function\") {\n\t\t\t\tvar force = callHook.call(vnode.state.onbeforeupdate, vnode, old)\n\t\t\t\tif (force !== undefined && !force) break\n\t\t\t}\n\t\t\treturn false\n\t\t} while (false); // eslint-disable-line no-constant-condition\n\t\tvnode.dom = old.dom\n\t\tvnode.domSize = old.domSize\n\t\tvnode.instance = old.instance\n\t\t// One would think having the actual latest attributes would be ideal,\n\t\t// but it doesn't let us properly diff based on our current internal\n\t\t// representation. We have to save not only the old DOM info, but also\n\t\t// the attributes used to create it, as we diff *that*, not against the\n\t\t// DOM directly (with a few exceptions in `setAttr`). And, of course, we\n\t\t// need to save the children and text as they are conceptually not\n\t\t// unlike special \"attributes\" internally.\n\t\tvnode.attrs = old.attrs\n\t\tvnode.children = old.children\n\t\tvnode.text = old.text\n\t\treturn true\n\t}\n\n\treturn function(dom, vnodes, redraw) {\n\t\tif (!dom) throw new TypeError(\"Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.\")\n\t\tvar hooks = []\n\t\tvar active = activeElement()\n\t\tvar namespace = dom.namespaceURI\n\n\t\t// First time rendering into a node clears it out\n\t\tif (dom.vnodes == null) dom.textContent = \"\"\n\n\t\tvnodes = Vnode.normalizeChildren(Array.isArray(vnodes) ? vnodes : [vnodes])\n\t\tvar prevRedraw = currentRedraw\n\t\ttry {\n\t\t\tcurrentRedraw = typeof redraw === \"function\" ? redraw : undefined\n\t\t\tupdateNodes(dom, dom.vnodes, vnodes, hooks, null, namespace === \"http://www.w3.org/1999/xhtml\" ? undefined : namespace)\n\t\t} finally {\n\t\t\tcurrentRedraw = prevRedraw\n\t\t}\n\t\tdom.vnodes = vnodes\n\t\t// `document.activeElement` can return null: https://html.spec.whatwg.org/multipage/interaction.html#dom-document-activeelement\n\t\tif (active != null && activeElement() !== active && typeof active.focus === \"function\") active.focus()\n\t\tfor (var i = 0; i < hooks.length; i++) hooks[i]()\n\t}\n}\n\n},{\"../render/vnode\":29}],28:[function(require,module,exports){\n\"use strict\"\n\nvar Vnode = require(\"../render/vnode\")\n\nmodule.exports = function(html) {\n\tif (html == null) html = \"\"\n\treturn Vnode(\"<\", undefined, undefined, html, undefined, undefined)\n}\n\n},{\"../render/vnode\":29}],29:[function(require,module,exports){\n\"use strict\"\n\nfunction Vnode(tag, key, attrs, children, text, dom) {\n\treturn {tag: tag, key: key, attrs: attrs, children: children, text: text, dom: dom, domSize: undefined, state: undefined, events: undefined, instance: undefined}\n}\nVnode.normalize = function(node) {\n\tif (Array.isArray(node)) return Vnode(\"[\", undefined, undefined, Vnode.normalizeChildren(node), undefined, undefined)\n\tif (node == null || typeof node === \"boolean\") return null\n\tif (typeof node === \"object\") return node\n\treturn Vnode(\"#\", undefined, undefined, String(node), undefined, undefined)\n}\nVnode.normalizeChildren = function(input) {\n\tvar children = []\n\tif (input.length) {\n\t\tvar isKeyed = input[0] != null && input[0].key != null\n\t\t// Note: this is a *very* perf-sensitive check.\n\t\t// Fun fact: merging the loop like this is somehow faster than splitting\n\t\t// it, noticeably so.\n\t\tfor (var i = 1; i < input.length; i++) {\n\t\t\tif ((input[i] != null && input[i].key != null) !== isKeyed) {\n\t\t\t\tthrow new TypeError(\"Vnodes must either always have keys or never have keys!\")\n\t\t\t}\n\t\t}\n\t\tfor (var i = 0; i < input.length; i++) {\n\t\t\tchildren[i] = Vnode.normalize(input[i])\n\t\t}\n\t}\n\treturn children\n}\n\nmodule.exports = Vnode\n\n},{}],30:[function(require,module,exports){\n\"use strict\"\n\nvar PromisePolyfill = require(\"./promise/promise\")\nvar mountRedraw = require(\"./mount-redraw\")\n\nmodule.exports = require(\"./request/request\")(window, PromisePolyfill, mountRedraw.redraw)\n\n},{\"./mount-redraw\":14,\"./promise/promise\":20,\"./request/request\":31}],31:[function(require,module,exports){\n\"use strict\"\n\nvar buildPathname = require(\"../pathname/build\")\n\nmodule.exports = function($window, Promise, oncompletion) {\n\tvar callbackCount = 0\n\n\tfunction PromiseProxy(executor) {\n\t\treturn new Promise(executor)\n\t}\n\n\t// In case the global Promise is some userland library's where they rely on\n\t// `foo instanceof this.constructor`, `this.constructor.resolve(value)`, or\n\t// similar. Let's *not* break them.\n\tPromiseProxy.prototype = Promise.prototype\n\tPromiseProxy.__proto__ = Promise // eslint-disable-line no-proto\n\n\tfunction makeRequest(factory) {\n\t\treturn function(url, args) {\n\t\t\tif (typeof url !== \"string\") { args = url; url = url.url }\n\t\t\telse if (args == null) args = {}\n\t\t\tvar promise = new Promise(function(resolve, reject) {\n\t\t\t\tfactory(buildPathname(url, args.params), args, function (data) {\n\t\t\t\t\tif (typeof args.type === \"function\") {\n\t\t\t\t\t\tif (Array.isArray(data)) {\n\t\t\t\t\t\t\tfor (var i = 0; i < data.length; i++) {\n\t\t\t\t\t\t\t\tdata[i] = new args.type(data[i])\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse data = new args.type(data)\n\t\t\t\t\t}\n\t\t\t\t\tresolve(data)\n\t\t\t\t}, reject)\n\t\t\t})\n\t\t\tif (args.background === true) return promise\n\t\t\tvar count = 0\n\t\t\tfunction complete() {\n\t\t\t\tif (--count === 0 && typeof oncompletion === \"function\") oncompletion()\n\t\t\t}\n\n\t\t\treturn wrap(promise)\n\n\t\t\tfunction wrap(promise) {\n\t\t\t\tvar then = promise.then\n\t\t\t\t// Set the constructor, so engines know to not await or resolve\n\t\t\t\t// this as a native promise. At the time of writing, this is\n\t\t\t\t// only necessary for V8, but their behavior is the correct\n\t\t\t\t// behavior per spec. See this spec issue for more details:\n\t\t\t\t// https://github.com/tc39/ecma262/issues/1577. Also, see the\n\t\t\t\t// corresponding comment in `request/tests/test-request.js` for\n\t\t\t\t// a bit more background on the issue at hand.\n\t\t\t\tpromise.constructor = PromiseProxy\n\t\t\t\tpromise.then = function() {\n\t\t\t\t\tcount++\n\t\t\t\t\tvar next = then.apply(promise, arguments)\n\t\t\t\t\tnext.then(complete, function(e) {\n\t\t\t\t\t\tcomplete()\n\t\t\t\t\t\tif (count === 0) throw e\n\t\t\t\t\t})\n\t\t\t\t\treturn wrap(next)\n\t\t\t\t}\n\t\t\t\treturn promise\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction hasHeader(args, name) {\n\t\tfor (var key in args.headers) {\n\t\t\tif ({}.hasOwnProperty.call(args.headers, key) && name.test(key)) return true\n\t\t}\n\t\treturn false\n\t}\n\n\treturn {\n\t\trequest: makeRequest(function(url, args, resolve, reject) {\n\t\t\tvar method = args.method != null ? args.method.toUpperCase() : \"GET\"\n\t\t\tvar body = args.body\n\t\t\tvar assumeJSON = (args.serialize == null || args.serialize === JSON.serialize) && !(body instanceof $window.FormData)\n\t\t\tvar responseType = args.responseType || (typeof args.extract === \"function\" ? \"\" : \"json\")\n\n\t\t\tvar xhr = new $window.XMLHttpRequest(), aborted = false\n\t\t\tvar original = xhr, replacedAbort\n\t\t\tvar abort = xhr.abort\n\n\t\t\txhr.abort = function() {\n\t\t\t\taborted = true\n\t\t\t\tabort.call(this)\n\t\t\t}\n\n\t\t\txhr.open(method, url, args.async !== false, typeof args.user === \"string\" ? args.user : undefined, typeof args.password === \"string\" ? args.password : undefined)\n\n\t\t\tif (assumeJSON && body != null && !hasHeader(args, /^content-type$/i)) {\n\t\t\t\txhr.setRequestHeader(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\t\t}\n\t\t\tif (typeof args.deserialize !== \"function\" && !hasHeader(args, /^accept$/i)) {\n\t\t\t\txhr.setRequestHeader(\"Accept\", \"application/json, text/*\")\n\t\t\t}\n\t\t\tif (args.withCredentials) xhr.withCredentials = args.withCredentials\n\t\t\tif (args.timeout) xhr.timeout = args.timeout\n\t\t\txhr.responseType = responseType\n\n\t\t\tfor (var key in args.headers) {\n\t\t\t\tif ({}.hasOwnProperty.call(args.headers, key)) {\n\t\t\t\t\txhr.setRequestHeader(key, args.headers[key])\n\t\t\t\t}\n\t\t\t}\n\n\t\t\txhr.onreadystatechange = function(ev) {\n\t\t\t\t// Don't throw errors on xhr.abort().\n\t\t\t\tif (aborted) return\n\n\t\t\t\tif (ev.target.readyState === 4) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvar success = (ev.target.status >= 200 && ev.target.status < 300) || ev.target.status === 304 || (/^file:\\/\\//i).test(url)\n\t\t\t\t\t\t// When the response type isn't \"\" or \"text\",\n\t\t\t\t\t\t// `xhr.responseText` is the wrong thing to use.\n\t\t\t\t\t\t// Browsers do the right thing and throw here, and we\n\t\t\t\t\t\t// should honor that and do the right thing by\n\t\t\t\t\t\t// preferring `xhr.response` where possible/practical.\n\t\t\t\t\t\tvar response = ev.target.response, message\n\n\t\t\t\t\t\tif (responseType === \"json\") {\n\t\t\t\t\t\t\t// For IE and Edge, which don't implement\n\t\t\t\t\t\t\t// `responseType: \"json\"`.\n\t\t\t\t\t\t\tif (!ev.target.responseType && typeof args.extract !== \"function\") response = JSON.parse(ev.target.responseText)\n\t\t\t\t\t\t} else if (!responseType || responseType === \"text\") {\n\t\t\t\t\t\t\t// Only use this default if it's text. If a parsed\n\t\t\t\t\t\t\t// document is needed on old IE and friends (all\n\t\t\t\t\t\t\t// unsupported), the user should use a custom\n\t\t\t\t\t\t\t// `config` instead. They're already using this at\n\t\t\t\t\t\t\t// their own risk.\n\t\t\t\t\t\t\tif (response == null) response = ev.target.responseText\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (typeof args.extract === \"function\") {\n\t\t\t\t\t\t\tresponse = args.extract(ev.target, args)\n\t\t\t\t\t\t\tsuccess = true\n\t\t\t\t\t\t} else if (typeof args.deserialize === \"function\") {\n\t\t\t\t\t\t\tresponse = args.deserialize(response)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (success) resolve(response)\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\ttry { message = ev.target.responseText }\n\t\t\t\t\t\t\tcatch (e) { message = response }\n\t\t\t\t\t\t\tvar error = new Error(message)\n\t\t\t\t\t\t\terror.code = ev.target.status\n\t\t\t\t\t\t\terror.response = response\n\t\t\t\t\t\t\treject(error)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcatch (e) {\n\t\t\t\t\t\treject(e)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (typeof args.config === \"function\") {\n\t\t\t\txhr = args.config(xhr, args, url) || xhr\n\n\t\t\t\t// Propagate the `abort` to any replacement XHR as well.\n\t\t\t\tif (xhr !== original) {\n\t\t\t\t\treplacedAbort = xhr.abort\n\t\t\t\t\txhr.abort = function() {\n\t\t\t\t\t\taborted = true\n\t\t\t\t\t\treplacedAbort.call(this)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (body == null) xhr.send()\n\t\t\telse if (typeof args.serialize === \"function\") xhr.send(args.serialize(body))\n\t\t\telse if (body instanceof $window.FormData) xhr.send(body)\n\t\t\telse xhr.send(JSON.stringify(body))\n\t\t}),\n\t\tjsonp: makeRequest(function(url, args, resolve, reject) {\n\t\t\tvar callbackName = args.callbackName || \"_mithril_\" + Math.round(Math.random() * 1e16) + \"_\" + callbackCount++\n\t\t\tvar script = $window.document.createElement(\"script\")\n\t\t\t$window[callbackName] = function(data) {\n\t\t\t\tdelete $window[callbackName]\n\t\t\t\tscript.parentNode.removeChild(script)\n\t\t\t\tresolve(data)\n\t\t\t}\n\t\t\tscript.onerror = function() {\n\t\t\t\tdelete $window[callbackName]\n\t\t\t\tscript.parentNode.removeChild(script)\n\t\t\t\treject(new Error(\"JSONP request failed\"))\n\t\t\t}\n\t\t\tscript.src = url + (url.indexOf(\"?\") < 0 ? \"?\" : \"&\") +\n\t\t\t\tencodeURIComponent(args.callbackKey || \"callback\") + \"=\" +\n\t\t\t\tencodeURIComponent(callbackName)\n\t\t\t$window.document.documentElement.appendChild(script)\n\t\t}),\n\t}\n}\n\n},{\"../pathname/build\":16}],32:[function(require,module,exports){\n\"use strict\"\n\nvar mountRedraw = require(\"./mount-redraw\")\n\nmodule.exports = require(\"./api/router\")(window, mountRedraw)\n\n},{\"./api/router\":11,\"./mount-redraw\":14}],33:[function(require,module,exports){\n// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n},{}],34:[function(require,module,exports){\n(function (setImmediate,clearImmediate){\nvar nextTick = require('process/browser.js').nextTick;\nvar apply = Function.prototype.apply;\nvar slice = Array.prototype.slice;\nvar immediateIds = {};\nvar nextImmediateId = 0;\n\n// DOM APIs, for completeness\n\nexports.setTimeout = function() {\n return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);\n};\nexports.setInterval = function() {\n return new Timeout(apply.call(setInterval, window, arguments), clearInterval);\n};\nexports.clearTimeout =\nexports.clearInterval = function(timeout) { timeout.close(); };\n\nfunction Timeout(id, clearFn) {\n this._id = id;\n this._clearFn = clearFn;\n}\nTimeout.prototype.unref = Timeout.prototype.ref = function() {};\nTimeout.prototype.close = function() {\n this._clearFn.call(window, this._id);\n};\n\n// Does not start the time, just sets up the members needed.\nexports.enroll = function(item, msecs) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = msecs;\n};\n\nexports.unenroll = function(item) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = -1;\n};\n\nexports._unrefActive = exports.active = function(item) {\n clearTimeout(item._idleTimeoutId);\n\n var msecs = item._idleTimeout;\n if (msecs >= 0) {\n item._idleTimeoutId = setTimeout(function onTimeout() {\n if (item._onTimeout)\n item._onTimeout();\n }, msecs);\n }\n};\n\n// That's not how node.js implements it but the exposed api is the same.\nexports.setImmediate = typeof setImmediate === \"function\" ? setImmediate : function(fn) {\n var id = nextImmediateId++;\n var args = arguments.length < 2 ? false : slice.call(arguments, 1);\n\n immediateIds[id] = true;\n\n nextTick(function onNextTick() {\n if (immediateIds[id]) {\n // fn.call() is faster so we optimize for the common use-case\n // @see http://jsperf.com/call-apply-segu\n if (args) {\n fn.apply(null, args);\n } else {\n fn.call(null);\n }\n // Prevent ids from leaking\n exports.clearImmediate(id);\n }\n });\n\n return id;\n};\n\nexports.clearImmediate = typeof clearImmediate === \"function\" ? clearImmediate : function(id) {\n delete immediateIds[id];\n};\n}).call(this,require(\"timers\").setImmediate,require(\"timers\").clearImmediate)\n},{\"process/browser.js\":33,\"timers\":34}],35:[function(require,module,exports){\nfunction tlite(getTooltipOpts) {\n document.addEventListener('mouseover', function (e) {\n var el = e.target;\n var opts = getTooltipOpts(el);\n\n if (!opts) {\n el = el.parentElement;\n opts = el && getTooltipOpts(el);\n }\n\n opts && tlite.show(el, opts, true);\n });\n}\n\ntlite.show = function (el, opts, isAuto) {\n var fallbackAttrib = 'data-tlite';\n opts = opts || {};\n\n (el.tooltip || Tooltip(el, opts)).show();\n\n function Tooltip(el, opts) {\n var tooltipEl;\n var showTimer;\n var text;\n\n el.addEventListener('mousedown', autoHide);\n el.addEventListener('mouseleave', autoHide);\n\n function show() {\n text = el.title || el.getAttribute(fallbackAttrib) || text;\n el.title = '';\n el.setAttribute(fallbackAttrib, '');\n text && !showTimer && (showTimer = setTimeout(fadeIn, isAuto ? 150 : 1))\n }\n\n function autoHide() {\n tlite.hide(el, true);\n }\n\n function hide(isAutoHiding) {\n if (isAuto === isAutoHiding) {\n showTimer = clearTimeout(showTimer);\n var parent = tooltipEl && tooltipEl.parentNode;\n parent && parent.removeChild(tooltipEl);\n tooltipEl = undefined;\n }\n }\n\n function fadeIn() {\n if (!tooltipEl) {\n tooltipEl = createTooltip(el, text, opts);\n }\n }\n\n return el.tooltip = {\n show: show,\n hide: hide\n };\n }\n\n function createTooltip(el, text, opts) {\n var tooltipEl = document.createElement('span');\n var grav = opts.grav || el.getAttribute('data-tlite') || 'n';\n\n tooltipEl.innerHTML = text;\n\n el.appendChild(tooltipEl);\n\n var vertGrav = grav[0] || '';\n var horzGrav = grav[1] || '';\n\n function positionTooltip() {\n tooltipEl.className = 'tlite ' + 'tlite-' + vertGrav + horzGrav;\n\n var arrowSize = 10;\n var top = el.offsetTop;\n var left = el.offsetLeft;\n\n if (tooltipEl.offsetParent === el) {\n top = left = 0;\n }\n\n var width = el.offsetWidth;\n var height = el.offsetHeight;\n var tooltipHeight = tooltipEl.offsetHeight;\n var tooltipWidth = tooltipEl.offsetWidth;\n var centerEl = left + (width / 2);\n\n tooltipEl.style.top = (\n vertGrav === 's' ? (top - tooltipHeight - arrowSize) :\n vertGrav === 'n' ? (top + height + arrowSize) :\n (top + (height / 2) - (tooltipHeight / 2))\n ) + 'px';\n\n tooltipEl.style.left = (\n horzGrav === 'w' ? left :\n horzGrav === 'e' ? left + width - tooltipWidth :\n vertGrav === 'w' ? (left + width + arrowSize) :\n vertGrav === 'e' ? (left - tooltipWidth - arrowSize) :\n (centerEl - tooltipWidth / 2)\n ) + 'px';\n }\n\n positionTooltip();\n\n var rect = tooltipEl.getBoundingClientRect();\n\n if (vertGrav === 's' && rect.top < 0) {\n vertGrav = 'n';\n positionTooltip();\n } else if (vertGrav === 'n' && rect.bottom > window.innerHeight) {\n vertGrav = 's';\n positionTooltip();\n } else if (vertGrav === 'e' && rect.left < 0) {\n vertGrav = 'w';\n positionTooltip();\n } else if (vertGrav === 'w' && rect.right > window.innerWidth) {\n vertGrav = 'e';\n positionTooltip();\n }\n\n tooltipEl.className += ' tlite-visible';\n\n return tooltipEl;\n }\n};\n\ntlite.hide = function (el, isAuto) {\n el.tooltip && el.tooltip.hide(isAuto);\n};\n\nif (typeof module !== 'undefined' && module.exports) {\n module.exports = tlite;\n}\n\n},{}]},{},[1]);\n"]}
assets/js/forms-admin.js CHANGED
@@ -1,4 +1,4 @@
1
- (function () { var require = undefined; var define = undefined; (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2
  'use strict';
3
 
4
  var i18n = window.mc4wp_forms_i18n;
@@ -11,16 +11,16 @@ r.showType = function (config) {
11
  // ucfirst
12
  var fieldType = config.type;
13
  fieldType = fieldType.charAt(0).toUpperCase() + fieldType.slice(1);
14
- return m('div', [m("label", i18n.fieldType), m('span', fieldType)]);
15
  };
16
 
17
  r.label = function (config) {
18
  // label row
19
- return m("div", [m("label", i18n.fieldLabel), m("input.widefat", {
20
- type: "text",
21
  value: config.label,
22
  onchange: function onchange(evt) {
23
- return config.label = evt.target.value;
24
  },
25
  placeholder: config.title
26
  })]);
@@ -28,13 +28,13 @@ r.label = function (config) {
28
 
29
  r.value = function (config) {
30
  var isHidden = config.type === 'hidden';
31
- return m("div", [m("label", [isHidden ? i18n.value : i18n.initialValue, " ", isHidden ? '' : m('small', {
32
- "style": "float: right; font-weight: normal;"
33
- }, i18n.optional)]), m("input.widefat", {
34
- type: "text",
35
  value: config.value,
36
  onchange: function onchange(evt) {
37
- return config.value = evt.target.value;
38
  }
39
  }), isHidden ? '' : m('p.help', i18n.valueHelp)]);
40
  };
@@ -43,12 +43,12 @@ r.numberMinMax = function (config) {
43
  return m('div', [m('div.row', [m('div.col.col-3', [m('label', i18n.min), m('input', {
44
  type: 'number',
45
  onchange: function onchange(evt) {
46
- return config.min = evt.target.value;
47
  }
48
  })]), m('div.col.col-3', [m('label', i18n.max), m('input', {
49
  type: 'number',
50
  onchange: function onchange(evt) {
51
- return config.max = evt.target.value;
52
  }
53
  })])])]);
54
  };
@@ -58,7 +58,7 @@ r.isRequired = function (config) {
58
  type: 'checkbox',
59
  checked: config.required,
60
  onchange: function onchange(evt) {
61
- return config.required = evt.target.checked;
62
  }
63
  };
64
  var desc;
@@ -73,16 +73,16 @@ r.isRequired = function (config) {
73
  };
74
 
75
  r.placeholder = function (config) {
76
- return m("div", [m("label", [i18n.placeholder, " ", m('small', {
77
- "style": "float: right; font-weight: normal;"
78
- }, i18n.optional)]), m("input.widefat", {
79
- type: "text",
80
  value: config.placeholder,
81
  onchange: function onchange(evt) {
82
- return config.placeholder = evt.target.value;
83
  },
84
- placeholder: ""
85
- }), m("p.help", i18n.placeholderHelp)]);
86
  };
87
 
88
  r.useParagraphs = function (config) {
@@ -90,7 +90,7 @@ r.useParagraphs = function (config) {
90
  type: 'checkbox',
91
  checked: config.wrap,
92
  onchange: function onchange(evt) {
93
- return config.wrap = evt.target.checked;
94
  }
95
  }), i18n.wrapInParagraphTags])]);
96
  };
@@ -114,14 +114,14 @@ r.choiceType = function (config) {
114
  return m('div', [m('label', i18n.choiceType), m('select', {
115
  value: config.type,
116
  onchange: function onchange(evt) {
117
- return config.type = evt.target.value;
118
  }
119
  }, options)]);
120
  };
121
 
122
  r.choices = function (config) {
123
  var html = [];
124
- html.push(m('div', [m('label', i18n.choices), m('div.limit-height', [m("table", config.choices.map(function (choice, index) {
125
  return m('tr', {
126
  'data-id': index
127
  }, [m('td.cb', m('input', {
@@ -149,12 +149,12 @@ r.choices = function (config) {
149
  value: choice.label,
150
  placeholder: choice.title,
151
  onchange: function onchange(evt) {
152
- return choice.label = evt.target.value;
153
  }
154
  })), m('td', m('span', {
155
- "title": i18n.remove,
156
  "class": 'dashicons dashicons-no-alt hover-activated',
157
- "onclick": function (key) {
158
  this.choices().splice(key, 1);
159
  }.bind(config, index)
160
  }, ''))]);
@@ -166,11 +166,11 @@ r.choices = function (config) {
166
 
167
  r.linkToTerms = function (config) {
168
  // label row
169
- return m("div", [m("label", i18n.agreeToTermsLink), m("input.widefat", {
170
- type: "text",
171
  value: config.link,
172
  onchange: function onchange(evt) {
173
- return config.link = evt.target.value;
174
  },
175
  placeholder: 'https://...'
176
  })]);
@@ -189,7 +189,7 @@ var rows = require('./field-forms-rows.js'); // route to one of the other form c
189
  forms.render = function (config) {
190
  var type = config.type;
191
 
192
- if (typeof forms[type] === "function") {
193
  return forms[type](config);
194
  }
195
 
@@ -256,7 +256,7 @@ var m = require('mithril');
256
 
257
  var setAttributes = function setAttributes(vnode) {
258
  if (vnode.dom.checked) {
259
- vnode.dom.setAttribute("checked", "true");
260
  }
261
 
262
  if (vnode.dom.value) {
@@ -264,7 +264,7 @@ var setAttributes = function setAttributes(vnode) {
264
  }
265
 
266
  if (vnode.dom.selected) {
267
- vnode.dom.setAttribute("selected", "true");
268
  }
269
  };
270
 
@@ -275,7 +275,7 @@ var generators = {};
275
  * @returns {*}
276
  */
277
 
278
- generators['select'] = function (config) {
279
  var attributes = {
280
  name: config.name,
281
  required: config.required
@@ -288,7 +288,7 @@ generators['select'] = function (config) {
288
 
289
  return m('option', {
290
  value: choice.value !== choice.label ? choice.value : undefined,
291
- "selected": choice.selected,
292
  oncreate: setAttributes
293
  }, choice.label);
294
  });
@@ -296,9 +296,9 @@ generators['select'] = function (config) {
296
 
297
  if (placeholder.length > 0) {
298
  options.unshift(m('option', {
299
- 'disabled': true,
300
- 'value': '',
301
- 'selected': !hasSelection,
302
  oncreate: setAttributes
303
  }, placeholder));
304
  }
@@ -312,7 +312,7 @@ generators['terms-checkbox'] = function (config) {
312
  if (config.link.length > 0) {
313
  label = m('a', {
314
  href: config.link,
315
- target: "_blank"
316
  }, config.label);
317
  } else {
318
  label = config.label;
@@ -333,7 +333,7 @@ generators['terms-checkbox'] = function (config) {
333
  */
334
 
335
 
336
- generators['checkbox'] = function (config) {
337
  return config.choices.map(function (choice) {
338
  var name = config.name + (config.type === 'checkbox' ? '[]' : '');
339
  var required = config.required && config.type === 'radio';
@@ -348,7 +348,7 @@ generators['checkbox'] = function (config) {
348
  });
349
  };
350
 
351
- generators['radio'] = generators['checkbox'];
352
  /**
353
  * Generates a default field
354
  *
@@ -358,7 +358,7 @@ generators['radio'] = generators['checkbox'];
358
  * @returns {*}
359
  */
360
 
361
- generators['default'] = function (config) {
362
  var attributes = {
363
  type: config.type
364
  };
@@ -397,15 +397,15 @@ generators['default'] = function (config) {
397
 
398
  function generate(config) {
399
  var labelAtts = {};
400
- var label = config.label.length > 0 && config.showLabel ? m("label", labelAtts, config.label) : '';
401
- var field = typeof generators[config.type] === "function" ? generators[config.type](config) : generators['default'](config);
402
  var htmlTemplate = config.wrap ? m('p', [label, field]) : [label, field]; // render in vdom
403
 
404
  var vdom = document.createElement('div');
405
  m.render(vdom, htmlTemplate); // prettify html
406
 
407
  var html = htmlutil.prettyPrint(vdom.innerHTML);
408
- return html + "\n";
409
  }
410
 
411
  module.exports = generate;
@@ -472,7 +472,7 @@ function view() {
472
  // build DOM for fields choice
473
  var fieldCategories = fields.getCategories();
474
  var availableFields = fields.getAll();
475
- var fieldsChoice = m("div.available-fields.small-margin", [m("h4", i18n.chooseField), fieldCategories.map(function (category) {
476
  var categoryFields = availableFields.filter(function (f) {
477
  return f.category === category;
478
  });
@@ -481,21 +481,21 @@ function view() {
481
  return;
482
  }
483
 
484
- return m("div.tiny-margin", [m("strong", category), // render fields
485
  categoryFields.map(function (field) {
486
- var className = "button";
487
 
488
  if (field.forceRequired) {
489
- className += " is-required";
490
  }
491
 
492
  var inForm = field.inFormContent;
493
 
494
  if (inForm !== null) {
495
- className += " " + (inForm ? 'in-form' : 'not-in-form');
496
  }
497
 
498
- return m("button", {
499
  className: className,
500
  type: 'button',
501
  onclick: function onclick(evt) {
@@ -512,13 +512,13 @@ function view() {
512
  form = m(Overlay, {
513
  onClose: setActiveField
514
  }, // field wizard
515
- m("div.field-wizard", [//heading
516
- m("h3", [fieldConfig.title, fieldConfig.forceRequired ? m('span.red', '*') : '', fieldConfig.name.length ? m("code", fieldConfig.name) : '']), // help text
517
  fieldConfig.help.length ? m('p', m.trust(fieldConfig.help)) : '', // actual form
518
  forms.render(fieldConfig), // add to form button
519
- m("p", [m("button", {
520
- "class": "button-primary",
521
- type: "button",
522
  onkeydown: function onkeydown(evt) {
523
  if (evt.keyCode === 13) {
524
  createFieldHTMLAndAddToForm();
@@ -550,6 +550,7 @@ var settings = window.mc4wp.settings;
550
  var ajaxurl = window.mc4wp_vars.ajaxurl;
551
  var i18n = window.mc4wp_forms_i18n;
552
  var mailchimp = window.mc4wp_vars.mailchimp;
 
553
  /**
554
  * Array of registered fields
555
  *
@@ -591,12 +592,12 @@ function register(category, data, sticky) {
591
 
592
  function getFieldType(type) {
593
  var map = {
594
- 'phone': 'tel',
595
- 'dropdown': 'select',
596
- 'checkboxes': 'checkbox',
597
- 'birthday': 'text'
598
  };
599
- return typeof map[type] !== "undefined" ? map[type] : type;
600
  }
601
  /**
602
  * Register the various fields for a merge var
@@ -653,7 +654,7 @@ function registerMergeField(mergeField) {
653
  type: 'select',
654
  mailchimpType: 'address',
655
  title: i18n.country,
656
- choices: mc4wp_vars.countries
657
  }, false);
658
  }
659
 
@@ -711,12 +712,12 @@ function registerListFields(list) {
711
 
712
 
713
  function registerListsFields(lists) {
714
- var url = ajaxurl + "?action=mc4wp_get_list_details&ids=" + lists.map(function (l) {
715
  return l.id;
716
  }).join(',');
717
  m.request({
718
  url: url,
719
- method: "GET"
720
  }).then(function (lists) {
721
  reset();
722
  lists.forEach(registerListFields);
@@ -737,7 +738,7 @@ function registerCustomFields(lists) {
737
  register(category, {
738
  name: '',
739
  value: i18n.subscribe,
740
- type: "submit",
741
  title: i18n.submitButton
742
  }, true); // register lists choice field
743
 
@@ -756,8 +757,8 @@ function registerCustomFields(lists) {
756
  acceptsMultipleValues: true
757
  }, true);
758
  choices = {
759
- 'subscribe': "Subscribe",
760
- 'unsubscribe': "Unsubscribe"
761
  };
762
  register(category, {
763
  name: '_mc4wp_action',
@@ -770,7 +771,7 @@ function registerCustomFields(lists) {
770
  register(category, {
771
  name: 'AGREE_TO_TERMS',
772
  value: 1,
773
- type: "terms-checkbox",
774
  label: i18n.agreeToTerms,
775
  title: i18n.agreeToTermsShort,
776
  showLabel: false,
@@ -803,12 +804,12 @@ var Field = function Field(data) {
803
  type: data.type,
804
  mailchimpType: data.mailchimpType || null,
805
  label: data.label || data.title || '',
806
- showLabel: typeof data.showLabel === "boolean" ? data.showLabel : true,
807
  value: data.value || '',
808
  placeholder: data.placeholder || '',
809
- required: typeof data.required === "boolean" ? data.required : false,
810
- forceRequired: typeof data.forceRequired === "boolean" ? data.forceRequired : false,
811
- wrap: typeof data.wrap === "boolean" ? data.wrap : true,
812
  min: data.min,
813
  max: data.max,
814
  help: data.help || '',
@@ -845,7 +846,7 @@ var FieldChoice = function FieldChoice(data) {
845
  function createChoices(data) {
846
  var choices = [];
847
 
848
- if (typeof data.map === "function") {
849
  choices = data.map(function (choiceLabel) {
850
  return new FieldChoice({
851
  label: choiceLabel
@@ -871,7 +872,6 @@ function createChoices(data) {
871
 
872
 
873
  function register(category, data) {
874
- var field;
875
  var existingField = getAllWhere('name', data.name).shift(); // a field with the same "name" already exists
876
 
877
  if (existingField) {
@@ -905,14 +905,13 @@ function register(category, data) {
905
  } // create Field object
906
 
907
 
908
- field = new Field(data);
909
  field.category = category; // add to array
910
 
911
  fields.push(field); // redraw view
912
- // TODO: Move this out
913
 
914
  timeout && window.clearTimeout(timeout);
915
- timeout = window.setTimeout(m.redraw, 200); // trigger event
916
 
917
  emit('change');
918
  return field;
@@ -973,7 +972,7 @@ function getAll() {
973
 
974
  function getCategories() {
975
  return categories.sort(function (a, b) {
976
- return a !== "Form fields" ? -1 : 1;
977
  });
978
  }
979
  /**
@@ -996,12 +995,12 @@ function getAllWhere(searchKey, searchValue) {
996
 
997
 
998
  module.exports = {
999
- 'get': get,
1000
- 'getAll': getAll,
1001
- 'getCategories': getCategories,
1002
- 'deregister': deregister,
1003
- 'register': register,
1004
- 'getAllWhere': getAllWhere,
1005
  on: on
1006
  };
1007
 
@@ -1108,7 +1107,7 @@ FormEditor.refresh = function () {
1108
 
1109
  if (element) {
1110
  window.addEventListener('load', function () {
1111
- CodeMirror.signal(editor, "change");
1112
  }); // set domDirty to true everytime the "change" event fires (a lot..)
1113
 
1114
  element.addEventListener('change', function () {
@@ -1120,7 +1119,7 @@ if (element) {
1120
  if (CodeMirror) {
1121
  editor = CodeMirror.fromTextArea(element, {
1122
  selectionPointer: true,
1123
- mode: "htmlmixed",
1124
  htmlMode: true,
1125
  autoCloseTags: true,
1126
  autoRefresh: true,
@@ -1132,7 +1131,7 @@ if (element) {
1132
  }); // dispatch regular "change" on element event every time editor changes (IE9+ only)
1133
 
1134
  window.dispatchEvent && editor.on('change', function () {
1135
- if (typeof Event === "function") {
1136
  // Create a new 'change' event
1137
  var event = new Event('change', {
1138
  bubbles: true
@@ -1161,6 +1160,8 @@ var editor = require('./form-editor.js');
1161
 
1162
  var fields = require('./fields.js');
1163
 
 
 
1164
  var requiredFieldsInput = document.getElementById('required-fields');
1165
 
1166
  function updateFields() {
@@ -1181,7 +1182,7 @@ function updateFields() {
1181
  } // query other fields for this address group
1182
 
1183
 
1184
- var nameGroup = field.name.replace(/\[(\w+)\]/g, '');
1185
 
1186
  if (editor.query('[name^="' + nameGroup + '"]').length > 0) {
1187
  field.forceRequired = true;
@@ -1197,7 +1198,7 @@ function updateFields() {
1197
  function findRequiredFields() {
1198
  // query fields required by Mailchimp
1199
  var requiredFields = fields.getAllWhere('forceRequired', true).map(function (f) {
1200
- return f.name.toUpperCase().replace(/\[(\w+)\]/g, '.$1');
1201
  }); // query fields in form with [required] attribute
1202
 
1203
  var requiredFieldElements = editor.query('[required]');
@@ -1209,9 +1210,9 @@ function findRequiredFields() {
1209
  } // replace array brackets with dot style notation
1210
 
1211
 
1212
- name = name.replace(/\[(\w+)\]/g, '.$1'); // replace array-style fields
1213
 
1214
- name = name.replace(/\[\]$/, ''); // uppercase everything before the .
1215
 
1216
  var pos = name.indexOf('.');
1217
  pos = pos > 0 ? pos : name.length;
@@ -1226,8 +1227,8 @@ function findRequiredFields() {
1226
  } // events
1227
 
1228
 
1229
- editor.on('change', helpers.debounce(updateFields, 500));
1230
- fields.on('change', helpers.debounce(updateFields, 500));
1231
 
1232
  },{"../helpers.js":9,"./fields.js":6,"./form-editor.js":7,"mithril":28}],9:[function(require,module,exports){
1233
  'use strict';
@@ -1237,8 +1238,8 @@ var helpers = {}; // polling
1237
  helpers.debounce = function (func, wait, immediate) {
1238
  var timeout;
1239
  return function () {
1240
- var context = this,
1241
- args = arguments;
1242
  var callNow = immediate && !timeout;
1243
  clearTimeout(timeout);
1244
  timeout = setTimeout(function () {
@@ -1292,7 +1293,7 @@ function render() {
1292
  }
1293
 
1294
  var groupingsNotice = function groupingsNotice() {
1295
- var text = "Your form contains deprecated <code>GROUPINGS</code> fields. <br /><br />Please remove these fields from your form and then re-add them through the available field buttons to make sure your data is getting through to Mailchimp correctly.";
1296
  var formCode = editor.getValue().toLowerCase();
1297
  formCode.indexOf('name="groupings') > -1 ? show('deprecated_groupings', text) : hide('deprecated_groupings');
1298
  };
@@ -1303,7 +1304,7 @@ var requiredFieldsNotice = function requiredFieldsNotice() {
1303
  return !editor.containsField(f.name.toUpperCase());
1304
  });
1305
  var text = '<strong>Heads up!</strong> Your form is missing list fields that are required in Mailchimp. Either add these fields to your form or mark them as optional in Mailchimp.';
1306
- text += "<br /><ul class=\"ul-square\" style=\"margin-bottom: 0;\"><li>" + missingFields.map(function (f) {
1307
  return f.title;
1308
  }).join('</li><li>') + '</li></ul>';
1309
  missingFields.length > 0 ? show('required_fields_missing', text) : hide('required_fields_missing');
@@ -1372,12 +1373,12 @@ function Overlay(vnode) {
1372
  var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
1373
  var marginLeft = (windowWidth - element.clientWidth - 40) / 2;
1374
  var marginTop = (windowHeight - element.clientHeight - 40) / 2;
1375
- element.style.left = (marginLeft > 0 ? marginLeft : 0) + "px";
1376
- element.style.top = (marginTop > 0 ? marginTop : 0) + "px";
1377
  }
1378
 
1379
  function view(vnode) {
1380
- return [m('div.overlay-wrap', m("div.overlay", {
1381
  oncreate: function oncreate(vnode) {
1382
  element = vnode.dom;
1383
  onWindowResize();
@@ -1405,7 +1406,7 @@ module.exports = Overlay;
1405
  },{"mithril":28}],12:[function(require,module,exports){
1406
  'use strict';
1407
 
1408
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1409
 
1410
  var context = document.getElementById('mc4wp-admin');
1411
  var listInputs = context.querySelectorAll('.mc4wp-list-input');
@@ -1427,11 +1428,11 @@ function updateSelectedLists() {
1427
  selectedLists = [];
1428
  [].forEach.call(listInputs, function (input) {
1429
  // skip unchecked checkboxes
1430
- if (typeof input.checked === "boolean" && !input.checked) {
1431
  return;
1432
  }
1433
 
1434
- if (_typeof(lists[input.value]) === "object") {
1435
  selectedLists.push(lists[input.value]);
1436
  }
1437
  });
@@ -1564,7 +1565,7 @@ window.mc4wp.forms.editor = editor;
1564
  if (!tagName ||
1565
  tok.type == "string" && (tok.end != pos.ch || !/[\"\']/.test(tok.string.charAt(tok.string.length - 1)) || tok.string.length == 1) ||
1566
  tok.type == "tag" && tagInfo.close ||
1567
- tok.string.indexOf("/") == (tok.string.length - 1) || // match something like <someTagName />
1568
  dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1 ||
1569
  closingTagExists(cm, inner.mode.xmlCurrentContext && inner.mode.xmlCurrentContext(state) || [], tagName, pos, true))
1570
  return CodeMirror.Pass;
@@ -2166,7 +2167,7 @@ window.mc4wp.forms.editor = editor;
2166
  (function (global, factory) {
2167
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
2168
  typeof define === 'function' && define.amd ? define(factory) :
2169
- (global.CodeMirror = factory());
2170
  }(this, (function () { 'use strict';
2171
 
2172
  // Kludges for bugs and behavior differences that can't be feature
@@ -2329,10 +2330,28 @@ window.mc4wp.forms.editor = editor;
2329
  }
2330
  }
2331
 
2332
- var Delayed = function() {this.id = null;};
 
 
 
 
 
 
 
 
 
 
 
 
 
2333
  Delayed.prototype.set = function (ms, f) {
2334
- clearTimeout(this.id);
2335
- this.id = setTimeout(f, ms);
 
 
 
 
 
2336
  };
2337
 
2338
  function indexOf(array, elt) {
@@ -2674,8 +2693,8 @@ window.mc4wp.forms.editor = editor;
2674
  } else if (emitter.attachEvent) {
2675
  emitter.attachEvent("on" + type, f);
2676
  } else {
2677
- var map$$1 = emitter._handlers || (emitter._handlers = {});
2678
- map$$1[type] = (map$$1[type] || noHandlers).concat(f);
2679
  }
2680
  };
2681
 
@@ -2689,11 +2708,11 @@ window.mc4wp.forms.editor = editor;
2689
  } else if (emitter.detachEvent) {
2690
  emitter.detachEvent("on" + type, f);
2691
  } else {
2692
- var map$$1 = emitter._handlers, arr = map$$1 && map$$1[type];
2693
  if (arr) {
2694
  var index = indexOf(arr, f);
2695
  if (index > -1)
2696
- { map$$1[type] = arr.slice(0, index).concat(arr.slice(index + 1)); }
2697
  }
2698
  }
2699
  }
@@ -2821,11 +2840,11 @@ window.mc4wp.forms.editor = editor;
2821
  try { return te.selectionStart != te.selectionEnd }
2822
  catch(e) { return false }
2823
  } : function (te) {
2824
- var range$$1;
2825
- try {range$$1 = te.ownerDocument.selection.createRange();}
2826
  catch(e) {}
2827
- if (!range$$1 || range$$1.parentElement() != te) { return false }
2828
- return range$$1.compareEndPoints("StartToEnd", range$$1) != 0
2829
  };
2830
 
2831
  var hasCopyEvent = (function () {
@@ -2973,10 +2992,8 @@ window.mc4wp.forms.editor = editor;
2973
  return this.pos > start
2974
  };
2975
  StringStream.prototype.eatSpace = function () {
2976
- var this$1 = this;
2977
-
2978
  var start = this.pos;
2979
- while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this$1.pos; }
2980
  return this.pos > start
2981
  };
2982
  StringStream.prototype.skipToEnd = function () {this.pos = this.string.length;};
@@ -3172,11 +3189,9 @@ window.mc4wp.forms.editor = editor;
3172
  };
3173
 
3174
  Context.prototype.baseToken = function (n) {
3175
- var this$1 = this;
3176
-
3177
  if (!this.baseTokens) { return null }
3178
  while (this.baseTokens[this.baseTokenPos] <= n)
3179
- { this$1.baseTokenPos += 2; }
3180
  var type = this.baseTokens[this.baseTokenPos + 1];
3181
  return {type: type && type.replace(/( |^)overlay .*/, ""),
3182
  size: this.baseTokens[this.baseTokenPos] - n}
@@ -3665,8 +3680,8 @@ window.mc4wp.forms.editor = editor;
3665
  // Test whether there exists a collapsed span that partially
3666
  // overlaps (covers the start or end, but not both) of a new span.
3667
  // Such overlap is not allowed.
3668
- function conflictingCollapsedRange(doc, lineNo$$1, from, to, marker) {
3669
- var line = getLine(doc, lineNo$$1);
3670
  var sps = sawCollapsedSpans && line.markedSpans;
3671
  if (sps) { for (var i = 0; i < sps.length; ++i) {
3672
  var sp = sps[i];
@@ -4347,10 +4362,10 @@ window.mc4wp.forms.editor = editor;
4347
 
4348
  function updateLineWidgets(cm, lineView, dims) {
4349
  if (lineView.alignable) { lineView.alignable = null; }
 
4350
  for (var node = lineView.node.firstChild, next = (void 0); node; node = next) {
4351
  next = node.nextSibling;
4352
- if (node.className == "CodeMirror-linewidget")
4353
- { lineView.node.removeChild(node); }
4354
  }
4355
  insertLineWidgets(cm, lineView, dims);
4356
  }
@@ -4380,7 +4395,7 @@ window.mc4wp.forms.editor = editor;
4380
  if (!line.widgets) { return }
4381
  var wrap = ensureLineWrapped(lineView);
4382
  for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
4383
- var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget");
4384
  if (!widget.handleMouseEvents) { node.setAttribute("cm-ignore-events", "true"); }
4385
  positionLineWidget(widget, node, lineView, dims);
4386
  cm.display.input.setUneditable(node);
@@ -4568,36 +4583,36 @@ window.mc4wp.forms.editor = editor;
4568
 
4569
  var nullRect = {left: 0, right: 0, top: 0, bottom: 0};
4570
 
4571
- function nodeAndOffsetInLineMap(map$$1, ch, bias) {
4572
  var node, start, end, collapse, mStart, mEnd;
4573
  // First, search the line map for the text node corresponding to,
4574
  // or closest to, the target character.
4575
- for (var i = 0; i < map$$1.length; i += 3) {
4576
- mStart = map$$1[i];
4577
- mEnd = map$$1[i + 1];
4578
  if (ch < mStart) {
4579
  start = 0; end = 1;
4580
  collapse = "left";
4581
  } else if (ch < mEnd) {
4582
  start = ch - mStart;
4583
  end = start + 1;
4584
- } else if (i == map$$1.length - 3 || ch == mEnd && map$$1[i + 3] > ch) {
4585
  end = mEnd - mStart;
4586
  start = end - 1;
4587
  if (ch >= mEnd) { collapse = "right"; }
4588
  }
4589
  if (start != null) {
4590
- node = map$$1[i + 2];
4591
  if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right"))
4592
  { collapse = bias; }
4593
  if (bias == "left" && start == 0)
4594
- { while (i && map$$1[i - 2] == map$$1[i - 3] && map$$1[i - 1].insertLeft) {
4595
- node = map$$1[(i -= 3) + 2];
4596
  collapse = "left";
4597
  } }
4598
  if (bias == "right" && start == mEnd - mStart)
4599
- { while (i < map$$1.length - 3 && map$$1[i + 3] == map$$1[i + 4] && !map$$1[i + 5].insertLeft) {
4600
- node = map$$1[(i += 3) + 2];
4601
  collapse = "right";
4602
  } }
4603
  break
@@ -4880,13 +4895,13 @@ window.mc4wp.forms.editor = editor;
4880
  return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x
4881
  }
4882
 
4883
- function coordsCharInner(cm, lineObj, lineNo$$1, x, y) {
4884
  // Move y into line-local coordinate space
4885
  y -= heightAtLine(lineObj);
4886
  var preparedMeasure = prepareMeasureForLine(cm, lineObj);
4887
  // When directly calling `measureCharPrepared`, we have to adjust
4888
  // for the widgets at this line.
4889
- var widgetHeight$$1 = widgetTopHeight(lineObj);
4890
  var begin = 0, end = lineObj.text.length, ltr = true;
4891
 
4892
  var order = getOrder(lineObj, cm.doc.direction);
@@ -4894,7 +4909,7 @@ window.mc4wp.forms.editor = editor;
4894
  // which bidi section the coordinates fall into.
4895
  if (order) {
4896
  var part = (cm.options.lineWrapping ? coordsBidiPartWrapped : coordsBidiPart)
4897
- (cm, lineObj, lineNo$$1, preparedMeasure, order, x, y);
4898
  ltr = part.level != 1;
4899
  // The awkward -1 offsets are needed because findFirst (called
4900
  // on these below) will treat its first bound as inclusive,
@@ -4910,7 +4925,7 @@ window.mc4wp.forms.editor = editor;
4910
  var chAround = null, boxAround = null;
4911
  var ch = findFirst(function (ch) {
4912
  var box = measureCharPrepared(cm, preparedMeasure, ch);
4913
- box.top += widgetHeight$$1; box.bottom += widgetHeight$$1;
4914
  if (!boxIsAfter(box, x, y, false)) { return false }
4915
  if (box.top <= y && box.left <= x) {
4916
  chAround = ch;
@@ -4934,27 +4949,27 @@ window.mc4wp.forms.editor = editor;
4934
  // left of the character and compare it's vertical position to the
4935
  // coordinates
4936
  sticky = ch == 0 ? "after" : ch == lineObj.text.length ? "before" :
4937
- (measureCharPrepared(cm, preparedMeasure, ch - (ltr ? 1 : 0)).bottom + widgetHeight$$1 <= y) == ltr ?
4938
  "after" : "before";
4939
  // Now get accurate coordinates for this place, in order to get a
4940
  // base X position
4941
- var coords = cursorCoords(cm, Pos(lineNo$$1, ch, sticky), "line", lineObj, preparedMeasure);
4942
  baseX = coords.left;
4943
  outside = y < coords.top ? -1 : y >= coords.bottom ? 1 : 0;
4944
  }
4945
 
4946
  ch = skipExtendingChars(lineObj.text, ch, 1);
4947
- return PosWithInfo(lineNo$$1, ch, sticky, outside, x - baseX)
4948
  }
4949
 
4950
- function coordsBidiPart(cm, lineObj, lineNo$$1, preparedMeasure, order, x, y) {
4951
  // Bidi parts are sorted left-to-right, and in a non-line-wrapping
4952
  // situation, we can take this ordering to correspond to the visual
4953
  // ordering. This finds the first part whose end is after the given
4954
  // coordinates.
4955
  var index = findFirst(function (i) {
4956
  var part = order[i], ltr = part.level != 1;
4957
- return boxIsAfter(cursorCoords(cm, Pos(lineNo$$1, ltr ? part.to : part.from, ltr ? "before" : "after"),
4958
  "line", lineObj, preparedMeasure), x, y, true)
4959
  }, 0, order.length - 1);
4960
  var part = order[index];
@@ -4963,7 +4978,7 @@ window.mc4wp.forms.editor = editor;
4963
  // that start, move one part back.
4964
  if (index > 0) {
4965
  var ltr = part.level != 1;
4966
- var start = cursorCoords(cm, Pos(lineNo$$1, ltr ? part.from : part.to, ltr ? "after" : "before"),
4967
  "line", lineObj, preparedMeasure);
4968
  if (boxIsAfter(start, x, y, true) && start.top > y)
4969
  { part = order[index - 1]; }
@@ -5103,7 +5118,7 @@ window.mc4wp.forms.editor = editor;
5103
  try { x = e.clientX - space.left; y = e.clientY - space.top; }
5104
  catch (e) { return null }
5105
  var coords = coordsChar(cm, x, y), line;
5106
- if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
5107
  var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;
5108
  coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));
5109
  }
@@ -5284,13 +5299,13 @@ window.mc4wp.forms.editor = editor;
5284
 
5285
  for (var i = 0; i < doc.sel.ranges.length; i++) {
5286
  if (!primary && i == doc.sel.primIndex) { continue }
5287
- var range$$1 = doc.sel.ranges[i];
5288
- if (range$$1.from().line >= cm.display.viewTo || range$$1.to().line < cm.display.viewFrom) { continue }
5289
- var collapsed = range$$1.empty();
5290
  if (collapsed || cm.options.showCursorWhenSelecting)
5291
- { drawSelectionCursor(cm, range$$1.head, curFragment); }
5292
  if (!collapsed)
5293
- { drawSelectionRange(cm, range$$1, selFragment); }
5294
  }
5295
  return result
5296
  }
@@ -5317,7 +5332,7 @@ window.mc4wp.forms.editor = editor;
5317
  function cmpCoords(a, b) { return a.top - b.top || a.left - b.left }
5318
 
5319
  // Draws the given range as a highlighted selection
5320
- function drawSelectionRange(cm, range$$1, output) {
5321
  var display = cm.display, doc = cm.doc;
5322
  var fragment = document.createDocumentFragment();
5323
  var padding = paddingH(cm.display), leftSide = padding.left;
@@ -5386,7 +5401,7 @@ window.mc4wp.forms.editor = editor;
5386
  return {start: start, end: end}
5387
  }
5388
 
5389
- var sFrom = range$$1.from(), sTo = range$$1.to();
5390
  if (sFrom.line == sTo.line) {
5391
  drawForLine(sFrom.line, sFrom.ch, sTo.ch);
5392
  } else {
@@ -5653,9 +5668,9 @@ window.mc4wp.forms.editor = editor;
5653
  if (y != null) { cm.curOp.scrollTop = y; }
5654
  }
5655
 
5656
- function scrollToRange(cm, range$$1) {
5657
  resolveScrollToPos(cm);
5658
- cm.curOp.scrollToPos = range$$1;
5659
  }
5660
 
5661
  // When an operation has its scrollToPos property set, and another
@@ -5663,11 +5678,11 @@ window.mc4wp.forms.editor = editor;
5663
  // 'simulates' scrolling that position into view in a cheap way, so
5664
  // that the effect of intermediate scroll commands is not ignored.
5665
  function resolveScrollToPos(cm) {
5666
- var range$$1 = cm.curOp.scrollToPos;
5667
- if (range$$1) {
5668
  cm.curOp.scrollToPos = null;
5669
- var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);
5670
- scrollToCoordsRange(cm, from, to, range$$1.margin);
5671
  }
5672
  }
5673
 
@@ -5814,9 +5829,9 @@ window.mc4wp.forms.editor = editor;
5814
  // (when the bar is hidden). If it is still visible, we keep
5815
  // it enabled, if it's hidden, we disable pointer events.
5816
  var box = bar.getBoundingClientRect();
5817
- var elt$$1 = type == "vert" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2)
5818
  : document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1);
5819
- if (elt$$1 != bar) { bar.style.pointerEvents = "none"; }
5820
  else { delay.set(1000, maybeDisable); }
5821
  }
5822
  delay.set(1000, maybeDisable);
@@ -6156,10 +6171,8 @@ window.mc4wp.forms.editor = editor;
6156
  { this.events.push(arguments); }
6157
  };
6158
  DisplayUpdate.prototype.finish = function () {
6159
- var this$1 = this;
6160
-
6161
  for (var i = 0; i < this.events.length; i++)
6162
- { signal.apply(null, this$1.events[i]); }
6163
  };
6164
 
6165
  function maybeClipScrollbars(cm) {
@@ -6194,11 +6207,11 @@ window.mc4wp.forms.editor = editor;
6194
  if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt()) { return }
6195
  snapshot.activeElt.focus();
6196
  if (snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {
6197
- var sel = window.getSelection(), range$$1 = document.createRange();
6198
- range$$1.setEnd(snapshot.anchorNode, snapshot.anchorOffset);
6199
- range$$1.collapse(false);
6200
  sel.removeAllRanges();
6201
- sel.addRange(range$$1);
6202
  sel.extend(snapshot.focusNode, snapshot.focusOffset);
6203
  }
6204
  }
@@ -6691,40 +6704,32 @@ window.mc4wp.forms.editor = editor;
6691
  Selection.prototype.primary = function () { return this.ranges[this.primIndex] };
6692
 
6693
  Selection.prototype.equals = function (other) {
6694
- var this$1 = this;
6695
-
6696
  if (other == this) { return true }
6697
  if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false }
6698
  for (var i = 0; i < this.ranges.length; i++) {
6699
- var here = this$1.ranges[i], there = other.ranges[i];
6700
  if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false }
6701
  }
6702
  return true
6703
  };
6704
 
6705
  Selection.prototype.deepCopy = function () {
6706
- var this$1 = this;
6707
-
6708
  var out = [];
6709
  for (var i = 0; i < this.ranges.length; i++)
6710
- { out[i] = new Range(copyPos(this$1.ranges[i].anchor), copyPos(this$1.ranges[i].head)); }
6711
  return new Selection(out, this.primIndex)
6712
  };
6713
 
6714
  Selection.prototype.somethingSelected = function () {
6715
- var this$1 = this;
6716
-
6717
  for (var i = 0; i < this.ranges.length; i++)
6718
- { if (!this$1.ranges[i].empty()) { return true } }
6719
  return false
6720
  };
6721
 
6722
  Selection.prototype.contains = function (pos, end) {
6723
- var this$1 = this;
6724
-
6725
  if (!end) { end = pos; }
6726
  for (var i = 0; i < this.ranges.length; i++) {
6727
- var range = this$1.ranges[i];
6728
  if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)
6729
  { return i }
6730
  }
@@ -6850,16 +6855,16 @@ window.mc4wp.forms.editor = editor;
6850
  }
6851
 
6852
  // Perform a change on the document data structure.
6853
- function updateDoc(doc, change, markedSpans, estimateHeight$$1) {
6854
  function spansFor(n) {return markedSpans ? markedSpans[n] : null}
6855
  function update(line, text, spans) {
6856
- updateLine(line, text, spans, estimateHeight$$1);
6857
  signalLater(line, "change", line, change);
6858
  }
6859
  function linesFor(start, end) {
6860
  var result = [];
6861
  for (var i = start; i < end; ++i)
6862
- { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }
6863
  return result
6864
  }
6865
 
@@ -6883,7 +6888,7 @@ window.mc4wp.forms.editor = editor;
6883
  update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);
6884
  } else {
6885
  var added$1 = linesFor(1, text.length - 1);
6886
- added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));
6887
  update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
6888
  doc.insert(from.line + 1, added$1);
6889
  }
@@ -7220,11 +7225,9 @@ window.mc4wp.forms.editor = editor;
7220
  var obj = {
7221
  ranges: sel.ranges,
7222
  update: function(ranges) {
7223
- var this$1 = this;
7224
-
7225
  this.ranges = [];
7226
  for (var i = 0; i < ranges.length; i++)
7227
- { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
7228
  clipPos(doc, ranges[i].head)); }
7229
  },
7230
  origin: options && options.origin
@@ -7711,13 +7714,11 @@ window.mc4wp.forms.editor = editor;
7711
  // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html
7712
 
7713
  function LeafChunk(lines) {
7714
- var this$1 = this;
7715
-
7716
  this.lines = lines;
7717
  this.parent = null;
7718
  var height = 0;
7719
  for (var i = 0; i < lines.length; ++i) {
7720
- lines[i].parent = this$1;
7721
  height += lines[i].height;
7722
  }
7723
  this.height = height;
@@ -7728,11 +7729,9 @@ window.mc4wp.forms.editor = editor;
7728
 
7729
  // Remove the n lines at offset 'at'.
7730
  removeInner: function(at, n) {
7731
- var this$1 = this;
7732
-
7733
  for (var i = at, e = at + n; i < e; ++i) {
7734
- var line = this$1.lines[i];
7735
- this$1.height -= line.height;
7736
  cleanUpLine(line);
7737
  signalLater(line, "delete");
7738
  }
@@ -7747,31 +7746,25 @@ window.mc4wp.forms.editor = editor;
7747
  // Insert the given array of lines at offset 'at', count them as
7748
  // having the given height.
7749
  insertInner: function(at, lines, height) {
7750
- var this$1 = this;
7751
-
7752
  this.height += height;
7753
  this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));
7754
- for (var i = 0; i < lines.length; ++i) { lines[i].parent = this$1; }
7755
  },
7756
 
7757
  // Used to iterate over a part of the tree.
7758
  iterN: function(at, n, op) {
7759
- var this$1 = this;
7760
-
7761
  for (var e = at + n; at < e; ++at)
7762
- { if (op(this$1.lines[at])) { return true } }
7763
  }
7764
  };
7765
 
7766
  function BranchChunk(children) {
7767
- var this$1 = this;
7768
-
7769
  this.children = children;
7770
  var size = 0, height = 0;
7771
  for (var i = 0; i < children.length; ++i) {
7772
  var ch = children[i];
7773
  size += ch.chunkSize(); height += ch.height;
7774
- ch.parent = this$1;
7775
  }
7776
  this.size = size;
7777
  this.height = height;
@@ -7782,16 +7775,14 @@ window.mc4wp.forms.editor = editor;
7782
  chunkSize: function() { return this.size },
7783
 
7784
  removeInner: function(at, n) {
7785
- var this$1 = this;
7786
-
7787
  this.size -= n;
7788
  for (var i = 0; i < this.children.length; ++i) {
7789
- var child = this$1.children[i], sz = child.chunkSize();
7790
  if (at < sz) {
7791
  var rm = Math.min(n, sz - at), oldHeight = child.height;
7792
  child.removeInner(at, rm);
7793
- this$1.height -= oldHeight - child.height;
7794
- if (sz == rm) { this$1.children.splice(i--, 1); child.parent = null; }
7795
  if ((n -= rm) == 0) { break }
7796
  at = 0;
7797
  } else { at -= sz; }
@@ -7808,18 +7799,14 @@ window.mc4wp.forms.editor = editor;
7808
  },
7809
 
7810
  collapse: function(lines) {
7811
- var this$1 = this;
7812
-
7813
- for (var i = 0; i < this.children.length; ++i) { this$1.children[i].collapse(lines); }
7814
  },
7815
 
7816
  insertInner: function(at, lines, height) {
7817
- var this$1 = this;
7818
-
7819
  this.size += lines.length;
7820
  this.height += height;
7821
  for (var i = 0; i < this.children.length; ++i) {
7822
- var child = this$1.children[i], sz = child.chunkSize();
7823
  if (at <= sz) {
7824
  child.insertInner(at, lines, height);
7825
  if (child.lines && child.lines.length > 50) {
@@ -7829,11 +7816,11 @@ window.mc4wp.forms.editor = editor;
7829
  for (var pos = remaining; pos < child.lines.length;) {
7830
  var leaf = new LeafChunk(child.lines.slice(pos, pos += 25));
7831
  child.height -= leaf.height;
7832
- this$1.children.splice(++i, 0, leaf);
7833
- leaf.parent = this$1;
7834
  }
7835
  child.lines = child.lines.slice(0, remaining);
7836
- this$1.maybeSpill();
7837
  }
7838
  break
7839
  }
@@ -7865,10 +7852,8 @@ window.mc4wp.forms.editor = editor;
7865
  },
7866
 
7867
  iterN: function(at, n, op) {
7868
- var this$1 = this;
7869
-
7870
  for (var i = 0; i < this.children.length; ++i) {
7871
- var child = this$1.children[i], sz = child.chunkSize();
7872
  if (at < sz) {
7873
  var used = Math.min(n, sz - at);
7874
  if (child.iterN(at, used, op)) { return true }
@@ -7882,20 +7867,16 @@ window.mc4wp.forms.editor = editor;
7882
  // Line widgets are block elements displayed above or below a line.
7883
 
7884
  var LineWidget = function(doc, node, options) {
7885
- var this$1 = this;
7886
-
7887
  if (options) { for (var opt in options) { if (options.hasOwnProperty(opt))
7888
- { this$1[opt] = options[opt]; } } }
7889
  this.doc = doc;
7890
  this.node = node;
7891
  };
7892
 
7893
  LineWidget.prototype.clear = function () {
7894
- var this$1 = this;
7895
-
7896
  var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);
7897
  if (no == null || !ws) { return }
7898
- for (var i = 0; i < ws.length; ++i) { if (ws[i] == this$1) { ws.splice(i--, 1); } }
7899
  if (!ws.length) { line.widgets = null; }
7900
  var height = widgetHeight(this);
7901
  updateLineHeight(line, Math.max(0, line.height - height));
@@ -7978,8 +7959,6 @@ window.mc4wp.forms.editor = editor;
7978
 
7979
  // Clear the marker.
7980
  TextMarker.prototype.clear = function () {
7981
- var this$1 = this;
7982
-
7983
  if (this.explicitlyCleared) { return }
7984
  var cm = this.doc.cm, withOp = cm && !cm.curOp;
7985
  if (withOp) { startOperation(cm); }
@@ -7989,19 +7968,19 @@ window.mc4wp.forms.editor = editor;
7989
  }
7990
  var min = null, max = null;
7991
  for (var i = 0; i < this.lines.length; ++i) {
7992
- var line = this$1.lines[i];
7993
- var span = getMarkedSpanFor(line.markedSpans, this$1);
7994
- if (cm && !this$1.collapsed) { regLineChange(cm, lineNo(line), "text"); }
7995
  else if (cm) {
7996
  if (span.to != null) { max = lineNo(line); }
7997
  if (span.from != null) { min = lineNo(line); }
7998
  }
7999
  line.markedSpans = removeMarkedSpan(line.markedSpans, span);
8000
- if (span.from == null && this$1.collapsed && !lineIsHidden(this$1.doc, line) && cm)
8001
  { updateLineHeight(line, textHeight(cm.display)); }
8002
  }
8003
  if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {
8004
- var visual = visualLine(this$1.lines[i$1]), len = lineLength(visual);
8005
  if (len > cm.display.maxLineLength) {
8006
  cm.display.maxLine = visual;
8007
  cm.display.maxLineLength = len;
@@ -8027,13 +8006,11 @@ window.mc4wp.forms.editor = editor;
8027
  // Pos objects returned contain a line object, rather than a line
8028
  // number (used to prevent looking up the same line twice).
8029
  TextMarker.prototype.find = function (side, lineObj) {
8030
- var this$1 = this;
8031
-
8032
  if (side == null && this.type == "bookmark") { side = 1; }
8033
  var from, to;
8034
  for (var i = 0; i < this.lines.length; ++i) {
8035
- var line = this$1.lines[i];
8036
- var span = getMarkedSpanFor(line.markedSpans, this$1);
8037
  if (span.from != null) {
8038
  from = Pos(lineObj ? line : lineNo(line), span.from);
8039
  if (side == -1) { return from }
@@ -8167,21 +8144,17 @@ window.mc4wp.forms.editor = editor;
8167
  // implemented as a meta-marker-object controlling multiple normal
8168
  // markers.
8169
  var SharedTextMarker = function(markers, primary) {
8170
- var this$1 = this;
8171
-
8172
  this.markers = markers;
8173
  this.primary = primary;
8174
  for (var i = 0; i < markers.length; ++i)
8175
- { markers[i].parent = this$1; }
8176
  };
8177
 
8178
  SharedTextMarker.prototype.clear = function () {
8179
- var this$1 = this;
8180
-
8181
  if (this.explicitlyCleared) { return }
8182
  this.explicitlyCleared = true;
8183
  for (var i = 0; i < this.markers.length; ++i)
8184
- { this$1.markers[i].clear(); }
8185
  signalLater(this, "clear");
8186
  };
8187
 
@@ -8324,11 +8297,11 @@ window.mc4wp.forms.editor = editor;
8324
  clipPos: function(pos) {return clipPos(this, pos)},
8325
 
8326
  getCursor: function(start) {
8327
- var range$$1 = this.sel.primary(), pos;
8328
- if (start == null || start == "head") { pos = range$$1.head; }
8329
- else if (start == "anchor") { pos = range$$1.anchor; }
8330
- else if (start == "end" || start == "to" || start === false) { pos = range$$1.to(); }
8331
- else { pos = range$$1.from(); }
8332
  return pos
8333
  },
8334
  listSelections: function() { return this.sel.ranges },
@@ -8351,13 +8324,11 @@ window.mc4wp.forms.editor = editor;
8351
  extendSelections(this, clipPosArray(this, heads), options);
8352
  }),
8353
  setSelections: docMethodOp(function(ranges, primary, options) {
8354
- var this$1 = this;
8355
-
8356
  if (!ranges.length) { return }
8357
  var out = [];
8358
  for (var i = 0; i < ranges.length; i++)
8359
- { out[i] = new Range(clipPos(this$1, ranges[i].anchor),
8360
- clipPos(this$1, ranges[i].head)); }
8361
  if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); }
8362
  setSelection(this, normalizeSelection(this.cm, out, primary), options);
8363
  }),
@@ -8368,23 +8339,19 @@ window.mc4wp.forms.editor = editor;
8368
  }),
8369
 
8370
  getSelection: function(lineSep) {
8371
- var this$1 = this;
8372
-
8373
  var ranges = this.sel.ranges, lines;
8374
  for (var i = 0; i < ranges.length; i++) {
8375
- var sel = getBetween(this$1, ranges[i].from(), ranges[i].to());
8376
  lines = lines ? lines.concat(sel) : sel;
8377
  }
8378
  if (lineSep === false) { return lines }
8379
  else { return lines.join(lineSep || this.lineSeparator()) }
8380
  },
8381
  getSelections: function(lineSep) {
8382
- var this$1 = this;
8383
-
8384
  var parts = [], ranges = this.sel.ranges;
8385
  for (var i = 0; i < ranges.length; i++) {
8386
- var sel = getBetween(this$1, ranges[i].from(), ranges[i].to());
8387
- if (lineSep !== false) { sel = sel.join(lineSep || this$1.lineSeparator()); }
8388
  parts[i] = sel;
8389
  }
8390
  return parts
@@ -8396,16 +8363,14 @@ window.mc4wp.forms.editor = editor;
8396
  this.replaceSelections(dup, collapse, origin || "+input");
8397
  },
8398
  replaceSelections: docMethodOp(function(code, collapse, origin) {
8399
- var this$1 = this;
8400
-
8401
  var changes = [], sel = this.sel;
8402
  for (var i = 0; i < sel.ranges.length; i++) {
8403
- var range$$1 = sel.ranges[i];
8404
- changes[i] = {from: range$$1.from(), to: range$$1.to(), text: this$1.splitLines(code[i]), origin: origin};
8405
  }
8406
  var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse);
8407
  for (var i$1 = changes.length - 1; i$1 >= 0; i$1--)
8408
- { makeChange(this$1, changes[i$1]); }
8409
  if (newSel) { setSelectionReplaceHistory(this, newSel); }
8410
  else if (this.cm) { ensureCursorVisible(this.cm); }
8411
  }),
@@ -8423,7 +8388,12 @@ window.mc4wp.forms.editor = editor;
8423
  for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone; } }
8424
  return {undo: done, redo: undone}
8425
  },
8426
- clearHistory: function() {this.history = new History(this.history.maxGeneration);},
 
 
 
 
 
8427
 
8428
  markClean: function() {
8429
  this.cleanGeneration = this.changeGeneration(true);
@@ -8544,18 +8514,18 @@ window.mc4wp.forms.editor = editor;
8544
  },
8545
  findMarks: function(from, to, filter) {
8546
  from = clipPos(this, from); to = clipPos(this, to);
8547
- var found = [], lineNo$$1 = from.line;
8548
  this.iter(from.line, to.line + 1, function (line) {
8549
  var spans = line.markedSpans;
8550
  if (spans) { for (var i = 0; i < spans.length; i++) {
8551
  var span = spans[i];
8552
- if (!(span.to != null && lineNo$$1 == from.line && from.ch >= span.to ||
8553
- span.from == null && lineNo$$1 != from.line ||
8554
- span.from != null && lineNo$$1 == to.line && span.from >= to.ch) &&
8555
  (!filter || filter(span.marker)))
8556
  { found.push(span.marker.parent || span.marker); }
8557
  } }
8558
- ++lineNo$$1;
8559
  });
8560
  return found
8561
  },
@@ -8570,14 +8540,14 @@ window.mc4wp.forms.editor = editor;
8570
  },
8571
 
8572
  posFromIndex: function(off) {
8573
- var ch, lineNo$$1 = this.first, sepSize = this.lineSeparator().length;
8574
  this.iter(function (line) {
8575
  var sz = line.text.length + sepSize;
8576
  if (sz > off) { ch = off; return true }
8577
  off -= sz;
8578
- ++lineNo$$1;
8579
  });
8580
- return clipPos(this, Pos(lineNo$$1, ch))
8581
  },
8582
  indexFromPos: function (coords) {
8583
  coords = clipPos(this, coords);
@@ -8616,15 +8586,13 @@ window.mc4wp.forms.editor = editor;
8616
  return copy
8617
  },
8618
  unlinkDoc: function(other) {
8619
- var this$1 = this;
8620
-
8621
  if (other instanceof CodeMirror) { other = other.doc; }
8622
  if (this.linked) { for (var i = 0; i < this.linked.length; ++i) {
8623
- var link = this$1.linked[i];
8624
  if (link.doc != other) { continue }
8625
- this$1.linked.splice(i, 1);
8626
- other.unlinkDoc(this$1);
8627
- detachSharedMarkers(findSharedMarkers(this$1));
8628
  break
8629
  } }
8630
  // If the histories were shared, split them again
@@ -8676,28 +8644,39 @@ window.mc4wp.forms.editor = editor;
8676
  // and insert it.
8677
  if (files && files.length && window.FileReader && window.File) {
8678
  var n = files.length, text = Array(n), read = 0;
8679
- var loadFile = function (file, i) {
8680
- if (cm.options.allowDropFileTypes &&
8681
- indexOf(cm.options.allowDropFileTypes, file.type) == -1)
8682
- { return }
8683
-
8684
- var reader = new FileReader;
8685
- reader.onload = operation(cm, function () {
8686
- var content = reader.result;
8687
- if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) { content = ""; }
8688
- text[i] = content;
8689
- if (++read == n) {
8690
  pos = clipPos(cm.doc, pos);
8691
  var change = {from: pos, to: pos,
8692
- text: cm.doc.splitLines(text.join(cm.doc.lineSeparator())),
 
8693
  origin: "paste"};
8694
  makeChange(cm.doc, change);
8695
  setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change)));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8696
  }
8697
- });
 
 
8698
  reader.readAsText(file);
8699
  };
8700
- for (var i = 0; i < n; ++i) { loadFile(files[i], i); }
8701
  } else { // Normal drop
8702
  // Don't do a replace if the drop happened inside of the selected text.
8703
  if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {
@@ -8922,18 +8901,18 @@ window.mc4wp.forms.editor = editor;
8922
  return keymap
8923
  }
8924
 
8925
- function lookupKey(key, map$$1, handle, context) {
8926
- map$$1 = getKeyMap(map$$1);
8927
- var found = map$$1.call ? map$$1.call(key, context) : map$$1[key];
8928
  if (found === false) { return "nothing" }
8929
  if (found === "...") { return "multi" }
8930
  if (found != null && handle(found)) { return "handled" }
8931
 
8932
- if (map$$1.fallthrough) {
8933
- if (Object.prototype.toString.call(map$$1.fallthrough) != "[object Array]")
8934
- { return lookupKey(key, map$$1.fallthrough, handle, context) }
8935
- for (var i = 0; i < map$$1.fallthrough.length; i++) {
8936
- var result = lookupKey(key, map$$1.fallthrough[i], handle, context);
8937
  if (result) { return result }
8938
  }
8939
  }
@@ -9007,6 +8986,7 @@ window.mc4wp.forms.editor = editor;
9007
 
9008
  function endOfLine(visually, cm, lineObj, lineNo, dir) {
9009
  if (visually) {
 
9010
  var order = getOrder(lineObj, cm.doc.direction);
9011
  if (order) {
9012
  var part = dir < 0 ? lst(order) : order[0];
@@ -9377,6 +9357,8 @@ window.mc4wp.forms.editor = editor;
9377
  if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
9378
  { cm.replaceSelection("", null, "cut"); }
9379
  }
 
 
9380
 
9381
  // Turn mouse into crosshair when Alt is held on Mac.
9382
  if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className))
@@ -9608,11 +9590,11 @@ window.mc4wp.forms.editor = editor;
9608
  start = posFromMouse(cm, event, true, true);
9609
  ourIndex = -1;
9610
  } else {
9611
- var range$$1 = rangeForUnit(cm, start, behavior.unit);
9612
  if (behavior.extend)
9613
- { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }
9614
  else
9615
- { ourRange = range$$1; }
9616
  }
9617
 
9618
  if (!behavior.addNew) {
@@ -9655,14 +9637,14 @@ window.mc4wp.forms.editor = editor;
9655
  cm.scrollIntoView(pos);
9656
  } else {
9657
  var oldRange = ourRange;
9658
- var range$$1 = rangeForUnit(cm, pos, behavior.unit);
9659
  var anchor = oldRange.anchor, head;
9660
- if (cmp(range$$1.anchor, anchor) > 0) {
9661
- head = range$$1.head;
9662
- anchor = minPos(oldRange.from(), range$$1.anchor);
9663
  } else {
9664
- head = range$$1.anchor;
9665
- anchor = maxPos(oldRange.to(), range$$1.head);
9666
  }
9667
  var ranges$1 = startSel.ranges.slice(0);
9668
  ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));
@@ -9724,17 +9706,17 @@ window.mc4wp.forms.editor = editor;
9724
 
9725
  // Used when mouse-selecting to adjust the anchor to the proper side
9726
  // of a bidi jump depending on the visual position of the head.
9727
- function bidiSimplify(cm, range$$1) {
9728
- var anchor = range$$1.anchor;
9729
- var head = range$$1.head;
9730
  var anchorLine = getLine(cm.doc, anchor.line);
9731
- if (cmp(anchor, head) == 0 && anchor.sticky == head.sticky) { return range$$1 }
9732
  var order = getOrder(anchorLine);
9733
- if (!order) { return range$$1 }
9734
  var index = getBidiPartAt(order, anchor.ch, anchor.sticky), part = order[index];
9735
- if (part.from != anchor.ch && part.to != anchor.ch) { return range$$1 }
9736
  var boundary = index + ((part.from == anchor.ch) == (part.level != 1) ? 0 : 1);
9737
- if (boundary == 0 || boundary == order.length) { return range$$1 }
9738
 
9739
  // Compute the relative visual position of the head compared to the
9740
  // anchor (<0 is to the left, >0 to the right)
@@ -9753,7 +9735,7 @@ window.mc4wp.forms.editor = editor;
9753
  var usePart = order[boundary + (leftSide ? -1 : 0)];
9754
  var from = leftSide == (usePart.level == 1);
9755
  var ch = from ? usePart.from : usePart.to, sticky = from ? "after" : "before";
9756
- return anchor.ch == ch && anchor.sticky == sticky ? range$$1 : new Range(new Pos(anchor.line, ch, sticky), head)
9757
  }
9758
 
9759
 
@@ -10045,10 +10027,10 @@ window.mc4wp.forms.editor = editor;
10045
  { onBlur(this); }
10046
 
10047
  for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))
10048
- { optionHandlers[opt](this$1, options[opt], Init); } }
10049
  maybeUpdateLineNumberWidth(this);
10050
  if (options.finishInit) { options.finishInit(this); }
10051
- for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }
10052
  endOperation(this);
10053
  // Suppress optimizelegibility in Webkit, since it breaks text
10054
  // measuring on line wrapping boundaries.
@@ -10082,6 +10064,9 @@ window.mc4wp.forms.editor = editor;
10082
  // which point we can't mess with it anymore. Context menu is
10083
  // handled in onMouseDown for these browsers.
10084
  on(d.scroller, "contextmenu", function (e) { return onContextMenu(cm, e); });
 
 
 
10085
 
10086
  // Used to suppress mouse event handling when a touch happens
10087
  var touchFinished, prevTouch = {end: 0};
@@ -10270,9 +10255,9 @@ window.mc4wp.forms.editor = editor;
10270
  var updateInput = cm.curOp.updateInput;
10271
  // Normal behavior is to insert the new text into every selection
10272
  for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) {
10273
- var range$$1 = sel.ranges[i$1];
10274
- var from = range$$1.from(), to = range$$1.to();
10275
- if (range$$1.empty()) {
10276
  if (deleted && deleted > 0) // Handle deletion
10277
  { from = Pos(from.line, from.ch - deleted); }
10278
  else if (cm.state.overwrite && !paste) // Handle overwrite
@@ -10310,21 +10295,21 @@ window.mc4wp.forms.editor = editor;
10310
  var sel = cm.doc.sel;
10311
 
10312
  for (var i = sel.ranges.length - 1; i >= 0; i--) {
10313
- var range$$1 = sel.ranges[i];
10314
- if (range$$1.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range$$1.head.line)) { continue }
10315
- var mode = cm.getModeAt(range$$1.head);
10316
  var indented = false;
10317
  if (mode.electricChars) {
10318
  for (var j = 0; j < mode.electricChars.length; j++)
10319
  { if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {
10320
- indented = indentLine(cm, range$$1.head.line, "smart");
10321
  break
10322
  } }
10323
  } else if (mode.electricInput) {
10324
- if (mode.electricInput.test(getLine(cm.doc, range$$1.head.line).text.slice(0, range$$1.head.ch)))
10325
- { indented = indentLine(cm, range$$1.head.line, "smart"); }
10326
  }
10327
- if (indented) { signalLater(cm, "electricInput", cm, range$$1.head.line); }
10328
  }
10329
  }
10330
 
@@ -10389,13 +10374,13 @@ window.mc4wp.forms.editor = editor;
10389
  getOption: function(option) {return this.options[option]},
10390
  getDoc: function() {return this.doc},
10391
 
10392
- addKeyMap: function(map$$1, bottom) {
10393
- this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map$$1));
10394
  },
10395
- removeKeyMap: function(map$$1) {
10396
  var maps = this.state.keyMaps;
10397
  for (var i = 0; i < maps.length; ++i)
10398
- { if (maps[i] == map$$1 || maps[i].name == map$$1) {
10399
  maps.splice(i, 1);
10400
  return true
10401
  } }
@@ -10412,15 +10397,13 @@ window.mc4wp.forms.editor = editor;
10412
  regChange(this);
10413
  }),
10414
  removeOverlay: methodOp(function(spec) {
10415
- var this$1 = this;
10416
-
10417
  var overlays = this.state.overlays;
10418
  for (var i = 0; i < overlays.length; ++i) {
10419
  var cur = overlays[i].modeSpec;
10420
  if (cur == spec || typeof spec == "string" && cur.name == spec) {
10421
  overlays.splice(i, 1);
10422
- this$1.state.modeGen++;
10423
- regChange(this$1);
10424
  return
10425
  }
10426
  }
@@ -10434,24 +10417,22 @@ window.mc4wp.forms.editor = editor;
10434
  if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }
10435
  }),
10436
  indentSelection: methodOp(function(how) {
10437
- var this$1 = this;
10438
-
10439
  var ranges = this.doc.sel.ranges, end = -1;
10440
  for (var i = 0; i < ranges.length; i++) {
10441
- var range$$1 = ranges[i];
10442
- if (!range$$1.empty()) {
10443
- var from = range$$1.from(), to = range$$1.to();
10444
  var start = Math.max(end, from.line);
10445
- end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;
10446
  for (var j = start; j < end; ++j)
10447
- { indentLine(this$1, j, how); }
10448
- var newRanges = this$1.doc.sel.ranges;
10449
  if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)
10450
- { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }
10451
- } else if (range$$1.head.line > end) {
10452
- indentLine(this$1, range$$1.head.line, how, true);
10453
- end = range$$1.head.line;
10454
- if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }
10455
  }
10456
  }
10457
  }),
@@ -10493,8 +10474,6 @@ window.mc4wp.forms.editor = editor;
10493
  },
10494
 
10495
  getHelpers: function(pos, type) {
10496
- var this$1 = this;
10497
-
10498
  var found = [];
10499
  if (!helpers.hasOwnProperty(type)) { return found }
10500
  var help = helpers[type], mode = this.getModeAt(pos);
@@ -10512,7 +10491,7 @@ window.mc4wp.forms.editor = editor;
10512
  }
10513
  for (var i$1 = 0; i$1 < help._global.length; i$1++) {
10514
  var cur = help._global[i$1];
10515
- if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)
10516
  { found.push(cur.val); }
10517
  }
10518
  return found
@@ -10525,10 +10504,10 @@ window.mc4wp.forms.editor = editor;
10525
  },
10526
 
10527
  cursorCoords: function(start, mode) {
10528
- var pos, range$$1 = this.doc.sel.primary();
10529
- if (start == null) { pos = range$$1.head; }
10530
  else if (typeof start == "object") { pos = clipPos(this.doc, start); }
10531
- else { pos = start ? range$$1.from() : range$$1.to(); }
10532
  return cursorCoords(this, pos, mode || "page")
10533
  },
10534
 
@@ -10612,13 +10591,11 @@ window.mc4wp.forms.editor = editor;
10612
  triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),
10613
 
10614
  findPosH: function(from, amount, unit, visually) {
10615
- var this$1 = this;
10616
-
10617
  var dir = 1;
10618
  if (amount < 0) { dir = -1; amount = -amount; }
10619
  var cur = clipPos(this.doc, from);
10620
  for (var i = 0; i < amount; ++i) {
10621
- cur = findPosH(this$1.doc, cur, dir, unit, visually);
10622
  if (cur.hitSide) { break }
10623
  }
10624
  return cur
@@ -10627,11 +10604,11 @@ window.mc4wp.forms.editor = editor;
10627
  moveH: methodOp(function(dir, unit) {
10628
  var this$1 = this;
10629
 
10630
- this.extendSelectionsBy(function (range$$1) {
10631
- if (this$1.display.shift || this$1.doc.extend || range$$1.empty())
10632
- { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }
10633
  else
10634
- { return dir < 0 ? range$$1.from() : range$$1.to() }
10635
  }, sel_move);
10636
  }),
10637
 
@@ -10640,23 +10617,21 @@ window.mc4wp.forms.editor = editor;
10640
  if (sel.somethingSelected())
10641
  { doc.replaceSelection("", null, "+delete"); }
10642
  else
10643
- { deleteNearSelection(this, function (range$$1) {
10644
- var other = findPosH(doc, range$$1.head, dir, unit, false);
10645
- return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}
10646
  }); }
10647
  }),
10648
 
10649
  findPosV: function(from, amount, unit, goalColumn) {
10650
- var this$1 = this;
10651
-
10652
  var dir = 1, x = goalColumn;
10653
  if (amount < 0) { dir = -1; amount = -amount; }
10654
  var cur = clipPos(this.doc, from);
10655
  for (var i = 0; i < amount; ++i) {
10656
- var coords = cursorCoords(this$1, cur, "div");
10657
  if (x == null) { x = coords.left; }
10658
  else { coords.left = x; }
10659
- cur = findPosV(this$1, coords, dir, unit);
10660
  if (cur.hitSide) { break }
10661
  }
10662
  return cur
@@ -10667,14 +10642,14 @@ window.mc4wp.forms.editor = editor;
10667
 
10668
  var doc = this.doc, goals = [];
10669
  var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();
10670
- doc.extendSelectionsBy(function (range$$1) {
10671
  if (collapse)
10672
- { return dir < 0 ? range$$1.from() : range$$1.to() }
10673
- var headPos = cursorCoords(this$1, range$$1.head, "div");
10674
- if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }
10675
  goals.push(headPos.left);
10676
  var pos = findPosV(this$1, headPos, dir, unit);
10677
- if (unit == "page" && range$$1 == doc.sel.primary())
10678
  { addToScrollTop(this$1, charCoords(this$1, pos, "div").top - headPos.top); }
10679
  return pos
10680
  }, sel_move);
@@ -10721,22 +10696,22 @@ window.mc4wp.forms.editor = editor;
10721
  clientHeight: displayHeight(this), clientWidth: displayWidth(this)}
10722
  },
10723
 
10724
- scrollIntoView: methodOp(function(range$$1, margin) {
10725
- if (range$$1 == null) {
10726
- range$$1 = {from: this.doc.sel.primary().head, to: null};
10727
  if (margin == null) { margin = this.options.cursorScrollMargin; }
10728
- } else if (typeof range$$1 == "number") {
10729
- range$$1 = {from: Pos(range$$1, 0), to: null};
10730
- } else if (range$$1.from == null) {
10731
- range$$1 = {from: range$$1, to: null};
10732
  }
10733
- if (!range$$1.to) { range$$1.to = range$$1.from; }
10734
- range$$1.margin = margin || 0;
10735
 
10736
- if (range$$1.from.line != null) {
10737
- scrollToRange(this, range$$1);
10738
  } else {
10739
- scrollToCoordsRange(this, range$$1.from, range$$1.to, range$$1.margin);
10740
  }
10741
  }),
10742
 
@@ -10747,11 +10722,11 @@ window.mc4wp.forms.editor = editor;
10747
  if (width != null) { this.display.wrapper.style.width = interpret(width); }
10748
  if (height != null) { this.display.wrapper.style.height = interpret(height); }
10749
  if (this.options.lineWrapping) { clearLineMeasurementCache(this); }
10750
- var lineNo$$1 = this.display.viewFrom;
10751
- this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {
10752
  if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)
10753
- { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, "widget"); break } } }
10754
- ++lineNo$$1;
10755
  });
10756
  this.curOp.forceUpdate = true;
10757
  signal(this, "refresh", this);
@@ -10822,8 +10797,9 @@ window.mc4wp.forms.editor = editor;
10822
  var oldPos = pos;
10823
  var origDir = dir;
10824
  var lineObj = getLine(doc, pos.line);
 
10825
  function findNextLine() {
10826
- var l = pos.line + dir;
10827
  if (l < doc.first || l >= doc.first + doc.size) { return false }
10828
  pos = new Pos(l, pos.ch, pos.sticky);
10829
  return lineObj = getLine(doc, l)
@@ -10837,7 +10813,7 @@ window.mc4wp.forms.editor = editor;
10837
  }
10838
  if (next == null) {
10839
  if (!boundToLine && findNextLine())
10840
- { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }
10841
  else
10842
  { return false }
10843
  } else {
@@ -11022,8 +10998,8 @@ window.mc4wp.forms.editor = editor;
11022
  var end = to.line < cm.display.viewTo && posToDOM(cm, to);
11023
  if (!end) {
11024
  var measure = view[view.length - 1].measure;
11025
- var map$$1 = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map;
11026
- end = {node: map$$1[map$$1.length - 1], offset: map$$1[map$$1.length - 2] - map$$1[map$$1.length - 3]};
11027
  }
11028
 
11029
  if (!start || !end) {
@@ -11312,11 +11288,11 @@ window.mc4wp.forms.editor = editor;
11312
  addText(cmText);
11313
  return
11314
  }
11315
- var markerID = node.getAttribute("cm-marker"), range$$1;
11316
  if (markerID) {
11317
  var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));
11318
- if (found.length && (range$$1 = found[0].find(0)))
11319
- { addText(getBetween(cm.doc, range$$1.from, range$$1.to).join(lineSep)); }
11320
  return
11321
  }
11322
  if (node.getAttribute("contenteditable") == "false") { return }
@@ -11384,13 +11360,13 @@ window.mc4wp.forms.editor = editor;
11384
 
11385
  function find(textNode, topNode, offset) {
11386
  for (var i = -1; i < (maps ? maps.length : 0); i++) {
11387
- var map$$1 = i < 0 ? measure.map : maps[i];
11388
- for (var j = 0; j < map$$1.length; j += 3) {
11389
- var curNode = map$$1[j + 2];
11390
  if (curNode == textNode || curNode == topNode) {
11391
  var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);
11392
- var ch = map$$1[j] + offset;
11393
- if (offset < 0 || curNode != textNode) { ch = map$$1[j + (offset ? 1 : 0)]; }
11394
  return Pos(line, ch)
11395
  }
11396
  }
@@ -11914,7 +11890,7 @@ window.mc4wp.forms.editor = editor;
11914
 
11915
  addLegacyProps(CodeMirror);
11916
 
11917
- CodeMirror.version = "5.49.0";
11918
 
11919
  return CodeMirror;
11920
 
@@ -17161,4 +17137,3 @@ exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate :
17161
  };
17162
  }).call(this,require("timers").setImmediate,require("timers").clearImmediate)
17163
  },{"process/browser.js":48,"timers":49}]},{},[13]);
17164
- })();
1
+ (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2
  'use strict';
3
 
4
  var i18n = window.mc4wp_forms_i18n;
11
  // ucfirst
12
  var fieldType = config.type;
13
  fieldType = fieldType.charAt(0).toUpperCase() + fieldType.slice(1);
14
+ return m('div', [m('label', i18n.fieldType), m('span', fieldType)]);
15
  };
16
 
17
  r.label = function (config) {
18
  // label row
19
+ return m('div', [m('label', i18n.fieldLabel), m('input.widefat', {
20
+ type: 'text',
21
  value: config.label,
22
  onchange: function onchange(evt) {
23
+ config.label = evt.target.value;
24
  },
25
  placeholder: config.title
26
  })]);
28
 
29
  r.value = function (config) {
30
  var isHidden = config.type === 'hidden';
31
+ return m('div', [m('label', [isHidden ? i18n.value : i18n.initialValue, ' ', isHidden ? '' : m('small', {
32
+ style: 'float: right; font-weight: normal;'
33
+ }, i18n.optional)]), m('input.widefat', {
34
+ type: 'text',
35
  value: config.value,
36
  onchange: function onchange(evt) {
37
+ config.value = evt.target.value;
38
  }
39
  }), isHidden ? '' : m('p.help', i18n.valueHelp)]);
40
  };
43
  return m('div', [m('div.row', [m('div.col.col-3', [m('label', i18n.min), m('input', {
44
  type: 'number',
45
  onchange: function onchange(evt) {
46
+ config.min = evt.target.value;
47
  }
48
  })]), m('div.col.col-3', [m('label', i18n.max), m('input', {
49
  type: 'number',
50
  onchange: function onchange(evt) {
51
+ config.max = evt.target.value;
52
  }
53
  })])])]);
54
  };
58
  type: 'checkbox',
59
  checked: config.required,
60
  onchange: function onchange(evt) {
61
+ config.required = evt.target.checked;
62
  }
63
  };
64
  var desc;
73
  };
74
 
75
  r.placeholder = function (config) {
76
+ return m('div', [m('label', [i18n.placeholder, ' ', m('small', {
77
+ style: 'float: right; font-weight: normal;'
78
+ }, i18n.optional)]), m('input.widefat', {
79
+ type: 'text',
80
  value: config.placeholder,
81
  onchange: function onchange(evt) {
82
+ config.placeholder = evt.target.value;
83
  },
84
+ placeholder: ''
85
+ }), m('p.help', i18n.placeholderHelp)]);
86
  };
87
 
88
  r.useParagraphs = function (config) {
90
  type: 'checkbox',
91
  checked: config.wrap,
92
  onchange: function onchange(evt) {
93
+ config.wrap = evt.target.checked;
94
  }
95
  }), i18n.wrapInParagraphTags])]);
96
  };
114
  return m('div', [m('label', i18n.choiceType), m('select', {
115
  value: config.type,
116
  onchange: function onchange(evt) {
117
+ config.type = evt.target.value;
118
  }
119
  }, options)]);
120
  };
121
 
122
  r.choices = function (config) {
123
  var html = [];
124
+ html.push(m('div', [m('label', i18n.choices), m('div.limit-height', [m('table', config.choices.map(function (choice, index) {
125
  return m('tr', {
126
  'data-id': index
127
  }, [m('td.cb', m('input', {
149
  value: choice.label,
150
  placeholder: choice.title,
151
  onchange: function onchange(evt) {
152
+ choice.label = evt.target.value;
153
  }
154
  })), m('td', m('span', {
155
+ title: i18n.remove,
156
  "class": 'dashicons dashicons-no-alt hover-activated',
157
+ onclick: function (key) {
158
  this.choices().splice(key, 1);
159
  }.bind(config, index)
160
  }, ''))]);
166
 
167
  r.linkToTerms = function (config) {
168
  // label row
169
+ return m('div', [m('label', i18n.agreeToTermsLink), m('input.widefat', {
170
+ type: 'text',
171
  value: config.link,
172
  onchange: function onchange(evt) {
173
+ config.link = evt.target.value;
174
  },
175
  placeholder: 'https://...'
176
  })]);
189
  forms.render = function (config) {
190
  var type = config.type;
191
 
192
+ if (typeof forms[type] === 'function') {
193
  return forms[type](config);
194
  }
195
 
256
 
257
  var setAttributes = function setAttributes(vnode) {
258
  if (vnode.dom.checked) {
259
+ vnode.dom.setAttribute('checked', 'true');
260
  }
261
 
262
  if (vnode.dom.value) {
264
  }
265
 
266
  if (vnode.dom.selected) {
267
+ vnode.dom.setAttribute('selected', 'true');
268
  }
269
  };
270
 
275
  * @returns {*}
276
  */
277
 
278
+ generators.select = function (config) {
279
  var attributes = {
280
  name: config.name,
281
  required: config.required
288
 
289
  return m('option', {
290
  value: choice.value !== choice.label ? choice.value : undefined,
291
+ selected: choice.selected,
292
  oncreate: setAttributes
293
  }, choice.label);
294
  });
296
 
297
  if (placeholder.length > 0) {
298
  options.unshift(m('option', {
299
+ disabled: true,
300
+ value: '',
301
+ selected: !hasSelection,
302
  oncreate: setAttributes
303
  }, placeholder));
304
  }
312
  if (config.link.length > 0) {
313
  label = m('a', {
314
  href: config.link,
315
+ target: '_blank'
316
  }, config.label);
317
  } else {
318
  label = config.label;
333
  */
334
 
335
 
336
+ generators.checkbox = function (config) {
337
  return config.choices.map(function (choice) {
338
  var name = config.name + (config.type === 'checkbox' ? '[]' : '');
339
  var required = config.required && config.type === 'radio';
348
  });
349
  };
350
 
351
+ generators.radio = generators.checkbox;
352
  /**
353
  * Generates a default field
354
  *
358
  * @returns {*}
359
  */
360
 
361
+ generators["default"] = function (config) {
362
  var attributes = {
363
  type: config.type
364
  };
397
 
398
  function generate(config) {
399
  var labelAtts = {};
400
+ var label = config.label.length > 0 && config.showLabel ? m('label', labelAtts, config.label) : '';
401
+ var field = typeof generators[config.type] === 'function' ? generators[config.type](config) : generators["default"](config);
402
  var htmlTemplate = config.wrap ? m('p', [label, field]) : [label, field]; // render in vdom
403
 
404
  var vdom = document.createElement('div');
405
  m.render(vdom, htmlTemplate); // prettify html
406
 
407
  var html = htmlutil.prettyPrint(vdom.innerHTML);
408
+ return html + '\n';
409
  }
410
 
411
  module.exports = generate;
472
  // build DOM for fields choice
473
  var fieldCategories = fields.getCategories();
474
  var availableFields = fields.getAll();
475
+ var fieldsChoice = m('div.available-fields.small-margin', [m('h4', i18n.chooseField), fieldCategories.map(function (category) {
476
  var categoryFields = availableFields.filter(function (f) {
477
  return f.category === category;
478
  });
481
  return;
482
  }
483
 
484
+ return m('div.tiny-margin', [m('strong', category), // render fields
485
  categoryFields.map(function (field) {
486
+ var className = 'button';
487
 
488
  if (field.forceRequired) {
489
+ className += ' is-required';
490
  }
491
 
492
  var inForm = field.inFormContent;
493
 
494
  if (inForm !== null) {
495
+ className += ' ' + (inForm ? 'in-form' : 'not-in-form');
496
  }
497
 
498
+ return m('button', {
499
  className: className,
500
  type: 'button',
501
  onclick: function onclick(evt) {
512
  form = m(Overlay, {
513
  onClose: setActiveField
514
  }, // field wizard
515
+ m('div.field-wizard', [// heading
516
+ m('h3', [fieldConfig.title, fieldConfig.forceRequired ? m('span.red', '*') : '', fieldConfig.name.length ? m('code', fieldConfig.name) : '']), // help text
517
  fieldConfig.help.length ? m('p', m.trust(fieldConfig.help)) : '', // actual form
518
  forms.render(fieldConfig), // add to form button
519
+ m('p', [m('button', {
520
+ "class": 'button-primary',
521
+ type: 'button',
522
  onkeydown: function onkeydown(evt) {
523
  if (evt.keyCode === 13) {
524
  createFieldHTMLAndAddToForm();
550
  var ajaxurl = window.mc4wp_vars.ajaxurl;
551
  var i18n = window.mc4wp_forms_i18n;
552
  var mailchimp = window.mc4wp_vars.mailchimp;
553
+ var countries = window.mc4wp_vars.countries;
554
  /**
555
  * Array of registered fields
556
  *
592
 
593
  function getFieldType(type) {
594
  var map = {
595
+ phone: 'tel',
596
+ dropdown: 'select',
597
+ checkboxes: 'checkbox',
598
+ birthday: 'text'
599
  };
600
+ return typeof map[type] !== 'undefined' ? map[type] : type;
601
  }
602
  /**
603
  * Register the various fields for a merge var
654
  type: 'select',
655
  mailchimpType: 'address',
656
  title: i18n.country,
657
+ choices: countries
658
  }, false);
659
  }
660
 
712
 
713
 
714
  function registerListsFields(lists) {
715
+ var url = ajaxurl + '?action=mc4wp_get_list_details&ids=' + lists.map(function (l) {
716
  return l.id;
717
  }).join(',');
718
  m.request({
719
  url: url,
720
+ method: 'GET'
721
  }).then(function (lists) {
722
  reset();
723
  lists.forEach(registerListFields);
738
  register(category, {
739
  name: '',
740
  value: i18n.subscribe,
741
+ type: 'submit',
742
  title: i18n.submitButton
743
  }, true); // register lists choice field
744
 
757
  acceptsMultipleValues: true
758
  }, true);
759
  choices = {
760
+ subscribe: 'Subscribe',
761
+ unsubscribe: 'Unsubscribe'
762
  };
763
  register(category, {
764
  name: '_mc4wp_action',
771
  register(category, {
772
  name: 'AGREE_TO_TERMS',
773
  value: 1,
774
+ type: 'terms-checkbox',
775
  label: i18n.agreeToTerms,
776
  title: i18n.agreeToTermsShort,
777
  showLabel: false,
804
  type: data.type,
805
  mailchimpType: data.mailchimpType || null,
806
  label: data.label || data.title || '',
807
+ showLabel: typeof data.showLabel === 'boolean' ? data.showLabel : true,
808
  value: data.value || '',
809
  placeholder: data.placeholder || '',
810
+ required: typeof data.required === 'boolean' ? data.required : false,
811
+ forceRequired: typeof data.forceRequired === 'boolean' ? data.forceRequired : false,
812
+ wrap: typeof data.wrap === 'boolean' ? data.wrap : true,
813
  min: data.min,
814
  max: data.max,
815
  help: data.help || '',
846
  function createChoices(data) {
847
  var choices = [];
848
 
849
+ if (typeof data.map === 'function') {
850
  choices = data.map(function (choiceLabel) {
851
  return new FieldChoice({
852
  label: choiceLabel
872
 
873
 
874
  function register(category, data) {
 
875
  var existingField = getAllWhere('name', data.name).shift(); // a field with the same "name" already exists
876
 
877
  if (existingField) {
905
  } // create Field object
906
 
907
 
908
+ var field = new Field(data);
909
  field.category = category; // add to array
910
 
911
  fields.push(field); // redraw view
 
912
 
913
  timeout && window.clearTimeout(timeout);
914
+ timeout = window.setTimeout(m.redraw, 600); // trigger event
915
 
916
  emit('change');
917
  return field;
972
 
973
  function getCategories() {
974
  return categories.sort(function (a, b) {
975
+ return a !== 'Form fields' ? -1 : 1;
976
  });
977
  }
978
  /**
995
 
996
 
997
  module.exports = {
998
+ get: get,
999
+ getAll: getAll,
1000
+ getCategories: getCategories,
1001
+ deregister: deregister,
1002
+ register: register,
1003
+ getAllWhere: getAllWhere,
1004
  on: on
1005
  };
1006
 
1107
 
1108
  if (element) {
1109
  window.addEventListener('load', function () {
1110
+ CodeMirror.signal(editor, 'change');
1111
  }); // set domDirty to true everytime the "change" event fires (a lot..)
1112
 
1113
  element.addEventListener('change', function () {
1119
  if (CodeMirror) {
1120
  editor = CodeMirror.fromTextArea(element, {
1121
  selectionPointer: true,
1122
+ mode: 'htmlmixed',
1123
  htmlMode: true,
1124
  autoCloseTags: true,
1125
  autoRefresh: true,
1131
  }); // dispatch regular "change" on element event every time editor changes (IE9+ only)
1132
 
1133
  window.dispatchEvent && editor.on('change', function () {
1134
+ if (typeof Event === 'function') {
1135
  // Create a new 'change' event
1136
  var event = new Event('change', {
1137
  bubbles: true
1160
 
1161
  var fields = require('./fields.js');
1162
 
1163
+ var REGEX_ARRAY_BRACKETS_WITH_KEY = /\[(\w+)\]/g;
1164
+ var REGEX_ARRAY_BRACKETS_EMPTY = /\[\]$/;
1165
  var requiredFieldsInput = document.getElementById('required-fields');
1166
 
1167
  function updateFields() {
1182
  } // query other fields for this address group
1183
 
1184
 
1185
+ var nameGroup = field.name.replace(REGEX_ARRAY_BRACKETS_WITH_KEY, '');
1186
 
1187
  if (editor.query('[name^="' + nameGroup + '"]').length > 0) {
1188
  field.forceRequired = true;
1198
  function findRequiredFields() {
1199
  // query fields required by Mailchimp
1200
  var requiredFields = fields.getAllWhere('forceRequired', true).map(function (f) {
1201
+ return f.name.toUpperCase().replace(REGEX_ARRAY_BRACKETS_WITH_KEY, '.$1');
1202
  }); // query fields in form with [required] attribute
1203
 
1204
  var requiredFieldElements = editor.query('[required]');
1210
  } // replace array brackets with dot style notation
1211
 
1212
 
1213
+ name = name.replace(REGEX_ARRAY_BRACKETS_WITH_KEY, '.$1'); // replace array-style fields
1214
 
1215
+ name = name.replace(REGEX_ARRAY_BRACKETS_EMPTY, ''); // uppercase everything before the .
1216
 
1217
  var pos = name.indexOf('.');
1218
  pos = pos > 0 ? pos : name.length;
1227
  } // events
1228
 
1229
 
1230
+ editor.on('change', helpers.debounce(updateFields, 600));
1231
+ fields.on('change', helpers.debounce(updateFields, 600));
1232
 
1233
  },{"../helpers.js":9,"./fields.js":6,"./form-editor.js":7,"mithril":28}],9:[function(require,module,exports){
1234
  'use strict';
1238
  helpers.debounce = function (func, wait, immediate) {
1239
  var timeout;
1240
  return function () {
1241
+ var context = this;
1242
+ var args = arguments;
1243
  var callNow = immediate && !timeout;
1244
  clearTimeout(timeout);
1245
  timeout = setTimeout(function () {
1293
  }
1294
 
1295
  var groupingsNotice = function groupingsNotice() {
1296
+ var text = 'Your form contains deprecated <code>GROUPINGS</code> fields. <br /><br />Please remove these fields from your form and then re-add them through the available field buttons to make sure your data is getting through to Mailchimp correctly.';
1297
  var formCode = editor.getValue().toLowerCase();
1298
  formCode.indexOf('name="groupings') > -1 ? show('deprecated_groupings', text) : hide('deprecated_groupings');
1299
  };
1304
  return !editor.containsField(f.name.toUpperCase());
1305
  });
1306
  var text = '<strong>Heads up!</strong> Your form is missing list fields that are required in Mailchimp. Either add these fields to your form or mark them as optional in Mailchimp.';
1307
+ text += '<br /><ul class="ul-square" style="margin-bottom: 0;"><li>' + missingFields.map(function (f) {
1308
  return f.title;
1309
  }).join('</li><li>') + '</li></ul>';
1310
  missingFields.length > 0 ? show('required_fields_missing', text) : hide('required_fields_missing');
1373
  var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
1374
  var marginLeft = (windowWidth - element.clientWidth - 40) / 2;
1375
  var marginTop = (windowHeight - element.clientHeight - 40) / 2;
1376
+ element.style.left = (marginLeft > 0 ? marginLeft : 0) + 'px';
1377
+ element.style.top = (marginTop > 0 ? marginTop : 0) + 'px';
1378
  }
1379
 
1380
  function view(vnode) {
1381
+ return [m('div.overlay-wrap', m('div.overlay', {
1382
  oncreate: function oncreate(vnode) {
1383
  element = vnode.dom;
1384
  onWindowResize();
1406
  },{"mithril":28}],12:[function(require,module,exports){
1407
  'use strict';
1408
 
1409
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1410
 
1411
  var context = document.getElementById('mc4wp-admin');
1412
  var listInputs = context.querySelectorAll('.mc4wp-list-input');
1428
  selectedLists = [];
1429
  [].forEach.call(listInputs, function (input) {
1430
  // skip unchecked checkboxes
1431
+ if (typeof input.checked === 'boolean' && !input.checked) {
1432
  return;
1433
  }
1434
 
1435
+ if (_typeof(lists[input.value]) === 'object') {
1436
  selectedLists.push(lists[input.value]);
1437
  }
1438
  });
1565
  if (!tagName ||
1566
  tok.type == "string" && (tok.end != pos.ch || !/[\"\']/.test(tok.string.charAt(tok.string.length - 1)) || tok.string.length == 1) ||
1567
  tok.type == "tag" && tagInfo.close ||
1568
+ tok.string.indexOf("/") == (pos.ch - tok.start - 1) || // match something like <someTagName />
1569
  dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1 ||
1570
  closingTagExists(cm, inner.mode.xmlCurrentContext && inner.mode.xmlCurrentContext(state) || [], tagName, pos, true))
1571
  return CodeMirror.Pass;
2167
  (function (global, factory) {
2168
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
2169
  typeof define === 'function' && define.amd ? define(factory) :
2170
+ (global = global || self, global.CodeMirror = factory());
2171
  }(this, (function () { 'use strict';
2172
 
2173
  // Kludges for bugs and behavior differences that can't be feature
2330
  }
2331
  }
2332
 
2333
+ var Delayed = function() {
2334
+ this.id = null;
2335
+ this.f = null;
2336
+ this.time = 0;
2337
+ this.handler = bind(this.onTimeout, this);
2338
+ };
2339
+ Delayed.prototype.onTimeout = function (self) {
2340
+ self.id = 0;
2341
+ if (self.time <= +new Date) {
2342
+ self.f();
2343
+ } else {
2344
+ setTimeout(self.handler, self.time - +new Date);
2345
+ }
2346
+ };
2347
  Delayed.prototype.set = function (ms, f) {
2348
+ this.f = f;
2349
+ var time = +new Date + ms;
2350
+ if (!this.id || time < this.time) {
2351
+ clearTimeout(this.id);
2352
+ this.id = setTimeout(this.handler, ms);
2353
+ this.time = time;
2354
+ }
2355
  };
2356
 
2357
  function indexOf(array, elt) {
2693
  } else if (emitter.attachEvent) {
2694
  emitter.attachEvent("on" + type, f);
2695
  } else {
2696
+ var map = emitter._handlers || (emitter._handlers = {});
2697
+ map[type] = (map[type] || noHandlers).concat(f);
2698
  }
2699
  };
2700
 
2708
  } else if (emitter.detachEvent) {
2709
  emitter.detachEvent("on" + type, f);
2710
  } else {
2711
+ var map = emitter._handlers, arr = map && map[type];
2712
  if (arr) {
2713
  var index = indexOf(arr, f);
2714
  if (index > -1)
2715
+ { map[type] = arr.slice(0, index).concat(arr.slice(index + 1)); }
2716
  }
2717
  }
2718
  }
2840
  try { return te.selectionStart != te.selectionEnd }
2841
  catch(e) { return false }
2842
  } : function (te) {
2843
+ var range;
2844
+ try {range = te.ownerDocument.selection.createRange();}
2845
  catch(e) {}
2846
+ if (!range || range.parentElement() != te) { return false }
2847
+ return range.compareEndPoints("StartToEnd", range) != 0
2848
  };
2849
 
2850
  var hasCopyEvent = (function () {
2992
  return this.pos > start
2993
  };
2994
  StringStream.prototype.eatSpace = function () {
 
 
2995
  var start = this.pos;
2996
+ while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this.pos; }
2997
  return this.pos > start
2998
  };
2999
  StringStream.prototype.skipToEnd = function () {this.pos = this.string.length;};
3189
  };
3190
 
3191
  Context.prototype.baseToken = function (n) {
 
 
3192
  if (!this.baseTokens) { return null }
3193
  while (this.baseTokens[this.baseTokenPos] <= n)
3194
+ { this.baseTokenPos += 2; }
3195
  var type = this.baseTokens[this.baseTokenPos + 1];
3196
  return {type: type && type.replace(/( |^)overlay .*/, ""),
3197
  size: this.baseTokens[this.baseTokenPos] - n}
3680
  // Test whether there exists a collapsed span that partially
3681
  // overlaps (covers the start or end, but not both) of a new span.
3682
  // Such overlap is not allowed.
3683
+ function conflictingCollapsedRange(doc, lineNo, from, to, marker) {
3684
+ var line = getLine(doc, lineNo);
3685
  var sps = sawCollapsedSpans && line.markedSpans;
3686
  if (sps) { for (var i = 0; i < sps.length; ++i) {
3687
  var sp = sps[i];
4362
 
4363
  function updateLineWidgets(cm, lineView, dims) {
4364
  if (lineView.alignable) { lineView.alignable = null; }
4365
+ var isWidget = classTest("CodeMirror-linewidget");
4366
  for (var node = lineView.node.firstChild, next = (void 0); node; node = next) {
4367
  next = node.nextSibling;
4368
+ if (isWidget.test(node.className)) { lineView.node.removeChild(node); }
 
4369
  }
4370
  insertLineWidgets(cm, lineView, dims);
4371
  }
4395
  if (!line.widgets) { return }
4396
  var wrap = ensureLineWrapped(lineView);
4397
  for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
4398
+ var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget" + (widget.className ? " " + widget.className : ""));
4399
  if (!widget.handleMouseEvents) { node.setAttribute("cm-ignore-events", "true"); }
4400
  positionLineWidget(widget, node, lineView, dims);
4401
  cm.display.input.setUneditable(node);
4583
 
4584
  var nullRect = {left: 0, right: 0, top: 0, bottom: 0};
4585
 
4586
+ function nodeAndOffsetInLineMap(map, ch, bias) {
4587
  var node, start, end, collapse, mStart, mEnd;
4588
  // First, search the line map for the text node corresponding to,
4589
  // or closest to, the target character.
4590
+ for (var i = 0; i < map.length; i += 3) {
4591
+ mStart = map[i];
4592
+ mEnd = map[i + 1];
4593
  if (ch < mStart) {
4594
  start = 0; end = 1;
4595
  collapse = "left";
4596
  } else if (ch < mEnd) {
4597
  start = ch - mStart;
4598
  end = start + 1;
4599
+ } else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) {
4600
  end = mEnd - mStart;
4601
  start = end - 1;
4602
  if (ch >= mEnd) { collapse = "right"; }
4603
  }
4604
  if (start != null) {
4605
+ node = map[i + 2];
4606
  if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right"))
4607
  { collapse = bias; }
4608
  if (bias == "left" && start == 0)
4609
+ { while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) {
4610
+ node = map[(i -= 3) + 2];
4611
  collapse = "left";
4612
  } }
4613
  if (bias == "right" && start == mEnd - mStart)
4614
+ { while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) {
4615
+ node = map[(i += 3) + 2];
4616
  collapse = "right";
4617
  } }
4618
  break
4895
  return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x
4896
  }
4897
 
4898
+ function coordsCharInner(cm, lineObj, lineNo, x, y) {
4899
  // Move y into line-local coordinate space
4900
  y -= heightAtLine(lineObj);
4901
  var preparedMeasure = prepareMeasureForLine(cm, lineObj);
4902
  // When directly calling `measureCharPrepared`, we have to adjust
4903
  // for the widgets at this line.
4904
+ var widgetHeight = widgetTopHeight(lineObj);
4905
  var begin = 0, end = lineObj.text.length, ltr = true;
4906
 
4907
  var order = getOrder(lineObj, cm.doc.direction);
4909
  // which bidi section the coordinates fall into.
4910
  if (order) {
4911
  var part = (cm.options.lineWrapping ? coordsBidiPartWrapped : coordsBidiPart)
4912
+ (cm, lineObj, lineNo, preparedMeasure, order, x, y);
4913
  ltr = part.level != 1;
4914
  // The awkward -1 offsets are needed because findFirst (called
4915
  // on these below) will treat its first bound as inclusive,
4925
  var chAround = null, boxAround = null;
4926
  var ch = findFirst(function (ch) {
4927
  var box = measureCharPrepared(cm, preparedMeasure, ch);
4928
+ box.top += widgetHeight; box.bottom += widgetHeight;
4929
  if (!boxIsAfter(box, x, y, false)) { return false }
4930
  if (box.top <= y && box.left <= x) {
4931
  chAround = ch;
4949
  // left of the character and compare it's vertical position to the
4950
  // coordinates
4951
  sticky = ch == 0 ? "after" : ch == lineObj.text.length ? "before" :
4952
+ (measureCharPrepared(cm, preparedMeasure, ch - (ltr ? 1 : 0)).bottom + widgetHeight <= y) == ltr ?
4953
  "after" : "before";
4954
  // Now get accurate coordinates for this place, in order to get a
4955
  // base X position
4956
+ var coords = cursorCoords(cm, Pos(lineNo, ch, sticky), "line", lineObj, preparedMeasure);
4957
  baseX = coords.left;
4958
  outside = y < coords.top ? -1 : y >= coords.bottom ? 1 : 0;
4959
  }
4960
 
4961
  ch = skipExtendingChars(lineObj.text, ch, 1);
4962
+ return PosWithInfo(lineNo, ch, sticky, outside, x - baseX)
4963
  }
4964
 
4965
+ function coordsBidiPart(cm, lineObj, lineNo, preparedMeasure, order, x, y) {
4966
  // Bidi parts are sorted left-to-right, and in a non-line-wrapping
4967
  // situation, we can take this ordering to correspond to the visual
4968
  // ordering. This finds the first part whose end is after the given
4969
  // coordinates.
4970
  var index = findFirst(function (i) {
4971
  var part = order[i], ltr = part.level != 1;
4972
+ return boxIsAfter(cursorCoords(cm, Pos(lineNo, ltr ? part.to : part.from, ltr ? "before" : "after"),
4973
  "line", lineObj, preparedMeasure), x, y, true)
4974
  }, 0, order.length - 1);
4975
  var part = order[index];
4978
  // that start, move one part back.
4979
  if (index > 0) {
4980
  var ltr = part.level != 1;
4981
+ var start = cursorCoords(cm, Pos(lineNo, ltr ? part.from : part.to, ltr ? "after" : "before"),
4982
  "line", lineObj, preparedMeasure);
4983
  if (boxIsAfter(start, x, y, true) && start.top > y)
4984
  { part = order[index - 1]; }
5118
  try { x = e.clientX - space.left; y = e.clientY - space.top; }
5119
  catch (e) { return null }
5120
  var coords = coordsChar(cm, x, y), line;
5121
+ if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
5122
  var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;
5123
  coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));
5124
  }
5299
 
5300
  for (var i = 0; i < doc.sel.ranges.length; i++) {
5301
  if (!primary && i == doc.sel.primIndex) { continue }
5302
+ var range = doc.sel.ranges[i];
5303
+ if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue }
5304
+ var collapsed = range.empty();
5305
  if (collapsed || cm.options.showCursorWhenSelecting)
5306
+ { drawSelectionCursor(cm, range.head, curFragment); }
5307
  if (!collapsed)
5308
+ { drawSelectionRange(cm, range, selFragment); }
5309
  }
5310
  return result
5311
  }
5332
  function cmpCoords(a, b) { return a.top - b.top || a.left - b.left }
5333
 
5334
  // Draws the given range as a highlighted selection
5335
+ function drawSelectionRange(cm, range, output) {
5336
  var display = cm.display, doc = cm.doc;
5337
  var fragment = document.createDocumentFragment();
5338
  var padding = paddingH(cm.display), leftSide = padding.left;
5401
  return {start: start, end: end}
5402
  }
5403
 
5404
+ var sFrom = range.from(), sTo = range.to();
5405
  if (sFrom.line == sTo.line) {
5406
  drawForLine(sFrom.line, sFrom.ch, sTo.ch);
5407
  } else {
5668
  if (y != null) { cm.curOp.scrollTop = y; }
5669
  }
5670
 
5671
+ function scrollToRange(cm, range) {
5672
  resolveScrollToPos(cm);
5673
+ cm.curOp.scrollToPos = range;
5674
  }
5675
 
5676
  // When an operation has its scrollToPos property set, and another
5678
  // 'simulates' scrolling that position into view in a cheap way, so
5679
  // that the effect of intermediate scroll commands is not ignored.
5680
  function resolveScrollToPos(cm) {
5681
+ var range = cm.curOp.scrollToPos;
5682
+ if (range) {
5683
  cm.curOp.scrollToPos = null;
5684
+ var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);
5685
+ scrollToCoordsRange(cm, from, to, range.margin);
5686
  }
5687
  }
5688
 
5829
  // (when the bar is hidden). If it is still visible, we keep
5830
  // it enabled, if it's hidden, we disable pointer events.
5831
  var box = bar.getBoundingClientRect();
5832
+ var elt = type == "vert" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2)
5833
  : document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1);
5834
+ if (elt != bar) { bar.style.pointerEvents = "none"; }
5835
  else { delay.set(1000, maybeDisable); }
5836
  }
5837
  delay.set(1000, maybeDisable);
6171
  { this.events.push(arguments); }
6172
  };
6173
  DisplayUpdate.prototype.finish = function () {
 
 
6174
  for (var i = 0; i < this.events.length; i++)
6175
+ { signal.apply(null, this.events[i]); }
6176
  };
6177
 
6178
  function maybeClipScrollbars(cm) {
6207
  if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt()) { return }
6208
  snapshot.activeElt.focus();
6209
  if (snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {
6210
+ var sel = window.getSelection(), range = document.createRange();
6211
+ range.setEnd(snapshot.anchorNode, snapshot.anchorOffset);
6212
+ range.collapse(false);
6213
  sel.removeAllRanges();
6214
+ sel.addRange(range);
6215
  sel.extend(snapshot.focusNode, snapshot.focusOffset);
6216
  }
6217
  }
6704
  Selection.prototype.primary = function () { return this.ranges[this.primIndex] };
6705
 
6706
  Selection.prototype.equals = function (other) {
 
 
6707
  if (other == this) { return true }
6708
  if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false }
6709
  for (var i = 0; i < this.ranges.length; i++) {
6710
+ var here = this.ranges[i], there = other.ranges[i];
6711
  if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false }
6712
  }
6713
  return true
6714
  };
6715
 
6716
  Selection.prototype.deepCopy = function () {
 
 
6717
  var out = [];
6718
  for (var i = 0; i < this.ranges.length; i++)
6719
+ { out[i] = new Range(copyPos(this.ranges[i].anchor), copyPos(this.ranges[i].head)); }
6720
  return new Selection(out, this.primIndex)
6721
  };
6722
 
6723
  Selection.prototype.somethingSelected = function () {
 
 
6724
  for (var i = 0; i < this.ranges.length; i++)
6725
+ { if (!this.ranges[i].empty()) { return true } }
6726
  return false
6727
  };
6728
 
6729
  Selection.prototype.contains = function (pos, end) {
 
 
6730
  if (!end) { end = pos; }
6731
  for (var i = 0; i < this.ranges.length; i++) {
6732
+ var range = this.ranges[i];
6733
  if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)
6734
  { return i }
6735
  }
6855
  }
6856
 
6857
  // Perform a change on the document data structure.
6858
+ function updateDoc(doc, change, markedSpans, estimateHeight) {
6859
  function spansFor(n) {return markedSpans ? markedSpans[n] : null}
6860
  function update(line, text, spans) {
6861
+ updateLine(line, text, spans, estimateHeight);
6862
  signalLater(line, "change", line, change);
6863
  }
6864
  function linesFor(start, end) {
6865
  var result = [];
6866
  for (var i = start; i < end; ++i)
6867
+ { result.push(new Line(text[i], spansFor(i), estimateHeight)); }
6868
  return result
6869
  }
6870
 
6888
  update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);
6889
  } else {
6890
  var added$1 = linesFor(1, text.length - 1);
6891
+ added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));
6892
  update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
6893
  doc.insert(from.line + 1, added$1);
6894
  }
7225
  var obj = {
7226
  ranges: sel.ranges,
7227
  update: function(ranges) {
 
 
7228
  this.ranges = [];
7229
  for (var i = 0; i < ranges.length; i++)
7230
+ { this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
7231
  clipPos(doc, ranges[i].head)); }
7232
  },
7233
  origin: options && options.origin
7714
  // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html
7715
 
7716
  function LeafChunk(lines) {
 
 
7717
  this.lines = lines;
7718
  this.parent = null;
7719
  var height = 0;
7720
  for (var i = 0; i < lines.length; ++i) {
7721
+ lines[i].parent = this;
7722
  height += lines[i].height;
7723
  }
7724
  this.height = height;
7729
 
7730
  // Remove the n lines at offset 'at'.
7731
  removeInner: function(at, n) {
 
 
7732
  for (var i = at, e = at + n; i < e; ++i) {
7733
+ var line = this.lines[i];
7734
+ this.height -= line.height;
7735
  cleanUpLine(line);
7736
  signalLater(line, "delete");
7737
  }
7746
  // Insert the given array of lines at offset 'at', count them as
7747
  // having the given height.
7748
  insertInner: function(at, lines, height) {
 
 
7749
  this.height += height;
7750
  this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));
7751
+ for (var i = 0; i < lines.length; ++i) { lines[i].parent = this; }
7752
  },
7753
 
7754
  // Used to iterate over a part of the tree.
7755
  iterN: function(at, n, op) {
 
 
7756
  for (var e = at + n; at < e; ++at)
7757
+ { if (op(this.lines[at])) { return true } }
7758
  }
7759
  };
7760
 
7761
  function BranchChunk(children) {
 
 
7762
  this.children = children;
7763
  var size = 0, height = 0;
7764
  for (var i = 0; i < children.length; ++i) {
7765
  var ch = children[i];
7766
  size += ch.chunkSize(); height += ch.height;
7767
+ ch.parent = this;
7768
  }
7769
  this.size = size;
7770
  this.height = height;
7775
  chunkSize: function() { return this.size },
7776
 
7777
  removeInner: function(at, n) {
 
 
7778
  this.size -= n;
7779
  for (var i = 0; i < this.children.length; ++i) {
7780
+ var child = this.children[i], sz = child.chunkSize();
7781
  if (at < sz) {
7782
  var rm = Math.min(n, sz - at), oldHeight = child.height;
7783
  child.removeInner(at, rm);
7784
+ this.height -= oldHeight - child.height;
7785
+ if (sz == rm) { this.children.splice(i--, 1); child.parent = null; }
7786
  if ((n -= rm) == 0) { break }
7787
  at = 0;
7788
  } else { at -= sz; }
7799
  },
7800
 
7801
  collapse: function(lines) {
7802
+ for (var i = 0; i < this.children.length; ++i) { this.children[i].collapse(lines); }
 
 
7803
  },
7804
 
7805
  insertInner: function(at, lines, height) {
 
 
7806
  this.size += lines.length;
7807
  this.height += height;
7808
  for (var i = 0; i < this.children.length; ++i) {
7809
+ var child = this.children[i], sz = child.chunkSize();
7810
  if (at <= sz) {
7811
  child.insertInner(at, lines, height);
7812
  if (child.lines && child.lines.length > 50) {
7816
  for (var pos = remaining; pos < child.lines.length;) {
7817
  var leaf = new LeafChunk(child.lines.slice(pos, pos += 25));
7818
  child.height -= leaf.height;
7819
+ this.children.splice(++i, 0, leaf);
7820
+ leaf.parent = this;
7821
  }
7822
  child.lines = child.lines.slice(0, remaining);
7823
+ this.maybeSpill();
7824
  }
7825
  break
7826
  }
7852
  },
7853
 
7854
  iterN: function(at, n, op) {
 
 
7855
  for (var i = 0; i < this.children.length; ++i) {
7856
+ var child = this.children[i], sz = child.chunkSize();
7857
  if (at < sz) {
7858
  var used = Math.min(n, sz - at);
7859
  if (child.iterN(at, used, op)) { return true }
7867
  // Line widgets are block elements displayed above or below a line.
7868
 
7869
  var LineWidget = function(doc, node, options) {
 
 
7870
  if (options) { for (var opt in options) { if (options.hasOwnProperty(opt))
7871
+ { this[opt] = options[opt]; } } }
7872
  this.doc = doc;
7873
  this.node = node;
7874
  };
7875
 
7876
  LineWidget.prototype.clear = function () {
 
 
7877
  var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);
7878
  if (no == null || !ws) { return }
7879
+ for (var i = 0; i < ws.length; ++i) { if (ws[i] == this) { ws.splice(i--, 1); } }
7880
  if (!ws.length) { line.widgets = null; }
7881
  var height = widgetHeight(this);
7882
  updateLineHeight(line, Math.max(0, line.height - height));
7959
 
7960
  // Clear the marker.
7961
  TextMarker.prototype.clear = function () {
 
 
7962
  if (this.explicitlyCleared) { return }
7963
  var cm = this.doc.cm, withOp = cm && !cm.curOp;
7964
  if (withOp) { startOperation(cm); }
7968
  }
7969
  var min = null, max = null;
7970
  for (var i = 0; i < this.lines.length; ++i) {
7971
+ var line = this.lines[i];
7972
+ var span = getMarkedSpanFor(line.markedSpans, this);
7973
+ if (cm && !this.collapsed) { regLineChange(cm, lineNo(line), "text"); }
7974
  else if (cm) {
7975
  if (span.to != null) { max = lineNo(line); }
7976
  if (span.from != null) { min = lineNo(line); }
7977
  }
7978
  line.markedSpans = removeMarkedSpan(line.markedSpans, span);
7979
+ if (span.from == null && this.collapsed && !lineIsHidden(this.doc, line) && cm)
7980
  { updateLineHeight(line, textHeight(cm.display)); }
7981
  }
7982
  if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {
7983
+ var visual = visualLine(this.lines[i$1]), len = lineLength(visual);
7984
  if (len > cm.display.maxLineLength) {
7985
  cm.display.maxLine = visual;
7986
  cm.display.maxLineLength = len;
8006
  // Pos objects returned contain a line object, rather than a line
8007
  // number (used to prevent looking up the same line twice).
8008
  TextMarker.prototype.find = function (side, lineObj) {
 
 
8009
  if (side == null && this.type == "bookmark") { side = 1; }
8010
  var from, to;
8011
  for (var i = 0; i < this.lines.length; ++i) {
8012
+ var line = this.lines[i];
8013
+ var span = getMarkedSpanFor(line.markedSpans, this);
8014
  if (span.from != null) {
8015
  from = Pos(lineObj ? line : lineNo(line), span.from);
8016
  if (side == -1) { return from }
8144
  // implemented as a meta-marker-object controlling multiple normal
8145
  // markers.
8146
  var SharedTextMarker = function(markers, primary) {
 
 
8147
  this.markers = markers;
8148
  this.primary = primary;
8149
  for (var i = 0; i < markers.length; ++i)
8150
+ { markers[i].parent = this; }
8151
  };
8152
 
8153
  SharedTextMarker.prototype.clear = function () {
 
 
8154
  if (this.explicitlyCleared) { return }
8155
  this.explicitlyCleared = true;
8156
  for (var i = 0; i < this.markers.length; ++i)
8157
+ { this.markers[i].clear(); }
8158
  signalLater(this, "clear");
8159
  };
8160
 
8297
  clipPos: function(pos) {return clipPos(this, pos)},
8298
 
8299
  getCursor: function(start) {
8300
+ var range = this.sel.primary(), pos;
8301
+ if (start == null || start == "head") { pos = range.head; }
8302
+ else if (start == "anchor") { pos = range.anchor; }
8303
+ else if (start == "end" || start == "to" || start === false) { pos = range.to(); }
8304
+ else { pos = range.from(); }
8305
  return pos
8306
  },
8307
  listSelections: function() { return this.sel.ranges },
8324
  extendSelections(this, clipPosArray(this, heads), options);
8325
  }),
8326
  setSelections: docMethodOp(function(ranges, primary, options) {
 
 
8327
  if (!ranges.length) { return }
8328
  var out = [];
8329
  for (var i = 0; i < ranges.length; i++)
8330
+ { out[i] = new Range(clipPos(this, ranges[i].anchor),
8331
+ clipPos(this, ranges[i].head)); }
8332
  if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); }
8333
  setSelection(this, normalizeSelection(this.cm, out, primary), options);
8334
  }),
8339
  }),
8340
 
8341
  getSelection: function(lineSep) {
 
 
8342
  var ranges = this.sel.ranges, lines;
8343
  for (var i = 0; i < ranges.length; i++) {
8344
+ var sel = getBetween(this, ranges[i].from(), ranges[i].to());
8345
  lines = lines ? lines.concat(sel) : sel;
8346
  }
8347
  if (lineSep === false) { return lines }
8348
  else { return lines.join(lineSep || this.lineSeparator()) }
8349
  },
8350
  getSelections: function(lineSep) {
 
 
8351
  var parts = [], ranges = this.sel.ranges;
8352
  for (var i = 0; i < ranges.length; i++) {
8353
+ var sel = getBetween(this, ranges[i].from(), ranges[i].to());
8354
+ if (lineSep !== false) { sel = sel.join(lineSep || this.lineSeparator()); }
8355
  parts[i] = sel;
8356
  }
8357
  return parts
8363
  this.replaceSelections(dup, collapse, origin || "+input");
8364
  },
8365
  replaceSelections: docMethodOp(function(code, collapse, origin) {
 
 
8366
  var changes = [], sel = this.sel;
8367
  for (var i = 0; i < sel.ranges.length; i++) {
8368
+ var range = sel.ranges[i];
8369
+ changes[i] = {from: range.from(), to: range.to(), text: this.splitLines(code[i]), origin: origin};
8370
  }
8371
  var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse);
8372
  for (var i$1 = changes.length - 1; i$1 >= 0; i$1--)
8373
+ { makeChange(this, changes[i$1]); }
8374
  if (newSel) { setSelectionReplaceHistory(this, newSel); }
8375
  else if (this.cm) { ensureCursorVisible(this.cm); }
8376
  }),
8388
  for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone; } }
8389
  return {undo: done, redo: undone}
8390
  },
8391
+ clearHistory: function() {
8392
+ var this$1 = this;
8393
+
8394
+ this.history = new History(this.history.maxGeneration);
8395
+ linkedDocs(this, function (doc) { return doc.history = this$1.history; }, true);
8396
+ },
8397
 
8398
  markClean: function() {
8399
  this.cleanGeneration = this.changeGeneration(true);
8514
  },
8515
  findMarks: function(from, to, filter) {
8516
  from = clipPos(this, from); to = clipPos(this, to);
8517
+ var found = [], lineNo = from.line;
8518
  this.iter(from.line, to.line + 1, function (line) {
8519
  var spans = line.markedSpans;
8520
  if (spans) { for (var i = 0; i < spans.length; i++) {
8521
  var span = spans[i];
8522
+ if (!(span.to != null && lineNo == from.line && from.ch >= span.to ||
8523
+ span.from == null && lineNo != from.line ||
8524
+ span.from != null && lineNo == to.line && span.from >= to.ch) &&
8525
  (!filter || filter(span.marker)))
8526
  { found.push(span.marker.parent || span.marker); }
8527
  } }
8528
+ ++lineNo;
8529
  });
8530
  return found
8531
  },
8540
  },
8541
 
8542
  posFromIndex: function(off) {
8543
+ var ch, lineNo = this.first, sepSize = this.lineSeparator().length;
8544
  this.iter(function (line) {
8545
  var sz = line.text.length + sepSize;
8546
  if (sz > off) { ch = off; return true }
8547
  off -= sz;
8548
+ ++lineNo;
8549
  });
8550
+ return clipPos(this, Pos(lineNo, ch))
8551
  },
8552
  indexFromPos: function (coords) {
8553
  coords = clipPos(this, coords);
8586
  return copy
8587
  },
8588
  unlinkDoc: function(other) {
 
 
8589
  if (other instanceof CodeMirror) { other = other.doc; }
8590
  if (this.linked) { for (var i = 0; i < this.linked.length; ++i) {
8591
+ var link = this.linked[i];
8592
  if (link.doc != other) { continue }
8593
+ this.linked.splice(i, 1);
8594
+ other.unlinkDoc(this);
8595
+ detachSharedMarkers(findSharedMarkers(this));
8596
  break
8597
  } }
8598
  // If the histories were shared, split them again
8644
  // and insert it.
8645
  if (files && files.length && window.FileReader && window.File) {
8646
  var n = files.length, text = Array(n), read = 0;
8647
+ var markAsReadAndPasteIfAllFilesAreRead = function () {
8648
+ if (++read == n) {
8649
+ operation(cm, function () {
 
 
 
 
 
 
 
 
8650
  pos = clipPos(cm.doc, pos);
8651
  var change = {from: pos, to: pos,
8652
+ text: cm.doc.splitLines(
8653
+ text.filter(function (t) { return t != null; }).join(cm.doc.lineSeparator())),
8654
  origin: "paste"};
8655
  makeChange(cm.doc, change);
8656
  setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change)));
8657
+ })();
8658
+ }
8659
+ };
8660
+ var readTextFromFile = function (file, i) {
8661
+ if (cm.options.allowDropFileTypes &&
8662
+ indexOf(cm.options.allowDropFileTypes, file.type) == -1) {
8663
+ markAsReadAndPasteIfAllFilesAreRead();
8664
+ return
8665
+ }
8666
+ var reader = new FileReader;
8667
+ reader.onerror = function () { return markAsReadAndPasteIfAllFilesAreRead(); };
8668
+ reader.onload = function () {
8669
+ var content = reader.result;
8670
+ if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) {
8671
+ markAsReadAndPasteIfAllFilesAreRead();
8672
+ return
8673
  }
8674
+ text[i] = content;
8675
+ markAsReadAndPasteIfAllFilesAreRead();
8676
+ };
8677
  reader.readAsText(file);
8678
  };
8679
+ for (var i = 0; i < files.length; i++) { readTextFromFile(files[i], i); }
8680
  } else { // Normal drop
8681
  // Don't do a replace if the drop happened inside of the selected text.
8682
  if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {
8901
  return keymap
8902
  }
8903
 
8904
+ function lookupKey(key, map, handle, context) {
8905
+ map = getKeyMap(map);
8906
+ var found = map.call ? map.call(key, context) : map[key];
8907
  if (found === false) { return "nothing" }
8908
  if (found === "...") { return "multi" }
8909
  if (found != null && handle(found)) { return "handled" }
8910
 
8911
+ if (map.fallthrough) {
8912
+ if (Object.prototype.toString.call(map.fallthrough) != "[object Array]")
8913
+ { return lookupKey(key, map.fallthrough, handle, context) }
8914
+ for (var i = 0; i < map.fallthrough.length; i++) {
8915
+ var result = lookupKey(key, map.fallthrough[i], handle, context);
8916
  if (result) { return result }
8917
  }
8918
  }
8986
 
8987
  function endOfLine(visually, cm, lineObj, lineNo, dir) {
8988
  if (visually) {
8989
+ if (cm.getOption("direction") == "rtl") { dir = -dir; }
8990
  var order = getOrder(lineObj, cm.doc.direction);
8991
  if (order) {
8992
  var part = dir < 0 ? lst(order) : order[0];
9357
  if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
9358
  { cm.replaceSelection("", null, "cut"); }
9359
  }
9360
+ if (gecko && !mac && !handled && code == 46 && e.shiftKey && !e.ctrlKey && document.execCommand)
9361
+ { document.execCommand("cut"); }
9362
 
9363
  // Turn mouse into crosshair when Alt is held on Mac.
9364
  if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className))
9590
  start = posFromMouse(cm, event, true, true);
9591
  ourIndex = -1;
9592
  } else {
9593
+ var range = rangeForUnit(cm, start, behavior.unit);
9594
  if (behavior.extend)
9595
+ { ourRange = extendRange(ourRange, range.anchor, range.head, behavior.extend); }
9596
  else
9597
+ { ourRange = range; }
9598
  }
9599
 
9600
  if (!behavior.addNew) {
9637
  cm.scrollIntoView(pos);
9638
  } else {
9639
  var oldRange = ourRange;
9640
+ var range = rangeForUnit(cm, pos, behavior.unit);
9641
  var anchor = oldRange.anchor, head;
9642
+ if (cmp(range.anchor, anchor) > 0) {
9643
+ head = range.head;
9644
+ anchor = minPos(oldRange.from(), range.anchor);
9645
  } else {
9646
+ head = range.anchor;
9647
+ anchor = maxPos(oldRange.to(), range.head);
9648
  }
9649
  var ranges$1 = startSel.ranges.slice(0);
9650
  ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));
9706
 
9707
  // Used when mouse-selecting to adjust the anchor to the proper side
9708
  // of a bidi jump depending on the visual position of the head.
9709
+ function bidiSimplify(cm, range) {
9710
+ var anchor = range.anchor;
9711
+ var head = range.head;
9712
  var anchorLine = getLine(cm.doc, anchor.line);
9713
+ if (cmp(anchor, head) == 0 && anchor.sticky == head.sticky) { return range }
9714
  var order = getOrder(anchorLine);
9715
+ if (!order) { return range }
9716
  var index = getBidiPartAt(order, anchor.ch, anchor.sticky), part = order[index];
9717
+ if (part.from != anchor.ch && part.to != anchor.ch) { return range }
9718
  var boundary = index + ((part.from == anchor.ch) == (part.level != 1) ? 0 : 1);
9719
+ if (boundary == 0 || boundary == order.length) { return range }
9720
 
9721
  // Compute the relative visual position of the head compared to the
9722
  // anchor (<0 is to the left, >0 to the right)
9735
  var usePart = order[boundary + (leftSide ? -1 : 0)];
9736
  var from = leftSide == (usePart.level == 1);
9737
  var ch = from ? usePart.from : usePart.to, sticky = from ? "after" : "before";
9738
+ return anchor.ch == ch && anchor.sticky == sticky ? range : new Range(new Pos(anchor.line, ch, sticky), head)
9739
  }
9740
 
9741
 
10027
  { onBlur(this); }
10028
 
10029
  for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))
10030
+ { optionHandlers[opt](this, options[opt], Init); } }
10031
  maybeUpdateLineNumberWidth(this);
10032
  if (options.finishInit) { options.finishInit(this); }
10033
+ for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); }
10034
  endOperation(this);
10035
  // Suppress optimizelegibility in Webkit, since it breaks text
10036
  // measuring on line wrapping boundaries.
10064
  // which point we can't mess with it anymore. Context menu is
10065
  // handled in onMouseDown for these browsers.
10066
  on(d.scroller, "contextmenu", function (e) { return onContextMenu(cm, e); });
10067
+ on(d.input.getField(), "contextmenu", function (e) {
10068
+ if (!d.scroller.contains(e.target)) { onContextMenu(cm, e); }
10069
+ });
10070
 
10071
  // Used to suppress mouse event handling when a touch happens
10072
  var touchFinished, prevTouch = {end: 0};
10255
  var updateInput = cm.curOp.updateInput;
10256
  // Normal behavior is to insert the new text into every selection
10257
  for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) {
10258
+ var range = sel.ranges[i$1];
10259
+ var from = range.from(), to = range.to();
10260
+ if (range.empty()) {
10261
  if (deleted && deleted > 0) // Handle deletion
10262
  { from = Pos(from.line, from.ch - deleted); }
10263
  else if (cm.state.overwrite && !paste) // Handle overwrite
10295
  var sel = cm.doc.sel;
10296
 
10297
  for (var i = sel.ranges.length - 1; i >= 0; i--) {
10298
+ var range = sel.ranges[i];
10299
+ if (range.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range.head.line)) { continue }
10300
+ var mode = cm.getModeAt(range.head);
10301
  var indented = false;
10302
  if (mode.electricChars) {
10303
  for (var j = 0; j < mode.electricChars.length; j++)
10304
  { if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {
10305
+ indented = indentLine(cm, range.head.line, "smart");
10306
  break
10307
  } }
10308
  } else if (mode.electricInput) {
10309
+ if (mode.electricInput.test(getLine(cm.doc, range.head.line).text.slice(0, range.head.ch)))
10310
+ { indented = indentLine(cm, range.head.line, "smart"); }
10311
  }
10312
+ if (indented) { signalLater(cm, "electricInput", cm, range.head.line); }
10313
  }
10314
  }
10315
 
10374
  getOption: function(option) {return this.options[option]},
10375
  getDoc: function() {return this.doc},
10376
 
10377
+ addKeyMap: function(map, bottom) {
10378
+ this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map));
10379
  },
10380
+ removeKeyMap: function(map) {
10381
  var maps = this.state.keyMaps;
10382
  for (var i = 0; i < maps.length; ++i)
10383
+ { if (maps[i] == map || maps[i].name == map) {
10384
  maps.splice(i, 1);
10385
  return true
10386
  } }
10397
  regChange(this);
10398
  }),
10399
  removeOverlay: methodOp(function(spec) {
 
 
10400
  var overlays = this.state.overlays;
10401
  for (var i = 0; i < overlays.length; ++i) {
10402
  var cur = overlays[i].modeSpec;
10403
  if (cur == spec || typeof spec == "string" && cur.name == spec) {
10404
  overlays.splice(i, 1);
10405
+ this.state.modeGen++;
10406
+ regChange(this);
10407
  return
10408
  }
10409
  }
10417
  if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }
10418
  }),
10419
  indentSelection: methodOp(function(how) {
 
 
10420
  var ranges = this.doc.sel.ranges, end = -1;
10421
  for (var i = 0; i < ranges.length; i++) {
10422
+ var range = ranges[i];
10423
+ if (!range.empty()) {
10424
+ var from = range.from(), to = range.to();
10425
  var start = Math.max(end, from.line);
10426
+ end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;
10427
  for (var j = start; j < end; ++j)
10428
+ { indentLine(this, j, how); }
10429
+ var newRanges = this.doc.sel.ranges;
10430
  if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)
10431
+ { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }
10432
+ } else if (range.head.line > end) {
10433
+ indentLine(this, range.head.line, how, true);
10434
+ end = range.head.line;
10435
+ if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }
10436
  }
10437
  }
10438
  }),
10474
  },
10475
 
10476
  getHelpers: function(pos, type) {
 
 
10477
  var found = [];
10478
  if (!helpers.hasOwnProperty(type)) { return found }
10479
  var help = helpers[type], mode = this.getModeAt(pos);
10491
  }
10492
  for (var i$1 = 0; i$1 < help._global.length; i$1++) {
10493
  var cur = help._global[i$1];
10494
+ if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)
10495
  { found.push(cur.val); }
10496
  }
10497
  return found
10504
  },
10505
 
10506
  cursorCoords: function(start, mode) {
10507
+ var pos, range = this.doc.sel.primary();
10508
+ if (start == null) { pos = range.head; }
10509
  else if (typeof start == "object") { pos = clipPos(this.doc, start); }
10510
+ else { pos = start ? range.from() : range.to(); }
10511
  return cursorCoords(this, pos, mode || "page")
10512
  },
10513
 
10591
  triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),
10592
 
10593
  findPosH: function(from, amount, unit, visually) {
 
 
10594
  var dir = 1;
10595
  if (amount < 0) { dir = -1; amount = -amount; }
10596
  var cur = clipPos(this.doc, from);
10597
  for (var i = 0; i < amount; ++i) {
10598
+ cur = findPosH(this.doc, cur, dir, unit, visually);
10599
  if (cur.hitSide) { break }
10600
  }
10601
  return cur
10604
  moveH: methodOp(function(dir, unit) {
10605
  var this$1 = this;
10606
 
10607
+ this.extendSelectionsBy(function (range) {
10608
+ if (this$1.display.shift || this$1.doc.extend || range.empty())
10609
+ { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }
10610
  else
10611
+ { return dir < 0 ? range.from() : range.to() }
10612
  }, sel_move);
10613
  }),
10614
 
10617
  if (sel.somethingSelected())
10618
  { doc.replaceSelection("", null, "+delete"); }
10619
  else
10620
+ { deleteNearSelection(this, function (range) {
10621
+ var other = findPosH(doc, range.head, dir, unit, false);
10622
+ return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}
10623
  }); }
10624
  }),
10625
 
10626
  findPosV: function(from, amount, unit, goalColumn) {
 
 
10627
  var dir = 1, x = goalColumn;
10628
  if (amount < 0) { dir = -1; amount = -amount; }
10629
  var cur = clipPos(this.doc, from);
10630
  for (var i = 0; i < amount; ++i) {
10631
+ var coords = cursorCoords(this, cur, "div");
10632
  if (x == null) { x = coords.left; }
10633
  else { coords.left = x; }
10634
+ cur = findPosV(this, coords, dir, unit);
10635
  if (cur.hitSide) { break }
10636
  }
10637
  return cur
10642
 
10643
  var doc = this.doc, goals = [];
10644
  var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();
10645
+ doc.extendSelectionsBy(function (range) {
10646
  if (collapse)
10647
+ { return dir < 0 ? range.from() : range.to() }
10648
+ var headPos = cursorCoords(this$1, range.head, "div");
10649
+ if (range.goalColumn != null) { headPos.left = range.goalColumn; }
10650
  goals.push(headPos.left);
10651
  var pos = findPosV(this$1, headPos, dir, unit);
10652
+ if (unit == "page" && range == doc.sel.primary())
10653
  { addToScrollTop(this$1, charCoords(this$1, pos, "div").top - headPos.top); }
10654
  return pos
10655
  }, sel_move);
10696
  clientHeight: displayHeight(this), clientWidth: displayWidth(this)}
10697
  },
10698
 
10699
+ scrollIntoView: methodOp(function(range, margin) {
10700
+ if (range == null) {
10701
+ range = {from: this.doc.sel.primary().head, to: null};
10702
  if (margin == null) { margin = this.options.cursorScrollMargin; }
10703
+ } else if (typeof range == "number") {
10704
+ range = {from: Pos(range, 0), to: null};
10705
+ } else if (range.from == null) {
10706
+ range = {from: range, to: null};
10707
  }
10708
+ if (!range.to) { range.to = range.from; }
10709
+ range.margin = margin || 0;
10710
 
10711
+ if (range.from.line != null) {
10712
+ scrollToRange(this, range);
10713
  } else {
10714
+ scrollToCoordsRange(this, range.from, range.to, range.margin);
10715
  }
10716
  }),
10717
 
10722
  if (width != null) { this.display.wrapper.style.width = interpret(width); }
10723
  if (height != null) { this.display.wrapper.style.height = interpret(height); }
10724
  if (this.options.lineWrapping) { clearLineMeasurementCache(this); }
10725
+ var lineNo = this.display.viewFrom;
10726
+ this.doc.iter(lineNo, this.display.viewTo, function (line) {
10727
  if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)
10728
+ { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, "widget"); break } } }
10729
+ ++lineNo;
10730
  });
10731
  this.curOp.forceUpdate = true;
10732
  signal(this, "refresh", this);
10797
  var oldPos = pos;
10798
  var origDir = dir;
10799
  var lineObj = getLine(doc, pos.line);
10800
+ var lineDir = visually && doc.cm && doc.cm.getOption("direction") == "rtl" ? -dir : dir;
10801
  function findNextLine() {
10802
+ var l = pos.line + lineDir;
10803
  if (l < doc.first || l >= doc.first + doc.size) { return false }
10804
  pos = new Pos(l, pos.ch, pos.sticky);
10805
  return lineObj = getLine(doc, l)
10813
  }
10814
  if (next == null) {
10815
  if (!boundToLine && findNextLine())
10816
+ { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); }
10817
  else
10818
  { return false }
10819
  } else {
10998
  var end = to.line < cm.display.viewTo && posToDOM(cm, to);
10999
  if (!end) {
11000
  var measure = view[view.length - 1].measure;
11001
+ var map = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map;
11002
+ end = {node: map[map.length - 1], offset: map[map.length - 2] - map[map.length - 3]};
11003
  }
11004
 
11005
  if (!start || !end) {
11288
  addText(cmText);
11289
  return
11290
  }
11291
+ var markerID = node.getAttribute("cm-marker"), range;
11292
  if (markerID) {
11293
  var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));
11294
+ if (found.length && (range = found[0].find(0)))
11295
+ { addText(getBetween(cm.doc, range.from, range.to).join(lineSep)); }
11296
  return
11297
  }
11298
  if (node.getAttribute("contenteditable") == "false") { return }
11360
 
11361
  function find(textNode, topNode, offset) {
11362
  for (var i = -1; i < (maps ? maps.length : 0); i++) {
11363
+ var map = i < 0 ? measure.map : maps[i];
11364
+ for (var j = 0; j < map.length; j += 3) {
11365
+ var curNode = map[j + 2];
11366
  if (curNode == textNode || curNode == topNode) {
11367
  var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);
11368
+ var ch = map[j] + offset;
11369
+ if (offset < 0 || curNode != textNode) { ch = map[j + (offset ? 1 : 0)]; }
11370
  return Pos(line, ch)
11371
  }
11372
  }
11890
 
11891
  addLegacyProps(CodeMirror);
11892
 
11893
+ CodeMirror.version = "5.51.0";
11894
 
11895
  return CodeMirror;
11896
 
17137
  };
17138
  }).call(this,require("timers").setImmediate,require("timers").clearImmediate)
17139
  },{"process/browser.js":48,"timers":49}]},{},[13]);
 
assets/js/forms-admin.min.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(){var o=void 0;!function o(a,l,s){function c(t,e){if(!l[t]){if(!a[t]){var n=!1;if(!e&&n)return n(t,!0);if(u)return u(t,!0);var r=new Error("Cannot find module '"+t+"'");throw r.code="MODULE_NOT_FOUND",r}var i=l[t]={exports:{}};a[t][0].call(i.exports,function(e){return c(a[t][1][e]||e)},i,i.exports,o,a,l,s)}return l[t].exports}for(var u=!1,e=0;e<s.length;e++)c(s[e]);return c}({1:[function(e,t,n){"use strict";var r=window.mc4wp_forms_i18n,i=e("mithril"),o={showType:function(e){var t=e.type;return t=t.charAt(0).toUpperCase()+t.slice(1),i("div",[i("label",r.fieldType),i("span",t)])},label:function(t){return i("div",[i("label",r.fieldLabel),i("input.widefat",{type:"text",value:t.label,onchange:function(e){return t.label=e.target.value},placeholder:t.title})])},value:function(t){var e="hidden"===t.type;return i("div",[i("label",[e?r.value:r.initialValue," ",e?"":i("small",{style:"float: right; font-weight: normal;"},r.optional)]),i("input.widefat",{type:"text",value:t.value,onchange:function(e){return t.value=e.target.value}}),e?"":i("p.help",r.valueHelp)])},numberMinMax:function(t){return i("div",[i("div.row",[i("div.col.col-3",[i("label",r.min),i("input",{type:"number",onchange:function(e){return t.min=e.target.value}})]),i("div.col.col-3",[i("label",r.max),i("input",{type:"number",onchange:function(e){return t.max=e.target.value}})])])])},isRequired:function(t){var e,n={type:"checkbox",checked:t.required,onchange:function(e){return t.required=e.target.checked}};return t.forceRequired&&(n.required=!0,n.disabled=!0,e=i("p.help",r.forceRequired)),i("div",[i("label.cb-wrap",[i("input",n),r.isFieldRequired]),e])},placeholder:function(t){return i("div",[i("label",[r.placeholder," ",i("small",{style:"float: right; font-weight: normal;"},r.optional)]),i("input.widefat",{type:"text",value:t.placeholder,onchange:function(e){return t.placeholder=e.target.value},placeholder:""}),i("p.help",r.placeholderHelp)])},useParagraphs:function(t){return i("div",[i("label.cb-wrap",[i("input",{type:"checkbox",checked:t.wrap,onchange:function(e){return t.wrap=e.target.checked}}),r.wrapInParagraphTags])])},choiceType:function(t){var e=[i("option",{value:"select",selected:"select"===t.type&&"selected"},r.dropdown),i("option",{value:"radio",selected:"radio"===t.type&&"selected"},r.radioButtons)];return t.acceptsMultipleValues&&e.push(i("option",{value:"checkbox",selected:"checkbox"===t.type&&"selected"},r.checkboxes)),i("div",[i("label",r.choiceType),i("select",{value:t.type,onchange:function(e){return t.type=e.target.value}},e)])},choices:function(n){var e=[];return e.push(i("div",[i("label",r.choices),i("div.limit-height",[i("table",n.choices.map(function(t,e){return i("tr",{"data-id":e},[i("td.cb",i("input",{name:"selected",type:"checkbox"===n.type?"checkbox":"radio",onchange:function(t){n.choices=n.choices.map(function(e){return e.value===t.target.value?e.selected=!e.selected:"checkbox"!==n.type&&(e.selected=!1),e})},checked:t.selected,value:t.value,title:r.preselect})),i("td.stretch",i("input.widefat",{type:"text",value:t.label,placeholder:t.title,onchange:function(e){return t.label=e.target.value}})),i("td",i("span",{title:r.remove,class:"dashicons dashicons-no-alt hover-activated",onclick:function(e){this.choices().splice(e,1)}.bind(n,e)},""))])}))])])),e},linkToTerms:function(t){return i("div",[i("label",r.agreeToTermsLink),i("input.widefat",{type:"text",value:t.link,onchange:function(e){return t.link=e.target.value},placeholder:"https://..."})])}};t.exports=o},{mithril:28}],2:[function(e,t,n){"use strict";var r={},i=e("./field-forms-rows.js");r.render=function(e){var t=e.type;if("function"==typeof r[t])return r[t](e);switch(t){case"select":case"radio":case"checkbox":return r.choice(e)}return r.text(e)},r.text=function(e){return[i.label(e),i.placeholder(e),i.value(e),i.isRequired(e),i.useParagraphs(e)]},r.choice=function(e){var t=[i.label(e),i.choiceType(e),i.choices(e)];return"select"===e.type&&t.push(i.placeholder(e)),t.push(i.useParagraphs(e)),"select"!==e.type&&"radio"!==e.type||t.push(i.isRequired(e)),t},r.hidden=function(e){return e.placeholder="",e.label="",e.wrap=!1,[i.showType(e),i.value(e)]},r.submit=function(e){return e.label="",e.placeholder="",[i.value(e),i.useParagraphs(e)]},r["terms-checkbox"]=function(e){return[i.label(e),i.linkToTerms(e),i.isRequired(e),i.useParagraphs(e)]},r.number=function(e){return[r.text(e),i.numberMinMax(e)]},t.exports=r},{"./field-forms-rows.js":1}],3:[function(e,t,n){"use strict";function o(e){e.dom.checked&&e.dom.setAttribute("checked","true"),e.dom.value&&e.dom.setAttribute("value",e.dom.value),e.dom.selected&&e.dom.setAttribute("selected","true")}var a=e("html"),l=e("mithril"),s={};s.select=function(e){var t={name:e.name,required:e.required},n=!1,r=e.choices.map(function(e){return e.selected&&(n=!0),l("option",{value:e.value!==e.label?e.value:void 0,selected:e.selected,oncreate:o},e.label)}),i=e.placeholder;return 0<i.length&&r.unshift(l("option",{disabled:!0,value:"",selected:!n,oncreate:o},i)),l("select",t,r)},s["terms-checkbox"]=function(e){var t;return t=0<e.link.length?l("a",{href:e.link,target:"_blank"},e.label):e.label,l("label",[l("input",{name:e.name,type:"checkbox",value:e.value,required:e.required})," ",t])},s.checkbox=function(r){return r.choices.map(function(e){var t=r.name+("checkbox"===r.type?"[]":""),n=r.required&&"radio"===r.type;return l("label",[l("input",{name:t,type:r.type,value:e.value,checked:e.selected,required:n,oncreate:o})," ",l("span",e.label)])})},s.radio=s.checkbox,s.default=function(e){var t={type:e.type};return e.name&&(t.name=e.name),e.min&&(t.min=e.min),e.max&&(t.max=e.max),0<e.value.length&&(t.value=e.value),0<e.placeholder.length&&(t.placeholder=e.placeholder),t.required=e.required,t.oncreate=o,l("input",t)},t.exports=function(e){var t=0<e.label.length&&e.showLabel?l("label",{},e.label):"",n="function"==typeof s[e.type]?s[e.type](e):s.default(e),r=e.wrap?l("p",[t,n]):[t,n],i=document.createElement("div");return l.render(i,r),a.prettyPrint(i.innerHTML)+"\n"}},{html:24,mithril:28}],4:[function(e,t,n){"use strict";var i,o=e("mithril"),r=e("./form-editor.js"),a=e("./fields.js"),l=window.mc4wp_forms_i18n,s=e("./field-generator.js"),c=e("../overlay.js"),u=e("./field-forms.js");function d(e){(i=a.get(e))&&"hidden"===i.type&&0<i.choices.length&&(i.value=i.choices.map(function(e){return e.label}).join("|")),o.redraw()}function f(){var e=s(i);r.insert(e),d(""),o.redraw()}r.on("blur",o.redraw);var h=document.getElementById("mc4wp-field-wizard");h&&o.mount(h,{view:function(){var e=a.getCategories(),n=a.getAll(),t=o("div.available-fields.small-margin",[o("h4",l.chooseField),e.map(function(t){var e=n.filter(function(e){return e.category===t});if(e.length)return o("div.tiny-margin",[o("strong",t),e.map(function(e){var t="button";e.forceRequired&&(t+=" is-required");var n=e.inFormContent;return null!==n&&(t+=" "+(n?"in-form":"not-in-form")),o("button",{className:t,type:"button",onclick:function(e){return d(e.target.value)},value:e.index},e.title)})])})]),r=null;return i&&(r=o(c,{onClose:d},o("div.field-wizard",[o("h3",[i.title,i.forceRequired?o("span.red","*"):"",i.name.length?o("code",i.name):""]),i.help.length?o("p",o.trust(i.help)):"",u.render(i),o("p",[o("button",{class:"button-primary",type:"button",onkeydown:function(e){13===e.keyCode&&f()},onclick:f},l.addToForm)])]))),[t,r]}})},{"../overlay.js":11,"./field-forms.js":2,"./field-generator.js":3,"./fields.js":6,"./form-editor.js":7,mithril:28}],5:[function(e,t,n){"use strict";var r=e("mithril"),i=e("./fields.js"),o=window.mc4wp.settings,a=window.mc4wp_vars.ajaxurl,l=window.mc4wp_forms_i18n,s=window.mc4wp_vars.mailchimp,c=[];function u(e,t,n){var r=i.register(e,t);n||c.push(r)}function d(e){var t={phone:"tel",dropdown:"select",checkboxes:"checkbox",birthday:"text"};return void 0!==t[e]?t[e]:e}function f(e){var t=l.listFields,n=d(e.type),r={name:e.tag,title:e.name,required:e.required,forceRequired:e.required,type:n,choices:e.options.choices,acceptsMultipleValues:!1};return"address"!==r.type?u(t,r,!1):(u(t,{name:r.name+"[addr1]",type:"text",mailchimpType:"address",title:l.streetAddress},!1),u(t,{name:r.name+"[city]",type:"text",mailchimpType:"address",title:l.city},!1),u(t,{name:r.name+"[state]",type:"text",mailchimpType:"address",title:l.state},!1),u(t,{name:r.name+"[zip]",type:"text",mailchimpType:"address",title:l.zip},!1),u(t,{name:r.name+"[country]",type:"select",mailchimpType:"address",title:l.country,choices:mc4wp_vars.countries},!1)),!0}function h(e){var t=l.interestCategories,n=d(e.type);u(t,{title:e.title,name:"INTERESTS["+e.id+"]",type:n,choices:e.interests,acceptsMultipleValues:"checkbox"===n},!1)}function p(e){e.merge_fields=e.merge_fields.sort(function(e,t){return"EMAIL"===e.tag||e.public&&!t.public?-1:!e.public&&t.public?1:0}),e.merge_fields.forEach(f),e.interest_categories.forEach(h)}function m(e){var t=a+"?action=mc4wp_get_list_details&ids="+e.map(function(e){return e.id}).join(",");r.request({url:t,method:"GET"}).then(function(e){c.forEach(i.deregister),e.forEach(p)})}o.on("selectedLists.change",m),m(o.getSelectedLists()),function(e){var t,n=l.formFields;for(var r in u(l.listFields,{name:"EMAIL",title:l.emailAddress,required:!0,forceRequired:!0,type:"email"},!0),u(n,{name:"",value:l.subscribe,type:"submit",title:l.submitButton},!0),t={},e)t[e[r].id]=e[r].name;u(n,{name:"_mc4wp_lists",type:"checkbox",title:l.listChoice,choices:t,help:l.listChoiceDescription,acceptsMultipleValues:!0},!0),t={subscribe:"Subscribe",unsubscribe:"Unsubscribe"},u(n,{name:"_mc4wp_action",type:"radio",title:l.formAction,choices:t,value:"subscribe",help:l.formActionDescription},!0),u(n,{name:"AGREE_TO_TERMS",value:1,type:"terms-checkbox",label:l.agreeToTerms,title:l.agreeToTermsShort,showLabel:!1,required:!0},!0)}(s.lists)},{"./fields.js":6,mithril:28}],6:[function(e,t,n){"use strict";function i(e){return{name:e.name,title:e.title||e.name,type:e.type,mailchimpType:e.mailchimpType||null,label:e.label||e.title||"",showLabel:"boolean"!=typeof e.showLabel||e.showLabel,value:e.value||"",placeholder:e.placeholder||"",required:"boolean"==typeof e.required&&e.required,forceRequired:"boolean"==typeof e.forceRequired&&e.forceRequired,wrap:"boolean"!=typeof e.wrap||e.wrap,min:e.min,max:e.max,help:e.help||"",choices:e.choices||[],inFormContent:null,acceptsMultipleValues:e.acceptsMultipleValues,link:e.link||""}}var o,a=e("mithril"),l=[],s=[],c={},u=function(e){return{title:e.title||e.label,selected:e.selected||!1,value:e.value||e.label,label:e.label}};function d(t,n){return l.filter(function(e){return e[t]===n})}t.exports={get:function(e){return l[e]},getAll:function(){return l=l.map(function(e,t){return e.index=t,e})},getCategories:function(){return s.sort(function(e,t){return"Form fields"!==e?-1:1})},deregister:function(e){var t=l.indexOf(e);-1<t&&(delete l[t],a.redraw())},register:function(e,t){var n,r=d("name",t.name).shift();if(!r)return t.choices&&(t.choices=function(n){return"function"==typeof n.map?n.map(function(e){return new u({label:e})}):Object.keys(n).map(function(e){var t=n[e];return new u({label:t,value:e})})}(t.choices),t.value&&(t.choices=t.choices.map(function(e){return e.value===t.value&&(e.selected=!0),e}))),s.indexOf(e)<0&&s.push(e),(n=new i(t)).category=e,l.push(n),o&&window.clearTimeout(o),o=window.setTimeout(a.redraw,200),function(e,t){c[e]=c[e]||[],c[e].forEach(function(e){return e.apply(null,t)})}("change"),n;!r.forceRequired&&t.forceRequired&&(r.forceRequired=!0)},getAllWhere:d,on:function(e,t){c[e]=c[e]||[],c[e].push(t)}}},{mithril:28}],7:[function(e,t,n){"use strict";var r=e("codemirror");e("codemirror/mode/xml/xml"),e("codemirror/mode/javascript/javascript"),e("codemirror/mode/css/css"),e("codemirror/mode/htmlmixed/htmlmixed"),e("codemirror/addon/fold/xml-fold.js"),e("codemirror/addon/edit/matchtags.js"),e("codemirror/addon/edit/closetag.js"),e("codemirror/addon/selection/active-line.js"),e("codemirror/addon/edit/matchbrackets.js");var i,o,a={},l=document.createElement("form"),s=!1,c=document.getElementById("mc4wp-form-content"),u=document.getElementById("mc4wp-form-preview"),d=/\{[^{}]+\}/g;function f(){var e=u.contentDocument||u.contentWindow.document;(o=e.querySelector(".mc4wp-form-fields"))&&h()}function h(){var e=a.getValue();e=e.replace(d,"").replace(d,""),o.innerHTML=e,o.dispatchEvent(new Event("mc4wp-refresh"))}function p(){return s&&(l.innerHTML=a.getValue().toLowerCase(),s=!1),l}a.getValue=function(){return i?i.getValue():c.value},a.query=function(e){return p().querySelectorAll(e.toLowerCase())},a.containsField=function(e){return null!==p().elements.namedItem(e.toLowerCase())},a.insert=function(e){i?(i.replaceSelection(e),i.focus()):c.value+=e},a.on=function(e,t){return i?(e="input"===e?"changes":e,i.on(e,t)):c.addEventListener(e,t)},a.refresh=function(){i&&i.refresh()},c&&(window.addEventListener("load",function(){r.signal(i,"change")}),c.addEventListener("change",function(){s=!0,h()}),l.innerHTML=c.value.toLowerCase(),r&&(i=r.fromTextArea(c,{selectionPointer:!0,mode:"htmlmixed",htmlMode:!0,autoCloseTags:!0,autoRefresh:!0,styleActiveLine:!0,matchBrackets:!0,matchTags:{bothTags:!0}}),window.dispatchEvent&&i.on("change",function(){if("function"==typeof Event){var e=new Event("change",{bubbles:!0});c.dispatchEvent(e)}}))),u&&(u.addEventListener("load",f),f.call()),t.exports=a},{codemirror:19,"codemirror/addon/edit/closetag.js":14,"codemirror/addon/edit/matchbrackets.js":15,"codemirror/addon/edit/matchtags.js":16,"codemirror/addon/fold/xml-fold.js":17,"codemirror/addon/selection/active-line.js":18,"codemirror/mode/css/css":20,"codemirror/mode/htmlmixed/htmlmixed":21,"codemirror/mode/javascript/javascript":22,"codemirror/mode/xml/xml":23}],8:[function(e,t,n){"use strict";var r=e("mithril"),i=e("../helpers.js"),o=e("./form-editor.js"),a=e("./fields.js"),l=document.getElementById("required-fields");function s(){a.getAll().forEach(function(e){if(!(e.name.length<=0)){var t=e.name;if("checkbox"===e.type&&(t+="[]"),e.inFormContent=o.containsField(t),"address"===e.mailchimpType){void 0===e.originalRequiredValue&&(e.originalRequiredValue=e.forceRequired);var n=e.name.replace(/\[(\w+)\]/g,"");0<o.query('[name^="'+n+'"]').length?e.forceRequired=!0:e.forceRequired=e.originalRequiredValue}}}),function(){var r=a.getAllWhere("forceRequired",!0).map(function(e){return e.name.toUpperCase().replace(/\[(\w+)\]/g,".$1")}),e=o.query("[required]");[].forEach.call(e,function(e){var t=e.name;if(t&&!(t.length<0)&&"_"!==t[0]){var n=(t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/\[\]$/,"")).indexOf(".");n=0<n?n:t.length,t=t.substr(0,n).toUpperCase()+t.substr(n),-1===r.indexOf(t)&&r.push(t)}}),l.value=r.join(",")}(),r.redraw()}o.on("change",i.debounce(s,500)),a.on("change",i.debounce(s,500))},{"../helpers.js":9,"./fields.js":6,"./form-editor.js":7,mithril:28}],9:[function(e,t,n){"use strict";var r={debounce:function(r,i,o){var a;return function(){var e=this,t=arguments,n=o&&!a;clearTimeout(a),a=setTimeout(function(){a=null,o||r.apply(e,t)},i),n&&r.apply(e,t)}}};t.exports=r},{}],10:[function(e,t,n){"use strict";var r=e("./form-editor/form-editor.js"),i=e("./form-editor/fields.js"),o=e("./settings"),a={};function l(e,t){a[e]=t,c()}function s(e){delete a[e],c()}function c(){var e="";for(var t in a)e+='<div class="notice notice-warning inline"><p>'+a[t]+"</p></div>";var n=document.querySelector(".mc4wp-notices");if(!n){(n=document.createElement("div")).className="mc4wp-notices";var r=document.querySelector("h1, h2");r.parentNode.insertBefore(n,r.nextSibling)}n.innerHTML=e}function u(){-1<r.getValue().toLowerCase().indexOf('name="groupings')?l("deprecated_groupings","Your form contains deprecated <code>GROUPINGS</code> fields. <br /><br />Please remove these fields from your form and then re-add them through the available field buttons to make sure your data is getting through to Mailchimp correctly."):s("deprecated_groupings")}function d(){var e=i.getAllWhere("forceRequired",!0).filter(function(e){return!r.containsField(e.name.toUpperCase())}),t="<strong>Heads up!</strong> Your form is missing list fields that are required in Mailchimp. Either add these fields to your form or mark them as optional in Mailchimp.";t+='<br /><ul class="ul-square" style="margin-bottom: 0;"><li>'+e.map(function(e){return e.title}).join("</li><li>")+"</li></ul>",0<e.length?l("required_fields_missing",t):s("required_fields_missing")}u(),r.on("focus",u),r.on("blur",u),d(),r.on("blur",d),r.on("focus",d),document.body.addEventListener("change",function(){0<o.getSelectedLists().length?s("no_lists_selected"):l("no_lists_selected",'<strong>Heads up!</strong> You have not yet selected a Mailchimp list to subscribe people to. Please select at least one list from the <a href="javascript:void(0)" data-tab="settings" class="tab-link">settings tab</a>.')})},{"./form-editor/fields.js":6,"./form-editor/form-editor.js":7,"./settings":12}],11:[function(e,t,n){"use strict";var a=e("mithril"),l=window.mc4wp_forms_i18n;t.exports=function(e){var i,t=e.attrs.onClose;function n(){t.apply(null)}function r(e){27===e.keyCode&&n(),13===e.keyCode&&e.preventDefault()}function o(){var e=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,t=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,n=(e-i.clientWidth-40)/2,r=(t-i.clientHeight-40)/2;i.style.left=(0<n?n:0)+"px",i.style.top=(0<r?r:0)+"px"}return{oncreate:function(){document.addEventListener("keydown",r),window.addEventListener("resize",o)},onremove:function(){document.removeEventListener("keydown",r),window.removeEventListener("resize",o)},view:function(e){return[a("div.overlay-wrap",a("div.overlay",{oncreate:function(e){i=e.dom,o()}},[a("span",{class:"close dashicons dashicons-no",title:l.close,onclick:n}),e.children])),a("div.overlay-background",{title:l.close,onclick:n})]}}}},{mithril:28}],12:[function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i=document.getElementById("mc4wp-admin").querySelectorAll(".mc4wp-list-input"),o=window.mc4wp_vars.mailchimp.lists,a=[],l={};function s(){return a=[],[].forEach.call(i,function(e){"boolean"==typeof e.checked&&!e.checked||"object"!==r(o[e.value])||a.push(o[e.value])}),function(){var e=document.querySelectorAll(".lists--only-selected > *");[].forEach.call(e,function(e){var t=0<function(t,n){return a.filter(function(e){return e[t]===n})}("id",e.getAttribute("data-list-id")).length;e.style.display=t?"":"none"})}(),function(e,t){l[e]=l[e]||[],l[e].forEach(function(e){return e.apply(null,t)})}("selectedLists.change",[a]),a}[].forEach.call(i,function(e){e.addEventListener("change",s)}),s(),t.exports={getSelectedLists:function(){return a},on:function(e,t){l[e]=l[e]||[],l[e].push(t)}}},{}],13:[function(e,t,n){"use strict";var r=e("./admin/form-editor/form-editor.js");e("./admin/form-editor/form-watcher.js"),e("./admin/form-editor/field-helper.js"),e("./admin/form-editor/field-manager.js"),e("./admin/notices.js"),window.mc4wp.forms=window.mc4wp.forms||{},window.mc4wp.forms.editor=r},{"./admin/form-editor/field-helper.js":4,"./admin/form-editor/field-manager.js":5,"./admin/form-editor/form-editor.js":7,"./admin/form-editor/form-watcher.js":8,"./admin/notices.js":10}],14:[function(e,t,n){var r;r=function(w){w.defineOption("autoCloseTags",!1,function(e,t,n){if(n!=w.Init&&n&&e.removeKeyMap("autoCloseTags"),t){var r={name:"autoCloseTags"};"object"==typeof t&&!t.whenClosing||(r["'/'"]=function(e){return function(e){return e.getOption("disableInput")?w.Pass:i(e,!0)}(e)}),"object"==typeof t&&!t.whenOpening||(r["'>'"]=function(e){return function(e){if(e.getOption("disableInput"))return w.Pass;for(var t=e.listSelections(),n=[],r=e.getOption("autoCloseTags"),i=0;i<t.length;i++){if(!t[i].empty())return w.Pass;var o=t[i].head,a=e.getTokenAt(o),l=w.innerMode(e.getMode(),a.state),s=l.state,c=l.mode.xmlCurrentTag&&l.mode.xmlCurrentTag(s),u=c&&c.name;if(!u)return w.Pass;var d="html"==l.mode.configuration,f="object"==typeof r&&r.dontCloseTags||d&&x,h="object"==typeof r&&r.indentTags||d&&k;a.end>o.ch&&(u=u.slice(0,u.length-a.end+o.ch));var p=u.toLowerCase();if(!u||"string"==a.type&&(a.end!=o.ch||!/[\"\']/.test(a.string.charAt(a.string.length-1))||1==a.string.length)||"tag"==a.type&&c.close||a.string.indexOf("/")==a.string.length-1||f&&-1<C(f,p)||T(e,l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(s)||[],u,o,!0))return w.Pass;var m="object"==typeof r&&r.emptyTags;if(m&&-1<C(m,u))n[i]={text:"/>",newPos:w.Pos(o.line,o.ch+2)};else{var g=h&&-1<C(h,p);n[i]={indent:g,text:">"+(g?"\n\n":"")+"</"+u+">",newPos:g?w.Pos(o.line+1,0):w.Pos(o.line,o.ch+1)}}}var v="object"==typeof r&&r.dontIndentOnAutoClose;for(i=t.length-1;0<=i;i--){var y=n[i];e.replaceRange(y.text,t[i].head,t[i].anchor,"+insert");var b=e.listSelections().slice(0);b[i]={head:y.newPos,anchor:y.newPos},e.setSelections(b),!v&&y.indent&&(e.indentLine(y.newPos.line,null,!0),e.indentLine(y.newPos.line+1,null,!0))}}(e)}),e.addKeyMap(r)}});var x=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],k=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function i(e,t){for(var n=e.listSelections(),r=[],i=t?"/":"</",o=e.getOption("autoCloseTags"),a="object"==typeof o&&o.dontIndentOnSlash,l=0;l<n.length;l++){if(!n[l].empty())return w.Pass;var s=n[l].head,c=e.getTokenAt(s),u=w.innerMode(e.getMode(),c.state),d=u.state;if(t&&("string"==c.type||"<"!=c.string.charAt(0)||c.start!=s.ch-1))return w.Pass;var f,h="xml"!=u.mode.name&&"htmlmixed"==e.getMode().name;if(h&&"javascript"==u.mode.name)f=i+"script";else if(h&&"css"==u.mode.name)f=i+"style";else{var p=u.mode.xmlCurrentContext&&u.mode.xmlCurrentContext(d);if(!p||p.length&&T(e,p,p[p.length-1],s))return w.Pass;f=i+p[p.length-1]}">"!=e.getLine(s.line).charAt(c.end)&&(f+=">"),r[l]=f}if(e.replaceSelections(r),n=e.listSelections(),!a)for(l=0;l<n.length;l++)(l==n.length-1||n[l].head.line<n[l+1].head.line)&&e.indentLine(n[l].head.line)}function C(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n<r;++n)if(e[n]==t)return n;return-1}function T(e,t,n,r,i){if(!w.scanForClosingTag)return!1;var o=Math.min(e.lastLine()+1,r.line+500),a=w.scanForClosingTag(e,r,null,o);if(!a||a.tag!=n)return!1;for(var l=i?1:0,s=t.length-1;0<=s&&t[s]==n;s--)++l;r=a.to;for(s=1;s<l;s++){var c=w.scanForClosingTag(e,r,null,o);if(!c||c.tag!=n)return!1;r=c.to}return!0}w.commands.closeTag=function(e){return i(e)}},"object"==typeof n&&"object"==typeof t?r(e("../../lib/codemirror"),e("../fold/xml-fold")):"function"==typeof o&&o.amd?o(["../../lib/codemirror","../fold/xml-fold"],r):r(CodeMirror)},{"../../lib/codemirror":19,"../fold/xml-fold":17}],15:[function(e,t,n){var r;r=function(r){var u=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),g=r.Pos,v={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function y(e){return e&&e.bracketRegex||/[(){}[\]]/}function d(e,t,n){var r=e.getLineHandle(t.line),i=t.ch-1,o=n&&n.afterCursor;null==o&&(o=/(^| )cm-fat-cursor($| )/.test(e.getWrapperElement().className));var a=y(n),l=!o&&0<=i&&a.test(r.text.charAt(i))&&v[r.text.charAt(i)]||a.test(r.text.charAt(i+1))&&v[r.text.charAt(++i)];if(!l)return null;var s=">"==l.charAt(1)?1:-1;if(n&&n.strict&&0<s!=(i==t.ch))return null;var c=e.getTokenTypeAt(g(t.line,i+1)),u=f(e,g(t.line,i+(0<s?1:0)),s,c||null,n);return null==u?null:{from:g(t.line,i),to:u&&u.pos,match:u&&u.ch==l.charAt(0),forward:0<s}}function f(e,t,n,r,i){for(var o=i&&i.maxScanLineLength||1e4,a=i&&i.maxScanLines||1e3,l=[],s=y(i),c=0<n?Math.min(t.line+a,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-a),u=t.line;u!=c;u+=n){var d=e.getLine(u);if(d){var f=0<n?0:d.length-1,h=0<n?d.length:-1;if(!(d.length>o))for(u==t.line&&(f=t.ch-(n<0?1:0));f!=h;f+=n){var p=d.charAt(f);if(s.test(p)&&(void 0===r||e.getTokenTypeAt(g(u,f+1))==r)){var m=v[p];if(m&&">"==m.charAt(1)==0<n)l.push(p);else{if(!l.length)return{pos:g(u,f),ch:p};l.pop()}}}}}return u-n!=(0<n?e.lastLine():e.firstLine())&&null}function t(e,t,n){for(var r=e.state.matchBrackets.maxHighlightLineLength||1e3,i=[],o=e.listSelections(),a=0;a<o.length;a++){var l=o[a].empty()&&d(e,o[a].head,n);if(l&&e.getLine(l.from.line).length<=r){var s=l.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";i.push(e.markText(l.from,g(l.from.line,l.from.ch+1),{className:s})),l.to&&e.getLine(l.to.line).length<=r&&i.push(e.markText(l.to,g(l.to.line,l.to.ch+1),{className:s}))}}if(i.length){u&&e.state.focused&&e.focus();function c(){e.operation(function(){for(var e=0;e<i.length;e++)i[e].clear()})}if(!t)return c;setTimeout(c,800)}}function i(e){e.operation(function(){e.state.matchBrackets.currentlyHighlighted&&(e.state.matchBrackets.currentlyHighlighted(),e.state.matchBrackets.currentlyHighlighted=null),e.state.matchBrackets.currentlyHighlighted=t(e,!1,e.state.matchBrackets)})}r.defineOption("matchBrackets",!1,function(e,t,n){n&&n!=r.Init&&(e.off("cursorActivity",i),e.state.matchBrackets&&e.state.matchBrackets.currentlyHighlighted&&(e.state.matchBrackets.currentlyHighlighted(),e.state.matchBrackets.currentlyHighlighted=null)),t&&(e.state.matchBrackets="object"==typeof t?t:{},e.on("cursorActivity",i))}),r.defineExtension("matchBrackets",function(){t(this,!0)}),r.defineExtension("findMatchingBracket",function(e,t,n){return!n&&"boolean"!=typeof t||(t=n?(n.strict=t,n):t?{strict:!0}:null),d(this,e,t)}),r.defineExtension("scanForBracket",function(e,t,n,r){return f(this,e,t,n,r)})},"object"==typeof n&&"object"==typeof t?r(e("../../lib/codemirror")):"function"==typeof o&&o.amd?o(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":19}],16:[function(e,t,n){var r;r=function(a){"use strict";function l(e){e.state.tagHit&&e.state.tagHit.clear(),e.state.tagOther&&e.state.tagOther.clear(),e.state.tagHit=e.state.tagOther=null}function r(o){o.state.failedTagMatch=!1,o.operation(function(){if(l(o),!o.somethingSelected()){var e=o.getCursor(),t=o.getViewport();t.from=Math.min(t.from,e.line),t.to=Math.max(e.line+1,t.to);var n=a.findMatchingTag(o,e,t);if(n){if(o.state.matchBothTags){var r="open"==n.at?n.open:n.close;r&&(o.state.tagHit=o.markText(r.from,r.to,{className:"CodeMirror-matchingtag"}))}var i="close"==n.at?n.open:n.close;i?o.state.tagOther=o.markText(i.from,i.to,{className:"CodeMirror-matchingtag"}):o.state.failedTagMatch=!0}}})}function i(e){e.state.failedTagMatch&&r(e)}a.defineOption("matchTags",!1,function(e,t,n){n&&n!=a.Init&&(e.off("cursorActivity",r),e.off("viewportChange",i),l(e)),t&&(e.state.matchBothTags="object"==typeof t&&t.bothTags,e.on("cursorActivity",r),e.on("viewportChange",i),r(e))}),a.commands.toMatchingTag=function(e){var t=a.findMatchingTag(e,e.getCursor());if(t){var n="close"==t.at?t.open:t.close;n&&e.extendSelection(n.to,n.from)}}},"object"==typeof n&&"object"==typeof t?r(e("../../lib/codemirror"),e("../fold/xml-fold")):"function"==typeof o&&o.amd?o(["../../lib/codemirror","../fold/xml-fold"],r):r(CodeMirror)},{"../../lib/codemirror":19,"../fold/xml-fold":17}],17:[function(e,t,n){var r;r=function(e){"use strict";var s=e.Pos;function c(e,t){return e.line-t.line||e.ch-t.ch}var t="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",r=new RegExp("<(/?)(["+t+"][A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*)","g");function u(e,t,n,r){this.line=t,this.ch=n,this.cm=e,this.text=e.getLine(t),this.min=r?Math.max(r.from,e.firstLine()):e.firstLine(),this.max=r?Math.min(r.to-1,e.lastLine()):e.lastLine()}function i(e,t){var n=e.cm.getTokenTypeAt(s(e.line,t));return n&&/\btag\b/.test(n)}function o(e){if(!(e.line>=e.max))return e.ch=0,e.text=e.cm.getLine(++e.line),!0}function a(e){if(!(e.line<=e.min))return e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0}function d(e){for(;;){var t=e.text.indexOf(">",e.ch);if(-1==t){if(o(e))continue;return}if(i(e,t+1)){var n=e.text.lastIndexOf("/",t),r=-1<n&&!/\S/.test(e.text.slice(n+1,t));return e.ch=t+1,r?"selfClose":"regular"}e.ch=t+1}}function f(e){for(;;){var t=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==t){if(a(e))continue;return}if(i(e,t+1)){r.lastIndex=t,e.ch=t;var n=r.exec(e.text);if(n&&n.index==t)return n}else e.ch=t}}function h(e){for(;;){r.lastIndex=e.ch;var t=r.exec(e.text);if(!t){if(o(e))continue;return}if(i(e,t.index+1))return e.ch=t.index+t[0].length,t;e.ch=t.index+1}}function p(e){for(;;){var t=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==t){if(a(e))continue;return}if(i(e,t+1)){var n=e.text.lastIndexOf("/",t),r=-1<n&&!/\S/.test(e.text.slice(n+1,t));return e.ch=t+1,r?"selfClose":"regular"}e.ch=t}}function m(e,t){for(var n=[];;){var r,i=h(e),o=e.line,a=e.ch-(i?i[0].length:0);if(!i||!(r=d(e)))return;if("selfClose"!=r)if(i[1]){for(var l=n.length-1;0<=l;--l)if(n[l]==i[2]){n.length=l;break}if(l<0&&(!t||t==i[2]))return{tag:i[2],from:s(o,a),to:s(e.line,e.ch)}}else n.push(i[2])}}function g(e,t){for(var n=[];;){var r=p(e);if(!r)return;if("selfClose"!=r){var i=e.line,o=e.ch,a=f(e);if(!a)return;if(a[1])n.push(a[2]);else{for(var l=n.length-1;0<=l;--l)if(n[l]==a[2]){n.length=l;break}if(l<0&&(!t||t==a[2]))return{tag:a[2],from:s(e.line,e.ch),to:s(i,o)}}}else f(e)}}e.registerHelper("fold","xml",function(e,t){for(var n=new u(e,t.line,0);;){var r=h(n);if(!r||n.line!=t.line)return;var i=d(n);if(!i)return;if(!r[1]&&"selfClose"!=i){var o=s(n.line,n.ch),a=m(n,r[2]);return a&&0<c(a.from,o)?{from:o,to:a.from}:null}}}),e.findMatchingTag=function(e,t,n){var r=new u(e,t.line,t.ch,n);if(-1!=r.text.indexOf(">")||-1!=r.text.indexOf("<")){var i=d(r),o=i&&s(r.line,r.ch),a=i&&f(r);if(i&&a&&!(0<c(r,t))){var l={from:s(r.line,r.ch),to:o,tag:a[2]};return"selfClose"==i?{open:l,close:null,at:"open"}:a[1]?{open:g(r,a[2]),close:l,at:"close"}:{open:l,close:m(r=new u(e,o.line,o.ch,n),a[2]),at:"open"}}}},e.findEnclosingTag=function(e,t,n,r){for(var i=new u(e,t.line,t.ch,n);;){var o=g(i,r);if(!o)break;var a=m(new u(e,t.line,t.ch,n),o.tag);if(a)return{open:o,close:a}}},e.scanForClosingTag=function(e,t,n,r){return m(new u(e,t.line,t.ch,r?{from:0,to:r}:null),n)}},"object"==typeof n&&"object"==typeof t?r(e("../../lib/codemirror")):"function"==typeof o&&o.amd?o(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":19}],18:[function(e,t,n){var r;r=function(i){"use strict";var l="CodeMirror-activeline",s="CodeMirror-activeline-background",c="CodeMirror-activeline-gutter";function u(e){for(var t=0;t<e.state.activeLines.length;t++)e.removeLineClass(e.state.activeLines[t],"wrap",l),e.removeLineClass(e.state.activeLines[t],"background",s),e.removeLineClass(e.state.activeLines[t],"gutter",c)}function o(t,e){for(var n=[],r=0;r<e.length;r++){var i=e[r],o=t.getOption("styleActiveLine");if("object"==typeof o&&o.nonEmpty?i.anchor.line==i.head.line:i.empty()){var a=t.getLineHandleVisualStart(i.head.line);n[n.length-1]!=a&&n.push(a)}}!function(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}(t.state.activeLines,n)&&t.operation(function(){u(t);for(var e=0;e<n.length;e++)t.addLineClass(n[e],"wrap",l),t.addLineClass(n[e],"background",s),t.addLineClass(n[e],"gutter",c);t.state.activeLines=n})}function a(e,t){o(e,t.ranges)}i.defineOption("styleActiveLine",!1,function(e,t,n){var r=n!=i.Init&&n;t!=r&&(r&&(e.off("beforeSelectionChange",a),u(e),delete e.state.activeLines),t&&(e.state.activeLines=[],o(e,e.listSelections()),e.on("beforeSelectionChange",a)))})},"object"==typeof n&&"object"==typeof t?r(e("../../lib/codemirror")):"function"==typeof o&&o.amd?o(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":19}],19:[function(e,t,n){var r,i;r=this,i=function(){"use strict";var e=navigator.userAgent,t=navigator.platform,m=/gecko\/\d/i.test(e),n=/MSIE \d/.test(e),r=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),i=/Edge\/(\d+)/.exec(e),x=n||r||i,k=x&&(n?document.documentMode||6:+(i||r)[1]),b=!i&&/WebKit\//.test(e),o=b&&/Qt\/\d+\.\d+/.test(e),a=!i&&/Chrome\//.test(e),g=/Opera\//.test(e),s=/Apple Computer/.test(navigator.vendor),l=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),c=/PhantomJS/.test(e),u=!i&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),d=/Android/.test(e),f=u||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),w=u||/Mac/.test(t),h=/\bCrOS\b/.test(e),p=/win/i.test(t),v=g&&e.match(/Version\/(\d*\.\d*)/);(v=v&&Number(v[1]))&&15<=v&&(b=!(g=!1));var y=w&&(o||g&&(null==v||v<12.11)),C=m||x&&9<=k;function T(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var S,L=function(e,t){var n=e.className,r=T(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function M(e){for(var t=e.childNodes.length;0<t;--t)e.removeChild(e.firstChild);return e}function A(e,t){return M(e).appendChild(t)}function N(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function O(e,t,n,r){var i=N(e,t,n,r);return i.setAttribute("role","presentation"),i}function _(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if(11==t.nodeType&&(t=t.host),t==e)return!0}while(t=t.parentNode)}function E(){var t;try{t=document.activeElement}catch(e){t=document.body||null}for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t}function z(e,t){var n=e.className;T(t).test(n)||(e.className+=(n?" ":"")+t)}function D(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!T(n[r]).test(t)&&(t+=" "+n[r]);return t}S=document.createRange?function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(e){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};var P=function(e){e.select()};function F(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function I(e,t,n){for(var r in t=t||{},e)!e.hasOwnProperty(r)||!1===n&&t.hasOwnProperty(r)||(t[r]=e[r]);return t}function j(e,t,n,r,i){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var o=r||0,a=i||0;;){var l=e.indexOf("\t",o);if(l<0||t<=l)return a+(t-o);a+=l-o,a+=n-a%n,o=l+1}}u?P=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:x&&(P=function(e){try{e.select()}catch(e){}});var W=function(){this.id=null};function H(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}W.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var R=30,B={toString:function(){return"CodeMirror.Pass"}},q={scroll:!1},U={origin:"*mouse"},K={origin:"+move"};function V(e,t,n){for(var r=0,i=0;;){var o=e.indexOf("\t",r);-1==o&&(o=e.length);var a=o-r;if(o==e.length||t<=i+a)return r+Math.min(a,t-i);if(i+=o-r,r=o+1,t<=(i+=n-i%n))return r}}var G=[""];function $(e){for(;G.length<=e;)G.push(Y(G)+" ");return G[e]}function Y(e){return e[e.length-1]}function X(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Z(){}function J(e,t){var n;return n=Object.create?Object.create(e):(Z.prototype=e,new Z),t&&I(t,n),n}var Q=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ee(e){return/\w/.test(e)||"€"<e&&(e.toUpperCase()!=e.toLowerCase()||Q.test(e))}function te(e,t){return t?!!(-1<t.source.indexOf("\\w")&&ee(e))||t.test(e):ee(e)}function ne(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var re=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ie(e){return 768<=e.charCodeAt(0)&&re.test(e)}function oe(e,t,n){for(;(n<0?0<t:t<e.length)&&ie(e.charAt(t));)t+=n;return t}function ae(e,t,n){for(var r=n<t?-1:1;;){if(t==n)return t;var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}var le=null;function se(e,t,n){var r;le=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&"before"==n?r=i:le=i),o.from==t&&(o.from!=o.to&&"before"!=n?r=i:le=i)}return null!=r?r:le}var ce,ue,de,fe,he,pe,me,ge=(ce="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",ue="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111",de=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,fe=/[stwN]/,he=/[LRr]/,pe=/[Lb1n]/,me=/[1n]/,function(e,t){var n="ltr"==t?"L":"R";if(0==e.length||"ltr"==t&&!de.test(e))return!1;for(var r,i=e.length,o=[],a=0;a<i;++a)o.push((r=e.charCodeAt(a))<=247?ce.charAt(r):1424<=r&&r<=1524?"R":1536<=r&&r<=1785?ue.charAt(r-1536):1774<=r&&r<=2220?"r":8192<=r&&r<=8203?"w":8204==r?"b":"L");for(var l=0,s=n;l<i;++l){var c=o[l];"m"==c?o[l]=s:s=c}for(var u=0,d=n;u<i;++u){var f=o[u];"1"==f&&"r"==d?o[u]="n":he.test(f)&&"r"==(d=f)&&(o[u]="R")}for(var h=1,p=o[0];h<i-1;++h){var m=o[h];"+"==m&&"1"==p&&"1"==o[h+1]?o[h]="1":","!=m||p!=o[h+1]||"1"!=p&&"n"!=p||(o[h]=p),p=m}for(var g=0;g<i;++g){var v=o[g];if(","==v)o[g]="N";else if("%"==v){var y=void 0;for(y=g+1;y<i&&"%"==o[y];++y);for(var b=g&&"!"==o[g-1]||y<i&&"1"==o[y]?"1":"N",w=g;w<y;++w)o[w]=b;g=y-1}}for(var x=0,k=n;x<i;++x){var C=o[x];"L"==k&&"1"==C?o[x]="L":he.test(C)&&(k=C)}for(var T=0;T<i;++T)if(fe.test(o[T])){var S=void 0;for(S=T+1;S<i&&fe.test(o[S]);++S);for(var L="L"==(T?o[T-1]:n),M=L==("L"==(S<i?o[S]:n))?L?"L":"R":n,A=T;A<S;++A)o[A]=M;T=S-1}for(var O,N=[],_=0;_<i;)if(pe.test(o[_])){var E=_;for(++_;_<i&&pe.test(o[_]);++_);N.push(new ve(0,E,_))}else{var z=_,D=N.length;for(++_;_<i&&"L"!=o[_];++_);for(var P=z;P<_;)if(me.test(o[P])){z<P&&N.splice(D,0,new ve(1,z,P));var F=P;for(++P;P<_&&me.test(o[P]);++P);N.splice(D,0,new ve(2,F,P)),z=P}else++P;z<_&&N.splice(D,0,new ve(1,z,_))}return"ltr"==t&&(1==N[0].level&&(O=e.match(/^\s+/))&&(N[0].from=O[0].length,N.unshift(new ve(0,0,O[0].length))),1==Y(N).level&&(O=e.match(/\s+$/))&&(Y(N).to-=O[0].length,N.push(new ve(0,i-O[0].length,i)))),"rtl"==t?N.reverse():N});function ve(e,t,n){this.level=e,this.from=t,this.to=n}function ye(e,t){var n=e.order;return null==n&&(n=e.order=ge(e.text,t)),n}var be=[],we=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||be).concat(n)}};function xe(e,t){return e._handlers&&e._handlers[t]||be}function ke(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var o=H(i,n);-1<o&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function Ce(e,t){var n=xe(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Te(e,t,n){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Ce(e,n||t.type,e,t),Ne(t)||t.codemirrorIgnore}function Se(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)-1==H(n,t[r])&&n.push(t[r])}function Le(e,t){return 0<xe(e,t).length}function Me(e){e.prototype.on=function(e,t){we(this,e,t)},e.prototype.off=function(e,t){ke(this,e,t)}}function Ae(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Oe(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Ne(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function _e(e){Ae(e),Oe(e)}function Ee(e){return e.target||e.srcElement}function ze(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),w&&e.ctrlKey&&1==t&&(t=3),t}var De,Pe,Fe=function(){if(x&&k<9)return!1;var e=N("div");return"draggable"in e||"dragDrop"in e}();function Ie(e){if(null==De){var t=N("span","​");A(e,N("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(De=t.offsetWidth<=1&&2<t.offsetHeight&&!(x&&k<8))}var n=De?N("span","​"):N("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function je(e){if(null!=Pe)return Pe;var t=A(e,document.createTextNode("AخA")),n=S(t,0,1).getBoundingClientRect(),r=S(t,1,2).getBoundingClientRect();return M(e),!(!n||n.left==n.right)&&(Pe=r.right-n.right<3)}var We,He=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(n.push(o.slice(0,a)),t+=a+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Re=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},Be="oncopy"in(We=N("div"))||(We.setAttribute("oncopy","return;"),"function"==typeof We.oncopy),qe=null;var Ue={},Ke={};function Ve(e){if("string"==typeof e&&Ke.hasOwnProperty(e))e=Ke[e];else if(e&&"string"==typeof e.name&&Ke.hasOwnProperty(e.name)){var t=Ke[e.name];"string"==typeof t&&(t={name:t}),(e=J(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ve("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ve("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Ge(e,t){t=Ve(t);var n=Ue[t.name];if(!n)return Ge(e,"text/plain");var r=n(e,t);if($e.hasOwnProperty(t.name)){var i=$e[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)r[a]=t.modeProps[a];return r}var $e={};function Ye(e,t){I(t,$e.hasOwnProperty(e)?$e[e]:$e[e]={})}function Xe(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Ze(e,t){for(var n;e.innerMode&&(n=e.innerMode(t))&&n.mode!=e;)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Je(e,t,n){return!e.startState||e.startState(t,n)}var Qe=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};function et(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(t<o){n=i;break}t-=o}return n.lines[t]}function tt(e,n,r){var i=[],o=n.line;return e.iter(n.line,r.line+1,function(e){var t=e.text;o==r.line&&(t=t.slice(0,r.ch)),o==n.line&&(t=t.slice(n.ch)),i.push(t),++o}),i}function nt(e,t,n){var r=[];return e.iter(t,n,function(e){r.push(e.text)}),r}function rt(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function it(e){if(null==e.parent)return null;for(var t=e.parent,n=H(t.lines,e),r=t.parent;r;r=(t=r).parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize();return n+t.first}function ot(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],o=i.height;if(t<o){e=i;continue e}t-=o,n+=i.chunkSize()}return n}while(!e.lines);for(var a=0;a<e.lines.length;++a){var l=e.lines[a].height;if(t<l)break;t-=l}return n+a}function at(e,t){return t>=e.first&&t<e.first+e.size}function lt(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function st(e,t,n){if(void 0===n&&(n=null),!(this instanceof st))return new st(e,t,n);this.line=e,this.ch=t,this.sticky=n}function ct(e,t){return e.line-t.line||e.ch-t.ch}function ut(e,t){return e.sticky==t.sticky&&0==ct(e,t)}function dt(e){return st(e.line,e.ch)}function ft(e,t){return ct(e,t)<0?t:e}function ht(e,t){return ct(e,t)<0?e:t}function pt(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function mt(e,t){if(t.line<e.first)return st(e.first,0);var n=e.first+e.size-1;return t.line>n?st(n,et(e,n).text.length):function(e,t){var n=e.ch;return null==n||t<n?st(e.line,t):n<0?st(e.line,0):e}(t,et(e,t.line).text.length)}function gt(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=mt(e,t[r]);return n}Qe.prototype.eol=function(){return this.pos>=this.string.length},Qe.prototype.sol=function(){return this.pos==this.lineStart},Qe.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Qe.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Qe.prototype.eat=function(e){var t=this.string.charAt(this.pos);if("string"==typeof e?t==e:t&&(e.test?e.test(t):e(t)))return++this.pos,t},Qe.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Qe.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Qe.prototype.skipToEnd=function(){this.pos=this.string.length},Qe.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(-1<t)return this.pos=t,!0},Qe.prototype.backUp=function(e){this.pos-=e},Qe.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=j(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?j(this.string,this.lineStart,this.tabSize):0)},Qe.prototype.indentation=function(){return j(this.string,null,this.tabSize)-(this.lineStart?j(this.string,this.lineStart,this.tabSize):0)},Qe.prototype.match=function(e,t,n){if("string"!=typeof e){var r=this.string.slice(this.pos).match(e);return r&&0<r.index?null:(r&&!1!==t&&(this.pos+=r[0].length),r)}function i(e){return n?e.toLowerCase():e}if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},Qe.prototype.current=function(){return this.string.slice(this.start,this.pos)},Qe.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Qe.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Qe.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var vt=function(e,t){this.state=e,this.lookAhead=t},yt=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};function bt(t,n,r,e){var s=[t.state.modeGen],i={};At(t,n.text,t.doc.mode,r,function(e,t){return s.push(e,t)},i,e);for(var c=r.state,o=function(e){r.baseTokens=s;var o=t.state.overlays[e],a=1,l=0;r.state=!0,At(t,n.text,o.mode,r,function(e,t){for(var n=a;l<e;){var r=s[a];e<r&&s.splice(a,1,e,s[a+1],r),a+=2,l=Math.min(e,r)}if(t)if(o.opaque)s.splice(n,a-n,e,"overlay "+t),a=n+2;else for(;n<a;n+=2){var i=s[n+1];s[n+1]=(i?i+" ":"")+"overlay "+t}},i),r.state=c,r.baseTokens=null,r.baseTokenPos=1},a=0;a<t.state.overlays.length;++a)o(a);return{styles:s,classes:i.bgClass||i.textClass?i:null}}function wt(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=xt(e,it(t)),i=t.text.length>e.options.maxHighlightLength&&Xe(e.doc.mode,r.state),o=bt(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function xt(n,r,e){var t=n.doc,i=n.display;if(!t.mode.startState)return new yt(t,!0,r);var o=function(e,t,n){for(var r,i,o=e.doc,a=n?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;a<l;--l){if(l<=o.first)return o.first;var s=et(o,l-1),c=s.stateAfter;if(c&&(!n||l+(c instanceof vt?c.lookAhead:0)<=o.modeFrontier))return l;var u=j(s.text,null,e.options.tabSize);(null==i||u<r)&&(i=l-1,r=u)}return i}(n,r,e),a=o>t.first&&et(t,o-1).stateAfter,l=a?yt.fromSaved(t,a,o):new yt(t,Je(t.mode),o);return t.iter(o,r,function(e){kt(n,e.text,l);var t=l.line;e.stateAfter=t==r-1||t%5==0||t>=i.viewFrom&&t<i.viewTo?l.save():null,l.nextLine()}),e&&(t.modeFrontier=l.line),l}function kt(e,t,n,r){var i=e.doc.mode,o=new Qe(t,e.options.tabSize,n);for(o.start=o.pos=r||0,""==t&&Ct(i,n.state);!o.eol();)Tt(i,o,n.state),o.start=o.pos}function Ct(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var n=Ze(e,t);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function Tt(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Ze(e,n).mode);var o=e.token(t,n);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}yt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},yt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},yt.prototype.nextLine=function(){this.line++,0<this.maxLookAhead&&this.maxLookAhead--},yt.fromSaved=function(e,t,n){return t instanceof vt?new yt(e,Xe(e.mode,t.state),n,t.lookAhead):new yt(e,Xe(e.mode,t),n)},yt.prototype.save=function(e){var t=!1!==e?Xe(this.doc.mode,this.state):this.state;return 0<this.maxLookAhead?new vt(t,this.maxLookAhead):t};var St=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Lt(e,t,n,r){var i,o,a=e.doc,l=a.mode,s=et(a,(t=mt(a,t)).line),c=xt(e,t.line,n),u=new Qe(s.text,e.options.tabSize,c);for(r&&(o=[]);(r||u.pos<t.ch)&&!u.eol();)u.start=u.pos,i=Tt(l,u,c.state),r&&o.push(new St(u,i,Xe(a.mode,c.state)));return r?o:new St(u,i,c.state)}function Mt(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";null==t[r]?t[r]=n[2]:new RegExp("(?:^|s)"+n[2]+"(?:$|s)").test(t[r])||(t[r]+=" "+n[2])}return e}function At(e,t,n,r,i,o,a){var l=n.flattenSpans;null==l&&(l=e.options.flattenSpans);var s,c=0,u=null,d=new Qe(t,e.options.tabSize,r),f=e.options.addModeClass&&[null];for(""==t&&Mt(Ct(n,r.state),o);!d.eol();){if(s=d.pos>e.options.maxHighlightLength?(l=!1,a&&kt(e,t,r,d.pos),d.pos=t.length,null):Mt(Tt(n,d,r.state,f),o),f){var h=f[0].name;h&&(s="m-"+(s?h+" "+s:h))}if(!l||u!=s){for(;c<d.start;)i(c=Math.min(d.start,c+5e3),u);u=s}d.start=d.pos}for(;c<d.pos;){var p=Math.min(d.pos,c+5e3);i(p,u),c=p}}var Ot=!1,Nt=!1;function _t(e,t,n){this.marker=e,this.from=t,this.to=n}function Et(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function zt(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n=n||[]).push(e[r]);return n}function Dt(e,t){if(t.full)return null;var n=at(e,t.from.line)&&et(e,t.from.line).markedSpans,r=at(e,t.to.line)&&et(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,o=t.to.ch,a=0==ct(t.from,t.to),l=function(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker;if(null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t)||o.from==t&&"bookmark"==a.type&&(!n||!o.marker.insertLeft)){var l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(r=r||[]).push(new _t(a,o.from,l?null:o.to))}}return r}(n,i,a),s=function(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker;if(null==o.to||(a.inclusiveRight?o.to>=t:o.to>t)||o.from==t&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(r=r||[]).push(new _t(a,l?null:o.from-t,null==o.to?null:o.to-t))}}return r}(r,o,a),c=1==t.text.length,u=Y(t.text).length+(c?i:0);if(l)for(var d=0;d<l.length;++d){var f=l[d];if(null==f.to){var h=Et(s,f.marker);h?c&&(f.to=null==h.to?null:h.to+u):f.to=i}}if(s)for(var p=0;p<s.length;++p){var m=s[p];if(null!=m.to&&(m.to+=u),null==m.from)Et(l,m.marker)||(m.from=u,c&&(l=l||[]).push(m));else m.from+=u,c&&(l=l||[]).push(m)}l=l&&Pt(l),s&&s!=l&&(s=Pt(s));var g=[l];if(!c){var v,y=t.text.length-2;if(0<y&&l)for(var b=0;b<l.length;++b)null==l[b].to&&(v=v||[]).push(new _t(l[b].marker,null,null));for(var w=0;w<y;++w)g.push(v);g.push(s)}return g}function Pt(e){for(var t=0;t<e.length;++t){var n=e[t];null!=n.from&&n.from==n.to&&!1!==n.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function Ft(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function It(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function jt(e){return e.inclusiveLeft?-1:0}function Wt(e){return e.inclusiveRight?1:0}function Ht(e,t){var n=e.lines.length-t.lines.length;if(0!=n)return n;var r=e.find(),i=t.find(),o=ct(r.from,i.from)||jt(e)-jt(t);if(o)return-o;var a=ct(r.to,i.to)||Wt(e)-Wt(t);return a||t.id-e.id}function Rt(e,t){var n,r=Nt&&e.markedSpans;if(r)for(var i=void 0,o=0;o<r.length;++o)(i=r[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!n||Ht(n,i.marker)<0)&&(n=i.marker);return n}function Bt(e){return Rt(e,!0)}function qt(e){return Rt(e,!1)}function Ut(e,t){var n,r=Nt&&e.markedSpans;if(r)for(var i=0;i<r.length;++i){var o=r[i];o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!n||Ht(n,o.marker)<0)&&(n=o.marker)}return n}function Kt(e,t,n,r,i){var o=et(e,t),a=Nt&&o.markedSpans;if(a)for(var l=0;l<a.length;++l){var s=a[l];if(s.marker.collapsed){var c=s.marker.find(0),u=ct(c.from,n)||jt(s.marker)-jt(i),d=ct(c.to,r)||Wt(s.marker)-Wt(i);if(!(0<=u&&d<=0||u<=0&&0<=d)&&(u<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?0<=ct(c.to,n):0<ct(c.to,n))||0<=u&&(s.marker.inclusiveRight&&i.inclusiveLeft?ct(c.from,r)<=0:ct(c.from,r)<0)))return!0}}}function Vt(e){for(var t;t=Bt(e);)e=t.find(-1,!0).line;return e}function Gt(e,t){var n=et(e,t),r=Vt(n);return n==r?t:it(r)}function $t(e,t){if(t>e.lastLine())return t;var n,r=et(e,t);if(!Yt(e,r))return t;for(;n=qt(r);)r=n.find(1,!0).line;return it(r)+1}function Yt(e,t){var n=Nt&&t.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i)if((r=n[i]).marker.collapsed){if(null==r.from)return!0;if(!r.marker.widgetNode&&0==r.from&&r.marker.inclusiveLeft&&Xt(e,t,r))return!0}}function Xt(e,t,n){if(null==n.to){var r=n.marker.find(1,!0);return Xt(e,r.line,Et(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if((i=t.markedSpans[o]).marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(null==i.to||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Xt(e,t,i))return!0}function Zt(e){for(var t=0,n=(e=Vt(e)).parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var o=n.parent;o;o=(n=o).parent)for(var a=0;a<o.children.length;++a){var l=o.children[a];if(l==n)break;t+=l.height}return t}function Jt(e){if(0==e.height)return 0;for(var t,n=e.text.length,r=e;t=Bt(r);){var i=t.find(0,!0);r=i.from.line,n+=i.from.ch-i.to.ch}for(r=e;t=qt(r);){var o=t.find(0,!0);n-=r.text.length-o.from.ch,n+=(r=o.to.line).text.length-o.to.ch}return n}function Qt(e){var n=e.display,t=e.doc;n.maxLine=et(t,t.first),n.maxLineLength=Jt(n.maxLine),n.maxLineChanged=!0,t.iter(function(e){var t=Jt(e);t>n.maxLineLength&&(n.maxLineLength=t,n.maxLine=e)})}var en=function(e,t,n){this.text=e,It(this,t),this.height=n?n(this):1};en.prototype.lineNo=function(){return it(this)},Me(en);var tn={},nn={};function rn(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?nn:tn;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function on(e,t){var n=O("span",null,null,b?"padding-right: .1px":null),r={pre:O("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,a=void 0;r.pos=0,r.addToken=ln,je(e.display.measure)&&(a=ye(o,e.doc.direction))&&(r.addToken=sn(r.addToken,a)),r.map=[],un(o,r,wt(e,o,t!=e.display.externalMeasured&&it(o))),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=D(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=D(o.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Ie(e.display.measure))),0==i?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(b){var l=r.content.lastChild;(/\bcm-tab\b/.test(l.className)||l.querySelector&&l.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Ce(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=D(r.pre.className,r.textClass||"")),r}function an(e){var t=N("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function ln(e,t,n,r,i,o,a){if(t){var l,s=e.splitSpaces?function(e,t){if(1<e.length&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!n||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),r+=o,n=" "==o}return r}(t,e.trailingSpace):t,c=e.cm.state.specialChars,u=!1;if(c.test(t)){l=document.createDocumentFragment();for(var d=0;;){c.lastIndex=d;var f=c.exec(t),h=f?f.index-d:t.length-d;if(h){var p=document.createTextNode(s.slice(d,d+h));x&&k<9?l.appendChild(N("span",[p])):l.appendChild(p),e.map.push(e.pos,e.pos+h,p),e.col+=h,e.pos+=h}if(!f)break;d+=1+h;var m=void 0;if("\t"==f[0]){var g=e.cm.options.tabSize,v=g-e.col%g;(m=l.appendChild(N("span",$(v),"cm-tab"))).setAttribute("role","presentation"),m.setAttribute("cm-text","\t"),e.col+=v}else"\r"==f[0]||"\n"==f[0]?(m=l.appendChild(N("span","\r"==f[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",f[0]):((m=e.cm.options.specialCharPlaceholder(f[0])).setAttribute("cm-text",f[0]),x&&k<9?l.appendChild(N("span",[m])):l.appendChild(m)),e.col+=1;e.map.push(e.pos,e.pos+1,m),e.pos++}}else e.col+=t.length,l=document.createTextNode(s),e.map.push(e.pos,e.pos+t.length,l),x&&k<9&&(u=!0),e.pos+=t.length;if(e.trailingSpace=32==s.charCodeAt(t.length-1),n||r||i||u||o){var y=n||"";r&&(y+=r),i&&(y+=i);var b=N("span",[l],y,o);if(a)for(var w in a)a.hasOwnProperty(w)&&"style"!=w&&"class"!=w&&b.setAttribute(w,a[w]);return e.content.appendChild(b)}e.content.appendChild(l)}}function sn(d,f){return function(e,t,n,r,i,o,a){n=n?n+" cm-force-border":"cm-force-border";for(var l=e.pos,s=l+t.length;;){for(var c=void 0,u=0;u<f.length&&!((c=f[u]).to>l&&c.from<=l);u++);if(c.to>=s)return d(e,t,n,r,i,o,a);d(e,t.slice(0,c.to-l),n,r,null,o,a),r=null,t=t.slice(c.to-l),l=c.to}}}function cn(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i=i||e.content.appendChild(document.createElement("span"))).setAttribute("cm-marker",n.id),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function un(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var a,l,s,c,u,d,f,h=i.length,p=0,m=1,g="",v=0;;){if(v==p){s=c=u=l="",d=f=null,v=1/0;for(var y=[],b=void 0,w=0;w<r.length;++w){var x=r[w],k=x.marker;if("bookmark"==k.type&&x.from==p&&k.widgetNode)y.push(k);else if(x.from<=p&&(null==x.to||x.to>p||k.collapsed&&x.to==p&&x.from==p)){if(null!=x.to&&x.to!=p&&v>x.to&&(v=x.to,c=""),k.className&&(s+=" "+k.className),k.css&&(l=(l?l+";":"")+k.css),k.startStyle&&x.from==p&&(u+=" "+k.startStyle),k.endStyle&&x.to==v&&(b=b||[]).push(k.endStyle,x.to),k.title&&((f=f||{}).title=k.title),k.attributes)for(var C in k.attributes)(f=f||{})[C]=k.attributes[C];k.collapsed&&(!d||Ht(d.marker,k)<0)&&(d=x)}else x.from>p&&v>x.from&&(v=x.from)}if(b)for(var T=0;T<b.length;T+=2)b[T+1]==v&&(c+=" "+b[T]);if(!d||d.from==p)for(var S=0;S<y.length;++S)cn(t,0,y[S]);if(d&&(d.from||0)==p){if(cn(t,(null==d.to?h+1:d.to)-p,d.marker,null==d.from),null==d.to)return;d.to==p&&(d=!1)}}if(h<=p)break;for(var L=Math.min(h,v);;){if(g){var M=p+g.length;if(!d){var A=L<M?g.slice(0,L-p):g;t.addToken(t,A,a?a+s:s,u,p+A.length==v?c:"",l,f)}if(L<=M){g=g.slice(L-p),p=L;break}p=M,u=""}g=i.slice(o,o=n[m++]),a=rn(n[m++],t.cm.options)}}else for(var O=1;O<n.length;O+=2)t.addToken(t,i.slice(o,o=n[O]),rn(n[O+1],t.cm.options))}function dn(e,t,n){this.line=t,this.rest=function(e){for(var t,n;t=qt(e);)e=t.find(1,!0).line,(n=n||[]).push(e);return n}(t),this.size=this.rest?it(Y(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Yt(e,t)}function fn(e,t,n){for(var r,i=[],o=t;o<n;o=r){var a=new dn(e.doc,et(e.doc,o),o);r=o+a.size,i.push(a)}return i}var hn=null;var pn=null;function mn(e,t){var n=xe(e,t);if(n.length){var r,i=Array.prototype.slice.call(arguments,2);hn?r=hn.delayedCallbacks:pn?r=pn:(r=pn=[],setTimeout(gn,0));for(var o=function(e){r.push(function(){return n[e].apply(null,i)})},a=0;a<n.length;++a)o(a)}}function gn(){var e=pn;pn=null;for(var t=0;t<e.length;++t)e[t]()}function vn(e,t,n,r){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?wn(e,t):"gutter"==o?kn(e,t,n,r):"class"==o?xn(e,t):"widget"==o&&Cn(e,t,r)}t.changes=null}function yn(e){return e.node==e.text&&(e.node=N("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),x&&k<8&&(e.node.style.zIndex=2)),e.node}function bn(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):on(e,t)}function wn(e,t){var n=t.text.className,r=bn(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,xn(e,t)):n&&(t.text.className=n)}function xn(e,t){!function(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=yn(t);t.background=r.insertBefore(N("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}(e,t),t.line.wrapClass?yn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function kn(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=yn(t);t.gutterBackground=N("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var a=yn(t),l=t.gutter=N("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(l),a.insertBefore(l,t.text),t.line.gutterClass&&(l.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=l.appendChild(N("div",lt(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var s=0;s<e.display.gutterSpecs.length;++s){var c=e.display.gutterSpecs[s].className,u=o.hasOwnProperty(c)&&o[c];u&&l.appendChild(N("div",[u],"CodeMirror-gutter-elt","left: "+r.gutterLeft[c]+"px; width: "+r.gutterWidth[c]+"px"))}}}function Cn(e,t,n){t.alignable&&(t.alignable=null);for(var r=t.node.firstChild,i=void 0;r;r=i)i=r.nextSibling,"CodeMirror-linewidget"==r.className&&t.node.removeChild(r);Tn(e,t,n)}function Tn(e,t,n){if(Sn(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Sn(e,t.rest[r],t,n,!1)}function Sn(e,t,n,r,i){if(t.widgets)for(var o=yn(n),a=0,l=t.widgets;a<l.length;++a){var s=l[a],c=N("div",[s.node],"CodeMirror-linewidget");s.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),Ln(s,c,n,r),e.display.input.setUneditable(c),i&&s.above?o.insertBefore(c,n.gutter||n.text):o.appendChild(c),mn(s,"redraw")}}function Ln(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function Mn(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!_(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),A(t.display.measure,N("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function An(e,t){for(var n=Ee(t);n!=e.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==e.sizer&&n!=e.mover)return!0}function On(e){return e.lineSpace.offsetTop}function Nn(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function _n(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=A(e.measure,N("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return isNaN(r.left)||isNaN(r.right)||(e.cachedPaddingH=r),r}function En(e){return R-e.display.nativeBarWidth}function zn(e){return e.display.scroller.clientWidth-En(e)-e.display.barWidth}function Dn(e){return e.display.scroller.clientHeight-En(e)-e.display.barHeight}function Pn(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(it(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Fn(e,t,n,r){return Wn(e,jn(e,t),n,r)}function In(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[pr(e,t)];var n=e.display.externalMeasured;return n&&t>=n.lineN&&t<n.lineN+n.size?n:void 0}function jn(e,t){var n=it(t),r=In(e,n);r&&!r.text?r=null:r&&r.changes&&(vn(e,r,n,cr(e)),e.curOp.forceUpdate=!0);var i=Pn(r=r||function(e,t){var n=it(t=Vt(t)),r=e.display.externalMeasured=new dn(e.doc,t,n);r.lineN=n;var i=r.built=on(e,r);return r.text=i.pre,A(e.display.lineMeasure,i.pre),r}(e,t),t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Wn(e,t,n,r,i){t.before&&(n=-1);var o,a=n+(r||"");return t.cache.hasOwnProperty(a)?o=t.cache[a]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(function(e,t,n){var r=e.options.lineWrapping,i=r&&zn(e);if(!t.measure.heights||r&&t.measure.width!=i){var o=t.measure.heights=[];if(r){t.measure.width=i;for(var a=t.text.firstChild.getClientRects(),l=0;l<a.length-1;l++){var s=a[l],c=a[l+1];2<Math.abs(s.bottom-c.bottom)&&o.push((s.bottom+c.top)/2-n.top)}}o.push(n.bottom-n.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,n,r){var i,o=Bn(t.map,n,r),a=o.node,l=o.start,s=o.end,c=o.collapse;if(3==a.nodeType){for(var u=0;u<4;u++){for(;l&&ie(t.line.text.charAt(o.coverStart+l));)--l;for(;o.coverStart+s<o.coverEnd&&ie(t.line.text.charAt(o.coverStart+s));)++s;if((i=x&&k<9&&0==l&&s==o.coverEnd-o.coverStart?a.parentNode.getBoundingClientRect():qn(S(a,l,s).getClientRects(),r)).left||i.right||0==l)break;s=l,l-=1,c="right"}x&&k<11&&(i=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=qe)return qe;var t=A(e,N("span","x")),n=t.getBoundingClientRect(),r=S(t,0,1).getBoundingClientRect();return qe=1<Math.abs(n.left-r.left)}(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}(e.display.measure,i))}else{var d;0<l&&(c=r="right"),i=e.options.lineWrapping&&1<(d=a.getClientRects()).length?d["right"==r?d.length-1:0]:a.getBoundingClientRect()}if(x&&k<9&&!l&&(!i||!i.left&&!i.right)){var f=a.parentNode.getClientRects()[0];i=f?{left:f.left,right:f.left+sr(e.display),top:f.top,bottom:f.bottom}:Rn}for(var h=i.top-t.rect.top,p=i.bottom-t.rect.top,m=(h+p)/2,g=t.view.measure.heights,v=0;v<g.length-1&&!(m<g[v]);v++);var y=v?g[v-1]:0,b=g[v],w={left:("right"==c?i.right:i.left)-t.rect.left,right:("left"==c?i.left:i.right)-t.rect.left,top:y,bottom:b};i.left||i.right||(w.bogus=!0);e.options.singleCursorHeightPerLine||(w.rtop=h,w.rbottom=p);return w}(e,t,n,r)).bogus||(t.cache[a]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var Hn,Rn={left:0,right:0,top:0,bottom:0};function Bn(e,t,n){for(var r,i,o,a,l,s,c=0;c<e.length;c+=3)if(l=e[c],s=e[c+1],t<l?(i=0,o=1,a="left"):t<s?o=(i=t-l)+1:(c==e.length-3||t==s&&e[c+3]>t)&&(i=(o=s-l)-1,s<=t&&(a="right")),null!=i){if(r=e[c+2],l==s&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;c&&e[c-2]==e[c-3]&&e[c-1].insertLeft;)r=e[2+(c-=3)],a="left";if("right"==n&&i==s-l)for(;c<e.length-3&&e[c+3]==e[c+4]&&!e[c+5].insertLeft;)r=e[(c+=3)+2],a="right";break}return{node:r,start:i,end:o,collapse:a,coverStart:l,coverEnd:s}}function qn(e,t){var n=Rn;if("left"==t)for(var r=0;r<e.length&&(n=e[r]).left==n.right;r++);else for(var i=e.length-1;0<=i&&(n=e[i]).left==n.right;i--);return n}function Un(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function Kn(e){e.display.externalMeasure=null,M(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Un(e.display.view[t])}function Vn(e){Kn(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Gn(){return a&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function $n(){return a&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Yn(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=Mn(e.widgets[n]));return t}function Xn(e,t,n,r,i){if(!i){var o=Yn(t);n.top+=o,n.bottom+=o}if("line"==r)return n;r=r||"local";var a=Zt(t);if("local"==r?a+=On(e.display):a-=e.display.viewOffset,"page"==r||"window"==r){var l=e.display.lineSpace.getBoundingClientRect();a+=l.top+("window"==r?0:$n());var s=l.left+("window"==r?0:Gn());n.left+=s,n.right+=s}return n.top+=a,n.bottom+=a,n}function Zn(e,t,n){if("div"==n)return t;var r=t.left,i=t.top;if("page"==n)r-=Gn(),i-=$n();else if("local"==n||!n){var o=e.display.sizer.getBoundingClientRect();r+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:r-a.left,top:i-a.top}}function Jn(e,t,n,r,i){return Xn(e,r=r||et(e.doc,t.line),Fn(e,r,t.ch,i),n)}function Qn(r,e,i,o,a,l){function s(e,t){var n=Wn(r,a,e,t?"right":"left",l);return t?n.left=n.right:n.right=n.left,Xn(r,o,n,i)}o=o||et(r.doc,e.line),a=a||jn(r,o);var c=ye(o,r.doc.direction),t=e.ch,n=e.sticky;if(t>=o.text.length?(t=o.text.length,n="before"):t<=0&&(t=0,n="after"),!c)return s("before"==n?t-1:t,"before"==n);function u(e,t,n){return s(n?e-1:e,1==c[t].level!=n)}var d=se(c,t,n),f=le,h=u(t,d,"before"==n);return null!=f&&(h.other=u(t,f,"before"!=n)),h}function er(e,t){var n=0;t=mt(e.doc,t),e.options.lineWrapping||(n=sr(e.display)*t.ch);var r=et(e.doc,t.line),i=Zt(r)+On(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function tr(e,t,n,r,i){var o=st(e,t,n);return o.xRel=i,r&&(o.outside=r),o}function nr(e,t,n){var r=e.doc;if((n+=e.display.viewOffset)<0)return tr(r.first,0,null,-1,-1);var i=ot(r,n),o=r.first+r.size-1;if(o<i)return tr(r.first+r.size-1,et(r,o).text.length,null,1,1);t<0&&(t=0);for(var a=et(r,i);;){var l=ar(e,a,i,t,n),s=Ut(a,l.ch+(0<l.xRel||0<l.outside?1:0));if(!s)return l;var c=s.find(1);if(c.line==i)return c;a=et(r,i=c.line)}}function rr(t,e,n,r){r-=Yn(e);var i=e.text.length,o=ae(function(e){return Wn(t,n,e-1).bottom<=r},i,0);return{begin:o,end:i=ae(function(e){return Wn(t,n,e).top>r},o,i)}}function ir(e,t,n,r){return rr(e,t,n=n||jn(e,t),Xn(e,t,Wn(e,n,r),"line").top)}function or(e,t,n,r){return!(e.bottom<=n)&&(e.top>n||(r?e.left:e.right)>t)}function ar(n,e,t,r,i){i-=Zt(e);var o=jn(n,e),a=Yn(e),l=0,s=e.text.length,c=!0,u=ye(e,n.doc.direction);if(u){var d=(n.options.lineWrapping?function(e,t,n,r,i,o,a){var l=rr(e,t,r,a),s=l.begin,c=l.end;/\s/.test(t.text.charAt(c-1))&&c--;for(var u=null,d=null,f=0;f<i.length;f++){var h=i[f];if(!(h.from>=c||h.to<=s)){var p=1!=h.level,m=Wn(e,r,p?Math.min(c,h.to)-1:Math.max(s,h.from)).right,g=m<o?o-m+1e9:m-o;(!u||g<d)&&(u=h,d=g)}}u=u||i[i.length-1];u.from<s&&(u={from:s,to:u.to,level:u.level});u.to>c&&(u={from:u.from,to:c,level:u.level});return u}:function(r,i,o,a,l,s,c){var e=ae(function(e){var t=l[e],n=1!=t.level;return or(Qn(r,st(o,n?t.to:t.from,n?"before":"after"),"line",i,a),s,c,!0)},0,l.length-1),t=l[e];if(0<e){var n=1!=t.level,u=Qn(r,st(o,n?t.from:t.to,n?"after":"before"),"line",i,a);or(u,s,c,!0)&&u.top>c&&(t=l[e-1])}return t})(n,e,t,o,u,r,i);l=(c=1!=d.level)?d.from:d.to-1,s=c?d.to:d.from-1}var f,h,p=null,m=null,g=ae(function(e){var t=Wn(n,o,e);return t.top+=a,t.bottom+=a,!!or(t,r,i,!1)&&(t.top<=i&&t.left<=r&&(p=e,m=t),!0)},l,s),v=!1;if(m){var y=r-m.left<m.right-r,b=y==c;g=p+(b?0:1),h=b?"after":"before",f=y?m.left:m.right}else{c||g!=s&&g!=l||g++,h=0==g?"after":g==e.text.length?"before":Wn(n,o,g-(c?1:0)).bottom+a<=i==c?"after":"before";var w=Qn(n,st(t,g,h),"line",e,o);f=w.left,v=i<w.top?-1:i>=w.bottom?1:0}return tr(t,g=oe(e.text,g,1),h,v,r-f)}function lr(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Hn){Hn=N("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Hn.appendChild(document.createTextNode("x")),Hn.appendChild(N("br"));Hn.appendChild(document.createTextNode("x"))}A(e.measure,Hn);var n=Hn.offsetHeight/50;return 3<n&&(e.cachedTextHeight=n),M(e.measure),n||1}function sr(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=N("span","xxxxxxxxxx"),n=N("pre",[t],"CodeMirror-line-like");A(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return 2<i&&(e.cachedCharWidth=i),i||10}function cr(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var l=e.display.gutterSpecs[a].className;n[l]=o.offsetLeft+o.clientLeft+i,r[l]=o.clientWidth}return{fixedPos:ur(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function ur(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function dr(r){var i=lr(r.display),o=r.options.lineWrapping,a=o&&Math.max(5,r.display.scroller.clientWidth/sr(r.display)-3);return function(e){if(Yt(r.doc,e))return 0;var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;n++)e.widgets[n].height&&(t+=e.widgets[n].height);return o?t+(Math.ceil(e.text.length/a)||1)*i:t+i}}function fr(e){var t=e.doc,n=dr(e);t.iter(function(e){var t=n(e);t!=e.height&&rt(e,t)})}function hr(e,t,n,r){var i=e.display;if(!n&&"true"==Ee(t).getAttribute("cm-not-content"))return null;var o,a,l=i.lineSpace.getBoundingClientRect();try{o=t.clientX-l.left,a=t.clientY-l.top}catch(t){return null}var s,c=nr(e,o,a);if(r&&1==c.xRel&&(s=et(e.doc,c.line).text).length==c.ch){var u=j(s,s.length,e.options.tabSize)-s.length;c=st(c.line,Math.max(0,Math.round((o-_n(e.display).left)/sr(e.display))-u))}return c}function pr(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if((t-=n[r].size)<0)return r}function mr(e,t,n,r){null==t&&(t=e.doc.first),null==n&&(n=e.doc.first+e.doc.size),r=r||0;var i=e.display;if(r&&n<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Nt&&Gt(e.doc,t)<i.viewTo&&vr(e);else if(n<=i.viewFrom)Nt&&$t(e.doc,n+r)>i.viewFrom?vr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)vr(e);else if(t<=i.viewFrom){var o=yr(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):vr(e)}else if(n>=i.viewTo){var a=yr(e,t,t,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):vr(e)}else{var l=yr(e,t,t,-1),s=yr(e,n,n+r,1);l&&s?(i.view=i.view.slice(0,l.index).concat(fn(e,l.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=r):vr(e)}var c=i.externalMeasured;c&&(n<c.lineN?c.lineN+=r:t<c.lineN+c.size&&(i.externalMeasured=null))}function gr(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),!(t<r.viewFrom||t>=r.viewTo)){var o=r.view[pr(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==H(a,n)&&a.push(n)}}}function vr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function yr(e,t,n,r){var i,o=pr(e,t),a=e.display.view;if(!Nt||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var l=e.display.viewFrom,s=0;s<o;s++)l+=a[s].size;if(l!=t){if(0<r){if(o==a.length-1)return null;i=l+a[o].size-t,o++}else i=l-t;t+=i,n+=i}for(;Gt(e.doc,n)!=n;){if(o==(r<0?0:a.length-1))return null;n+=r*a[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function br(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];i.hidden||i.node&&!i.changes||++n}return n}function wr(e){e.display.input.showSelection(e.display.input.prepareSelection())}function xr(e,t){void 0===t&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),o=r.selection=document.createDocumentFragment(),a=0;a<n.sel.ranges.length;a++)if(t||a!=n.sel.primIndex){var l=n.sel.ranges[a];if(!(l.from().line>=e.display.viewTo||l.to().line<e.display.viewFrom)){var s=l.empty();(s||e.options.showCursorWhenSelecting)&&kr(e,l.head,i),s||Tr(e,l,o)}}return r}function kr(e,t,n){var r=Qn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(N("div"," ","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var o=n.appendChild(N("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=r.other.left+"px",o.style.top=r.other.top+"px",o.style.height=.85*(r.other.bottom-r.other.top)+"px"}}function Cr(e,t){return e.top-t.top||e.left-t.left}function Tr(a,e,t){var n=a.display,r=a.doc,i=document.createDocumentFragment(),o=_n(a.display),L=o.left,M=Math.max(n.sizerWidth,zn(a)-n.sizer.offsetLeft)-o.right,A="ltr"==r.direction;function O(e,t,n,r){t<0&&(t=0),t=Math.round(t),r=Math.round(r),i.appendChild(N("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==n?M-e:n)+"px;\n height: "+(r-t)+"px"))}function l(n,y,b){var w,x,o=et(r,n),k=o.text.length;function C(e,t){return Jn(a,st(n,e),"div",o,t)}function T(e,t,n){var r=ir(a,o,null,e),i="ltr"==t==("after"==n)?"left":"right";return C("after"==n?r.begin:r.end-(/\s/.test(o.text.charAt(r.end-1))?2:1),i)[i]}var S=ye(o,r.direction);return function(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var a=e[o];(a.from<n&&a.to>t||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),1==a.level?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}(S,y||0,null==b?k:b,function(e,t,n,r){var i="ltr"==n,o=C(e,i?"left":"right"),a=C(t-1,i?"right":"left"),l=null==y&&0==e,s=null==b&&t==k,c=0==r,u=!S||r==S.length-1;if(a.top-o.top<=3){var d=(A?s:l)&&u,f=(A?l:s)&&c?L:(i?o:a).left,h=d?M:(i?a:o).right;O(f,o.top,h-f,o.bottom)}else{var p,m,g,v;v=i?(p=A&&l&&c?L:o.left,m=A?M:T(e,n,"before"),g=A?L:T(t,n,"after"),A&&s&&u?M:a.right):(p=A?T(e,n,"before"):L,m=!A&&l&&c?M:o.right,g=!A&&s&&u?L:a.left,A?T(t,n,"after"):M),O(p,o.top,m-p,o.bottom),o.bottom<a.top&&O(L,o.bottom,null,a.top),O(g,a.top,v-g,a.bottom)}(!w||Cr(o,w)<0)&&(w=o),Cr(a,w)<0&&(w=a),(!x||Cr(o,x)<0)&&(x=o),Cr(a,x)<0&&(x=a)}),{start:w,end:x}}var s=e.from(),c=e.to();if(s.line==c.line)l(s.line,s.ch,c.ch);else{var u=et(r,s.line),d=et(r,c.line),f=Vt(u)==Vt(d),h=l(s.line,s.ch,f?u.text.length+1:null).end,p=l(c.line,f?0:null,c.ch).start;f&&(h.top<p.top-2?(O(h.right,h.top,null,h.bottom),O(L,p.top,p.left,p.bottom)):O(h.right,h.top,p.left-h.right,h.bottom)),h.bottom<p.top&&O(L,h.bottom,null,p.top)}t.appendChild(i)}function Sr(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",0<e.options.cursorBlinkRate?t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Lr(e){e.state.focused||(e.display.input.focus(),Ar(e))}function Mr(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Or(e))},100)}function Ar(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(Ce(e,"focus",e,t),e.state.focused=!0,z(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),b&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sr(e))}function Or(e,t){e.state.delayingBlurEvent||(e.state.focused&&(Ce(e,"blur",e,t),e.state.focused=!1,L(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Nr(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],o=e.options.lineWrapping,a=void 0,l=0;if(!i.hidden){if(x&&k<8){var s=i.node.offsetTop+i.node.offsetHeight;a=s-n,n=s}else{var c=i.node.getBoundingClientRect();a=c.bottom-c.top,!o&&i.text.firstChild&&(l=i.text.firstChild.getBoundingClientRect().right-c.left-1)}var u=i.line.height-a;if((.005<u||u<-.005)&&(rt(i.line,a),_r(i.line),i.rest))for(var d=0;d<i.rest.length;d++)_r(i.rest[d]);if(l>e.display.sizerWidth){var f=Math.ceil(l/sr(e.display));f>e.display.maxLineLength&&(e.display.maxLineLength=f,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}}function _r(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Er(e,t,n){var r=n&&null!=n.top?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-On(e));var i=n&&null!=n.bottom?n.bottom:r+e.wrapper.clientHeight,o=ot(t,r),a=ot(t,i);if(n&&n.ensure){var l=n.ensure.from.line,s=n.ensure.to.line;l<o?a=ot(t,Zt(et(t,o=l))+e.wrapper.clientHeight):Math.min(s,t.lastLine())>=a&&(o=ot(t,Zt(et(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function zr(e,t){var n=e.display,r=lr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:n.scroller.scrollTop,o=Dn(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var l=e.doc.height+Nn(n),s=t.top<r,c=t.bottom>l-r;if(t.top<i)a.scrollTop=s?0:t.top;else if(t.bottom>i+o){var u=Math.min(t.top,(c?l:t.bottom)-o);u!=i&&(a.scrollTop=u)}var d=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft,f=zn(e)-(e.options.fixedGutter?n.gutters.offsetWidth:0),h=t.right-t.left>f;return h&&(t.right=t.left+f),t.left<10?a.scrollLeft=0:t.left<d?a.scrollLeft=Math.max(0,t.left-(h?0:10)):t.right>f+d-3&&(a.scrollLeft=t.right+(h?0:10)-f),a}function Dr(e,t){null!=t&&(Ir(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Pr(e){Ir(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Fr(e,t,n){null==t&&null==n||Ir(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function Ir(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,jr(e,er(e,t.from),er(e,t.to),t.margin))}function jr(e,t,n,r){var i=zr(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});Fr(e,i.scrollLeft,i.scrollTop)}function Wr(e,t){Math.abs(e.doc.scrollTop-t)<2||(m||di(e,{top:t}),Hr(e,t,!0),m&&di(e),ai(e,100))}function Hr(e,t,n){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),e.display.scroller.scrollTop==t&&!n||(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Rr(e,t,n,r){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r||(e.doc.scrollLeft=t,pi(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Br(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Nn(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+En(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}function qr(e,t,n){this.cm=n;var r=this.vert=N("div",[N("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=N("div",[N("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),we(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),we(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,x&&k<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}qr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&0<e.clientHeight&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},qr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},qr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},qr.prototype.zeroWidthHack=function(){var e=w&&!l?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new W,this.disableVert=new W},qr.prototype.enableZeroWidthBar=function(n,r,i){n.style.pointerEvents="auto",r.set(1e3,function e(){var t=n.getBoundingClientRect();("vert"==i?document.elementFromPoint(t.right-1,(t.top+t.bottom)/2):document.elementFromPoint((t.right+t.left)/2,t.bottom-1))!=n?n.style.pointerEvents="none":r.set(1e3,e)})},qr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};function Ur(){}function Kr(e,t){t=t||Br(e);var n=e.display.barWidth,r=e.display.barHeight;Vr(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Nr(e),Vr(e,Br(e)),n=e.display.barWidth,r=e.display.barHeight}function Vr(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}Ur.prototype.update=function(){return{bottom:0,right:0}},Ur.prototype.setScrollLeft=function(){},Ur.prototype.setScrollTop=function(){},Ur.prototype.clear=function(){};var Gr={native:qr,null:Ur};function $r(n){n.display.scrollbars&&(n.display.scrollbars.clear(),n.display.scrollbars.addClass&&L(n.display.wrapper,n.display.scrollbars.addClass)),n.display.scrollbars=new Gr[n.options.scrollbarStyle](function(e){n.display.wrapper.insertBefore(e,n.display.scrollbarFiller),we(e,"mousedown",function(){n.state.focused&&setTimeout(function(){return n.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,t){"horizontal"==t?Rr(n,e):Wr(n,e)},n),n.display.scrollbars.addClass&&z(n.display.wrapper,n.display.scrollbars.addClass)}var Yr=0;function Xr(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Yr},function(e){hn?hn.ops.push(e):e.ownsGroup=hn={ops:[e],delayedCallbacks:[]}}(e.curOp)}function Zr(e){var t=e.curOp;t&&function(e,t){var n=e.ownsGroup;if(n)try{!function(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}(n)}finally{hn=null,t(n)}}(t,function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;!function(e){for(var t=e.ops,n=0;n<t.length;n++)Jr(t[n]);for(var r=0;r<t.length;r++)(i=t[r]).updatedDisplay=i.mustUpdate&&ci(i.cm,i.update);var i;for(var o=0;o<t.length;o++)Qr(t[o]);for(var a=0;a<t.length;a++)ei(t[a]);for(var l=0;l<t.length;l++)ti(t[l])}(e)})}function Jr(e){var t=e.cm,n=t.display;!function(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=En(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=En(e)+"px",t.scrollbarsClipped=!0)}(t),e.updateMaxLine&&Qt(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new si(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Qr(e){var t=e.cm,n=t.display;e.updatedDisplay&&Nr(t),e.barMeasure=Br(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Fn(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+En(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-zn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function ei(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Rr(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==E();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),!e.updatedDisplay&&e.startHeight==t.doc.height||Kr(t,e.barMeasure),e.updatedDisplay&&hi(t,e.barMeasure),e.selectionChanged&&Sr(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&Lr(e.cm)}function ti(e){var t=e.cm,n=t.display,r=t.doc;e.updatedDisplay&&ui(t,e.update),null==n.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(n.wheelStartX=n.wheelStartY=null),null!=e.scrollTop&&Hr(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&Rr(t,e.scrollLeft,!0,!0),e.scrollToPos&&function(e,t){if(!Te(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!c){var o=N("div","​",null,"position: absolute;\n top: "+(t.top-n.viewOffset-On(e.display))+"px;\n height: "+(t.bottom-t.top+En(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}(t,function(e,t,n,r){var i;null==r&&(r=0),e.options.lineWrapping||t!=n||(n="before"==(t=t.ch?st(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?st(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var a=!1,l=Qn(e,t),s=n&&n!=t?Qn(e,n):l,c=zr(e,i={left:Math.min(l.left,s.left),top:Math.min(l.top,s.top)-r,right:Math.max(l.left,s.left),bottom:Math.max(l.bottom,s.bottom)+r}),u=e.doc.scrollTop,d=e.doc.scrollLeft;if(null!=c.scrollTop&&(Wr(e,c.scrollTop),1<Math.abs(e.doc.scrollTop-u)&&(a=!0)),null!=c.scrollLeft&&(Rr(e,c.scrollLeft),1<Math.abs(e.doc.scrollLeft-d)&&(a=!0)),!a)break}return i}(t,mt(r,e.scrollToPos.from),mt(r,e.scrollToPos.to),e.scrollToPos.margin));var i=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(i)for(var a=0;a<i.length;++a)i[a].lines.length||Ce(i[a],"hide");if(o)for(var l=0;l<o.length;++l)o[l].lines.length&&Ce(o[l],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Ce(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function ni(e,t){if(e.curOp)return t();Xr(e);try{return t()}finally{Zr(e)}}function ri(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Xr(e);try{return t.apply(e,arguments)}finally{Zr(e)}}}function ii(e){return function(){if(this.curOp)return e.apply(this,arguments);Xr(this);try{return e.apply(this,arguments)}finally{Zr(this)}}}function oi(t){return function(){var e=this.cm;if(!e||e.curOp)return t.apply(this,arguments);Xr(e);try{return t.apply(this,arguments)}finally{Zr(e)}}}function ai(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,F(li,e))}function li(s){var c=s.doc;if(!(c.highlightFrontier>=s.display.viewTo)){var u=+new Date+s.options.workTime,d=xt(s,c.highlightFrontier),f=[];c.iter(d.line,Math.min(c.first+c.size,s.display.viewTo+500),function(e){if(d.line>=s.display.viewFrom){var t=e.styles,n=e.text.length>s.options.maxHighlightLength?Xe(c.mode,d.state):null,r=bt(s,e,d,!0);n&&(d.state=n),e.styles=r.styles;var i=e.styleClasses,o=r.classes;o?e.styleClasses=o:i&&(e.styleClasses=null);for(var a=!t||t.length!=e.styles.length||i!=o&&(!i||!o||i.bgClass!=o.bgClass||i.textClass!=o.textClass),l=0;!a&&l<t.length;++l)a=t[l]!=e.styles[l];a&&f.push(d.line),e.stateAfter=d.save(),d.nextLine()}else e.text.length<=s.options.maxHighlightLength&&kt(s,e.text,d),e.stateAfter=d.line%5==0?d.save():null,d.nextLine();if(+new Date>u)return ai(s,s.options.workDelay),!0}),c.highlightFrontier=d.line,c.modeFrontier=Math.max(c.modeFrontier,d.line),f.length&&ni(s,function(){for(var e=0;e<f.length;e++)gr(s,f[e],"text")})}}var si=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Er(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=zn(e),this.force=n,this.dims=cr(e),this.events=[]};function ci(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return vr(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==br(e))return!1;mi(e)&&(vr(e),t.dims=cr(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<o&&o-n.viewFrom<20&&(o=Math.max(r.first,n.viewFrom)),n.viewTo>a&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),Nt&&(o=Gt(e.doc,o),a=$t(e.doc,a));var l=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;!function(e,t,n){var r=e.display;0==r.view.length||t>=r.viewTo||n<=r.viewFrom?(r.view=fn(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=fn(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(pr(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(fn(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,pr(e,n)))),r.viewTo=n}(e,o,a),n.viewOffset=Zt(et(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var s=br(e);if(!l&&0==s&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var c=function(e){if(e.hasFocus())return null;var t=E();if(!t||!_(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&_(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}(e);return 4<s&&(n.lineDiv.style.display="none"),function(n,e,t){var r=n.display,i=n.options.lineNumbers,o=r.lineDiv,a=o.firstChild;function l(e){var t=e.nextSibling;return b&&w&&n.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),t}for(var s=r.view,c=r.viewFrom,u=0;u<s.length;u++){var d=s[u];if(d.hidden);else if(d.node&&d.node.parentNode==o){for(;a!=d.node;)a=l(a);var f=i&&null!=e&&e<=c&&d.lineNumber;d.changes&&(-1<H(d.changes,"gutter")&&(f=!1),vn(n,d,c,t)),f&&(M(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(lt(n.options,c)))),a=d.node.nextSibling}else{var h=(g=c,v=t,void 0,y=bn(p=n,m=d),m.text=m.node=y.pre,y.bgClass&&(m.bgClass=y.bgClass),y.textClass&&(m.textClass=y.textClass),xn(p,m),kn(p,m,g,v),Tn(p,m,v),m.node);o.insertBefore(h,a)}c+=d.size}var p,m,g,v,y;for(;a;)a=l(a)}(e,n.updateLineNumbers,t.dims),4<s&&(n.lineDiv.style.display=""),n.renderedView=n.view,function(e){if(e&&e.activeElt&&e.activeElt!=E()&&(e.activeElt.focus(),e.anchorNode&&_(document.body,e.anchorNode)&&_(document.body,e.focusNode))){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}(c),M(n.cursorDiv),M(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,l&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ai(e,400)),!(n.updateLineNumbers=null)}function ui(e,t){for(var n=t.viewport,r=!0;(r&&e.options.lineWrapping&&t.oldDisplayWidth!=zn(e)||(n&&null!=n.top&&(n={top:Math.min(e.doc.height+Nn(e.display)-Dn(e),n.top)}),t.visible=Er(e.display,e.doc,n),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&ci(e,t);r=!1){Nr(e);var i=Br(e);wr(e),Kr(e,i),hi(e,i),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function di(e,t){var n=new si(e,t);if(ci(e,n)){Nr(e),ui(e,n);var r=Br(e);wr(e),Kr(e,r),hi(e,r),n.finish()}}function fi(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function hi(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+En(e)+"px"}function pi(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=ur(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;a<n.length;a++)if(!n[a].hidden){e.options.fixedGutter&&(n[a].gutter&&(n[a].gutter.style.left=o),n[a].gutterBackground&&(n[a].gutterBackground.style.left=o));var l=n[a].alignable;if(l)for(var s=0;s<l.length;s++)l[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}}function mi(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=lt(e.options,t.first+t.size-1),r=e.display;if(n.length==r.lineNumChars)return!1;var i=r.measure.appendChild(N("div",[N("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(o,r.lineGutter.offsetWidth-a)+1,r.lineNumWidth=r.lineNumInnerWidth+a,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",fi(e.display),!0}function gi(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var o=e[i],a=null;if("string"!=typeof o&&(a=o.style,o=o.className),"CodeMirror-linenumbers"==o){if(!t)continue;r=!0}n.push({className:o,style:a})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function vi(e){var t=e.gutters,n=e.gutterSpecs;M(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],o=i.className,a=i.style,l=t.appendChild(N("div",null,"CodeMirror-gutter "+o));a&&(l.style.cssText=a),"CodeMirror-linenumbers"==o&&((e.lineGutter=l).style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",fi(e)}function yi(e){vi(e.display),mr(e),pi(e)}function bi(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=N("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=N("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=O("div",null,"CodeMirror-code"),i.selectionDiv=N("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=N("div",null,"CodeMirror-cursors"),i.measure=N("div",null,"CodeMirror-measure"),i.lineMeasure=N("div",null,"CodeMirror-measure"),i.lineSpace=O("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var o=O("div",[i.lineSpace],"CodeMirror-lines");i.mover=N("div",[o],null,"position: relative"),i.sizer=N("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=N("div",null,null,"position: absolute; height: "+R+"px; width: 1px;"),i.gutters=N("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=N("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=N("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),x&&k<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),b||m&&f||(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=gi(r.gutters,r.lineNumbers),vi(i),n.init(i)}si.prototype.signal=function(e,t){Le(e,t)&&this.events.push(arguments)},si.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Ce.apply(null,this.events[e])};var wi=0,xi=null;function ki(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta),{x:t,y:n}}function Ci(e){var t=ki(e);return t.x*=xi,t.y*=xi,t}function Ti(e,t){var n=ki(t),r=n.x,i=n.y,o=e.display,a=o.scroller,l=a.scrollWidth>a.clientWidth,s=a.scrollHeight>a.clientHeight;if(r&&l||i&&s){if(i&&w&&b)e:for(var c=t.target,u=o.view;c!=a;c=c.parentNode)for(var d=0;d<u.length;d++)if(u[d].node==c){e.display.currentWheelTarget=c;break e}if(r&&!m&&!g&&null!=xi)return i&&s&&Wr(e,Math.max(0,a.scrollTop+i*xi)),Rr(e,Math.max(0,a.scrollLeft+r*xi)),(!i||i&&s)&&Ae(t),void(o.wheelStartX=null);if(i&&null!=xi){var f=i*xi,h=e.doc.scrollTop,p=h+o.wrapper.clientHeight;f<0?h=Math.max(0,h+f-50):p=Math.min(e.doc.height,p+f+50),di(e,{top:h,bottom:p})}wi<20&&(null==o.wheelStartX?(o.wheelStartX=a.scrollLeft,o.wheelStartY=a.scrollTop,o.wheelDX=r,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=a.scrollLeft-o.wheelStartX,t=a.scrollTop-o.wheelStartY,n=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,n&&(xi=(xi*wi+n)/(wi+1),++wi)}},200)):(o.wheelDX+=r,o.wheelDY+=i))}}x?xi=-.53:m?xi=15:a?xi=-.7:s&&(xi=-1/3);var Si=function(e,t){this.ranges=e,this.primIndex=t};Si.prototype.primary=function(){return this.ranges[this.primIndex]},Si.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!ut(n.anchor,r.anchor)||!ut(n.head,r.head))return!1}return!0},Si.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Li(dt(this.ranges[t].anchor),dt(this.ranges[t].head));return new Si(e,this.primIndex)},Si.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Si.prototype.contains=function(e,t){t=t||e;for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(0<=ct(t,r.from())&&ct(e,r.to())<=0)return n}return-1};var Li=function(e,t){this.anchor=e,this.head=t};function Mi(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(e,t){return ct(e.from(),t.from())}),n=H(t,i);for(var o=1;o<t.length;o++){var a=t[o],l=t[o-1],s=ct(l.to(),a.from());if(r&&!a.empty()?0<s:0<=s){var c=ht(l.from(),a.from()),u=ft(l.to(),a.to()),d=l.empty()?a.from()==a.head:l.from()==l.head;o<=n&&--n,t.splice(--o,2,new Li(d?u:c,d?c:u))}}return new Si(t,n)}function Ai(e,t){return new Si([new Li(e,t||e)],0)}function Oi(e){return e.text?st(e.from.line+e.text.length-1,Y(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Ni(e,t){if(ct(e,t.from)<0)return e;if(ct(e,t.to)<=0)return Oi(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Oi(t).ch-t.to.ch),st(n,r)}function _i(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new Li(Ni(i.anchor,t),Ni(i.head,t)))}return Mi(e.cm,n,e.sel.primIndex)}function Ei(e,t,n){return e.line==t.line?st(n.line,e.ch-t.ch+n.ch):st(n.line+(e.line-t.line),e.ch)}function zi(e){e.doc.mode=Ge(e.options,e.doc.modeOption),Di(e)}function Di(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,ai(e,100),e.state.modeGen++,e.curOp&&mr(e)}function Pi(e,t){return 0==t.from.ch&&0==t.to.ch&&""==Y(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Fi(e,r,t,i){function o(e){return t?t[e]:null}function n(e,t,n){!function(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Ft(e),It(e,n);var i=r?r(e):1;i!=e.height&&rt(e,i)}(e,t,n,i),mn(e,"change",e,r)}function a(e,t){for(var n=[],r=e;r<t;++r)n.push(new en(c[r],o(r),i));return n}var l=r.from,s=r.to,c=r.text,u=et(e,l.line),d=et(e,s.line),f=Y(c),h=o(c.length-1),p=s.line-l.line;if(r.full)e.insert(0,a(0,c.length)),e.remove(c.length,e.size-c.length);else if(Pi(e,r)){var m=a(0,c.length-1);n(d,d.text,h),p&&e.remove(l.line,p),m.length&&e.insert(l.line,m)}else if(u==d)if(1==c.length)n(u,u.text.slice(0,l.ch)+f+u.text.slice(s.ch),h);else{var g=a(1,c.length-1);g.push(new en(f+u.text.slice(s.ch),h,i)),n(u,u.text.slice(0,l.ch)+c[0],o(0)),e.insert(l.line+1,g)}else if(1==c.length)n(u,u.text.slice(0,l.ch)+c[0]+d.text.slice(s.ch),o(0)),e.remove(l.line+1,p);else{n(u,u.text.slice(0,l.ch)+c[0],o(0)),n(d,f+d.text.slice(s.ch),h);var v=a(1,c.length-1);1<p&&e.remove(l.line+1,p-1),e.insert(l.line+1,v)}mn(e,"change",e,r)}function Ii(e,l,s){!function e(t,n,r){if(t.linked)for(var i=0;i<t.linked.length;++i){var o=t.linked[i];if(o.doc!=n){var a=r&&o.sharedHist;s&&!a||(l(o.doc,a),e(o.doc,t,a))}}}(e,null,!0)}function ji(e,t){if(t.cm)throw new Error("This document is already in use.");fr((e.doc=t).cm=e),zi(e),Wi(e),e.options.lineWrapping||Qt(e),e.options.mode=t.modeOption,mr(e)}function Wi(e){("rtl"==e.doc.direction?z:L)(e.display.lineDiv,"CodeMirror-rtl")}function Hi(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ri(e,t){var n={from:dt(t.from),to:Oi(t),text:tt(e,t.from,t.to)};return Vi(e,n,t.from.line,t.to.line+1),Ii(e,function(e){return Vi(e,n,t.from.line,t.to.line+1)},!0),n}function Bi(e){for(;e.length;){if(!Y(e).ranges)break;e.pop()}}function qi(e,t,n,r){var i=e.history;i.undone.length=0;var o,a,l=+new Date;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastModTime>l-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=function(e,t){return t?(Bi(e.done),Y(e.done)):e.done.length&&!Y(e.done).ranges?Y(e.done):1<e.done.length&&!e.done[e.done.length-2].ranges?(e.done.pop(),Y(e.done)):void 0}(i,i.lastOp==r)))a=Y(o.changes),0==ct(t.from,t.to)&&0==ct(t.from,a.to)?a.to=Oi(t):o.changes.push(Ri(e,t));else{var s=Y(i.done);for(s&&s.ranges||Ki(e.sel,i.done),o={changes:[Ri(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=l,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,a||Ce(e,"historyAdded")}function Ui(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||function(e,t,n,r){var i=t.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,o,Y(i.done),t))?i.done[i.done.length-1]=t:Ki(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&!1!==r.clearRedo&&Bi(i.undone)}function Ki(e,t){var n=Y(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Vi(t,n,e,r){var i=n["spans_"+t.id],o=0;t.iter(Math.max(t.first,e),Math.min(t.first+t.size,r),function(e){e.markedSpans&&((i=i||(n["spans_"+t.id]={}))[o]=e.markedSpans),++o})}function Gi(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t=t||e.slice(0,n):t&&t.push(e[n]);return t?t.length?t:null:e}function $i(e,t){var n=function(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(Gi(n[i]));return r}(e,t),r=Dt(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var o=n[i],a=r[i];if(o&&a)e:for(var l=0;l<a.length;++l){for(var s=a[l],c=0;c<o.length;++c)if(o[c].marker==s.marker)continue e;o.push(s)}else a&&(n[i]=a)}return n}function Yi(e,t,n){for(var r=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)r.push(n?Si.prototype.deepCopy.call(o):o);else{var a=o.changes,l=[];r.push({changes:l});for(var s=0;s<a.length;++s){var c=a[s],u=void 0;if(l.push({from:c.from,to:c.to,text:c.text}),t)for(var d in c)(u=d.match(/^spans_(\d+)$/))&&-1<H(t,Number(u[1]))&&(Y(l)[d]=c[d],delete c[d])}}}return r}function Xi(e,t,n,r){if(r){var i=e.anchor;if(n){var o=ct(t,i)<0;o!=ct(n,i)<0?(i=t,t=n):o!=ct(t,n)<0&&(t=n)}return new Li(i,t)}return new Li(n||t,t)}function Zi(e,t,n,r,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),no(e,new Si([Xi(e.sel.primary(),t,n,i)],0),r)}function Ji(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)r[o]=Xi(e.sel.ranges[o],t[o],null,i);no(e,Mi(e.cm,r,e.sel.primIndex),n)}function Qi(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,no(e,Mi(e.cm,i,e.sel.primIndex),r)}function eo(e,t,n,r){no(e,Ai(t,n),r)}function to(e,t,n){var r=e.history.done,i=Y(r);i&&i.ranges?ro(e,r[r.length-1]=t,n):no(e,t,n)}function no(e,t,n){ro(e,t,n),Ui(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function ro(e,t,n){(Le(e,"beforeSelectionChange")||e.cm&&Le(e.cm,"beforeSelectionChange"))&&(t=function(n,e,t){var r={ranges:e.ranges,update:function(e){this.ranges=[];for(var t=0;t<e.length;t++)this.ranges[t]=new Li(mt(n,e[t].anchor),mt(n,e[t].head))},origin:t&&t.origin};return Ce(n,"beforeSelectionChange",n,r),n.cm&&Ce(n.cm,"beforeSelectionChange",n.cm,r),r.ranges!=e.ranges?Mi(n.cm,r.ranges,r.ranges.length-1):e}(e,t,n));var r=n&&n.bias||(ct(t.primary().head,e.sel.primary().head)<0?-1:1);io(e,ao(e,t,r,!0)),n&&!1===n.scroll||!e.cm||Pr(e.cm)}function io(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Se(e.cm)),mn(e,"cursorActivity",e))}function oo(e){io(e,ao(e,e.sel,null,!1))}function ao(e,t,n,r){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],l=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],s=so(e,a.anchor,l&&l.anchor,n,r),c=so(e,a.head,l&&l.head,n,r);!i&&s==a.anchor&&c==a.head||((i=i||t.ranges.slice(0,o))[o]=new Li(s,c))}return i?Mi(e.cm,i,t.primIndex):t}function lo(e,t,n,r,i){var o=et(e,t.line);if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var l=o.markedSpans[a],s=l.marker,c="selectLeft"in s?!s.selectLeft:s.inclusiveLeft,u="selectRight"in s?!s.selectRight:s.inclusiveRight;if((null==l.from||(c?l.from<=t.ch:l.from<t.ch))&&(null==l.to||(u?l.to>=t.ch:l.to>t.ch))){if(i&&(Ce(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!s.atomic)continue;if(n){var d=s.find(r<0?1:-1),f=void 0;if((r<0?u:c)&&(d=co(e,d,-r,d&&d.line==t.line?o:null)),d&&d.line==t.line&&(f=ct(d,n))&&(r<0?f<0:0<f))return lo(e,d,t,r,i)}var h=s.find(r<0?-1:1);return(r<0?c:u)&&(h=co(e,h,r,h.line==t.line?o:null)),h?lo(e,h,t,r,i):null}}return t}function so(e,t,n,r,i){var o=r||1,a=lo(e,t,n,o,i)||!i&&lo(e,t,n,o,!0)||lo(e,t,n,-o,i)||!i&&lo(e,t,n,-o,!0);return a||(e.cantEdit=!0,st(e.first,0))}function co(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?mt(e,st(t.line-1)):null:0<n&&t.ch==(r||et(e,t.line)).text.length?t.line<e.first+e.size-1?st(t.line+1,0):null:new st(t.line,t.ch+n)}function uo(e){e.setSelection(st(e.firstLine(),0),st(e.lastLine()),q)}function fo(i,e,t){var o={canceled:!1,from:e.from,to:e.to,text:e.text,origin:e.origin,cancel:function(){return o.canceled=!0}};return t&&(o.update=function(e,t,n,r){e&&(o.from=mt(i,e)),t&&(o.to=mt(i,t)),n&&(o.text=n),void 0!==r&&(o.origin=r)}),Ce(i,"beforeChange",i,o),i.cm&&Ce(i.cm,"beforeChange",i.cm,o),o.canceled?(i.cm&&(i.cm.curOp.updateInput=2),null):{from:o.from,to:o.to,text:o.text,origin:o.origin}}function ho(e,t,n){if(e.cm){if(!e.cm.curOp)return ri(e.cm,ho)(e,t,n);if(e.cm.state.suppressEdits)return}if(!(Le(e,"beforeChange")||e.cm&&Le(e.cm,"beforeChange"))||(t=fo(e,t,!0))){var r=Ot&&!n&&function(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var n=e.markedSpans[t].marker;!n.readOnly||r&&-1!=H(r,n)||(r=r||[]).push(n)}}),!r)return null;for(var i=[{from:t,to:n}],o=0;o<r.length;++o)for(var a=r[o],l=a.find(0),s=0;s<i.length;++s){var c=i[s];if(!(ct(c.to,l.from)<0||0<ct(c.from,l.to))){var u=[s,1],d=ct(c.from,l.from),f=ct(c.to,l.to);(d<0||!a.inclusiveLeft&&!d)&&u.push({from:c.from,to:l.from}),(0<f||!a.inclusiveRight&&!f)&&u.push({from:l.to,to:c.to}),i.splice.apply(i,u),s+=u.length-3}}return i}(e,t.from,t.to);if(r)for(var i=r.length-1;0<=i;--i)po(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else po(e,t)}}function po(e,n){if(1!=n.text.length||""!=n.text[0]||0!=ct(n.from,n.to)){var t=_i(e,n);qi(e,n,t,e.cm?e.cm.curOp.id:NaN),vo(e,n,t,Dt(e,n));var r=[];Ii(e,function(e,t){t||-1!=H(r,e.history)||(xo(e.history,n),r.push(e.history)),vo(e,n,null,Dt(e,n))})}}function mo(i,o,e){var t=i.cm&&i.cm.state.suppressEdits;if(!t||e){for(var a,n=i.history,r=i.sel,l="undo"==o?n.done:n.undone,s="undo"==o?n.undone:n.done,c=0;c<l.length&&(a=l[c],e?!a.ranges||a.equals(i.sel):a.ranges);c++);if(c!=l.length){for(n.lastOrigin=n.lastSelOrigin=null;;){if(!(a=l.pop()).ranges){if(t)return void l.push(a);break}if(Ki(a,s),e&&!a.equals(i.sel))return void no(i,a,{clearRedo:!1});r=a}var u=[];Ki(r,s),s.push({changes:u,generation:n.generation}),n.generation=a.generation||++n.maxGeneration;for(var d=Le(i,"beforeChange")||i.cm&&Le(i.cm,"beforeChange"),f=function(e){var n=a.changes[e];if(n.origin=o,d&&!fo(i,n,!1))return l.length=0,{};u.push(Ri(i,n));var t=e?_i(i,n):Y(l);vo(i,n,t,$i(i,n)),!e&&i.cm&&i.cm.scrollIntoView({from:n.from,to:Oi(n)});var r=[];Ii(i,function(e,t){t||-1!=H(r,e.history)||(xo(e.history,n),r.push(e.history)),vo(e,n,null,$i(e,n))})},h=a.changes.length-1;0<=h;--h){var p=f(h);if(p)return p.v}}}}function go(e,t){if(0!=t&&(e.first+=t,e.sel=new Si(X(e.sel.ranges,function(e){return new Li(st(e.anchor.line+t,e.anchor.ch),st(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){mr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)gr(e.cm,r,"gutter")}}function vo(e,t,n,r){if(e.cm&&!e.cm.curOp)return ri(e.cm,vo)(e,t,n,r);if(t.to.line<e.first)go(e,t.text.length-1-(t.to.line-t.from.line));else if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);go(e,i),t={from:st(e.first,0),to:st(t.to.line+i,t.to.ch),text:[Y(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:st(o,et(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=tt(e,t.from,t.to),n=n||_i(e,t),e.cm?function(e,t,n){var r=e.doc,i=e.display,o=t.from,a=t.to,l=!1,s=o.line;e.options.lineWrapping||(s=it(Vt(et(r,o.line))),r.iter(s,a.line+1,function(e){if(e==i.maxLine)return l=!0}));-1<r.sel.contains(t.from,t.to)&&Se(e);Fi(r,t,n,dr(e)),e.options.lineWrapping||(r.iter(s,o.line+t.text.length,function(e){var t=Jt(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,l=!1)}),l&&(e.curOp.updateMaxLine=!0));(function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var n=e.first,r=t-1;n<r;r--){var i=et(e,r).stateAfter;if(i&&(!(i instanceof vt)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}})(r,o.line),ai(e,400);var c=t.text.length-(a.line-o.line)-1;t.full?mr(e):o.line!=a.line||1!=t.text.length||Pi(e.doc,t)?mr(e,o.line,a.line+1,c):gr(e,o.line,"text");var u=Le(e,"changes"),d=Le(e,"change");if(d||u){var f={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin};d&&mn(e,"change",e,f),u&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(f)}e.display.selForContextMenu=null}(e.cm,t,r):Fi(e,t,r),ro(e,n,q),e.cantEdit&&so(e,st(e.firstLine(),0))&&(e.cantEdit=!1)}}function yo(e,t,n,r,i){var o;ct(r=r||n,n)<0&&(n=(o=[r,n])[0],r=o[1]),"string"==typeof t&&(t=e.splitLines(t)),ho(e,{from:n,to:r,text:t,origin:i})}function bo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function wo(e,t,n,r){for(var i=0;i<e.length;++i){var o=e[i],a=!0;if(o.ranges){o.copied||((o=e[i]=o.deepCopy()).copied=!0);for(var l=0;l<o.ranges.length;l++)bo(o.ranges[l].anchor,t,n,r),bo(o.ranges[l].head,t,n,r)}else{for(var s=0;s<o.changes.length;++s){var c=o.changes[s];if(n<c.from.line)c.from=st(c.from.line+r,c.from.ch),c.to=st(c.to.line+r,c.to.ch);else if(t<=c.to.line){a=!1;break}}a||(e.splice(0,i+1),i=0)}}}function xo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;wo(e.done,n,r,i),wo(e.undone,n,r,i)}function ko(e,t,n,r){var i=t,o=t;return"number"==typeof t?o=et(e,pt(e,t)):i=it(t),null==i?null:(r(o,i)&&e.cm&&gr(e.cm,i,n),o)}function Co(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}function To(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}Li.prototype.from=function(){return ht(this.anchor,this.head)},Li.prototype.to=function(){return ft(this.anchor,this.head)},Li.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},Co.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n,r=e,i=e+t;r<i;++r){var o=this.lines[r];this.height-=o.height,(n=o).parent=null,Ft(n),mn(o,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}},To.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var o=Math.min(t,i-e),a=r.height;if(r.removeInner(e,o),this.height-=a-r.height,i==o&&(this.children.splice(n--,1),r.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(1<this.children.length||!(this.children[0]instanceof Co))){var l=[];this.collapse(l),this.children=[new Co(l)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(e<=o){if(i.insertInner(e,t,n),i.lines&&50<i.lines.length){for(var a=i.lines.length%25+25,l=a;l<i.lines.length;){var s=new Co(i.lines.slice(l,l+=25));i.height-=s.height,this.children.splice(++r,0,s),s.parent=this}i.lines=i.lines.slice(0,a),this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=new To(e.children.splice(e.children.length-5,5));if(e.parent){e.size-=t.size,e.height-=t.height;var n=H(e.parent.children,e);e.parent.children.splice(n+1,0,t)}else{var r=new To(e.children);(r.parent=e).children=[r,t],e=r}t.parent=e.parent}while(10<e.children.length);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(e<o){var a=Math.min(t,o-e);if(i.iterN(e,a,n))return!0;if(0==(t-=a))break;e=0}else e-=o}}};function So(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t}function Lo(e,t,n){Zt(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Dr(e,n)}So.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=it(n);if(null!=r&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var o=Mn(this);rt(n,Math.max(0,n.height-o)),e&&(ni(e,function(){Lo(e,n,-o),gr(e,r,"widget")}),mn(e,"lineWidgetCleared",e,this,r))}},So.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=Mn(this)-t;i&&(Yt(this.doc,r)||rt(r,r.height+i),n&&ni(n,function(){n.curOp.forceUpdate=!0,Lo(n,r,i),mn(n,"lineWidgetChanged",n,e,it(r))}))},Me(So);var Mo=0,Ao=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++Mo};function Oo(t,n,r,e,i){if(e&&e.shared)return function(e,n,r,i,o){(i=I(i)).shared=!1;var a=[Oo(e,n,r,i,o)],l=a[0],s=i.widgetNode;return Ii(e,function(e){s&&(i.widgetNode=s.cloneNode(!0)),a.push(Oo(e,mt(e,n),mt(e,r),i,o));for(var t=0;t<e.linked.length;++t)if(e.linked[t].isParent)return;l=Y(a)}),new No(a,l)}(t,n,r,e,i);if(t.cm&&!t.cm.curOp)return ri(t.cm,Oo)(t,n,r,e,i);var o=new Ao(t,i),a=ct(n,r);if(e&&I(e,o,!1),0<a||0==a&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=O("span",[o.replacedWith],"CodeMirror-widget"),e.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),e.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Kt(t,n.line,n,r,o)||n.line!=r.line&&Kt(t,r.line,n,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Nt=!0}o.addToHistory&&qi(t,{from:n,to:r,origin:"markText"},t.sel,NaN);var l,s=n.line,c=t.cm;if(t.iter(s,r.line+1,function(e){c&&o.collapsed&&!c.options.lineWrapping&&Vt(e)==c.display.maxLine&&(l=!0),o.collapsed&&s!=n.line&&rt(e,0),function(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}(e,new _t(o,s==n.line?n.ch:null,s==r.line?r.ch:null)),++s}),o.collapsed&&t.iter(n.line,r.line+1,function(e){Yt(t,e)&&rt(e,0)}),o.clearOnEnter&&we(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(Ot=!0,(t.history.done.length||t.history.undone.length)&&t.clearHistory()),o.collapsed&&(o.id=++Mo,o.atomic=!0),c){if(l&&(c.curOp.updateMaxLine=!0),o.collapsed)mr(c,n.line,r.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var u=n.line;u<=r.line;u++)gr(c,u,"text");o.atomic&&oo(c.doc),mn(c,"markerAdded",c,o)}return o}Ao.prototype.clear=function(){var e=this;if(!this.explicitlyCleared){var t=this.doc.cm,n=t&&!t.curOp;if(n&&Xr(t),Le(this,"clear")){var r=this.find();r&&mn(this,"clear",r.from,r.to)}for(var i=null,o=null,a=0;a<this.lines.length;++a){var l=e.lines[a],s=Et(l.markedSpans,e);t&&!e.collapsed?gr(t,it(l),"text"):t&&(null!=s.to&&(o=it(l)),null!=s.from&&(i=it(l))),l.markedSpans=zt(l.markedSpans,s),null==s.from&&e.collapsed&&!Yt(e.doc,l)&&t&&rt(l,lr(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var c=0;c<this.lines.length;++c){var u=Vt(e.lines[c]),d=Jt(u);d>t.display.maxLineLength&&(t.display.maxLine=u,t.display.maxLineLength=d,t.display.maxLineChanged=!0)}null!=i&&t&&this.collapsed&&mr(t,i,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&oo(t.doc)),t&&mn(t,"markerCleared",t,this,i,o),n&&Zr(t),this.parent&&this.parent.clear()}},Ao.prototype.find=function(e,t){var n,r;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i<this.lines.length;++i){var o=this.lines[i],a=Et(o.markedSpans,this);if(null!=a.from&&(n=st(t?o:it(o),a.from),-1==e))return n;if(null!=a.to&&(r=st(t?o:it(o),a.to),1==e))return r}return n&&{from:n,to:r}},Ao.prototype.changed=function(){var o=this,a=this.find(-1,!0),l=this,s=this.doc.cm;a&&s&&ni(s,function(){var e=a.line,t=it(a.line),n=In(s,t);if(n&&(Un(n),s.curOp.selectionChanged=s.curOp.forceUpdate=!0),s.curOp.updateMaxLine=!0,!Yt(l.doc,e)&&null!=l.height){var r=l.height;l.height=null;var i=Mn(l)-r;i&&rt(e,e.height+i)}mn(s,"markerChanged",s,o)})},Ao.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=H(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Ao.prototype.detachLine=function(e){if(this.lines.splice(H(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},Me(Ao);var No=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};function _o(e){return e.findMarks(st(e.first,0),e.clipPos(st(e.lastLine())),function(e){return e.parent})}function Eo(o){for(var e=function(e){var t=o[e],n=[t.primary.doc];Ii(t.primary.doc,function(e){return n.push(e)});for(var r=0;r<t.markers.length;r++){var i=t.markers[r];-1==H(n,i.doc)&&(i.parent=null,t.markers.splice(r--,1))}},t=0;t<o.length;t++)e(t)}No.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();mn(this,"clear")}},No.prototype.find=function(e,t){return this.primary.find(e,t)},Me(No);var zo=0,Do=function(e,t,n,r,i){if(!(this instanceof Do))return new Do(e,t,n,r,i);null==n&&(n=0),To.call(this,[new Co([new en("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var o=st(n,0);this.sel=Ai(o),this.history=new Hi(null),this.id=++zo,this.modeOption=t,this.lineSep=r,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),Fi(this,{from:o,to:o,text:e}),no(this,Ai(o),q)};Do.prototype=J(To.prototype,{constructor:Do,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=nt(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:oi(function(e){var t=st(this.first,0),n=this.first+this.size-1;ho(this,{from:t,to:st(n,et(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Fr(this.cm,0,0),no(this,Ai(t),q)}),replaceRange:function(e,t,n,r){yo(this,e,t=mt(this,t),n=n?mt(this,n):t,r)},getRange:function(e,t,n){var r=tt(this,mt(this,e),mt(this,t));return!1===n?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(at(this,e))return et(this,e)},getLineNumber:function(e){return it(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=et(this,e)),Vt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return mt(this,e)},getCursor:function(e){var t=this.sel.primary();return null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:oi(function(e,t,n){eo(this,mt(this,"number"==typeof e?st(e,t||0):e),null,n)}),setSelection:oi(function(e,t,n){eo(this,mt(this,e),mt(this,t||e),n)}),extendSelection:oi(function(e,t,n){Zi(this,mt(this,e),t&&mt(this,t),n)}),extendSelections:oi(function(e,t){Ji(this,gt(this,e),t)}),extendSelectionsBy:oi(function(e,t){Ji(this,gt(this,X(this.sel.ranges,e)),t)}),setSelections:oi(function(e,t,n){if(e.length){for(var r=[],i=0;i<e.length;i++)r[i]=new Li(mt(this,e[i].anchor),mt(this,e[i].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),no(this,Mi(this.cm,r,t),n)}}),addSelection:oi(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new Li(mt(this,e),mt(this,t||e))),no(this,Mi(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t,n=this.sel.ranges,r=0;r<n.length;r++){var i=tt(this,n[r].from(),n[r].to());t=t?t.concat(i):i}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=tt(this,n[r].from(),n[r].to());!1!==e&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:oi(function(e,t,n){for(var r=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o];r[o]={from:a.from(),to:a.to(),text:this.splitLines(e[o]),origin:n}}for(var l=t&&"end"!=t&&function(e,t,n){for(var r=[],i=st(e.first,0),o=i,a=0;a<t.length;a++){var l=t[a],s=Ei(l.from,i,o),c=Ei(Oi(l),i,o);if(i=l.to,o=c,"around"==n){var u=e.sel.ranges[a],d=ct(u.head,u.anchor)<0;r[a]=new Li(d?c:s,d?s:c)}else r[a]=new Li(s,s)}return new Si(r,e.sel.primIndex)}(this,r,t),s=r.length-1;0<=s;s--)ho(this,r[s]);l?to(this,l):this.cm&&Pr(this.cm)}),undo:oi(function(){mo(this,"undo")}),redo:oi(function(){mo(this,"redo")}),undoSelection:oi(function(){mo(this,"undo",!0)}),redoSelection:oi(function(){mo(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){this.history=new Hi(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Yi(this.history.done),undone:Yi(this.history.undone)}},setHistory:function(e){var t=this.history=new Hi(this.history.maxGeneration);t.done=Yi(e.done.slice(0),null,!0),t.undone=Yi(e.undone.slice(0),null,!0)},setGutterMarker:oi(function(e,n,r){return ko(this,e,"gutter",function(e){var t=e.gutterMarkers||(e.gutterMarkers={});return!(t[n]=r)&&ne(t)&&(e.gutterMarkers=null),!0})}),clearGutter:oi(function(t){var n=this;this.iter(function(e){e.gutterMarkers&&e.gutterMarkers[t]&&ko(n,e,"gutter",function(){return e.gutterMarkers[t]=null,ne(e.gutterMarkers)&&(e.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!at(this,e))return null;if(!(e=et(this,t=e)))return null}else if(null==(t=it(e)))return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:oi(function(e,n,r){return ko(this,e,"gutter"==n?"gutter":"class",function(e){var t="text"==n?"textClass":"background"==n?"bgClass":"gutter"==n?"gutterClass":"wrapClass";if(e[t]){if(T(r).test(e[t]))return!1;e[t]+=" "+r}else e[t]=r;return!0})}),removeLineClass:oi(function(e,o,a){return ko(this,e,"gutter"==o?"gutter":"class",function(e){var t="text"==o?"textClass":"background"==o?"bgClass":"gutter"==o?"gutterClass":"wrapClass",n=e[t];if(!n)return!1;if(null==a)e[t]=null;else{var r=n.match(T(a));if(!r)return!1;var i=r.index+r[0].length;e[t]=n.slice(0,r.index)+(r.index&&i!=n.length?" ":"")+n.slice(i)||null}return!0})}),addLineWidget:oi(function(e,t,n){return function(r,e,t,n){var i=new So(r,t,n),o=r.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),ko(r,e,"widget",function(e){var t=e.widgets||(e.widgets=[]);if(null==i.insertAt?t.push(i):t.splice(Math.min(t.length-1,Math.max(0,i.insertAt)),0,i),i.line=e,o&&!Yt(r,e)){var n=Zt(e)<r.scrollTop;rt(e,e.height+Mn(i)),n&&Dr(o,i.height),o.curOp.forceUpdate=!0}return!0}),o&&mn(o,"lineWidgetAdded",o,i,"number"==typeof e?e:it(e)),i}(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Oo(this,mt(this,e),mt(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return Oo(this,e=mt(this,e),e,n,"bookmark")},findMarksAt:function(e){var t=[],n=et(this,(e=mt(this,e)).line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(i,o,a){i=mt(this,i),o=mt(this,o);var l=[],s=i.line;return this.iter(i.line,o.line+1,function(e){var t=e.markedSpans;if(t)for(var n=0;n<t.length;n++){var r=t[n];null!=r.to&&s==i.line&&i.ch>=r.to||null==r.from&&s!=i.line||null!=r.from&&s==o.line&&r.from>=o.ch||a&&!a(r.marker)||l.push(r.marker.parent||r.marker)}++s}),l},getAllMarks:function(){var r=[];return this.iter(function(e){var t=e.markedSpans;if(t)for(var n=0;n<t.length;++n)null!=t[n].from&&r.push(t[n].marker)}),r},posFromIndex:function(n){var r,i=this.first,o=this.lineSeparator().length;return this.iter(function(e){var t=e.text.length+o;if(n<t)return r=n,!0;n-=t,++i}),mt(this,st(i,r))},indexFromPos:function(e){var t=(e=mt(this,e)).ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(e){t+=e.text.length+n}),t},copy:function(e){var t=new Do(nt(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e=e||{};var t=this.first,n=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<n&&(n=e.to);var r=new Do(nt(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),o=e.clipPos(i.from),a=e.clipPos(i.to);if(ct(o,a)){var l=Oo(e,o,a,r.primary,r.primary.type);r.markers.push(l),l.parent=r}}}(r,_o(this)),r},unlinkDoc:function(e){if(e instanceof Na&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){if(this.linked[t].doc==e){this.linked.splice(t,1),e.unlinkDoc(this),Eo(_o(this));break}}if(e.history==this.history){var n=[e.id];Ii(e,function(e){return n.push(e.id)},!0),e.history=new Hi(null),e.history.done=Yi(this.history.done,n),e.history.undone=Yi(this.history.undone,n)}},iterLinkedDocs:function(e){Ii(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):He(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:oi(function(e){"rtl"!=e&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter(function(e){return e.order=null}),this.cm&&function(e){ni(e,function(){Wi(e),mr(e)})}(this.cm))})}),Do.prototype.eachLine=Do.prototype.iter;var Po=0;function Fo(e){var i=this;if(Io(i),!Te(i,e)&&!An(i.display,e)){Ae(e),x&&(Po=+new Date);var o=hr(i,e,!0),t=e.dataTransfer.files;if(o&&!i.isReadOnly())if(t&&t.length&&window.FileReader&&window.File)for(var a=t.length,l=Array(a),s=0,n=function(e,n){if(!i.options.allowDropFileTypes||-1!=H(i.options.allowDropFileTypes,e.type)){var r=new FileReader;r.onload=ri(i,function(){var e=r.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),l[n]=e,++s==a){var t={from:o=mt(i.doc,o),to:o,text:i.doc.splitLines(l.join(i.doc.lineSeparator())),origin:"paste"};ho(i.doc,t),to(i.doc,Ai(o,Oi(t)))}}),r.readAsText(e)}},r=0;r<a;++r)n(t[r],r);else{if(i.state.draggingText&&-1<i.doc.sel.contains(o))return i.state.draggingText(e),void setTimeout(function(){return i.display.input.focus()},20);try{var c=e.dataTransfer.getData("Text");if(c){var u;if(i.state.draggingText&&!i.state.draggingText.copy&&(u=i.listSelections()),ro(i.doc,Ai(o,o)),u)for(var d=0;d<u.length;++d)yo(i.doc,"",u[d].anchor,u[d].head,"drag");i.replaceSelection(c,"around","paste"),i.display.input.focus()}}catch(e){}}}}function Io(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function jo(t){if(document.getElementsByClassName){for(var e=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<e.length;r++){var i=e[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var e=0;e<n.length;e++)t(n[e])})}}var Wo=!1;function Ho(){Wo||(function(){var e;we(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,jo(Ro)},100))}),we(window,"blur",function(){return jo(Or)})}(),Wo=!0)}function Ro(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Bo={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},qo=0;qo<10;qo++)Bo[qo+48]=Bo[qo+96]=String(qo);for(var Uo=65;Uo<=90;Uo++)Bo[Uo]=String.fromCharCode(Uo);for(var Ko=1;Ko<=12;Ko++)Bo[Ko+111]=Bo[Ko+63235]="F"+Ko;var Vo={};function Go(e){var t,n,r,i,o=e.split(/-(?!$)/);e=o[o.length-1];for(var a=0;a<o.length-1;a++){var l=o[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))t=!0;else if(/^(c|ctrl|control)$/i.test(l))n=!0;else{if(!/^s(hift)?$/i.test(l))throw new Error("Unrecognized modifier name: "+l);r=!0}}return t&&(e="Alt-"+e),n&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),r&&(e="Shift-"+e),e}function $o(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==r){delete e[n];continue}for(var i=X(n.split(" "),Go),o=0;o<i.length;o++){var a=void 0,l=void 0;a=o==i.length-1?(l=i.join(" "),r):(l=i.slice(0,o+1).join(" "),"...");var s=t[l];if(s){if(s!=a)throw new Error("Inconsistent bindings for "+l)}else t[l]=a}delete e[n]}for(var c in t)e[c]=t[c];return e}function Yo(e,t,n,r){var i=(t=Qo(t)).call?t.call(e,r):t[e];if(!1===i)return"nothing";if("..."===i)return"multi";if(null!=i&&n(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return Yo(e,t.fallthrough,n,r);for(var o=0;o<t.fallthrough.length;o++){var a=Yo(e,t.fallthrough[o],n,r);if(a)return a}}}function Xo(e){var t="string"==typeof e?e:Bo[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function Zo(e,t,n){var r=e;return t.altKey&&"Alt"!=r&&(e="Alt-"+e),(y?t.metaKey:t.ctrlKey)&&"Ctrl"!=r&&(e="Ctrl-"+e),(y?t.ctrlKey:t.metaKey)&&"Cmd"!=r&&(e="Cmd-"+e),!n&&t.shiftKey&&"Shift"!=r&&(e="Shift-"+e),e}function Jo(e,t){if(g&&34==e.keyCode&&e.char)return!1;var n=Bo[e.keyCode];return null!=n&&!e.altGraphKey&&(3==e.keyCode&&e.code&&(n=e.code),Zo(n,e,t))}function Qo(e){return"string"==typeof e?Vo[e]:e}function ea(t,e){for(var n=t.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var o=e(n[i]);r.length&&ct(o.from,Y(r).to)<=0;){var a=r.pop();if(ct(a.from,o.from)<0){o.from=a.from;break}}r.push(o)}ni(t,function(){for(var e=r.length-1;0<=e;e--)yo(t.doc,"",r[e].from,r[e].to,"+delete");Pr(t)})}function ta(e,t,n){var r=oe(e.text,t+n,n);return r<0||r>e.text.length?null:r}function na(e,t,n){var r=ta(e,t.ch,n);return null==r?null:new st(t.line,r,n<0?"after":"before")}function ra(e,t,n,r,i){if(e){var o=ye(n,t.doc.direction);if(o){var a,l=i<0?Y(o):o[0],s=i<0==(1==l.level)?"after":"before";if(0<l.level||"rtl"==t.doc.direction){var c=jn(t,n);a=i<0?n.text.length-1:0;var u=Wn(t,c,a).top;a=ae(function(e){return Wn(t,c,e).top==u},i<0==(1==l.level)?l.from:l.to-1,a),"before"==s&&(a=ta(n,a,1))}else a=i<0?l.to:l.from;return new st(r,a,s)}}return new st(r,i<0?n.text.length:0,i<0?"before":"after")}Vo.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Vo.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Vo.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Vo.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Vo.default=w?Vo.macDefault:Vo.pcDefault;var ia={selectAll:uo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),q)},killLine:function(n){return ea(n,function(e){if(e.empty()){var t=et(n.doc,e.head.line).text.length;return e.head.ch==t&&e.head.line<n.lastLine()?{from:e.head,to:st(e.head.line+1,0)}:{from:e.head,to:st(e.head.line,t)}}return{from:e.from(),to:e.to()}})},deleteLine:function(t){return ea(t,function(e){return{from:st(e.from().line,0),to:mt(t.doc,st(e.to().line+1,0))}})},delLineLeft:function(e){return ea(e,function(e){return{from:st(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(n){return ea(n,function(e){var t=n.charCoords(e.head,"div").top+5;return{from:n.coordsChar({left:0,top:t},"div"),to:e.from()}})},delWrappedLineRight:function(r){return ea(r,function(e){var t=r.charCoords(e.head,"div").top+5,n=r.coordsChar({left:r.display.lineDiv.offsetWidth+100,top:t},"div");return{from:e.from(),to:n}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(st(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(st(e.lastLine()))},goLineStart:function(t){return t.extendSelectionsBy(function(e){return oa(t,e.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(t){return t.extendSelectionsBy(function(e){return aa(t,e.head)},{origin:"+move",bias:1})},goLineEnd:function(t){return t.extendSelectionsBy(function(e){return function(e,t){var n=et(e.doc,t),r=function(e){for(var t;t=qt(e);)e=t.find(1,!0).line;return e}(n);r!=n&&(t=it(r));return ra(!0,e,n,t,-1)}(t,e.head.line)},{origin:"+move",bias:-1})},goLineRight:function(n){return n.extendSelectionsBy(function(e){var t=n.cursorCoords(e.head,"div").top+5;return n.coordsChar({left:n.display.lineDiv.offsetWidth+100,top:t},"div")},K)},goLineLeft:function(n){return n.extendSelectionsBy(function(e){var t=n.cursorCoords(e.head,"div").top+5;return n.coordsChar({left:0,top:t},"div")},K)},goLineLeftSmart:function(r){return r.extendSelectionsBy(function(e){var t=r.cursorCoords(e.head,"div").top+5,n=r.coordsChar({left:0,top:t},"div");return n.ch<r.getLine(n.line).search(/\S/)?aa(r,e.head):n},K)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"char")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var o=n[i].from(),a=j(e.getLine(o.line),o.ch,r);t.push($(r-a%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(a){return ni(a,function(){for(var e=a.listSelections(),t=[],n=0;n<e.length;n++)if(e[n].empty()){var r=e[n].head,i=et(a.doc,r.line).text;if(i)if(r.ch==i.length&&(r=new st(r.line,r.ch-1)),0<r.ch)r=new st(r.line,r.ch+1),a.replaceRange(i.charAt(r.ch-1)+i.charAt(r.ch-2),st(r.line,r.ch-2),r,"+transpose");else if(r.line>a.doc.first){var o=et(a.doc,r.line-1).text;o&&(r=new st(r.line,1),a.replaceRange(i.charAt(0)+a.doc.lineSeparator()+o.charAt(o.length-1),st(r.line-1,o.length-1),r,"+transpose"))}t.push(new Li(r,r))}a.setSelections(t)})},newlineAndIndent:function(r){return ni(r,function(){for(var e=r.listSelections(),t=e.length-1;0<=t;t--)r.replaceRange(r.doc.lineSeparator(),e[t].anchor,e[t].head,"+input");e=r.listSelections();for(var n=0;n<e.length;n++)r.indentLine(e[n].from().line,null,!0);Pr(r)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function oa(e,t){var n=et(e.doc,t),r=Vt(n);return r!=n&&(t=it(r)),ra(!0,e,r,t,1)}function aa(e,t){var n=oa(e,t.line),r=et(e.doc,n.line),i=ye(r,e.doc.direction);if(i&&0!=i[0].level)return n;var o=Math.max(0,r.text.search(/\S/)),a=t.line==n.line&&t.ch<=o&&t.ch;return st(n.line,a?0:o,n.sticky)}function la(e,t,n){if("string"==typeof t&&!(t=ia[t]))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=B}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}var sa=new W;function ca(e,t,n,r){var i=e.state.keySeq;if(i){if(Xo(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:sa.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),ua(e,i+" "+t,n,r))return!0}return ua(e,t,n,r)}function ua(e,t,n,r){var i=function(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Yo(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Yo(t,e.options.extraKeys,n,e)||Yo(t,e.options.keyMap,n,e)}(e,t,r);return"multi"==i&&(e.state.keySeq=t),"handled"==i&&mn(e,"keyHandled",e,t,n),"handled"!=i&&"multi"!=i||(Ae(n),Sr(e)),!!i}function da(t,e){var n=Jo(e,!0);return!!n&&(e.shiftKey&&!t.state.keySeq?ca(t,"Shift-"+n,e,function(e){return la(t,e,!0)})||ca(t,n,e,function(e){if("string"==typeof e?/^go[A-Z]/.test(e):e.motion)return la(t,e)}):ca(t,n,e,function(e){return la(t,e)}))}var fa=null;function ha(e){if(this.curOp.focus=E(),!Te(this,e)){x&&k<11&&27==e.keyCode&&(e.returnValue=!1);var t=e.keyCode;this.display.shift=16==t||e.shiftKey;var n=da(this,e);g&&(fa=n?t:null,!n&&88==t&&!Be&&(w?e.metaKey:e.ctrlKey)&&this.replaceSelection("",null,"cut")),18!=t||/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)||function(e){var t=e.display.lineDiv;function n(e){18!=e.keyCode&&e.altKey||(L(t,"CodeMirror-crosshair"),ke(document,"keyup",n),ke(document,"mouseover",n))}z(t,"CodeMirror-crosshair"),we(document,"keyup",n),we(document,"mouseover",n)}(this)}}function pa(e){16==e.keyCode&&(this.doc.sel.shift=!1),Te(this,e)}function ma(e){if(!(An(this.display,e)||Te(this,e)||e.ctrlKey&&!e.altKey||w&&e.metaKey)){var t=e.keyCode,n=e.charCode;if(g&&t==fa)return fa=null,void Ae(e);if(!g||e.which&&!(e.which<10)||!da(this,e)){var r=String.fromCharCode(null==n?t:n);"\b"==r||function(t,e,n){return ca(t,"'"+n+"'",e,function(e){return la(t,e,!0)})}(this,e,r)||this.display.input.onKeyPress(e)}}}var ga,va,ya=function(e,t,n){this.time=e,this.pos=t,this.button=n};function ba(e){var t=this,n=t.display;if(!(Te(t,e)||n.activeTouch&&n.input.supportsTouch()))if(n.input.ensurePolled(),n.shift=e.shiftKey,An(n,e))b||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));else if(!ka(t,e)){var r=hr(t,e),i=ze(e),o=r?function(e,t){var n=+new Date;return va&&va.compare(n,e,t)?(ga=va=null,"triple"):ga&&ga.compare(n,e,t)?(va=new ya(n,e,t),ga=null,"double"):(ga=new ya(n,e,t),va=null,"single")}(r,i):"single";window.focus(),1==i&&t.state.selectingText&&t.state.selectingText(e),r&&function(n,e,r,t,i){var o="Click";"double"==t?o="Double"+o:"triple"==t&&(o="Triple"+o);return ca(n,Zo(o=(1==e?"Left":2==e?"Middle":"Right")+o,i),i,function(e){if("string"==typeof e&&(e=ia[e]),!e)return!1;var t=!1;try{n.isReadOnly()&&(n.state.suppressEdits=!0),t=e(n,r)!=B}finally{n.state.suppressEdits=!1}return t})}(t,i,r,o,e)||(1==i?r?function(e,t,n,r){x?setTimeout(F(Lr,e),0):e.curOp.focus=E();var i,o=function(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(null==i.unit){var o=h?n.shiftKey&&n.metaKey:n.altKey;i.unit=o?"rectangle":"single"==t?"char":"double"==t?"word":"line"}null!=i.extend&&!e.doc.extend||(i.extend=e.doc.extend||n.shiftKey);null==i.addNew&&(i.addNew=w?n.metaKey:n.ctrlKey);null==i.moveOnDrag&&(i.moveOnDrag=!(w?n.altKey:n.ctrlKey));return i}(e,n,r),a=e.doc.sel;e.options.dragDrop&&Fe&&!e.isReadOnly()&&"single"==n&&-1<(i=a.contains(t))&&(ct((i=a.ranges[i]).from(),t)<0||0<t.xRel)&&(0<ct(i.to(),t)||t.xRel<0)?function(t,n,r,i){var o=t.display,a=!1,l=ri(t,function(e){b&&(o.scroller.draggable=!1),t.state.draggingText=!1,ke(o.wrapper.ownerDocument,"mouseup",l),ke(o.wrapper.ownerDocument,"mousemove",s),ke(o.scroller,"dragstart",c),ke(o.scroller,"drop",l),a||(Ae(e),i.addNew||Zi(t.doc,r,null,null,i.extend),b||x&&9==k?setTimeout(function(){o.wrapper.ownerDocument.body.focus(),o.input.focus()},20):o.input.focus())}),s=function(e){a=a||10<=Math.abs(n.clientX-e.clientX)+Math.abs(n.clientY-e.clientY)},c=function(){return a=!0};b&&(o.scroller.draggable=!0);(t.state.draggingText=l).copy=!i.moveOnDrag,o.scroller.dragDrop&&o.scroller.dragDrop();we(o.wrapper.ownerDocument,"mouseup",l),we(o.wrapper.ownerDocument,"mousemove",s),we(o.scroller,"dragstart",c),we(o.scroller,"drop",l),Mr(t),setTimeout(function(){return o.input.focus()},20)}(e,r,t,o):function(g,e,v,y){var a=g.display,b=g.doc;Ae(e);var w,x,k=b.sel,t=k.ranges;y.addNew&&!y.extend?(x=b.sel.contains(v),w=-1<x?t[x]:new Li(v,v)):(w=b.sel.primary(),x=b.sel.primIndex);if("rectangle"==y.unit)y.addNew||(w=new Li(v,v)),v=hr(g,e,!0,!0),x=-1;else{var n=wa(g,v,y.unit);w=y.extend?Xi(w,n.anchor,n.head,y.extend):n}y.addNew?-1==x?(x=t.length,no(b,Mi(g,t.concat([w]),x),{scroll:!1,origin:"*mouse"})):1<t.length&&t[x].empty()&&"char"==y.unit&&!y.extend?(no(b,Mi(g,t.slice(0,x).concat(t.slice(x+1)),0),{scroll:!1,origin:"*mouse"}),k=b.sel):Qi(b,x,w,U):(no(b,new Si([w],x=0),U),k=b.sel);var C=v;function l(e){if(0!=ct(C,e))if(C=e,"rectangle"==y.unit){for(var t=[],n=g.options.tabSize,r=j(et(b,v.line).text,v.ch,n),i=j(et(b,e.line).text,e.ch,n),o=Math.min(r,i),a=Math.max(r,i),l=Math.min(v.line,e.line),s=Math.min(g.lastLine(),Math.max(v.line,e.line));l<=s;l++){var c=et(b,l).text,u=V(c,o,n);o==a?t.push(new Li(st(l,u),st(l,u))):c.length>u&&t.push(new Li(st(l,u),st(l,V(c,a,n))))}t.length||t.push(new Li(v,v)),no(b,Mi(g,k.ranges.slice(0,x).concat(t),x),{origin:"*mouse",scroll:!1}),g.scrollIntoView(e)}else{var d,f=w,h=wa(g,e,y.unit),p=f.anchor;p=0<ct(h.anchor,p)?(d=h.head,ht(f.from(),h.anchor)):(d=h.anchor,ft(f.to(),h.head));var m=k.ranges.slice(0);m[x]=function(e,t){var n=t.anchor,r=t.head,i=et(e.doc,n.line);if(0==ct(n,r)&&n.sticky==r.sticky)return t;var o=ye(i);if(!o)return t;var a=se(o,n.ch,n.sticky),l=o[a];if(l.from!=n.ch&&l.to!=n.ch)return t;var s,c=a+(l.from==n.ch==(1!=l.level)?0:1);if(0==c||c==o.length)return t;if(r.line!=n.line)s=0<(r.line-n.line)*("ltr"==e.doc.direction?1:-1);else{var u=se(o,r.ch,r.sticky),d=u-a||(r.ch-n.ch)*(1==l.level?-1:1);s=u==c-1||u==c?d<0:0<d}var f=o[c+(s?-1:0)],h=s==(1==f.level),p=h?f.from:f.to,m=h?"after":"before";return n.ch==p&&n.sticky==m?t:new Li(new st(n.line,p,m),r)}(g,new Li(mt(b,p),d)),no(b,Mi(g,m,x),U)}}var s=a.wrapper.getBoundingClientRect(),c=0;function r(e){g.state.selectingText=!1,c=1/0,e&&(Ae(e),a.input.focus()),ke(a.wrapper.ownerDocument,"mousemove",i),ke(a.wrapper.ownerDocument,"mouseup",o),b.history.lastSelOrigin=null}var i=ri(g,function(e){0!==e.buttons&&ze(e)?function e(t){var n=++c,r=hr(g,t,!0,"rectangle"==y.unit);if(r)if(0!=ct(r,C)){g.curOp.focus=E(),l(r);var i=Er(a,b);(r.line>=i.to||r.line<i.from)&&setTimeout(ri(g,function(){c==n&&e(t)}),150)}else{var o=t.clientY<s.top?-20:t.clientY>s.bottom?20:0;o&&setTimeout(ri(g,function(){c==n&&(a.scroller.scrollTop+=o,e(t))}),50)}}(e):r(e)}),o=ri(g,r);g.state.selectingText=o,we(a.wrapper.ownerDocument,"mousemove",i),we(a.wrapper.ownerDocument,"mouseup",o)}(e,r,t,o)}(t,r,o,e):Ee(e)==n.scroller&&Ae(e):2==i?(r&&Zi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):3==i&&(C?t.display.input.onContextMenu(e):Mr(t)))}}function wa(e,t,n){if("char"==n)return new Li(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new Li(st(t.line,0),mt(e.doc,st(t.line+1,0)));var r=n(e,t);return new Li(r.from,r.to)}function xa(e,t,n,r){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Ae(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(o>l.bottom||!Le(e,n))return Ne(t);o-=l.top-a.viewOffset;for(var s=0;s<e.display.gutterSpecs.length;++s){var c=a.gutters.childNodes[s];if(c&&c.getBoundingClientRect().right>=i)return Ce(e,n,e,ot(e.doc,o),e.display.gutterSpecs[s].className,t),Ne(t)}}function ka(e,t){return xa(e,t,"gutterClick",!0)}function Ca(e,t){An(e.display,t)||function(e,t){return!!Le(e,"gutterContextMenu")&&xa(e,t,"gutterContextMenu",!1)}(e,t)||Te(e,t,"contextmenu")||C||e.display.input.onContextMenu(t)}function Ta(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Vn(e)}ya.prototype.compare=function(e,t,n){return this.time+400>e&&0==ct(t,this.pos)&&n==this.button};var Sa={toString:function(){return"CodeMirror.Init"}},La={},Ma={};function Aa(e,t,n){if(!t!=!(n&&n!=Sa)){var r=e.display.dragFunctions,i=t?we:ke;i(e.display.scroller,"dragstart",r.start),i(e.display.scroller,"dragenter",r.enter),i(e.display.scroller,"dragover",r.over),i(e.display.scroller,"dragleave",r.leave),i(e.display.scroller,"drop",r.drop)}}function Oa(e){e.options.lineWrapping?(z(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(L(e.display.wrapper,"CodeMirror-wrap"),Qt(e)),fr(e),mr(e),Vn(e),setTimeout(function(){return Kr(e)},100)}function Na(e,t){var n=this;if(!(this instanceof Na))return new Na(e,t);this.options=t=t?I(t):{},I(La,t,!1);var r=t.value;"string"==typeof r?r=new Do(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Na.inputStyles[t.inputStyle](this),o=this.display=new bi(e,r,i,t);for(var a in Ta(o.wrapper.CodeMirror=this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),$r(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new W,keySeq:null,specialChars:null},t.autofocus&&!f&&o.input.focus(),x&&k<11&&setTimeout(function(){return n.display.input.reset(!0)},20),function(i){var o=i.display;we(o.scroller,"mousedown",ri(i,ba)),we(o.scroller,"dblclick",x&&k<11?ri(i,function(e){if(!Te(i,e)){var t=hr(i,e);if(t&&!ka(i,e)&&!An(i.display,e)){Ae(e);var n=i.findWordAt(t);Zi(i.doc,n.anchor,n.head)}}}):function(e){return Te(i,e)||Ae(e)});we(o.scroller,"contextmenu",function(e){return Ca(i,e)});var n,r={end:0};function a(){o.activeTouch&&(n=setTimeout(function(){return o.activeTouch=null},1e3),(r=o.activeTouch).end=+new Date)}function l(e,t){if(null==t.left)return!0;var n=t.left-e.left,r=t.top-e.top;return 400<n*n+r*r}we(o.scroller,"touchstart",function(e){if(!Te(i,e)&&!function(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(e)&&!ka(i,e)){o.input.ensurePolled(),clearTimeout(n);var t=+new Date;o.activeTouch={start:t,moved:!1,prev:t-r.end<=300?r:null},1==e.touches.length&&(o.activeTouch.left=e.touches[0].pageX,o.activeTouch.top=e.touches[0].pageY)}}),we(o.scroller,"touchmove",function(){o.activeTouch&&(o.activeTouch.moved=!0)}),we(o.scroller,"touchend",function(e){var t=o.activeTouch;if(t&&!An(o,e)&&null!=t.left&&!t.moved&&new Date-t.start<300){var n,r=i.coordsChar(o.activeTouch,"page");n=!t.prev||l(t,t.prev)?new Li(r,r):!t.prev.prev||l(t,t.prev.prev)?i.findWordAt(r):new Li(st(r.line,0),mt(i.doc,st(r.line+1,0))),i.setSelection(n.anchor,n.head),i.focus(),Ae(e)}a()}),we(o.scroller,"touchcancel",a),we(o.scroller,"scroll",function(){o.scroller.clientHeight&&(Wr(i,o.scroller.scrollTop),Rr(i,o.scroller.scrollLeft,!0),Ce(i,"scroll",i))}),we(o.scroller,"mousewheel",function(e){return Ti(i,e)}),we(o.scroller,"DOMMouseScroll",function(e){return Ti(i,e)}),we(o.wrapper,"scroll",function(){return o.wrapper.scrollTop=o.wrapper.scrollLeft=0}),o.dragFunctions={enter:function(e){Te(i,e)||_e(e)},over:function(e){Te(i,e)||(function(e,t){var n=hr(e,t);if(n){var r=document.createDocumentFragment();kr(e,n,r),e.display.dragCursor||(e.display.dragCursor=N("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),A(e.display.dragCursor,r)}}(i,e),_e(e))},start:function(e){return function(e,t){if(x&&(!e.state.draggingText||+new Date-Po<100))_e(t);else if(!Te(e,t)&&!An(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!s)){var n=N("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",g&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),g&&n.parentNode.removeChild(n)}}(i,e)},drop:ri(i,Fo),leave:function(e){Te(i,e)||Io(i)}};var e=o.input.getField();we(e,"keyup",function(e){return pa.call(i,e)}),we(e,"keydown",ri(i,ha)),we(e,"keypress",ri(i,ma)),we(e,"focus",function(e){return Ar(i,e)}),we(e,"blur",function(e){return Or(i,e)})}(this),Ho(),Xr(this),this.curOp.forceUpdate=!0,ji(this,r),t.autofocus&&!f||this.hasFocus()?setTimeout(F(Ar,this),20):Or(this),Ma)Ma.hasOwnProperty(a)&&Ma[a](n,t[a],Sa);mi(this),t.finishInit&&t.finishInit(this);for(var l=0;l<_a.length;++l)_a[l](n);Zr(this),b&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}Na.defaults=La,Na.optionHandlers=Ma;var _a=[];function Ea(e,t,n,r){var i,o=e.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=xt(e,t).state:n="prev");var a=e.options.tabSize,l=et(o,t),s=j(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var c,u=l.text.match(/^\s*/)[0];if(r||/\S/.test(l.text)){if("smart"==n&&((c=o.mode.indent(i,l.text.slice(u.length),l.text))==B||150<c)){if(!r)return;n="prev"}}else c=0,n="not";"prev"==n?c=t>o.first?j(et(o,t-1).text,null,a):0:"add"==n?c=s+e.options.indentUnit:"subtract"==n?c=s-e.options.indentUnit:"number"==typeof n&&(c=s+n),c=Math.max(0,c);var d="",f=0;if(e.options.indentWithTabs)for(var h=Math.floor(c/a);h;--h)f+=a,d+="\t";if(f<c&&(d+=$(c-f)),d!=u)return yo(o,d,st(t,0),st(t,u.length),"+input"),!(l.stateAfter=null);for(var p=0;p<o.sel.ranges.length;p++){var m=o.sel.ranges[p];if(m.head.line==t&&m.head.ch<u.length){var g=st(t,u.length);Qi(o,p,new Li(g,g));break}}}Na.defineInitHook=function(e){return _a.push(e)};var za=null;function Da(e){za=e}function Pa(e,t,n,r,i){var o=e.doc;e.display.shift=!1,r=r||o.sel;var a=+new Date-200,l="paste"==i||e.state.pasteIncoming>a,s=He(t),c=null;if(l&&1<r.ranges.length)if(za&&za.text.join("\n")==t){if(r.ranges.length%za.text.length==0){c=[];for(var u=0;u<za.text.length;u++)c.push(o.splitLines(za.text[u]))}}else s.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(c=X(s,function(e){return[e]}));for(var d=e.curOp.updateInput,f=r.ranges.length-1;0<=f;f--){var h=r.ranges[f],p=h.from(),m=h.to();h.empty()&&(n&&0<n?p=st(p.line,p.ch-n):e.state.overwrite&&!l?m=st(m.line,Math.min(et(o,m.line).text.length,m.ch+Y(s).length)):l&&za&&za.lineWise&&za.text.join("\n")==t&&(p=m=st(p.line,0)));var g={from:p,to:m,text:c?c[f%c.length]:s,origin:i||(l?"paste":e.state.cutIncoming>a?"cut":"+input")};ho(e.doc,g),mn(e,"inputRead",e,g)}t&&!l&&Ia(e,t),Pr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=d),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Fa(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||ni(t,function(){return Pa(t,n,0,null,"paste")}),!0}function Ia(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;0<=r;r--){var i=n.ranges[r];if(!(100<i.head.ch||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var l=0;l<o.electricChars.length;l++)if(-1<t.indexOf(o.electricChars.charAt(l))){a=Ea(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(et(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Ea(e,i.head.line,"smart"));a&&mn(e,"electricInput",e,i.head.line)}}}function ja(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,o={anchor:st(i,0),head:st(i+1,0)};n.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:n}}function Wa(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Ha(){var e=N("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=N("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return b?e.style.width="1000px":e.setAttribute("wrap","off"),u&&(e.style.border="1px solid black"),Wa(e),t}function Ra(n,r,i,e,o){var t=r,a=i,l=et(n,r.line);function s(e){var t;if(null==(t=o?function(t,n,l,e){var s=ye(n,t.doc.direction);if(!s)return na(n,l,e);l.ch>=n.text.length?(l.ch=n.text.length,l.sticky="before"):l.ch<=0&&(l.ch=0,l.sticky="after");var r=se(s,l.ch,l.sticky),i=s[r];if("ltr"==t.doc.direction&&i.level%2==0&&(0<e?i.to>l.ch:i.from<l.ch))return na(n,l,e);function c(e,t){return ta(n,e instanceof st?e.ch:e,t)}function o(e){return t.options.lineWrapping?(a=a||jn(t,n),ir(t,n,a,e)):{begin:0,end:n.text.length}}var a,u=o("before"==l.sticky?c(l,-1):l.ch);if("rtl"==t.doc.direction||1==i.level){var d=1==i.level==e<0,f=c(l,d?1:-1);if(null!=f&&(d?f<=i.to&&f<=u.end:f>=i.from&&f>=u.begin)){var h=d?"before":"after";return new st(l.line,f,h)}}function p(e,t,n){for(var r=function(e,t){return t?new st(l.line,c(e,1),"before"):new st(l.line,e,"after")};0<=e&&e<s.length;e+=t){var i=s[e],o=0<t==(1!=i.level),a=o?n.begin:c(n.end,-1);if(i.from<=a&&a<i.to)return r(a,o);if(a=o?i.from:c(i.to,-1),n.begin<=a&&a<n.end)return r(a,o)}}var m=p(r+e,e,u);if(m)return m;var g=0<e?u.end:c(u.begin,-1);return null==g||0<e&&g==n.text.length||!(m=p(0<e?0:s.length-1,e,o(g)))?null:m}(n.cm,l,r,i):na(l,r,i))){if(e||!function(){var e=r.line+i;return!(e<n.first||e>=n.first+n.size)&&(r=new st(e,r.ch,r.sticky),l=et(n,e))}())return!1;r=ra(o,n.cm,l,r.line,i)}else r=t;return!0}if("char"==e)s();else if("column"==e)s(!0);else if("word"==e||"group"==e)for(var c=null,u="group"==e,d=n.cm&&n.cm.getHelper(r,"wordChars"),f=!0;!(i<0)||s(!f);f=!1){var h=l.text.charAt(r.ch)||"\n",p=te(h,d)?"w":u&&"\n"==h?"n":!u||/\s/.test(h)?null:"p";if(!u||f||p||(p="s"),c&&c!=p){i<0&&(i=1,s(),r.sticky="after");break}if(p&&(c=p),0<i&&!s(!f))break}var m=so(n,r,t,a,!0);return ut(t,m)&&(m.hitSide=!0),m}function Ba(e,t,n,r){var i,o,a=e.doc,l=t.left;if("page"==r){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),c=Math.max(s-.5*lr(e.display),3);i=(0<n?t.bottom:t.top)+n*c}else"line"==r&&(i=0<n?t.bottom+3:t.top-3);for(;(o=nr(e,l,i)).outside;){if(n<0?i<=0:i>=a.height){o.hitSide=!0;break}i+=5*n}return o}function qa(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new W,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null}function Ua(e,t){var n=In(e,t.line);if(!n||n.hidden)return null;var r=et(e.doc,t.line),i=Pn(n,r,t.line),o=ye(r,e.doc.direction),a="left";o&&(a=se(o,t.ch)%2?"right":"left");var l=Bn(i.map,t.ch,a);return l.offset="right"==l.collapse?l.end:l.start,l}function Ka(e,t){return t&&(e.bad=!0),e}function Va(e,t,n){var r;if(t==e.display.lineDiv){if(!(r=e.display.lineDiv.childNodes[n]))return Ka(e.clipPos(st(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==r)return Ga(o,t,n)}}function Ga(c,e,t){var n=c.text.firstChild,r=!1;if(!e||!_(n,e))return Ka(st(it(c.line),0),!0);if(e==n&&(r=!0,e=n.childNodes[t],t=0,!e)){var i=c.rest?Y(c.rest):c.line;return Ka(st(it(i),i.text.length),r)}var o=3==e.nodeType?e:null,a=e;for(o||1!=e.childNodes.length||3!=e.firstChild.nodeType||(o=e.firstChild,t=t&&o.nodeValue.length);a.parentNode!=n;)a=a.parentNode;var u=c.measure,d=u.maps;function l(e,t,n){for(var r=-1;r<(d?d.length:0);r++)for(var i=r<0?u.map:d[r],o=0;o<i.length;o+=3){var a=i[o+2];if(a==e||a==t){var l=it(r<0?c.line:c.rest[r]),s=i[o]+n;return(n<0||a!=e)&&(s=i[o+(n?1:0)]),st(l,s)}}}var s=l(o,a,t);if(s)return Ka(s,r);for(var f=a.nextSibling,h=o?o.nodeValue.length-t:0;f;f=f.nextSibling){if(s=l(f,f.firstChild,0))return Ka(st(s.line,s.ch-h),r);h+=f.textContent.length}for(var p=a.previousSibling,m=t;p;p=p.previousSibling){if(s=l(p,p.firstChild,-1))return Ka(st(s.line,s.ch+m),r);m+=p.textContent.length}}qa.prototype.init=function(e){var t=this,a=this,l=a.cm,s=a.div=e.lineDiv;function n(e){if(!Te(l,e)){if(l.somethingSelected())Da({lineWise:!1,text:l.getSelections()}),"cut"==e.type&&l.replaceSelection("",null,"cut");else{if(!l.options.lineWiseCopyCut)return;var t=ja(l);Da({lineWise:!0,text:t.text}),"cut"==e.type&&l.operation(function(){l.setSelections(t.ranges,0,q),l.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var n=za.text.join("\n");if(e.clipboardData.setData("Text",n),e.clipboardData.getData("Text")==n)return void e.preventDefault()}var r=Ha(),i=r.firstChild;l.display.lineSpace.insertBefore(r,l.display.lineSpace.firstChild),i.value=za.text.join("\n");var o=document.activeElement;P(i),setTimeout(function(){l.display.lineSpace.removeChild(r),o.focus(),o==s&&a.showPrimarySelection()},50)}}Wa(s,l.options.spellcheck,l.options.autocorrect,l.options.autocapitalize),we(s,"paste",function(e){Te(l,e)||Fa(e,l)||k<=11&&setTimeout(ri(l,function(){return t.updateFromDOM()}),20)}),we(s,"compositionstart",function(e){t.composing={data:e.data,done:!1}}),we(s,"compositionupdate",function(e){t.composing||(t.composing={data:e.data,done:!1})}),we(s,"compositionend",function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),we(s,"touchstart",function(){return a.forceCompositionEnd()}),we(s,"input",function(){t.composing||t.readFromDOMSoon()}),we(s,"copy",n),we(s,"cut",n)},qa.prototype.prepareSelection=function(){var e=xr(this.cm,!1);return e.focus=this.cm.state.focused,e},qa.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},qa.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},qa.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom)e.removeAllRanges();else{var o=Va(t,e.anchorNode,e.anchorOffset),a=Va(t,e.focusNode,e.focusOffset);if(!o||o.bad||!a||a.bad||0!=ct(ht(o,a),r)||0!=ct(ft(o,a),i)){var l=t.display.view,s=r.line>=t.display.viewFrom&&Ua(t,r)||{node:l[0].measure.map[2],offset:0},c=i.line<t.display.viewTo&&Ua(t,i);if(!c){var u=l[l.length-1].measure,d=u.maps?u.maps[u.maps.length-1]:u.map;c={node:d[d.length-1],offset:d[d.length-2]-d[d.length-3]}}if(s&&c){var f,h=e.rangeCount&&e.getRangeAt(0);try{f=S(s.node,s.offset,c.offset,c.node)}catch(e){}f&&(!m&&t.state.focused?(e.collapse(s.node,s.offset),f.collapsed||(e.removeAllRanges(),e.addRange(f))):(e.removeAllRanges(),e.addRange(f)),h&&null==e.anchorNode?e.addRange(h):m&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},qa.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},qa.prototype.showMultipleSelections=function(e){A(this.cm.display.cursorDiv,e.cursors),A(this.cm.display.selectionDiv,e.selection)},qa.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},qa.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return _(this.div,t)},qa.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())},qa.prototype.blur=function(){this.div.blur()},qa.prototype.getField=function(){return this.div},qa.prototype.supportsTouch=function(){return!0},qa.prototype.receivedFocus=function(){var t=this;this.selectionInEditor()?this.pollSelection():ni(this.cm,function(){return t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))})},qa.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},qa.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=this.getSelection(),t=this.cm;if(d&&a&&this.cm.display.gutterSpecs.length&&function(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}(e.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var n=Va(t,e.anchorNode,e.anchorOffset),r=Va(t,e.focusNode,e.focusOffset);n&&r&&ni(t,function(){no(t.doc,Ai(n,r),q),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})}}},qa.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e,t,n,r=this.cm,i=r.display,o=r.doc.sel.primary(),a=o.from(),l=o.to();if(0==a.ch&&a.line>r.firstLine()&&(a=st(a.line-1,et(r.doc,a.line-1).length)),l.ch==et(r.doc,l.line).text.length&&l.line<r.lastLine()&&(l=st(l.line+1,0)),a.line<i.viewFrom||l.line>i.viewTo-1)return!1;n=a.line==i.viewFrom||0==(e=pr(r,a.line))?(t=it(i.view[0].line),i.view[0].node):(t=it(i.view[e].line),i.view[e-1].node.nextSibling);var s,c,u=pr(r,l.line);if(c=u==i.view.length-1?(s=i.viewTo-1,i.lineDiv.lastChild):(s=it(i.view[u+1].line)-1,i.view[u+1].node.previousSibling),!n)return!1;for(var d=r.doc.splitLines(function(l,e,t,s,c){var n="",u=!1,d=l.doc.lineSeparator(),f=!1;function h(){u&&(n+=d,f&&(n+=d),u=f=!1)}function p(e){e&&(h(),n+=e)}function m(e){if(1==e.nodeType){var t=e.getAttribute("cm-text");if(t)return void p(t);var n,r=e.getAttribute("cm-marker");if(r){var i=l.findMarks(st(s,0),st(c+1,0),function(t){return function(e){return e.id==t}}(+r));return void(i.length&&(n=i[0].find(0))&&p(tt(l.doc,n.from,n.to).join(d)))}if("false"==e.getAttribute("contenteditable"))return;var o=/^(pre|div|p|li|table|br)$/i.test(e.nodeName);if(!/^br$/i.test(e.nodeName)&&0==e.textContent.length)return;o&&h();for(var a=0;a<e.childNodes.length;a++)m(e.childNodes[a]);/^(pre|p)$/i.test(e.nodeName)&&(f=!0),o&&(u=!0)}else 3==e.nodeType&&p(e.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;m(e),e!=t;)e=e.nextSibling,f=!1;return n}(r,n,c,t,s)),f=tt(r.doc,st(t,0),st(s,et(r.doc,s).text.length));1<d.length&&1<f.length;)if(Y(d)==Y(f))d.pop(),f.pop(),s--;else{if(d[0]!=f[0])break;d.shift(),f.shift(),t++}for(var h=0,p=0,m=d[0],g=f[0],v=Math.min(m.length,g.length);h<v&&m.charCodeAt(h)==g.charCodeAt(h);)++h;for(var y=Y(d),b=Y(f),w=Math.min(y.length-(1==d.length?h:0),b.length-(1==f.length?h:0));p<w&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p;if(1==d.length&&1==f.length&&t==a.line)for(;h&&h>a.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)h--,p++;d[d.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),d[0]=d[0].slice(h).replace(/\u200b+$/,"");var x=st(t,h),k=st(s,f.length?Y(f).length-p:0);return 1<d.length||d[0]||ct(x,k)?(yo(r.doc,d,x,k,"+input"),!0):void 0},qa.prototype.ensurePolled=function(){this.forceCompositionEnd()},qa.prototype.reset=function(){this.forceCompositionEnd()},qa.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},qa.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()},80))},qa.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||ni(this.cm,function(){return mr(e.cm)})},qa.prototype.setUneditable=function(e){e.contentEditable="false"},qa.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||ri(this.cm,Pa)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},qa.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},qa.prototype.onContextMenu=function(){},qa.prototype.resetPosition=function(){},qa.prototype.needsContentAttribute=!0;function $a(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new W,this.hasSelection=!1,this.composing=null}var Ya,Xa,Za,Ja,Qa;function el(e,t,r,n){Ya.defaults[e]=t,r&&(Xa[e]=n?function(e,t,n){n!=Sa&&r(e,t,n)}:r)}$a.prototype.init=function(n){var e=this,r=this,i=this.cm;this.createField(n);var o=this.textarea;function t(e){if(!Te(i,e)){if(i.somethingSelected())Da({lineWise:!1,text:i.getSelections()});else{if(!i.options.lineWiseCopyCut)return;var t=ja(i);Da({lineWise:!0,text:t.text}),"cut"==e.type?i.setSelections(t.ranges,null,q):(r.prevInput="",o.value=t.text.join("\n"),P(o))}"cut"==e.type&&(i.state.cutIncoming=+new Date)}}n.wrapper.insertBefore(this.wrapper,n.wrapper.firstChild),u&&(o.style.width="0px"),we(o,"input",function(){x&&9<=k&&e.hasSelection&&(e.hasSelection=null),r.poll()}),we(o,"paste",function(e){Te(i,e)||Fa(e,i)||(i.state.pasteIncoming=+new Date,r.fastPoll())}),we(o,"cut",t),we(o,"copy",t),we(n.scroller,"paste",function(e){if(!An(n,e)&&!Te(i,e)){if(!o.dispatchEvent)return i.state.pasteIncoming=+new Date,void r.focus();var t=new Event("paste");t.clipboardData=e.clipboardData,o.dispatchEvent(t)}}),we(n.lineSpace,"selectstart",function(e){An(n,e)||Ae(e)}),we(o,"compositionstart",function(){var e=i.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:i.markText(e,i.getCursor("to"),{className:"CodeMirror-composing"})}}),we(o,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},$a.prototype.createField=function(e){this.wrapper=Ha(),this.textarea=this.wrapper.firstChild},$a.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=xr(e);if(e.options.moveInputWithCursor){var i=Qn(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},$a.prototype.showSelection=function(e){var t=this.cm.display;A(t.cursorDiv,e.cursors),A(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},$a.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&P(this.textarea),x&&9<=k&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",x&&9<=k&&(this.hasSelection=null))}},$a.prototype.getField=function(){return this.textarea},$a.prototype.supportsTouch=function(){return!1},$a.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!f||E()!=this.textarea))try{this.textarea.focus()}catch(e){}},$a.prototype.blur=function(){this.textarea.blur()},$a.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},$a.prototype.receivedFocus=function(){this.slowPoll()},$a.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},$a.prototype.fastPoll=function(){var t=!1,n=this;n.pollingFast=!0,n.polling.set(20,function e(){n.poll()||t?(n.pollingFast=!1,n.slowPoll()):(t=!0,n.polling.set(60,e))})},$a.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Re(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(x&&9<=k&&this.hasSelection===i||w&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||r||(r="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var a=0,l=Math.min(r.length,i.length);a<l&&r.charCodeAt(a)==i.charCodeAt(a);)++a;return ni(t,function(){Pa(t,i.slice(a),r.length-a,null,e.composing?"*compose":null),1e3<i.length||-1<i.indexOf("\n")?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},$a.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},$a.prototype.onKeyPress=function(){x&&9<=k&&(this.hasSelection=null),this.fastPoll()},$a.prototype.onContextMenu=function(e){var n=this,r=n.cm,i=r.display,o=n.textarea;n.contextMenuPending&&n.contextMenuPending();var t=hr(r,e),a=i.scroller.scrollTop;if(t&&!g){r.options.resetSelectionOnContextMenu&&-1==r.doc.sel.contains(t)&&ri(r,no)(r.doc,Ai(t),q);var l,s=o.style.cssText,c=n.wrapper.style.cssText,u=n.wrapper.offsetParent.getBoundingClientRect();if(n.wrapper.style.cssText="position: static",o.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-u.top-5)+"px; left: "+(e.clientX-u.left-5)+"px;\n z-index: 1000; background: "+(x?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",b&&(l=window.scrollY),i.input.focus(),b&&window.scrollTo(null,l),i.input.reset(),r.somethingSelected()||(o.value=n.prevInput=" "),n.contextMenuPending=h,i.selForContextMenu=r.doc.sel,clearTimeout(i.detectingSelectAll),x&&9<=k&&f(),C){_e(e);var d=function(){ke(window,"mouseup",d),setTimeout(h,20)};we(window,"mouseup",d)}else setTimeout(h,50)}function f(){if(null!=o.selectionStart){var e=r.somethingSelected(),t="​"+(e?o.value:"");o.value="⇚",o.value=t,n.prevInput=e?"":"​",o.selectionStart=1,o.selectionEnd=t.length,i.selForContextMenu=r.doc.sel}}function h(){if(n.contextMenuPending==h&&(n.contextMenuPending=!1,n.wrapper.style.cssText=c,o.style.cssText=s,x&&k<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=a),null!=o.selectionStart)){(!x||x&&k<9)&&f();var e=0,t=function(){i.selForContextMenu==r.doc.sel&&0==o.selectionStart&&0<o.selectionEnd&&"​"==n.prevInput?ri(r,uo)(r):e++<10?i.detectingSelectAll=setTimeout(t,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(t,200)}}},$a.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},$a.prototype.setUneditable=function(){},$a.prototype.needsContentAttribute=!1,Xa=(Ya=Na).optionHandlers,Ya.defineOption=el,Ya.Init=Sa,el("value","",function(e,t){return e.setValue(t)},!0),el("mode",null,function(e,t){e.doc.modeOption=t,zi(e)},!0),el("indentUnit",2,zi,!0),el("indentWithTabs",!1),el("smartIndent",!0),el("tabSize",4,function(e){Di(e),Vn(e),mr(e)},!0),el("lineSeparator",null,function(e,r){if(e.doc.lineSep=r){var i=[],o=e.doc.first;e.doc.iter(function(e){for(var t=0;;){var n=e.text.indexOf(r,t);if(-1==n)break;t=n+r.length,i.push(st(o,n))}o++});for(var t=i.length-1;0<=t;t--)yo(e.doc,r,i[t],st(i[t].line,i[t].ch+r.length))}}),el("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=Sa&&e.refresh()}),el("specialCharPlaceholder",an,function(e){return e.refresh()},!0),el("electricChars",!0),el("inputStyle",f?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),el("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),el("autocorrect",!1,function(e,t){return e.getInputField().autocorrect=t},!0),el("autocapitalize",!1,function(e,t){return e.getInputField().autocapitalize=t},!0),el("rtlMoveVisually",!p),el("wholeLineUpdateBefore",!0),el("theme","default",function(e){Ta(e),yi(e)},!0),el("keyMap","default",function(e,t,n){var r=Qo(t),i=n!=Sa&&Qo(n);i&&i.detach&&i.detach(e,r),r.attach&&r.attach(e,i||null)}),el("extraKeys",null),el("configureMouse",null),el("lineWrapping",!1,Oa,!0),el("gutters",[],function(e,t){e.display.gutterSpecs=gi(t,e.options.lineNumbers),yi(e)},!0),el("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?ur(e.display)+"px":"0",e.refresh()},!0),el("coverGutterNextToScrollbar",!1,function(e){return Kr(e)},!0),el("scrollbarStyle","native",function(e){$r(e),Kr(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),el("lineNumbers",!1,function(e,t){e.display.gutterSpecs=gi(e.options.gutters,t),yi(e)},!0),el("firstLineNumber",1,yi,!0),el("lineNumberFormatter",function(e){return e},yi,!0),el("showCursorWhenSelecting",!1,wr,!0),el("resetSelectionOnContextMenu",!0),el("lineWiseCopyCut",!0),el("pasteLinesPerSelection",!0),el("selectionsMayTouch",!1),el("readOnly",!1,function(e,t){"nocursor"==t&&(Or(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),el("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),el("dragDrop",!0,Aa),el("allowDropFileTypes",null),el("cursorBlinkRate",530),el("cursorScrollMargin",0),el("cursorHeight",1,wr,!0),el("singleCursorHeightPerLine",!0,wr,!0),el("workTime",100),el("workDelay",100),el("flattenSpans",!0,Di,!0),el("addModeClass",!1,Di,!0),el("pollInterval",100),el("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),el("historyEventDelay",1250),el("viewportMargin",10,function(e){return e.refresh()},!0),el("maxHighlightLength",1e4,Di,!0),el("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),el("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),el("autofocus",null),el("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0),el("phrases",null),Ja=(Za=Na).optionHandlers,Qa=Za.helpers={},Za.prototype={constructor:Za,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var n=this.options,r=n[e];n[e]==t&&"mode"!=e||(n[e]=t,Ja.hasOwnProperty(e)&&ri(this,Ja[e])(this,t,r),Ce(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Qo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;n<t.length;++n)if(t[n]==e||t[n].name==e)return t.splice(n,1),!0},addOverlay:ii(function(e,t){var n=e.token?e:Za.getMode(this.options,e);if(n.startState)throw new Error("Overlays may not be stateful.");!function(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}(this.state.overlays,{mode:n,modeSpec:e,opaque:t&&t.opaque,priority:t&&t.priority||0},function(e){return e.priority}),this.state.modeGen++,mr(this)}),removeOverlay:ii(function(e){for(var t=this.state.overlays,n=0;n<t.length;++n){var r=t[n].modeSpec;if(r==e||"string"==typeof e&&r.name==e)return t.splice(n,1),this.state.modeGen++,void mr(this)}}),indentLine:ii(function(e,t,n){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),at(this.doc,e)&&Ea(this,e,t,n)}),indentSelection:ii(function(e){for(var t=this.doc.sel.ranges,n=-1,r=0;r<t.length;r++){var i=t[r];if(i.empty())i.head.line>n&&(Ea(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&Pr(this));else{var o=i.from(),a=i.to(),l=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var s=l;s<n;++s)Ea(this,s,e);var c=this.doc.sel.ranges;0==o.ch&&t.length==c.length&&0<c[r].from().ch&&Qi(this.doc,r,new Li(o,c[r].to()),q)}}}),getTokenAt:function(e,t){return Lt(this,e,t)},getLineTokens:function(e,t){return Lt(this,st(e),t,!0)},getTokenTypeAt:function(e){e=mt(this.doc,e);var t,n=wt(this,et(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var a=r+i>>1;if((a?n[2*a-1]:0)>=o)i=a;else{if(!(n[2*a+1]<o)){t=n[2*a+2];break}r=1+a}}var l=t?t.indexOf("overlay "):-1;return l<0?t:0==l?null:t.slice(0,l-1)},getModeAt:function(e){var t=this.doc.mode;return t.innerMode?Za.innerMode(t,this.getTokenAt(e).state).mode:t},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var n=[];if(!Qa.hasOwnProperty(t))return n;var r=Qa[t],i=this.getModeAt(e);if("string"==typeof i[t])r[i[t]]&&n.push(r[i[t]]);else if(i[t])for(var o=0;o<i[t].length;o++){var a=r[i[t][o]];a&&n.push(a)}else i.helperType&&r[i.helperType]?n.push(r[i.helperType]):r[i.name]&&n.push(r[i.name]);for(var l=0;l<r._global.length;l++){var s=r._global[l];s.pred(i,this)&&-1==H(n,s.val)&&n.push(s.val)}return n},getStateAfter:function(e,t){var n=this.doc;return xt(this,(e=pt(n,null==e?n.first+n.size-1:e))+1,t).state},cursorCoords:function(e,t){var n=this.doc.sel.primary();return Qn(this,null==e?n.head:"object"==typeof e?mt(this.doc,e):e?n.from():n.to(),t||"page")},charCoords:function(e,t){return Jn(this,mt(this.doc,e),t||"page")},coordsChar:function(e,t){return nr(this,(e=Zn(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=Zn(this,{top:e,left:0},t||"page").top,ot(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,n){var r,i=!1;if("number"==typeof e){var o=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:o<e&&(e=o,i=!0),r=et(this.doc,e)}else r=e;return Xn(this,r,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-Zt(r):0)},defaultTextHeight:function(){return lr(this.display)},defaultCharWidth:function(){return sr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o=this.display,a=(e=Qn(this,mt(this.doc,e))).bottom,l=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==r)a=e.top;else if("above"==r||"near"==r){var s=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=s&&(a=e.bottom),l+t.offsetWidth>c&&(l=c-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(l=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?l=0:"middle"==i&&(l=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=l+"px"),n&&function(e,t){var n=zr(e,t);null!=n.scrollTop&&Wr(e,n.scrollTop),null!=n.scrollLeft&&Rr(e,n.scrollLeft)}(this,{left:l,top:a,right:l+t.offsetWidth,bottom:a+t.offsetHeight})},triggerOnKeyDown:ii(ha),triggerOnKeyPress:ii(ma),triggerOnKeyUp:pa,triggerOnMouseDown:ii(ba),execCommand:function(e){if(ia.hasOwnProperty(e))return ia[e].call(null,this)},triggerElectric:ii(function(e){Ia(this,e)}),findPosH:function(e,t,n,r){var i=1;t<0&&(i=-1,t=-t);for(var o=mt(this.doc,e),a=0;a<t&&!(o=Ra(this.doc,o,i,n,r)).hitSide;++a);return o},moveH:ii(function(t,n){var r=this;this.extendSelectionsBy(function(e){return r.display.shift||r.doc.extend||e.empty()?Ra(r.doc,e.head,t,n,r.options.rtlMoveVisually):t<0?e.from():e.to()},K)}),deleteH:ii(function(n,r){var e=this.doc.sel,i=this.doc;e.somethingSelected()?i.replaceSelection("",null,"+delete"):ea(this,function(e){var t=Ra(i,e.head,n,r,!1);return n<0?{from:t,to:e.head}:{from:e.head,to:t}})}),findPosV:function(e,t,n,r){var i=1,o=r;t<0&&(i=-1,t=-t);for(var a=mt(this.doc,e),l=0;l<t;++l){var s=Qn(this,a,"div");if(null==o?o=s.left:s.left=o,(a=Ba(this,s,i,n)).hitSide)break}return a},moveV:ii(function(r,i){var o=this,a=this.doc,l=[],s=!this.display.shift&&!a.extend&&a.sel.somethingSelected();if(a.extendSelectionsBy(function(e){if(s)return r<0?e.from():e.to();var t=Qn(o,e.head,"div");null!=e.goalColumn&&(t.left=e.goalColumn),l.push(t.left);var n=Ba(o,t,r,i);return"page"==i&&e==a.sel.primary()&&Dr(o,Jn(o,n,"div").top-t.top),n},K),l.length)for(var e=0;e<a.sel.ranges.length;e++)a.sel.ranges[e].goalColumn=l[e]}),findWordAt:function(e){var t=et(this.doc,e.line).text,n=e.ch,r=e.ch;if(t){var i=this.getHelper(e,"wordChars");"before"!=e.sticky&&r!=t.length||!n?++r:--n;for(var o=t.charAt(n),a=te(o,i)?function(e){return te(e,i)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!te(e)};0<n&&a(t.charAt(n-1));)--n;for(;r<t.length&&a(t.charAt(r));)++r}return new Li(st(e.line,n),st(e.line,r))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?z(this.display.cursorDiv,"CodeMirror-overwrite"):L(this.display.cursorDiv,"CodeMirror-overwrite"),Ce(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==E()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:ii(function(e,t){Fr(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-En(this)-this.display.barHeight,width:e.scrollWidth-En(this)-this.display.barWidth,clientHeight:Dn(this),clientWidth:zn(this)}},scrollIntoView:ii(function(e,t){null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:st(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line?function(e,t){Ir(e),e.curOp.scrollToPos=t}(this,e):jr(this,e.from,e.to,e.margin)}),setSize:ii(function(e,t){function n(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e}var r=this;null!=e&&(this.display.wrapper.style.width=n(e)),null!=t&&(this.display.wrapper.style.height=n(t)),this.options.lineWrapping&&Kn(this);var i=this.display.viewFrom;this.doc.iter(i,this.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){gr(r,i,"widget");break}++i}),this.curOp.forceUpdate=!0,Ce(this,"refresh",this)}),operation:function(e){return ni(this,e)},startOperation:function(){return Xr(this)},endOperation:function(){return Zr(this)},refresh:ii(function(){var e=this.display.cachedTextHeight;mr(this),this.curOp.forceUpdate=!0,Vn(this),Fr(this,this.doc.scrollLeft,this.doc.scrollTop),fi(this.display),(null==e||.5<Math.abs(e-lr(this.display)))&&fr(this),Ce(this,"refresh",this)}),swapDoc:ii(function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),ji(this,e),Vn(this),this.display.input.reset(),Fr(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,mn(this,"swapDoc",this,t),t}),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Me(Za),Za.registerHelper=function(e,t,n){Qa.hasOwnProperty(e)||(Qa[e]=Za[e]={_global:[]}),Qa[e][t]=n},Za.registerGlobalHelper=function(e,t,n,r){Za.registerHelper(e,t,r),Qa[e]._global.push({pred:n,val:r})};var tl,nl="iter insert remove copy getEditor constructor".split(" ");for(var rl in Do.prototype)Do.prototype.hasOwnProperty(rl)&&H(nl,rl)<0&&(Na.prototype[rl]=function(e){return function(){return e.apply(this.doc,arguments)}}(Do.prototype[rl]));return Me(Do),Na.inputStyles={textarea:$a,contenteditable:qa},Na.defineMode=function(e){Na.defaults.mode||"null"==e||(Na.defaults.mode=e),function(e,t){2<arguments.length&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ue[e]=t}.apply(this,arguments)},Na.defineMIME=function(e,t){Ke[e]=t},Na.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Na.defineMIME("text/plain","null"),Na.defineExtension=function(e,t){Na.prototype[e]=t},Na.defineDocExtension=function(e,t){Do.prototype[e]=t},Na.fromTextArea=function(t,n){if((n=n?I(n):{}).value=t.value,!n.tabindex&&t.tabIndex&&(n.tabindex=t.tabIndex),!n.placeholder&&t.placeholder&&(n.placeholder=t.placeholder),null==n.autofocus){var e=E();n.autofocus=e==t||null!=t.getAttribute("autofocus")&&e==document.body}function r(){t.value=l.getValue()}var i;if(t.form&&(we(t.form,"submit",r),!n.leaveSubmitMethodAlone)){var o=t.form;i=o.submit;try{var a=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=a}}catch(e){}}n.finishInit=function(e){e.save=r,e.getTextArea=function(){return t},e.toTextArea=function(){e.toTextArea=isNaN,r(),t.parentNode.removeChild(e.getWrapperElement()),t.style.display="",t.form&&(ke(t.form,"submit",r),n.leaveSubmitMethodAlone||"function"!=typeof t.form.submit||(t.form.submit=i))}},t.style.display="none";var l=Na(function(e){return t.parentNode.insertBefore(e,t.nextSibling)},n);return l},(tl=Na).off=ke,tl.on=we,tl.wheelEventPixels=Ci,tl.Doc=Do,tl.splitLines=He,tl.countColumn=j,tl.findColumn=V,tl.isWordChar=ee,tl.Pass=B,tl.signal=Ce,tl.Line=en,tl.changeEnd=Oi,tl.scrollbarModel=Gr,tl.Pos=st,tl.cmpPos=ct,tl.modes=Ue,tl.mimeModes=Ke,tl.resolveMode=Ve,tl.getMode=Ge,tl.modeExtensions=$e,tl.extendMode=Ye,tl.copyState=Xe,tl.startState=Je,tl.innerMode=Ze,tl.commands=ia,tl.keyMap=Vo,tl.keyName=Jo,tl.isModifierKey=Xo,tl.lookupKey=Yo,tl.normalizeKeyMap=$o,tl.StringStream=Qe,tl.SharedTextMarker=No,tl.TextMarker=Ao,tl.LineWidget=So,tl.e_preventDefault=Ae,tl.e_stopPropagation=Oe,tl.e_stop=_e,tl.addClass=z,tl.contains=_,tl.rmClass=L,tl.keyNames=Bo,Na.version="5.49.0",Na},"object"==typeof n&&void 0!==t?t.exports=i():"function"==typeof o&&o.amd?o(i):r.CodeMirror=i()},{}],20:[function(e,t,n){var r;r=function(N){"use strict";function e(e){for(var t={},n=0;n<e.length;++n)t[e[n].toLowerCase()]=!0;return t}N.defineMode("css",function(e,t){var n=t.inline;t.propertyKeywords||(t=N.resolveMode("text/css"));var r,i,o=e.indentUnit,a=t.tokenHooks,l=t.documentTypes||{},s=t.mediaTypes||{},c=t.mediaFeatures||{},u=t.mediaValueKeywords||{},d=t.propertyKeywords||{},f=t.nonStandardPropertyKeywords||{},h=t.fontProperties||{},p=t.counterDescriptors||{},m=t.colorKeywords||{},g=t.valueKeywords||{},v=t.allowNested,y=t.lineComment,b=!0===t.supportsAtComponent;function w(e,t){return r=t,e}function x(i){return function(e,t){for(var n,r=!1;null!=(n=e.next());){if(n==i&&!r){")"==i&&e.backUp(1);break}r=!r&&"\\"==n}return n!=i&&(r||")"==i)||(t.tokenize=null),w("string","string")}}function k(e,t){return e.next(),e.match(/\s*[\"\')]/,!1)?t.tokenize=null:t.tokenize=x(")"),w(null,"(")}function C(e,t,n){this.type=e,this.indent=t,this.prev=n}function T(e,t,n,r){return e.context=new C(n,t.indentation()+(!1===r?0:o),e.context),n}function S(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function L(e,t,n){return O[n.context.type](e,t,n)}function M(e,t,n,r){for(var i=r||1;0<i;i--)n.context=n.context.prev;return L(e,t,n)}function A(e){var t=e.current().toLowerCase();i=g.hasOwnProperty(t)?"atom":m.hasOwnProperty(t)?"keyword":"variable"}var O={top:function(e,t,n){if("{"==e)return T(n,t,"block");if("}"==e&&n.context.prev)return S(n);if(b&&/@component/i.test(e))return T(n,t,"atComponentBlock");if(/^@(-moz-)?document$/i.test(e))return T(n,t,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/i.test(e))return T(n,t,"atBlock");if(/^@(font-face|counter-style)/i.test(e))return n.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return T(n,t,"at");if("hash"==e)i="builtin";else if("word"==e)i="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return T(n,t,"interpolation");if(":"==e)return"pseudo";if(v&&"("==e)return T(n,t,"parens")}return n.context.type},block:function(e,t,n){if("word"!=e)return"meta"==e?"block":v||"hash"!=e&&"qualifier"!=e?O.top(e,t,n):(i="error","block");var r=t.current().toLowerCase();return d.hasOwnProperty(r)?(i="property","maybeprop"):f.hasOwnProperty(r)?(i="string-2","maybeprop"):v?(i=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(i+=" error","maybeprop")},maybeprop:function(e,t,n){return":"==e?T(n,t,"prop"):L(e,t,n)},prop:function(e,t,n){if(";"==e)return S(n);if("{"==e&&v)return T(n,t,"propBlock");if("}"==e||"{"==e)return M(e,t,n);if("("==e)return T(n,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(t.current())){if("word"==e)A(t);else if("interpolation"==e)return T(n,t,"interpolation")}else i+=" error";return"prop"},propBlock:function(e,t,n){return"}"==e?S(n):"word"==e?(i="property","maybeprop"):n.context.type},parens:function(e,t,n){return"{"==e||"}"==e?M(e,t,n):")"==e?S(n):"("==e?T(n,t,"parens"):"interpolation"==e?T(n,t,"interpolation"):("word"==e&&A(t),"parens")},pseudo:function(e,t,n){return"meta"==e?"pseudo":"word"==e?(i="variable-3",n.context.type):L(e,t,n)},documentTypes:function(e,t,n){return"word"==e&&l.hasOwnProperty(t.current())?(i="tag",n.context.type):O.atBlock(e,t,n)},atBlock:function(e,t,n){if("("==e)return T(n,t,"atBlock_parens");if("}"==e||";"==e)return M(e,t,n);if("{"==e)return S(n)&&T(n,t,v?"block":"top");if("interpolation"==e)return T(n,t,"interpolation");if("word"==e){var r=t.current().toLowerCase();i="only"==r||"not"==r||"and"==r||"or"==r?"keyword":s.hasOwnProperty(r)?"attribute":c.hasOwnProperty(r)?"property":u.hasOwnProperty(r)?"keyword":d.hasOwnProperty(r)?"property":f.hasOwnProperty(r)?"string-2":g.hasOwnProperty(r)?"atom":m.hasOwnProperty(r)?"keyword":"error"}return n.context.type},atComponentBlock:function(e,t,n){return"}"==e?M(e,t,n):"{"==e?S(n)&&T(n,t,v?"block":"top",!1):("word"==e&&(i="error"),n.context.type)},atBlock_parens:function(e,t,n){return")"==e?S(n):"{"==e||"}"==e?M(e,t,n,2):O.atBlock(e,t,n)},restricted_atBlock_before:function(e,t,n){return"{"==e?T(n,t,"restricted_atBlock"):"word"==e&&"@counter-style"==n.stateArg?(i="variable","restricted_atBlock_before"):L(e,t,n)},restricted_atBlock:function(e,t,n){return"}"==e?(n.stateArg=null,S(n)):"word"==e?(i="@font-face"==n.stateArg&&!h.hasOwnProperty(t.current().toLowerCase())||"@counter-style"==n.stateArg&&!p.hasOwnProperty(t.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},keyframes:function(e,t,n){return"word"==e?(i="variable","keyframes"):"{"==e?T(n,t,"top"):L(e,t,n)},at:function(e,t,n){return";"==e?S(n):"{"==e||"}"==e?M(e,t,n):("word"==e?i="tag":"hash"==e&&(i="builtin"),"at")},interpolation:function(e,t,n){return"}"==e?S(n):"{"==e||";"==e?M(e,t,n):("word"==e?i="variable":"variable"!=e&&"("!=e&&")"!=e&&(i="error"),"interpolation")}};return{startState:function(e){return{tokenize:null,state:n?"block":"top",stateArg:null,context:new C(n?"block":"top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var n=(t.tokenize||function(e,t){var n=e.next();if(a[n]){var r=a[n](e,t);if(!1!==r)return r}return"@"==n?(e.eatWhile(/[\w\\\-]/),w("def",e.current())):"="==n||("~"==n||"|"==n)&&e.eat("=")?w(null,"compare"):'"'==n||"'"==n?(t.tokenize=x(n),t.tokenize(e,t)):"#"==n?(e.eatWhile(/[\w\\\-]/),w("atom","hash")):"!"==n?(e.match(/^\s*\w*/),w("keyword","important")):/\d/.test(n)||"."==n&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),w("number","unit")):"-"!==n?/[,+>*\/]/.test(n)?w(null,"select-op"):"."==n&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?w("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(n)?w(null,n):e.match(/[\w-.]+(?=\()/)?(/^(url(-prefix)?|domain|regexp)$/.test(e.current().toLowerCase())&&(t.tokenize=k),w("variable callee","variable")):/[\w\\\-]/.test(n)?(e.eatWhile(/[\w\\\-]/),w("property","word")):w(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),w("number","unit")):e.match(/^-[\w\\\-]*/)?(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?w("variable-2","variable-definition"):w("variable-2","variable")):e.match(/^\w+-/)?w("meta","meta"):void 0})(e,t);return n&&"object"==typeof n&&(r=n[1],n=n[0]),i=n,"comment"!=r&&(t.state=O[t.state](r,e,t)),i},indent:function(e,t){var n=e.context,r=t&&t.charAt(0),i=n.indent;return"prop"!=n.type||"}"!=r&&")"!=r||(n=n.prev),n.prev&&("}"!=r||"block"!=n.type&&"top"!=n.type&&"interpolation"!=n.type&&"restricted_atBlock"!=n.type?(")"!=r||"parens"!=n.type&&"atBlock_parens"!=n.type)&&("{"!=r||"at"!=n.type&&"atBlock"!=n.type)||(i=Math.max(0,n.indent-o)):i=(n=n.prev).indent),i},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:y,fold:"brace"}});var t=["domain","regexp","url","url-prefix"],n=e(t),r=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],i=e(r),o=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","orientation","device-pixel-ratio","min-device-pixel-ratio","max-device-pixel-ratio","pointer","any-pointer","hover","any-hover"],a=e(o),l=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive"],s=e(l),c=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-gap","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-gap","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","justify-items","justify-self","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","mix-blend-mode","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","place-content","place-items","place-self","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","user-select","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],u=e(c),d=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],f=e(d),h=e(["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"]),p=e(["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"]),m=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],g=e(m),v=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","graytext","grid","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","multiply","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","opacity","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unset","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"],y=e(v),b=t.concat(r).concat(o).concat(l).concat(c).concat(d).concat(m).concat(v);function w(e,t){for(var n,r=!1;null!=(n=e.next());){if(r&&"/"==n){t.tokenize=null;break}r="*"==n}return["comment","comment"]}N.registerHelper("hintWords","css",b),N.defineMIME("text/css",{documentTypes:n,mediaTypes:i,mediaFeatures:a,mediaValueKeywords:s,propertyKeywords:u,nonStandardPropertyKeywords:f,fontProperties:h,counterDescriptors:p,colorKeywords:g,valueKeywords:y,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=w)(e,t)}},name:"css"}),N.defineMIME("text/x-scss",{mediaTypes:i,mediaFeatures:a,mediaValueKeywords:s,propertyKeywords:u,nonStandardPropertyKeywords:f,colorKeywords:g,valueKeywords:y,fontProperties:h,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=w)(e,t):["operator","operator"]},":":function(e){return!!e.match(/\s*\{/,!1)&&[null,null]},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return!!e.eat("{")&&[null,"interpolation"]}},name:"css",helperType:"scss"}),N.defineMIME("text/x-less",{mediaTypes:i,mediaFeatures:a,mediaValueKeywords:s,propertyKeywords:u,nonStandardPropertyKeywords:f,colorKeywords:g,valueKeywords:y,fontProperties:h,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=w)(e,t):["operator","operator"]},"@":function(e){return e.eat("{")?[null,"interpolation"]:!e.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/i,!1)&&(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),N.defineMIME("text/x-gss",{documentTypes:n,mediaTypes:i,mediaFeatures:a,propertyKeywords:u,nonStandardPropertyKeywords:f,fontProperties:h,counterDescriptors:p,colorKeywords:g,valueKeywords:y,supportsAtComponent:!0,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=w)(e,t)}},name:"css",helperType:"gss"})},"object"==typeof n&&"object"==typeof t?r(e("../../lib/codemirror")):"function"==typeof o&&o.amd?o(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":19}],21:[function(e,t,n){var r;r=function(p){"use strict";var i={script:[["lang",/(javascript|babel)/i,"javascript"],["type",/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i,"javascript"],["type",/./,"text/plain"],[null,null,"javascript"]],style:[["lang",/^css$/i,"css"],["type",/^(text\/)?(x-)?(stylesheet|css)$/i,"css"],["type",/./,"text/plain"],[null,null,"css"]]};var r={};function m(e,t){var n=e.match(function(e){var t=r[e];return t||(r[e]=new RegExp("\\s+"+e+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*"))}(t));return n?/^\s*(.*?)\s*$/.exec(n[2])[1]:""}function g(e,t){return new RegExp((t?"^":"")+"</s*"+e+"s*>","i")}function o(e,t){for(var n in e)for(var r=t[n]||(t[n]=[]),i=e[n],o=i.length-1;0<=o;o--)r.unshift(i[o])}p.defineMode("htmlmixed",function(u,e){var d=p.getMode(u,{name:"xml",htmlMode:!0,multilineTagIndentFactor:e.multilineTagIndentFactor,multilineTagIndentPastTag:e.multilineTagIndentPastTag}),f={},t=e&&e.tags,n=e&&e.scriptTypes;if(o(i,f),t&&o(t,f),n)for(var r=n.length-1;0<=r;r--)f.script.unshift(["type",n[r].matches,n[r].mode]);function h(e,t){var n,r=d.token(e,t.htmlState),i=/\btag\b/.test(r);if(i&&!/[<>\s\/]/.test(e.current())&&(n=t.htmlState.tagName&&t.htmlState.tagName.toLowerCase())&&f.hasOwnProperty(n))t.inTag=n+" ";else if(t.inTag&&i&&/>$/.test(e.current())){var o=/^([\S]+) (.*)/.exec(t.inTag);t.inTag=null;var a=">"==e.current()&&function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(!r[0]||r[1].test(m(t,r[0])))return r[2]}}(f[o[1]],o[2]),l=p.getMode(u,a),s=g(o[1],!0),c=g(o[1],!1);t.token=function(e,t){return e.match(s,!1)?(t.token=h,t.localState=t.localMode=null,null):function(e,t,n){var r=e.current(),i=r.search(t);return-1<i?e.backUp(r.length-i):r.match(/<\/?$/)&&(e.backUp(r.length),e.match(t,!1)||e.match(r)),n}(e,c,t.localMode.token(e,t.localState))},t.localMode=l,t.localState=p.startState(l,d.indent(t.htmlState,"",""))}else t.inTag&&(t.inTag+=e.current(),e.eol()&&(t.inTag+=" "));return r}return{startState:function(){return{token:h,inTag:null,localMode:null,localState:null,htmlState:p.startState(d)}},copyState:function(e){var t;return e.localState&&(t=p.copyState(e.localMode,e.localState)),{token:e.token,inTag:e.inTag,localMode:e.localMode,localState:t,htmlState:p.copyState(d,e.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(e,t,n){return!e.localMode||/^\s*<\//.test(t)?d.indent(e.htmlState,t,n):e.localMode.indent?e.localMode.indent(e.localState,t,n):p.Pass},innerMode:function(e){return{state:e.localState||e.htmlState,mode:e.localMode||d}}}},"xml","javascript","css"),p.defineMIME("text/html","htmlmixed")},"object"==typeof n&&"object"==typeof t?r(e("../../lib/codemirror"),e("../xml/xml"),e("../javascript/javascript"),e("../css/css")):"function"==typeof o&&o.amd?o(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],r):r(CodeMirror)},{"../../lib/codemirror":19,"../css/css":20,"../javascript/javascript":22,"../xml/xml":23}],22:[function(e,t,n){var r;r=function(tt){"use strict";tt.defineMode("javascript",function(e,c){var t,n,r,i,o,a,u=e.indentUnit,d=c.statementIndent,l=c.jsonld,s=c.json||l,f=c.typescript,h=c.wordCharacters||/[\w$\xa1-\uffff]/,p=(t=m("keyword a"),n=m("keyword b"),r=m("keyword c"),i=m("keyword d"),o=m("operator"),a={type:"atom",style:"atom"},{if:m("if"),while:t,with:t,else:n,do:n,try:n,finally:n,return:i,break:i,continue:i,new:m("new"),delete:r,void:r,throw:r,debugger:m("debugger"),var:m("var"),const:m("var"),let:m("var"),function:m("function"),catch:m("catch"),for:m("for"),switch:m("switch"),case:m("case"),default:m("default"),in:o,typeof:o,instanceof:o,true:a,false:a,null:a,undefined:a,NaN:a,Infinity:a,this:m("this"),class:m("class"),super:m("atom"),yield:r,export:m("export"),import:m("import"),extends:r,await:r});function m(e){return{type:e,style:"keyword"}}var g,v,y=/[+\-*&%=<>!?|~^@]/,b=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function w(e,t,n){return g=e,v=n,t}function x(e,t){var n=e.next();if('"'==n||"'"==n)return t.tokenize=function(i){return function(e,t){var n,r=!1;if(l&&"@"==e.peek()&&e.match(b))return t.tokenize=x,w("jsonld-keyword","meta");for(;null!=(n=e.next())&&(n!=i||r);)r=!r&&"\\"==n;return r||(t.tokenize=x),w("string","string")}}(n),t.tokenize(e,t);if("."==n&&e.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return w("number","number");if("."==n&&e.match(".."))return w("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(n))return w(n);if("="==n&&e.eat(">"))return w("=>","operator");if("0"==n&&e.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return w("number","number");if(/\d/.test(n))return e.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),w("number","number");if("/"==n)return e.eat("*")?(t.tokenize=k)(e,t):e.eat("/")?(e.skipToEnd(),w("comment","comment")):et(e,t,1)?(function(e){for(var t,n=!1,r=!1;null!=(t=e.next());){if(!n){if("/"==t&&!r)return;"["==t?r=!0:r&&"]"==t&&(r=!1)}n=!n&&"\\"==t}}(e),e.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),w("regexp","string-2")):(e.eat("="),w("operator","operator",e.current()));if("`"==n)return(t.tokenize=C)(e,t);if("#"==n)return e.skipToEnd(),w("error","error");if("<"==n&&e.match("!--")||"-"==n&&e.match("->"))return e.skipToEnd(),w("comment","comment");if(y.test(n))return">"==n&&t.lexical&&">"==t.lexical.type||(e.eat("=")?"!"!=n&&"="!=n||e.eat("="):/[<>*+\-]/.test(n)&&(e.eat(n),">"==n&&e.eat(n))),w("operator","operator",e.current());if(h.test(n)){e.eatWhile(h);var r=e.current();if("."!=t.lastType){if(p.propertyIsEnumerable(r)){var i=p[r];return w(i.type,i.style,r)}if("async"==r&&e.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/,!1))return w("async","keyword",r)}return w("variable","variable",r)}}function k(e,t){for(var n,r=!1;n=e.next();){if("/"==n&&r){t.tokenize=x;break}r="*"==n}return w("comment","comment")}function C(e,t){for(var n,r=!1;null!=(n=e.next());){if(!r&&("`"==n||"$"==n&&e.eat("{"))){t.tokenize=x;break}r=!r&&"\\"==n}return w("quasi","string-2",e.current())}var T="([{}])";function S(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var n=e.string.indexOf("=>",e.start);if(!(n<0)){if(f){var r=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(e.string.slice(e.start,n));r&&(n=r.index)}for(var i=0,o=!1,a=n-1;0<=a;--a){var l=e.string.charAt(a),s=T.indexOf(l);if(0<=s&&s<3){if(!i){++a;break}if(0==--i){"("==l&&(o=!0);break}}else if(3<=s&&s<6)++i;else if(h.test(l))o=!0;else if(/["'\/`]/.test(l))for(;;--a){if(0==a)return;if(e.string.charAt(a-1)==l&&"\\"!=e.string.charAt(a-2)){a--;break}}else if(o&&!i){++a;break}}o&&!i&&(t.fatArrowAt=a)}}var L={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0};function M(e,t,n,r,i,o){this.indented=e,this.column=t,this.type=n,this.prev=i,this.info=o,null!=r&&(this.align=r)}function A(e,t){for(var n=e.localVars;n;n=n.next)if(n.name==t)return!0;for(var r=e.context;r;r=r.prev)for(n=r.vars;n;n=n.next)if(n.name==t)return!0}var O={state:null,column:null,marked:null,cc:null};function N(){for(var e=arguments.length-1;0<=e;e--)O.cc.push(arguments[e])}function _(){return N.apply(null,arguments),!0}function E(e,t){for(var n=t;n;n=n.next)if(n.name==e)return!0;return!1}function z(e){var t=O.state;if(O.marked="def",t.context)if("var"==t.lexical.info&&t.context&&t.context.block){var n=function e(t,n){{if(n){if(n.block){var r=e(t,n.prev);return r?r==n.prev?n:new P(r,n.vars,!0):null}return E(t,n.vars)?n:new P(n.prev,new F(t,n.vars),!1)}return null}}(e,t.context);if(null!=n)return void(t.context=n)}else if(!E(e,t.localVars))return void(t.localVars=new F(e,t.localVars));c.globalVars&&!E(e,t.globalVars)&&(t.globalVars=new F(e,t.globalVars))}function D(e){return"public"==e||"private"==e||"protected"==e||"abstract"==e||"readonly"==e}function P(e,t,n){this.prev=e,this.vars=t,this.block=n}function F(e,t){this.name=e,this.next=t}var I=new F("this",new F("arguments",null));function j(){O.state.context=new P(O.state.context,O.state.localVars,!1),O.state.localVars=I}function W(){O.state.context=new P(O.state.context,O.state.localVars,!0),O.state.localVars=null}function H(){O.state.localVars=O.state.context.vars,O.state.context=O.state.context.prev}function R(r,i){function e(){var e=O.state,t=e.indented;if("stat"==e.lexical.type)t=e.lexical.indented;else for(var n=e.lexical;n&&")"==n.type&&n.align;n=n.prev)t=n.indented;e.lexical=new M(t,O.stream.column(),r,null,e.lexical,i)}return e.lex=!0,e}function B(){var e=O.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function q(n){return function e(t){return t==n?_():";"==n||"}"==t||")"==t||"]"==t?N():_(e)}}function U(e,t){return"var"==e?_(R("vardef",t),Se,q(";"),B):"keyword a"==e?_(R("form"),$,U,B):"keyword b"==e?_(R("form"),U,B):"keyword d"==e?O.stream.match(/^\s*$/,!1)?_():_(R("stat"),X,q(";"),B):"debugger"==e?_(q(";")):"{"==e?_(R("}"),W,fe,B,H):";"==e?_():"if"==e?("else"==O.state.lexical.info&&O.state.cc[O.state.cc.length-1]==B&&O.state.cc.pop()(),_(R("form"),$,U,B,_e)):"function"==e?_(Pe):"for"==e?_(R("form"),Ee,U,B):"class"==e||f&&"interface"==t?(O.marked="keyword",_(R("form","class"==e?e:t),He,B)):"variable"==e?f&&"declare"==t?(O.marked="keyword",_(U)):f&&("module"==t||"enum"==t||"type"==t)&&O.stream.match(/^\s*\w/,!1)?(O.marked="keyword","enum"==t?_(Je):"type"==t?_(Ie,q("operator"),ve,q(";")):_(R("form"),Le,q("{"),R("}"),fe,B,B)):f&&"namespace"==t?(O.marked="keyword",_(R("form"),V,U,B)):f&&"abstract"==t?(O.marked="keyword",_(U)):_(R("stat"),oe):"switch"==e?_(R("form"),$,q("{"),R("}","switch"),W,fe,B,B,H):"case"==e?_(V,q(":")):"default"==e?_(q(":")):"catch"==e?_(R("form"),j,K,U,B,H):"export"==e?_(R("stat"),Ue,B):"import"==e?_(R("stat"),Ve,B):"async"==e?_(U):"@"==t?_(V,U):N(R("stat"),V,q(";"),B)}function K(e){if("("==e)return _(je,q(")"))}function V(e,t){return Y(e,t,!1)}function G(e,t){return Y(e,t,!0)}function $(e){return"("!=e?N():_(R(")"),V,q(")"),B)}function Y(e,t,n){if(O.state.fatArrowAt==O.stream.start){var r=n?ne:te;if("("==e)return _(j,R(")"),ue(je,")"),B,q("=>"),r,H);if("variable"==e)return N(j,Le,q("=>"),r,H)}var i=n?J:Z;return L.hasOwnProperty(e)?_(i):"function"==e?_(Pe,i):"class"==e||f&&"interface"==t?(O.marked="keyword",_(R("form"),We,B)):"keyword c"==e||"async"==e?_(n?G:V):"("==e?_(R(")"),X,q(")"),B,i):"operator"==e||"spread"==e?_(n?G:V):"["==e?_(R("]"),Ze,B,i):"{"==e?de(le,"}",null,i):"quasi"==e?N(Q,i):"new"==e?_(function(t){return function(e){return"."==e?_(t?ie:re):"variable"==e&&f?_(ke,t?J:Z):N(t?G:V)}}(n)):"import"==e?_(V):_()}function X(e){return e.match(/[;\}\)\],]/)?N():N(V)}function Z(e,t){return","==e?_(V):J(e,t,!1)}function J(e,t,n){var r=0==n?Z:J,i=0==n?V:G;return"=>"==e?_(j,n?ne:te,H):"operator"==e?/\+\+|--/.test(t)||f&&"!"==t?_(r):f&&"<"==t&&O.stream.match(/^([^>]|<.*?>)*>\s*\(/,!1)?_(R(">"),ue(ve,">"),B,r):"?"==t?_(V,q(":"),i):_(i):"quasi"==e?N(Q,r):";"!=e?"("==e?de(G,")","call",r):"."==e?_(ae,r):"["==e?_(R("]"),X,q("]"),B,r):f&&"as"==t?(O.marked="keyword",_(ve,r)):"regexp"==e?(O.state.lastType=O.marked="operator",O.stream.backUp(O.stream.pos-O.stream.start-1),_(i)):void 0:void 0}function Q(e,t){return"quasi"!=e?N():"${"!=t.slice(t.length-2)?_(Q):_(V,ee)}function ee(e){if("}"==e)return O.marked="string-2",O.state.tokenize=C,_(Q)}function te(e){return S(O.stream,O.state),N("{"==e?U:V)}function ne(e){return S(O.stream,O.state),N("{"==e?U:G)}function re(e,t){if("target"==t)return O.marked="keyword",_(Z)}function ie(e,t){if("target"==t)return O.marked="keyword",_(J)}function oe(e){return":"==e?_(B,U):N(Z,q(";"),B)}function ae(e){if("variable"==e)return O.marked="property",_()}function le(e,t){if("async"==e)return O.marked="property",_(le);if("variable"==e||"keyword"==O.style){return O.marked="property","get"==t||"set"==t?_(se):(f&&O.state.fatArrowAt==O.stream.start&&(n=O.stream.match(/^\s*:\s*/,!1))&&(O.state.fatArrowAt=O.stream.pos+n[0].length),_(ce));var n}else{if("number"==e||"string"==e)return O.marked=l?"property":O.style+" property",_(ce);if("jsonld-keyword"==e)return _(ce);if(f&&D(t))return O.marked="keyword",_(le);if("["==e)return _(V,he,q("]"),ce);if("spread"==e)return _(G,ce);if("*"==t)return O.marked="keyword",_(le);if(":"==e)return N(ce)}}function se(e){return"variable"!=e?N(ce):(O.marked="property",_(Pe))}function ce(e){return":"==e?_(G):"("==e?N(Pe):void 0}function ue(r,i,o){function a(e,t){if(o?-1<o.indexOf(e):","==e){var n=O.state.lexical;return"call"==n.info&&(n.pos=(n.pos||0)+1),_(function(e,t){return e==i||t==i?N():N(r)},a)}return e==i||t==i?_():o&&-1<o.indexOf(";")?N(r):_(q(i))}return function(e,t){return e==i||t==i?_():N(r,a)}}function de(e,t,n){for(var r=3;r<arguments.length;r++)O.cc.push(arguments[r]);return _(R(t,n),ue(e,t),B)}function fe(e){return"}"==e?_():N(U,fe)}function he(e,t){if(f){if(":"==e)return _(ve);if("?"==t)return _(he)}}function pe(e,t){if(f&&(":"==e||"in"==t))return _(ve)}function me(e){if(f&&":"==e)return O.stream.match(/^\s*\w+\s+is\b/,!1)?_(V,ge,ve):_(ve)}function ge(e,t){if("is"==t)return O.marked="keyword",_()}function ve(e,t){return"keyof"==t||"typeof"==t||"infer"==t?(O.marked="keyword",_("typeof"==t?G:ve)):"variable"==e||"void"==t?(O.marked="type",_(xe)):"|"==t||"&"==t?_(ve):"string"==e||"number"==e||"atom"==e?_(xe):"["==e?_(R("]"),ue(ve,"]",","),B,xe):"{"==e?_(R("}"),ue(be,"}",",;"),B,xe):"("==e?_(ue(we,")"),ye,xe):"<"==e?_(ue(ve,">"),ve):void 0}function ye(e){if("=>"==e)return _(ve)}function be(e,t){return"variable"==e||"keyword"==O.style?(O.marked="property",_(be)):"?"==t||"number"==e||"string"==e?_(be):":"==e?_(ve):"["==e?_(q("variable"),pe,q("]"),be):"("==e?N(Fe,be):void 0}function we(e,t){return"variable"==e&&O.stream.match(/^\s*[?:]/,!1)||"?"==t?_(we):":"==e?_(ve):"spread"==e?_(we):N(ve)}function xe(e,t){return"<"==t?_(R(">"),ue(ve,">"),B,xe):"|"==t||"."==e||"&"==t?_(ve):"["==e?_(ve,q("]"),xe):"extends"==t||"implements"==t?(O.marked="keyword",_(ve)):"?"==t?_(ve,q(":"),ve):void 0}function ke(e,t){if("<"==t)return _(R(">"),ue(ve,">"),B,xe)}function Ce(){return N(ve,Te)}function Te(e,t){if("="==t)return _(ve)}function Se(e,t){return"enum"==t?(O.marked="keyword",_(Je)):N(Le,he,Oe,Ne)}function Le(e,t){return f&&D(t)?(O.marked="keyword",_(Le)):"variable"==e?(z(t),_()):"spread"==e?_(Le):"["==e?de(Ae,"]"):"{"==e?de(Me,"}"):void 0}function Me(e,t){return"variable"!=e||O.stream.match(/^\s*:/,!1)?("variable"==e&&(O.marked="property"),"spread"==e?_(Le):"}"==e?N():"["==e?_(V,q("]"),q(":"),Me):_(q(":"),Le,Oe)):(z(t),_(Oe))}function Ae(){return N(Le,Oe)}function Oe(e,t){if("="==t)return _(G)}function Ne(e){if(","==e)return _(Se)}function _e(e,t){if("keyword b"==e&&"else"==t)return _(R("form","else"),U,B)}function Ee(e,t){return"await"==t?_(Ee):"("==e?_(R(")"),ze,B):void 0}function ze(e){return"var"==e?_(Se,De):"variable"==e?_(De):N(De)}function De(e,t){return")"==e?_():";"==e?_(De):"in"==t||"of"==t?(O.marked="keyword",_(V,De)):N(V,De)}function Pe(e,t){return"*"==t?(O.marked="keyword",_(Pe)):"variable"==e?(z(t),_(Pe)):"("==e?_(j,R(")"),ue(je,")"),B,me,U,H):f&&"<"==t?_(R(">"),ue(Ce,">"),B,Pe):void 0}function Fe(e,t){return"*"==t?(O.marked="keyword",_(Fe)):"variable"==e?(z(t),_(Fe)):"("==e?_(j,R(")"),ue(je,")"),B,me,H):f&&"<"==t?_(R(">"),ue(Ce,">"),B,Fe):void 0}function Ie(e,t){return"keyword"==e||"variable"==e?(O.marked="type",_(Ie)):"<"==t?_(R(">"),ue(Ce,">"),B):void 0}function je(e,t){return"@"==t&&_(V,je),"spread"==e?_(je):f&&D(t)?(O.marked="keyword",_(je)):f&&"this"==e?_(he,Oe):N(Le,he,Oe)}function We(e,t){return"variable"==e?He(e,t):Re(e,t)}function He(e,t){if("variable"==e)return z(t),_(Re)}function Re(e,t){return"<"==t?_(R(">"),ue(Ce,">"),B,Re):"extends"==t||"implements"==t||f&&","==e?("implements"==t&&(O.marked="keyword"),_(f?ve:V,Re)):"{"==e?_(R("}"),Be,B):void 0}function Be(e,t){return"async"==e||"variable"==e&&("static"==t||"get"==t||"set"==t||f&&D(t))&&O.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(O.marked="keyword",_(Be)):"variable"==e||"keyword"==O.style?(O.marked="property",_(f?qe:Pe,Be)):"number"==e||"string"==e?_(f?qe:Pe,Be):"["==e?_(V,he,q("]"),f?qe:Pe,Be):"*"==t?(O.marked="keyword",_(Be)):f&&"("==e?N(Fe,Be):";"==e||","==e?_(Be):"}"==e?_():"@"==t?_(V,Be):void 0}function qe(e,t){if("?"==t)return _(qe);if(":"==e)return _(ve,Oe);if("="==t)return _(G);var n=O.state.lexical.prev;return N(n&&"interface"==n.info?Fe:Pe)}function Ue(e,t){return"*"==t?(O.marked="keyword",_(Xe,q(";"))):"default"==t?(O.marked="keyword",_(V,q(";"))):"{"==e?_(ue(Ke,"}"),Xe,q(";")):N(U)}function Ke(e,t){return"as"==t?(O.marked="keyword",_(q("variable"))):"variable"==e?N(G,Ke):void 0}function Ve(e){return"string"==e?_():"("==e?N(V):N(Ge,$e,Xe)}function Ge(e,t){return"{"==e?de(Ge,"}"):("variable"==e&&z(t),"*"==t&&(O.marked="keyword"),_(Ye))}function $e(e){if(","==e)return _(Ge,$e)}function Ye(e,t){if("as"==t)return O.marked="keyword",_(Ge)}function Xe(e,t){if("from"==t)return O.marked="keyword",_(V)}function Ze(e){return"]"==e?_():N(ue(G,"]"))}function Je(){return N(R("form"),Le,q("{"),R("}"),ue(Qe,"}"),B,B)}function Qe(){return N(Le,Oe)}function et(e,t,n){return t.tokenize==x&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(n||0)))}return B.lex=H.lex=!0,{startState:function(e){var t={tokenize:x,lastType:"sof",cc:[],lexical:new M((e||0)-u,0,"block",!1),localVars:c.localVars,context:c.localVars&&new P(null,null,!1),indented:e||0};return c.globalVars&&"object"==typeof c.globalVars&&(t.globalVars=c.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),S(e,t)),t.tokenize!=k&&e.eatSpace())return null;var n=t.tokenize(e,t);return"comment"==g?n:(t.lastType="operator"!=g||"++"!=v&&"--"!=v?g:"incdec",function(e,t,n,r,i){var o=e.cc;for(O.state=e,O.stream=i,O.marked=null,O.cc=o,O.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){if((o.length?o.pop():s?V:U)(n,r)){for(;o.length&&o[o.length-1].lex;)o.pop()();return O.marked?O.marked:"variable"==n&&A(e,r)?"variable-2":t}}}(t,n,g,v,e))},indent:function(e,t){if(e.tokenize==k)return tt.Pass;if(e.tokenize!=x)return 0;var n,r=t&&t.charAt(0),i=e.lexical;if(!/^\s*else\b/.test(t))for(var o=e.cc.length-1;0<=o;--o){var a=e.cc[o];if(a==B)i=i.prev;else if(a!=_e)break}for(;("stat"==i.type||"form"==i.type)&&("}"==r||(n=e.cc[e.cc.length-1])&&(n==Z||n==J)&&!/^[,\.=+\-*:?[\(]/.test(t));)i=i.prev;d&&")"==i.type&&"stat"==i.prev.type&&(i=i.prev);var l=i.type,s=r==l;return"vardef"==l?i.indented+("operator"==e.lastType||","==e.lastType?i.info.length+1:0):"form"==l&&"{"==r?i.indented:"form"==l?i.indented+u:"stat"==l?i.indented+(function(e,t){return"operator"==e.lastType||","==e.lastType||y.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}(e,t)?d||u:0):"switch"!=i.info||s||0==c.doubleIndentSwitch?i.align?i.column+(s?0:1):i.indented+(s?0:u):i.indented+(/^(?:case|default)\b/.test(t)?u:2*u)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:s?null:"/*",blockCommentEnd:s?null:"*/",blockCommentContinue:s?null:" * ",lineComment:s?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:s?"json":"javascript",jsonldMode:l,jsonMode:s,expressionAllowed:et,skipExpression:function(e){var t=e.cc[e.cc.length-1];t!=V&&t!=G||e.cc.pop()}}}),tt.registerHelper("wordChars","javascript",/[\w$]/),tt.defineMIME("text/javascript","javascript"),tt.defineMIME("text/ecmascript","javascript"),tt.defineMIME("application/javascript","javascript"),tt.defineMIME("application/x-javascript","javascript"),tt.defineMIME("application/ecmascript","javascript"),tt.defineMIME("application/json",{name:"javascript",json:!0}),tt.defineMIME("application/x-json",{name:"javascript",json:!0}),tt.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),tt.defineMIME("text/typescript",{name:"javascript",typescript:!0}),tt.defineMIME("application/typescript",{name:"javascript",typescript:!0})},"object"==typeof n&&"object"==typeof t?r(e("../../lib/codemirror")):"function"==typeof o&&o.amd?o(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":19}],23:[function(e,t,n){var r;r=function(C){"use strict";var T={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},S={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};C.defineMode("xml",function(e,t){var i,o,a=e.indentUnit,l={},n=t.htmlMode?T:S;for(var r in n)l[r]=n[r];for(var r in t)l[r]=t[r];function s(t,n){function e(e){return(n.tokenize=e)(t,n)}var r=t.next();return"<"==r?t.eat("!")?t.eat("[")?t.match("CDATA[")?e(u("atom","]]>")):null:t.match("--")?e(u("comment","--\x3e")):t.match("DOCTYPE",!0,!0)?(t.eatWhile(/[\w\._\-]/),e(function r(i){return function(e,t){for(var n;null!=(n=e.next());){if("<"==n)return t.tokenize=r(i+1),t.tokenize(e,t);if(">"==n){if(1!=i)return t.tokenize=r(i-1),t.tokenize(e,t);t.tokenize=s;break}}return"meta"}}(1))):null:t.eat("?")?(t.eatWhile(/[\w\._\-]/),n.tokenize=u("meta","?>"),"meta"):(i=t.eat("/")?"closeTag":"openTag",n.tokenize=c,"tag bracket"):"&"!=r?(t.eatWhile(/[^&<]/),null):(t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w\.\-:]/)&&t.eat(";"))?"atom":"error"}function c(e,t){var n=e.next();if(">"==n||"/"==n&&e.eat(">"))return t.tokenize=s,i=">"==n?"endTag":"selfcloseTag","tag bracket";if("="==n)return i="equals",null;if("<"!=n)return/[\'\"]/.test(n)?(t.tokenize=function(n){function e(e,t){for(;!e.eol();)if(e.next()==n){t.tokenize=c;break}return"string"}return e.isInAttribute=!0,e}(n),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word");t.tokenize=s,t.state=p,t.tagName=t.tagStart=null;var r=t.tokenize(e,t);return r?r+" tag error":"tag error"}function u(n,r){return function(e,t){for(;!e.eol();){if(e.match(r)){t.tokenize=s;break}e.next()}return n}}function d(e,t,n){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=n,(l.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function f(e){e.context&&(e.context=e.context.prev)}function h(e,t){for(var n;;){if(!e.context)return;if(n=e.context.tagName,!l.contextGrabbers.hasOwnProperty(n)||!l.contextGrabbers[n].hasOwnProperty(t))return;f(e)}}function p(e,t,n){return"openTag"==e?(n.tagStart=t.column(),m):"closeTag"==e?g:p}function m(e,t,n){return"word"==e?(n.tagName=t.current(),o="tag",b):l.allowMissingTagName&&"endTag"==e?(o="tag bracket",b(e,t,n)):(o="error",m)}function g(e,t,n){if("word"!=e)return l.allowMissingTagName&&"endTag"==e?(o="tag bracket",v(e,t,n)):(o="error",y);var r=t.current();return n.context&&n.context.tagName!=r&&l.implicitlyClosed.hasOwnProperty(n.context.tagName)&&f(n),n.context&&n.context.tagName==r||!1===l.matchClosing?(o="tag",v):(o="tag error",y)}function v(e,t,n){return"endTag"!=e?(o="error",v):(f(n),p)}function y(e,t,n){return o="error",v(e,0,n)}function b(e,t,n){if("word"==e)return o="attribute",w;if("endTag"!=e&&"selfcloseTag"!=e)return o="error",b;var r=n.tagName,i=n.tagStart;return n.tagName=n.tagStart=null,"selfcloseTag"==e||l.autoSelfClosers.hasOwnProperty(r)?h(n,r):(h(n,r),n.context=new d(n,r,i==n.indented)),p}function w(e,t,n){return"equals"==e?x:(l.allowMissing||(o="error"),b(e,0,n))}function x(e,t,n){return"string"==e?k:"word"==e&&l.allowUnquoted?(o="string",b):(o="error",b(e,0,n))}function k(e,t,n){return"string"==e?k:b(e,0,n)}return s.isInText=!0,{startState:function(e){var t={tokenize:s,state:p,indented:e||0,tagName:null,tagStart:null,context:null};return null!=e&&(t.baseIndent=e),t},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;i=null;var n=t.tokenize(e,t);return(n||i)&&"comment"!=n&&(o=null,t.state=t.state(i||n,e,t),o&&(n="error"==o?n+" error":o)),n},indent:function(e,t,n){var r=e.context;if(e.tokenize.isInAttribute)return e.tagStart==e.indented?e.stringStartCol+1:e.indented+a;if(r&&r.noIndent)return C.Pass;if(e.tokenize!=c&&e.tokenize!=s)return n?n.match(/^(\s*)/)[0].length:0;if(e.tagName)return!1!==l.multilineTagIndentPastTag?e.tagStart+e.tagName.length+2:e.tagStart+a*(l.multilineTagIndentFactor||1);if(l.alignCDATA&&/<!\[CDATA\[/.test(t))return 0;var i=t&&/^<(\/)?([\w_:\.-]*)/.exec(t);if(i&&i[1])for(;r;){if(r.tagName==i[2]){r=r.prev;break}if(!l.implicitlyClosed.hasOwnProperty(r.tagName))break;r=r.prev}else if(i)for(;r;){var o=l.contextGrabbers[r.tagName];if(!o||!o.hasOwnProperty(i[2]))break;r=r.prev}for(;r&&r.prev&&!r.startOfLine;)r=r.prev;return r?r.indent+a:e.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:l.htmlMode?"html":"xml",helperType:l.htmlMode?"html":"xml",skipAttribute:function(e){e.state==x&&(e.state=b)},xmlCurrentTag:function(e){return e.tagName?{name:e.tagName,close:"closeTag"==e.type}:null},xmlCurrentContext:function(e){for(var t=[],n=e.context;n;n=n.prev)n.tagName&&t.push(n.tagName);return t.reverse()}}}),C.defineMIME("text/xml","xml"),C.defineMIME("application/xml","xml"),C.mimeModes.hasOwnProperty("text/html")||C.defineMIME("text/html",{name:"xml",htmlMode:!0})},"object"==typeof n&&"object"==typeof t?r(e("../../lib/codemirror")):"function"==typeof o&&o.amd?o(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":19}],24:[function(e,t,n){t.exports={prettyPrint:function(e,t){var n,r,i,o,a,c;for(r=(t=t||{}).indent_size||4,i=t.indent_char||" ",a=t.brace_style||"collapse",o=0==t.max_char?1/0:t.max_char||70,c=t.unformatted||["a","span","bdo","em","strong","dfn","code","samp","kbd","var","cite","abbr","acronym","q","sub","sup","tt","i","b","big","small","u","s","strike","font","ins","del","pre","address","dt","h1","h2","h3","h4","h5","h6"],(n=new function(){return this.pos=0,this.token="",this.current_mode="CONTENT",this.tags={parent:"parent1",parentcount:1,parent1:""},this.tag_type="",this.token_text=this.last_token=this.last_text=this.token_type="",this.Utils={whitespace:"\n\r\t ".split(""),single_token:"br,input,link,meta,!doctype,basefont,base,area,hr,wbr,param,img,isindex,?xml,embed,?php,?,?=".split(","),extra_liners:"head,body,/html".split(","),in_array:function(e,t){for(var n=0;n<t.length;n++)if(e===t[n])return!0;return!1}},this.get_content=function(){for(var e="",t=[],n=!1;"<"!==this.input.charAt(this.pos);){if(this.pos>=this.input.length)return t.length?t.join(""):["","TK_EOF"];if(e=this.input.charAt(this.pos),this.pos++,this.line_char_count++,this.Utils.in_array(e,this.Utils.whitespace))t.length&&(n=!0),this.line_char_count--;else{if(n){if(this.line_char_count>=this.max_char){t.push("\n");for(var r=0;r<this.indent_level;r++)t.push(this.indent_string);this.line_char_count=0}else t.push(" "),this.line_char_count++;n=!1}t.push(e)}}return t.length?t.join(""):""},this.get_contents_to=function(e){if(this.pos==this.input.length)return["","TK_EOF"];var t="",n=new RegExp("</"+e+"\\s*>","igm");n.lastIndex=this.pos;var r=n.exec(this.input),i=r?r.index:this.input.length;return this.pos<i&&(t=this.input.substring(this.pos,i),this.pos=i),t},this.record_tag=function(e){this.tags[e+"count"]?this.tags[e+"count"]++:this.tags[e+"count"]=1,this.tags[e+this.tags[e+"count"]]=this.indent_level,this.tags[e+this.tags[e+"count"]+"parent"]=this.tags.parent,this.tags.parent=e+this.tags[e+"count"]},this.retrieve_tag=function(e){if(this.tags[e+"count"]){for(var t=this.tags.parent;t&&e+this.tags[e+"count"]!==t;)t=this.tags[t+"parent"];t&&(this.indent_level=this.tags[e+this.tags[e+"count"]],this.tags.parent=this.tags[t+"parent"]),delete this.tags[e+this.tags[e+"count"]+"parent"],delete this.tags[e+this.tags[e+"count"]],1==this.tags[e+"count"]?delete this.tags[e+"count"]:this.tags[e+"count"]--}},this.get_tag=function(){var e,t,n="",r=[],i=!1;do{if(this.pos>=this.input.length)return r.length?r.join(""):["","TK_EOF"];n=this.input.charAt(this.pos),this.pos++,this.line_char_count++,this.Utils.in_array(n,this.Utils.whitespace)?(i=!0,this.line_char_count--):("'"!==n&&'"'!==n||r[1]&&"!"===r[1]||(n+=this.get_unformatted(n),i=!0),"="===n&&(i=!1),r.length&&"="!==r[r.length-1]&&">"!==n&&i&&(this.line_char_count>=this.max_char?(this.print_newline(!1,r),this.line_char_count=0):(r.push(" "),this.line_char_count++),i=!1),"<"===n&&(e=this.pos-1),r.push(n))}while(">"!==n);var o,a=r.join("");o=-1!=a.indexOf(" ")?a.indexOf(" "):a.indexOf(">");var l=a.substring(1,o).toLowerCase();if("/"===a.charAt(a.length-2)||this.Utils.in_array(l,this.Utils.single_token))this.tag_type="SINGLE";else if("script"===l)this.record_tag(l),this.tag_type="SCRIPT";else if("style"===l)this.record_tag(l),this.tag_type="STYLE";else if(this.Utils.in_array(l,c)){var s=this.get_unformatted("</"+l+">",a);r.push(s),0<e&&this.Utils.in_array(this.input.charAt(e-1),this.Utils.whitespace)&&r.splice(0,0,this.input.charAt(e-1)),t=this.pos-1,this.Utils.in_array(this.input.charAt(1+t),this.Utils.whitespace)&&r.push(this.input.charAt(1+t)),this.tag_type="SINGLE"}else if("!"===l.charAt(0))if(-1!=l.indexOf("[if")){if(-1!=a.indexOf("!IE")){s=this.get_unformatted("--\x3e",a);r.push(s)}this.tag_type="START"}else if(-1!=l.indexOf("[endif"))this.tag_type="END",this.unindent();else if(-1!=l.indexOf("[cdata[")){s=this.get_unformatted("]]>",a);r.push(s),this.tag_type="SINGLE"}else{s=this.get_unformatted("--\x3e",a);r.push(s),this.tag_type="SINGLE"}else"/"===l.charAt(0)?(this.retrieve_tag(l.substring(1)),this.tag_type="END"):(this.record_tag(l),this.tag_type="START"),this.Utils.in_array(l,this.Utils.extra_liners)&&this.print_newline(!0,this.output);return r.join("")},this.get_unformatted=function(e,t){if(t&&-1!=t.toLowerCase().indexOf(e))return"";var n="",r="",i=!0;do{if(this.pos>=this.input.length)return r;if(n=this.input.charAt(this.pos),this.pos++,this.Utils.in_array(n,this.Utils.whitespace)){if(!i){this.line_char_count--;continue}if("\n"===n||"\r"===n){r+="\n",this.line_char_count=0;continue}}r+=n,this.line_char_count++,i=!0}while(-1==r.toLowerCase().indexOf(e));return r},this.get_token=function(){var e;if("TK_TAG_SCRIPT"!==this.last_token&&"TK_TAG_STYLE"!==this.last_token)return"CONTENT"===this.current_mode?"string"!=typeof(e=this.get_content())?e:[e,"TK_CONTENT"]:"TAG"===this.current_mode?"string"!=typeof(e=this.get_tag())?e:[e,"TK_TAG_"+this.tag_type]:void 0;var t=this.last_token.substr(7);return"string"!=typeof(e=this.get_contents_to(t))?e:[e,"TK_"+t]},this.get_full_indent=function(e){return(e=this.indent_level+e||0)<1?"":Array(e+1).join(this.indent_string)},this.printer=function(e,t,n,r,i){this.input=e||"",this.output=[],this.indent_character=t,this.indent_string="",this.indent_size=n,this.brace_style=i,this.indent_level=0,this.max_char=r;for(var o=this.line_char_count=0;o<this.indent_size;o++)this.indent_string+=this.indent_character;this.print_newline=function(e,t){if(this.line_char_count=0,t&&t.length){if(!e)for(;this.Utils.in_array(t[t.length-1],this.Utils.whitespace);)t.pop();t.push("\n");for(var n=0;n<this.indent_level;n++)t.push(this.indent_string)}},this.print_token=function(e){this.output.push(e)},this.indent=function(){this.indent_level++},this.unindent=function(){0<this.indent_level&&this.indent_level--}},this}).printer(e,i,r,o,a);;){var l=n.get_token();if(n.token_text=l[0],n.token_type=l[1],"TK_EOF"===n.token_type)break;switch(n.token_type){case"TK_TAG_START":n.print_newline(!1,n.output),n.print_token(n.token_text),n.indent(),n.current_mode="CONTENT";break;case"TK_TAG_STYLE":case"TK_TAG_SCRIPT":n.print_newline(!1,n.output),n.print_token(n.token_text),n.current_mode="CONTENT";break;case"TK_TAG_END":if("TK_CONTENT"===n.last_token&&""===n.last_text){var s=n.token_text.match(/\w+/)[0],u=n.output[n.output.length-1].match(/<\s*(\w+)/);null!==u&&u[1]===s||n.print_newline(!0,n.output)}n.print_token(n.token_text),n.current_mode="CONTENT";break;case"TK_TAG_SINGLE":var d=n.token_text.match(/^\s*<([a-z]+)/i);d&&n.Utils.in_array(d[1],c)||n.print_newline(!1,n.output),n.print_token(n.token_text),n.current_mode="CONTENT";break;case"TK_CONTENT":""!==n.token_text&&n.print_token(n.token_text),n.current_mode="TAG";break;case"TK_STYLE":case"TK_SCRIPT":if(""!==n.token_text){n.output.push("\n");var f=n.token_text;if("TK_SCRIPT"==n.token_type)var h="function"==typeof js_beautify&&js_beautify;else if("TK_STYLE"==n.token_type)h="function"==typeof css_beautify&&css_beautify;if("keep"==t.indent_scripts)var p=0;else if("separate"==t.indent_scripts)p=-n.indent_level;else p=1;var m=n.get_full_indent(p);if(h)f=h(f.replace(/^\s*/,m),t);else{var g=f.match(/^\s*/)[0].match(/[^\n\r]*$/)[0].split(n.indent_string).length-1,v=n.get_full_indent(p-g);f=f.replace(/^\s*/,m).replace(/\r\n|\r|\n/g,"\n"+v).replace(/\s*$/,"")}f&&(n.print_token(f),n.print_newline(!0,n.output))}n.current_mode="TAG"}n.last_token=n.token_type,n.last_text=n.token_text}return n.output.join("")}}},{}],25:[function(e,t,n){"use strict";var s=e("../render/vnode");t.exports=function(r,e,t){var i=[],n=!1,o=!1;function a(){if(n)throw new Error("Nested m.redraw.sync() call");n=!0;for(var e=0;e<i.length;e+=2)try{r(i[e],s(i[e+1]),l)}catch(e){t.error(e)}n=!1}function l(){o||(o=!0,e(function(){o=!1,a()}))}return l.sync=a,{mount:function(e,t){if(null!=t&&null==t.view&&"function"!=typeof t)throw new TypeError("m.mount(element, component) expects a component, not a vnode");var n=i.indexOf(e);0<=n&&(i.splice(n,2),r(e,[],l)),null!=t&&(i.push(e,t),r(e,s(t),l))},redraw:l}}},{"../render/vnode":44}],26:[function(e,t,n){(function(k){"use strict";var C=e("../render/vnode"),a=e("../render/hyperscript"),T=e("../promise/promise"),o=e("../pathname/build"),S=e("../pathname/parse"),L=e("../pathname/compileTemplate"),M=e("../pathname/assign"),A={};t.exports=function(f,h){var s;function p(e,t,n){if(e=o(e,t),null!=s){s();var r=n?n.state:null,i=n?n.title:null;n&&n.replace?f.history.replaceState(r,i,x.prefix+e):f.history.pushState(r,i,x.prefix+e)}else f.location.href=x.prefix+e}var m,g,v,y,b=A,w=x.SKIP={};function x(e,t,n){if(null==e)throw new Error("Ensure the DOM element that was passed to `m.route` is not undefined");var r,c=0,u=Object.keys(n).map(function(e){if("/"!==e[0])throw new SyntaxError("Routes must start with a `/`");if(/:([^\/\.-]+)(\.{3})?:/.test(e))throw new SyntaxError("Route parameter names must be separated with either `/`, `.`, or `-`");return{route:e,component:n[e],check:L(e)}}),i="function"==typeof k?k:setTimeout,d=T.resolve(),o=!1;if((s=null)!=t){var a=S(t);if(!u.some(function(e){return e.check(a)}))throw new ReferenceError("Default route doesn't match any known routes")}function l(){o=!1;var e=f.location.hash;"#"!==x.prefix[0]&&(e=f.location.search+e,"?"!==x.prefix[0]&&"/"!==(e=f.location.pathname+e)[0]&&(e="/"+e));var a=e.concat().replace(/(?:%[a-f89][a-f0-9])+/gim,decodeURIComponent).slice(x.prefix.length),l=S(a);function s(){if(a===t)throw new Error("Could not resolve default route "+t);p(t,null,{replace:!0})}M(l.params,f.history.state),function t(n){for(;n<u.length;n++)if(u[n].check(l)){var r=u[n].component,e=u[n].route,i=r,o=y=function(e){if(o===y){if(e===w)return t(n+1);m=null==e||"function"!=typeof e.view&&"function"!=typeof e?"div":e,g=l.params,v=a,y=null,b=r.render?r:null,2===c?h.redraw():(c=2,h.redraw.sync())}};return void(r.view||"function"==typeof r?(r={},o(i)):r.onmatch?d.then(function(){return r.onmatch(l.params,a,e)}).then(o,s):o("div"))}s()}(0)}return s=function(){o||(o=!0,i(l))},"function"==typeof f.history.pushState?(r=function(){f.removeEventListener("popstate",s,!1)},f.addEventListener("popstate",s,!1)):"#"===x.prefix[0]&&(s=null,r=function(){f.removeEventListener("hashchange",l,!1)},f.addEventListener("hashchange",l,!1)),h.mount(e,{onbeforeupdate:function(){return!(!(c=c?2:1)||A===b)},oncreate:l,onremove:r,view:function(){if(c&&A!==b){var e=[C(m,g.key,g)];return b&&(e=b.render(e[0])),e}}})}return x.set=function(e,t,n){null!=y&&((n=n||{}).replace=!0),y=null,p(e,t,n)},x.get=function(){return v},x.prefix="#!",x.Link={view:function(e){var n,r,i=e.attrs.options,t={};M(t,e.attrs),t.selector=t.options=t.key=t.oninit=t.oncreate=t.onbeforeupdate=t.onupdate=t.onbeforeremove=t.onremove=null;var o=a(e.attrs.selector||"a",t,e.children);return(o.attrs.disabled=Boolean(o.attrs.disabled))?(o.attrs.href=null,o.attrs["aria-disabled"]="true",o.attrs.onclick=null):(n=o.attrs.onclick,r=o.attrs.href,o.attrs.href=x.prefix+r,o.attrs.onclick=function(e){var t;"function"==typeof n?t=n.call(e.currentTarget,e):null==n||"object"!=typeof n||"function"==typeof n.handleEvent&&n.handleEvent(e),!1===t||e.defaultPrevented||0!==e.button&&0!==e.which&&1!==e.which||e.currentTarget.target&&"_self"!==e.currentTarget.target||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey||(e.preventDefault(),e.redraw=!1,x.set(r,null,i))}),o}},x.param=function(e){return g&&null!=e?g[e]:g},x}}).call(this,e("timers").setImmediate)},{"../pathname/assign":30,"../pathname/build":31,"../pathname/compileTemplate":32,"../pathname/parse":33,"../promise/promise":35,"../render/hyperscript":40,"../render/vnode":44,timers:49}],27:[function(e,t,n){"use strict";var r=e("./render/hyperscript");r.trust=e("./render/trust"),r.fragment=e("./render/fragment"),t.exports=r},{"./render/fragment":39,"./render/hyperscript":40,"./render/trust":43}],28:[function(e,t,n){"use strict";function r(){return i.apply(this,arguments)}var i=e("./hyperscript"),o=e("./request"),a=e("./mount-redraw");r.m=i,r.trust=i.trust,r.fragment=i.fragment,r.mount=a.mount,r.route=e("./route"),r.render=e("./render"),r.redraw=a.redraw,r.request=o.request,r.jsonp=o.jsonp,r.parseQueryString=e("./querystring/parse"),r.buildQueryString=e("./querystring/build"),r.parsePathname=e("./pathname/parse"),r.buildPathname=e("./pathname/build"),r.vnode=e("./render/vnode"),r.PromisePolyfill=e("./promise/polyfill"),t.exports=r},{"./hyperscript":27,"./mount-redraw":29,"./pathname/build":31,"./pathname/parse":33,"./promise/polyfill":34,"./querystring/build":36,"./querystring/parse":37,"./render":38,"./render/vnode":44,"./request":45,"./route":47}],29:[function(e,t,n){"use strict";var r=e("./render");t.exports=e("./api/mount-redraw")(r,requestAnimationFrame,console)},{"./api/mount-redraw":25,"./render":38}],30:[function(e,t,n){"use strict";t.exports=Object.assign||function(t,n){n&&Object.keys(n).forEach(function(e){t[e]=n[e]})}},{}],31:[function(e,t,n){"use strict";var m=e("../querystring/build"),g=e("./assign");t.exports=function(e,r){if(/:([^\/\.-]+)(\.{3})?:/.test(e))throw new SyntaxError("Template parameter names *must* be separated");if(null==r)return e;var t=e.indexOf("?"),n=e.indexOf("#"),i=n<0?e.length:n,o=t<0?i:t,a=e.slice(0,o),l={};g(l,r);var s=a.replace(/:([^\/\.-]+)(\.{3})?/g,function(e,t,n){return delete l[t],null==r[t]?e:n?r[t]:encodeURIComponent(String(r[t]))}),c=s.indexOf("?"),u=s.indexOf("#"),d=u<0?s.length:u,f=c<0?d:c,h=s.slice(0,f);0<=t&&(h+=e.slice(t,i)),0<=c&&(h+=(t<0?"?":"&")+s.slice(c,d));var p=m(l);return p&&(h+=(t<0&&c<0?"?":"&")+p),0<=n&&(h+=e.slice(n)),0<=u&&(h+=(n<0?"":"&")+s.slice(u)),h}},{"../querystring/build":36,"./assign":30}],32:[function(e,t,n){"use strict";var l=e("./parse");t.exports=function(e){var r=l(e),i=Object.keys(r.params),o=[],a=new RegExp("^"+r.path.replace(/:([^\/.-]+)(\.{3}|\.(?!\.)|-)?|[\\^$*+.()|\[\]{}]/g,function(e,t,n){return null==t?"\\"+e:(o.push({k:t,r:"..."===n}),"..."===n?"(.*)":"."===n?"([^/]+)\\.":"([^/]+)"+(n||""))})+"$");return function(e){for(var t=0;t<i.length;t++)if(r.params[i[t]]!==e.params[i[t]])return!1;if(!o.length)return a.test(e.path);var n=a.exec(e.path);if(null==n)return!1;for(t=0;t<o.length;t++)e.params[o[t].k]=o[t].r?n[t+1]:decodeURIComponent(n[t+1]);return!0}}},{"./parse":33}],33:[function(e,t,n){"use strict";var a=e("../querystring/parse");t.exports=function(e){var t=e.indexOf("?"),n=e.indexOf("#"),r=n<0?e.length:n,i=t<0?r:t,o=e.slice(0,i).replace(/\/{2,}/g,"/");return o?("/"!==o[0]&&(o="/"+o),1<o.length&&"/"===o[o.length-1]&&(o=o.slice(0,-1))):o="/",{path:o,params:t<0?{}:a(e.slice(t+1,r))}}},{"../querystring/parse":37}],34:[function(e,t,n){(function(n){"use strict";var f=function(e){if(!(this instanceof f))throw new Error("Promise must be called with `new`");if("function"!=typeof e)throw new TypeError("executor must be a function");var o=this,a=[],l=[],i=t(a,!0),s=t(l,!1),c=o._instance={resolvers:a,rejectors:l},u="function"==typeof n?n:setTimeout;function t(r,i){return function t(n){var e;try{if(!i||null==n||"object"!=typeof n&&"function"!=typeof n||"function"!=typeof(e=n.then))u(function(){i||0!==r.length||console.error("Possible unhandled promise rejection:",n);for(var e=0;e<r.length;e++)r[e](n);a.length=0,l.length=0,c.state=i,c.retry=function(){t(n)}});else{if(n===o)throw new TypeError("Promise can't be resolved w/ itself");d(e.bind(n))}}catch(e){s(e)}}}function d(e){var n=0;function t(t){return function(e){0<n++||t(e)}}var r=t(s);try{e(t(i),r)}catch(e){r(e)}}d(e)};f.prototype.then=function(e,t){var i,o,a=this._instance;function n(t,e,n,r){e.push(function(e){if("function"!=typeof t)n(e);else try{i(t(e))}catch(e){o&&o(e)}}),"function"==typeof a.retry&&r===a.state&&a.retry()}var r=new f(function(e,t){i=e,o=t});return n(e,a.resolvers,i,!0),n(t,a.rejectors,o,!1),r},f.prototype.catch=function(e){return this.then(null,e)},f.prototype.finally=function(t){return this.then(function(e){return f.resolve(t()).then(function(){return e})},function(e){return f.resolve(t()).then(function(){return f.reject(e)})})},f.resolve=function(t){return t instanceof f?t:new f(function(e){e(t)})},f.reject=function(n){return new f(function(e,t){t(n)})},f.all=function(l){return new f(function(n,r){var i=l.length,o=0,a=[];if(0===l.length)n([]);else for(var e=0;e<l.length;e++)!function(t){function e(e){o++,a[t]=e,o===i&&n(a)}null==l[t]||"object"!=typeof l[t]&&"function"!=typeof l[t]||"function"!=typeof l[t].then?e(l[t]):l[t].then(e,r)}(e)})},f.race=function(r){return new f(function(e,t){for(var n=0;n<r.length;n++)r[n].then(e,t)})},t.exports=f}).call(this,e("timers").setImmediate)},{timers:49}],35:[function(n,r,e){(function(e){"use strict";var t=n("./polyfill");"undefined"!=typeof window?(void 0===window.Promise?window.Promise=t:window.Promise.prototype.finally||(window.Promise.prototype.finally=t.prototype.finally),r.exports=window.Promise):void 0!==e?(void 0===e.Promise?e.Promise=t:e.Promise.prototype.finally||(e.Promise.prototype.finally=t.prototype.finally),r.exports=e.Promise):r.exports=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./polyfill":34}],36:[function(e,t,n){"use strict";t.exports=function(e){if("[object Object]"!==Object.prototype.toString.call(e))return"";var r=[];for(var t in e)i(t,e[t]);return r.join("&");function i(e,t){if(Array.isArray(t))for(var n=0;n<t.length;n++)i(e+"["+n+"]",t[n]);else if("[object Object]"===Object.prototype.toString.call(t))for(var n in t)i(e+"["+n+"]",t[n]);else r.push(encodeURIComponent(e)+(null!=t&&""!==t?"="+encodeURIComponent(t):""))}}},{}],37:[function(e,t,n){"use strict";t.exports=function(e){if(""===e||null==e)return{};"?"===e.charAt(0)&&(e=e.slice(1));for(var t=e.split("&"),n={},r={},i=0;i<t.length;i++){var o=t[i].split("="),a=decodeURIComponent(o[0]),l=2===o.length?decodeURIComponent(o[1]):"";"true"===l?l=!0:"false"===l&&(l=!1);var s=a.split(/\]\[?|\[/),c=r;-1<a.indexOf("[")&&s.pop();for(var u=0;u<s.length;u++){var d=s[u],f=s[u+1],h=""==f||!isNaN(parseInt(f,10));if(""===d)null==n[a=s.slice(0,u).join()]&&(n[a]=Array.isArray(c)?c.length:0),d=n[a]++;else if("__proto__"===d)break;if(u===s.length-1)c[d]=l;else{var p=Object.getOwnPropertyDescriptor(c,d);null!=p&&(p=p.value),null==p&&(c[d]=p=h?[]:{}),c=p}}}return r}},{}],38:[function(e,t,n){"use strict";t.exports=e("./render/render")(window)},{"./render/render":42}],39:[function(e,t,n){"use strict";var r=e("../render/vnode"),i=e("./hyperscriptVnode");t.exports=function(){var e=i.apply(0,arguments);return e.tag="[",e.children=r.normalizeChildren(e.children),e}},{"../render/vnode":44,"./hyperscriptVnode":41}],40:[function(e,t,n){"use strict";var s=e("../render/vnode"),r=e("./hyperscriptVnode"),c=/(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g,u={},d={}.hasOwnProperty;function f(e){for(var t in e)if(d.call(e,t))return!1;return!0}t.exports=function(e){if(null==e||"string"!=typeof e&&"function"!=typeof e&&"function"!=typeof e.view)throw Error("The selector must be either a string or a component.");var t=r.apply(1,arguments);return"string"==typeof e&&(t.children=s.normalizeChildren(t.children),"["!==e)?function(e,t){var n=t.attrs,r=s.normalizeChildren(t.children),i=d.call(n,"class"),o=i?n.class:n.className;if(t.tag=e.tag,t.attrs=null,t.children=void 0,!f(e.attrs)&&!f(n)){var a={};for(var l in n)d.call(n,l)&&(a[l]=n[l]);n=a}for(var l in e.attrs)d.call(e.attrs,l)&&"className"!==l&&!d.call(n,l)&&(n[l]=e.attrs[l]);for(var l in null==o&&null==e.attrs.className||(n.className=null!=o?null!=e.attrs.className?String(e.attrs.className)+" "+String(o):o:null!=e.attrs.className?e.attrs.className:null),i&&(n.class=null),n)if(d.call(n,l)&&"key"!==l){t.attrs=n;break}return Array.isArray(r)&&1===r.length&&null!=r[0]&&"#"===r[0].tag?t.text=r[0].children:t.children=r,t}(u[e]||function(e){for(var t,n="div",r=[],i={};t=c.exec(e);){var o=t[1],a=t[2];if(""===o&&""!==a)n=a;else if("#"===o)i.id=a;else if("."===o)r.push(a);else if("["===t[3][0]){var l=t[6];l=l&&l.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\"),"class"===t[4]?r.push(l):i[t[4]]=""===l?l:l||!0}}return 0<r.length&&(i.className=r.join(" ")),u[e]={tag:n,attrs:i}}(e),t):(t.tag=e,t)}},{"../render/vnode":44,"./hyperscriptVnode":41}],41:[function(e,t,n){"use strict";var r=e("../render/vnode");t.exports=function(){var e,t=arguments[this],n=this+1;if(null==t?t={}:"object"==typeof t&&null==t.tag&&!Array.isArray(t)||(t={},n=this),arguments.length===n+1)e=arguments[n],Array.isArray(e)||(e=[e]);else for(e=[];n<arguments.length;)e.push(arguments[n++]);return r("",t.key,t,e)}},{"../render/vnode":44}],42:[function(e,t,n){"use strict";var I=e("../render/vnode");t.exports=function(e){var s,u=e&&e.document,t={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"};function d(e){return e.attrs&&e.attrs.xmlns||t[e.tag]}function c(e,t){if(e.state!==t)throw new Error("`vnode.state` must not be modified")}function f(e){var t=e.state;try{return this.apply(t,arguments)}finally{c(e,t)}}function h(){try{return u.activeElement}catch(e){return null}}function A(e,t,n,r,i,o,a){for(var l=n;l<r;l++){var s=t[l];null!=s&&O(e,s,i,a,o)}}function O(e,t,n,r,i){var o=t.tag;if("string"==typeof o)switch(t.state={},null!=t.attrs&&L(t.attrs,t,n),o){case"#":!function(e,t,n){t.dom=u.createTextNode(t.children),g(e,t.dom,n)}(e,t,i);break;case"<":l(e,t,r,i);break;case"[":!function(e,t,n,r,i){var o=u.createDocumentFragment();if(null!=t.children){var a=t.children;A(o,a,0,a.length,n,null,r)}t.dom=o.firstChild,t.domSize=o.childNodes.length,g(e,o,i)}(e,t,n,r,i);break;default:!function(e,t,n,r,i){var o=t.tag,a=t.attrs,l=a&&a.is,s=(r=d(t)||r)?l?u.createElementNS(r,o,{is:l}):u.createElementNS(r,o):l?u.createElement(o,{is:l}):u.createElement(o);t.dom=s,null!=a&&function(e,t,n){for(var r in t)x(e,r,null,t[r],n)}(t,a,r);if(g(e,s,i),!v(t)&&(null!=t.text&&(""!==t.text?s.textContent=t.text:t.children=[I("#",void 0,void 0,t.text,void 0,void 0)]),null!=t.children)){var c=t.children;A(s,c,0,c.length,n,null,r),"select"===t.tag&&null!=a&&function(e,t){if("value"in t)if(null===t.value)-1!==e.dom.selectedIndex&&(e.dom.value=null);else{var n=""+t.value;e.dom.value===n&&-1!==e.dom.selectedIndex||(e.dom.value=n)}"selectedIndex"in t&&x(e,"selectedIndex",null,t.selectedIndex,void 0)}(t,a)}}(e,t,n,r,i)}else!function(e,t,n,r,i){(function(e,t){var n;if("function"==typeof e.tag.view){if(e.state=Object.create(e.tag),null!=(n=e.state.view).$$reentrantLock$$)return;n.$$reentrantLock$$=!0}else{if(e.state=void 0,null!=(n=e.tag).$$reentrantLock$$)return;n.$$reentrantLock$$=!0,e.state=null!=e.tag.prototype&&"function"==typeof e.tag.prototype.view?new e.tag(e):e.tag(e)}L(e.state,e,t),null!=e.attrs&&L(e.attrs,e,t);if(e.instance=I.normalize(f.call(e.state.view,e)),e.instance===e)throw Error("A view cannot return the vnode it received as argument");n.$$reentrantLock$$=null})(t,n),null!=t.instance?(O(e,t.instance,n,r,i),t.dom=t.instance.dom,t.domSize=null!=t.dom?t.instance.domSize:0):t.domSize=0}(e,t,n,r,i)}var p={caption:"table",thead:"table",tbody:"table",tfoot:"table",tr:"tbody",th:"tr",td:"tr",colgroup:"table",col:"colgroup"};function l(e,t,n,r){var i=t.children.match(/^\s*?<(\w+)/im)||[],o=u.createElement(p[i[1]]||"div");"http://www.w3.org/2000/svg"===n?(o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg">'+t.children+"</svg>",o=o.firstChild):o.innerHTML=t.children,t.dom=o.firstChild,t.domSize=o.childNodes.length,t.instance=[];for(var a,l=u.createDocumentFragment();a=o.firstChild;)t.instance.push(a),l.appendChild(a);g(e,l,r)}function m(e,t,n,r,i,o){if(t!==n&&(null!=t||null!=n))if(null==t||0===t.length)A(e,n,0,n.length,r,i,o);else if(null==n||0===n.length)P(e,t,0,t.length);else{var a=null!=t[0]&&null!=t[0].key,l=null!=n[0]&&null!=n[0].key,s=0,c=0;if(!a)for(;c<t.length&&null==t[c];)c++;if(!l)for(;s<n.length&&null==n[s];)s++;if(null===l&&null==a)return;if(a!=l)P(e,t,c,t.length),A(e,n,s,n.length,r,i,o);else if(l){for(var u,d,f,h,p,m=t.length-1,g=n.length-1;c<=m&&s<=g&&(f=t[m],h=n[g],f.key===h.key);)f!==h&&N(e,f,h,r,i,o),null!=h.dom&&(i=h.dom),m--,g--;for(;c<=m&&s<=g&&(u=t[c],d=n[s],u.key===d.key);)c++,s++,u!==d&&N(e,u,d,r,z(t,c,i),o);for(;c<=m&&s<=g&&s!==g&&u.key===h.key&&f.key===d.key;)D(e,f,p=z(t,c,i)),f!==d&&N(e,f,d,r,p,o),++s<=--g&&D(e,u,i),u!==h&&N(e,u,h,r,i,o),null!=h.dom&&(i=h.dom),c++,f=t[--m],h=n[g],u=t[c],d=n[s];for(;c<=m&&s<=g&&f.key===h.key;)f!==h&&N(e,f,h,r,i,o),null!=h.dom&&(i=h.dom),g--,f=t[--m],h=n[g];if(g<s)P(e,t,c,m+1);else if(m<c)A(e,n,s,g+1,r,i,o);else{var v,y,b=i,w=g-s+1,x=new Array(w),k=0,C=0,T=2147483647,S=0;for(C=0;C<w;C++)x[C]=-1;for(C=g;s<=C;C--){null==v&&(v=_(t,c,m+1));var L=v[(h=n[C]).key];null!=L&&(T=L<T?L:-1,f=t[x[C-s]=L],t[L]=null,f!==h&&N(e,f,h,r,i,o),null!=h.dom&&(i=h.dom),S++)}if(i=b,S!==m-c+1&&P(e,t,c,m+1),0===S)A(e,n,s,g+1,r,i,o);else if(-1===T)for(k=(y=function(e){var t=[0],n=0,r=0,i=0,o=E.length=e.length;for(i=0;i<o;i++)E[i]=e[i];for(i=0;i<o;++i)if(-1!==e[i]){var a=t[t.length-1];if(e[a]<e[i])E[i]=a,t.push(i);else{for(n=0,r=t.length-1;n<r;){var l=(n>>>1)+(r>>>1)+(n&r&1);e[t[l]]<e[i]?n=1+l:r=l}e[i]<e[t[n]]&&(0<n&&(E[i]=t[n-1]),t[n]=i)}}n=t.length,r=t[n-1];for(;0<n--;)t[n]=r,r=E[r];return E.length=0,t}(x)).length-1,C=g;s<=C;C--)d=n[C],-1===x[C-s]?O(e,d,r,o,i):y[k]===C-s?k--:D(e,d,i),null!=d.dom&&(i=n[C].dom);else for(C=g;s<=C;C--)d=n[C],-1===x[C-s]&&O(e,d,r,o,i),null!=d.dom&&(i=n[C].dom)}}else{var M=t.length<n.length?t.length:n.length;for(s=s<c?s:c;s<M;s++)(u=t[s])===(d=n[s])||null==u&&null==d||(null==u?O(e,d,r,o,z(t,s+1,i)):null==d?F(e,u):N(e,u,d,r,z(t,s+1,i),o));t.length>M&&P(e,t,s,t.length),n.length>M&&A(e,n,s,n.length,r,i,o)}}}function N(e,t,n,r,i,o){var a=t.tag;if(a===n.tag){if(n.state=t.state,n.events=t.events,function(e,t){do{var n;if(null!=e.attrs&&"function"==typeof e.attrs.onbeforeupdate)if(void 0!==(n=f.call(e.attrs.onbeforeupdate,e,t))&&!n)break;if("string"!=typeof e.tag&&"function"==typeof e.state.onbeforeupdate)if(void 0!==(n=f.call(e.state.onbeforeupdate,e,t))&&!n)break;return!1}while(0);return e.dom=t.dom,e.domSize=t.domSize,e.instance=t.instance,e.attrs=t.attrs,e.children=t.children,e.text=t.text,!0}(n,t))return;if("string"==typeof a)switch(null!=n.attrs&&M(n.attrs,n,r),a){case"#":!function(e,t){e.children.toString()!==t.children.toString()&&(e.dom.nodeValue=t.children);t.dom=e.dom}(t,n);break;case"<":!function(e,t,n,r,i){t.children!==n.children?(y(e,t),l(e,n,r,i)):(n.dom=t.dom,n.domSize=t.domSize,n.instance=t.instance)}(e,t,n,o,i);break;case"[":!function(e,t,n,r,i,o){m(e,t.children,n.children,r,i,o);var a=0,l=n.children;if((n.dom=null)!=l){for(var s=0;s<l.length;s++){var c=l[s];null!=c&&null!=c.dom&&(null==n.dom&&(n.dom=c.dom),a+=c.domSize||1)}1!==a&&(n.domSize=a)}}(e,t,n,r,i,o);break;default:!function(e,t,n,r){var i=t.dom=e.dom;r=d(t)||r,"textarea"===t.tag&&(null==t.attrs&&(t.attrs={}),null!=t.text&&(t.attrs.value=t.text,t.text=void 0));(function(e,t,n,r){if(null!=n)for(var i in n)x(e,i,t&&t[i],n[i],r);var o;if(null!=t)for(var i in t)null==(o=t[i])||null!=n&&null!=n[i]||k(e,i,o,r)})(t,e.attrs,t.attrs,r),v(t)||(null!=e.text&&null!=t.text&&""!==t.text?e.text.toString()!==t.text.toString()&&(e.dom.firstChild.nodeValue=t.text):(null!=e.text&&(e.children=[I("#",void 0,void 0,e.text,void 0,e.dom.firstChild)]),null!=t.text&&(t.children=[I("#",void 0,void 0,t.text,void 0,void 0)]),m(i,e.children,t.children,n,null,r)))}(t,n,r,o)}else!function(e,t,n,r,i,o){if(n.instance=I.normalize(f.call(n.state.view,n)),n.instance===n)throw Error("A view cannot return the vnode it received as argument");M(n.state,n,r),null!=n.attrs&&M(n.attrs,n,r);null!=n.instance?(null==t.instance?O(e,n.instance,r,o,i):N(e,t.instance,n.instance,r,i,o),n.dom=n.instance.dom,n.domSize=n.instance.domSize):null!=t.instance?(F(e,t.instance),n.dom=void 0,n.domSize=0):(n.dom=t.dom,n.domSize=t.domSize)}(e,t,n,r,i,o)}else F(e,t),O(e,n,r,o,i)}function _(e,t,n){for(var r=Object.create(null);t<n;t++){var i=e[t];if(null!=i){var o=i.key;null!=o&&(r[o]=t)}}return r}var E=[];function z(e,t,n){for(;t<e.length;t++)if(null!=e[t]&&null!=e[t].dom)return e[t].dom;return n}function D(e,t,n){var r=u.createDocumentFragment();!function e(t,n,r){for(;null!=r.dom&&r.dom.parentNode===t;){if("string"!=typeof r.tag){if(null!=(r=r.instance))continue}else if("<"===r.tag)for(var i=0;i<r.instance.length;i++)n.appendChild(r.instance[i]);else if("["!==r.tag)n.appendChild(r.dom);else if(1===r.children.length){if(null!=(r=r.children[0]))continue}else for(var i=0;i<r.children.length;i++){var o=r.children[i];null!=o&&e(t,n,o)}break}}(e,r,t),g(e,r,n)}function g(e,t,n){null!=n?e.insertBefore(t,n):e.appendChild(t)}function v(e){if(null==e.attrs||null==e.attrs.contenteditable&&null==e.attrs.contentEditable)return!1;var t=e.children;if(null!=t&&1===t.length&&"<"===t[0].tag){var n=t[0].children;e.dom.innerHTML!==n&&(e.dom.innerHTML=n)}else if(null!=e.text||null!=t&&0!==t.length)throw new Error("Child node of a contenteditable must be trusted");return!0}function P(e,t,n,r){for(var i=n;i<r;i++){var o=t[i];null!=o&&F(e,o)}}function F(e,t){var n,r,i,o=0,a=t.state;"string"!=typeof t.tag&&"function"==typeof t.state.onbeforeremove&&null!=(i=f.call(t.state.onbeforeremove,t))&&"function"==typeof i.then&&(o=1,n=i);t.attrs&&"function"==typeof t.attrs.onbeforeremove&&null!=(i=f.call(t.attrs.onbeforeremove,t))&&"function"==typeof i.then&&(o|=2,r=i);if(c(t,a),o){if(null!=n){var l=function(){1&o&&((o&=2)||s())};n.then(l,l)}if(null!=r){l=function(){2&o&&((o&=1)||s())};r.then(l,l)}}else w(t),b(e,t);function s(){c(t,a),w(t),b(e,t)}}function y(e,t){for(var n=0;n<t.instance.length;n++)e.removeChild(t.instance[n])}function b(e,t){for(;null!=t.dom&&t.dom.parentNode===e;){if("string"!=typeof t.tag){if(null!=(t=t.instance))continue}else if("<"===t.tag)y(e,t);else{if("["!==t.tag&&(e.removeChild(t.dom),!Array.isArray(t.children)))break;if(1===t.children.length){if(null!=(t=t.children[0]))continue}else for(var n=0;n<t.children.length;n++){var r=t.children[n];null!=r&&b(e,r)}}break}}function w(e){if("string"!=typeof e.tag&&"function"==typeof e.state.onremove&&f.call(e.state.onremove,e),e.attrs&&"function"==typeof e.attrs.onremove&&f.call(e.attrs.onremove,e),"string"!=typeof e.tag)null!=e.instance&&w(e.instance);else{var t=e.children;if(Array.isArray(t))for(var n=0;n<t.length;n++){var r=t[n];null!=r&&w(r)}}}function x(e,t,n,r,i){if("key"!==t&&"is"!==t&&null!=r&&!o(t)&&(n!==r||function(e,t){return"value"===t||"checked"===t||"selectedIndex"===t||"selected"===t&&e.dom===h()||"option"===e.tag&&e.dom.parentNode===u.activeElement}(e,t)||"object"==typeof r)){if("o"===t[0]&&"n"===t[1])return S(e,t,r);if("xlink:"===t.slice(0,6))e.dom.setAttributeNS("http://www.w3.org/1999/xlink",t.slice(6),r);else if("style"===t)T(e.dom,n,r);else if(a(e,t,i)){if("value"===t){if(("input"===e.tag||"textarea"===e.tag)&&e.dom.value===""+r&&e.dom===h())return;if("select"===e.tag&&null!==n&&e.dom.value===""+r)return;if("option"===e.tag&&null!==n&&e.dom.value===""+r)return}"input"===e.tag&&"type"===t?e.dom.setAttribute(t,r):e.dom[t]=r}else"boolean"==typeof r?r?e.dom.setAttribute(t,""):e.dom.removeAttribute(t):e.dom.setAttribute("className"===t?"class":t,r)}}function k(e,t,n,r){if("key"!==t&&"is"!==t&&null!=n&&!o(t))if("o"!==t[0]||"n"!==t[1]||o(t))if("style"===t)T(e.dom,n,null);else if(!a(e,t,r)||"className"===t||"value"===t&&("option"===e.tag||"select"===e.tag&&-1===e.dom.selectedIndex&&e.dom===h())||"input"===e.tag&&"type"===t){var i=t.indexOf(":");-1!==i&&(t=t.slice(i+1)),!1!==n&&e.dom.removeAttribute("className"===t?"class":t)}else e.dom[t]=null;else S(e,t,void 0)}function o(e){return"oninit"===e||"oncreate"===e||"onupdate"===e||"onremove"===e||"onbeforeremove"===e||"onbeforeupdate"===e}function a(e,t,n){return void 0===n&&(-1<e.tag.indexOf("-")||null!=e.attrs&&e.attrs.is||"href"!==t&&"list"!==t&&"form"!==t&&"width"!==t&&"height"!==t)&&t in e.dom}var n=/[A-Z]/g;function r(e){return"-"+e.toLowerCase()}function C(e){return"-"===e[0]&&"-"===e[1]?e:"cssFloat"===e?"float":e.replace(n,r)}function T(e,t,n){if(t===n);else if(null==n)e.style.cssText="";else if("object"!=typeof n)e.style.cssText=n;else if(null==t||"object"!=typeof t)for(var r in e.style.cssText="",n){null!=(i=n[r])&&e.style.setProperty(C(r),String(i))}else{for(var r in n){var i;null!=(i=n[r])&&(i=String(i))!==String(t[r])&&e.style.setProperty(C(r),i)}for(var r in t)null!=t[r]&&null==n[r]&&e.style.removeProperty(C(r))}}function i(){this._=s}function S(e,t,n){if(null!=e.events){if(e.events[t]===n)return;null==n||"function"!=typeof n&&"object"!=typeof n?(null!=e.events[t]&&e.dom.removeEventListener(t.slice(2),e.events,!1),e.events[t]=void 0):(null==e.events[t]&&e.dom.addEventListener(t.slice(2),e.events,!1),e.events[t]=n)}else null==n||"function"!=typeof n&&"object"!=typeof n||(e.events=new i,e.dom.addEventListener(t.slice(2),e.events,!1),e.events[t]=n)}function L(e,t,n){"function"==typeof e.oninit&&f.call(e.oninit,t),"function"==typeof e.oncreate&&n.push(f.bind(e.oncreate,t))}function M(e,t,n){"function"==typeof e.onupdate&&n.push(f.bind(e.onupdate,t))}return(i.prototype=Object.create(null)).handleEvent=function(e){var t,n=this["on"+e.type];"function"==typeof n?t=n.call(e.currentTarget,e):"function"==typeof n.handleEvent&&n.handleEvent(e),this._&&!1!==e.redraw&&(0,this._)(),!1===t&&(e.preventDefault(),e.stopPropagation())},function(e,t,n){if(!e)throw new TypeError("Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.");var r=[],i=h(),o=e.namespaceURI;null==e.vnodes&&(e.textContent=""),t=I.normalizeChildren(Array.isArray(t)?t:[t]);var a=s;try{s="function"==typeof n?n:void 0,m(e,e.vnodes,t,r,null,"http://www.w3.org/1999/xhtml"===o?void 0:o)}finally{s=a}e.vnodes=t,null!=i&&h()!==i&&"function"==typeof i.focus&&i.focus();for(var l=0;l<r.length;l++)r[l]()}}},{"../render/vnode":44}],43:[function(e,t,n){"use strict";var r=e("../render/vnode");t.exports=function(e){return null==e&&(e=""),r("<",void 0,void 0,e,void 0,void 0)}},{"../render/vnode":44}],44:[function(e,t,n){"use strict";function i(e,t,n,r,i,o){return{tag:e,key:t,attrs:n,children:r,text:i,dom:o,domSize:void 0,state:void 0,events:void 0,instance:void 0}}i.normalize=function(e){return Array.isArray(e)?i("[",void 0,void 0,i.normalizeChildren(e),void 0,void 0):null==e||"boolean"==typeof e?null:"object"==typeof e?e:i("#",void 0,void 0,String(e),void 0,void 0)},i.normalizeChildren=function(e){var t=[];if(e.length){for(var n=null!=e[0]&&null!=e[0].key,r=1;r<e.length;r++)if((null!=e[r]&&null!=e[r].key)!=n)throw new TypeError("Vnodes must either always have keys or never have keys!");for(r=0;r<e.length;r++)t[r]=i.normalize(e[r])}return t},t.exports=i},{}],45:[function(e,t,n){"use strict";var r=e("./promise/promise"),i=e("./mount-redraw");t.exports=e("./request/request")(window,r,i.redraw)},{"./mount-redraw":29,"./promise/promise":35,"./request/request":46}],46:[function(e,t,n){"use strict";var c=e("../pathname/build");t.exports=function(p,n,l){var a=0;function s(e){return new n(e)}function e(a){return function(t,r){"string"!=typeof t?t=(r=t).url:null==r&&(r={});var e=new n(function(n,e){a(c(t,r.params),r,function(e){if("function"==typeof r.type)if(Array.isArray(e))for(var t=0;t<e.length;t++)e[t]=new r.type(e[t]);else e=new r.type(e);n(e)},e)});if(!0===r.background)return e;var i=0;function o(){0==--i&&"function"==typeof l&&l()}return function t(n){var r=n.then;n.constructor=s;n.then=function(){i++;var e=r.apply(n,arguments);return e.then(o,function(e){if(o(),0===i)throw e}),t(e)};return n}(e)}}function m(e,t){for(var n in e.headers)if({}.hasOwnProperty.call(e.headers,n)&&t.test(n))return!0;return!1}return s.prototype=n.prototype,s.__proto__=n,{request:e(function(o,a,l,s){var e,t=null!=a.method?a.method.toUpperCase():"GET",n=a.body,r=!(null!=a.serialize&&a.serialize!==JSON.serialize||n instanceof p.FormData),c=a.responseType||("function"==typeof a.extract?"":"json"),i=new p.XMLHttpRequest,u=!1,d=i,f=i.abort;for(var h in i.abort=function(){u=!0,f.call(this)},i.open(t,o,!1!==a.async,"string"==typeof a.user?a.user:void 0,"string"==typeof a.password?a.password:void 0),r&&null!=n&&!m(a,/^content-type$/i)&&i.setRequestHeader("Content-Type","application/json; charset=utf-8"),"function"==typeof a.deserialize||m(a,/^accept$/i)||i.setRequestHeader("Accept","application/json, text/*"),a.withCredentials&&(i.withCredentials=a.withCredentials),a.timeout&&(i.timeout=a.timeout),i.responseType=c,a.headers)!{}.hasOwnProperty.call(a.headers,h)||i.setRequestHeader(h,a.headers[h]);i.onreadystatechange=function(e){if(!u&&4===e.target.readyState)try{var t,n=200<=e.target.status&&e.target.status<300||304===e.target.status||/^file:\/\//i.test(o),r=e.target.response;if("json"===c?e.target.responseType||"function"==typeof a.extract||(r=JSON.parse(e.target.responseText)):c&&"text"!==c||null==r&&(r=e.target.responseText),"function"==typeof a.extract?(r=a.extract(e.target,a),n=!0):"function"==typeof a.deserialize&&(r=a.deserialize(r)),n)l(r);else{try{t=e.target.responseText}catch(e){t=r}var i=new Error(t);i.code=e.target.status,i.response=r,s(i)}}catch(e){s(e)}},"function"==typeof a.config&&(i=a.config(i,a,o)||i)!==d&&(e=i.abort,i.abort=function(){u=!0,e.call(this)}),null==n?i.send():"function"==typeof a.serialize?i.send(a.serialize(n)):n instanceof p.FormData?i.send(n):i.send(JSON.stringify(n))}),jsonp:e(function(e,t,n,r){var i=t.callbackName||"_mithril_"+Math.round(1e16*Math.random())+"_"+a++,o=p.document.createElement("script");p[i]=function(e){delete p[i],o.parentNode.removeChild(o),n(e)},o.onerror=function(){delete p[i],o.parentNode.removeChild(o),r(new Error("JSONP request failed"))},o.src=e+(e.indexOf("?")<0?"?":"&")+encodeURIComponent(t.callbackKey||"callback")+"="+encodeURIComponent(i),p.document.documentElement.appendChild(o)})}}},{"../pathname/build":31}],47:[function(e,t,n){"use strict";var r=e("./mount-redraw");t.exports=e("./api/router")(window,r)},{"./api/router":26,"./mount-redraw":29}],48:[function(e,t,n){var r,i,o=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function l(){throw new Error("clearTimeout has not been defined")}function s(t){if(r===setTimeout)return setTimeout(t,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:a}catch(e){r=a}try{i="function"==typeof clearTimeout?clearTimeout:l}catch(e){i=l}}();var c,u=[],d=!1,f=-1;function h(){d&&c&&(d=!1,c.length?u=c.concat(u):f=-1,u.length&&p())}function p(){if(!d){var e=s(h);d=!0;for(var t=u.length;t;){for(c=u,u=[];++f<t;)c&&c[f].run();f=-1,t=u.length}c=null,d=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===l||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function g(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new m(e,t)),1!==u.length||d||s(p)},m.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=g,o.addListener=g,o.once=g,o.off=g,o.removeListener=g,o.removeAllListeners=g,o.emit=g,o.prependListener=g,o.prependOnceListener=g,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},{}],49:[function(s,e,c){(function(e,t){var r=s("process/browser.js").nextTick,n=Function.prototype.apply,i=Array.prototype.slice,o={},a=0;function l(e,t){this._id=e,this._clearFn=t}c.setTimeout=function(){return new l(n.call(setTimeout,window,arguments),clearTimeout)},c.setInterval=function(){return new l(n.call(setInterval,window,arguments),clearInterval)},c.clearTimeout=c.clearInterval=function(e){e.close()},l.prototype.unref=l.prototype.ref=function(){},l.prototype.close=function(){this._clearFn.call(window,this._id)},c.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},c.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},c._unrefActive=c.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;0<=t&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},c.setImmediate="function"==typeof e?e:function(e){var t=a++,n=!(arguments.length<2)&&i.call(arguments,1);return o[t]=!0,r(function(){o[t]&&(n?e.apply(null,n):e.call(null),c.clearImmediate(t))}),t},c.clearImmediate="function"==typeof t?t:function(e){delete o[e]}}).call(this,s("timers").setImmediate,s("timers").clearImmediate)},{"process/browser.js":48,timers:49}]},{},[13])}();
1
+ !function o(a,l,s){function c(t,e){if(!l[t]){if(!a[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(u)return u(t,!0);var r=new Error("Cannot find module '"+t+"'");throw r.code="MODULE_NOT_FOUND",r}var i=l[t]={exports:{}};a[t][0].call(i.exports,function(e){return c(a[t][1][e]||e)},i,i.exports,o,a,l,s)}return l[t].exports}for(var u="function"==typeof require&&require,e=0;e<s.length;e++)c(s[e]);return c}({1:[function(e,t,n){"use strict";var r=window.mc4wp_forms_i18n,i=e("mithril"),o={showType:function(e){var t=e.type;return t=t.charAt(0).toUpperCase()+t.slice(1),i("div",[i("label",r.fieldType),i("span",t)])},label:function(t){return i("div",[i("label",r.fieldLabel),i("input.widefat",{type:"text",value:t.label,onchange:function(e){t.label=e.target.value},placeholder:t.title})])},value:function(t){var e="hidden"===t.type;return i("div",[i("label",[e?r.value:r.initialValue," ",e?"":i("small",{style:"float: right; font-weight: normal;"},r.optional)]),i("input.widefat",{type:"text",value:t.value,onchange:function(e){t.value=e.target.value}}),e?"":i("p.help",r.valueHelp)])},numberMinMax:function(t){return i("div",[i("div.row",[i("div.col.col-3",[i("label",r.min),i("input",{type:"number",onchange:function(e){t.min=e.target.value}})]),i("div.col.col-3",[i("label",r.max),i("input",{type:"number",onchange:function(e){t.max=e.target.value}})])])])},isRequired:function(t){var e,n={type:"checkbox",checked:t.required,onchange:function(e){t.required=e.target.checked}};return t.forceRequired&&(n.required=!0,n.disabled=!0,e=i("p.help",r.forceRequired)),i("div",[i("label.cb-wrap",[i("input",n),r.isFieldRequired]),e])},placeholder:function(t){return i("div",[i("label",[r.placeholder," ",i("small",{style:"float: right; font-weight: normal;"},r.optional)]),i("input.widefat",{type:"text",value:t.placeholder,onchange:function(e){t.placeholder=e.target.value},placeholder:""}),i("p.help",r.placeholderHelp)])},useParagraphs:function(t){return i("div",[i("label.cb-wrap",[i("input",{type:"checkbox",checked:t.wrap,onchange:function(e){t.wrap=e.target.checked}}),r.wrapInParagraphTags])])},choiceType:function(t){var e=[i("option",{value:"select",selected:"select"===t.type&&"selected"},r.dropdown),i("option",{value:"radio",selected:"radio"===t.type&&"selected"},r.radioButtons)];return t.acceptsMultipleValues&&e.push(i("option",{value:"checkbox",selected:"checkbox"===t.type&&"selected"},r.checkboxes)),i("div",[i("label",r.choiceType),i("select",{value:t.type,onchange:function(e){t.type=e.target.value}},e)])},choices:function(n){var e=[];return e.push(i("div",[i("label",r.choices),i("div.limit-height",[i("table",n.choices.map(function(t,e){return i("tr",{"data-id":e},[i("td.cb",i("input",{name:"selected",type:"checkbox"===n.type?"checkbox":"radio",onchange:function(t){n.choices=n.choices.map(function(e){return e.value===t.target.value?e.selected=!e.selected:"checkbox"!==n.type&&(e.selected=!1),e})},checked:t.selected,value:t.value,title:r.preselect})),i("td.stretch",i("input.widefat",{type:"text",value:t.label,placeholder:t.title,onchange:function(e){t.label=e.target.value}})),i("td",i("span",{title:r.remove,class:"dashicons dashicons-no-alt hover-activated",onclick:function(e){this.choices().splice(e,1)}.bind(n,e)},""))])}))])])),e},linkToTerms:function(t){return i("div",[i("label",r.agreeToTermsLink),i("input.widefat",{type:"text",value:t.link,onchange:function(e){t.link=e.target.value},placeholder:"https://..."})])}};t.exports=o},{mithril:28}],2:[function(e,t,n){"use strict";var r={},i=e("./field-forms-rows.js");r.render=function(e){var t=e.type;if("function"==typeof r[t])return r[t](e);switch(t){case"select":case"radio":case"checkbox":return r.choice(e)}return r.text(e)},r.text=function(e){return[i.label(e),i.placeholder(e),i.value(e),i.isRequired(e),i.useParagraphs(e)]},r.choice=function(e){var t=[i.label(e),i.choiceType(e),i.choices(e)];return"select"===e.type&&t.push(i.placeholder(e)),t.push(i.useParagraphs(e)),"select"!==e.type&&"radio"!==e.type||t.push(i.isRequired(e)),t},r.hidden=function(e){return e.placeholder="",e.label="",e.wrap=!1,[i.showType(e),i.value(e)]},r.submit=function(e){return e.label="",e.placeholder="",[i.value(e),i.useParagraphs(e)]},r["terms-checkbox"]=function(e){return[i.label(e),i.linkToTerms(e),i.isRequired(e),i.useParagraphs(e)]},r.number=function(e){return[r.text(e),i.numberMinMax(e)]},t.exports=r},{"./field-forms-rows.js":1}],3:[function(e,t,n){"use strict";function o(e){e.dom.checked&&e.dom.setAttribute("checked","true"),e.dom.value&&e.dom.setAttribute("value",e.dom.value),e.dom.selected&&e.dom.setAttribute("selected","true")}var a=e("html"),l=e("mithril"),s={};s.select=function(e){var t={name:e.name,required:e.required},n=!1,r=e.choices.map(function(e){return e.selected&&(n=!0),l("option",{value:e.value!==e.label?e.value:void 0,selected:e.selected,oncreate:o},e.label)}),i=e.placeholder;return 0<i.length&&r.unshift(l("option",{disabled:!0,value:"",selected:!n,oncreate:o},i)),l("select",t,r)},s["terms-checkbox"]=function(e){var t;return t=0<e.link.length?l("a",{href:e.link,target:"_blank"},e.label):e.label,l("label",[l("input",{name:e.name,type:"checkbox",value:e.value,required:e.required})," ",t])},s.checkbox=function(r){return r.choices.map(function(e){var t=r.name+("checkbox"===r.type?"[]":""),n=r.required&&"radio"===r.type;return l("label",[l("input",{name:t,type:r.type,value:e.value,checked:e.selected,required:n,oncreate:o})," ",l("span",e.label)])})},s.radio=s.checkbox,s.default=function(e){var t={type:e.type};return e.name&&(t.name=e.name),e.min&&(t.min=e.min),e.max&&(t.max=e.max),0<e.value.length&&(t.value=e.value),0<e.placeholder.length&&(t.placeholder=e.placeholder),t.required=e.required,t.oncreate=o,l("input",t)},t.exports=function(e){var t=0<e.label.length&&e.showLabel?l("label",{},e.label):"",n="function"==typeof s[e.type]?s[e.type](e):s.default(e),r=e.wrap?l("p",[t,n]):[t,n],i=document.createElement("div");return l.render(i,r),a.prettyPrint(i.innerHTML)+"\n"}},{html:24,mithril:28}],4:[function(e,t,n){"use strict";var i,o=e("mithril"),r=e("./form-editor.js"),a=e("./fields.js"),l=window.mc4wp_forms_i18n,s=e("./field-generator.js"),c=e("../overlay.js"),u=e("./field-forms.js");function d(e){(i=a.get(e))&&"hidden"===i.type&&0<i.choices.length&&(i.value=i.choices.map(function(e){return e.label}).join("|")),o.redraw()}function f(){var e=s(i);r.insert(e),d(""),o.redraw()}r.on("blur",o.redraw);var h=document.getElementById("mc4wp-field-wizard");h&&o.mount(h,{view:function(){var e=a.getCategories(),n=a.getAll(),t=o("div.available-fields.small-margin",[o("h4",l.chooseField),e.map(function(t){var e=n.filter(function(e){return e.category===t});if(e.length)return o("div.tiny-margin",[o("strong",t),e.map(function(e){var t="button";e.forceRequired&&(t+=" is-required");var n=e.inFormContent;return null!==n&&(t+=" "+(n?"in-form":"not-in-form")),o("button",{className:t,type:"button",onclick:function(e){return d(e.target.value)},value:e.index},e.title)})])})]),r=null;return i&&(r=o(c,{onClose:d},o("div.field-wizard",[o("h3",[i.title,i.forceRequired?o("span.red","*"):"",i.name.length?o("code",i.name):""]),i.help.length?o("p",o.trust(i.help)):"",u.render(i),o("p",[o("button",{class:"button-primary",type:"button",onkeydown:function(e){13===e.keyCode&&f()},onclick:f},l.addToForm)])]))),[t,r]}})},{"../overlay.js":11,"./field-forms.js":2,"./field-generator.js":3,"./fields.js":6,"./form-editor.js":7,mithril:28}],5:[function(e,t,n){"use strict";var r=e("mithril"),i=e("./fields.js"),o=window.mc4wp.settings,a=window.mc4wp_vars.ajaxurl,l=window.mc4wp_forms_i18n,s=window.mc4wp_vars.mailchimp,c=window.mc4wp_vars.countries,u=[];function d(e,t,n){var r=i.register(e,t);n||u.push(r)}function f(e){var t={phone:"tel",dropdown:"select",checkboxes:"checkbox",birthday:"text"};return void 0!==t[e]?t[e]:e}function h(e){var t=l.listFields,n=f(e.type),r={name:e.tag,title:e.name,required:e.required,forceRequired:e.required,type:n,choices:e.options.choices,acceptsMultipleValues:!1};return"address"!==r.type?d(t,r,!1):(d(t,{name:r.name+"[addr1]",type:"text",mailchimpType:"address",title:l.streetAddress},!1),d(t,{name:r.name+"[city]",type:"text",mailchimpType:"address",title:l.city},!1),d(t,{name:r.name+"[state]",type:"text",mailchimpType:"address",title:l.state},!1),d(t,{name:r.name+"[zip]",type:"text",mailchimpType:"address",title:l.zip},!1),d(t,{name:r.name+"[country]",type:"select",mailchimpType:"address",title:l.country,choices:c},!1)),!0}function p(e){var t=l.interestCategories,n=f(e.type);d(t,{title:e.title,name:"INTERESTS["+e.id+"]",type:n,choices:e.interests,acceptsMultipleValues:"checkbox"===n},!1)}function m(e){e.merge_fields=e.merge_fields.sort(function(e,t){return"EMAIL"===e.tag||e.public&&!t.public?-1:!e.public&&t.public?1:0}),e.merge_fields.forEach(h),e.interest_categories.forEach(p)}function g(e){var t=a+"?action=mc4wp_get_list_details&ids="+e.map(function(e){return e.id}).join(",");r.request({url:t,method:"GET"}).then(function(e){u.forEach(i.deregister),e.forEach(m)})}o.on("selectedLists.change",g),g(o.getSelectedLists()),function(e){var t,n=l.formFields;for(var r in d(l.listFields,{name:"EMAIL",title:l.emailAddress,required:!0,forceRequired:!0,type:"email"},!0),d(n,{name:"",value:l.subscribe,type:"submit",title:l.submitButton},!0),t={},e)t[e[r].id]=e[r].name;d(n,{name:"_mc4wp_lists",type:"checkbox",title:l.listChoice,choices:t,help:l.listChoiceDescription,acceptsMultipleValues:!0},!0),t={subscribe:"Subscribe",unsubscribe:"Unsubscribe"},d(n,{name:"_mc4wp_action",type:"radio",title:l.formAction,choices:t,value:"subscribe",help:l.formActionDescription},!0),d(n,{name:"AGREE_TO_TERMS",value:1,type:"terms-checkbox",label:l.agreeToTerms,title:l.agreeToTermsShort,showLabel:!1,required:!0},!0)}(s.lists)},{"./fields.js":6,mithril:28}],6:[function(e,t,n){"use strict";function i(e){return{name:e.name,title:e.title||e.name,type:e.type,mailchimpType:e.mailchimpType||null,label:e.label||e.title||"",showLabel:"boolean"!=typeof e.showLabel||e.showLabel,value:e.value||"",placeholder:e.placeholder||"",required:"boolean"==typeof e.required&&e.required,forceRequired:"boolean"==typeof e.forceRequired&&e.forceRequired,wrap:"boolean"!=typeof e.wrap||e.wrap,min:e.min,max:e.max,help:e.help||"",choices:e.choices||[],inFormContent:null,acceptsMultipleValues:e.acceptsMultipleValues,link:e.link||""}}var o,a=e("mithril"),l=[],s=[],c={},u=function(e){return{title:e.title||e.label,selected:e.selected||!1,value:e.value||e.label,label:e.label}};function d(t,n){return l.filter(function(e){return e[t]===n})}t.exports={get:function(e){return l[e]},getAll:function(){return l=l.map(function(e,t){return e.index=t,e})},getCategories:function(){return s.sort(function(e,t){return"Form fields"!==e?-1:1})},deregister:function(e){var t=l.indexOf(e);-1<t&&(delete l[t],a.redraw())},register:function(e,t){var n=d("name",t.name).shift();if(!n){t.choices&&(t.choices=function(n){return"function"==typeof n.map?n.map(function(e){return new u({label:e})}):Object.keys(n).map(function(e){var t=n[e];return new u({label:t,value:e})})}(t.choices),t.value&&(t.choices=t.choices.map(function(e){return e.value===t.value&&(e.selected=!0),e}))),s.indexOf(e)<0&&s.push(e);var r=new i(t);return r.category=e,l.push(r),o&&window.clearTimeout(o),o=window.setTimeout(a.redraw,600),function(e,t){c[e]=c[e]||[],c[e].forEach(function(e){return e.apply(null,t)})}("change"),r}!n.forceRequired&&t.forceRequired&&(n.forceRequired=!0)},getAllWhere:d,on:function(e,t){c[e]=c[e]||[],c[e].push(t)}}},{mithril:28}],7:[function(e,t,n){"use strict";var r=e("codemirror");e("codemirror/mode/xml/xml"),e("codemirror/mode/javascript/javascript"),e("codemirror/mode/css/css"),e("codemirror/mode/htmlmixed/htmlmixed"),e("codemirror/addon/fold/xml-fold.js"),e("codemirror/addon/edit/matchtags.js"),e("codemirror/addon/edit/closetag.js"),e("codemirror/addon/selection/active-line.js"),e("codemirror/addon/edit/matchbrackets.js");var i,o,a={},l=document.createElement("form"),s=!1,c=document.getElementById("mc4wp-form-content"),u=document.getElementById("mc4wp-form-preview"),d=/\{[^{}]+\}/g;function f(){var e=u.contentDocument||u.contentWindow.document;(o=e.querySelector(".mc4wp-form-fields"))&&h()}function h(){var e=a.getValue();e=e.replace(d,"").replace(d,""),o.innerHTML=e,o.dispatchEvent(new Event("mc4wp-refresh"))}function p(){return s&&(l.innerHTML=a.getValue().toLowerCase(),s=!1),l}a.getValue=function(){return i?i.getValue():c.value},a.query=function(e){return p().querySelectorAll(e.toLowerCase())},a.containsField=function(e){return null!==p().elements.namedItem(e.toLowerCase())},a.insert=function(e){i?(i.replaceSelection(e),i.focus()):c.value+=e},a.on=function(e,t){return i?(e="input"===e?"changes":e,i.on(e,t)):c.addEventListener(e,t)},a.refresh=function(){i&&i.refresh()},c&&(window.addEventListener("load",function(){r.signal(i,"change")}),c.addEventListener("change",function(){s=!0,h()}),l.innerHTML=c.value.toLowerCase(),r&&(i=r.fromTextArea(c,{selectionPointer:!0,mode:"htmlmixed",htmlMode:!0,autoCloseTags:!0,autoRefresh:!0,styleActiveLine:!0,matchBrackets:!0,matchTags:{bothTags:!0}}),window.dispatchEvent&&i.on("change",function(){if("function"==typeof Event){var e=new Event("change",{bubbles:!0});c.dispatchEvent(e)}}))),u&&(u.addEventListener("load",f),f.call()),t.exports=a},{codemirror:19,"codemirror/addon/edit/closetag.js":14,"codemirror/addon/edit/matchbrackets.js":15,"codemirror/addon/edit/matchtags.js":16,"codemirror/addon/fold/xml-fold.js":17,"codemirror/addon/selection/active-line.js":18,"codemirror/mode/css/css":20,"codemirror/mode/htmlmixed/htmlmixed":21,"codemirror/mode/javascript/javascript":22,"codemirror/mode/xml/xml":23}],8:[function(e,t,n){"use strict";var r=e("mithril"),i=e("../helpers.js"),o=e("./form-editor.js"),a=e("./fields.js"),l=/\[(\w+)\]/g,s=/\[\]$/,c=document.getElementById("required-fields");function u(){a.getAll().forEach(function(e){if(!(e.name.length<=0)){var t=e.name;if("checkbox"===e.type&&(t+="[]"),e.inFormContent=o.containsField(t),"address"===e.mailchimpType){void 0===e.originalRequiredValue&&(e.originalRequiredValue=e.forceRequired);var n=e.name.replace(l,"");0<o.query('[name^="'+n+'"]').length?e.forceRequired=!0:e.forceRequired=e.originalRequiredValue}}}),function(){var r=a.getAllWhere("forceRequired",!0).map(function(e){return e.name.toUpperCase().replace(l,".$1")}),e=o.query("[required]");[].forEach.call(e,function(e){var t=e.name;if(t&&!(t.length<0)&&"_"!==t[0]){var n=(t=(t=t.replace(l,".$1")).replace(s,"")).indexOf(".");n=0<n?n:t.length,t=t.substr(0,n).toUpperCase()+t.substr(n),-1===r.indexOf(t)&&r.push(t)}}),c.value=r.join(",")}(),r.redraw()}o.on("change",i.debounce(u,600)),a.on("change",i.debounce(u,600))},{"../helpers.js":9,"./fields.js":6,"./form-editor.js":7,mithril:28}],9:[function(e,t,n){"use strict";var r={debounce:function(r,i,o){var a;return function(){var e=this,t=arguments,n=o&&!a;clearTimeout(a),a=setTimeout(function(){a=null,o||r.apply(e,t)},i),n&&r.apply(e,t)}}};t.exports=r},{}],10:[function(e,t,n){"use strict";var r=e("./form-editor/form-editor.js"),i=e("./form-editor/fields.js"),o=e("./settings"),a={};function l(e,t){a[e]=t,c()}function s(e){delete a[e],c()}function c(){var e="";for(var t in a)e+='<div class="notice notice-warning inline"><p>'+a[t]+"</p></div>";var n=document.querySelector(".mc4wp-notices");if(!n){(n=document.createElement("div")).className="mc4wp-notices";var r=document.querySelector("h1, h2");r.parentNode.insertBefore(n,r.nextSibling)}n.innerHTML=e}function u(){-1<r.getValue().toLowerCase().indexOf('name="groupings')?l("deprecated_groupings","Your form contains deprecated <code>GROUPINGS</code> fields. <br /><br />Please remove these fields from your form and then re-add them through the available field buttons to make sure your data is getting through to Mailchimp correctly."):s("deprecated_groupings")}function d(){var e=i.getAllWhere("forceRequired",!0).filter(function(e){return!r.containsField(e.name.toUpperCase())}),t="<strong>Heads up!</strong> Your form is missing list fields that are required in Mailchimp. Either add these fields to your form or mark them as optional in Mailchimp.";t+='<br /><ul class="ul-square" style="margin-bottom: 0;"><li>'+e.map(function(e){return e.title}).join("</li><li>")+"</li></ul>",0<e.length?l("required_fields_missing",t):s("required_fields_missing")}u(),r.on("focus",u),r.on("blur",u),d(),r.on("blur",d),r.on("focus",d),document.body.addEventListener("change",function(){0<o.getSelectedLists().length?s("no_lists_selected"):l("no_lists_selected",'<strong>Heads up!</strong> You have not yet selected a Mailchimp list to subscribe people to. Please select at least one list from the <a href="javascript:void(0)" data-tab="settings" class="tab-link">settings tab</a>.')})},{"./form-editor/fields.js":6,"./form-editor/form-editor.js":7,"./settings":12}],11:[function(e,t,n){"use strict";var a=e("mithril"),l=window.mc4wp_forms_i18n;t.exports=function(e){var i,t=e.attrs.onClose;function n(){t.apply(null)}function r(e){27===e.keyCode&&n(),13===e.keyCode&&e.preventDefault()}function o(){var e=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,t=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,n=(e-i.clientWidth-40)/2,r=(t-i.clientHeight-40)/2;i.style.left=(0<n?n:0)+"px",i.style.top=(0<r?r:0)+"px"}return{oncreate:function(){document.addEventListener("keydown",r),window.addEventListener("resize",o)},onremove:function(){document.removeEventListener("keydown",r),window.removeEventListener("resize",o)},view:function(e){return[a("div.overlay-wrap",a("div.overlay",{oncreate:function(e){i=e.dom,o()}},[a("span",{class:"close dashicons dashicons-no",title:l.close,onclick:n}),e.children])),a("div.overlay-background",{title:l.close,onclick:n})]}}}},{mithril:28}],12:[function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i=document.getElementById("mc4wp-admin").querySelectorAll(".mc4wp-list-input"),o=window.mc4wp_vars.mailchimp.lists,a=[],l={};function s(){return a=[],[].forEach.call(i,function(e){"boolean"==typeof e.checked&&!e.checked||"object"!==r(o[e.value])||a.push(o[e.value])}),function(){var e=document.querySelectorAll(".lists--only-selected > *");[].forEach.call(e,function(e){var t=0<function(t,n){return a.filter(function(e){return e[t]===n})}("id",e.getAttribute("data-list-id")).length;e.style.display=t?"":"none"})}(),function(e,t){l[e]=l[e]||[],l[e].forEach(function(e){return e.apply(null,t)})}("selectedLists.change",[a]),a}[].forEach.call(i,function(e){e.addEventListener("change",s)}),s(),t.exports={getSelectedLists:function(){return a},on:function(e,t){l[e]=l[e]||[],l[e].push(t)}}},{}],13:[function(e,t,n){"use strict";var r=e("./admin/form-editor/form-editor.js");e("./admin/form-editor/form-watcher.js"),e("./admin/form-editor/field-helper.js"),e("./admin/form-editor/field-manager.js"),e("./admin/notices.js"),window.mc4wp.forms=window.mc4wp.forms||{},window.mc4wp.forms.editor=r},{"./admin/form-editor/field-helper.js":4,"./admin/form-editor/field-manager.js":5,"./admin/form-editor/form-editor.js":7,"./admin/form-editor/form-watcher.js":8,"./admin/notices.js":10}],14:[function(e,t,n){var r;r=function(w){w.defineOption("autoCloseTags",!1,function(e,t,n){if(n!=w.Init&&n&&e.removeKeyMap("autoCloseTags"),t){var r={name:"autoCloseTags"};"object"==typeof t&&!t.whenClosing||(r["'/'"]=function(e){return function(e){return e.getOption("disableInput")?w.Pass:i(e,!0)}(e)}),"object"==typeof t&&!t.whenOpening||(r["'>'"]=function(e){return function(e){if(e.getOption("disableInput"))return w.Pass;for(var t=e.listSelections(),n=[],r=e.getOption("autoCloseTags"),i=0;i<t.length;i++){if(!t[i].empty())return w.Pass;var o=t[i].head,a=e.getTokenAt(o),l=w.innerMode(e.getMode(),a.state),s=l.state,c=l.mode.xmlCurrentTag&&l.mode.xmlCurrentTag(s),u=c&&c.name;if(!u)return w.Pass;var d="html"==l.mode.configuration,f="object"==typeof r&&r.dontCloseTags||d&&x,h="object"==typeof r&&r.indentTags||d&&k;a.end>o.ch&&(u=u.slice(0,u.length-a.end+o.ch));var p=u.toLowerCase();if(!u||"string"==a.type&&(a.end!=o.ch||!/[\"\']/.test(a.string.charAt(a.string.length-1))||1==a.string.length)||"tag"==a.type&&c.close||a.string.indexOf("/")==o.ch-a.start-1||f&&-1<C(f,p)||T(e,l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(s)||[],u,o,!0))return w.Pass;var m="object"==typeof r&&r.emptyTags;if(m&&-1<C(m,u))n[i]={text:"/>",newPos:w.Pos(o.line,o.ch+2)};else{var g=h&&-1<C(h,p);n[i]={indent:g,text:">"+(g?"\n\n":"")+"</"+u+">",newPos:g?w.Pos(o.line+1,0):w.Pos(o.line,o.ch+1)}}}var v="object"==typeof r&&r.dontIndentOnAutoClose;for(i=t.length-1;0<=i;i--){var y=n[i];e.replaceRange(y.text,t[i].head,t[i].anchor,"+insert");var b=e.listSelections().slice(0);b[i]={head:y.newPos,anchor:y.newPos},e.setSelections(b),!v&&y.indent&&(e.indentLine(y.newPos.line,null,!0),e.indentLine(y.newPos.line+1,null,!0))}}(e)}),e.addKeyMap(r)}});var x=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],k=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function i(e,t){for(var n=e.listSelections(),r=[],i=t?"/":"</",o=e.getOption("autoCloseTags"),a="object"==typeof o&&o.dontIndentOnSlash,l=0;l<n.length;l++){if(!n[l].empty())return w.Pass;var s=n[l].head,c=e.getTokenAt(s),u=w.innerMode(e.getMode(),c.state),d=u.state;if(t&&("string"==c.type||"<"!=c.string.charAt(0)||c.start!=s.ch-1))return w.Pass;var f,h="xml"!=u.mode.name&&"htmlmixed"==e.getMode().name;if(h&&"javascript"==u.mode.name)f=i+"script";else if(h&&"css"==u.mode.name)f=i+"style";else{var p=u.mode.xmlCurrentContext&&u.mode.xmlCurrentContext(d);if(!p||p.length&&T(e,p,p[p.length-1],s))return w.Pass;f=i+p[p.length-1]}">"!=e.getLine(s.line).charAt(c.end)&&(f+=">"),r[l]=f}if(e.replaceSelections(r),n=e.listSelections(),!a)for(l=0;l<n.length;l++)(l==n.length-1||n[l].head.line<n[l+1].head.line)&&e.indentLine(n[l].head.line)}function C(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n<r;++n)if(e[n]==t)return n;return-1}function T(e,t,n,r,i){if(!w.scanForClosingTag)return!1;var o=Math.min(e.lastLine()+1,r.line+500),a=w.scanForClosingTag(e,r,null,o);if(!a||a.tag!=n)return!1;for(var l=i?1:0,s=t.length-1;0<=s&&t[s]==n;s--)++l;r=a.to;for(s=1;s<l;s++){var c=w.scanForClosingTag(e,r,null,o);if(!c||c.tag!=n)return!1;r=c.to}return!0}w.commands.closeTag=function(e){return i(e)}},"object"==typeof n&&"object"==typeof t?r(e("../../lib/codemirror"),e("../fold/xml-fold")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],r):r(CodeMirror)},{"../../lib/codemirror":19,"../fold/xml-fold":17}],15:[function(e,t,n){var r;r=function(r){var u=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),g=r.Pos,v={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function y(e){return e&&e.bracketRegex||/[(){}[\]]/}function d(e,t,n){var r=e.getLineHandle(t.line),i=t.ch-1,o=n&&n.afterCursor;null==o&&(o=/(^| )cm-fat-cursor($| )/.test(e.getWrapperElement().className));var a=y(n),l=!o&&0<=i&&a.test(r.text.charAt(i))&&v[r.text.charAt(i)]||a.test(r.text.charAt(i+1))&&v[r.text.charAt(++i)];if(!l)return null;var s=">"==l.charAt(1)?1:-1;if(n&&n.strict&&0<s!=(i==t.ch))return null;var c=e.getTokenTypeAt(g(t.line,i+1)),u=f(e,g(t.line,i+(0<s?1:0)),s,c||null,n);return null==u?null:{from:g(t.line,i),to:u&&u.pos,match:u&&u.ch==l.charAt(0),forward:0<s}}function f(e,t,n,r,i){for(var o=i&&i.maxScanLineLength||1e4,a=i&&i.maxScanLines||1e3,l=[],s=y(i),c=0<n?Math.min(t.line+a,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-a),u=t.line;u!=c;u+=n){var d=e.getLine(u);if(d){var f=0<n?0:d.length-1,h=0<n?d.length:-1;if(!(d.length>o))for(u==t.line&&(f=t.ch-(n<0?1:0));f!=h;f+=n){var p=d.charAt(f);if(s.test(p)&&(void 0===r||e.getTokenTypeAt(g(u,f+1))==r)){var m=v[p];if(m&&">"==m.charAt(1)==0<n)l.push(p);else{if(!l.length)return{pos:g(u,f),ch:p};l.pop()}}}}}return u-n!=(0<n?e.lastLine():e.firstLine())&&null}function t(e,t,n){for(var r=e.state.matchBrackets.maxHighlightLineLength||1e3,i=[],o=e.listSelections(),a=0;a<o.length;a++){var l=o[a].empty()&&d(e,o[a].head,n);if(l&&e.getLine(l.from.line).length<=r){var s=l.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";i.push(e.markText(l.from,g(l.from.line,l.from.ch+1),{className:s})),l.to&&e.getLine(l.to.line).length<=r&&i.push(e.markText(l.to,g(l.to.line,l.to.ch+1),{className:s}))}}if(i.length){u&&e.state.focused&&e.focus();function c(){e.operation(function(){for(var e=0;e<i.length;e++)i[e].clear()})}if(!t)return c;setTimeout(c,800)}}function i(e){e.operation(function(){e.state.matchBrackets.currentlyHighlighted&&(e.state.matchBrackets.currentlyHighlighted(),e.state.matchBrackets.currentlyHighlighted=null),e.state.matchBrackets.currentlyHighlighted=t(e,!1,e.state.matchBrackets)})}r.defineOption("matchBrackets",!1,function(e,t,n){n&&n!=r.Init&&(e.off("cursorActivity",i),e.state.matchBrackets&&e.state.matchBrackets.currentlyHighlighted&&(e.state.matchBrackets.currentlyHighlighted(),e.state.matchBrackets.currentlyHighlighted=null)),t&&(e.state.matchBrackets="object"==typeof t?t:{},e.on("cursorActivity",i))}),r.defineExtension("matchBrackets",function(){t(this,!0)}),r.defineExtension("findMatchingBracket",function(e,t,n){return!n&&"boolean"!=typeof t||(t=n?(n.strict=t,n):t?{strict:!0}:null),d(this,e,t)}),r.defineExtension("scanForBracket",function(e,t,n,r){return f(this,e,t,n,r)})},"object"==typeof n&&"object"==typeof t?r(e("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":19}],16:[function(e,t,n){var r;r=function(a){"use strict";function l(e){e.state.tagHit&&e.state.tagHit.clear(),e.state.tagOther&&e.state.tagOther.clear(),e.state.tagHit=e.state.tagOther=null}function r(o){o.state.failedTagMatch=!1,o.operation(function(){if(l(o),!o.somethingSelected()){var e=o.getCursor(),t=o.getViewport();t.from=Math.min(t.from,e.line),t.to=Math.max(e.line+1,t.to);var n=a.findMatchingTag(o,e,t);if(n){if(o.state.matchBothTags){var r="open"==n.at?n.open:n.close;r&&(o.state.tagHit=o.markText(r.from,r.to,{className:"CodeMirror-matchingtag"}))}var i="close"==n.at?n.open:n.close;i?o.state.tagOther=o.markText(i.from,i.to,{className:"CodeMirror-matchingtag"}):o.state.failedTagMatch=!0}}})}function i(e){e.state.failedTagMatch&&r(e)}a.defineOption("matchTags",!1,function(e,t,n){n&&n!=a.Init&&(e.off("cursorActivity",r),e.off("viewportChange",i),l(e)),t&&(e.state.matchBothTags="object"==typeof t&&t.bothTags,e.on("cursorActivity",r),e.on("viewportChange",i),r(e))}),a.commands.toMatchingTag=function(e){var t=a.findMatchingTag(e,e.getCursor());if(t){var n="close"==t.at?t.open:t.close;n&&e.extendSelection(n.to,n.from)}}},"object"==typeof n&&"object"==typeof t?r(e("../../lib/codemirror"),e("../fold/xml-fold")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],r):r(CodeMirror)},{"../../lib/codemirror":19,"../fold/xml-fold":17}],17:[function(e,t,n){var r;r=function(e){"use strict";var s=e.Pos;function c(e,t){return e.line-t.line||e.ch-t.ch}var t="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",r=new RegExp("<(/?)(["+t+"][A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*)","g");function u(e,t,n,r){this.line=t,this.ch=n,this.cm=e,this.text=e.getLine(t),this.min=r?Math.max(r.from,e.firstLine()):e.firstLine(),this.max=r?Math.min(r.to-1,e.lastLine()):e.lastLine()}function i(e,t){var n=e.cm.getTokenTypeAt(s(e.line,t));return n&&/\btag\b/.test(n)}function o(e){if(!(e.line>=e.max))return e.ch=0,e.text=e.cm.getLine(++e.line),!0}function a(e){if(!(e.line<=e.min))return e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0}function d(e){for(;;){var t=e.text.indexOf(">",e.ch);if(-1==t){if(o(e))continue;return}if(i(e,t+1)){var n=e.text.lastIndexOf("/",t),r=-1<n&&!/\S/.test(e.text.slice(n+1,t));return e.ch=t+1,r?"selfClose":"regular"}e.ch=t+1}}function f(e){for(;;){var t=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==t){if(a(e))continue;return}if(i(e,t+1)){r.lastIndex=t,e.ch=t;var n=r.exec(e.text);if(n&&n.index==t)return n}else e.ch=t}}function h(e){for(;;){r.lastIndex=e.ch;var t=r.exec(e.text);if(!t){if(o(e))continue;return}if(i(e,t.index+1))return e.ch=t.index+t[0].length,t;e.ch=t.index+1}}function p(e){for(;;){var t=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==t){if(a(e))continue;return}if(i(e,t+1)){var n=e.text.lastIndexOf("/",t),r=-1<n&&!/\S/.test(e.text.slice(n+1,t));return e.ch=t+1,r?"selfClose":"regular"}e.ch=t}}function m(e,t){for(var n=[];;){var r,i=h(e),o=e.line,a=e.ch-(i?i[0].length:0);if(!i||!(r=d(e)))return;if("selfClose"!=r)if(i[1]){for(var l=n.length-1;0<=l;--l)if(n[l]==i[2]){n.length=l;break}if(l<0&&(!t||t==i[2]))return{tag:i[2],from:s(o,a),to:s(e.line,e.ch)}}else n.push(i[2])}}function g(e,t){for(var n=[];;){var r=p(e);if(!r)return;if("selfClose"!=r){var i=e.line,o=e.ch,a=f(e);if(!a)return;if(a[1])n.push(a[2]);else{for(var l=n.length-1;0<=l;--l)if(n[l]==a[2]){n.length=l;break}if(l<0&&(!t||t==a[2]))return{tag:a[2],from:s(e.line,e.ch),to:s(i,o)}}}else f(e)}}e.registerHelper("fold","xml",function(e,t){for(var n=new u(e,t.line,0);;){var r=h(n);if(!r||n.line!=t.line)return;var i=d(n);if(!i)return;if(!r[1]&&"selfClose"!=i){var o=s(n.line,n.ch),a=m(n,r[2]);return a&&0<c(a.from,o)?{from:o,to:a.from}:null}}}),e.findMatchingTag=function(e,t,n){var r=new u(e,t.line,t.ch,n);if(-1!=r.text.indexOf(">")||-1!=r.text.indexOf("<")){var i=d(r),o=i&&s(r.line,r.ch),a=i&&f(r);if(i&&a&&!(0<c(r,t))){var l={from:s(r.line,r.ch),to:o,tag:a[2]};return"selfClose"==i?{open:l,close:null,at:"open"}:a[1]?{open:g(r,a[2]),close:l,at:"close"}:{open:l,close:m(r=new u(e,o.line,o.ch,n),a[2]),at:"open"}}}},e.findEnclosingTag=function(e,t,n,r){for(var i=new u(e,t.line,t.ch,n);;){var o=g(i,r);if(!o)break;var a=m(new u(e,t.line,t.ch,n),o.tag);if(a)return{open:o,close:a}}},e.scanForClosingTag=function(e,t,n,r){return m(new u(e,t.line,t.ch,r?{from:0,to:r}:null),n)}},"object"==typeof n&&"object"==typeof t?r(e("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":19}],18:[function(e,t,n){var r;r=function(i){"use strict";var l="CodeMirror-activeline",s="CodeMirror-activeline-background",c="CodeMirror-activeline-gutter";function u(e){for(var t=0;t<e.state.activeLines.length;t++)e.removeLineClass(e.state.activeLines[t],"wrap",l),e.removeLineClass(e.state.activeLines[t],"background",s),e.removeLineClass(e.state.activeLines[t],"gutter",c)}function o(t,e){for(var n=[],r=0;r<e.length;r++){var i=e[r],o=t.getOption("styleActiveLine");if("object"==typeof o&&o.nonEmpty?i.anchor.line==i.head.line:i.empty()){var a=t.getLineHandleVisualStart(i.head.line);n[n.length-1]!=a&&n.push(a)}}!function(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}(t.state.activeLines,n)&&t.operation(function(){u(t);for(var e=0;e<n.length;e++)t.addLineClass(n[e],"wrap",l),t.addLineClass(n[e],"background",s),t.addLineClass(n[e],"gutter",c);t.state.activeLines=n})}function a(e,t){o(e,t.ranges)}i.defineOption("styleActiveLine",!1,function(e,t,n){var r=n!=i.Init&&n;t!=r&&(r&&(e.off("beforeSelectionChange",a),u(e),delete e.state.activeLines),t&&(e.state.activeLines=[],o(e,e.listSelections()),e.on("beforeSelectionChange",a)))})},"object"==typeof n&&"object"==typeof t?r(e("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":19}],19:[function(e,t,n){var r,i;r=this,i=function(){"use strict";var e=navigator.userAgent,t=navigator.platform,m=/gecko\/\d/i.test(e),n=/MSIE \d/.test(e),r=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),i=/Edge\/(\d+)/.exec(e),x=n||r||i,k=x&&(n?document.documentMode||6:+(i||r)[1]),b=!i&&/WebKit\//.test(e),o=b&&/Qt\/\d+\.\d+/.test(e),a=!i&&/Chrome\//.test(e),g=/Opera\//.test(e),s=/Apple Computer/.test(navigator.vendor),l=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),c=/PhantomJS/.test(e),u=!i&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),d=/Android/.test(e),f=u||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),w=u||/Mac/.test(t),h=/\bCrOS\b/.test(e),p=/win/i.test(t),v=g&&e.match(/Version\/(\d*\.\d*)/);(v=v&&Number(v[1]))&&15<=v&&(b=!(g=!1));var y=w&&(o||g&&(null==v||v<12.11)),C=m||x&&9<=k;function T(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var S,L=function(e,t){var n=e.className,r=T(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function M(e){for(var t=e.childNodes.length;0<t;--t)e.removeChild(e.firstChild);return e}function A(e,t){return M(e).appendChild(t)}function N(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function O(e,t,n,r){var i=N(e,t,n,r);return i.setAttribute("role","presentation"),i}function _(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if(11==t.nodeType&&(t=t.host),t==e)return!0}while(t=t.parentNode)}function E(){var t;try{t=document.activeElement}catch(e){t=document.body||null}for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t}function z(e,t){var n=e.className;T(t).test(n)||(e.className+=(n?" ":"")+t)}function D(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!T(n[r]).test(t)&&(t+=" "+n[r]);return t}S=document.createRange?function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(e){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};var P=function(e){e.select()};function F(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function I(e,t,n){for(var r in t=t||{},e)!e.hasOwnProperty(r)||!1===n&&t.hasOwnProperty(r)||(t[r]=e[r]);return t}function j(e,t,n,r,i){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var o=r||0,a=i||0;;){var l=e.indexOf("\t",o);if(l<0||t<=l)return a+(t-o);a+=l-o,a+=n-a%n,o=l+1}}u?P=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:x&&(P=function(e){try{e.select()}catch(e){}});var W=function(){this.id=null,this.f=null,this.time=0,this.handler=F(this.onTimeout,this)};function H(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}W.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},W.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};var R=30,B={toString:function(){return"CodeMirror.Pass"}},q={scroll:!1},U={origin:"*mouse"},K={origin:"+move"};function V(e,t,n){for(var r=0,i=0;;){var o=e.indexOf("\t",r);-1==o&&(o=e.length);var a=o-r;if(o==e.length||t<=i+a)return r+Math.min(a,t-i);if(i+=o-r,r=o+1,t<=(i+=n-i%n))return r}}var G=[""];function $(e){for(;G.length<=e;)G.push(Y(G)+" ");return G[e]}function Y(e){return e[e.length-1]}function X(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Z(){}function J(e,t){var n;return n=Object.create?Object.create(e):(Z.prototype=e,new Z),t&&I(t,n),n}var Q=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ee(e){return/\w/.test(e)||"€"<e&&(e.toUpperCase()!=e.toLowerCase()||Q.test(e))}function te(e,t){return t?!!(-1<t.source.indexOf("\\w")&&ee(e))||t.test(e):ee(e)}function ne(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var re=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ie(e){return 768<=e.charCodeAt(0)&&re.test(e)}function oe(e,t,n){for(;(n<0?0<t:t<e.length)&&ie(e.charAt(t));)t+=n;return t}function ae(e,t,n){for(var r=n<t?-1:1;;){if(t==n)return t;var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}var le=null;function se(e,t,n){var r;le=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&"before"==n?r=i:le=i),o.from==t&&(o.from!=o.to&&"before"!=n?r=i:le=i)}return null!=r?r:le}var ce,ue,de,fe,he,pe,me,ge=(ce="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",ue="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111",de=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,fe=/[stwN]/,he=/[LRr]/,pe=/[Lb1n]/,me=/[1n]/,function(e,t){var n="ltr"==t?"L":"R";if(0==e.length||"ltr"==t&&!de.test(e))return!1;for(var r,i=e.length,o=[],a=0;a<i;++a)o.push((r=e.charCodeAt(a))<=247?ce.charAt(r):1424<=r&&r<=1524?"R":1536<=r&&r<=1785?ue.charAt(r-1536):1774<=r&&r<=2220?"r":8192<=r&&r<=8203?"w":8204==r?"b":"L");for(var l=0,s=n;l<i;++l){var c=o[l];"m"==c?o[l]=s:s=c}for(var u=0,d=n;u<i;++u){var f=o[u];"1"==f&&"r"==d?o[u]="n":he.test(f)&&"r"==(d=f)&&(o[u]="R")}for(var h=1,p=o[0];h<i-1;++h){var m=o[h];"+"==m&&"1"==p&&"1"==o[h+1]?o[h]="1":","!=m||p!=o[h+1]||"1"!=p&&"n"!=p||(o[h]=p),p=m}for(var g=0;g<i;++g){var v=o[g];if(","==v)o[g]="N";else if("%"==v){var y=void 0;for(y=g+1;y<i&&"%"==o[y];++y);for(var b=g&&"!"==o[g-1]||y<i&&"1"==o[y]?"1":"N",w=g;w<y;++w)o[w]=b;g=y-1}}for(var x=0,k=n;x<i;++x){var C=o[x];"L"==k&&"1"==C?o[x]="L":he.test(C)&&(k=C)}for(var T=0;T<i;++T)if(fe.test(o[T])){var S=void 0;for(S=T+1;S<i&&fe.test(o[S]);++S);for(var L="L"==(T?o[T-1]:n),M=L==("L"==(S<i?o[S]:n))?L?"L":"R":n,A=T;A<S;++A)o[A]=M;T=S-1}for(var O,N=[],_=0;_<i;)if(pe.test(o[_])){var E=_;for(++_;_<i&&pe.test(o[_]);++_);N.push(new ve(0,E,_))}else{var z=_,D=N.length;for(++_;_<i&&"L"!=o[_];++_);for(var P=z;P<_;)if(me.test(o[P])){z<P&&N.splice(D,0,new ve(1,z,P));var F=P;for(++P;P<_&&me.test(o[P]);++P);N.splice(D,0,new ve(2,F,P)),z=P}else++P;z<_&&N.splice(D,0,new ve(1,z,_))}return"ltr"==t&&(1==N[0].level&&(O=e.match(/^\s+/))&&(N[0].from=O[0].length,N.unshift(new ve(0,0,O[0].length))),1==Y(N).level&&(O=e.match(/\s+$/))&&(Y(N).to-=O[0].length,N.push(new ve(0,i-O[0].length,i)))),"rtl"==t?N.reverse():N});function ve(e,t,n){this.level=e,this.from=t,this.to=n}function ye(e,t){var n=e.order;return null==n&&(n=e.order=ge(e.text,t)),n}var be=[],we=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||be).concat(n)}};function xe(e,t){return e._handlers&&e._handlers[t]||be}function ke(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var o=H(i,n);-1<o&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function Ce(e,t){var n=xe(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Te(e,t,n){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Ce(e,n||t.type,e,t),Ne(t)||t.codemirrorIgnore}function Se(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)-1==H(n,t[r])&&n.push(t[r])}function Le(e,t){return 0<xe(e,t).length}function Me(e){e.prototype.on=function(e,t){we(this,e,t)},e.prototype.off=function(e,t){ke(this,e,t)}}function Ae(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Oe(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Ne(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function _e(e){Ae(e),Oe(e)}function Ee(e){return e.target||e.srcElement}function ze(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),w&&e.ctrlKey&&1==t&&(t=3),t}var De,Pe,Fe=function(){if(x&&k<9)return!1;var e=N("div");return"draggable"in e||"dragDrop"in e}();function Ie(e){if(null==De){var t=N("span","​");A(e,N("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(De=t.offsetWidth<=1&&2<t.offsetHeight&&!(x&&k<8))}var n=De?N("span","​"):N("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function je(e){if(null!=Pe)return Pe;var t=A(e,document.createTextNode("AخA")),n=S(t,0,1).getBoundingClientRect(),r=S(t,1,2).getBoundingClientRect();return M(e),!(!n||n.left==n.right)&&(Pe=r.right-n.right<3)}var We,He=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(n.push(o.slice(0,a)),t+=a+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Re=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},Be="oncopy"in(We=N("div"))||(We.setAttribute("oncopy","return;"),"function"==typeof We.oncopy),qe=null;var Ue={},Ke={};function Ve(e){if("string"==typeof e&&Ke.hasOwnProperty(e))e=Ke[e];else if(e&&"string"==typeof e.name&&Ke.hasOwnProperty(e.name)){var t=Ke[e.name];"string"==typeof t&&(t={name:t}),(e=J(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ve("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ve("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Ge(e,t){t=Ve(t);var n=Ue[t.name];if(!n)return Ge(e,"text/plain");var r=n(e,t);if($e.hasOwnProperty(t.name)){var i=$e[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)r[a]=t.modeProps[a];return r}var $e={};function Ye(e,t){I(t,$e.hasOwnProperty(e)?$e[e]:$e[e]={})}function Xe(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Ze(e,t){for(var n;e.innerMode&&(n=e.innerMode(t))&&n.mode!=e;)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Je(e,t,n){return!e.startState||e.startState(t,n)}var Qe=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};function et(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(t<o){n=i;break}t-=o}return n.lines[t]}function tt(e,n,r){var i=[],o=n.line;return e.iter(n.line,r.line+1,function(e){var t=e.text;o==r.line&&(t=t.slice(0,r.ch)),o==n.line&&(t=t.slice(n.ch)),i.push(t),++o}),i}function nt(e,t,n){var r=[];return e.iter(t,n,function(e){r.push(e.text)}),r}function rt(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function it(e){if(null==e.parent)return null;for(var t=e.parent,n=H(t.lines,e),r=t.parent;r;r=(t=r).parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize();return n+t.first}function ot(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],o=i.height;if(t<o){e=i;continue e}t-=o,n+=i.chunkSize()}return n}while(!e.lines);for(var a=0;a<e.lines.length;++a){var l=e.lines[a].height;if(t<l)break;t-=l}return n+a}function at(e,t){return t>=e.first&&t<e.first+e.size}function lt(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function st(e,t,n){if(void 0===n&&(n=null),!(this instanceof st))return new st(e,t,n);this.line=e,this.ch=t,this.sticky=n}function ct(e,t){return e.line-t.line||e.ch-t.ch}function ut(e,t){return e.sticky==t.sticky&&0==ct(e,t)}function dt(e){return st(e.line,e.ch)}function ft(e,t){return ct(e,t)<0?t:e}function ht(e,t){return ct(e,t)<0?e:t}function pt(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function mt(e,t){if(t.line<e.first)return st(e.first,0);var n=e.first+e.size-1;return t.line>n?st(n,et(e,n).text.length):function(e,t){var n=e.ch;return null==n||t<n?st(e.line,t):n<0?st(e.line,0):e}(t,et(e,t.line).text.length)}function gt(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=mt(e,t[r]);return n}Qe.prototype.eol=function(){return this.pos>=this.string.length},Qe.prototype.sol=function(){return this.pos==this.lineStart},Qe.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Qe.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Qe.prototype.eat=function(e){var t=this.string.charAt(this.pos);if("string"==typeof e?t==e:t&&(e.test?e.test(t):e(t)))return++this.pos,t},Qe.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Qe.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Qe.prototype.skipToEnd=function(){this.pos=this.string.length},Qe.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(-1<t)return this.pos=t,!0},Qe.prototype.backUp=function(e){this.pos-=e},Qe.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=j(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?j(this.string,this.lineStart,this.tabSize):0)},Qe.prototype.indentation=function(){return j(this.string,null,this.tabSize)-(this.lineStart?j(this.string,this.lineStart,this.tabSize):0)},Qe.prototype.match=function(e,t,n){if("string"!=typeof e){var r=this.string.slice(this.pos).match(e);return r&&0<r.index?null:(r&&!1!==t&&(this.pos+=r[0].length),r)}function i(e){return n?e.toLowerCase():e}if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},Qe.prototype.current=function(){return this.string.slice(this.start,this.pos)},Qe.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Qe.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Qe.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var vt=function(e,t){this.state=e,this.lookAhead=t},yt=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};function bt(t,n,r,e){var s=[t.state.modeGen],i={};At(t,n.text,t.doc.mode,r,function(e,t){return s.push(e,t)},i,e);for(var c=r.state,o=function(e){r.baseTokens=s;var o=t.state.overlays[e],a=1,l=0;r.state=!0,At(t,n.text,o.mode,r,function(e,t){for(var n=a;l<e;){var r=s[a];e<r&&s.splice(a,1,e,s[a+1],r),a+=2,l=Math.min(e,r)}if(t)if(o.opaque)s.splice(n,a-n,e,"overlay "+t),a=n+2;else for(;n<a;n+=2){var i=s[n+1];s[n+1]=(i?i+" ":"")+"overlay "+t}},i),r.state=c,r.baseTokens=null,r.baseTokenPos=1},a=0;a<t.state.overlays.length;++a)o(a);return{styles:s,classes:i.bgClass||i.textClass?i:null}}function wt(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=xt(e,it(t)),i=t.text.length>e.options.maxHighlightLength&&Xe(e.doc.mode,r.state),o=bt(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function xt(n,r,e){var t=n.doc,i=n.display;if(!t.mode.startState)return new yt(t,!0,r);var o=function(e,t,n){for(var r,i,o=e.doc,a=n?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;a<l;--l){if(l<=o.first)return o.first;var s=et(o,l-1),c=s.stateAfter;if(c&&(!n||l+(c instanceof vt?c.lookAhead:0)<=o.modeFrontier))return l;var u=j(s.text,null,e.options.tabSize);(null==i||u<r)&&(i=l-1,r=u)}return i}(n,r,e),a=o>t.first&&et(t,o-1).stateAfter,l=a?yt.fromSaved(t,a,o):new yt(t,Je(t.mode),o);return t.iter(o,r,function(e){kt(n,e.text,l);var t=l.line;e.stateAfter=t==r-1||t%5==0||t>=i.viewFrom&&t<i.viewTo?l.save():null,l.nextLine()}),e&&(t.modeFrontier=l.line),l}function kt(e,t,n,r){var i=e.doc.mode,o=new Qe(t,e.options.tabSize,n);for(o.start=o.pos=r||0,""==t&&Ct(i,n.state);!o.eol();)Tt(i,o,n.state),o.start=o.pos}function Ct(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var n=Ze(e,t);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function Tt(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Ze(e,n).mode);var o=e.token(t,n);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}yt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},yt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},yt.prototype.nextLine=function(){this.line++,0<this.maxLookAhead&&this.maxLookAhead--},yt.fromSaved=function(e,t,n){return t instanceof vt?new yt(e,Xe(e.mode,t.state),n,t.lookAhead):new yt(e,Xe(e.mode,t),n)},yt.prototype.save=function(e){var t=!1!==e?Xe(this.doc.mode,this.state):this.state;return 0<this.maxLookAhead?new vt(t,this.maxLookAhead):t};var St=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Lt(e,t,n,r){var i,o,a=e.doc,l=a.mode,s=et(a,(t=mt(a,t)).line),c=xt(e,t.line,n),u=new Qe(s.text,e.options.tabSize,c);for(r&&(o=[]);(r||u.pos<t.ch)&&!u.eol();)u.start=u.pos,i=Tt(l,u,c.state),r&&o.push(new St(u,i,Xe(a.mode,c.state)));return r?o:new St(u,i,c.state)}function Mt(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";null==t[r]?t[r]=n[2]:new RegExp("(?:^|s)"+n[2]+"(?:$|s)").test(t[r])||(t[r]+=" "+n[2])}return e}function At(e,t,n,r,i,o,a){var l=n.flattenSpans;null==l&&(l=e.options.flattenSpans);var s,c=0,u=null,d=new Qe(t,e.options.tabSize,r),f=e.options.addModeClass&&[null];for(""==t&&Mt(Ct(n,r.state),o);!d.eol();){if(s=d.pos>e.options.maxHighlightLength?(l=!1,a&&kt(e,t,r,d.pos),d.pos=t.length,null):Mt(Tt(n,d,r.state,f),o),f){var h=f[0].name;h&&(s="m-"+(s?h+" "+s:h))}if(!l||u!=s){for(;c<d.start;)i(c=Math.min(d.start,c+5e3),u);u=s}d.start=d.pos}for(;c<d.pos;){var p=Math.min(d.pos,c+5e3);i(p,u),c=p}}var Ot=!1,Nt=!1;function _t(e,t,n){this.marker=e,this.from=t,this.to=n}function Et(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function zt(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n=n||[]).push(e[r]);return n}function Dt(e,t){if(t.full)return null;var n=at(e,t.from.line)&&et(e,t.from.line).markedSpans,r=at(e,t.to.line)&&et(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,o=t.to.ch,a=0==ct(t.from,t.to),l=function(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker;if(null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t)||o.from==t&&"bookmark"==a.type&&(!n||!o.marker.insertLeft)){var l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(r=r||[]).push(new _t(a,o.from,l?null:o.to))}}return r}(n,i,a),s=function(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker;if(null==o.to||(a.inclusiveRight?o.to>=t:o.to>t)||o.from==t&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(r=r||[]).push(new _t(a,l?null:o.from-t,null==o.to?null:o.to-t))}}return r}(r,o,a),c=1==t.text.length,u=Y(t.text).length+(c?i:0);if(l)for(var d=0;d<l.length;++d){var f=l[d];if(null==f.to){var h=Et(s,f.marker);h?c&&(f.to=null==h.to?null:h.to+u):f.to=i}}if(s)for(var p=0;p<s.length;++p){var m=s[p];if(null!=m.to&&(m.to+=u),null==m.from)Et(l,m.marker)||(m.from=u,c&&(l=l||[]).push(m));else m.from+=u,c&&(l=l||[]).push(m)}l=l&&Pt(l),s&&s!=l&&(s=Pt(s));var g=[l];if(!c){var v,y=t.text.length-2;if(0<y&&l)for(var b=0;b<l.length;++b)null==l[b].to&&(v=v||[]).push(new _t(l[b].marker,null,null));for(var w=0;w<y;++w)g.push(v);g.push(s)}return g}function Pt(e){for(var t=0;t<e.length;++t){var n=e[t];null!=n.from&&n.from==n.to&&!1!==n.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function Ft(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function It(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function jt(e){return e.inclusiveLeft?-1:0}function Wt(e){return e.inclusiveRight?1:0}function Ht(e,t){var n=e.lines.length-t.lines.length;if(0!=n)return n;var r=e.find(),i=t.find(),o=ct(r.from,i.from)||jt(e)-jt(t);if(o)return-o;var a=ct(r.to,i.to)||Wt(e)-Wt(t);return a||t.id-e.id}function Rt(e,t){var n,r=Nt&&e.markedSpans;if(r)for(var i=void 0,o=0;o<r.length;++o)(i=r[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!n||Ht(n,i.marker)<0)&&(n=i.marker);return n}function Bt(e){return Rt(e,!0)}function qt(e){return Rt(e,!1)}function Ut(e,t){var n,r=Nt&&e.markedSpans;if(r)for(var i=0;i<r.length;++i){var o=r[i];o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!n||Ht(n,o.marker)<0)&&(n=o.marker)}return n}function Kt(e,t,n,r,i){var o=et(e,t),a=Nt&&o.markedSpans;if(a)for(var l=0;l<a.length;++l){var s=a[l];if(s.marker.collapsed){var c=s.marker.find(0),u=ct(c.from,n)||jt(s.marker)-jt(i),d=ct(c.to,r)||Wt(s.marker)-Wt(i);if(!(0<=u&&d<=0||u<=0&&0<=d)&&(u<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?0<=ct(c.to,n):0<ct(c.to,n))||0<=u&&(s.marker.inclusiveRight&&i.inclusiveLeft?ct(c.from,r)<=0:ct(c.from,r)<0)))return!0}}}function Vt(e){for(var t;t=Bt(e);)e=t.find(-1,!0).line;return e}function Gt(e,t){var n=et(e,t),r=Vt(n);return n==r?t:it(r)}function $t(e,t){if(t>e.lastLine())return t;var n,r=et(e,t);if(!Yt(e,r))return t;for(;n=qt(r);)r=n.find(1,!0).line;return it(r)+1}function Yt(e,t){var n=Nt&&t.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i)if((r=n[i]).marker.collapsed){if(null==r.from)return!0;if(!r.marker.widgetNode&&0==r.from&&r.marker.inclusiveLeft&&Xt(e,t,r))return!0}}function Xt(e,t,n){if(null==n.to){var r=n.marker.find(1,!0);return Xt(e,r.line,Et(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if((i=t.markedSpans[o]).marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(null==i.to||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Xt(e,t,i))return!0}function Zt(e){for(var t=0,n=(e=Vt(e)).parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var o=n.parent;o;o=(n=o).parent)for(var a=0;a<o.children.length;++a){var l=o.children[a];if(l==n)break;t+=l.height}return t}function Jt(e){if(0==e.height)return 0;for(var t,n=e.text.length,r=e;t=Bt(r);){var i=t.find(0,!0);r=i.from.line,n+=i.from.ch-i.to.ch}for(r=e;t=qt(r);){var o=t.find(0,!0);n-=r.text.length-o.from.ch,n+=(r=o.to.line).text.length-o.to.ch}return n}function Qt(e){var n=e.display,t=e.doc;n.maxLine=et(t,t.first),n.maxLineLength=Jt(n.maxLine),n.maxLineChanged=!0,t.iter(function(e){var t=Jt(e);t>n.maxLineLength&&(n.maxLineLength=t,n.maxLine=e)})}var en=function(e,t,n){this.text=e,It(this,t),this.height=n?n(this):1};en.prototype.lineNo=function(){return it(this)},Me(en);var tn={},nn={};function rn(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?nn:tn;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function on(e,t){var n=O("span",null,null,b?"padding-right: .1px":null),r={pre:O("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,a=void 0;r.pos=0,r.addToken=ln,je(e.display.measure)&&(a=ye(o,e.doc.direction))&&(r.addToken=sn(r.addToken,a)),r.map=[],un(o,r,wt(e,o,t!=e.display.externalMeasured&&it(o))),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=D(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=D(o.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Ie(e.display.measure))),0==i?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(b){var l=r.content.lastChild;(/\bcm-tab\b/.test(l.className)||l.querySelector&&l.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Ce(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=D(r.pre.className,r.textClass||"")),r}function an(e){var t=N("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function ln(e,t,n,r,i,o,a){if(t){var l,s=e.splitSpaces?function(e,t){if(1<e.length&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!n||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),r+=o,n=" "==o}return r}(t,e.trailingSpace):t,c=e.cm.state.specialChars,u=!1;if(c.test(t)){l=document.createDocumentFragment();for(var d=0;;){c.lastIndex=d;var f=c.exec(t),h=f?f.index-d:t.length-d;if(h){var p=document.createTextNode(s.slice(d,d+h));x&&k<9?l.appendChild(N("span",[p])):l.appendChild(p),e.map.push(e.pos,e.pos+h,p),e.col+=h,e.pos+=h}if(!f)break;d+=1+h;var m=void 0;if("\t"==f[0]){var g=e.cm.options.tabSize,v=g-e.col%g;(m=l.appendChild(N("span",$(v),"cm-tab"))).setAttribute("role","presentation"),m.setAttribute("cm-text","\t"),e.col+=v}else"\r"==f[0]||"\n"==f[0]?(m=l.appendChild(N("span","\r"==f[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",f[0]):((m=e.cm.options.specialCharPlaceholder(f[0])).setAttribute("cm-text",f[0]),x&&k<9?l.appendChild(N("span",[m])):l.appendChild(m)),e.col+=1;e.map.push(e.pos,e.pos+1,m),e.pos++}}else e.col+=t.length,l=document.createTextNode(s),e.map.push(e.pos,e.pos+t.length,l),x&&k<9&&(u=!0),e.pos+=t.length;if(e.trailingSpace=32==s.charCodeAt(t.length-1),n||r||i||u||o){var y=n||"";r&&(y+=r),i&&(y+=i);var b=N("span",[l],y,o);if(a)for(var w in a)a.hasOwnProperty(w)&&"style"!=w&&"class"!=w&&b.setAttribute(w,a[w]);return e.content.appendChild(b)}e.content.appendChild(l)}}function sn(d,f){return function(e,t,n,r,i,o,a){n=n?n+" cm-force-border":"cm-force-border";for(var l=e.pos,s=l+t.length;;){for(var c=void 0,u=0;u<f.length&&!((c=f[u]).to>l&&c.from<=l);u++);if(c.to>=s)return d(e,t,n,r,i,o,a);d(e,t.slice(0,c.to-l),n,r,null,o,a),r=null,t=t.slice(c.to-l),l=c.to}}}function cn(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i=i||e.content.appendChild(document.createElement("span"))).setAttribute("cm-marker",n.id),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function un(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var a,l,s,c,u,d,f,h=i.length,p=0,m=1,g="",v=0;;){if(v==p){s=c=u=l="",d=f=null,v=1/0;for(var y=[],b=void 0,w=0;w<r.length;++w){var x=r[w],k=x.marker;if("bookmark"==k.type&&x.from==p&&k.widgetNode)y.push(k);else if(x.from<=p&&(null==x.to||x.to>p||k.collapsed&&x.to==p&&x.from==p)){if(null!=x.to&&x.to!=p&&v>x.to&&(v=x.to,c=""),k.className&&(s+=" "+k.className),k.css&&(l=(l?l+";":"")+k.css),k.startStyle&&x.from==p&&(u+=" "+k.startStyle),k.endStyle&&x.to==v&&(b=b||[]).push(k.endStyle,x.to),k.title&&((f=f||{}).title=k.title),k.attributes)for(var C in k.attributes)(f=f||{})[C]=k.attributes[C];k.collapsed&&(!d||Ht(d.marker,k)<0)&&(d=x)}else x.from>p&&v>x.from&&(v=x.from)}if(b)for(var T=0;T<b.length;T+=2)b[T+1]==v&&(c+=" "+b[T]);if(!d||d.from==p)for(var S=0;S<y.length;++S)cn(t,0,y[S]);if(d&&(d.from||0)==p){if(cn(t,(null==d.to?h+1:d.to)-p,d.marker,null==d.from),null==d.to)return;d.to==p&&(d=!1)}}if(h<=p)break;for(var L=Math.min(h,v);;){if(g){var M=p+g.length;if(!d){var A=L<M?g.slice(0,L-p):g;t.addToken(t,A,a?a+s:s,u,p+A.length==v?c:"",l,f)}if(L<=M){g=g.slice(L-p),p=L;break}p=M,u=""}g=i.slice(o,o=n[m++]),a=rn(n[m++],t.cm.options)}}else for(var O=1;O<n.length;O+=2)t.addToken(t,i.slice(o,o=n[O]),rn(n[O+1],t.cm.options))}function dn(e,t,n){this.line=t,this.rest=function(e){for(var t,n;t=qt(e);)e=t.find(1,!0).line,(n=n||[]).push(e);return n}(t),this.size=this.rest?it(Y(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Yt(e,t)}function fn(e,t,n){for(var r,i=[],o=t;o<n;o=r){var a=new dn(e.doc,et(e.doc,o),o);r=o+a.size,i.push(a)}return i}var hn=null;var pn=null;function mn(e,t){var n=xe(e,t);if(n.length){var r,i=Array.prototype.slice.call(arguments,2);hn?r=hn.delayedCallbacks:pn?r=pn:(r=pn=[],setTimeout(gn,0));for(var o=function(e){r.push(function(){return n[e].apply(null,i)})},a=0;a<n.length;++a)o(a)}}function gn(){var e=pn;pn=null;for(var t=0;t<e.length;++t)e[t]()}function vn(e,t,n,r){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?wn(e,t):"gutter"==o?kn(e,t,n,r):"class"==o?xn(e,t):"widget"==o&&Cn(e,t,r)}t.changes=null}function yn(e){return e.node==e.text&&(e.node=N("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),x&&k<8&&(e.node.style.zIndex=2)),e.node}function bn(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):on(e,t)}function wn(e,t){var n=t.text.className,r=bn(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,xn(e,t)):n&&(t.text.className=n)}function xn(e,t){!function(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=yn(t);t.background=r.insertBefore(N("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}(e,t),t.line.wrapClass?yn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function kn(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=yn(t);t.gutterBackground=N("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var a=yn(t),l=t.gutter=N("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(l),a.insertBefore(l,t.text),t.line.gutterClass&&(l.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=l.appendChild(N("div",lt(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var s=0;s<e.display.gutterSpecs.length;++s){var c=e.display.gutterSpecs[s].className,u=o.hasOwnProperty(c)&&o[c];u&&l.appendChild(N("div",[u],"CodeMirror-gutter-elt","left: "+r.gutterLeft[c]+"px; width: "+r.gutterWidth[c]+"px"))}}}function Cn(e,t,n){t.alignable&&(t.alignable=null);for(var r=T("CodeMirror-linewidget"),i=t.node.firstChild,o=void 0;i;i=o)o=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);Tn(e,t,n)}function Tn(e,t,n){if(Sn(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Sn(e,t.rest[r],t,n,!1)}function Sn(e,t,n,r,i){if(t.widgets)for(var o=yn(n),a=0,l=t.widgets;a<l.length;++a){var s=l[a],c=N("div",[s.node],"CodeMirror-linewidget"+(s.className?" "+s.className:""));s.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),Ln(s,c,n,r),e.display.input.setUneditable(c),i&&s.above?o.insertBefore(c,n.gutter||n.text):o.appendChild(c),mn(s,"redraw")}}function Ln(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function Mn(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!_(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),A(t.display.measure,N("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function An(e,t){for(var n=Ee(t);n!=e.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==e.sizer&&n!=e.mover)return!0}function On(e){return e.lineSpace.offsetTop}function Nn(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function _n(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=A(e.measure,N("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return isNaN(r.left)||isNaN(r.right)||(e.cachedPaddingH=r),r}function En(e){return R-e.display.nativeBarWidth}function zn(e){return e.display.scroller.clientWidth-En(e)-e.display.barWidth}function Dn(e){return e.display.scroller.clientHeight-En(e)-e.display.barHeight}function Pn(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(it(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Fn(e,t,n,r){return Wn(e,jn(e,t),n,r)}function In(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[pr(e,t)];var n=e.display.externalMeasured;return n&&t>=n.lineN&&t<n.lineN+n.size?n:void 0}function jn(e,t){var n=it(t),r=In(e,n);r&&!r.text?r=null:r&&r.changes&&(vn(e,r,n,cr(e)),e.curOp.forceUpdate=!0);var i=Pn(r=r||function(e,t){var n=it(t=Vt(t)),r=e.display.externalMeasured=new dn(e.doc,t,n);r.lineN=n;var i=r.built=on(e,r);return r.text=i.pre,A(e.display.lineMeasure,i.pre),r}(e,t),t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Wn(e,t,n,r,i){t.before&&(n=-1);var o,a=n+(r||"");return t.cache.hasOwnProperty(a)?o=t.cache[a]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(function(e,t,n){var r=e.options.lineWrapping,i=r&&zn(e);if(!t.measure.heights||r&&t.measure.width!=i){var o=t.measure.heights=[];if(r){t.measure.width=i;for(var a=t.text.firstChild.getClientRects(),l=0;l<a.length-1;l++){var s=a[l],c=a[l+1];2<Math.abs(s.bottom-c.bottom)&&o.push((s.bottom+c.top)/2-n.top)}}o.push(n.bottom-n.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,n,r){var i,o=Bn(t.map,n,r),a=o.node,l=o.start,s=o.end,c=o.collapse;if(3==a.nodeType){for(var u=0;u<4;u++){for(;l&&ie(t.line.text.charAt(o.coverStart+l));)--l;for(;o.coverStart+s<o.coverEnd&&ie(t.line.text.charAt(o.coverStart+s));)++s;if((i=x&&k<9&&0==l&&s==o.coverEnd-o.coverStart?a.parentNode.getBoundingClientRect():qn(S(a,l,s).getClientRects(),r)).left||i.right||0==l)break;s=l,l-=1,c="right"}x&&k<11&&(i=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=qe)return qe;var t=A(e,N("span","x")),n=t.getBoundingClientRect(),r=S(t,0,1).getBoundingClientRect();return qe=1<Math.abs(n.left-r.left)}(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}(e.display.measure,i))}else{var d;0<l&&(c=r="right"),i=e.options.lineWrapping&&1<(d=a.getClientRects()).length?d["right"==r?d.length-1:0]:a.getBoundingClientRect()}if(x&&k<9&&!l&&(!i||!i.left&&!i.right)){var f=a.parentNode.getClientRects()[0];i=f?{left:f.left,right:f.left+sr(e.display),top:f.top,bottom:f.bottom}:Rn}for(var h=i.top-t.rect.top,p=i.bottom-t.rect.top,m=(h+p)/2,g=t.view.measure.heights,v=0;v<g.length-1&&!(m<g[v]);v++);var y=v?g[v-1]:0,b=g[v],w={left:("right"==c?i.right:i.left)-t.rect.left,right:("left"==c?i.left:i.right)-t.rect.left,top:y,bottom:b};i.left||i.right||(w.bogus=!0);e.options.singleCursorHeightPerLine||(w.rtop=h,w.rbottom=p);return w}(e,t,n,r)).bogus||(t.cache[a]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var Hn,Rn={left:0,right:0,top:0,bottom:0};function Bn(e,t,n){for(var r,i,o,a,l,s,c=0;c<e.length;c+=3)if(l=e[c],s=e[c+1],t<l?(i=0,o=1,a="left"):t<s?o=(i=t-l)+1:(c==e.length-3||t==s&&e[c+3]>t)&&(i=(o=s-l)-1,s<=t&&(a="right")),null!=i){if(r=e[c+2],l==s&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;c&&e[c-2]==e[c-3]&&e[c-1].insertLeft;)r=e[2+(c-=3)],a="left";if("right"==n&&i==s-l)for(;c<e.length-3&&e[c+3]==e[c+4]&&!e[c+5].insertLeft;)r=e[(c+=3)+2],a="right";break}return{node:r,start:i,end:o,collapse:a,coverStart:l,coverEnd:s}}function qn(e,t){var n=Rn;if("left"==t)for(var r=0;r<e.length&&(n=e[r]).left==n.right;r++);else for(var i=e.length-1;0<=i&&(n=e[i]).left==n.right;i--);return n}function Un(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function Kn(e){e.display.externalMeasure=null,M(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Un(e.display.view[t])}function Vn(e){Kn(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Gn(){return a&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function $n(){return a&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Yn(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=Mn(e.widgets[n]));return t}function Xn(e,t,n,r,i){if(!i){var o=Yn(t);n.top+=o,n.bottom+=o}if("line"==r)return n;r=r||"local";var a=Zt(t);if("local"==r?a+=On(e.display):a-=e.display.viewOffset,"page"==r||"window"==r){var l=e.display.lineSpace.getBoundingClientRect();a+=l.top+("window"==r?0:$n());var s=l.left+("window"==r?0:Gn());n.left+=s,n.right+=s}return n.top+=a,n.bottom+=a,n}function Zn(e,t,n){if("div"==n)return t;var r=t.left,i=t.top;if("page"==n)r-=Gn(),i-=$n();else if("local"==n||!n){var o=e.display.sizer.getBoundingClientRect();r+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:r-a.left,top:i-a.top}}function Jn(e,t,n,r,i){return Xn(e,r=r||et(e.doc,t.line),Fn(e,r,t.ch,i),n)}function Qn(r,e,i,o,a,l){function s(e,t){var n=Wn(r,a,e,t?"right":"left",l);return t?n.left=n.right:n.right=n.left,Xn(r,o,n,i)}o=o||et(r.doc,e.line),a=a||jn(r,o);var c=ye(o,r.doc.direction),t=e.ch,n=e.sticky;if(t>=o.text.length?(t=o.text.length,n="before"):t<=0&&(t=0,n="after"),!c)return s("before"==n?t-1:t,"before"==n);function u(e,t,n){return s(n?e-1:e,1==c[t].level!=n)}var d=se(c,t,n),f=le,h=u(t,d,"before"==n);return null!=f&&(h.other=u(t,f,"before"!=n)),h}function er(e,t){var n=0;t=mt(e.doc,t),e.options.lineWrapping||(n=sr(e.display)*t.ch);var r=et(e.doc,t.line),i=Zt(r)+On(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function tr(e,t,n,r,i){var o=st(e,t,n);return o.xRel=i,r&&(o.outside=r),o}function nr(e,t,n){var r=e.doc;if((n+=e.display.viewOffset)<0)return tr(r.first,0,null,-1,-1);var i=ot(r,n),o=r.first+r.size-1;if(o<i)return tr(r.first+r.size-1,et(r,o).text.length,null,1,1);t<0&&(t=0);for(var a=et(r,i);;){var l=ar(e,a,i,t,n),s=Ut(a,l.ch+(0<l.xRel||0<l.outside?1:0));if(!s)return l;var c=s.find(1);if(c.line==i)return c;a=et(r,i=c.line)}}function rr(t,e,n,r){r-=Yn(e);var i=e.text.length,o=ae(function(e){return Wn(t,n,e-1).bottom<=r},i,0);return{begin:o,end:i=ae(function(e){return Wn(t,n,e).top>r},o,i)}}function ir(e,t,n,r){return rr(e,t,n=n||jn(e,t),Xn(e,t,Wn(e,n,r),"line").top)}function or(e,t,n,r){return!(e.bottom<=n)&&(e.top>n||(r?e.left:e.right)>t)}function ar(n,e,t,r,i){i-=Zt(e);var o=jn(n,e),a=Yn(e),l=0,s=e.text.length,c=!0,u=ye(e,n.doc.direction);if(u){var d=(n.options.lineWrapping?function(e,t,n,r,i,o,a){var l=rr(e,t,r,a),s=l.begin,c=l.end;/\s/.test(t.text.charAt(c-1))&&c--;for(var u=null,d=null,f=0;f<i.length;f++){var h=i[f];if(!(h.from>=c||h.to<=s)){var p=1!=h.level,m=Wn(e,r,p?Math.min(c,h.to)-1:Math.max(s,h.from)).right,g=m<o?o-m+1e9:m-o;(!u||g<d)&&(u=h,d=g)}}u=u||i[i.length-1];u.from<s&&(u={from:s,to:u.to,level:u.level});u.to>c&&(u={from:u.from,to:c,level:u.level});return u}:function(r,i,o,a,l,s,c){var e=ae(function(e){var t=l[e],n=1!=t.level;return or(Qn(r,st(o,n?t.to:t.from,n?"before":"after"),"line",i,a),s,c,!0)},0,l.length-1),t=l[e];if(0<e){var n=1!=t.level,u=Qn(r,st(o,n?t.from:t.to,n?"after":"before"),"line",i,a);or(u,s,c,!0)&&u.top>c&&(t=l[e-1])}return t})(n,e,t,o,u,r,i);l=(c=1!=d.level)?d.from:d.to-1,s=c?d.to:d.from-1}var f,h,p=null,m=null,g=ae(function(e){var t=Wn(n,o,e);return t.top+=a,t.bottom+=a,!!or(t,r,i,!1)&&(t.top<=i&&t.left<=r&&(p=e,m=t),!0)},l,s),v=!1;if(m){var y=r-m.left<m.right-r,b=y==c;g=p+(b?0:1),h=b?"after":"before",f=y?m.left:m.right}else{c||g!=s&&g!=l||g++,h=0==g?"after":g==e.text.length?"before":Wn(n,o,g-(c?1:0)).bottom+a<=i==c?"after":"before";var w=Qn(n,st(t,g,h),"line",e,o);f=w.left,v=i<w.top?-1:i>=w.bottom?1:0}return tr(t,g=oe(e.text,g,1),h,v,r-f)}function lr(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Hn){Hn=N("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Hn.appendChild(document.createTextNode("x")),Hn.appendChild(N("br"));Hn.appendChild(document.createTextNode("x"))}A(e.measure,Hn);var n=Hn.offsetHeight/50;return 3<n&&(e.cachedTextHeight=n),M(e.measure),n||1}function sr(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=N("span","xxxxxxxxxx"),n=N("pre",[t],"CodeMirror-line-like");A(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return 2<i&&(e.cachedCharWidth=i),i||10}function cr(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var l=e.display.gutterSpecs[a].className;n[l]=o.offsetLeft+o.clientLeft+i,r[l]=o.clientWidth}return{fixedPos:ur(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function ur(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function dr(r){var i=lr(r.display),o=r.options.lineWrapping,a=o&&Math.max(5,r.display.scroller.clientWidth/sr(r.display)-3);return function(e){if(Yt(r.doc,e))return 0;var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;n++)e.widgets[n].height&&(t+=e.widgets[n].height);return o?t+(Math.ceil(e.text.length/a)||1)*i:t+i}}function fr(e){var t=e.doc,n=dr(e);t.iter(function(e){var t=n(e);t!=e.height&&rt(e,t)})}function hr(e,t,n,r){var i=e.display;if(!n&&"true"==Ee(t).getAttribute("cm-not-content"))return null;var o,a,l=i.lineSpace.getBoundingClientRect();try{o=t.clientX-l.left,a=t.clientY-l.top}catch(t){return null}var s,c=nr(e,o,a);if(r&&0<c.xRel&&(s=et(e.doc,c.line).text).length==c.ch){var u=j(s,s.length,e.options.tabSize)-s.length;c=st(c.line,Math.max(0,Math.round((o-_n(e.display).left)/sr(e.display))-u))}return c}function pr(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if((t-=n[r].size)<0)return r}function mr(e,t,n,r){null==t&&(t=e.doc.first),null==n&&(n=e.doc.first+e.doc.size),r=r||0;var i=e.display;if(r&&n<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Nt&&Gt(e.doc,t)<i.viewTo&&vr(e);else if(n<=i.viewFrom)Nt&&$t(e.doc,n+r)>i.viewFrom?vr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)vr(e);else if(t<=i.viewFrom){var o=yr(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):vr(e)}else if(n>=i.viewTo){var a=yr(e,t,t,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):vr(e)}else{var l=yr(e,t,t,-1),s=yr(e,n,n+r,1);l&&s?(i.view=i.view.slice(0,l.index).concat(fn(e,l.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=r):vr(e)}var c=i.externalMeasured;c&&(n<c.lineN?c.lineN+=r:t<c.lineN+c.size&&(i.externalMeasured=null))}function gr(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),!(t<r.viewFrom||t>=r.viewTo)){var o=r.view[pr(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==H(a,n)&&a.push(n)}}}function vr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function yr(e,t,n,r){var i,o=pr(e,t),a=e.display.view;if(!Nt||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var l=e.display.viewFrom,s=0;s<o;s++)l+=a[s].size;if(l!=t){if(0<r){if(o==a.length-1)return null;i=l+a[o].size-t,o++}else i=l-t;t+=i,n+=i}for(;Gt(e.doc,n)!=n;){if(o==(r<0?0:a.length-1))return null;n+=r*a[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function br(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];i.hidden||i.node&&!i.changes||++n}return n}function wr(e){e.display.input.showSelection(e.display.input.prepareSelection())}function xr(e,t){void 0===t&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),o=r.selection=document.createDocumentFragment(),a=0;a<n.sel.ranges.length;a++)if(t||a!=n.sel.primIndex){var l=n.sel.ranges[a];if(!(l.from().line>=e.display.viewTo||l.to().line<e.display.viewFrom)){var s=l.empty();(s||e.options.showCursorWhenSelecting)&&kr(e,l.head,i),s||Tr(e,l,o)}}return r}function kr(e,t,n){var r=Qn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(N("div"," ","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var o=n.appendChild(N("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=r.other.left+"px",o.style.top=r.other.top+"px",o.style.height=.85*(r.other.bottom-r.other.top)+"px"}}function Cr(e,t){return e.top-t.top||e.left-t.left}function Tr(a,e,t){var n=a.display,r=a.doc,i=document.createDocumentFragment(),o=_n(a.display),L=o.left,M=Math.max(n.sizerWidth,zn(a)-n.sizer.offsetLeft)-o.right,A="ltr"==r.direction;function O(e,t,n,r){t<0&&(t=0),t=Math.round(t),r=Math.round(r),i.appendChild(N("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==n?M-e:n)+"px;\n height: "+(r-t)+"px"))}function l(n,y,b){var w,x,o=et(r,n),k=o.text.length;function C(e,t){return Jn(a,st(n,e),"div",o,t)}function T(e,t,n){var r=ir(a,o,null,e),i="ltr"==t==("after"==n)?"left":"right";return C("after"==n?r.begin:r.end-(/\s/.test(o.text.charAt(r.end-1))?2:1),i)[i]}var S=ye(o,r.direction);return function(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var a=e[o];(a.from<n&&a.to>t||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),1==a.level?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}(S,y||0,null==b?k:b,function(e,t,n,r){var i="ltr"==n,o=C(e,i?"left":"right"),a=C(t-1,i?"right":"left"),l=null==y&&0==e,s=null==b&&t==k,c=0==r,u=!S||r==S.length-1;if(a.top-o.top<=3){var d=(A?s:l)&&u,f=(A?l:s)&&c?L:(i?o:a).left,h=d?M:(i?a:o).right;O(f,o.top,h-f,o.bottom)}else{var p,m,g,v;v=i?(p=A&&l&&c?L:o.left,m=A?M:T(e,n,"before"),g=A?L:T(t,n,"after"),A&&s&&u?M:a.right):(p=A?T(e,n,"before"):L,m=!A&&l&&c?M:o.right,g=!A&&s&&u?L:a.left,A?T(t,n,"after"):M),O(p,o.top,m-p,o.bottom),o.bottom<a.top&&O(L,o.bottom,null,a.top),O(g,a.top,v-g,a.bottom)}(!w||Cr(o,w)<0)&&(w=o),Cr(a,w)<0&&(w=a),(!x||Cr(o,x)<0)&&(x=o),Cr(a,x)<0&&(x=a)}),{start:w,end:x}}var s=e.from(),c=e.to();if(s.line==c.line)l(s.line,s.ch,c.ch);else{var u=et(r,s.line),d=et(r,c.line),f=Vt(u)==Vt(d),h=l(s.line,s.ch,f?u.text.length+1:null).end,p=l(c.line,f?0:null,c.ch).start;f&&(h.top<p.top-2?(O(h.right,h.top,null,h.bottom),O(L,p.top,p.left,p.bottom)):O(h.right,h.top,p.left-h.right,h.bottom)),h.bottom<p.top&&O(L,h.bottom,null,p.top)}t.appendChild(i)}function Sr(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",0<e.options.cursorBlinkRate?t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Lr(e){e.state.focused||(e.display.input.focus(),Ar(e))}function Mr(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Or(e))},100)}function Ar(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(Ce(e,"focus",e,t),e.state.focused=!0,z(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),b&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sr(e))}function Or(e,t){e.state.delayingBlurEvent||(e.state.focused&&(Ce(e,"blur",e,t),e.state.focused=!1,L(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Nr(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],o=e.options.lineWrapping,a=void 0,l=0;if(!i.hidden){if(x&&k<8){var s=i.node.offsetTop+i.node.offsetHeight;a=s-n,n=s}else{var c=i.node.getBoundingClientRect();a=c.bottom-c.top,!o&&i.text.firstChild&&(l=i.text.firstChild.getBoundingClientRect().right-c.left-1)}var u=i.line.height-a;if((.005<u||u<-.005)&&(rt(i.line,a),_r(i.line),i.rest))for(var d=0;d<i.rest.length;d++)_r(i.rest[d]);if(l>e.display.sizerWidth){var f=Math.ceil(l/sr(e.display));f>e.display.maxLineLength&&(e.display.maxLineLength=f,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}}function _r(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Er(e,t,n){var r=n&&null!=n.top?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-On(e));var i=n&&null!=n.bottom?n.bottom:r+e.wrapper.clientHeight,o=ot(t,r),a=ot(t,i);if(n&&n.ensure){var l=n.ensure.from.line,s=n.ensure.to.line;l<o?a=ot(t,Zt(et(t,o=l))+e.wrapper.clientHeight):Math.min(s,t.lastLine())>=a&&(o=ot(t,Zt(et(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function zr(e,t){var n=e.display,r=lr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:n.scroller.scrollTop,o=Dn(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var l=e.doc.height+Nn(n),s=t.top<r,c=t.bottom>l-r;if(t.top<i)a.scrollTop=s?0:t.top;else if(t.bottom>i+o){var u=Math.min(t.top,(c?l:t.bottom)-o);u!=i&&(a.scrollTop=u)}var d=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft,f=zn(e)-(e.options.fixedGutter?n.gutters.offsetWidth:0),h=t.right-t.left>f;return h&&(t.right=t.left+f),t.left<10?a.scrollLeft=0:t.left<d?a.scrollLeft=Math.max(0,t.left-(h?0:10)):t.right>f+d-3&&(a.scrollLeft=t.right+(h?0:10)-f),a}function Dr(e,t){null!=t&&(Ir(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Pr(e){Ir(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Fr(e,t,n){null==t&&null==n||Ir(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function Ir(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,jr(e,er(e,t.from),er(e,t.to),t.margin))}function jr(e,t,n,r){var i=zr(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});Fr(e,i.scrollLeft,i.scrollTop)}function Wr(e,t){Math.abs(e.doc.scrollTop-t)<2||(m||di(e,{top:t}),Hr(e,t,!0),m&&di(e),ai(e,100))}function Hr(e,t,n){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),e.display.scroller.scrollTop==t&&!n||(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Rr(e,t,n,r){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r||(e.doc.scrollLeft=t,pi(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Br(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Nn(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+En(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}function qr(e,t,n){this.cm=n;var r=this.vert=N("div",[N("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=N("div",[N("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),we(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),we(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,x&&k<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}qr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&0<e.clientHeight&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},qr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},qr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},qr.prototype.zeroWidthHack=function(){var e=w&&!l?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new W,this.disableVert=new W},qr.prototype.enableZeroWidthBar=function(n,r,i){n.style.pointerEvents="auto",r.set(1e3,function e(){var t=n.getBoundingClientRect();("vert"==i?document.elementFromPoint(t.right-1,(t.top+t.bottom)/2):document.elementFromPoint((t.right+t.left)/2,t.bottom-1))!=n?n.style.pointerEvents="none":r.set(1e3,e)})},qr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};function Ur(){}function Kr(e,t){t=t||Br(e);var n=e.display.barWidth,r=e.display.barHeight;Vr(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Nr(e),Vr(e,Br(e)),n=e.display.barWidth,r=e.display.barHeight}function Vr(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}Ur.prototype.update=function(){return{bottom:0,right:0}},Ur.prototype.setScrollLeft=function(){},Ur.prototype.setScrollTop=function(){},Ur.prototype.clear=function(){};var Gr={native:qr,null:Ur};function $r(n){n.display.scrollbars&&(n.display.scrollbars.clear(),n.display.scrollbars.addClass&&L(n.display.wrapper,n.display.scrollbars.addClass)),n.display.scrollbars=new Gr[n.options.scrollbarStyle](function(e){n.display.wrapper.insertBefore(e,n.display.scrollbarFiller),we(e,"mousedown",function(){n.state.focused&&setTimeout(function(){return n.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,t){"horizontal"==t?Rr(n,e):Wr(n,e)},n),n.display.scrollbars.addClass&&z(n.display.wrapper,n.display.scrollbars.addClass)}var Yr=0;function Xr(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Yr},function(e){hn?hn.ops.push(e):e.ownsGroup=hn={ops:[e],delayedCallbacks:[]}}(e.curOp)}function Zr(e){var t=e.curOp;t&&function(e,t){var n=e.ownsGroup;if(n)try{!function(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}(n)}finally{hn=null,t(n)}}(t,function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;!function(e){for(var t=e.ops,n=0;n<t.length;n++)Jr(t[n]);for(var r=0;r<t.length;r++)(i=t[r]).updatedDisplay=i.mustUpdate&&ci(i.cm,i.update);var i;for(var o=0;o<t.length;o++)Qr(t[o]);for(var a=0;a<t.length;a++)ei(t[a]);for(var l=0;l<t.length;l++)ti(t[l])}(e)})}function Jr(e){var t=e.cm,n=t.display;!function(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=En(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=En(e)+"px",t.scrollbarsClipped=!0)}(t),e.updateMaxLine&&Qt(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new si(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Qr(e){var t=e.cm,n=t.display;e.updatedDisplay&&Nr(t),e.barMeasure=Br(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Fn(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+En(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-zn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function ei(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Rr(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==E();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),!e.updatedDisplay&&e.startHeight==t.doc.height||Kr(t,e.barMeasure),e.updatedDisplay&&hi(t,e.barMeasure),e.selectionChanged&&Sr(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&Lr(e.cm)}function ti(e){var t=e.cm,n=t.display,r=t.doc;e.updatedDisplay&&ui(t,e.update),null==n.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(n.wheelStartX=n.wheelStartY=null),null!=e.scrollTop&&Hr(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&Rr(t,e.scrollLeft,!0,!0),e.scrollToPos&&function(e,t){if(!Te(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!c){var o=N("div","​",null,"position: absolute;\n top: "+(t.top-n.viewOffset-On(e.display))+"px;\n height: "+(t.bottom-t.top+En(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}(t,function(e,t,n,r){var i;null==r&&(r=0),e.options.lineWrapping||t!=n||(n="before"==(t=t.ch?st(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?st(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var a=!1,l=Qn(e,t),s=n&&n!=t?Qn(e,n):l,c=zr(e,i={left:Math.min(l.left,s.left),top:Math.min(l.top,s.top)-r,right:Math.max(l.left,s.left),bottom:Math.max(l.bottom,s.bottom)+r}),u=e.doc.scrollTop,d=e.doc.scrollLeft;if(null!=c.scrollTop&&(Wr(e,c.scrollTop),1<Math.abs(e.doc.scrollTop-u)&&(a=!0)),null!=c.scrollLeft&&(Rr(e,c.scrollLeft),1<Math.abs(e.doc.scrollLeft-d)&&(a=!0)),!a)break}return i}(t,mt(r,e.scrollToPos.from),mt(r,e.scrollToPos.to),e.scrollToPos.margin));var i=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(i)for(var a=0;a<i.length;++a)i[a].lines.length||Ce(i[a],"hide");if(o)for(var l=0;l<o.length;++l)o[l].lines.length&&Ce(o[l],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Ce(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function ni(e,t){if(e.curOp)return t();Xr(e);try{return t()}finally{Zr(e)}}function ri(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Xr(e);try{return t.apply(e,arguments)}finally{Zr(e)}}}function ii(e){return function(){if(this.curOp)return e.apply(this,arguments);Xr(this);try{return e.apply(this,arguments)}finally{Zr(this)}}}function oi(t){return function(){var e=this.cm;if(!e||e.curOp)return t.apply(this,arguments);Xr(e);try{return t.apply(this,arguments)}finally{Zr(e)}}}function ai(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,F(li,e))}function li(s){var c=s.doc;if(!(c.highlightFrontier>=s.display.viewTo)){var u=+new Date+s.options.workTime,d=xt(s,c.highlightFrontier),f=[];c.iter(d.line,Math.min(c.first+c.size,s.display.viewTo+500),function(e){if(d.line>=s.display.viewFrom){var t=e.styles,n=e.text.length>s.options.maxHighlightLength?Xe(c.mode,d.state):null,r=bt(s,e,d,!0);n&&(d.state=n),e.styles=r.styles;var i=e.styleClasses,o=r.classes;o?e.styleClasses=o:i&&(e.styleClasses=null);for(var a=!t||t.length!=e.styles.length||i!=o&&(!i||!o||i.bgClass!=o.bgClass||i.textClass!=o.textClass),l=0;!a&&l<t.length;++l)a=t[l]!=e.styles[l];a&&f.push(d.line),e.stateAfter=d.save(),d.nextLine()}else e.text.length<=s.options.maxHighlightLength&&kt(s,e.text,d),e.stateAfter=d.line%5==0?d.save():null,d.nextLine();if(+new Date>u)return ai(s,s.options.workDelay),!0}),c.highlightFrontier=d.line,c.modeFrontier=Math.max(c.modeFrontier,d.line),f.length&&ni(s,function(){for(var e=0;e<f.length;e++)gr(s,f[e],"text")})}}var si=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Er(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=zn(e),this.force=n,this.dims=cr(e),this.events=[]};function ci(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return vr(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==br(e))return!1;mi(e)&&(vr(e),t.dims=cr(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<o&&o-n.viewFrom<20&&(o=Math.max(r.first,n.viewFrom)),n.viewTo>a&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),Nt&&(o=Gt(e.doc,o),a=$t(e.doc,a));var l=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;!function(e,t,n){var r=e.display;0==r.view.length||t>=r.viewTo||n<=r.viewFrom?(r.view=fn(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=fn(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(pr(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(fn(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,pr(e,n)))),r.viewTo=n}(e,o,a),n.viewOffset=Zt(et(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var s=br(e);if(!l&&0==s&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var c=function(e){if(e.hasFocus())return null;var t=E();if(!t||!_(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&_(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}(e);return 4<s&&(n.lineDiv.style.display="none"),function(n,e,t){var r=n.display,i=n.options.lineNumbers,o=r.lineDiv,a=o.firstChild;function l(e){var t=e.nextSibling;return b&&w&&n.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),t}for(var s=r.view,c=r.viewFrom,u=0;u<s.length;u++){var d=s[u];if(d.hidden);else if(d.node&&d.node.parentNode==o){for(;a!=d.node;)a=l(a);var f=i&&null!=e&&e<=c&&d.lineNumber;d.changes&&(-1<H(d.changes,"gutter")&&(f=!1),vn(n,d,c,t)),f&&(M(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(lt(n.options,c)))),a=d.node.nextSibling}else{var h=(g=c,v=t,void 0,y=bn(p=n,m=d),m.text=m.node=y.pre,y.bgClass&&(m.bgClass=y.bgClass),y.textClass&&(m.textClass=y.textClass),xn(p,m),kn(p,m,g,v),Tn(p,m,v),m.node);o.insertBefore(h,a)}c+=d.size}var p,m,g,v,y;for(;a;)a=l(a)}(e,n.updateLineNumbers,t.dims),4<s&&(n.lineDiv.style.display=""),n.renderedView=n.view,function(e){if(e&&e.activeElt&&e.activeElt!=E()&&(e.activeElt.focus(),e.anchorNode&&_(document.body,e.anchorNode)&&_(document.body,e.focusNode))){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}(c),M(n.cursorDiv),M(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,l&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ai(e,400)),!(n.updateLineNumbers=null)}function ui(e,t){for(var n=t.viewport,r=!0;(r&&e.options.lineWrapping&&t.oldDisplayWidth!=zn(e)||(n&&null!=n.top&&(n={top:Math.min(e.doc.height+Nn(e.display)-Dn(e),n.top)}),t.visible=Er(e.display,e.doc,n),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&ci(e,t);r=!1){Nr(e);var i=Br(e);wr(e),Kr(e,i),hi(e,i),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function di(e,t){var n=new si(e,t);if(ci(e,n)){Nr(e),ui(e,n);var r=Br(e);wr(e),Kr(e,r),hi(e,r),n.finish()}}function fi(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function hi(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+En(e)+"px"}function pi(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=ur(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;a<n.length;a++)if(!n[a].hidden){e.options.fixedGutter&&(n[a].gutter&&(n[a].gutter.style.left=o),n[a].gutterBackground&&(n[a].gutterBackground.style.left=o));var l=n[a].alignable;if(l)for(var s=0;s<l.length;s++)l[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}}function mi(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=lt(e.options,t.first+t.size-1),r=e.display;if(n.length==r.lineNumChars)return!1;var i=r.measure.appendChild(N("div",[N("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(o,r.lineGutter.offsetWidth-a)+1,r.lineNumWidth=r.lineNumInnerWidth+a,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",fi(e.display),!0}function gi(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var o=e[i],a=null;if("string"!=typeof o&&(a=o.style,o=o.className),"CodeMirror-linenumbers"==o){if(!t)continue;r=!0}n.push({className:o,style:a})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function vi(e){var t=e.gutters,n=e.gutterSpecs;M(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],o=i.className,a=i.style,l=t.appendChild(N("div",null,"CodeMirror-gutter "+o));a&&(l.style.cssText=a),"CodeMirror-linenumbers"==o&&((e.lineGutter=l).style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",fi(e)}function yi(e){vi(e.display),mr(e),pi(e)}function bi(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=N("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=N("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=O("div",null,"CodeMirror-code"),i.selectionDiv=N("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=N("div",null,"CodeMirror-cursors"),i.measure=N("div",null,"CodeMirror-measure"),i.lineMeasure=N("div",null,"CodeMirror-measure"),i.lineSpace=O("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var o=O("div",[i.lineSpace],"CodeMirror-lines");i.mover=N("div",[o],null,"position: relative"),i.sizer=N("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=N("div",null,null,"position: absolute; height: "+R+"px; width: 1px;"),i.gutters=N("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=N("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=N("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),x&&k<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),b||m&&f||(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=gi(r.gutters,r.lineNumbers),vi(i),n.init(i)}si.prototype.signal=function(e,t){Le(e,t)&&this.events.push(arguments)},si.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Ce.apply(null,this.events[e])};var wi=0,xi=null;function ki(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta),{x:t,y:n}}function Ci(e){var t=ki(e);return t.x*=xi,t.y*=xi,t}function Ti(e,t){var n=ki(t),r=n.x,i=n.y,o=e.display,a=o.scroller,l=a.scrollWidth>a.clientWidth,s=a.scrollHeight>a.clientHeight;if(r&&l||i&&s){if(i&&w&&b)e:for(var c=t.target,u=o.view;c!=a;c=c.parentNode)for(var d=0;d<u.length;d++)if(u[d].node==c){e.display.currentWheelTarget=c;break e}if(r&&!m&&!g&&null!=xi)return i&&s&&Wr(e,Math.max(0,a.scrollTop+i*xi)),Rr(e,Math.max(0,a.scrollLeft+r*xi)),(!i||i&&s)&&Ae(t),void(o.wheelStartX=null);if(i&&null!=xi){var f=i*xi,h=e.doc.scrollTop,p=h+o.wrapper.clientHeight;f<0?h=Math.max(0,h+f-50):p=Math.min(e.doc.height,p+f+50),di(e,{top:h,bottom:p})}wi<20&&(null==o.wheelStartX?(o.wheelStartX=a.scrollLeft,o.wheelStartY=a.scrollTop,o.wheelDX=r,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=a.scrollLeft-o.wheelStartX,t=a.scrollTop-o.wheelStartY,n=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,n&&(xi=(xi*wi+n)/(wi+1),++wi)}},200)):(o.wheelDX+=r,o.wheelDY+=i))}}x?xi=-.53:m?xi=15:a?xi=-.7:s&&(xi=-1/3);var Si=function(e,t){this.ranges=e,this.primIndex=t};Si.prototype.primary=function(){return this.ranges[this.primIndex]},Si.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!ut(n.anchor,r.anchor)||!ut(n.head,r.head))return!1}return!0},Si.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Li(dt(this.ranges[t].anchor),dt(this.ranges[t].head));return new Si(e,this.primIndex)},Si.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Si.prototype.contains=function(e,t){t=t||e;for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(0<=ct(t,r.from())&&ct(e,r.to())<=0)return n}return-1};var Li=function(e,t){this.anchor=e,this.head=t};function Mi(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(e,t){return ct(e.from(),t.from())}),n=H(t,i);for(var o=1;o<t.length;o++){var a=t[o],l=t[o-1],s=ct(l.to(),a.from());if(r&&!a.empty()?0<s:0<=s){var c=ht(l.from(),a.from()),u=ft(l.to(),a.to()),d=l.empty()?a.from()==a.head:l.from()==l.head;o<=n&&--n,t.splice(--o,2,new Li(d?u:c,d?c:u))}}return new Si(t,n)}function Ai(e,t){return new Si([new Li(e,t||e)],0)}function Oi(e){return e.text?st(e.from.line+e.text.length-1,Y(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Ni(e,t){if(ct(e,t.from)<0)return e;if(ct(e,t.to)<=0)return Oi(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Oi(t).ch-t.to.ch),st(n,r)}function _i(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new Li(Ni(i.anchor,t),Ni(i.head,t)))}return Mi(e.cm,n,e.sel.primIndex)}function Ei(e,t,n){return e.line==t.line?st(n.line,e.ch-t.ch+n.ch):st(n.line+(e.line-t.line),e.ch)}function zi(e){e.doc.mode=Ge(e.options,e.doc.modeOption),Di(e)}function Di(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,ai(e,100),e.state.modeGen++,e.curOp&&mr(e)}function Pi(e,t){return 0==t.from.ch&&0==t.to.ch&&""==Y(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Fi(e,r,t,i){function o(e){return t?t[e]:null}function n(e,t,n){!function(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Ft(e),It(e,n);var i=r?r(e):1;i!=e.height&&rt(e,i)}(e,t,n,i),mn(e,"change",e,r)}function a(e,t){for(var n=[],r=e;r<t;++r)n.push(new en(c[r],o(r),i));return n}var l=r.from,s=r.to,c=r.text,u=et(e,l.line),d=et(e,s.line),f=Y(c),h=o(c.length-1),p=s.line-l.line;if(r.full)e.insert(0,a(0,c.length)),e.remove(c.length,e.size-c.length);else if(Pi(e,r)){var m=a(0,c.length-1);n(d,d.text,h),p&&e.remove(l.line,p),m.length&&e.insert(l.line,m)}else if(u==d)if(1==c.length)n(u,u.text.slice(0,l.ch)+f+u.text.slice(s.ch),h);else{var g=a(1,c.length-1);g.push(new en(f+u.text.slice(s.ch),h,i)),n(u,u.text.slice(0,l.ch)+c[0],o(0)),e.insert(l.line+1,g)}else if(1==c.length)n(u,u.text.slice(0,l.ch)+c[0]+d.text.slice(s.ch),o(0)),e.remove(l.line+1,p);else{n(u,u.text.slice(0,l.ch)+c[0],o(0)),n(d,f+d.text.slice(s.ch),h);var v=a(1,c.length-1);1<p&&e.remove(l.line+1,p-1),e.insert(l.line+1,v)}mn(e,"change",e,r)}function Ii(e,l,s){!function e(t,n,r){if(t.linked)for(var i=0;i<t.linked.length;++i){var o=t.linked[i];if(o.doc!=n){var a=r&&o.sharedHist;s&&!a||(l(o.doc,a),e(o.doc,t,a))}}}(e,null,!0)}function ji(e,t){if(t.cm)throw new Error("This document is already in use.");fr((e.doc=t).cm=e),zi(e),Wi(e),e.options.lineWrapping||Qt(e),e.options.mode=t.modeOption,mr(e)}function Wi(e){("rtl"==e.doc.direction?z:L)(e.display.lineDiv,"CodeMirror-rtl")}function Hi(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ri(e,t){var n={from:dt(t.from),to:Oi(t),text:tt(e,t.from,t.to)};return Vi(e,n,t.from.line,t.to.line+1),Ii(e,function(e){return Vi(e,n,t.from.line,t.to.line+1)},!0),n}function Bi(e){for(;e.length;){if(!Y(e).ranges)break;e.pop()}}function qi(e,t,n,r){var i=e.history;i.undone.length=0;var o,a,l=+new Date;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastModTime>l-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=function(e,t){return t?(Bi(e.done),Y(e.done)):e.done.length&&!Y(e.done).ranges?Y(e.done):1<e.done.length&&!e.done[e.done.length-2].ranges?(e.done.pop(),Y(e.done)):void 0}(i,i.lastOp==r)))a=Y(o.changes),0==ct(t.from,t.to)&&0==ct(t.from,a.to)?a.to=Oi(t):o.changes.push(Ri(e,t));else{var s=Y(i.done);for(s&&s.ranges||Ki(e.sel,i.done),o={changes:[Ri(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=l,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,a||Ce(e,"historyAdded")}function Ui(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||function(e,t,n,r){var i=t.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,o,Y(i.done),t))?i.done[i.done.length-1]=t:Ki(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&!1!==r.clearRedo&&Bi(i.undone)}function Ki(e,t){var n=Y(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Vi(t,n,e,r){var i=n["spans_"+t.id],o=0;t.iter(Math.max(t.first,e),Math.min(t.first+t.size,r),function(e){e.markedSpans&&((i=i||(n["spans_"+t.id]={}))[o]=e.markedSpans),++o})}function Gi(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t=t||e.slice(0,n):t&&t.push(e[n]);return t?t.length?t:null:e}function $i(e,t){var n=function(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(Gi(n[i]));return r}(e,t),r=Dt(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var o=n[i],a=r[i];if(o&&a)e:for(var l=0;l<a.length;++l){for(var s=a[l],c=0;c<o.length;++c)if(o[c].marker==s.marker)continue e;o.push(s)}else a&&(n[i]=a)}return n}function Yi(e,t,n){for(var r=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)r.push(n?Si.prototype.deepCopy.call(o):o);else{var a=o.changes,l=[];r.push({changes:l});for(var s=0;s<a.length;++s){var c=a[s],u=void 0;if(l.push({from:c.from,to:c.to,text:c.text}),t)for(var d in c)(u=d.match(/^spans_(\d+)$/))&&-1<H(t,Number(u[1]))&&(Y(l)[d]=c[d],delete c[d])}}}return r}function Xi(e,t,n,r){if(r){var i=e.anchor;if(n){var o=ct(t,i)<0;o!=ct(n,i)<0?(i=t,t=n):o!=ct(t,n)<0&&(t=n)}return new Li(i,t)}return new Li(n||t,t)}function Zi(e,t,n,r,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),no(e,new Si([Xi(e.sel.primary(),t,n,i)],0),r)}function Ji(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)r[o]=Xi(e.sel.ranges[o],t[o],null,i);no(e,Mi(e.cm,r,e.sel.primIndex),n)}function Qi(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,no(e,Mi(e.cm,i,e.sel.primIndex),r)}function eo(e,t,n,r){no(e,Ai(t,n),r)}function to(e,t,n){var r=e.history.done,i=Y(r);i&&i.ranges?ro(e,r[r.length-1]=t,n):no(e,t,n)}function no(e,t,n){ro(e,t,n),Ui(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function ro(e,t,n){(Le(e,"beforeSelectionChange")||e.cm&&Le(e.cm,"beforeSelectionChange"))&&(t=function(n,e,t){var r={ranges:e.ranges,update:function(e){this.ranges=[];for(var t=0;t<e.length;t++)this.ranges[t]=new Li(mt(n,e[t].anchor),mt(n,e[t].head))},origin:t&&t.origin};return Ce(n,"beforeSelectionChange",n,r),n.cm&&Ce(n.cm,"beforeSelectionChange",n.cm,r),r.ranges!=e.ranges?Mi(n.cm,r.ranges,r.ranges.length-1):e}(e,t,n));var r=n&&n.bias||(ct(t.primary().head,e.sel.primary().head)<0?-1:1);io(e,ao(e,t,r,!0)),n&&!1===n.scroll||!e.cm||Pr(e.cm)}function io(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Se(e.cm)),mn(e,"cursorActivity",e))}function oo(e){io(e,ao(e,e.sel,null,!1))}function ao(e,t,n,r){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],l=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],s=so(e,a.anchor,l&&l.anchor,n,r),c=so(e,a.head,l&&l.head,n,r);!i&&s==a.anchor&&c==a.head||((i=i||t.ranges.slice(0,o))[o]=new Li(s,c))}return i?Mi(e.cm,i,t.primIndex):t}function lo(e,t,n,r,i){var o=et(e,t.line);if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var l=o.markedSpans[a],s=l.marker,c="selectLeft"in s?!s.selectLeft:s.inclusiveLeft,u="selectRight"in s?!s.selectRight:s.inclusiveRight;if((null==l.from||(c?l.from<=t.ch:l.from<t.ch))&&(null==l.to||(u?l.to>=t.ch:l.to>t.ch))){if(i&&(Ce(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!s.atomic)continue;if(n){var d=s.find(r<0?1:-1),f=void 0;if((r<0?u:c)&&(d=co(e,d,-r,d&&d.line==t.line?o:null)),d&&d.line==t.line&&(f=ct(d,n))&&(r<0?f<0:0<f))return lo(e,d,t,r,i)}var h=s.find(r<0?-1:1);return(r<0?c:u)&&(h=co(e,h,r,h.line==t.line?o:null)),h?lo(e,h,t,r,i):null}}return t}function so(e,t,n,r,i){var o=r||1,a=lo(e,t,n,o,i)||!i&&lo(e,t,n,o,!0)||lo(e,t,n,-o,i)||!i&&lo(e,t,n,-o,!0);return a||(e.cantEdit=!0,st(e.first,0))}function co(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?mt(e,st(t.line-1)):null:0<n&&t.ch==(r||et(e,t.line)).text.length?t.line<e.first+e.size-1?st(t.line+1,0):null:new st(t.line,t.ch+n)}function uo(e){e.setSelection(st(e.firstLine(),0),st(e.lastLine()),q)}function fo(i,e,t){var o={canceled:!1,from:e.from,to:e.to,text:e.text,origin:e.origin,cancel:function(){return o.canceled=!0}};return t&&(o.update=function(e,t,n,r){e&&(o.from=mt(i,e)),t&&(o.to=mt(i,t)),n&&(o.text=n),void 0!==r&&(o.origin=r)}),Ce(i,"beforeChange",i,o),i.cm&&Ce(i.cm,"beforeChange",i.cm,o),o.canceled?(i.cm&&(i.cm.curOp.updateInput=2),null):{from:o.from,to:o.to,text:o.text,origin:o.origin}}function ho(e,t,n){if(e.cm){if(!e.cm.curOp)return ri(e.cm,ho)(e,t,n);if(e.cm.state.suppressEdits)return}if(!(Le(e,"beforeChange")||e.cm&&Le(e.cm,"beforeChange"))||(t=fo(e,t,!0))){var r=Ot&&!n&&function(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var n=e.markedSpans[t].marker;!n.readOnly||r&&-1!=H(r,n)||(r=r||[]).push(n)}}),!r)return null;for(var i=[{from:t,to:n}],o=0;o<r.length;++o)for(var a=r[o],l=a.find(0),s=0;s<i.length;++s){var c=i[s];if(!(ct(c.to,l.from)<0||0<ct(c.from,l.to))){var u=[s,1],d=ct(c.from,l.from),f=ct(c.to,l.to);(d<0||!a.inclusiveLeft&&!d)&&u.push({from:c.from,to:l.from}),(0<f||!a.inclusiveRight&&!f)&&u.push({from:l.to,to:c.to}),i.splice.apply(i,u),s+=u.length-3}}return i}(e,t.from,t.to);if(r)for(var i=r.length-1;0<=i;--i)po(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else po(e,t)}}function po(e,n){if(1!=n.text.length||""!=n.text[0]||0!=ct(n.from,n.to)){var t=_i(e,n);qi(e,n,t,e.cm?e.cm.curOp.id:NaN),vo(e,n,t,Dt(e,n));var r=[];Ii(e,function(e,t){t||-1!=H(r,e.history)||(xo(e.history,n),r.push(e.history)),vo(e,n,null,Dt(e,n))})}}function mo(i,o,e){var t=i.cm&&i.cm.state.suppressEdits;if(!t||e){for(var a,n=i.history,r=i.sel,l="undo"==o?n.done:n.undone,s="undo"==o?n.undone:n.done,c=0;c<l.length&&(a=l[c],e?!a.ranges||a.equals(i.sel):a.ranges);c++);if(c!=l.length){for(n.lastOrigin=n.lastSelOrigin=null;;){if(!(a=l.pop()).ranges){if(t)return void l.push(a);break}if(Ki(a,s),e&&!a.equals(i.sel))return void no(i,a,{clearRedo:!1});r=a}var u=[];Ki(r,s),s.push({changes:u,generation:n.generation}),n.generation=a.generation||++n.maxGeneration;for(var d=Le(i,"beforeChange")||i.cm&&Le(i.cm,"beforeChange"),f=function(e){var n=a.changes[e];if(n.origin=o,d&&!fo(i,n,!1))return l.length=0,{};u.push(Ri(i,n));var t=e?_i(i,n):Y(l);vo(i,n,t,$i(i,n)),!e&&i.cm&&i.cm.scrollIntoView({from:n.from,to:Oi(n)});var r=[];Ii(i,function(e,t){t||-1!=H(r,e.history)||(xo(e.history,n),r.push(e.history)),vo(e,n,null,$i(e,n))})},h=a.changes.length-1;0<=h;--h){var p=f(h);if(p)return p.v}}}}function go(e,t){if(0!=t&&(e.first+=t,e.sel=new Si(X(e.sel.ranges,function(e){return new Li(st(e.anchor.line+t,e.anchor.ch),st(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){mr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)gr(e.cm,r,"gutter")}}function vo(e,t,n,r){if(e.cm&&!e.cm.curOp)return ri(e.cm,vo)(e,t,n,r);if(t.to.line<e.first)go(e,t.text.length-1-(t.to.line-t.from.line));else if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);go(e,i),t={from:st(e.first,0),to:st(t.to.line+i,t.to.ch),text:[Y(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:st(o,et(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=tt(e,t.from,t.to),n=n||_i(e,t),e.cm?function(e,t,n){var r=e.doc,i=e.display,o=t.from,a=t.to,l=!1,s=o.line;e.options.lineWrapping||(s=it(Vt(et(r,o.line))),r.iter(s,a.line+1,function(e){if(e==i.maxLine)return l=!0}));-1<r.sel.contains(t.from,t.to)&&Se(e);Fi(r,t,n,dr(e)),e.options.lineWrapping||(r.iter(s,o.line+t.text.length,function(e){var t=Jt(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,l=!1)}),l&&(e.curOp.updateMaxLine=!0));(function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var n=e.first,r=t-1;n<r;r--){var i=et(e,r).stateAfter;if(i&&(!(i instanceof vt)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}})(r,o.line),ai(e,400);var c=t.text.length-(a.line-o.line)-1;t.full?mr(e):o.line!=a.line||1!=t.text.length||Pi(e.doc,t)?mr(e,o.line,a.line+1,c):gr(e,o.line,"text");var u=Le(e,"changes"),d=Le(e,"change");if(d||u){var f={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin};d&&mn(e,"change",e,f),u&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(f)}e.display.selForContextMenu=null}(e.cm,t,r):Fi(e,t,r),ro(e,n,q),e.cantEdit&&so(e,st(e.firstLine(),0))&&(e.cantEdit=!1)}}function yo(e,t,n,r,i){var o;ct(r=r||n,n)<0&&(n=(o=[r,n])[0],r=o[1]),"string"==typeof t&&(t=e.splitLines(t)),ho(e,{from:n,to:r,text:t,origin:i})}function bo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function wo(e,t,n,r){for(var i=0;i<e.length;++i){var o=e[i],a=!0;if(o.ranges){o.copied||((o=e[i]=o.deepCopy()).copied=!0);for(var l=0;l<o.ranges.length;l++)bo(o.ranges[l].anchor,t,n,r),bo(o.ranges[l].head,t,n,r)}else{for(var s=0;s<o.changes.length;++s){var c=o.changes[s];if(n<c.from.line)c.from=st(c.from.line+r,c.from.ch),c.to=st(c.to.line+r,c.to.ch);else if(t<=c.to.line){a=!1;break}}a||(e.splice(0,i+1),i=0)}}}function xo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;wo(e.done,n,r,i),wo(e.undone,n,r,i)}function ko(e,t,n,r){var i=t,o=t;return"number"==typeof t?o=et(e,pt(e,t)):i=it(t),null==i?null:(r(o,i)&&e.cm&&gr(e.cm,i,n),o)}function Co(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}function To(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}Li.prototype.from=function(){return ht(this.anchor,this.head)},Li.prototype.to=function(){return ft(this.anchor,this.head)},Li.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},Co.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,(o=i).parent=null,Ft(o),mn(i,"delete")}var o;this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}},To.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var o=Math.min(t,i-e),a=r.height;if(r.removeInner(e,o),this.height-=a-r.height,i==o&&(this.children.splice(n--,1),r.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(1<this.children.length||!(this.children[0]instanceof Co))){var l=[];this.collapse(l),this.children=[new Co(l)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(e<=o){if(i.insertInner(e,t,n),i.lines&&50<i.lines.length){for(var a=i.lines.length%25+25,l=a;l<i.lines.length;){var s=new Co(i.lines.slice(l,l+=25));i.height-=s.height,this.children.splice(++r,0,s),s.parent=this}i.lines=i.lines.slice(0,a),this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=new To(e.children.splice(e.children.length-5,5));if(e.parent){e.size-=t.size,e.height-=t.height;var n=H(e.parent.children,e);e.parent.children.splice(n+1,0,t)}else{var r=new To(e.children);(r.parent=e).children=[r,t],e=r}t.parent=e.parent}while(10<e.children.length);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(e<o){var a=Math.min(t,o-e);if(i.iterN(e,a,n))return!0;if(0==(t-=a))break;e=0}else e-=o}}};function So(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t}function Lo(e,t,n){Zt(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Dr(e,n)}So.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=it(n);if(null!=r&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var o=Mn(this);rt(n,Math.max(0,n.height-o)),e&&(ni(e,function(){Lo(e,n,-o),gr(e,r,"widget")}),mn(e,"lineWidgetCleared",e,this,r))}},So.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=Mn(this)-t;i&&(Yt(this.doc,r)||rt(r,r.height+i),n&&ni(n,function(){n.curOp.forceUpdate=!0,Lo(n,r,i),mn(n,"lineWidgetChanged",n,e,it(r))}))},Me(So);var Mo=0,Ao=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++Mo};function Oo(t,n,r,e,i){if(e&&e.shared)return function(e,n,r,i,o){(i=I(i)).shared=!1;var a=[Oo(e,n,r,i,o)],l=a[0],s=i.widgetNode;return Ii(e,function(e){s&&(i.widgetNode=s.cloneNode(!0)),a.push(Oo(e,mt(e,n),mt(e,r),i,o));for(var t=0;t<e.linked.length;++t)if(e.linked[t].isParent)return;l=Y(a)}),new No(a,l)}(t,n,r,e,i);if(t.cm&&!t.cm.curOp)return ri(t.cm,Oo)(t,n,r,e,i);var o=new Ao(t,i),a=ct(n,r);if(e&&I(e,o,!1),0<a||0==a&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=O("span",[o.replacedWith],"CodeMirror-widget"),e.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),e.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Kt(t,n.line,n,r,o)||n.line!=r.line&&Kt(t,r.line,n,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Nt=!0}o.addToHistory&&qi(t,{from:n,to:r,origin:"markText"},t.sel,NaN);var l,s=n.line,c=t.cm;if(t.iter(s,r.line+1,function(e){c&&o.collapsed&&!c.options.lineWrapping&&Vt(e)==c.display.maxLine&&(l=!0),o.collapsed&&s!=n.line&&rt(e,0),function(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}(e,new _t(o,s==n.line?n.ch:null,s==r.line?r.ch:null)),++s}),o.collapsed&&t.iter(n.line,r.line+1,function(e){Yt(t,e)&&rt(e,0)}),o.clearOnEnter&&we(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(Ot=!0,(t.history.done.length||t.history.undone.length)&&t.clearHistory()),o.collapsed&&(o.id=++Mo,o.atomic=!0),c){if(l&&(c.curOp.updateMaxLine=!0),o.collapsed)mr(c,n.line,r.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var u=n.line;u<=r.line;u++)gr(c,u,"text");o.atomic&&oo(c.doc),mn(c,"markerAdded",c,o)}return o}Ao.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Xr(e),Le(this,"clear")){var n=this.find();n&&mn(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;o<this.lines.length;++o){var a=this.lines[o],l=Et(a.markedSpans,this);e&&!this.collapsed?gr(e,it(a),"text"):e&&(null!=l.to&&(i=it(a)),null!=l.from&&(r=it(a))),a.markedSpans=zt(a.markedSpans,l),null==l.from&&this.collapsed&&!Yt(this.doc,a)&&e&&rt(a,lr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var s=0;s<this.lines.length;++s){var c=Vt(this.lines[s]),u=Jt(c);u>e.display.maxLineLength&&(e.display.maxLine=c,e.display.maxLineLength=u,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&mr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&oo(e.doc)),e&&mn(e,"markerCleared",e,this,r,i),t&&Zr(e),this.parent&&this.parent.clear()}},Ao.prototype.find=function(e,t){var n,r;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i<this.lines.length;++i){var o=this.lines[i],a=Et(o.markedSpans,this);if(null!=a.from&&(n=st(t?o:it(o),a.from),-1==e))return n;if(null!=a.to&&(r=st(t?o:it(o),a.to),1==e))return r}return n&&{from:n,to:r}},Ao.prototype.changed=function(){var o=this,a=this.find(-1,!0),l=this,s=this.doc.cm;a&&s&&ni(s,function(){var e=a.line,t=it(a.line),n=In(s,t);if(n&&(Un(n),s.curOp.selectionChanged=s.curOp.forceUpdate=!0),s.curOp.updateMaxLine=!0,!Yt(l.doc,e)&&null!=l.height){var r=l.height;l.height=null;var i=Mn(l)-r;i&&rt(e,e.height+i)}mn(s,"markerChanged",s,o)})},Ao.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=H(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Ao.prototype.detachLine=function(e){if(this.lines.splice(H(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},Me(Ao);var No=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};function _o(e){return e.findMarks(st(e.first,0),e.clipPos(st(e.lastLine())),function(e){return e.parent})}function Eo(o){for(var e=function(e){var t=o[e],n=[t.primary.doc];Ii(t.primary.doc,function(e){return n.push(e)});for(var r=0;r<t.markers.length;r++){var i=t.markers[r];-1==H(n,i.doc)&&(i.parent=null,t.markers.splice(r--,1))}},t=0;t<o.length;t++)e(t)}No.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();mn(this,"clear")}},No.prototype.find=function(e,t){return this.primary.find(e,t)},Me(No);var zo=0,Do=function(e,t,n,r,i){if(!(this instanceof Do))return new Do(e,t,n,r,i);null==n&&(n=0),To.call(this,[new Co([new en("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var o=st(n,0);this.sel=Ai(o),this.history=new Hi(null),this.id=++zo,this.modeOption=t,this.lineSep=r,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),Fi(this,{from:o,to:o,text:e}),no(this,Ai(o),q)};Do.prototype=J(To.prototype,{constructor:Do,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=nt(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:oi(function(e){var t=st(this.first,0),n=this.first+this.size-1;ho(this,{from:t,to:st(n,et(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Fr(this.cm,0,0),no(this,Ai(t),q)}),replaceRange:function(e,t,n,r){yo(this,e,t=mt(this,t),n=n?mt(this,n):t,r)},getRange:function(e,t,n){var r=tt(this,mt(this,e),mt(this,t));return!1===n?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(at(this,e))return et(this,e)},getLineNumber:function(e){return it(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=et(this,e)),Vt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return mt(this,e)},getCursor:function(e){var t=this.sel.primary();return null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:oi(function(e,t,n){eo(this,mt(this,"number"==typeof e?st(e,t||0):e),null,n)}),setSelection:oi(function(e,t,n){eo(this,mt(this,e),mt(this,t||e),n)}),extendSelection:oi(function(e,t,n){Zi(this,mt(this,e),t&&mt(this,t),n)}),extendSelections:oi(function(e,t){Ji(this,gt(this,e),t)}),extendSelectionsBy:oi(function(e,t){Ji(this,gt(this,X(this.sel.ranges,e)),t)}),setSelections:oi(function(e,t,n){if(e.length){for(var r=[],i=0;i<e.length;i++)r[i]=new Li(mt(this,e[i].anchor),mt(this,e[i].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),no(this,Mi(this.cm,r,t),n)}}),addSelection:oi(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new Li(mt(this,e),mt(this,t||e))),no(this,Mi(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t,n=this.sel.ranges,r=0;r<n.length;r++){var i=tt(this,n[r].from(),n[r].to());t=t?t.concat(i):i}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=tt(this,n[r].from(),n[r].to());!1!==e&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:oi(function(e,t,n){for(var r=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o];r[o]={from:a.from(),to:a.to(),text:this.splitLines(e[o]),origin:n}}for(var l=t&&"end"!=t&&function(e,t,n){for(var r=[],i=st(e.first,0),o=i,a=0;a<t.length;a++){var l=t[a],s=Ei(l.from,i,o),c=Ei(Oi(l),i,o);if(i=l.to,o=c,"around"==n){var u=e.sel.ranges[a],d=ct(u.head,u.anchor)<0;r[a]=new Li(d?c:s,d?s:c)}else r[a]=new Li(s,s)}return new Si(r,e.sel.primIndex)}(this,r,t),s=r.length-1;0<=s;s--)ho(this,r[s]);l?to(this,l):this.cm&&Pr(this.cm)}),undo:oi(function(){mo(this,"undo")}),redo:oi(function(){mo(this,"redo")}),undoSelection:oi(function(){mo(this,"undo",!0)}),redoSelection:oi(function(){mo(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var t=this;this.history=new Hi(this.history.maxGeneration),Ii(this,function(e){return e.history=t.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Yi(this.history.done),undone:Yi(this.history.undone)}},setHistory:function(e){var t=this.history=new Hi(this.history.maxGeneration);t.done=Yi(e.done.slice(0),null,!0),t.undone=Yi(e.undone.slice(0),null,!0)},setGutterMarker:oi(function(e,n,r){return ko(this,e,"gutter",function(e){var t=e.gutterMarkers||(e.gutterMarkers={});return!(t[n]=r)&&ne(t)&&(e.gutterMarkers=null),!0})}),clearGutter:oi(function(t){var n=this;this.iter(function(e){e.gutterMarkers&&e.gutterMarkers[t]&&ko(n,e,"gutter",function(){return e.gutterMarkers[t]=null,ne(e.gutterMarkers)&&(e.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!at(this,e))return null;if(!(e=et(this,t=e)))return null}else if(null==(t=it(e)))return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:oi(function(e,n,r){return ko(this,e,"gutter"==n?"gutter":"class",function(e){var t="text"==n?"textClass":"background"==n?"bgClass":"gutter"==n?"gutterClass":"wrapClass";if(e[t]){if(T(r).test(e[t]))return!1;e[t]+=" "+r}else e[t]=r;return!0})}),removeLineClass:oi(function(e,o,a){return ko(this,e,"gutter"==o?"gutter":"class",function(e){var t="text"==o?"textClass":"background"==o?"bgClass":"gutter"==o?"gutterClass":"wrapClass",n=e[t];if(!n)return!1;if(null==a)e[t]=null;else{var r=n.match(T(a));if(!r)return!1;var i=r.index+r[0].length;e[t]=n.slice(0,r.index)+(r.index&&i!=n.length?" ":"")+n.slice(i)||null}return!0})}),addLineWidget:oi(function(e,t,n){return function(r,e,t,n){var i=new So(r,t,n),o=r.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),ko(r,e,"widget",function(e){var t=e.widgets||(e.widgets=[]);if(null==i.insertAt?t.push(i):t.splice(Math.min(t.length-1,Math.max(0,i.insertAt)),0,i),i.line=e,o&&!Yt(r,e)){var n=Zt(e)<r.scrollTop;rt(e,e.height+Mn(i)),n&&Dr(o,i.height),o.curOp.forceUpdate=!0}return!0}),o&&mn(o,"lineWidgetAdded",o,i,"number"==typeof e?e:it(e)),i}(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Oo(this,mt(this,e),mt(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return Oo(this,e=mt(this,e),e,n,"bookmark")},findMarksAt:function(e){var t=[],n=et(this,(e=mt(this,e)).line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(i,o,a){i=mt(this,i),o=mt(this,o);var l=[],s=i.line;return this.iter(i.line,o.line+1,function(e){var t=e.markedSpans;if(t)for(var n=0;n<t.length;n++){var r=t[n];null!=r.to&&s==i.line&&i.ch>=r.to||null==r.from&&s!=i.line||null!=r.from&&s==o.line&&r.from>=o.ch||a&&!a(r.marker)||l.push(r.marker.parent||r.marker)}++s}),l},getAllMarks:function(){var r=[];return this.iter(function(e){var t=e.markedSpans;if(t)for(var n=0;n<t.length;++n)null!=t[n].from&&r.push(t[n].marker)}),r},posFromIndex:function(n){var r,i=this.first,o=this.lineSeparator().length;return this.iter(function(e){var t=e.text.length+o;if(n<t)return r=n,!0;n-=t,++i}),mt(this,st(i,r))},indexFromPos:function(e){var t=(e=mt(this,e)).ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(e){t+=e.text.length+n}),t},copy:function(e){var t=new Do(nt(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e=e||{};var t=this.first,n=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<n&&(n=e.to);var r=new Do(nt(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),o=e.clipPos(i.from),a=e.clipPos(i.to);if(ct(o,a)){var l=Oo(e,o,a,r.primary,r.primary.type);r.markers.push(l),l.parent=r}}}(r,_o(this)),r},unlinkDoc:function(e){if(e instanceof Na&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){if(this.linked[t].doc==e){this.linked.splice(t,1),e.unlinkDoc(this),Eo(_o(this));break}}if(e.history==this.history){var n=[e.id];Ii(e,function(e){return n.push(e.id)},!0),e.history=new Hi(null),e.history.done=Yi(this.history.done,n),e.history.undone=Yi(this.history.undone,n)}},iterLinkedDocs:function(e){Ii(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):He(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:oi(function(e){"rtl"!=e&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter(function(e){return e.order=null}),this.cm&&function(e){ni(e,function(){Wi(e),mr(e)})}(this.cm))})}),Do.prototype.eachLine=Do.prototype.iter;var Po=0;function Fo(e){var r=this;if(Io(r),!Te(r,e)&&!An(r.display,e)){Ae(e),x&&(Po=+new Date);var t=hr(r,e,!0),n=e.dataTransfer.files;if(t&&!r.isReadOnly())if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),a=0,l=function(){++a==i&&ri(r,function(){var e={from:t=mt(r.doc,t),to:t,text:r.doc.splitLines(o.filter(function(e){return null!=e}).join(r.doc.lineSeparator())),origin:"paste"};ho(r.doc,e),to(r.doc,Ai(t,Oi(e)))})()},s=function(e,t){if(r.options.allowDropFileTypes&&-1==H(r.options.allowDropFileTypes,e.type))l();else{var n=new FileReader;n.onerror=function(){return l()},n.onload=function(){var e=n.result;/[\x00-\x08\x0e-\x1f]{2}/.test(e)||(o[t]=e),l()},n.readAsText(e)}},c=0;c<n.length;c++)s(n[c],c);else{if(r.state.draggingText&&-1<r.doc.sel.contains(t))return r.state.draggingText(e),void setTimeout(function(){return r.display.input.focus()},20);try{var u=e.dataTransfer.getData("Text");if(u){var d;if(r.state.draggingText&&!r.state.draggingText.copy&&(d=r.listSelections()),ro(r.doc,Ai(t,t)),d)for(var f=0;f<d.length;++f)yo(r.doc,"",d[f].anchor,d[f].head,"drag");r.replaceSelection(u,"around","paste"),r.display.input.focus()}}catch(e){}}}}function Io(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function jo(t){if(document.getElementsByClassName){for(var e=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<e.length;r++){var i=e[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var e=0;e<n.length;e++)t(n[e])})}}var Wo=!1;function Ho(){Wo||(function(){var e;we(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,jo(Ro)},100))}),we(window,"blur",function(){return jo(Or)})}(),Wo=!0)}function Ro(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Bo={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},qo=0;qo<10;qo++)Bo[qo+48]=Bo[qo+96]=String(qo);for(var Uo=65;Uo<=90;Uo++)Bo[Uo]=String.fromCharCode(Uo);for(var Ko=1;Ko<=12;Ko++)Bo[Ko+111]=Bo[Ko+63235]="F"+Ko;var Vo={};function Go(e){var t,n,r,i,o=e.split(/-(?!$)/);e=o[o.length-1];for(var a=0;a<o.length-1;a++){var l=o[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))t=!0;else if(/^(c|ctrl|control)$/i.test(l))n=!0;else{if(!/^s(hift)?$/i.test(l))throw new Error("Unrecognized modifier name: "+l);r=!0}}return t&&(e="Alt-"+e),n&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),r&&(e="Shift-"+e),e}function $o(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==r){delete e[n];continue}for(var i=X(n.split(" "),Go),o=0;o<i.length;o++){var a=void 0,l=void 0;a=o==i.length-1?(l=i.join(" "),r):(l=i.slice(0,o+1).join(" "),"...");var s=t[l];if(s){if(s!=a)throw new Error("Inconsistent bindings for "+l)}else t[l]=a}delete e[n]}for(var c in t)e[c]=t[c];return e}function Yo(e,t,n,r){var i=(t=Qo(t)).call?t.call(e,r):t[e];if(!1===i)return"nothing";if("..."===i)return"multi";if(null!=i&&n(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return Yo(e,t.fallthrough,n,r);for(var o=0;o<t.fallthrough.length;o++){var a=Yo(e,t.fallthrough[o],n,r);if(a)return a}}}function Xo(e){var t="string"==typeof e?e:Bo[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function Zo(e,t,n){var r=e;return t.altKey&&"Alt"!=r&&(e="Alt-"+e),(y?t.metaKey:t.ctrlKey)&&"Ctrl"!=r&&(e="Ctrl-"+e),(y?t.ctrlKey:t.metaKey)&&"Cmd"!=r&&(e="Cmd-"+e),!n&&t.shiftKey&&"Shift"!=r&&(e="Shift-"+e),e}function Jo(e,t){if(g&&34==e.keyCode&&e.char)return!1;var n=Bo[e.keyCode];return null!=n&&!e.altGraphKey&&(3==e.keyCode&&e.code&&(n=e.code),Zo(n,e,t))}function Qo(e){return"string"==typeof e?Vo[e]:e}function ea(t,e){for(var n=t.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var o=e(n[i]);r.length&&ct(o.from,Y(r).to)<=0;){var a=r.pop();if(ct(a.from,o.from)<0){o.from=a.from;break}}r.push(o)}ni(t,function(){for(var e=r.length-1;0<=e;e--)yo(t.doc,"",r[e].from,r[e].to,"+delete");Pr(t)})}function ta(e,t,n){var r=oe(e.text,t+n,n);return r<0||r>e.text.length?null:r}function na(e,t,n){var r=ta(e,t.ch,n);return null==r?null:new st(t.line,r,n<0?"after":"before")}function ra(e,t,n,r,i){if(e){"rtl"==t.getOption("direction")&&(i=-i);var o=ye(n,t.doc.direction);if(o){var a,l=i<0?Y(o):o[0],s=i<0==(1==l.level)?"after":"before";if(0<l.level||"rtl"==t.doc.direction){var c=jn(t,n);a=i<0?n.text.length-1:0;var u=Wn(t,c,a).top;a=ae(function(e){return Wn(t,c,e).top==u},i<0==(1==l.level)?l.from:l.to-1,a),"before"==s&&(a=ta(n,a,1))}else a=i<0?l.to:l.from;return new st(r,a,s)}}return new st(r,i<0?n.text.length:0,i<0?"before":"after")}Vo.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Vo.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Vo.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Vo.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Vo.default=w?Vo.macDefault:Vo.pcDefault;var ia={selectAll:uo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),q)},killLine:function(n){return ea(n,function(e){if(e.empty()){var t=et(n.doc,e.head.line).text.length;return e.head.ch==t&&e.head.line<n.lastLine()?{from:e.head,to:st(e.head.line+1,0)}:{from:e.head,to:st(e.head.line,t)}}return{from:e.from(),to:e.to()}})},deleteLine:function(t){return ea(t,function(e){return{from:st(e.from().line,0),to:mt(t.doc,st(e.to().line+1,0))}})},delLineLeft:function(e){return ea(e,function(e){return{from:st(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(n){return ea(n,function(e){var t=n.charCoords(e.head,"div").top+5;return{from:n.coordsChar({left:0,top:t},"div"),to:e.from()}})},delWrappedLineRight:function(r){return ea(r,function(e){var t=r.charCoords(e.head,"div").top+5,n=r.coordsChar({left:r.display.lineDiv.offsetWidth+100,top:t},"div");return{from:e.from(),to:n}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(st(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(st(e.lastLine()))},goLineStart:function(t){return t.extendSelectionsBy(function(e){return oa(t,e.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(t){return t.extendSelectionsBy(function(e){return aa(t,e.head)},{origin:"+move",bias:1})},goLineEnd:function(t){return t.extendSelectionsBy(function(e){return function(e,t){var n=et(e.doc,t),r=function(e){for(var t;t=qt(e);)e=t.find(1,!0).line;return e}(n);r!=n&&(t=it(r));return ra(!0,e,n,t,-1)}(t,e.head.line)},{origin:"+move",bias:-1})},goLineRight:function(n){return n.extendSelectionsBy(function(e){var t=n.cursorCoords(e.head,"div").top+5;return n.coordsChar({left:n.display.lineDiv.offsetWidth+100,top:t},"div")},K)},goLineLeft:function(n){return n.extendSelectionsBy(function(e){var t=n.cursorCoords(e.head,"div").top+5;return n.coordsChar({left:0,top:t},"div")},K)},goLineLeftSmart:function(r){return r.extendSelectionsBy(function(e){var t=r.cursorCoords(e.head,"div").top+5,n=r.coordsChar({left:0,top:t},"div");return n.ch<r.getLine(n.line).search(/\S/)?aa(r,e.head):n},K)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"char")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var o=n[i].from(),a=j(e.getLine(o.line),o.ch,r);t.push($(r-a%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(a){return ni(a,function(){for(var e=a.listSelections(),t=[],n=0;n<e.length;n++)if(e[n].empty()){var r=e[n].head,i=et(a.doc,r.line).text;if(i)if(r.ch==i.length&&(r=new st(r.line,r.ch-1)),0<r.ch)r=new st(r.line,r.ch+1),a.replaceRange(i.charAt(r.ch-1)+i.charAt(r.ch-2),st(r.line,r.ch-2),r,"+transpose");else if(r.line>a.doc.first){var o=et(a.doc,r.line-1).text;o&&(r=new st(r.line,1),a.replaceRange(i.charAt(0)+a.doc.lineSeparator()+o.charAt(o.length-1),st(r.line-1,o.length-1),r,"+transpose"))}t.push(new Li(r,r))}a.setSelections(t)})},newlineAndIndent:function(r){return ni(r,function(){for(var e=r.listSelections(),t=e.length-1;0<=t;t--)r.replaceRange(r.doc.lineSeparator(),e[t].anchor,e[t].head,"+input");e=r.listSelections();for(var n=0;n<e.length;n++)r.indentLine(e[n].from().line,null,!0);Pr(r)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function oa(e,t){var n=et(e.doc,t),r=Vt(n);return r!=n&&(t=it(r)),ra(!0,e,r,t,1)}function aa(e,t){var n=oa(e,t.line),r=et(e.doc,n.line),i=ye(r,e.doc.direction);if(i&&0!=i[0].level)return n;var o=Math.max(0,r.text.search(/\S/)),a=t.line==n.line&&t.ch<=o&&t.ch;return st(n.line,a?0:o,n.sticky)}function la(e,t,n){if("string"==typeof t&&!(t=ia[t]))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=B}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}var sa=new W;function ca(e,t,n,r){var i=e.state.keySeq;if(i){if(Xo(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:sa.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),ua(e,i+" "+t,n,r))return!0}return ua(e,t,n,r)}function ua(e,t,n,r){var i=function(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Yo(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Yo(t,e.options.extraKeys,n,e)||Yo(t,e.options.keyMap,n,e)}(e,t,r);return"multi"==i&&(e.state.keySeq=t),"handled"==i&&mn(e,"keyHandled",e,t,n),"handled"!=i&&"multi"!=i||(Ae(n),Sr(e)),!!i}function da(t,e){var n=Jo(e,!0);return!!n&&(e.shiftKey&&!t.state.keySeq?ca(t,"Shift-"+n,e,function(e){return la(t,e,!0)})||ca(t,n,e,function(e){if("string"==typeof e?/^go[A-Z]/.test(e):e.motion)return la(t,e)}):ca(t,n,e,function(e){return la(t,e)}))}var fa=null;function ha(e){if(this.curOp.focus=E(),!Te(this,e)){x&&k<11&&27==e.keyCode&&(e.returnValue=!1);var t=e.keyCode;this.display.shift=16==t||e.shiftKey;var n=da(this,e);g&&(fa=n?t:null,!n&&88==t&&!Be&&(w?e.metaKey:e.ctrlKey)&&this.replaceSelection("",null,"cut")),m&&!w&&!n&&46==t&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),18!=t||/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)||function(e){var t=e.display.lineDiv;function n(e){18!=e.keyCode&&e.altKey||(L(t,"CodeMirror-crosshair"),ke(document,"keyup",n),ke(document,"mouseover",n))}z(t,"CodeMirror-crosshair"),we(document,"keyup",n),we(document,"mouseover",n)}(this)}}function pa(e){16==e.keyCode&&(this.doc.sel.shift=!1),Te(this,e)}function ma(e){if(!(An(this.display,e)||Te(this,e)||e.ctrlKey&&!e.altKey||w&&e.metaKey)){var t=e.keyCode,n=e.charCode;if(g&&t==fa)return fa=null,void Ae(e);if(!g||e.which&&!(e.which<10)||!da(this,e)){var r=String.fromCharCode(null==n?t:n);"\b"==r||function(t,e,n){return ca(t,"'"+n+"'",e,function(e){return la(t,e,!0)})}(this,e,r)||this.display.input.onKeyPress(e)}}}var ga,va,ya=function(e,t,n){this.time=e,this.pos=t,this.button=n};function ba(e){var t=this,n=t.display;if(!(Te(t,e)||n.activeTouch&&n.input.supportsTouch()))if(n.input.ensurePolled(),n.shift=e.shiftKey,An(n,e))b||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));else if(!ka(t,e)){var r=hr(t,e),i=ze(e),o=r?function(e,t){var n=+new Date;return va&&va.compare(n,e,t)?(ga=va=null,"triple"):ga&&ga.compare(n,e,t)?(va=new ya(n,e,t),ga=null,"double"):(ga=new ya(n,e,t),va=null,"single")}(r,i):"single";window.focus(),1==i&&t.state.selectingText&&t.state.selectingText(e),r&&function(n,e,r,t,i){var o="Click";"double"==t?o="Double"+o:"triple"==t&&(o="Triple"+o);return ca(n,Zo(o=(1==e?"Left":2==e?"Middle":"Right")+o,i),i,function(e){if("string"==typeof e&&(e=ia[e]),!e)return!1;var t=!1;try{n.isReadOnly()&&(n.state.suppressEdits=!0),t=e(n,r)!=B}finally{n.state.suppressEdits=!1}return t})}(t,i,r,o,e)||(1==i?r?function(e,t,n,r){x?setTimeout(F(Lr,e),0):e.curOp.focus=E();var i,o=function(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(null==i.unit){var o=h?n.shiftKey&&n.metaKey:n.altKey;i.unit=o?"rectangle":"single"==t?"char":"double"==t?"word":"line"}null!=i.extend&&!e.doc.extend||(i.extend=e.doc.extend||n.shiftKey);null==i.addNew&&(i.addNew=w?n.metaKey:n.ctrlKey);null==i.moveOnDrag&&(i.moveOnDrag=!(w?n.altKey:n.ctrlKey));return i}(e,n,r),a=e.doc.sel;e.options.dragDrop&&Fe&&!e.isReadOnly()&&"single"==n&&-1<(i=a.contains(t))&&(ct((i=a.ranges[i]).from(),t)<0||0<t.xRel)&&(0<ct(i.to(),t)||t.xRel<0)?function(t,n,r,i){var o=t.display,a=!1,l=ri(t,function(e){b&&(o.scroller.draggable=!1),t.state.draggingText=!1,ke(o.wrapper.ownerDocument,"mouseup",l),ke(o.wrapper.ownerDocument,"mousemove",s),ke(o.scroller,"dragstart",c),ke(o.scroller,"drop",l),a||(Ae(e),i.addNew||Zi(t.doc,r,null,null,i.extend),b||x&&9==k?setTimeout(function(){o.wrapper.ownerDocument.body.focus(),o.input.focus()},20):o.input.focus())}),s=function(e){a=a||10<=Math.abs(n.clientX-e.clientX)+Math.abs(n.clientY-e.clientY)},c=function(){return a=!0};b&&(o.scroller.draggable=!0);(t.state.draggingText=l).copy=!i.moveOnDrag,o.scroller.dragDrop&&o.scroller.dragDrop();we(o.wrapper.ownerDocument,"mouseup",l),we(o.wrapper.ownerDocument,"mousemove",s),we(o.scroller,"dragstart",c),we(o.scroller,"drop",l),Mr(t),setTimeout(function(){return o.input.focus()},20)}(e,r,t,o):function(g,e,v,y){var a=g.display,b=g.doc;Ae(e);var w,x,k=b.sel,t=k.ranges;y.addNew&&!y.extend?(x=b.sel.contains(v),w=-1<x?t[x]:new Li(v,v)):(w=b.sel.primary(),x=b.sel.primIndex);if("rectangle"==y.unit)y.addNew||(w=new Li(v,v)),v=hr(g,e,!0,!0),x=-1;else{var n=wa(g,v,y.unit);w=y.extend?Xi(w,n.anchor,n.head,y.extend):n}y.addNew?-1==x?(x=t.length,no(b,Mi(g,t.concat([w]),x),{scroll:!1,origin:"*mouse"})):1<t.length&&t[x].empty()&&"char"==y.unit&&!y.extend?(no(b,Mi(g,t.slice(0,x).concat(t.slice(x+1)),0),{scroll:!1,origin:"*mouse"}),k=b.sel):Qi(b,x,w,U):(no(b,new Si([w],x=0),U),k=b.sel);var C=v;function l(e){if(0!=ct(C,e))if(C=e,"rectangle"==y.unit){for(var t=[],n=g.options.tabSize,r=j(et(b,v.line).text,v.ch,n),i=j(et(b,e.line).text,e.ch,n),o=Math.min(r,i),a=Math.max(r,i),l=Math.min(v.line,e.line),s=Math.min(g.lastLine(),Math.max(v.line,e.line));l<=s;l++){var c=et(b,l).text,u=V(c,o,n);o==a?t.push(new Li(st(l,u),st(l,u))):c.length>u&&t.push(new Li(st(l,u),st(l,V(c,a,n))))}t.length||t.push(new Li(v,v)),no(b,Mi(g,k.ranges.slice(0,x).concat(t),x),{origin:"*mouse",scroll:!1}),g.scrollIntoView(e)}else{var d,f=w,h=wa(g,e,y.unit),p=f.anchor;p=0<ct(h.anchor,p)?(d=h.head,ht(f.from(),h.anchor)):(d=h.anchor,ft(f.to(),h.head));var m=k.ranges.slice(0);m[x]=function(e,t){var n=t.anchor,r=t.head,i=et(e.doc,n.line);if(0==ct(n,r)&&n.sticky==r.sticky)return t;var o=ye(i);if(!o)return t;var a=se(o,n.ch,n.sticky),l=o[a];if(l.from!=n.ch&&l.to!=n.ch)return t;var s,c=a+(l.from==n.ch==(1!=l.level)?0:1);if(0==c||c==o.length)return t;if(r.line!=n.line)s=0<(r.line-n.line)*("ltr"==e.doc.direction?1:-1);else{var u=se(o,r.ch,r.sticky),d=u-a||(r.ch-n.ch)*(1==l.level?-1:1);s=u==c-1||u==c?d<0:0<d}var f=o[c+(s?-1:0)],h=s==(1==f.level),p=h?f.from:f.to,m=h?"after":"before";return n.ch==p&&n.sticky==m?t:new Li(new st(n.line,p,m),r)}(g,new Li(mt(b,p),d)),no(b,Mi(g,m,x),U)}}var s=a.wrapper.getBoundingClientRect(),c=0;function r(e){g.state.selectingText=!1,c=1/0,e&&(Ae(e),a.input.focus()),ke(a.wrapper.ownerDocument,"mousemove",i),ke(a.wrapper.ownerDocument,"mouseup",o),b.history.lastSelOrigin=null}var i=ri(g,function(e){0!==e.buttons&&ze(e)?function e(t){var n=++c,r=hr(g,t,!0,"rectangle"==y.unit);if(r)if(0!=ct(r,C)){g.curOp.focus=E(),l(r);var i=Er(a,b);(r.line>=i.to||r.line<i.from)&&setTimeout(ri(g,function(){c==n&&e(t)}),150)}else{var o=t.clientY<s.top?-20:t.clientY>s.bottom?20:0;o&&setTimeout(ri(g,function(){c==n&&(a.scroller.scrollTop+=o,e(t))}),50)}}(e):r(e)}),o=ri(g,r);g.state.selectingText=o,we(a.wrapper.ownerDocument,"mousemove",i),we(a.wrapper.ownerDocument,"mouseup",o)}(e,r,t,o)}(t,r,o,e):Ee(e)==n.scroller&&Ae(e):2==i?(r&&Zi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):3==i&&(C?t.display.input.onContextMenu(e):Mr(t)))}}function wa(e,t,n){if("char"==n)return new Li(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new Li(st(t.line,0),mt(e.doc,st(t.line+1,0)));var r=n(e,t);return new Li(r.from,r.to)}function xa(e,t,n,r){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Ae(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(o>l.bottom||!Le(e,n))return Ne(t);o-=l.top-a.viewOffset;for(var s=0;s<e.display.gutterSpecs.length;++s){var c=a.gutters.childNodes[s];if(c&&c.getBoundingClientRect().right>=i)return Ce(e,n,e,ot(e.doc,o),e.display.gutterSpecs[s].className,t),Ne(t)}}function ka(e,t){return xa(e,t,"gutterClick",!0)}function Ca(e,t){An(e.display,t)||function(e,t){return!!Le(e,"gutterContextMenu")&&xa(e,t,"gutterContextMenu",!1)}(e,t)||Te(e,t,"contextmenu")||C||e.display.input.onContextMenu(t)}function Ta(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Vn(e)}ya.prototype.compare=function(e,t,n){return this.time+400>e&&0==ct(t,this.pos)&&n==this.button};var Sa={toString:function(){return"CodeMirror.Init"}},La={},Ma={};function Aa(e,t,n){if(!t!=!(n&&n!=Sa)){var r=e.display.dragFunctions,i=t?we:ke;i(e.display.scroller,"dragstart",r.start),i(e.display.scroller,"dragenter",r.enter),i(e.display.scroller,"dragover",r.over),i(e.display.scroller,"dragleave",r.leave),i(e.display.scroller,"drop",r.drop)}}function Oa(e){e.options.lineWrapping?(z(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(L(e.display.wrapper,"CodeMirror-wrap"),Qt(e)),fr(e),mr(e),Vn(e),setTimeout(function(){return Kr(e)},100)}function Na(e,t){var n=this;if(!(this instanceof Na))return new Na(e,t);this.options=t=t?I(t):{},I(La,t,!1);var r=t.value;"string"==typeof r?r=new Do(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Na.inputStyles[t.inputStyle](this),o=this.display=new bi(e,r,i,t);for(var a in Ta(o.wrapper.CodeMirror=this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),$r(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new W,keySeq:null,specialChars:null},t.autofocus&&!f&&o.input.focus(),x&&k<11&&setTimeout(function(){return n.display.input.reset(!0)},20),function(i){var o=i.display;we(o.scroller,"mousedown",ri(i,ba)),we(o.scroller,"dblclick",x&&k<11?ri(i,function(e){if(!Te(i,e)){var t=hr(i,e);if(t&&!ka(i,e)&&!An(i.display,e)){Ae(e);var n=i.findWordAt(t);Zi(i.doc,n.anchor,n.head)}}}):function(e){return Te(i,e)||Ae(e)});we(o.scroller,"contextmenu",function(e){return Ca(i,e)}),we(o.input.getField(),"contextmenu",function(e){o.scroller.contains(e.target)||Ca(i,e)});var n,r={end:0};function a(){o.activeTouch&&(n=setTimeout(function(){return o.activeTouch=null},1e3),(r=o.activeTouch).end=+new Date)}function l(e,t){if(null==t.left)return!0;var n=t.left-e.left,r=t.top-e.top;return 400<n*n+r*r}we(o.scroller,"touchstart",function(e){if(!Te(i,e)&&!function(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(e)&&!ka(i,e)){o.input.ensurePolled(),clearTimeout(n);var t=+new Date;o.activeTouch={start:t,moved:!1,prev:t-r.end<=300?r:null},1==e.touches.length&&(o.activeTouch.left=e.touches[0].pageX,o.activeTouch.top=e.touches[0].pageY)}}),we(o.scroller,"touchmove",function(){o.activeTouch&&(o.activeTouch.moved=!0)}),we(o.scroller,"touchend",function(e){var t=o.activeTouch;if(t&&!An(o,e)&&null!=t.left&&!t.moved&&new Date-t.start<300){var n,r=i.coordsChar(o.activeTouch,"page");n=!t.prev||l(t,t.prev)?new Li(r,r):!t.prev.prev||l(t,t.prev.prev)?i.findWordAt(r):new Li(st(r.line,0),mt(i.doc,st(r.line+1,0))),i.setSelection(n.anchor,n.head),i.focus(),Ae(e)}a()}),we(o.scroller,"touchcancel",a),we(o.scroller,"scroll",function(){o.scroller.clientHeight&&(Wr(i,o.scroller.scrollTop),Rr(i,o.scroller.scrollLeft,!0),Ce(i,"scroll",i))}),we(o.scroller,"mousewheel",function(e){return Ti(i,e)}),we(o.scroller,"DOMMouseScroll",function(e){return Ti(i,e)}),we(o.wrapper,"scroll",function(){return o.wrapper.scrollTop=o.wrapper.scrollLeft=0}),o.dragFunctions={enter:function(e){Te(i,e)||_e(e)},over:function(e){Te(i,e)||(function(e,t){var n=hr(e,t);if(n){var r=document.createDocumentFragment();kr(e,n,r),e.display.dragCursor||(e.display.dragCursor=N("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),A(e.display.dragCursor,r)}}(i,e),_e(e))},start:function(e){return function(e,t){if(x&&(!e.state.draggingText||+new Date-Po<100))_e(t);else if(!Te(e,t)&&!An(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!s)){var n=N("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",g&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),g&&n.parentNode.removeChild(n)}}(i,e)},drop:ri(i,Fo),leave:function(e){Te(i,e)||Io(i)}};var e=o.input.getField();we(e,"keyup",function(e){return pa.call(i,e)}),we(e,"keydown",ri(i,ha)),we(e,"keypress",ri(i,ma)),we(e,"focus",function(e){return Ar(i,e)}),we(e,"blur",function(e){return Or(i,e)})}(this),Ho(),Xr(this),this.curOp.forceUpdate=!0,ji(this,r),t.autofocus&&!f||this.hasFocus()?setTimeout(F(Ar,this),20):Or(this),Ma)Ma.hasOwnProperty(a)&&Ma[a](this,t[a],Sa);mi(this),t.finishInit&&t.finishInit(this);for(var l=0;l<_a.length;++l)_a[l](this);Zr(this),b&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}Na.defaults=La,Na.optionHandlers=Ma;var _a=[];function Ea(e,t,n,r){var i,o=e.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=xt(e,t).state:n="prev");var a=e.options.tabSize,l=et(o,t),s=j(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var c,u=l.text.match(/^\s*/)[0];if(r||/\S/.test(l.text)){if("smart"==n&&((c=o.mode.indent(i,l.text.slice(u.length),l.text))==B||150<c)){if(!r)return;n="prev"}}else c=0,n="not";"prev"==n?c=t>o.first?j(et(o,t-1).text,null,a):0:"add"==n?c=s+e.options.indentUnit:"subtract"==n?c=s-e.options.indentUnit:"number"==typeof n&&(c=s+n),c=Math.max(0,c);var d="",f=0;if(e.options.indentWithTabs)for(var h=Math.floor(c/a);h;--h)f+=a,d+="\t";if(f<c&&(d+=$(c-f)),d!=u)return yo(o,d,st(t,0),st(t,u.length),"+input"),!(l.stateAfter=null);for(var p=0;p<o.sel.ranges.length;p++){var m=o.sel.ranges[p];if(m.head.line==t&&m.head.ch<u.length){var g=st(t,u.length);Qi(o,p,new Li(g,g));break}}}Na.defineInitHook=function(e){return _a.push(e)};var za=null;function Da(e){za=e}function Pa(e,t,n,r,i){var o=e.doc;e.display.shift=!1,r=r||o.sel;var a=+new Date-200,l="paste"==i||e.state.pasteIncoming>a,s=He(t),c=null;if(l&&1<r.ranges.length)if(za&&za.text.join("\n")==t){if(r.ranges.length%za.text.length==0){c=[];for(var u=0;u<za.text.length;u++)c.push(o.splitLines(za.text[u]))}}else s.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(c=X(s,function(e){return[e]}));for(var d=e.curOp.updateInput,f=r.ranges.length-1;0<=f;f--){var h=r.ranges[f],p=h.from(),m=h.to();h.empty()&&(n&&0<n?p=st(p.line,p.ch-n):e.state.overwrite&&!l?m=st(m.line,Math.min(et(o,m.line).text.length,m.ch+Y(s).length)):l&&za&&za.lineWise&&za.text.join("\n")==t&&(p=m=st(p.line,0)));var g={from:p,to:m,text:c?c[f%c.length]:s,origin:i||(l?"paste":e.state.cutIncoming>a?"cut":"+input")};ho(e.doc,g),mn(e,"inputRead",e,g)}t&&!l&&Ia(e,t),Pr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=d),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Fa(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||ni(t,function(){return Pa(t,n,0,null,"paste")}),!0}function Ia(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;0<=r;r--){var i=n.ranges[r];if(!(100<i.head.ch||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var l=0;l<o.electricChars.length;l++)if(-1<t.indexOf(o.electricChars.charAt(l))){a=Ea(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(et(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Ea(e,i.head.line,"smart"));a&&mn(e,"electricInput",e,i.head.line)}}}function ja(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,o={anchor:st(i,0),head:st(i+1,0)};n.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:n}}function Wa(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Ha(){var e=N("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=N("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return b?e.style.width="1000px":e.setAttribute("wrap","off"),u&&(e.style.border="1px solid black"),Wa(e),t}function Ra(n,r,i,e,o){var t=r,a=i,l=et(n,r.line),s=o&&n.cm&&"rtl"==n.cm.getOption("direction")?-i:i;function c(e){var t;if(null==(t=o?function(t,n,l,e){var s=ye(n,t.doc.direction);if(!s)return na(n,l,e);l.ch>=n.text.length?(l.ch=n.text.length,l.sticky="before"):l.ch<=0&&(l.ch=0,l.sticky="after");var r=se(s,l.ch,l.sticky),i=s[r];if("ltr"==t.doc.direction&&i.level%2==0&&(0<e?i.to>l.ch:i.from<l.ch))return na(n,l,e);function c(e,t){return ta(n,e instanceof st?e.ch:e,t)}function o(e){return t.options.lineWrapping?(a=a||jn(t,n),ir(t,n,a,e)):{begin:0,end:n.text.length}}var a,u=o("before"==l.sticky?c(l,-1):l.ch);if("rtl"==t.doc.direction||1==i.level){var d=1==i.level==e<0,f=c(l,d?1:-1);if(null!=f&&(d?f<=i.to&&f<=u.end:f>=i.from&&f>=u.begin)){var h=d?"before":"after";return new st(l.line,f,h)}}function p(e,t,n){for(var r=function(e,t){return t?new st(l.line,c(e,1),"before"):new st(l.line,e,"after")};0<=e&&e<s.length;e+=t){var i=s[e],o=0<t==(1!=i.level),a=o?n.begin:c(n.end,-1);if(i.from<=a&&a<i.to)return r(a,o);if(a=o?i.from:c(i.to,-1),n.begin<=a&&a<n.end)return r(a,o)}}var m=p(r+e,e,u);if(m)return m;var g=0<e?u.end:c(u.begin,-1);return null==g||0<e&&g==n.text.length||!(m=p(0<e?0:s.length-1,e,o(g)))?null:m}(n.cm,l,r,i):na(l,r,i))){if(e||!function(){var e=r.line+s;return!(e<n.first||e>=n.first+n.size)&&(r=new st(e,r.ch,r.sticky),l=et(n,e))}())return!1;r=ra(o,n.cm,l,r.line,s)}else r=t;return!0}if("char"==e)c();else if("column"==e)c(!0);else if("word"==e||"group"==e)for(var u=null,d="group"==e,f=n.cm&&n.cm.getHelper(r,"wordChars"),h=!0;!(i<0)||c(!h);h=!1){var p=l.text.charAt(r.ch)||"\n",m=te(p,f)?"w":d&&"\n"==p?"n":!d||/\s/.test(p)?null:"p";if(!d||h||m||(m="s"),u&&u!=m){i<0&&(i=1,c(),r.sticky="after");break}if(m&&(u=m),0<i&&!c(!h))break}var g=so(n,r,t,a,!0);return ut(t,g)&&(g.hitSide=!0),g}function Ba(e,t,n,r){var i,o,a=e.doc,l=t.left;if("page"==r){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),c=Math.max(s-.5*lr(e.display),3);i=(0<n?t.bottom:t.top)+n*c}else"line"==r&&(i=0<n?t.bottom+3:t.top-3);for(;(o=nr(e,l,i)).outside;){if(n<0?i<=0:i>=a.height){o.hitSide=!0;break}i+=5*n}return o}function qa(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new W,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null}function Ua(e,t){var n=In(e,t.line);if(!n||n.hidden)return null;var r=et(e.doc,t.line),i=Pn(n,r,t.line),o=ye(r,e.doc.direction),a="left";o&&(a=se(o,t.ch)%2?"right":"left");var l=Bn(i.map,t.ch,a);return l.offset="right"==l.collapse?l.end:l.start,l}function Ka(e,t){return t&&(e.bad=!0),e}function Va(e,t,n){var r;if(t==e.display.lineDiv){if(!(r=e.display.lineDiv.childNodes[n]))return Ka(e.clipPos(st(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==r)return Ga(o,t,n)}}function Ga(c,e,t){var n=c.text.firstChild,r=!1;if(!e||!_(n,e))return Ka(st(it(c.line),0),!0);if(e==n&&(r=!0,e=n.childNodes[t],t=0,!e)){var i=c.rest?Y(c.rest):c.line;return Ka(st(it(i),i.text.length),r)}var o=3==e.nodeType?e:null,a=e;for(o||1!=e.childNodes.length||3!=e.firstChild.nodeType||(o=e.firstChild,t=t&&o.nodeValue.length);a.parentNode!=n;)a=a.parentNode;var u=c.measure,d=u.maps;function l(e,t,n){for(var r=-1;r<(d?d.length:0);r++)for(var i=r<0?u.map:d[r],o=0;o<i.length;o+=3){var a=i[o+2];if(a==e||a==t){var l=it(r<0?c.line:c.rest[r]),s=i[o]+n;return(n<0||a!=e)&&(s=i[o+(n?1:0)]),st(l,s)}}}var s=l(o,a,t);if(s)return Ka(s,r);for(var f=a.nextSibling,h=o?o.nodeValue.length-t:0;f;f=f.nextSibling){if(s=l(f,f.firstChild,0))return Ka(st(s.line,s.ch-h),r);h+=f.textContent.length}for(var p=a.previousSibling,m=t;p;p=p.previousSibling){if(s=l(p,p.firstChild,-1))return Ka(st(s.line,s.ch+m),r);m+=p.textContent.length}}qa.prototype.init=function(e){var t=this,a=this,l=a.cm,s=a.div=e.lineDiv;function n(e){if(!Te(l,e)){if(l.somethingSelected())Da({lineWise:!1,text:l.getSelections()}),"cut"==e.type&&l.replaceSelection("",null,"cut");else{if(!l.options.lineWiseCopyCut)return;var t=ja(l);Da({lineWise:!0,text:t.text}),"cut"==e.type&&l.operation(function(){l.setSelections(t.ranges,0,q),l.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var n=za.text.join("\n");if(e.clipboardData.setData("Text",n),e.clipboardData.getData("Text")==n)return void e.preventDefault()}var r=Ha(),i=r.firstChild;l.display.lineSpace.insertBefore(r,l.display.lineSpace.firstChild),i.value=za.text.join("\n");var o=document.activeElement;P(i),setTimeout(function(){l.display.lineSpace.removeChild(r),o.focus(),o==s&&a.showPrimarySelection()},50)}}Wa(s,l.options.spellcheck,l.options.autocorrect,l.options.autocapitalize),we(s,"paste",function(e){Te(l,e)||Fa(e,l)||k<=11&&setTimeout(ri(l,function(){return t.updateFromDOM()}),20)}),we(s,"compositionstart",function(e){t.composing={data:e.data,done:!1}}),we(s,"compositionupdate",function(e){t.composing||(t.composing={data:e.data,done:!1})}),we(s,"compositionend",function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),we(s,"touchstart",function(){return a.forceCompositionEnd()}),we(s,"input",function(){t.composing||t.readFromDOMSoon()}),we(s,"copy",n),we(s,"cut",n)},qa.prototype.prepareSelection=function(){var e=xr(this.cm,!1);return e.focus=this.cm.state.focused,e},qa.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},qa.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},qa.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom)e.removeAllRanges();else{var o=Va(t,e.anchorNode,e.anchorOffset),a=Va(t,e.focusNode,e.focusOffset);if(!o||o.bad||!a||a.bad||0!=ct(ht(o,a),r)||0!=ct(ft(o,a),i)){var l=t.display.view,s=r.line>=t.display.viewFrom&&Ua(t,r)||{node:l[0].measure.map[2],offset:0},c=i.line<t.display.viewTo&&Ua(t,i);if(!c){var u=l[l.length-1].measure,d=u.maps?u.maps[u.maps.length-1]:u.map;c={node:d[d.length-1],offset:d[d.length-2]-d[d.length-3]}}if(s&&c){var f,h=e.rangeCount&&e.getRangeAt(0);try{f=S(s.node,s.offset,c.offset,c.node)}catch(e){}f&&(!m&&t.state.focused?(e.collapse(s.node,s.offset),f.collapsed||(e.removeAllRanges(),e.addRange(f))):(e.removeAllRanges(),e.addRange(f)),h&&null==e.anchorNode?e.addRange(h):m&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},qa.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},qa.prototype.showMultipleSelections=function(e){A(this.cm.display.cursorDiv,e.cursors),A(this.cm.display.selectionDiv,e.selection)},qa.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},qa.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return _(this.div,t)},qa.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())},qa.prototype.blur=function(){this.div.blur()},qa.prototype.getField=function(){return this.div},qa.prototype.supportsTouch=function(){return!0},qa.prototype.receivedFocus=function(){var t=this;this.selectionInEditor()?this.pollSelection():ni(this.cm,function(){return t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))})},qa.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},qa.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=this.getSelection(),t=this.cm;if(d&&a&&this.cm.display.gutterSpecs.length&&function(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}(e.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var n=Va(t,e.anchorNode,e.anchorOffset),r=Va(t,e.focusNode,e.focusOffset);n&&r&&ni(t,function(){no(t.doc,Ai(n,r),q),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})}}},qa.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e,t,n,r=this.cm,i=r.display,o=r.doc.sel.primary(),a=o.from(),l=o.to();if(0==a.ch&&a.line>r.firstLine()&&(a=st(a.line-1,et(r.doc,a.line-1).length)),l.ch==et(r.doc,l.line).text.length&&l.line<r.lastLine()&&(l=st(l.line+1,0)),a.line<i.viewFrom||l.line>i.viewTo-1)return!1;n=a.line==i.viewFrom||0==(e=pr(r,a.line))?(t=it(i.view[0].line),i.view[0].node):(t=it(i.view[e].line),i.view[e-1].node.nextSibling);var s,c,u=pr(r,l.line);if(c=u==i.view.length-1?(s=i.viewTo-1,i.lineDiv.lastChild):(s=it(i.view[u+1].line)-1,i.view[u+1].node.previousSibling),!n)return!1;for(var d=r.doc.splitLines(function(l,e,t,s,c){var n="",u=!1,d=l.doc.lineSeparator(),f=!1;function h(){u&&(n+=d,f&&(n+=d),u=f=!1)}function p(e){e&&(h(),n+=e)}function m(e){if(1==e.nodeType){var t=e.getAttribute("cm-text");if(t)return void p(t);var n,r=e.getAttribute("cm-marker");if(r){var i=l.findMarks(st(s,0),st(c+1,0),function(t){return function(e){return e.id==t}}(+r));return void(i.length&&(n=i[0].find(0))&&p(tt(l.doc,n.from,n.to).join(d)))}if("false"==e.getAttribute("contenteditable"))return;var o=/^(pre|div|p|li|table|br)$/i.test(e.nodeName);if(!/^br$/i.test(e.nodeName)&&0==e.textContent.length)return;o&&h();for(var a=0;a<e.childNodes.length;a++)m(e.childNodes[a]);/^(pre|p)$/i.test(e.nodeName)&&(f=!0),o&&(u=!0)}else 3==e.nodeType&&p(e.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;m(e),e!=t;)e=e.nextSibling,f=!1;return n}(r,n,c,t,s)),f=tt(r.doc,st(t,0),st(s,et(r.doc,s).text.length));1<d.length&&1<f.length;)if(Y(d)==Y(f))d.pop(),f.pop(),s--;else{if(d[0]!=f[0])break;d.shift(),f.shift(),t++}for(var h=0,p=0,m=d[0],g=f[0],v=Math.min(m.length,g.length);h<v&&m.charCodeAt(h)==g.charCodeAt(h);)++h;for(var y=Y(d),b=Y(f),w=Math.min(y.length-(1==d.length?h:0),b.length-(1==f.length?h:0));p<w&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p;if(1==d.length&&1==f.length&&t==a.line)for(;h&&h>a.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)h--,p++;d[d.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),d[0]=d[0].slice(h).replace(/\u200b+$/,"");var x=st(t,h),k=st(s,f.length?Y(f).length-p:0);return 1<d.length||d[0]||ct(x,k)?(yo(r.doc,d,x,k,"+input"),!0):void 0},qa.prototype.ensurePolled=function(){this.forceCompositionEnd()},qa.prototype.reset=function(){this.forceCompositionEnd()},qa.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},qa.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()},80))},qa.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||ni(this.cm,function(){return mr(e.cm)})},qa.prototype.setUneditable=function(e){e.contentEditable="false"},qa.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||ri(this.cm,Pa)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},qa.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},qa.prototype.onContextMenu=function(){},qa.prototype.resetPosition=function(){},qa.prototype.needsContentAttribute=!0;function $a(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new W,this.hasSelection=!1,this.composing=null}var Ya,Xa,Za,Ja,Qa;function el(e,t,r,n){Ya.defaults[e]=t,r&&(Xa[e]=n?function(e,t,n){n!=Sa&&r(e,t,n)}:r)}$a.prototype.init=function(n){var e=this,r=this,i=this.cm;this.createField(n);var o=this.textarea;function t(e){if(!Te(i,e)){if(i.somethingSelected())Da({lineWise:!1,text:i.getSelections()});else{if(!i.options.lineWiseCopyCut)return;var t=ja(i);Da({lineWise:!0,text:t.text}),"cut"==e.type?i.setSelections(t.ranges,null,q):(r.prevInput="",o.value=t.text.join("\n"),P(o))}"cut"==e.type&&(i.state.cutIncoming=+new Date)}}n.wrapper.insertBefore(this.wrapper,n.wrapper.firstChild),u&&(o.style.width="0px"),we(o,"input",function(){x&&9<=k&&e.hasSelection&&(e.hasSelection=null),r.poll()}),we(o,"paste",function(e){Te(i,e)||Fa(e,i)||(i.state.pasteIncoming=+new Date,r.fastPoll())}),we(o,"cut",t),we(o,"copy",t),we(n.scroller,"paste",function(e){if(!An(n,e)&&!Te(i,e)){if(!o.dispatchEvent)return i.state.pasteIncoming=+new Date,void r.focus();var t=new Event("paste");t.clipboardData=e.clipboardData,o.dispatchEvent(t)}}),we(n.lineSpace,"selectstart",function(e){An(n,e)||Ae(e)}),we(o,"compositionstart",function(){var e=i.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:i.markText(e,i.getCursor("to"),{className:"CodeMirror-composing"})}}),we(o,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},$a.prototype.createField=function(e){this.wrapper=Ha(),this.textarea=this.wrapper.firstChild},$a.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=xr(e);if(e.options.moveInputWithCursor){var i=Qn(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},$a.prototype.showSelection=function(e){var t=this.cm.display;A(t.cursorDiv,e.cursors),A(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},$a.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&P(this.textarea),x&&9<=k&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",x&&9<=k&&(this.hasSelection=null))}},$a.prototype.getField=function(){return this.textarea},$a.prototype.supportsTouch=function(){return!1},$a.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!f||E()!=this.textarea))try{this.textarea.focus()}catch(e){}},$a.prototype.blur=function(){this.textarea.blur()},$a.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},$a.prototype.receivedFocus=function(){this.slowPoll()},$a.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},$a.prototype.fastPoll=function(){var t=!1,n=this;n.pollingFast=!0,n.polling.set(20,function e(){n.poll()||t?(n.pollingFast=!1,n.slowPoll()):(t=!0,n.polling.set(60,e))})},$a.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Re(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(x&&9<=k&&this.hasSelection===i||w&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||r||(r="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var a=0,l=Math.min(r.length,i.length);a<l&&r.charCodeAt(a)==i.charCodeAt(a);)++a;return ni(t,function(){Pa(t,i.slice(a),r.length-a,null,e.composing?"*compose":null),1e3<i.length||-1<i.indexOf("\n")?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},$a.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},$a.prototype.onKeyPress=function(){x&&9<=k&&(this.hasSelection=null),this.fastPoll()},$a.prototype.onContextMenu=function(e){var n=this,r=n.cm,i=r.display,o=n.textarea;n.contextMenuPending&&n.contextMenuPending();var t=hr(r,e),a=i.scroller.scrollTop;if(t&&!g){r.options.resetSelectionOnContextMenu&&-1==r.doc.sel.contains(t)&&ri(r,no)(r.doc,Ai(t),q);var l,s=o.style.cssText,c=n.wrapper.style.cssText,u=n.wrapper.offsetParent.getBoundingClientRect();if(n.wrapper.style.cssText="position: static",o.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-u.top-5)+"px; left: "+(e.clientX-u.left-5)+"px;\n z-index: 1000; background: "+(x?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",b&&(l=window.scrollY),i.input.focus(),b&&window.scrollTo(null,l),i.input.reset(),r.somethingSelected()||(o.value=n.prevInput=" "),n.contextMenuPending=h,i.selForContextMenu=r.doc.sel,clearTimeout(i.detectingSelectAll),x&&9<=k&&f(),C){_e(e);var d=function(){ke(window,"mouseup",d),setTimeout(h,20)};we(window,"mouseup",d)}else setTimeout(h,50)}function f(){if(null!=o.selectionStart){var e=r.somethingSelected(),t="​"+(e?o.value:"");o.value="⇚",o.value=t,n.prevInput=e?"":"​",o.selectionStart=1,o.selectionEnd=t.length,i.selForContextMenu=r.doc.sel}}function h(){if(n.contextMenuPending==h&&(n.contextMenuPending=!1,n.wrapper.style.cssText=c,o.style.cssText=s,x&&k<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=a),null!=o.selectionStart)){(!x||x&&k<9)&&f();var e=0,t=function(){i.selForContextMenu==r.doc.sel&&0==o.selectionStart&&0<o.selectionEnd&&"​"==n.prevInput?ri(r,uo)(r):e++<10?i.detectingSelectAll=setTimeout(t,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(t,200)}}},$a.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},$a.prototype.setUneditable=function(){},$a.prototype.needsContentAttribute=!1,Xa=(Ya=Na).optionHandlers,Ya.defineOption=el,Ya.Init=Sa,el("value","",function(e,t){return e.setValue(t)},!0),el("mode",null,function(e,t){e.doc.modeOption=t,zi(e)},!0),el("indentUnit",2,zi,!0),el("indentWithTabs",!1),el("smartIndent",!0),el("tabSize",4,function(e){Di(e),Vn(e),mr(e)},!0),el("lineSeparator",null,function(e,r){if(e.doc.lineSep=r){var i=[],o=e.doc.first;e.doc.iter(function(e){for(var t=0;;){var n=e.text.indexOf(r,t);if(-1==n)break;t=n+r.length,i.push(st(o,n))}o++});for(var t=i.length-1;0<=t;t--)yo(e.doc,r,i[t],st(i[t].line,i[t].ch+r.length))}}),el("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=Sa&&e.refresh()}),el("specialCharPlaceholder",an,function(e){return e.refresh()},!0),el("electricChars",!0),el("inputStyle",f?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),el("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),el("autocorrect",!1,function(e,t){return e.getInputField().autocorrect=t},!0),el("autocapitalize",!1,function(e,t){return e.getInputField().autocapitalize=t},!0),el("rtlMoveVisually",!p),el("wholeLineUpdateBefore",!0),el("theme","default",function(e){Ta(e),yi(e)},!0),el("keyMap","default",function(e,t,n){var r=Qo(t),i=n!=Sa&&Qo(n);i&&i.detach&&i.detach(e,r),r.attach&&r.attach(e,i||null)}),el("extraKeys",null),el("configureMouse",null),el("lineWrapping",!1,Oa,!0),el("gutters",[],function(e,t){e.display.gutterSpecs=gi(t,e.options.lineNumbers),yi(e)},!0),el("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?ur(e.display)+"px":"0",e.refresh()},!0),el("coverGutterNextToScrollbar",!1,function(e){return Kr(e)},!0),el("scrollbarStyle","native",function(e){$r(e),Kr(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),el("lineNumbers",!1,function(e,t){e.display.gutterSpecs=gi(e.options.gutters,t),yi(e)},!0),el("firstLineNumber",1,yi,!0),el("lineNumberFormatter",function(e){return e},yi,!0),el("showCursorWhenSelecting",!1,wr,!0),el("resetSelectionOnContextMenu",!0),el("lineWiseCopyCut",!0),el("pasteLinesPerSelection",!0),el("selectionsMayTouch",!1),el("readOnly",!1,function(e,t){"nocursor"==t&&(Or(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),el("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),el("dragDrop",!0,Aa),el("allowDropFileTypes",null),el("cursorBlinkRate",530),el("cursorScrollMargin",0),el("cursorHeight",1,wr,!0),el("singleCursorHeightPerLine",!0,wr,!0),el("workTime",100),el("workDelay",100),el("flattenSpans",!0,Di,!0),el("addModeClass",!1,Di,!0),el("pollInterval",100),el("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),el("historyEventDelay",1250),el("viewportMargin",10,function(e){return e.refresh()},!0),el("maxHighlightLength",1e4,Di,!0),el("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),el("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),el("autofocus",null),el("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0),el("phrases",null),Ja=(Za=Na).optionHandlers,Qa=Za.helpers={},Za.prototype={constructor:Za,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var n=this.options,r=n[e];n[e]==t&&"mode"!=e||(n[e]=t,Ja.hasOwnProperty(e)&&ri(this,Ja[e])(this,t,r),Ce(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Qo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;n<t.length;++n)if(t[n]==e||t[n].name==e)return t.splice(n,1),!0},addOverlay:ii(function(e,t){var n=e.token?e:Za.getMode(this.options,e);if(n.startState)throw new Error("Overlays may not be stateful.");!function(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}(this.state.overlays,{mode:n,modeSpec:e,opaque:t&&t.opaque,priority:t&&t.priority||0},function(e){return e.priority}),this.state.modeGen++,mr(this)}),removeOverlay:ii(function(e){for(var t=this.state.overlays,n=0;n<t.length;++n){var r=t[n].modeSpec;if(r==e||"string"==typeof e&&r.name==e)return t.splice(n,1),this.state.modeGen++,void mr(this)}}),indentLine:ii(function(e,t,n){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),at(this.doc,e)&&Ea(this,e,t,n)}),indentSelection:ii(function(e){for(var t=this.doc.sel.ranges,n=-1,r=0;r<t.length;r++){var i=t[r];if(i.empty())i.head.line>n&&(Ea(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&Pr(this));else{var o=i.from(),a=i.to(),l=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var s=l;s<n;++s)Ea(this,s,e);var c=this.doc.sel.ranges;0==o.ch&&t.length==c.length&&0<c[r].from().ch&&Qi(this.doc,r,new Li(o,c[r].to()),q)}}}),getTokenAt:function(e,t){return Lt(this,e,t)},getLineTokens:function(e,t){return Lt(this,st(e),t,!0)},getTokenTypeAt:function(e){e=mt(this.doc,e);var t,n=wt(this,et(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var a=r+i>>1;if((a?n[2*a-1]:0)>=o)i=a;else{if(!(n[2*a+1]<o)){t=n[2*a+2];break}r=1+a}}var l=t?t.indexOf("overlay "):-1;return l<0?t:0==l?null:t.slice(0,l-1)},getModeAt:function(e){var t=this.doc.mode;return t.innerMode?Za.innerMode(t,this.getTokenAt(e).state).mode:t},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var n=[];if(!Qa.hasOwnProperty(t))return n;var r=Qa[t],i=this.getModeAt(e);if("string"==typeof i[t])r[i[t]]&&n.push(r[i[t]]);else if(i[t])for(var o=0;o<i[t].length;o++){var a=r[i[t][o]];a&&n.push(a)}else i.helperType&&r[i.helperType]?n.push(r[i.helperType]):r[i.name]&&n.push(r[i.name]);for(var l=0;l<r._global.length;l++){var s=r._global[l];s.pred(i,this)&&-1==H(n,s.val)&&n.push(s.val)}return n},getStateAfter:function(e,t){var n=this.doc;return xt(this,(e=pt(n,null==e?n.first+n.size-1:e))+1,t).state},cursorCoords:function(e,t){var n=this.doc.sel.primary();return Qn(this,null==e?n.head:"object"==typeof e?mt(this.doc,e):e?n.from():n.to(),t||"page")},charCoords:function(e,t){return Jn(this,mt(this.doc,e),t||"page")},coordsChar:function(e,t){return nr(this,(e=Zn(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=Zn(this,{top:e,left:0},t||"page").top,ot(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,n){var r,i=!1;if("number"==typeof e){var o=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:o<e&&(e=o,i=!0),r=et(this.doc,e)}else r=e;return Xn(this,r,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-Zt(r):0)},defaultTextHeight:function(){return lr(this.display)},defaultCharWidth:function(){return sr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o=this.display,a=(e=Qn(this,mt(this.doc,e))).bottom,l=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==r)a=e.top;else if("above"==r||"near"==r){var s=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=s&&(a=e.bottom),l+t.offsetWidth>c&&(l=c-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(l=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?l=0:"middle"==i&&(l=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=l+"px"),n&&function(e,t){var n=zr(e,t);null!=n.scrollTop&&Wr(e,n.scrollTop),null!=n.scrollLeft&&Rr(e,n.scrollLeft)}(this,{left:l,top:a,right:l+t.offsetWidth,bottom:a+t.offsetHeight})},triggerOnKeyDown:ii(ha),triggerOnKeyPress:ii(ma),triggerOnKeyUp:pa,triggerOnMouseDown:ii(ba),execCommand:function(e){if(ia.hasOwnProperty(e))return ia[e].call(null,this)},triggerElectric:ii(function(e){Ia(this,e)}),findPosH:function(e,t,n,r){var i=1;t<0&&(i=-1,t=-t);for(var o=mt(this.doc,e),a=0;a<t&&!(o=Ra(this.doc,o,i,n,r)).hitSide;++a);return o},moveH:ii(function(t,n){var r=this;this.extendSelectionsBy(function(e){return r.display.shift||r.doc.extend||e.empty()?Ra(r.doc,e.head,t,n,r.options.rtlMoveVisually):t<0?e.from():e.to()},K)}),deleteH:ii(function(n,r){var e=this.doc.sel,i=this.doc;e.somethingSelected()?i.replaceSelection("",null,"+delete"):ea(this,function(e){var t=Ra(i,e.head,n,r,!1);return n<0?{from:t,to:e.head}:{from:e.head,to:t}})}),findPosV:function(e,t,n,r){var i=1,o=r;t<0&&(i=-1,t=-t);for(var a=mt(this.doc,e),l=0;l<t;++l){var s=Qn(this,a,"div");if(null==o?o=s.left:s.left=o,(a=Ba(this,s,i,n)).hitSide)break}return a},moveV:ii(function(r,i){var o=this,a=this.doc,l=[],s=!this.display.shift&&!a.extend&&a.sel.somethingSelected();if(a.extendSelectionsBy(function(e){if(s)return r<0?e.from():e.to();var t=Qn(o,e.head,"div");null!=e.goalColumn&&(t.left=e.goalColumn),l.push(t.left);var n=Ba(o,t,r,i);return"page"==i&&e==a.sel.primary()&&Dr(o,Jn(o,n,"div").top-t.top),n},K),l.length)for(var e=0;e<a.sel.ranges.length;e++)a.sel.ranges[e].goalColumn=l[e]}),findWordAt:function(e){var t=et(this.doc,e.line).text,n=e.ch,r=e.ch;if(t){var i=this.getHelper(e,"wordChars");"before"!=e.sticky&&r!=t.length||!n?++r:--n;for(var o=t.charAt(n),a=te(o,i)?function(e){return te(e,i)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!te(e)};0<n&&a(t.charAt(n-1));)--n;for(;r<t.length&&a(t.charAt(r));)++r}return new Li(st(e.line,n),st(e.line,r))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?z(this.display.cursorDiv,"CodeMirror-overwrite"):L(this.display.cursorDiv,"CodeMirror-overwrite"),Ce(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==E()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:ii(function(e,t){Fr(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-En(this)-this.display.barHeight,width:e.scrollWidth-En(this)-this.display.barWidth,clientHeight:Dn(this),clientWidth:zn(this)}},scrollIntoView:ii(function(e,t){null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:st(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line?function(e,t){Ir(e),e.curOp.scrollToPos=t}(this,e):jr(this,e.from,e.to,e.margin)}),setSize:ii(function(e,t){function n(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e}var r=this;null!=e&&(this.display.wrapper.style.width=n(e)),null!=t&&(this.display.wrapper.style.height=n(t)),this.options.lineWrapping&&Kn(this);var i=this.display.viewFrom;this.doc.iter(i,this.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){gr(r,i,"widget");break}++i}),this.curOp.forceUpdate=!0,Ce(this,"refresh",this)}),operation:function(e){return ni(this,e)},startOperation:function(){return Xr(this)},endOperation:function(){return Zr(this)},refresh:ii(function(){var e=this.display.cachedTextHeight;mr(this),this.curOp.forceUpdate=!0,Vn(this),Fr(this,this.doc.scrollLeft,this.doc.scrollTop),fi(this.display),(null==e||.5<Math.abs(e-lr(this.display)))&&fr(this),Ce(this,"refresh",this)}),swapDoc:ii(function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),ji(this,e),Vn(this),this.display.input.reset(),Fr(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,mn(this,"swapDoc",this,t),t}),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Me(Za),Za.registerHelper=function(e,t,n){Qa.hasOwnProperty(e)||(Qa[e]=Za[e]={_global:[]}),Qa[e][t]=n},Za.registerGlobalHelper=function(e,t,n,r){Za.registerHelper(e,t,r),Qa[e]._global.push({pred:n,val:r})};var tl,nl="iter insert remove copy getEditor constructor".split(" ");for(var rl in Do.prototype)Do.prototype.hasOwnProperty(rl)&&H(nl,rl)<0&&(Na.prototype[rl]=function(e){return function(){return e.apply(this.doc,arguments)}}(Do.prototype[rl]));return Me(Do),Na.inputStyles={textarea:$a,contenteditable:qa},Na.defineMode=function(e){Na.defaults.mode||"null"==e||(Na.defaults.mode=e),function(e,t){2<arguments.length&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ue[e]=t}.apply(this,arguments)},Na.defineMIME=function(e,t){Ke[e]=t},Na.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Na.defineMIME("text/plain","null"),Na.defineExtension=function(e,t){Na.prototype[e]=t},Na.defineDocExtension=function(e,t){Do.prototype[e]=t},Na.fromTextArea=function(t,n){if((n=n?I(n):{}).value=t.value,!n.tabindex&&t.tabIndex&&(n.tabindex=t.tabIndex),!n.placeholder&&t.placeholder&&(n.placeholder=t.placeholder),null==n.autofocus){var e=E();n.autofocus=e==t||null!=t.getAttribute("autofocus")&&e==document.body}function r(){t.value=l.getValue()}var i;if(t.form&&(we(t.form,"submit",r),!n.leaveSubmitMethodAlone)){var o=t.form;i=o.submit;try{var a=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=a}}catch(e){}}n.finishInit=function(e){e.save=r,e.getTextArea=function(){return t},e.toTextArea=function(){e.toTextArea=isNaN,r(),t.parentNode.removeChild(e.getWrapperElement()),t.style.display="",t.form&&(ke(t.form,"submit",r),n.leaveSubmitMethodAlone||"function"!=typeof t.form.submit||(t.form.submit=i))}},t.style.display="none";var l=Na(function(e){return t.parentNode.insertBefore(e,t.nextSibling)},n);return l},(tl=Na).off=ke,tl.on=we,tl.wheelEventPixels=Ci,tl.Doc=Do,tl.splitLines=He,tl.countColumn=j,tl.findColumn=V,tl.isWordChar=ee,tl.Pass=B,tl.signal=Ce,tl.Line=en,tl.changeEnd=Oi,tl.scrollbarModel=Gr,tl.Pos=st,tl.cmpPos=ct,tl.modes=Ue,tl.mimeModes=Ke,tl.resolveMode=Ve,tl.getMode=Ge,tl.modeExtensions=$e,tl.extendMode=Ye,tl.copyState=Xe,tl.startState=Je,tl.innerMode=Ze,tl.commands=ia,tl.keyMap=Vo,tl.keyName=Jo,tl.isModifierKey=Xo,tl.lookupKey=Yo,tl.normalizeKeyMap=$o,tl.StringStream=Qe,tl.SharedTextMarker=No,tl.TextMarker=Ao,tl.LineWidget=So,tl.e_preventDefault=Ae,tl.e_stopPropagation=Oe,tl.e_stop=_e,tl.addClass=z,tl.contains=_,tl.rmClass=L,tl.keyNames=Bo,Na.version="5.51.0",Na},"object"==typeof n&&void 0!==t?t.exports=i():"function"==typeof define&&define.amd?define(i):(r=r||self).CodeMirror=i()},{}],20:[function(e,t,n){var r;r=function(N){"use strict";function e(e){for(var t={},n=0;n<e.length;++n)t[e[n].toLowerCase()]=!0;return t}N.defineMode("css",function(e,t){var n=t.inline;t.propertyKeywords||(t=N.resolveMode("text/css"));var r,i,o=e.indentUnit,a=t.tokenHooks,l=t.documentTypes||{},s=t.mediaTypes||{},c=t.mediaFeatures||{},u=t.mediaValueKeywords||{},d=t.propertyKeywords||{},f=t.nonStandardPropertyKeywords||{},h=t.fontProperties||{},p=t.counterDescriptors||{},m=t.colorKeywords||{},g=t.valueKeywords||{},v=t.allowNested,y=t.lineComment,b=!0===t.supportsAtComponent;function w(e,t){return r=t,e}function x(i){return function(e,t){for(var n,r=!1;null!=(n=e.next());){if(n==i&&!r){")"==i&&e.backUp(1);break}r=!r&&"\\"==n}return n!=i&&(r||")"==i)||(t.tokenize=null),w("string","string")}}function k(e,t){return e.next(),e.match(/\s*[\"\')]/,!1)?t.tokenize=null:t.tokenize=x(")"),w(null,"(")}function C(e,t,n){this.type=e,this.indent=t,this.prev=n}function T(e,t,n,r){return e.context=new C(n,t.indentation()+(!1===r?0:o),e.context),n}function S(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function L(e,t,n){return O[n.context.type](e,t,n)}function M(e,t,n,r){for(var i=r||1;0<i;i--)n.context=n.context.prev;return L(e,t,n)}function A(e){var t=e.current().toLowerCase();i=g.hasOwnProperty(t)?"atom":m.hasOwnProperty(t)?"keyword":"variable"}var O={top:function(e,t,n){if("{"==e)return T(n,t,"block");if("}"==e&&n.context.prev)return S(n);if(b&&/@component/i.test(e))return T(n,t,"atComponentBlock");if(/^@(-moz-)?document$/i.test(e))return T(n,t,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/i.test(e))return T(n,t,"atBlock");if(/^@(font-face|counter-style)/i.test(e))return n.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return T(n,t,"at");if("hash"==e)i="builtin";else if("word"==e)i="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return T(n,t,"interpolation");if(":"==e)return"pseudo";if(v&&"("==e)return T(n,t,"parens")}return n.context.type},block:function(e,t,n){if("word"!=e)return"meta"==e?"block":v||"hash"!=e&&"qualifier"!=e?O.top(e,t,n):(i="error","block");var r=t.current().toLowerCase();return d.hasOwnProperty(r)?(i="property","maybeprop"):f.hasOwnProperty(r)?(i="string-2","maybeprop"):v?(i=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(i+=" error","maybeprop")},maybeprop:function(e,t,n){return":"==e?T(n,t,"prop"):L(e,t,n)},prop:function(e,t,n){if(";"==e)return S(n);if("{"==e&&v)return T(n,t,"propBlock");if("}"==e||"{"==e)return M(e,t,n);if("("==e)return T(n,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(t.current())){if("word"==e)A(t);else if("interpolation"==e)return T(n,t,"interpolation")}else i+=" error";return"prop"},propBlock:function(e,t,n){return"}"==e?S(n):"word"==e?(i="property","maybeprop"):n.context.type},parens:function(e,t,n){return"{"==e||"}"==e?M(e,t,n):")"==e?S(n):"("==e?T(n,t,"parens"):"interpolation"==e?T(n,t,"interpolation"):("word"==e&&A(t),"parens")},pseudo:function(e,t,n){return"meta"==e?"pseudo":"word"==e?(i="variable-3",n.context.type):L(e,t,n)},documentTypes:function(e,t,n){return"word"==e&&l.hasOwnProperty(t.current())?(i="tag",n.context.type):O.atBlock(e,t,n)},atBlock:function(e,t,n){if("("==e)return T(n,t,"atBlock_parens");if("}"==e||";"==e)return M(e,t,n);if("{"==e)return S(n)&&T(n,t,v?"block":"top");if("interpolation"==e)return T(n,t,"interpolation");if("word"==e){var r=t.current().toLowerCase();i="only"==r||"not"==r||"and"==r||"or"==r?"keyword":s.hasOwnProperty(r)?"attribute":c.hasOwnProperty(r)?"property":u.hasOwnProperty(r)?"keyword":d.hasOwnProperty(r)?"property":f.hasOwnProperty(r)?"string-2":g.hasOwnProperty(r)?"atom":m.hasOwnProperty(r)?"keyword":"error"}return n.context.type},atComponentBlock:function(e,t,n){return"}"==e?M(e,t,n):"{"==e?S(n)&&T(n,t,v?"block":"top",!1):("word"==e&&(i="error"),n.context.type)},atBlock_parens:function(e,t,n){return")"==e?S(n):"{"==e||"}"==e?M(e,t,n,2):O.atBlock(e,t,n)},restricted_atBlock_before:function(e,t,n){return"{"==e?T(n,t,"restricted_atBlock"):"word"==e&&"@counter-style"==n.stateArg?(i="variable","restricted_atBlock_before"):L(e,t,n)},restricted_atBlock:function(e,t,n){return"}"==e?(n.stateArg=null,S(n)):"word"==e?(i="@font-face"==n.stateArg&&!h.hasOwnProperty(t.current().toLowerCase())||"@counter-style"==n.stateArg&&!p.hasOwnProperty(t.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},keyframes:function(e,t,n){return"word"==e?(i="variable","keyframes"):"{"==e?T(n,t,"top"):L(e,t,n)},at:function(e,t,n){return";"==e?S(n):"{"==e||"}"==e?M(e,t,n):("word"==e?i="tag":"hash"==e&&(i="builtin"),"at")},interpolation:function(e,t,n){return"}"==e?S(n):"{"==e||";"==e?M(e,t,n):("word"==e?i="variable":"variable"!=e&&"("!=e&&")"!=e&&(i="error"),"interpolation")}};return{startState:function(e){return{tokenize:null,state:n?"block":"top",stateArg:null,context:new C(n?"block":"top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var n=(t.tokenize||function(e,t){var n=e.next();if(a[n]){var r=a[n](e,t);if(!1!==r)return r}return"@"==n?(e.eatWhile(/[\w\\\-]/),w("def",e.current())):"="==n||("~"==n||"|"==n)&&e.eat("=")?w(null,"compare"):'"'==n||"'"==n?(t.tokenize=x(n),t.tokenize(e,t)):"#"==n?(e.eatWhile(/[\w\\\-]/),w("atom","hash")):"!"==n?(e.match(/^\s*\w*/),w("keyword","important")):/\d/.test(n)||"."==n&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),w("number","unit")):"-"!==n?/[,+>*\/]/.test(n)?w(null,"select-op"):"."==n&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?w("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(n)?w(null,n):e.match(/[\w-.]+(?=\()/)?(/^(url(-prefix)?|domain|regexp)$/.test(e.current().toLowerCase())&&(t.tokenize=k),w("variable callee","variable")):/[\w\\\-]/.test(n)?(e.eatWhile(/[\w\\\-]/),w("property","word")):w(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),w("number","unit")):e.match(/^-[\w\\\-]*/)?(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?w("variable-2","variable-definition"):w("variable-2","variable")):e.match(/^\w+-/)?w("meta","meta"):void 0})(e,t);return n&&"object"==typeof n&&(r=n[1],n=n[0]),i=n,"comment"!=r&&(t.state=O[t.state](r,e,t)),i},indent:function(e,t){var n=e.context,r=t&&t.charAt(0),i=n.indent;return"prop"!=n.type||"}"!=r&&")"!=r||(n=n.prev),n.prev&&("}"!=r||"block"!=n.type&&"top"!=n.type&&"interpolation"!=n.type&&"restricted_atBlock"!=n.type?(")"!=r||"parens"!=n.type&&"atBlock_parens"!=n.type)&&("{"!=r||"at"!=n.type&&"atBlock"!=n.type)||(i=Math.max(0,n.indent-o)):i=(n=n.prev).indent),i},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:y,fold:"brace"}});var t=["domain","regexp","url","url-prefix"],n=e(t),r=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],i=e(r),o=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","orientation","device-pixel-ratio","min-device-pixel-ratio","max-device-pixel-ratio","pointer","any-pointer","hover","any-hover"],a=e(o),l=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive"],s=e(l),c=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-gap","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-gap","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","justify-items","justify-self","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","mix-blend-mode","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","place-content","place-items","place-self","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","user-select","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],u=e(c),d=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],f=e(d),h=e(["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"]),p=e(["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"]),m=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],g=e(m),v=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","graytext","grid","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","multiply","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","opacity","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unset","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"],y=e(v),b=t.concat(r).concat(o).concat(l).concat(c).concat(d).concat(m).concat(v);function w(e,t){for(var n,r=!1;null!=(n=e.next());){if(r&&"/"==n){t.tokenize=null;break}r="*"==n}return["comment","comment"]}N.registerHelper("hintWords","css",b),N.defineMIME("text/css",{documentTypes:n,mediaTypes:i,mediaFeatures:a,mediaValueKeywords:s,propertyKeywords:u,nonStandardPropertyKeywords:f,fontProperties:h,counterDescriptors:p,colorKeywords:g,valueKeywords:y,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=w)(e,t)}},name:"css"}),N.defineMIME("text/x-scss",{mediaTypes:i,mediaFeatures:a,mediaValueKeywords:s,propertyKeywords:u,nonStandardPropertyKeywords:f,colorKeywords:g,valueKeywords:y,fontProperties:h,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=w)(e,t):["operator","operator"]},":":function(e){return!!e.match(/\s*\{/,!1)&&[null,null]},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return!!e.eat("{")&&[null,"interpolation"]}},name:"css",helperType:"scss"}),N.defineMIME("text/x-less",{mediaTypes:i,mediaFeatures:a,mediaValueKeywords:s,propertyKeywords:u,nonStandardPropertyKeywords:f,colorKeywords:g,valueKeywords:y,fontProperties:h,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=w)(e,t):["operator","operator"]},"@":function(e){return e.eat("{")?[null,"interpolation"]:!e.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/i,!1)&&(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),N.defineMIME("text/x-gss",{documentTypes:n,mediaTypes:i,mediaFeatures:a,propertyKeywords:u,nonStandardPropertyKeywords:f,fontProperties:h,counterDescriptors:p,colorKeywords:g,valueKeywords:y,supportsAtComponent:!0,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=w)(e,t)}},name:"css",helperType:"gss"})},"object"==typeof n&&"object"==typeof t?r(e("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":19}],21:[function(e,t,n){var r;r=function(p){"use strict";var i={script:[["lang",/(javascript|babel)/i,"javascript"],["type",/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i,"javascript"],["type",/./,"text/plain"],[null,null,"javascript"]],style:[["lang",/^css$/i,"css"],["type",/^(text\/)?(x-)?(stylesheet|css)$/i,"css"],["type",/./,"text/plain"],[null,null,"css"]]};var r={};function m(e,t){var n=e.match(function(e){var t=r[e];return t||(r[e]=new RegExp("\\s+"+e+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*"))}(t));return n?/^\s*(.*?)\s*$/.exec(n[2])[1]:""}function g(e,t){return new RegExp((t?"^":"")+"</s*"+e+"s*>","i")}function o(e,t){for(var n in e)for(var r=t[n]||(t[n]=[]),i=e[n],o=i.length-1;0<=o;o--)r.unshift(i[o])}p.defineMode("htmlmixed",function(u,e){var d=p.getMode(u,{name:"xml",htmlMode:!0,multilineTagIndentFactor:e.multilineTagIndentFactor,multilineTagIndentPastTag:e.multilineTagIndentPastTag}),f={},t=e&&e.tags,n=e&&e.scriptTypes;if(o(i,f),t&&o(t,f),n)for(var r=n.length-1;0<=r;r--)f.script.unshift(["type",n[r].matches,n[r].mode]);function h(e,t){var n,r=d.token(e,t.htmlState),i=/\btag\b/.test(r);if(i&&!/[<>\s\/]/.test(e.current())&&(n=t.htmlState.tagName&&t.htmlState.tagName.toLowerCase())&&f.hasOwnProperty(n))t.inTag=n+" ";else if(t.inTag&&i&&/>$/.test(e.current())){var o=/^([\S]+) (.*)/.exec(t.inTag);t.inTag=null;var a=">"==e.current()&&function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(!r[0]||r[1].test(m(t,r[0])))return r[2]}}(f[o[1]],o[2]),l=p.getMode(u,a),s=g(o[1],!0),c=g(o[1],!1);t.token=function(e,t){return e.match(s,!1)?(t.token=h,t.localState=t.localMode=null,null):function(e,t,n){var r=e.current(),i=r.search(t);return-1<i?e.backUp(r.length-i):r.match(/<\/?$/)&&(e.backUp(r.length),e.match(t,!1)||e.match(r)),n}(e,c,t.localMode.token(e,t.localState))},t.localMode=l,t.localState=p.startState(l,d.indent(t.htmlState,"",""))}else t.inTag&&(t.inTag+=e.current(),e.eol()&&(t.inTag+=" "));return r}return{startState:function(){return{token:h,inTag:null,localMode:null,localState:null,htmlState:p.startState(d)}},copyState:function(e){var t;return e.localState&&(t=p.copyState(e.localMode,e.localState)),{token:e.token,inTag:e.inTag,localMode:e.localMode,localState:t,htmlState:p.copyState(d,e.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(e,t,n){return!e.localMode||/^\s*<\//.test(t)?d.indent(e.htmlState,t,n):e.localMode.indent?e.localMode.indent(e.localState,t,n):p.Pass},innerMode:function(e){return{state:e.localState||e.htmlState,mode:e.localMode||d}}}},"xml","javascript","css"),p.defineMIME("text/html","htmlmixed")},"object"==typeof n&&"object"==typeof t?r(e("../../lib/codemirror"),e("../xml/xml"),e("../javascript/javascript"),e("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],r):r(CodeMirror)},{"../../lib/codemirror":19,"../css/css":20,"../javascript/javascript":22,"../xml/xml":23}],22:[function(e,t,n){var r;r=function(tt){"use strict";tt.defineMode("javascript",function(e,c){var t,n,r,i,o,a,u=e.indentUnit,d=c.statementIndent,l=c.jsonld,s=c.json||l,f=c.typescript,h=c.wordCharacters||/[\w$\xa1-\uffff]/,p=(t=m("keyword a"),n=m("keyword b"),r=m("keyword c"),i=m("keyword d"),o=m("operator"),a={type:"atom",style:"atom"},{if:m("if"),while:t,with:t,else:n,do:n,try:n,finally:n,return:i,break:i,continue:i,new:m("new"),delete:r,void:r,throw:r,debugger:m("debugger"),var:m("var"),const:m("var"),let:m("var"),function:m("function"),catch:m("catch"),for:m("for"),switch:m("switch"),case:m("case"),default:m("default"),in:o,typeof:o,instanceof:o,true:a,false:a,null:a,undefined:a,NaN:a,Infinity:a,this:m("this"),class:m("class"),super:m("atom"),yield:r,export:m("export"),import:m("import"),extends:r,await:r});function m(e){return{type:e,style:"keyword"}}var g,v,y=/[+\-*&%=<>!?|~^@]/,b=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function w(e,t,n){return g=e,v=n,t}function x(e,t){var n=e.next();if('"'==n||"'"==n)return t.tokenize=function(i){return function(e,t){var n,r=!1;if(l&&"@"==e.peek()&&e.match(b))return t.tokenize=x,w("jsonld-keyword","meta");for(;null!=(n=e.next())&&(n!=i||r);)r=!r&&"\\"==n;return r||(t.tokenize=x),w("string","string")}}(n),t.tokenize(e,t);if("."==n&&e.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return w("number","number");if("."==n&&e.match(".."))return w("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(n))return w(n);if("="==n&&e.eat(">"))return w("=>","operator");if("0"==n&&e.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return w("number","number");if(/\d/.test(n))return e.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),w("number","number");if("/"==n)return e.eat("*")?(t.tokenize=k)(e,t):e.eat("/")?(e.skipToEnd(),w("comment","comment")):et(e,t,1)?(function(e){for(var t,n=!1,r=!1;null!=(t=e.next());){if(!n){if("/"==t&&!r)return;"["==t?r=!0:r&&"]"==t&&(r=!1)}n=!n&&"\\"==t}}(e),e.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),w("regexp","string-2")):(e.eat("="),w("operator","operator",e.current()));if("`"==n)return(t.tokenize=C)(e,t);if("#"==n)return e.skipToEnd(),w("error","error");if("<"==n&&e.match("!--")||"-"==n&&e.match("->"))return e.skipToEnd(),w("comment","comment");if(y.test(n))return">"==n&&t.lexical&&">"==t.lexical.type||(e.eat("=")?"!"!=n&&"="!=n||e.eat("="):/[<>*+\-]/.test(n)&&(e.eat(n),">"==n&&e.eat(n))),w("operator","operator",e.current());if(h.test(n)){e.eatWhile(h);var r=e.current();if("."!=t.lastType){if(p.propertyIsEnumerable(r)){var i=p[r];return w(i.type,i.style,r)}if("async"==r&&e.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/,!1))return w("async","keyword",r)}return w("variable","variable",r)}}function k(e,t){for(var n,r=!1;n=e.next();){if("/"==n&&r){t.tokenize=x;break}r="*"==n}return w("comment","comment")}function C(e,t){for(var n,r=!1;null!=(n=e.next());){if(!r&&("`"==n||"$"==n&&e.eat("{"))){t.tokenize=x;break}r=!r&&"\\"==n}return w("quasi","string-2",e.current())}var T="([{}])";function S(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var n=e.string.indexOf("=>",e.start);if(!(n<0)){if(f){var r=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(e.string.slice(e.start,n));r&&(n=r.index)}for(var i=0,o=!1,a=n-1;0<=a;--a){var l=e.string.charAt(a),s=T.indexOf(l);if(0<=s&&s<3){if(!i){++a;break}if(0==--i){"("==l&&(o=!0);break}}else if(3<=s&&s<6)++i;else if(h.test(l))o=!0;else if(/["'\/`]/.test(l))for(;;--a){if(0==a)return;if(e.string.charAt(a-1)==l&&"\\"!=e.string.charAt(a-2)){a--;break}}else if(o&&!i){++a;break}}o&&!i&&(t.fatArrowAt=a)}}var L={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0};function M(e,t,n,r,i,o){this.indented=e,this.column=t,this.type=n,this.prev=i,this.info=o,null!=r&&(this.align=r)}function A(e,t){for(var n=e.localVars;n;n=n.next)if(n.name==t)return!0;for(var r=e.context;r;r=r.prev)for(n=r.vars;n;n=n.next)if(n.name==t)return!0}var O={state:null,column:null,marked:null,cc:null};function N(){for(var e=arguments.length-1;0<=e;e--)O.cc.push(arguments[e])}function _(){return N.apply(null,arguments),!0}function E(e,t){for(var n=t;n;n=n.next)if(n.name==e)return!0;return!1}function z(e){var t=O.state;if(O.marked="def",t.context)if("var"==t.lexical.info&&t.context&&t.context.block){var n=function e(t,n){{if(n){if(n.block){var r=e(t,n.prev);return r?r==n.prev?n:new P(r,n.vars,!0):null}return E(t,n.vars)?n:new P(n.prev,new F(t,n.vars),!1)}return null}}(e,t.context);if(null!=n)return void(t.context=n)}else if(!E(e,t.localVars))return void(t.localVars=new F(e,t.localVars));c.globalVars&&!E(e,t.globalVars)&&(t.globalVars=new F(e,t.globalVars))}function D(e){return"public"==e||"private"==e||"protected"==e||"abstract"==e||"readonly"==e}function P(e,t,n){this.prev=e,this.vars=t,this.block=n}function F(e,t){this.name=e,this.next=t}var I=new F("this",new F("arguments",null));function j(){O.state.context=new P(O.state.context,O.state.localVars,!1),O.state.localVars=I}function W(){O.state.context=new P(O.state.context,O.state.localVars,!0),O.state.localVars=null}function H(){O.state.localVars=O.state.context.vars,O.state.context=O.state.context.prev}function R(r,i){function e(){var e=O.state,t=e.indented;if("stat"==e.lexical.type)t=e.lexical.indented;else for(var n=e.lexical;n&&")"==n.type&&n.align;n=n.prev)t=n.indented;e.lexical=new M(t,O.stream.column(),r,null,e.lexical,i)}return e.lex=!0,e}function B(){var e=O.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function q(n){return function e(t){return t==n?_():";"==n||"}"==t||")"==t||"]"==t?N():_(e)}}function U(e,t){return"var"==e?_(R("vardef",t),Se,q(";"),B):"keyword a"==e?_(R("form"),$,U,B):"keyword b"==e?_(R("form"),U,B):"keyword d"==e?O.stream.match(/^\s*$/,!1)?_():_(R("stat"),X,q(";"),B):"debugger"==e?_(q(";")):"{"==e?_(R("}"),W,fe,B,H):";"==e?_():"if"==e?("else"==O.state.lexical.info&&O.state.cc[O.state.cc.length-1]==B&&O.state.cc.pop()(),_(R("form"),$,U,B,_e)):"function"==e?_(Pe):"for"==e?_(R("form"),Ee,U,B):"class"==e||f&&"interface"==t?(O.marked="keyword",_(R("form","class"==e?e:t),He,B)):"variable"==e?f&&"declare"==t?(O.marked="keyword",_(U)):f&&("module"==t||"enum"==t||"type"==t)&&O.stream.match(/^\s*\w/,!1)?(O.marked="keyword","enum"==t?_(Je):"type"==t?_(Ie,q("operator"),ve,q(";")):_(R("form"),Le,q("{"),R("}"),fe,B,B)):f&&"namespace"==t?(O.marked="keyword",_(R("form"),V,U,B)):f&&"abstract"==t?(O.marked="keyword",_(U)):_(R("stat"),oe):"switch"==e?_(R("form"),$,q("{"),R("}","switch"),W,fe,B,B,H):"case"==e?_(V,q(":")):"default"==e?_(q(":")):"catch"==e?_(R("form"),j,K,U,B,H):"export"==e?_(R("stat"),Ue,B):"import"==e?_(R("stat"),Ve,B):"async"==e?_(U):"@"==t?_(V,U):N(R("stat"),V,q(";"),B)}function K(e){if("("==e)return _(je,q(")"))}function V(e,t){return Y(e,t,!1)}function G(e,t){return Y(e,t,!0)}function $(e){return"("!=e?N():_(R(")"),V,q(")"),B)}function Y(e,t,n){if(O.state.fatArrowAt==O.stream.start){var r=n?ne:te;if("("==e)return _(j,R(")"),ue(je,")"),B,q("=>"),r,H);if("variable"==e)return N(j,Le,q("=>"),r,H)}var i=n?J:Z;return L.hasOwnProperty(e)?_(i):"function"==e?_(Pe,i):"class"==e||f&&"interface"==t?(O.marked="keyword",_(R("form"),We,B)):"keyword c"==e||"async"==e?_(n?G:V):"("==e?_(R(")"),X,q(")"),B,i):"operator"==e||"spread"==e?_(n?G:V):"["==e?_(R("]"),Ze,B,i):"{"==e?de(le,"}",null,i):"quasi"==e?N(Q,i):"new"==e?_(function(t){return function(e){return"."==e?_(t?ie:re):"variable"==e&&f?_(ke,t?J:Z):N(t?G:V)}}(n)):"import"==e?_(V):_()}function X(e){return e.match(/[;\}\)\],]/)?N():N(V)}function Z(e,t){return","==e?_(V):J(e,t,!1)}function J(e,t,n){var r=0==n?Z:J,i=0==n?V:G;return"=>"==e?_(j,n?ne:te,H):"operator"==e?/\+\+|--/.test(t)||f&&"!"==t?_(r):f&&"<"==t&&O.stream.match(/^([^>]|<.*?>)*>\s*\(/,!1)?_(R(">"),ue(ve,">"),B,r):"?"==t?_(V,q(":"),i):_(i):"quasi"==e?N(Q,r):";"!=e?"("==e?de(G,")","call",r):"."==e?_(ae,r):"["==e?_(R("]"),X,q("]"),B,r):f&&"as"==t?(O.marked="keyword",_(ve,r)):"regexp"==e?(O.state.lastType=O.marked="operator",O.stream.backUp(O.stream.pos-O.stream.start-1),_(i)):void 0:void 0}function Q(e,t){return"quasi"!=e?N():"${"!=t.slice(t.length-2)?_(Q):_(V,ee)}function ee(e){if("}"==e)return O.marked="string-2",O.state.tokenize=C,_(Q)}function te(e){return S(O.stream,O.state),N("{"==e?U:V)}function ne(e){return S(O.stream,O.state),N("{"==e?U:G)}function re(e,t){if("target"==t)return O.marked="keyword",_(Z)}function ie(e,t){if("target"==t)return O.marked="keyword",_(J)}function oe(e){return":"==e?_(B,U):N(Z,q(";"),B)}function ae(e){if("variable"==e)return O.marked="property",_()}function le(e,t){if("async"==e)return O.marked="property",_(le);if("variable"==e||"keyword"==O.style){return O.marked="property","get"==t||"set"==t?_(se):(f&&O.state.fatArrowAt==O.stream.start&&(n=O.stream.match(/^\s*:\s*/,!1))&&(O.state.fatArrowAt=O.stream.pos+n[0].length),_(ce));var n}else{if("number"==e||"string"==e)return O.marked=l?"property":O.style+" property",_(ce);if("jsonld-keyword"==e)return _(ce);if(f&&D(t))return O.marked="keyword",_(le);if("["==e)return _(V,he,q("]"),ce);if("spread"==e)return _(G,ce);if("*"==t)return O.marked="keyword",_(le);if(":"==e)return N(ce)}}function se(e){return"variable"!=e?N(ce):(O.marked="property",_(Pe))}function ce(e){return":"==e?_(G):"("==e?N(Pe):void 0}function ue(r,i,o){function a(e,t){if(o?-1<o.indexOf(e):","==e){var n=O.state.lexical;return"call"==n.info&&(n.pos=(n.pos||0)+1),_(function(e,t){return e==i||t==i?N():N(r)},a)}return e==i||t==i?_():o&&-1<o.indexOf(";")?N(r):_(q(i))}return function(e,t){return e==i||t==i?_():N(r,a)}}function de(e,t,n){for(var r=3;r<arguments.length;r++)O.cc.push(arguments[r]);return _(R(t,n),ue(e,t),B)}function fe(e){return"}"==e?_():N(U,fe)}function he(e,t){if(f){if(":"==e)return _(ve);if("?"==t)return _(he)}}function pe(e,t){if(f&&(":"==e||"in"==t))return _(ve)}function me(e){if(f&&":"==e)return O.stream.match(/^\s*\w+\s+is\b/,!1)?_(V,ge,ve):_(ve)}function ge(e,t){if("is"==t)return O.marked="keyword",_()}function ve(e,t){return"keyof"==t||"typeof"==t||"infer"==t?(O.marked="keyword",_("typeof"==t?G:ve)):"variable"==e||"void"==t?(O.marked="type",_(xe)):"|"==t||"&"==t?_(ve):"string"==e||"number"==e||"atom"==e?_(xe):"["==e?_(R("]"),ue(ve,"]",","),B,xe):"{"==e?_(R("}"),ue(be,"}",",;"),B,xe):"("==e?_(ue(we,")"),ye,xe):"<"==e?_(ue(ve,">"),ve):void 0}function ye(e){if("=>"==e)return _(ve)}function be(e,t){return"variable"==e||"keyword"==O.style?(O.marked="property",_(be)):"?"==t||"number"==e||"string"==e?_(be):":"==e?_(ve):"["==e?_(q("variable"),pe,q("]"),be):"("==e?N(Fe,be):void 0}function we(e,t){return"variable"==e&&O.stream.match(/^\s*[?:]/,!1)||"?"==t?_(we):":"==e?_(ve):"spread"==e?_(we):N(ve)}function xe(e,t){return"<"==t?_(R(">"),ue(ve,">"),B,xe):"|"==t||"."==e||"&"==t?_(ve):"["==e?_(ve,q("]"),xe):"extends"==t||"implements"==t?(O.marked="keyword",_(ve)):"?"==t?_(ve,q(":"),ve):void 0}function ke(e,t){if("<"==t)return _(R(">"),ue(ve,">"),B,xe)}function Ce(){return N(ve,Te)}function Te(e,t){if("="==t)return _(ve)}function Se(e,t){return"enum"==t?(O.marked="keyword",_(Je)):N(Le,he,Oe,Ne)}function Le(e,t){return f&&D(t)?(O.marked="keyword",_(Le)):"variable"==e?(z(t),_()):"spread"==e?_(Le):"["==e?de(Ae,"]"):"{"==e?de(Me,"}"):void 0}function Me(e,t){return"variable"!=e||O.stream.match(/^\s*:/,!1)?("variable"==e&&(O.marked="property"),"spread"==e?_(Le):"}"==e?N():"["==e?_(V,q("]"),q(":"),Me):_(q(":"),Le,Oe)):(z(t),_(Oe))}function Ae(){return N(Le,Oe)}function Oe(e,t){if("="==t)return _(G)}function Ne(e){if(","==e)return _(Se)}function _e(e,t){if("keyword b"==e&&"else"==t)return _(R("form","else"),U,B)}function Ee(e,t){return"await"==t?_(Ee):"("==e?_(R(")"),ze,B):void 0}function ze(e){return"var"==e?_(Se,De):"variable"==e?_(De):N(De)}function De(e,t){return")"==e?_():";"==e?_(De):"in"==t||"of"==t?(O.marked="keyword",_(V,De)):N(V,De)}function Pe(e,t){return"*"==t?(O.marked="keyword",_(Pe)):"variable"==e?(z(t),_(Pe)):"("==e?_(j,R(")"),ue(je,")"),B,me,U,H):f&&"<"==t?_(R(">"),ue(Ce,">"),B,Pe):void 0}function Fe(e,t){return"*"==t?(O.marked="keyword",_(Fe)):"variable"==e?(z(t),_(Fe)):"("==e?_(j,R(")"),ue(je,")"),B,me,H):f&&"<"==t?_(R(">"),ue(Ce,">"),B,Fe):void 0}function Ie(e,t){return"keyword"==e||"variable"==e?(O.marked="type",_(Ie)):"<"==t?_(R(">"),ue(Ce,">"),B):void 0}function je(e,t){return"@"==t&&_(V,je),"spread"==e?_(je):f&&D(t)?(O.marked="keyword",_(je)):f&&"this"==e?_(he,Oe):N(Le,he,Oe)}function We(e,t){return"variable"==e?He(e,t):Re(e,t)}function He(e,t){if("variable"==e)return z(t),_(Re)}function Re(e,t){return"<"==t?_(R(">"),ue(Ce,">"),B,Re):"extends"==t||"implements"==t||f&&","==e?("implements"==t&&(O.marked="keyword"),_(f?ve:V,Re)):"{"==e?_(R("}"),Be,B):void 0}function Be(e,t){return"async"==e||"variable"==e&&("static"==t||"get"==t||"set"==t||f&&D(t))&&O.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(O.marked="keyword",_(Be)):"variable"==e||"keyword"==O.style?(O.marked="property",_(f?qe:Pe,Be)):"number"==e||"string"==e?_(f?qe:Pe,Be):"["==e?_(V,he,q("]"),f?qe:Pe,Be):"*"==t?(O.marked="keyword",_(Be)):f&&"("==e?N(Fe,Be):";"==e||","==e?_(Be):"}"==e?_():"@"==t?_(V,Be):void 0}function qe(e,t){if("?"==t)return _(qe);if(":"==e)return _(ve,Oe);if("="==t)return _(G);var n=O.state.lexical.prev;return N(n&&"interface"==n.info?Fe:Pe)}function Ue(e,t){return"*"==t?(O.marked="keyword",_(Xe,q(";"))):"default"==t?(O.marked="keyword",_(V,q(";"))):"{"==e?_(ue(Ke,"}"),Xe,q(";")):N(U)}function Ke(e,t){return"as"==t?(O.marked="keyword",_(q("variable"))):"variable"==e?N(G,Ke):void 0}function Ve(e){return"string"==e?_():"("==e?N(V):N(Ge,$e,Xe)}function Ge(e,t){return"{"==e?de(Ge,"}"):("variable"==e&&z(t),"*"==t&&(O.marked="keyword"),_(Ye))}function $e(e){if(","==e)return _(Ge,$e)}function Ye(e,t){if("as"==t)return O.marked="keyword",_(Ge)}function Xe(e,t){if("from"==t)return O.marked="keyword",_(V)}function Ze(e){return"]"==e?_():N(ue(G,"]"))}function Je(){return N(R("form"),Le,q("{"),R("}"),ue(Qe,"}"),B,B)}function Qe(){return N(Le,Oe)}function et(e,t,n){return t.tokenize==x&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(n||0)))}return B.lex=H.lex=!0,{startState:function(e){var t={tokenize:x,lastType:"sof",cc:[],lexical:new M((e||0)-u,0,"block",!1),localVars:c.localVars,context:c.localVars&&new P(null,null,!1),indented:e||0};return c.globalVars&&"object"==typeof c.globalVars&&(t.globalVars=c.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),S(e,t)),t.tokenize!=k&&e.eatSpace())return null;var n=t.tokenize(e,t);return"comment"==g?n:(t.lastType="operator"!=g||"++"!=v&&"--"!=v?g:"incdec",function(e,t,n,r,i){var o=e.cc;for(O.state=e,O.stream=i,O.marked=null,O.cc=o,O.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){if((o.length?o.pop():s?V:U)(n,r)){for(;o.length&&o[o.length-1].lex;)o.pop()();return O.marked?O.marked:"variable"==n&&A(e,r)?"variable-2":t}}}(t,n,g,v,e))},indent:function(e,t){if(e.tokenize==k)return tt.Pass;if(e.tokenize!=x)return 0;var n,r=t&&t.charAt(0),i=e.lexical;if(!/^\s*else\b/.test(t))for(var o=e.cc.length-1;0<=o;--o){var a=e.cc[o];if(a==B)i=i.prev;else if(a!=_e)break}for(;("stat"==i.type||"form"==i.type)&&("}"==r||(n=e.cc[e.cc.length-1])&&(n==Z||n==J)&&!/^[,\.=+\-*:?[\(]/.test(t));)i=i.prev;d&&")"==i.type&&"stat"==i.prev.type&&(i=i.prev);var l=i.type,s=r==l;return"vardef"==l?i.indented+("operator"==e.lastType||","==e.lastType?i.info.length+1:0):"form"==l&&"{"==r?i.indented:"form"==l?i.indented+u:"stat"==l?i.indented+(function(e,t){return"operator"==e.lastType||","==e.lastType||y.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}(e,t)?d||u:0):"switch"!=i.info||s||0==c.doubleIndentSwitch?i.align?i.column+(s?0:1):i.indented+(s?0:u):i.indented+(/^(?:case|default)\b/.test(t)?u:2*u)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:s?null:"/*",blockCommentEnd:s?null:"*/",blockCommentContinue:s?null:" * ",lineComment:s?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:s?"json":"javascript",jsonldMode:l,jsonMode:s,expressionAllowed:et,skipExpression:function(e){var t=e.cc[e.cc.length-1];t!=V&&t!=G||e.cc.pop()}}}),tt.registerHelper("wordChars","javascript",/[\w$]/),tt.defineMIME("text/javascript","javascript"),tt.defineMIME("text/ecmascript","javascript"),tt.defineMIME("application/javascript","javascript"),tt.defineMIME("application/x-javascript","javascript"),tt.defineMIME("application/ecmascript","javascript"),tt.defineMIME("application/json",{name:"javascript",json:!0}),tt.defineMIME("application/x-json",{name:"javascript",json:!0}),tt.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),tt.defineMIME("text/typescript",{name:"javascript",typescript:!0}),tt.defineMIME("application/typescript",{name:"javascript",typescript:!0})},"object"==typeof n&&"object"==typeof t?r(e("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":19}],23:[function(e,t,n){var r;r=function(C){"use strict";var T={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},S={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};C.defineMode("xml",function(e,t){var i,o,a=e.indentUnit,l={},n=t.htmlMode?T:S;for(var r in n)l[r]=n[r];for(var r in t)l[r]=t[r];function s(t,n){function e(e){return(n.tokenize=e)(t,n)}var r=t.next();return"<"==r?t.eat("!")?t.eat("[")?t.match("CDATA[")?e(u("atom","]]>")):null:t.match("--")?e(u("comment","--\x3e")):t.match("DOCTYPE",!0,!0)?(t.eatWhile(/[\w\._\-]/),e(function r(i){return function(e,t){for(var n;null!=(n=e.next());){if("<"==n)return t.tokenize=r(i+1),t.tokenize(e,t);if(">"==n){if(1!=i)return t.tokenize=r(i-1),t.tokenize(e,t);t.tokenize=s;break}}return"meta"}}(1))):null:t.eat("?")?(t.eatWhile(/[\w\._\-]/),n.tokenize=u("meta","?>"),"meta"):(i=t.eat("/")?"closeTag":"openTag",n.tokenize=c,"tag bracket"):"&"!=r?(t.eatWhile(/[^&<]/),null):(t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w\.\-:]/)&&t.eat(";"))?"atom":"error"}function c(e,t){var n=e.next();if(">"==n||"/"==n&&e.eat(">"))return t.tokenize=s,i=">"==n?"endTag":"selfcloseTag","tag bracket";if("="==n)return i="equals",null;if("<"!=n)return/[\'\"]/.test(n)?(t.tokenize=function(n){function e(e,t){for(;!e.eol();)if(e.next()==n){t.tokenize=c;break}return"string"}return e.isInAttribute=!0,e}(n),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word");t.tokenize=s,t.state=p,t.tagName=t.tagStart=null;var r=t.tokenize(e,t);return r?r+" tag error":"tag error"}function u(n,r){return function(e,t){for(;!e.eol();){if(e.match(r)){t.tokenize=s;break}e.next()}return n}}function d(e,t,n){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=n,(l.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function f(e){e.context&&(e.context=e.context.prev)}function h(e,t){for(var n;;){if(!e.context)return;if(n=e.context.tagName,!l.contextGrabbers.hasOwnProperty(n)||!l.contextGrabbers[n].hasOwnProperty(t))return;f(e)}}function p(e,t,n){return"openTag"==e?(n.tagStart=t.column(),m):"closeTag"==e?g:p}function m(e,t,n){return"word"==e?(n.tagName=t.current(),o="tag",b):l.allowMissingTagName&&"endTag"==e?(o="tag bracket",b(e,t,n)):(o="error",m)}function g(e,t,n){if("word"!=e)return l.allowMissingTagName&&"endTag"==e?(o="tag bracket",v(e,t,n)):(o="error",y);var r=t.current();return n.context&&n.context.tagName!=r&&l.implicitlyClosed.hasOwnProperty(n.context.tagName)&&f(n),n.context&&n.context.tagName==r||!1===l.matchClosing?(o="tag",v):(o="tag error",y)}function v(e,t,n){return"endTag"!=e?(o="error",v):(f(n),p)}function y(e,t,n){return o="error",v(e,0,n)}function b(e,t,n){if("word"==e)return o="attribute",w;if("endTag"!=e&&"selfcloseTag"!=e)return o="error",b;var r=n.tagName,i=n.tagStart;return n.tagName=n.tagStart=null,"selfcloseTag"==e||l.autoSelfClosers.hasOwnProperty(r)?h(n,r):(h(n,r),n.context=new d(n,r,i==n.indented)),p}function w(e,t,n){return"equals"==e?x:(l.allowMissing||(o="error"),b(e,0,n))}function x(e,t,n){return"string"==e?k:"word"==e&&l.allowUnquoted?(o="string",b):(o="error",b(e,0,n))}function k(e,t,n){return"string"==e?k:b(e,0,n)}return s.isInText=!0,{startState:function(e){var t={tokenize:s,state:p,indented:e||0,tagName:null,tagStart:null,context:null};return null!=e&&(t.baseIndent=e),t},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;i=null;var n=t.tokenize(e,t);return(n||i)&&"comment"!=n&&(o=null,t.state=t.state(i||n,e,t),o&&(n="error"==o?n+" error":o)),n},indent:function(e,t,n){var r=e.context;if(e.tokenize.isInAttribute)return e.tagStart==e.indented?e.stringStartCol+1:e.indented+a;if(r&&r.noIndent)return C.Pass;if(e.tokenize!=c&&e.tokenize!=s)return n?n.match(/^(\s*)/)[0].length:0;if(e.tagName)return!1!==l.multilineTagIndentPastTag?e.tagStart+e.tagName.length+2:e.tagStart+a*(l.multilineTagIndentFactor||1);if(l.alignCDATA&&/<!\[CDATA\[/.test(t))return 0;var i=t&&/^<(\/)?([\w_:\.-]*)/.exec(t);if(i&&i[1])for(;r;){if(r.tagName==i[2]){r=r.prev;break}if(!l.implicitlyClosed.hasOwnProperty(r.tagName))break;r=r.prev}else if(i)for(;r;){var o=l.contextGrabbers[r.tagName];if(!o||!o.hasOwnProperty(i[2]))break;r=r.prev}for(;r&&r.prev&&!r.startOfLine;)r=r.prev;return r?r.indent+a:e.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:l.htmlMode?"html":"xml",helperType:l.htmlMode?"html":"xml",skipAttribute:function(e){e.state==x&&(e.state=b)},xmlCurrentTag:function(e){return e.tagName?{name:e.tagName,close:"closeTag"==e.type}:null},xmlCurrentContext:function(e){for(var t=[],n=e.context;n;n=n.prev)n.tagName&&t.push(n.tagName);return t.reverse()}}}),C.defineMIME("text/xml","xml"),C.defineMIME("application/xml","xml"),C.mimeModes.hasOwnProperty("text/html")||C.defineMIME("text/html",{name:"xml",htmlMode:!0})},"object"==typeof n&&"object"==typeof t?r(e("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":19}],24:[function(e,t,n){t.exports={prettyPrint:function(e,t){var n,r,i,o,a,c;for(r=(t=t||{}).indent_size||4,i=t.indent_char||" ",a=t.brace_style||"collapse",o=0==t.max_char?1/0:t.max_char||70,c=t.unformatted||["a","span","bdo","em","strong","dfn","code","samp","kbd","var","cite","abbr","acronym","q","sub","sup","tt","i","b","big","small","u","s","strike","font","ins","del","pre","address","dt","h1","h2","h3","h4","h5","h6"],(n=new function(){return this.pos=0,this.token="",this.current_mode="CONTENT",this.tags={parent:"parent1",parentcount:1,parent1:""},this.tag_type="",this.token_text=this.last_token=this.last_text=this.token_type="",this.Utils={whitespace:"\n\r\t ".split(""),single_token:"br,input,link,meta,!doctype,basefont,base,area,hr,wbr,param,img,isindex,?xml,embed,?php,?,?=".split(","),extra_liners:"head,body,/html".split(","),in_array:function(e,t){for(var n=0;n<t.length;n++)if(e===t[n])return!0;return!1}},this.get_content=function(){for(var e="",t=[],n=!1;"<"!==this.input.charAt(this.pos);){if(this.pos>=this.input.length)return t.length?t.join(""):["","TK_EOF"];if(e=this.input.charAt(this.pos),this.pos++,this.line_char_count++,this.Utils.in_array(e,this.Utils.whitespace))t.length&&(n=!0),this.line_char_count--;else{if(n){if(this.line_char_count>=this.max_char){t.push("\n");for(var r=0;r<this.indent_level;r++)t.push(this.indent_string);this.line_char_count=0}else t.push(" "),this.line_char_count++;n=!1}t.push(e)}}return t.length?t.join(""):""},this.get_contents_to=function(e){if(this.pos==this.input.length)return["","TK_EOF"];var t="",n=new RegExp("</"+e+"\\s*>","igm");n.lastIndex=this.pos;var r=n.exec(this.input),i=r?r.index:this.input.length;return this.pos<i&&(t=this.input.substring(this.pos,i),this.pos=i),t},this.record_tag=function(e){this.tags[e+"count"]?this.tags[e+"count"]++:this.tags[e+"count"]=1,this.tags[e+this.tags[e+"count"]]=this.indent_level,this.tags[e+this.tags[e+"count"]+"parent"]=this.tags.parent,this.tags.parent=e+this.tags[e+"count"]},this.retrieve_tag=function(e){if(this.tags[e+"count"]){for(var t=this.tags.parent;t&&e+this.tags[e+"count"]!==t;)t=this.tags[t+"parent"];t&&(this.indent_level=this.tags[e+this.tags[e+"count"]],this.tags.parent=this.tags[t+"parent"]),delete this.tags[e+this.tags[e+"count"]+"parent"],delete this.tags[e+this.tags[e+"count"]],1==this.tags[e+"count"]?delete this.tags[e+"count"]:this.tags[e+"count"]--}},this.get_tag=function(){var e,t,n="",r=[],i=!1;do{if(this.pos>=this.input.length)return r.length?r.join(""):["","TK_EOF"];n=this.input.charAt(this.pos),this.pos++,this.line_char_count++,this.Utils.in_array(n,this.Utils.whitespace)?(i=!0,this.line_char_count--):("'"!==n&&'"'!==n||r[1]&&"!"===r[1]||(n+=this.get_unformatted(n),i=!0),"="===n&&(i=!1),r.length&&"="!==r[r.length-1]&&">"!==n&&i&&(this.line_char_count>=this.max_char?(this.print_newline(!1,r),this.line_char_count=0):(r.push(" "),this.line_char_count++),i=!1),"<"===n&&(e=this.pos-1),r.push(n))}while(">"!==n);var o,a=r.join("");o=-1!=a.indexOf(" ")?a.indexOf(" "):a.indexOf(">");var l=a.substring(1,o).toLowerCase();if("/"===a.charAt(a.length-2)||this.Utils.in_array(l,this.Utils.single_token))this.tag_type="SINGLE";else if("script"===l)this.record_tag(l),this.tag_type="SCRIPT";else if("style"===l)this.record_tag(l),this.tag_type="STYLE";else if(this.Utils.in_array(l,c)){var s=this.get_unformatted("</"+l+">",a);r.push(s),0<e&&this.Utils.in_array(this.input.charAt(e-1),this.Utils.whitespace)&&r.splice(0,0,this.input.charAt(e-1)),t=this.pos-1,this.Utils.in_array(this.input.charAt(1+t),this.Utils.whitespace)&&r.push(this.input.charAt(1+t)),this.tag_type="SINGLE"}else if("!"===l.charAt(0))if(-1!=l.indexOf("[if")){if(-1!=a.indexOf("!IE")){s=this.get_unformatted("--\x3e",a);r.push(s)}this.tag_type="START"}else if(-1!=l.indexOf("[endif"))this.tag_type="END",this.unindent();else if(-1!=l.indexOf("[cdata[")){s=this.get_unformatted("]]>",a);r.push(s),this.tag_type="SINGLE"}else{s=this.get_unformatted("--\x3e",a);r.push(s),this.tag_type="SINGLE"}else"/"===l.charAt(0)?(this.retrieve_tag(l.substring(1)),this.tag_type="END"):(this.record_tag(l),this.tag_type="START"),this.Utils.in_array(l,this.Utils.extra_liners)&&this.print_newline(!0,this.output);return r.join("")},this.get_unformatted=function(e,t){if(t&&-1!=t.toLowerCase().indexOf(e))return"";var n="",r="",i=!0;do{if(this.pos>=this.input.length)return r;if(n=this.input.charAt(this.pos),this.pos++,this.Utils.in_array(n,this.Utils.whitespace)){if(!i){this.line_char_count--;continue}if("\n"===n||"\r"===n){r+="\n",this.line_char_count=0;continue}}r+=n,this.line_char_count++,i=!0}while(-1==r.toLowerCase().indexOf(e));return r},this.get_token=function(){var e;if("TK_TAG_SCRIPT"!==this.last_token&&"TK_TAG_STYLE"!==this.last_token)return"CONTENT"===this.current_mode?"string"!=typeof(e=this.get_content())?e:[e,"TK_CONTENT"]:"TAG"===this.current_mode?"string"!=typeof(e=this.get_tag())?e:[e,"TK_TAG_"+this.tag_type]:void 0;var t=this.last_token.substr(7);return"string"!=typeof(e=this.get_contents_to(t))?e:[e,"TK_"+t]},this.get_full_indent=function(e){return(e=this.indent_level+e||0)<1?"":Array(e+1).join(this.indent_string)},this.printer=function(e,t,n,r,i){this.input=e||"",this.output=[],this.indent_character=t,this.indent_string="",this.indent_size=n,this.brace_style=i,this.indent_level=0,this.max_char=r;for(var o=this.line_char_count=0;o<this.indent_size;o++)this.indent_string+=this.indent_character;this.print_newline=function(e,t){if(this.line_char_count=0,t&&t.length){if(!e)for(;this.Utils.in_array(t[t.length-1],this.Utils.whitespace);)t.pop();t.push("\n");for(var n=0;n<this.indent_level;n++)t.push(this.indent_string)}},this.print_token=function(e){this.output.push(e)},this.indent=function(){this.indent_level++},this.unindent=function(){0<this.indent_level&&this.indent_level--}},this}).printer(e,i,r,o,a);;){var l=n.get_token();if(n.token_text=l[0],n.token_type=l[1],"TK_EOF"===n.token_type)break;switch(n.token_type){case"TK_TAG_START":n.print_newline(!1,n.output),n.print_token(n.token_text),n.indent(),n.current_mode="CONTENT";break;case"TK_TAG_STYLE":case"TK_TAG_SCRIPT":n.print_newline(!1,n.output),n.print_token(n.token_text),n.current_mode="CONTENT";break;case"TK_TAG_END":if("TK_CONTENT"===n.last_token&&""===n.last_text){var s=n.token_text.match(/\w+/)[0],u=n.output[n.output.length-1].match(/<\s*(\w+)/);null!==u&&u[1]===s||n.print_newline(!0,n.output)}n.print_token(n.token_text),n.current_mode="CONTENT";break;case"TK_TAG_SINGLE":var d=n.token_text.match(/^\s*<([a-z]+)/i);d&&n.Utils.in_array(d[1],c)||n.print_newline(!1,n.output),n.print_token(n.token_text),n.current_mode="CONTENT";break;case"TK_CONTENT":""!==n.token_text&&n.print_token(n.token_text),n.current_mode="TAG";break;case"TK_STYLE":case"TK_SCRIPT":if(""!==n.token_text){n.output.push("\n");var f=n.token_text;if("TK_SCRIPT"==n.token_type)var h="function"==typeof js_beautify&&js_beautify;else if("TK_STYLE"==n.token_type)h="function"==typeof css_beautify&&css_beautify;if("keep"==t.indent_scripts)var p=0;else if("separate"==t.indent_scripts)p=-n.indent_level;else p=1;var m=n.get_full_indent(p);if(h)f=h(f.replace(/^\s*/,m),t);else{var g=f.match(/^\s*/)[0].match(/[^\n\r]*$/)[0].split(n.indent_string).length-1,v=n.get_full_indent(p-g);f=f.replace(/^\s*/,m).replace(/\r\n|\r|\n/g,"\n"+v).replace(/\s*$/,"")}f&&(n.print_token(f),n.print_newline(!0,n.output))}n.current_mode="TAG"}n.last_token=n.token_type,n.last_text=n.token_text}return n.output.join("")}}},{}],25:[function(e,t,n){"use strict";var s=e("../render/vnode");t.exports=function(r,e,t){var i=[],n=!1,o=!1;function a(){if(n)throw new Error("Nested m.redraw.sync() call");n=!0;for(var e=0;e<i.length;e+=2)try{r(i[e],s(i[e+1]),l)}catch(e){t.error(e)}n=!1}function l(){o||(o=!0,e(function(){o=!1,a()}))}return l.sync=a,{mount:function(e,t){if(null!=t&&null==t.view&&"function"!=typeof t)throw new TypeError("m.mount(element, component) expects a component, not a vnode");var n=i.indexOf(e);0<=n&&(i.splice(n,2),r(e,[],l)),null!=t&&(i.push(e,t),r(e,s(t),l))},redraw:l}}},{"../render/vnode":44}],26:[function(e,t,n){(function(k){"use strict";var C=e("../render/vnode"),a=e("../render/hyperscript"),T=e("../promise/promise"),o=e("../pathname/build"),S=e("../pathname/parse"),L=e("../pathname/compileTemplate"),M=e("../pathname/assign"),A={};t.exports=function(f,h){var s;function p(e,t,n){if(e=o(e,t),null!=s){s();var r=n?n.state:null,i=n?n.title:null;n&&n.replace?f.history.replaceState(r,i,x.prefix+e):f.history.pushState(r,i,x.prefix+e)}else f.location.href=x.prefix+e}var m,g,v,y,b=A,w=x.SKIP={};function x(e,t,n){if(null==e)throw new Error("Ensure the DOM element that was passed to `m.route` is not undefined");var r,c=0,u=Object.keys(n).map(function(e){if("/"!==e[0])throw new SyntaxError("Routes must start with a `/`");if(/:([^\/\.-]+)(\.{3})?:/.test(e))throw new SyntaxError("Route parameter names must be separated with either `/`, `.`, or `-`");return{route:e,component:n[e],check:L(e)}}),i="function"==typeof k?k:setTimeout,d=T.resolve(),o=!1;if((s=null)!=t){var a=S(t);if(!u.some(function(e){return e.check(a)}))throw new ReferenceError("Default route doesn't match any known routes")}function l(){o=!1;var e=f.location.hash;"#"!==x.prefix[0]&&(e=f.location.search+e,"?"!==x.prefix[0]&&"/"!==(e=f.location.pathname+e)[0]&&(e="/"+e));var a=e.concat().replace(/(?:%[a-f89][a-f0-9])+/gim,decodeURIComponent).slice(x.prefix.length),l=S(a);function s(){if(a===t)throw new Error("Could not resolve default route "+t);p(t,null,{replace:!0})}M(l.params,f.history.state),function t(n){for(;n<u.length;n++)if(u[n].check(l)){var r=u[n].component,e=u[n].route,i=r,o=y=function(e){if(o===y){if(e===w)return t(n+1);m=null==e||"function"!=typeof e.view&&"function"!=typeof e?"div":e,g=l.params,v=a,y=null,b=r.render?r:null,2===c?h.redraw():(c=2,h.redraw.sync())}};return void(r.view||"function"==typeof r?(r={},o(i)):r.onmatch?d.then(function(){return r.onmatch(l.params,a,e)}).then(o,s):o("div"))}s()}(0)}return s=function(){o||(o=!0,i(l))},"function"==typeof f.history.pushState?(r=function(){f.removeEventListener("popstate",s,!1)},f.addEventListener("popstate",s,!1)):"#"===x.prefix[0]&&(s=null,r=function(){f.removeEventListener("hashchange",l,!1)},f.addEventListener("hashchange",l,!1)),h.mount(e,{onbeforeupdate:function(){return!(!(c=c?2:1)||A===b)},oncreate:l,onremove:r,view:function(){if(c&&A!==b){var e=[C(m,g.key,g)];return b&&(e=b.render(e[0])),e}}})}return x.set=function(e,t,n){null!=y&&((n=n||{}).replace=!0),y=null,p(e,t,n)},x.get=function(){return v},x.prefix="#!",x.Link={view:function(e){var n,r,i=e.attrs.options,t={};M(t,e.attrs),t.selector=t.options=t.key=t.oninit=t.oncreate=t.onbeforeupdate=t.onupdate=t.onbeforeremove=t.onremove=null;var o=a(e.attrs.selector||"a",t,e.children);return(o.attrs.disabled=Boolean(o.attrs.disabled))?(o.attrs.href=null,o.attrs["aria-disabled"]="true",o.attrs.onclick=null):(n=o.attrs.onclick,r=o.attrs.href,o.attrs.href=x.prefix+r,o.attrs.onclick=function(e){var t;"function"==typeof n?t=n.call(e.currentTarget,e):null==n||"object"!=typeof n||"function"==typeof n.handleEvent&&n.handleEvent(e),!1===t||e.defaultPrevented||0!==e.button&&0!==e.which&&1!==e.which||e.currentTarget.target&&"_self"!==e.currentTarget.target||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey||(e.preventDefault(),e.redraw=!1,x.set(r,null,i))}),o}},x.param=function(e){return g&&null!=e?g[e]:g},x}}).call(this,e("timers").setImmediate)},{"../pathname/assign":30,"../pathname/build":31,"../pathname/compileTemplate":32,"../pathname/parse":33,"../promise/promise":35,"../render/hyperscript":40,"../render/vnode":44,timers:49}],27:[function(e,t,n){"use strict";var r=e("./render/hyperscript");r.trust=e("./render/trust"),r.fragment=e("./render/fragment"),t.exports=r},{"./render/fragment":39,"./render/hyperscript":40,"./render/trust":43}],28:[function(e,t,n){"use strict";function r(){return i.apply(this,arguments)}var i=e("./hyperscript"),o=e("./request"),a=e("./mount-redraw");r.m=i,r.trust=i.trust,r.fragment=i.fragment,r.mount=a.mount,r.route=e("./route"),r.render=e("./render"),r.redraw=a.redraw,r.request=o.request,r.jsonp=o.jsonp,r.parseQueryString=e("./querystring/parse"),r.buildQueryString=e("./querystring/build"),r.parsePathname=e("./pathname/parse"),r.buildPathname=e("./pathname/build"),r.vnode=e("./render/vnode"),r.PromisePolyfill=e("./promise/polyfill"),t.exports=r},{"./hyperscript":27,"./mount-redraw":29,"./pathname/build":31,"./pathname/parse":33,"./promise/polyfill":34,"./querystring/build":36,"./querystring/parse":37,"./render":38,"./render/vnode":44,"./request":45,"./route":47}],29:[function(e,t,n){"use strict";var r=e("./render");t.exports=e("./api/mount-redraw")(r,requestAnimationFrame,console)},{"./api/mount-redraw":25,"./render":38}],30:[function(e,t,n){"use strict";t.exports=Object.assign||function(t,n){n&&Object.keys(n).forEach(function(e){t[e]=n[e]})}},{}],31:[function(e,t,n){"use strict";var m=e("../querystring/build"),g=e("./assign");t.exports=function(e,r){if(/:([^\/\.-]+)(\.{3})?:/.test(e))throw new SyntaxError("Template parameter names *must* be separated");if(null==r)return e;var t=e.indexOf("?"),n=e.indexOf("#"),i=n<0?e.length:n,o=t<0?i:t,a=e.slice(0,o),l={};g(l,r);var s=a.replace(/:([^\/\.-]+)(\.{3})?/g,function(e,t,n){return delete l[t],null==r[t]?e:n?r[t]:encodeURIComponent(String(r[t]))}),c=s.indexOf("?"),u=s.indexOf("#"),d=u<0?s.length:u,f=c<0?d:c,h=s.slice(0,f);0<=t&&(h+=e.slice(t,i)),0<=c&&(h+=(t<0?"?":"&")+s.slice(c,d));var p=m(l);return p&&(h+=(t<0&&c<0?"?":"&")+p),0<=n&&(h+=e.slice(n)),0<=u&&(h+=(n<0?"":"&")+s.slice(u)),h}},{"../querystring/build":36,"./assign":30}],32:[function(e,t,n){"use strict";var l=e("./parse");t.exports=function(e){var r=l(e),i=Object.keys(r.params),o=[],a=new RegExp("^"+r.path.replace(/:([^\/.-]+)(\.{3}|\.(?!\.)|-)?|[\\^$*+.()|\[\]{}]/g,function(e,t,n){return null==t?"\\"+e:(o.push({k:t,r:"..."===n}),"..."===n?"(.*)":"."===n?"([^/]+)\\.":"([^/]+)"+(n||""))})+"$");return function(e){for(var t=0;t<i.length;t++)if(r.params[i[t]]!==e.params[i[t]])return!1;if(!o.length)return a.test(e.path);var n=a.exec(e.path);if(null==n)return!1;for(t=0;t<o.length;t++)e.params[o[t].k]=o[t].r?n[t+1]:decodeURIComponent(n[t+1]);return!0}}},{"./parse":33}],33:[function(e,t,n){"use strict";var a=e("../querystring/parse");t.exports=function(e){var t=e.indexOf("?"),n=e.indexOf("#"),r=n<0?e.length:n,i=t<0?r:t,o=e.slice(0,i).replace(/\/{2,}/g,"/");return o?("/"!==o[0]&&(o="/"+o),1<o.length&&"/"===o[o.length-1]&&(o=o.slice(0,-1))):o="/",{path:o,params:t<0?{}:a(e.slice(t+1,r))}}},{"../querystring/parse":37}],34:[function(e,t,n){(function(n){"use strict";var f=function(e){if(!(this instanceof f))throw new Error("Promise must be called with `new`");if("function"!=typeof e)throw new TypeError("executor must be a function");var o=this,a=[],l=[],i=t(a,!0),s=t(l,!1),c=o._instance={resolvers:a,rejectors:l},u="function"==typeof n?n:setTimeout;function t(r,i){return function t(n){var e;try{if(!i||null==n||"object"!=typeof n&&"function"!=typeof n||"function"!=typeof(e=n.then))u(function(){i||0!==r.length||console.error("Possible unhandled promise rejection:",n);for(var e=0;e<r.length;e++)r[e](n);a.length=0,l.length=0,c.state=i,c.retry=function(){t(n)}});else{if(n===o)throw new TypeError("Promise can't be resolved w/ itself");d(e.bind(n))}}catch(e){s(e)}}}function d(e){var n=0;function t(t){return function(e){0<n++||t(e)}}var r=t(s);try{e(t(i),r)}catch(e){r(e)}}d(e)};f.prototype.then=function(e,t){var i,o,a=this._instance;function n(t,e,n,r){e.push(function(e){if("function"!=typeof t)n(e);else try{i(t(e))}catch(e){o&&o(e)}}),"function"==typeof a.retry&&r===a.state&&a.retry()}var r=new f(function(e,t){i=e,o=t});return n(e,a.resolvers,i,!0),n(t,a.rejectors,o,!1),r},f.prototype.catch=function(e){return this.then(null,e)},f.prototype.finally=function(t){return this.then(function(e){return f.resolve(t()).then(function(){return e})},function(e){return f.resolve(t()).then(function(){return f.reject(e)})})},f.resolve=function(t){return t instanceof f?t:new f(function(e){e(t)})},f.reject=function(n){return new f(function(e,t){t(n)})},f.all=function(l){return new f(function(n,r){var i=l.length,o=0,a=[];if(0===l.length)n([]);else for(var e=0;e<l.length;e++)!function(t){function e(e){o++,a[t]=e,o===i&&n(a)}null==l[t]||"object"!=typeof l[t]&&"function"!=typeof l[t]||"function"!=typeof l[t].then?e(l[t]):l[t].then(e,r)}(e)})},f.race=function(r){return new f(function(e,t){for(var n=0;n<r.length;n++)r[n].then(e,t)})},t.exports=f}).call(this,e("timers").setImmediate)},{timers:49}],35:[function(n,r,e){(function(e){"use strict";var t=n("./polyfill");"undefined"!=typeof window?(void 0===window.Promise?window.Promise=t:window.Promise.prototype.finally||(window.Promise.prototype.finally=t.prototype.finally),r.exports=window.Promise):void 0!==e?(void 0===e.Promise?e.Promise=t:e.Promise.prototype.finally||(e.Promise.prototype.finally=t.prototype.finally),r.exports=e.Promise):r.exports=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./polyfill":34}],36:[function(e,t,n){"use strict";t.exports=function(e){if("[object Object]"!==Object.prototype.toString.call(e))return"";var r=[];for(var t in e)i(t,e[t]);return r.join("&");function i(e,t){if(Array.isArray(t))for(var n=0;n<t.length;n++)i(e+"["+n+"]",t[n]);else if("[object Object]"===Object.prototype.toString.call(t))for(var n in t)i(e+"["+n+"]",t[n]);else r.push(encodeURIComponent(e)+(null!=t&&""!==t?"="+encodeURIComponent(t):""))}}},{}],37:[function(e,t,n){"use strict";t.exports=function(e){if(""===e||null==e)return{};"?"===e.charAt(0)&&(e=e.slice(1));for(var t=e.split("&"),n={},r={},i=0;i<t.length;i++){var o=t[i].split("="),a=decodeURIComponent(o[0]),l=2===o.length?decodeURIComponent(o[1]):"";"true"===l?l=!0:"false"===l&&(l=!1);var s=a.split(/\]\[?|\[/),c=r;-1<a.indexOf("[")&&s.pop();for(var u=0;u<s.length;u++){var d=s[u],f=s[u+1],h=""==f||!isNaN(parseInt(f,10));if(""===d)null==n[a=s.slice(0,u).join()]&&(n[a]=Array.isArray(c)?c.length:0),d=n[a]++;else if("__proto__"===d)break;if(u===s.length-1)c[d]=l;else{var p=Object.getOwnPropertyDescriptor(c,d);null!=p&&(p=p.value),null==p&&(c[d]=p=h?[]:{}),c=p}}}return r}},{}],38:[function(e,t,n){"use strict";t.exports=e("./render/render")(window)},{"./render/render":42}],39:[function(e,t,n){"use strict";var r=e("../render/vnode"),i=e("./hyperscriptVnode");t.exports=function(){var e=i.apply(0,arguments);return e.tag="[",e.children=r.normalizeChildren(e.children),e}},{"../render/vnode":44,"./hyperscriptVnode":41}],40:[function(e,t,n){"use strict";var s=e("../render/vnode"),r=e("./hyperscriptVnode"),c=/(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g,u={},d={}.hasOwnProperty;function f(e){for(var t in e)if(d.call(e,t))return!1;return!0}t.exports=function(e){if(null==e||"string"!=typeof e&&"function"!=typeof e&&"function"!=typeof e.view)throw Error("The selector must be either a string or a component.");var t=r.apply(1,arguments);return"string"==typeof e&&(t.children=s.normalizeChildren(t.children),"["!==e)?function(e,t){var n=t.attrs,r=s.normalizeChildren(t.children),i=d.call(n,"class"),o=i?n.class:n.className;if(t.tag=e.tag,t.attrs=null,t.children=void 0,!f(e.attrs)&&!f(n)){var a={};for(var l in n)d.call(n,l)&&(a[l]=n[l]);n=a}for(var l in e.attrs)d.call(e.attrs,l)&&"className"!==l&&!d.call(n,l)&&(n[l]=e.attrs[l]);for(var l in null==o&&null==e.attrs.className||(n.className=null!=o?null!=e.attrs.className?String(e.attrs.className)+" "+String(o):o:null!=e.attrs.className?e.attrs.className:null),i&&(n.class=null),n)if(d.call(n,l)&&"key"!==l){t.attrs=n;break}return Array.isArray(r)&&1===r.length&&null!=r[0]&&"#"===r[0].tag?t.text=r[0].children:t.children=r,t}(u[e]||function(e){for(var t,n="div",r=[],i={};t=c.exec(e);){var o=t[1],a=t[2];if(""===o&&""!==a)n=a;else if("#"===o)i.id=a;else if("."===o)r.push(a);else if("["===t[3][0]){var l=t[6];l=l&&l.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\"),"class"===t[4]?r.push(l):i[t[4]]=""===l?l:l||!0}}return 0<r.length&&(i.className=r.join(" ")),u[e]={tag:n,attrs:i}}(e),t):(t.tag=e,t)}},{"../render/vnode":44,"./hyperscriptVnode":41}],41:[function(e,t,n){"use strict";var r=e("../render/vnode");t.exports=function(){var e,t=arguments[this],n=this+1;if(null==t?t={}:"object"==typeof t&&null==t.tag&&!Array.isArray(t)||(t={},n=this),arguments.length===n+1)e=arguments[n],Array.isArray(e)||(e=[e]);else for(e=[];n<arguments.length;)e.push(arguments[n++]);return r("",t.key,t,e)}},{"../render/vnode":44}],42:[function(e,t,n){"use strict";var I=e("../render/vnode");t.exports=function(e){var s,u=e&&e.document,t={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"};function d(e){return e.attrs&&e.attrs.xmlns||t[e.tag]}function c(e,t){if(e.state!==t)throw new Error("`vnode.state` must not be modified")}function f(e){var t=e.state;try{return this.apply(t,arguments)}finally{c(e,t)}}function h(){try{return u.activeElement}catch(e){return null}}function A(e,t,n,r,i,o,a){for(var l=n;l<r;l++){var s=t[l];null!=s&&O(e,s,i,a,o)}}function O(e,t,n,r,i){var o=t.tag;if("string"==typeof o)switch(t.state={},null!=t.attrs&&L(t.attrs,t,n),o){case"#":!function(e,t,n){t.dom=u.createTextNode(t.children),g(e,t.dom,n)}(e,t,i);break;case"<":l(e,t,r,i);break;case"[":!function(e,t,n,r,i){var o=u.createDocumentFragment();if(null!=t.children){var a=t.children;A(o,a,0,a.length,n,null,r)}t.dom=o.firstChild,t.domSize=o.childNodes.length,g(e,o,i)}(e,t,n,r,i);break;default:!function(e,t,n,r,i){var o=t.tag,a=t.attrs,l=a&&a.is,s=(r=d(t)||r)?l?u.createElementNS(r,o,{is:l}):u.createElementNS(r,o):l?u.createElement(o,{is:l}):u.createElement(o);t.dom=s,null!=a&&function(e,t,n){for(var r in t)x(e,r,null,t[r],n)}(t,a,r);if(g(e,s,i),!v(t)&&(null!=t.text&&(""!==t.text?s.textContent=t.text:t.children=[I("#",void 0,void 0,t.text,void 0,void 0)]),null!=t.children)){var c=t.children;A(s,c,0,c.length,n,null,r),"select"===t.tag&&null!=a&&function(e,t){if("value"in t)if(null===t.value)-1!==e.dom.selectedIndex&&(e.dom.value=null);else{var n=""+t.value;e.dom.value===n&&-1!==e.dom.selectedIndex||(e.dom.value=n)}"selectedIndex"in t&&x(e,"selectedIndex",null,t.selectedIndex,void 0)}(t,a)}}(e,t,n,r,i)}else!function(e,t,n,r,i){(function(e,t){var n;if("function"==typeof e.tag.view){if(e.state=Object.create(e.tag),null!=(n=e.state.view).$$reentrantLock$$)return;n.$$reentrantLock$$=!0}else{if(e.state=void 0,null!=(n=e.tag).$$reentrantLock$$)return;n.$$reentrantLock$$=!0,e.state=null!=e.tag.prototype&&"function"==typeof e.tag.prototype.view?new e.tag(e):e.tag(e)}L(e.state,e,t),null!=e.attrs&&L(e.attrs,e,t);if(e.instance=I.normalize(f.call(e.state.view,e)),e.instance===e)throw Error("A view cannot return the vnode it received as argument");n.$$reentrantLock$$=null})(t,n),null!=t.instance?(O(e,t.instance,n,r,i),t.dom=t.instance.dom,t.domSize=null!=t.dom?t.instance.domSize:0):t.domSize=0}(e,t,n,r,i)}var p={caption:"table",thead:"table",tbody:"table",tfoot:"table",tr:"tbody",th:"tr",td:"tr",colgroup:"table",col:"colgroup"};function l(e,t,n,r){var i=t.children.match(/^\s*?<(\w+)/im)||[],o=u.createElement(p[i[1]]||"div");"http://www.w3.org/2000/svg"===n?(o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg">'+t.children+"</svg>",o=o.firstChild):o.innerHTML=t.children,t.dom=o.firstChild,t.domSize=o.childNodes.length,t.instance=[];for(var a,l=u.createDocumentFragment();a=o.firstChild;)t.instance.push(a),l.appendChild(a);g(e,l,r)}function m(e,t,n,r,i,o){if(t!==n&&(null!=t||null!=n))if(null==t||0===t.length)A(e,n,0,n.length,r,i,o);else if(null==n||0===n.length)P(e,t,0,t.length);else{var a=null!=t[0]&&null!=t[0].key,l=null!=n[0]&&null!=n[0].key,s=0,c=0;if(!a)for(;c<t.length&&null==t[c];)c++;if(!l)for(;s<n.length&&null==n[s];)s++;if(null===l&&null==a)return;if(a!=l)P(e,t,c,t.length),A(e,n,s,n.length,r,i,o);else if(l){for(var u,d,f,h,p,m=t.length-1,g=n.length-1;c<=m&&s<=g&&(f=t[m],h=n[g],f.key===h.key);)f!==h&&N(e,f,h,r,i,o),null!=h.dom&&(i=h.dom),m--,g--;for(;c<=m&&s<=g&&(u=t[c],d=n[s],u.key===d.key);)c++,s++,u!==d&&N(e,u,d,r,z(t,c,i),o);for(;c<=m&&s<=g&&s!==g&&u.key===h.key&&f.key===d.ke