HTML Editor Syntax Highlighter - Version 2.4.4

Version Description

  • Added about 15 new themes
Download this release

Release Info

Developer arniebradfo
Plugin Icon 128x128 HTML Editor Syntax Highlighter
Version 2.4.4
Comparing to
See all releases

Code changes from version 2.4.3 to 2.4.4

Files changed (4) hide show
  1. hesh.css +256 -161
  2. hesh.js +1 -1
  3. html-editor-syntax-highlighter.php +31 -10
  4. readme.txt +5 -2
hesh.css CHANGED
@@ -3026,6 +3026,38 @@ span.CodeMirror-selectedtext {
3026
  background: #202020;
3027
  }
3028
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3029
  .cm-s-lesser-dark {
3030
  line-height: 1.3em;
3031
  }
@@ -3170,38 +3202,6 @@ span.CodeMirror-selectedtext {
3170
  color: #fff!important;
3171
  }
3172
 
3173
- .cm-s-juejin.CodeMirror {
3174
- background: #f8f9fa;
3175
- }
3176
-
3177
- .cm-s-juejin .cm-def,.cm-s-juejin .cm-header {
3178
- color: #1ba2f0;
3179
- }
3180
-
3181
- .cm-s-juejin .cm-comment {
3182
- color: #009e9d;
3183
- }
3184
-
3185
- .cm-s-juejin .cm-attribute,.cm-s-juejin .cm-link,.cm-s-juejin .cm-quote,.cm-s-juejin .cm-strong {
3186
- color: #fd7741;
3187
- }
3188
-
3189
- .cm-s-juejin .cm-builtin,.cm-s-juejin .cm-keyword,.cm-s-juejin .cm-url {
3190
- color: #bb51b8;
3191
- }
3192
-
3193
- .cm-s-juejin .cm-hr {
3194
- color: #909090;
3195
- }
3196
-
3197
- .cm-s-juejin .cm-tag {
3198
- color: #107000;
3199
- }
3200
-
3201
- .cm-s-juejin .cm-variable-2 {
3202
- color: #0050a0;
3203
- }
3204
-
3205
  .cm-s-liquibyte.CodeMirror {
3206
  background-color: #000;
3207
  color: #fff;
@@ -4557,6 +4557,66 @@ div.cm-s-mdn-like span.CodeMirror-matchingbracket {
4557
  color: #000!important;
4558
  }
4559
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4560
  .cm-s-night.CodeMirror {
4561
  background: #0a001f;
4562
  color: #f8f8f8;
@@ -4652,66 +4712,6 @@ div.cm-s-mdn-like span.CodeMirror-matchingbracket {
4652
  color: #fff!important;
4653
  }
4654
 
4655
- .cm-s-neo.CodeMirror {
4656
- background-color: #fff;
4657
- color: #2e383c;
4658
- line-height: 1.4375;
4659
- }
4660
-
4661
- .cm-s-neo .cm-comment {
4662
- color: #75787b;
4663
- }
4664
-
4665
- .cm-s-neo .cm-keyword,.cm-s-neo .cm-property {
4666
- color: #1d75b3;
4667
- }
4668
-
4669
- .cm-s-neo .cm-atom,.cm-s-neo .cm-number {
4670
- color: #75438a;
4671
- }
4672
-
4673
- .cm-s-neo .cm-node,.cm-s-neo .cm-tag {
4674
- color: #9c3328;
4675
- }
4676
-
4677
- .cm-s-neo .cm-string {
4678
- color: #b35e14;
4679
- }
4680
-
4681
- .cm-s-neo .cm-qualifier,.cm-s-neo .cm-variable {
4682
- color: #047d65;
4683
- }
4684
-
4685
- .cm-s-neo pre {
4686
- padding: 0;
4687
- }
4688
-
4689
- .cm-s-neo .CodeMirror-gutters {
4690
- border: none;
4691
- border-right: 10px solid transparent;
4692
- background-color: transparent;
4693
- }
4694
-
4695
- .cm-s-neo .CodeMirror-linenumber {
4696
- padding: 0;
4697
- color: #e0e2e5;
4698
- }
4699
-
4700
- .cm-s-neo .CodeMirror-guttermarker {
4701
- color: #1d75b3;
4702
- }
4703
-
4704
- .cm-s-neo .CodeMirror-guttermarker-subtle {
4705
- color: #e0e2e5;
4706
- }
4707
-
4708
- .cm-s-neo .CodeMirror-cursor {
4709
- width: auto;
4710
- border: 0;
4711
- background: hsla(223,4%,62%,.37);
4712
- z-index: 1;
4713
- }
4714
-
4715
  .cm-s-nord.CodeMirror {
4716
  background: #2e3440;
4717
  color: #d8dee9;
@@ -6788,6 +6788,75 @@ div.cm-s-mdn-like span.CodeMirror-matchingbracket {
6788
  color: #fff!important;
6789
  }
6790
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6791
  .cm-s-yeti.CodeMirror {
6792
  background-color: #eceae8!important;
6793
  color: #d1c9c0!important;
@@ -7042,75 +7111,6 @@ div.cm-s-mdn-like span.CodeMirror-matchingbracket {
7042
  color: #d4d4d4!important;
7043
  }
7044
 
7045
- .cm-s-xq-light span.cm-keyword {
7046
- line-height: 1em;
7047
- font-weight: 700;
7048
- color: #5a5cad;
7049
- }
7050
-
7051
- .cm-s-xq-light span.cm-atom {
7052
- color: #6c8cd5;
7053
- }
7054
-
7055
- .cm-s-xq-light span.cm-number {
7056
- color: #164;
7057
- }
7058
-
7059
- .cm-s-xq-light span.cm-def {
7060
- text-decoration: underline;
7061
- }
7062
-
7063
- .cm-s-xq-light span.cm-type,.cm-s-xq-light span.cm-variable,.cm-s-xq-light span.cm-variable-2,.cm-s-xq-light span.cm-variable-3 {
7064
- color: #000;
7065
- }
7066
-
7067
- .cm-s-xq-light span.cm-comment {
7068
- color: #0080ff;
7069
- font-style: italic;
7070
- }
7071
-
7072
- .cm-s-xq-light span.cm-string {
7073
- color: red;
7074
- }
7075
-
7076
- .cm-s-xq-light span.cm-meta {
7077
- color: #ff0;
7078
- }
7079
-
7080
- .cm-s-xq-light span.cm-qualifier {
7081
- color: grey;
7082
- }
7083
-
7084
- .cm-s-xq-light span.cm-builtin {
7085
- color: #7ea656;
7086
- }
7087
-
7088
- .cm-s-xq-light span.cm-bracket {
7089
- color: #cc7;
7090
- }
7091
-
7092
- .cm-s-xq-light span.cm-tag {
7093
- color: #3f7f7f;
7094
- }
7095
-
7096
- .cm-s-xq-light span.cm-attribute {
7097
- color: #7f007f;
7098
- }
7099
-
7100
- .cm-s-xq-light span.cm-error {
7101
- color: red;
7102
- }
7103
-
7104
- .cm-s-xq-light .CodeMirror-activeline-background {
7105
- background: #e8f2ff;
7106
- }
7107
-
7108
- .cm-s-xq-light .CodeMirror-matchingbracket {
7109
- outline: 1px solid grey;
7110
- color: #000!important;
7111
- background: #ff0;
7112
- }
7113
-
7114
  .cm-s-zenburn .CodeMirror-gutters {
7115
  background: #3f3f3f!important;
7116
  }
@@ -7426,6 +7426,101 @@ div.cm-s-mdn-like span.CodeMirror-matchingbracket {
7426
  color: #fff!important;
7427
  }
7428
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7429
  .CodeMirror-foldmarker {
7430
  color: blue;
7431
  text-shadow: #b9f 1px 1px 2px,#b9f -1px -1px 2px,#b9f 1px -1px 2px,#b9f -1px 1px 2px;
3026
  background: #202020;
3027
  }
3028
 
3029
+ .cm-s-juejin.CodeMirror {
3030
+ background: #f8f9fa;
3031
+ }
3032
+
3033
+ .cm-s-juejin .cm-def,.cm-s-juejin .cm-header {
3034
+ color: #1ba2f0;
3035
+ }
3036
+
3037
+ .cm-s-juejin .cm-comment {
3038
+ color: #009e9d;
3039
+ }
3040
+
3041
+ .cm-s-juejin .cm-attribute,.cm-s-juejin .cm-link,.cm-s-juejin .cm-quote,.cm-s-juejin .cm-strong {
3042
+ color: #fd7741;
3043
+ }
3044
+
3045
+ .cm-s-juejin .cm-builtin,.cm-s-juejin .cm-keyword,.cm-s-juejin .cm-url {
3046
+ color: #bb51b8;
3047
+ }
3048
+
3049
+ .cm-s-juejin .cm-hr {
3050
+ color: #909090;
3051
+ }
3052
+
3053
+ .cm-s-juejin .cm-tag {
3054
+ color: #107000;
3055
+ }
3056
+
3057
+ .cm-s-juejin .cm-variable-2 {
3058
+ color: #0050a0;
3059
+ }
3060
+
3061
  .cm-s-lesser-dark {
3062
  line-height: 1.3em;
3063
  }
3202
  color: #fff!important;
3203
  }
3204
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3205
  .cm-s-liquibyte.CodeMirror {
3206
  background-color: #000;
3207
  color: #fff;
4557
  color: #000!important;
4558
  }
4559
 
4560
+ .cm-s-neo.CodeMirror {
4561
+ background-color: #fff;
4562
+ color: #2e383c;
4563
+ line-height: 1.4375;
4564
+ }
4565
+
4566
+ .cm-s-neo .cm-comment {
4567
+ color: #75787b;
4568
+ }
4569
+
4570
+ .cm-s-neo .cm-keyword,.cm-s-neo .cm-property {
4571
+ color: #1d75b3;
4572
+ }
4573
+
4574
+ .cm-s-neo .cm-atom,.cm-s-neo .cm-number {
4575
+ color: #75438a;
4576
+ }
4577
+
4578
+ .cm-s-neo .cm-node,.cm-s-neo .cm-tag {
4579
+ color: #9c3328;
4580
+ }
4581
+
4582
+ .cm-s-neo .cm-string {
4583
+ color: #b35e14;
4584
+ }
4585
+
4586
+ .cm-s-neo .cm-qualifier,.cm-s-neo .cm-variable {
4587
+ color: #047d65;
4588
+ }
4589
+
4590
+ .cm-s-neo pre {
4591
+ padding: 0;
4592
+ }
4593
+
4594
+ .cm-s-neo .CodeMirror-gutters {
4595
+ border: none;
4596
+ border-right: 10px solid transparent;
4597
+ background-color: transparent;
4598
+ }
4599
+
4600
+ .cm-s-neo .CodeMirror-linenumber {
4601
+ padding: 0;
4602
+ color: #e0e2e5;
4603
+ }
4604
+
4605
+ .cm-s-neo .CodeMirror-guttermarker {
4606
+ color: #1d75b3;
4607
+ }
4608
+
4609
+ .cm-s-neo .CodeMirror-guttermarker-subtle {
4610
+ color: #e0e2e5;
4611
+ }
4612
+
4613
+ .cm-s-neo .CodeMirror-cursor {
4614
+ width: auto;
4615
+ border: 0;
4616
+ background: hsla(223,4%,62%,.37);
4617
+ z-index: 1;
4618
+ }
4619
+
4620
  .cm-s-night.CodeMirror {
4621
  background: #0a001f;
4622
  color: #f8f8f8;
4712
  color: #fff!important;
4713
  }
4714
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4715
  .cm-s-nord.CodeMirror {
4716
  background: #2e3440;
4717
  color: #d8dee9;
6788
  color: #fff!important;
6789
  }
6790
 
6791
+ .cm-s-xq-light span.cm-keyword {
6792
+ line-height: 1em;
6793
+ font-weight: 700;
6794
+ color: #5a5cad;
6795
+ }
6796
+
6797
+ .cm-s-xq-light span.cm-atom {
6798
+ color: #6c8cd5;
6799
+ }
6800
+
6801
+ .cm-s-xq-light span.cm-number {
6802
+ color: #164;
6803
+ }
6804
+
6805
+ .cm-s-xq-light span.cm-def {
6806
+ text-decoration: underline;
6807
+ }
6808
+
6809
+ .cm-s-xq-light span.cm-type,.cm-s-xq-light span.cm-variable,.cm-s-xq-light span.cm-variable-2,.cm-s-xq-light span.cm-variable-3 {
6810
+ color: #000;
6811
+ }
6812
+
6813
+ .cm-s-xq-light span.cm-comment {
6814
+ color: #0080ff;
6815
+ font-style: italic;
6816
+ }
6817
+
6818
+ .cm-s-xq-light span.cm-string {
6819
+ color: red;
6820
+ }
6821
+
6822
+ .cm-s-xq-light span.cm-meta {
6823
+ color: #ff0;
6824
+ }
6825
+
6826
+ .cm-s-xq-light span.cm-qualifier {
6827
+ color: grey;
6828
+ }
6829
+
6830
+ .cm-s-xq-light span.cm-builtin {
6831
+ color: #7ea656;
6832
+ }
6833
+
6834
+ .cm-s-xq-light span.cm-bracket {
6835
+ color: #cc7;
6836
+ }
6837
+
6838
+ .cm-s-xq-light span.cm-tag {
6839
+ color: #3f7f7f;
6840
+ }
6841
+
6842
+ .cm-s-xq-light span.cm-attribute {
6843
+ color: #7f007f;
6844
+ }
6845
+
6846
+ .cm-s-xq-light span.cm-error {
6847
+ color: red;
6848
+ }
6849
+
6850
+ .cm-s-xq-light .CodeMirror-activeline-background {
6851
+ background: #e8f2ff;
6852
+ }
6853
+
6854
+ .cm-s-xq-light .CodeMirror-matchingbracket {
6855
+ outline: 1px solid grey;
6856
+ color: #000!important;
6857
+ background: #ff0;
6858
+ }
6859
+
6860
  .cm-s-yeti.CodeMirror {
6861
  background-color: #eceae8!important;
6862
  color: #d1c9c0!important;
7111
  color: #d4d4d4!important;
7112
  }
7113
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7114
  .cm-s-zenburn .CodeMirror-gutters {
7115
  background: #3f3f3f!important;
7116
  }
7426
  color: #fff!important;
7427
  }
7428
 
7429
+ .cm-s-github.CodeMirror {
7430
+ background: #fff;
7431
+ color: #24292e;
7432
+ font-size: 12px;
7433
+ }
7434
+
7435
+ .cm-s-github .CodeMirror-gutters {
7436
+ background: #fff;
7437
+ border: 0;
7438
+ }
7439
+
7440
+ .cm-s-github .CodeMirror-linenumber {
7441
+ color: rgba(27,31,35,.3);
7442
+ }
7443
+
7444
+ .cm-s-github .CodeMirror-cursor {
7445
+ border-color: #24292e;
7446
+ }
7447
+
7448
+ .cm-s-github .cm-keyword {
7449
+ color: #d73a49;
7450
+ }
7451
+
7452
+ .cm-s-github .cm-atom,.cm-s-github .cm-number {
7453
+ color: #005cc5;
7454
+ }
7455
+
7456
+ .cm-s-github .cm-def {
7457
+ color: #d73a49;
7458
+ }
7459
+
7460
+ .cm-s-github .cm-variable {
7461
+ color: #24292e;
7462
+ }
7463
+
7464
+ .cm-s-github .cm-variable-2 {
7465
+ color: #d73a49;
7466
+ }
7467
+
7468
+ .cm-s-default .cm-type,.cm-s-github .cm-variable-3 {
7469
+ color: #6f42c1;
7470
+ }
7471
+
7472
+ .cm-s-github .cm-property {
7473
+ color: #005cc5;
7474
+ }
7475
+
7476
+ .cm-s-github .cm-comment {
7477
+ color: #6a737d;
7478
+ }
7479
+
7480
+ .cm-s-github .cm-string {
7481
+ color: #005cc5;
7482
+ }
7483
+
7484
+ .cm-s-github .cm-string-2 {
7485
+ color: #2e383c;
7486
+ }
7487
+
7488
+ .cm-s-github .cm-meta {
7489
+ color: #24292e;
7490
+ }
7491
+
7492
+ .cm-s-github .cm-builtin,.cm-s-github .cm-qualifier {
7493
+ color: #6f42c1;
7494
+ }
7495
+
7496
+ .cm-s-github .cm-bracket {
7497
+ color: #24292e;
7498
+ }
7499
+
7500
+ .cm-s-github .cm-tag {
7501
+ color: #22863a;
7502
+ }
7503
+
7504
+ .cm-s-github .cm-attribute {
7505
+ color: #6f42c1;
7506
+ }
7507
+
7508
+ .cm-s-github .cm-attribute+.cm-s-github .cm-string {
7509
+ color: #032f62;
7510
+ }
7511
+
7512
+ .cm-s-github .cm-hr {
7513
+ color: #24292e;
7514
+ }
7515
+
7516
+ .cm-s-github .cm-link {
7517
+ color: #005cc5;
7518
+ }
7519
+
7520
+ .cm-invalidchar,.cm-s-github .cm-error {
7521
+ color: #d73a49;
7522
+ }
7523
+
7524
  .CodeMirror-foldmarker {
7525
  color: blue;
7526
  text-shadow: #b9f 1px 1px 2px,#b9f -1px -1px 2px,#b9f 1px -1px 2px,#b9f -1px 1px 2px;
hesh.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).CodeMirror=t()}(this,function(){"use strict";var e=navigator.userAgent,t=navigator.platform,f=/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),k=n||r||i,v=k&&(n?document.documentMode||6:+(i||r)[1]),h=!i&&/WebKit\//.test(e),r=h&&/Qt\/\d+\.\d+/.test(e),o=!i&&/Chrome\//.test(e),p=/Opera\//.test(e),u=/Apple Computer/.test(navigator.vendor),a=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),c=/PhantomJS/.test(e),s=u&&(/Mobile\/\w+/.test(e)||2<navigator.maxTouchPoints),l=/Android/.test(e),d=s||l||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),m=s||/Mac/.test(t),g=/\bCrOS\b/.test(e),y=/win/i.test(t),e=p&&e.match(/Version\/(\d*\.\d*)/);(e=e&&Number(e[1]))&&15<=e&&(h=!(p=!1));var b=m&&(r||p&&(null==e||e<12.11)),x=f||k&&9<=v;function w(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var C=function(e,t){var n=e.className,r=w(t).exec(n);r&&(t=n.slice(r.index+r[0].length),e.className=n.slice(0,r.index)+(t?r[1]+t:""))};function S(e){for(var t=e.childNodes.length;0<t;--t)e.removeChild(e.firstChild);return e}function _(e,t){return S(e).appendChild(t)}function M(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 L(e,t,n,r){r=M(e,t,n,r);return r.setAttribute("role","presentation"),r}function T(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if((t=11==t.nodeType?t.host:t)==e)return!0}while(t=t.parentNode)}function A(){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 O(e,t){var n=e.className;w(t).test(n)||(e.className+=(n?" ":"")+t)}function N(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!w(n[r]).test(t)&&(t+=" "+n[r]);return t}var E=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},I=function(e){e.select()};function P(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function R(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 B(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 s=e.indexOf("\t",o);if(s<0||t<=s)return a+(t-o);a+=s-o,a+=n-a%n,o=s+1}}s?I=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:k&&(I=function(e){try{e.select()}catch(e){}});function D(){this.id=null,this.f=null,this.time=0,this.handler=P(this.onTimeout,this)}function F(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}D.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)};var z=50,W={toString:function(){return"CodeMirror.Pass"}},q={scroll:!(D.prototype.set=function(e,t){this.f=t;t=+new Date+e;(!this.id||t<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=t)})},H={origin:"*mouse"},j={origin:"+move"};function K(e,t,n){for(var r=0,i=0;;){var o=e.indexOf("\t",r),a=(o=-1==o?e.length: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 U=[""];function V(e){for(;U.length<=e;)U.push($(U)+" ");return U[e]}function $(e){return e[e.length-1]}function G(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function X(){}function Y(e,t){e=Object.create?Object.create(e):(X.prototype=e,new X);return t&&R(t,e),e}var Q=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function J(e){return/\w/.test(e)||"€"<e&&(e.toUpperCase()!=e.toLowerCase()||Q.test(e))}function Z(e,t){return t?!!(-1<t.source.indexOf("\\w")&&J(e))||t.test(e):J(e)}function ee(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return;return 1}var te=/[\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 ne(e){return 768<=e.charCodeAt(0)&&te.test(e)}function re(e,t,n){for(;(n<0?0<t:t<e.length)&&ne(e.charAt(t));)t+=n;return t}function ie(e,t,n){for(var r=n<t?-1:1;;){if(t==n)return t;var i=(t+n)/2,i=r<0?Math.ceil(i):Math.floor(i);if(i==t)return e(i)?t:n;e(i)?n=i:t=i+r}}var oe=null;function ae(e,t,n){var r;oe=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:oe=i),o.from==t&&(o.from!=o.to&&"before"!=n?r=i:oe=i)}return null!=r?r:oe}var se,le,ce,ue,de,fe=(se=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,le=/[stwN]/,ce=/[LRr]/,ue=/[Lb1n]/,de=/[1n]/,function(e,t){var n="ltr"==t?"L":"R";if(0==e.length||"ltr"==t&&!se.test(e))return!1;for(var r,i=e.length,o=[],a=0;a<i;++a)o.push((r=e.charCodeAt(a))<=247?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(r):1424<=r&&r<=1524?"R":1536<=r&&r<=1785?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(r-1536):1774<=r&&r<=2220?"r":8192<=r&&r<=8203?"w":8204==r?"b":"L");for(var s=0,l=n;s<i;++s){var c=o[s];"m"==c?o[s]=l:l=c}for(var u=0,d=n;u<i;++u){var f=o[u];"1"==f&&"r"==d?o[u]="n":ce.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){for(var y=void 0,y=g+1;y<i&&"%"==o[y];++y);for(var b=g&&"!"==o[g-1]||y<i&&"1"==o[y]?"1":"N",k=g;k<y;++k)o[k]=b;g=y-1}}for(var x=0,w=n;x<i;++x){var C=o[x];"L"==w&&"1"==C?o[x]="L":ce.test(C)&&(w=C)}for(var S=0;S<i;++S)if(le.test(o[S])){for(var _=void 0,_=S+1;_<i&&le.test(o[_]);++_);for(var L="L"==(S?o[S-1]:n),M=L==("L"==(_<i?o[_]:n))?L?"L":"R":n,T=S;T<_;++T)o[T]=M;S=_-1}for(var A,O=[],N=0;N<i;)if(ue.test(o[N])){var E=N;for(++N;N<i&&ue.test(o[N]);++N);O.push(new he(0,E,N))}else{var I=N,P=O.length,R="rtl"==t?1:0;for(++N;N<i&&"L"!=o[N];++N);for(var B=I;B<N;)if(de.test(o[B])){I<B&&(O.splice(P,0,new he(1,I,B)),P+=R);var D=B;for(++B;B<N&&de.test(o[B]);++B);O.splice(P,0,new he(2,D,B)),P+=R,I=B}else++B;I<N&&O.splice(P,0,new he(1,I,N))}return"ltr"==t&&(1==O[0].level&&(A=e.match(/^\s+/))&&(O[0].from=A[0].length,O.unshift(new he(0,0,A[0].length))),1==$(O).level&&(A=e.match(/\s+$/))&&($(O).to-=A[0].length,O.push(new he(0,i-A[0].length,i)))),"rtl"==t?O.reverse():O});function he(e,t,n){this.level=e,this.from=t,this.to=n}function pe(e,t){var n=e.order;return n=null==n?e.order=fe(e.text,t):n}var me=[],ge=function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent?e.attachEvent("on"+t,n):(e=e._handlers||(e._handlers={}))[t]=(e[t]||me).concat(n)};function ve(e,t){return e._handlers&&e._handlers[t]||me}function ye(e,t,n){var r;e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent?e.detachEvent("on"+t,n):!(e=(r=e._handlers)&&r[t])||-1<(n=F(e,n))&&(r[t]=e.slice(0,n).concat(e.slice(n+1)))}function be(e,t){var n=ve(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 ke(e,t,n){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),be(e,n||t.type,e,t),Le(t)||t.codemirrorIgnore}function xe(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==F(n,t[r])&&n.push(t[r])}function we(e,t){return 0<ve(e,t).length}function Ce(e){e.prototype.on=function(e,t){ge(this,e,t)},e.prototype.off=function(e,t){ye(this,e,t)}}function Se(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function _e(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Le(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Me(e){Se(e),_e(e)}function Te(e){return e.target||e.srcElement}function Ae(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),t=m&&e.ctrlKey&&1==t?3:t}var Oe,Ne,Ee=function(){if(k&&v<9)return!1;var e=M("div");return"draggable"in e||"dragDrop"in e}();var Ie=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/)},Pe=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)},Re="oncopy"in(r=M("div"))||(r.setAttribute("oncopy","return;"),"function"==typeof r.oncopy),Be=null;var De={},Fe={};function ze(e){if("string"==typeof e&&Fe.hasOwnProperty(e))e=Fe[e];else if(e&&"string"==typeof e.name&&Fe.hasOwnProperty(e.name)){var t=Fe[e.name];(e=Y(t="string"==typeof t?{name:t}:t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return ze("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return ze("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function We(e,t){t=ze(t);var n=De[t.name];if(!n)return We(e,"text/plain");var r=n(e,t);if(qe.hasOwnProperty(t.name)){var i,o=qe[t.name];for(i in o)o.hasOwnProperty(i)&&(r.hasOwnProperty(i)&&(r["_"+i]=r[i]),r[i]=o[i])}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 qe={};function He(e,t){R(t,qe.hasOwnProperty(e)?qe[e]:qe[e]={})}function je(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var n,r={};for(n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function Ke(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 Ue(e,t,n){return!e.startState||e.startState(t,n)}var Ve=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 $e(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 Ge(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(e){e=e.text;i==n.line&&(e=e.slice(0,n.ch)),i==t.line&&(e=e.slice(t.ch)),r.push(e),++i}),r}function Xe(e,t,n){var r=[];return e.iter(t,n,function(e){r.push(e.text)}),r}function Ye(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Qe(e){if(null==e.parent)return null;for(var t=e.parent,n=F(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 Je(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 s=e.lines[a].height;if(t<s)break;t-=s}return n+a}function Ze(e,t){return t>=e.first&&t<e.first+e.size}function et(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function tt(e,t,n){if(void 0===n&&(n=null),!(this instanceof tt))return new tt(e,t,n);this.line=e,this.ch=t,this.sticky=n}function nt(e,t){return e.line-t.line||e.ch-t.ch}function rt(e,t){return e.sticky==t.sticky&&0==nt(e,t)}function it(e){return tt(e.line,e.ch)}function ot(e,t){return nt(e,t)<0?t:e}function at(e,t){return nt(e,t)<0?e:t}function st(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function lt(e,t){if(t.line<e.first)return tt(e.first,0);var n=e.first+e.size-1;return t.line>n?tt(n,$e(e,n).text.length):(e=$e(e,(n=t).line).text.length,null==(t=n.ch)||e<t?tt(n.line,e):t<0?tt(n.line,0):n)}function ct(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=lt(e,t[r]);return n}Ve.prototype.eol=function(){return this.pos>=this.string.length},Ve.prototype.sol=function(){return this.pos==this.lineStart},Ve.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ve.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ve.prototype.eat=function(e){var t=this.string.charAt(this.pos),e="string"==typeof e?t==e:t&&(e.test?e.test(t):e(t));if(e)return++this.pos,t},Ve.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ve.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ve.prototype.skipToEnd=function(){this.pos=this.string.length},Ve.prototype.skipTo=function(e){e=this.string.indexOf(e,this.pos);if(-1<e)return this.pos=e,!0},Ve.prototype.backUp=function(e){this.pos-=e},Ve.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=B(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?B(this.string,this.lineStart,this.tabSize):0)},Ve.prototype.indentation=function(){return B(this.string,null,this.tabSize)-(this.lineStart?B(this.string,this.lineStart,this.tabSize):0)},Ve.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)}r=function(e){return n?e.toLowerCase():e};if(r(this.string.substr(this.pos,e.length))==r(e))return!1!==t&&(this.pos+=e.length),!0},Ve.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ve.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ve.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ve.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ut(e,t){this.state=e,this.lookAhead=t}var dt=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 ft(t,n,r,e){var l=[t.state.modeGen],i={};xt(t,n.text,t.doc.mode,r,function(e,t){return l.push(e,t)},i,e);for(var c=r.state,o=0;o<t.state.overlays.length;++o)!function(e){r.baseTokens=l;var o=t.state.overlays[e],a=1,s=0;r.state=!0,xt(t,n.text,o.mode,r,function(e,t){for(var n=a;s<e;){var r=l[a];e<r&&l.splice(a,1,e,l[a+1],r),a+=2,s=Math.min(e,r)}if(t)if(o.opaque)l.splice(n,a-n,e,"overlay "+t),a=n+2;else for(;n<a;n+=2){var i=l[n+1];l[n+1]=(i?i+" ":"")+"overlay "+t}},i),r.state=c,r.baseTokens=null,r.baseTokenPos=1}(o);return{styles:l,classes:i.bgClass||i.textClass?i:null}}function ht(e,t,n){var r,i,o;return t.styles&&t.styles[0]==e.state.modeGen||(r=pt(e,Qe(t)),i=t.text.length>e.options.maxHighlightLength&&je(e.doc.mode,r.state),o=ft(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))),t.styles}function pt(n,r,e){var t=n.doc,i=n.display;if(!t.mode.startState)return new dt(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),s=t;a<s;--s){if(s<=o.first)return o.first;var l=$e(o,s-1),c=l.stateAfter;if(c&&(!n||s+(c instanceof ut?c.lookAhead:0)<=o.modeFrontier))return s;l=B(l.text,null,e.options.tabSize);(null==i||l<r)&&(i=s-1,r=l)}return i}(n,r,e),a=o>t.first&&$e(t,o-1).stateAfter,s=a?dt.fromSaved(t,a,o):new dt(t,Ue(t.mode),o);return t.iter(o,r,function(e){mt(n,e.text,s);var t=s.line;e.stateAfter=t==r-1||t%5==0||t>=i.viewFrom&&t<i.viewTo?s.save():null,s.nextLine()}),e&&(t.modeFrontier=s.line),s}function mt(e,t,n,r){var i=e.doc.mode,o=new Ve(t,e.options.tabSize,n);for(o.start=o.pos=r||0,""==t&&gt(i,n.state);!o.eol();)vt(i,o,n.state),o.start=o.pos}function gt(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){t=Ke(e,t);return t.mode.blankLine?t.mode.blankLine(t.state):void 0}}function vt(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Ke(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.")}dt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},dt.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}},dt.prototype.nextLine=function(){this.line++,0<this.maxLookAhead&&this.maxLookAhead--},dt.fromSaved=function(e,t,n){return t instanceof ut?new dt(e,je(e.mode,t.state),n,t.lookAhead):new dt(e,je(e.mode,t),n)},dt.prototype.save=function(e){e=!1!==e?je(this.doc.mode,this.state):this.state;return 0<this.maxLookAhead?new ut(e,this.maxLookAhead):e};var yt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function bt(e,t,n,r){var i,o,a=e.doc,s=a.mode,l=$e(a,(t=lt(a,t)).line),c=pt(e,t.line,n),u=new Ve(l.text,e.options.tabSize,c);for(r&&(o=[]);(r||u.pos<t.ch)&&!u.eol();)u.start=u.pos,i=vt(s,u,c.state),r&&o.push(new yt(u,i,je(a.mode,c.state)));return r?o:new yt(u,i,c.state)}function kt(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 xt(e,t,n,r,i,o,a){var s=n.flattenSpans;null==s&&(s=e.options.flattenSpans);var l=0,c=null,u=new Ve(t,e.options.tabSize,r),d=e.options.addModeClass&&[null];for(""==t&&kt(gt(n,r.state),o);!u.eol();){var f,h=u.pos>e.options.maxHighlightLength?(s=!1,a&&mt(e,t,r,u.pos),u.pos=t.length,null):kt(vt(n,u,r.state,d),o);if(!d||(f=d[0].name)&&(h="m-"+(h?f+" "+h:f)),!s||c!=h){for(;l<u.start;)i(l=Math.min(u.start,l+5e3),c);c=h}u.start=u.pos}for(;l<u.pos;){var p=Math.min(u.pos,l+5e3);i(p,c),l=p}}var wt=!1,Ct=!1;function St(e,t,n){this.marker=e,this.from=t,this.to=n}function _t(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Lt(e,t){if(t.full)return null;var n=Ze(e,t.from.line)&&$e(e,t.from.line).markedSpans,r=Ze(e,t.to.line)&&$e(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,o=t.to.ch,e=0==nt(t.from,t.to),a=function(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o,a=e[i],s=a.marker;!(null==a.from||(s.inclusiveLeft?a.from<=t:a.from<t))&&(a.from!=t||"bookmark"!=s.type||n&&a.marker.insertLeft)||(o=null==a.to||(s.inclusiveRight?a.to>=t:a.to>t),(r=r||[]).push(new St(s,a.from,o?null:a.to)))}return r}(n,i,e),s=function(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o,a=e[i],s=a.marker;!(null==a.to||(s.inclusiveRight?a.to>=t:a.to>t))&&(a.from!=t||"bookmark"!=s.type||n&&!a.marker.insertLeft)||(o=null==a.from||(s.inclusiveLeft?a.from<=t:a.from<t),(r=r||[]).push(new St(s,o?null:a.from-t,null==a.to?null:a.to-t)))}return r}(r,o,e),l=1==t.text.length,c=$(t.text).length+(l?i:0);if(a)for(var u=0;u<a.length;++u){var d,f=a[u];null==f.to&&((d=_t(s,f.marker))?l&&(f.to=null==d.to?null:d.to+c):f.to=i)}if(s)for(var h=0;h<s.length;++h){var p=s[h];null!=p.to&&(p.to+=c),null==p.from?_t(a,p.marker)||(p.from=c,l&&(a=a||[]).push(p)):(p.from+=c,l&&(a=a||[]).push(p))}a=a&&Mt(a),s&&s!=a&&(s=Mt(s));var m=[a];if(!l){var g,v=t.text.length-2;if(0<v&&a)for(var y=0;y<a.length;++y)null==a[y].to&&(g=g||[]).push(new St(a[y].marker,null,null));for(var b=0;b<v;++b)m.push(g);m.push(s)}return m}function Mt(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 Tt(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function At(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function Ot(e){return e.inclusiveLeft?-1:0}function Nt(e){return e.inclusiveRight?1:0}function Et(e,t){var n=e.lines.length-t.lines.length;if(0!=n)return n;var r=e.find(),i=t.find(),n=nt(r.from,i.from)||Ot(e)-Ot(t);if(n)return-n;i=nt(r.to,i.to)||Nt(e)-Nt(t);return i||t.id-e.id}function It(e,t){var n,r=Ct&&e.markedSpans;if(r)for(var i,o=0;o<r.length;++o)(i=r[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!n||Et(n,i.marker)<0)&&(n=i.marker);return n}function Pt(e){return It(e,!0)}function Rt(e){return It(e,!1)}function Bt(e,t,n,r,i){var t=$e(e,t),o=Ct&&t.markedSpans;if(o)for(var a=0;a<o.length;++a){var s=o[a];if(s.marker.collapsed){var l=s.marker.find(0),c=nt(l.from,n)||Ot(s.marker)-Ot(i),u=nt(l.to,r)||Nt(s.marker)-Nt(i);if(!(0<=c&&u<=0||c<=0&&0<=u)&&(c<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?0<=nt(l.to,n):0<nt(l.to,n))||0<=c&&(s.marker.inclusiveRight&&i.inclusiveLeft?nt(l.from,r)<=0:nt(l.from,r)<0)))return 1}}}function Dt(e){for(var t;t=Pt(e);)e=t.find(-1,!0).line;return e}function Ft(e,t){var n=$e(e,t),e=Dt(n);return n==e?t:Qe(e)}function zt(e,t){if(t>e.lastLine())return t;var n,r=$e(e,t);if(!Wt(e,r))return t;for(;n=Rt(r);)r=n.find(1,!0).line;return Qe(r)+1}function Wt(e,t){var n=Ct&&t.markedSpans;if(n)for(var r,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&&function e(t,n,r){if(null==r.to){var i=r.marker.find(1,!0);return e(t,i.line,_t(i.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==n.text.length)return!0;for(var o=void 0,a=0;a<n.markedSpans.length;++a)if((o=n.markedSpans[a]).marker.collapsed&&!o.marker.widgetNode&&o.from==r.to&&(null==o.to||o.to!=r.from)&&(o.marker.inclusiveLeft||r.marker.inclusiveRight)&&e(t,n,o))return!0}(e,t,r))return!0}}function qt(e){for(var t=0,n=(e=Dt(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 s=o.children[a];if(s==n)break;t+=s.height}return t}function Ht(e){if(0==e.height)return 0;for(var t,n=e.text.length,r=e;t=Pt(r);){var i=t.find(0,!0),r=i.from.line;n+=i.from.ch-i.to.ch}for(r=e;t=Rt(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 jt(e){var n=e.display,e=e.doc;n.maxLine=$e(e,e.first),n.maxLineLength=Ht(n.maxLine),n.maxLineChanged=!0,e.iter(function(e){var t=Ht(e);t>n.maxLineLength&&(n.maxLineLength=t,n.maxLine=e)})}var Kt=function(e,t,n){this.text=e,At(this,t),this.height=n?n(this):1};Kt.prototype.lineNo=function(){return Qe(this)},Ce(Kt);var Ut={},Vt={};function $t(e,t){if(!e||/^\s*$/.test(e))return null;t=t.addModeClass?Vt:Ut;return t[e]||(t[e]=e.replace(/\S+/g,"cm-$&"))}function Gt(e,t){var n=L("span",null,null,h?"padding-right: .1px":null),r={pre:L("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=Yt,function(e){if(null!=Ne)return Ne;var t=_(e,document.createTextNode("AخA")),n=E(t,0,1).getBoundingClientRect(),t=E(t,1,2).getBoundingClientRect();return S(e),n&&n.left!=n.right&&(Ne=t.right-n.right<3)}(e.display.measure)&&(a=pe(o,e.doc.direction))&&(r.addToken=function(d,f){return function(e,t,n,r,i,o,a){n=n?n+" cm-force-border":"cm-force-border";for(var s=e.pos,l=s+t.length;;){for(var c=void 0,u=0;u<f.length&&!((c=f[u]).to>s&&c.from<=s);u++);if(c.to>=l)return d(e,t,n,r,i,o,a);d(e,t.slice(0,c.to-s),n,r,null,o,a),r=null,t=t.slice(c.to-s),s=c.to}}}(r.addToken,a)),r.map=[],function(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var a,s,l,c,u,d,f,h=i.length,p=0,m=1,g="",v=0;;){if(v==p){l=c=u=s="",d=f=null,v=1/0;for(var y=[],b=void 0,k=0;k<r.length;++k){var x=r[k],w=x.marker;if("bookmark"==w.type&&x.from==p&&w.widgetNode)y.push(w);else if(x.from<=p&&(null==x.to||x.to>p||w.collapsed&&x.to==p&&x.from==p)){if(null!=x.to&&x.to!=p&&v>x.to&&(v=x.to,c=""),w.className&&(l+=" "+w.className),w.css&&(s=(s?s+";":"")+w.css),w.startStyle&&x.from==p&&(u+=" "+w.startStyle),w.endStyle&&x.to==v&&(b=b||[]).push(w.endStyle,x.to),w.title&&((f=f||{}).title=w.title),w.attributes)for(var C in w.attributes)(f=f||{})[C]=w.attributes[C];w.collapsed&&(!d||Et(d.marker,w)<0)&&(d=x)}else x.from>p&&v>x.from&&(v=x.from)}if(b)for(var S=0;S<b.length;S+=2)b[S+1]==v&&(c+=" "+b[S]);if(!d||d.from==p)for(var _=0;_<y.length;++_)Qt(t,0,y[_]);if(d&&(d.from||0)==p){if(Qt(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,T=p+g.length;if(d||(M=L<T?g.slice(0,L-p):g,t.addToken(t,M,a?a+l:l,u,p+M.length==v?c:"",s,f)),L<=T){g=g.slice(L-p),p=L;break}p=T,u=""}g=i.slice(o,o=n[m++]),a=$t(n[m++],t.cm.options)}}else for(var A=1;A<n.length;A+=2)t.addToken(t,i.slice(o,o=n[A]),$t(n[A+1],t.cm.options))}(o,r,ht(e,o,t!=e.display.externalMeasured&&Qe(o))),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=N(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=N(o.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(function(e){null==Oe&&(t=M("span","​"),_(e,M("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Oe=t.offsetWidth<=1&&2<t.offsetHeight&&!(k&&v<8)));var t=Oe?M("span","​"):M("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return t.setAttribute("cm-text",""),t}(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({}))}return h&&(n=r.content.lastChild,(/\bcm-tab\b/.test(n.className)||n.querySelector&&n.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")),be(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=N(r.pre.className,r.textClass||"")),r}function Xt(e){var t=M("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Yt(e,t,n,r,i,o,a){if(t){var 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,l=e.cm.state.specialChars,c=!1;if(l.test(t))for(var u=document.createDocumentFragment(),d=0;;){l.lastIndex=d;var f=l.exec(t),h=f?f.index-d:t.length-d;if(h&&(p=document.createTextNode(s.slice(d,d+h)),k&&v<9?u.appendChild(M("span",[p])):u.appendChild(p),e.map.push(e.pos,e.pos+h,p),e.col+=h,e.pos+=h),!f)break;d+=1+h;var p=void 0;"\t"==f[0]?(h=(h=e.cm.options.tabSize)-e.col%h,(p=u.appendChild(M("span",V(h),"cm-tab"))).setAttribute("role","presentation"),p.setAttribute("cm-text","\t"),e.col+=h):("\r"==f[0]||"\n"==f[0]?(p=u.appendChild(M("span","\r"==f[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",f[0]):((p=e.cm.options.specialCharPlaceholder(f[0])).setAttribute("cm-text",f[0]),k&&v<9?u.appendChild(M("span",[p])):u.appendChild(p)),e.col+=1),e.map.push(e.pos,e.pos+1,p),e.pos++}else e.col+=t.length,u=document.createTextNode(s),e.map.push(e.pos,e.pos+t.length,u),k&&v<9&&(c=!0),e.pos+=t.length;if(e.trailingSpace=32==s.charCodeAt(t.length-1),n||r||i||c||o||a){n=n||"";r&&(n+=r),i&&(n+=i);var m=M("span",[u],n,o);if(a)for(var g in a)a.hasOwnProperty(g)&&"style"!=g&&"class"!=g&&m.setAttribute(g,a[g]);return e.content.appendChild(m)}e.content.appendChild(u)}}function Qt(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 Jt(e,t,n){this.line=t,this.rest=function(e){for(var t,n;t=Rt(e);)e=t.find(1,!0).line,(n=n||[]).push(e);return n}(t),this.size=this.rest?Qe($(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Wt(e,t)}function Zt(e,t,n){for(var r=[],i=t;i<n;i=a){var o=new Jt(e.doc,$e(e.doc,i),i),a=i+o.size;r.push(o)}return r}var en=null;function tn(e,t){e=e.ownsGroup;if(e)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)}(e)}finally{en=null,t(e)}}var nn=null;function rn(e,t){var n=ve(e,t);if(n.length){var r,i=Array.prototype.slice.call(arguments,2);en?r=en.delayedCallbacks:nn?r=nn:(r=nn=[],setTimeout(on,0));for(var o=0;o<n.length;++o)!function(e){r.push(function(){return n[e].apply(null,i)})}(o)}}function on(){var e=nn;nn=null;for(var t=0;t<e.length;++t)e[t]()}function an(e,t,n,r){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?function(e,t){var n=t.text.className,r=ln(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,cn(e,t)):n&&(t.text.className=n)}(e,t):"gutter"==o?un(e,t,n,r):"class"==o?cn(e,t):"widget"==o&&function(e,t,n){t.alignable&&(t.alignable=null);for(var r=w("CodeMirror-linewidget"),i=t.node.firstChild,o=void 0;i;i=o)o=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);dn(e,t,n)}(e,t,r)}t.changes=null}function sn(e){return e.node==e.text&&(e.node=M("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),k&&v<8&&(e.node.style.zIndex=2)),e.node}function ln(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Gt(e,t)}function cn(e,t){var n,r;n=e,(r=(i=t).bgClass?i.bgClass+" "+(i.line.bgClass||""):i.line.bgClass)&&(r+=" CodeMirror-linebackground"),i.background?r?i.background.className=r:(i.background.parentNode.removeChild(i.background),i.background=null):r&&(e=sn(i),i.background=e.insertBefore(M("div",null,r),e.firstChild),n.display.input.setUneditable(i.background)),t.line.wrapClass?sn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function un(e,t,n,r){t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass&&(o=sn(t),t.gutterBackground=M("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),o.insertBefore(t.gutterBackground,t.text));var i=t.line.gutterMarkers;if(e.options.lineNumbers||i){var o=sn(t),a=t.gutter=M("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(a.setAttribute("aria-hidden","true"),e.display.input.setUneditable(a),o.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!e.options.lineNumbers||i&&i["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(M("div",et(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),i)for(var s=0;s<e.display.gutterSpecs.length;++s){var l=e.display.gutterSpecs[s].className,c=i.hasOwnProperty(l)&&i[l];c&&a.appendChild(M("div",[c],"CodeMirror-gutter-elt","left: "+r.gutterLeft[l]+"px; width: "+r.gutterWidth[l]+"px"))}}}function dn(e,t,n){if(fn(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)fn(e,t.rest[r],t,n,!1)}function fn(e,t,n,r,i){if(t.widgets)for(var o=sn(n),a=0,s=t.widgets;a<s.length;++a){var l=s[a],c=M("div",[l.node],"CodeMirror-linewidget"+(l.className?" "+l.className:""));l.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),function(e,t,n,r){e.noHScroll&&((n.alignable||(n.alignable=[])).push(t),n=r.wrapperWidth,t.style.left=r.fixedPos+"px",e.coverGutter||(n-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=n+"px");e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}(l,c,n,r),e.display.input.setUneditable(c),i&&l.above?o.insertBefore(c,n.gutter||n.text):o.appendChild(c),rn(l,"redraw")}}function hn(e){if(null!=e.height)return e.height;var t,n=e.doc.cm;return n?(T(document.body,e.node)||(t="position: relative;",e.coverGutter&&(t+="margin-left: -"+n.display.gutters.offsetWidth+"px;"),e.noHScroll&&(t+="width: "+n.display.wrapper.clientWidth+"px;"),_(n.display.measure,M("div",[e.node],null,t))),e.height=e.node.parentNode.offsetHeight):0}function pn(e,t){for(var n=Te(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 1}function mn(e){return e.lineSpace.offsetTop}function gn(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function vn(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=_(e.measure,M("pre","x","CodeMirror-line-like")),t=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,t={left:parseInt(t.paddingLeft),right:parseInt(t.paddingRight)};return isNaN(t.left)||isNaN(t.right)||(e.cachedPaddingH=t),t}function yn(e){return z-e.display.nativeBarWidth}function bn(e){return e.display.scroller.clientWidth-yn(e)-e.display.barWidth}function kn(e){return e.display.scroller.clientHeight-yn(e)-e.display.barHeight}function xn(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(Qe(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function wn(e,t,n,r){return _n(e,Sn(e,t),n,r)}function Cn(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[er(e,t)];e=e.display.externalMeasured;return e&&t>=e.lineN&&t<e.lineN+e.size?e:void 0}function Sn(e,t){var n,r,i=Qe(t),o=Cn(e,i);o&&!o.text?o=null:o&&o.changes&&(an(e,o,i,Xn(e)),e.curOp.forceUpdate=!0),o||(n=e,e=Qe(r=Dt(r=t)),(r=n.display.externalMeasured=new Jt(n.doc,r,e)).lineN=e,e=r.built=Gt(n,r),r.text=e.pre,_(n.display.lineMeasure,e.pre),o=r);i=xn(o,t,i);return{line:t,view:o,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function _n(e,t,n,r,i){var o,a=(n=t.before?-1: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,e=r&&bn(e);if(!t.measure.heights||r&&t.measure.width!=e){var i=t.measure.heights=[];if(r){t.measure.width=e;for(var o=t.text.firstChild.getClientRects(),a=0;a<o.length-1;a++){var s=o[a],l=o[a+1];2<Math.abs(s.bottom-l.bottom)&&i.push((s.bottom+l.top)/2-n.top)}}i.push(n.bottom-n.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,n,r){var i,o=Tn(t.map,n,r),a=o.node,s=o.start,l=o.end,c=o.collapse;if(3==a.nodeType){for(var u=0;u<4;u++){for(;s&&ne(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+l<o.coverEnd&&ne(t.line.text.charAt(o.coverStart+l));)++l;if((i=k&&v<9&&0==s&&l==o.coverEnd-o.coverStart?a.parentNode.getBoundingClientRect():function(e,t){var n=Mn;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}(E(a,s,l).getClientRects(),r)).left||i.right||0==s)break;l=s,s-=1,c="right"}k&&v<11&&(i=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=Be)return Be;var e=(t=_(e,M("span","x"))).getBoundingClientRect(),t=E(t,0,1).getBoundingClientRect();return Be=1<Math.abs(e.left-t.left)}(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,e=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*e,bottom:t.bottom*e}}(e.display.measure,i))}else 0<s&&(c=r="right"),i=e.options.lineWrapping&&1<(m=a.getClientRects()).length?m["right"==r?m.length-1:0]:a.getBoundingClientRect();!(k&&v<9)||s||i&&(i.left||i.right)||(g=a.parentNode.getClientRects()[0],i=g?{left:g.left,right:g.left+Gn(e.display),top:g.top,bottom:g.bottom}:Mn);for(var d=i.top-t.rect.top,n=i.bottom-t.rect.top,f=(d+n)/2,h=t.view.measure.heights,p=0;p<h.length-1&&!(f<h[p]);p++);var m=p?h[p-1]:0,g=h[p],g={left:("right"==c?i.right:i.left)-t.rect.left,right:("left"==c?i.left:i.right)-t.rect.left,top:m,bottom:g};i.left||i.right||(g.bogus=!0);e.options.singleCursorHeightPerLine||(g.rtop=d,g.rbottom=n);return g}(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 Ln,Mn={left:0,right:0,top:0,bottom:0};function Tn(e,t,n){for(var r,i,o,a,s,l,c=0;c<e.length;c+=3)if(s=e[c],l=e[c+1],t<s?(i=0,o=1,a="left"):t<l?o=(i=t-s)+1:(c==e.length-3||t==l&&e[c+3]>t)&&(i=(o=l-s)-1,l<=t&&(a="right")),null!=i){if(r=e[c+2],s==l&&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==l-s)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:s,coverEnd:l}}function An(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 On(e){e.display.externalMeasure=null,S(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)An(e.display.view[t])}function Nn(e){On(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function En(){return o&&l?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function In(){return o&&l?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Pn(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=hn(e.widgets[n]));return t}function Rn(e,t,n,r,i){if(i||(i=Pn(t),n.top+=i,n.bottom+=i),"line"==r)return n;r=r||"local";t=qt(t);return"local"==r?t+=mn(e.display):t-=e.display.viewOffset,"page"!=r&&"window"!=r||(t+=(e=e.display.lineSpace.getBoundingClientRect()).top+("window"==r?0:In()),r=e.left+("window"==r?0:En()),n.left+=r,n.right+=r),n.top+=t,n.bottom+=t,n}function Bn(e,t,n){if("div"==n)return t;var r=t.left,t=t.top;"page"==n?(r-=En(),t-=In()):"local"!=n&&n||(r+=(n=e.display.sizer.getBoundingClientRect()).left,t+=n.top);e=e.display.lineSpace.getBoundingClientRect();return{left:r-e.left,top:t-e.top}}function Dn(e,t,n,r,i){return Rn(e,r=r||$e(e.doc,t.line),wn(e,r,t.ch,i),n)}function Fn(n,e,r,i,o,a){function s(e,t){e=_n(n,o,e,t?"right":"left",a);return t?e.left=e.right:e.right=e.left,Rn(n,i,e,r)}i=i||$e(n.doc,e.line),o=o||Sn(n,i);var l=pe(i,n.doc.direction),t=e.ch,c=e.sticky;if(t>=i.text.length?(t=i.text.length,c="before"):t<=0&&(t=0,c="after"),!l)return s("before"==c?t-1:t,"before"==c);function u(e,t,n){return s(n?e-1:e,1==l[t].level!=n)}var d=ae(l,t,c),e=oe,d=u(t,d,"before"==c);return null!=e&&(d.other=u(t,e,"before"!=c)),d}function zn(e,t){var n=0;t=lt(e.doc,t),e.options.lineWrapping||(n=Gn(e.display)*t.ch);t=$e(e.doc,t.line),e=qt(t)+mn(e.display);return{left:n,right:n,top:e,bottom:e+t.height}}function Wn(e,t,n,r,i){n=tt(e,t,n);return n.xRel=i,r&&(n.outside=r),n}function qn(e,t,n){var r=e.doc;if((n+=e.display.viewOffset)<0)return Wn(r.first,0,null,-1,-1);var i=Je(r,n),o=r.first+r.size-1;if(o<i)return Wn(r.first+r.size-1,$e(r,o).text.length,null,1,1);t<0&&(t=0);for(var a=$e(r,i);;){var s=function(n,e,t,r,i){i-=qt(e);var o=Sn(n,e),a=Pn(e),s=0,l=e.text.length,c=!0,u=pe(e,n.doc.direction);u&&(h=(n.options.lineWrapping?Vn:Un)(n,e,t,o,u,r,i),c=1!=h.level,s=c?h.from:h.to-1,l=c?h.to:h.from-1);var d=null,f=null,u=ie(function(e){var t=_n(n,o,e);return t.top+=a,t.bottom+=a,Kn(t,r,i,!1)&&(t.top<=i&&t.left<=r&&(d=e,f=t),1)},s,l),h=!1;{var p,m;f?(p=r-f.left<f.right-r,u=d+((m=p==c)?0:1),m=m?"after":"before",p=p?f.left:f.right):(c||u!=l&&u!=s||u++,m=0==u||u!=e.text.length&&_n(n,o,u-(c?1:0)).bottom+a<=i==c?"after":"before",c=Fn(n,tt(t,u,m),"line",e,o),p=c.left,h=i<c.top?-1:i>=c.bottom?1:0)}return u=re(e.text,u,1),Wn(t,u,m,h,r-p)}(e,a,i,t,n),l=function(e,t){var n,r=Ct&&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||Et(n,o.marker)<0)&&(n=o.marker)}return n}(a,s.ch+(0<s.xRel||0<s.outside?1:0));if(!l)return s;l=l.find(1);if(l.line==i)return l;a=$e(r,i=l.line)}}function Hn(t,e,n,r){r-=Pn(e);var i=e.text.length,e=ie(function(e){return _n(t,n,e-1).bottom<=r},i,0);return{begin:e,end:i=ie(function(e){return _n(t,n,e).top>r},e,i)}}function jn(e,t,n,r){return Hn(e,t,n=n||Sn(e,t),Rn(e,t,_n(e,n,r),"line").top)}function Kn(e,t,n,r){return!(e.bottom<=n)&&(e.top>n||(r?e.left:e.right)>t)}function Un(n,r,i,o,a,s,l){var e,t=ie(function(e){var t=a[e],e=1!=t.level;return Kn(Fn(n,tt(i,e?t.to:t.from,e?"before":"after"),"line",r,o),s,l,!0)},0,a.length-1),c=a[t];return 0<t&&(e=1!=c.level,Kn(e=Fn(n,tt(i,e?c.from:c.to,e?"after":"before"),"line",r,o),s,l,!0)&&e.top>l&&(c=a[t-1])),c}function Vn(e,t,n,r,i,o,a){var a=Hn(e,t,r,a),s=a.begin,l=a.end;/\s/.test(t.text.charAt(l-1))&&l--;for(var c=null,u=null,d=0;d<i.length;d++){var f,h=i[d];h.from>=l||h.to<=s||(f=(f=_n(e,r,1!=h.level?Math.min(l,h.to)-1:Math.max(s,h.from)).right)<o?o-f+1e9:f-o,(!c||f<u)&&(c=h,u=f))}return c=(c=(c=c||i[i.length-1]).from<s?{from:s,to:c.to,level:c.level}:c).to>l?{from:c.from,to:l,level:c.level}:c}function $n(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Ln){Ln=M("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Ln.appendChild(document.createTextNode("x")),Ln.appendChild(M("br"));Ln.appendChild(document.createTextNode("x"))}_(e.measure,Ln);var n=Ln.offsetHeight/50;return 3<n&&(e.cachedTextHeight=n),S(e.measure),n||1}function Gn(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=M("span","xxxxxxxxxx"),n=M("pre",[t],"CodeMirror-line-like");_(e.measure,n);t=t.getBoundingClientRect(),t=(t.right-t.left)/10;return 2<t&&(e.cachedCharWidth=t),t||10}function Xn(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var s=e.display.gutterSpecs[a].className;n[s]=o.offsetLeft+o.clientLeft+i,r[s]=o.clientWidth}return{fixedPos:Yn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Yn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Qn(r){var i=$n(r.display),o=r.options.lineWrapping,a=o&&Math.max(5,r.display.scroller.clientWidth/Gn(r.display)-3);return function(e){if(Wt(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 Jn(e){var t=e.doc,n=Qn(e);t.iter(function(e){var t=n(e);t!=e.height&&Ye(e,t)})}function Zn(e,t,n,r){var i=e.display;if(!n&&"true"==Te(t).getAttribute("cm-not-content"))return null;var o,i=i.lineSpace.getBoundingClientRect();try{o=t.clientX-i.left,s=t.clientY-i.top}catch(e){return null}var a,s=qn(e,o,s);return r&&0<s.xRel&&(a=$e(e.doc,s.line).text).length==s.ch&&(a=B(a,a.length,e.options.tabSize)-a.length,s=tt(s.line,Math.max(0,Math.round((o-vn(e.display).left)/Gn(e.display))-a))),s}function er(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 tr(e,t,n,r){null==t&&(t=e.doc.first),null==n&&(n=e.doc.first+e.doc.size);var i,o,a=e.display;(r=r||0)&&n<a.viewTo&&(null==a.updateLineNumbers||a.updateLineNumbers>t)&&(a.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=a.viewTo?Ct&&Ft(e.doc,t)<a.viewTo&&rr(e):n<=a.viewFrom?Ct&&zt(e.doc,n+r)>a.viewFrom?rr(e):(a.viewFrom+=r,a.viewTo+=r):t<=a.viewFrom&&n>=a.viewTo?rr(e):t<=a.viewFrom?(i=ir(e,n,n+r,1))?(a.view=a.view.slice(i.index),a.viewFrom=i.lineN,a.viewTo+=r):rr(e):n>=a.viewTo?(o=ir(e,t,t,-1))?(a.view=a.view.slice(0,o.index),a.viewTo=o.lineN):rr(e):(i=ir(e,t,t,-1),o=ir(e,n,n+r,1),i&&o?(a.view=a.view.slice(0,i.index).concat(Zt(e,i.lineN,o.lineN)).concat(a.view.slice(o.index)),a.viewTo+=r):rr(e));e=a.externalMeasured;e&&(n<e.lineN?e.lineN+=r:t<e.lineN+e.size&&(a.externalMeasured=null))}function nr(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo||(null==(t=r.view[er(e,t)]).node||-1==F(t=t.changes||(t.changes=[]),n)&&t.push(n))}function rr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function ir(e,t,n,r){var i,o=er(e,t),a=e.display.view;if(!Ct||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var s=e.display.viewFrom,l=0;l<o;l++)s+=a[l].size;if(s!=t){if(0<r){if(o==a.length-1)return null;i=s+a[o].size-t,o++}else i=s-t;t+=i,n+=i}for(;Ft(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 or(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 ar(e){e.display.input.showSelection(e.display.input.prepareSelection())}function sr(e,t){void 0===t&&(t=!0);for(var n,r,i=e.doc,o={},a=o.cursors=document.createDocumentFragment(),s=o.selection=document.createDocumentFragment(),l=0;l<i.sel.ranges.length;l++)!t&&l==i.sel.primIndex||((n=i.sel.ranges[l]).from().line>=e.display.viewTo||n.to().line<e.display.viewFrom||(((r=n.empty())||e.options.showCursorWhenSelecting)&&lr(e,n.head,a),r||function(i,e,t){var n=i.display,o=i.doc,a=document.createDocumentFragment(),r=vn(i.display),C=r.left,S=Math.max(n.sizerWidth,bn(i)-n.sizer.offsetLeft)-r.right,_="ltr"==o.direction;function L(e,t,n,r){t<0&&(t=0),t=Math.round(t),r=Math.round(r),a.appendChild(M("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==n?S-e:n)+"px;\n height: "+(r-t)+"px"))}function s(n,m,g){var v,y,r=$e(o,n),b=r.text.length;function k(e,t){return Dn(i,tt(n,e),"div",r,t)}function x(e,t,n){e=jn(i,r,null,e),t="ltr"==t==("after"==n)?"left":"right";return k("after"==n?e.begin:e.end-(/\s/.test(r.text.charAt(e.end-1))?2:1),t)[t]}var w=pe(r,o.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")}(w,m||0,null==g?b:g,function(e,t,n,r){var i,o,a,s,l="ltr"==n,c=k(e,l?"left":"right"),u=k(t-1,l?"right":"left"),d=null==m&&0==e,f=null==g&&t==b,h=0==r,p=!w||r==w.length-1;u.top-c.top<=3?(i=(_?d:f)&&h?C:(l?c:u).left,r=(_?f:d)&&p?S:(l?u:c).right,L(i,c.top,r-i,c.bottom)):(n=l?(o=_&&d&&h?C:c.left,a=_?S:x(e,n,"before"),s=_?C:x(t,n,"after"),_&&f&&p?S:u.right):(o=_?x(e,n,"before"):C,a=!_&&d&&h?S:c.right,s=!_&&f&&p?C:u.left,_?x(t,n,"after"):S),L(o,c.top,a-o,c.bottom),c.bottom<u.top&&L(C,c.bottom,null,u.top),L(s,u.top,n-s,u.bottom)),(!v||cr(c,v)<0)&&(v=c),cr(u,v)<0&&(v=u),(!y||cr(c,y)<0)&&(y=c),cr(u,y)<0&&(y=u)}),{start:v,end:y}}var l=e.from(),n=e.to();l.line==n.line?s(l.line,l.ch,n.ch):(r=$e(o,l.line),e=$e(o,n.line),e=Dt(r)==Dt(e),r=s(l.line,l.ch,e?r.text.length+1:null).end,n=s(n.line,e?0:null,n.ch).start,e&&(r.top<n.top-2?(L(r.right,r.top,null,r.bottom),L(C,n.top,n.left,n.bottom)):L(r.right,r.top,n.left-r.right,r.bottom)),r.bottom<n.top&&L(C,r.bottom,null,n.top));t.appendChild(a)}(e,n,s)));return o}function lr(e,t,n){var r=Fn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(M("div"," ","CodeMirror-cursor"));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",/\bcm-fat-cursor\b/.test(e.getWrapperElement().className)&&(t=Dn(e,t,"div",null,null),i.style.width=Math.max(0,t.right-t.left)+"px"),r.other&&((n=n.appendChild(M("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"))).style.display="",n.style.left=r.other.left+"px",n.style.top=r.other.top+"px",n.style.height=.85*(r.other.bottom-r.other.top)+"px")}function cr(e,t){return e.top-t.top||e.left-t.left}function ur(e){var t,n;e.state.focused&&(t=e.display,clearInterval(t.blinker),n=!0,t.cursorDiv.style.visibility="",0<e.options.cursorBlinkRate?t.blinker=setInterval(function(){e.hasFocus()||pr(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden"))}function dr(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||hr(e))}function fr(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&pr(e))},100)}function hr(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(be(e,"focus",e,t),e.state.focused=!0,O(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),h&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),ur(e))}function pr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(be(e,"blur",e,t),e.state.focused=!1,C(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function mr(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i,o=t.view[r],a=e.options.lineWrapping,s=void 0,l=0;if(!o.hidden){k&&v<8?(s=(i=o.node.offsetTop+o.node.offsetHeight)-n,n=i):(s=(c=o.node.getBoundingClientRect()).bottom-c.top,!a&&o.text.firstChild&&(l=o.text.firstChild.getBoundingClientRect().right-c.left-1));var c=o.line.height-s;if((.005<c||c<-.005)&&(Ye(o.line,s),gr(o.line),o.rest))for(var u=0;u<o.rest.length;u++)gr(o.rest[u]);l>e.display.sizerWidth&&((l=Math.ceil(l/Gn(e.display)))>e.display.maxLineLength&&(e.display.maxLineLength=l,e.display.maxLine=o.line,e.display.maxLineChanged=!0))}}}function gr(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 vr(e,t,n){var r=n&&null!=n.top?Math.max(0,n.top):e.scroller.scrollTop,r=Math.floor(r-mn(e)),i=n&&null!=n.bottom?n.bottom:r+e.wrapper.clientHeight,o=Je(t,r),r=Je(t,i);return n&&n.ensure&&(i=n.ensure.from.line,n=n.ensure.to.line,i<o?r=Je(t,qt($e(t,o=i))+e.wrapper.clientHeight):Math.min(n,t.lastLine())>=r&&(o=Je(t,qt($e(t,n))-e.wrapper.clientHeight),r=n)),{from:o,to:Math.max(r,o+1)}}function yr(e,t){var n=e.display,r=$n(e.display);t.top<0&&(t.top=0);var i=(e.curOp&&null!=e.curOp.scrollTop?e.curOp:n.scroller).scrollTop,o=kn(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var s=e.doc.height+gn(n),l=t.top<r,r=t.bottom>s-r;t.top<i?a.scrollTop=l?0:t.top:t.bottom>i+o&&((c=Math.min(t.top,(r?s:t.bottom)-o))!=i&&(a.scrollTop=c));var i=e.options.fixedGutter?0:n.gutters.offsetWidth,c=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft-i,e=bn(e)-n.gutters.offsetWidth,n=t.right-t.left>e;return n&&(t.right=t.left+e),t.left<10?a.scrollLeft=0:t.left<c?a.scrollLeft=Math.max(0,t.left+i-(n?0:10)):t.right>e+c-3&&(a.scrollLeft=t.right+(n?0:10)-e),a}function br(e,t){null!=t&&(wr(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc:e.curOp).scrollTop+t)}function kr(e){wr(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function xr(e,t,n){null==t&&null==n||wr(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function wr(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Cr(e,zn(e,t.from),zn(e,t.to),t.margin))}function Cr(e,t,n,r){r=yr(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});xr(e,r.scrollLeft,r.scrollTop)}function Sr(e,t){Math.abs(e.doc.scrollTop-t)<2||(f||Kr(e,{top:t}),_r(e,t,!0),f&&Kr(e),zr(e,100))}function _r(e,t,n){t=Math.max(0,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 Lr(e,t,n,r){t=Math.max(0,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,$r(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Mr(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+gn(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+yn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}e=function(e,t,n){this.cm=n;var r=this.vert=M("div",[M("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=M("div",[M("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),ge(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ge(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,k&&v<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};e.prototype.update=function(e){var t,n=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,i=e.nativeBarWidth;return r?(this.vert.style.display="block",this.vert.style.bottom=n?i+"px":"0",t=e.viewHeight-(n?i:0),this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+t)+"px"):(this.vert.style.display="",this.vert.firstChild.style.height="0"),n?(this.horiz.style.display="block",this.horiz.style.right=r?i+"px":"0",this.horiz.style.left=e.barLeft+"px",t=e.viewWidth-e.barLeft-(r?i:0),this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+t)+"px"):(this.horiz.style.display="",this.horiz.firstChild.style.width="0"),!this.checkedZeroWidth&&0<e.clientHeight&&(0==i&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?i:0,bottom:n?i:0}},e.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},e.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},e.prototype.zeroWidthHack=function(){this.horiz.style.height=this.vert.style.width=m&&!a?"12px":"18px",this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new D,this.disableVert=new D},e.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)})},e.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};r=function(){};function Tr(e,t){t=t||Mr(e);var n=e.display.barWidth,r=e.display.barHeight;Ar(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&mr(e),Ar(e,Mr(e)),n=e.display.barWidth,r=e.display.barHeight}function Ar(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=""}r.prototype.update=function(){return{bottom:0,right:0}},r.prototype.setScrollLeft=function(){},r.prototype.setScrollTop=function(){},r.prototype.clear=function(){};var Or={native:e,null:r};function Nr(n){n.display.scrollbars&&(n.display.scrollbars.clear(),n.display.scrollbars.addClass&&C(n.display.wrapper,n.display.scrollbars.addClass)),n.display.scrollbars=new Or[n.options.scrollbarStyle](function(e){n.display.wrapper.insertBefore(e,n.display.scrollbarFiller),ge(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?Lr:Sr)(n,e)},n),n.display.scrollbars.addClass&&O(n.display.wrapper,n.display.scrollbars.addClass)}var Er=0;function Ir(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:++Er,markArrays:null},e=e.curOp,en?en.ops.push(e):e.ownsGroup=en={ops:[e],delayedCallbacks:[]}}function Pr(e){e=e.curOp;e&&tn(e,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++)!function(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=yn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=yn(e)+"px",t.scrollbarsClipped=!0)})(t),e.updateMaxLine&&jt(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 qr(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}(t[n]);for(var r=0;r<t.length;r++)!function(e){e.updatedDisplay=e.mustUpdate&&Hr(e.cm,e.update)}(t[r]);for(var i=0;i<t.length;i++)!function(e){var t=e.cm,n=t.display;e.updatedDisplay&&mr(t);e.barMeasure=Mr(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=wn(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+yn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-bn(t)));(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}(t[i]);for(var o=0;o<t.length;o++)!function(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Lr(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==A();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n);!e.updatedDisplay&&e.startHeight==t.doc.height||Tr(t,e.barMeasure);e.updatedDisplay&&Vr(t,e.barMeasure);e.selectionChanged&&ur(t);t.state.focused&&e.updateInput&&t.display.input.reset(e.typing);n&&dr(e.cm)}(t[o]);for(var a=0;a<t.length;a++)!function(e){var t=e.cm,n=t.display,r=t.doc;e.updatedDisplay&&jr(t,e.update);null==n.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(n.wheelStartX=n.wheelStartY=null);null!=e.scrollTop&&_r(t,e.scrollTop,e.forceScroll);null!=e.scrollLeft&&Lr(t,e.scrollLeft,!0,!0);{var i;e.scrollToPos&&(i=function(e,t,n,r){null==r&&(r=0),e.options.lineWrapping||t!=n||(n="before"==t.sticky?tt(t.line,t.ch+1,"before"):t,t=t.ch?tt(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t);for(var i=0;i<5;i++){var o,a=!1,s=Fn(e,t),l=n&&n!=t?Fn(e,n):s,c=yr(e,o={left:Math.min(s.left,l.left),top:Math.min(s.top,l.top)-r,right:Math.max(s.left,l.left),bottom:Math.max(s.bottom,l.bottom)+r}),s=e.doc.scrollTop,l=e.doc.scrollLeft;if(null!=c.scrollTop&&(Sr(e,c.scrollTop),1<Math.abs(e.doc.scrollTop-s)&&(a=!0)),null!=c.scrollLeft&&(Lr(e,c.scrollLeft),1<Math.abs(e.doc.scrollLeft-l)&&(a=!0)),!a)break}return o}(t,lt(r,e.scrollToPos.from),lt(r,e.scrollToPos.to),e.scrollToPos.margin),function(e,t){var n,r,i;ke(e,"scrollCursorIntoView")||(r=(n=e.display).sizer.getBoundingClientRect(),i=null,t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null==i||c||(t=M("div","​",null,"position: absolute;\n top: "+(t.top-n.viewOffset-mn(e.display))+"px;\n height: "+(t.bottom-t.top+yn(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;"),e.display.lineSpace.appendChild(t),t.scrollIntoView(i),e.display.lineSpace.removeChild(t)))}(t,i))}var o=e.maybeHiddenMarkers,a=e.maybeUnhiddenMarkers;if(o)for(var s=0;s<o.length;++s)o[s].lines.length||be(o[s],"hide");if(a)for(var l=0;l<a.length;++l)a[l].lines.length&&be(a[l],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop);e.changeObjs&&be(t,"changes",t,e.changeObjs);e.update&&e.update.finish()}(t[a])}(e)})}function Rr(e,t){if(e.curOp)return t();Ir(e);try{return t()}finally{Pr(e)}}function Br(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Ir(e);try{return t.apply(e,arguments)}finally{Pr(e)}}}function Dr(e){return function(){if(this.curOp)return e.apply(this,arguments);Ir(this);try{return e.apply(this,arguments)}finally{Pr(this)}}}function Fr(t){return function(){var e=this.cm;if(!e||e.curOp)return t.apply(this,arguments);Ir(e);try{return t.apply(this,arguments)}finally{Pr(e)}}}function zr(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,P(Wr,e))}function Wr(a){var s,l,c,u=a.doc;u.highlightFrontier>=a.display.viewTo||(s=+new Date+a.options.workTime,l=pt(a,u.highlightFrontier),c=[],u.iter(l.line,Math.min(u.first+u.size,a.display.viewTo+500),function(e){if(l.line>=a.display.viewFrom){var t=e.styles,n=e.text.length>a.options.maxHighlightLength?je(u.mode,l.state):null,r=ft(a,e,l,!0);n&&(l.state=n),e.styles=r.styles;n=e.styleClasses,r=r.classes;r?e.styleClasses=r:n&&(e.styleClasses=null);for(var i=!t||t.length!=e.styles.length||n!=r&&(!n||!r||n.bgClass!=r.bgClass||n.textClass!=r.textClass),o=0;!i&&o<t.length;++o)i=t[o]!=e.styles[o];i&&c.push(l.line),e.stateAfter=l.save(),l.nextLine()}else e.text.length<=a.options.maxHighlightLength&&mt(a,e.text,l),e.stateAfter=l.line%5==0?l.save():null,l.nextLine();if(+new Date>s)return zr(a,a.options.workDelay),!0}),u.highlightFrontier=l.line,u.modeFrontier=Math.max(u.modeFrontier,l.line),c.length&&Rr(a,function(){for(var e=0;e<c.length;e++)nr(a,c[e],"text")}))}var qr=function(e,t,n){var r=e.display;this.viewport=t,this.visible=vr(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=bn(e),this.force=n,this.dims=Xn(e),this.events=[]};function Hr(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return rr(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==or(e))return!1;Gr(e)&&(rr(e),t.dims=Xn(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)),Ct&&(o=Ft(e.doc,o),a=zt(e.doc,a));var s=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;r=o,i=a,0==(a=(o=e).display).view.length||r>=a.viewTo||i<=a.viewFrom?(a.view=Zt(o,r,i),a.viewFrom=r):(a.viewFrom>r?a.view=Zt(o,r,a.viewFrom).concat(a.view):a.viewFrom<r&&(a.view=a.view.slice(er(o,r))),a.viewFrom=r,a.viewTo<i?a.view=a.view.concat(Zt(o,a.viewTo,i)):a.viewTo>i&&(a.view=a.view.slice(0,er(o,i)))),a.viewTo=i,n.viewOffset=qt($e(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";o=or(e);if(!s&&0==o&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;a=function(e){if(e.hasFocus())return null;var t=A();if(!t||!T(e.display.lineDiv,t))return null;var n={activeElt:t};return!window.getSelection||(t=window.getSelection()).anchorNode&&t.extend&&T(e.display.lineDiv,t.anchorNode)&&(n.anchorNode=t.anchorNode,n.anchorOffset=t.anchorOffset,n.focusNode=t.focusNode,n.focusOffset=t.focusOffset),n}(e);return 4<o&&(n.lineDiv.style.display="none"),function(n,e,t){var r=n.display,i=n.options.lineNumbers,o=r.lineDiv,a=o.firstChild;function s(e){var t=e.nextSibling;return h&&m&&n.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),t}for(var l=r.view,c=r.viewFrom,u=0;u<l.length;u++){var d=l[u];if(!d.hidden)if(d.node&&d.node.parentNode==o){for(;a!=d.node;)a=s(a);var f=i&&null!=e&&e<=c&&d.lineNumber;d.changes&&(-1<F(d.changes,"gutter")&&(f=!1),an(n,d,c,t)),f&&(S(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(et(n.options,c)))),a=d.node.nextSibling}else{f=function(e,t,n,r){var i=ln(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),cn(e,t),un(e,t,n,r),dn(e,t,r),t.node}(n,d,c,t);o.insertBefore(f,a)}c+=d.size}for(;a;)a=s(a)}(e,n.updateLineNumbers,t.dims),4<o&&(n.lineDiv.style.display=""),n.renderedView=n.view,(i=a)&&i.activeElt&&i.activeElt!=A()&&(i.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(i.activeElt.nodeName)&&i.anchorNode&&T(document.body,i.anchorNode)&&T(document.body,i.focusNode)&&(o=window.getSelection(),(a=document.createRange()).setEnd(i.anchorNode,i.anchorOffset),a.collapse(!1),o.removeAllRanges(),o.addRange(a),o.extend(i.focusNode,i.focusOffset))),S(n.cursorDiv),S(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,s&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,zr(e,400)),!(n.updateLineNumbers=null)}function jr(e,t){for(var n=t.viewport,r=!0;;r=!1){if(r&&e.options.lineWrapping&&t.oldDisplayWidth!=bn(e))r&&(t.visible=vr(e.display,e.doc,n));else if(n&&null!=n.top&&(n={top:Math.min(e.doc.height+gn(e.display)-kn(e),n.top)}),t.visible=vr(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!Hr(e,t))break;mr(e);var i=Mr(e);ar(e),Tr(e,i),Vr(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 Kr(e,t){var n=new qr(e,t);Hr(e,n)&&(mr(e),jr(e,n),t=Mr(e),ar(e),Tr(e,t),Vr(e,t),n.finish())}function Ur(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",rn(e,"gutterChanged",e)}function Vr(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+yn(e)+"px"}function $r(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=Yn(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 s=n[a].alignable;if(s)for(var l=0;l<s.length;l++)s[l].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}}function Gr(e){if(e.options.lineNumbers){var t=e.doc,n=et(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(M("div",[M("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),t=i.firstChild.offsetWidth,i=i.offsetWidth-t;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(t,r.lineGutter.offsetWidth-i)+1,r.lineNumWidth=r.lineNumInnerWidth+i,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Ur(e.display),1}}}function Xr(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 Yr(e){var t=e.gutters,n=e.gutterSpecs;S(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],o=i.className,a=i.style,i=t.appendChild(M("div",null,"CodeMirror-gutter "+o));a&&(i.style.cssText=a),"CodeMirror-linenumbers"==o&&((e.lineGutter=i).style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Ur(e)}function Qr(e){Yr(e.display),tr(e),$r(e)}function Jr(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=M("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=M("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=L("div",null,"CodeMirror-code"),i.selectionDiv=M("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=M("div",null,"CodeMirror-cursors"),i.measure=M("div",null,"CodeMirror-measure"),i.lineMeasure=M("div",null,"CodeMirror-measure"),i.lineSpace=L("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var o=L("div",[i.lineSpace],"CodeMirror-lines");i.mover=M("div",[o],null,"position: relative"),i.sizer=M("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=M("div",null,null,"position: absolute; height: "+z+"px; width: 1px;"),i.gutters=M("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=M("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=M("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),i.wrapper.setAttribute("translate","no"),k&&v<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),h||f&&d||(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=Xr(r.gutters,r.lineNumbers),Yr(i),n.init(i)}qr.prototype.signal=function(e,t){we(e,t)&&this.events.push(arguments)},qr.prototype.finish=function(){for(var e=0;e<this.events.length;e++)be.apply(null,this.events[e])};var Zr=0,ei=null;function ti(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 ni(e){e=ti(e);return e.x*=ei,e.y*=ei,e}function ri(e,t){var n=ti(t),r=n.x,i=n.y,o=e.display,a=o.scroller,s=a.scrollWidth>a.clientWidth,l=a.scrollHeight>a.clientHeight;if(r&&s||i&&l){if(i&&m&&h)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&&!f&&!p&&null!=ei)return i&&l&&Sr(e,Math.max(0,a.scrollTop+i*ei)),Lr(e,Math.max(0,a.scrollLeft+r*ei)),i&&!l||Se(t),void(o.wheelStartX=null);i&&null!=ei&&(n=i*ei,l=(s=e.doc.scrollTop)+o.wrapper.clientHeight,n<0?s=Math.max(0,s+n-50):l=Math.min(e.doc.height,l+n+50),Kr(e,{top:s,bottom:l})),Zr<20&&(null==o.wheelStartX?(o.wheelStartX=a.scrollLeft,o.wheelStartY=a.scrollTop,o.wheelDX=r,o.wheelDY=i,setTimeout(function(){var e,t;null!=o.wheelStartX&&(t=a.scrollLeft-o.wheelStartX,t=(e=a.scrollTop-o.wheelStartY)&&o.wheelDY&&e/o.wheelDY||t&&o.wheelDX&&t/o.wheelDX,o.wheelStartX=o.wheelStartY=null,t&&(ei=(ei*Zr+t)/(Zr+1),++Zr))},200)):(o.wheelDX+=r,o.wheelDY+=i))}}k?ei=-.53:f?ei=15:o?ei=-.7:u&&(ei=-1/3);var ii=function(e,t){this.ranges=e,this.primIndex=t};ii.prototype.primary=function(){return this.ranges[this.primIndex]},ii.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(!rt(n.anchor,r.anchor)||!rt(n.head,r.head))return!1}return!0},ii.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new oi(it(this.ranges[t].anchor),it(this.ranges[t].head));return new ii(e,this.primIndex)},ii.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},ii.prototype.contains=function(e,t){t=t||e;for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(0<=nt(t,r.from())&&nt(e,r.to())<=0)return n}return-1};var oi=function(e,t){this.anchor=e,this.head=t};function ai(e,t,n){var r=e&&e.options.selectionsMayTouch,e=t[n];t.sort(function(e,t){return nt(e.from(),t.from())}),n=F(t,e);for(var i=1;i<t.length;i++){var o,a=t[i],s=t[i-1],l=nt(s.to(),a.from());(r&&!a.empty()?0<l:0<=l)&&(o=at(s.from(),a.from()),l=ot(s.to(),a.to()),s=s.empty()?a.from()==a.head:s.from()==s.head,i<=n&&--n,t.splice(--i,2,new oi(s?l:o,s?o:l)))}return new ii(t,n)}function si(e,t){return new ii([new oi(e,t||e)],0)}function li(e){return e.text?tt(e.from.line+e.text.length-1,$(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function ci(e,t){if(nt(e,t.from)<0)return e;if(nt(e,t.to)<=0)return li(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+=li(t).ch-t.to.ch),tt(n,r)}function ui(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new oi(ci(i.anchor,t),ci(i.head,t)))}return ai(e.cm,n,e.sel.primIndex)}function di(e,t,n){return e.line==t.line?tt(n.line,e.ch-t.ch+n.ch):tt(n.line+(e.line-t.line),e.ch)}function fi(e){e.doc.mode=We(e.options,e.doc.modeOption),hi(e)}function hi(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,zr(e,100),e.state.modeGen++,e.curOp&&tr(e)}function pi(e,t){return 0==t.from.ch&&0==t.to.ch&&""==$(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function mi(e,o,t,a){function i(e){return t?t[e]:null}function n(e,t,n){var r,i;r=n,i=a,(n=e).text=t,n.stateAfter&&(n.stateAfter=null),n.styles&&(n.styles=null),null!=n.order&&(n.order=null),Tt(n),At(n,r),(i=i?i(n):1)!=n.height&&Ye(n,i),rn(e,"change",e,o)}function r(e,t){for(var n=[],r=e;r<t;++r)n.push(new Kt(u[r],i(r),a));return n}var s,l=o.from,c=o.to,u=o.text,d=$e(e,l.line),f=$e(e,c.line),h=$(u),p=i(u.length-1),m=c.line-l.line;o.full?(e.insert(0,r(0,u.length)),e.remove(u.length,e.size-u.length)):pi(e,o)?(s=r(0,u.length-1),n(f,f.text,p),m&&e.remove(l.line,m),s.length&&e.insert(l.line,s)):d==f?1==u.length?n(d,d.text.slice(0,l.ch)+h+d.text.slice(c.ch),p):((s=r(1,u.length-1)).push(new Kt(h+d.text.slice(c.ch),p,a)),n(d,d.text.slice(0,l.ch)+u[0],i(0)),e.insert(l.line+1,s)):1==u.length?(n(d,d.text.slice(0,l.ch)+u[0]+f.text.slice(c.ch),i(0)),e.remove(l.line+1,m)):(n(d,d.text.slice(0,l.ch)+u[0],i(0)),n(f,h+f.text.slice(c.ch),p),p=r(1,u.length-1),1<m&&e.remove(l.line+1,m-1),e.insert(l.line+1,p)),rn(e,"change",e,o)}function gi(e,s,l){!function e(t,n,r){if(t.linked)for(var i=0;i<t.linked.length;++i){var o,a=t.linked[i];a.doc!=n&&(o=r&&a.sharedHist,l&&!o||(s(a.doc,o),e(a.doc,t,o)))}}(e,null,!0)}function vi(e,t){if(t.cm)throw new Error("This document is already in use.");Jn((e.doc=t).cm=e),fi(e),yi(e),e.options.direction=t.direction,e.options.lineWrapping||jt(e),e.options.mode=t.modeOption,tr(e)}function yi(e){("rtl"==e.doc.direction?O:C)(e.display.lineDiv,"CodeMirror-rtl")}function bi(e){this.done=[],this.undone=[],this.undoDepth=e?e.undoDepth:1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e?e.maxGeneration:1}function ki(e,t){var n={from:it(t.from),to:li(t),text:Ge(e,t.from,t.to)};return _i(e,n,t.from.line,t.to.line+1),gi(e,function(e){return _i(e,n,t.from.line,t.to.line+1),0},!0),n}function xi(e){for(;e.length;){if(!$(e).ranges)break;e.pop()}}function wi(e,t,n,r){var i=e.history;i.undone.length=0;var o,a,s=+new Date;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastModTime>s-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=(l=i).lastOp==r?(xi(l.done),$(l.done)):l.done.length&&!$(l.done).ranges?$(l.done):1<l.done.length&&!l.done[l.done.length-2].ranges?(l.done.pop(),$(l.done)):void 0))a=$(o.changes),0==nt(t.from,t.to)&&0==nt(t.from,a.to)?a.to=li(t):o.changes.push(ki(e,t));else{var l=$(i.done);for(l&&l.ranges||Si(e.sel,i.done),o={changes:[ki(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=s,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,a||be(e,"historyAdded")}function Ci(e,t,n,r){var i,o,a,s=e.history,l=r&&r.origin;n==s.lastSelOp||l&&s.lastSelOrigin==l&&(s.lastModTime==s.lastSelTime&&s.lastOrigin==l||(i=e,o=l,a=$(s.done),e=t,"*"==(o=o.charAt(0))||"+"==o&&a.ranges.length==e.ranges.length&&a.somethingSelected()==e.somethingSelected()&&new Date-i.history.lastSelTime<=(i.cm?i.cm.options.historyEventDelay:500)))?s.done[s.done.length-1]=t:Si(t,s.done),s.lastSelTime=+new Date,s.lastSelOrigin=l,s.lastSelOp=n,r&&!1!==r.clearRedo&&xi(s.undone)}function Si(e,t){var n=$(t);n&&n.ranges&&n.equals(e)||t.push(e)}function _i(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 Li(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(function(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}(n[i]));return r}function Mi(e,t){var n=Li(e,t),r=Lt(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 s=0;s<a.length;++s){for(var l=a[s],c=0;c<o.length;++c)if(o[c].marker==l.marker)continue e;o.push(l)}else a&&(n[i]=a)}return n}function Ti(e,t,n){for(var r=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)r.push(n?ii.prototype.deepCopy.call(o):o);else{var a=o.changes,s=[];r.push({changes:s});for(var l=0;l<a.length;++l){var c,u=a[l];if(s.push({from:u.from,to:u.to,text:u.text}),t)for(var d in u)(c=d.match(/^spans_(\d+)$/))&&-1<F(t,Number(c[1]))&&($(s)[d]=u[d],delete u[d])}}}return r}function Ai(e,t,n,r){if(r){r=e.anchor;return n&&((e=nt(t,r)<0)!=nt(n,r)<0?(r=t,t=n):e!=nt(t,n)<0&&(t=n)),new oi(r,t)}return new oi(n||t,t)}function Oi(e,t,n,r,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Ri(e,new ii([Ai(e.sel.primary(),t,n,i)],0),r)}function Ni(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]=Ai(e.sel.ranges[o],t[o],null,i);Ri(e,ai(e.cm,r,e.sel.primIndex),n)}function Ei(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Ri(e,ai(e.cm,i,e.sel.primIndex),r)}function Ii(e,t,n,r){Ri(e,si(t,n),r)}function Pi(e,t,n){var r=e.history.done,i=$(r);i&&i.ranges?Bi(e,r[r.length-1]=t,n):Ri(e,t,n)}function Ri(e,t,n){Bi(e,t,n),Ci(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Bi(e,t,n){var r,i;(we(e,"beforeSelectionChange")||e.cm&&we(e.cm,"beforeSelectionChange"))&&(r=e,i=n,i={ranges:(o=t).ranges,update:function(e){this.ranges=[];for(var t=0;t<e.length;t++)this.ranges[t]=new oi(lt(r,e[t].anchor),lt(r,e[t].head))},origin:i&&i.origin},be(r,"beforeSelectionChange",r,i),r.cm&&be(r.cm,"beforeSelectionChange",r.cm,i),t=i.ranges!=o.ranges?ai(r.cm,i.ranges,i.ranges.length-1):o);var o=n&&n.bias||(nt(t.primary().head,e.sel.primary().head)<0?-1:1);Di(e,zi(e,t,o,!0)),n&&!1===n.scroll||!e.cm||"nocursor"==e.cm.getOption("readOnly")||kr(e.cm)}function Di(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,xe(e.cm)),rn(e,"cursorActivity",e))}function Fi(e){Di(e,zi(e,e.sel,null,!1))}function zi(e,t,n,r){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],s=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],l=qi(e,a.anchor,s&&s.anchor,n,r),s=qi(e,a.head,s&&s.head,n,r);!i&&l==a.anchor&&s==a.head||((i=i||t.ranges.slice(0,o))[o]=new oi(l,s))}return i?ai(e.cm,i,t.primIndex):t}function Wi(e,t,n,r,i){var o=$e(e,t.line);if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var s=o.markedSpans[a],l=s.marker,c="selectLeft"in l?!l.selectLeft:l.inclusiveLeft,u="selectRight"in l?!l.selectRight:l.inclusiveRight;if((null==s.from||(c?s.from<=t.ch:s.from<t.ch))&&(null==s.to||(u?s.to>=t.ch:s.to>t.ch))){if(i&&(be(l,"beforeCursorEnter"),l.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(l.atomic){if(n){var d=l.find(r<0?1:-1),s=void 0;if((d=(r<0?u:c)?Hi(e,d,-r,d&&d.line==t.line?o:null):d)&&d.line==t.line&&(s=nt(d,n))&&(r<0?s<0:0<s))return Wi(e,d,t,r,i)}l=l.find(r<0?-1:1);return(l=(r<0?c:u)?Hi(e,l,r,l.line==t.line?o:null):l)?Wi(e,l,t,r,i):null}}}return t}function qi(e,t,n,r,i){r=r||1,r=Wi(e,t,n,r,i)||!i&&Wi(e,t,n,r,!0)||Wi(e,t,n,-r,i)||!i&&Wi(e,t,n,-r,!0);return r||(e.cantEdit=!0,tt(e.first,0))}function Hi(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?lt(e,tt(t.line-1)):null:0<n&&t.ch==(r||$e(e,t.line)).text.length?t.line<e.first+e.size-1?tt(t.line+1,0):null:new tt(t.line,t.ch+n)}function ji(e){e.setSelection(tt(e.firstLine(),0),tt(e.lastLine()),q)}function Ki(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=lt(i,e)),t&&(o.to=lt(i,t)),n&&(o.text=n),void 0!==r&&(o.origin=r)}),be(i,"beforeChange",i,o),i.cm&&be(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 Ui(e,t,n){if(e.cm){if(!e.cm.curOp)return Br(e.cm,Ui)(e,t,n);if(e.cm.state.suppressEdits)return}if(!(we(e,"beforeChange")||e.cm&&we(e.cm,"beforeChange"))||(t=Ki(e,t,!0))){var r=wt&&!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!=F(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],s=a.find(0),l=0;l<i.length;++l){var c,u,d,f=i[l];nt(f.to,s.from)<0||0<nt(f.from,s.to)||(c=[l,1],u=nt(f.from,s.from),d=nt(f.to,s.to),(u<0||!a.inclusiveLeft&&!u)&&c.push({from:f.from,to:s.from}),(0<d||!a.inclusiveRight&&!d)&&c.push({from:s.to,to:f.to}),i.splice.apply(i,c),l+=c.length-3)}return i}(e,t.from,t.to);if(r)for(var i=r.length-1;0<=i;--i)Vi(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Vi(e,t)}}function Vi(e,n){var t,r;1==n.text.length&&""==n.text[0]&&0==nt(n.from,n.to)||(t=ui(e,n),wi(e,n,t,e.cm?e.cm.curOp.id:NaN),Xi(e,n,t,Lt(e,n)),r=[],gi(e,function(e,t){t||-1!=F(r,e.history)||(Zi(e.history,n),r.push(e.history)),Xi(e,n,null,Lt(e,n))}))}function $i(i,o,e){var t=i.cm&&i.cm.state.suppressEdits;if(!t||e){for(var a,n=i.history,r=i.sel,s="undo"==o?n.done:n.undone,l="undo"==o?n.undone:n.done,c=0;c<s.length&&(a=s[c],e?!a.ranges||a.equals(i.sel):a.ranges);c++);if(c!=s.length){for(n.lastOrigin=n.lastSelOrigin=null;;){if(!(a=s.pop()).ranges){if(t)return void s.push(a);break}if(Si(a,l),e&&!a.equals(i.sel))return void Ri(i,a,{clearRedo:!1});r=a}var u=[];Si(r,l),l.push({changes:u,generation:n.generation}),n.generation=a.generation||++n.maxGeneration;for(var d=we(i,"beforeChange")||i.cm&&we(i.cm,"beforeChange"),f=a.changes.length-1;0<=f;--f){var h=function(e){var n=a.changes[e];if(n.origin=o,d&&!Ki(i,n,!1))return s.length=0,{};u.push(ki(i,n));var t=e?ui(i,n):$(s);Xi(i,n,t,Mi(i,n)),!e&&i.cm&&i.cm.scrollIntoView({from:n.from,to:li(n)});var r=[];gi(i,function(e,t){t||-1!=F(r,e.history)||(Zi(e.history,n),r.push(e.history)),Xi(e,n,null,Mi(e,n))})}(f);if(h)return h.v}}}}function Gi(e,t){if(0!=t&&(e.first+=t,e.sel=new ii(G(e.sel.ranges,function(e){return new oi(tt(e.anchor.line+t,e.anchor.ch),tt(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){tr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)nr(e.cm,r,"gutter")}}function Xi(e,t,n,r){if(e.cm&&!e.cm.curOp)return Br(e.cm,Xi)(e,t,n,r);var i;t.to.line<e.first?Gi(e,t.text.length-1-(t.to.line-t.from.line)):t.from.line>e.lastLine()||(t.from.line<e.first&&(Gi(e,i=t.text.length-1-(e.first-t.from.line)),t={from:tt(e.first,0),to:tt(t.to.line+i,t.to.ch),text:[$(t.text)],origin:t.origin}),i=e.lastLine(),(t=t.to.line>i?{from:t.from,to:tt(i,$e(e,i).text.length),text:[t.text[0]],origin:t.origin}:t).removed=Ge(e,t.from,t.to),n=n||ui(e,t),e.cm?function(e,t,n){var r=e.doc,i=e.display,o=t.from,a=t.to,s=!1,l=o.line;e.options.lineWrapping||(l=Qe(Dt($e(r,o.line))),r.iter(l,a.line+1,function(e){if(e==i.maxLine)return s=!0}));-1<r.sel.contains(t.from,t.to)&&xe(e);mi(r,t,n,Qn(e)),e.options.lineWrapping||(r.iter(l,o.line+t.text.length,function(e){var t=Ht(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)}),s&&(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=$e(e,r).stateAfter;if(i&&(!(i instanceof ut)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}})(r,o.line),zr(e,400);l=t.text.length-(a.line-o.line)-1;t.full?tr(e):o.line!=a.line||1!=t.text.length||pi(e.doc,t)?tr(e,o.line,a.line+1,l):nr(e,o.line,"text");r=we(e,"changes"),l=we(e,"change");(l||r)&&(t={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin},l&&rn(e,"change",e,t),r&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(t));e.display.selForContextMenu=null}(e.cm,t,r):mi(e,t,r),Bi(e,n,q),e.cantEdit&&qi(e,tt(e.firstLine(),0))&&(e.cantEdit=!1))}function Yi(e,t,n,r,i){var o;nt(r=r||n,n)<0&&(n=(o=[r,n])[0],r=o[1]),"string"==typeof t&&(t=e.splitLines(t)),Ui(e,{from:n,to:r,text:t,origin:i})}function Qi(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Ji(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 s=0;s<o.ranges.length;s++)Qi(o.ranges[s].anchor,t,n,r),Qi(o.ranges[s].head,t,n,r)}else{for(var l=0;l<o.changes.length;++l){var c=o.changes[l];if(n<c.from.line)c.from=tt(c.from.line+r,c.from.ch),c.to=tt(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 Zi(e,t){var n=t.from.line,r=t.to.line,t=t.text.length-(r-n)-1;Ji(e.done,n,r,t),Ji(e.undone,n,r,t)}function eo(e,t,n,r){var i=t,o=t;return"number"==typeof t?o=$e(e,st(e,t)):i=Qe(t),null==i?null:(r(o,i)&&e.cm&&nr(e.cm,i,n),o)}function to(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 no(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}oi.prototype.from=function(){return at(this.anchor,this.head)},oi.prototype.to=function(){return ot(this.anchor,this.head)},oi.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},to.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,Tt(n),rn(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}},no.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n,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),s=i.height;if(i.removeInner(e,a),this.height-=s-i.height,o==a&&(this.children.splice(r--,1),i.parent=null),0==(t-=a))break;e=0}else e-=o}this.size-t<25&&(1<this.children.length||!(this.children[0]instanceof to))&&(this.collapse(n=[]),this.children=[new to(n)],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,s=a;s<i.lines.length;){var l=new to(i.lines.slice(s,s+=25));i.height-=l.height,this.children.splice(++r,0,l),l.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,n=new no(e.children.splice(e.children.length-5,5))}while(e.parent?(e.size-=n.size,e.height-=n.height,t=F(e.parent.children,e),e.parent.children.splice(t+1,0,n)):(((t=new no(e.children)).parent=e).children=[t,n],e=t),n.parent=e.parent,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 ro(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t}function io(e,t,n){qt(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&br(e,n)}ro.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Qe(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=hn(this);Ye(n,Math.max(0,n.height-o)),e&&(Rr(e,function(){io(e,n,-o),nr(e,r,"widget")}),rn(e,"lineWidgetCleared",e,this,r))}},ro.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=hn(this)-t;i&&(Wt(this.doc,r)||Ye(r,r.height+i),n&&Rr(n,function(){n.curOp.forceUpdate=!0,io(n,r,i),rn(n,"lineWidgetChanged",n,e,Qe(r))}))},Ce(ro);function oo(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ao}var ao=0;function so(r,i,o,e,t){if(e&&e.shared)return function(e,n,r,i,o){(i=R(i)).shared=!1;var a=[so(e,n,r,i,o)],s=a[0],l=i.widgetNode;return gi(e,function(e){l&&(i.widgetNode=l.cloneNode(!0)),a.push(so(e,lt(e,n),lt(e,r),i,o));for(var t=0;t<e.linked.length;++t)if(e.linked[t].isParent)return;s=$(a)}),new lo(a,s)}(r,i,o,e,t);if(r.cm&&!r.cm.curOp)return Br(r.cm,so)(r,i,o,e,t);var a=new oo(r,t),t=nt(i,o);if(e&&R(e,a,!1),0<t||0==t&&!1!==a.clearWhenEmpty)return a;if(a.replacedWith&&(a.collapsed=!0,a.widgetNode=L("span",[a.replacedWith],"CodeMirror-widget"),e.handleMouseEvents||a.widgetNode.setAttribute("cm-ignore-events","true"),e.insertLeft&&(a.widgetNode.insertLeft=!0)),a.collapsed){if(Bt(r,i.line,i,o,a)||i.line!=o.line&&Bt(r,o.line,i,o,a))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ct=!0}a.addToHistory&&wi(r,{from:i,to:o,origin:"markText"},r.sel,NaN);var s,l=i.line,c=r.cm;if(r.iter(l,o.line+1,function(e){var t,n;c&&a.collapsed&&!c.options.lineWrapping&&Dt(e)==c.display.maxLine&&(s=!0),a.collapsed&&l!=i.line&&Ye(e,0),t=e,n=new St(a,l==i.line?i.ch:null,l==o.line?o.ch:null),(e=(e=r.cm&&r.cm.curOp)&&window.WeakSet&&(e.markedSpans||(e.markedSpans=new WeakSet)))&&e.has(t.markedSpans)?t.markedSpans.push(n):(t.markedSpans=t.markedSpans?t.markedSpans.concat([n]):[n],e&&e.add(t.markedSpans)),n.marker.attachLine(t),++l}),a.collapsed&&r.iter(i.line,o.line+1,function(e){Wt(r,e)&&Ye(e,0)}),a.clearOnEnter&&ge(a,"beforeCursorEnter",function(){return a.clear()}),a.readOnly&&(wt=!0,(r.history.done.length||r.history.undone.length)&&r.clearHistory()),a.collapsed&&(a.id=++ao,a.atomic=!0),c){if(s&&(c.curOp.updateMaxLine=!0),a.collapsed)tr(c,i.line,o.line+1);else if(a.className||a.startStyle||a.endStyle||a.css||a.attributes||a.title)for(var n=i.line;n<=o.line;n++)nr(c,n,"text");a.atomic&&Fi(c.doc),rn(c,"markerAdded",c,a)}return a}oo.prototype.clear=function(){if(!this.explicitlyCleared){var e,t=this.doc.cm,n=t&&!t.curOp;n&&Ir(t),!we(this,"clear")||(e=this.find())&&rn(this,"clear",e.from,e.to);for(var r=null,i=null,o=0;o<this.lines.length;++o){var a=this.lines[o],s=_t(a.markedSpans,this);t&&!this.collapsed?nr(t,Qe(a),"text"):t&&(null!=s.to&&(i=Qe(a)),null!=s.from&&(r=Qe(a))),a.markedSpans=function(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n=n||[]).push(e[r]);return n}(a.markedSpans,s),null==s.from&&this.collapsed&&!Wt(this.doc,a)&&t&&Ye(a,$n(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var l=0;l<this.lines.length;++l){var c=Dt(this.lines[l]),u=Ht(c);u>t.display.maxLineLength&&(t.display.maxLine=c,t.display.maxLineLength=u,t.display.maxLineChanged=!0)}null!=r&&t&&this.collapsed&&tr(t,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&Fi(t.doc)),t&&rn(t,"markerCleared",t,this,r,i),n&&Pr(t),this.parent&&this.parent.clear()}},oo.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=_t(o.markedSpans,this);if(null!=a.from&&(n=tt(t?o:Qe(o),a.from),-1==e))return n;if(null!=a.to&&(r=tt(t?o:Qe(o),a.to),1==e))return r}return n&&{from:n,to:r}},oo.prototype.changed=function(){var n=this,r=this.find(-1,!0),i=this,o=this.doc.cm;r&&o&&Rr(o,function(){var e=r.line,t=Qe(r.line),t=Cn(o,t);t&&(An(t),o.curOp.selectionChanged=o.curOp.forceUpdate=!0),o.curOp.updateMaxLine=!0,Wt(i.doc,e)||null==i.height||(t=i.height,i.height=null,(t=hn(i)-t)&&Ye(e,e.height+t)),rn(o,"markerChanged",o,n)})},oo.prototype.attachLine=function(e){var t;!this.lines.length&&this.doc.cm&&((t=this.doc.cm.curOp).maybeHiddenMarkers&&-1!=F(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)),this.lines.push(e)},oo.prototype.detachLine=function(e){this.lines.splice(F(this.lines,e),1),!this.lines.length&&this.doc.cm&&((e=this.doc.cm.curOp).maybeHiddenMarkers||(e.maybeHiddenMarkers=[])).push(this)},Ce(oo);var lo=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};function co(e){return e.findMarks(tt(e.first,0),e.clipPos(tt(e.lastLine())),function(e){return e.parent})}function uo(o){for(var e=0;e<o.length;e++)!function(e){var t=o[e],n=[t.primary.doc];gi(t.primary.doc,function(e){return n.push(e)});for(var r=0;r<t.markers.length;r++){var i=t.markers[r];-1==F(n,i.doc)&&(i.parent=null,t.markers.splice(r--,1))}}(e)}lo.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();rn(this,"clear")}},lo.prototype.find=function(e,t){return this.primary.find(e,t)},Ce(lo);function fo(e,t,n,r,i){if(!(this instanceof fo))return new fo(e,t,n,r,i);null==n&&(n=0),no.call(this,[new to([new Kt("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,n=tt(this.modeFrontier=this.highlightFrontier=n,0),this.sel=si(n),this.history=new bi(null),this.id=++ho,this.modeOption=t,this.lineSep=r,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),mi(this,{from:n,to:n,text:e}),Ri(this,si(n),q)}var ho=0;(fo.prototype=Y(no.prototype,{constructor:fo,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=Xe(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:Fr(function(e){var t=tt(this.first,0),n=this.first+this.size-1;Ui(this,{from:t,to:tt(n,$e(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&xr(this.cm,0,0),Ri(this,si(t),q)}),replaceRange:function(e,t,n,r){Yi(this,e,t=lt(this,t),n=n?lt(this,n):t,r)},getRange:function(e,t,n){t=Ge(this,lt(this,e),lt(this,t));return!1===n?t:""===n?t.join(""):t.join(n||this.lineSeparator())},getLine:function(e){e=this.getLineHandle(e);return e&&e.text},getLineHandle:function(e){if(Ze(this,e))return $e(this,e)},getLineNumber:Qe,getLineHandleVisualStart:function(e){return Dt(e="number"==typeof e?$e(this,e):e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return lt(this,e)},getCursor:function(e){var t=this.sel.primary(),t=null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from();return t},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Fr(function(e,t,n){Ii(this,lt(this,"number"==typeof e?tt(e,t||0):e),null,n)}),setSelection:Fr(function(e,t,n){Ii(this,lt(this,e),lt(this,t||e),n)}),extendSelection:Fr(function(e,t,n){Oi(this,lt(this,e),t&&lt(this,t),n)}),extendSelections:Fr(function(e,t){Ni(this,ct(this,e),t)}),extendSelectionsBy:Fr(function(e,t){Ni(this,ct(this,G(this.sel.ranges,e)),t)}),setSelections:Fr(function(e,t,n){if(e.length){for(var r=[],i=0;i<e.length;i++)r[i]=new oi(lt(this,e[i].anchor),lt(this,e[i].head||e[i].anchor));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Ri(this,ai(this.cm,r,t),n)}}),addSelection:Fr(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new oi(lt(this,e),lt(this,t||e))),Ri(this,ai(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n=0;n<t.length;n++)var r=Ge(this,t[n].from(),t[n].to()),i=i?i.concat(r):r;return!1===e?i:i.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=Ge(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:Fr(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 t=t&&"end"!=t&&function(e,t,n){for(var r=[],i=c=tt(e.first,0),o=0;o<t.length;o++){var a=t[o],s=di(a.from,c,i),l=di(li(a),c,i),c=a.to,i=l;"around"==n?(a=nt((a=e.sel.ranges[o]).head,a.anchor)<0,r[o]=new oi(a?l:s,a?s:l)):r[o]=new oi(s,s)}return new ii(r,e.sel.primIndex)}(this,r,t),s=r.length-1;0<=s;s--)Ui(this,r[s]);t?Pi(this,t):this.cm&&kr(this.cm)}),undo:Fr(function(){$i(this,"undo")}),redo:Fr(function(){$i(this,"redo")}),undoSelection:Fr(function(){$i(this,"undo",!0)}),redoSelection:Fr(function(){$i(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 bi(this.history),gi(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:Ti(this.history.done),undone:Ti(this.history.undone)}},setHistory:function(e){var t=this.history=new bi(this.history);t.done=Ti(e.done.slice(0),null,!0),t.undone=Ti(e.undone.slice(0),null,!0)},setGutterMarker:Fr(function(e,n,r){return eo(this,e,"gutter",function(e){var t=e.gutterMarkers||(e.gutterMarkers={});return!(t[n]=r)&&ee(t)&&(e.gutterMarkers=null),1})}),clearGutter:Fr(function(t){var n=this;this.iter(function(e){e.gutterMarkers&&e.gutterMarkers[t]&&eo(n,e,"gutter",function(){return e.gutterMarkers[t]=null,ee(e.gutterMarkers)&&(e.gutterMarkers=null),1})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!Ze(this,e))return null;if(!(e=$e(this,t=e)))return null}else if(null==(t=Qe(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:Fr(function(e,n,r){return eo(this,e,"gutter"==n?"gutter":"class",function(e){var t="text"==n?"textClass":"background"==n?"bgClass":"gutter"==n?"gutterClass":"wrapClass";if(e[t]){if(w(r).test(e[t]))return;e[t]+=" "+r}else e[t]=r;return 1})}),removeLineClass:Fr(function(e,o,a){return eo(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){if(null==a)e[t]=null;else{var r=n.match(w(a));if(!r)return;var i=r.index+r[0].length;e[t]=n.slice(0,r.index)+(r.index&&i!=n.length?" ":"")+n.slice(i)||null}return 1}})}),addLineWidget:Fr(function(e,t,n){return e=e,i=new ro(r=this,t,n),(o=r.cm)&&i.noHScroll&&(o.display.alignWidgets=!0),eo(r,e,"widget",function(e){var t=e.widgets||(e.widgets=[]);return null==i.insertAt?t.push(i):t.splice(Math.min(t.length,Math.max(0,i.insertAt)),0,i),i.line=e,o&&!Wt(r,e)&&(t=qt(e)<r.scrollTop,Ye(e,e.height+hn(i)),t&&br(o,i.height),o.curOp.forceUpdate=!0),1}),o&&rn(o,"lineWidgetAdded",o,i,"number"==typeof e?e:Qe(e)),i;var r,i,o}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return so(this,lt(this,e),lt(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){t={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return so(this,e=lt(this,e),e,t,"bookmark")},findMarksAt:function(e){var t=[],n=$e(this,(e=lt(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=lt(this,i),o=lt(this,o);var s=[],l=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&&l==i.line&&i.ch>=r.to||null==r.from&&l!=i.line||null!=r.from&&l==o.line&&r.from>=o.ch||a&&!a(r.marker)||s.push(r.marker.parent||r.marker)}++l}),s},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(t){var n,r=this.first,i=this.lineSeparator().length;return this.iter(function(e){e=e.text.length+i;if(t<e)return n=t,!0;t-=e,++r}),lt(this,tt(r,n))},indexFromPos:function(e){var t=(e=lt(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 fo(Xe(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){var t=this.first,n=this.first+this.size;null!=(e=e||{}).from&&e.from>t&&(t=e.from),null!=e.to&&e.to<n&&(n=e.to);t=new fo(Xe(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(t.history=this.history),(this.linked||(this.linked=[])).push({doc:t,sharedHist:e.sharedHist}),t.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),i=e.clipPos(i.to);nt(o,i)&&(i=so(e,o,i,r.primary,r.primary.type),r.markers.push(i),i.parent=r)}}(t,co(this)),t},unlinkDoc:function(e){if(e instanceof ua&&(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),uo(co(this));break}var n;e.history==this.history&&(n=[e.id],gi(e,function(e){return n.push(e.id)},!0),e.history=new bi(null),e.history.done=Ti(this.history.done,n),e.history.undone=Ti(this.history.undone,n))},iterLinkedDocs:function(e){gi(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Ie(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:Fr(function(e){var t;(e="rtl"!=e?"ltr":e)!=this.direction&&(this.direction=e,this.iter(function(e){return e.order=null}),this.cm&&Rr(t=this.cm,function(){yi(t),tr(t)}))})})).eachLine=fo.prototype.iter;var po=0;function mo(e){var r=this;if(go(r),!ke(r,e)&&!pn(r.display,e)){Se(e),k&&(po=+new Date);var t=Zn(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,s=function(){++a==i&&Br(r,function(){var e={from:t=lt(r.doc,t),to:t,text:r.doc.splitLines(o.filter(function(e){return null!=e}).join(r.doc.lineSeparator())),origin:"paste"};Ui(r.doc,e),Pi(r.doc,si(lt(r.doc,t),lt(r.doc,li(e))))})()},l=0;l<n.length;l++)!function(e,t){var n;r.options.allowDropFileTypes&&-1==F(r.options.allowDropFileTypes,e.type)?s():((n=new FileReader).onerror=function(){return s()},n.onload=function(){var e=n.result;/[\x00-\x08\x0e-\x1f]{2}/.test(e)||(o[t]=e),s()},n.readAsText(e))}(n[l],l);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 c,u=e.dataTransfer.getData("Text");if(u){if(r.state.draggingText&&!r.state.draggingText.copy&&(c=r.listSelections()),Bi(r.doc,si(t,t)),c)for(var d=0;d<c.length;++d)Yi(r.doc,"",c[d].anchor,c[d].head,"drag");r.replaceSelection(u,"around","paste"),r.display.input.focus()}}catch(e){}}}}function go(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function vo(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 yo=!1;function bo(){var e;yo||(ge(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,vo(ko)},100))}),ge(window,"blur",function(){return vo(pr)}),yo=!0)}function ko(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var xo={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:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},wo=0;wo<10;wo++)xo[wo+48]=xo[wo+96]=String(wo);for(var Co=65;Co<=90;Co++)xo[Co]=String.fromCharCode(Co);for(var So=1;So<=12;So++)xo[So+111]=xo[So+63235]="F"+So;var _o={};function Lo(e){var t,n,r,i,o=e.split(/-(?!$)/);e=o[o.length-1];for(var a=0;a<o.length-1;a++){var s=o[a];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else{if(!/^s(hift)?$/i.test(s))throw new Error("Unrecognized modifier name: "+s);r=!0}}return t&&(e="Alt-"+e),n&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),e=r?"Shift-"+e:e}function Mo(e){var t,n,r={};for(t in e)if(e.hasOwnProperty(t)){var i=e[t];if(!/^(name|fallthrough|(de|at)tach)$/.test(t))if("..."!=i){for(var o=G(t.split(" "),Lo),a=0;a<o.length;a++){var s=void 0,l=void 0,s=a==o.length-1?(l=o.join(" "),i):(l=o.slice(0,a+1).join(" "),"..."),c=r[l];if(c){if(c!=s)throw new Error("Inconsistent bindings for "+l)}else r[l]=s}delete e[t]}else delete e[t]}for(n in r)e[n]=r[n];return e}function To(e,t,n,r){var i=(t=Eo(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 To(e,t.fallthrough,n,r);for(var o=0;o<t.fallthrough.length;o++){var a=To(e,t.fallthrough[o],n,r);if(a)return a}}}function Ao(e){e="string"==typeof e?e:xo[e.keyCode];return"Ctrl"==e||"Alt"==e||"Shift"==e||"Mod"==e}function Oo(e,t,n){var r=e;return t.altKey&&"Alt"!=r&&(e="Alt-"+e),(b?t.metaKey:t.ctrlKey)&&"Ctrl"!=r&&(e="Ctrl-"+e),(b?t.ctrlKey:t.metaKey)&&"Mod"!=r&&(e="Cmd-"+e),e=!n&&t.shiftKey&&"Shift"!=r?"Shift-"+e:e}function No(e,t){if(p&&34==e.keyCode&&e.char)return!1;var n=xo[e.keyCode];return null!=n&&!e.altGraphKey&&Oo(n=3==e.keyCode&&e.code?e.code:n,e,t)}function Eo(e){return"string"==typeof e?_o[e]:e}function Io(t,e){for(var n=t.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var o=e(n[i]);r.length&&nt(o.from,$(r).to)<=0;){var a=r.pop();if(nt(a.from,o.from)<0){o.from=a.from;break}}r.push(o)}Rr(t,function(){for(var e=r.length-1;0<=e;e--)Yi(t.doc,"",r[e].from,r[e].to,"+delete");kr(t)})}function Po(e,t,n){n=re(e.text,t+n,n);return n<0||n>e.text.length?null:n}function Ro(e,t,n){e=Po(e,t.ch,n);return null==e?null:new tt(t.line,e,n<0?"after":"before")}function Bo(e,t,n,r,i){if(e){"rtl"==t.doc.direction&&(i=-i);var o=pe(n,t.doc.direction);if(o){var a,s,l,e=i<0?$(o):o[0],o=i<0==(1==e.level)?"after":"before";return 0<e.level||"rtl"==t.doc.direction?(a=Sn(t,n),s=i<0?n.text.length-1:0,l=_n(t,a,s).top,s=ie(function(e){return _n(t,a,e).top==l},i<0==(1==e.level)?e.from:e.to-1,s),"before"==o&&(s=Po(n,s,1))):s=i<0?e.to:e.from,new tt(r,s,o)}}return new tt(r,i<0?n.text.length:0,i<0?"before":"after")}function Do(t,n,s,e){var l=pe(n,t.doc.direction);if(!l)return Ro(n,s,e);s.ch>=n.text.length?(s.ch=n.text.length,s.sticky="before"):s.ch<=0&&(s.ch=0,s.sticky="after");var r=ae(l,s.ch,s.sticky),i=l[r];if("ltr"==t.doc.direction&&i.level%2==0&&(0<e?i.to>s.ch:i.from<s.ch))return Ro(n,s,e);function c(e,t){return Po(n,e instanceof tt?e.ch:e,t)}function o(e){return t.options.lineWrapping?(a=a||Sn(t,n),jn(t,n,a,e)):{begin:0,end:n.text.length}}var a,u=o("before"==s.sticky?c(s,-1):s.ch);if("rtl"==t.doc.direction||1==i.level){var d=1==i.level==e<0,f=c(s,d?1:-1);if(null!=f&&(d?f<=i.to&&f<=u.end:f>=i.from&&f>=u.begin))return new tt(s.line,f,d?"before":"after")}d=function(e,t,n){for(var r=function(e,t){return t?new tt(s.line,c(e,1),"before"):new tt(s.line,e,"after")};0<=e&&e<l.length;e+=t){var i=l[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)}},r=d(r+e,e,u);if(r)return r;u=0<e?u.end:c(u.begin,-1);return null==u||0<e&&u==n.text.length||!(r=d(0<e?0:l.length-1,e,o(u)))?null:r}_o.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"},_o.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"},_o.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},_o.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"]},_o.default=m?_o.macDefault:_o.pcDefault;var Fo={selectAll:ji,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),q)},killLine:function(n){return Io(n,function(e){if(e.empty()){var t=$e(n.doc,e.head.line).text.length;return e.head.ch==t&&e.head.line<n.lastLine()?{from:e.head,to:tt(e.head.line+1,0)}:{from:e.head,to:tt(e.head.line,t)}}return{from:e.from(),to:e.to()}})},deleteLine:function(t){return Io(t,function(e){return{from:tt(e.from().line,0),to:lt(t.doc,tt(e.to().line+1,0))}})},delLineLeft:function(e){return Io(e,function(e){return{from:tt(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(n){return Io(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(n){return Io(n,function(e){var t=n.charCoords(e.head,"div").top+5,t=n.coordsChar({left:n.display.lineDiv.offsetWidth+100,top:t},"div");return{from:e.from(),to:t}})},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(tt(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(tt(e.lastLine()))},goLineStart:function(t){return t.extendSelectionsBy(function(e){return zo(t,e.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(t){return t.extendSelectionsBy(function(e){return Wo(t,e.head)},{origin:"+move",bias:1})},goLineEnd:function(t){return t.extendSelectionsBy(function(e){return function(e,t){var n=$e(e.doc,t),r=function(e){for(var t;t=Rt(e);)e=t.find(1,!0).line;return e}(n);r!=n&&(t=Qe(r));return Bo(!0,e,n,t,-1)}(t,e.head.line)},{origin:"+move",bias:-1})},goLineRight:function(t){return t.extendSelectionsBy(function(e){e=t.cursorCoords(e.head,"div").top+5;return t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:e},"div")},j)},goLineLeft:function(t){return t.extendSelectionsBy(function(e){e=t.cursorCoords(e.head,"div").top+5;return t.coordsChar({left:0,top:e},"div")},j)},goLineLeftSmart:function(n){return n.extendSelectionsBy(function(e){var t=n.cursorCoords(e.head,"div").top+5,t=n.coordsChar({left:0,top:t},"div");return t.ch<n.getLine(t.line).search(/\S/)?Wo(n,e.head):t},j)},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,"codepoint")},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(),o=B(e.getLine(o.line),o.ch,r);t.push(V(r-o%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(a){return Rr(a,function(){for(var e,t,n,r=a.listSelections(),i=[],o=0;o<r.length;o++)r[o].empty()&&(e=r[o].head,(t=$e(a.doc,e.line).text)&&(0<(e=e.ch==t.length?new tt(e.line,e.ch-1):e).ch?(e=new tt(e.line,e.ch+1),a.replaceRange(t.charAt(e.ch-1)+t.charAt(e.ch-2),tt(e.line,e.ch-2),e,"+transpose")):e.line>a.doc.first&&((n=$e(a.doc,e.line-1).text)&&(e=new tt(e.line,1),a.replaceRange(t.charAt(0)+a.doc.lineSeparator()+n.charAt(n.length-1),tt(e.line-1,n.length-1),e,"+transpose")))),i.push(new oi(e,e)));a.setSelections(i)})},newlineAndIndent:function(r){return Rr(r,function(){for(var e=(t=r.listSelections()).length-1;0<=e;e--)r.replaceRange(r.doc.lineSeparator(),t[e].anchor,t[e].head,"+input");for(var t=r.listSelections(),n=0;n<t.length;n++)r.indentLine(t[n].from().line,null,!0);kr(r)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function zo(e,t){var n=$e(e.doc,t),r=Dt(n);return Bo(!0,e,r,t=r!=n?Qe(r):t,1)}function Wo(e,t){var n=zo(e,t.line),r=$e(e.doc,n.line),e=pe(r,e.doc.direction);if(e&&0!=e[0].level)return n;r=Math.max(n.ch,r.text.search(/\S/)),t=t.line==n.line&&t.ch<=r&&t.ch;return tt(n.line,t?0:r,n.sticky)}function qo(e,t,n){if("string"==typeof t&&!(t=Fo[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)!=W}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}var Ho=new D;function jo(e,t,n,r){var i=e.state.keySeq;if(i){if(Ao(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ho.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),Ko(e,i+" "+t,n,r))return!0}return Ko(e,t,n,r)}function Ko(e,t,n,r){r=function(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=To(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&To(t,e.options.extraKeys,n,e)||To(t,e.options.keyMap,n,e)}(e,t,r);return"multi"==r&&(e.state.keySeq=t),"handled"==r&&rn(e,"keyHandled",e,t,n),"handled"!=r&&"multi"!=r||(Se(n),ur(e)),!!r}function Uo(t,e){var n=No(e,!0);return!!n&&(e.shiftKey&&!t.state.keySeq?jo(t,"Shift-"+n,e,function(e){return qo(t,e,!0)})||jo(t,n,e,function(e){if("string"==typeof e?/^go[A-Z]/.test(e):e.motion)return qo(t,e)}):jo(t,n,e,function(e){return qo(t,e)}))}var Vo=null;function $o(e){var t,n,r,i=this;function o(e){18!=e.keyCode&&e.altKey||(C(r,"CodeMirror-crosshair"),ye(document,"keyup",o),ye(document,"mouseover",o))}e.target&&e.target!=i.display.input.getField()||(i.curOp.focus=A(),ke(i,e)||(k&&v<11&&27==e.keyCode&&(e.returnValue=!1),t=e.keyCode,i.display.shift=16==t||e.shiftKey,n=Uo(i,e),p&&(Vo=n?t:null,!n&&88==t&&!Re&&(m?e.metaKey:e.ctrlKey)&&i.replaceSelection("",null,"cut")),f&&!m&&!n&&46==t&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),18!=t||/\bCodeMirror-crosshair\b/.test(i.display.lineDiv.className)||(O(r=i.display.lineDiv,"CodeMirror-crosshair"),ge(document,"keyup",o),ge(document,"mouseover",o))))}function Go(e){16==e.keyCode&&(this.doc.sel.shift=!1),ke(this,e)}function Xo(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField()||pn(t.display,e)||ke(t,e)||e.ctrlKey&&!e.altKey||m&&e.metaKey)){var n,r=e.keyCode,i=e.charCode;if(p&&r==Vo)return Vo=null,void Se(e);p&&(!e.which||e.which<10)&&Uo(t,e)||"\b"!=(i=String.fromCharCode(null==i?r:i))&&(jo(n=t,"'"+i+"'",e,function(e){return qo(n,e,!0)})||t.display.input.onKeyPress(e))}}function Yo(e,t,n){this.time=e,this.pos=t,this.button=n}var Qo,Jo;function Zo(e){var t,n,r,i,o,a=this,s=a.display;ke(a,e)||s.activeTouch&&s.input.supportsTouch()||(s.input.ensurePolled(),s.shift=e.shiftKey,pn(s,e)?h||(s.scroller.draggable=!1,setTimeout(function(){return s.scroller.draggable=!0},100)):na(a,e)||(t=Zn(a,e),n=Ae(e),i=t?(r=t,i=n,o=+new Date,Jo&&Jo.compare(o,r,i)?(Qo=Jo=null,"triple"):Qo&&Qo.compare(o,r,i)?(Jo=new Yo(o,r,i),Qo=null,"double"):(Qo=new Yo(o,r,i),Jo=null,"single")):"single",window.focus(),1==n&&a.state.selectingText&&a.state.selectingText(e),t&&function(n,e,r,t,i){var o="Click";"double"==t?o="Double"+o:"triple"==t&&(o="Triple"+o);return jo(n,Oo(o=(1==e?"Left":2==e?"Middle":"Right")+o,i),i,function(e){if(!(e="string"==typeof e?Fo[e]:e))return!1;var t=!1;try{n.isReadOnly()&&(n.state.suppressEdits=!0),t=e(n,r)!=W}finally{n.state.suppressEdits=!1}return t})}(a,n,t,i,e)||(1==n?t?function(e,t,n,r){k?setTimeout(P(dr,e),0):e.curOp.focus=A();var i,o=function(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};null==i.unit&&(r=g?n.shiftKey&&n.metaKey:n.altKey,i.unit=r?"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=m?n.metaKey:n.ctrlKey);null==i.moveOnDrag&&(i.moveOnDrag=!(m?n.altKey:n.ctrlKey));return i}(e,n,r),a=e.doc.sel;(e.options.dragDrop&&Ee&&!e.isReadOnly()&&"single"==n&&-1<(i=a.contains(t))&&(nt((i=a.ranges[i]).from(),t)<0||0<t.xRel)&&(0<nt(i.to(),t)||t.xRel<0)?function(t,n,r,i){var o=t.display,a=!1,s=Br(t,function(e){h&&(o.scroller.draggable=!1),t.state.draggingText=!1,t.state.delayingBlurEvent&&(t.hasFocus()?t.state.delayingBlurEvent=!1:fr(t)),ye(o.wrapper.ownerDocument,"mouseup",s),ye(o.wrapper.ownerDocument,"mousemove",l),ye(o.scroller,"dragstart",c),ye(o.scroller,"drop",s),a||(Se(e),i.addNew||Oi(t.doc,r,null,null,i.extend),h&&!u||k&&9==v?setTimeout(function(){o.wrapper.ownerDocument.body.focus({preventScroll:!0}),o.input.focus()},20):o.input.focus())}),l=function(e){a=a||10<=Math.abs(n.clientX-e.clientX)+Math.abs(n.clientY-e.clientY)},c=function(){return a=!0};h&&(o.scroller.draggable=!0);(t.state.draggingText=s).copy=!i.moveOnDrag,ge(o.wrapper.ownerDocument,"mouseup",s),ge(o.wrapper.ownerDocument,"mousemove",l),ge(o.scroller,"dragstart",c),ge(o.scroller,"drop",s),t.state.delayingBlurEvent=!0,setTimeout(function(){return o.input.focus()},20),o.scroller.dragDrop&&o.scroller.dragDrop()}:function(f,e,h,p){k&&fr(f);var a=f.display,m=f.doc;Se(e);var g,v,y=m.sel,t=y.ranges;p.addNew&&!p.extend?(v=m.sel.contains(h),g=-1<v?t[v]:new oi(h,h)):(g=m.sel.primary(),v=m.sel.primIndex);"rectangle"==p.unit?(p.addNew||(g=new oi(h,h)),h=Zn(f,e,!0,!0),v=-1):(e=ea(f,h,p.unit),g=p.extend?Ai(g,e.anchor,e.head,p.extend):e);p.addNew?-1==v?(v=t.length,Ri(m,ai(f,t.concat([g]),v),{scroll:!1,origin:"*mouse"})):1<t.length&&t[v].empty()&&"char"==p.unit&&!p.extend?(Ri(m,ai(f,t.slice(0,v).concat(t.slice(v+1)),0),{scroll:!1,origin:"*mouse"}),y=m.sel):Ei(m,v,g,H):(Ri(m,new ii([g],v=0),H),y=m.sel);var b=h;function s(e){if(0!=nt(b,e))if(b=e,"rectangle"==p.unit){for(var t=[],n=f.options.tabSize,r=B($e(m,h.line).text,h.ch,n),i=B($e(m,e.line).text,e.ch,n),o=Math.min(r,i),a=Math.max(r,i),s=Math.min(h.line,e.line),l=Math.min(f.lastLine(),Math.max(h.line,e.line));s<=l;s++){var c=$e(m,s).text,u=K(c,o,n);o==a?t.push(new oi(tt(s,u),tt(s,u))):c.length>u&&t.push(new oi(tt(s,u),tt(s,K(c,a,n))))}t.length||t.push(new oi(h,h)),Ri(m,ai(f,y.ranges.slice(0,v).concat(t),v),{origin:"*mouse",scroll:!1}),f.scrollIntoView(e)}else{var d,r=g,i=ea(f,e,p.unit),e=r.anchor,e=0<nt(i.anchor,e)?(d=i.head,at(r.from(),i.anchor)):(d=i.anchor,ot(r.to(),i.head)),i=y.ranges.slice(0);i[v]=function(e,t){var n=t.anchor,r=t.head,i=$e(e.doc,n.line);if(0==nt(n,r)&&n.sticky==r.sticky)return t;var o=pe(i);if(!o)return t;var a=ae(o,n.ch,n.sticky),s=o[a];if(s.from!=n.ch&&s.to!=n.ch)return t;i=a+(s.from==n.ch==(1!=s.level)?0:1);if(0==i||i==o.length)return t;l=r.line!=n.line?0<(r.line-n.line)*("ltr"==e.doc.direction?1:-1):(e=ae(o,r.ch,r.sticky),l=e-a||(r.ch-n.ch)*(1==s.level?-1:1),e==i-1||e==i?l<0:0<l);var i=o[i+(l?-1:0)],l=l==(1==i.level),i=l?i.from:i.to,l=l?"after":"before";return n.ch==i&&n.sticky==l?t:new oi(new tt(n.line,i,l),r)}(f,new oi(lt(m,e),d)),Ri(m,ai(f,i,v),H)}}var l=a.wrapper.getBoundingClientRect(),c=0;function n(e){f.state.selectingText=!1,c=1/0,e&&(Se(e),a.input.focus()),ye(a.wrapper.ownerDocument,"mousemove",r),ye(a.wrapper.ownerDocument,"mouseup",i),m.history.lastSelOrigin=null}var r=Br(f,function(e){(0!==e.buttons&&Ae(e)?function e(t){var n,r,i=++c,o=Zn(f,t,!0,"rectangle"==p.unit);o&&(0!=nt(o,b)?(f.curOp.focus=A(),s(o),n=vr(a,m),(o.line>=n.to||o.line<n.from)&&setTimeout(Br(f,function(){c==i&&e(t)}),150)):(r=t.clientY<l.top?-20:t.clientY>l.bottom?20:0)&&setTimeout(Br(f,function(){c==i&&(a.scroller.scrollTop+=r,e(t))}),50))}:n)(e)}),i=Br(f,n);f.state.selectingText=i,ge(a.wrapper.ownerDocument,"mousemove",r),ge(a.wrapper.ownerDocument,"mouseup",i)})(e,r,t,o)}(a,t,i,e):Te(e)==s.scroller&&Se(e):2==n?(t&&Oi(a.doc,t),setTimeout(function(){return s.input.focus()},20)):3==n&&(x?a.display.input.onContextMenu(e):fr(a)))))}function ea(e,t,n){if("char"==n)return new oi(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new oi(tt(t.line,0),lt(e.doc,tt(t.line+1,0)));t=n(e,t);return new oi(t.from,t.to)}function ta(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(e){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Se(t);var a=e.display,r=a.lineDiv.getBoundingClientRect();if(o>r.bottom||!we(e,n))return Le(t);o-=r.top-a.viewOffset;for(var s=0;s<e.display.gutterSpecs.length;++s){var l=a.gutters.childNodes[s];if(l&&l.getBoundingClientRect().right>=i)return be(e,n,e,Je(e.doc,o),e.display.gutterSpecs[s].className,t),Le(t)}}function na(e,t){return ta(e,t,"gutterClick",!0)}function ra(e,t){var n,r;pn(e.display,t)||(r=t,we(n=e,"gutterContextMenu")&&ta(n,r,"gutterContextMenu",!1))||ke(e,t,"contextmenu")||x||e.display.input.onContextMenu(t)}function ia(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Nn(e)}Yo.prototype.compare=function(e,t,n){return this.time+400>e&&0==nt(t,this.pos)&&n==this.button};var oa={toString:function(){return"CodeMirror.Init"}},aa={},sa={};function la(e,t,n){!t!=!(n&&n!=oa)&&(n=e.display.dragFunctions,(t=t?ge:ye)(e.display.scroller,"dragstart",n.start),t(e.display.scroller,"dragenter",n.enter),t(e.display.scroller,"dragover",n.over),t(e.display.scroller,"dragleave",n.leave),t(e.display.scroller,"drop",n.drop))}function ca(e){e.options.lineWrapping?(O(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(C(e.display.wrapper,"CodeMirror-wrap"),jt(e)),Jn(e),tr(e),Nn(e),setTimeout(function(){return Tr(e)},100)}function ua(e,t){var n=this;if(!(this instanceof ua))return new ua(e,t);this.options=t=t?R(t):{},R(aa,t,!1);var r=t.value;"string"==typeof r?r=new fo(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i,o=new ua.inputStyles[t.inputStyle](this),o=this.display=new Jr(e,r,o,t);for(i in ia(o.wrapper.CodeMirror=this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Nr(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 D,keySeq:null,specialChars:null},t.autofocus&&!d&&o.input.focus(),k&&v<11&&setTimeout(function(){return n.display.input.reset(!0)},20),function(r){var i=r.display;ge(i.scroller,"mousedown",Br(r,Zo)),ge(i.scroller,"dblclick",k&&v<11?Br(r,function(e){var t;ke(r,e)||(!(t=Zn(r,e))||na(r,e)||pn(r.display,e)||(Se(e),t=r.findWordAt(t),Oi(r.doc,t.anchor,t.head)))}):function(e){return ke(r,e)||Se(e)});ge(i.scroller,"contextmenu",function(e){return ra(r,e)}),ge(i.input.getField(),"contextmenu",function(e){i.scroller.contains(e.target)||ra(r,e)});var n,o={end:0};function a(){i.activeTouch&&(n=setTimeout(function(){return i.activeTouch=null},1e3),(o=i.activeTouch).end=+new Date)}function s(e,t){if(null==t.left)return 1;var n=t.left-e.left,e=t.top-e.top;return 400<n*n+e*e}ge(i.scroller,"touchstart",function(e){var t;ke(r,e)||function(e){if(1==e.touches.length){e=e.touches[0];return e.radiusX<=1&&e.radiusY<=1}}(e)||na(r,e)||(i.input.ensurePolled(),clearTimeout(n),t=+new Date,i.activeTouch={start:t,moved:!1,prev:t-o.end<=300?o:null},1==e.touches.length&&(i.activeTouch.left=e.touches[0].pageX,i.activeTouch.top=e.touches[0].pageY))}),ge(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),ge(i.scroller,"touchend",function(e){var t,n=i.activeTouch;n&&!pn(i,e)&&null!=n.left&&!n.moved&&new Date-n.start<300&&(t=r.coordsChar(i.activeTouch,"page"),t=!n.prev||s(n,n.prev)?new oi(t,t):!n.prev.prev||s(n,n.prev.prev)?r.findWordAt(t):new oi(tt(t.line,0),lt(r.doc,tt(t.line+1,0))),r.setSelection(t.anchor,t.head),r.focus(),Se(e)),a()}),ge(i.scroller,"touchcancel",a),ge(i.scroller,"scroll",function(){i.scroller.clientHeight&&(Sr(r,i.scroller.scrollTop),Lr(r,i.scroller.scrollLeft,!0),be(r,"scroll",r))}),ge(i.scroller,"mousewheel",function(e){return ri(r,e)}),ge(i.scroller,"DOMMouseScroll",function(e){return ri(r,e)}),ge(i.wrapper,"scroll",function(){return i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(e){ke(r,e)||Me(e)},over:function(e){var t,n;ke(r,e)||((n=Zn(t=r,n=e))&&(lr(t,n,n=document.createDocumentFragment()),t.display.dragCursor||(t.display.dragCursor=M("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),t.display.lineSpace.insertBefore(t.display.dragCursor,t.display.cursorDiv)),_(t.display.dragCursor,n)),Me(e))},start:function(e){var t,n;t=r,n=e,k&&(!t.state.draggingText||+new Date-po<100)?Me(n):ke(t,n)||pn(t.display,n)||(n.dataTransfer.setData("Text",t.getSelection()),n.dataTransfer.effectAllowed="copyMove",n.dataTransfer.setDragImage&&!u&&((e=M("img",null,null,"position: fixed; left: 0; top: 0;")).src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",p&&(e.width=e.height=1,t.display.wrapper.appendChild(e),e._top=e.offsetTop),n.dataTransfer.setDragImage(e,0,0),p&&e.parentNode.removeChild(e)))},drop:Br(r,mo),leave:function(e){ke(r,e)||go(r)}};var e=i.input.getField();ge(e,"keyup",function(e){return Go.call(r,e)}),ge(e,"keydown",Br(r,$o)),ge(e,"keypress",Br(r,Xo)),ge(e,"focus",function(e){return hr(r,e)}),ge(e,"blur",function(e){return pr(r,e)})}(this),bo(),Ir(this),this.curOp.forceUpdate=!0,vi(this,r),t.autofocus&&!d||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&hr(n)},20):pr(this),sa)sa.hasOwnProperty(i)&&sa[i](this,t[i],oa);Gr(this),t.finishInit&&t.finishInit(this);for(var a=0;a<da.length;++a)da[a](this);Pr(this),h&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}ua.defaults=aa,ua.optionHandlers=sa;var da=[];function fa(e,t,n,r){var i,o=e.doc;"smart"==(n=null==n?"add":n)&&(o.mode.indent?i=pt(e,t).state:n="prev");var a=e.options.tabSize,s=$e(o,t),l=B(s.text,null,a);s.stateAfter&&(s.stateAfter=null);var c=s.text.match(/^\s*/)[0];if(r||/\S/.test(s.text)){if("smart"==n&&((u=o.mode.indent(i,s.text.slice(c.length),s.text))==W||150<u)){if(!r)return;n="prev"}}else u=0,n="not";"prev"==n?u=t>o.first?B($e(o,t-1).text,null,a):0:"add"==n?u=l+e.options.indentUnit:"subtract"==n?u=l-e.options.indentUnit:"number"==typeof n&&(u=l+n);var u=Math.max(0,u),d="",f=0;if(e.options.indentWithTabs)for(var h=Math.floor(u/a);h;--h)f+=a,d+="\t";if(f<u&&(d+=V(u-f)),d!=c)return Yi(o,d,tt(t,0),tt(t,c.length),"+input"),!(s.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<c.length){m=tt(t,c.length);Ei(o,p,new oi(m,m));break}}}ua.defineInitHook=function(e){return da.push(e)};var ha=null;function pa(e){ha=e}function ma(e,t,n,r,i){var o=e.doc;e.display.shift=!1,r=r||o.sel;var a=+new Date-200,s="paste"==i||e.state.pasteIncoming>a,l=Ie(t),c=null;if(s&&1<r.ranges.length)if(ha&&ha.text.join("\n")==t){if(r.ranges.length%ha.text.length==0)for(var c=[],u=0;u<ha.text.length;u++)c.push(o.splitLines(ha.text[u]))}else l.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(c=G(l,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=tt(p.line,p.ch-n):e.state.overwrite&&!s?m=tt(m.line,Math.min($e(o,m.line).text.length,m.ch+$(l).length)):s&&ha&&ha.lineWise&&ha.text.join("\n")==l.join("\n")&&(p=m=tt(p.line,0)));m={from:p,to:m,text:c?c[f%c.length]:l,origin:i||(s?"paste":e.state.cutIncoming>a?"cut":"+input")};Ui(e.doc,m),rn(e,"inputRead",e,m)}t&&!s&&va(e,t),kr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=d),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ga(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");return n&&(e.preventDefault(),t.isReadOnly()||t.options.disableInput||Rr(t,function(){return ma(t,n,0,null,"paste")}),1)}function va(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 s=0;s<o.electricChars.length;s++)if(-1<t.indexOf(o.electricChars.charAt(s))){a=fa(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test($e(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=fa(e,i.head.line,"smart"));a&&rn(e,"electricInput",e,i.head.line)}}}function ya(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,i={anchor:tt(i,0),head:tt(i+1,0)};n.push(i),t.push(e.getRange(i.anchor,i.head))}return{text:t,ranges:n}}function ba(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function ka(){var e=M("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=M("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return h?e.style.width="1000px":e.setAttribute("wrap","off"),s&&(e.style.border="1px solid black"),ba(e),t}function xa(i,o,a,s,l){var e=o,t=a,c=$e(i,o.line),u=l&&"rtl"==i.direction?-a:a;function n(e){var t,n,r;if(null==(n="codepoint"==s?(t=c.text.charCodeAt(o.ch+(0<a?0:-1)),isNaN(t)?null:(n=0<a?55296<=t&&t<56320:56320<=t&&t<57343,new tt(o.line,Math.max(0,Math.min(c.text.length,o.ch+a*(n?2:1))),-a))):l?Do(i.cm,c,o,a):Ro(c,o,a))){if(e||(r=o.line+u)<i.first||r>=i.first+i.size||(o=new tt(r,o.ch,o.sticky),!(c=$e(i,r))))return;o=Bo(l,i.cm,c,o.line,u)}else o=n;return 1}if("char"==s||"codepoint"==s)n();else if("column"==s)n(!0);else if("word"==s||"group"==s)for(var r=null,d="group"==s,f=i.cm&&i.cm.getHelper(o,"wordChars"),h=!0;!(a<0)||n(!h);h=!1){var p=c.text.charAt(o.ch)||"\n",p=Z(p,f)?"w":d&&"\n"==p?"n":!d||/\s/.test(p)?null:"p";if(!d||h||p||(p="s"),r&&r!=p){a<0&&(a=1,n(),o.sticky="after");break}if(p&&(r=p),0<a&&!n(!h))break}t=qi(i,o,e,t,!0);return rt(e,t)&&(t.hitSide=!0),t}function wa(e,t,n,r){var i,o,a,s=e.doc,l=t.left;for("page"==r?(i=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),i=Math.max(i-.5*$n(e.display),3),o=(0<n?t.bottom:t.top)+n*i):"line"==r&&(o=0<n?t.bottom+3:t.top-3);(a=qn(e,l,o)).outside;){if(n<0?o<=0:o>=s.height){a.hitSide=!0;break}o+=5*n}return a}e=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new D,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Ca(e,t){var n=Cn(e,t.line);if(!n||n.hidden)return null;var r=$e(e.doc,t.line),n=xn(n,r,t.line),r=pe(r,e.doc.direction),e="left";r&&(e=ae(r,t.ch)%2?"right":"left");e=Tn(n.map,t.ch,e);return e.offset="right"==e.collapse?e.end:e.start,e}function Sa(e,t){return t&&(e.bad=!0),e}function _a(e,t,n){var r;if(t==e.display.lineDiv){if(!(r=e.display.lineDiv.childNodes[n]))return Sa(e.clipPos(tt(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 function(c,e,t){var n=c.text.firstChild,r=!1;if(!e||!T(n,e))return Sa(tt(Qe(c.line),0),!0);if(e==n&&(r=!0,e=n.childNodes[t],t=0,!e)){var i=c.rest?$(c.rest):c.line;return Sa(tt(Qe(i),i.text.length),r)}var i=3==e.nodeType?e:null,o=e;i||1!=e.childNodes.length||3!=e.firstChild.nodeType||(i=e.firstChild,t=t&&i.nodeValue.length);for(;o.parentNode!=n;)o=o.parentNode;var u=c.measure,d=u.maps;function a(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 s=Qe(r<0?c.line:c.rest[r]),l=i[o]+n;return tt(s,l=n<0||a!=e?i[o+(n?1:0)]:l)}}}var s=a(i,o,t);if(s)return Sa(s,r);for(var l=o.nextSibling,f=i?i.nodeValue.length-t:0;l;l=l.nextSibling){if(s=a(l,l.firstChild,0))return Sa(tt(s.line,s.ch-f),r);f+=l.textContent.length}for(var h=o.previousSibling,p=t;h;h=h.previousSibling){if(s=a(h,h.firstChild,-1))return Sa(tt(s.line,s.ch+p),r);p+=h.textContent.length}}(o,t,n)}}e.prototype.init=function(e){var t=this,o=this,a=o.cm,s=o.div=e.lineDiv;function l(e){for(var t=e.target;t;t=t.parentNode){if(t==s)return 1;if(/\bCodeMirror-(?:line)?widget\b/.test(t.className))break}}function n(e){if(l(e)&&!ke(a,e)){if(a.somethingSelected())pa({lineWise:!1,text:a.getSelections()}),"cut"==e.type&&a.replaceSelection("",null,"cut");else{if(!a.options.lineWiseCopyCut)return;var t=ya(a);pa({lineWise:!0,text:t.text}),"cut"==e.type&&a.operation(function(){a.setSelections(t.ranges,0,q),a.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var n=ha.text.join("\n");if(e.clipboardData.setData("Text",n),e.clipboardData.getData("Text")==n)return void e.preventDefault()}var r=ka(),e=r.firstChild;a.display.lineSpace.insertBefore(r,a.display.lineSpace.firstChild),e.value=ha.text.join("\n");var i=A();I(e),setTimeout(function(){a.display.lineSpace.removeChild(r),i.focus(),i==s&&o.showPrimarySelection()},50)}}s.contentEditable=!0,ba(s,a.options.spellcheck,a.options.autocorrect,a.options.autocapitalize),ge(s,"paste",function(e){!l(e)||ke(a,e)||ga(e,a)||v<=11&&setTimeout(Br(a,function(){return t.updateFromDOM()}),20)}),ge(s,"compositionstart",function(e){t.composing={data:e.data,done:!1}}),ge(s,"compositionupdate",function(e){t.composing||(t.composing={data:e.data,done:!1})}),ge(s,"compositionend",function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ge(s,"touchstart",function(){return o.forceCompositionEnd()}),ge(s,"input",function(){t.composing||t.readFromDOMSoon()}),ge(s,"copy",n),ge(s,"cut",n)},e.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},e.prototype.prepareSelection=function(){var e=sr(this.cm,!1);return e.focus=A()==this.div,e},e.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},e.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},e.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=_a(t,e.anchorNode,e.anchorOffset),n=_a(t,e.focusNode,e.focusOffset);if(!o||o.bad||!n||n.bad||0!=nt(at(o,n),r)||0!=nt(ot(o,n),i)){n=t.display.view,r=r.line>=t.display.viewFrom&&Ca(t,r)||{node:n[0].measure.map[2],offset:0},i=i.line<t.display.viewTo&&Ca(t,i);if(i||(i={node:(s=(s=n[n.length-1].measure).maps?s.maps[s.maps.length-1]:s.map)[s.length-1],offset:s[s.length-2]-s[s.length-3]}),r&&i){var a,s=e.rangeCount&&e.getRangeAt(0);try{a=E(r.node,r.offset,i.offset,i.node)}catch(e){}a&&(!f&&t.state.focused?(e.collapse(r.node,r.offset),a.collapsed||(e.removeAllRanges(),e.addRange(a))):(e.removeAllRanges(),e.addRange(a)),s&&null==e.anchorNode?e.addRange(s):f&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},e.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)},e.prototype.showMultipleSelections=function(e){_(this.cm.display.cursorDiv,e.cursors),_(this.cm.display.selectionDiv,e.selection)},e.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},e.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;e=e.getRangeAt(0).commonAncestorContainer;return T(this.div,e)},e.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&A()==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())},e.prototype.blur=function(){this.div.blur()},e.prototype.getField=function(){return this.div},e.prototype.supportsTouch=function(){return!0},e.prototype.receivedFocus=function(){var t=this;this.selectionInEditor()?this.pollSelection():Rr(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))})},e.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},e.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e,t,n=this.getSelection(),r=this.cm;if(l&&o&&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}(n.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();this.composing||(this.rememberSelection(),e=_a(r,n.anchorNode,n.anchorOffset),t=_a(r,n.focusNode,n.focusOffset),e&&t&&Rr(r,function(){Ri(r.doc,si(e,t),q),(e.bad||t.bad)&&(r.curOp.selectionChanged=!0)}))}},e.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e,t=this.cm,n=t.display,r=t.doc.sel.primary(),i=r.from(),r=r.to();if(0==i.ch&&i.line>t.firstLine()&&(i=tt(i.line-1,$e(t.doc,i.line-1).length)),r.ch==$e(t.doc,r.line).text.length&&r.line<t.lastLine()&&(r=tt(r.line+1,0)),i.line<n.viewFrom||r.line>n.viewTo-1)return!1;var o,a=i.line==n.viewFrom||0==(a=er(t,i.line))?(e=Qe(n.view[0].line),n.view[0].node):(e=Qe(n.view[a].line),n.view[a-1].node.nextSibling),r=er(t,r.line),r=r==n.view.length-1?(o=n.viewTo-1,n.lineDiv.lastChild):(o=Qe(n.view[r+1].line)-1,n.view[r+1].node.previousSibling);if(!a)return!1;for(var s=t.doc.splitLines(function(a,e,t,s,l){var n="",c=!1,u=a.doc.lineSeparator(),d=!1;function f(){c&&(n+=u,d&&(n+=u),c=d=!1)}function h(e){e&&(f(),n+=e)}for(;!function e(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(n)h(n);else if(n=t.getAttribute("cm-marker"))(n=a.findMarks(tt(s,0),tt(l+1,0),(o=+n,function(e){return e.id==o}))).length&&(r=n[0].find(0))&&h(Ge(a.doc,r.from,r.to).join(u));else if("false"!=t.getAttribute("contenteditable")){var r=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(/^br$/i.test(t.nodeName)||0!=t.textContent.length){r&&f();for(var i=0;i<t.childNodes.length;i++)e(t.childNodes[i]);/^(pre|p)$/i.test(t.nodeName)&&(d=!0),r&&(c=!0)}}}else 3==t.nodeType&&h(t.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "));var o}(e),e!=t;)e=e.nextSibling,d=!1;return n}(t,a,r,e,o)),l=Ge(t.doc,tt(e,0),tt(o,$e(t.doc,o).text.length));1<s.length&&1<l.length;)if($(s)==$(l))s.pop(),l.pop(),o--;else{if(s[0]!=l[0])break;s.shift(),l.shift(),e++}for(var c=0,u=0,d=s[0],f=l[0],h=Math.min(d.length,f.length);c<h&&d.charCodeAt(c)==f.charCodeAt(c);)++c;for(var p=$(s),m=$(l),g=Math.min(p.length-(1==s.length?c:0),m.length-(1==l.length?c:0));u<g&&p.charCodeAt(p.length-u-1)==m.charCodeAt(m.length-u-1);)++u;if(1==s.length&&1==l.length&&e==i.line)for(;c&&c>i.ch&&p.charCodeAt(p.length-u-1)==m.charCodeAt(m.length-u-1);)c--,u++;s[s.length-1]=p.slice(0,p.length-u).replace(/^\u200b+/,""),s[0]=s[0].slice(c).replace(/\u200b+$/,"");a=tt(e,c),r=tt(o,l.length?$(l).length-u:0);return 1<s.length||s[0]||nt(a,r)?(Yi(t.doc,s,a,r,"+input"),!0):void 0},e.prototype.ensurePolled=function(){this.forceCompositionEnd()},e.prototype.reset=function(){this.forceCompositionEnd()},e.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},e.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))},e.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Rr(this.cm,function(){return tr(e.cm)})},e.prototype.setUneditable=function(e){e.contentEditable="false"},e.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Br(this.cm,ma)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},e.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},e.prototype.onContextMenu=function(){},e.prototype.resetPosition=function(){},e.prototype.needsContentAttribute=!0;var La,Ma,Ta,Aa,Oa,r=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new D,this.hasSelection=!1,this.composing=null};function Na(e,t,r,n){La.defaults[e]=t,r&&(Ma[e]=n?function(e,t,n){n!=oa&&r(e,t,n)}:r)}r.prototype.init=function(n){var e=this,r=this,i=this.cm;this.createField(n);var o=this.textarea;function t(e){if(!ke(i,e)){if(i.somethingSelected())pa({lineWise:!1,text:i.getSelections()});else{if(!i.options.lineWiseCopyCut)return;var t=ya(i);pa({lineWise:!0,text:t.text}),"cut"==e.type?i.setSelections(t.ranges,null,q):(r.prevInput="",o.value=t.text.join("\n"),I(o))}"cut"==e.type&&(i.state.cutIncoming=+new Date)}}n.wrapper.insertBefore(this.wrapper,n.wrapper.firstChild),s&&(o.style.width="0px"),ge(o,"input",function(){k&&9<=v&&e.hasSelection&&(e.hasSelection=null),r.poll()}),ge(o,"paste",function(e){ke(i,e)||ga(e,i)||(i.state.pasteIncoming=+new Date,r.fastPoll())}),ge(o,"cut",t),ge(o,"copy",t),ge(n.scroller,"paste",function(e){if(!pn(n,e)&&!ke(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)}}),ge(n.lineSpace,"selectstart",function(e){pn(n,e)||Se(e)}),ge(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"})}}),ge(o,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},r.prototype.createField=function(e){this.wrapper=ka(),this.textarea=this.wrapper.firstChild},r.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},r.prototype.prepareSelection=function(){var e,t=this.cm,n=t.display,r=t.doc,i=sr(t);return t.options.moveInputWithCursor&&(e=Fn(t,r.sel.primary().head,"div"),t=n.wrapper.getBoundingClientRect(),r=n.lineDiv.getBoundingClientRect(),i.teTop=Math.max(0,Math.min(n.wrapper.clientHeight-10,e.top+r.top-t.top)),i.teLeft=Math.max(0,Math.min(n.wrapper.clientWidth-10,e.left+r.left-t.left))),i},r.prototype.showSelection=function(e){var t=this.cm.display;_(t.cursorDiv,e.cursors),_(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},r.prototype.reset=function(e){var t,n;this.contextMenuPending||this.composing||((t=this.cm).somethingSelected()?(this.prevInput="",n=t.getSelection(),this.textarea.value=n,t.state.focused&&I(this.textarea),k&&9<=v&&(this.hasSelection=n)):e||(this.prevInput=this.textarea.value="",k&&9<=v&&(this.hasSelection=null)))},r.prototype.getField=function(){return this.textarea},r.prototype.supportsTouch=function(){return!1},r.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!d||A()!=this.textarea))try{this.textarea.focus()}catch(e){}},r.prototype.blur=function(){this.textarea.blur()},r.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},r.prototype.receivedFocus=function(){this.slowPoll()},r.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},r.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))})},r.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Pe(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(k&&9<=v&&this.hasSelection===i||m&&/[\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,s=Math.min(r.length,i.length);a<s&&r.charCodeAt(a)==i.charCodeAt(a);)++a;return Rr(t,function(){ma(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},r.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},r.prototype.onKeyPress=function(){k&&9<=v&&(this.hasSelection=null),this.fastPoll()},r.prototype.onContextMenu=function(e){var n=this,r=n.cm,i=r.display,o=n.textarea;n.contextMenuPending&&n.contextMenuPending();var a,s,t,l,c=Zn(r,e),u=i.scroller.scrollTop;function d(){var e,t;null!=o.selectionStart&&(t="​"+((e=r.somethingSelected())?o.value:""),o.value="⇚",o.value=t,n.prevInput=e?"":"​",o.selectionStart=1,o.selectionEnd=t.length,i.selForContextMenu=r.doc.sel)}function f(){var e,t;n.contextMenuPending==f&&(n.contextMenuPending=!1,n.wrapper.style.cssText=s,o.style.cssText=a,k&&v<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=u),null!=o.selectionStart&&((!k||v<9)&&d(),e=0,t=function(){i.selForContextMenu==r.doc.sel&&0==o.selectionStart&&0<o.selectionEnd&&"​"==n.prevInput?Br(r,ji)(r):e++<10?i.detectingSelectAll=setTimeout(t,500):(i.selForContextMenu=null,i.input.reset())},i.detectingSelectAll=setTimeout(t,200)))}c&&!p&&(r.options.resetSelectionOnContextMenu&&-1==r.doc.sel.contains(c)&&Br(r,Ri)(r.doc,si(c),q),a=o.style.cssText,s=n.wrapper.style.cssText,c=n.wrapper.offsetParent.getBoundingClientRect(),n.wrapper.style.cssText="position: static",o.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-c.top-5)+"px; left: "+(e.clientX-c.left-5)+"px;\n z-index: 1000; background: "+(k?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",h&&(t=window.scrollY),i.input.focus(),h&&window.scrollTo(null,t),i.input.reset(),r.somethingSelected()||(o.value=n.prevInput=" "),n.contextMenuPending=f,i.selForContextMenu=r.doc.sel,clearTimeout(i.detectingSelectAll),k&&9<=v&&d(),x?(Me(e),l=function(){ye(window,"mouseup",l),setTimeout(f,20)},ge(window,"mouseup",l)):setTimeout(f,50))},r.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e,this.textarea.readOnly=!!e},r.prototype.setUneditable=function(){},r.prototype.needsContentAttribute=!1,Ma=(La=ua).optionHandlers,La.defineOption=Na,La.Init=oa,Na("value","",function(e,t){return e.setValue(t)},!0),Na("mode",null,function(e,t){e.doc.modeOption=t,fi(e)},!0),Na("indentUnit",2,fi,!0),Na("indentWithTabs",!1),Na("smartIndent",!0),Na("tabSize",4,function(e){hi(e),Nn(e),tr(e)},!0),Na("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(tt(o,n))}o++});for(var t=i.length-1;0<=t;t--)Yi(e.doc,r,i[t],tt(i[t].line,i[t].ch+r.length))}}),Na("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=oa&&e.refresh()}),Na("specialCharPlaceholder",Xt,function(e){return e.refresh()},!0),Na("electricChars",!0),Na("inputStyle",d?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),Na("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),Na("autocorrect",!1,function(e,t){return e.getInputField().autocorrect=t},!0),Na("autocapitalize",!1,function(e,t){return e.getInputField().autocapitalize=t},!0),Na("rtlMoveVisually",!y),Na("wholeLineUpdateBefore",!0),Na("theme","default",function(e){ia(e),Qr(e)},!0),Na("keyMap","default",function(e,t,n){t=Eo(t),n=n!=oa&&Eo(n);n&&n.detach&&n.detach(e,t),t.attach&&t.attach(e,n||null)}),Na("extraKeys",null),Na("configureMouse",null),Na("lineWrapping",!1,ca,!0),Na("gutters",[],function(e,t){e.display.gutterSpecs=Xr(t,e.options.lineNumbers),Qr(e)},!0),Na("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?Yn(e.display)+"px":"0",e.refresh()},!0),Na("coverGutterNextToScrollbar",!1,function(e){return Tr(e)},!0),Na("scrollbarStyle","native",function(e){Nr(e),Tr(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),Na("lineNumbers",!1,function(e,t){e.display.gutterSpecs=Xr(e.options.gutters,t),Qr(e)},!0),Na("firstLineNumber",1,Qr,!0),Na("lineNumberFormatter",function(e){return e},Qr,!0),Na("showCursorWhenSelecting",!1,ar,!0),Na("resetSelectionOnContextMenu",!0),Na("lineWiseCopyCut",!0),Na("pasteLinesPerSelection",!0),Na("selectionsMayTouch",!1),Na("readOnly",!1,function(e,t){"nocursor"==t&&(pr(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),Na("screenReaderLabel",null,function(e,t){e.display.input.screenReaderLabelChanged(t=""===t?null:t)}),Na("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),Na("dragDrop",!0,la),Na("allowDropFileTypes",null),Na("cursorBlinkRate",530),Na("cursorScrollMargin",0),Na("cursorHeight",1,ar,!0),Na("singleCursorHeightPerLine",!0,ar,!0),Na("workTime",100),Na("workDelay",100),Na("flattenSpans",!0,hi,!0),Na("addModeClass",!1,hi,!0),Na("pollInterval",100),Na("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),Na("historyEventDelay",1250),Na("viewportMargin",10,function(e){return e.refresh()},!0),Na("maxHighlightLength",1e4,hi,!0),Na("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),Na("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),Na("autofocus",null),Na("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0),Na("phrases",null),Aa=(Ta=ua).optionHandlers,Oa=Ta.helpers={},Ta.prototype={constructor:Ta,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,Aa.hasOwnProperty(e)&&Br(this,Aa[e])(this,t,r),be(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"](Eo(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:Dr(function(e,t){var n=e.token?e:Ta.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++,tr(this)}),removeOverlay:Dr(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 tr(this)}}),indentLine:Dr(function(e,t,n){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),Ze(this.doc,e)&&fa(this,e,t,n)}),indentSelection:Dr(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&&(fa(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&kr(this));else{for(var o=i.from(),a=i.to(),i=Math.max(n,o.line),n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1,s=i;s<n;++s)fa(this,s,e);i=this.doc.sel.ranges;0==o.ch&&t.length==i.length&&0<i[r].from().ch&&Ei(this.doc,r,new oi(o,i[r].to()),q)}}}),getTokenAt:function(e,t){return bt(this,e,t)},getLineTokens:function(e,t){return bt(this,tt(e),t,!0)},getTokenTypeAt:function(e){e=lt(this.doc,e);var t,n=ht(this,$e(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}}e=t?t.indexOf("overlay "):-1;return e<0?t:0==e?null:t.slice(0,e-1)},getModeAt:function(e){var t=this.doc.mode;return t.innerMode?Ta.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(!Oa.hasOwnProperty(t))return n;var r=Oa[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 s=0;s<r._global.length;s++){var l=r._global[s];l.pred(i,this)&&-1==F(n,l.val)&&n.push(l.val)}return n},getStateAfter:function(e,t){var n=this.doc;return pt(this,(e=st(n,null==e?n.first+n.size-1:e))+1,t).state},cursorCoords:function(e,t){var n=this.doc.sel.primary(),n=null==e?n.head:"object"==typeof e?lt(this.doc,e):e?n.from():n.to();return Fn(this,n,t||"page")},charCoords:function(e,t){return Dn(this,lt(this.doc,e),t||"page")},coordsChar:function(e,t){return qn(this,(e=Bn(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=Bn(this,{top:e,left:0},t||"page").top,Je(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,n){var r,i=!1,e="number"==typeof e?(r=this.doc.first+this.doc.size-1,e<this.doc.first?e=this.doc.first:r<e&&(e=r,i=!0),$e(this.doc,e)):e;return Rn(this,e,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-qt(e):0)},defaultTextHeight:function(){return $n(this.display)},defaultCharWidth:function(){return Gn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o,a,s=this.display,l=(e=Fn(this,lt(this.doc,e))).bottom,c=e.left;t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),s.sizer.appendChild(t),"over"==r?l=e.top:"above"!=r&&"near"!=r||(o=Math.max(s.wrapper.clientHeight,this.doc.height),a=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth),("above"==r||e.bottom+t.offsetHeight>o)&&e.top>t.offsetHeight?l=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=o&&(l=e.bottom),c+t.offsetWidth>a&&(c=a-t.offsetWidth)),t.style.top=l+"px",t.style.left=t.style.right="","right"==i?(c=s.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?c=0:"middle"==i&&(c=(s.sizer.clientWidth-t.offsetWidth)/2),t.style.left=c+"px"),n&&(n=this,t={left:c,top:l,right:c+t.offsetWidth,bottom:l+t.offsetHeight},null!=(t=yr(n,t)).scrollTop&&Sr(n,t.scrollTop),null!=t.scrollLeft&&Lr(n,t.scrollLeft))},triggerOnKeyDown:Dr($o),triggerOnKeyPress:Dr(Xo),triggerOnKeyUp:Go,triggerOnMouseDown:Dr(Zo),execCommand:function(e){if(Fo.hasOwnProperty(e))return Fo[e].call(null,this)},triggerElectric:Dr(function(e){va(this,e)}),findPosH:function(e,t,n,r){var i=1;t<0&&(i=-1,t=-t);for(var o=lt(this.doc,e),a=0;a<t&&!(o=xa(this.doc,o,i,n,r)).hitSide;++a);return o},moveH:Dr(function(t,n){var r=this;this.extendSelectionsBy(function(e){return r.display.shift||r.doc.extend||e.empty()?xa(r.doc,e.head,t,n,r.options.rtlMoveVisually):t<0?e.from():e.to()},j)}),deleteH:Dr(function(n,r){var e=this.doc.sel,i=this.doc;e.somethingSelected()?i.replaceSelection("",null,"+delete"):Io(this,function(e){var t=xa(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=lt(this.doc,e),s=0;s<t;++s){var l=Fn(this,a,"div");if(null==o?o=l.left:l.left=o,(a=wa(this,l,i,n)).hitSide)break}return a},moveV:Dr(function(r,i){var o=this,a=this.doc,s=[],l=!this.display.shift&&!a.extend&&a.sel.somethingSelected();if(a.extendSelectionsBy(function(e){if(l)return r<0?e.from():e.to();var t=Fn(o,e.head,"div");null!=e.goalColumn&&(t.left=e.goalColumn),s.push(t.left);var n=wa(o,t,r,i);return"page"==i&&e==a.sel.primary()&&br(o,Dn(o,n,"div").top-t.top),n},j),s.length)for(var e=0;e<a.sel.ranges.length;e++)a.sel.ranges[e].goalColumn=s[e]}),findWordAt:function(e){var t=$e(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=Z(o,i)?function(e){return Z(e,i)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!Z(e)};0<n&&a(t.charAt(n-1));)--n;for(;r<t.length&&a(t.charAt(r));)++r}return new oi(tt(e.line,n),tt(e.line,r))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||(((this.state.overwrite=!this.state.overwrite)?O:C)(this.display.cursorDiv,"CodeMirror-overwrite"),be(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==A()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:Dr(function(e,t){xr(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-yn(this)-this.display.barHeight,width:e.scrollWidth-yn(this)-this.display.barWidth,clientHeight:kn(this),clientWidth:bn(this)}},scrollIntoView:Dr(function(e,t){var n;null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:tt(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?(n=e,wr(t=this),t.curOp.scrollToPos=n):Cr(this,e.from,e.to,e.margin)}),setSize:Dr(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&&On(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){nr(r,i,"widget");break}++i}),this.curOp.forceUpdate=!0,be(this,"refresh",this)}),operation:function(e){return Rr(this,e)},startOperation:function(){return Ir(this)},endOperation:function(){return Pr(this)},refresh:Dr(function(){var e=this.display.cachedTextHeight;tr(this),this.curOp.forceUpdate=!0,Nn(this),xr(this,this.doc.scrollLeft,this.doc.scrollTop),Ur(this.display),(null==e||.5<Math.abs(e-$n(this.display))||this.options.lineWrapping)&&Jn(this),be(this,"refresh",this)}),swapDoc:Dr(function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),vi(this,e),Nn(this),this.display.input.reset(),xr(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,rn(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}},Ce(Ta),Ta.registerHelper=function(e,t,n){Oa.hasOwnProperty(e)||(Oa[e]=Ta[e]={_global:[]}),Oa[e][t]=n},Ta.registerGlobalHelper=function(e,t,n,r){Ta.registerHelper(e,t,r),Oa[e]._global.push({pred:n,val:r})};var Ea,Ia,Pa="iter insert remove copy getEditor constructor".split(" ");for(Ea in fo.prototype)fo.prototype.hasOwnProperty(Ea)&&F(Pa,Ea)<0&&(ua.prototype[Ea]=function(e){return function(){return e.apply(this.doc,arguments)}}(fo.prototype[Ea]));return Ce(fo),ua.inputStyles={textarea:r,contenteditable:e},ua.defineMode=function(e){ua.defaults.mode||"null"==e||(ua.defaults.mode=e),function(e,t){2<arguments.length&&(t.dependencies=Array.prototype.slice.call(arguments,2)),De[e]=t}.apply(this,arguments)},ua.defineMIME=function(e,t){Fe[e]=t},ua.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),ua.defineMIME("text/plain","null"),ua.defineExtension=function(e,t){ua.prototype[e]=t},ua.defineDocExtension=function(e,t){fo.prototype[e]=t},ua.fromTextArea=function(t,n){var e;function r(){t.value=s.getValue()}if((n=n?R(n):{}).value=t.value,!n.tabindex&&t.tabIndex&&(n.tabindex=t.tabIndex),!n.placeholder&&t.placeholder&&(n.placeholder=t.placeholder),null==n.autofocus&&(e=A(),n.autofocus=e==t||null!=t.getAttribute("autofocus")&&e==document.body),t.form&&(ge(t.form,"submit",r),!n.leaveSubmitMethodAlone)){var i=t.form,o=i.submit;try{var a=i.submit=function(){r(),i.submit=o,i.submit(),i.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&&(ye(t.form,"submit",r),n.leaveSubmitMethodAlone||"function"!=typeof t.form.submit||(t.form.submit=o))}},t.style.display="none";var s=ua(function(e){return t.parentNode.insertBefore(e,t.nextSibling)},n);return s},(Ia=ua).off=ye,Ia.on=ge,Ia.wheelEventPixels=ni,Ia.Doc=fo,Ia.splitLines=Ie,Ia.countColumn=B,Ia.findColumn=K,Ia.isWordChar=J,Ia.Pass=W,Ia.signal=be,Ia.Line=Kt,Ia.changeEnd=li,Ia.scrollbarModel=Or,Ia.Pos=tt,Ia.cmpPos=nt,Ia.modes=De,Ia.mimeModes=Fe,Ia.resolveMode=ze,Ia.getMode=We,Ia.modeExtensions=qe,Ia.extendMode=He,Ia.copyState=je,Ia.startState=Ue,Ia.innerMode=Ke,Ia.commands=Fo,Ia.keyMap=_o,Ia.keyName=No,Ia.isModifierKey=Ao,Ia.lookupKey=To,Ia.normalizeKeyMap=Mo,Ia.StringStream=Ve,Ia.SharedTextMarker=lo,Ia.TextMarker=oo,Ia.LineWidget=ro,Ia.e_preventDefault=Se,Ia.e_stopPropagation=_e,Ia.e_stop=Me,Ia.addClass=O,Ia.contains=T,Ia.rmClass=C,Ia.keyNames=xo,ua.version="5.62.3",ua}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(C){"use strict";var S={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},_={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};C.defineMode("xml",function(e,t){var n,o,a,s=e.indentUnit,l={},r=t.htmlMode?S:_;for(n in r)l[n]=r[n];for(n in t)l[n]=t[n];function c(t,n){function e(e){return(n.tokenize=e)(t,n)}var r=t.next();if("<"==r)return t.eat("!")?t.eat("[")?t.match("CDATA[")?e(i("atom","]]>")):null:t.match("--")?e(i("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=c;break}}return"meta"}}(1))):null:t.eat("?")?(t.eatWhile(/[\w\._\-]/),n.tokenize=i("meta","?>"),"meta"):(o=t.eat("/")?"closeTag":"openTag",n.tokenize=u,"tag bracket");if("&"!=r)return t.eatWhile(/[^&<]/),null;r=t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w\.\-:]/)&&t.eat(";");return r?"atom":"error"}function u(e,t){var n=e.next();if(">"==n||"/"==n&&e.eat(">"))return t.tokenize=c,o=">"==n?"endTag":"selfcloseTag","tag bracket";if("="==n)return o="equals",null;if("<"!=n)return/[\'\"]/.test(n)?(t.tokenize=(r=n,i.isInAttribute=!0,i),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word");t.tokenize=c,t.state=p,t.tagName=t.tagStart=null;var r,t=t.tokenize(e,t);return t?t+" tag error":"tag error";function i(e,t){for(;!e.eol();)if(e.next()==r){t.tokenize=u;break}return"string"}}function i(n,r){return function(e,t){for(;!e.eol();){if(e.match(r)){t.tokenize=c;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(),a="tag",b):l.allowMissingTagName&&"endTag"==e?(a="tag bracket",b(e,0,n)):(a="error",m)}function g(e,t,n){if("word"!=e)return l.allowMissingTagName&&"endTag"==e?(a="tag bracket",v(e,0,n)):(a="error",y);t=t.current();return n.context&&n.context.tagName!=t&&l.implicitlyClosed.hasOwnProperty(n.context.tagName)&&f(n),n.context&&n.context.tagName==t||!1===l.matchClosing?(a="tag",v):(a="tag error",y)}function v(e,t,n){return"endTag"!=e?(a="error",v):(f(n),p)}function y(e,t,n){return a="error",v(e,0,n)}function b(e,t,n){if("word"==e)return a="attribute",k;if("endTag"!=e&&"selfcloseTag"!=e)return a="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 k(e,t,n){return"equals"==e?x:(l.allowMissing||(a="error"),b(e,0,n))}function x(e,t,n){return"string"==e?w:"word"==e&&l.allowUnquoted?(a="string",b):(a="error",b(e,0,n))}function w(e,t,n){return"string"==e?w:b(e,0,n)}return c.isInText=!0,{startState:function(e){var t={tokenize:c,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;o=null;var n=t.tokenize(e,t);return(n||o)&&"comment"!=n&&(a=null,t.state=t.state(o||n,e,t),a&&(n="error"==a?n+" error":a)),n},indent:function(e,t,n){var r=e.context;if(e.tokenize.isInAttribute)return e.tagStart==e.indented?e.stringStartCol+1:e.indented+s;if(r&&r.noIndent)return C.Pass;if(e.tokenize!=u&&e.tokenize!=c)return n?n.match(/^(\s*)/)[0].length:0;if(e.tagName)return!1!==l.multilineTagIndentPastTag?e.tagStart+e.tagName.length+2:e.tagStart+s*(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+s: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)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})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(nt){"use strict";nt.defineMode("javascript",function(e,u){var t,n,r,i,d=e.indentUnit,f=u.statementIndent,o=u.jsonld,a=u.json||o,s=!1!==u.trackScope,c=u.typescript,h=u.wordCharacters||/[\w$\xa1-\uffff]/,l=(t=p("keyword a"),n=p("keyword b"),r=p("keyword c"),i=p("keyword d"),e=p("operator"),{if:p("if"),while:t,with:t,else:n,do:n,try:n,finally:n,return:i,break:i,continue:i,new:p("new"),delete:r,void:r,throw:r,debugger:p("debugger"),var:p("var"),const:p("var"),let:p("var"),function:p("function"),catch:p("catch"),for:p("for"),switch:p("switch"),case:p("case"),default:p("default"),in:e,typeof:e,instanceof:e,true:e={type:"atom",style:"atom"},false:e,null:e,undefined:e,NaN:e,Infinity:e,this:p("this"),class:p("class"),super:p("atom"),yield:r,export:p("export"),import:p("import"),extends:r,await:r});function p(e){return{type:e,style:"keyword"}}var m,g,v=/[+\-*&%=<>!?|~^@]/,y=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function b(e,t,n){return m=e,g=n,t}function k(e,t){var i,n=e.next();if('"'==n||"'"==n)return t.tokenize=(i=n,function(e,t){var n,r=!1;if(o&&"@"==e.peek()&&e.match(y))return t.tokenize=k,b("jsonld-keyword","meta");for(;null!=(n=e.next())&&(n!=i||r);)r=!r&&"\\"==n;return r||(t.tokenize=k),b("string","string")}),t.tokenize(e,t);if("."==n&&e.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return b("number","number");if("."==n&&e.match(".."))return b("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(n))return b(n);if("="==n&&e.eat(">"))return b("=>","operator");if("0"==n&&e.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return b("number","number");if(/\d/.test(n))return e.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),b("number","number");if("/"==n)return e.eat("*")?(t.tokenize=x)(e,t):e.eat("/")?(e.skipToEnd(),b("comment","comment")):tt(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/),b("regexp","string-2")):(e.eat("="),b("operator","operator",e.current()));if("`"==n)return(t.tokenize=w)(e,t);if("#"==n&&"!"==e.peek())return e.skipToEnd(),b("meta","meta");if("#"==n&&e.eatWhile(h))return b("variable","property");if("<"==n&&e.match("!--")||"-"==n&&e.match("->")&&!/\S/.test(e.string.slice(0,e.start)))return e.skipToEnd(),b("comment","comment");if(v.test(n))return">"==n&&t.lexical&&">"==t.lexical.type||(e.eat("=")?"!"!=n&&"="!=n||e.eat("="):/[<>*+\-|&?]/.test(n)&&(e.eat(n),">"==n&&e.eat(n))),"?"==n&&e.eat(".")?b("."):b("operator","operator",e.current());if(h.test(n)){e.eatWhile(h);n=e.current();if("."!=t.lastType){if(l.propertyIsEnumerable(n)){t=l[n];return b(t.type,t.style,n)}if("async"==n&&e.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return b("async","keyword",n)}return b("variable","variable",n)}}function x(e,t){for(var n,r=!1;n=e.next();){if("/"==n&&r){t.tokenize=k;break}r="*"==n}return b("comment","comment")}function w(e,t){for(var n,r=!1;null!=(n=e.next());){if(!r&&("`"==n||"$"==n&&e.eat("{"))){t.tokenize=k;break}r=!r&&"\\"==n}return b("quasi","string-2",e.current())}function C(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var n,r=e.string.indexOf("=>",e.start);if(!(r<0)){!c||(n=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(e.string.slice(e.start,r)))&&(r=n.index);for(var i=0,o=!1,a=r-1;0<=a;--a){var s=e.string.charAt(a),l="([{}])".indexOf(s);if(0<=l&&l<3){if(!i){++a;break}if(0==--i){"("==s&&(o=!0);break}}else if(3<=l&&l<6)++i;else if(h.test(s))o=!0;else if(/["'\/`]/.test(s))for(;;--a){if(0==a)return;if(e.string.charAt(a-1)==s&&"\\"!=e.string.charAt(a-2)){a--;break}}else if(o&&!i){++a;break}}o&&!i&&(t.fatArrowAt=a)}}var S={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function _(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 L(e,t,n,r,i){var o=e.cc;for(M.state=e,M.stream=i,M.marked=null,M.cc=o,M.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;)if((o.length?o.pop():a?K:H)(n,r)){for(;o.length&&o[o.length-1].lex;)o.pop()();return M.marked?M.marked:"variable"==n&&function(e,t){if(s){for(var n=e.localVars;n;n=n.next)if(n.name==t)return 1;for(var r=e.context;r;r=r.prev)for(n=r.vars;n;n=n.next)if(n.name==t)return 1}}(e,r)?"variable-2":t}}var M={state:null,column:null,marked:null,cc:null};function T(){for(var e=arguments.length-1;0<=e;e--)M.cc.push(arguments[e])}function A(){return T.apply(null,arguments),!0}function O(e,t){for(var n=t;n;n=n.next)if(n.name==e)return 1}function N(e){var t=M.state;if(M.marked="def",s){if(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 I(r,n.vars,!0):null}return O(t,n.vars)?n:new I(n.prev,new P(t,n.vars),!1)}return null}}(e,t.context);if(null!=n)return void(t.context=n)}else if(!O(e,t.localVars))return void(t.localVars=new P(e,t.localVars));u.globalVars&&!O(e,t.globalVars)&&(t.globalVars=new P(e,t.globalVars))}}function E(e){return"public"==e||"private"==e||"protected"==e||"abstract"==e||"readonly"==e}function I(e,t,n){this.prev=e,this.vars=t,this.block=n}function P(e,t){this.name=e,this.next=t}var R=new P("this",new P("arguments",null));function B(){M.state.context=new I(M.state.context,M.state.localVars,!1),M.state.localVars=R}function D(){M.state.context=new I(M.state.context,M.state.localVars,!0),M.state.localVars=null}function F(){M.state.localVars=M.state.context.vars,M.state.context=M.state.context.prev}function z(r,i){function e(){var e=M.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 _(t,M.stream.column(),r,null,e.lexical,i)}return e.lex=!0,e}function W(){var e=M.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?A():";"==n||"}"==t||")"==t||"]"==t?T():A(e)}}function H(e,t){return"var"==e?A(z("vardef",t),Le,q(";"),W):"keyword a"==e?A(z("form"),V,H,W):"keyword b"==e?A(z("form"),H,W):"keyword d"==e?M.stream.match(/^\s*$/,!1)?A():A(z("stat"),G,q(";"),W):"debugger"==e?A(q(";")):"{"==e?A(z("}"),D,ue,W,F):";"==e?A():"if"==e?("else"==M.state.lexical.info&&M.state.cc[M.state.cc.length-1]==W&&M.state.cc.pop()(),A(z("form"),V,H,W,Ee)):"function"==e?A(Be):"for"==e?A(z("form"),D,Ie,H,F,W):"class"==e||c&&"interface"==t?(M.marked="keyword",A(z("form","class"==e?e:t),qe,W)):"variable"==e?c&&"declare"==t?(M.marked="keyword",A(H)):c&&("module"==t||"enum"==t||"type"==t)&&M.stream.match(/^\s*\w/,!1)?(M.marked="keyword","enum"==t?A(Ze):"type"==t?A(Fe,q("operator"),me,q(";")):A(z("form"),Me,q("{"),z("}"),ue,W,W)):c&&"namespace"==t?(M.marked="keyword",A(z("form"),K,H,W)):c&&"abstract"==t?(M.marked="keyword",A(H)):A(z("stat"),re):"switch"==e?A(z("form"),V,q("{"),z("}","switch"),D,ue,W,W,F):"case"==e?A(K,q(":")):"default"==e?A(q(":")):"catch"==e?A(z("form"),B,j,H,W,F):"export"==e?A(z("stat"),Ue,W):"import"==e?A(z("stat"),$e,W):"async"==e?A(H):"@"==t?A(K,H):T(z("stat"),K,q(";"),W)}function j(e){if("("==e)return A(ze,q(")"))}function K(e,t){return $(e,t,!1)}function U(e,t){return $(e,t,!0)}function V(e){return"("!=e?T():A(z(")"),G,q(")"),W)}function $(e,t,n){if(M.state.fatArrowAt==M.stream.start){var r=n?ee:Z;if("("==e)return A(B,z(")"),le(ze,")"),W,q("=>"),r,F);if("variable"==e)return T(B,Me,q("=>"),r,F)}var i,r=n?Y:X;return S.hasOwnProperty(e)?A(r):"function"==e?A(Be,r):"class"==e||c&&"interface"==t?(M.marked="keyword",A(z("form"),We,W)):"keyword c"==e||"async"==e?A(n?U:K):"("==e?A(z(")"),G,q(")"),W,r):"operator"==e||"spread"==e?A(n?U:K):"["==e?A(z("]"),Je,W,r):"{"==e?ce(oe,"}",null,r):"quasi"==e?T(Q,r):"new"==e?A((i=n,function(e){return"."==e?A(i?ne:te):"variable"==e&&c?A(Ce,i?Y:X):T(i?U:K)})):A()}function G(e){return e.match(/[;\}\)\],]/)?T():T(K)}function X(e,t){return","==e?A(G):Y(e,t,!1)}function Y(e,t,n){var r=0==n?X:Y,i=0==n?K:U;return"=>"==e?A(B,n?ee:Z,F):"operator"==e?/\+\+|--/.test(t)||c&&"!"==t?A(r):c&&"<"==t&&M.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?A(z(">"),le(me,">"),W,r):"?"==t?A(K,q(":"),i):A(i):"quasi"==e?T(Q,r):";"!=e?"("==e?ce(U,")","call",r):"."==e?A(ie,r):"["==e?A(z("]"),G,q("]"),W,r):c&&"as"==t?(M.marked="keyword",A(me,r)):"regexp"==e?(M.state.lastType=M.marked="operator",M.stream.backUp(M.stream.pos-M.stream.start-1),A(i)):void 0:void 0}function Q(e,t){return"quasi"!=e?T():"${"!=t.slice(t.length-2)?A(Q):A(G,J)}function J(e){if("}"==e)return M.marked="string-2",M.state.tokenize=w,A(Q)}function Z(e){return C(M.stream,M.state),T("{"==e?H:K)}function ee(e){return C(M.stream,M.state),T("{"==e?H:U)}function te(e,t){if("target"==t)return M.marked="keyword",A(X)}function ne(e,t){if("target"==t)return M.marked="keyword",A(Y)}function re(e){return":"==e?A(W,H):T(X,q(";"),W)}function ie(e){if("variable"==e)return M.marked="property",A()}function oe(e,t){return"async"==e?(M.marked="property",A(oe)):"variable"!=e&&"keyword"!=M.style?"number"==e||"string"==e?(M.marked=o?"property":M.style+" property",A(se)):"jsonld-keyword"==e?A(se):c&&E(t)?(M.marked="keyword",A(oe)):"["==e?A(K,de,q("]"),se):"spread"==e?A(U,se):"*"==t?(M.marked="keyword",A(oe)):":"==e?T(se):void 0:(M.marked="property","get"==t||"set"==t?A(ae):(c&&M.state.fatArrowAt==M.stream.start&&(n=M.stream.match(/^\s*:\s*/,!1))&&(M.state.fatArrowAt=M.stream.pos+n[0].length),A(se)));var n}function ae(e){return"variable"!=e?T(se):(M.marked="property",A(Be))}function se(e){return":"==e?A(U):"("==e?T(Be):void 0}function le(r,i,o){function a(e,t){if(o?-1<o.indexOf(e):","==e){var n=M.state.lexical;return"call"==n.info&&(n.pos=(n.pos||0)+1),A(function(e,t){return e==i||t==i?T():T(r)},a)}return e==i||t==i?A():o&&-1<o.indexOf(";")?T(r):A(q(i))}return function(e,t){return e==i||t==i?A():T(r,a)}}function ce(e,t,n){for(var r=3;r<arguments.length;r++)M.cc.push(arguments[r]);return A(z(t,n),le(e,t),W)}function ue(e){return"}"==e?A():T(H,ue)}function de(e,t){if(c)return":"==e?A(me):"?"==t?A(de):void 0}function fe(e,t){if(c&&(":"==e||"in"==t))return A(me)}function he(e){if(c&&":"==e)return M.stream.match(/^\s*\w+\s+is\b/,!1)?A(K,pe,me):A(me)}function pe(e,t){if("is"==t)return M.marked="keyword",A()}function me(e,t){return"keyof"==t||"typeof"==t||"infer"==t||"readonly"==t?(M.marked="keyword",A("typeof"==t?U:me)):"variable"==e||"void"==t?(M.marked="type",A(we)):"|"==t||"&"==t?A(me):"string"==e||"number"==e||"atom"==e?A(we):"["==e?A(z("]"),le(me,"]",","),W,we):"{"==e?A(z("}"),ve,W,we):"("==e?A(le(xe,")"),ge,we):"<"==e?A(le(me,">"),me):"quasi"==e?T(be,we):void 0}function ge(e){if("=>"==e)return A(me)}function ve(e){return e.match(/[\}\)\]]/)?A():","==e||";"==e?A(ve):T(ye,ve)}function ye(e,t){return"variable"==e||"keyword"==M.style?(M.marked="property",A(ye)):"?"==t||"number"==e||"string"==e?A(ye):":"==e?A(me):"["==e?A(q("variable"),fe,q("]"),ye):"("==e?T(De,ye):e.match(/[;\}\)\],]/)?void 0:A()}function be(e,t){return"quasi"!=e?T():"${"!=t.slice(t.length-2)?A(be):A(me,ke)}function ke(e){if("}"==e)return M.marked="string-2",M.state.tokenize=w,A(be)}function xe(e,t){return"variable"==e&&M.stream.match(/^\s*[?:]/,!1)||"?"==t?A(xe):":"==e?A(me):"spread"==e?A(xe):T(me)}function we(e,t){return"<"==t?A(z(">"),le(me,">"),W,we):"|"==t||"."==e||"&"==t?A(me):"["==e?A(me,q("]"),we):"extends"==t||"implements"==t?(M.marked="keyword",A(me)):"?"==t?A(me,q(":"),me):void 0}function Ce(e,t){if("<"==t)return A(z(">"),le(me,">"),W,we)}function Se(){return T(me,_e)}function _e(e,t){if("="==t)return A(me)}function Le(e,t){return"enum"==t?(M.marked="keyword",A(Ze)):T(Me,de,Oe,Ne)}function Me(e,t){return c&&E(t)?(M.marked="keyword",A(Me)):"variable"==e?(N(t),A()):"spread"==e?A(Me):"["==e?ce(Ae,"]"):"{"==e?ce(Te,"}"):void 0}function Te(e,t){return"variable"!=e||M.stream.match(/^\s*:/,!1)?("variable"==e&&(M.marked="property"),"spread"==e?A(Me):"}"==e?T():"["==e?A(K,q("]"),q(":"),Te):A(q(":"),Me,Oe)):(N(t),A(Oe))}function Ae(){return T(Me,Oe)}function Oe(e,t){if("="==t)return A(U)}function Ne(e){if(","==e)return A(Le)}function Ee(e,t){if("keyword b"==e&&"else"==t)return A(z("form","else"),H,W)}function Ie(e,t){return"await"==t?A(Ie):"("==e?A(z(")"),Pe,W):void 0}function Pe(e){return"var"==e?A(Le,Re):("variable"==e?A:T)(Re)}function Re(e,t){return")"==e?A():";"==e?A(Re):"in"==t||"of"==t?(M.marked="keyword",A(K,Re)):T(K,Re)}function Be(e,t){return"*"==t?(M.marked="keyword",A(Be)):"variable"==e?(N(t),A(Be)):"("==e?A(B,z(")"),le(ze,")"),W,he,H,F):c&&"<"==t?A(z(">"),le(Se,">"),W,Be):void 0}function De(e,t){return"*"==t?(M.marked="keyword",A(De)):"variable"==e?(N(t),A(De)):"("==e?A(B,z(")"),le(ze,")"),W,he,F):c&&"<"==t?A(z(">"),le(Se,">"),W,De):void 0}function Fe(e,t){return"keyword"==e||"variable"==e?(M.marked="type",A(Fe)):"<"==t?A(z(">"),le(Se,">"),W):void 0}function ze(e,t){return"@"==t&&A(K,ze),"spread"==e?A(ze):c&&E(t)?(M.marked="keyword",A(ze)):c&&"this"==e?A(de,Oe):T(Me,de,Oe)}function We(e,t){return("variable"==e?qe:He)(e,t)}function qe(e,t){if("variable"==e)return N(t),A(He)}function He(e,t){return"<"==t?A(z(">"),le(Se,">"),W,He):"extends"==t||"implements"==t||c&&","==e?("implements"==t&&(M.marked="keyword"),A(c?me:K,He)):"{"==e?A(z("}"),je,W):void 0}function je(e,t){return"async"==e||"variable"==e&&("static"==t||"get"==t||"set"==t||c&&E(t))&&M.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(M.marked="keyword",A(je)):"variable"==e||"keyword"==M.style?(M.marked="property",A(Ke,je)):"number"==e||"string"==e?A(Ke,je):"["==e?A(K,de,q("]"),Ke,je):"*"==t?(M.marked="keyword",A(je)):c&&"("==e?T(De,je):";"==e||","==e?A(je):"}"==e?A():"@"==t?A(K,je):void 0}function Ke(e,t){if("!"==t)return A(Ke);if("?"==t)return A(Ke);if(":"==e)return A(me,Oe);if("="==t)return A(U);t=M.state.lexical.prev;return T(t&&"interface"==t.info?De:Be)}function Ue(e,t){return"*"==t?(M.marked="keyword",A(Qe,q(";"))):"default"==t?(M.marked="keyword",A(K,q(";"))):"{"==e?A(le(Ve,"}"),Qe,q(";")):T(H)}function Ve(e,t){return"as"==t?(M.marked="keyword",A(q("variable"))):"variable"==e?T(U,Ve):void 0}function $e(e){return"string"==e?A():"("==e?T(K):"."==e?T(X):T(Ge,Xe,Qe)}function Ge(e,t){return"{"==e?ce(Ge,"}"):("variable"==e&&N(t),"*"==t&&(M.marked="keyword"),A(Ye))}function Xe(e){if(","==e)return A(Ge,Xe)}function Ye(e,t){if("as"==t)return M.marked="keyword",A(Ge)}function Qe(e,t){if("from"==t)return M.marked="keyword",A(K)}function Je(e){return"]"==e?A():T(le(U,"]"))}function Ze(){return T(z("form"),Me,q("{"),z("}"),le(et,"}"),W,W)}function et(){return T(Me,Oe)}function tt(e,t,n){return t.tokenize==k&&/^(?: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 W.lex=F.lex=!0,{startState:function(e){e={tokenize:k,lastType:"sof",cc:[],lexical:new _((e||0)-d,0,"block",!1),localVars:u.localVars,context:u.localVars&&new I(null,null,!1),indented:e||0};return u.globalVars&&"object"==typeof u.globalVars&&(e.globalVars=u.globalVars),e},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),C(e,t)),t.tokenize!=x&&e.eatSpace())return null;var n=t.tokenize(e,t);return"comment"==m?n:(t.lastType="operator"!=m||"++"!=g&&"--"!=g?m:"incdec",L(t,n,m,g,e))},indent:function(e,t){if(e.tokenize==x||e.tokenize==w)return nt.Pass;if(e.tokenize!=k)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==W)i=i.prev;else if(a!=Ee&&a!=F)break}for(;("stat"==i.type||"form"==i.type)&&("}"==r||(n=e.cc[e.cc.length-1])&&(n==X||n==Y)&&!/^[,\.=+\-*:?[\(]/.test(t));)i=i.prev;var s,l=(i=f&&")"==i.type&&"stat"==i.prev.type?i.prev:i).type,c=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+d:"stat"==l?i.indented+(s=t,"operator"==(l=e).lastType||","==l.lastType||v.test(s.charAt(0))||/[,.]/.test(s.charAt(0))?f||d:0):"switch"!=i.info||c||0==u.doubleIndentSwitch?i.align?i.column+(c?0:1):i.indented+(c?0:d):i.indented+(/^(?:case|default)\b/.test(t)?d:2*d)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:a?null:"/*",blockCommentEnd:a?null:"*/",blockCommentContinue:a?null:" * ",lineComment:a?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:a?"json":"javascript",jsonldMode:o,jsonMode:a,expressionAllowed:tt,skipExpression:function(e){L(e,"atom","atom","true",new nt.StringStream("",2,null))}}}),nt.registerHelper("wordChars","javascript",/[\w$]/),nt.defineMIME("text/javascript","javascript"),nt.defineMIME("text/ecmascript","javascript"),nt.defineMIME("application/javascript","javascript"),nt.defineMIME("application/x-javascript","javascript"),nt.defineMIME("application/ecmascript","javascript"),nt.defineMIME("application/json",{name:"javascript",json:!0}),nt.defineMIME("application/x-json",{name:"javascript",json:!0}),nt.defineMIME("application/manifest+json",{name:"javascript",json:!0}),nt.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),nt.defineMIME("text/typescript",{name:"javascript",typescript:!0}),nt.defineMIME("application/typescript",{name:"javascript",typescript:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(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 o,r,i=e.indentUnit,a=t.tokenHooks,s=t.documentTypes||{},l=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,k=!1!==e.highlightNonStandardPropertyKeywords;function x(e,t){return o=t,e}function w(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),o="string"}}function C(e,t){return e.next(),e.match(/^\s*[\"\')]/,!1)?t.tokenize=null:t.tokenize=w(")"),o="(",null}function S(e,t,n){this.type=e,this.indent=t,this.prev=n}function _(e,t,n,r){return e.context=new S(n,t.indentation()+(!1===r?0:i),e.context),n}function L(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function M(e,t,n){return O[n.context.type](e,t,n)}function T(e,t,n,r){for(var i=r||1;0<i;i--)n.context=n.context.prev;return M(e,t,n)}function A(e){e=e.current().toLowerCase();r=g.hasOwnProperty(e)?"atom":m.hasOwnProperty(e)?"keyword":"variable"}var O={top:function(e,t,n){if("{"==e)return _(n,t,"block");if("}"==e&&n.context.prev)return L(n);if(b&&/@component/i.test(e))return _(n,t,"atComponentBlock");if(/^@(-moz-)?document$/i.test(e))return _(n,t,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/i.test(e))return _(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 _(n,t,"at");if("hash"==e)r="builtin";else if("word"==e)r="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return _(n,t,"interpolation");if(":"==e)return"pseudo";if(v&&"("==e)return _(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):(r="error","block");n=t.current().toLowerCase();return d.hasOwnProperty(n)?(r="property","maybeprop"):f.hasOwnProperty(n)?(r=k?"string-2":"property","maybeprop"):v?(r=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(r+=" error","maybeprop")},maybeprop:function(e,t,n){return":"==e?_(n,t,"prop"):M(e,t,n)},prop:function(e,t,n){if(";"==e)return L(n);if("{"==e&&v)return _(n,t,"propBlock");if("}"==e||"{"==e)return T(e,t,n);if("("==e)return _(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 _(n,t,"interpolation")}else r+=" error";return"prop"},propBlock:function(e,t,n){return"}"==e?L(n):"word"==e?(r="property","maybeprop"):n.context.type},parens:function(e,t,n){return"{"==e||"}"==e?T(e,t,n):")"==e?L(n):"("==e?_(n,t,"parens"):"interpolation"==e?_(n,t,"interpolation"):("word"==e&&A(t),"parens")},pseudo:function(e,t,n){return"meta"==e?"pseudo":"word"==e?(r="variable-3",n.context.type):M(e,t,n)},documentTypes:function(e,t,n){return"word"==e&&s.hasOwnProperty(t.current())?(r="tag",n.context.type):O.atBlock(e,t,n)},atBlock:function(e,t,n){return"("==e?_(n,t,"atBlock_parens"):"}"==e||";"==e?T(e,t,n):"{"==e?L(n)&&_(n,t,v?"block":"top"):"interpolation"==e?_(n,t,"interpolation"):("word"==e&&(t=t.current().toLowerCase(),r="only"==t||"not"==t||"and"==t||"or"==t?"keyword":l.hasOwnProperty(t)?"attribute":c.hasOwnProperty(t)?"property":u.hasOwnProperty(t)?"keyword":d.hasOwnProperty(t)?"property":f.hasOwnProperty(t)?k?"string-2":"property":g.hasOwnProperty(t)?"atom":m.hasOwnProperty(t)?"keyword":"error"),n.context.type)},atComponentBlock:function(e,t,n){return"}"==e?T(e,t,n):"{"==e?L(n)&&_(n,t,v?"block":"top",!1):("word"==e&&(r="error"),n.context.type)},atBlock_parens:function(e,t,n){return")"==e?L(n):"{"==e||"}"==e?T(e,t,n,2):O.atBlock(e,t,n)},restricted_atBlock_before:function(e,t,n){return"{"==e?_(n,t,"restricted_atBlock"):"word"==e&&"@counter-style"==n.stateArg?(r="variable","restricted_atBlock_before"):M(e,t,n)},restricted_atBlock:function(e,t,n){return"}"==e?(n.stateArg=null,L(n)):"word"==e?(r="@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?(r="variable","keyframes"):"{"==e?_(n,t,"top"):M(e,t,n)},at:function(e,t,n){return";"==e?L(n):"{"==e||"}"==e?T(e,t,n):("word"==e?r="tag":"hash"==e&&(r="builtin"),"at")},interpolation:function(e,t,n){return"}"==e?L(n):"{"==e||";"==e?T(e,t,n):("word"==e?r="variable":"variable"!=e&&"("!=e&&")"!=e&&(r="error"),"interpolation")}};return{startState:function(e){return{tokenize:null,state:n?"block":"top",stateArg:null,context:new S(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\\\-]/),x("def",e.current())):"="==n||("~"==n||"|"==n)&&e.eat("=")?(o="compare",null):'"'==n||"'"==n?(t.tokenize=w(n),t.tokenize(e,t)):"#"==n?(e.eatWhile(/[\w\\\-]/),o="hash","atom"):"!"==n?(e.match(/^\s*\w*/),o="important","keyword"):/\d/.test(n)||"."==n&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),o="unit","number"):"-"===n?/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),o="unit","number"):e.match(/^-[\w\\\-]*/)?(e.eatWhile(/[\w\\\-]/),o=e.match(/^\s*:/,!1)?"variable-definition":"variable","variable-2"):e.match(/^\w+-/)?o="meta":void 0:/[,+>*\/]/.test(n)?(o="select-op",null):"."==n&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?o="qualifier":/[:;{}\[\]\(\)]/.test(n)?x(null,n):e.match(/^[\w-.]+(?=\()/)?(/^(url(-prefix)?|domain|regexp)$/i.test(e.current())&&(t.tokenize=C),o="variable","variable callee"):/[\w\\\-]/.test(n)?(e.eatWhile(/[\w\\\-]/),o="word","property"):o=null})(e,t);return n&&"object"==typeof n&&(o=n[1],n=n[0]),r=n,"comment"!=o&&(t.state=O[t.state](o,e,t)),r},indent:function(e,t){var n=e.context,e=t&&t.charAt(0),t=n.indent;return(n="prop"==n.type&&("}"==e||")"==e)?n.prev:n).prev&&("}"!=e||"block"!=n.type&&"top"!=n.type&&"interpolation"!=n.type&&"restricted_atBlock"!=n.type?(")"!=e||"parens"!=n.type&&"atBlock_parens"!=n.type)&&("{"!=e||"at"!=n.type&&"atBlock"!=n.type)||(t=Math.max(0,n.indent-i)):t=(n=n.prev).indent),t},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","prefers-color-scheme"],a=e(o),s=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive","dark","light"],l=e(s),c=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","all","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","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","binding","bleed","block-size","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","contain","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-content","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","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-variation-settings","font-weight","gap","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","inset","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","left","letter-spacing","line-break","line-height","line-height-step","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","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","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","rotate","rotation","rotation-point","row-gap","ruby-align","ruby-overhang","ruby-position","ruby-span","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-type","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-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-orientation","text-outline","text-overflow","text-rendering","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","touch-action","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","translate","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","writing-mode","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","paint-order","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=["accent-color","aspect-ratio","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","content-visibility","margin-block","margin-block-end","margin-block-start","margin-inline","margin-inline-end","margin-inline-start","overflow-anchor","overscroll-behavior","padding-block","padding-block-end","padding-block-start","padding-inline","padding-inline-end","padding-inline-start","scroll-snap-stop","scrollbar-3d-light-color","scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-track-color","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","shape-inside","zoom"],f=e(d),h=e(["font-display","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","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","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","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","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","slategrey","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","axis-pan","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","blur","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","brightness","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","contrast","copy","counter","counters","cover","crop","cross","crosshair","cubic-bezier","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","drop-shadow","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","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","grayscale","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","hue-rotate","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","manipulation","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","multiple_mask_images","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","pinch-zoom","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","saturate","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","sepia","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","stroke-box","sub","subpixel-antialiased","svg_masks","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","unidirectional-pan","unset","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","view-box","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),v=t.concat(r).concat(o).concat(s).concat(c).concat(d).concat(m).concat(v);function b(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",v),N.defineMIME("text/css",{documentTypes:n,mediaTypes:i,mediaFeatures:a,mediaValueKeywords:l,propertyKeywords:u,nonStandardPropertyKeywords:f,fontProperties:h,counterDescriptors:p,colorKeywords:g,valueKeywords:y,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=b)(e,t)}},name:"css"}),N.defineMIME("text/x-scss",{mediaTypes:i,mediaFeatures:a,mediaValueKeywords:l,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=b)(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:l,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=b)(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=b)(e,t)}},name:"css",helperType:"gss"})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],e):e(CodeMirror)}(function(d){"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 n={};function f(e,t){t=e.match(n[t=t]||(n[t]=new RegExp("\\s+"+t+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*")));return t?/^\s*(.*?)\s*$/.exec(t[2])[1]:""}function h(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])}d.defineMode("htmlmixed",function(s,e){var l=d.getMode(s,{name:"xml",htmlMode:!0,multilineTagIndentFactor:e.multilineTagIndentFactor,multilineTagIndentPastTag:e.multilineTagIndentPastTag,allowMissingTagName:e.allowMissingTagName}),c={},t=e&&e.tags,n=e&&e.scriptTypes;if(o(i,c),t&&o(t,c),n)for(var r=n.length-1;0<=r;r--)c.script.unshift(["type",n[r].matches,n[r].mode]);function u(e,t){var n,o,a,r=l.token(e,t.htmlState),i=/\btag\b/.test(r);return i&&!/[<>\s\/]/.test(e.current())&&(n=t.htmlState.tagName&&t.htmlState.tagName.toLowerCase())&&c.hasOwnProperty(n)?t.inTag=n+" ":t.inTag&&i&&/>$/.test(e.current())?(n=/^([\S]+) (.*)/.exec(t.inTag),t.inTag=null,i=">"==e.current()&&function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(!r[0]||r[1].test(f(t,r[0])))return r[2]}}(c[n[1]],n[2]),i=d.getMode(s,i),o=h(n[1],!0),a=h(n[1],!1),t.token=function(e,t){return e.match(o,!1)?(t.token=u,t.localState=t.localMode=null):(n=e,r=a,i=t.localMode.token(e,t.localState),e=n.current(),-1<(t=e.search(r))?n.backUp(e.length-t):e.match(/<\/?$/)&&(n.backUp(e.length),n.match(r,!1)||n.match(e)),i);var n,r,i},t.localMode=i,t.localState=d.startState(i,l.indent(t.htmlState,"",""))):t.inTag&&(t.inTag+=e.current(),e.eol()&&(t.inTag+=" ")),r}return{startState:function(){return{token:u,inTag:null,localMode:null,localState:null,htmlState:d.startState(l)}},copyState:function(e){var t;return e.localState&&(t=d.copyState(e.localMode,e.localState)),{token:e.token,inTag:e.inTag,localMode:e.localMode,localState:t,htmlState:d.copyState(l,e.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(e,t,n){return!e.localMode||/^\s*<\//.test(t)?l.indent(e.htmlState,t,n):e.localMode.indent?e.localMode.indent(e.localState,t,n):d.Pass},innerMode:function(e){return{state:e.localState||e.htmlState,mode:e.localMode||l}}}},"xml","javascript","css"),d.defineMIME("text/html","htmlmixed")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(A){"use strict";function O(e,t,n,r,i,o){this.indented=e,this.column=t,this.type=n,this.info=r,this.align=i,this.prev=o}function N(e,t,n,r){var i=e.indented;return e.context&&"statement"==e.context.type&&"statement"!=n&&(i=e.context.indented),e.context=new O(i,t,n,r,null,e.context)}function E(e){var t=e.context.type;return")"!=t&&"]"!=t&&"}"!=t||(e.indented=e.context.indented),e.context=e.context.prev}function I(e,t,n){return"variable"==t.prevToken||"type"==t.prevToken||(!!/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(e.string.slice(0,n))||(!(!t.typeAtEndOfLine||e.column()!=e.indentation())||void 0))}function P(e){for(;;){if(!e||"top"==e.type)return 1;if("}"==e.type&&"namespace"!=e.prev.info)return;e=e.prev}}function e(e){for(var t={},n=e.split(" "),r=0;r<n.length;++r)t[n[r]]=!0;return t}function R(e,t){return"function"==typeof e?e(t):e.propertyIsEnumerable(t)}A.defineMode("clike",function(e,a){var s,l,c=e.indentUnit,u=a.statementIndentUnit||c,d=a.dontAlignCalls,i=a.keywords||{},f=a.types||{},h=a.builtin||{},p=a.blockKeywords||{},m=a.defKeywords||{},g=a.atoms||{},v=a.hooks||{},y=a.multiLineStrings,o=!1!==a.indentStatements,e=!1!==a.indentSwitch,b=a.namespaceSeparator,k=a.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,x=a.numberStart||/[\d\.]/,w=a.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,C=a.isOperatorChar||/[+\-*&%=<>!?|\/]/,S=a.isIdentifierChar||/[\w\$_\xa1-\uffff]/,_=a.isReservedIdentifier||!1;function L(e,t){var o,n=e.next();if(v[n]){var r=v[n](e,t);if(!1!==r)return r}if('"'==n||"'"==n)return t.tokenize=(o=n,function(e,t){for(var n,r=!1,i=!1;null!=(n=e.next());){if(n==o&&!r){i=!0;break}r=!r&&"\\"==n}return!i&&(r||y)||(t.tokenize=null),"string"}),t.tokenize(e,t);if(x.test(n)){if(e.backUp(1),e.match(w))return"number";e.next()}if(k.test(n))return s=n,null;if("/"==n){if(e.eat("*"))return(t.tokenize=M)(e,t);if(e.eat("/"))return e.skipToEnd(),"comment"}if(C.test(n)){for(;!e.match(/^\/[\/*]/,!1)&&e.eat(C););return"operator"}if(e.eatWhile(S),b)for(;e.match(b);)e.eatWhile(S);n=e.current();return R(i,n)?(R(p,n)&&(s="newstatement"),R(m,n)&&(l=!0),"keyword"):R(f,n)?"type":R(h,n)||_&&_(n)?(R(p,n)&&(s="newstatement"),"builtin"):R(g,n)?"atom":"variable"}function M(e,t){for(var n,r=!1;n=e.next();){if("/"==n&&r){t.tokenize=null;break}r="*"==n}return"comment"}function T(e,t){a.typeFirstDefinitions&&e.eol()&&P(t.context)&&(t.typeAtEndOfLine=I(e,t,e.pos))}return{startState:function(e){return{tokenize:null,context:new O((e||0)-c,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(e,t){var n=t.context;if(e.sol()&&(null==n.align&&(n.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return T(e,t),null;s=l=null;var r,i=(t.tokenize||L)(e,t);if("comment"==i||"meta"==i)return i;if(null==n.align&&(n.align=!0),";"==s||":"==s||","==s&&e.match(/^\s*(?:\/\/.*)?$/,!1))for(;"statement"==t.context.type;)E(t);else if("{"==s)N(t,e.column(),"}");else if("["==s)N(t,e.column(),"]");else if("("==s)N(t,e.column(),")");else if("}"==s){for(;"statement"==n.type;)n=E(t);for("}"==n.type&&(n=E(t));"statement"==n.type;)n=E(t)}else s==n.type?E(t):o&&(("}"==n.type||"top"==n.type)&&";"!=s||"statement"==n.type&&"newstatement"==s)&&N(t,e.column(),"statement",e.current());return"variable"==i&&("def"==t.prevToken||a.typeFirstDefinitions&&I(e,t,e.start)&&P(t.context)&&e.match(/^\s*\(/,!1))&&(i="def"),!v.token||void 0!==(r=v.token(e,t,i))&&(i=r),"def"==i&&!1===a.styleDefs&&(i="variable"),t.startOfLine=!1,t.prevToken=l?"def":i||s,T(e,t),i},indent:function(e,t){if(e.tokenize!=L&&null!=e.tokenize||e.typeAtEndOfLine)return A.Pass;var n=e.context,r=t&&t.charAt(0),i=r==n.type;if("statement"==n.type&&"}"==r&&(n=n.prev),a.dontIndentStatements)for(;"statement"==n.type&&a.dontIndentStatements.test(n.info);)n=n.prev;if(v.indent){var o=v.indent(e,n,t,c);if("number"==typeof o)return o}o=n.prev&&"switch"==n.prev.info;if(a.allmanIndentation&&/[{(]/.test(r)){for(;"top"!=n.type&&"}"!=n.type;)n=n.prev;return n.indented}return"statement"==n.type?n.indented+("{"==r?0:u):!n.align||d&&")"==n.type?")"!=n.type||i?n.indented+(i?0:c)+(i||!o||/^(?:case|default)\b/.test(t)?0:c):n.indented+u:n.column+(i?0:1)},electricInput:e?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:"//",fold:"brace"}});var t="auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile inline restrict asm fortran",n="alignas alignof and and_eq audit axiom bitand bitor catch class compl concept constexpr const_cast decltype delete dynamic_cast explicit export final friend import module mutable namespace new noexcept not not_eq operator or or_eq override private protected public reinterpret_cast requires static_assert static_cast template this thread_local throw try typeid typename using virtual xor xor_eq",r="bycopy byref in inout oneway out self super atomic nonatomic retain copy readwrite readonly strong weak assign typeof nullable nonnull null_resettable _cmd @interface @implementation @end @protocol @encode @property @synthesize @dynamic @class @public @package @private @protected @required @optional @try @catch @finally @import @selector @encode @defs @synchronized @autoreleasepool @compatibility_alias @available",i="FOUNDATION_EXPORT FOUNDATION_EXTERN NS_INLINE NS_FORMAT_FUNCTION NS_RETURNS_RETAINEDNS_ERROR_ENUM NS_RETURNS_NOT_RETAINED NS_RETURNS_INNER_POINTER NS_DESIGNATED_INITIALIZER NS_ENUM NS_OPTIONS NS_REQUIRES_NIL_TERMINATION NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END NS_SWIFT_NAME NS_REFINED_FOR_SWIFT",o=e("int long char short double float unsigned signed void bool"),a=e("SEL instancetype id Class Protocol BOOL");function s(e){return R(o,e)||/.+_t$/.test(e)}function l(e){return s(e)||R(a,e)}var c="case do else for if switch while struct enum union",u="struct enum union";function d(e,t){if(!t.startOfLine)return!1;for(var n,r=null;n=e.peek();){if("\\"==n&&e.match(/^.$/)){r=d;break}if("/"==n&&e.match(/^\/[\/\*]/,!1))break;e.next()}return t.tokenize=r,"meta"}function f(e,t){return"type"==t.prevToken&&"type"}function h(e){return!(!e||e.length<2)&&("_"==e[0]&&("_"==e[1]||e[1]!==e[1].toLowerCase()))}function p(e){return e.eatWhile(/[\w\.']/),"number"}function m(e,t){if(e.backUp(1),e.match(/^(?:R|u8R|uR|UR|LR)/)){var n=e.match(/^"([^\s\\()]{0,16})\(/);return n?(t.cpp11RawStringDelim=n[1],(t.tokenize=y)(e,t)):!1}return e.match(/^(?:u8|u|U|L)/)?!!e.match(/^["']/,!1)&&"string":(e.next(),!1)}function g(e){e=/(\w+)::~?(\w+)$/.exec(e);return e&&e[1]==e[2]}function v(e,t){for(var n;null!=(n=e.next());)if('"'==n&&!e.eat('"')){t.tokenize=null;break}return"string"}function y(e,t){var n=t.cpp11RawStringDelim.replace(/[^\w\s]/g,"\\$&");return e.match(new RegExp(".*?\\)"+n+'"'))?t.tokenize=null:e.skipToEnd(),"string"}function b(e,t){"string"==typeof e&&(e=[e]);var n=[];function r(e){if(e)for(var t in e)e.hasOwnProperty(t)&&n.push(t)}r(t.keywords),r(t.types),r(t.builtin),r(t.atoms),n.length&&(t.helperType=e[0],A.registerHelper("hintWords",e[0],n));for(var i=0;i<e.length;++i)A.defineMIME(e[i],t)}function k(e,t){for(var n=!1;!e.eol();){if(!n&&e.match('"""')){t.tokenize=null;break}n="\\"==e.next()&&!n}return"string"}function x(r){return function(e,t){for(var n;n=e.next();){if("*"==n&&e.eat("/")){if(1!=r)return t.tokenize=x(r-1),t.tokenize(e,t);t.tokenize=null;break}if("/"==n&&e.eat("*"))return t.tokenize=x(r+1),t.tokenize(e,t)}return"comment"}}b(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:e(t),types:s,blockKeywords:e(c),defKeywords:e(u),typeFirstDefinitions:!0,atoms:e("NULL true false"),isReservedIdentifier:h,hooks:{"#":d,"*":f},modeProps:{fold:["brace","include"]}}),b(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:e(t+" "+n),types:s,blockKeywords:e(c+" class try catch"),defKeywords:e(u+" class namespace"),typeFirstDefinitions:!0,atoms:e("true false NULL nullptr"),dontIndentStatements:/^template$/,isIdentifierChar:/[\w\$_~\xa1-\uffff]/,isReservedIdentifier:h,hooks:{"#":d,"*":f,u:m,U:m,L:m,R:m,0:p,1:p,2:p,3:p,4:p,5:p,6:p,7:p,8:p,9:p,token:function(e,t,n){if("variable"==n&&"("==e.peek()&&(";"==t.prevToken||null==t.prevToken||"}"==t.prevToken)&&g(e.current()))return"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),b("text/x-java",{name:"clike",keywords:e("abstract assert break case catch class const continue default do else enum extends final finally for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while @interface"),types:e("var byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:e("catch class do else finally for if switch try while"),defKeywords:e("class interface enum @interface"),typeFirstDefinitions:!0,atoms:e("true false null"),number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,hooks:{"@":function(e){return!e.match("interface",!1)&&(e.eatWhile(/[\w\$_]/),"meta")}},modeProps:{fold:["brace","import"]}}),b("text/x-csharp",{name:"clike",keywords:e("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:e("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:e("catch class do else finally for foreach if struct switch try while"),defKeywords:e("class interface namespace struct var"),typeFirstDefinitions:!0,atoms:e("true false null"),hooks:{"@":function(e,t){return e.eat('"')?(t.tokenize=v)(e,t):(e.eatWhile(/[\w\$_]/),"meta")}}}),b("text/x-scala",{name:"clike",keywords:e("abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble"),types:e("AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:e("catch class enum do else finally for forSome if match switch try while"),defKeywords:e("class enum def object package trait type val var"),atoms:e("true false null"),indentStatements:!1,indentSwitch:!1,isOperatorChar:/[+\-*&%=<>!?|\/#:@]/,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return!!e.match('""')&&(t.tokenize=k,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},"=":function(e,t){var n=t.context;return!("}"!=n.type||!n.align||!e.eat(">"))&&(t.context=new O(n.indented,n.column,n.type,n.info,null,n.prev),"operator")},"/":function(e,t){return!!e.eat("*")&&(t.tokenize=x(1),t.tokenize(e,t))}},modeProps:{closeBrackets:{pairs:'()[]{}""',triples:'"'}}}),b("text/x-kotlin",{name:"clike",keywords:e("package as typealias class interface this super val operator var fun for is in This throw return annotation break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix suspend actual expect setparam value"),types:e("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void Annotation Any BooleanArray ByteArray Char CharArray DeprecationLevel DoubleArray Enum FloatArray Function Int IntArray Lazy LazyThreadSafetyMode LongArray Nothing ShortArray Unit"),intendSwitch:!1,indentStatements:!1,multiLineStrings:!0,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+(\.\d+)?|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,blockKeywords:e("catch class do else finally for if where try while enum"),defKeywords:e("class val var object interface fun"),atoms:e("true false null this"),hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},"*":function(e,t){return"."==t.prevToken?"variable":"operator"},'"':function(e,t){var o;return t.tokenize=(o=e.match('""'),function(e,t){for(var n,r=!1,i=!1;!e.eol();){if(!o&&!r&&e.match('"')){i=!0;break}if(o&&e.match('"""')){i=!0;break}n=e.next(),!r&&"$"==n&&e.match("{")&&e.skipTo("}"),r=!r&&"\\"==n&&!o}return!i&&o||(t.tokenize=null),"string"}),t.tokenize(e,t)},"/":function(e,t){return!!e.eat("*")&&(t.tokenize=x(1),t.tokenize(e,t))},indent:function(e,t,n,r){var i=n&&n.charAt(0);return"}"!=e.prevToken&&")"!=e.prevToken||""!=n?"operator"==e.prevToken&&"}"!=n&&"}"!=e.context.type||"variable"==e.prevToken&&"."==i||("}"==e.prevToken||")"==e.prevToken)&&"."==i?2*r+t.indented:t.align&&"}"==t.type?t.indented+(e.context.type==(n||"").charAt(0)?0:r):void 0:e.indented}},modeProps:{closeBrackets:{triples:'"'}}}),b(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:e("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:e("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:e("for while do if else struct"),builtin:e("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:e("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TextureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":d},modeProps:{fold:["brace","include"]}}),b("text/x-nesc",{name:"clike",keywords:e(t+" as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:s,blockKeywords:e(c),atoms:e("null true false"),hooks:{"#":d},modeProps:{fold:["brace","include"]}}),b("text/x-objectivec",{name:"clike",keywords:e(t+" "+r),types:l,builtin:e(i),blockKeywords:e(c+" @synthesize @try @catch @finally @autoreleasepool @synchronized"),defKeywords:e(u+" @interface @implementation @protocol @class"),dontIndentStatements:/^@.*$/,typeFirstDefinitions:!0,atoms:e("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:h,hooks:{"#":d,"*":f},modeProps:{fold:["brace","include"]}}),b("text/x-objectivec++",{name:"clike",keywords:e(t+" "+r+" "+n),types:l,builtin:e(i),blockKeywords:e(c+" @synthesize @try @catch @finally @autoreleasepool @synchronized class try catch"),defKeywords:e(u+" @interface @implementation @protocol @class class namespace"),dontIndentStatements:/^@.*$|^template$/,typeFirstDefinitions:!0,atoms:e("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:h,hooks:{"#":d,"*":f,u:m,U:m,L:m,R:m,0:p,1:p,2:p,3:p,4:p,5:p,6:p,7:p,8:p,9:p,token:function(e,t,n){if("variable"==n&&"("==e.peek()&&(";"==t.prevToken||null==t.prevToken||"}"==t.prevToken)&&g(e.current()))return"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),b("text/x-squirrel",{name:"clike",keywords:e("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:s,blockKeywords:e("case catch class else for foreach if switch try while"),defKeywords:e("function local class"),typeFirstDefinitions:!0,atoms:e("true false null"),hooks:{"#":d},modeProps:{fold:["brace","include"]}});var w=null;b("text/x-ceylon",{name:"clike",keywords:e("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(e){e=e.charAt(0);return e===e.toUpperCase()&&e!==e.toLowerCase()},blockKeywords:e("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:e("class dynamic function interface module object package value"),builtin:e("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:e("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return t.tokenize=function o(a){return function(e,t){for(var n,r=!1,i=!1;!e.eol();){if(!r&&e.match('"')&&("single"==a||e.match('""'))){i=!0;break}if(!r&&e.match("``")){w=o(a),i=!0;break}n=e.next(),r="single"==a&&!r&&"\\"==n}return i&&(t.tokenize=null),"string"}}(e.match('""')?"triple":"single"),t.tokenize(e,t)},"`":function(e,t){return!(!w||!e.match("`"))&&(t.tokenize=w,w=null,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(e,t,n){if(("variable"==n||"type"==n)&&"."==t.prevToken)return"variable-2"}},modeProps:{fold:["brace","import"],closeBrackets:{triples:'"'}}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../clike/clike")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../clike/clike"],e):e(CodeMirror)}(function(l){"use strict";function e(e){for(var t={},n=e.split(" "),r=0;r<n.length;++r)t[n[r]]=!0;return t}function s(i,o,a){return 0==i.length?c(o):function(e,t){for(var n=i[0],r=0;r<n.length;r++)if(e.match(n[r][0]))return t.tokenize=s(i.slice(1),o),n[r][1];return t.tokenize=c(o,a),"string"}}function c(n,r){return function(e,t){return function(e,t,n,r){if(!1!==r&&e.match("${",!1)||e.match("{$",!1))return t.tokenize=null,"string";if(!1!==r&&e.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/))return e.match("[",!1)&&(t.tokenize=s([[["[",null]],[[/\d[\w\.]*/,"number"],[/\$[a-zA-Z_][a-zA-Z0-9_]*/,"variable-2"],[/[\w\$]+/,"variable"]],[["]",null]]],n,r)),e.match(/^->\w/,!1)&&(t.tokenize=s([[["->",null]],[[/[\w]+/,"variable"]]],n,r)),"variable-2";var i=!1;for(;!e.eol()&&(i||!1===r||!e.match("{$",!1)&&!e.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/,!1));){if(!i&&e.match(n)){t.tokenize=null,t.tokStack.pop(),t.tokStack.pop();break}i="\\"==e.next()&&!i}return"string"}(e,t,n,r)}}var t="abstract and array as break case catch class clone const continue declare default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach function global goto if implements interface instanceof namespace new or private protected public static switch throw trait try use var while xor die echo empty exit eval include include_once isset list require require_once return print unset __halt_compiler self static parent yield insteadof finally",n="true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__",r="func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage memory_get_peak_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents file_put_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists array_intersect_key array_combine array_column pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count";l.registerHelper("hintWords","php",[t,n,r].join(" ").split(" ")),l.registerHelper("wordChars","php",/[\w$]/);var i={name:"clike",helperType:"php",keywords:e(t),blockKeywords:e("catch do else elseif for foreach if switch try while finally"),defKeywords:e("class function interface namespace trait"),atoms:e(n),builtin:e(r),multiLineStrings:!0,hooks:{$:function(e){return e.eatWhile(/[\w\$_]/),"variable-2"},"<":function(e,t){if(r=e.match(/^<<\s*/)){var n=e.eat(/['"]/);e.eatWhile(/[\w\.]/);var r=e.current().slice(r[0].length+(n?2:1));if(n&&e.eat(n),r)return(t.tokStack||(t.tokStack=[])).push(r,0),t.tokenize=c(r,"'"!=n),"string"}return!1},"#":function(e){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"},"/":function(e){if(e.eat("/")){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"}return!1},'"':function(e,t){return(t.tokStack||(t.tokStack=[])).push('"',0),t.tokenize=c('"'),"string"},"{":function(e,t){return t.tokStack&&t.tokStack.length&&t.tokStack[t.tokStack.length-1]++,!1},"}":function(e,t){return t.tokStack&&0<t.tokStack.length&&!--t.tokStack[t.tokStack.length-1]&&(t.tokenize=c(t.tokStack[t.tokStack.length-2])),!1}}};l.defineMode("php",function(e,n){var a=l.getMode(e,n&&n.htmlMode||"text/html"),s=l.getMode(e,i);return{startState:function(){var e=l.startState(a),t=n.startOpen?l.startState(s):null;return{html:e,php:t,curMode:n.startOpen?s:a,curState:n.startOpen?t:e,pending:null}},copyState:function(e){var t=e.html,n=l.copyState(a,t),r=e.php,t=r&&l.copyState(s,r),r=e.curMode==a?n:t;return{html:n,php:t,curMode:e.curMode,curState:r,pending:e.pending}},token:function(e,t){var n=t.curMode==s;if(e.sol()&&t.pending&&'"'!=t.pending&&"'"!=t.pending&&(t.pending=null),n)return null==t.php.tokenize&&e.match("?>")?(t.curMode=a,t.curState=t.html,t.php.context.prev||(t.php=null),"meta"):s.token(e,t.curState);if(e.match(/^<\?\w*/))return t.curMode=s,t.php||(t.php=l.startState(s,a.indent(t.html,"",""))),t.curState=t.php,"meta";if('"'==t.pending||"'"==t.pending){for(;!e.eol()&&e.next()!=t.pending;);var r="string"}else r=t.pending&&e.pos<t.pending.end?(e.pos=t.pending.end,t.pending.style):a.token(e,t.curState);t.pending&&(t.pending=null);var i,o=e.current();return-1!=(n=o.search(/<\?/))&&("string"==r&&(i=o.match(/[\'\"]$/))&&!/\?>/.test(o)?t.pending=i[0]:t.pending={end:e.pos,style:r},e.backUp(o.length-n)),r},indent:function(e,t,n){return e.curMode!=s&&/^\s*<\//.test(t)||e.curMode==s&&/^\?>/.test(t)?a.indent(e.html,t,n):e.curMode.indent(e.curState,t,n)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",innerMode:function(e){return{state:e.curState,mode:e.curMode}}}},"htmlmixed","clike"),l.defineMIME("application/x-httpd-php","php"),l.defineMIME("application/x-httpd-php-open",{name:"php",startOpen:!0}),l.defineMIME("text/x-php",i)}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var C={allowUnquoted:!0,allowMissing:!0,caseFold:!0};e.defineMode("shortcode",function(e,t){var n,r,o,a,s=e.indentUnit,l={},i=C;for(n in i)l[n]=i[n];for(r in t)l[r]=t[r];function c(e,t){return"["===e.next()?"["===e.peek()?(t.tokenize=u,"comment"):/\s/.test(e.peek())?null:(o=e.eat("/")?"closeTag":"openTag",t.tokenize=d,"tag bracket"):(e.eatWhile(/[^\[]/),null)}function u(e,t){function n(e,t){return e.next(),t.tokenize=c,"comment"}return n.isInEscape=!0,"]"===e.next()&&"]"===e.peek()&&(t.tokenize=n),e.eatWhile(/[^\]]/),null}function d(e,t){var n=e.next();if("]"===n||"/"===n&&e.eat("]"))return t.tokenize=c,o="endTag","tag bracket";if("="===n)return o="equals",null;if("["!==n)return/[\'\"]/.test(n)?(t.tokenize=(r=n,i.isInAttribute=!0,i),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=\[\]\"\']*[^\s\u00a0=\[\]\"\'\/]/),"word");t.tokenize=c,t.state=p,t.tagName=t.tagStart=null;var r,t=t.tokenize(e,t);return t?t+" tag error":"tag error";function i(e,t){var n=e.next();return n===r?(t.tokenize=d,"string"):/[\[\]]/.test(n)?"string error":(e.eatWhile(/[^\[\]\'\"]/),"string")}}function f(e,t,n){this.tagHistory=[t],e.context&&(this.tagHistory=this.tagHistory.concat(e.context.tagHistory)),this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=n}function h(e){e.context&&(e.context=e.context.prev)}function p(e,t,n){return"openTag"===e?(n.tagStart=t.column(),m):"closeTag"===e?g:p}function m(e,t,n){if("word"!==e)return a="error",m;e=t.current();return a=/[\[\]\/\'\"<>&]/.test(e)?"error":(n.tagName=t.current(),"tag"),b}function g(e,t,n){if("word"!==e)return a="error",y;t=t.current();if(n.context&&n.context.tagName===t||!1===l.matchClosing)return a="tag",v;if(n.context&&0<n.context.tagHistory.indexOf(t)){for(var r=n.context.tagHistory.indexOf(t),i=0;i<r;i++)h(n);return a="tag",v}return a="tag error",y}function v(e,t,n){return"endTag"!==e?(a="error",v):(h(n),p)}function y(e,t,n){return a="error",v(e,0,n)}function b(e,t,n){if("word"===e)return a=/^[a-z0-9_\-]+$/i.test(t.current())?"attribute":"error",k;if("endTag"!==e)return a="error",b;t=n.tagName,e=n.tagStart;return n.tagName=n.tagStart=null,n.context=new f(n,t,e===n.indented),p}function k(e,t,n){return"equals"===e?x:(l.allowMissing||(a="error"),b(e,t,n))}function x(e,t,n){return"string"===e?w:"word"===e&&l.allowUnquoted?(a="string",b):(a="error",b(e,t,n))}function w(e,t,n){return"string"===e?w:b(e,t,n)}return u.isInEscape=c.isInText=!0,{startState:function(e){var t={tokenize:c,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;o=null;var n=t.tokenize(e,t);return(n||o)&&"comment"!==n&&(a=null,t.state=t.state(o||n,e,t),a&&(n="error"===a?n+" error":a)),n},indent:function(e,t,n){var r=e.context;if(e.tokenize.isInAttribute)return e.tagStart===e.indented?e.stringStartCol+1:e.indented+s;if(e.tokenize!==d&&e.tokenize!==c)return n?n.match(/^(\s*)/)[0].length:0;if(e.tagName)return!1!==l.multilineTagIndentPastTag?e.tagStart+e.tagName.length+2:e.tagStart+s*(l.multilineTagIndentFactor||1);var i=t&&/^\[(\/)?([\w_:\.-]*)/.exec(t);if(i&&i[1])for(;r&&r.tagName===i[2];){r=r.prev;break}for(;r&&r.prev&&!r.startOfLine;)r=r.prev;return r?r.indent+s:e.baseIndent||0},skipAttribute:function(e){e.state===x&&(e.state=b)}}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],e):e(CodeMirror)}(function(n){"use strict";n.defineMode("wordpresspost",function(e,t){var a=n.getMode(e,{name:"htmlmixed",multilineTagIndentFactor:t.multilineTagIndentFactor,multilineTagIndentPastTag:t.multilineTagIndentPastTag}),s=n.getMode(e,{name:"shortcode",multilineTagIndentFactor:t.multilineTagIndentFactor,multilineTagIndentPastTag:t.multilineTagIndentPastTag});function l(e,t){t.isInShortcode=!0;var n=s.token(e,t.shortcodeState),r=t.shortcodeState.tokenize.isInText,i=t.shortcodeState.tokenize.isInEscape;return r?t.token=o:i&&/\]/.test(e.current())&&(i=(r=e.current()).search(/\]/),e.backUp(r.length-i-1),"]"!==e.peek()&&(t.token=o)),n}function o(e,t){t.isInShortcode=!1;var n,r,i=a.token(e,t.htmlmixedState),o=t.htmlmixedState.htmlState.tokenize.isInText;return o&&/\[/.test(e.current())&&!t.htmlmixedState.localState&&null===i?(r=(n=e.current()).search(/\[/),e.backUp(n.length-r),null==t.shortcodeState&&(t.shortcodeState=s.startState(a.indent(t.htmlmixedState,""))),t.token=l):o&&/<!\-\-more|<!\-\-(noteaser|nextpage)\-\->?/.test(e.current())&&!t.htmlmixedState.localState&&"comment"===i&&(e.backUp(e.current().length),t.token=c),i}function c(e,t){return e.match("\x3c!--more")?"meta":e.match("--\x3e")||e.match("\x3c!--noteaser--\x3e")||e.match("\x3c!--nextpage--\x3e")?(t.token=o,"meta"):(e.eatWhile(/[^\-/]/),"string")}return{startState:function(){return{token:o,isInShortcode:!1,shortcodeState:null,htmlmixedState:a.startState()}},copyState:function(e){var t;return e.shortcodeState&&(t=n.copyState(s,e.shortcodeState)),{token:e.token,shortcodeState:t,htmlmixedState:n.copyState(a,e.htmlmixedState)}},token:function(e,t){return t.token(e,t)},indent:function(e,t){return e.isInShortcode?e.isInShortcode?s.indent(e.shortcodeState,t):n.Pass:a.indent(e.htmlmixedState,t)},innerMode:function(e){return e.isInShortcode?{state:e.shortcodeState,mode:s}:{state:e.htmlmixedState,mode:a}}}},"htmlmixed","shortcode")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(r){"use strict";var a="CodeMirror-activeline",s="CodeMirror-activeline-background",l="CodeMirror-activeline-gutter";function c(e){for(var t=0;t<e.state.activeLines.length;t++)e.removeLineClass(e.state.activeLines[t],"wrap",a),e.removeLineClass(e.state.activeLines[t],"background",s),e.removeLineClass(e.state.activeLines[t],"gutter",l)}function i(t,e){for(var n=[],r=0;r<e.length;r++){var i=e[r],o=t.getOption("styleActiveLine");("object"==typeof o&&o.nonEmpty?i.anchor.line==i.head.line:i.empty())&&(i=t.getLineHandleVisualStart(i.head.line),n[n.length-1]!=i&&n.push(i))}!function(e,t){if(e.length==t.length){for(var n=0;n<e.length;n++)if(e[n]!=t[n])return;return 1}}(t.state.activeLines,n)&&t.operation(function(){c(t);for(var e=0;e<n.length;e++)t.addLineClass(n[e],"wrap",a),t.addLineClass(n[e],"background",s),t.addLineClass(n[e],"gutter",l);t.state.activeLines=n})}function o(e,t){i(e,t.ranges)}r.defineOption("styleActiveLine",!1,function(e,t,n){n=n!=r.Init&&n;t!=n&&(n&&(e.off("beforeSelectionChange",o),c(e),delete e.state.activeLines),t&&(e.state.activeLines=[],i(e,e.listSelections()),e.on("beforeSelectionChange",o)))})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(i){"use strict";var g,v,y=i.Pos;function p(e,t){for(var n,r,n=null!=(r=(n=e).flags)?r:(n.ignoreCase?"i":"")+(n.global?"g":"")+(n.multiline?"m":""),i=n,o=0;o<t.length;o++)-1==i.indexOf(t.charAt(o))&&(i+=t.charAt(o));return n==i?e:new RegExp(e.source,i)}function m(e){return/\\s|\\n|\n|\\W|\\D|\[\^/.test(e.source)}function h(e,t,n){t=p(t,"g");for(var r=n.line,i=n.ch,o=e.lastLine();r<=o;r++,i=0){t.lastIndex=i;var a=e.getLine(r),a=t.exec(a);if(a)return{from:y(r,a.index),to:y(r,a.index+a[0].length),match:a}}}function o(e,t,n){if(!m(t))return h(e,t,n);t=p(t,"gm");for(var r=1,i=n.line,o=e.lastLine();i<=o;){for(var a=0;a<r&&!(o<i);a++)var s=e.getLine(i++),l=null==l?s:l+"\n"+s;r*=2,t.lastIndex=n.ch;var c=t.exec(l);if(c){var u=l.slice(0,c.index).split("\n"),d=c[0].split("\n"),f=n.line+u.length-1,u=u[u.length-1].length;return{from:y(f,u),to:y(f+d.length-1,1==d.length?u+d[0].length:d[d.length-1].length),match:c}}}}function b(e,t,n){for(var r,i=0;i<=e.length;){t.lastIndex=i;var o=t.exec(e);if(!o)break;var a=o.index+o[0].length;if(a>e.length-n)break;(!r||a>r.index+r[0].length)&&(r=o),i=o.index+1}return r}function k(e,t,n){t=p(t,"g");for(var r=n.line,i=n.ch,o=e.firstLine();o<=r;r--,i=-1){var a=e.getLine(r),a=b(a,t,i<0?0:a.length-i);if(a)return{from:y(r,a.index),to:y(r,a.index+a[0].length),match:a}}}function a(e,t,n){if(!m(t))return k(e,t,n);t=p(t,"gm");for(var r=1,i=e.getLine(n.line).length-n.ch,o=n.line,a=e.firstLine();a<=o;){for(var s=0;s<r&&a<=o;s++)var l=e.getLine(o--),c=null==c?l:l+"\n"+c;r*=2;var u=b(c,t,i);if(u){var d=c.slice(0,u.index).split("\n"),f=u[0].split("\n"),h=o+d.length,d=d[d.length-1].length;return{from:y(h,d),to:y(h+f.length-1,1==f.length?d+f[0].length:f[f.length-1].length),match:u}}}}function x(e,t,n,r){if(e.length==t.length)return n;for(var i=0,o=n+Math.max(0,e.length-t.length);;){if(i==o)return i;var a=i+o>>1,s=r(e.slice(0,a)).length;if(s==n)return a;n<s?o=a:i=1+a}}function s(e,t,n,r){if(!t.length)return null;var i=r?g:v,o=i(t).split(/\r|\n\r?/);e:for(var a=n.line,s=n.ch,l=e.lastLine()+1-o.length;a<=l;a++,s=0){var c=e.getLine(a).slice(s),u=i(c);if(1==o.length){var d=u.indexOf(o[0]);if(-1!=d){n=x(c,u,d,i)+s;return{from:y(a,x(c,u,d,i)+s),to:y(a,x(c,u,d+o[0].length,i)+s)}}}else{var f=u.length-o[0].length;if(u.slice(f)==o[0]){for(var h=1;h<o.length-1;h++)if(i(e.getLine(a+h))!=o[h])continue e;var p=e.getLine(a+o.length-1),m=i(p),d=o[o.length-1];if(m.slice(0,d.length)==d)return{from:y(a,x(c,u,f,i)+s),to:y(a+o.length-1,x(p,m,d.length,i))}}}}}function l(e,t,n,r){if(!t.length)return null;var i=r?g:v,o=i(t).split(/\r|\n\r?/);e:for(var a=n.line,s=n.ch,l=e.firstLine()-1+o.length;l<=a;a--,s=-1){var c=e.getLine(a),u=i(c=-1<s?c.slice(0,s):c);if(1==o.length){var d=u.lastIndexOf(o[0]);if(-1!=d)return{from:y(a,x(c,u,d,i)),to:y(a,x(c,u,d+o[0].length,i))}}else{var f=o[o.length-1];if(u.slice(0,f.length)==f){for(var h=1,n=a-o.length+1;h<o.length-1;h++)if(i(e.getLine(n+h))!=o[h])continue e;var p=e.getLine(a+1-o.length),d=i(p);if(d.slice(d.length-o[0].length)==o[0])return{from:y(a+1-o.length,x(p,d,p.length-o[0].length,i)),to:y(a,x(c,u,f.length,i))}}}}}function r(n,r,e,t){var i;this.atOccurrence=!1,this.doc=n,e=e?n.clipPos(e):y(0,0),this.pos={from:e,to:e},"object"==typeof t?i=t.caseFold:(i=t,t=null),"string"==typeof r?(null==i&&(i=!1),this.matches=function(e,t){return(e?l:s)(n,r,t,i)}):(r=p(r,"gm"),t&&!1===t.multiline?this.matches=function(e,t){return(e?k:h)(n,r,t)}:this.matches=function(e,t){return(e?a:o)(n,r,t)})}v=String.prototype.normalize?(g=function(e){return e.normalize("NFD").toLowerCase()},function(e){return e.normalize("NFD")}):(g=function(e){return e.toLowerCase()},function(e){return e}),r.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){for(var t=this.matches(e,this.doc.clipPos(e?this.pos.from:this.pos.to));t&&0==i.cmpPos(t.from,t.to);)e?t.from.ch?t.from=y(t.from.line,t.from.ch-1):t=t.from.line==this.doc.firstLine()?null:this.matches(e,this.doc.clipPos(y(t.from.line-1))):t.to.ch<this.doc.getLine(t.to.line).length?t.to=y(t.to.line,t.to.ch+1):t=t.to.line==this.doc.lastLine()?null:this.matches(e,y(t.to.line+1,0));if(t)return this.pos=t,this.atOccurrence=!0,this.pos.match||!0;var n=y(e?this.doc.firstLine():this.doc.lastLine()+1,0);return this.pos={from:n,to:n},this.atOccurrence=!1},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(e,t){this.atOccurrence&&(e=i.splitLines(e),this.doc.replaceRange(e,this.pos.from,this.pos.to,t),this.pos.to=y(this.pos.from.line+e.length-1,e[e.length-1].length+(1==e.length?this.pos.from.ch:0)))}},i.defineExtension("getSearchCursor",function(e,t,n){return new r(this.doc,e,t,n)}),i.defineDocExtension("getSearchCursor",function(e,t,n){return new r(this,e,t,n)}),i.defineExtension("selectMatches",function(e,t){for(var n=[],r=this.getSearchCursor(e,this.getCursor("from"),t);r.findNext()&&!(0<i.cmpPos(r.to(),this.getCursor("to")));)n.push({anchor:r.from(),head:r.to()});n.length&&this.setSelections(n,0)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],e):e(CodeMirror)}(function(d){"use strict";function t(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null}function f(e){return e.state.search||(e.state.search=new t)}function i(e){return"string"==typeof e&&e==e.toLowerCase()}function h(e,t,n){return e.getSearchCursor(t,n,{caseFold:i(t),multiline:!0})}function p(e,t,n,r,i){e.openDialog?e.openDialog(t,i,{value:r,selectValueOnOpen:!0,bottom:e.options.search.bottom}):i(prompt(n,r))}function m(e){return e.replace(/\\([nrt\\])/g,function(e,t){return"n"==t?"\n":"r"==t?"\r":"t"==t?"\t":"\\"==t?"\\":e})}function o(e){var t=e.match(/^\/(.*)\/([a-z]*)$/);if(t)try{e=new RegExp(t[1],-1==t[2].indexOf("i")?"":"i")}catch(e){}else e=m(e);return e=("string"==typeof e?""==e:e.test(""))?/x^/:e}function g(e,t,n){var r;t.queryText=n,t.query=o(n),e.removeOverlay(t.overlay,i(t.query)),t.overlay=(r=t.query,n=i(t.query),"string"==typeof r?r=new RegExp(r.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),n?"gi":"g"):r.global||(r=new RegExp(r.source,r.ignoreCase?"gi":"g")),{token:function(e){r.lastIndex=e.pos;var t=r.exec(e.string);if(t&&t.index==e.pos)return e.pos+=t[0].length||1,"searching";t?e.pos=t.index:e.skipToEnd()}}),e.addOverlay(t.overlay),e.showMatchesOnScrollbar&&(t.annotate&&(t.annotate.clear(),t.annotate=null),t.annotate=e.showMatchesOnScrollbar(t.query,i(t.query)))}function n(i,t,e,n){var r=f(i);if(r.query)return v(i,t);var o,a,s,l,c,u=i.getSelection()||r.lastQuery;u instanceof RegExp&&"x^"==u.source&&(u=null),e&&i.openDialog?(o=null,a=function(e,t){d.e_stop(t),e&&(e!=r.queryText&&(g(i,r,e),r.posFrom=r.posTo=i.getCursor()),o&&(o.style.opacity=1),v(i,t.shiftKey,function(e,t){var n;t.line<3&&document.querySelector&&(n=i.display.wrapper.querySelector(".CodeMirror-dialog"))&&n.getBoundingClientRect().bottom-4>i.cursorCoords(t,"window").top&&((o=n).style.opacity=.4)}))},l=k(s=i),c=u,e=function(e,t){var n=d.keyName(e),r=i.getOption("extraKeys"),n=r&&r[n]||d.keyMap[i.getOption("keyMap")][n];"findNext"==n||"findPrev"==n||"findPersistentNext"==n||"findPersistentPrev"==n?(d.e_stop(e),g(i,f(i),t),i.execCommand(n)):"find"!=n&&"findPersistent"!=n||(d.e_stop(e),a(t,e))},s.openDialog(l,a,{value:c,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){y(s)},onKeyDown:e,bottom:s.options.search.bottom}),n&&u&&(g(i,r,u),v(i,t))):p(i,k(i),"Search for:",u,function(e){e&&!r.query&&i.operation(function(){g(i,r,e),r.posFrom=r.posTo=i.getCursor(),v(i,t)})})}function v(n,r,i){n.operation(function(){var e=f(n),t=h(n,e.query,r?e.posFrom:e.posTo);(t.find(r)||(t=h(n,e.query,r?d.Pos(n.lastLine()):d.Pos(n.firstLine(),0))).find(r))&&(n.setSelection(t.from(),t.to()),n.scrollIntoView({from:t.from(),to:t.to()},20),e.posFrom=t.from(),e.posTo=t.to(),i&&i(t.from(),t.to()))})}function y(t){t.operation(function(){var e=f(t);e.lastQuery=e.query,e.query&&(e.query=e.queryText=null,t.removeOverlay(e.overlay),e.annotate&&(e.annotate.clear(),e.annotate=null))})}function b(e,t){var n,r=e?document.createElement(e):document.createDocumentFragment();for(n in t)r[n]=t[n];for(var i=2;i<arguments.length;i++){var o=arguments[i];r.appendChild("string"==typeof o?document.createTextNode(o):o)}return r}function k(e){return b("",null,b("span",{className:"CodeMirror-search-label"},e.phrase("Search:"))," ",b("input",{type:"text",style:"width: 10em",className:"CodeMirror-search-field"})," ",b("span",{style:"color: #888",className:"CodeMirror-search-hint"},e.phrase("(Use /re/ syntax for regexp search)")))}function x(t,r,i){t.operation(function(){for(var n,e=h(t,r);e.findNext();)"string"!=typeof r?(n=t.getRange(e.from(),e.to()).match(r),e.replace(i.replace(/\$(\d)/g,function(e,t){return n[t]}))):e.replace(i)})}function r(u,e){var t,n,r;u.getOption("readOnly")||(t=u.getSelection()||f(u).lastQuery,r=b("",null,b("span",{className:"CodeMirror-search-label"},n=e?u.phrase("Replace all:"):u.phrase("Replace:")),(r=u,b("",null," ",b("input",{type:"text",style:"width: 10em",className:"CodeMirror-search-field"})," ",b("span",{style:"color: #888",className:"CodeMirror-search-hint"},r.phrase("(Use /re/ syntax for regexp search)"))))),p(u,r,n,t,function(c){c&&(c=o(c),p(u,b("",null,b("span",{className:"CodeMirror-search-label"},u.phrase("With:"))," ",b("input",{type:"text",style:"width: 10em",className:"CodeMirror-search-field"})),u.phrase("Replace with:"),"",function(o){var a,s,l;o=m(o),e?x(u,c,o):(y(u),a=h(u,c,u.getCursor("from")),s=function(){var e,t,n,r,i=a.from();!(e=a.findNext())&&(a=h(u,c),!(e=a.findNext())||i&&a.from().line==i.line&&a.from().ch==i.ch)||(u.setSelection(a.from(),a.to()),u.scrollIntoView({from:a.from(),to:a.to()}),n=b("",null,b("span",{className:"CodeMirror-search-label"},(r=t=u).phrase("Replace?"))," ",b("button",{},r.phrase("Yes"))," ",b("button",{},r.phrase("No"))," ",b("button",{},r.phrase("All"))," ",b("button",{},r.phrase("Stop"))),i=u.phrase("Replace?"),r=[function(){l(e)},s,function(){x(u,c,o)}],t.openConfirm?t.openConfirm(n,r):confirm(i)&&r[0]())},l=function(n){a.replace("string"==typeof c?o:o.replace(/\$(\d)/g,function(e,t){return n[t]})),s()},s())}))}))}d.defineOption("search",{bottom:!1}),d.commands.find=function(e){y(e),n(e)},d.commands.findPersistent=function(e){y(e),n(e,!1,!0)},d.commands.findPersistentNext=function(e){n(e,!1,!0,!0)},d.commands.findPersistentPrev=function(e){n(e,!0,!0,!0)},d.commands.findNext=n,d.commands.findPrev=function(e){n(e,!0)},d.commands.clearSearch=y,d.commands.replace=r,d.commands.replaceAll=function(e){r(e,!0)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(d){function f(e,t,n){var r=e.getWrapperElement(),e=r.appendChild(document.createElement("div"));return e.className=n?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top","string"==typeof t?e.innerHTML=t:e.appendChild(t),d.addClass(r,"dialog-opened"),e}function h(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}d.defineExtension("openDialog",function(e,t,n){n=n||{},h(this,null);var r=f(this,e,n.bottom),i=!1,o=this;function a(e){"string"==typeof e?s.value=e:i||(i=!0,d.rmClass(r.parentNode,"dialog-opened"),r.parentNode.removeChild(r),o.focus(),n.onClose&&n.onClose(r))}var s=r.getElementsByTagName("input")[0];return s?(s.focus(),n.value&&(s.value=n.value,!1!==n.selectValueOnOpen&&s.select()),n.onInput&&d.on(s,"input",function(e){n.onInput(e,s.value,a)}),n.onKeyUp&&d.on(s,"keyup",function(e){n.onKeyUp(e,s.value,a)}),d.on(s,"keydown",function(e){n&&n.onKeyDown&&n.onKeyDown(e,s.value,a)||((27==e.keyCode||!1!==n.closeOnEnter&&13==e.keyCode)&&(s.blur(),d.e_stop(e),a()),13==e.keyCode&&t(s.value,e))}),!1!==n.closeOnBlur&&d.on(r,"focusout",function(e){null!==e.relatedTarget&&a()})):(e=r.getElementsByTagName("button")[0])&&(d.on(e,"click",function(){a(),o.focus()}),!1!==n.closeOnBlur&&d.on(e,"blur",a),e.focus()),a}),d.defineExtension("openConfirm",function(e,t,n){h(this,null);var r=f(this,e,n&&n.bottom),i=r.getElementsByTagName("button"),o=!1,a=this,s=1;function l(){o||(o=!0,d.rmClass(r.parentNode,"dialog-opened"),r.parentNode.removeChild(r),a.focus())}i[0].focus();for(var c=0;c<i.length;++c){var u=i[c];!function(t){d.on(u,"click",function(e){d.e_preventDefault(e),l(),t&&t(a)})}(t[c]),d.on(u,"blur",function(){--s,setTimeout(function(){s<=0&&l()},200)}),d.on(u,"focus",function(){++s})}}),d.defineExtension("openNotification",function(e,t){h(this,o);var n,r=f(this,e,t&&t.bottom),i=!1,t=t&&void 0!==t.duration?t.duration:5e3;function o(){i||(i=!0,clearTimeout(n),d.rmClass(r.parentNode,"dialog-opened"),r.parentNode.removeChild(r))}return d.on(r,"click",function(e){d.e_preventDefault(e),o()}),t&&(n=setTimeout(o,t)),o})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(s){"use strict";function r(e,t,n){this.orientation=t,this.scroll=n,this.screen=this.total=this.size=1,this.pos=0,this.node=document.createElement("div"),this.node.className=e+"-"+t,this.inner=this.node.appendChild(document.createElement("div"));var a=this;function r(e){var t=s.wheelEventPixels(e)["horizontal"==a.orientation?"x":"y"],n=a.pos;a.moveTo(a.pos+t),a.pos!=n&&s.e_preventDefault(e)}s.on(this.inner,"mousedown",function(e){var t,n,r;function i(){s.off(document,"mousemove",o),s.off(document,"mouseup",i)}function o(e){if(1!=e.which)return i();a.moveTo(r+(e[t]-n)*(a.total/a.size))}1==e.which&&(s.e_preventDefault(e),t="horizontal"==a.orientation?"pageX":"pageY",n=e[t],r=a.pos,s.on(document,"mousemove",o),s.on(document,"mouseup",i))}),s.on(this.node,"click",function(e){s.e_preventDefault(e);var t=a.inner.getBoundingClientRect(),t="horizontal"==a.orientation?e.clientX<t.left?-1:e.clientX>t.right?1:0:e.clientY<t.top?-1:e.clientY>t.bottom?1:0;a.moveTo(a.pos+t*a.screen)}),s.on(this.node,"mousewheel",r),s.on(this.node,"DOMMouseScroll",r)}r.prototype.setPos=function(e,t){return(e=e<0?0:e)>this.total-this.screen&&(e=this.total-this.screen),!(!t&&e==this.pos)&&(this.pos=e,this.inner.style["horizontal"==this.orientation?"left":"top"]=e*(this.size/this.total)+"px",!0)},r.prototype.moveTo=function(e){this.setPos(e)&&this.scroll(e,this.orientation)};function n(e,t,n){this.addClass=e,this.horiz=new r(e,"horizontal",n),t(this.horiz.node),this.vert=new r(e,"vertical",n),t(this.vert.node),this.width=null}r.prototype.update=function(e,t,n){var r=this.screen!=t||this.total!=e||this.size!=n;r&&(this.screen=t,this.total=e,this.size=n);n=this.screen*(this.size/this.total);n<10&&(this.size-=10-n,n=10),this.inner.style["horizontal"==this.orientation?"width":"height"]=n+"px",this.setPos(this.pos,r)},n.prototype.update=function(e){null!=this.width||(r=window.getComputedStyle?window.getComputedStyle(this.horiz.node):this.horiz.node.currentStyle)&&(this.width=parseInt(r.height));var t=this.width||0,n=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1;return this.vert.node.style.display=r?"block":"none",this.horiz.node.style.display=n?"block":"none",r&&(this.vert.update(e.scrollHeight,e.clientHeight,e.viewHeight-(n?t:0)),this.vert.node.style.bottom=n?t+"px":"0"),n&&(this.horiz.update(e.scrollWidth,e.clientWidth,e.viewWidth-(r?t:0)-e.barLeft),this.horiz.node.style.right=r?t+"px":"0",this.horiz.node.style.left=e.barLeft+"px"),{right:r?t:0,bottom:n?t:0}},n.prototype.setScrollTop=function(e){this.vert.setPos(e)},n.prototype.setScrollLeft=function(e){this.horiz.setPos(e)},n.prototype.clear=function(){var e=this.horiz.node.parentNode;e.removeChild(this.horiz.node),e.removeChild(this.vert.node)},s.scrollbarModel.simple=function(e,t){return new n("CodeMirror-simplescroll",e,t)},s.scrollbarModel.overlay=function(e,t){return new n("CodeMirror-overlayscroll",e,t)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var x={},w=/[^\s\u00a0]/,C=e.Pos,p=e.cmpPos;function f(e){e=e.search(w);return-1==e?0:e}function S(e,t){var n=e.getMode();return!1!==n.useInnerComments&&n.innerMode?e.getModeAt(t):n}e.commands.toggleComment=function(e){e.toggleComment()},e.defineExtension("toggleComment",function(e){e=e||x;for(var t=1/0,n=this.listSelections(),r=null,i=n.length-1;0<=i;i--){var o=n[i].from(),a=n[i].to();o.line>=t||(a.line>=t&&(a=C(t,0)),t=o.line,null==r?r=this.uncomment(o,a,e)?"un":(this.lineComment(o,a,e),"line"):"un"==r?this.uncomment(o,a,e):this.lineComment(o,a,e))}}),e.defineExtension("lineComment",function(o,e,a){a=a||x;var s,l,c,u,d=this,t=S(d,o),n=d.getLine(o.line);null!=n&&(n=n,!/\bstring\b/.test(d.getTokenTypeAt(C(o.line,0)))||/^[\'\"\`]/.test(n))&&((s=a.lineComment||t.lineComment)?(l=Math.min(0!=e.ch||e.line==o.line?e.line+1:e.line,d.lastLine()+1),c=null==a.padding?" ":a.padding,u=a.commentBlankLines||o.line==e.line,d.operation(function(){if(a.indent){for(var e=null,t=o.line;t<l;++t){var n=(r=d.getLine(t)).slice(0,f(r));(null==e||e.length>n.length)&&(e=n)}for(t=o.line;t<l;++t){var r=d.getLine(t),i=e.length;(u||w.test(r))&&(r.slice(0,i)!=e&&(i=f(r)),d.replaceRange(e+s+c,C(t,0),C(t,i)))}}else for(t=o.line;t<l;++t)(u||w.test(d.getLine(t)))&&d.replaceRange(s+c,C(t,0))})):(a.blockCommentStart||t.blockCommentStart)&&(a.fullLines=!0,d.blockComment(o,e,a)))}),e.defineExtension("blockComment",function(o,a,s){s=s||x;var l,c,u=this,d=S(u,o),f=s.blockCommentStart||d.blockCommentStart,h=s.blockCommentEnd||d.blockCommentEnd;f&&h?/\bcomment\b/.test(u.getTokenTypeAt(C(o.line,0)))||((l=Math.min(a.line,u.lastLine()))!=o.line&&0==a.ch&&w.test(u.getLine(l))&&--l,c=null==s.padding?" ":s.padding,o.line>l||u.operation(function(){if(0!=s.fullLines){var e=w.test(u.getLine(l));u.replaceRange(c+h,C(l)),u.replaceRange(f+c,C(o.line,0));var t=s.blockCommentLead||d.blockCommentLead;if(null!=t)for(var n=o.line+1;n<=l;++n)n==l&&!e||u.replaceRange(t+c,C(n,0))}else{var r=0==p(u.getCursor("to"),a),i=!u.somethingSelected();u.replaceRange(h,a),r&&u.setSelection(i?a:u.getCursor("from"),a),u.replaceRange(f,o)}})):(s.lineComment||d.lineComment)&&0!=s.fullLines&&u.lineComment(o,a,s)}),e.defineExtension("uncomment",function(e,t,n){n=n||x;var i,o=this,r=S(o,e),a=Math.min(0!=t.ch||t.line==e.line?t.line:t.line-1,o.lastLine()),s=Math.min(e.line,a),l=n.lineComment||r.lineComment,c=[],u=null==n.padding?" ":n.padding;e:if(l){for(var d=s;d<=a;++d){var f=o.getLine(d),h=f.indexOf(l);if(-1==(h=-1<h&&!/comment/.test(o.getTokenTypeAt(C(d,h+1)))?-1:h)&&w.test(f))break e;if(-1<h&&w.test(f.slice(0,h)))break e;c.push(f)}if(o.operation(function(){for(var e=s;e<=a;++e){var t=c[e-s],n=t.indexOf(l),r=n+l.length;n<0||(t.slice(r,r+u.length)==u&&(r+=u.length),i=!0,o.replaceRange("",C(e,n),C(e,r)))}}),i)return!0}var p=n.blockCommentStart||r.blockCommentStart,m=n.blockCommentEnd||r.blockCommentEnd;if(!p||!m)return!1;var g=n.blockCommentLead||r.blockCommentLead,v=o.getLine(s),y=v.indexOf(p);if(-1==y)return!1;var b=a==s?v:o.getLine(a),k=b.indexOf(m,a==s?y+p.length:0),n=C(s,y+1),r=C(a,k+1);if(-1==k||!/comment/.test(o.getTokenTypeAt(n))||!/comment/.test(o.getTokenTypeAt(r))||-1<o.getRange(n,r,"\n").indexOf(m))return!1;r=-1==(n=v.lastIndexOf(p,e.ch))?-1:v.slice(0,e.ch).indexOf(m,n+p.length);if(-1!=n&&-1!=r&&r+m.length!=e.ch)return!1;r=b.indexOf(m,t.ch),e=b.slice(t.ch).lastIndexOf(p,r-t.ch),n=-1==r||-1==e?-1:t.ch+e;return(-1==r||-1==n||n==t.ch)&&(o.operation(function(){o.replaceRange("",C(a,k-(u&&b.slice(k-u.length,k)==u?u.length:0)),C(a,k+m.length));var e=y+p.length;if(u&&v.slice(e,e+u.length)==u&&(e+=u.length),o.replaceRange("",C(s,y),C(s,e)),g)for(var t=s+1;t<=a;++t){var n,r=o.getLine(t),i=r.indexOf(g);-1==i||w.test(r.slice(0,i))||(n=i+g.length,u&&r.slice(n,n+u.length)==u&&(n+=u.length),o.replaceRange("",C(t,i),C(t,n)))}}),!0)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(u){"use strict";function i(i,o,e,a){var s;e&&e.call?(s=e,e=null):s=d(i,e,"rangeFinder"),"number"==typeof o&&(o=u.Pos(o,0));var l=d(i,e,"minFoldSize");function t(e){var t=s(i,o);if(!t||t.to.line-t.from.line<l)return null;if("fold"===a)return t;for(var n=i.findMarksAt(t.from),r=0;r<n.length;++r)if(n[r].__isFold){if(!e)return null;t.cleared=!0,n[r].clear()}return t}var n,r,c=t(!0);if(d(i,e,"scanUp"))for(;!c&&o.line>i.firstLine();)o=u.Pos(o.line-1,0),c=t(!1);c&&!c.cleared&&"unfold"!==a&&(n=function(e,t,n){t=d(e,t,"widget");"function"==typeof t&&(t=t(n.from,n.to));"string"==typeof t?(n=document.createTextNode(t),(t=document.createElement("span")).appendChild(n),t.className="CodeMirror-foldmarker"):t=t&&t.cloneNode(!0);return t}(i,e,c),u.on(n,"mousedown",function(e){r.clear(),u.e_preventDefault(e)}),(r=i.markText(c.from,c.to,{replacedWith:n,clearOnEnter:d(i,e,"clearOnEnter"),__isFold:!0})).on("clear",function(e,t){u.signal(i,"unfold",i,e,t)}),u.signal(i,"fold",i,c.from,c.to))}u.newFoldFunction=function(n,r){return function(e,t){i(e,t,{rangeFinder:n,widget:r})}},u.defineExtension("foldCode",function(e,t,n){i(this,e,t,n)}),u.defineExtension("isFolded",function(e){for(var t=this.findMarksAt(e),n=0;n<t.length;++n)if(t[n].__isFold)return!0}),u.commands.toggleFold=function(e){e.foldCode(e.getCursor())},u.commands.fold=function(e){e.foldCode(e.getCursor(),null,"fold")},u.commands.unfold=function(e){e.foldCode(e.getCursor(),{scanUp:!1},"unfold")},u.commands.foldAll=function(n){n.operation(function(){for(var e=n.firstLine(),t=n.lastLine();e<=t;e++)n.foldCode(u.Pos(e,0),{scanUp:!1},"fold")})},u.commands.unfoldAll=function(n){n.operation(function(){for(var e=n.firstLine(),t=n.lastLine();e<=t;e++)n.foldCode(u.Pos(e,0),{scanUp:!1},"unfold")})},u.registerHelper("fold","combine",function(){var i=Array.prototype.slice.call(arguments,0);return function(e,t){for(var n=0;n<i.length;++n){var r=i[n](e,t);if(r)return r}}}),u.registerHelper("fold","auto",function(e,t){for(var n=e.getHelpers(t,"fold"),r=0;r<n.length;r++){var i=n[r](e,t);if(i)return i}});var r={rangeFinder:u.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1,clearOnEnter:!0};function d(e,t,n){if(t&&void 0!==t[n])return t[n];e=e.options.foldOptions;return(e&&void 0!==e[n]?e:r)[n]}u.defineOption("foldOptions",null),u.defineExtension("foldOption",function(e,t){return d(this,e,t)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./foldcode")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./foldcode"],e):e(CodeMirror)}(function(r){"use strict";r.defineOption("foldGutter",!1,function(e,t,n){n&&n!=r.Init&&(e.clearGutter(e.state.foldGutter.options.gutter),e.state.foldGutter=null,e.off("gutterClick",s),e.off("changes",l),e.off("viewportChange",c),e.off("fold",u),e.off("unfold",u),e.off("swapDoc",l)),t&&(e.state.foldGutter=new i(function(e){!0===e&&(e={});null==e.gutter&&(e.gutter="CodeMirror-foldgutter");null==e.indicatorOpen&&(e.indicatorOpen="CodeMirror-foldgutter-open");null==e.indicatorFolded&&(e.indicatorFolded="CodeMirror-foldgutter-folded");return e}(t)),a(e),e.on("gutterClick",s),e.on("changes",l),e.on("viewportChange",c),e.on("fold",u),e.on("unfold",u),e.on("swapDoc",l))});var d=r.Pos;function i(e){this.options=e,this.from=this.to=0}function f(e,t){for(var n=e.findMarks(d(t,0),d(t+1,0)),r=0;r<n.length;++r)if(n[r].__isFold){var i=n[r].find(-1);if(i&&i.line===t)return n[r]}}function h(e){if("string"!=typeof e)return e.cloneNode(!0);var t=document.createElement("div");return t.className=e+" CodeMirror-guttermarker-subtle",t}function o(i,e,t){var o=i.state.foldGutter.options,a=e-1,s=i.foldOption(o,"minFoldSize"),l=i.foldOption(o,"rangeFinder"),c="string"==typeof o.indicatorFolded&&n(o.indicatorFolded),u="string"==typeof o.indicatorOpen&&n(o.indicatorOpen);i.eachLine(e,t,function(e){++a;var t=null,n=(n=e.gutterMarkers)&&n[o.gutter];if(f(i,a)){if(c&&n&&c.test(n.className))return;t=h(o.indicatorFolded)}else{var r=d(a,0),r=l&&l(i,r);if(r&&r.to.line-r.from.line>=s){if(u&&n&&u.test(n.className))return;t=h(o.indicatorOpen)}}(t||n)&&i.setGutterMarker(e,o.gutter,t)})}function n(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function a(e){var t=e.getViewport(),n=e.state.foldGutter;n&&(e.operation(function(){o(e,t.from,t.to)}),n.from=t.from,n.to=t.to)}function s(e,t,n){var r=e.state.foldGutter;!r||n==(n=r.options).gutter&&((r=f(e,t))?r.clear():e.foldCode(d(t,0),n))}function l(e){var t,n=e.state.foldGutter;n&&(t=n.options,n.from=n.to=0,clearTimeout(n.changeUpdate),n.changeUpdate=setTimeout(function(){a(e)},t.foldOnChangeTimeSpan||600))}function c(t){var e,n=t.state.foldGutter;n&&(e=n.options,clearTimeout(n.changeUpdate),n.changeUpdate=setTimeout(function(){var e=t.getViewport();n.from==n.to||20<e.from-n.to||20<n.from-e.to?a(t):t.operation(function(){e.from<n.from&&(o(t,e.from,n.from),n.from=e.from),e.to>n.to&&(o(t,n.to,e.to),n.to=e.to)})},e.updateViewportTimeSpan||400))}function u(e,t){var n=e.state.foldGutter;!n||(t=t.line)>=n.from&&t<n.to&&o(e,t,t+1)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var l=e.Pos;function s(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 c(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 u(e,t){t=e.cm.getTokenTypeAt(l(e.line,t));return t&&/\btag\b/.test(t)}function i(e){return!(e.line>=e.max)&&(e.ch=0,e.text=e.cm.getLine(++e.line),1)}function d(e){return!(e.line<=e.min)&&(e.text=e.cm.getLine(--e.line),e.ch=e.text.length,1)}function f(e){for(;;){var t=e.text.indexOf(">",e.ch);if(-1==t){if(i(e))continue;return}if(u(e,t+1)){var n=e.text.lastIndexOf("/",t),n=-1<n&&!/\S/.test(e.text.slice(n+1,t));return e.ch=t+1,n?"selfClose":"regular"}e.ch=t+1}}function h(e){for(;;){var t=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==t){if(d(e))continue;return}if(u(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 p(e){for(;;){r.lastIndex=e.ch;var t=r.exec(e.text);if(!t){if(i(e))continue;return}if(u(e,t.index+1))return e.ch=t.index+t[0].length,t;e.ch=t.index+1}}function m(e,t){for(var n=[];;){var r,i=p(e),o=e.line,a=e.ch-(i?i[0].length:0);if(!i||!(r=f(e)))return;if("selfClose"!=r)if(i[1]){for(var s=n.length-1;0<=s;--s)if(n[s]==i[2]){n.length=s;break}if(s<0&&(!t||t==i[2]))return{tag:i[2],from:l(o,a),to:l(e.line,e.ch)}}else n.push(i[2])}}function g(e,t){for(var n=[];;){var r=function(e){for(;;){var t=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==t){if(d(e))continue;return}if(u(e,t+1)){var n=e.text.lastIndexOf("/",t),n=-1<n&&!/\S/.test(e.text.slice(n+1,t));return e.ch=t+1,n?"selfClose":"regular"}e.ch=t}}(e);if(!r)return;if("selfClose"!=r){var i=e.line,r=e.ch,o=h(e);if(!o)return;if(o[1])n.push(o[2]);else{for(var a=n.length-1;0<=a;--a)if(n[a]==o[2]){n.length=a;break}if(a<0&&(!t||t==o[2]))return{tag:o[2],from:l(e.line,e.ch),to:l(i,r)}}}else h(e)}}e.registerHelper("fold","xml",function(e,t){for(var n=new c(e,t.line,0);;){var r=p(n);if(!r||n.line!=t.line)return;var i=f(n);if(!i)return;if(!r[1]&&"selfClose"!=i){i=l(n.line,n.ch),r=m(n,r[2]);return r&&0<s(r.from,i)?{from:i,to:r.from}:null}}}),e.findMatchingTag=function(e,t,n){var r=new c(e,t.line,t.ch,n);if(-1!=r.text.indexOf(">")||-1!=r.text.indexOf("<")){var i=f(r),o=i&&l(r.line,r.ch),a=i&&h(r);if(i&&a&&!(0<s(r,t))){t={from:l(r.line,r.ch),to:o,tag:a[2]};return"selfClose"==i?{open:t,close:null,at:"open"}:a[1]?{open:g(r,a[2]),close:t,at:"close"}:{open:t,close:m(r=new c(e,o.line,o.ch,n),a[2]),at:"open"}}}},e.findEnclosingTag=function(e,t,n,r){for(var i=new c(e,t.line,t.ch,n);;){var o=g(i,r);if(!o)break;var a=m(new c(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 c(e,t.line,t.ch,r?{from:0,to:r}:null),n)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(s){"use strict";function l(e,t){var n=e.getLine(t),r=n.search(/\S/);return-1==r||/\bcomment\b/.test(e.getTokenTypeAt(s.Pos(t,r+1)))?-1:s.countColumn(n,null,e.getOption("tabSize"))}s.registerHelper("fold","indent",function(e,t){var n=l(e,t.line);if(!(n<0)){for(var r=null,i=t.line+1,o=e.lastLine();i<=o;++i){var a=l(e,i);if(-1!=a){if(!(n<a))break;r=i}}return r?{from:s.Pos(t.line,e.getLine(t.line).length),to:s.Pos(r,e.getLine(r).length)}:void 0}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(r){var d=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),g=r.Pos,v={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function y(e){return e&&e.bracketRegex||/[(){}[\]]/}function f(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),o=!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(!o)return null;a=">"==o.charAt(1)?1:-1;if(n&&n.strict&&0<a!=(i==t.ch))return null;r=e.getTokenTypeAt(g(t.line,i+1)),n=s(e,g(t.line,i+(0<a?1:0)),a,r,n);return null==n?null:{from:g(t.line,i),to:n&&n.pos,match:n&&n.ch==o.charAt(0),forward:0<a}}function s(e,t,n,r,i){for(var o=i&&i.maxScanLineLength||1e4,a=i&&i.maxScanLines||1e3,s=[],l=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(l.test(p)&&(void 0===r||(e.getTokenTypeAt(g(u,f+1))||"")==(r||""))){var m=v[p];if(m&&">"==m.charAt(1)==0<n)s.push(p);else{if(!s.length)return{pos:g(u,f),ch:p};s.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=n&&n.highlightNonMatching,o=[],a=e.listSelections(),s=0;s<a.length;s++){var l,c=a[s].empty()&&f(e,a[s].head,n);c&&(c.match||!1!==i)&&e.getLine(c.from.line).length<=r&&(l=c.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",o.push(e.markText(c.from,g(c.from.line,c.from.ch+1),{className:l})),c.to&&e.getLine(c.to.line).length<=r&&o.push(e.markText(c.to,g(c.to.line,c.to.ch+1),{className:l})))}if(o.length){d&&e.state.focused&&e.focus();function u(){e.operation(function(){for(var e=0;e<o.length;e++)o[e].clear()})}if(!t)return u;setTimeout(u,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)})}function o(e){e.state.matchBrackets&&e.state.matchBrackets.currentlyHighlighted&&(e.state.matchBrackets.currentlyHighlighted(),e.state.matchBrackets.currentlyHighlighted=null)}r.defineOption("matchBrackets",!1,function(e,t,n){n&&n!=r.Init&&(e.off("cursorActivity",i),e.off("focus",i),e.off("blur",o),o(e)),t&&(e.state.matchBrackets="object"==typeof t?t:{},e.on("cursorActivity",i),e.on("focus",i),e.on("blur",o))}),r.defineExtension("matchBrackets",function(){t(this,!0)}),r.defineExtension("findMatchingBracket",function(e,t,n){return f(this,e,t=n||"boolean"==typeof t?n?(n.strict=t,n):t?{strict:!0}:null:t)}),r.defineExtension("scanForBracket",function(e,t,n,r){return s(this,e,t,n,r)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],e):e(CodeMirror)}(function(r){"use strict";function i(e){e.state.tagHit&&e.state.tagHit.clear(),e.state.tagOther&&e.state.tagOther.clear(),e.state.tagHit=e.state.tagOther=null}function o(n){n.state.failedTagMatch=!1,n.operation(function(){var e,t;i(n),n.somethingSelected()||(t=n.getCursor(),(e=n.getViewport()).from=Math.min(e.from,t.line),e.to=Math.max(t.line+1,e.to),(t=r.findMatchingTag(n,t,e))&&(!n.state.matchBothTags||(e="open"==t.at?t.open:t.close)&&(n.state.tagHit=n.markText(e.from,e.to,{className:"CodeMirror-matchingtag"})),(t="close"==t.at?t.open:t.close)?n.state.tagOther=n.markText(t.from,t.to,{className:"CodeMirror-matchingtag"}):n.state.failedTagMatch=!0))})}function a(e){e.state.failedTagMatch&&o(e)}r.defineOption("matchTags",!1,function(e,t,n){n&&n!=r.Init&&(e.off("cursorActivity",o),e.off("viewportChange",a),i(e)),t&&(e.state.matchBothTags="object"==typeof t&&t.bothTags,e.on("cursorActivity",o),e.on("viewportChange",a),o(e))}),r.commands.toMatchingTag=function(e){var t=r.findMatchingTag(e,e.getCursor());!t||(t="close"==t.at?t.open:t.close)&&e.extendSelection(t.to,t.from)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./matchesonscrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./matchesonscrollbar"],e):e(CodeMirror)}(function(r){"use strict";var n={style:"matchhighlight",minChars:2,delay:100,wordsOnly:!1,annotateScrollbar:!1,showToken:!1,trim:!0};function i(e){for(var t in this.options={},n)this.options[t]=(e&&e.hasOwnProperty(t)?e:n)[t];this.overlay=this.timeout=null,this.matchesonscroll=null,this.active=!1}function o(e){var t=e.state.matchHighlighter;(t.active||e.hasFocus())&&s(e,t)}function a(e){var t=e.state.matchHighlighter;t.active||(t.active=!0,s(e,t))}function s(e,t){clearTimeout(t.timeout),t.timeout=setTimeout(function(){l(e)},t.options.delay)}function c(e,t,n,r){var i,o,a,s=e.state.matchHighlighter;e.addOverlay(s.overlay=(i=t,o=n,a=r,{token:function(e){if(e.match(i)&&(!o||(n=o,!((t=e).start&&n.test(t.string.charAt(t.start-1))||t.pos!=t.string.length&&n.test(t.string.charAt(t.pos))))))return a;var t,n;e.next(),e.skipTo(i.charAt(0))||e.skipToEnd()}})),s.options.annotateScrollbar&&e.showMatchesOnScrollbar&&(t=n?new RegExp((/\w/.test(t.charAt(0))?"\\b":"")+t.replace(/[\\\[.+*?(){|^$]/g,"\\$&")+(/\w/.test(t.charAt(t.length-1))?"\\b":"")):t,s.matchesonscroll=e.showMatchesOnScrollbar(t,!1,{className:"CodeMirror-selection-highlight-scrollbar"}))}function u(e){var t=e.state.matchHighlighter;t.overlay&&(e.removeOverlay(t.overlay),t.overlay=null,t.matchesonscroll&&(t.matchesonscroll.clear(),t.matchesonscroll=null))}function l(l){l.operation(function(){var e=l.state.matchHighlighter;if(u(l),l.somethingSelected()||!e.options.showToken){var t=l.getCursor("from"),n=l.getCursor("to");t.line==n.line&&(e.options.wordsOnly&&!function(e,t,n){{if(null===e.getRange(t,n).match(/^\w+$/))return!1;if(0<t.ch){var r={line:t.line,ch:t.ch-1};if(null===e.getRange(r,t).match(/\W/))return!1}if(n.ch<e.getLine(t.line).length){r={line:n.line,ch:n.ch+1};if(null===e.getRange(n,r).match(/\W/))return!1}return!0}}(l,t,n)||(i=l.getRange(t,n),(i=e.options.trim?i.replace(/^\s+|\s+$/g,""):i).length>=e.options.minChars&&c(l,i,!1,e.options.style)))}else{for(var r=!0===e.options.showToken?/[\w$]/:e.options.showToken,i=l.getCursor(),o=l.getLine(i.line),a=i.ch,s=a;a&&r.test(o.charAt(a-1));)--a;for(;s<o.length&&r.test(o.charAt(s));)++s;a<s&&c(l,o.slice(a,s),r,e.options.style)}})}r.defineOption("highlightSelectionMatches",!1,function(e,t,n){n&&n!=r.Init&&(u(e),clearTimeout(e.state.matchHighlighter.timeout),e.state.matchHighlighter=null,e.off("cursorActivity",o),e.off("focus",a)),t&&(t=e.state.matchHighlighter=new i(t),e.hasFocus()?(t.active=!0,l(e)):e.on("focus",a),e.on("cursorActivity",o))})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],e):e(CodeMirror)}(function(v){v.defineOption("autoCloseTags",!1,function(e,t,n){n!=v.Init&&n&&e.removeKeyMap("autoCloseTags"),t&&(n={name:"autoCloseTags"},"object"==typeof t&&!1===t.whenClosing||(n["'/'"]=function(e){return(e=e).getOption("disableInput")?v.Pass:r(e,!0)}),"object"==typeof t&&!1===t.whenOpening||(n["'>'"]=function(e){if(e.getOption("disableInput"))return v.Pass;for(var t=e.listSelections(),n=[],r=e.getOption("autoCloseTags"),i=0;i<t.length;i++){if(!t[i].empty())return v.Pass;var o=t[i].head,a=e.getTokenAt(o),s=v.innerMode(e.getMode(),a.state),l=s.state,c=s.mode.xmlCurrentTag&&s.mode.xmlCurrentTag(l),u=c&&c.name;if(!u)return v.Pass;var d="html"==s.mode.configuration,f="object"==typeof r&&r.dontCloseTags||d&&y,h="object"==typeof r&&r.indentTags||d&&b,d=(u=a.end>o.ch?u.slice(0,u.length-a.end+o.ch):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<k(f,d)||x(e,s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(l)||[],u,o,!0))return v.Pass;l="object"==typeof r&&r.emptyTags;l&&-1<k(l,u)?n[i]={text:"/>",newPos:v.Pos(o.line,o.ch+2)}:(d=h&&-1<k(h,d),n[i]={indent:d,text:">"+(d?"\n\n":"")+"</"+u+">",newPos:d?v.Pos(o.line+1,0):v.Pos(o.line,o.ch+1)})}for(var p="object"==typeof r&&r.dontIndentOnAutoClose,i=t.length-1;0<=i;i--){var m=n[i];e.replaceRange(m.text,t[i].head,t[i].anchor,"+insert");var g=e.listSelections().slice(0);g[i]={head:m.newPos,anchor:m.newPos},e.setSelections(g),!p&&m.indent&&(e.indentLine(m.newPos.line,null,!0),e.indentLine(m.newPos.line+1,null,!0))}}),e.addKeyMap(n))});var y=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],b=["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 r(e,t){for(var n=e.listSelections(),r=[],i=t?"/":"</",o=e.getOption("autoCloseTags"),o="object"==typeof o&&o.dontIndentOnSlash,a=0;a<n.length;a++){if(!n[a].empty())return v.Pass;var s=n[a].head,l=e.getTokenAt(s),c=v.innerMode(e.getMode(),l.state),u=c.state;if(t&&("string"==l.type||"<"!=l.string.charAt(0)||l.start!=s.ch-1))return v.Pass;var d,f="xml"!=c.mode.name&&"htmlmixed"==e.getMode().name;if(f&&"javascript"==c.mode.name)d=i+"script";else if(f&&"css"==c.mode.name)d=i+"style";else{c=c.mode.xmlCurrentContext&&c.mode.xmlCurrentContext(u),u=c.length?c[c.length-1]:"";if(!c||c.length&&x(e,c,u,s))return v.Pass;d=i+u}">"!=e.getLine(s.line).charAt(l.end)&&(d+=">"),r[a]=d}if(e.replaceSelections(r),n=e.listSelections(),!o)for(a=0;a<n.length;a++)(a==n.length-1||n[a].head.line<n[a+1].head.line)&&e.indentLine(n[a].head.line)}function k(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 x(e,t,n,r,i){if(v.scanForClosingTag){var o=Math.min(e.lastLine()+1,r.line+500),a=v.scanForClosingTag(e,r,null,o);if(a&&a.tag==n){for(var s=i?1:0,l=t.length-1;0<=l&&t[l]==n;l--)++s;r=a.to;for(l=1;l<s;l++){var c=v.scanForClosingTag(e,r,null,o);if(!c||c.tag!=n)return;r=c.to}return 1}}}v.commands.closeTag=function(e){return r(e)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(y){var n={pairs:"()[]{}''\"\"",closeBefore:")]}'\":;>",triples:"",explode:"[]{}"},b=y.Pos;function k(e,t){return"pairs"==t&&"string"==typeof e?e:("object"==typeof e&&null!=e[t]?e:n)[t]}y.defineOption("autoCloseBrackets",!1,function(e,t,n){n&&n!=y.Init&&(e.removeKeyMap(i),e.state.closeBrackets=null),t&&(r(k(t,"pairs")),e.state.closeBrackets=t,e.addKeyMap(i))});var i={Backspace:function(e){var t=x(e);if(!t||e.getOption("disableInput"))return y.Pass;for(var n=k(t,"pairs"),r=e.listSelections(),i=0;i<r.length;i++){if(!r[i].empty())return y.Pass;var o=s(e,r[i].head);if(!o||n.indexOf(o)%2!=0)return y.Pass}for(i=r.length-1;0<=i;i--){var a=r[i].head;e.replaceRange("",b(a.line,a.ch-1),b(a.line,a.ch+1),"+delete")}},Enter:function(r){var e=x(r),t=e&&k(e,"explode");if(!t||r.getOption("disableInput"))return y.Pass;for(var i=r.listSelections(),n=0;n<i.length;n++){if(!i[n].empty())return y.Pass;var o=s(r,i[n].head);if(!o||t.indexOf(o)%2!=0)return y.Pass}r.operation(function(){var e=r.lineSeparator()||"\n";r.replaceSelection(e+e,null),w(r,-1),i=r.listSelections();for(var t=0;t<i.length;t++){var n=i[t].head.line;r.indentLine(n,null,!0),r.indentLine(n+1,null,!0)}})}};function r(e){for(var t=0;t<e.length;t++){var n=e.charAt(t),r="'"+n+"'";i[r]||(i[r]=function(t){return function(e){return function(i,e){var t=x(i);if(!t||i.getOption("disableInput"))return y.Pass;var n=k(t,"pairs"),r=n.indexOf(e);if(-1==r)return y.Pass;for(var o,a=k(t,"closeBefore"),s=k(t,"triples"),l=n.charAt(r+1)==e,c=i.listSelections(),u=r%2==0,d=0;d<c.length;d++){var f,h=c[d],p=h.head,m=i.getRange(p,b(p.line,p.ch+1));if(u&&!h.empty())f="surround";else if(!l&&u||m!=e)if(l&&1<p.ch&&0<=s.indexOf(e)&&i.getRange(b(p.line,p.ch-2),p)==e+e){if(2<p.ch&&/\bstring/.test(i.getTokenTypeAt(b(p.line,p.ch-2))))return y.Pass;f="addFour"}else if(l){h=0==p.ch?" ":i.getRange(b(p.line,p.ch-1),p);if(y.isWordChar(m)||h==e||y.isWordChar(h))return y.Pass;f="both"}else{if(!u||!(0===m.length||/\s/.test(m)||-1<a.indexOf(m)))return y.Pass;f="both"}else f=l&&function(e,t){var n=e.getTokenAt(b(t.line,t.ch+1));return/\bstring/.test(n.type)&&n.start==t.ch&&(0==t.ch||!/\bstring/.test(e.getTokenTypeAt(t)))}(i,p)?"both":0<=s.indexOf(e)&&i.getRange(p,b(p.line,p.ch+3))==e+e+e?"skipThree":"skip";if(o){if(o!=f)return y.Pass}else o=f}var g=r%2?n.charAt(r-1):e,v=r%2?e:n.charAt(r+1);i.operation(function(){if("skip"==o)w(i,1);else if("skipThree"==o)w(i,3);else if("surround"==o){for(var e=i.getSelections(),t=0;t<e.length;t++)e[t]=g+e[t]+v;i.replaceSelections(e,"around");for(e=i.listSelections().slice(),t=0;t<e.length;t++)e[t]=(n=e[t],r=void 0,r=0<y.cmpPos(n.anchor,n.head),{anchor:new b(n.anchor.line,n.anchor.ch+(r?-1:1)),head:new b(n.head.line,n.head.ch+(r?1:-1))});i.setSelections(e)}else"both"==o?(i.replaceSelection(g+v,null),i.triggerElectric(g+v),w(i,-1)):"addFour"==o&&(i.replaceSelection(g+g+g+g,"before"),w(i,1));var n,r})}(e,t)}}(n))}}function x(e){var t=e.state.closeBrackets;return t&&!t.override&&e.getModeAt(e.getCursor()).closeBrackets||t}function w(e,t){for(var n=[],r=e.listSelections(),i=0,o=0;o<r.length;o++){var a=r[o];a.head==e.getCursor()&&(i=o);a=a.head.ch||0<t?{line:a.head.line,ch:a.head.ch+t}:{line:a.head.line-1};n.push({anchor:a,head:a})}e.setSelections(n,i)}function s(e,t){t=e.getRange(b(t.line,t.ch-1),b(t.line,t.ch+1));return 2==t.length?t:null}r(n.pairs+"`")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/edit/matchbrackets")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/edit/matchbrackets"],e):e(CodeMirror)}(function(d){"use strict";var r=d.commands,f=d.Pos;function t(t,n){t.extendSelectionsBy(function(e){return t.display.shift||t.doc.extend||e.empty()?function(e,t,n){if(n<0&&0==t.ch)return e.clipPos(f(t.line-1));var r=e.getLine(t.line);if(0<n&&t.ch>=r.length)return e.clipPos(f(t.line+1,0));for(var i,o="start",a=t.ch,s=a,l=n<0?0:r.length;s!=l;s+=n,0){var c=r.charAt(n<0?s-1:s),u="_"!=c&&d.isWordChar(c)?"w":"o";if("w"==u&&c.toUpperCase()==c&&(u="W"),"start"==o)"o"!=u?(o="in",i=u):a=s+n;else if("in"==o&&i!=u){if("w"==i&&"W"==u&&n<0&&s--,"W"==i&&"w"==u&&0<n){if(s==a+1){i="w";continue}s--}break}}return f(t.line,s)}(t.doc,e.head,n):n<0?e.from():e.to()})}function n(a,s){if(a.isReadOnly())return d.Pass;a.operation(function(){for(var e=a.listSelections().length,t=[],n=-1,r=0;r<e;r++){var i,o=a.listSelections()[r].head;o.line<=n||(i=f(o.line+(s?0:1),0),a.replaceRange("\n",i,null,"+insertLine"),a.indentLine(i.line,null,!0),t.push({head:i,anchor:i}),n=o.line+1)}a.setSelections(t)}),a.execCommand("indentAuto")}function c(e,t){for(var n=t.ch,r=n,i=e.getLine(t.line);n&&d.isWordChar(i.charAt(n-1));)--n;for(;r<i.length&&d.isWordChar(i.charAt(r));)++r;return{from:f(t.line,n),to:f(t.line,r),word:i.slice(n,r)}}function i(e,t){for(var n=e.listSelections(),r=[],i=0;i<n.length;i++){var o=n[i],a=e.findPosV(o.anchor,t,"line",o.anchor.goalColumn),s=e.findPosV(o.head,t,"line",o.head.goalColumn);a.goalColumn=null!=o.anchor.goalColumn?o.anchor.goalColumn:e.cursorCoords(o.anchor,"div").left,s.goalColumn=null!=o.head.goalColumn?o.head.goalColumn:e.cursorCoords(o.head,"div").left;s={anchor:a,head:s};r.push(o),r.push(s)}e.setSelections(r)}r.goSubwordLeft=function(e){t(e,-1)},r.goSubwordRight=function(e){t(e,1)},r.scrollLineUp=function(e){var t,n=e.getScrollInfo();e.somethingSelected()||(t=e.lineAtHeight(n.top+n.clientHeight,"local"),e.getCursor().line>=t&&e.execCommand("goLineUp")),e.scrollTo(null,n.top-e.defaultTextHeight())},r.scrollLineDown=function(e){var t,n=e.getScrollInfo();e.somethingSelected()||(t=e.lineAtHeight(n.top,"local")+1,e.getCursor().line<=t&&e.execCommand("goLineDown")),e.scrollTo(null,n.top+e.defaultTextHeight())},r.splitSelectionByLine=function(e){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++)for(var i=t[r].from(),o=t[r].to(),a=i.line;a<=o.line;++a)o.line>i.line&&a==o.line&&0==o.ch||n.push({anchor:a==i.line?i:f(a,0),head:a==o.line?o:f(a)});e.setSelections(n,0)},r.singleSelectionTop=function(e){var t=e.listSelections()[0];e.setSelection(t.anchor,t.head,{scroll:!1})},r.selectLine=function(e){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){var i=t[r];n.push({anchor:f(i.from().line,0),head:f(i.to().line+1,0)})}e.setSelections(n)},r.insertLineAfter=function(e){return n(e,!1)},r.insertLineBefore=function(e){return n(e,!0)},r.selectNextOccurrence=function(e){var t=e.getCursor("from"),n=e.getCursor("to"),r=e.state.sublimeFindFullWord==e.doc.sel;if(0==d.cmpPos(t,n)){var i=c(e,t);if(!i.word)return;e.setSelection(i.from,i.to),r=!0}else{t=e.getRange(t,n),t=r?new RegExp("\\b"+t+"\\b"):t,n=e.getSearchCursor(t,n);if(!(n.findNext()||(n=e.getSearchCursor(t,f(e.firstLine(),0))).findNext())||function(e,t,n){for(var r=0;r<e.length;r++)if(0==d.cmpPos(e[r].from(),t)&&0==d.cmpPos(e[r].to(),n))return!0;return!1}(e.listSelections(),n.from(),n.to()))return;e.addSelection(n.from(),n.to())}r&&(e.state.sublimeFindFullWord=e.doc.sel)},r.skipAndSelectNextOccurrence=function(e){var t=e.getCursor("anchor"),n=e.getCursor("head");r.selectNextOccurrence(e),0!=d.cmpPos(t,n)&&e.doc.setSelections(e.doc.listSelections().filter(function(e){return e.anchor!=t||e.head!=n}))},r.addCursorToPrevLine=function(e){i(e,-1)},r.addCursorToNextLine=function(e){i(e,1)};function o(e){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){var i=t[r],o=i.head,a=e.scanForBracket(o,-1);if(!a)return;for(;;){var s=e.scanForBracket(o,1);if(!s)return;if(s.ch=="(){}[]".charAt("(){}[]".indexOf(a.ch)+1)){var l=f(a.pos.line,a.pos.ch+1);if(0!=d.cmpPos(l,i.from())||0!=d.cmpPos(s.pos,i.to())){n.push({anchor:l,head:s.pos});break}if(!(a=e.scanForBracket(a.pos,-1)))return}o=f(s.pos.line,s.pos.ch+1)}}return e.setSelections(n),1}function a(e){return e?/\bpunctuation\b/.test(e)?e:void 0:null}function s(a,s,l){if(a.isReadOnly())return d.Pass;for(var c,e=a.listSelections(),u=[],t=0;t<e.length;t++){var n=e[t];if(!n.empty()){for(var r=n.from().line,i=n.to().line;t<e.length-1&&e[t+1].from().line==i;)i=e[++t].to().line;e[t].to().ch||i--,u.push(r,i)}}u.length?c=!0:u.push(a.firstLine(),a.lastLine()),a.operation(function(){for(var e=[],t=0;t<u.length;t+=2){var n=u[t],r=u[t+1],i=f(n,0),o=f(r),n=a.getRange(i,o,!1);s?n.sort(function(e,t){return e<t?-l:e==t?0:l}):n.sort(function(e,t){var n=e.toUpperCase(),r=t.toUpperCase();return n!=r&&(e=n,t=r),e<t?-l:e==t?0:l}),a.replaceRange(n,i,o),c&&e.push({anchor:i,head:f(r+1,0)})}c&&a.setSelections(e,0)})}function l(s,l){s.operation(function(){for(var e=s.listSelections(),t=[],n=[],r=0;r<e.length;r++)(a=e[r]).empty()?(t.push(r),n.push("")):n.push(l(s.getRange(a.from(),a.to())));s.replaceSelections(n,"around","case");for(r=t.length-1;0<=r;r--){var i,o,a=e[t[r]];o&&0<d.cmpPos(a.head,o)||(o=(i=c(s,a.head)).from,s.replaceRange(l(i.word),i.from,i.to))}})}function u(e){var t=e.getCursor("from"),n=e.getCursor("to");if(0==d.cmpPos(t,n)){var r=c(e,t);if(!r.word)return;t=r.from,n=r.to}return{from:t,to:n,query:e.getRange(t,n),word:r}}function h(e,t){var n,r,i=u(e);i&&(n=i.query,r=e.getSearchCursor(n,t?i.to:i.from),(t?r.findNext():r.findPrevious())?e.setSelection(r.from(),r.to()):(r=e.getSearchCursor(n,t?f(e.firstLine(),0):e.clipPos(f(e.lastLine()))),(t?r.findNext():r.findPrevious())?e.setSelection(r.from(),r.to()):i.word&&e.setSelection(i.from,i.to)))}r.selectScope=function(e){o(e)||e.execCommand("selectAll")},r.selectBetweenBrackets=function(e){if(!o(e))return d.Pass},r.goToBracket=function(n){n.extendSelectionsBy(function(e){var t=n.scanForBracket(e.head,1,a(n.getTokenTypeAt(e.head)));if(t&&0!=d.cmpPos(t.pos,e.head))return t.pos;t=n.scanForBracket(e.head,-1,a(n.getTokenTypeAt(f(e.head.line,e.head.ch+1))));return t&&f(t.pos.line,t.pos.ch+1)||e.head})},r.swapLineUp=function(i){if(i.isReadOnly())return d.Pass;for(var e=i.listSelections(),o=[],t=i.firstLine()-1,a=[],n=0;n<e.length;n++){var r=e[n],s=r.from().line-1,l=r.to().line;a.push({anchor:f(r.anchor.line-1,r.anchor.ch),head:f(r.head.line-1,r.head.ch)}),0!=r.to().ch||r.empty()||--l,t<s?o.push(s,l):o.length&&(o[o.length-1]=l),t=l}i.operation(function(){for(var e=0;e<o.length;e+=2){var t=o[e],n=o[e+1],r=i.getLine(t);i.replaceRange("",f(t,0),f(t+1,0),"+swapLine"),n>i.lastLine()?i.replaceRange("\n"+r,f(i.lastLine()),null,"+swapLine"):i.replaceRange(r+"\n",f(n,0),null,"+swapLine")}i.setSelections(a),i.scrollIntoView()})},r.swapLineDown=function(i){if(i.isReadOnly())return d.Pass;for(var e=i.listSelections(),o=[],t=i.lastLine()+1,n=e.length-1;0<=n;n--){var r=e[n],a=r.to().line+1,s=r.from().line;0!=r.to().ch||r.empty()||a--,a<t?o.push(a,s):o.length&&(o[o.length-1]=s),t=s}i.operation(function(){for(var e=o.length-2;0<=e;e-=2){var t=o[e],n=o[e+1],r=i.getLine(t);t==i.lastLine()?i.replaceRange("",f(t-1),f(t),"+swapLine"):i.replaceRange("",f(t,0),f(t+1,0),"+swapLine"),i.replaceRange(r+"\n",f(n,0),null,"+swapLine")}i.scrollIntoView()})},r.toggleCommentIndented=function(e){e.toggleComment({indent:!0})},r.joinLines=function(l){for(var e=l.listSelections(),c=[],t=0;t<e.length;t++){for(var n=e[t],r=n.from(),i=r.line,o=n.to().line;t<e.length-1&&e[t+1].from().line==o;)o=e[++t].to().line;c.push({start:i,end:o,anchor:!n.empty()&&r})}l.operation(function(){for(var e=0,t=[],n=0;n<c.length;n++){for(var r,i=c[n],o=i.anchor&&f(i.anchor.line-e,i.anchor.ch),a=i.start;a<=i.end;a++){var s=a-e;a==i.end&&(r=f(s,l.getLine(s).length+1)),s<l.lastLine()&&(l.replaceRange(" ",f(s),f(1+s,/^\s*/.exec(l.getLine(1+s))[0].length)),++e)}t.push({anchor:o||r,head:r})}l.setSelections(t,0)})},r.duplicateLine=function(r){r.operation(function(){for(var e=r.listSelections().length,t=0;t<e;t++){var n=r.listSelections()[t];n.empty()?r.replaceRange(r.getLine(n.head.line)+"\n",f(n.head.line,0)):r.replaceRange(r.getRange(n.from(),n.to()),n.from())}r.scrollIntoView()})},r.sortLines=function(e){s(e,!0,1)},r.reverseSortLines=function(e){s(e,!0,-1)},r.sortLinesInsensitive=function(e){s(e,!1,1)},r.reverseSortLinesInsensitive=function(e){s(e,!1,-1)},r.nextBookmark=function(e){var t=e.state.sublimeBookmarks;if(t)for(;t.length;){var n=t.shift(),r=n.find();if(r)return t.push(n),e.setSelection(r.from,r.to)}},r.prevBookmark=function(e){var t=e.state.sublimeBookmarks;if(t)for(;t.length;){t.unshift(t.pop());var n=t[t.length-1].find();if(n)return e.setSelection(n.from,n.to);t.pop()}},r.toggleBookmark=function(e){for(var t=e.listSelections(),n=e.state.sublimeBookmarks||(e.state.sublimeBookmarks=[]),r=0;r<t.length;r++){for(var i=t[r].from(),o=t[r].to(),a=t[r].empty()?e.findMarksAt(i):e.findMarks(i,o),s=0;s<a.length;s++)if(a[s].sublimeBookmark){a[s].clear();for(var l=0;l<n.length;l++)n[l]==a[s]&&n.splice(l--,1);break}s==a.length&&n.push(e.markText(i,o,{sublimeBookmark:!0,clearWhenEmpty:!1}))}},r.clearBookmarks=function(e){var t=e.state.sublimeBookmarks;if(t)for(var n=0;n<t.length;n++)t[n].clear();t.length=0},r.selectBookmarks=function(e){var t=e.state.sublimeBookmarks,n=[];if(t)for(var r=0;r<t.length;r++){var i=t[r].find();i?n.push({anchor:i.from,head:i.to}):t.splice(r--,0)}n.length&&e.setSelections(n,0)},r.smartBackspace=function(s){if(s.somethingSelected())return d.Pass;s.operation(function(){for(var e=s.listSelections(),t=s.getOption("indentUnit"),n=e.length-1;0<=n;n--){var r=e[n].head,i=s.getRange({line:r.line,ch:0},r),o=d.countColumn(i,null,s.getOption("tabSize")),a=s.findPosH(r,-1,"char",!1);!i||/\S/.test(i)||o%t!=0||(o=new f(r.line,d.findColumn(i,o-t,t))).ch!=r.ch&&(a=o),s.replaceRange("",a,r,"+delete")}})},r.delLineRight=function(n){n.operation(function(){for(var e=n.listSelections(),t=e.length-1;0<=t;t--)n.replaceRange("",e[t].anchor,f(e[t].to().line),"+delete");n.scrollIntoView()})},r.upcaseAtCursor=function(e){l(e,function(e){return e.toUpperCase()})},r.downcaseAtCursor=function(e){l(e,function(e){return e.toLowerCase()})},r.setSublimeMark=function(e){e.state.sublimeMark&&e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor())},r.selectToSublimeMark=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&e.setSelection(e.getCursor(),t)},r.deleteToSublimeMark=function(e){var t,n,r=e.state.sublimeMark&&e.state.sublimeMark.find();r&&(n=e.getCursor(),0<d.cmpPos(n,t=r)&&(r=t,t=n,n=r),e.state.sublimeKilled=e.getRange(n,t),e.replaceRange("",n,t))},r.swapWithSublimeMark=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&(e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor()),e.setCursor(t))},r.sublimeYank=function(e){null!=e.state.sublimeKilled&&e.replaceSelection(e.state.sublimeKilled,null,"paste")},r.showInCenter=function(e){var t=e.cursorCoords(null,"local");e.scrollTo(null,(t.top+t.bottom)/2-e.getScrollInfo().clientHeight/2)},r.findUnder=function(e){h(e,!0)},r.findUnderPrevious=function(e){h(e,!1)},r.findAllUnder=function(e){var t=u(e);if(t){for(var n=e.getSearchCursor(t.query),r=[],i=-1;n.findNext();)r.push({anchor:n.from(),head:n.to()}),n.from().line<=t.from.line&&n.from().ch<=t.from.ch&&i++;e.setSelections(r,i)}};var e=d.keyMap;e.macSublime={"Cmd-Left":"goLineStartSmart","Shift-Tab":"indentLess","Shift-Ctrl-K":"deleteLine","Alt-Q":"wrapLines","Ctrl-Left":"goSubwordLeft","Ctrl-Right":"goSubwordRight","Ctrl-Alt-Up":"scrollLineUp","Ctrl-Alt-Down":"scrollLineDown","Cmd-L":"selectLine","Shift-Cmd-L":"splitSelectionByLine",Esc:"singleSelectionTop","Cmd-Enter":"insertLineAfter","Shift-Cmd-Enter":"insertLineBefore","Cmd-D":"selectNextOccurrence","Shift-Cmd-Space":"selectScope","Shift-Cmd-M":"selectBetweenBrackets","Cmd-M":"goToBracket","Cmd-Ctrl-Up":"swapLineUp","Cmd-Ctrl-Down":"swapLineDown","Cmd-/":"toggleCommentIndented","Cmd-J":"joinLines","Shift-Cmd-D":"duplicateLine",F5:"sortLines","Shift-F5":"reverseSortLines","Cmd-F5":"sortLinesInsensitive","Shift-Cmd-F5":"reverseSortLinesInsensitive",F2:"nextBookmark","Shift-F2":"prevBookmark","Cmd-F2":"toggleBookmark","Shift-Cmd-F2":"clearBookmarks","Alt-F2":"selectBookmarks",Backspace:"smartBackspace","Cmd-K Cmd-D":"skipAndSelectNextOccurrence","Cmd-K Cmd-K":"delLineRight","Cmd-K Cmd-U":"upcaseAtCursor","Cmd-K Cmd-L":"downcaseAtCursor","Cmd-K Cmd-Space":"setSublimeMark","Cmd-K Cmd-A":"selectToSublimeMark","Cmd-K Cmd-W":"deleteToSublimeMark","Cmd-K Cmd-X":"swapWithSublimeMark","Cmd-K Cmd-Y":"sublimeYank","Cmd-K Cmd-C":"showInCenter","Cmd-K Cmd-G":"clearBookmarks","Cmd-K Cmd-Backspace":"delLineLeft","Cmd-K Cmd-1":"foldAll","Cmd-K Cmd-0":"unfoldAll","Cmd-K Cmd-J":"unfoldAll","Ctrl-Shift-Up":"addCursorToPrevLine","Ctrl-Shift-Down":"addCursorToNextLine","Cmd-F3":"findUnder","Shift-Cmd-F3":"findUnderPrevious","Alt-F3":"findAllUnder","Shift-Cmd-[":"fold","Shift-Cmd-]":"unfold","Cmd-I":"findIncremental","Shift-Cmd-I":"findIncrementalReverse","Cmd-H":"replace",F3:"findNext","Shift-F3":"findPrev",fallthrough:"macDefault"},d.normalizeKeyMap(e.macSublime),e.pcSublime={"Shift-Tab":"indentLess","Shift-Ctrl-K":"deleteLine","Alt-Q":"wrapLines","Ctrl-T":"transposeChars","Alt-Left":"goSubwordLeft","Alt-Right":"goSubwordRight","Ctrl-Up":"scrollLineUp","Ctrl-Down":"scrollLineDown","Ctrl-L":"selectLine","Shift-Ctrl-L":"splitSelectionByLine",Esc:"singleSelectionTop","Ctrl-Enter":"insertLineAfter","Shift-Ctrl-Enter":"insertLineBefore","Ctrl-D":"selectNextOccurrence","Shift-Ctrl-Space":"selectScope","Shift-Ctrl-M":"selectBetweenBrackets","Ctrl-M":"goToBracket","Shift-Ctrl-Up":"swapLineUp","Shift-Ctrl-Down":"swapLineDown","Ctrl-/":"toggleCommentIndented","Ctrl-J":"joinLines","Shift-Ctrl-D":"duplicateLine",F9:"sortLines","Shift-F9":"reverseSortLines","Ctrl-F9":"sortLinesInsensitive","Shift-Ctrl-F9":"reverseSortLinesInsensitive",F2:"nextBookmark","Shift-F2":"prevBookmark","Ctrl-F2":"toggleBookmark","Shift-Ctrl-F2":"clearBookmarks","Alt-F2":"selectBookmarks",Backspace:"smartBackspace","Ctrl-K Ctrl-D":"skipAndSelectNextOccurrence","Ctrl-K Ctrl-K":"delLineRight","Ctrl-K Ctrl-U":"upcaseAtCursor","Ctrl-K Ctrl-L":"downcaseAtCursor","Ctrl-K Ctrl-Space":"setSublimeMark","Ctrl-K Ctrl-A":"selectToSublimeMark","Ctrl-K Ctrl-W":"deleteToSublimeMark","Ctrl-K Ctrl-X":"swapWithSublimeMark","Ctrl-K Ctrl-Y":"sublimeYank","Ctrl-K Ctrl-C":"showInCenter","Ctrl-K Ctrl-G":"clearBookmarks","Ctrl-K Ctrl-Backspace":"delLineLeft","Ctrl-K Ctrl-1":"foldAll","Ctrl-K Ctrl-0":"unfoldAll","Ctrl-K Ctrl-J":"unfoldAll","Ctrl-Alt-Up":"addCursorToPrevLine","Ctrl-Alt-Down":"addCursorToNextLine","Ctrl-F3":"findUnder","Shift-Ctrl-F3":"findUnderPrevious","Alt-F3":"findAllUnder","Shift-Ctrl-[":"fold","Shift-Ctrl-]":"unfold","Ctrl-I":"findIncremental","Shift-Ctrl-I":"findIncrementalReverse","Ctrl-H":"replace",F3:"findNext","Shift-F3":"findPrev",fallthrough:"pcDefault"},d.normalizeKeyMap(e.pcSublime);var p=e.default==e.macDefault;e.sublime=p?e.macSublime:e.pcSublime}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror")):"function"==typeof define&&define.amd?define(["../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var t=e.commands,l=e.Pos;function s(e,t){return e.line==t.line&&e.ch==t.ch}var o=[];function a(e){o.push(e),50<o.length&&o.shift()}function n(e){return o[o.length-(e?Math.min(e,1):1)]||""}var c=null;function u(e,t,n,r,i){null==i&&(i=e.getRange(t,n)),"grow"==r&&c&&c.cm==e&&s(t,c.pos)&&e.isClean(c.gen)?function(e){if(!o.length)return a(e);o[o.length-1]+=e}(i):!1!==r&&a(i),e.replaceRange("",t,n,"+delete"),c="grow"==r?{cm:e,pos:t,gen:e.changeGeneration()}:null}function r(e,t,n){return e.findPosH(t,n,"char",!0)}function i(e,t,n){return e.findPosH(t,n,"word",!0)}function d(e,t,n){return e.findPosV(t,n,"line",e.doc.sel.goalColumn)}function f(e,t,n){return e.findPosV(t,n,"page",e.doc.sel.goalColumn)}function h(e,t,n){for(var r=t.line,i=e.getLine(r),o=/\S/.test(n<0?i.slice(0,t.ch):i.slice(t.ch)),a=e.firstLine(),s=e.lastLine();;){if((r+=n)<a||s<r)return e.clipPos(l(r-n,n<0?0:null));i=e.getLine(r);if(/\S/.test(i))o=!0;else if(o)return l(r,0)}}function p(e,t,n){for(var r=t.line,i=t.ch,o=e.getLine(t.line),a=!1;;){var s=o.charAt(i+(n<0?-1:0));if(s){if(a&&/[!?.]/.test(s))return l(r,i+(0<n?1:0));a=a||/\w/.test(s),i+=n}else{if(r==(n<0?e.firstLine():e.lastLine()))return l(r,i);if(o=e.getLine(r+n),!/\S/.test(o))return l(r,i);r+=n,i=n<0?o.length:0}}}function m(e,t,n){var r;if(e.findMatchingBracket&&(r=e.findMatchingBracket(t,{strict:!0}))&&r.match&&(r.forward?1:-1)==n)return 0<n?l(r.to.line,r.to.ch+1):r.to;for(var i=!0;;i=!1){var o=e.getTokenAt(t),a=l(t.line,n<0?o.start:o.end);if(!(i&&0<n&&o.end==t.ch)&&/\w/.test(o.string))return a;o=e.findPosH(a,n,"char");if(s(a,o))return t;t=o}}function g(e,t){var n=e.state.emacsPrefix;return n?(_(e),"-"==n?-1:Number(n)):t?null:1}function v(t){var r="string"==typeof t?function(e){e.execCommand(t)}:t;return function(e){var t=g(e);r(e);for(var n=1;n<t;++n)r(e)}}function y(e,t,n,r){var i=g(e);i<0&&(r=-r,i=-i);for(var o=0;o<i;++o){var a=n(e,t,r);if(s(a,t))break;t=a}return t}function b(t,n){function e(e){e.extendSelection(y(e,e.getCursor(),t,n))}return e.motion=!0,e}function k(e,t,n,r){for(var i,o=e.listSelections(),a=o.length;a--;)u(e,i=o[a].head,y(e,i,t,n),r)}function x(e,t){if(e.somethingSelected()){for(var n,r=e.listSelections(),i=r.length;i--;)u(e,(n=r[i]).anchor,n.head,t);return!0}}function w(e,t){e.state.emacsPrefix?"-"!=t&&(e.state.emacsPrefix+=t):(e.state.emacsPrefix=t,e.on("keyHandled",S),e.on("inputRead",L))}var C={"Alt-G":!0,"Ctrl-X":!0,"Ctrl-Q":!0,"Ctrl-U":!0};function S(e,t){e.state.emacsPrefixMap||C.hasOwnProperty(t)||_(e)}function _(e){e.state.emacsPrefix=null,e.off("keyHandled",S),e.off("inputRead",L)}function L(e,t){var n=g(e);if(1<n&&"+input"==t.origin){for(var r=t.text.join("\n"),i="",o=1;o<n;++o)i+=r;e.replaceSelection(i)}}function M(e,t){"string"==typeof t&&(/^\d$/.test(t)||"Ctrl-U"==t)||(e.removeKeyMap(E),e.state.emacsPrefixMap=!1,e.off("keyHandled",M),e.off("inputRead",M))}function T(e){e.setExtending(!1),e.setCursor(e.getCursor())}function A(e,t,n){var r,i;e.openDialog?e.openDialog((r=t,i=document.createDocumentFragment(),(e=document.createElement("input")).setAttribute("type","text"),e.style.width="10em",i.appendChild(document.createTextNode(r+": ")),i.appendChild(e),i),n,{bottom:!0}):n(prompt(t,""))}function O(e,t){var n=e.getCursor(),r=e.findPosH(n,1,"word");e.replaceRange(t(e.getRange(n,r)),n,r),e.setCursor(r)}t.setMark=function(e){e.setCursor(e.getCursor()),e.setExtending(!e.getExtending()),e.on("change",function(){e.setExtending(!1)})},t.killRegion=function(e){u(e,e.getCursor("start"),e.getCursor("end"),!0)},t.killLineEmacs=v(function(e){var t=e.getCursor(),n=e.clipPos(l(t.line)),r=e.getRange(t,n);/\S/.test(r)||(r+="\n",n=l(t.line+1,0)),u(e,t,n,"grow",r)}),t.killRingSave=function(e){a(e.getSelection()),T(e)},t.yank=function(e){var t=e.getCursor();e.replaceRange(n(g(e)),t,t,"paste"),e.setSelection(t,e.getCursor())},t.yankPop=function(e){e.replaceSelection((1<o.length&&o.pop(),n()),"around","paste")},t.forwardChar=b(r,1),t.backwardChar=b(r,-1),t.deleteChar=function(e){k(e,r,1,!1)},t.deleteForwardChar=function(e){x(e,!1)||k(e,r,1,!1)},t.deleteBackwardChar=function(e){x(e,!1)||k(e,r,-1,!1)},t.forwardWord=b(i,1),t.backwardWord=b(i,-1),t.killWord=function(e){k(e,i,1,"grow")},t.backwardKillWord=function(e){k(e,i,-1,"grow")},t.nextLine=b(d,1),t.previousLine=b(d,-1),t.scrollDownCommand=b(f,-1),t.scrollUpCommand=b(f,1),t.backwardParagraph=b(h,-1),t.forwardParagraph=b(h,1),t.backwardSentence=b(p,-1),t.forwardSentence=b(p,1),t.killSentence=function(e){k(e,p,1,"grow")},t.backwardKillSentence=function(e){u(e,e.getCursor(),p(e,e.getCursor(),1),"grow")},t.killSexp=function(e){k(e,m,1,"grow")},t.backwardKillSexp=function(e){k(e,m,-1,"grow")},t.forwardSexp=b(m,1),t.backwardSexp=b(m,-1),t.markSexp=function(e){var t=e.getCursor();e.setSelection(y(e,t,m,1),t)},t.transposeSexps=function(e){var t=m(e,e.getCursor(),-1),n=m(e,t,1),r=m(e,n,1),i=m(e,r,-1);e.replaceRange(e.getRange(i,r)+e.getRange(n,i)+e.getRange(t,n),t,r)},t.backwardUpList=v(function(e){for(var t=e.getCursor(),n=t.line,r=t.ch,i=[];n>=e.firstLine();){for(var o=e.getLine(n),a=null==r?o.length:r;0<a;)if(")"==(r=o.charAt(--a)))i.push("(");else if("]"==r)i.push("[");else if("}"==r)i.push("{");else if(/[\(\{\[]/.test(r)&&(!i.length||i.pop()!=r))return e.extendSelection(l(n,a));--n,r=null}}),t.justOneSpace=function(e){for(var t=e.getCursor(),n=t.ch,r=t.ch,i=e.getLine(t.line);n&&/\s/.test(i.charAt(n-1));)--n;for(;r<i.length&&/\s/.test(i.charAt(r));)++r;e.replaceRange(" ",l(t.line,n),l(t.line,r))},t.openLine=v(function(e){e.replaceSelection("\n","start")}),t.transposeCharsRepeatable=v(function(e){e.execCommand("transposeChars")}),t.capitalizeWord=v(function(e){O(e,function(e){var t=e.search(/\w/);return-1==t?e:e.slice(0,t)+e.charAt(t).toUpperCase()+e.slice(t+1).toLowerCase()})}),t.upcaseWord=v(function(e){O(e,function(e){return e.toUpperCase()})}),t.downcaseWord=v(function(e){O(e,function(e){return e.toLowerCase()})}),t.undoRepeatable=v("undo"),t.keyboardQuit=function(e){e.execCommand("clearSearch"),T(e)},t.newline=v(function(e){e.replaceSelection("\n","end")}),t.gotoLine=function(n){var e=g(n,!0);if(null!=e&&0<e)return n.setCursor(e-1);A(n,"Goto line",function(e){var t;e&&!isNaN(t=Number(e))&&t==(0|t)&&0<t&&n.setCursor(t-1)})},t.indentRigidly=function(e){e.indentSelection(g(e,!0)||e.getOption("indentUnit"))},t.exchangePointAndMark=function(e){e.setSelection(e.getCursor("head"),e.getCursor("anchor"))},t.quotedInsertTab=v("insertTab"),t.universalArgument=function(e){e.state.emacsPrefixMap=!0,e.addKeyMap(E),e.on("keyHandled",M),e.on("inputRead",M)},e.emacs={kill:u,killRegion:x,repeated:v};var N=e.keyMap.emacs=e.normalizeKeyMap({"Ctrl-W":"killRegion","Ctrl-K":"killLineEmacs","Alt-W":"killRingSave","Ctrl-Y":"yank","Alt-Y":"yankPop","Ctrl-Space":"setMark","Ctrl-Shift-2":"setMark","Ctrl-F":"forwardChar","Ctrl-B":"backwardChar",Right:"forwardChar",Left:"backwardChar","Ctrl-D":"deleteChar",Delete:"deleteForwardChar","Ctrl-H":"deleteBackwardChar",Backspace:"deleteBackwardChar","Alt-F":"forwardWord","Alt-B":"backwardWord","Alt-Right":"forwardWord","Alt-Left":"backwardWord","Alt-D":"killWord","Alt-Backspace":"backwardKillWord","Ctrl-N":"nextLine","Ctrl-P":"previousLine",Down:"nextLine",Up:"previousLine","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd",End:"goLineEnd",Home:"goLineStart","Alt-V":"scrollDownCommand","Ctrl-V":"scrollUpCommand",PageUp:"scrollDownCommand",PageDown:"scrollUpCommand","Ctrl-Up":"backwardParagraph","Ctrl-Down":"forwardParagraph","Alt-{":"backwardParagraph","Alt-}":"forwardParagraph","Alt-A":"backwardSentence","Alt-E":"forwardSentence","Alt-K":"killSentence","Ctrl-X Delete":"backwardKillSentence","Ctrl-Alt-K":"killSexp","Ctrl-Alt-Backspace":"backwardKillSexp","Ctrl-Alt-F":"forwardSexp","Ctrl-Alt-B":"backwardSexp","Shift-Ctrl-Alt-2":"markSexp","Ctrl-Alt-T":"transposeSexps","Ctrl-Alt-U":"backwardUpList","Alt-Space":"justOneSpace","Ctrl-O":"openLine","Ctrl-T":"transposeCharsRepeatable","Alt-C":"capitalizeWord","Alt-U":"upcaseWord","Alt-L":"downcaseWord","Alt-;":"toggleComment","Ctrl-/":"undoRepeatable","Shift-Ctrl--":"undoRepeatable","Ctrl-Z":"undoRepeatable","Cmd-Z":"undoRepeatable","Ctrl-X U":"undoRepeatable","Shift-Ctrl-Z":"redo","Shift-Alt-,":"goDocStart","Shift-Alt-.":"goDocEnd","Ctrl-S":"findPersistentNext","Ctrl-R":"findPersistentPrev","Ctrl-G":"keyboardQuit","Shift-Alt-5":"replace","Alt-/":"autocomplete",Enter:"newlineAndIndent","Ctrl-J":"newline",Tab:"indentAuto","Alt-G G":"gotoLine","Ctrl-X Tab":"indentRigidly","Ctrl-X Ctrl-X":"exchangePointAndMark","Ctrl-X Ctrl-S":"save","Ctrl-X Ctrl-W":"save","Ctrl-X S":"saveAll","Ctrl-X F":"open","Ctrl-X K":"close","Ctrl-X H":"selectAll","Ctrl-Q Tab":"quotedInsertTab","Ctrl-U":"universalArgument",fallthrough:"default"}),E={"Ctrl-G":_};function I(t){E[t]=function(e){w(e,t)},N["Ctrl-"+t]=function(e){w(e,t)},C["Ctrl-"+t]=!0}for(var P=0;P<10;++P)I(String(P));I("-")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/dialog/dialog"),require("../addon/edit/matchbrackets.js")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/dialog/dialog","../addon/edit/matchbrackets"],e):e(CodeMirror)}(function(Ye){"use strict";var Qe=[{keys:"<Left>",type:"keyToKey",toKeys:"h"},{keys:"<Right>",type:"keyToKey",toKeys:"l"},{keys:"<Up>",type:"keyToKey",toKeys:"k"},{keys:"<Down>",type:"keyToKey",toKeys:"j"},{keys:"<Space>",type:"keyToKey",toKeys:"l"},{keys:"<BS>",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"<Del>",type:"keyToKey",toKeys:"x",context:"normal"},{keys:"<C-Space>",type:"keyToKey",toKeys:"W"},{keys:"<C-BS>",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"<S-Space>",type:"keyToKey",toKeys:"w"},{keys:"<S-BS>",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"<C-n>",type:"keyToKey",toKeys:"j"},{keys:"<C-p>",type:"keyToKey",toKeys:"k"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"<Home>",type:"keyToKey",toKeys:"0"},{keys:"<End>",type:"keyToKey",toKeys:"$"},{keys:"<PageUp>",type:"keyToKey",toKeys:"<C-b>"},{keys:"<PageDown>",type:"keyToKey",toKeys:"<C-f>"},{keys:"<CR>",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"<Ins>",type:"action",action:"toggleOverwrite",context:"insert"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"(",type:"motion",motion:"moveBySentence",motionArgs:{forward:!1}},{keys:")",type:"motion",motion:"moveBySentence",motionArgs:{forward:!0}},{keys:"<C-f>",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"<C-b>",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"<C-d>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"<C-u>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'<character>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<character>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:"=",type:"operator",operator:"indentAuto"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"gn",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!0}},{keys:"gN",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!1}},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"expandToLine",motionArgs:{linewise:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"<C-w>",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"<C-w>",type:"idle",context:"normal"},{keys:"<C-i>",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"<C-o>",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"<C-e>",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"<C-y>",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"gi",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"lastEdit"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"gI",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"bol"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"<C-v>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"<C-q>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"gJ",type:"action",action:"joinLines",actionArgs:{keepSpaces:!0},isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r<character>",type:"action",action:"replace",isEdit:!0},{keys:"@<character>",type:"action",action:"replayMacro"},{keys:"q<character>",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0},context:"normal"},{keys:"R",type:"operator",operator:"change",operatorArgs:{linewise:!0,fullLine:!0},context:"visual",exitVisualBlock:!0},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"<C-r>",type:"action",action:"redo"},{keys:"m<character>",type:"action",action:"setMark"},{keys:'"<character>',type:"action",action:"setRegister"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z<CR>",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"<C-a>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"<C-x>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"<C-t>",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"<C-d>",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a<character>",type:"motion",motion:"textObjectManipulation"},{keys:"i<character>",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],Je=Qe.length,Ze=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"unmap"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"vglobal",shortName:"v"},{name:"global",shortName:"g"}],et=Ye.Pos;Ye.Vim=function(){function e(e,t){var n;this==Ye.keyMap.vim&&(Ye.rmClass(e.getWrapperElement(),"cm-fat-cursor"),"contenteditable"==e.getOption("inputStyle")&&null!=document.body.style.caretColor&&(a(n=e),n.off("cursorActivity",i),n.state.fatCursorMarks=null,e.getInputField().style.caretColor="")),t&&t.attach==r||((e=e).setOption("disableInput",!1),e.off("cursorActivity",je),Ye.off(e.getInputField(),"paste",l(e)),e.state.vim=null)}function r(e,t){var n;this==Ye.keyMap.vim&&(Ye.addClass(e.getWrapperElement(),"cm-fat-cursor"),"contenteditable"==e.getOption("inputStyle")&&null!=document.body.style.caretColor&&((n=e).state.fatCursorMarks=[],i(n),n.on("cursorActivity",i),e.getInputField().style.caretColor="transparent")),t&&t.attach==r||((e=e).setOption("disableInput",!0),e.setOption("showCursorWhenSelecting",!1),Ye.signal(e,"vim-mode-change",{mode:"normal"}),e.on("cursorActivity",je),I(e),Ye.on(e.getInputField(),"paste",l(e)))}function i(e){if(e.state.fatCursorMarks){a(e);for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){var i,o=t[r];o.empty()&&(i=e.getLine(o.anchor.line).length,o.anchor.ch<i?n.push(e.markText(o.anchor,et(o.anchor.line,o.anchor.ch+1),{className:"cm-fat-cursor-mark"})):n.push(e.markText(et(o.anchor.line,i-1),et(o.anchor.line,i),{className:"cm-fat-cursor-mark"})))}e.state.fatCursorMarks=n}}function a(e){var t=e.state.fatCursorMarks;if(t)for(var n=0;n<t.length;n++)t[n].clear()}function t(e,t){if(t){if(this[e])return this[e];var n=function(e){if("'"==e.charAt(0))return e.charAt(1);var t=e.split(/-(?!$)/),e=t[t.length-1];{if(1==t.length&&1==t[0].length)return!1;if(2==t.length&&"Shift"==t[0]&&1==e.length)return!1}for(var n=!1,r=0;r<t.length;r++){var i=t[r];i in o?t[r]=o[i]:n=!0,i in s&&(t[r]=s[i])}if(!n)return!1;k(e)&&(t[t.length-1]=e.toLowerCase());return"<"+t.join("-")+">"}(e);if(!n)return!1;e=Ye.Vim.findKey(t,n);return"function"==typeof e&&Ye.signal(t,"vim-keypress",n),e}}Ye.defineOption("vimMode",!1,function(e,t,n){t&&"vim"!=e.getOption("keyMap")?e.setOption("keyMap","vim"):!t&&n!=Ye.Init&&/^vim/.test(e.getOption("keyMap"))&&e.setOption("keyMap","default")});var o={Shift:"S",Ctrl:"C",Alt:"A",Cmd:"D",Mod:"A",CapsLock:""},s={Enter:"CR",Backspace:"BS",Delete:"Del",Insert:"Ins"};function l(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor($(e.getCursor(),0,1)),K.enterInsertMode(e,{},t))}),t.onPasteFn}var c=/[\d]/,m=[Ye.isWordChar,function(e){return e&&!Ye.isWordChar(e)&&!/\s/.test(e)}],g=[function(e){return/\S/.test(e)}];function n(e,t){for(var n=[],r=e;r<e+t;r++)n.push(String.fromCharCode(r));return n}var u,d=n(65,26),f=n(97,26),h=n(48,10),p=[].concat(d,f,h,["<",">"]),v=[].concat(d,f,h,["-",'"',".",":","_","/"]);try{u=new RegExp("^[\\p{Lu}]$","u")}catch(e){u=/^[A-Z]$/}function y(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function b(e){return/^[a-z]$/.test(e)}function k(e){return u.test(e)}function _(e){return/^\s*$/.test(e)}function x(e){return-1!=".?!".indexOf(e)}function w(e,t){for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1}var C={};function S(e,t,n,r,i){if(void 0===t&&!i)throw Error("defaultValue is required unless callback is provided");if(C[e]={type:n=n||"string",defaultValue:t,callback:i},r)for(var o=0;o<r.length;o++)C[r[o]]=C[e];t&&L(e,t)}function L(e,t,n,r){var i=C[e],r=(r=r||{}).scope;if(!i)return new Error("Unknown option: "+e);if("boolean"==i.type){if(t&&!0!==t)return new Error("Invalid argument: "+e+"="+t);!1!==t&&(t=!0)}i.callback?("local"!==r&&i.callback(t,void 0),"global"!==r&&n&&i.callback(t,n)):("local"!==r&&(i.value="boolean"==i.type?!!t:t),"global"!==r&&n&&(n.state.vim.options[e]={value:t}))}function M(e,t,n){var r=C[e],n=(n=n||{}).scope;if(!r)return new Error("Unknown option: "+e);if(r.callback){var i=t&&r.callback(void 0,t);return"global"!==n&&void 0!==i?i:"local"!==n?r.callback():void 0}return((i="global"!==n&&t&&t.state.vim.options[e])||"local"!==n&&r||{}).value}S("filetype",void 0,"string",["ft"],function(e,t){if(void 0!==t){if(void 0===e)return"null"==(n=t.getOption("mode"))?"":n;var n=""==e?"null":e;t.setOption("mode",n)}});function T(){var a=100,s=-1,l=0,c=0,u=new Array(a);function r(e,t){l<(s+=t)?s=l:s<c&&(s=c);var n=u[(a+s)%a];if(n&&!n.find()){var r,i=0<t?1:-1,o=e.getCursor();do{if((n=u[(a+(s+=i))%a])&&(r=n.find())&&!Y(o,r))break}while(s<l&&c<s)}return n}return{cachedCursor:void 0,add:function(r,e,t){var n=u[s%a];function i(e){var t=++s%a,n=u[t];n&&n.clear(),u[t]=r.setBookmark(e)}n&&(!(n=n.find())||Y(n,e))||i(e),i(t),(c=(l=s)-a+1)<0&&(c=0)},find:function(e,t){var n=s,t=r(e,t);return s=n,t&&t.find()},move:r}}function A(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}}var O,N;function E(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=A()}function I(e){return e.state.vim||(e.state.vim={inputState:new R,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},fakeCursor:null,insertMode:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:null,sel:{},options:{}}),e.state.vim}function P(){for(var e in O={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:T(),macroModeState:new E,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new F({}),searchHistoryController:new z,exCommandHistoryController:new z},C){e=C[e];e.value=e.defaultValue}}f={buildKeyMap:function(){},getRegisterController:function(){return O.registerController},resetVimGlobalState_:P,getVimGlobalState_:function(){return O},maybeInitVimState_:I,suppressErrorLogging:!(E.prototype={exitMacroRecordMode:function(){var e=O.macroModeState;e.onRecordingDone&&e.onRecordingDone(),e.onRecordingDone=void 0,e.isRecording=!1},enterMacroRecordMode:function(e,t){var n=O.registerController.getRegister(t);n&&(n.clear(),this.latestRegister=t,e.openDialog&&(this.onRecordingDone=e.openDialog(document.createTextNode("(recording)["+t+"]"),null,{bottom:!0})),this.isRecording=!0)}}),InsertModeKey:Ve,map:function(e,t,n){ze.map(e,t,n)},unmap:function(e,t){ze.unmap(e,t)},noremap:function(e,t,n){function r(e){return e?[e]:["normal","insert","visual"]}for(var i=r(n),o=Qe.length,a=o-Je;a<o&&i.length;a++){var s=Qe[a];if(!(s.keys!=t||n&&s.context&&s.context!==n||"ex"===s.type.substr(0,2)||"key"===s.type.substr(0,3))){var l,c={};for(l in s)c[l]=s[l];c.keys=e,n&&!c.context&&(c.context=n),this._mapCommand(c);var u=r(s.context),i=i.filter(function(e){return-1===u.indexOf(e)})}}},mapclear:function(e){var t=Qe.length,n=Je,r=Qe.slice(0,t-n);if(Qe=Qe.slice(t-n),e)for(var i=r.length-1;0<=i;i--){var o=r[i];if(e!==o.context)if(o.context)this._mapCommand(o);else{var a,s=["normal","insert","visual"];for(a in s)if(s[a]!==e){var l,c={};for(l in o)c[l]=o[l];c.context=s[a],this._mapCommand(c)}}}},setOption:L,getOption:M,defineOption:S,defineEx:function(e,t,n){if(t){if(0!==e.indexOf(t))throw new Error('(Vim.defineEx) "'+t+'" is not a prefix of "'+e+'", command not registered')}else t=e;Fe[e]=n,ze.commandMap_[t]={name:e,shortName:t,type:"api"}},handleKey:function(e,t,n){n=this.findKey(e,t,n);if("function"==typeof n)return n()},findKey:function(s,l,n){var e,c=I(s);function r(){var e,t=O.macroModeState;if(t.isRecording){if("q"==l)return t.exitMacroRecordMode(),B(s),1;"mapping"!=n&&(e=l,(t=t).isPlaying||(t=t.latestRegister,(t=O.registerController.getRegister(t))&&t.pushText(e)))}}function u(){return"<Esc>"==l&&(B(s),c.visualMode?le(s):c.insertMode&&We(s),1)}return!1===(e=(c.insertMode?function(){if(u())return!0;for(var e=c.inputState.keyBuffer=c.inputState.keyBuffer+l,t=1==l.length,n=W.matchCommand(e,Qe,c.inputState,"insert");1<e.length&&"full"!=n.type;){var e=c.inputState.keyBuffer=e.slice(1),r=W.matchCommand(e,Qe,c.inputState,"insert");"none"!=r.type&&(n=r)}if("none"==n.type)return B(s),!1;if("partial"==n.type)return N&&window.clearTimeout(N),N=window.setTimeout(function(){c.insertMode&&c.inputState.keyBuffer&&B(s)},M("insertModeEscKeysTimeout")),!t;if(N&&window.clearTimeout(N),t){for(var i=s.listSelections(),o=0;o<i.length;o++){var a=i[o].head;s.replaceRange("",$(a,0,-(e.length-1)),a,"+input")}O.macroModeState.lastInsertModeChanges.changes.pop()}return B(s),n.command}:function(){if(r()||u())return!0;var e=c.inputState.keyBuffer=c.inputState.keyBuffer+l;if(/^[1-9]\d*$/.test(e))return!0;var t=/^(\d*)(.*)$/.exec(e);if(!t)return B(s),!1;var n=c.visualMode?"visual":"normal";return"none"==(n=W.matchCommand(t[2]||t[1],Qe,c.inputState,n)).type?(B(s),!1):"partial"==n.type||(c.inputState.keyBuffer="",(t=/^(\d*)(.*)$/.exec(e))[1]&&"0"!=t[1]&&c.inputState.pushRepeatDigit(t[1]),n.command)})())?c.insertMode||1!==l.length?void 0:function(){return!0}:!0===e?function(){return!0}:function(){return s.operation(function(){s.curOp.isVimOp=!0;try{"keyToKey"==e.type?function(e){for(var t;e;)t=/<\w+-.+?>|<\w+>|./.exec(e),l=t[0],e=e.substring(t.index+l.length),Ye.Vim.handleKey(s,l,"mapping")}(e.toKeys):W.processCommand(s,c,e)}catch(e){throw s.state.vim=void 0,I(s),Ye.Vim.suppressErrorLogging||console.log(e),e}return!0})}},handleEx:function(e,t){ze.processCommand(e,t)},defineMotion:function(e,t){q[e]=t},defineAction:function(e,t){K[e]=t},defineOperator:function(e,t){j[e]=t},mapCommand:function(e,t,n,r,i){var o,a={keys:e,type:t};for(o in a[t]=n,a[t+"Args"]=r,i)a[o]=i[o];qe(a)},_mapCommand:qe,defineRegister:function(e,t){var n=O.registerController.registers;if(!e||1!=e.length)throw Error("Register name must be 1 character");if(n[e])throw Error("Register already defined "+e);n[e]=t,v.push(e)},exitVisualMode:le,exitInsertMode:We};function R(){this.prefixRepeat=[],this.motionRepeat=[],this.operator=null,this.operatorArgs=null,this.motion=null,this.motionArgs=null,this.keyBuffer=[],this.registerName=null}function B(e,t){e.state.vim.inputState=new R,Ye.signal(e,"vim-command-done",t)}function D(e,t,n){this.clear(),this.keyBuffer=[e||""],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!t,this.blockwise=!!n}function F(e){this.registers=e,this.unnamedRegister=e['"']=new D,e["."]=new D,e[":"]=new D,e["/"]=new D}function z(){this.historyBuffer=[],this.iterator=0,this.initialPrefix=null}R.prototype.pushRepeatDigit=function(e){this.operator?this.motionRepeat=this.motionRepeat.concat(e):this.prefixRepeat=this.prefixRepeat.concat(e)},R.prototype.getRepeat=function(){var e=0;return(0<this.prefixRepeat.length||0<this.motionRepeat.length)&&(e=1,0<this.prefixRepeat.length&&(e*=parseInt(this.prefixRepeat.join(""),10)),0<this.motionRepeat.length&&(e*=parseInt(this.motionRepeat.join(""),10))),e},D.prototype={setText:function(e,t,n){this.keyBuffer=[e||""],this.linewise=!!t,this.blockwise=!!n},pushText:function(e,t){t&&(this.linewise||this.keyBuffer.push("\n"),this.linewise=!0),this.keyBuffer.push(e)},pushInsertModeChanges:function(e){this.insertModeChanges.push(A(e))},pushSearchQuery:function(e){this.searchQueries.push(e)},clear:function(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1},toString:function(){return this.keyBuffer.join("")}},F.prototype={pushText:function(e,t,n,r,i){if("_"!==e){r&&"\n"!==n.charAt(n.length-1)&&(n+="\n");var o=this.isValidRegister(e)?this.getRegister(e):null;if(o)k(e)?o.pushText(n,r):o.setText(n,r,i),this.unnamedRegister.setText(o.toString(),r);else{switch(t){case"yank":this.registers[0]=new D(n,r,i);break;case"delete":case"change":-1==n.indexOf("\n")?this.registers["-"]=new D(n,r):(this.shiftNumericRegisters_(),this.registers[1]=new D(n,r))}this.unnamedRegister.setText(n,r,i)}}},getRegister:function(e){return this.isValidRegister(e)?(e=e.toLowerCase(),this.registers[e]||(this.registers[e]=new D),this.registers[e]):this.unnamedRegister},isValidRegister:function(e){return e&&w(e,v)},shiftNumericRegisters_:function(){for(var e=9;2<=e;e--)this.registers[e]=this.getRegister(""+(e-1))}},z.prototype={nextMatch:function(e,t){var n=this.historyBuffer,r=t?-1:1;null===this.initialPrefix&&(this.initialPrefix=e);for(var i=this.iterator+r;t?0<=i:i<n.length;i+=r)for(var o=n[i],a=0;a<=o.length;a++)if(this.initialPrefix==o.substring(0,a))return this.iterator=i,o;return i>=n.length?(this.iterator=n.length,this.initialPrefix):i<0?e:void 0},pushInput:function(e){var t=this.historyBuffer.indexOf(e);-1<t&&this.historyBuffer.splice(t,1),e.length&&this.historyBuffer.push(e)},reset:function(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}};var W={matchCommand:function(e,t,n,r){var i=function(e,t,n,r){for(var i,o=[],a=[],s=0;s<t.length;s++){var l=t[s];"insert"==n&&"insert"!=l.context||l.context&&l.context!=n||r.operator&&"action"==l.type||!(i=function(e,t){{if("<character>"!=t.slice(-11))return e==t?"full":0==t.indexOf(e)&&"partial";var n=t.length-11,r=e.slice(0,n),t=t.slice(0,n);return r==t&&e.length>n?"full":0==t.indexOf(r)&&"partial"}}(e,l.keys))||("partial"==i&&o.push(l),"full"==i&&a.push(l))}return{partial:o.length&&o,full:a.length&&a}}(e,t,r,n);if(!i.full&&!i.partial)return{type:"none"};if(!i.full&&i.partial)return{type:"partial"};for(var o=0;o<i.full.length;o++)var a=i.full[o],s=s||a;if("<character>"==s.keys.slice(-11)){e=function(e){var t=/^.*(<[^>]+>)$/.exec(e),n=t?t[1]:e.slice(-1);if(1<n.length)switch(n){case"<CR>":n="\n";break;case"<Space>":n=" ";break;default:n=""}return n}(e);if(!e)return{type:"none"};n.selectedCharacter=e}return{type:"full",command:s}},processCommand:function(e,t,n){switch(t.inputState.repeatOverride=n.repeatOverride,n.type){case"motion":this.processMotion(e,t,n);break;case"operator":this.processOperator(e,t,n);break;case"operatorMotion":this.processOperatorMotion(e,t,n);break;case"action":this.processAction(e,t,n);break;case"search":this.processSearch(e,t,n);break;case"ex":case"keyToEx":this.processEx(e,t,n)}},processMotion:function(e,t,n){t.inputState.motion=n.motion,t.inputState.motionArgs=V(n.motionArgs),this.evalInput(e,t)},processOperator:function(e,t,n){var r=t.inputState;if(r.operator){if(r.operator==n.operator)return r.motion="expandToLine",r.motionArgs={linewise:!0},void this.evalInput(e,t);B(e)}r.operator=n.operator,r.operatorArgs=V(n.operatorArgs),n.exitVisualBlock&&(t.visualBlock=!1,ae(e)),t.visualMode&&this.evalInput(e,t)},processOperatorMotion:function(e,t,n){var r=t.visualMode,i=V(n.operatorMotionArgs);i&&r&&i.visualLine&&(t.visualLine=!0),this.processOperator(e,t,n),r||this.processMotion(e,t,n)},processAction:function(e,t,n){var r=t.inputState,i=r.getRepeat(),o=!!i,a=V(n.actionArgs)||{};r.selectedCharacter&&(a.selectedCharacter=r.selectedCharacter),n.operator&&this.processOperator(e,t,n),n.motion&&this.processMotion(e,t,n),(n.motion||n.operator)&&this.evalInput(e,t),a.repeat=i||1,a.repeatIsExplicit=o,a.registerName=r.registerName,B(e),t.lastMotion=null,n.isEdit&&this.recordLastEdit(t,r,n),K[n.action](e,a,t)},processSearch:function(a,r,i){if(a.getSearchCursor){var s=i.searchArgs.forward,e=i.searchArgs.wholeWordOnly;ke(a).setReversed(!s);var t=s?"/":"?",o=ke(a).getQuery(),l=a.getScrollInfo();switch(i.searchArgs.querySrc){case"prompt":var n=O.macroModeState;n.isPlaying?d(u=n.replaySearchQueries.shift(),!0,!1):Ae(a,{onClose:f,prefix:t,desc:"(JavaScript regexp)",onKeyUp:function(e,t,n){var r,i,o=Ye.keyName(e);"Up"==o||"Down"==o?(r=e.target?e.target.selectionEnd:0,n(t=O.searchHistoryController.nextMatch(t,"Up"==o)||""),r&&e.target&&(e.target.selectionEnd=e.target.selectionStart=Math.min(r,e.target.value.length))):"Left"!=o&&"Right"!=o&&"Ctrl"!=o&&"Alt"!=o&&"Shift"!=o&&O.searchHistoryController.reset();try{i=Oe(a,t,!0,!0)}catch(e){}i?a.scrollIntoView(Ie(a,!s,i),30):(Pe(a),a.scrollTo(l.left,l.top))},onKeyDown:function(e,t,n){var r=Ye.keyName(e);"Esc"==r||"Ctrl-C"==r||"Ctrl-["==r||"Backspace"==r&&""==t?(O.searchHistoryController.pushInput(t),O.searchHistoryController.reset(),Oe(a,o),Pe(a),a.scrollTo(l.left,l.top),Ye.e_stop(e),B(a),n(),a.focus()):"Up"==r||"Down"==r?Ye.e_stop(e):"Ctrl-U"==r&&(Ye.e_stop(e),n(""))}});break;case"wordUnderCursor":var c=ue(a,!1,0,!1,!0),n=!0;if(c||(c=ue(a,!1,0,!1,!1),n=!1),!c)return;var u=a.getLine(c.start.line).substring(c.start.ch,c.end.ch);u=n&&e?"\\b"+u+"\\b":u.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1"),O.jumpList.cachedCursor=a.getCursor(),a.setCursor(c.start),d(u,!0,!1)}}function d(t,e,n){O.searchHistoryController.pushInput(t),O.searchHistoryController.reset();try{Oe(a,t,e,n)}catch(e){return Te(a,"Invalid regex: "+t),void B(a)}W.processMotion(a,r,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:i.searchArgs.toJumplist}})}function f(e){a.scrollTo(l.left,l.top),d(e,!0,!0);var t=O.macroModeState;t.isRecording&&(e=e,(t=t).isPlaying||(t=t.latestRegister,(t=O.registerController.getRegister(t))&&t.pushSearchQuery&&t.pushSearchQuery(e)))}},processEx:function(o,e,t){function n(e){O.exCommandHistoryController.pushInput(e),O.exCommandHistoryController.reset(),ze.processCommand(o,e)}function r(e,t,n){var r,i=Ye.keyName(e);("Esc"==i||"Ctrl-C"==i||"Ctrl-["==i||"Backspace"==i&&""==t)&&(O.exCommandHistoryController.pushInput(t),O.exCommandHistoryController.reset(),Ye.e_stop(e),B(o),n(),o.focus()),"Up"==i||"Down"==i?(Ye.e_stop(e),r=e.target?e.target.selectionEnd:0,n(t=O.exCommandHistoryController.nextMatch(t,"Up"==i)||""),r&&e.target&&(e.target.selectionEnd=e.target.selectionStart=Math.min(r,e.target.value.length))):"Ctrl-U"==i?(Ye.e_stop(e),n("")):"Left"!=i&&"Right"!=i&&"Ctrl"!=i&&"Alt"!=i&&"Shift"!=i&&O.exCommandHistoryController.reset()}"keyToEx"==t.type?ze.processCommand(o,t.exArgs.input):e.visualMode?Ae(o,{onClose:n,prefix:":",value:"'<,'>",onKeyDown:r,selectValueOnOpen:!1}):Ae(o,{onClose:n,prefix:":",onKeyDown:r})},evalInput:function(e,t){var n,r,i,o,a,s=t.inputState,l=s.motion,c=s.motionArgs||{},u=s.operator,d=s.operatorArgs||{},f=s.registerName,h=t.sel,p=X(t.visualMode?U(e,h.head):e.getCursor("head")),m=X(t.visualMode?U(e,h.anchor):e.getCursor("anchor")),g=X(p),v=X(m);if(u&&this.recordLastEdit(t,s),0<(m=void 0!==s.repeatOverride?s.repeatOverride:s.getRepeat())&&c.explicitRepeat?c.repeatIsExplicit=!0:(c.noRepeat||!c.explicitRepeat&&0===m)&&(c.repeatIsExplicit=!(m=1)),s.selectedCharacter&&(c.selectedCharacter=d.selectedCharacter=s.selectedCharacter),c.repeat=m,B(e),l){var y,b=q[l](e,p,c,t,s);if(t.lastMotion=q[l],!b)return;c.toJumplist&&((S=(y=O.jumpList).cachedCursor)?(de(e,S,b),delete y.cachedCursor):de(e,p,b)),S=(S=b instanceof Array?(n=b[0],b[1]):b)||X(p),t.visualMode?(t.visualBlock&&S.ch===1/0||(S=U(e,S)),n=n&&U(e,n),h.anchor=n=n||v,h.head=S,ae(e),ve(e,t,"<",Q(n,S)?n:S),ve(e,t,">",Q(n,S)?S:n)):u||(S=U(e,S),e.setCursor(S.line,S.ch))}if(u){if(d.lastSel?(n=v,y=d.lastSel,b=Math.abs(y.head.line-y.anchor.line),p=Math.abs(y.head.ch-y.anchor.ch),S=y.visualLine?et(v.line+b,v.ch):y.visualBlock?et(v.line+b,v.ch+p):y.head.line==y.anchor.line?et(v.line,v.ch+p):et(v.line+b,v.ch),t.visualMode=!0,t.visualLine=y.visualLine,t.visualBlock=y.visualBlock,h=t.sel={anchor:n,head:S},ae(e)):t.visualMode&&(d.lastSel={anchor:X(h.anchor),head:X(h.head),visualBlock:t.visualBlock,visualLine:t.visualLine}),t.visualMode){if(i=J(h.head,h.anchor),o=Z(h.head,h.anchor),r=t.visualLine||d.linewise,C=se(e,{anchor:i,head:o},w=t.visualBlock?"block":r?"line":"char"),r){var k=C.ranges;if("block"==w)for(var x=0;x<k.length;x++)k[x].head.ch=te(e,k[x].head.line);else"line"==w&&(k[0].head=et(k[0].head.line+1,0))}}else{i=X(n||v),Q(o=X(S||g),i)&&(a=i,i=o,o=a),(r=c.linewise||d.linewise)?(a=o,i.ch=0,a.ch=0,a.line++):c.forward&&function(e,t,n){t=e.getRange(t,n);if(/\n\s*$/.test(t)){var r=t.split("\n");r.pop();for(var i=r.pop();0<r.length&&i&&_(i);i=r.pop())n.line--,n.ch=0;i?(n.line--,n.ch=te(e,n.line)):n.ch=0}}(e,i,o);var w="char",c=!c.inclusive||r,C=se(e,{anchor:i,head:o},w,c)}e.setSelections(C.ranges,C.primary),t.lastMotion=null,d.repeat=m,d.registerName=f,d.linewise=r;var S=j[u](e,d,C.ranges,v,S);t.visualMode&&le(e,null!=S),S&&e.setCursor(S)}},recordLastEdit:function(e,t,n){var r=O.macroModeState;r.isPlaying||(e.lastEditInputState=t,e.lastEditActionCommand=n,r.lastInsertModeChanges.changes=[],r.lastInsertModeChanges.expectCursorActivityForChange=!1,r.lastInsertModeChanges.visualBlock=e.visualBlock?e.sel.head.line-e.sel.anchor.line:0)}},q={moveToTopLine:function(e,t,n){n=Re(e).top+n.repeat-1;return et(n,ce(e.getLine(n)))},moveToMiddleLine:function(e){var t=Re(e),t=Math.floor(.5*(t.top+t.bottom));return et(t,ce(e.getLine(t)))},moveToBottomLine:function(e,t,n){n=Re(e).bottom-n.repeat+1;return et(n,ce(e.getLine(n)))},expandToLine:function(e,t,n){return et(t.line+n.repeat-1,1/0)},findNext:function(e,t,n){var r=ke(e),i=r.getQuery();if(i){var o=!n.forward,o=r.isReversed()?!o:o;return Ee(e,i),Ie(e,o,i,n.repeat)}},findAndSelectNextInclusive:function(e,t,n,r,i){var o=ke(e),a=o.getQuery();if(a){var s=!n.forward,l=function(i,o,a,s,l){void 0===s&&(s=1);return i.operation(function(){var e=i.getCursor(),t=i.getSearchCursor(a,e),n=t.find(!o);!l.visualMode&&n&&Y(t.from(),e)&&t.find(!o);for(var r=0;r<s;r++)if(!(n=t.find(o))&&!(t=i.getSearchCursor(a,o?et(i.lastLine()):et(i.firstLine(),0))).find(o))return;return[t.from(),t.to()]})}(e,s=o.isReversed()?!s:s,a,n.repeat,r);if(l){if(i.operator)return l;a=l[0],i=et(l[1].line,l[1].ch-1);if(r.visualMode){(r.visualLine||r.visualBlock)&&(r.visualLine=!1,r.visualBlock=!1,Ye.signal(e,"vim-mode-change",{mode:"visual",subMode:""}));l=r.sel.anchor;if(l)return o.isReversed()?n.forward?[l,a]:[l,i]:n.forward?[l,i]:[l,a]}else r.visualMode=!0,r.visualLine=!1,r.visualBlock=!1,Ye.signal(e,"vim-mode-change",{mode:"visual",subMode:""});return s?[i,a]:[a,i]}}},goToMark:function(e,t,n,r){r=Be(e,r,n.selectedCharacter);return r?n.linewise?{line:r.line,ch:ce(e.getLine(r.line))}:r:null},moveToOtherHighlightedEnd:function(e,t,n,r){if(r.visualBlock&&n.sameLine){n=r.sel;return[U(e,et(n.anchor.line,n.head.ch)),U(e,et(n.head.line,n.anchor.ch))]}return[r.sel.head,r.sel.anchor]},jumpToMark:function(e,t,n,r){for(var i=t,o=0;o<n.repeat;o++){var a,s,l,c,u=i;for(a in r.marks)b(a)&&(s=r.marks[a].find(),(n.forward?Q(s,u):Q(u,s))||n.linewise&&s.line==u.line||(l=Y(u,i),c=n.forward?ee(u,s,i):ee(i,s,u),(l||c)&&(i=s)))}return i=n.linewise?et(i.line,ce(e.getLine(i.line))):i},moveByCharacters:function(e,t,n){var r=n.repeat,r=n.forward?t.ch+r:t.ch-r;return et(t.line,r)},moveByLines:function(e,t,n,r){var i=t,o=i.ch;switch(r.lastMotion){case this.moveByLines:case this.moveByDisplayLines:case this.moveByScroll:case this.moveToColumn:case this.moveToEol:o=r.lastHPos;break;default:r.lastHPos=o}var a=n.repeat+(n.repeatOffset||0),s=n.forward?i.line+a:i.line-a,l=e.firstLine(),c=e.lastLine(),a=e.findPosV(i,n.forward?a:-a,"line",r.lastHSPos);return(n.forward?a.line>s:a.line<s)&&(s=a.line,o=a.ch),s<l&&i.line==l?this.moveToStartOfLine(e,t,n,r):c<s&&i.line==c?me(e,t,n,r,!0):(n.toFirstChar&&(o=ce(e.getLine(s)),r.lastHPos=o),r.lastHSPos=e.charCoords(et(s,o),"div").left,et(s,o))},moveByDisplayLines:function(e,t,n,r){var i=t;switch(r.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:r.lastHSPos=e.charCoords(i,"div").left}var o,t=n.repeat,t=e.findPosV(i,n.forward?t:-t,"line",r.lastHSPos);return t.hitSide&&(t=n.forward?(o={top:e.charCoords(t,"div").top+8,left:r.lastHSPos},e.coordsChar(o,"div")):((o=e.charCoords(et(e.firstLine(),0),"div")).left=r.lastHSPos,e.coordsChar(o,"div"))),r.lastHPos=t.ch,t},moveByPage:function(e,t,n){var r=n.repeat;return e.findPosV(t,n.forward?r:-r,"page")},moveByParagraph:function(e,t,n){var r=n.forward?1:-1;return ye(e,t,n.repeat,r)},moveBySentence:function(e,t,n){var r=n.forward?1:-1;return function(e,t,n,r){function u(e,t){if(t.pos+t.dir<0||t.pos+t.dir>=t.line.length){if(t.ln+=t.dir,!y(e,t.ln))return t.line=null,t.ln=null,void(t.pos=null);t.line=e.getLine(t.ln),t.pos=0<t.dir?0:t.line.length-1}else t.pos+=t.dir}var i={ln:t.line,pos:t.ch};for(;0<n;)i=(r<0?function(e,t,n,r){var i={line:s=e.getLine(t),ln:t,pos:n,dir:r},o={ln:i.ln,pos:null},a=""===i.line;for(u(e,i);null!==i.line;){if(""===i.line&&!a)return null!==o.pos?o:{ln:i.ln,pos:i.pos};if(x(i.line[i.pos])&&null!==o.pos&&(i.ln!==o.ln||i.pos+1!==o.pos))return o;""===i.line||_(i.line[i.pos])||(a=!1,o={ln:i.ln,pos:i.pos}),u(e,i)}for(var s=e.getLine(o.ln),l=o.pos=0;l<s.length;++l)if(!_(s[l])){o.pos=l;break}return o}:function(e,t,n,r){var i=""===(l=e.getLine(t)),o={line:l,ln:t,pos:n,dir:r},a={ln:o.ln,pos:o.pos},s=""===o.line;for(u(e,o);null!==o.line;){if(a.ln=o.ln,a.pos=o.pos,""===o.line&&!s)return{ln:o.ln,pos:o.pos};if(i&&""!==o.line&&!_(o.line[o.pos]))return{ln:o.ln,pos:o.pos};!x(o.line[o.pos])||i||o.pos!==o.line.length-1&&!_(o.line[o.pos+1])||(i=!0),u(e,o)}var l=e.getLine(a.ln);a.pos=0;for(var c=l.length-1;0<=c;--c)if(!_(l[c])){a.pos=c;break}return a})(e,i.ln,i.pos,r),n--;return et(i.ln,i.pos)}(e,t,n.repeat,r)},moveByScroll:function(e,t,n,r){var i=e.getScrollInfo(),o=null,a=(a=n.repeat)||i.clientHeight/(2*e.defaultTextHeight()),s=e.charCoords(t,"local");if(n.repeat=a,!(o=q.moveByDisplayLines(e,t,n,r)))return null;r=e.charCoords(o,"local");return e.scrollTo(null,i.top+r.top-s.top),o},moveByWords:function(e,t,n){return function(e,t,n,r,i,o){var a=X(t),s=[];(r&&!i||!r&&i)&&n++;for(var l=!(r&&i),c=0;c<n;c++){var u=function(e,t,n,r,i){var o=t.line,a=t.ch,s=e.getLine(o),l=n?1:-1,c=r?g:m;if(i&&""==s){if(o+=l,s=e.getLine(o),!y(e,o))return null;a=n?0:s.length}for(;;){if(i&&""==s)return{from:0,to:0,line:o};for(var u=0<l?s.length:-1,d=u,f=u;a!=u;){for(var h=!1,p=0;p<c.length&&!h;++p)if(c[p](s.charAt(a))){for(d=a;a!=u&&c[p](s.charAt(a));)a+=l;if(h=d!=(f=a),d!=t.ch||o!=t.line||f!=d+l)return{from:Math.min(d,f+1),to:Math.max(d,f),line:o}}h||(a+=l)}if(!y(e,o+=l))return null;s=e.getLine(o),a=0<l?0:s.length}}(e,t,r,o,l);if(!u){var d=te(e,e.lastLine());s.push(r?{line:e.lastLine(),from:d,to:d}:{line:0,from:0,to:0});break}s.push(u),t=et(u.line,r?u.to-1:u.from)}var f=s.length!=n,h=s[0],p=s.pop();return r&&!i?(f||h.from==a.ch&&h.line==a.line||(p=s.pop()),et(p.line,p.from)):r&&i?et(p.line,p.to-1):!r&&i?(f||h.to==a.ch&&h.line==a.line||(p=s.pop()),et(p.line,p.to)):et(p.line,p.from)}(e,t,n.repeat,!!n.forward,!!n.wordEnd,!!n.bigWord)},moveTillCharacter:function(e,t,n){var r=ge(e,n.repeat,n.forward,n.selectedCharacter),e=n.forward?-1:1;return fe(e,n),r?(r.ch+=e,r):null},moveToCharacter:function(e,t,n){var r=n.repeat;return fe(0,n),ge(e,r,n.forward,n.selectedCharacter)||t},moveToSymbol:function(e,t,n){return function(e,t,n,r){var i=X(e.getCursor()),o=n?1:-1,a=n?e.lineCount():-1,s=i.ch,l=i.line,c=e.getLine(l),u={lineText:c,nextCh:c.charAt(s),lastCh:null,index:s,symb:r,reverseSymb:(n?{")":"(","}":"{"}:{"(":")","{":"}"})[r],forward:n,depth:0,curMoveThrough:!1},n=he[r];if(!n)return i;var r=pe[n].init,d=pe[n].isComplete;r&&r(u);for(;l!==a&&t;){var f;u.index+=o,u.nextCh=u.lineText.charAt(u.index),u.nextCh||(l+=o,u.lineText=e.getLine(l)||"",0<o?u.index=0:(f=u.lineText.length,u.index=0<f?f-1:0),u.nextCh=u.lineText.charAt(u.index)),d(u)&&(i.line=l,i.ch=u.index,t--)}if(u.nextCh||u.curMoveThrough)return et(l,u.index);return i}(e,n.repeat,n.forward,n.selectedCharacter)||t},moveToColumn:function(e,t,n,r){n=n.repeat;return r.lastHPos=n-1,r.lastHSPos=e.charCoords(t,"div").left,t=n,e=(n=e).getCursor().line,U(n,et(e,t-1))},moveToEol:function(e,t,n,r){return me(e,t,n,r,!1)},moveToFirstNonWhiteSpaceCharacter:function(e,t){return et(t.line,ce(e.getLine(t.line)))},moveToMatchedSymbol:function(e,t){for(var n=t,r=n.line,i=n.ch,o=e.getLine(r);i<o.length;i++)if((a=o.charAt(i))&&-1!="()[]{}".indexOf(a)){var a=e.getTokenTypeAt(et(r,i+1));if("string"!==a&&"comment"!==a)break}if(i<o.length){t="<"===i||">"===i?/[(){}[\]<>]/:/[(){}[\]]/;return e.findMatchingBracket(et(r,i),{bracketRegex:t}).to}return n},moveToStartOfLine:function(e,t){return et(t.line,0)},moveToLineOrEdgeOfDocument:function(e,t,n){var r=n.forward?e.lastLine():e.firstLine();return n.repeatIsExplicit&&(r=n.repeat-e.getOption("firstLineNumber")),et(r,ce(e.getLine(r)))},textObjectManipulation:function(e,t,n,r){var i=n.selectedCharacter;"b"==i?i="(":"B"==i&&(i="{");var o=!n.textObjectInner;if({"(":")",")":"(","{":"}","}":"{","[":"]","]":"[","<":">",">":"<"}[i])a=function(e,t,n,r){var i=t,o={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/,"<":/[<>]/,">":/[<>]/}[n],t={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{","<":"<",">":"<"}[n],n=e.getLine(i.line).charAt(i.ch)===t?1:0;if(t=e.scanForBracket(et(i.line,i.ch+n),-1,void 0,{bracketRegex:o}),o=e.scanForBracket(et(i.line,i.ch+n),1,void 0,{bracketRegex:o}),!t||!o)return{start:i,end:i};t=t.pos,o=o.pos,(t.line==o.line&&t.ch>o.ch||t.line>o.line)&&(i=t,t=o,o=i);r?o.ch+=1:t.ch+=1;return{start:t,end:o}}(e,t,i,o);else if({"'":!0,'"':!0,"`":!0}[i])a=function(e,t,n,r){var i,o,a,s,t=X(t),l=e.getLine(t.line).split(""),e=l.indexOf(n);t.ch<e?t.ch=e:e<t.ch&&l[t.ch]==n&&(o=t.ch,--t.ch);if(l[t.ch]!=n||o)for(a=t.ch;-1<a&&!i;a--)l[a]==n&&(i=a+1);else i=t.ch+1;if(i&&!o)for(a=i,s=l.length;a<s&&!o;a++)l[a]==n&&(o=a);if(!i||!o)return{start:t,end:t};r&&(--i,++o);return{start:et(t.line,i),end:et(t.line,o)}}(e,t,i,o);else if("W"===i)a=ue(e,o,0,!0);else if("w"===i)a=ue(e,o,0,!1);else if("p"===i){var a=ye(e,t,n.repeat,0,o);n.linewise=!0,r.visualMode?r.visualLine||(r.visualLine=!0):((r=r.inputState.operatorArgs)&&(r.linewise=!0),a.end.line--)}else{if("t"!==i)return null;a=function(e,t,n){var r=t;if(!Ye.findMatchingTag||!Ye.findEnclosingTag)return{start:r,end:r};t=Ye.findMatchingTag(e,t)||Ye.findEnclosingTag(e,t);if(!t||!t.open||!t.close)return{start:r,end:r};if(n)return{start:t.open.from,end:t.close.to};return{start:t.open.to,end:t.close.from}}(e,t,o)}return e.state.vim.visualMode?function(e,t,n){var r=e.state.vim.sel,i=r.head,o=r.anchor;Q(n,t)&&(r=n,n=t,t=r);Q(i,o)?(i=J(t,i),o=Z(o,n)):(o=J(t,o),-1==(i=$(i=Z(i,n),0,-1)).ch&&i.line!=e.firstLine()&&(i=et(i.line-1,te(e,i.line-1))));return[o,i]}(e,a.start,a.end):[a.start,a.end]},repeatLastCharacterSearch:function(e,t,n){var r=O.lastCharacterSearch,i=n.repeat,o=n.forward===r.forward,a=(r.increment?1:0)*(o?-1:1);e.moveH(-a,"char");r=ge(e,i,n.inclusive=o,r.selectedCharacter);return r?(r.ch+=a,r):(e.moveH(a,"char"),t)}};function H(e,t){for(var n=[],r=0;r<t;r++)n.push(e);return n}var j={change:function(e,t,n){var r,i,o,a=e.state.vim,s=n[0].anchor,l=n[0].head,s=a.visualMode?t.fullLine?(l.ch=Number.MAX_VALUE,l.line--,e.setSelection(s,l),i=e.getSelection(),e.replaceSelection(""),s):(i=e.getSelection(),r=H("",n.length),e.replaceSelections(r),J(n[0].head,n[0].anchor)):(i=e.getRange(s,l),"moveByWords"!=(a=a.lastEditInputState||{}).motion||_(i)||(o=/\s+$/.exec(i))&&a.motionArgs&&a.motionArgs.forward&&(l=$(l,0,-o[0].length),i=i.slice(0,-o[0].length)),a=new et(s.line-1,Number.MAX_VALUE),o=e.firstLine()==e.lastLine(),l.line>e.lastLine()&&t.linewise&&!o?e.replaceRange("",a,l):e.replaceRange("",s,l),t.linewise&&(o||(e.setCursor(a),Ye.commands.newlineAndIndent(e)),s.ch=Number.MAX_VALUE),s);O.registerController.pushText(t.registerName,"change",i,t.linewise,1<n.length),K.enterInsertMode(e,{head:s},e.state.vim)},delete:function(e,t,n){var r,i,o,a=e.state.vim;return a.visualBlock?(i=e.getSelection(),o=H("",n.length),e.replaceSelections(o),r=n[0].anchor):(o=n[0].anchor,n=n[0].head,t.linewise&&n.line!=e.firstLine()&&o.line==e.lastLine()&&o.line==n.line-1&&(o.line==e.firstLine()?o.ch=0:o=et(o.line-1,te(e,o.line-1))),i=e.getRange(o,n),e.replaceRange("",o,n),r=o,t.linewise&&(r=q.moveToFirstNonWhiteSpaceCharacter(e,o))),O.registerController.pushText(t.registerName,"delete",i,t.linewise,a.visualBlock),U(e,r)},indent:function(e,t,n){var r=e.state.vim,i=n[0].anchor.line,o=(r.visualBlock?n[n.length-1].anchor:n[0].head).line,a=r.visualMode?t.repeat:1;t.linewise&&o--;for(var s=i;s<=o;s++)for(var l=0;l<a;l++)e.indentLine(s,t.indentRight);return q.moveToFirstNonWhiteSpaceCharacter(e,n[0].anchor)},indentAuto:function(e,t,n){return e.execCommand("indentAuto"),q.moveToFirstNonWhiteSpaceCharacter(e,n[0].anchor)},changeCase:function(e,t,n,r,i){for(var o=e.getSelections(),a=[],s=t.toLower,l=0;l<o.length;l++){var c=o[l],u="";if(!0===s)u=c.toLowerCase();else if(!1===s)u=c.toUpperCase();else for(var d=0;d<c.length;d++){var f=c.charAt(d);u+=k(f)?f.toLowerCase():f.toUpperCase()}a.push(u)}return e.replaceSelections(a),t.shouldMoveCursor?i:!e.state.vim.visualMode&&t.linewise&&n[0].anchor.line+1==n[0].head.line?q.moveToFirstNonWhiteSpaceCharacter(e,r):t.linewise?r:J(n[0].anchor,n[0].head)},yank:function(e,t,n,r){var i=e.state.vim,e=e.getSelection(),r=i.visualMode?J(i.sel.anchor,i.sel.head,n[0].head,n[0].anchor):r;return O.registerController.pushText(t.registerName,"yank",e,t.linewise,i.visualBlock),r}};var K={jumpListWalk:function(e,t,n){n.visualMode||(n=t.repeat,t=t.forward,n=(n=(n=O.jumpList.move(e,t?n:-n))?n.find():void 0)||e.getCursor(),e.setCursor(n))},scroll:function(e,t,n){var r,i,o;n.visualMode||(i=t.repeat||1,r=e.defaultTextHeight(),o=e.getScrollInfo().top,n=r*i,i=t.forward?o+n:o-n,o=X(e.getCursor()),n=e.charCoords(o,"local"),t.forward?i>n.top?(o.line+=(i-n.top)/r,o.line=Math.ceil(o.line),e.setCursor(o),n=e.charCoords(o,"local"),e.scrollTo(null,n.top)):e.scrollTo(null,i):(t=i+e.getScrollInfo().clientHeight)<n.bottom?(o.line-=(n.bottom-t)/r,o.line=Math.floor(o.line),e.setCursor(o),n=e.charCoords(o,"local"),e.scrollTo(null,n.bottom-e.getScrollInfo().clientHeight)):e.scrollTo(null,i))},scrollToCursor:function(e,t){var n=e.getCursor().line,n=e.charCoords(et(n,0),"local"),r=e.getScrollInfo().clientHeight,i=n.top,o=n.bottom-i;switch(t.position){case"center":i=i-r/2+o;break;case"bottom":i=i-r+o}e.scrollTo(null,i)},replayMacro:function(e,t,n){var r=t.selectedCharacter,i=t.repeat,o=O.macroModeState;for("@"==r?r=o.latestRegister:o.latestRegister=r;i--;)!function(e,t,n,r){var i=O.registerController.getRegister(r);if(":"!=r){var o=i.keyBuffer,a=0;n.isPlaying=!0,n.replaySearchQueries=i.searchQueries.slice(0);for(var s=0;s<o.length;s++)for(var l,c,u=o[s];u;)l=/<\w+-.+?>|<\w+>|./.exec(u),c=l[0],u=u.substring(l.index+c.length),Ye.Vim.handleKey(e,c,"macro"),t.insertMode&&(c=i.insertModeChanges[a++].changes,O.macroModeState.lastInsertModeChanges.changes=c,Xe(e,c,1),We(e));n.isPlaying=!1}else i.keyBuffer[0]&&ze.processCommand(e,i.keyBuffer[0]),n.isPlaying=!1}(e,n,o,r)},enterMacroRecordMode:function(e,t){var n=O.macroModeState,t=t.selectedCharacter;O.registerController.isValidRegister(t)&&n.enterMacroRecordMode(e,t)},toggleOverwrite:function(e){e.state.overwrite?(e.toggleOverwrite(!1),e.setOption("keyMap","vim-insert"),Ye.signal(e,"vim-mode-change",{mode:"insert"})):(e.toggleOverwrite(!0),e.setOption("keyMap","vim-replace"),Ye.signal(e,"vim-mode-change",{mode:"replace"}))},enterInsertMode:function(e,t,n){if(!e.getOption("readOnly")){n.insertMode=!0,n.insertModeRepeat=t&&t.repeat||1;var r=t?t.insertAt:null,i=n.sel,o=t.head||e.getCursor("head"),a=e.listSelections().length;if("eol"==r)o=et(o.line,te(e,o.line));else if("bol"==r)o=et(o.line,0);else if("charAfter"==r)o=$(o,0,1);else if("firstNonBlank"==r)o=q.moveToFirstNonWhiteSpaceCharacter(e,o);else if("startOfSelectedArea"==r){if(!n.visualMode)return;n.visualBlock?(o=et(Math.min(i.head.line,i.anchor.line),Math.min(i.head.ch,i.anchor.ch)),a=Math.abs(i.head.line-i.anchor.line)+1):o=i.head.line<i.anchor.line?i.head:et(i.anchor.line,0)}else if("endOfSelectedArea"==r){if(!n.visualMode)return;n.visualBlock?(o=et(Math.min(i.head.line,i.anchor.line),Math.max(i.head.ch+1,i.anchor.ch)),a=Math.abs(i.head.line-i.anchor.line)+1):o=i.head.line>=i.anchor.line?$(i.head,0,1):et(i.anchor.line,0)}else if("inplace"==r){if(n.visualMode)return}else"lastEdit"==r&&(o=De(e)||o);e.setOption("disableInput",!1),t&&t.replace?(e.toggleOverwrite(!0),e.setOption("keyMap","vim-replace"),Ye.signal(e,"vim-mode-change",{mode:"replace"})):(e.toggleOverwrite(!1),e.setOption("keyMap","vim-insert"),Ye.signal(e,"vim-mode-change",{mode:"insert"})),O.macroModeState.isPlaying||(e.on("change",He),Ye.on(e.getInputField(),"keydown",$e)),n.visualMode&&le(e),ie(e,o,a)}},toggleVisualMode:function(e,t,n){var r=t.repeat,i=e.getCursor();n.visualMode?n.visualLine^t.linewise||n.visualBlock^t.blockwise?(n.visualLine=!!t.linewise,n.visualBlock=!!t.blockwise,Ye.signal(e,"vim-mode-change",{mode:"visual",subMode:n.visualLine?"linewise":n.visualBlock?"blockwise":""}),ae(e)):le(e):(n.visualMode=!0,n.visualLine=!!t.linewise,n.visualBlock=!!t.blockwise,r=U(e,et(i.line,i.ch+r-1)),n.sel={anchor:i,head:r},Ye.signal(e,"vim-mode-change",{mode:"visual",subMode:n.visualLine?"linewise":n.visualBlock?"blockwise":""}),ae(e),ve(e,n,"<",J(i,r)),ve(e,n,">",Z(i,r)))},reselectLastSelection:function(e,t,n){var r,i,o=n.lastSelection;n.visualMode&&oe(e,n),o&&(r=o.anchorMark.find(),i=o.headMark.find(),r&&i&&(n.sel={anchor:r,head:i},n.visualMode=!0,n.visualLine=o.visualLine,n.visualBlock=o.visualBlock,ae(e),ve(e,n,"<",J(r,i)),ve(e,n,">",Z(r,i)),Ye.signal(e,"vim-mode-change",{mode:"visual",subMode:n.visualLine?"linewise":n.visualBlock?"blockwise":""})))},joinLines:function(e,t,n){var r,i;n.visualMode?(i=e.getCursor("anchor"),Q(r=e.getCursor("head"),i)&&(s=r,r=i,i=s),r.ch=te(e,r.line)-1):(c=Math.max(t.repeat,2),i=e.getCursor(),r=U(e,et(i.line+c-1,1/0)));for(var o=0,a=i.line;a<r.line;a++){var o=te(e,i.line),s=et(i.line+1,te(e,i.line+1)),l=e.getRange(i,s),l=t.keepSpaces?l.replace(/\n\r?/g,""):l.replace(/\n\s*/g," ");e.replaceRange(l,i,s)}var c=et(i.line,o);n.visualMode&&le(e,!1),e.setCursor(c)},newLineAndEnterInsertMode:function(e,t,n){n.insertMode=!0;var r=X(e.getCursor());r.line!==e.firstLine()||t.after?(r.line=t.after?r.line:r.line-1,r.ch=te(e,r.line),e.setCursor(r),(Ye.commands.newlineAndIndentContinueComment||Ye.commands.newlineAndIndent)(e)):(e.replaceRange("\n",et(e.firstLine(),0)),e.setCursor(e.firstLine(),0)),this.enterInsertMode(e,{repeat:t.repeat},n)},paste:function(n,e,t){var r,i,o,a,s=X(n.getCursor()),l=O.registerController.getRegister(e.registerName),c=l.toString();if(c){e.matchIndent&&(r=n.getOption("tabSize"),i=function(e){var t=e.split("\t").length-1,e=e.split(" ").length-1;return t*r+e},y=n.getLine(n.getCursor().line),o=i(y.match(/^\s*/)[0]),k=c.replace(/\n$/,""),w=c!==k,a=i(c.match(/^\s*/)[0]),c=k.replace(/^\s*/gm,function(e){var t=o+(i(e)-a);if(t<0)return"";if(n.getOption("indentWithTabs")){e=Math.floor(t/r);return Array(e+1).join("\t")}return Array(t+1).join(" ")}),c+=w?"\n":""),1<e.repeat&&(c=Array(e.repeat+1).join(c));var u,d,f,h,p,m,g,v=l.linewise,y=l.blockwise;if(y){c=c.split("\n"),v&&c.pop();for(var b=0;b<c.length;b++)c[b]=""==c[b]?" ":c[b];s.ch+=e.after?1:0,s.ch=Math.min(te(n,s.line),s.ch)}else v?t.visualMode?c=t.visualLine?c.slice(0,-1):"\n"+c.slice(0,c.length-1)+"\n":e.after?(c="\n"+c.slice(0,c.length-1),s.ch=te(n,s.line)):s.ch=0:s.ch+=e.after?1:0;if(t.visualMode){t.lastPastedText=c;var k=(m=n,g=t.lastSelection,(t.visualMode?function(){var e=m.listSelections(),t=e[0],e=e[e.length-1];return[Q(t.anchor,t.head)?t.anchor:t.head,Q(e.anchor,e.head)?e.head:e.anchor]}:function(){var e=m.getCursor(),t=m.getCursor(),n=g.visualBlock;if(n){for(var r=n.width,i=n.height,t=et(e.line+i,e.ch+r),o=[],a=e.line;a<t.line;a++){var s=et(a,e.ch),l=et(a,t.ch);o.push({anchor:s,head:l})}m.setSelections(o)}else{n=g.anchorMark.find(),i=g.headMark.find(),r=i.line-n.line,n=i.ch-n.ch;t={line:t.line+r,ch:r?t.ch:n+t.ch},g.visualLine&&(e=et(e.line,0),t=et(t.line,te(m,t.line))),m.setSelection(e,t)}return[e,t]})()),x=k[0],w=k[1],l=n.getSelection(),k=n.listSelections(),k=new Array(k.length).join("1").split("1");t.lastSelection&&(d=t.lastSelection.headMark.find()),O.registerController.unnamedRegister.setText(l),x=y?(n.replaceSelections(k),w=et(x.line+c.length-1,x.ch),n.setCursor(x),re(n,w),n.replaceSelections(c),x):t.visualBlock?(n.replaceSelections(k),n.setCursor(x),n.replaceRange(c,x,x),x):(n.replaceRange(c,x,w),n.posFromIndex(n.indexFromPos(x)+c.length-1)),d&&(t.lastSelection.headMark=n.setBookmark(d)),v&&(x.ch=0)}else if(y){n.setCursor(s);for(b=0;b<c.length;b++){var C=s.line+b;C>n.lastLine()&&n.replaceRange("\n",et(C,0)),te(n,C)<s.ch&&(f=n,h=C,p=s.ch,C=void 0,C=te(f,h),p=new Array(p-C+1).join(" "),f.setCursor(et(h,C)),f.replaceRange(p,f.getCursor()))}n.setCursor(s),re(n,et(s.line+c.length-1,s.ch)),n.replaceSelections(c),x=s}else n.replaceRange(c,s),x=v&&e.after?et(s.line+1,ce(n.getLine(s.line+1))):v&&!e.after?et(s.line,ce(n.getLine(s.line))):!v&&e.after?(u=n.indexFromPos(s),n.posFromIndex(u+c.length-1)):(u=n.indexFromPos(s),n.posFromIndex(u+c.length));t.visualMode&&le(n,!1),n.setCursor(x)}},undo:function(e,t){e.operation(function(){G(e,Ye.commands.undo,t.repeat)(),e.setCursor(e.getCursor("anchor"))})},redo:function(e,t){G(e,Ye.commands.redo,t.repeat)()},setRegister:function(e,t,n){n.inputState.registerName=t.selectedCharacter},setMark:function(e,t,n){ve(e,n,t.selectedCharacter,e.getCursor())},replace:function(e,t,n){var r,i,o=t.selectedCharacter,a=e.getCursor(),s=e.listSelections(),t=n.visualMode?(a=e.getCursor("start"),e.getCursor("end")):(i=e.getLine(a.line),(r=a.ch+t.repeat)>i.length&&(r=i.length),et(a.line,r));"\n"==o?(n.visualMode||e.replaceRange("",a,t),(Ye.commands.newlineAndIndentContinueComment||Ye.commands.newlineAndIndent)(e)):(i=(i=e.getRange(a,t)).replace(/[^\n]/g,o),n.visualBlock?(r=new Array(e.getOption("tabSize")+1).join(" "),i=(i=e.getSelection()).replace(/\t/g,r).replace(/[^\n]/g,o).split("\n"),e.replaceSelections(i)):e.replaceRange(i,a,t),n.visualMode?(a=Q(s[0].anchor,s[0].head)?s[0].anchor:s[0].head,e.setCursor(a),le(e,!1)):e.setCursor($(t,0,-1)))},incrementNumberToken:function(e,t){for(var n,r,i,o,a,s,l,c=e.getCursor(),u=e.getLine(c.line),d=/(-?)(?:(0x)([\da-f]+)|(0b|0|)(\d+))/gi;null!==(n=d.exec(u))&&(i=(r=n.index)+n[0].length,!(c.ch<i)););!t.backtrack&&i<=c.ch||n&&(s=n[2]||n[4],l=n[3]||n[5],o=t.increase?1:-1,a={"0b":2,0:8,"":10,"0x":16}[s.toLowerCase()],a=(parseInt(n[1]+l,a)+o*t.repeat).toString(a),l=s?new Array(l.length-a.length+1+n[1].length).join("0"):"",a="-"===a.charAt(0)?"-"+s+l+a.substr(1):s+l+a,s=et(c.line,r),l=et(c.line,i),e.replaceRange(a,s,l),e.setCursor(et(c.line,r+a.length-1)))},repeatLastEdit:function(e,t,n){var r;n.lastEditInputState&&((r=t.repeat)&&t.repeatIsExplicit?n.lastEditInputState.repeatOverride=r:r=n.lastEditInputState.repeatOverride||r,Ge(e,n,r,!1))},indent:function(e,t){e.indentLine(e.getCursor().line,t.indentRight)},exitInsertMode:We};function U(e,t){var n=e.state.vim,r=n.insertMode||n.visualMode,n=Math.min(Math.max(e.firstLine(),t.line),e.lastLine()),r=te(e,n)-1+!!r,r=Math.min(Math.max(0,t.ch),r);return et(n,r)}function V(e){var t,n={};for(t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);return n}function $(e,t,n){return"object"==typeof t&&(n=t.ch,t=t.line),et(e.line+t,e.ch+n)}function G(t,n,r){return function(){for(var e=0;e<r;e++)n(t)}}function X(e){return et(e.line,e.ch)}function Y(e,t){return e.ch==t.ch&&e.line==t.line}function Q(e,t){return e.line<t.line||e.line==t.line&&e.ch<t.ch}function J(e,t){return Q(e,t=2<arguments.length?J.apply(void 0,Array.prototype.slice.call(arguments,1)):t)?e:t}function Z(e,t){return Q(e,t=2<arguments.length?Z.apply(void 0,Array.prototype.slice.call(arguments,1)):t)?t:e}function ee(e,t,n){e=Q(e,t),n=Q(t,n);return e&&n}function te(e,t){return e.getLine(t).length}function ne(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function re(e,t){var n=[],r=e.listSelections(),i=X(e.clipPos(t)),o=!Y(t,i),a=function(e,t,n){for(var r=0;r<e.length;r++){var i="head"!=n&&Y(e[r].anchor,t),o="anchor"!=n&&Y(e[r].head,t);if(i||o)return r}return-1}(r,e.getCursor("head")),s=Y(r[a].head,r[a].anchor),l=r.length-1,c=a<l-a?l:0,a=r[c].anchor,l=Math.min(a.line,i.line),u=Math.max(a.line,i.line),d=a.ch,f=i.ch,r=r[c].head.ch-d,c=f-d;0<r&&c<=0?(d++,o||f--):r<0&&0<=c?(d--,s||f++):r<0&&-1==c&&(d--,f++);for(var h=l;h<=u;h++){var p={anchor:new et(h,d),head:new et(h,f)};n.push(p)}return e.setSelections(n),t.ch=f,a.ch=d,a}function ie(e,t,n){for(var r=[],i=0;i<n;i++){var o=$(t,i,0);r.push({anchor:o,head:o})}e.setSelections(r,0)}function oe(e,t){var n=t.sel.anchor,r=t.sel.head;t.lastPastedText&&(r=e.posFromIndex(e.indexFromPos(n)+t.lastPastedText.length),t.lastPastedText=null),t.lastSelection={anchorMark:e.setBookmark(n),headMark:e.setBookmark(r),anchor:X(n),head:X(r),visualMode:t.visualMode,visualLine:t.visualLine,visualBlock:t.visualBlock}}function ae(e,t,n){var r=e.state.vim,n=se(e,t=t||r.sel,n=n||r.visualLine?"line":r.visualBlock?"block":"char");e.setSelections(n.ranges,n.primary),Ke(e)}function se(e,t,n,r){var i=X(t.head),o=X(t.anchor);if("char"==n){var a=r||Q(t.head,t.anchor)?0:1,r=Q(t.head,t.anchor)?1:0,i=$(t.head,0,a);return{ranges:[{anchor:o=$(t.anchor,0,r),head:i}],primary:0}}if("line"==n)return Q(t.head,t.anchor)?(i.ch=0,o.ch=te(e,o.line)):(o.ch=0,t=e.lastLine(),i.line>t&&(i.line=t),i.ch=te(e,i.line)),{ranges:[{anchor:o,head:i}],primary:0};if("block"==n){for(var s=Math.min(o.line,i.line),l=Math.min(o.ch,i.ch),n=Math.max(o.line,i.line),c=Math.max(o.ch,i.ch)+1,u=n-s+1,i=i.line==s?0:u-1,d=[],f=0;f<u;f++)d.push({anchor:et(s+f,l),head:et(s+f,c)});return{ranges:d,primary:i}}}function le(e,t){var n=e.state.vim;!1!==t&&e.setCursor(U(e,n.sel.head)),oe(e,n),n.visualMode=!1,n.visualLine=!1,n.visualBlock=!1,n.insertMode||Ye.signal(e,"vim-mode-change",{mode:"normal"}),Ue(n)}function ce(e){if(!e)return 0;var t=e.search(/\S/);return-1==t?e.length:t}function ue(e,t,n,r,i){for(var o,a,a=(a=(o=e).getCursor("head"),a=1==o.getSelection().length?J(a,o.getCursor("anchor")):a),s=e.getLine(a.line),l=a.ch,c=(i?m:g)[0];!c(s.charAt(l));)if(++l>=s.length)return null;r?c=g[0]:(c=m[0])(s.charAt(l))||(c=m[1]);for(var u=l,d=l;c(s.charAt(u))&&u<s.length;)u++;for(;c(s.charAt(d))&&0<=d;)d--;if(d++,t){for(t=u;/\s/.test(s.charAt(u))&&u<s.length;)u++;if(t==u){for(t=d;/\s/.test(s.charAt(d-1))&&0<d;)d--;d=d||t}}return{start:et(a.line,d),end:et(a.line,u)}}function de(e,t,n){Y(t,n)||O.jumpList.add(e,t,n)}function fe(e,t){O.lastCharacterSearch.increment=e,O.lastCharacterSearch.forward=t.forward,O.lastCharacterSearch.selectedCharacter=t.selectedCharacter}var he={"(":"bracket",")":"bracket","{":"bracket","}":"bracket","[":"section","]":"section","*":"comment","/":"comment",m:"method",M:"method","#":"preprocess"},pe={bracket:{isComplete:function(e){if(e.nextCh===e.symb){if(e.depth++,1<=e.depth)return!0}else e.nextCh===e.reverseSymb&&e.depth--;return!1}},section:{init:function(e){e.curMoveThrough=!0,e.symb=(e.forward?"]":"[")===e.symb?"{":"}"},isComplete:function(e){return 0===e.index&&e.nextCh===e.symb}},comment:{isComplete:function(e){var t="*"===e.lastCh&&"/"===e.nextCh;return e.lastCh=e.nextCh,t}},method:{init:function(e){e.symb="m"===e.symb?"{":"}",e.reverseSymb="{"===e.symb?"}":"{"},isComplete:function(e){return e.nextCh===e.symb}},preprocess:{init:function(e){e.index=0},isComplete:function(e){if("#"===e.nextCh){var t=e.lineText.match(/^#(\w+)/)[1];if("endif"===t){if(e.forward&&0===e.depth)return!0;e.depth++}else if("if"===t){if(!e.forward&&0===e.depth)return!0;e.depth--}if("else"===t&&0===e.depth)return!0}return!1}}};function me(e,t,n,r,i){t=et(t.line+n.repeat-1,1/0),n=e.clipPos(t);return n.ch--,i||(r.lastHPos=1/0,r.lastHSPos=e.charCoords(n,"div").left),t}function ge(e,t,n,r){for(var i,o=e.getCursor(),a=o.ch,s=0;s<t;s++){if(-1==(i=function(e,t,n,r,i){var o;r?-1==(o=t.indexOf(n,e+1))||i||--o:-1==(o=t.lastIndexOf(n,e-1))||i||(o+=1);return o}(a,e.getLine(o.line),r,n,!0)))return null;a=i}return et(e.getCursor().line,i)}function ve(e,t,n,r){w(n,p)&&(t.marks[n]&&t.marks[n].clear(),t.marks[n]=e.setBookmark(r))}function ye(t,e,n,r,i){var o=e.line,a=t.firstLine(),s=t.lastLine(),l=o;function c(e){return!t.getLine(e)}function u(e,t,n){return n?c(e)!=c(e+t):!c(e)&&c(e+t)}if(r){for(;a<=l&&l<=s&&0<n;)u(l,r)&&n--,l+=r;return new et(l,0)}var d,e=t.state.vim;e.visualLine&&u(o,1,!0)&&(u((d=e.sel.anchor).line,-1,!0)&&(i&&d.line==o||(o+=1)));for(var f=c(o),l=o;l<=s&&n;l++)u(l,1,!0)&&(i&&c(l)==f||n--);for(d=new et(l,0),s<l&&!f?f=!0:i=!1,l=o;a<l&&(i&&c(l)!=f&&l!=o||!u(l,-1,!0));l--);return{start:new et(l,0),end:d}}function be(){}function ke(e){e=e.state.vim;return e.searchState_||(e.searchState_=new be)}function xe(e,t){var n=we(e,t)||[];if(!n.length)return[];var r=[];if(0===n[0]){for(var i=0;i<n.length;i++)"number"==typeof n[i]&&r.push(e.substring(n[i]+1,n[i+1]));return r}}function we(e,t){t=t||"/";for(var n=!1,r=[],i=0;i<e.length;i++){var o=e.charAt(i);n||o!=t||r.push(i),n=!n&&"\\"==o}return r}S("pcre",!0,"boolean"),be.prototype={getQuery:function(){return O.query},setQuery:function(e){O.query=e},getOverlay:function(){return this.searchOverlay},setOverlay:function(e){this.searchOverlay=e},isReversed:function(){return O.isReversed},setReversed:function(e){O.isReversed=e},getScrollbarAnnotate:function(){return this.annotate},setScrollbarAnnotate:function(e){this.annotate=e}};var Ce={"\\n":"\n","\\r":"\r","\\t":"\t"};function Se(e){for(var t=!1,n=[],r=-1;r<e.length;r++){var i=e.charAt(r)||"",o=e.charAt(r+1)||"";Ce[i+o]?(n.push(Ce[i+o]),r++):t?(n.push(i),t=!1):"\\"===i?(t=!0,c.test(o)||"$"===o?n.push("$"):"/"!==o&&"\\"!==o&&n.push("\\")):("$"===i&&n.push("$"),n.push(i),"/"===o&&n.push("\\"))}return n.join("")}var _e={"\\/":"/","\\\\":"\\","\\n":"\n","\\r":"\r","\\t":"\t","\\&":"&"};function Le(e,t,n){if(O.registerController.getRegister("/").setText(e),e instanceof RegExp)return e;var r,i,o=we(e,"/");return o.length?(r=e.substring(0,o[0]),i=-1!=e.substring(o[0]).indexOf("i")):r=e,r?(M("pcre")||(r=function(e){for(var t=!1,n=[],r=-1;r<e.length;r++){var i=e.charAt(r)||"",o=e.charAt(r+1)||"",a=o&&-1!="|(){".indexOf(o);t?("\\"===i&&a||n.push(i),t=!1):"\\"===i?(t=!0,(a=o&&-1!="}".indexOf(o)?!0:a)&&"\\"!==o||n.push(i)):(n.push(i),a&&"\\"!==o&&n.push("\\"))}return n.join("")}(r)),n&&(t=/^[^A-Z]*$/.test(r)),new RegExp(r,t||i?"i":void 0)):null}function Me(e){"string"==typeof e&&(e=document.createElement(e));for(var t,n=1;n<arguments.length;n++)if(t=arguments[n])if((t="object"!=typeof t?document.createTextNode(t):t).nodeType)e.appendChild(t);else for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&("$"===r[0]?e.style[r.slice(1)]=t[r]:e.setAttribute(r,t[r]));return e}function Te(e,t){t=Me("pre",{$color:"red"},t);e.openNotification?e.openNotification(t,{bottom:!0,duration:5e3}):alert(t.innerText)}function Ae(e,t){var n,r,i=(t.prefix||"")+" "+(t.desc||""),r=(n=t.prefix,r=t.desc,Me(document.createDocumentFragment(),Me("span",{$fontFamily:"monospace",$whiteSpace:"pre"},n,Me("input",{type:"text",autocorrect:"off",autocapitalize:"off",spellcheck:"false"})),r&&Me("span",{$color:"#888"},r)));e.openDialog?e.openDialog(r,t.onClose,{onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,bottom:!0,selectValueOnOpen:!1,value:t.value}):t.onClose(prompt(i,""))}function Oe(e,t,n,r){if(t){var i=ke(e),r=Le(t,!!n,!!r);if(r)return Ee(e,r),function(e,t){if(e instanceof RegExp&&t instanceof RegExp){for(var n=["global","multiline","ignoreCase","source"],r=0;r<n.length;r++){var i=n[r];if(e[i]!==t[i])return}return 1}}(r,i.getQuery())||i.setQuery(r),r}}var Ne=0;function Ee(i,o){clearTimeout(Ne),Ne=setTimeout(function(){var n,r,e=ke(i),t=e.getOverlay();t&&o==t.query||(t&&i.removeOverlay(t),"^"==(n=o).source.charAt(0)&&(r=!0),i.addOverlay(t={token:function(e){if(!r||e.sol()){var t=e.match(n,!1);if(t)return 0==t[0].length?(e.next(),"searching"):e.sol()||(e.backUp(1),n.exec(e.next()+t[0]))?(e.match(n),"searching"):(e.next(),null);for(;!e.eol()&&(e.next(),!e.match(n,!1)););}else e.skipToEnd()},query:n}),i.showMatchesOnScrollbar&&(e.getScrollbarAnnotate()&&e.getScrollbarAnnotate().clear(),e.setScrollbarAnnotate(i.showMatchesOnScrollbar(o))),e.setOverlay(t))},50)}function Ie(i,o,a,s){return void 0===s&&(s=1),i.operation(function(){for(var e=i.getCursor(),t=i.getSearchCursor(a,e),n=0;n<s;n++){var r=t.find(o);if(!(r=0==n&&r&&Y(t.from(),e)?t.find(o):r)&&!(t=i.getSearchCursor(a,o?et(i.lastLine()):et(i.firstLine(),0))).find(o))return}return t.from()})}function Pe(e){var t=ke(e);e.removeOverlay(ke(e).getOverlay()),t.setOverlay(null),t.getScrollbarAnnotate()&&(t.getScrollbarAnnotate().clear(),t.setScrollbarAnnotate(null))}function Re(e){var t=e.getScrollInfo(),n=e.coordsChar({left:0,top:6+t.top},"local"),t=t.clientHeight-10+t.top,t=e.coordsChar({left:0,top:t},"local");return{top:n.line,bottom:t.line}}function Be(e,t,n){if("'"==n||"`"==n)return O.jumpList.find(e,-1)||et(0,0);if("."==n)return De(e);n=t.marks[n];return n&&n.find()}function De(e){for(var t=e.doc.history.done,n=t.length;n--;)if(t[n].changes)return X(t[n].changes[0].to)}h=function(){this.buildCommandMap_()};h.prototype={processCommand:function(e,t,n){var r=this;e.operation(function(){e.curOp.isVimOp=!0,r._processCommand(e,t,n)})},_processCommand:function(t,e,n){var r=t.state.vim,i=O.registerController.getRegister(":"),o=i.toString();r.visualMode&&le(t);r=new Ye.StringStream(e);i.setText(e);var a,s,n=n||{};n.input=e;try{this.parseInput_(t,r,n)}catch(e){throw Te(t,e.toString()),e}if(n.commandName){if(a=this.matchCommand_(n.commandName)){if(s=a.name,a.excludeFromCommandHistory&&i.setText(o),this.parseCommandArgs_(r,n,a),"exToKey"==a.type){for(var l=0;l<a.toKeys.length;l++)Ye.Vim.handleKey(t,a.toKeys[l],"mapping");return}if("exToEx"==a.type)return void this.processCommand(t,a.toInput)}}else void 0!==n.line&&(s="move");if(s)try{Fe[s](t,n),a&&a.possiblyAsync||!n.callback||n.callback()}catch(e){throw Te(t,e.toString()),e}else Te(t,'Not an editor command ":'+e+'"')},parseInput_:function(e,t,n){t.eatWhile(":"),t.eat("%")?(n.line=e.firstLine(),n.lineEnd=e.lastLine()):(n.line=this.parseLineSpec_(e,t),void 0!==n.line&&t.eat(",")&&(n.lineEnd=this.parseLineSpec_(e,t)));e=t.match(/^(\w+|!!|@@|[!#&*<=>@~])/);return n.commandName=e?e[1]:t.match(/.*/)[0],n},parseLineSpec_:function(e,t){var n=t.match(/^(\d+)/);if(n)return parseInt(n[1],10)-1;switch(t.next()){case".":return this.parseLineSpecOffset_(t,e.getCursor().line);case"$":return this.parseLineSpecOffset_(t,e.lastLine());case"'":var r=t.next(),r=Be(e,e.state.vim,r);if(!r)throw new Error("Mark not set");return this.parseLineSpecOffset_(t,r.line);case"-":case"+":return t.backUp(1),this.parseLineSpecOffset_(t,e.getCursor().line);default:return void t.backUp(1)}},parseLineSpecOffset_:function(e,t){var n=e.match(/^([+-])?(\d+)/);return n&&(e=parseInt(n[2],10),"-"==n[1]?t-=e:t+=e),t},parseCommandArgs_:function(e,t,n){e.eol()||(t.argString=e.match(/.*/)[0],n=n.argDelimiter||/\s+/,(n=ne(t.argString).split(n)).length&&n[0]&&(t.args=n))},matchCommand_:function(e){for(var t=e.length;0<t;t--){var n=e.substring(0,t);if(this.commandMap_[n]){n=this.commandMap_[n];if(0===n.name.indexOf(e))return n}}return null},buildCommandMap_:function(){this.commandMap_={};for(var e=0;e<Ze.length;e++){var t=Ze[e],n=t.shortName||t.name;this.commandMap_[n]=t}},map:function(e,t,n){if(":"!=e&&":"==e.charAt(0)){if(n)throw Error("Mode not supported for ex mappings");var r=e.substring(1);":"!=t&&":"==t.charAt(0)?this.commandMap_[r]={name:r,type:"exToEx",toInput:t.substring(1),user:!0}:this.commandMap_[r]={name:r,type:"exToKey",toKeys:t,user:!0}}else t=":"!=t&&":"==t.charAt(0)?{keys:e,type:"keyToEx",exArgs:{input:t.substring(1)}}:{keys:e,type:"keyToKey",toKeys:t},n&&(t.context=n),Qe.unshift(t)},unmap:function(e,t){if(":"!=e&&":"==e.charAt(0)){if(t)throw Error("Mode not supported for ex mappings");var n=e.substring(1);if(this.commandMap_[n]&&this.commandMap_[n].user)return void delete this.commandMap_[n]}else for(var r=e,i=0;i<Qe.length;i++)if(r==Qe[i].keys&&Qe[i].context===t)return void Qe.splice(i,1);throw Error("No such mapping.")}};var Fe={colorscheme:function(e,t){!t.args||t.args.length<1?Te(e,e.getOption("theme")):e.setOption("theme",t.args[0])},map:function(e,t,n){var r=t.args;!r||r.length<2?e&&Te(e,"Invalid mapping: "+t.input):ze.map(r[0],r[1],n)},imap:function(e,t){this.map(e,t,"insert")},nmap:function(e,t){this.map(e,t,"normal")},vmap:function(e,t){this.map(e,t,"visual")},unmap:function(e,t,n){var r=t.args;!r||r.length<1?e&&Te(e,"No such mapping: "+t.input):ze.unmap(r[0],n)},move:function(e,t){W.processCommand(e,e.state.vim,{type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0},repeatOverride:t.line+1})},set:function(e,t){var n=t.args,r=t.setCfg||{};if(!n||n.length<1)e&&Te(e,"Invalid mapping: "+t.input);else{var i=n[0].split("="),o=i[0],n=i[1],i=!1;if("?"==o.charAt(o.length-1)){if(n)throw Error("Trailing characters: "+t.argString);o=o.substring(0,o.length-1),i=!0}void 0===n&&"no"==o.substring(0,2)&&(o=o.substring(2),n=!1);t=C[o]&&"boolean"==C[o].type;t&&null==n&&(n=!0),!t&&void 0===n||i?(i=M(o,e,r))instanceof Error?Te(e,i.message):Te(e,!0===i||!1===i?" "+(i?"":"no")+o:" "+o+"="+i):(r=L(o,n,e,r))instanceof Error&&Te(e,r.message)}},setlocal:function(e,t){t.setCfg={scope:"local"},this.set(e,t)},setglobal:function(e,t){t.setCfg={scope:"global"},this.set(e,t)},registers:function(e,t){var n=t.args,r=O.registerController.registers,i="----------Registers----------\n\n";if(n)for(var n=n.join(""),o=0;o<n.length;o++)a=n.charAt(o),O.registerController.isValidRegister(a)&&(i+='"'+a+" "+(r[a]||new D).toString()+"\n");else for(var a in r){var s=r[a].toString();s.length&&(i+='"'+a+" "+s+"\n")}Te(e,i)},sort:function(e,i){var o,a,s,l,c;var t=function(){if(i.argString){var e=new Ye.StringStream(i.argString);if(e.eat("!")&&(o=!0),!e.eol()){if(!e.eatSpace())return"Invalid arguments";var t=e.match(/([dinuox]+)?\s*(\/.+\/)?\s*/);if(!t&&!e.eol())return"Invalid arguments";if(t[1]){a=-1!=t[1].indexOf("i"),s=-1!=t[1].indexOf("u");var n=-1!=t[1].indexOf("d")||-1!=t[1].indexOf("n")&&1,r=-1!=t[1].indexOf("x")&&1,e=-1!=t[1].indexOf("o")&&1;if(1<n+r+e)return"Invalid arguments";l=(n?"decimal":r&&"hex")||e&&"octal"}t[2]&&(c=new RegExp(t[2].substr(1,t[2].length-2),a?"i":""))}}}();if(t)Te(e,t+": "+i.argString);else{var n=i.line||e.firstLine(),t=i.lineEnd||i.line||e.lastLine();if(n!=t){var n=et(n,0),t=et(t,te(e,t)),r=e.getRange(n,t).split("\n"),u=c||("decimal"==l?/(-?)([\d]+)/:"hex"==l?/(-?)(?:0x)?([0-9a-f]+)/i:"octal"==l?/([0-7]+)/:null),d="decimal"==l?10:"hex"==l?16:"octal"==l?8:null,f=[],h=[];if(l||c)for(var p=0;p<r.length;p++){var m=c?r[p].match(c):null;m&&""!=m[0]?f.push(m):(!c&&u.exec(r[p])?f:h).push(r[p])}else h=r;if(f.sort(c?function(e,t){var n;return o&&(n=e,e=t,t=n),a&&(e[0]=e[0].toLowerCase(),t[0]=t[0].toLowerCase()),e[0]<t[0]?-1:1}:y),c)for(p=0;p<f.length;p++)f[p]=f[p].input;else l||h.sort(y);if(r=o?f.concat(h):h.concat(f),s)for(var g,v=r,r=[],p=0;p<v.length;p++)v[p]!=g&&r.push(v[p]),g=v[p];e.replaceRange(r.join("\n"),n,t)}}function y(e,t){o&&(r=e,e=t,t=r),a&&(e=e.toLowerCase(),t=t.toLowerCase());var n=l&&u.exec(e),r=l&&u.exec(t);return n?parseInt((n[1]+n[2]).toLowerCase(),d)-(r=parseInt((r[1]+r[2]).toLowerCase(),d)):e<t?-1:1}},vglobal:function(e,t){this.global(e,t)},global:function(t,e){var n=e.argString;if(n){var r,i="v"===e.commandName[0],o=void 0!==e.line?e.line:t.firstLine(),a=e.lineEnd||e.line||t.lastLine(),e=xe(n,"/"),n=n;if(e.length&&(n=e[0],r=e.slice(1,e.length).join("/")),n)try{Oe(t,n,!0,!0)}catch(e){return void Te(t,"Invalid regex: "+n)}for(var s,l,c=ke(t).getQuery(),u=[],d=o;d<=a;d++){var f=t.getLineHandle(d);c.test(f.text)!==i&&u.push(r?f:f.text)}r?(s=0,(l=function(){var e;s<u.length&&(e=u[s++],null!=(e=t.getLineNumber(e))?(e=e+1+r,ze.processCommand(t,e,{callback:l})):l())})()):Te(t,u.join("\n"))}else Te(t,"Regular Expression missing from global")},substitute:function(t,e){if(!t.getSearchCursor)throw new Error("Search feature not available. Requires searchcursor.js or any other getSearchCursor implementation.");var n,r,i,o,a=e.argString,s=a?xe(a,a[0]):[],l="",c=!1,u=!1;if(s.length)i=s[0],M("pcre")&&""!==i&&(i=new RegExp(i).source),l=s[1],/(^|[^\\])(\\\\)*\$$/.test(i)&&(i=i.slice(0,-1)+"\\n",l=(l||"")+"\n"),void 0!==l&&(l=M("pcre")?function(e){for(var t=new Ye.StringStream(e),n=[];!t.eol();){for(;t.peek()&&"\\"!=t.peek();)n.push(t.next());var r,i=!1;for(r in _e)if(t.match(r,!0)){i=!0,n.push(_e[r]);break}i||n.push(t.next())}return n.join("")}(l.replace(/([^\\])&/g,"$1$$&")):Se(l),O.lastSubstituteReplacePart=l),n=s[2]?s[2].split(" "):[];else if(a&&a.length)return void Te(t,"Substitutions should be of the form :s/pattern/replace/");if(n&&(r=n[0],o=parseInt(n[1]),r&&(-1!=r.indexOf("c")&&(c=!0),-1!=r.indexOf("g")&&(u=!0),i=M("pcre")?i+"/"+r:i.replace(/\//g,"\\/")+"/"+r)),i)try{Oe(t,i,!0,!0)}catch(e){return void Te(t,"Invalid regex: "+i)}void 0!==(l=l||O.lastSubstituteReplacePart)?(n=ke(t).getQuery(),r=(void 0!==e.line?e:t.getCursor()).line,i=e.lineEnd||r,r==t.firstLine()&&i==t.lastLine()&&(i=1/0),o&&(i=(r=i)+o-1),o=U(t,et(r,0)),o=t.getSearchCursor(n,o),function(i,e,r,o,a,s,n,l,c){i.state.vim.exMode=!0;var u,d,f,h=!1;function p(){i.operation(function(){for(;!h;)m(),g();v()})}function m(){var e=i.getRange(s.from(),s.to()).replace(n,l),t=s.to().line;s.replace(e),d=s.to().line,a+=d-t,f=d<t}function g(){for(;s.findNext()&&(e=s.from(),t=o,n=a,"number"!=typeof e&&(e=e.line),t instanceof Array?w(e,t):"number"==typeof n?t<=e&&e<=n:e==t);)if(r||s.from().line!=d||f)return i.scrollIntoView(s.from(),30),i.setSelection(s.from(),s.to()),u=s.from(),void(h=!1);var e,t,n;h=!0}function v(e){e&&e(),i.focus(),u&&(i.setCursor(u),(e=i.state.vim).exMode=!1,e.lastHPos=e.lastHSPos=u.ch),c&&c()}g(),h?Te(i,"No matches for "+n.source):e?Ae(i,{prefix:Me("span","replace with ",Me("strong",l)," (y/n/a/q/l)"),onKeyDown:function(e,t,n){switch(Ye.e_stop(e),Ye.keyName(e)){case"Y":m(),g();break;case"N":g();break;case"A":var r=c;c=void 0,i.operation(p),c=r;break;case"L":m();case"Q":case"Esc":case"Ctrl-C":case"Ctrl-[":v(n)}h&&v(n);return!0}}):(p(),c&&c())}(t,c,u,r,i,o,n,l,e.callback)):Te(t,"No previous substitute regular expression")},redo:Ye.commands.redo,undo:Ye.commands.undo,write:function(e){Ye.commands.save?Ye.commands.save(e):e.save&&e.save()},nohlsearch:function(e){Pe(e)},yank:function(e){var t=X(e.getCursor()).line,t=e.getLine(t);O.registerController.pushText("0","yank",t,!0,!0)},delmarks:function(e,t){if(t.argString&&ne(t.argString))for(var n=e.state.vim,r=new Ye.StringStream(ne(t.argString));!r.eol();){r.eatSpace();var i=r.pos;if(!r.match(/[a-zA-Z]/,!1))return void Te(e,"Invalid argument: "+t.argString.substring(i));var o=r.next();if(r.match("-",!0)){if(!r.match(/[a-zA-Z]/,!1))return void Te(e,"Invalid argument: "+t.argString.substring(i));var a=o,s=r.next();if(!(b(a)&&b(s)||k(a)&&k(s)))return void Te(e,"Invalid argument: "+a+"-");var l=a.charCodeAt(0),c=s.charCodeAt(0);if(c<=l)return void Te(e,"Invalid argument: "+t.argString.substring(i));for(var u=0;u<=c-l;u++){var d=String.fromCharCode(l+u);delete n.marks[d]}}else delete n.marks[o]}else Te(e,"Argument required")}},ze=new h;function We(e){var t=e.state.vim,n=O.macroModeState,r=O.registerController.getRegister("."),i=n.isPlaying,o=n.lastInsertModeChanges;i||(e.off("change",He),Ye.off(e.getInputField(),"keydown",$e)),!i&&1<t.insertModeRepeat&&(Ge(e,t,t.insertModeRepeat-1,!0),t.lastEditInputState.repeatOverride=t.insertModeRepeat),delete t.insertModeRepeat,t.insertMode=!1,e.setCursor(e.getCursor().line,e.getCursor().ch-1),e.setOption("keyMap","vim"),e.setOption("disableInput",!0),e.toggleOverwrite(!1),r.setText(o.changes.join("")),Ye.signal(e,"vim-mode-change",{mode:"normal"}),n.isRecording&&((e=n).isPlaying||(n=e.latestRegister,(n=O.registerController.getRegister(n))&&n.pushInsertModeChanges&&n.pushInsertModeChanges(e.lastInsertModeChanges)))}function qe(e){Qe.unshift(e)}function He(e,t){var n,r=O.macroModeState,i=r.lastInsertModeChanges;if(!r.isPlaying)for(;t;)i.expectCursorActivityForChange=!0,1<i.ignoreCount?i.ignoreCount--:"+input"!=t.origin&&"paste"!=t.origin&&void 0!==t.origin||(1<(n=e.listSelections().length)&&(i.ignoreCount=n),n=t.text.join("\n"),i.maybeReset&&(i.changes=[],i.maybeReset=!1),n&&(e.state.overwrite&&!/\n/.test(n)?i.changes.push([n]):i.changes.push(n))),t=t.next}function je(e){var t=e.state.vim;if(t.insertMode){var n=O.macroModeState;if(n.isPlaying)return;n=n.lastInsertModeChanges;n.expectCursorActivityForChange?n.expectCursorActivityForChange=!1:n.maybeReset=!0}else e.curOp.isVimOp||function(e,t){var n=e.getCursor("anchor"),r=e.getCursor("head");t.visualMode&&!e.somethingSelected()?le(e,!1):t.visualMode||t.insertMode||!e.somethingSelected()||(t.visualMode=!0,t.visualLine=!1,Ye.signal(e,"vim-mode-change",{mode:"visual"}));{var i,o;t.visualMode?(i=Q(r,n)?0:-1,o=Q(r,n)?-1:0,r=$(r,0,i),n=$(n,0,o),t.sel={anchor:n,head:r},ve(e,t,"<",J(r,n)),ve(e,t,">",Z(r,n))):t.insertMode||(t.lastHPos=e.getCursor().ch)}}(e,t);t.visualMode&&Ke(e)}function Ke(e){var t,n="cm-animate-fat-cursor",r=e.state.vim,i=U(e,X(r.sel.head)),o=$(i,0,1);Ue(r),i.ch==e.getLine(i.line).length?(t=Me("span",{class:n}," "),r.fakeCursorBookmark=e.setBookmark(i,{widget:t})):r.fakeCursor=e.markText(i,o,{className:n})}function Ue(e){e.fakeCursor&&(e.fakeCursor.clear(),e.fakeCursor=null),e.fakeCursorBookmark&&(e.fakeCursorBookmark.clear(),e.fakeCursorBookmark=null)}function Ve(e){this.keyName=e}function $e(e){var t=O.macroModeState.lastInsertModeChanges,n=Ye.keyName(e);n&&(-1==n.indexOf("Delete")&&-1==n.indexOf("Backspace")||Ye.lookupKey(n,"vim-insert",function(){return t.maybeReset&&(t.changes=[],t.maybeReset=!1),t.changes.push(new Ve(n)),!0}))}function Ge(n,r,e,t){var i=O.macroModeState;i.isPlaying=!0;var o=!!r.lastEditActionCommand,a=r.inputState;function s(){o?W.processAction(n,r,r.lastEditActionCommand):W.evalInput(n,r)}function l(e){var t;0<i.lastInsertModeChanges.changes.length&&(e=r.lastEditActionCommand?e:1,t=i.lastInsertModeChanges,Xe(n,t.changes,e))}if(r.inputState=r.lastEditInputState,o&&r.lastEditActionCommand.interlaceInsertRepeat)for(var c=0;c<e;c++)s(),l(1);else t||s(),l(e);r.inputState=a,r.insertMode&&!t&&We(n),i.isPlaying=!1}function Xe(t,e,n){function r(e){return"string"==typeof e?Ye.commands[e](t):e(t),!0}var i=t.getCursor("head"),o=O.macroModeState.lastInsertModeChanges.visualBlock;o&&(ie(t,i,o+1),n=t.listSelections().length,t.setCursor(i));for(var a=0;a<n;a++){o&&t.setCursor($(i,a,0));for(var s=0;s<e.length;s++){var l,c,u=e[s];u instanceof Ve?Ye.lookupKey(u.keyName,"vim-insert",r):"string"==typeof u?(c=t.getCursor(),t.replaceRange(u,c,c)):(c=$(l=t.getCursor(),0,u[0].length),t.replaceRange(u[0],l,c))}}o&&t.setCursor($(i,0,1))}return Ye.keyMap.vim={attach:r,detach:e,call:t},S("insertModeEscKeysTimeout",200,"number"),Ye.keyMap["vim-insert"]={fallthrough:["default"],attach:r,detach:e,call:t},Ye.keyMap["vim-replace"]={Backspace:"goCharLeft",fallthrough:["vim-insert"],attach:r,detach:e,call:t},P(),f}()}),function(i,u,o,t,a){"use strict";var d,s,l,c=i.getElementById("CodeMirror-settings"),r=i.getElementById("CodeMirror-settings__form"),f=i.getElementById("ed_toolbar"),h=i.getElementById("content")||i.getElementById("newcontent"),n=i.getElementById("content-html"),p=i.getElementById("content-tmce"),m=null!=i.getElementById("post_ID")?i.getElementById("post_ID").value:0,g=i.getElementById("editor-expand-toggle"),v={isVisualEnabled:null!=i.getElementById("content-tmce"),isThemeOrPlugin:null!=i.getElementById("newcontent"),isActive:function(){return null!=d},isVisualActive:function(){return null!=i.getElementsByClassName("tmce-active")[0]},isGutenberg:null!=(wp.data&&wp.data.select("core/edit-post")),isGutenbergVisualActive:function(){return"visual"===wp.data.select("core/edit-post").getEditorMode()},isFullHeight:function(){return!!g&&g.checked},previousSettingsPosition:"none",settingsPosition:function(){var e=this,t=f?"absolute"===f.style.position?"0px"===f.style.top?"top":"bottom":"fixed"===f.style.position?"middle":"normal":"none";return u.setTimeout(function(){e.previousSettingsPosition=t},0),t},charWidth:0},y={mode:"wordpresspost",tabMode:"indent",indentWithTabs:!0,smartIndent:!1,enterMode:"keep",styleActiveLine:!0,electricChars:!1,showCursorWhenSelecting:!0,viewportMargin:10,extraKeys:{F11:function(){P()},Esc:function(){P(!0)},"Ctrl-S":function(){e()},"Cmd-S":function(){e()}}};function e(){v.isGutenberg?(Q(),wp.data.dispatch("core/editor").savePost()):(i.getElementById("save-post")||i.getElementById("publish")||i.getElementById("submit")).click()}function b(e){var t=!1;return function(){t||(e.apply(this,arguments),t=!0,u.requestAnimationFrame(function(){u.requestAnimationFrame(function(){t=!1})}))}}function k(){for(var e=-1;e<c.children.length;e++){var t=e<0?l:c.children[e];null!=t&&(t.style.position="",t.style.top="",t.style.left="",t.style.right="",t.style.width="")}}var x=b(w);function w(e){S();var t=v.settingsPosition();if(t!==v.previousSettingsPosition||e&&"resize"===e.type)switch(R(),t){case"top":k();break;case"middle":!function(){for(var e=f.getBoundingClientRect(),t=-1;t<c.children.length;t++){var n=t<0?l:c.children[t];null!=n&&(n.style.position="fixed",n.style.top=e.bottom+"px",n.style.right=i.documentElement.getBoundingClientRect().width-e.right+"px",n.id.match(/toggle/gi)||(n.style.left=e.left+"px",n.style.width="auto"))}}();break;case"bottom":!function(){for(var e=f.getBoundingClientRect(),t=d.getWrapperElement().getBoundingClientRect(),n=-1;n<c.children.length;n++){var r=n<0?l:c.children[n];null!=r&&(r.style.position="absolute",r.style.top=-1*(t.top-e.bottom)+"px",r.style.left="",r.style.right="",r.style.width="")}}()}}var C=!!navigator.userAgent.match(/Trident/gi);function S(){var e,t,n;r&&(e=r.getBoundingClientRect().top,t=i.getElementById("post-status-info").getBoundingClientRect().top,n=u.innerHeight-e,r.style.maxHeight=Math.min(t-e,n)-6+"px",C&&(r.style.height=r.style.maxHeight))}function _(){v.isFullHeight()?(d.setOption("viewportMargin",1/0),d.on("change",R),u.addEventListener("scroll",x),u.addEventListener("resize",x),u.addEventListener("resize",D),d.getWrapperElement().style.height="auto",w(),F(),u.setTimeout(function(){S(),R()},100)):(d.setOption("viewportMargin",y.viewportMargin),d.off("change",R),u.removeEventListener("scroll",x),u.removeEventListener("resize",x),u.removeEventListener("resize",D),d.getWrapperElement().style.marginTop="",r.style.maxHeight="",C&&(r.style.height=""),k(),B())}function L(e){for(var t=0;t<e.length;t++){var n=e[t];if(n.addedNodes[0]&&n.addedNodes[0].classList.contains("CodeMirror-dialog"))for(var r=(l=n.addedNodes[0]).getElementsByTagName("button"),i=0;i<r.length;i++)r[i].classList="button button-small";else l=void 0}}function M(e){e.target.id.match(/advanced/gi)?c.classList.contains("open-advanced")?T("open"):T("advanced"):c.classList.contains("open")?T("closed"):T("open")}function T(e){switch(e){case"open":c.classList.add("open"),c.classList.remove("open-advanced"),c.classList.remove("closed");break;case"advanced":c.classList.add("open"),c.classList.add("open-advanced"),c.classList.remove("closed");break;default:c.classList.remove("open"),c.classList.remove("open-advanced"),c.classList.add("closed")}}function A(){v.charWidth=d.defaultCharWidth()*(a.fontSize/13)}function O(e){var t=+e.target.value,t=isNaN(t)?e.target.value:t;switch("checkbox"===e.target.type&&(t=e.target.checked),e.target.id){case"fontSize":a.fontSize=t,s.style.fontSize=t+"px",A(),d.refresh();break;case"lineHeight":a.lineHeight=t,s.style.lineHeight=t+"em",d.refresh();break;case"matchTags":a.matchTags=t,d.setOption("matchTags",t?{bothTags:!0}:null);break;case"scrollbarStyle":a.scrollbarStyle=t,d.setOption("scrollbarStyle",t?"overlay":null);break;case"foldGutter":d.setOption("gutters",t?["CodeMirror-linenumbers","CodeMirror-foldgutter"]:[]);case"tabSize":d.setOption("indentUnit",t);default:a[e.target.id]=t,d.setOption(e.target.id,t)}"lineNumbers"===e.target.id&&t&&a.foldGutter&&d.setOption("gutters",["CodeMirror-linenumbers","CodeMirror-foldgutter"])}function N(){var e=t(r).serializeArray();t.post(a.ajaxUrl,e,function(e){})}var E=i.getElementById("wp-content-editor-container"),I="heshFullscreen";function P(e){e=!0===e,v.isFullHeight()?E.classList.remove(I):(E.classList.contains(I)||e?E.classList.remove(I):E.classList.add(I),d.focus())}function R(){d.save(),d.getTextArea().style.height=d.getWrapperElement().getBoundingClientRect().height+"px"}function B(){d.getWrapperElement().style.height=d.getTextArea().style.height}var D=b(F);function F(){d.getWrapperElement().style.marginTop=f.offsetHeight+"px"}var z,W,q=200,H=500;function j(e){W=H+(e.pageY-z),d.getWrapperElement().style.height=Math.max(q,W)+"px"}function K(e){z=e.pageY,i.addEventListener("mousemove",j),i.addEventListener("mouseup",U),e.preventDefault()}function U(e){H=Math.max(q,W),i.removeEventListener("mousemove",j),d.refresh(),i.removeEventListener("mouseup",U)}function V(e){W=H=e,d.getWrapperElement().style.height=H+"px";e=i.createElement("div");e.className="hesh-content-resize-handle",e.id="content-resize-handle",d.getWrapperElement().appendChild(e),i.getElementById("content-resize-handle").addEventListener("mousedown",K)}function $(){var e=(function(e){if(2===(e=("; "+i.cookie).split("; "+e+"=")).length)return e.pop().split(";").shift()}("hesh_plugin_selection_state")||"0,0,0,0,0,0,0").split(",");m===e[0]&&(d.doc.setSelection({line:+e[1],ch:+e[2]},{line:+e[3],ch:+e[4]},{scroll:!1}),d.scrollTo(+e[5],+e[6]))}var G=b(X);function X(){var e=d.doc.listSelections()[0],t=d.getScrollInfo();i.cookie="hesh_plugin_selection_state="+m+","+e.anchor.line+","+e.anchor.ch+","+e.head.line+","+e.head.ch+","+t.left+","+t.top}function Y(){var t,n,r,e,i,o=d.doc.listSelections()[0];function a(){u.clearInterval(i),d.off("focus",a)}t=n=r=0,d.doc.eachLine(function(e){r<=o.head.line-1&&(t+=e.text.length+1),r<=o.anchor.line-1&&(n+=e.text.length+1),r++}),t+=o.head.ch,n+=o.anchor.ch,d.getTextArea().setSelectionRange(Math.min(n,t),Math.max(n,t)),d.getTextArea().focus(),e=d.getTextArea().value.length,i=u.setInterval(function(){e!==d.getTextArea().value.length&&(u.clearInterval(i),function(){var e=d.getTextArea().selectionStart,t=d.getTextArea().selectionEnd,n=d.getScrollInfo(),r={top:u.pageYOffset,left:u.pageXOffset};d.doc.setValue(d.getTextArea().value),d.focus();var i=0,o=0,a=0,s=e,l=t,c=d.getLineHandle(a).text.length+1;for(;c<=s&&c<=l;)a++,c<=s&&(s-=c,i=a),c<=l&&(l-=c,o=a),c=d.getLineHandle(a).text.length+1;d.doc.setSelection({line:i,ch:s},{line:o,ch:l},{scroll:!1}),u.scrollTo(r.left,r.top),d.scrollTo(n.left,n.top),d.save()}())},10),d.on("focus",a)}function Q(){d.save(),X(),wp.data.dispatch("core/editor").resetBlocks(wp.blocks.parse(d.getTextArea().value)),d.setValue(wp.data.select("core/editor").getEditedPostContent()),$()}function J(){var t,e,n,r;v.isActive()||null!=(h=v.isGutenberg?i.getElementsByClassName("editor-post-text-editor")[0]:h)&&(y.theme=a.theme,y.lineNumbers=!!a.lineNumbers,y.foldGutter=!!a.foldGutter,y.gutters=y.foldGutter?["CodeMirror-linenumbers","CodeMirror-foldgutter"]:[],y.tabSize=y.indentUnit=+a.tabSize,y.lineWrapping=!!a.lineWrapping,y.matchBrackets=!!a.matchBrackets,y.autoCloseTags=!!a.autoCloseTags,y.autoCloseBrackets=!!a.autoCloseBrackets,y.surveyNoticeDismissedB=!!a.surveyNoticeDismissedB,y.highlightSelectionMatches=!!a.highlightSelectionMatches,y.matchTags=!!a.matchTags&&{bothTags:!0},y.scrollbarStyle=a.scrollbarStyle?"overlay":null,y.keyMap=a.keyMap,y.autofocus=i.getElementById("title")&&!!i.getElementById("title").value&&0<i.getElementById("title").value.length,v.isThemeOrPlugin&&(e=(e=i.querySelector(".fileedit-sub .alignleft").textContent.match(/\.[a-z\d]{2,}/gi))[e.length-1].match(/[a-z]*/gi)[1],y.mode={php:"php",css:"css",xml:"xml",html:"htmlmixed",js:"javascript",json:"javascript"}[e]),d=o.fromTextArea(h,y),s=d.getWrapperElement().querySelector(".CodeMirror-code"),h.classList.add("CodeMirror-mirrored"),v.isGutenberg?d.on("blur",Q):d.on("change",function(){d.save()}),$(),d.on("cursorActivity",G),d.on("scroll",G),v.isThemeOrPlugin?V(u.innerHeight-d.getWrapperElement().getBoundingClientRect().top-100):v.isGutenberg?V(u.innerHeight-d.getWrapperElement().getBoundingClientRect().top-16):(f.addEventListener("mousedown",Y),t=u.send_to_editor,u.send_to_editor=function(e){v.isActive()&&"content"===u.wpActiveEditor?(d.replaceSelection(e),d.save()):t(e)},i.getElementById("content-resize-handle").addEventListener("mousedown",function(){i.addEventListener("mousemove",B)}),i.addEventListener("mouseup",function(){i.removeEventListener("mousemove",B)}),g&&(g.addEventListener("change",_),_()),f.insertAdjacentHTML("afterbegin",'<button type="button" id="cm_content_fullscreen" class="ed_button qt-dfw" title="Full Screen"></button>'),i.getElementById("cm_content_fullscreen").onclick=P),function(){d.getWrapperElement().appendChild(c),c.style.display="block",c.querySelector(".CodeMirror-settings__toggle").addEventListener("click",M),c.querySelector(".CodeMirror-settings__toggle-advanced").addEventListener("click",M),new MutationObserver(L).observe(d.getWrapperElement(),{childList:!0});for(var e=c.querySelectorAll(".CodeMirror-settings__option"),t=0;t<e.length;t++){var n=e[t];n.addEventListener("change",N),n.addEventListener("change",O)}}(),n=+a.fontSize,r=+a.lineHeight,s.style.fontSize=n+"px",a.fontSize=n,s.style.lineHeight=r+"em",a.lineHeight=r,A(),d.refresh(),e=".CodeMirror pre > * { text-indent: 0px; }",n=i.head||i.getElementsByTagName("head")[0],(r=i.createElement("style")).type="text/css",r.styleSheet?r.styleSheet.cssText=e:r.appendChild(i.createTextNode(e)),n.appendChild(r),d.on("renderLine",function(e,t,n){e=o.countColumn(t.text,null,e.getOption("tabSize"))*v.charWidth;n.style.textIndent="-"+e+"px",n.style.paddingLeft=4+e+"px"}),d.refresh())}function Z(){v.isActive()&&(T("closed"),d.toTextArea(),d=void 0)}function ee(){var e,t;(e=i.querySelector(".notice-hesh .notice-dismiss"))&&e.addEventListener("click",function(){var e=r.elements.surveyNoticeDismissedB;e&&(e.value=!0),N()}),v.isThemeOrPlugin?J():v.isGutenberg?(t=v.isGutenbergVisualActive(),wp.data.subscribe(function(){v.isGutenbergVisualActive()!==t&&((t=v.isGutenbergVisualActive())?Z():u.setTimeout(J,0))}),t||J()):v.isVisualEnabled?(n.addEventListener("click",function(){u.setTimeout(J,0)}),p.addEventListener("click",Z),v.isVisualActive()||J()):(J(),i.body.className+=" visual-editor-is-disabled")}"complete"!==i.readyState?u.addEventListener?u.addEventListener("load",ee,!1):u.attachEvent&&u.attachEvent("onload",ee):ee()}(document,window,window.CodeMirror,window.jQuery,window.heshOptions);
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).CodeMirror=t()}(this,function(){"use strict";var e=navigator.userAgent,t=navigator.platform,f=/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),k=n||r||i,v=k&&(n?document.documentMode||6:+(i||r)[1]),h=!i&&/WebKit\//.test(e),r=h&&/Qt\/\d+\.\d+/.test(e),o=!i&&/Chrome\//.test(e),p=/Opera\//.test(e),u=/Apple Computer/.test(navigator.vendor),a=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),c=/PhantomJS/.test(e),s=u&&(/Mobile\/\w+/.test(e)||2<navigator.maxTouchPoints),l=/Android/.test(e),d=s||l||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),m=s||/Mac/.test(t),g=/\bCrOS\b/.test(e),y=/win/i.test(t),e=p&&e.match(/Version\/(\d*\.\d*)/);(e=e&&Number(e[1]))&&15<=e&&(h=!(p=!1));var b=m&&(r||p&&(null==e||e<12.11)),x=f||k&&9<=v;function w(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var C=function(e,t){var n=e.className,r=w(t).exec(n);r&&(t=n.slice(r.index+r[0].length),e.className=n.slice(0,r.index)+(t?r[1]+t:""))};function S(e){for(var t=e.childNodes.length;0<t;--t)e.removeChild(e.firstChild);return e}function _(e,t){return S(e).appendChild(t)}function M(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 L(e,t,n,r){r=M(e,t,n,r);return r.setAttribute("role","presentation"),r}function T(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if((t=11==t.nodeType?t.host:t)==e)return!0}while(t=t.parentNode)}function A(){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 O(e,t){var n=e.className;w(t).test(n)||(e.className+=(n?" ":"")+t)}function N(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!w(n[r]).test(t)&&(t+=" "+n[r]);return t}var E=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},I=function(e){e.select()};function P(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function R(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 B(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 s=e.indexOf("\t",o);if(s<0||t<=s)return a+(t-o);a+=s-o,a+=n-a%n,o=s+1}}s?I=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:k&&(I=function(e){try{e.select()}catch(e){}});function D(){this.id=null,this.f=null,this.time=0,this.handler=P(this.onTimeout,this)}function F(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}D.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)};var z=50,W={toString:function(){return"CodeMirror.Pass"}},q={scroll:!(D.prototype.set=function(e,t){this.f=t;t=+new Date+e;(!this.id||t<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=t)})},H={origin:"*mouse"},j={origin:"+move"};function K(e,t,n){for(var r=0,i=0;;){var o=e.indexOf("\t",r),a=(o=-1==o?e.length: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 U=[""];function V(e){for(;U.length<=e;)U.push($(U)+" ");return U[e]}function $(e){return e[e.length-1]}function G(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function X(){}function Y(e,t){e=Object.create?Object.create(e):(X.prototype=e,new X);return t&&R(t,e),e}var Q=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function J(e){return/\w/.test(e)||"€"<e&&(e.toUpperCase()!=e.toLowerCase()||Q.test(e))}function Z(e,t){return t?!!(-1<t.source.indexOf("\\w")&&J(e))||t.test(e):J(e)}function ee(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return;return 1}var te=/[\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 ne(e){return 768<=e.charCodeAt(0)&&te.test(e)}function re(e,t,n){for(;(n<0?0<t:t<e.length)&&ne(e.charAt(t));)t+=n;return t}function ie(e,t,n){for(var r=n<t?-1:1;;){if(t==n)return t;var i=(t+n)/2,i=r<0?Math.ceil(i):Math.floor(i);if(i==t)return e(i)?t:n;e(i)?n=i:t=i+r}}var oe=null;function ae(e,t,n){var r;oe=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:oe=i),o.from==t&&(o.from!=o.to&&"before"!=n?r=i:oe=i)}return null!=r?r:oe}var se,le,ce,ue,de,fe=(se=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,le=/[stwN]/,ce=/[LRr]/,ue=/[Lb1n]/,de=/[1n]/,function(e,t){var n="ltr"==t?"L":"R";if(0==e.length||"ltr"==t&&!se.test(e))return!1;for(var r,i=e.length,o=[],a=0;a<i;++a)o.push((r=e.charCodeAt(a))<=247?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(r):1424<=r&&r<=1524?"R":1536<=r&&r<=1785?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(r-1536):1774<=r&&r<=2220?"r":8192<=r&&r<=8203?"w":8204==r?"b":"L");for(var s=0,l=n;s<i;++s){var c=o[s];"m"==c?o[s]=l:l=c}for(var u=0,d=n;u<i;++u){var f=o[u];"1"==f&&"r"==d?o[u]="n":ce.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){for(var y=void 0,y=g+1;y<i&&"%"==o[y];++y);for(var b=g&&"!"==o[g-1]||y<i&&"1"==o[y]?"1":"N",k=g;k<y;++k)o[k]=b;g=y-1}}for(var x=0,w=n;x<i;++x){var C=o[x];"L"==w&&"1"==C?o[x]="L":ce.test(C)&&(w=C)}for(var S=0;S<i;++S)if(le.test(o[S])){for(var _=void 0,_=S+1;_<i&&le.test(o[_]);++_);for(var L="L"==(S?o[S-1]:n),M=L==("L"==(_<i?o[_]:n))?L?"L":"R":n,T=S;T<_;++T)o[T]=M;S=_-1}for(var A,O=[],N=0;N<i;)if(ue.test(o[N])){var E=N;for(++N;N<i&&ue.test(o[N]);++N);O.push(new he(0,E,N))}else{var I=N,P=O.length,R="rtl"==t?1:0;for(++N;N<i&&"L"!=o[N];++N);for(var B=I;B<N;)if(de.test(o[B])){I<B&&(O.splice(P,0,new he(1,I,B)),P+=R);var D=B;for(++B;B<N&&de.test(o[B]);++B);O.splice(P,0,new he(2,D,B)),P+=R,I=B}else++B;I<N&&O.splice(P,0,new he(1,I,N))}return"ltr"==t&&(1==O[0].level&&(A=e.match(/^\s+/))&&(O[0].from=A[0].length,O.unshift(new he(0,0,A[0].length))),1==$(O).level&&(A=e.match(/\s+$/))&&($(O).to-=A[0].length,O.push(new he(0,i-A[0].length,i)))),"rtl"==t?O.reverse():O});function he(e,t,n){this.level=e,this.from=t,this.to=n}function pe(e,t){var n=e.order;return n=null==n?e.order=fe(e.text,t):n}var me=[],ge=function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent?e.attachEvent("on"+t,n):(e=e._handlers||(e._handlers={}))[t]=(e[t]||me).concat(n)};function ve(e,t){return e._handlers&&e._handlers[t]||me}function ye(e,t,n){var r;e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent?e.detachEvent("on"+t,n):!(e=(r=e._handlers)&&r[t])||-1<(n=F(e,n))&&(r[t]=e.slice(0,n).concat(e.slice(n+1)))}function be(e,t){var n=ve(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 ke(e,t,n){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),be(e,n||t.type,e,t),Le(t)||t.codemirrorIgnore}function xe(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==F(n,t[r])&&n.push(t[r])}function we(e,t){return 0<ve(e,t).length}function Ce(e){e.prototype.on=function(e,t){ge(this,e,t)},e.prototype.off=function(e,t){ye(this,e,t)}}function Se(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function _e(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Le(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Me(e){Se(e),_e(e)}function Te(e){return e.target||e.srcElement}function Ae(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),t=m&&e.ctrlKey&&1==t?3:t}var Oe,Ne,Ee=function(){if(k&&v<9)return!1;var e=M("div");return"draggable"in e||"dragDrop"in e}();var Ie=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/)},Pe=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)},Re="oncopy"in(r=M("div"))||(r.setAttribute("oncopy","return;"),"function"==typeof r.oncopy),Be=null;var De={},Fe={};function ze(e){if("string"==typeof e&&Fe.hasOwnProperty(e))e=Fe[e];else if(e&&"string"==typeof e.name&&Fe.hasOwnProperty(e.name)){var t=Fe[e.name];(e=Y(t="string"==typeof t?{name:t}:t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return ze("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return ze("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function We(e,t){t=ze(t);var n=De[t.name];if(!n)return We(e,"text/plain");var r=n(e,t);if(qe.hasOwnProperty(t.name)){var i,o=qe[t.name];for(i in o)o.hasOwnProperty(i)&&(r.hasOwnProperty(i)&&(r["_"+i]=r[i]),r[i]=o[i])}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 qe={};function He(e,t){R(t,qe.hasOwnProperty(e)?qe[e]:qe[e]={})}function je(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var n,r={};for(n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function Ke(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 Ue(e,t,n){return!e.startState||e.startState(t,n)}var Ve=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 $e(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 Ge(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(e){e=e.text;i==n.line&&(e=e.slice(0,n.ch)),i==t.line&&(e=e.slice(t.ch)),r.push(e),++i}),r}function Xe(e,t,n){var r=[];return e.iter(t,n,function(e){r.push(e.text)}),r}function Ye(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Qe(e){if(null==e.parent)return null;for(var t=e.parent,n=F(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 Je(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 s=e.lines[a].height;if(t<s)break;t-=s}return n+a}function Ze(e,t){return t>=e.first&&t<e.first+e.size}function et(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function tt(e,t,n){if(void 0===n&&(n=null),!(this instanceof tt))return new tt(e,t,n);this.line=e,this.ch=t,this.sticky=n}function nt(e,t){return e.line-t.line||e.ch-t.ch}function rt(e,t){return e.sticky==t.sticky&&0==nt(e,t)}function it(e){return tt(e.line,e.ch)}function ot(e,t){return nt(e,t)<0?t:e}function at(e,t){return nt(e,t)<0?e:t}function st(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function lt(e,t){if(t.line<e.first)return tt(e.first,0);var n=e.first+e.size-1;return t.line>n?tt(n,$e(e,n).text.length):(e=$e(e,(n=t).line).text.length,null==(t=n.ch)||e<t?tt(n.line,e):t<0?tt(n.line,0):n)}function ct(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=lt(e,t[r]);return n}Ve.prototype.eol=function(){return this.pos>=this.string.length},Ve.prototype.sol=function(){return this.pos==this.lineStart},Ve.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ve.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ve.prototype.eat=function(e){var t=this.string.charAt(this.pos),e="string"==typeof e?t==e:t&&(e.test?e.test(t):e(t));if(e)return++this.pos,t},Ve.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ve.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ve.prototype.skipToEnd=function(){this.pos=this.string.length},Ve.prototype.skipTo=function(e){e=this.string.indexOf(e,this.pos);if(-1<e)return this.pos=e,!0},Ve.prototype.backUp=function(e){this.pos-=e},Ve.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=B(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?B(this.string,this.lineStart,this.tabSize):0)},Ve.prototype.indentation=function(){return B(this.string,null,this.tabSize)-(this.lineStart?B(this.string,this.lineStart,this.tabSize):0)},Ve.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)}r=function(e){return n?e.toLowerCase():e};if(r(this.string.substr(this.pos,e.length))==r(e))return!1!==t&&(this.pos+=e.length),!0},Ve.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ve.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ve.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ve.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ut(e,t){this.state=e,this.lookAhead=t}var dt=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 ft(t,n,r,e){var l=[t.state.modeGen],i={};xt(t,n.text,t.doc.mode,r,function(e,t){return l.push(e,t)},i,e);for(var c=r.state,o=0;o<t.state.overlays.length;++o)!function(e){r.baseTokens=l;var o=t.state.overlays[e],a=1,s=0;r.state=!0,xt(t,n.text,o.mode,r,function(e,t){for(var n=a;s<e;){var r=l[a];e<r&&l.splice(a,1,e,l[a+1],r),a+=2,s=Math.min(e,r)}if(t)if(o.opaque)l.splice(n,a-n,e,"overlay "+t),a=n+2;else for(;n<a;n+=2){var i=l[n+1];l[n+1]=(i?i+" ":"")+"overlay "+t}},i),r.state=c,r.baseTokens=null,r.baseTokenPos=1}(o);return{styles:l,classes:i.bgClass||i.textClass?i:null}}function ht(e,t,n){var r,i,o;return t.styles&&t.styles[0]==e.state.modeGen||(r=pt(e,Qe(t)),i=t.text.length>e.options.maxHighlightLength&&je(e.doc.mode,r.state),o=ft(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))),t.styles}function pt(n,r,e){var t=n.doc,i=n.display;if(!t.mode.startState)return new dt(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),s=t;a<s;--s){if(s<=o.first)return o.first;var l=$e(o,s-1),c=l.stateAfter;if(c&&(!n||s+(c instanceof ut?c.lookAhead:0)<=o.modeFrontier))return s;l=B(l.text,null,e.options.tabSize);(null==i||l<r)&&(i=s-1,r=l)}return i}(n,r,e),a=o>t.first&&$e(t,o-1).stateAfter,s=a?dt.fromSaved(t,a,o):new dt(t,Ue(t.mode),o);return t.iter(o,r,function(e){mt(n,e.text,s);var t=s.line;e.stateAfter=t==r-1||t%5==0||t>=i.viewFrom&&t<i.viewTo?s.save():null,s.nextLine()}),e&&(t.modeFrontier=s.line),s}function mt(e,t,n,r){var i=e.doc.mode,o=new Ve(t,e.options.tabSize,n);for(o.start=o.pos=r||0,""==t&&gt(i,n.state);!o.eol();)vt(i,o,n.state),o.start=o.pos}function gt(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){t=Ke(e,t);return t.mode.blankLine?t.mode.blankLine(t.state):void 0}}function vt(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Ke(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.")}dt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},dt.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}},dt.prototype.nextLine=function(){this.line++,0<this.maxLookAhead&&this.maxLookAhead--},dt.fromSaved=function(e,t,n){return t instanceof ut?new dt(e,je(e.mode,t.state),n,t.lookAhead):new dt(e,je(e.mode,t),n)},dt.prototype.save=function(e){e=!1!==e?je(this.doc.mode,this.state):this.state;return 0<this.maxLookAhead?new ut(e,this.maxLookAhead):e};var yt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function bt(e,t,n,r){var i,o,a=e.doc,s=a.mode,l=$e(a,(t=lt(a,t)).line),c=pt(e,t.line,n),u=new Ve(l.text,e.options.tabSize,c);for(r&&(o=[]);(r||u.pos<t.ch)&&!u.eol();)u.start=u.pos,i=vt(s,u,c.state),r&&o.push(new yt(u,i,je(a.mode,c.state)));return r?o:new yt(u,i,c.state)}function kt(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 xt(e,t,n,r,i,o,a){var s=n.flattenSpans;null==s&&(s=e.options.flattenSpans);var l=0,c=null,u=new Ve(t,e.options.tabSize,r),d=e.options.addModeClass&&[null];for(""==t&&kt(gt(n,r.state),o);!u.eol();){var f,h=u.pos>e.options.maxHighlightLength?(s=!1,a&&mt(e,t,r,u.pos),u.pos=t.length,null):kt(vt(n,u,r.state,d),o);if(!d||(f=d[0].name)&&(h="m-"+(h?f+" "+h:f)),!s||c!=h){for(;l<u.start;)i(l=Math.min(u.start,l+5e3),c);c=h}u.start=u.pos}for(;l<u.pos;){var p=Math.min(u.pos,l+5e3);i(p,c),l=p}}var wt=!1,Ct=!1;function St(e,t,n){this.marker=e,this.from=t,this.to=n}function _t(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Lt(e,t){if(t.full)return null;var n=Ze(e,t.from.line)&&$e(e,t.from.line).markedSpans,r=Ze(e,t.to.line)&&$e(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,o=t.to.ch,e=0==nt(t.from,t.to),a=function(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o,a=e[i],s=a.marker;!(null==a.from||(s.inclusiveLeft?a.from<=t:a.from<t))&&(a.from!=t||"bookmark"!=s.type||n&&a.marker.insertLeft)||(o=null==a.to||(s.inclusiveRight?a.to>=t:a.to>t),(r=r||[]).push(new St(s,a.from,o?null:a.to)))}return r}(n,i,e),s=function(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o,a=e[i],s=a.marker;!(null==a.to||(s.inclusiveRight?a.to>=t:a.to>t))&&(a.from!=t||"bookmark"!=s.type||n&&!a.marker.insertLeft)||(o=null==a.from||(s.inclusiveLeft?a.from<=t:a.from<t),(r=r||[]).push(new St(s,o?null:a.from-t,null==a.to?null:a.to-t)))}return r}(r,o,e),l=1==t.text.length,c=$(t.text).length+(l?i:0);if(a)for(var u=0;u<a.length;++u){var d,f=a[u];null==f.to&&((d=_t(s,f.marker))?l&&(f.to=null==d.to?null:d.to+c):f.to=i)}if(s)for(var h=0;h<s.length;++h){var p=s[h];null!=p.to&&(p.to+=c),null==p.from?_t(a,p.marker)||(p.from=c,l&&(a=a||[]).push(p)):(p.from+=c,l&&(a=a||[]).push(p))}a=a&&Mt(a),s&&s!=a&&(s=Mt(s));var m=[a];if(!l){var g,v=t.text.length-2;if(0<v&&a)for(var y=0;y<a.length;++y)null==a[y].to&&(g=g||[]).push(new St(a[y].marker,null,null));for(var b=0;b<v;++b)m.push(g);m.push(s)}return m}function Mt(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 Tt(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function At(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function Ot(e){return e.inclusiveLeft?-1:0}function Nt(e){return e.inclusiveRight?1:0}function Et(e,t){var n=e.lines.length-t.lines.length;if(0!=n)return n;var r=e.find(),i=t.find(),n=nt(r.from,i.from)||Ot(e)-Ot(t);if(n)return-n;i=nt(r.to,i.to)||Nt(e)-Nt(t);return i||t.id-e.id}function It(e,t){var n,r=Ct&&e.markedSpans;if(r)for(var i,o=0;o<r.length;++o)(i=r[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!n||Et(n,i.marker)<0)&&(n=i.marker);return n}function Pt(e){return It(e,!0)}function Rt(e){return It(e,!1)}function Bt(e,t,n,r,i){var t=$e(e,t),o=Ct&&t.markedSpans;if(o)for(var a=0;a<o.length;++a){var s=o[a];if(s.marker.collapsed){var l=s.marker.find(0),c=nt(l.from,n)||Ot(s.marker)-Ot(i),u=nt(l.to,r)||Nt(s.marker)-Nt(i);if(!(0<=c&&u<=0||c<=0&&0<=u)&&(c<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?0<=nt(l.to,n):0<nt(l.to,n))||0<=c&&(s.marker.inclusiveRight&&i.inclusiveLeft?nt(l.from,r)<=0:nt(l.from,r)<0)))return 1}}}function Dt(e){for(var t;t=Pt(e);)e=t.find(-1,!0).line;return e}function Ft(e,t){var n=$e(e,t),e=Dt(n);return n==e?t:Qe(e)}function zt(e,t){if(t>e.lastLine())return t;var n,r=$e(e,t);if(!Wt(e,r))return t;for(;n=Rt(r);)r=n.find(1,!0).line;return Qe(r)+1}function Wt(e,t){var n=Ct&&t.markedSpans;if(n)for(var r,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&&function e(t,n,r){if(null==r.to){var i=r.marker.find(1,!0);return e(t,i.line,_t(i.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==n.text.length)return!0;for(var o=void 0,a=0;a<n.markedSpans.length;++a)if((o=n.markedSpans[a]).marker.collapsed&&!o.marker.widgetNode&&o.from==r.to&&(null==o.to||o.to!=r.from)&&(o.marker.inclusiveLeft||r.marker.inclusiveRight)&&e(t,n,o))return!0}(e,t,r))return!0}}function qt(e){for(var t=0,n=(e=Dt(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 s=o.children[a];if(s==n)break;t+=s.height}return t}function Ht(e){if(0==e.height)return 0;for(var t,n=e.text.length,r=e;t=Pt(r);){var i=t.find(0,!0),r=i.from.line;n+=i.from.ch-i.to.ch}for(r=e;t=Rt(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 jt(e){var n=e.display,e=e.doc;n.maxLine=$e(e,e.first),n.maxLineLength=Ht(n.maxLine),n.maxLineChanged=!0,e.iter(function(e){var t=Ht(e);t>n.maxLineLength&&(n.maxLineLength=t,n.maxLine=e)})}var Kt=function(e,t,n){this.text=e,At(this,t),this.height=n?n(this):1};Kt.prototype.lineNo=function(){return Qe(this)},Ce(Kt);var Ut={},Vt={};function $t(e,t){if(!e||/^\s*$/.test(e))return null;t=t.addModeClass?Vt:Ut;return t[e]||(t[e]=e.replace(/\S+/g,"cm-$&"))}function Gt(e,t){var n=L("span",null,null,h?"padding-right: .1px":null),r={pre:L("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=Yt,function(e){if(null!=Ne)return Ne;var t=_(e,document.createTextNode("AخA")),n=E(t,0,1).getBoundingClientRect(),t=E(t,1,2).getBoundingClientRect();return S(e),n&&n.left!=n.right&&(Ne=t.right-n.right<3)}(e.display.measure)&&(a=pe(o,e.doc.direction))&&(r.addToken=function(d,f){return function(e,t,n,r,i,o,a){n=n?n+" cm-force-border":"cm-force-border";for(var s=e.pos,l=s+t.length;;){for(var c=void 0,u=0;u<f.length&&!((c=f[u]).to>s&&c.from<=s);u++);if(c.to>=l)return d(e,t,n,r,i,o,a);d(e,t.slice(0,c.to-s),n,r,null,o,a),r=null,t=t.slice(c.to-s),s=c.to}}}(r.addToken,a)),r.map=[],function(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var a,s,l,c,u,d,f,h=i.length,p=0,m=1,g="",v=0;;){if(v==p){l=c=u=s="",d=f=null,v=1/0;for(var y=[],b=void 0,k=0;k<r.length;++k){var x=r[k],w=x.marker;if("bookmark"==w.type&&x.from==p&&w.widgetNode)y.push(w);else if(x.from<=p&&(null==x.to||x.to>p||w.collapsed&&x.to==p&&x.from==p)){if(null!=x.to&&x.to!=p&&v>x.to&&(v=x.to,c=""),w.className&&(l+=" "+w.className),w.css&&(s=(s?s+";":"")+w.css),w.startStyle&&x.from==p&&(u+=" "+w.startStyle),w.endStyle&&x.to==v&&(b=b||[]).push(w.endStyle,x.to),w.title&&((f=f||{}).title=w.title),w.attributes)for(var C in w.attributes)(f=f||{})[C]=w.attributes[C];w.collapsed&&(!d||Et(d.marker,w)<0)&&(d=x)}else x.from>p&&v>x.from&&(v=x.from)}if(b)for(var S=0;S<b.length;S+=2)b[S+1]==v&&(c+=" "+b[S]);if(!d||d.from==p)for(var _=0;_<y.length;++_)Qt(t,0,y[_]);if(d&&(d.from||0)==p){if(Qt(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,T=p+g.length;if(d||(M=L<T?g.slice(0,L-p):g,t.addToken(t,M,a?a+l:l,u,p+M.length==v?c:"",s,f)),L<=T){g=g.slice(L-p),p=L;break}p=T,u=""}g=i.slice(o,o=n[m++]),a=$t(n[m++],t.cm.options)}}else for(var A=1;A<n.length;A+=2)t.addToken(t,i.slice(o,o=n[A]),$t(n[A+1],t.cm.options))}(o,r,ht(e,o,t!=e.display.externalMeasured&&Qe(o))),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=N(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=N(o.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(function(e){null==Oe&&(t=M("span","​"),_(e,M("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Oe=t.offsetWidth<=1&&2<t.offsetHeight&&!(k&&v<8)));var t=Oe?M("span","​"):M("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return t.setAttribute("cm-text",""),t}(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({}))}return h&&(n=r.content.lastChild,(/\bcm-tab\b/.test(n.className)||n.querySelector&&n.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")),be(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=N(r.pre.className,r.textClass||"")),r}function Xt(e){var t=M("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Yt(e,t,n,r,i,o,a){if(t){var 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,l=e.cm.state.specialChars,c=!1;if(l.test(t))for(var u=document.createDocumentFragment(),d=0;;){l.lastIndex=d;var f=l.exec(t),h=f?f.index-d:t.length-d;if(h&&(p=document.createTextNode(s.slice(d,d+h)),k&&v<9?u.appendChild(M("span",[p])):u.appendChild(p),e.map.push(e.pos,e.pos+h,p),e.col+=h,e.pos+=h),!f)break;d+=1+h;var p=void 0;"\t"==f[0]?(h=(h=e.cm.options.tabSize)-e.col%h,(p=u.appendChild(M("span",V(h),"cm-tab"))).setAttribute("role","presentation"),p.setAttribute("cm-text","\t"),e.col+=h):("\r"==f[0]||"\n"==f[0]?(p=u.appendChild(M("span","\r"==f[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",f[0]):((p=e.cm.options.specialCharPlaceholder(f[0])).setAttribute("cm-text",f[0]),k&&v<9?u.appendChild(M("span",[p])):u.appendChild(p)),e.col+=1),e.map.push(e.pos,e.pos+1,p),e.pos++}else e.col+=t.length,u=document.createTextNode(s),e.map.push(e.pos,e.pos+t.length,u),k&&v<9&&(c=!0),e.pos+=t.length;if(e.trailingSpace=32==s.charCodeAt(t.length-1),n||r||i||c||o||a){n=n||"";r&&(n+=r),i&&(n+=i);var m=M("span",[u],n,o);if(a)for(var g in a)a.hasOwnProperty(g)&&"style"!=g&&"class"!=g&&m.setAttribute(g,a[g]);return e.content.appendChild(m)}e.content.appendChild(u)}}function Qt(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 Jt(e,t,n){this.line=t,this.rest=function(e){for(var t,n;t=Rt(e);)e=t.find(1,!0).line,(n=n||[]).push(e);return n}(t),this.size=this.rest?Qe($(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Wt(e,t)}function Zt(e,t,n){for(var r=[],i=t;i<n;i=a){var o=new Jt(e.doc,$e(e.doc,i),i),a=i+o.size;r.push(o)}return r}var en=null;function tn(e,t){e=e.ownsGroup;if(e)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)}(e)}finally{en=null,t(e)}}var nn=null;function rn(e,t){var n=ve(e,t);if(n.length){var r,i=Array.prototype.slice.call(arguments,2);en?r=en.delayedCallbacks:nn?r=nn:(r=nn=[],setTimeout(on,0));for(var o=0;o<n.length;++o)!function(e){r.push(function(){return n[e].apply(null,i)})}(o)}}function on(){var e=nn;nn=null;for(var t=0;t<e.length;++t)e[t]()}function an(e,t,n,r){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?function(e,t){var n=t.text.className,r=ln(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,cn(e,t)):n&&(t.text.className=n)}(e,t):"gutter"==o?un(e,t,n,r):"class"==o?cn(e,t):"widget"==o&&function(e,t,n){t.alignable&&(t.alignable=null);for(var r=w("CodeMirror-linewidget"),i=t.node.firstChild,o=void 0;i;i=o)o=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);dn(e,t,n)}(e,t,r)}t.changes=null}function sn(e){return e.node==e.text&&(e.node=M("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),k&&v<8&&(e.node.style.zIndex=2)),e.node}function ln(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Gt(e,t)}function cn(e,t){var n,r;n=e,(r=(i=t).bgClass?i.bgClass+" "+(i.line.bgClass||""):i.line.bgClass)&&(r+=" CodeMirror-linebackground"),i.background?r?i.background.className=r:(i.background.parentNode.removeChild(i.background),i.background=null):r&&(e=sn(i),i.background=e.insertBefore(M("div",null,r),e.firstChild),n.display.input.setUneditable(i.background)),t.line.wrapClass?sn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function un(e,t,n,r){t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass&&(o=sn(t),t.gutterBackground=M("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),o.insertBefore(t.gutterBackground,t.text));var i=t.line.gutterMarkers;if(e.options.lineNumbers||i){var o=sn(t),a=t.gutter=M("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(a.setAttribute("aria-hidden","true"),e.display.input.setUneditable(a),o.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!e.options.lineNumbers||i&&i["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(M("div",et(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),i)for(var s=0;s<e.display.gutterSpecs.length;++s){var l=e.display.gutterSpecs[s].className,c=i.hasOwnProperty(l)&&i[l];c&&a.appendChild(M("div",[c],"CodeMirror-gutter-elt","left: "+r.gutterLeft[l]+"px; width: "+r.gutterWidth[l]+"px"))}}}function dn(e,t,n){if(fn(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)fn(e,t.rest[r],t,n,!1)}function fn(e,t,n,r,i){if(t.widgets)for(var o=sn(n),a=0,s=t.widgets;a<s.length;++a){var l=s[a],c=M("div",[l.node],"CodeMirror-linewidget"+(l.className?" "+l.className:""));l.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),function(e,t,n,r){e.noHScroll&&((n.alignable||(n.alignable=[])).push(t),n=r.wrapperWidth,t.style.left=r.fixedPos+"px",e.coverGutter||(n-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=n+"px");e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}(l,c,n,r),e.display.input.setUneditable(c),i&&l.above?o.insertBefore(c,n.gutter||n.text):o.appendChild(c),rn(l,"redraw")}}function hn(e){if(null!=e.height)return e.height;var t,n=e.doc.cm;return n?(T(document.body,e.node)||(t="position: relative;",e.coverGutter&&(t+="margin-left: -"+n.display.gutters.offsetWidth+"px;"),e.noHScroll&&(t+="width: "+n.display.wrapper.clientWidth+"px;"),_(n.display.measure,M("div",[e.node],null,t))),e.height=e.node.parentNode.offsetHeight):0}function pn(e,t){for(var n=Te(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 1}function mn(e){return e.lineSpace.offsetTop}function gn(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function vn(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=_(e.measure,M("pre","x","CodeMirror-line-like")),t=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,t={left:parseInt(t.paddingLeft),right:parseInt(t.paddingRight)};return isNaN(t.left)||isNaN(t.right)||(e.cachedPaddingH=t),t}function yn(e){return z-e.display.nativeBarWidth}function bn(e){return e.display.scroller.clientWidth-yn(e)-e.display.barWidth}function kn(e){return e.display.scroller.clientHeight-yn(e)-e.display.barHeight}function xn(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(Qe(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function wn(e,t,n,r){return _n(e,Sn(e,t),n,r)}function Cn(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[er(e,t)];e=e.display.externalMeasured;return e&&t>=e.lineN&&t<e.lineN+e.size?e:void 0}function Sn(e,t){var n,r,i=Qe(t),o=Cn(e,i);o&&!o.text?o=null:o&&o.changes&&(an(e,o,i,Xn(e)),e.curOp.forceUpdate=!0),o||(n=e,e=Qe(r=Dt(r=t)),(r=n.display.externalMeasured=new Jt(n.doc,r,e)).lineN=e,e=r.built=Gt(n,r),r.text=e.pre,_(n.display.lineMeasure,e.pre),o=r);i=xn(o,t,i);return{line:t,view:o,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function _n(e,t,n,r,i){var o,a=(n=t.before?-1: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,e=r&&bn(e);if(!t.measure.heights||r&&t.measure.width!=e){var i=t.measure.heights=[];if(r){t.measure.width=e;for(var o=t.text.firstChild.getClientRects(),a=0;a<o.length-1;a++){var s=o[a],l=o[a+1];2<Math.abs(s.bottom-l.bottom)&&i.push((s.bottom+l.top)/2-n.top)}}i.push(n.bottom-n.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,n,r){var i,o=Tn(t.map,n,r),a=o.node,s=o.start,l=o.end,c=o.collapse;if(3==a.nodeType){for(var u=0;u<4;u++){for(;s&&ne(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+l<o.coverEnd&&ne(t.line.text.charAt(o.coverStart+l));)++l;if((i=k&&v<9&&0==s&&l==o.coverEnd-o.coverStart?a.parentNode.getBoundingClientRect():function(e,t){var n=Mn;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}(E(a,s,l).getClientRects(),r)).left||i.right||0==s)break;l=s,s-=1,c="right"}k&&v<11&&(i=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=Be)return Be;var e=(t=_(e,M("span","x"))).getBoundingClientRect(),t=E(t,0,1).getBoundingClientRect();return Be=1<Math.abs(e.left-t.left)}(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,e=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*e,bottom:t.bottom*e}}(e.display.measure,i))}else 0<s&&(c=r="right"),i=e.options.lineWrapping&&1<(m=a.getClientRects()).length?m["right"==r?m.length-1:0]:a.getBoundingClientRect();!(k&&v<9)||s||i&&(i.left||i.right)||(g=a.parentNode.getClientRects()[0],i=g?{left:g.left,right:g.left+Gn(e.display),top:g.top,bottom:g.bottom}:Mn);for(var d=i.top-t.rect.top,n=i.bottom-t.rect.top,f=(d+n)/2,h=t.view.measure.heights,p=0;p<h.length-1&&!(f<h[p]);p++);var m=p?h[p-1]:0,g=h[p],g={left:("right"==c?i.right:i.left)-t.rect.left,right:("left"==c?i.left:i.right)-t.rect.left,top:m,bottom:g};i.left||i.right||(g.bogus=!0);e.options.singleCursorHeightPerLine||(g.rtop=d,g.rbottom=n);return g}(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 Ln,Mn={left:0,right:0,top:0,bottom:0};function Tn(e,t,n){for(var r,i,o,a,s,l,c=0;c<e.length;c+=3)if(s=e[c],l=e[c+1],t<s?(i=0,o=1,a="left"):t<l?o=(i=t-s)+1:(c==e.length-3||t==l&&e[c+3]>t)&&(i=(o=l-s)-1,l<=t&&(a="right")),null!=i){if(r=e[c+2],s==l&&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==l-s)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:s,coverEnd:l}}function An(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 On(e){e.display.externalMeasure=null,S(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)An(e.display.view[t])}function Nn(e){On(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function En(){return o&&l?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function In(){return o&&l?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Pn(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=hn(e.widgets[n]));return t}function Rn(e,t,n,r,i){if(i||(i=Pn(t),n.top+=i,n.bottom+=i),"line"==r)return n;r=r||"local";t=qt(t);return"local"==r?t+=mn(e.display):t-=e.display.viewOffset,"page"!=r&&"window"!=r||(t+=(e=e.display.lineSpace.getBoundingClientRect()).top+("window"==r?0:In()),r=e.left+("window"==r?0:En()),n.left+=r,n.right+=r),n.top+=t,n.bottom+=t,n}function Bn(e,t,n){if("div"==n)return t;var r=t.left,t=t.top;"page"==n?(r-=En(),t-=In()):"local"!=n&&n||(r+=(n=e.display.sizer.getBoundingClientRect()).left,t+=n.top);e=e.display.lineSpace.getBoundingClientRect();return{left:r-e.left,top:t-e.top}}function Dn(e,t,n,r,i){return Rn(e,r=r||$e(e.doc,t.line),wn(e,r,t.ch,i),n)}function Fn(n,e,r,i,o,a){function s(e,t){e=_n(n,o,e,t?"right":"left",a);return t?e.left=e.right:e.right=e.left,Rn(n,i,e,r)}i=i||$e(n.doc,e.line),o=o||Sn(n,i);var l=pe(i,n.doc.direction),t=e.ch,c=e.sticky;if(t>=i.text.length?(t=i.text.length,c="before"):t<=0&&(t=0,c="after"),!l)return s("before"==c?t-1:t,"before"==c);function u(e,t,n){return s(n?e-1:e,1==l[t].level!=n)}var d=ae(l,t,c),e=oe,d=u(t,d,"before"==c);return null!=e&&(d.other=u(t,e,"before"!=c)),d}function zn(e,t){var n=0;t=lt(e.doc,t),e.options.lineWrapping||(n=Gn(e.display)*t.ch);t=$e(e.doc,t.line),e=qt(t)+mn(e.display);return{left:n,right:n,top:e,bottom:e+t.height}}function Wn(e,t,n,r,i){n=tt(e,t,n);return n.xRel=i,r&&(n.outside=r),n}function qn(e,t,n){var r=e.doc;if((n+=e.display.viewOffset)<0)return Wn(r.first,0,null,-1,-1);var i=Je(r,n),o=r.first+r.size-1;if(o<i)return Wn(r.first+r.size-1,$e(r,o).text.length,null,1,1);t<0&&(t=0);for(var a=$e(r,i);;){var s=function(n,e,t,r,i){i-=qt(e);var o=Sn(n,e),a=Pn(e),s=0,l=e.text.length,c=!0,u=pe(e,n.doc.direction);u&&(h=(n.options.lineWrapping?Vn:Un)(n,e,t,o,u,r,i),c=1!=h.level,s=c?h.from:h.to-1,l=c?h.to:h.from-1);var d=null,f=null,u=ie(function(e){var t=_n(n,o,e);return t.top+=a,t.bottom+=a,Kn(t,r,i,!1)&&(t.top<=i&&t.left<=r&&(d=e,f=t),1)},s,l),h=!1;{var p,m;f?(p=r-f.left<f.right-r,u=d+((m=p==c)?0:1),m=m?"after":"before",p=p?f.left:f.right):(c||u!=l&&u!=s||u++,m=0==u||u!=e.text.length&&_n(n,o,u-(c?1:0)).bottom+a<=i==c?"after":"before",c=Fn(n,tt(t,u,m),"line",e,o),p=c.left,h=i<c.top?-1:i>=c.bottom?1:0)}return u=re(e.text,u,1),Wn(t,u,m,h,r-p)}(e,a,i,t,n),l=function(e,t){var n,r=Ct&&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||Et(n,o.marker)<0)&&(n=o.marker)}return n}(a,s.ch+(0<s.xRel||0<s.outside?1:0));if(!l)return s;l=l.find(1);if(l.line==i)return l;a=$e(r,i=l.line)}}function Hn(t,e,n,r){r-=Pn(e);var i=e.text.length,e=ie(function(e){return _n(t,n,e-1).bottom<=r},i,0);return{begin:e,end:i=ie(function(e){return _n(t,n,e).top>r},e,i)}}function jn(e,t,n,r){return Hn(e,t,n=n||Sn(e,t),Rn(e,t,_n(e,n,r),"line").top)}function Kn(e,t,n,r){return!(e.bottom<=n)&&(e.top>n||(r?e.left:e.right)>t)}function Un(n,r,i,o,a,s,l){var e,t=ie(function(e){var t=a[e],e=1!=t.level;return Kn(Fn(n,tt(i,e?t.to:t.from,e?"before":"after"),"line",r,o),s,l,!0)},0,a.length-1),c=a[t];return 0<t&&(e=1!=c.level,Kn(e=Fn(n,tt(i,e?c.from:c.to,e?"after":"before"),"line",r,o),s,l,!0)&&e.top>l&&(c=a[t-1])),c}function Vn(e,t,n,r,i,o,a){var a=Hn(e,t,r,a),s=a.begin,l=a.end;/\s/.test(t.text.charAt(l-1))&&l--;for(var c=null,u=null,d=0;d<i.length;d++){var f,h=i[d];h.from>=l||h.to<=s||(f=(f=_n(e,r,1!=h.level?Math.min(l,h.to)-1:Math.max(s,h.from)).right)<o?o-f+1e9:f-o,(!c||f<u)&&(c=h,u=f))}return c=(c=(c=c||i[i.length-1]).from<s?{from:s,to:c.to,level:c.level}:c).to>l?{from:c.from,to:l,level:c.level}:c}function $n(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Ln){Ln=M("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Ln.appendChild(document.createTextNode("x")),Ln.appendChild(M("br"));Ln.appendChild(document.createTextNode("x"))}_(e.measure,Ln);var n=Ln.offsetHeight/50;return 3<n&&(e.cachedTextHeight=n),S(e.measure),n||1}function Gn(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=M("span","xxxxxxxxxx"),n=M("pre",[t],"CodeMirror-line-like");_(e.measure,n);t=t.getBoundingClientRect(),t=(t.right-t.left)/10;return 2<t&&(e.cachedCharWidth=t),t||10}function Xn(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var s=e.display.gutterSpecs[a].className;n[s]=o.offsetLeft+o.clientLeft+i,r[s]=o.clientWidth}return{fixedPos:Yn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Yn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Qn(r){var i=$n(r.display),o=r.options.lineWrapping,a=o&&Math.max(5,r.display.scroller.clientWidth/Gn(r.display)-3);return function(e){if(Wt(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 Jn(e){var t=e.doc,n=Qn(e);t.iter(function(e){var t=n(e);t!=e.height&&Ye(e,t)})}function Zn(e,t,n,r){var i=e.display;if(!n&&"true"==Te(t).getAttribute("cm-not-content"))return null;var o,i=i.lineSpace.getBoundingClientRect();try{o=t.clientX-i.left,s=t.clientY-i.top}catch(e){return null}var a,s=qn(e,o,s);return r&&0<s.xRel&&(a=$e(e.doc,s.line).text).length==s.ch&&(a=B(a,a.length,e.options.tabSize)-a.length,s=tt(s.line,Math.max(0,Math.round((o-vn(e.display).left)/Gn(e.display))-a))),s}function er(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 tr(e,t,n,r){null==t&&(t=e.doc.first),null==n&&(n=e.doc.first+e.doc.size);var i,o,a=e.display;(r=r||0)&&n<a.viewTo&&(null==a.updateLineNumbers||a.updateLineNumbers>t)&&(a.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=a.viewTo?Ct&&Ft(e.doc,t)<a.viewTo&&rr(e):n<=a.viewFrom?Ct&&zt(e.doc,n+r)>a.viewFrom?rr(e):(a.viewFrom+=r,a.viewTo+=r):t<=a.viewFrom&&n>=a.viewTo?rr(e):t<=a.viewFrom?(i=ir(e,n,n+r,1))?(a.view=a.view.slice(i.index),a.viewFrom=i.lineN,a.viewTo+=r):rr(e):n>=a.viewTo?(o=ir(e,t,t,-1))?(a.view=a.view.slice(0,o.index),a.viewTo=o.lineN):rr(e):(i=ir(e,t,t,-1),o=ir(e,n,n+r,1),i&&o?(a.view=a.view.slice(0,i.index).concat(Zt(e,i.lineN,o.lineN)).concat(a.view.slice(o.index)),a.viewTo+=r):rr(e));e=a.externalMeasured;e&&(n<e.lineN?e.lineN+=r:t<e.lineN+e.size&&(a.externalMeasured=null))}function nr(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo||(null==(t=r.view[er(e,t)]).node||-1==F(t=t.changes||(t.changes=[]),n)&&t.push(n))}function rr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function ir(e,t,n,r){var i,o=er(e,t),a=e.display.view;if(!Ct||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var s=e.display.viewFrom,l=0;l<o;l++)s+=a[l].size;if(s!=t){if(0<r){if(o==a.length-1)return null;i=s+a[o].size-t,o++}else i=s-t;t+=i,n+=i}for(;Ft(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 or(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 ar(e){e.display.input.showSelection(e.display.input.prepareSelection())}function sr(e,t){void 0===t&&(t=!0);for(var n,r,i=e.doc,o={},a=o.cursors=document.createDocumentFragment(),s=o.selection=document.createDocumentFragment(),l=0;l<i.sel.ranges.length;l++)!t&&l==i.sel.primIndex||((n=i.sel.ranges[l]).from().line>=e.display.viewTo||n.to().line<e.display.viewFrom||(((r=n.empty())||e.options.showCursorWhenSelecting)&&lr(e,n.head,a),r||function(i,e,t){var n=i.display,o=i.doc,a=document.createDocumentFragment(),r=vn(i.display),C=r.left,S=Math.max(n.sizerWidth,bn(i)-n.sizer.offsetLeft)-r.right,_="ltr"==o.direction;function L(e,t,n,r){t<0&&(t=0),t=Math.round(t),r=Math.round(r),a.appendChild(M("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==n?S-e:n)+"px;\n height: "+(r-t)+"px"))}function s(n,m,g){var v,y,r=$e(o,n),b=r.text.length;function k(e,t){return Dn(i,tt(n,e),"div",r,t)}function x(e,t,n){e=jn(i,r,null,e),t="ltr"==t==("after"==n)?"left":"right";return k("after"==n?e.begin:e.end-(/\s/.test(r.text.charAt(e.end-1))?2:1),t)[t]}var w=pe(r,o.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")}(w,m||0,null==g?b:g,function(e,t,n,r){var i,o,a,s,l="ltr"==n,c=k(e,l?"left":"right"),u=k(t-1,l?"right":"left"),d=null==m&&0==e,f=null==g&&t==b,h=0==r,p=!w||r==w.length-1;u.top-c.top<=3?(i=(_?d:f)&&h?C:(l?c:u).left,r=(_?f:d)&&p?S:(l?u:c).right,L(i,c.top,r-i,c.bottom)):(n=l?(o=_&&d&&h?C:c.left,a=_?S:x(e,n,"before"),s=_?C:x(t,n,"after"),_&&f&&p?S:u.right):(o=_?x(e,n,"before"):C,a=!_&&d&&h?S:c.right,s=!_&&f&&p?C:u.left,_?x(t,n,"after"):S),L(o,c.top,a-o,c.bottom),c.bottom<u.top&&L(C,c.bottom,null,u.top),L(s,u.top,n-s,u.bottom)),(!v||cr(c,v)<0)&&(v=c),cr(u,v)<0&&(v=u),(!y||cr(c,y)<0)&&(y=c),cr(u,y)<0&&(y=u)}),{start:v,end:y}}var l=e.from(),n=e.to();l.line==n.line?s(l.line,l.ch,n.ch):(r=$e(o,l.line),e=$e(o,n.line),e=Dt(r)==Dt(e),r=s(l.line,l.ch,e?r.text.length+1:null).end,n=s(n.line,e?0:null,n.ch).start,e&&(r.top<n.top-2?(L(r.right,r.top,null,r.bottom),L(C,n.top,n.left,n.bottom)):L(r.right,r.top,n.left-r.right,r.bottom)),r.bottom<n.top&&L(C,r.bottom,null,n.top));t.appendChild(a)}(e,n,s)));return o}function lr(e,t,n){var r=Fn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(M("div"," ","CodeMirror-cursor"));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",/\bcm-fat-cursor\b/.test(e.getWrapperElement().className)&&(t=Dn(e,t,"div",null,null),i.style.width=Math.max(0,t.right-t.left)+"px"),r.other&&((n=n.appendChild(M("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"))).style.display="",n.style.left=r.other.left+"px",n.style.top=r.other.top+"px",n.style.height=.85*(r.other.bottom-r.other.top)+"px")}function cr(e,t){return e.top-t.top||e.left-t.left}function ur(e){var t,n;e.state.focused&&(t=e.display,clearInterval(t.blinker),n=!0,t.cursorDiv.style.visibility="",0<e.options.cursorBlinkRate?t.blinker=setInterval(function(){e.hasFocus()||pr(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden"))}function dr(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||hr(e))}function fr(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&pr(e))},100)}function hr(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(be(e,"focus",e,t),e.state.focused=!0,O(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),h&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),ur(e))}function pr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(be(e,"blur",e,t),e.state.focused=!1,C(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function mr(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i,o=t.view[r],a=e.options.lineWrapping,s=void 0,l=0;if(!o.hidden){k&&v<8?(s=(i=o.node.offsetTop+o.node.offsetHeight)-n,n=i):(s=(c=o.node.getBoundingClientRect()).bottom-c.top,!a&&o.text.firstChild&&(l=o.text.firstChild.getBoundingClientRect().right-c.left-1));var c=o.line.height-s;if((.005<c||c<-.005)&&(Ye(o.line,s),gr(o.line),o.rest))for(var u=0;u<o.rest.length;u++)gr(o.rest[u]);l>e.display.sizerWidth&&((l=Math.ceil(l/Gn(e.display)))>e.display.maxLineLength&&(e.display.maxLineLength=l,e.display.maxLine=o.line,e.display.maxLineChanged=!0))}}}function gr(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 vr(e,t,n){var r=n&&null!=n.top?Math.max(0,n.top):e.scroller.scrollTop,r=Math.floor(r-mn(e)),i=n&&null!=n.bottom?n.bottom:r+e.wrapper.clientHeight,o=Je(t,r),r=Je(t,i);return n&&n.ensure&&(i=n.ensure.from.line,n=n.ensure.to.line,i<o?r=Je(t,qt($e(t,o=i))+e.wrapper.clientHeight):Math.min(n,t.lastLine())>=r&&(o=Je(t,qt($e(t,n))-e.wrapper.clientHeight),r=n)),{from:o,to:Math.max(r,o+1)}}function yr(e,t){var n=e.display,r=$n(e.display);t.top<0&&(t.top=0);var i=(e.curOp&&null!=e.curOp.scrollTop?e.curOp:n.scroller).scrollTop,o=kn(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var s=e.doc.height+gn(n),l=t.top<r,r=t.bottom>s-r;t.top<i?a.scrollTop=l?0:t.top:t.bottom>i+o&&((c=Math.min(t.top,(r?s:t.bottom)-o))!=i&&(a.scrollTop=c));var i=e.options.fixedGutter?0:n.gutters.offsetWidth,c=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft-i,e=bn(e)-n.gutters.offsetWidth,n=t.right-t.left>e;return n&&(t.right=t.left+e),t.left<10?a.scrollLeft=0:t.left<c?a.scrollLeft=Math.max(0,t.left+i-(n?0:10)):t.right>e+c-3&&(a.scrollLeft=t.right+(n?0:10)-e),a}function br(e,t){null!=t&&(wr(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc:e.curOp).scrollTop+t)}function kr(e){wr(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function xr(e,t,n){null==t&&null==n||wr(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function wr(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Cr(e,zn(e,t.from),zn(e,t.to),t.margin))}function Cr(e,t,n,r){r=yr(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});xr(e,r.scrollLeft,r.scrollTop)}function Sr(e,t){Math.abs(e.doc.scrollTop-t)<2||(f||Kr(e,{top:t}),_r(e,t,!0),f&&Kr(e),zr(e,100))}function _r(e,t,n){t=Math.max(0,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 Lr(e,t,n,r){t=Math.max(0,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,$r(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Mr(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+gn(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+yn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}e=function(e,t,n){this.cm=n;var r=this.vert=M("div",[M("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=M("div",[M("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),ge(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ge(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,k&&v<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};e.prototype.update=function(e){var t,n=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,i=e.nativeBarWidth;return r?(this.vert.style.display="block",this.vert.style.bottom=n?i+"px":"0",t=e.viewHeight-(n?i:0),this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+t)+"px"):(this.vert.style.display="",this.vert.firstChild.style.height="0"),n?(this.horiz.style.display="block",this.horiz.style.right=r?i+"px":"0",this.horiz.style.left=e.barLeft+"px",t=e.viewWidth-e.barLeft-(r?i:0),this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+t)+"px"):(this.horiz.style.display="",this.horiz.firstChild.style.width="0"),!this.checkedZeroWidth&&0<e.clientHeight&&(0==i&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?i:0,bottom:n?i:0}},e.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},e.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},e.prototype.zeroWidthHack=function(){this.horiz.style.height=this.vert.style.width=m&&!a?"12px":"18px",this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new D,this.disableVert=new D},e.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)})},e.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};r=function(){};function Tr(e,t){t=t||Mr(e);var n=e.display.barWidth,r=e.display.barHeight;Ar(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&mr(e),Ar(e,Mr(e)),n=e.display.barWidth,r=e.display.barHeight}function Ar(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=""}r.prototype.update=function(){return{bottom:0,right:0}},r.prototype.setScrollLeft=function(){},r.prototype.setScrollTop=function(){},r.prototype.clear=function(){};var Or={native:e,null:r};function Nr(n){n.display.scrollbars&&(n.display.scrollbars.clear(),n.display.scrollbars.addClass&&C(n.display.wrapper,n.display.scrollbars.addClass)),n.display.scrollbars=new Or[n.options.scrollbarStyle](function(e){n.display.wrapper.insertBefore(e,n.display.scrollbarFiller),ge(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?Lr:Sr)(n,e)},n),n.display.scrollbars.addClass&&O(n.display.wrapper,n.display.scrollbars.addClass)}var Er=0;function Ir(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:++Er,markArrays:null},e=e.curOp,en?en.ops.push(e):e.ownsGroup=en={ops:[e],delayedCallbacks:[]}}function Pr(e){e=e.curOp;e&&tn(e,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++)!function(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=yn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=yn(e)+"px",t.scrollbarsClipped=!0)})(t),e.updateMaxLine&&jt(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 qr(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}(t[n]);for(var r=0;r<t.length;r++)!function(e){e.updatedDisplay=e.mustUpdate&&Hr(e.cm,e.update)}(t[r]);for(var i=0;i<t.length;i++)!function(e){var t=e.cm,n=t.display;e.updatedDisplay&&mr(t);e.barMeasure=Mr(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=wn(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+yn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-bn(t)));(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}(t[i]);for(var o=0;o<t.length;o++)!function(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Lr(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==A();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n);!e.updatedDisplay&&e.startHeight==t.doc.height||Tr(t,e.barMeasure);e.updatedDisplay&&Vr(t,e.barMeasure);e.selectionChanged&&ur(t);t.state.focused&&e.updateInput&&t.display.input.reset(e.typing);n&&dr(e.cm)}(t[o]);for(var a=0;a<t.length;a++)!function(e){var t=e.cm,n=t.display,r=t.doc;e.updatedDisplay&&jr(t,e.update);null==n.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(n.wheelStartX=n.wheelStartY=null);null!=e.scrollTop&&_r(t,e.scrollTop,e.forceScroll);null!=e.scrollLeft&&Lr(t,e.scrollLeft,!0,!0);{var i;e.scrollToPos&&(i=function(e,t,n,r){null==r&&(r=0),e.options.lineWrapping||t!=n||(n="before"==t.sticky?tt(t.line,t.ch+1,"before"):t,t=t.ch?tt(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t);for(var i=0;i<5;i++){var o,a=!1,s=Fn(e,t),l=n&&n!=t?Fn(e,n):s,c=yr(e,o={left:Math.min(s.left,l.left),top:Math.min(s.top,l.top)-r,right:Math.max(s.left,l.left),bottom:Math.max(s.bottom,l.bottom)+r}),s=e.doc.scrollTop,l=e.doc.scrollLeft;if(null!=c.scrollTop&&(Sr(e,c.scrollTop),1<Math.abs(e.doc.scrollTop-s)&&(a=!0)),null!=c.scrollLeft&&(Lr(e,c.scrollLeft),1<Math.abs(e.doc.scrollLeft-l)&&(a=!0)),!a)break}return o}(t,lt(r,e.scrollToPos.from),lt(r,e.scrollToPos.to),e.scrollToPos.margin),function(e,t){var n,r,i;ke(e,"scrollCursorIntoView")||(r=(n=e.display).sizer.getBoundingClientRect(),i=null,t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null==i||c||(t=M("div","​",null,"position: absolute;\n top: "+(t.top-n.viewOffset-mn(e.display))+"px;\n height: "+(t.bottom-t.top+yn(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;"),e.display.lineSpace.appendChild(t),t.scrollIntoView(i),e.display.lineSpace.removeChild(t)))}(t,i))}var o=e.maybeHiddenMarkers,a=e.maybeUnhiddenMarkers;if(o)for(var s=0;s<o.length;++s)o[s].lines.length||be(o[s],"hide");if(a)for(var l=0;l<a.length;++l)a[l].lines.length&&be(a[l],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop);e.changeObjs&&be(t,"changes",t,e.changeObjs);e.update&&e.update.finish()}(t[a])}(e)})}function Rr(e,t){if(e.curOp)return t();Ir(e);try{return t()}finally{Pr(e)}}function Br(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Ir(e);try{return t.apply(e,arguments)}finally{Pr(e)}}}function Dr(e){return function(){if(this.curOp)return e.apply(this,arguments);Ir(this);try{return e.apply(this,arguments)}finally{Pr(this)}}}function Fr(t){return function(){var e=this.cm;if(!e||e.curOp)return t.apply(this,arguments);Ir(e);try{return t.apply(this,arguments)}finally{Pr(e)}}}function zr(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,P(Wr,e))}function Wr(a){var s,l,c,u=a.doc;u.highlightFrontier>=a.display.viewTo||(s=+new Date+a.options.workTime,l=pt(a,u.highlightFrontier),c=[],u.iter(l.line,Math.min(u.first+u.size,a.display.viewTo+500),function(e){if(l.line>=a.display.viewFrom){var t=e.styles,n=e.text.length>a.options.maxHighlightLength?je(u.mode,l.state):null,r=ft(a,e,l,!0);n&&(l.state=n),e.styles=r.styles;n=e.styleClasses,r=r.classes;r?e.styleClasses=r:n&&(e.styleClasses=null);for(var i=!t||t.length!=e.styles.length||n!=r&&(!n||!r||n.bgClass!=r.bgClass||n.textClass!=r.textClass),o=0;!i&&o<t.length;++o)i=t[o]!=e.styles[o];i&&c.push(l.line),e.stateAfter=l.save(),l.nextLine()}else e.text.length<=a.options.maxHighlightLength&&mt(a,e.text,l),e.stateAfter=l.line%5==0?l.save():null,l.nextLine();if(+new Date>s)return zr(a,a.options.workDelay),!0}),u.highlightFrontier=l.line,u.modeFrontier=Math.max(u.modeFrontier,l.line),c.length&&Rr(a,function(){for(var e=0;e<c.length;e++)nr(a,c[e],"text")}))}var qr=function(e,t,n){var r=e.display;this.viewport=t,this.visible=vr(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=bn(e),this.force=n,this.dims=Xn(e),this.events=[]};function Hr(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return rr(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==or(e))return!1;Gr(e)&&(rr(e),t.dims=Xn(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)),Ct&&(o=Ft(e.doc,o),a=zt(e.doc,a));var s=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;r=o,i=a,0==(a=(o=e).display).view.length||r>=a.viewTo||i<=a.viewFrom?(a.view=Zt(o,r,i),a.viewFrom=r):(a.viewFrom>r?a.view=Zt(o,r,a.viewFrom).concat(a.view):a.viewFrom<r&&(a.view=a.view.slice(er(o,r))),a.viewFrom=r,a.viewTo<i?a.view=a.view.concat(Zt(o,a.viewTo,i)):a.viewTo>i&&(a.view=a.view.slice(0,er(o,i)))),a.viewTo=i,n.viewOffset=qt($e(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";o=or(e);if(!s&&0==o&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;a=function(e){if(e.hasFocus())return null;var t=A();if(!t||!T(e.display.lineDiv,t))return null;var n={activeElt:t};return!window.getSelection||(t=window.getSelection()).anchorNode&&t.extend&&T(e.display.lineDiv,t.anchorNode)&&(n.anchorNode=t.anchorNode,n.anchorOffset=t.anchorOffset,n.focusNode=t.focusNode,n.focusOffset=t.focusOffset),n}(e);return 4<o&&(n.lineDiv.style.display="none"),function(n,e,t){var r=n.display,i=n.options.lineNumbers,o=r.lineDiv,a=o.firstChild;function s(e){var t=e.nextSibling;return h&&m&&n.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),t}for(var l=r.view,c=r.viewFrom,u=0;u<l.length;u++){var d=l[u];if(!d.hidden)if(d.node&&d.node.parentNode==o){for(;a!=d.node;)a=s(a);var f=i&&null!=e&&e<=c&&d.lineNumber;d.changes&&(-1<F(d.changes,"gutter")&&(f=!1),an(n,d,c,t)),f&&(S(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(et(n.options,c)))),a=d.node.nextSibling}else{f=function(e,t,n,r){var i=ln(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),cn(e,t),un(e,t,n,r),dn(e,t,r),t.node}(n,d,c,t);o.insertBefore(f,a)}c+=d.size}for(;a;)a=s(a)}(e,n.updateLineNumbers,t.dims),4<o&&(n.lineDiv.style.display=""),n.renderedView=n.view,(i=a)&&i.activeElt&&i.activeElt!=A()&&(i.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(i.activeElt.nodeName)&&i.anchorNode&&T(document.body,i.anchorNode)&&T(document.body,i.focusNode)&&(o=window.getSelection(),(a=document.createRange()).setEnd(i.anchorNode,i.anchorOffset),a.collapse(!1),o.removeAllRanges(),o.addRange(a),o.extend(i.focusNode,i.focusOffset))),S(n.cursorDiv),S(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,s&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,zr(e,400)),!(n.updateLineNumbers=null)}function jr(e,t){for(var n=t.viewport,r=!0;;r=!1){if(r&&e.options.lineWrapping&&t.oldDisplayWidth!=bn(e))r&&(t.visible=vr(e.display,e.doc,n));else if(n&&null!=n.top&&(n={top:Math.min(e.doc.height+gn(e.display)-kn(e),n.top)}),t.visible=vr(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!Hr(e,t))break;mr(e);var i=Mr(e);ar(e),Tr(e,i),Vr(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 Kr(e,t){var n=new qr(e,t);Hr(e,n)&&(mr(e),jr(e,n),t=Mr(e),ar(e),Tr(e,t),Vr(e,t),n.finish())}function Ur(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",rn(e,"gutterChanged",e)}function Vr(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+yn(e)+"px"}function $r(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=Yn(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 s=n[a].alignable;if(s)for(var l=0;l<s.length;l++)s[l].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}}function Gr(e){if(e.options.lineNumbers){var t=e.doc,n=et(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(M("div",[M("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),t=i.firstChild.offsetWidth,i=i.offsetWidth-t;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(t,r.lineGutter.offsetWidth-i)+1,r.lineNumWidth=r.lineNumInnerWidth+i,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Ur(e.display),1}}}function Xr(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 Yr(e){var t=e.gutters,n=e.gutterSpecs;S(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],o=i.className,a=i.style,i=t.appendChild(M("div",null,"CodeMirror-gutter "+o));a&&(i.style.cssText=a),"CodeMirror-linenumbers"==o&&((e.lineGutter=i).style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Ur(e)}function Qr(e){Yr(e.display),tr(e),$r(e)}function Jr(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=M("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=M("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=L("div",null,"CodeMirror-code"),i.selectionDiv=M("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=M("div",null,"CodeMirror-cursors"),i.measure=M("div",null,"CodeMirror-measure"),i.lineMeasure=M("div",null,"CodeMirror-measure"),i.lineSpace=L("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var o=L("div",[i.lineSpace],"CodeMirror-lines");i.mover=M("div",[o],null,"position: relative"),i.sizer=M("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=M("div",null,null,"position: absolute; height: "+z+"px; width: 1px;"),i.gutters=M("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=M("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=M("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),i.wrapper.setAttribute("translate","no"),k&&v<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),h||f&&d||(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=Xr(r.gutters,r.lineNumbers),Yr(i),n.init(i)}qr.prototype.signal=function(e,t){we(e,t)&&this.events.push(arguments)},qr.prototype.finish=function(){for(var e=0;e<this.events.length;e++)be.apply(null,this.events[e])};var Zr=0,ei=null;function ti(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 ni(e){e=ti(e);return e.x*=ei,e.y*=ei,e}function ri(e,t){var n=ti(t),r=n.x,i=n.y,o=e.display,a=o.scroller,s=a.scrollWidth>a.clientWidth,l=a.scrollHeight>a.clientHeight;if(r&&s||i&&l){if(i&&m&&h)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&&!f&&!p&&null!=ei)return i&&l&&Sr(e,Math.max(0,a.scrollTop+i*ei)),Lr(e,Math.max(0,a.scrollLeft+r*ei)),i&&!l||Se(t),void(o.wheelStartX=null);i&&null!=ei&&(n=i*ei,l=(s=e.doc.scrollTop)+o.wrapper.clientHeight,n<0?s=Math.max(0,s+n-50):l=Math.min(e.doc.height,l+n+50),Kr(e,{top:s,bottom:l})),Zr<20&&(null==o.wheelStartX?(o.wheelStartX=a.scrollLeft,o.wheelStartY=a.scrollTop,o.wheelDX=r,o.wheelDY=i,setTimeout(function(){var e,t;null!=o.wheelStartX&&(t=a.scrollLeft-o.wheelStartX,t=(e=a.scrollTop-o.wheelStartY)&&o.wheelDY&&e/o.wheelDY||t&&o.wheelDX&&t/o.wheelDX,o.wheelStartX=o.wheelStartY=null,t&&(ei=(ei*Zr+t)/(Zr+1),++Zr))},200)):(o.wheelDX+=r,o.wheelDY+=i))}}k?ei=-.53:f?ei=15:o?ei=-.7:u&&(ei=-1/3);var ii=function(e,t){this.ranges=e,this.primIndex=t};ii.prototype.primary=function(){return this.ranges[this.primIndex]},ii.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(!rt(n.anchor,r.anchor)||!rt(n.head,r.head))return!1}return!0},ii.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new oi(it(this.ranges[t].anchor),it(this.ranges[t].head));return new ii(e,this.primIndex)},ii.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},ii.prototype.contains=function(e,t){t=t||e;for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(0<=nt(t,r.from())&&nt(e,r.to())<=0)return n}return-1};var oi=function(e,t){this.anchor=e,this.head=t};function ai(e,t,n){var r=e&&e.options.selectionsMayTouch,e=t[n];t.sort(function(e,t){return nt(e.from(),t.from())}),n=F(t,e);for(var i=1;i<t.length;i++){var o,a=t[i],s=t[i-1],l=nt(s.to(),a.from());(r&&!a.empty()?0<l:0<=l)&&(o=at(s.from(),a.from()),l=ot(s.to(),a.to()),s=s.empty()?a.from()==a.head:s.from()==s.head,i<=n&&--n,t.splice(--i,2,new oi(s?l:o,s?o:l)))}return new ii(t,n)}function si(e,t){return new ii([new oi(e,t||e)],0)}function li(e){return e.text?tt(e.from.line+e.text.length-1,$(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function ci(e,t){if(nt(e,t.from)<0)return e;if(nt(e,t.to)<=0)return li(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+=li(t).ch-t.to.ch),tt(n,r)}function ui(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new oi(ci(i.anchor,t),ci(i.head,t)))}return ai(e.cm,n,e.sel.primIndex)}function di(e,t,n){return e.line==t.line?tt(n.line,e.ch-t.ch+n.ch):tt(n.line+(e.line-t.line),e.ch)}function fi(e){e.doc.mode=We(e.options,e.doc.modeOption),hi(e)}function hi(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,zr(e,100),e.state.modeGen++,e.curOp&&tr(e)}function pi(e,t){return 0==t.from.ch&&0==t.to.ch&&""==$(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function mi(e,o,t,a){function i(e){return t?t[e]:null}function n(e,t,n){var r,i;r=n,i=a,(n=e).text=t,n.stateAfter&&(n.stateAfter=null),n.styles&&(n.styles=null),null!=n.order&&(n.order=null),Tt(n),At(n,r),(i=i?i(n):1)!=n.height&&Ye(n,i),rn(e,"change",e,o)}function r(e,t){for(var n=[],r=e;r<t;++r)n.push(new Kt(u[r],i(r),a));return n}var s,l=o.from,c=o.to,u=o.text,d=$e(e,l.line),f=$e(e,c.line),h=$(u),p=i(u.length-1),m=c.line-l.line;o.full?(e.insert(0,r(0,u.length)),e.remove(u.length,e.size-u.length)):pi(e,o)?(s=r(0,u.length-1),n(f,f.text,p),m&&e.remove(l.line,m),s.length&&e.insert(l.line,s)):d==f?1==u.length?n(d,d.text.slice(0,l.ch)+h+d.text.slice(c.ch),p):((s=r(1,u.length-1)).push(new Kt(h+d.text.slice(c.ch),p,a)),n(d,d.text.slice(0,l.ch)+u[0],i(0)),e.insert(l.line+1,s)):1==u.length?(n(d,d.text.slice(0,l.ch)+u[0]+f.text.slice(c.ch),i(0)),e.remove(l.line+1,m)):(n(d,d.text.slice(0,l.ch)+u[0],i(0)),n(f,h+f.text.slice(c.ch),p),p=r(1,u.length-1),1<m&&e.remove(l.line+1,m-1),e.insert(l.line+1,p)),rn(e,"change",e,o)}function gi(e,s,l){!function e(t,n,r){if(t.linked)for(var i=0;i<t.linked.length;++i){var o,a=t.linked[i];a.doc!=n&&(o=r&&a.sharedHist,l&&!o||(s(a.doc,o),e(a.doc,t,o)))}}(e,null,!0)}function vi(e,t){if(t.cm)throw new Error("This document is already in use.");Jn((e.doc=t).cm=e),fi(e),yi(e),e.options.direction=t.direction,e.options.lineWrapping||jt(e),e.options.mode=t.modeOption,tr(e)}function yi(e){("rtl"==e.doc.direction?O:C)(e.display.lineDiv,"CodeMirror-rtl")}function bi(e){this.done=[],this.undone=[],this.undoDepth=e?e.undoDepth:1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e?e.maxGeneration:1}function ki(e,t){var n={from:it(t.from),to:li(t),text:Ge(e,t.from,t.to)};return _i(e,n,t.from.line,t.to.line+1),gi(e,function(e){return _i(e,n,t.from.line,t.to.line+1)},!0),n}function xi(e){for(;e.length;){if(!$(e).ranges)break;e.pop()}}function wi(e,t,n,r){var i=e.history;i.undone.length=0;var o,a,s=+new Date;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastModTime>s-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=(l=i).lastOp==r?(xi(l.done),$(l.done)):l.done.length&&!$(l.done).ranges?$(l.done):1<l.done.length&&!l.done[l.done.length-2].ranges?(l.done.pop(),$(l.done)):void 0))a=$(o.changes),0==nt(t.from,t.to)&&0==nt(t.from,a.to)?a.to=li(t):o.changes.push(ki(e,t));else{var l=$(i.done);for(l&&l.ranges||Si(e.sel,i.done),o={changes:[ki(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=s,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,a||be(e,"historyAdded")}function Ci(e,t,n,r){var i,o,a,s=e.history,l=r&&r.origin;n==s.lastSelOp||l&&s.lastSelOrigin==l&&(s.lastModTime==s.lastSelTime&&s.lastOrigin==l||(i=e,o=l,a=$(s.done),e=t,"*"==(o=o.charAt(0))||"+"==o&&a.ranges.length==e.ranges.length&&a.somethingSelected()==e.somethingSelected()&&new Date-i.history.lastSelTime<=(i.cm?i.cm.options.historyEventDelay:500)))?s.done[s.done.length-1]=t:Si(t,s.done),s.lastSelTime=+new Date,s.lastSelOrigin=l,s.lastSelOp=n,r&&!1!==r.clearRedo&&xi(s.undone)}function Si(e,t){var n=$(t);n&&n.ranges&&n.equals(e)||t.push(e)}function _i(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 Li(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(function(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}(n[i]));return r}function Mi(e,t){var n=Li(e,t),r=Lt(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 s=0;s<a.length;++s){for(var l=a[s],c=0;c<o.length;++c)if(o[c].marker==l.marker)continue e;o.push(l)}else a&&(n[i]=a)}return n}function Ti(e,t,n){for(var r=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)r.push(n?ii.prototype.deepCopy.call(o):o);else{var a=o.changes,s=[];r.push({changes:s});for(var l=0;l<a.length;++l){var c,u=a[l];if(s.push({from:u.from,to:u.to,text:u.text}),t)for(var d in u)(c=d.match(/^spans_(\d+)$/))&&-1<F(t,Number(c[1]))&&($(s)[d]=u[d],delete u[d])}}}return r}function Ai(e,t,n,r){if(r){r=e.anchor;return n&&((e=nt(t,r)<0)!=nt(n,r)<0?(r=t,t=n):e!=nt(t,n)<0&&(t=n)),new oi(r,t)}return new oi(n||t,t)}function Oi(e,t,n,r,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Ri(e,new ii([Ai(e.sel.primary(),t,n,i)],0),r)}function Ni(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]=Ai(e.sel.ranges[o],t[o],null,i);Ri(e,ai(e.cm,r,e.sel.primIndex),n)}function Ei(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Ri(e,ai(e.cm,i,e.sel.primIndex),r)}function Ii(e,t,n,r){Ri(e,si(t,n),r)}function Pi(e,t,n){var r=e.history.done,i=$(r);i&&i.ranges?Bi(e,r[r.length-1]=t,n):Ri(e,t,n)}function Ri(e,t,n){Bi(e,t,n),Ci(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Bi(e,t,n){var r,i;(we(e,"beforeSelectionChange")||e.cm&&we(e.cm,"beforeSelectionChange"))&&(r=e,i=n,i={ranges:(o=t).ranges,update:function(e){this.ranges=[];for(var t=0;t<e.length;t++)this.ranges[t]=new oi(lt(r,e[t].anchor),lt(r,e[t].head))},origin:i&&i.origin},be(r,"beforeSelectionChange",r,i),r.cm&&be(r.cm,"beforeSelectionChange",r.cm,i),t=i.ranges!=o.ranges?ai(r.cm,i.ranges,i.ranges.length-1):o);var o=n&&n.bias||(nt(t.primary().head,e.sel.primary().head)<0?-1:1);Di(e,zi(e,t,o,!0)),n&&!1===n.scroll||!e.cm||"nocursor"==e.cm.getOption("readOnly")||kr(e.cm)}function Di(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,xe(e.cm)),rn(e,"cursorActivity",e))}function Fi(e){Di(e,zi(e,e.sel,null,!1))}function zi(e,t,n,r){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],s=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],l=qi(e,a.anchor,s&&s.anchor,n,r),s=qi(e,a.head,s&&s.head,n,r);!i&&l==a.anchor&&s==a.head||((i=i||t.ranges.slice(0,o))[o]=new oi(l,s))}return i?ai(e.cm,i,t.primIndex):t}function Wi(e,t,n,r,i){var o=$e(e,t.line);if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var s=o.markedSpans[a],l=s.marker,c="selectLeft"in l?!l.selectLeft:l.inclusiveLeft,u="selectRight"in l?!l.selectRight:l.inclusiveRight;if((null==s.from||(c?s.from<=t.ch:s.from<t.ch))&&(null==s.to||(u?s.to>=t.ch:s.to>t.ch))){if(i&&(be(l,"beforeCursorEnter"),l.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(l.atomic){if(n){var d=l.find(r<0?1:-1),s=void 0;if((d=(r<0?u:c)?Hi(e,d,-r,d&&d.line==t.line?o:null):d)&&d.line==t.line&&(s=nt(d,n))&&(r<0?s<0:0<s))return Wi(e,d,t,r,i)}l=l.find(r<0?-1:1);return(l=(r<0?c:u)?Hi(e,l,r,l.line==t.line?o:null):l)?Wi(e,l,t,r,i):null}}}return t}function qi(e,t,n,r,i){r=r||1,r=Wi(e,t,n,r,i)||!i&&Wi(e,t,n,r,!0)||Wi(e,t,n,-r,i)||!i&&Wi(e,t,n,-r,!0);return r||(e.cantEdit=!0,tt(e.first,0))}function Hi(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?lt(e,tt(t.line-1)):null:0<n&&t.ch==(r||$e(e,t.line)).text.length?t.line<e.first+e.size-1?tt(t.line+1,0):null:new tt(t.line,t.ch+n)}function ji(e){e.setSelection(tt(e.firstLine(),0),tt(e.lastLine()),q)}function Ki(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=lt(i,e)),t&&(o.to=lt(i,t)),n&&(o.text=n),void 0!==r&&(o.origin=r)}),be(i,"beforeChange",i,o),i.cm&&be(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 Ui(e,t,n){if(e.cm){if(!e.cm.curOp)return Br(e.cm,Ui)(e,t,n);if(e.cm.state.suppressEdits)return}if(!(we(e,"beforeChange")||e.cm&&we(e.cm,"beforeChange"))||(t=Ki(e,t,!0))){var r=wt&&!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!=F(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],s=a.find(0),l=0;l<i.length;++l){var c,u,d,f=i[l];nt(f.to,s.from)<0||0<nt(f.from,s.to)||(c=[l,1],u=nt(f.from,s.from),d=nt(f.to,s.to),(u<0||!a.inclusiveLeft&&!u)&&c.push({from:f.from,to:s.from}),(0<d||!a.inclusiveRight&&!d)&&c.push({from:s.to,to:f.to}),i.splice.apply(i,c),l+=c.length-3)}return i}(e,t.from,t.to);if(r)for(var i=r.length-1;0<=i;--i)Vi(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Vi(e,t)}}function Vi(e,n){var t,r;1==n.text.length&&""==n.text[0]&&0==nt(n.from,n.to)||(t=ui(e,n),wi(e,n,t,e.cm?e.cm.curOp.id:NaN),Xi(e,n,t,Lt(e,n)),r=[],gi(e,function(e,t){t||-1!=F(r,e.history)||(Zi(e.history,n),r.push(e.history)),Xi(e,n,null,Lt(e,n))}))}function $i(i,o,e){var t=i.cm&&i.cm.state.suppressEdits;if(!t||e){for(var a,n=i.history,r=i.sel,s="undo"==o?n.done:n.undone,l="undo"==o?n.undone:n.done,c=0;c<s.length&&(a=s[c],e?!a.ranges||a.equals(i.sel):a.ranges);c++);if(c!=s.length){for(n.lastOrigin=n.lastSelOrigin=null;;){if(!(a=s.pop()).ranges){if(t)return void s.push(a);break}if(Si(a,l),e&&!a.equals(i.sel))return void Ri(i,a,{clearRedo:!1});r=a}var u=[];Si(r,l),l.push({changes:u,generation:n.generation}),n.generation=a.generation||++n.maxGeneration;for(var d=we(i,"beforeChange")||i.cm&&we(i.cm,"beforeChange"),f=a.changes.length-1;0<=f;--f){var h=function(e){var n=a.changes[e];if(n.origin=o,d&&!Ki(i,n,!1))return s.length=0,{};u.push(ki(i,n));var t=e?ui(i,n):$(s);Xi(i,n,t,Mi(i,n)),!e&&i.cm&&i.cm.scrollIntoView({from:n.from,to:li(n)});var r=[];gi(i,function(e,t){t||-1!=F(r,e.history)||(Zi(e.history,n),r.push(e.history)),Xi(e,n,null,Mi(e,n))})}(f);if(h)return h.v}}}}function Gi(e,t){if(0!=t&&(e.first+=t,e.sel=new ii(G(e.sel.ranges,function(e){return new oi(tt(e.anchor.line+t,e.anchor.ch),tt(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){tr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)nr(e.cm,r,"gutter")}}function Xi(e,t,n,r){if(e.cm&&!e.cm.curOp)return Br(e.cm,Xi)(e,t,n,r);var i;t.to.line<e.first?Gi(e,t.text.length-1-(t.to.line-t.from.line)):t.from.line>e.lastLine()||(t.from.line<e.first&&(Gi(e,i=t.text.length-1-(e.first-t.from.line)),t={from:tt(e.first,0),to:tt(t.to.line+i,t.to.ch),text:[$(t.text)],origin:t.origin}),i=e.lastLine(),(t=t.to.line>i?{from:t.from,to:tt(i,$e(e,i).text.length),text:[t.text[0]],origin:t.origin}:t).removed=Ge(e,t.from,t.to),n=n||ui(e,t),e.cm?function(e,t,n){var r=e.doc,i=e.display,o=t.from,a=t.to,s=!1,l=o.line;e.options.lineWrapping||(l=Qe(Dt($e(r,o.line))),r.iter(l,a.line+1,function(e){if(e==i.maxLine)return s=!0}));-1<r.sel.contains(t.from,t.to)&&xe(e);mi(r,t,n,Qn(e)),e.options.lineWrapping||(r.iter(l,o.line+t.text.length,function(e){var t=Ht(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)}),s&&(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=$e(e,r).stateAfter;if(i&&(!(i instanceof ut)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}})(r,o.line),zr(e,400);l=t.text.length-(a.line-o.line)-1;t.full?tr(e):o.line!=a.line||1!=t.text.length||pi(e.doc,t)?tr(e,o.line,a.line+1,l):nr(e,o.line,"text");r=we(e,"changes"),l=we(e,"change");(l||r)&&(t={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin},l&&rn(e,"change",e,t),r&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(t));e.display.selForContextMenu=null}(e.cm,t,r):mi(e,t,r),Bi(e,n,q),e.cantEdit&&qi(e,tt(e.firstLine(),0))&&(e.cantEdit=!1))}function Yi(e,t,n,r,i){var o;nt(r=r||n,n)<0&&(n=(o=[r,n])[0],r=o[1]),"string"==typeof t&&(t=e.splitLines(t)),Ui(e,{from:n,to:r,text:t,origin:i})}function Qi(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Ji(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 s=0;s<o.ranges.length;s++)Qi(o.ranges[s].anchor,t,n,r),Qi(o.ranges[s].head,t,n,r)}else{for(var l=0;l<o.changes.length;++l){var c=o.changes[l];if(n<c.from.line)c.from=tt(c.from.line+r,c.from.ch),c.to=tt(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 Zi(e,t){var n=t.from.line,r=t.to.line,t=t.text.length-(r-n)-1;Ji(e.done,n,r,t),Ji(e.undone,n,r,t)}function eo(e,t,n,r){var i=t,o=t;return"number"==typeof t?o=$e(e,st(e,t)):i=Qe(t),null==i?null:(r(o,i)&&e.cm&&nr(e.cm,i,n),o)}function to(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 no(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}oi.prototype.from=function(){return at(this.anchor,this.head)},oi.prototype.to=function(){return ot(this.anchor,this.head)},oi.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},to.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,Tt(n),rn(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}},no.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n,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),s=i.height;if(i.removeInner(e,a),this.height-=s-i.height,o==a&&(this.children.splice(r--,1),i.parent=null),0==(t-=a))break;e=0}else e-=o}this.size-t<25&&(1<this.children.length||!(this.children[0]instanceof to))&&(this.collapse(n=[]),this.children=[new to(n)],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,s=a;s<i.lines.length;){var l=new to(i.lines.slice(s,s+=25));i.height-=l.height,this.children.splice(++r,0,l),l.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,n=new no(e.children.splice(e.children.length-5,5))}while(e.parent?(e.size-=n.size,e.height-=n.height,t=F(e.parent.children,e),e.parent.children.splice(t+1,0,n)):(((t=new no(e.children)).parent=e).children=[t,n],e=t),n.parent=e.parent,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 ro(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t}function io(e,t,n){qt(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&br(e,n)}ro.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Qe(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=hn(this);Ye(n,Math.max(0,n.height-o)),e&&(Rr(e,function(){io(e,n,-o),nr(e,r,"widget")}),rn(e,"lineWidgetCleared",e,this,r))}},ro.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=hn(this)-t;i&&(Wt(this.doc,r)||Ye(r,r.height+i),n&&Rr(n,function(){n.curOp.forceUpdate=!0,io(n,r,i),rn(n,"lineWidgetChanged",n,e,Qe(r))}))},Ce(ro);function oo(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ao}var ao=0;function so(r,i,o,e,t){if(e&&e.shared)return function(e,n,r,i,o){(i=R(i)).shared=!1;var a=[so(e,n,r,i,o)],s=a[0],l=i.widgetNode;return gi(e,function(e){l&&(i.widgetNode=l.cloneNode(!0)),a.push(so(e,lt(e,n),lt(e,r),i,o));for(var t=0;t<e.linked.length;++t)if(e.linked[t].isParent)return;s=$(a)}),new lo(a,s)}(r,i,o,e,t);if(r.cm&&!r.cm.curOp)return Br(r.cm,so)(r,i,o,e,t);var a=new oo(r,t),t=nt(i,o);if(e&&R(e,a,!1),0<t||0==t&&!1!==a.clearWhenEmpty)return a;if(a.replacedWith&&(a.collapsed=!0,a.widgetNode=L("span",[a.replacedWith],"CodeMirror-widget"),e.handleMouseEvents||a.widgetNode.setAttribute("cm-ignore-events","true"),e.insertLeft&&(a.widgetNode.insertLeft=!0)),a.collapsed){if(Bt(r,i.line,i,o,a)||i.line!=o.line&&Bt(r,o.line,i,o,a))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ct=!0}a.addToHistory&&wi(r,{from:i,to:o,origin:"markText"},r.sel,NaN);var s,l=i.line,c=r.cm;if(r.iter(l,o.line+1,function(e){var t,n;c&&a.collapsed&&!c.options.lineWrapping&&Dt(e)==c.display.maxLine&&(s=!0),a.collapsed&&l!=i.line&&Ye(e,0),t=e,n=new St(a,l==i.line?i.ch:null,l==o.line?o.ch:null),(e=(e=r.cm&&r.cm.curOp)&&window.WeakSet&&(e.markedSpans||(e.markedSpans=new WeakSet)))&&e.has(t.markedSpans)?t.markedSpans.push(n):(t.markedSpans=t.markedSpans?t.markedSpans.concat([n]):[n],e&&e.add(t.markedSpans)),n.marker.attachLine(t),++l}),a.collapsed&&r.iter(i.line,o.line+1,function(e){Wt(r,e)&&Ye(e,0)}),a.clearOnEnter&&ge(a,"beforeCursorEnter",function(){return a.clear()}),a.readOnly&&(wt=!0,(r.history.done.length||r.history.undone.length)&&r.clearHistory()),a.collapsed&&(a.id=++ao,a.atomic=!0),c){if(s&&(c.curOp.updateMaxLine=!0),a.collapsed)tr(c,i.line,o.line+1);else if(a.className||a.startStyle||a.endStyle||a.css||a.attributes||a.title)for(var n=i.line;n<=o.line;n++)nr(c,n,"text");a.atomic&&Fi(c.doc),rn(c,"markerAdded",c,a)}return a}oo.prototype.clear=function(){if(!this.explicitlyCleared){var e,t=this.doc.cm,n=t&&!t.curOp;n&&Ir(t),!we(this,"clear")||(e=this.find())&&rn(this,"clear",e.from,e.to);for(var r=null,i=null,o=0;o<this.lines.length;++o){var a=this.lines[o],s=_t(a.markedSpans,this);t&&!this.collapsed?nr(t,Qe(a),"text"):t&&(null!=s.to&&(i=Qe(a)),null!=s.from&&(r=Qe(a))),a.markedSpans=function(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n=n||[]).push(e[r]);return n}(a.markedSpans,s),null==s.from&&this.collapsed&&!Wt(this.doc,a)&&t&&Ye(a,$n(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var l=0;l<this.lines.length;++l){var c=Dt(this.lines[l]),u=Ht(c);u>t.display.maxLineLength&&(t.display.maxLine=c,t.display.maxLineLength=u,t.display.maxLineChanged=!0)}null!=r&&t&&this.collapsed&&tr(t,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&Fi(t.doc)),t&&rn(t,"markerCleared",t,this,r,i),n&&Pr(t),this.parent&&this.parent.clear()}},oo.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=_t(o.markedSpans,this);if(null!=a.from&&(n=tt(t?o:Qe(o),a.from),-1==e))return n;if(null!=a.to&&(r=tt(t?o:Qe(o),a.to),1==e))return r}return n&&{from:n,to:r}},oo.prototype.changed=function(){var n=this,r=this.find(-1,!0),i=this,o=this.doc.cm;r&&o&&Rr(o,function(){var e=r.line,t=Qe(r.line),t=Cn(o,t);t&&(An(t),o.curOp.selectionChanged=o.curOp.forceUpdate=!0),o.curOp.updateMaxLine=!0,Wt(i.doc,e)||null==i.height||(t=i.height,i.height=null,(t=hn(i)-t)&&Ye(e,e.height+t)),rn(o,"markerChanged",o,n)})},oo.prototype.attachLine=function(e){var t;!this.lines.length&&this.doc.cm&&((t=this.doc.cm.curOp).maybeHiddenMarkers&&-1!=F(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)),this.lines.push(e)},oo.prototype.detachLine=function(e){this.lines.splice(F(this.lines,e),1),!this.lines.length&&this.doc.cm&&((e=this.doc.cm.curOp).maybeHiddenMarkers||(e.maybeHiddenMarkers=[])).push(this)},Ce(oo);var lo=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};function co(e){return e.findMarks(tt(e.first,0),e.clipPos(tt(e.lastLine())),function(e){return e.parent})}function uo(o){for(var e=0;e<o.length;e++)!function(e){var t=o[e],n=[t.primary.doc];gi(t.primary.doc,function(e){return n.push(e)});for(var r=0;r<t.markers.length;r++){var i=t.markers[r];-1==F(n,i.doc)&&(i.parent=null,t.markers.splice(r--,1))}}(e)}lo.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();rn(this,"clear")}},lo.prototype.find=function(e,t){return this.primary.find(e,t)},Ce(lo);function fo(e,t,n,r,i){if(!(this instanceof fo))return new fo(e,t,n,r,i);null==n&&(n=0),no.call(this,[new to([new Kt("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,n=tt(this.modeFrontier=this.highlightFrontier=n,0),this.sel=si(n),this.history=new bi(null),this.id=++ho,this.modeOption=t,this.lineSep=r,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),mi(this,{from:n,to:n,text:e}),Ri(this,si(n),q)}var ho=0;(fo.prototype=Y(no.prototype,{constructor:fo,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=Xe(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:Fr(function(e){var t=tt(this.first,0),n=this.first+this.size-1;Ui(this,{from:t,to:tt(n,$e(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&xr(this.cm,0,0),Ri(this,si(t),q)}),replaceRange:function(e,t,n,r){Yi(this,e,t=lt(this,t),n=n?lt(this,n):t,r)},getRange:function(e,t,n){t=Ge(this,lt(this,e),lt(this,t));return!1===n?t:""===n?t.join(""):t.join(n||this.lineSeparator())},getLine:function(e){e=this.getLineHandle(e);return e&&e.text},getLineHandle:function(e){if(Ze(this,e))return $e(this,e)},getLineNumber:Qe,getLineHandleVisualStart:function(e){return Dt(e="number"==typeof e?$e(this,e):e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return lt(this,e)},getCursor:function(e){var t=this.sel.primary(),t=null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from();return t},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Fr(function(e,t,n){Ii(this,lt(this,"number"==typeof e?tt(e,t||0):e),null,n)}),setSelection:Fr(function(e,t,n){Ii(this,lt(this,e),lt(this,t||e),n)}),extendSelection:Fr(function(e,t,n){Oi(this,lt(this,e),t&&lt(this,t),n)}),extendSelections:Fr(function(e,t){Ni(this,ct(this,e),t)}),extendSelectionsBy:Fr(function(e,t){Ni(this,ct(this,G(this.sel.ranges,e)),t)}),setSelections:Fr(function(e,t,n){if(e.length){for(var r=[],i=0;i<e.length;i++)r[i]=new oi(lt(this,e[i].anchor),lt(this,e[i].head||e[i].anchor));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Ri(this,ai(this.cm,r,t),n)}}),addSelection:Fr(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new oi(lt(this,e),lt(this,t||e))),Ri(this,ai(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n=0;n<t.length;n++)var r=Ge(this,t[n].from(),t[n].to()),i=i?i.concat(r):r;return!1===e?i:i.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=Ge(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:Fr(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 t=t&&"end"!=t&&function(e,t,n){for(var r=[],i=c=tt(e.first,0),o=0;o<t.length;o++){var a=t[o],s=di(a.from,c,i),l=di(li(a),c,i),c=a.to,i=l;"around"==n?(a=nt((a=e.sel.ranges[o]).head,a.anchor)<0,r[o]=new oi(a?l:s,a?s:l)):r[o]=new oi(s,s)}return new ii(r,e.sel.primIndex)}(this,r,t),s=r.length-1;0<=s;s--)Ui(this,r[s]);t?Pi(this,t):this.cm&&kr(this.cm)}),undo:Fr(function(){$i(this,"undo")}),redo:Fr(function(){$i(this,"redo")}),undoSelection:Fr(function(){$i(this,"undo",!0)}),redoSelection:Fr(function(){$i(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 bi(this.history),gi(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:Ti(this.history.done),undone:Ti(this.history.undone)}},setHistory:function(e){var t=this.history=new bi(this.history);t.done=Ti(e.done.slice(0),null,!0),t.undone=Ti(e.undone.slice(0),null,!0)},setGutterMarker:Fr(function(e,n,r){return eo(this,e,"gutter",function(e){var t=e.gutterMarkers||(e.gutterMarkers={});return!(t[n]=r)&&ee(t)&&(e.gutterMarkers=null),1})}),clearGutter:Fr(function(t){var n=this;this.iter(function(e){e.gutterMarkers&&e.gutterMarkers[t]&&eo(n,e,"gutter",function(){return e.gutterMarkers[t]=null,ee(e.gutterMarkers)&&(e.gutterMarkers=null),1})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!Ze(this,e))return null;if(!(e=$e(this,t=e)))return null}else if(null==(t=Qe(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:Fr(function(e,n,r){return eo(this,e,"gutter"==n?"gutter":"class",function(e){var t="text"==n?"textClass":"background"==n?"bgClass":"gutter"==n?"gutterClass":"wrapClass";if(e[t]){if(w(r).test(e[t]))return;e[t]+=" "+r}else e[t]=r;return 1})}),removeLineClass:Fr(function(e,o,a){return eo(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){if(null==a)e[t]=null;else{var r=n.match(w(a));if(!r)return;var i=r.index+r[0].length;e[t]=n.slice(0,r.index)+(r.index&&i!=n.length?" ":"")+n.slice(i)||null}return 1}})}),addLineWidget:Fr(function(e,t,n){return e=e,i=new ro(r=this,t,n),(o=r.cm)&&i.noHScroll&&(o.display.alignWidgets=!0),eo(r,e,"widget",function(e){var t=e.widgets||(e.widgets=[]);return null==i.insertAt?t.push(i):t.splice(Math.min(t.length,Math.max(0,i.insertAt)),0,i),i.line=e,o&&!Wt(r,e)&&(t=qt(e)<r.scrollTop,Ye(e,e.height+hn(i)),t&&br(o,i.height),o.curOp.forceUpdate=!0),1}),o&&rn(o,"lineWidgetAdded",o,i,"number"==typeof e?e:Qe(e)),i;var r,i,o}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return so(this,lt(this,e),lt(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){t={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return so(this,e=lt(this,e),e,t,"bookmark")},findMarksAt:function(e){var t=[],n=$e(this,(e=lt(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=lt(this,i),o=lt(this,o);var s=[],l=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&&l==i.line&&i.ch>=r.to||null==r.from&&l!=i.line||null!=r.from&&l==o.line&&r.from>=o.ch||a&&!a(r.marker)||s.push(r.marker.parent||r.marker)}++l}),s},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(t){var n,r=this.first,i=this.lineSeparator().length;return this.iter(function(e){e=e.text.length+i;if(t<e)return n=t,!0;t-=e,++r}),lt(this,tt(r,n))},indexFromPos:function(e){var t=(e=lt(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 fo(Xe(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){var t=this.first,n=this.first+this.size;null!=(e=e||{}).from&&e.from>t&&(t=e.from),null!=e.to&&e.to<n&&(n=e.to);t=new fo(Xe(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(t.history=this.history),(this.linked||(this.linked=[])).push({doc:t,sharedHist:e.sharedHist}),t.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),i=e.clipPos(i.to);nt(o,i)&&(i=so(e,o,i,r.primary,r.primary.type),r.markers.push(i),i.parent=r)}}(t,co(this)),t},unlinkDoc:function(e){if(e instanceof ua&&(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),uo(co(this));break}var n;e.history==this.history&&(n=[e.id],gi(e,function(e){return n.push(e.id)},!0),e.history=new bi(null),e.history.done=Ti(this.history.done,n),e.history.undone=Ti(this.history.undone,n))},iterLinkedDocs:function(e){gi(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Ie(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:Fr(function(e){var t;(e="rtl"!=e?"ltr":e)!=this.direction&&(this.direction=e,this.iter(function(e){return e.order=null}),this.cm&&Rr(t=this.cm,function(){yi(t),tr(t)}))})})).eachLine=fo.prototype.iter;var po=0;function mo(e){var r=this;if(go(r),!ke(r,e)&&!pn(r.display,e)){Se(e),k&&(po=+new Date);var t=Zn(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,s=function(){++a==i&&Br(r,function(){var e={from:t=lt(r.doc,t),to:t,text:r.doc.splitLines(o.filter(function(e){return null!=e}).join(r.doc.lineSeparator())),origin:"paste"};Ui(r.doc,e),Pi(r.doc,si(lt(r.doc,t),lt(r.doc,li(e))))})()},l=0;l<n.length;l++)!function(e,t){var n;r.options.allowDropFileTypes&&-1==F(r.options.allowDropFileTypes,e.type)?s():((n=new FileReader).onerror=function(){return s()},n.onload=function(){var e=n.result;/[\x00-\x08\x0e-\x1f]{2}/.test(e)||(o[t]=e),s()},n.readAsText(e))}(n[l],l);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 c,u=e.dataTransfer.getData("Text");if(u){if(r.state.draggingText&&!r.state.draggingText.copy&&(c=r.listSelections()),Bi(r.doc,si(t,t)),c)for(var d=0;d<c.length;++d)Yi(r.doc,"",c[d].anchor,c[d].head,"drag");r.replaceSelection(u,"around","paste"),r.display.input.focus()}}catch(e){}}}}function go(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function vo(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 yo=!1;function bo(){var e;yo||(ge(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,vo(ko)},100))}),ge(window,"blur",function(){return vo(pr)}),yo=!0)}function ko(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var xo={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:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},wo=0;wo<10;wo++)xo[wo+48]=xo[wo+96]=String(wo);for(var Co=65;Co<=90;Co++)xo[Co]=String.fromCharCode(Co);for(var So=1;So<=12;So++)xo[So+111]=xo[So+63235]="F"+So;var _o={};function Lo(e){var t,n,r,i,o=e.split(/-(?!$)/);e=o[o.length-1];for(var a=0;a<o.length-1;a++){var s=o[a];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else{if(!/^s(hift)?$/i.test(s))throw new Error("Unrecognized modifier name: "+s);r=!0}}return t&&(e="Alt-"+e),n&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),e=r?"Shift-"+e:e}function Mo(e){var t,n,r={};for(t in e)if(e.hasOwnProperty(t)){var i=e[t];if(!/^(name|fallthrough|(de|at)tach)$/.test(t))if("..."!=i){for(var o=G(t.split(" "),Lo),a=0;a<o.length;a++){var s=void 0,l=void 0,s=a==o.length-1?(l=o.join(" "),i):(l=o.slice(0,a+1).join(" "),"..."),c=r[l];if(c){if(c!=s)throw new Error("Inconsistent bindings for "+l)}else r[l]=s}delete e[t]}else delete e[t]}for(n in r)e[n]=r[n];return e}function To(e,t,n,r){var i=(t=Eo(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 To(e,t.fallthrough,n,r);for(var o=0;o<t.fallthrough.length;o++){var a=To(e,t.fallthrough[o],n,r);if(a)return a}}}function Ao(e){e="string"==typeof e?e:xo[e.keyCode];return"Ctrl"==e||"Alt"==e||"Shift"==e||"Mod"==e}function Oo(e,t,n){var r=e;return t.altKey&&"Alt"!=r&&(e="Alt-"+e),(b?t.metaKey:t.ctrlKey)&&"Ctrl"!=r&&(e="Ctrl-"+e),(b?t.ctrlKey:t.metaKey)&&"Mod"!=r&&(e="Cmd-"+e),e=!n&&t.shiftKey&&"Shift"!=r?"Shift-"+e:e}function No(e,t){if(p&&34==e.keyCode&&e.char)return!1;var n=xo[e.keyCode];return null!=n&&!e.altGraphKey&&Oo(n=3==e.keyCode&&e.code?e.code:n,e,t)}function Eo(e){return"string"==typeof e?_o[e]:e}function Io(t,e){for(var n=t.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var o=e(n[i]);r.length&&nt(o.from,$(r).to)<=0;){var a=r.pop();if(nt(a.from,o.from)<0){o.from=a.from;break}}r.push(o)}Rr(t,function(){for(var e=r.length-1;0<=e;e--)Yi(t.doc,"",r[e].from,r[e].to,"+delete");kr(t)})}function Po(e,t,n){n=re(e.text,t+n,n);return n<0||n>e.text.length?null:n}function Ro(e,t,n){e=Po(e,t.ch,n);return null==e?null:new tt(t.line,e,n<0?"after":"before")}function Bo(e,t,n,r,i){if(e){"rtl"==t.doc.direction&&(i=-i);var o=pe(n,t.doc.direction);if(o){var a,s,l,e=i<0?$(o):o[0],o=i<0==(1==e.level)?"after":"before";return 0<e.level||"rtl"==t.doc.direction?(a=Sn(t,n),s=i<0?n.text.length-1:0,l=_n(t,a,s).top,s=ie(function(e){return _n(t,a,e).top==l},i<0==(1==e.level)?e.from:e.to-1,s),"before"==o&&(s=Po(n,s,1))):s=i<0?e.to:e.from,new tt(r,s,o)}}return new tt(r,i<0?n.text.length:0,i<0?"before":"after")}function Do(t,n,s,e){var l=pe(n,t.doc.direction);if(!l)return Ro(n,s,e);s.ch>=n.text.length?(s.ch=n.text.length,s.sticky="before"):s.ch<=0&&(s.ch=0,s.sticky="after");var r=ae(l,s.ch,s.sticky),i=l[r];if("ltr"==t.doc.direction&&i.level%2==0&&(0<e?i.to>s.ch:i.from<s.ch))return Ro(n,s,e);function c(e,t){return Po(n,e instanceof tt?e.ch:e,t)}function o(e){return t.options.lineWrapping?(a=a||Sn(t,n),jn(t,n,a,e)):{begin:0,end:n.text.length}}var a,u=o("before"==s.sticky?c(s,-1):s.ch);if("rtl"==t.doc.direction||1==i.level){var d=1==i.level==e<0,f=c(s,d?1:-1);if(null!=f&&(d?f<=i.to&&f<=u.end:f>=i.from&&f>=u.begin))return new tt(s.line,f,d?"before":"after")}d=function(e,t,n){for(var r=function(e,t){return t?new tt(s.line,c(e,1),"before"):new tt(s.line,e,"after")};0<=e&&e<l.length;e+=t){var i=l[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)}},r=d(r+e,e,u);if(r)return r;u=0<e?u.end:c(u.begin,-1);return null==u||0<e&&u==n.text.length||!(r=d(0<e?0:l.length-1,e,o(u)))?null:r}_o.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"},_o.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"},_o.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},_o.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"]},_o.default=m?_o.macDefault:_o.pcDefault;var Fo={selectAll:ji,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),q)},killLine:function(n){return Io(n,function(e){if(e.empty()){var t=$e(n.doc,e.head.line).text.length;return e.head.ch==t&&e.head.line<n.lastLine()?{from:e.head,to:tt(e.head.line+1,0)}:{from:e.head,to:tt(e.head.line,t)}}return{from:e.from(),to:e.to()}})},deleteLine:function(t){return Io(t,function(e){return{from:tt(e.from().line,0),to:lt(t.doc,tt(e.to().line+1,0))}})},delLineLeft:function(e){return Io(e,function(e){return{from:tt(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(n){return Io(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(n){return Io(n,function(e){var t=n.charCoords(e.head,"div").top+5,t=n.coordsChar({left:n.display.lineDiv.offsetWidth+100,top:t},"div");return{from:e.from(),to:t}})},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(tt(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(tt(e.lastLine()))},goLineStart:function(t){return t.extendSelectionsBy(function(e){return zo(t,e.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(t){return t.extendSelectionsBy(function(e){return Wo(t,e.head)},{origin:"+move",bias:1})},goLineEnd:function(t){return t.extendSelectionsBy(function(e){return function(e,t){var n=$e(e.doc,t),r=function(e){for(var t;t=Rt(e);)e=t.find(1,!0).line;return e}(n);r!=n&&(t=Qe(r));return Bo(!0,e,n,t,-1)}(t,e.head.line)},{origin:"+move",bias:-1})},goLineRight:function(t){return t.extendSelectionsBy(function(e){e=t.cursorCoords(e.head,"div").top+5;return t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:e},"div")},j)},goLineLeft:function(t){return t.extendSelectionsBy(function(e){e=t.cursorCoords(e.head,"div").top+5;return t.coordsChar({left:0,top:e},"div")},j)},goLineLeftSmart:function(n){return n.extendSelectionsBy(function(e){var t=n.cursorCoords(e.head,"div").top+5,t=n.coordsChar({left:0,top:t},"div");return t.ch<n.getLine(t.line).search(/\S/)?Wo(n,e.head):t},j)},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,"codepoint")},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(),o=B(e.getLine(o.line),o.ch,r);t.push(V(r-o%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(a){return Rr(a,function(){for(var e,t,n,r=a.listSelections(),i=[],o=0;o<r.length;o++)r[o].empty()&&(e=r[o].head,(t=$e(a.doc,e.line).text)&&(0<(e=e.ch==t.length?new tt(e.line,e.ch-1):e).ch?(e=new tt(e.line,e.ch+1),a.replaceRange(t.charAt(e.ch-1)+t.charAt(e.ch-2),tt(e.line,e.ch-2),e,"+transpose")):e.line>a.doc.first&&((n=$e(a.doc,e.line-1).text)&&(e=new tt(e.line,1),a.replaceRange(t.charAt(0)+a.doc.lineSeparator()+n.charAt(n.length-1),tt(e.line-1,n.length-1),e,"+transpose")))),i.push(new oi(e,e)));a.setSelections(i)})},newlineAndIndent:function(r){return Rr(r,function(){for(var e=(t=r.listSelections()).length-1;0<=e;e--)r.replaceRange(r.doc.lineSeparator(),t[e].anchor,t[e].head,"+input");for(var t=r.listSelections(),n=0;n<t.length;n++)r.indentLine(t[n].from().line,null,!0);kr(r)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function zo(e,t){var n=$e(e.doc,t),r=Dt(n);return Bo(!0,e,r,t=r!=n?Qe(r):t,1)}function Wo(e,t){var n=zo(e,t.line),r=$e(e.doc,n.line),e=pe(r,e.doc.direction);if(e&&0!=e[0].level)return n;r=Math.max(n.ch,r.text.search(/\S/)),t=t.line==n.line&&t.ch<=r&&t.ch;return tt(n.line,t?0:r,n.sticky)}function qo(e,t,n){if("string"==typeof t&&!(t=Fo[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)!=W}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}var Ho=new D;function jo(e,t,n,r){var i=e.state.keySeq;if(i){if(Ao(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Ho.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),Ko(e,i+" "+t,n,r))return!0}return Ko(e,t,n,r)}function Ko(e,t,n,r){r=function(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=To(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&To(t,e.options.extraKeys,n,e)||To(t,e.options.keyMap,n,e)}(e,t,r);return"multi"==r&&(e.state.keySeq=t),"handled"==r&&rn(e,"keyHandled",e,t,n),"handled"!=r&&"multi"!=r||(Se(n),ur(e)),!!r}function Uo(t,e){var n=No(e,!0);return!!n&&(e.shiftKey&&!t.state.keySeq?jo(t,"Shift-"+n,e,function(e){return qo(t,e,!0)})||jo(t,n,e,function(e){if("string"==typeof e?/^go[A-Z]/.test(e):e.motion)return qo(t,e)}):jo(t,n,e,function(e){return qo(t,e)}))}var Vo=null;function $o(e){var t,n,r,i=this;function o(e){18!=e.keyCode&&e.altKey||(C(r,"CodeMirror-crosshair"),ye(document,"keyup",o),ye(document,"mouseover",o))}e.target&&e.target!=i.display.input.getField()||(i.curOp.focus=A(),ke(i,e)||(k&&v<11&&27==e.keyCode&&(e.returnValue=!1),t=e.keyCode,i.display.shift=16==t||e.shiftKey,n=Uo(i,e),p&&(Vo=n?t:null,!n&&88==t&&!Re&&(m?e.metaKey:e.ctrlKey)&&i.replaceSelection("",null,"cut")),f&&!m&&!n&&46==t&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),18!=t||/\bCodeMirror-crosshair\b/.test(i.display.lineDiv.className)||(O(r=i.display.lineDiv,"CodeMirror-crosshair"),ge(document,"keyup",o),ge(document,"mouseover",o))))}function Go(e){16==e.keyCode&&(this.doc.sel.shift=!1),ke(this,e)}function Xo(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField()||pn(t.display,e)||ke(t,e)||e.ctrlKey&&!e.altKey||m&&e.metaKey)){var n,r=e.keyCode,i=e.charCode;if(p&&r==Vo)return Vo=null,void Se(e);p&&(!e.which||e.which<10)&&Uo(t,e)||"\b"!=(i=String.fromCharCode(null==i?r:i))&&(jo(n=t,"'"+i+"'",e,function(e){return qo(n,e,!0)})||t.display.input.onKeyPress(e))}}function Yo(e,t,n){this.time=e,this.pos=t,this.button=n}var Qo,Jo;function Zo(e){var t,n,r,i,o,a=this,s=a.display;ke(a,e)||s.activeTouch&&s.input.supportsTouch()||(s.input.ensurePolled(),s.shift=e.shiftKey,pn(s,e)?h||(s.scroller.draggable=!1,setTimeout(function(){return s.scroller.draggable=!0},100)):na(a,e)||(t=Zn(a,e),n=Ae(e),i=t?(r=t,i=n,o=+new Date,Jo&&Jo.compare(o,r,i)?(Qo=Jo=null,"triple"):Qo&&Qo.compare(o,r,i)?(Jo=new Yo(o,r,i),Qo=null,"double"):(Qo=new Yo(o,r,i),Jo=null,"single")):"single",window.focus(),1==n&&a.state.selectingText&&a.state.selectingText(e),t&&function(n,e,r,t,i){var o="Click";"double"==t?o="Double"+o:"triple"==t&&(o="Triple"+o);return jo(n,Oo(o=(1==e?"Left":2==e?"Middle":"Right")+o,i),i,function(e){if(!(e="string"==typeof e?Fo[e]:e))return!1;var t=!1;try{n.isReadOnly()&&(n.state.suppressEdits=!0),t=e(n,r)!=W}finally{n.state.suppressEdits=!1}return t})}(a,n,t,i,e)||(1==n?t?function(e,t,n,r){k?setTimeout(P(dr,e),0):e.curOp.focus=A();var i,o=function(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};null==i.unit&&(r=g?n.shiftKey&&n.metaKey:n.altKey,i.unit=r?"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=m?n.metaKey:n.ctrlKey);null==i.moveOnDrag&&(i.moveOnDrag=!(m?n.altKey:n.ctrlKey));return i}(e,n,r),a=e.doc.sel;(e.options.dragDrop&&Ee&&!e.isReadOnly()&&"single"==n&&-1<(i=a.contains(t))&&(nt((i=a.ranges[i]).from(),t)<0||0<t.xRel)&&(0<nt(i.to(),t)||t.xRel<0)?function(t,n,r,i){var o=t.display,a=!1,s=Br(t,function(e){h&&(o.scroller.draggable=!1),t.state.draggingText=!1,t.state.delayingBlurEvent&&(t.hasFocus()?t.state.delayingBlurEvent=!1:fr(t)),ye(o.wrapper.ownerDocument,"mouseup",s),ye(o.wrapper.ownerDocument,"mousemove",l),ye(o.scroller,"dragstart",c),ye(o.scroller,"drop",s),a||(Se(e),i.addNew||Oi(t.doc,r,null,null,i.extend),h&&!u||k&&9==v?setTimeout(function(){o.wrapper.ownerDocument.body.focus({preventScroll:!0}),o.input.focus()},20):o.input.focus())}),l=function(e){a=a||10<=Math.abs(n.clientX-e.clientX)+Math.abs(n.clientY-e.clientY)},c=function(){return a=!0};h&&(o.scroller.draggable=!0);(t.state.draggingText=s).copy=!i.moveOnDrag,ge(o.wrapper.ownerDocument,"mouseup",s),ge(o.wrapper.ownerDocument,"mousemove",l),ge(o.scroller,"dragstart",c),ge(o.scroller,"drop",s),t.state.delayingBlurEvent=!0,setTimeout(function(){return o.input.focus()},20),o.scroller.dragDrop&&o.scroller.dragDrop()}:function(f,e,h,p){k&&fr(f);var a=f.display,m=f.doc;Se(e);var g,v,y=m.sel,t=y.ranges;p.addNew&&!p.extend?(v=m.sel.contains(h),g=-1<v?t[v]:new oi(h,h)):(g=m.sel.primary(),v=m.sel.primIndex);"rectangle"==p.unit?(p.addNew||(g=new oi(h,h)),h=Zn(f,e,!0,!0),v=-1):(e=ea(f,h,p.unit),g=p.extend?Ai(g,e.anchor,e.head,p.extend):e);p.addNew?-1==v?(v=t.length,Ri(m,ai(f,t.concat([g]),v),{scroll:!1,origin:"*mouse"})):1<t.length&&t[v].empty()&&"char"==p.unit&&!p.extend?(Ri(m,ai(f,t.slice(0,v).concat(t.slice(v+1)),0),{scroll:!1,origin:"*mouse"}),y=m.sel):Ei(m,v,g,H):(Ri(m,new ii([g],v=0),H),y=m.sel);var b=h;function s(e){if(0!=nt(b,e))if(b=e,"rectangle"==p.unit){for(var t=[],n=f.options.tabSize,r=B($e(m,h.line).text,h.ch,n),i=B($e(m,e.line).text,e.ch,n),o=Math.min(r,i),a=Math.max(r,i),s=Math.min(h.line,e.line),l=Math.min(f.lastLine(),Math.max(h.line,e.line));s<=l;s++){var c=$e(m,s).text,u=K(c,o,n);o==a?t.push(new oi(tt(s,u),tt(s,u))):c.length>u&&t.push(new oi(tt(s,u),tt(s,K(c,a,n))))}t.length||t.push(new oi(h,h)),Ri(m,ai(f,y.ranges.slice(0,v).concat(t),v),{origin:"*mouse",scroll:!1}),f.scrollIntoView(e)}else{var d,r=g,i=ea(f,e,p.unit),e=r.anchor,e=0<nt(i.anchor,e)?(d=i.head,at(r.from(),i.anchor)):(d=i.anchor,ot(r.to(),i.head)),i=y.ranges.slice(0);i[v]=function(e,t){var n=t.anchor,r=t.head,i=$e(e.doc,n.line);if(0==nt(n,r)&&n.sticky==r.sticky)return t;var o=pe(i);if(!o)return t;var a=ae(o,n.ch,n.sticky),s=o[a];if(s.from!=n.ch&&s.to!=n.ch)return t;i=a+(s.from==n.ch==(1!=s.level)?0:1);if(0==i||i==o.length)return t;l=r.line!=n.line?0<(r.line-n.line)*("ltr"==e.doc.direction?1:-1):(e=ae(o,r.ch,r.sticky),l=e-a||(r.ch-n.ch)*(1==s.level?-1:1),e==i-1||e==i?l<0:0<l);var i=o[i+(l?-1:0)],l=l==(1==i.level),i=l?i.from:i.to,l=l?"after":"before";return n.ch==i&&n.sticky==l?t:new oi(new tt(n.line,i,l),r)}(f,new oi(lt(m,e),d)),Ri(m,ai(f,i,v),H)}}var l=a.wrapper.getBoundingClientRect(),c=0;function n(e){f.state.selectingText=!1,c=1/0,e&&(Se(e),a.input.focus()),ye(a.wrapper.ownerDocument,"mousemove",r),ye(a.wrapper.ownerDocument,"mouseup",i),m.history.lastSelOrigin=null}var r=Br(f,function(e){(0!==e.buttons&&Ae(e)?function e(t){var n,r,i=++c,o=Zn(f,t,!0,"rectangle"==p.unit);o&&(0!=nt(o,b)?(f.curOp.focus=A(),s(o),n=vr(a,m),(o.line>=n.to||o.line<n.from)&&setTimeout(Br(f,function(){c==i&&e(t)}),150)):(r=t.clientY<l.top?-20:t.clientY>l.bottom?20:0)&&setTimeout(Br(f,function(){c==i&&(a.scroller.scrollTop+=r,e(t))}),50))}:n)(e)}),i=Br(f,n);f.state.selectingText=i,ge(a.wrapper.ownerDocument,"mousemove",r),ge(a.wrapper.ownerDocument,"mouseup",i)})(e,r,t,o)}(a,t,i,e):Te(e)==s.scroller&&Se(e):2==n?(t&&Oi(a.doc,t),setTimeout(function(){return s.input.focus()},20)):3==n&&(x?a.display.input.onContextMenu(e):fr(a)))))}function ea(e,t,n){if("char"==n)return new oi(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new oi(tt(t.line,0),lt(e.doc,tt(t.line+1,0)));t=n(e,t);return new oi(t.from,t.to)}function ta(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(e){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Se(t);var a=e.display,r=a.lineDiv.getBoundingClientRect();if(o>r.bottom||!we(e,n))return Le(t);o-=r.top-a.viewOffset;for(var s=0;s<e.display.gutterSpecs.length;++s){var l=a.gutters.childNodes[s];if(l&&l.getBoundingClientRect().right>=i)return be(e,n,e,Je(e.doc,o),e.display.gutterSpecs[s].className,t),Le(t)}}function na(e,t){return ta(e,t,"gutterClick",!0)}function ra(e,t){var n,r;pn(e.display,t)||(r=t,we(n=e,"gutterContextMenu")&&ta(n,r,"gutterContextMenu",!1))||ke(e,t,"contextmenu")||x||e.display.input.onContextMenu(t)}function ia(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Nn(e)}Yo.prototype.compare=function(e,t,n){return this.time+400>e&&0==nt(t,this.pos)&&n==this.button};var oa={toString:function(){return"CodeMirror.Init"}},aa={},sa={};function la(e,t,n){!t!=!(n&&n!=oa)&&(n=e.display.dragFunctions,(t=t?ge:ye)(e.display.scroller,"dragstart",n.start),t(e.display.scroller,"dragenter",n.enter),t(e.display.scroller,"dragover",n.over),t(e.display.scroller,"dragleave",n.leave),t(e.display.scroller,"drop",n.drop))}function ca(e){e.options.lineWrapping?(O(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(C(e.display.wrapper,"CodeMirror-wrap"),jt(e)),Jn(e),tr(e),Nn(e),setTimeout(function(){return Tr(e)},100)}function ua(e,t){var n=this;if(!(this instanceof ua))return new ua(e,t);this.options=t=t?R(t):{},R(aa,t,!1);var r=t.value;"string"==typeof r?r=new fo(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i,o=new ua.inputStyles[t.inputStyle](this),o=this.display=new Jr(e,r,o,t);for(i in ia(o.wrapper.CodeMirror=this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Nr(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 D,keySeq:null,specialChars:null},t.autofocus&&!d&&o.input.focus(),k&&v<11&&setTimeout(function(){return n.display.input.reset(!0)},20),function(r){var i=r.display;ge(i.scroller,"mousedown",Br(r,Zo)),ge(i.scroller,"dblclick",k&&v<11?Br(r,function(e){var t;ke(r,e)||(!(t=Zn(r,e))||na(r,e)||pn(r.display,e)||(Se(e),t=r.findWordAt(t),Oi(r.doc,t.anchor,t.head)))}):function(e){return ke(r,e)||Se(e)});ge(i.scroller,"contextmenu",function(e){return ra(r,e)}),ge(i.input.getField(),"contextmenu",function(e){i.scroller.contains(e.target)||ra(r,e)});var n,o={end:0};function a(){i.activeTouch&&(n=setTimeout(function(){return i.activeTouch=null},1e3),(o=i.activeTouch).end=+new Date)}function s(e,t){if(null==t.left)return 1;var n=t.left-e.left,e=t.top-e.top;return 400<n*n+e*e}ge(i.scroller,"touchstart",function(e){var t;ke(r,e)||function(e){if(1==e.touches.length){e=e.touches[0];return e.radiusX<=1&&e.radiusY<=1}}(e)||na(r,e)||(i.input.ensurePolled(),clearTimeout(n),t=+new Date,i.activeTouch={start:t,moved:!1,prev:t-o.end<=300?o:null},1==e.touches.length&&(i.activeTouch.left=e.touches[0].pageX,i.activeTouch.top=e.touches[0].pageY))}),ge(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),ge(i.scroller,"touchend",function(e){var t,n=i.activeTouch;n&&!pn(i,e)&&null!=n.left&&!n.moved&&new Date-n.start<300&&(t=r.coordsChar(i.activeTouch,"page"),t=!n.prev||s(n,n.prev)?new oi(t,t):!n.prev.prev||s(n,n.prev.prev)?r.findWordAt(t):new oi(tt(t.line,0),lt(r.doc,tt(t.line+1,0))),r.setSelection(t.anchor,t.head),r.focus(),Se(e)),a()}),ge(i.scroller,"touchcancel",a),ge(i.scroller,"scroll",function(){i.scroller.clientHeight&&(Sr(r,i.scroller.scrollTop),Lr(r,i.scroller.scrollLeft,!0),be(r,"scroll",r))}),ge(i.scroller,"mousewheel",function(e){return ri(r,e)}),ge(i.scroller,"DOMMouseScroll",function(e){return ri(r,e)}),ge(i.wrapper,"scroll",function(){return i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(e){ke(r,e)||Me(e)},over:function(e){var t,n;ke(r,e)||((n=Zn(t=r,n=e))&&(lr(t,n,n=document.createDocumentFragment()),t.display.dragCursor||(t.display.dragCursor=M("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),t.display.lineSpace.insertBefore(t.display.dragCursor,t.display.cursorDiv)),_(t.display.dragCursor,n)),Me(e))},start:function(e){var t,n;t=r,n=e,k&&(!t.state.draggingText||+new Date-po<100)?Me(n):ke(t,n)||pn(t.display,n)||(n.dataTransfer.setData("Text",t.getSelection()),n.dataTransfer.effectAllowed="copyMove",n.dataTransfer.setDragImage&&!u&&((e=M("img",null,null,"position: fixed; left: 0; top: 0;")).src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",p&&(e.width=e.height=1,t.display.wrapper.appendChild(e),e._top=e.offsetTop),n.dataTransfer.setDragImage(e,0,0),p&&e.parentNode.removeChild(e)))},drop:Br(r,mo),leave:function(e){ke(r,e)||go(r)}};var e=i.input.getField();ge(e,"keyup",function(e){return Go.call(r,e)}),ge(e,"keydown",Br(r,$o)),ge(e,"keypress",Br(r,Xo)),ge(e,"focus",function(e){return hr(r,e)}),ge(e,"blur",function(e){return pr(r,e)})}(this),bo(),Ir(this),this.curOp.forceUpdate=!0,vi(this,r),t.autofocus&&!d||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&hr(n)},20):pr(this),sa)sa.hasOwnProperty(i)&&sa[i](this,t[i],oa);Gr(this),t.finishInit&&t.finishInit(this);for(var a=0;a<da.length;++a)da[a](this);Pr(this),h&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}ua.defaults=aa,ua.optionHandlers=sa;var da=[];function fa(e,t,n,r){var i,o=e.doc;"smart"==(n=null==n?"add":n)&&(o.mode.indent?i=pt(e,t).state:n="prev");var a=e.options.tabSize,s=$e(o,t),l=B(s.text,null,a);s.stateAfter&&(s.stateAfter=null);var c=s.text.match(/^\s*/)[0];if(r||/\S/.test(s.text)){if("smart"==n&&((u=o.mode.indent(i,s.text.slice(c.length),s.text))==W||150<u)){if(!r)return;n="prev"}}else u=0,n="not";"prev"==n?u=t>o.first?B($e(o,t-1).text,null,a):0:"add"==n?u=l+e.options.indentUnit:"subtract"==n?u=l-e.options.indentUnit:"number"==typeof n&&(u=l+n);var u=Math.max(0,u),d="",f=0;if(e.options.indentWithTabs)for(var h=Math.floor(u/a);h;--h)f+=a,d+="\t";if(f<u&&(d+=V(u-f)),d!=c)return Yi(o,d,tt(t,0),tt(t,c.length),"+input"),!(s.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<c.length){m=tt(t,c.length);Ei(o,p,new oi(m,m));break}}}ua.defineInitHook=function(e){return da.push(e)};var ha=null;function pa(e){ha=e}function ma(e,t,n,r,i){var o=e.doc;e.display.shift=!1,r=r||o.sel;var a=+new Date-200,s="paste"==i||e.state.pasteIncoming>a,l=Ie(t),c=null;if(s&&1<r.ranges.length)if(ha&&ha.text.join("\n")==t){if(r.ranges.length%ha.text.length==0)for(var c=[],u=0;u<ha.text.length;u++)c.push(o.splitLines(ha.text[u]))}else l.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(c=G(l,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=tt(p.line,p.ch-n):e.state.overwrite&&!s?m=tt(m.line,Math.min($e(o,m.line).text.length,m.ch+$(l).length)):s&&ha&&ha.lineWise&&ha.text.join("\n")==l.join("\n")&&(p=m=tt(p.line,0)));m={from:p,to:m,text:c?c[f%c.length]:l,origin:i||(s?"paste":e.state.cutIncoming>a?"cut":"+input")};Ui(e.doc,m),rn(e,"inputRead",e,m)}t&&!s&&va(e,t),kr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=d),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ga(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");return n&&(e.preventDefault(),t.isReadOnly()||t.options.disableInput||Rr(t,function(){return ma(t,n,0,null,"paste")}),1)}function va(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 s=0;s<o.electricChars.length;s++)if(-1<t.indexOf(o.electricChars.charAt(s))){a=fa(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test($e(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=fa(e,i.head.line,"smart"));a&&rn(e,"electricInput",e,i.head.line)}}}function ya(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,i={anchor:tt(i,0),head:tt(i+1,0)};n.push(i),t.push(e.getRange(i.anchor,i.head))}return{text:t,ranges:n}}function ba(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function ka(){var e=M("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=M("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return h?e.style.width="1000px":e.setAttribute("wrap","off"),s&&(e.style.border="1px solid black"),ba(e),t}function xa(i,o,a,s,l){var e=o,t=a,c=$e(i,o.line),u=l&&"rtl"==i.direction?-a:a;function n(e){var t,n,r;if(null==(n="codepoint"==s?(t=c.text.charCodeAt(o.ch+(0<a?0:-1)),isNaN(t)?null:(n=0<a?55296<=t&&t<56320:56320<=t&&t<57343,new tt(o.line,Math.max(0,Math.min(c.text.length,o.ch+a*(n?2:1))),-a))):l?Do(i.cm,c,o,a):Ro(c,o,a))){if(e||(r=o.line+u)<i.first||r>=i.first+i.size||(o=new tt(r,o.ch,o.sticky),!(c=$e(i,r))))return;o=Bo(l,i.cm,c,o.line,u)}else o=n;return 1}if("char"==s||"codepoint"==s)n();else if("column"==s)n(!0);else if("word"==s||"group"==s)for(var r=null,d="group"==s,f=i.cm&&i.cm.getHelper(o,"wordChars"),h=!0;!(a<0)||n(!h);h=!1){var p=c.text.charAt(o.ch)||"\n",p=Z(p,f)?"w":d&&"\n"==p?"n":!d||/\s/.test(p)?null:"p";if(!d||h||p||(p="s"),r&&r!=p){a<0&&(a=1,n(),o.sticky="after");break}if(p&&(r=p),0<a&&!n(!h))break}t=qi(i,o,e,t,!0);return rt(e,t)&&(t.hitSide=!0),t}function wa(e,t,n,r){var i,o,a,s=e.doc,l=t.left;for("page"==r?(i=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),i=Math.max(i-.5*$n(e.display),3),o=(0<n?t.bottom:t.top)+n*i):"line"==r&&(o=0<n?t.bottom+3:t.top-3);(a=qn(e,l,o)).outside;){if(n<0?o<=0:o>=s.height){a.hitSide=!0;break}o+=5*n}return a}e=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new D,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Ca(e,t){var n=Cn(e,t.line);if(!n||n.hidden)return null;var r=$e(e.doc,t.line),n=xn(n,r,t.line),r=pe(r,e.doc.direction),e="left";r&&(e=ae(r,t.ch)%2?"right":"left");e=Tn(n.map,t.ch,e);return e.offset="right"==e.collapse?e.end:e.start,e}function Sa(e,t){return t&&(e.bad=!0),e}function _a(e,t,n){var r;if(t==e.display.lineDiv){if(!(r=e.display.lineDiv.childNodes[n]))return Sa(e.clipPos(tt(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 function(c,e,t){var n=c.text.firstChild,r=!1;if(!e||!T(n,e))return Sa(tt(Qe(c.line),0),!0);if(e==n&&(r=!0,e=n.childNodes[t],t=0,!e)){var i=c.rest?$(c.rest):c.line;return Sa(tt(Qe(i),i.text.length),r)}var i=3==e.nodeType?e:null,o=e;i||1!=e.childNodes.length||3!=e.firstChild.nodeType||(i=e.firstChild,t=t&&i.nodeValue.length);for(;o.parentNode!=n;)o=o.parentNode;var u=c.measure,d=u.maps;function a(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 s=Qe(r<0?c.line:c.rest[r]),l=i[o]+n;return tt(s,l=n<0||a!=e?i[o+(n?1:0)]:l)}}}var s=a(i,o,t);if(s)return Sa(s,r);for(var l=o.nextSibling,f=i?i.nodeValue.length-t:0;l;l=l.nextSibling){if(s=a(l,l.firstChild,0))return Sa(tt(s.line,s.ch-f),r);f+=l.textContent.length}for(var h=o.previousSibling,p=t;h;h=h.previousSibling){if(s=a(h,h.firstChild,-1))return Sa(tt(s.line,s.ch+p),r);p+=h.textContent.length}}(o,t,n)}}e.prototype.init=function(e){var t=this,o=this,a=o.cm,s=o.div=e.lineDiv;function l(e){for(var t=e.target;t;t=t.parentNode){if(t==s)return 1;if(/\bCodeMirror-(?:line)?widget\b/.test(t.className))break}}function n(e){if(l(e)&&!ke(a,e)){if(a.somethingSelected())pa({lineWise:!1,text:a.getSelections()}),"cut"==e.type&&a.replaceSelection("",null,"cut");else{if(!a.options.lineWiseCopyCut)return;var t=ya(a);pa({lineWise:!0,text:t.text}),"cut"==e.type&&a.operation(function(){a.setSelections(t.ranges,0,q),a.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var n=ha.text.join("\n");if(e.clipboardData.setData("Text",n),e.clipboardData.getData("Text")==n)return void e.preventDefault()}var r=ka(),e=r.firstChild;a.display.lineSpace.insertBefore(r,a.display.lineSpace.firstChild),e.value=ha.text.join("\n");var i=A();I(e),setTimeout(function(){a.display.lineSpace.removeChild(r),i.focus(),i==s&&o.showPrimarySelection()},50)}}s.contentEditable=!0,ba(s,a.options.spellcheck,a.options.autocorrect,a.options.autocapitalize),ge(s,"paste",function(e){!l(e)||ke(a,e)||ga(e,a)||v<=11&&setTimeout(Br(a,function(){return t.updateFromDOM()}),20)}),ge(s,"compositionstart",function(e){t.composing={data:e.data,done:!1}}),ge(s,"compositionupdate",function(e){t.composing||(t.composing={data:e.data,done:!1})}),ge(s,"compositionend",function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ge(s,"touchstart",function(){return o.forceCompositionEnd()}),ge(s,"input",function(){t.composing||t.readFromDOMSoon()}),ge(s,"copy",n),ge(s,"cut",n)},e.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},e.prototype.prepareSelection=function(){var e=sr(this.cm,!1);return e.focus=A()==this.div,e},e.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},e.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},e.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=_a(t,e.anchorNode,e.anchorOffset),n=_a(t,e.focusNode,e.focusOffset);if(!o||o.bad||!n||n.bad||0!=nt(at(o,n),r)||0!=nt(ot(o,n),i)){n=t.display.view,r=r.line>=t.display.viewFrom&&Ca(t,r)||{node:n[0].measure.map[2],offset:0},i=i.line<t.display.viewTo&&Ca(t,i);if(i||(i={node:(s=(s=n[n.length-1].measure).maps?s.maps[s.maps.length-1]:s.map)[s.length-1],offset:s[s.length-2]-s[s.length-3]}),r&&i){var a,s=e.rangeCount&&e.getRangeAt(0);try{a=E(r.node,r.offset,i.offset,i.node)}catch(e){}a&&(!f&&t.state.focused?(e.collapse(r.node,r.offset),a.collapsed||(e.removeAllRanges(),e.addRange(a))):(e.removeAllRanges(),e.addRange(a)),s&&null==e.anchorNode?e.addRange(s):f&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},e.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)},e.prototype.showMultipleSelections=function(e){_(this.cm.display.cursorDiv,e.cursors),_(this.cm.display.selectionDiv,e.selection)},e.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},e.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;e=e.getRangeAt(0).commonAncestorContainer;return T(this.div,e)},e.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&A()==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())},e.prototype.blur=function(){this.div.blur()},e.prototype.getField=function(){return this.div},e.prototype.supportsTouch=function(){return!0},e.prototype.receivedFocus=function(){var t=this;this.selectionInEditor()?this.pollSelection():Rr(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))})},e.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},e.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e,t,n=this.getSelection(),r=this.cm;if(l&&o&&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}(n.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();this.composing||(this.rememberSelection(),e=_a(r,n.anchorNode,n.anchorOffset),t=_a(r,n.focusNode,n.focusOffset),e&&t&&Rr(r,function(){Ri(r.doc,si(e,t),q),(e.bad||t.bad)&&(r.curOp.selectionChanged=!0)}))}},e.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e,t=this.cm,n=t.display,r=t.doc.sel.primary(),i=r.from(),r=r.to();if(0==i.ch&&i.line>t.firstLine()&&(i=tt(i.line-1,$e(t.doc,i.line-1).length)),r.ch==$e(t.doc,r.line).text.length&&r.line<t.lastLine()&&(r=tt(r.line+1,0)),i.line<n.viewFrom||r.line>n.viewTo-1)return!1;var o,a=i.line==n.viewFrom||0==(a=er(t,i.line))?(e=Qe(n.view[0].line),n.view[0].node):(e=Qe(n.view[a].line),n.view[a-1].node.nextSibling),r=er(t,r.line),r=r==n.view.length-1?(o=n.viewTo-1,n.lineDiv.lastChild):(o=Qe(n.view[r+1].line)-1,n.view[r+1].node.previousSibling);if(!a)return!1;for(var s=t.doc.splitLines(function(a,e,t,s,l){var n="",c=!1,u=a.doc.lineSeparator(),d=!1;function f(){c&&(n+=u,d&&(n+=u),c=d=!1)}function h(e){e&&(f(),n+=e)}for(;!function e(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(n)h(n);else if(n=t.getAttribute("cm-marker"))(n=a.findMarks(tt(s,0),tt(l+1,0),(o=+n,function(e){return e.id==o}))).length&&(r=n[0].find(0))&&h(Ge(a.doc,r.from,r.to).join(u));else if("false"!=t.getAttribute("contenteditable")){var r=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(/^br$/i.test(t.nodeName)||0!=t.textContent.length){r&&f();for(var i=0;i<t.childNodes.length;i++)e(t.childNodes[i]);/^(pre|p)$/i.test(t.nodeName)&&(d=!0),r&&(c=!0)}}}else 3==t.nodeType&&h(t.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "));var o}(e),e!=t;)e=e.nextSibling,d=!1;return n}(t,a,r,e,o)),l=Ge(t.doc,tt(e,0),tt(o,$e(t.doc,o).text.length));1<s.length&&1<l.length;)if($(s)==$(l))s.pop(),l.pop(),o--;else{if(s[0]!=l[0])break;s.shift(),l.shift(),e++}for(var c=0,u=0,d=s[0],f=l[0],h=Math.min(d.length,f.length);c<h&&d.charCodeAt(c)==f.charCodeAt(c);)++c;for(var p=$(s),m=$(l),g=Math.min(p.length-(1==s.length?c:0),m.length-(1==l.length?c:0));u<g&&p.charCodeAt(p.length-u-1)==m.charCodeAt(m.length-u-1);)++u;if(1==s.length&&1==l.length&&e==i.line)for(;c&&c>i.ch&&p.charCodeAt(p.length-u-1)==m.charCodeAt(m.length-u-1);)c--,u++;s[s.length-1]=p.slice(0,p.length-u).replace(/^\u200b+/,""),s[0]=s[0].slice(c).replace(/\u200b+$/,"");a=tt(e,c),r=tt(o,l.length?$(l).length-u:0);return 1<s.length||s[0]||nt(a,r)?(Yi(t.doc,s,a,r,"+input"),!0):void 0},e.prototype.ensurePolled=function(){this.forceCompositionEnd()},e.prototype.reset=function(){this.forceCompositionEnd()},e.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},e.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))},e.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Rr(this.cm,function(){return tr(e.cm)})},e.prototype.setUneditable=function(e){e.contentEditable="false"},e.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Br(this.cm,ma)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},e.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},e.prototype.onContextMenu=function(){},e.prototype.resetPosition=function(){},e.prototype.needsContentAttribute=!0;var La,Ma,Ta,Aa,Oa,r=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new D,this.hasSelection=!1,this.composing=null};function Na(e,t,r,n){La.defaults[e]=t,r&&(Ma[e]=n?function(e,t,n){n!=oa&&r(e,t,n)}:r)}r.prototype.init=function(n){var e=this,r=this,i=this.cm;this.createField(n);var o=this.textarea;function t(e){if(!ke(i,e)){if(i.somethingSelected())pa({lineWise:!1,text:i.getSelections()});else{if(!i.options.lineWiseCopyCut)return;var t=ya(i);pa({lineWise:!0,text:t.text}),"cut"==e.type?i.setSelections(t.ranges,null,q):(r.prevInput="",o.value=t.text.join("\n"),I(o))}"cut"==e.type&&(i.state.cutIncoming=+new Date)}}n.wrapper.insertBefore(this.wrapper,n.wrapper.firstChild),s&&(o.style.width="0px"),ge(o,"input",function(){k&&9<=v&&e.hasSelection&&(e.hasSelection=null),r.poll()}),ge(o,"paste",function(e){ke(i,e)||ga(e,i)||(i.state.pasteIncoming=+new Date,r.fastPoll())}),ge(o,"cut",t),ge(o,"copy",t),ge(n.scroller,"paste",function(e){if(!pn(n,e)&&!ke(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)}}),ge(n.lineSpace,"selectstart",function(e){pn(n,e)||Se(e)}),ge(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"})}}),ge(o,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},r.prototype.createField=function(e){this.wrapper=ka(),this.textarea=this.wrapper.firstChild},r.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},r.prototype.prepareSelection=function(){var e,t=this.cm,n=t.display,r=t.doc,i=sr(t);return t.options.moveInputWithCursor&&(e=Fn(t,r.sel.primary().head,"div"),t=n.wrapper.getBoundingClientRect(),r=n.lineDiv.getBoundingClientRect(),i.teTop=Math.max(0,Math.min(n.wrapper.clientHeight-10,e.top+r.top-t.top)),i.teLeft=Math.max(0,Math.min(n.wrapper.clientWidth-10,e.left+r.left-t.left))),i},r.prototype.showSelection=function(e){var t=this.cm.display;_(t.cursorDiv,e.cursors),_(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},r.prototype.reset=function(e){var t,n;this.contextMenuPending||this.composing||((t=this.cm).somethingSelected()?(this.prevInput="",n=t.getSelection(),this.textarea.value=n,t.state.focused&&I(this.textarea),k&&9<=v&&(this.hasSelection=n)):e||(this.prevInput=this.textarea.value="",k&&9<=v&&(this.hasSelection=null)))},r.prototype.getField=function(){return this.textarea},r.prototype.supportsTouch=function(){return!1},r.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!d||A()!=this.textarea))try{this.textarea.focus()}catch(e){}},r.prototype.blur=function(){this.textarea.blur()},r.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},r.prototype.receivedFocus=function(){this.slowPoll()},r.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},r.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))})},r.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Pe(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(k&&9<=v&&this.hasSelection===i||m&&/[\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,s=Math.min(r.length,i.length);a<s&&r.charCodeAt(a)==i.charCodeAt(a);)++a;return Rr(t,function(){ma(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},r.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},r.prototype.onKeyPress=function(){k&&9<=v&&(this.hasSelection=null),this.fastPoll()},r.prototype.onContextMenu=function(e){var n=this,r=n.cm,i=r.display,o=n.textarea;n.contextMenuPending&&n.contextMenuPending();var a,s,t,l,c=Zn(r,e),u=i.scroller.scrollTop;function d(){var e,t;null!=o.selectionStart&&(t="​"+((e=r.somethingSelected())?o.value:""),o.value="⇚",o.value=t,n.prevInput=e?"":"​",o.selectionStart=1,o.selectionEnd=t.length,i.selForContextMenu=r.doc.sel)}function f(){var e,t;n.contextMenuPending==f&&(n.contextMenuPending=!1,n.wrapper.style.cssText=s,o.style.cssText=a,k&&v<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=u),null!=o.selectionStart&&((!k||v<9)&&d(),e=0,t=function(){i.selForContextMenu==r.doc.sel&&0==o.selectionStart&&0<o.selectionEnd&&"​"==n.prevInput?Br(r,ji)(r):e++<10?i.detectingSelectAll=setTimeout(t,500):(i.selForContextMenu=null,i.input.reset())},i.detectingSelectAll=setTimeout(t,200)))}c&&!p&&(r.options.resetSelectionOnContextMenu&&-1==r.doc.sel.contains(c)&&Br(r,Ri)(r.doc,si(c),q),a=o.style.cssText,s=n.wrapper.style.cssText,c=n.wrapper.offsetParent.getBoundingClientRect(),n.wrapper.style.cssText="position: static",o.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-c.top-5)+"px; left: "+(e.clientX-c.left-5)+"px;\n z-index: 1000; background: "+(k?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",h&&(t=window.scrollY),i.input.focus(),h&&window.scrollTo(null,t),i.input.reset(),r.somethingSelected()||(o.value=n.prevInput=" "),n.contextMenuPending=f,i.selForContextMenu=r.doc.sel,clearTimeout(i.detectingSelectAll),k&&9<=v&&d(),x?(Me(e),l=function(){ye(window,"mouseup",l),setTimeout(f,20)},ge(window,"mouseup",l)):setTimeout(f,50))},r.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e,this.textarea.readOnly=!!e},r.prototype.setUneditable=function(){},r.prototype.needsContentAttribute=!1,Ma=(La=ua).optionHandlers,La.defineOption=Na,La.Init=oa,Na("value","",function(e,t){return e.setValue(t)},!0),Na("mode",null,function(e,t){e.doc.modeOption=t,fi(e)},!0),Na("indentUnit",2,fi,!0),Na("indentWithTabs",!1),Na("smartIndent",!0),Na("tabSize",4,function(e){hi(e),Nn(e),tr(e)},!0),Na("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(tt(o,n))}o++});for(var t=i.length-1;0<=t;t--)Yi(e.doc,r,i[t],tt(i[t].line,i[t].ch+r.length))}}),Na("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=oa&&e.refresh()}),Na("specialCharPlaceholder",Xt,function(e){return e.refresh()},!0),Na("electricChars",!0),Na("inputStyle",d?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),Na("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),Na("autocorrect",!1,function(e,t){return e.getInputField().autocorrect=t},!0),Na("autocapitalize",!1,function(e,t){return e.getInputField().autocapitalize=t},!0),Na("rtlMoveVisually",!y),Na("wholeLineUpdateBefore",!0),Na("theme","default",function(e){ia(e),Qr(e)},!0),Na("keyMap","default",function(e,t,n){t=Eo(t),n=n!=oa&&Eo(n);n&&n.detach&&n.detach(e,t),t.attach&&t.attach(e,n||null)}),Na("extraKeys",null),Na("configureMouse",null),Na("lineWrapping",!1,ca,!0),Na("gutters",[],function(e,t){e.display.gutterSpecs=Xr(t,e.options.lineNumbers),Qr(e)},!0),Na("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?Yn(e.display)+"px":"0",e.refresh()},!0),Na("coverGutterNextToScrollbar",!1,function(e){return Tr(e)},!0),Na("scrollbarStyle","native",function(e){Nr(e),Tr(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),Na("lineNumbers",!1,function(e,t){e.display.gutterSpecs=Xr(e.options.gutters,t),Qr(e)},!0),Na("firstLineNumber",1,Qr,!0),Na("lineNumberFormatter",function(e){return e},Qr,!0),Na("showCursorWhenSelecting",!1,ar,!0),Na("resetSelectionOnContextMenu",!0),Na("lineWiseCopyCut",!0),Na("pasteLinesPerSelection",!0),Na("selectionsMayTouch",!1),Na("readOnly",!1,function(e,t){"nocursor"==t&&(pr(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),Na("screenReaderLabel",null,function(e,t){e.display.input.screenReaderLabelChanged(t=""===t?null:t)}),Na("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),Na("dragDrop",!0,la),Na("allowDropFileTypes",null),Na("cursorBlinkRate",530),Na("cursorScrollMargin",0),Na("cursorHeight",1,ar,!0),Na("singleCursorHeightPerLine",!0,ar,!0),Na("workTime",100),Na("workDelay",100),Na("flattenSpans",!0,hi,!0),Na("addModeClass",!1,hi,!0),Na("pollInterval",100),Na("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),Na("historyEventDelay",1250),Na("viewportMargin",10,function(e){return e.refresh()},!0),Na("maxHighlightLength",1e4,hi,!0),Na("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),Na("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),Na("autofocus",null),Na("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0),Na("phrases",null),Aa=(Ta=ua).optionHandlers,Oa=Ta.helpers={},Ta.prototype={constructor:Ta,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,Aa.hasOwnProperty(e)&&Br(this,Aa[e])(this,t,r),be(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"](Eo(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:Dr(function(e,t){var n=e.token?e:Ta.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++,tr(this)}),removeOverlay:Dr(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 tr(this)}}),indentLine:Dr(function(e,t,n){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),Ze(this.doc,e)&&fa(this,e,t,n)}),indentSelection:Dr(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&&(fa(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&kr(this));else{for(var o=i.from(),a=i.to(),i=Math.max(n,o.line),n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1,s=i;s<n;++s)fa(this,s,e);i=this.doc.sel.ranges;0==o.ch&&t.length==i.length&&0<i[r].from().ch&&Ei(this.doc,r,new oi(o,i[r].to()),q)}}}),getTokenAt:function(e,t){return bt(this,e,t)},getLineTokens:function(e,t){return bt(this,tt(e),t,!0)},getTokenTypeAt:function(e){e=lt(this.doc,e);var t,n=ht(this,$e(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}}e=t?t.indexOf("overlay "):-1;return e<0?t:0==e?null:t.slice(0,e-1)},getModeAt:function(e){var t=this.doc.mode;return t.innerMode?Ta.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(!Oa.hasOwnProperty(t))return n;var r=Oa[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 s=0;s<r._global.length;s++){var l=r._global[s];l.pred(i,this)&&-1==F(n,l.val)&&n.push(l.val)}return n},getStateAfter:function(e,t){var n=this.doc;return pt(this,(e=st(n,null==e?n.first+n.size-1:e))+1,t).state},cursorCoords:function(e,t){var n=this.doc.sel.primary(),n=null==e?n.head:"object"==typeof e?lt(this.doc,e):e?n.from():n.to();return Fn(this,n,t||"page")},charCoords:function(e,t){return Dn(this,lt(this.doc,e),t||"page")},coordsChar:function(e,t){return qn(this,(e=Bn(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=Bn(this,{top:e,left:0},t||"page").top,Je(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,n){var r,i=!1,e="number"==typeof e?(r=this.doc.first+this.doc.size-1,e<this.doc.first?e=this.doc.first:r<e&&(e=r,i=!0),$e(this.doc,e)):e;return Rn(this,e,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-qt(e):0)},defaultTextHeight:function(){return $n(this.display)},defaultCharWidth:function(){return Gn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o,a,s=this.display,l=(e=Fn(this,lt(this.doc,e))).bottom,c=e.left;t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),s.sizer.appendChild(t),"over"==r?l=e.top:"above"!=r&&"near"!=r||(o=Math.max(s.wrapper.clientHeight,this.doc.height),a=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth),("above"==r||e.bottom+t.offsetHeight>o)&&e.top>t.offsetHeight?l=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=o&&(l=e.bottom),c+t.offsetWidth>a&&(c=a-t.offsetWidth)),t.style.top=l+"px",t.style.left=t.style.right="","right"==i?(c=s.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?c=0:"middle"==i&&(c=(s.sizer.clientWidth-t.offsetWidth)/2),t.style.left=c+"px"),n&&(n=this,t={left:c,top:l,right:c+t.offsetWidth,bottom:l+t.offsetHeight},null!=(t=yr(n,t)).scrollTop&&Sr(n,t.scrollTop),null!=t.scrollLeft&&Lr(n,t.scrollLeft))},triggerOnKeyDown:Dr($o),triggerOnKeyPress:Dr(Xo),triggerOnKeyUp:Go,triggerOnMouseDown:Dr(Zo),execCommand:function(e){if(Fo.hasOwnProperty(e))return Fo[e].call(null,this)},triggerElectric:Dr(function(e){va(this,e)}),findPosH:function(e,t,n,r){var i=1;t<0&&(i=-1,t=-t);for(var o=lt(this.doc,e),a=0;a<t&&!(o=xa(this.doc,o,i,n,r)).hitSide;++a);return o},moveH:Dr(function(t,n){var r=this;this.extendSelectionsBy(function(e){return r.display.shift||r.doc.extend||e.empty()?xa(r.doc,e.head,t,n,r.options.rtlMoveVisually):t<0?e.from():e.to()},j)}),deleteH:Dr(function(n,r){var e=this.doc.sel,i=this.doc;e.somethingSelected()?i.replaceSelection("",null,"+delete"):Io(this,function(e){var t=xa(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=lt(this.doc,e),s=0;s<t;++s){var l=Fn(this,a,"div");if(null==o?o=l.left:l.left=o,(a=wa(this,l,i,n)).hitSide)break}return a},moveV:Dr(function(r,i){var o=this,a=this.doc,s=[],l=!this.display.shift&&!a.extend&&a.sel.somethingSelected();if(a.extendSelectionsBy(function(e){if(l)return r<0?e.from():e.to();var t=Fn(o,e.head,"div");null!=e.goalColumn&&(t.left=e.goalColumn),s.push(t.left);var n=wa(o,t,r,i);return"page"==i&&e==a.sel.primary()&&br(o,Dn(o,n,"div").top-t.top),n},j),s.length)for(var e=0;e<a.sel.ranges.length;e++)a.sel.ranges[e].goalColumn=s[e]}),findWordAt:function(e){var t=$e(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=Z(o,i)?function(e){return Z(e,i)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!Z(e)};0<n&&a(t.charAt(n-1));)--n;for(;r<t.length&&a(t.charAt(r));)++r}return new oi(tt(e.line,n),tt(e.line,r))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||(((this.state.overwrite=!this.state.overwrite)?O:C)(this.display.cursorDiv,"CodeMirror-overwrite"),be(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==A()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:Dr(function(e,t){xr(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-yn(this)-this.display.barHeight,width:e.scrollWidth-yn(this)-this.display.barWidth,clientHeight:kn(this),clientWidth:bn(this)}},scrollIntoView:Dr(function(e,t){var n;null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:tt(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?(n=e,wr(t=this),t.curOp.scrollToPos=n):Cr(this,e.from,e.to,e.margin)}),setSize:Dr(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&&On(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){nr(r,i,"widget");break}++i}),this.curOp.forceUpdate=!0,be(this,"refresh",this)}),operation:function(e){return Rr(this,e)},startOperation:function(){return Ir(this)},endOperation:function(){return Pr(this)},refresh:Dr(function(){var e=this.display.cachedTextHeight;tr(this),this.curOp.forceUpdate=!0,Nn(this),xr(this,this.doc.scrollLeft,this.doc.scrollTop),Ur(this.display),(null==e||.5<Math.abs(e-$n(this.display))||this.options.lineWrapping)&&Jn(this),be(this,"refresh",this)}),swapDoc:Dr(function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),vi(this,e),Nn(this),this.display.input.reset(),xr(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,rn(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}},Ce(Ta),Ta.registerHelper=function(e,t,n){Oa.hasOwnProperty(e)||(Oa[e]=Ta[e]={_global:[]}),Oa[e][t]=n},Ta.registerGlobalHelper=function(e,t,n,r){Ta.registerHelper(e,t,r),Oa[e]._global.push({pred:n,val:r})};var Ea,Ia,Pa="iter insert remove copy getEditor constructor".split(" ");for(Ea in fo.prototype)fo.prototype.hasOwnProperty(Ea)&&F(Pa,Ea)<0&&(ua.prototype[Ea]=function(e){return function(){return e.apply(this.doc,arguments)}}(fo.prototype[Ea]));return Ce(fo),ua.inputStyles={textarea:r,contenteditable:e},ua.defineMode=function(e){ua.defaults.mode||"null"==e||(ua.defaults.mode=e),function(e,t){2<arguments.length&&(t.dependencies=Array.prototype.slice.call(arguments,2)),De[e]=t}.apply(this,arguments)},ua.defineMIME=function(e,t){Fe[e]=t},ua.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),ua.defineMIME("text/plain","null"),ua.defineExtension=function(e,t){ua.prototype[e]=t},ua.defineDocExtension=function(e,t){fo.prototype[e]=t},ua.fromTextArea=function(t,n){var e;function r(){t.value=s.getValue()}if((n=n?R(n):{}).value=t.value,!n.tabindex&&t.tabIndex&&(n.tabindex=t.tabIndex),!n.placeholder&&t.placeholder&&(n.placeholder=t.placeholder),null==n.autofocus&&(e=A(),n.autofocus=e==t||null!=t.getAttribute("autofocus")&&e==document.body),t.form&&(ge(t.form,"submit",r),!n.leaveSubmitMethodAlone)){var i=t.form,o=i.submit;try{var a=i.submit=function(){r(),i.submit=o,i.submit(),i.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&&(ye(t.form,"submit",r),n.leaveSubmitMethodAlone||"function"!=typeof t.form.submit||(t.form.submit=o))}},t.style.display="none";var s=ua(function(e){return t.parentNode.insertBefore(e,t.nextSibling)},n);return s},(Ia=ua).off=ye,Ia.on=ge,Ia.wheelEventPixels=ni,Ia.Doc=fo,Ia.splitLines=Ie,Ia.countColumn=B,Ia.findColumn=K,Ia.isWordChar=J,Ia.Pass=W,Ia.signal=be,Ia.Line=Kt,Ia.changeEnd=li,Ia.scrollbarModel=Or,Ia.Pos=tt,Ia.cmpPos=nt,Ia.modes=De,Ia.mimeModes=Fe,Ia.resolveMode=ze,Ia.getMode=We,Ia.modeExtensions=qe,Ia.extendMode=He,Ia.copyState=je,Ia.startState=Ue,Ia.innerMode=Ke,Ia.commands=Fo,Ia.keyMap=_o,Ia.keyName=No,Ia.isModifierKey=Ao,Ia.lookupKey=To,Ia.normalizeKeyMap=Mo,Ia.StringStream=Ve,Ia.SharedTextMarker=lo,Ia.TextMarker=oo,Ia.LineWidget=ro,Ia.e_preventDefault=Se,Ia.e_stopPropagation=_e,Ia.e_stop=Me,Ia.addClass=O,Ia.contains=T,Ia.rmClass=C,Ia.keyNames=xo,ua.version="5.62.3",ua}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(C){"use strict";var S={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},_={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};C.defineMode("xml",function(e,t){var n,o,a,s=e.indentUnit,l={},r=t.htmlMode?S:_;for(n in r)l[n]=r[n];for(n in t)l[n]=t[n];function c(t,n){function e(e){return(n.tokenize=e)(t,n)}var r=t.next();if("<"==r)return t.eat("!")?t.eat("[")?t.match("CDATA[")?e(i("atom","]]>")):null:t.match("--")?e(i("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=c;break}}return"meta"}}(1))):null:t.eat("?")?(t.eatWhile(/[\w\._\-]/),n.tokenize=i("meta","?>"),"meta"):(o=t.eat("/")?"closeTag":"openTag",n.tokenize=u,"tag bracket");if("&"!=r)return t.eatWhile(/[^&<]/),null;r=t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w\.\-:]/)&&t.eat(";");return r?"atom":"error"}function u(e,t){var n=e.next();if(">"==n||"/"==n&&e.eat(">"))return t.tokenize=c,o=">"==n?"endTag":"selfcloseTag","tag bracket";if("="==n)return o="equals",null;if("<"!=n)return/[\'\"]/.test(n)?(t.tokenize=(r=n,i.isInAttribute=!0,i),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word");t.tokenize=c,t.state=p,t.tagName=t.tagStart=null;var r,t=t.tokenize(e,t);return t?t+" tag error":"tag error";function i(e,t){for(;!e.eol();)if(e.next()==r){t.tokenize=u;break}return"string"}}function i(n,r){return function(e,t){for(;!e.eol();){if(e.match(r)){t.tokenize=c;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(),a="tag",b):l.allowMissingTagName&&"endTag"==e?(a="tag bracket",b(e,0,n)):(a="error",m)}function g(e,t,n){if("word"!=e)return l.allowMissingTagName&&"endTag"==e?(a="tag bracket",v(e,0,n)):(a="error",y);t=t.current();return n.context&&n.context.tagName!=t&&l.implicitlyClosed.hasOwnProperty(n.context.tagName)&&f(n),n.context&&n.context.tagName==t||!1===l.matchClosing?(a="tag",v):(a="tag error",y)}function v(e,t,n){return"endTag"!=e?(a="error",v):(f(n),p)}function y(e,t,n){return a="error",v(e,0,n)}function b(e,t,n){if("word"==e)return a="attribute",k;if("endTag"!=e&&"selfcloseTag"!=e)return a="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 k(e,t,n){return"equals"==e?x:(l.allowMissing||(a="error"),b(e,0,n))}function x(e,t,n){return"string"==e?w:"word"==e&&l.allowUnquoted?(a="string",b):(a="error",b(e,0,n))}function w(e,t,n){return"string"==e?w:b(e,0,n)}return c.isInText=!0,{startState:function(e){var t={tokenize:c,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;o=null;var n=t.tokenize(e,t);return(n||o)&&"comment"!=n&&(a=null,t.state=t.state(o||n,e,t),a&&(n="error"==a?n+" error":a)),n},indent:function(e,t,n){var r=e.context;if(e.tokenize.isInAttribute)return e.tagStart==e.indented?e.stringStartCol+1:e.indented+s;if(r&&r.noIndent)return C.Pass;if(e.tokenize!=u&&e.tokenize!=c)return n?n.match(/^(\s*)/)[0].length:0;if(e.tagName)return!1!==l.multilineTagIndentPastTag?e.tagStart+e.tagName.length+2:e.tagStart+s*(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+s: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)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})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(nt){"use strict";nt.defineMode("javascript",function(e,u){var t,n,r,i,d=e.indentUnit,f=u.statementIndent,o=u.jsonld,a=u.json||o,s=!1!==u.trackScope,c=u.typescript,h=u.wordCharacters||/[\w$\xa1-\uffff]/,l=(t=p("keyword a"),n=p("keyword b"),r=p("keyword c"),i=p("keyword d"),e=p("operator"),{if:p("if"),while:t,with:t,else:n,do:n,try:n,finally:n,return:i,break:i,continue:i,new:p("new"),delete:r,void:r,throw:r,debugger:p("debugger"),var:p("var"),const:p("var"),let:p("var"),function:p("function"),catch:p("catch"),for:p("for"),switch:p("switch"),case:p("case"),default:p("default"),in:e,typeof:e,instanceof:e,true:e={type:"atom",style:"atom"},false:e,null:e,undefined:e,NaN:e,Infinity:e,this:p("this"),class:p("class"),super:p("atom"),yield:r,export:p("export"),import:p("import"),extends:r,await:r});function p(e){return{type:e,style:"keyword"}}var m,g,v=/[+\-*&%=<>!?|~^@]/,y=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function b(e,t,n){return m=e,g=n,t}function k(e,t){var i,n=e.next();if('"'==n||"'"==n)return t.tokenize=(i=n,function(e,t){var n,r=!1;if(o&&"@"==e.peek()&&e.match(y))return t.tokenize=k,b("jsonld-keyword","meta");for(;null!=(n=e.next())&&(n!=i||r);)r=!r&&"\\"==n;return r||(t.tokenize=k),b("string","string")}),t.tokenize(e,t);if("."==n&&e.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return b("number","number");if("."==n&&e.match(".."))return b("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(n))return b(n);if("="==n&&e.eat(">"))return b("=>","operator");if("0"==n&&e.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return b("number","number");if(/\d/.test(n))return e.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),b("number","number");if("/"==n)return e.eat("*")?(t.tokenize=x)(e,t):e.eat("/")?(e.skipToEnd(),b("comment","comment")):tt(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/),b("regexp","string-2")):(e.eat("="),b("operator","operator",e.current()));if("`"==n)return(t.tokenize=w)(e,t);if("#"==n&&"!"==e.peek())return e.skipToEnd(),b("meta","meta");if("#"==n&&e.eatWhile(h))return b("variable","property");if("<"==n&&e.match("!--")||"-"==n&&e.match("->")&&!/\S/.test(e.string.slice(0,e.start)))return e.skipToEnd(),b("comment","comment");if(v.test(n))return">"==n&&t.lexical&&">"==t.lexical.type||(e.eat("=")?"!"!=n&&"="!=n||e.eat("="):/[<>*+\-|&?]/.test(n)&&(e.eat(n),">"==n&&e.eat(n))),"?"==n&&e.eat(".")?b("."):b("operator","operator",e.current());if(h.test(n)){e.eatWhile(h);n=e.current();if("."!=t.lastType){if(l.propertyIsEnumerable(n)){t=l[n];return b(t.type,t.style,n)}if("async"==n&&e.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return b("async","keyword",n)}return b("variable","variable",n)}}function x(e,t){for(var n,r=!1;n=e.next();){if("/"==n&&r){t.tokenize=k;break}r="*"==n}return b("comment","comment")}function w(e,t){for(var n,r=!1;null!=(n=e.next());){if(!r&&("`"==n||"$"==n&&e.eat("{"))){t.tokenize=k;break}r=!r&&"\\"==n}return b("quasi","string-2",e.current())}function C(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var n,r=e.string.indexOf("=>",e.start);if(!(r<0)){!c||(n=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(e.string.slice(e.start,r)))&&(r=n.index);for(var i=0,o=!1,a=r-1;0<=a;--a){var s=e.string.charAt(a),l="([{}])".indexOf(s);if(0<=l&&l<3){if(!i){++a;break}if(0==--i){"("==s&&(o=!0);break}}else if(3<=l&&l<6)++i;else if(h.test(s))o=!0;else if(/["'\/`]/.test(s))for(;;--a){if(0==a)return;if(e.string.charAt(a-1)==s&&"\\"!=e.string.charAt(a-2)){a--;break}}else if(o&&!i){++a;break}}o&&!i&&(t.fatArrowAt=a)}}var S={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function _(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 L(e,t,n,r,i){var o=e.cc;for(M.state=e,M.stream=i,M.marked=null,M.cc=o,M.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;)if((o.length?o.pop():a?K:H)(n,r)){for(;o.length&&o[o.length-1].lex;)o.pop()();return M.marked?M.marked:"variable"==n&&function(e,t){if(s){for(var n=e.localVars;n;n=n.next)if(n.name==t)return 1;for(var r=e.context;r;r=r.prev)for(n=r.vars;n;n=n.next)if(n.name==t)return 1}}(e,r)?"variable-2":t}}var M={state:null,column:null,marked:null,cc:null};function T(){for(var e=arguments.length-1;0<=e;e--)M.cc.push(arguments[e])}function A(){return T.apply(null,arguments),!0}function O(e,t){for(var n=t;n;n=n.next)if(n.name==e)return 1}function N(e){var t=M.state;if(M.marked="def",s){if(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 I(r,n.vars,!0):null}return O(t,n.vars)?n:new I(n.prev,new P(t,n.vars),!1)}return null}}(e,t.context);if(null!=n)return void(t.context=n)}else if(!O(e,t.localVars))return void(t.localVars=new P(e,t.localVars));u.globalVars&&!O(e,t.globalVars)&&(t.globalVars=new P(e,t.globalVars))}}function E(e){return"public"==e||"private"==e||"protected"==e||"abstract"==e||"readonly"==e}function I(e,t,n){this.prev=e,this.vars=t,this.block=n}function P(e,t){this.name=e,this.next=t}var R=new P("this",new P("arguments",null));function B(){M.state.context=new I(M.state.context,M.state.localVars,!1),M.state.localVars=R}function D(){M.state.context=new I(M.state.context,M.state.localVars,!0),M.state.localVars=null}function F(){M.state.localVars=M.state.context.vars,M.state.context=M.state.context.prev}function z(r,i){function e(){var e=M.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 _(t,M.stream.column(),r,null,e.lexical,i)}return e.lex=!0,e}function W(){var e=M.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?A():";"==n||"}"==t||")"==t||"]"==t?T():A(e)}}function H(e,t){return"var"==e?A(z("vardef",t),Le,q(";"),W):"keyword a"==e?A(z("form"),V,H,W):"keyword b"==e?A(z("form"),H,W):"keyword d"==e?M.stream.match(/^\s*$/,!1)?A():A(z("stat"),G,q(";"),W):"debugger"==e?A(q(";")):"{"==e?A(z("}"),D,ue,W,F):";"==e?A():"if"==e?("else"==M.state.lexical.info&&M.state.cc[M.state.cc.length-1]==W&&M.state.cc.pop()(),A(z("form"),V,H,W,Ee)):"function"==e?A(Be):"for"==e?A(z("form"),D,Ie,H,F,W):"class"==e||c&&"interface"==t?(M.marked="keyword",A(z("form","class"==e?e:t),qe,W)):"variable"==e?c&&"declare"==t?(M.marked="keyword",A(H)):c&&("module"==t||"enum"==t||"type"==t)&&M.stream.match(/^\s*\w/,!1)?(M.marked="keyword","enum"==t?A(Ze):"type"==t?A(Fe,q("operator"),me,q(";")):A(z("form"),Me,q("{"),z("}"),ue,W,W)):c&&"namespace"==t?(M.marked="keyword",A(z("form"),K,H,W)):c&&"abstract"==t?(M.marked="keyword",A(H)):A(z("stat"),re):"switch"==e?A(z("form"),V,q("{"),z("}","switch"),D,ue,W,W,F):"case"==e?A(K,q(":")):"default"==e?A(q(":")):"catch"==e?A(z("form"),B,j,H,W,F):"export"==e?A(z("stat"),Ue,W):"import"==e?A(z("stat"),$e,W):"async"==e?A(H):"@"==t?A(K,H):T(z("stat"),K,q(";"),W)}function j(e){if("("==e)return A(ze,q(")"))}function K(e,t){return $(e,t,!1)}function U(e,t){return $(e,t,!0)}function V(e){return"("!=e?T():A(z(")"),G,q(")"),W)}function $(e,t,n){if(M.state.fatArrowAt==M.stream.start){var r=n?ee:Z;if("("==e)return A(B,z(")"),le(ze,")"),W,q("=>"),r,F);if("variable"==e)return T(B,Me,q("=>"),r,F)}var i,r=n?Y:X;return S.hasOwnProperty(e)?A(r):"function"==e?A(Be,r):"class"==e||c&&"interface"==t?(M.marked="keyword",A(z("form"),We,W)):"keyword c"==e||"async"==e?A(n?U:K):"("==e?A(z(")"),G,q(")"),W,r):"operator"==e||"spread"==e?A(n?U:K):"["==e?A(z("]"),Je,W,r):"{"==e?ce(oe,"}",null,r):"quasi"==e?T(Q,r):"new"==e?A((i=n,function(e){return"."==e?A(i?ne:te):"variable"==e&&c?A(Ce,i?Y:X):T(i?U:K)})):A()}function G(e){return e.match(/[;\}\)\],]/)?T():T(K)}function X(e,t){return","==e?A(G):Y(e,t,!1)}function Y(e,t,n){var r=0==n?X:Y,i=0==n?K:U;return"=>"==e?A(B,n?ee:Z,F):"operator"==e?/\+\+|--/.test(t)||c&&"!"==t?A(r):c&&"<"==t&&M.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?A(z(">"),le(me,">"),W,r):"?"==t?A(K,q(":"),i):A(i):"quasi"==e?T(Q,r):";"!=e?"("==e?ce(U,")","call",r):"."==e?A(ie,r):"["==e?A(z("]"),G,q("]"),W,r):c&&"as"==t?(M.marked="keyword",A(me,r)):"regexp"==e?(M.state.lastType=M.marked="operator",M.stream.backUp(M.stream.pos-M.stream.start-1),A(i)):void 0:void 0}function Q(e,t){return"quasi"!=e?T():"${"!=t.slice(t.length-2)?A(Q):A(G,J)}function J(e){if("}"==e)return M.marked="string-2",M.state.tokenize=w,A(Q)}function Z(e){return C(M.stream,M.state),T("{"==e?H:K)}function ee(e){return C(M.stream,M.state),T("{"==e?H:U)}function te(e,t){if("target"==t)return M.marked="keyword",A(X)}function ne(e,t){if("target"==t)return M.marked="keyword",A(Y)}function re(e){return":"==e?A(W,H):T(X,q(";"),W)}function ie(e){if("variable"==e)return M.marked="property",A()}function oe(e,t){return"async"==e?(M.marked="property",A(oe)):"variable"!=e&&"keyword"!=M.style?"number"==e||"string"==e?(M.marked=o?"property":M.style+" property",A(se)):"jsonld-keyword"==e?A(se):c&&E(t)?(M.marked="keyword",A(oe)):"["==e?A(K,de,q("]"),se):"spread"==e?A(U,se):"*"==t?(M.marked="keyword",A(oe)):":"==e?T(se):void 0:(M.marked="property","get"==t||"set"==t?A(ae):(c&&M.state.fatArrowAt==M.stream.start&&(n=M.stream.match(/^\s*:\s*/,!1))&&(M.state.fatArrowAt=M.stream.pos+n[0].length),A(se)));var n}function ae(e){return"variable"!=e?T(se):(M.marked="property",A(Be))}function se(e){return":"==e?A(U):"("==e?T(Be):void 0}function le(r,i,o){function a(e,t){if(o?-1<o.indexOf(e):","==e){var n=M.state.lexical;return"call"==n.info&&(n.pos=(n.pos||0)+1),A(function(e,t){return e==i||t==i?T():T(r)},a)}return e==i||t==i?A():o&&-1<o.indexOf(";")?T(r):A(q(i))}return function(e,t){return e==i||t==i?A():T(r,a)}}function ce(e,t,n){for(var r=3;r<arguments.length;r++)M.cc.push(arguments[r]);return A(z(t,n),le(e,t),W)}function ue(e){return"}"==e?A():T(H,ue)}function de(e,t){if(c)return":"==e?A(me):"?"==t?A(de):void 0}function fe(e,t){if(c&&(":"==e||"in"==t))return A(me)}function he(e){if(c&&":"==e)return M.stream.match(/^\s*\w+\s+is\b/,!1)?A(K,pe,me):A(me)}function pe(e,t){if("is"==t)return M.marked="keyword",A()}function me(e,t){return"keyof"==t||"typeof"==t||"infer"==t||"readonly"==t?(M.marked="keyword",A("typeof"==t?U:me)):"variable"==e||"void"==t?(M.marked="type",A(we)):"|"==t||"&"==t?A(me):"string"==e||"number"==e||"atom"==e?A(we):"["==e?A(z("]"),le(me,"]",","),W,we):"{"==e?A(z("}"),ve,W,we):"("==e?A(le(xe,")"),ge,we):"<"==e?A(le(me,">"),me):"quasi"==e?T(be,we):void 0}function ge(e){if("=>"==e)return A(me)}function ve(e){return e.match(/[\}\)\]]/)?A():","==e||";"==e?A(ve):T(ye,ve)}function ye(e,t){return"variable"==e||"keyword"==M.style?(M.marked="property",A(ye)):"?"==t||"number"==e||"string"==e?A(ye):":"==e?A(me):"["==e?A(q("variable"),fe,q("]"),ye):"("==e?T(De,ye):e.match(/[;\}\)\],]/)?void 0:A()}function be(e,t){return"quasi"!=e?T():"${"!=t.slice(t.length-2)?A(be):A(me,ke)}function ke(e){if("}"==e)return M.marked="string-2",M.state.tokenize=w,A(be)}function xe(e,t){return"variable"==e&&M.stream.match(/^\s*[?:]/,!1)||"?"==t?A(xe):":"==e?A(me):"spread"==e?A(xe):T(me)}function we(e,t){return"<"==t?A(z(">"),le(me,">"),W,we):"|"==t||"."==e||"&"==t?A(me):"["==e?A(me,q("]"),we):"extends"==t||"implements"==t?(M.marked="keyword",A(me)):"?"==t?A(me,q(":"),me):void 0}function Ce(e,t){if("<"==t)return A(z(">"),le(me,">"),W,we)}function Se(){return T(me,_e)}function _e(e,t){if("="==t)return A(me)}function Le(e,t){return"enum"==t?(M.marked="keyword",A(Ze)):T(Me,de,Oe,Ne)}function Me(e,t){return c&&E(t)?(M.marked="keyword",A(Me)):"variable"==e?(N(t),A()):"spread"==e?A(Me):"["==e?ce(Ae,"]"):"{"==e?ce(Te,"}"):void 0}function Te(e,t){return"variable"!=e||M.stream.match(/^\s*:/,!1)?("variable"==e&&(M.marked="property"),"spread"==e?A(Me):"}"==e?T():"["==e?A(K,q("]"),q(":"),Te):A(q(":"),Me,Oe)):(N(t),A(Oe))}function Ae(){return T(Me,Oe)}function Oe(e,t){if("="==t)return A(U)}function Ne(e){if(","==e)return A(Le)}function Ee(e,t){if("keyword b"==e&&"else"==t)return A(z("form","else"),H,W)}function Ie(e,t){return"await"==t?A(Ie):"("==e?A(z(")"),Pe,W):void 0}function Pe(e){return"var"==e?A(Le,Re):("variable"==e?A:T)(Re)}function Re(e,t){return")"==e?A():";"==e?A(Re):"in"==t||"of"==t?(M.marked="keyword",A(K,Re)):T(K,Re)}function Be(e,t){return"*"==t?(M.marked="keyword",A(Be)):"variable"==e?(N(t),A(Be)):"("==e?A(B,z(")"),le(ze,")"),W,he,H,F):c&&"<"==t?A(z(">"),le(Se,">"),W,Be):void 0}function De(e,t){return"*"==t?(M.marked="keyword",A(De)):"variable"==e?(N(t),A(De)):"("==e?A(B,z(")"),le(ze,")"),W,he,F):c&&"<"==t?A(z(">"),le(Se,">"),W,De):void 0}function Fe(e,t){return"keyword"==e||"variable"==e?(M.marked="type",A(Fe)):"<"==t?A(z(">"),le(Se,">"),W):void 0}function ze(e,t){return"@"==t&&A(K,ze),"spread"==e?A(ze):c&&E(t)?(M.marked="keyword",A(ze)):c&&"this"==e?A(de,Oe):T(Me,de,Oe)}function We(e,t){return("variable"==e?qe:He)(e,t)}function qe(e,t){if("variable"==e)return N(t),A(He)}function He(e,t){return"<"==t?A(z(">"),le(Se,">"),W,He):"extends"==t||"implements"==t||c&&","==e?("implements"==t&&(M.marked="keyword"),A(c?me:K,He)):"{"==e?A(z("}"),je,W):void 0}function je(e,t){return"async"==e||"variable"==e&&("static"==t||"get"==t||"set"==t||c&&E(t))&&M.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(M.marked="keyword",A(je)):"variable"==e||"keyword"==M.style?(M.marked="property",A(Ke,je)):"number"==e||"string"==e?A(Ke,je):"["==e?A(K,de,q("]"),Ke,je):"*"==t?(M.marked="keyword",A(je)):c&&"("==e?T(De,je):";"==e||","==e?A(je):"}"==e?A():"@"==t?A(K,je):void 0}function Ke(e,t){if("!"==t)return A(Ke);if("?"==t)return A(Ke);if(":"==e)return A(me,Oe);if("="==t)return A(U);t=M.state.lexical.prev;return T(t&&"interface"==t.info?De:Be)}function Ue(e,t){return"*"==t?(M.marked="keyword",A(Qe,q(";"))):"default"==t?(M.marked="keyword",A(K,q(";"))):"{"==e?A(le(Ve,"}"),Qe,q(";")):T(H)}function Ve(e,t){return"as"==t?(M.marked="keyword",A(q("variable"))):"variable"==e?T(U,Ve):void 0}function $e(e){return"string"==e?A():"("==e?T(K):"."==e?T(X):T(Ge,Xe,Qe)}function Ge(e,t){return"{"==e?ce(Ge,"}"):("variable"==e&&N(t),"*"==t&&(M.marked="keyword"),A(Ye))}function Xe(e){if(","==e)return A(Ge,Xe)}function Ye(e,t){if("as"==t)return M.marked="keyword",A(Ge)}function Qe(e,t){if("from"==t)return M.marked="keyword",A(K)}function Je(e){return"]"==e?A():T(le(U,"]"))}function Ze(){return T(z("form"),Me,q("{"),z("}"),le(et,"}"),W,W)}function et(){return T(Me,Oe)}function tt(e,t,n){return t.tokenize==k&&/^(?: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 W.lex=F.lex=!0,{startState:function(e){e={tokenize:k,lastType:"sof",cc:[],lexical:new _((e||0)-d,0,"block",!1),localVars:u.localVars,context:u.localVars&&new I(null,null,!1),indented:e||0};return u.globalVars&&"object"==typeof u.globalVars&&(e.globalVars=u.globalVars),e},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),C(e,t)),t.tokenize!=x&&e.eatSpace())return null;var n=t.tokenize(e,t);return"comment"==m?n:(t.lastType="operator"!=m||"++"!=g&&"--"!=g?m:"incdec",L(t,n,m,g,e))},indent:function(e,t){if(e.tokenize==x||e.tokenize==w)return nt.Pass;if(e.tokenize!=k)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==W)i=i.prev;else if(a!=Ee&&a!=F)break}for(;("stat"==i.type||"form"==i.type)&&("}"==r||(n=e.cc[e.cc.length-1])&&(n==X||n==Y)&&!/^[,\.=+\-*:?[\(]/.test(t));)i=i.prev;var s,l=(i=f&&")"==i.type&&"stat"==i.prev.type?i.prev:i).type,c=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+d:"stat"==l?i.indented+(s=t,"operator"==(l=e).lastType||","==l.lastType||v.test(s.charAt(0))||/[,.]/.test(s.charAt(0))?f||d:0):"switch"!=i.info||c||0==u.doubleIndentSwitch?i.align?i.column+(c?0:1):i.indented+(c?0:d):i.indented+(/^(?:case|default)\b/.test(t)?d:2*d)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:a?null:"/*",blockCommentEnd:a?null:"*/",blockCommentContinue:a?null:" * ",lineComment:a?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:a?"json":"javascript",jsonldMode:o,jsonMode:a,expressionAllowed:tt,skipExpression:function(e){L(e,"atom","atom","true",new nt.StringStream("",2,null))}}}),nt.registerHelper("wordChars","javascript",/[\w$]/),nt.defineMIME("text/javascript","javascript"),nt.defineMIME("text/ecmascript","javascript"),nt.defineMIME("application/javascript","javascript"),nt.defineMIME("application/x-javascript","javascript"),nt.defineMIME("application/ecmascript","javascript"),nt.defineMIME("application/json",{name:"javascript",json:!0}),nt.defineMIME("application/x-json",{name:"javascript",json:!0}),nt.defineMIME("application/manifest+json",{name:"javascript",json:!0}),nt.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),nt.defineMIME("text/typescript",{name:"javascript",typescript:!0}),nt.defineMIME("application/typescript",{name:"javascript",typescript:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(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 o,r,i=e.indentUnit,a=t.tokenHooks,s=t.documentTypes||{},l=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,k=!1!==e.highlightNonStandardPropertyKeywords;function x(e,t){return o=t,e}function w(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),o="string"}}function C(e,t){return e.next(),e.match(/^\s*[\"\')]/,!1)?t.tokenize=null:t.tokenize=w(")"),o="(",null}function S(e,t,n){this.type=e,this.indent=t,this.prev=n}function _(e,t,n,r){return e.context=new S(n,t.indentation()+(!1===r?0:i),e.context),n}function L(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function M(e,t,n){return O[n.context.type](e,t,n)}function T(e,t,n,r){for(var i=r||1;0<i;i--)n.context=n.context.prev;return M(e,t,n)}function A(e){e=e.current().toLowerCase();r=g.hasOwnProperty(e)?"atom":m.hasOwnProperty(e)?"keyword":"variable"}var O={top:function(e,t,n){if("{"==e)return _(n,t,"block");if("}"==e&&n.context.prev)return L(n);if(b&&/@component/i.test(e))return _(n,t,"atComponentBlock");if(/^@(-moz-)?document$/i.test(e))return _(n,t,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/i.test(e))return _(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 _(n,t,"at");if("hash"==e)r="builtin";else if("word"==e)r="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return _(n,t,"interpolation");if(":"==e)return"pseudo";if(v&&"("==e)return _(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):(r="error","block");n=t.current().toLowerCase();return d.hasOwnProperty(n)?(r="property","maybeprop"):f.hasOwnProperty(n)?(r=k?"string-2":"property","maybeprop"):v?(r=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(r+=" error","maybeprop")},maybeprop:function(e,t,n){return":"==e?_(n,t,"prop"):M(e,t,n)},prop:function(e,t,n){if(";"==e)return L(n);if("{"==e&&v)return _(n,t,"propBlock");if("}"==e||"{"==e)return T(e,t,n);if("("==e)return _(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 _(n,t,"interpolation")}else r+=" error";return"prop"},propBlock:function(e,t,n){return"}"==e?L(n):"word"==e?(r="property","maybeprop"):n.context.type},parens:function(e,t,n){return"{"==e||"}"==e?T(e,t,n):")"==e?L(n):"("==e?_(n,t,"parens"):"interpolation"==e?_(n,t,"interpolation"):("word"==e&&A(t),"parens")},pseudo:function(e,t,n){return"meta"==e?"pseudo":"word"==e?(r="variable-3",n.context.type):M(e,t,n)},documentTypes:function(e,t,n){return"word"==e&&s.hasOwnProperty(t.current())?(r="tag",n.context.type):O.atBlock(e,t,n)},atBlock:function(e,t,n){return"("==e?_(n,t,"atBlock_parens"):"}"==e||";"==e?T(e,t,n):"{"==e?L(n)&&_(n,t,v?"block":"top"):"interpolation"==e?_(n,t,"interpolation"):("word"==e&&(t=t.current().toLowerCase(),r="only"==t||"not"==t||"and"==t||"or"==t?"keyword":l.hasOwnProperty(t)?"attribute":c.hasOwnProperty(t)?"property":u.hasOwnProperty(t)?"keyword":d.hasOwnProperty(t)?"property":f.hasOwnProperty(t)?k?"string-2":"property":g.hasOwnProperty(t)?"atom":m.hasOwnProperty(t)?"keyword":"error"),n.context.type)},atComponentBlock:function(e,t,n){return"}"==e?T(e,t,n):"{"==e?L(n)&&_(n,t,v?"block":"top",!1):("word"==e&&(r="error"),n.context.type)},atBlock_parens:function(e,t,n){return")"==e?L(n):"{"==e||"}"==e?T(e,t,n,2):O.atBlock(e,t,n)},restricted_atBlock_before:function(e,t,n){return"{"==e?_(n,t,"restricted_atBlock"):"word"==e&&"@counter-style"==n.stateArg?(r="variable","restricted_atBlock_before"):M(e,t,n)},restricted_atBlock:function(e,t,n){return"}"==e?(n.stateArg=null,L(n)):"word"==e?(r="@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?(r="variable","keyframes"):"{"==e?_(n,t,"top"):M(e,t,n)},at:function(e,t,n){return";"==e?L(n):"{"==e||"}"==e?T(e,t,n):("word"==e?r="tag":"hash"==e&&(r="builtin"),"at")},interpolation:function(e,t,n){return"}"==e?L(n):"{"==e||";"==e?T(e,t,n):("word"==e?r="variable":"variable"!=e&&"("!=e&&")"!=e&&(r="error"),"interpolation")}};return{startState:function(e){return{tokenize:null,state:n?"block":"top",stateArg:null,context:new S(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\\\-]/),x("def",e.current())):"="==n||("~"==n||"|"==n)&&e.eat("=")?(o="compare",null):'"'==n||"'"==n?(t.tokenize=w(n),t.tokenize(e,t)):"#"==n?(e.eatWhile(/[\w\\\-]/),o="hash","atom"):"!"==n?(e.match(/^\s*\w*/),o="important","keyword"):/\d/.test(n)||"."==n&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),o="unit","number"):"-"===n?/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),o="unit","number"):e.match(/^-[\w\\\-]*/)?(e.eatWhile(/[\w\\\-]/),o=e.match(/^\s*:/,!1)?"variable-definition":"variable","variable-2"):e.match(/^\w+-/)?o="meta":void 0:/[,+>*\/]/.test(n)?(o="select-op",null):"."==n&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?o="qualifier":/[:;{}\[\]\(\)]/.test(n)?x(null,n):e.match(/^[\w-.]+(?=\()/)?(/^(url(-prefix)?|domain|regexp)$/i.test(e.current())&&(t.tokenize=C),o="variable","variable callee"):/[\w\\\-]/.test(n)?(e.eatWhile(/[\w\\\-]/),o="word","property"):o=null})(e,t);return n&&"object"==typeof n&&(o=n[1],n=n[0]),r=n,"comment"!=o&&(t.state=O[t.state](o,e,t)),r},indent:function(e,t){var n=e.context,e=t&&t.charAt(0),t=n.indent;return(n="prop"==n.type&&("}"==e||")"==e)?n.prev:n).prev&&("}"!=e||"block"!=n.type&&"top"!=n.type&&"interpolation"!=n.type&&"restricted_atBlock"!=n.type?(")"!=e||"parens"!=n.type&&"atBlock_parens"!=n.type)&&("{"!=e||"at"!=n.type&&"atBlock"!=n.type)||(t=Math.max(0,n.indent-i)):t=(n=n.prev).indent),t},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","prefers-color-scheme"],a=e(o),s=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive","dark","light"],l=e(s),c=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","all","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","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","binding","bleed","block-size","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","contain","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-content","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","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-variation-settings","font-weight","gap","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","inset","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","left","letter-spacing","line-break","line-height","line-height-step","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","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","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","rotate","rotation","rotation-point","row-gap","ruby-align","ruby-overhang","ruby-position","ruby-span","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-type","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-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-orientation","text-outline","text-overflow","text-rendering","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","touch-action","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","translate","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","writing-mode","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","paint-order","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=["accent-color","aspect-ratio","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","content-visibility","margin-block","margin-block-end","margin-block-start","margin-inline","margin-inline-end","margin-inline-start","overflow-anchor","overscroll-behavior","padding-block","padding-block-end","padding-block-start","padding-inline","padding-inline-end","padding-inline-start","scroll-snap-stop","scrollbar-3d-light-color","scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-track-color","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","shape-inside","zoom"],f=e(d),h=e(["font-display","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","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","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","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","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","slategrey","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","axis-pan","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","blur","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","brightness","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","contrast","copy","counter","counters","cover","crop","cross","crosshair","cubic-bezier","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","drop-shadow","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","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","grayscale","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","hue-rotate","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","manipulation","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","multiple_mask_images","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","pinch-zoom","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","saturate","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","sepia","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","stroke-box","sub","subpixel-antialiased","svg_masks","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","unidirectional-pan","unset","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","view-box","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),v=t.concat(r).concat(o).concat(s).concat(c).concat(d).concat(m).concat(v);function b(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",v),N.defineMIME("text/css",{documentTypes:n,mediaTypes:i,mediaFeatures:a,mediaValueKeywords:l,propertyKeywords:u,nonStandardPropertyKeywords:f,fontProperties:h,counterDescriptors:p,colorKeywords:g,valueKeywords:y,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=b)(e,t)}},name:"css"}),N.defineMIME("text/x-scss",{mediaTypes:i,mediaFeatures:a,mediaValueKeywords:l,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=b)(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:l,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=b)(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=b)(e,t)}},name:"css",helperType:"gss"})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],e):e(CodeMirror)}(function(d){"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 n={};function f(e,t){t=e.match(n[t=t]||(n[t]=new RegExp("\\s+"+t+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*")));return t?/^\s*(.*?)\s*$/.exec(t[2])[1]:""}function h(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])}d.defineMode("htmlmixed",function(s,e){var l=d.getMode(s,{name:"xml",htmlMode:!0,multilineTagIndentFactor:e.multilineTagIndentFactor,multilineTagIndentPastTag:e.multilineTagIndentPastTag,allowMissingTagName:e.allowMissingTagName}),c={},t=e&&e.tags,n=e&&e.scriptTypes;if(o(i,c),t&&o(t,c),n)for(var r=n.length-1;0<=r;r--)c.script.unshift(["type",n[r].matches,n[r].mode]);function u(e,t){var n,o,a,r=l.token(e,t.htmlState),i=/\btag\b/.test(r);return i&&!/[<>\s\/]/.test(e.current())&&(n=t.htmlState.tagName&&t.htmlState.tagName.toLowerCase())&&c.hasOwnProperty(n)?t.inTag=n+" ":t.inTag&&i&&/>$/.test(e.current())?(n=/^([\S]+) (.*)/.exec(t.inTag),t.inTag=null,i=">"==e.current()&&function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(!r[0]||r[1].test(f(t,r[0])))return r[2]}}(c[n[1]],n[2]),i=d.getMode(s,i),o=h(n[1],!0),a=h(n[1],!1),t.token=function(e,t){return e.match(o,!1)?(t.token=u,t.localState=t.localMode=null):(n=e,r=a,i=t.localMode.token(e,t.localState),e=n.current(),-1<(t=e.search(r))?n.backUp(e.length-t):e.match(/<\/?$/)&&(n.backUp(e.length),n.match(r,!1)||n.match(e)),i);var n,r,i},t.localMode=i,t.localState=d.startState(i,l.indent(t.htmlState,"",""))):t.inTag&&(t.inTag+=e.current(),e.eol()&&(t.inTag+=" ")),r}return{startState:function(){return{token:u,inTag:null,localMode:null,localState:null,htmlState:d.startState(l)}},copyState:function(e){var t;return e.localState&&(t=d.copyState(e.localMode,e.localState)),{token:e.token,inTag:e.inTag,localMode:e.localMode,localState:t,htmlState:d.copyState(l,e.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(e,t,n){return!e.localMode||/^\s*<\//.test(t)?l.indent(e.htmlState,t,n):e.localMode.indent?e.localMode.indent(e.localState,t,n):d.Pass},innerMode:function(e){return{state:e.localState||e.htmlState,mode:e.localMode||l}}}},"xml","javascript","css"),d.defineMIME("text/html","htmlmixed")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(A){"use strict";function O(e,t,n,r,i,o){this.indented=e,this.column=t,this.type=n,this.info=r,this.align=i,this.prev=o}function N(e,t,n,r){var i=e.indented;return e.context&&"statement"==e.context.type&&"statement"!=n&&(i=e.context.indented),e.context=new O(i,t,n,r,null,e.context)}function E(e){var t=e.context.type;return")"!=t&&"]"!=t&&"}"!=t||(e.indented=e.context.indented),e.context=e.context.prev}function I(e,t,n){return"variable"==t.prevToken||"type"==t.prevToken||(!!/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(e.string.slice(0,n))||(!(!t.typeAtEndOfLine||e.column()!=e.indentation())||void 0))}function P(e){for(;;){if(!e||"top"==e.type)return 1;if("}"==e.type&&"namespace"!=e.prev.info)return;e=e.prev}}function e(e){for(var t={},n=e.split(" "),r=0;r<n.length;++r)t[n[r]]=!0;return t}function R(e,t){return"function"==typeof e?e(t):e.propertyIsEnumerable(t)}A.defineMode("clike",function(e,a){var s,l,c=e.indentUnit,u=a.statementIndentUnit||c,d=a.dontAlignCalls,i=a.keywords||{},f=a.types||{},h=a.builtin||{},p=a.blockKeywords||{},m=a.defKeywords||{},g=a.atoms||{},v=a.hooks||{},y=a.multiLineStrings,o=!1!==a.indentStatements,e=!1!==a.indentSwitch,b=a.namespaceSeparator,k=a.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,x=a.numberStart||/[\d\.]/,w=a.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,C=a.isOperatorChar||/[+\-*&%=<>!?|\/]/,S=a.isIdentifierChar||/[\w\$_\xa1-\uffff]/,_=a.isReservedIdentifier||!1;function L(e,t){var o,n=e.next();if(v[n]){var r=v[n](e,t);if(!1!==r)return r}if('"'==n||"'"==n)return t.tokenize=(o=n,function(e,t){for(var n,r=!1,i=!1;null!=(n=e.next());){if(n==o&&!r){i=!0;break}r=!r&&"\\"==n}return!i&&(r||y)||(t.tokenize=null),"string"}),t.tokenize(e,t);if(x.test(n)){if(e.backUp(1),e.match(w))return"number";e.next()}if(k.test(n))return s=n,null;if("/"==n){if(e.eat("*"))return(t.tokenize=M)(e,t);if(e.eat("/"))return e.skipToEnd(),"comment"}if(C.test(n)){for(;!e.match(/^\/[\/*]/,!1)&&e.eat(C););return"operator"}if(e.eatWhile(S),b)for(;e.match(b);)e.eatWhile(S);n=e.current();return R(i,n)?(R(p,n)&&(s="newstatement"),R(m,n)&&(l=!0),"keyword"):R(f,n)?"type":R(h,n)||_&&_(n)?(R(p,n)&&(s="newstatement"),"builtin"):R(g,n)?"atom":"variable"}function M(e,t){for(var n,r=!1;n=e.next();){if("/"==n&&r){t.tokenize=null;break}r="*"==n}return"comment"}function T(e,t){a.typeFirstDefinitions&&e.eol()&&P(t.context)&&(t.typeAtEndOfLine=I(e,t,e.pos))}return{startState:function(e){return{tokenize:null,context:new O((e||0)-c,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(e,t){var n=t.context;if(e.sol()&&(null==n.align&&(n.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return T(e,t),null;s=l=null;var r,i=(t.tokenize||L)(e,t);if("comment"==i||"meta"==i)return i;if(null==n.align&&(n.align=!0),";"==s||":"==s||","==s&&e.match(/^\s*(?:\/\/.*)?$/,!1))for(;"statement"==t.context.type;)E(t);else if("{"==s)N(t,e.column(),"}");else if("["==s)N(t,e.column(),"]");else if("("==s)N(t,e.column(),")");else if("}"==s){for(;"statement"==n.type;)n=E(t);for("}"==n.type&&(n=E(t));"statement"==n.type;)n=E(t)}else s==n.type?E(t):o&&(("}"==n.type||"top"==n.type)&&";"!=s||"statement"==n.type&&"newstatement"==s)&&N(t,e.column(),"statement",e.current());return"variable"==i&&("def"==t.prevToken||a.typeFirstDefinitions&&I(e,t,e.start)&&P(t.context)&&e.match(/^\s*\(/,!1))&&(i="def"),!v.token||void 0!==(r=v.token(e,t,i))&&(i=r),"def"==i&&!1===a.styleDefs&&(i="variable"),t.startOfLine=!1,t.prevToken=l?"def":i||s,T(e,t),i},indent:function(e,t){if(e.tokenize!=L&&null!=e.tokenize||e.typeAtEndOfLine)return A.Pass;var n=e.context,r=t&&t.charAt(0),i=r==n.type;if("statement"==n.type&&"}"==r&&(n=n.prev),a.dontIndentStatements)for(;"statement"==n.type&&a.dontIndentStatements.test(n.info);)n=n.prev;if(v.indent){var o=v.indent(e,n,t,c);if("number"==typeof o)return o}o=n.prev&&"switch"==n.prev.info;if(a.allmanIndentation&&/[{(]/.test(r)){for(;"top"!=n.type&&"}"!=n.type;)n=n.prev;return n.indented}return"statement"==n.type?n.indented+("{"==r?0:u):!n.align||d&&")"==n.type?")"!=n.type||i?n.indented+(i?0:c)+(i||!o||/^(?:case|default)\b/.test(t)?0:c):n.indented+u:n.column+(i?0:1)},electricInput:e?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:"//",fold:"brace"}});var t="auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile inline restrict asm fortran",n="alignas alignof and and_eq audit axiom bitand bitor catch class compl concept constexpr const_cast decltype delete dynamic_cast explicit export final friend import module mutable namespace new noexcept not not_eq operator or or_eq override private protected public reinterpret_cast requires static_assert static_cast template this thread_local throw try typeid typename using virtual xor xor_eq",r="bycopy byref in inout oneway out self super atomic nonatomic retain copy readwrite readonly strong weak assign typeof nullable nonnull null_resettable _cmd @interface @implementation @end @protocol @encode @property @synthesize @dynamic @class @public @package @private @protected @required @optional @try @catch @finally @import @selector @encode @defs @synchronized @autoreleasepool @compatibility_alias @available",i="FOUNDATION_EXPORT FOUNDATION_EXTERN NS_INLINE NS_FORMAT_FUNCTION NS_RETURNS_RETAINEDNS_ERROR_ENUM NS_RETURNS_NOT_RETAINED NS_RETURNS_INNER_POINTER NS_DESIGNATED_INITIALIZER NS_ENUM NS_OPTIONS NS_REQUIRES_NIL_TERMINATION NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END NS_SWIFT_NAME NS_REFINED_FOR_SWIFT",o=e("int long char short double float unsigned signed void bool"),a=e("SEL instancetype id Class Protocol BOOL");function s(e){return R(o,e)||/.+_t$/.test(e)}function l(e){return s(e)||R(a,e)}var c="case do else for if switch while struct enum union",u="struct enum union";function d(e,t){if(!t.startOfLine)return!1;for(var n,r=null;n=e.peek();){if("\\"==n&&e.match(/^.$/)){r=d;break}if("/"==n&&e.match(/^\/[\/\*]/,!1))break;e.next()}return t.tokenize=r,"meta"}function f(e,t){return"type"==t.prevToken&&"type"}function h(e){return!(!e||e.length<2)&&("_"==e[0]&&("_"==e[1]||e[1]!==e[1].toLowerCase()))}function p(e){return e.eatWhile(/[\w\.']/),"number"}function m(e,t){if(e.backUp(1),e.match(/^(?:R|u8R|uR|UR|LR)/)){var n=e.match(/^"([^\s\\()]{0,16})\(/);return n?(t.cpp11RawStringDelim=n[1],(t.tokenize=y)(e,t)):!1}return e.match(/^(?:u8|u|U|L)/)?!!e.match(/^["']/,!1)&&"string":(e.next(),!1)}function g(e){e=/(\w+)::~?(\w+)$/.exec(e);return e&&e[1]==e[2]}function v(e,t){for(var n;null!=(n=e.next());)if('"'==n&&!e.eat('"')){t.tokenize=null;break}return"string"}function y(e,t){var n=t.cpp11RawStringDelim.replace(/[^\w\s]/g,"\\$&");return e.match(new RegExp(".*?\\)"+n+'"'))?t.tokenize=null:e.skipToEnd(),"string"}function b(e,t){"string"==typeof e&&(e=[e]);var n=[];function r(e){if(e)for(var t in e)e.hasOwnProperty(t)&&n.push(t)}r(t.keywords),r(t.types),r(t.builtin),r(t.atoms),n.length&&(t.helperType=e[0],A.registerHelper("hintWords",e[0],n));for(var i=0;i<e.length;++i)A.defineMIME(e[i],t)}function k(e,t){for(var n=!1;!e.eol();){if(!n&&e.match('"""')){t.tokenize=null;break}n="\\"==e.next()&&!n}return"string"}function x(r){return function(e,t){for(var n;n=e.next();){if("*"==n&&e.eat("/")){if(1!=r)return t.tokenize=x(r-1),t.tokenize(e,t);t.tokenize=null;break}if("/"==n&&e.eat("*"))return t.tokenize=x(r+1),t.tokenize(e,t)}return"comment"}}b(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:e(t),types:s,blockKeywords:e(c),defKeywords:e(u),typeFirstDefinitions:!0,atoms:e("NULL true false"),isReservedIdentifier:h,hooks:{"#":d,"*":f},modeProps:{fold:["brace","include"]}}),b(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:e(t+" "+n),types:s,blockKeywords:e(c+" class try catch"),defKeywords:e(u+" class namespace"),typeFirstDefinitions:!0,atoms:e("true false NULL nullptr"),dontIndentStatements:/^template$/,isIdentifierChar:/[\w\$_~\xa1-\uffff]/,isReservedIdentifier:h,hooks:{"#":d,"*":f,u:m,U:m,L:m,R:m,0:p,1:p,2:p,3:p,4:p,5:p,6:p,7:p,8:p,9:p,token:function(e,t,n){if("variable"==n&&"("==e.peek()&&(";"==t.prevToken||null==t.prevToken||"}"==t.prevToken)&&g(e.current()))return"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),b("text/x-java",{name:"clike",keywords:e("abstract assert break case catch class const continue default do else enum extends final finally for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while @interface"),types:e("var byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:e("catch class do else finally for if switch try while"),defKeywords:e("class interface enum @interface"),typeFirstDefinitions:!0,atoms:e("true false null"),number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,hooks:{"@":function(e){return!e.match("interface",!1)&&(e.eatWhile(/[\w\$_]/),"meta")}},modeProps:{fold:["brace","import"]}}),b("text/x-csharp",{name:"clike",keywords:e("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:e("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:e("catch class do else finally for foreach if struct switch try while"),defKeywords:e("class interface namespace struct var"),typeFirstDefinitions:!0,atoms:e("true false null"),hooks:{"@":function(e,t){return e.eat('"')?(t.tokenize=v)(e,t):(e.eatWhile(/[\w\$_]/),"meta")}}}),b("text/x-scala",{name:"clike",keywords:e("abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble"),types:e("AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:e("catch class enum do else finally for forSome if match switch try while"),defKeywords:e("class enum def object package trait type val var"),atoms:e("true false null"),indentStatements:!1,indentSwitch:!1,isOperatorChar:/[+\-*&%=<>!?|\/#:@]/,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return!!e.match('""')&&(t.tokenize=k,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},"=":function(e,t){var n=t.context;return!("}"!=n.type||!n.align||!e.eat(">"))&&(t.context=new O(n.indented,n.column,n.type,n.info,null,n.prev),"operator")},"/":function(e,t){return!!e.eat("*")&&(t.tokenize=x(1),t.tokenize(e,t))}},modeProps:{closeBrackets:{pairs:'()[]{}""',triples:'"'}}}),b("text/x-kotlin",{name:"clike",keywords:e("package as typealias class interface this super val operator var fun for is in This throw return annotation break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix suspend actual expect setparam value"),types:e("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void Annotation Any BooleanArray ByteArray Char CharArray DeprecationLevel DoubleArray Enum FloatArray Function Int IntArray Lazy LazyThreadSafetyMode LongArray Nothing ShortArray Unit"),intendSwitch:!1,indentStatements:!1,multiLineStrings:!0,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+(\.\d+)?|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,blockKeywords:e("catch class do else finally for if where try while enum"),defKeywords:e("class val var object interface fun"),atoms:e("true false null this"),hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},"*":function(e,t){return"."==t.prevToken?"variable":"operator"},'"':function(e,t){var o;return t.tokenize=(o=e.match('""'),function(e,t){for(var n,r=!1,i=!1;!e.eol();){if(!o&&!r&&e.match('"')){i=!0;break}if(o&&e.match('"""')){i=!0;break}n=e.next(),!r&&"$"==n&&e.match("{")&&e.skipTo("}"),r=!r&&"\\"==n&&!o}return!i&&o||(t.tokenize=null),"string"}),t.tokenize(e,t)},"/":function(e,t){return!!e.eat("*")&&(t.tokenize=x(1),t.tokenize(e,t))},indent:function(e,t,n,r){var i=n&&n.charAt(0);return"}"!=e.prevToken&&")"!=e.prevToken||""!=n?"operator"==e.prevToken&&"}"!=n&&"}"!=e.context.type||"variable"==e.prevToken&&"."==i||("}"==e.prevToken||")"==e.prevToken)&&"."==i?2*r+t.indented:t.align&&"}"==t.type?t.indented+(e.context.type==(n||"").charAt(0)?0:r):void 0:e.indented}},modeProps:{closeBrackets:{triples:'"'}}}),b(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:e("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:e("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:e("for while do if else struct"),builtin:e("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:e("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TextureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":d},modeProps:{fold:["brace","include"]}}),b("text/x-nesc",{name:"clike",keywords:e(t+" as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:s,blockKeywords:e(c),atoms:e("null true false"),hooks:{"#":d},modeProps:{fold:["brace","include"]}}),b("text/x-objectivec",{name:"clike",keywords:e(t+" "+r),types:l,builtin:e(i),blockKeywords:e(c+" @synthesize @try @catch @finally @autoreleasepool @synchronized"),defKeywords:e(u+" @interface @implementation @protocol @class"),dontIndentStatements:/^@.*$/,typeFirstDefinitions:!0,atoms:e("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:h,hooks:{"#":d,"*":f},modeProps:{fold:["brace","include"]}}),b("text/x-objectivec++",{name:"clike",keywords:e(t+" "+r+" "+n),types:l,builtin:e(i),blockKeywords:e(c+" @synthesize @try @catch @finally @autoreleasepool @synchronized class try catch"),defKeywords:e(u+" @interface @implementation @protocol @class class namespace"),dontIndentStatements:/^@.*$|^template$/,typeFirstDefinitions:!0,atoms:e("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:h,hooks:{"#":d,"*":f,u:m,U:m,L:m,R:m,0:p,1:p,2:p,3:p,4:p,5:p,6:p,7:p,8:p,9:p,token:function(e,t,n){if("variable"==n&&"("==e.peek()&&(";"==t.prevToken||null==t.prevToken||"}"==t.prevToken)&&g(e.current()))return"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),b("text/x-squirrel",{name:"clike",keywords:e("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:s,blockKeywords:e("case catch class else for foreach if switch try while"),defKeywords:e("function local class"),typeFirstDefinitions:!0,atoms:e("true false null"),hooks:{"#":d},modeProps:{fold:["brace","include"]}});var w=null;b("text/x-ceylon",{name:"clike",keywords:e("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(e){e=e.charAt(0);return e===e.toUpperCase()&&e!==e.toLowerCase()},blockKeywords:e("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:e("class dynamic function interface module object package value"),builtin:e("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:e("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return t.tokenize=function o(a){return function(e,t){for(var n,r=!1,i=!1;!e.eol();){if(!r&&e.match('"')&&("single"==a||e.match('""'))){i=!0;break}if(!r&&e.match("``")){w=o(a),i=!0;break}n=e.next(),r="single"==a&&!r&&"\\"==n}return i&&(t.tokenize=null),"string"}}(e.match('""')?"triple":"single"),t.tokenize(e,t)},"`":function(e,t){return!(!w||!e.match("`"))&&(t.tokenize=w,w=null,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(e,t,n){if(("variable"==n||"type"==n)&&"."==t.prevToken)return"variable-2"}},modeProps:{fold:["brace","import"],closeBrackets:{triples:'"'}}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../clike/clike")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../clike/clike"],e):e(CodeMirror)}(function(l){"use strict";function e(e){for(var t={},n=e.split(" "),r=0;r<n.length;++r)t[n[r]]=!0;return t}function s(i,o,a){return 0==i.length?c(o):function(e,t){for(var n=i[0],r=0;r<n.length;r++)if(e.match(n[r][0]))return t.tokenize=s(i.slice(1),o),n[r][1];return t.tokenize=c(o,a),"string"}}function c(n,r){return function(e,t){return function(e,t,n,r){if(!1!==r&&e.match("${",!1)||e.match("{$",!1))return t.tokenize=null,"string";if(!1!==r&&e.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/))return e.match("[",!1)&&(t.tokenize=s([[["[",null]],[[/\d[\w\.]*/,"number"],[/\$[a-zA-Z_][a-zA-Z0-9_]*/,"variable-2"],[/[\w\$]+/,"variable"]],[["]",null]]],n,r)),e.match(/^->\w/,!1)&&(t.tokenize=s([[["->",null]],[[/[\w]+/,"variable"]]],n,r)),"variable-2";var i=!1;for(;!e.eol()&&(i||!1===r||!e.match("{$",!1)&&!e.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/,!1));){if(!i&&e.match(n)){t.tokenize=null,t.tokStack.pop(),t.tokStack.pop();break}i="\\"==e.next()&&!i}return"string"}(e,t,n,r)}}var t="abstract and array as break case catch class clone const continue declare default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach function global goto if implements interface instanceof namespace new or private protected public static switch throw trait try use var while xor die echo empty exit eval include include_once isset list require require_once return print unset __halt_compiler self static parent yield insteadof finally",n="true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__",r="func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage memory_get_peak_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents file_put_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists array_intersect_key array_combine array_column pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count";l.registerHelper("hintWords","php",[t,n,r].join(" ").split(" ")),l.registerHelper("wordChars","php",/[\w$]/);var i={name:"clike",helperType:"php",keywords:e(t),blockKeywords:e("catch do else elseif for foreach if switch try while finally"),defKeywords:e("class function interface namespace trait"),atoms:e(n),builtin:e(r),multiLineStrings:!0,hooks:{$:function(e){return e.eatWhile(/[\w\$_]/),"variable-2"},"<":function(e,t){if(r=e.match(/^<<\s*/)){var n=e.eat(/['"]/);e.eatWhile(/[\w\.]/);var r=e.current().slice(r[0].length+(n?2:1));if(n&&e.eat(n),r)return(t.tokStack||(t.tokStack=[])).push(r,0),t.tokenize=c(r,"'"!=n),"string"}return!1},"#":function(e){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"},"/":function(e){if(e.eat("/")){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"}return!1},'"':function(e,t){return(t.tokStack||(t.tokStack=[])).push('"',0),t.tokenize=c('"'),"string"},"{":function(e,t){return t.tokStack&&t.tokStack.length&&t.tokStack[t.tokStack.length-1]++,!1},"}":function(e,t){return t.tokStack&&0<t.tokStack.length&&!--t.tokStack[t.tokStack.length-1]&&(t.tokenize=c(t.tokStack[t.tokStack.length-2])),!1}}};l.defineMode("php",function(e,n){var a=l.getMode(e,n&&n.htmlMode||"text/html"),s=l.getMode(e,i);return{startState:function(){var e=l.startState(a),t=n.startOpen?l.startState(s):null;return{html:e,php:t,curMode:n.startOpen?s:a,curState:n.startOpen?t:e,pending:null}},copyState:function(e){var t=e.html,n=l.copyState(a,t),r=e.php,t=r&&l.copyState(s,r),r=e.curMode==a?n:t;return{html:n,php:t,curMode:e.curMode,curState:r,pending:e.pending}},token:function(e,t){var n=t.curMode==s;if(e.sol()&&t.pending&&'"'!=t.pending&&"'"!=t.pending&&(t.pending=null),n)return null==t.php.tokenize&&e.match("?>")?(t.curMode=a,t.curState=t.html,t.php.context.prev||(t.php=null),"meta"):s.token(e,t.curState);if(e.match(/^<\?\w*/))return t.curMode=s,t.php||(t.php=l.startState(s,a.indent(t.html,"",""))),t.curState=t.php,"meta";if('"'==t.pending||"'"==t.pending){for(;!e.eol()&&e.next()!=t.pending;);var r="string"}else r=t.pending&&e.pos<t.pending.end?(e.pos=t.pending.end,t.pending.style):a.token(e,t.curState);t.pending&&(t.pending=null);var i,o=e.current();return-1!=(n=o.search(/<\?/))&&("string"==r&&(i=o.match(/[\'\"]$/))&&!/\?>/.test(o)?t.pending=i[0]:t.pending={end:e.pos,style:r},e.backUp(o.length-n)),r},indent:function(e,t,n){return e.curMode!=s&&/^\s*<\//.test(t)||e.curMode==s&&/^\?>/.test(t)?a.indent(e.html,t,n):e.curMode.indent(e.curState,t,n)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",innerMode:function(e){return{state:e.curState,mode:e.curMode}}}},"htmlmixed","clike"),l.defineMIME("application/x-httpd-php","php"),l.defineMIME("application/x-httpd-php-open",{name:"php",startOpen:!0}),l.defineMIME("text/x-php",i)}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var C={allowUnquoted:!0,allowMissing:!0,caseFold:!0};e.defineMode("shortcode",function(e,t){var n,r,o,a,s=e.indentUnit,l={},i=C;for(n in i)l[n]=i[n];for(r in t)l[r]=t[r];function c(e,t){return"["===e.next()?"["===e.peek()?(t.tokenize=u,"comment"):/\s/.test(e.peek())?null:(o=e.eat("/")?"closeTag":"openTag",t.tokenize=d,"tag bracket"):(e.eatWhile(/[^\[]/),null)}function u(e,t){function n(e,t){return e.next(),t.tokenize=c,"comment"}return n.isInEscape=!0,"]"===e.next()&&"]"===e.peek()&&(t.tokenize=n),e.eatWhile(/[^\]]/),null}function d(e,t){var n=e.next();if("]"===n||"/"===n&&e.eat("]"))return t.tokenize=c,o="endTag","tag bracket";if("="===n)return o="equals",null;if("["!==n)return/[\'\"]/.test(n)?(t.tokenize=(r=n,i.isInAttribute=!0,i),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=\[\]\"\']*[^\s\u00a0=\[\]\"\'\/]/),"word");t.tokenize=c,t.state=p,t.tagName=t.tagStart=null;var r,t=t.tokenize(e,t);return t?t+" tag error":"tag error";function i(e,t){var n=e.next();return n===r?(t.tokenize=d,"string"):/[\[\]]/.test(n)?"string error":(e.eatWhile(/[^\[\]\'\"]/),"string")}}function f(e,t,n){this.tagHistory=[t],e.context&&(this.tagHistory=this.tagHistory.concat(e.context.tagHistory)),this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=n}function h(e){e.context&&(e.context=e.context.prev)}function p(e,t,n){return"openTag"===e?(n.tagStart=t.column(),m):"closeTag"===e?g:p}function m(e,t,n){if("word"!==e)return a="error",m;e=t.current();return a=/[\[\]\/\'\"<>&]/.test(e)?"error":(n.tagName=t.current(),"tag"),b}function g(e,t,n){if("word"!==e)return a="error",y;t=t.current();if(n.context&&n.context.tagName===t||!1===l.matchClosing)return a="tag",v;if(n.context&&0<n.context.tagHistory.indexOf(t)){for(var r=n.context.tagHistory.indexOf(t),i=0;i<r;i++)h(n);return a="tag",v}return a="tag error",y}function v(e,t,n){return"endTag"!==e?(a="error",v):(h(n),p)}function y(e,t,n){return a="error",v(e,0,n)}function b(e,t,n){if("word"===e)return a=/^[a-z0-9_\-]+$/i.test(t.current())?"attribute":"error",k;if("endTag"!==e)return a="error",b;t=n.tagName,e=n.tagStart;return n.tagName=n.tagStart=null,n.context=new f(n,t,e===n.indented),p}function k(e,t,n){return"equals"===e?x:(l.allowMissing||(a="error"),b(e,t,n))}function x(e,t,n){return"string"===e?w:"word"===e&&l.allowUnquoted?(a="string",b):(a="error",b(e,t,n))}function w(e,t,n){return"string"===e?w:b(e,t,n)}return u.isInEscape=c.isInText=!0,{startState:function(e){var t={tokenize:c,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;o=null;var n=t.tokenize(e,t);return(n||o)&&"comment"!==n&&(a=null,t.state=t.state(o||n,e,t),a&&(n="error"===a?n+" error":a)),n},indent:function(e,t,n){var r=e.context;if(e.tokenize.isInAttribute)return e.tagStart===e.indented?e.stringStartCol+1:e.indented+s;if(e.tokenize!==d&&e.tokenize!==c)return n?n.match(/^(\s*)/)[0].length:0;if(e.tagName)return!1!==l.multilineTagIndentPastTag?e.tagStart+e.tagName.length+2:e.tagStart+s*(l.multilineTagIndentFactor||1);var i=t&&/^\[(\/)?([\w_:\.-]*)/.exec(t);if(i&&i[1])for(;r&&r.tagName===i[2];){r=r.prev;break}for(;r&&r.prev&&!r.startOfLine;)r=r.prev;return r?r.indent+s:e.baseIndent||0},skipAttribute:function(e){e.state===x&&(e.state=b)}}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],e):e(CodeMirror)}(function(n){"use strict";n.defineMode("wordpresspost",function(e,t){var a=n.getMode(e,{name:"htmlmixed",multilineTagIndentFactor:t.multilineTagIndentFactor,multilineTagIndentPastTag:t.multilineTagIndentPastTag}),s=n.getMode(e,{name:"shortcode",multilineTagIndentFactor:t.multilineTagIndentFactor,multilineTagIndentPastTag:t.multilineTagIndentPastTag});function l(e,t){t.isInShortcode=!0;var n=s.token(e,t.shortcodeState),r=t.shortcodeState.tokenize.isInText,i=t.shortcodeState.tokenize.isInEscape;return r?t.token=o:i&&/\]/.test(e.current())&&(i=(r=e.current()).search(/\]/),e.backUp(r.length-i-1),"]"!==e.peek()&&(t.token=o)),n}function o(e,t){t.isInShortcode=!1;var n,r,i=a.token(e,t.htmlmixedState),o=t.htmlmixedState.htmlState.tokenize.isInText;return o&&/\[/.test(e.current())&&!t.htmlmixedState.localState&&null===i?(r=(n=e.current()).search(/\[/),e.backUp(n.length-r),null==t.shortcodeState&&(t.shortcodeState=s.startState(a.indent(t.htmlmixedState,""))),t.token=l):o&&/<!\-\-more|<!\-\-(noteaser|nextpage)\-\->?/.test(e.current())&&!t.htmlmixedState.localState&&"comment"===i&&(e.backUp(e.current().length),t.token=c),i}function c(e,t){return e.match("\x3c!--more")?"meta":e.match("--\x3e")||e.match("\x3c!--noteaser--\x3e")||e.match("\x3c!--nextpage--\x3e")?(t.token=o,"meta"):(e.eatWhile(/[^\-/]/),"string")}return{startState:function(){return{token:o,isInShortcode:!1,shortcodeState:null,htmlmixedState:a.startState()}},copyState:function(e){var t;return e.shortcodeState&&(t=n.copyState(s,e.shortcodeState)),{token:e.token,shortcodeState:t,htmlmixedState:n.copyState(a,e.htmlmixedState)}},token:function(e,t){return t.token(e,t)},indent:function(e,t){return e.isInShortcode?e.isInShortcode?s.indent(e.shortcodeState,t):n.Pass:a.indent(e.htmlmixedState,t)},innerMode:function(e){return e.isInShortcode?{state:e.shortcodeState,mode:s}:{state:e.htmlmixedState,mode:a}}}},"htmlmixed","shortcode")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(r){"use strict";var a="CodeMirror-activeline",s="CodeMirror-activeline-background",l="CodeMirror-activeline-gutter";function c(e){for(var t=0;t<e.state.activeLines.length;t++)e.removeLineClass(e.state.activeLines[t],"wrap",a),e.removeLineClass(e.state.activeLines[t],"background",s),e.removeLineClass(e.state.activeLines[t],"gutter",l)}function i(t,e){for(var n=[],r=0;r<e.length;r++){var i=e[r],o=t.getOption("styleActiveLine");("object"==typeof o&&o.nonEmpty?i.anchor.line==i.head.line:i.empty())&&(i=t.getLineHandleVisualStart(i.head.line),n[n.length-1]!=i&&n.push(i))}!function(e,t){if(e.length==t.length){for(var n=0;n<e.length;n++)if(e[n]!=t[n])return;return 1}}(t.state.activeLines,n)&&t.operation(function(){c(t);for(var e=0;e<n.length;e++)t.addLineClass(n[e],"wrap",a),t.addLineClass(n[e],"background",s),t.addLineClass(n[e],"gutter",l);t.state.activeLines=n})}function o(e,t){i(e,t.ranges)}r.defineOption("styleActiveLine",!1,function(e,t,n){n=n!=r.Init&&n;t!=n&&(n&&(e.off("beforeSelectionChange",o),c(e),delete e.state.activeLines),t&&(e.state.activeLines=[],i(e,e.listSelections()),e.on("beforeSelectionChange",o)))})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(i){"use strict";var g,v,y=i.Pos;function p(e,t){for(var n,r,n=null!=(r=(n=e).flags)?r:(n.ignoreCase?"i":"")+(n.global?"g":"")+(n.multiline?"m":""),i=n,o=0;o<t.length;o++)-1==i.indexOf(t.charAt(o))&&(i+=t.charAt(o));return n==i?e:new RegExp(e.source,i)}function m(e){return/\\s|\\n|\n|\\W|\\D|\[\^/.test(e.source)}function h(e,t,n){t=p(t,"g");for(var r=n.line,i=n.ch,o=e.lastLine();r<=o;r++,i=0){t.lastIndex=i;var a=e.getLine(r),a=t.exec(a);if(a)return{from:y(r,a.index),to:y(r,a.index+a[0].length),match:a}}}function o(e,t,n){if(!m(t))return h(e,t,n);t=p(t,"gm");for(var r=1,i=n.line,o=e.lastLine();i<=o;){for(var a=0;a<r&&!(o<i);a++)var s=e.getLine(i++),l=null==l?s:l+"\n"+s;r*=2,t.lastIndex=n.ch;var c=t.exec(l);if(c){var u=l.slice(0,c.index).split("\n"),d=c[0].split("\n"),f=n.line+u.length-1,u=u[u.length-1].length;return{from:y(f,u),to:y(f+d.length-1,1==d.length?u+d[0].length:d[d.length-1].length),match:c}}}}function b(e,t,n){for(var r,i=0;i<=e.length;){t.lastIndex=i;var o=t.exec(e);if(!o)break;var a=o.index+o[0].length;if(a>e.length-n)break;(!r||a>r.index+r[0].length)&&(r=o),i=o.index+1}return r}function k(e,t,n){t=p(t,"g");for(var r=n.line,i=n.ch,o=e.firstLine();o<=r;r--,i=-1){var a=e.getLine(r),a=b(a,t,i<0?0:a.length-i);if(a)return{from:y(r,a.index),to:y(r,a.index+a[0].length),match:a}}}function a(e,t,n){if(!m(t))return k(e,t,n);t=p(t,"gm");for(var r=1,i=e.getLine(n.line).length-n.ch,o=n.line,a=e.firstLine();a<=o;){for(var s=0;s<r&&a<=o;s++)var l=e.getLine(o--),c=null==c?l:l+"\n"+c;r*=2;var u=b(c,t,i);if(u){var d=c.slice(0,u.index).split("\n"),f=u[0].split("\n"),h=o+d.length,d=d[d.length-1].length;return{from:y(h,d),to:y(h+f.length-1,1==f.length?d+f[0].length:f[f.length-1].length),match:u}}}}function x(e,t,n,r){if(e.length==t.length)return n;for(var i=0,o=n+Math.max(0,e.length-t.length);;){if(i==o)return i;var a=i+o>>1,s=r(e.slice(0,a)).length;if(s==n)return a;n<s?o=a:i=1+a}}function s(e,t,n,r){if(!t.length)return null;var i=r?g:v,o=i(t).split(/\r|\n\r?/);e:for(var a=n.line,s=n.ch,l=e.lastLine()+1-o.length;a<=l;a++,s=0){var c=e.getLine(a).slice(s),u=i(c);if(1==o.length){var d=u.indexOf(o[0]);if(-1!=d){n=x(c,u,d,i)+s;return{from:y(a,x(c,u,d,i)+s),to:y(a,x(c,u,d+o[0].length,i)+s)}}}else{var f=u.length-o[0].length;if(u.slice(f)==o[0]){for(var h=1;h<o.length-1;h++)if(i(e.getLine(a+h))!=o[h])continue e;var p=e.getLine(a+o.length-1),m=i(p),d=o[o.length-1];if(m.slice(0,d.length)==d)return{from:y(a,x(c,u,f,i)+s),to:y(a+o.length-1,x(p,m,d.length,i))}}}}}function l(e,t,n,r){if(!t.length)return null;var i=r?g:v,o=i(t).split(/\r|\n\r?/);e:for(var a=n.line,s=n.ch,l=e.firstLine()-1+o.length;l<=a;a--,s=-1){var c=e.getLine(a),u=i(c=-1<s?c.slice(0,s):c);if(1==o.length){var d=u.lastIndexOf(o[0]);if(-1!=d)return{from:y(a,x(c,u,d,i)),to:y(a,x(c,u,d+o[0].length,i))}}else{var f=o[o.length-1];if(u.slice(0,f.length)==f){for(var h=1,n=a-o.length+1;h<o.length-1;h++)if(i(e.getLine(n+h))!=o[h])continue e;var p=e.getLine(a+1-o.length),d=i(p);if(d.slice(d.length-o[0].length)==o[0])return{from:y(a+1-o.length,x(p,d,p.length-o[0].length,i)),to:y(a,x(c,u,f.length,i))}}}}}function r(n,r,e,t){var i;this.atOccurrence=!1,this.doc=n,e=e?n.clipPos(e):y(0,0),this.pos={from:e,to:e},"object"==typeof t?i=t.caseFold:(i=t,t=null),"string"==typeof r?(null==i&&(i=!1),this.matches=function(e,t){return(e?l:s)(n,r,t,i)}):(r=p(r,"gm"),t&&!1===t.multiline?this.matches=function(e,t){return(e?k:h)(n,r,t)}:this.matches=function(e,t){return(e?a:o)(n,r,t)})}v=String.prototype.normalize?(g=function(e){return e.normalize("NFD").toLowerCase()},function(e){return e.normalize("NFD")}):(g=function(e){return e.toLowerCase()},function(e){return e}),r.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){for(var t=this.matches(e,this.doc.clipPos(e?this.pos.from:this.pos.to));t&&0==i.cmpPos(t.from,t.to);)e?t.from.ch?t.from=y(t.from.line,t.from.ch-1):t=t.from.line==this.doc.firstLine()?null:this.matches(e,this.doc.clipPos(y(t.from.line-1))):t.to.ch<this.doc.getLine(t.to.line).length?t.to=y(t.to.line,t.to.ch+1):t=t.to.line==this.doc.lastLine()?null:this.matches(e,y(t.to.line+1,0));if(t)return this.pos=t,this.atOccurrence=!0,this.pos.match||!0;var n=y(e?this.doc.firstLine():this.doc.lastLine()+1,0);return this.pos={from:n,to:n},this.atOccurrence=!1},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(e,t){this.atOccurrence&&(e=i.splitLines(e),this.doc.replaceRange(e,this.pos.from,this.pos.to,t),this.pos.to=y(this.pos.from.line+e.length-1,e[e.length-1].length+(1==e.length?this.pos.from.ch:0)))}},i.defineExtension("getSearchCursor",function(e,t,n){return new r(this.doc,e,t,n)}),i.defineDocExtension("getSearchCursor",function(e,t,n){return new r(this,e,t,n)}),i.defineExtension("selectMatches",function(e,t){for(var n=[],r=this.getSearchCursor(e,this.getCursor("from"),t);r.findNext()&&!(0<i.cmpPos(r.to(),this.getCursor("to")));)n.push({anchor:r.from(),head:r.to()});n.length&&this.setSelections(n,0)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],e):e(CodeMirror)}(function(d){"use strict";function t(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null}function f(e){return e.state.search||(e.state.search=new t)}function i(e){return"string"==typeof e&&e==e.toLowerCase()}function h(e,t,n){return e.getSearchCursor(t,n,{caseFold:i(t),multiline:!0})}function p(e,t,n,r,i){e.openDialog?e.openDialog(t,i,{value:r,selectValueOnOpen:!0,bottom:e.options.search.bottom}):i(prompt(n,r))}function m(e){return e.replace(/\\([nrt\\])/g,function(e,t){return"n"==t?"\n":"r"==t?"\r":"t"==t?"\t":"\\"==t?"\\":e})}function o(e){var t=e.match(/^\/(.*)\/([a-z]*)$/);if(t)try{e=new RegExp(t[1],-1==t[2].indexOf("i")?"":"i")}catch(e){}else e=m(e);return e=("string"==typeof e?""==e:e.test(""))?/x^/:e}function g(e,t,n){var r;t.queryText=n,t.query=o(n),e.removeOverlay(t.overlay,i(t.query)),t.overlay=(r=t.query,n=i(t.query),"string"==typeof r?r=new RegExp(r.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),n?"gi":"g"):r.global||(r=new RegExp(r.source,r.ignoreCase?"gi":"g")),{token:function(e){r.lastIndex=e.pos;var t=r.exec(e.string);if(t&&t.index==e.pos)return e.pos+=t[0].length||1,"searching";t?e.pos=t.index:e.skipToEnd()}}),e.addOverlay(t.overlay),e.showMatchesOnScrollbar&&(t.annotate&&(t.annotate.clear(),t.annotate=null),t.annotate=e.showMatchesOnScrollbar(t.query,i(t.query)))}function n(i,t,e,n){var r=f(i);if(r.query)return v(i,t);var o,a,s,l,c,u=i.getSelection()||r.lastQuery;u instanceof RegExp&&"x^"==u.source&&(u=null),e&&i.openDialog?(o=null,a=function(e,t){d.e_stop(t),e&&(e!=r.queryText&&(g(i,r,e),r.posFrom=r.posTo=i.getCursor()),o&&(o.style.opacity=1),v(i,t.shiftKey,function(e,t){var n;t.line<3&&document.querySelector&&(n=i.display.wrapper.querySelector(".CodeMirror-dialog"))&&n.getBoundingClientRect().bottom-4>i.cursorCoords(t,"window").top&&((o=n).style.opacity=.4)}))},l=k(s=i),c=u,e=function(e,t){var n=d.keyName(e),r=i.getOption("extraKeys"),n=r&&r[n]||d.keyMap[i.getOption("keyMap")][n];"findNext"==n||"findPrev"==n||"findPersistentNext"==n||"findPersistentPrev"==n?(d.e_stop(e),g(i,f(i),t),i.execCommand(n)):"find"!=n&&"findPersistent"!=n||(d.e_stop(e),a(t,e))},s.openDialog(l,a,{value:c,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){y(s)},onKeyDown:e,bottom:s.options.search.bottom}),n&&u&&(g(i,r,u),v(i,t))):p(i,k(i),"Search for:",u,function(e){e&&!r.query&&i.operation(function(){g(i,r,e),r.posFrom=r.posTo=i.getCursor(),v(i,t)})})}function v(n,r,i){n.operation(function(){var e=f(n),t=h(n,e.query,r?e.posFrom:e.posTo);(t.find(r)||(t=h(n,e.query,r?d.Pos(n.lastLine()):d.Pos(n.firstLine(),0))).find(r))&&(n.setSelection(t.from(),t.to()),n.scrollIntoView({from:t.from(),to:t.to()},20),e.posFrom=t.from(),e.posTo=t.to(),i&&i(t.from(),t.to()))})}function y(t){t.operation(function(){var e=f(t);e.lastQuery=e.query,e.query&&(e.query=e.queryText=null,t.removeOverlay(e.overlay),e.annotate&&(e.annotate.clear(),e.annotate=null))})}function b(e,t){var n,r=e?document.createElement(e):document.createDocumentFragment();for(n in t)r[n]=t[n];for(var i=2;i<arguments.length;i++){var o=arguments[i];r.appendChild("string"==typeof o?document.createTextNode(o):o)}return r}function k(e){return b("",null,b("span",{className:"CodeMirror-search-label"},e.phrase("Search:"))," ",b("input",{type:"text",style:"width: 10em",className:"CodeMirror-search-field"})," ",b("span",{style:"color: #888",className:"CodeMirror-search-hint"},e.phrase("(Use /re/ syntax for regexp search)")))}function x(t,r,i){t.operation(function(){for(var n,e=h(t,r);e.findNext();)"string"!=typeof r?(n=t.getRange(e.from(),e.to()).match(r),e.replace(i.replace(/\$(\d)/g,function(e,t){return n[t]}))):e.replace(i)})}function r(u,e){var t,n,r;u.getOption("readOnly")||(t=u.getSelection()||f(u).lastQuery,r=b("",null,b("span",{className:"CodeMirror-search-label"},n=e?u.phrase("Replace all:"):u.phrase("Replace:")),(r=u,b("",null," ",b("input",{type:"text",style:"width: 10em",className:"CodeMirror-search-field"})," ",b("span",{style:"color: #888",className:"CodeMirror-search-hint"},r.phrase("(Use /re/ syntax for regexp search)"))))),p(u,r,n,t,function(c){c&&(c=o(c),p(u,b("",null,b("span",{className:"CodeMirror-search-label"},u.phrase("With:"))," ",b("input",{type:"text",style:"width: 10em",className:"CodeMirror-search-field"})),u.phrase("Replace with:"),"",function(o){var a,s,l;o=m(o),e?x(u,c,o):(y(u),a=h(u,c,u.getCursor("from")),s=function(){var e,t,n,r,i=a.from();!(e=a.findNext())&&(a=h(u,c),!(e=a.findNext())||i&&a.from().line==i.line&&a.from().ch==i.ch)||(u.setSelection(a.from(),a.to()),u.scrollIntoView({from:a.from(),to:a.to()}),n=b("",null,b("span",{className:"CodeMirror-search-label"},(r=t=u).phrase("Replace?"))," ",b("button",{},r.phrase("Yes"))," ",b("button",{},r.phrase("No"))," ",b("button",{},r.phrase("All"))," ",b("button",{},r.phrase("Stop"))),i=u.phrase("Replace?"),r=[function(){l(e)},s,function(){x(u,c,o)}],t.openConfirm?t.openConfirm(n,r):confirm(i)&&r[0]())},l=function(n){a.replace("string"==typeof c?o:o.replace(/\$(\d)/g,function(e,t){return n[t]})),s()},s())}))}))}d.defineOption("search",{bottom:!1}),d.commands.find=function(e){y(e),n(e)},d.commands.findPersistent=function(e){y(e),n(e,!1,!0)},d.commands.findPersistentNext=function(e){n(e,!1,!0,!0)},d.commands.findPersistentPrev=function(e){n(e,!0,!0,!0)},d.commands.findNext=n,d.commands.findPrev=function(e){n(e,!0)},d.commands.clearSearch=y,d.commands.replace=r,d.commands.replaceAll=function(e){r(e,!0)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(d){function f(e,t,n){var r=e.getWrapperElement(),e=r.appendChild(document.createElement("div"));return e.className=n?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top","string"==typeof t?e.innerHTML=t:e.appendChild(t),d.addClass(r,"dialog-opened"),e}function h(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}d.defineExtension("openDialog",function(e,t,n){n=n||{},h(this,null);var r=f(this,e,n.bottom),i=!1,o=this;function a(e){"string"==typeof e?s.value=e:i||(i=!0,d.rmClass(r.parentNode,"dialog-opened"),r.parentNode.removeChild(r),o.focus(),n.onClose&&n.onClose(r))}var s=r.getElementsByTagName("input")[0];return s?(s.focus(),n.value&&(s.value=n.value,!1!==n.selectValueOnOpen&&s.select()),n.onInput&&d.on(s,"input",function(e){n.onInput(e,s.value,a)}),n.onKeyUp&&d.on(s,"keyup",function(e){n.onKeyUp(e,s.value,a)}),d.on(s,"keydown",function(e){n&&n.onKeyDown&&n.onKeyDown(e,s.value,a)||((27==e.keyCode||!1!==n.closeOnEnter&&13==e.keyCode)&&(s.blur(),d.e_stop(e),a()),13==e.keyCode&&t(s.value,e))}),!1!==n.closeOnBlur&&d.on(r,"focusout",function(e){null!==e.relatedTarget&&a()})):(e=r.getElementsByTagName("button")[0])&&(d.on(e,"click",function(){a(),o.focus()}),!1!==n.closeOnBlur&&d.on(e,"blur",a),e.focus()),a}),d.defineExtension("openConfirm",function(e,t,n){h(this,null);var r=f(this,e,n&&n.bottom),i=r.getElementsByTagName("button"),o=!1,a=this,s=1;function l(){o||(o=!0,d.rmClass(r.parentNode,"dialog-opened"),r.parentNode.removeChild(r),a.focus())}i[0].focus();for(var c=0;c<i.length;++c){var u=i[c];!function(t){d.on(u,"click",function(e){d.e_preventDefault(e),l(),t&&t(a)})}(t[c]),d.on(u,"blur",function(){--s,setTimeout(function(){s<=0&&l()},200)}),d.on(u,"focus",function(){++s})}}),d.defineExtension("openNotification",function(e,t){h(this,o);var n,r=f(this,e,t&&t.bottom),i=!1,t=t&&void 0!==t.duration?t.duration:5e3;function o(){i||(i=!0,clearTimeout(n),d.rmClass(r.parentNode,"dialog-opened"),r.parentNode.removeChild(r))}return d.on(r,"click",function(e){d.e_preventDefault(e),o()}),t&&(n=setTimeout(o,t)),o})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(s){"use strict";function r(e,t,n){this.orientation=t,this.scroll=n,this.screen=this.total=this.size=1,this.pos=0,this.node=document.createElement("div"),this.node.className=e+"-"+t,this.inner=this.node.appendChild(document.createElement("div"));var a=this;function r(e){var t=s.wheelEventPixels(e)["horizontal"==a.orientation?"x":"y"],n=a.pos;a.moveTo(a.pos+t),a.pos!=n&&s.e_preventDefault(e)}s.on(this.inner,"mousedown",function(e){var t,n,r;function i(){s.off(document,"mousemove",o),s.off(document,"mouseup",i)}function o(e){if(1!=e.which)return i();a.moveTo(r+(e[t]-n)*(a.total/a.size))}1==e.which&&(s.e_preventDefault(e),t="horizontal"==a.orientation?"pageX":"pageY",n=e[t],r=a.pos,s.on(document,"mousemove",o),s.on(document,"mouseup",i))}),s.on(this.node,"click",function(e){s.e_preventDefault(e);var t=a.inner.getBoundingClientRect(),t="horizontal"==a.orientation?e.clientX<t.left?-1:e.clientX>t.right?1:0:e.clientY<t.top?-1:e.clientY>t.bottom?1:0;a.moveTo(a.pos+t*a.screen)}),s.on(this.node,"mousewheel",r),s.on(this.node,"DOMMouseScroll",r)}r.prototype.setPos=function(e,t){return(e=e<0?0:e)>this.total-this.screen&&(e=this.total-this.screen),!(!t&&e==this.pos)&&(this.pos=e,this.inner.style["horizontal"==this.orientation?"left":"top"]=e*(this.size/this.total)+"px",!0)},r.prototype.moveTo=function(e){this.setPos(e)&&this.scroll(e,this.orientation)};function n(e,t,n){this.addClass=e,this.horiz=new r(e,"horizontal",n),t(this.horiz.node),this.vert=new r(e,"vertical",n),t(this.vert.node),this.width=null}r.prototype.update=function(e,t,n){var r=this.screen!=t||this.total!=e||this.size!=n;r&&(this.screen=t,this.total=e,this.size=n);n=this.screen*(this.size/this.total);n<10&&(this.size-=10-n,n=10),this.inner.style["horizontal"==this.orientation?"width":"height"]=n+"px",this.setPos(this.pos,r)},n.prototype.update=function(e){null!=this.width||(r=window.getComputedStyle?window.getComputedStyle(this.horiz.node):this.horiz.node.currentStyle)&&(this.width=parseInt(r.height));var t=this.width||0,n=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1;return this.vert.node.style.display=r?"block":"none",this.horiz.node.style.display=n?"block":"none",r&&(this.vert.update(e.scrollHeight,e.clientHeight,e.viewHeight-(n?t:0)),this.vert.node.style.bottom=n?t+"px":"0"),n&&(this.horiz.update(e.scrollWidth,e.clientWidth,e.viewWidth-(r?t:0)-e.barLeft),this.horiz.node.style.right=r?t+"px":"0",this.horiz.node.style.left=e.barLeft+"px"),{right:r?t:0,bottom:n?t:0}},n.prototype.setScrollTop=function(e){this.vert.setPos(e)},n.prototype.setScrollLeft=function(e){this.horiz.setPos(e)},n.prototype.clear=function(){var e=this.horiz.node.parentNode;e.removeChild(this.horiz.node),e.removeChild(this.vert.node)},s.scrollbarModel.simple=function(e,t){return new n("CodeMirror-simplescroll",e,t)},s.scrollbarModel.overlay=function(e,t){return new n("CodeMirror-overlayscroll",e,t)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var x={},w=/[^\s\u00a0]/,C=e.Pos,p=e.cmpPos;function f(e){e=e.search(w);return-1==e?0:e}function S(e,t){var n=e.getMode();return!1!==n.useInnerComments&&n.innerMode?e.getModeAt(t):n}e.commands.toggleComment=function(e){e.toggleComment()},e.defineExtension("toggleComment",function(e){e=e||x;for(var t=1/0,n=this.listSelections(),r=null,i=n.length-1;0<=i;i--){var o=n[i].from(),a=n[i].to();o.line>=t||(a.line>=t&&(a=C(t,0)),t=o.line,null==r?r=this.uncomment(o,a,e)?"un":(this.lineComment(o,a,e),"line"):"un"==r?this.uncomment(o,a,e):this.lineComment(o,a,e))}}),e.defineExtension("lineComment",function(o,e,a){a=a||x;var s,l,c,u,d=this,t=S(d,o),n=d.getLine(o.line);null!=n&&(n=n,!/\bstring\b/.test(d.getTokenTypeAt(C(o.line,0)))||/^[\'\"\`]/.test(n))&&((s=a.lineComment||t.lineComment)?(l=Math.min(0!=e.ch||e.line==o.line?e.line+1:e.line,d.lastLine()+1),c=null==a.padding?" ":a.padding,u=a.commentBlankLines||o.line==e.line,d.operation(function(){if(a.indent){for(var e=null,t=o.line;t<l;++t){var n=(r=d.getLine(t)).slice(0,f(r));(null==e||e.length>n.length)&&(e=n)}for(t=o.line;t<l;++t){var r=d.getLine(t),i=e.length;(u||w.test(r))&&(r.slice(0,i)!=e&&(i=f(r)),d.replaceRange(e+s+c,C(t,0),C(t,i)))}}else for(t=o.line;t<l;++t)(u||w.test(d.getLine(t)))&&d.replaceRange(s+c,C(t,0))})):(a.blockCommentStart||t.blockCommentStart)&&(a.fullLines=!0,d.blockComment(o,e,a)))}),e.defineExtension("blockComment",function(o,a,s){s=s||x;var l,c,u=this,d=S(u,o),f=s.blockCommentStart||d.blockCommentStart,h=s.blockCommentEnd||d.blockCommentEnd;f&&h?/\bcomment\b/.test(u.getTokenTypeAt(C(o.line,0)))||((l=Math.min(a.line,u.lastLine()))!=o.line&&0==a.ch&&w.test(u.getLine(l))&&--l,c=null==s.padding?" ":s.padding,o.line>l||u.operation(function(){if(0!=s.fullLines){var e=w.test(u.getLine(l));u.replaceRange(c+h,C(l)),u.replaceRange(f+c,C(o.line,0));var t=s.blockCommentLead||d.blockCommentLead;if(null!=t)for(var n=o.line+1;n<=l;++n)n==l&&!e||u.replaceRange(t+c,C(n,0))}else{var r=0==p(u.getCursor("to"),a),i=!u.somethingSelected();u.replaceRange(h,a),r&&u.setSelection(i?a:u.getCursor("from"),a),u.replaceRange(f,o)}})):(s.lineComment||d.lineComment)&&0!=s.fullLines&&u.lineComment(o,a,s)}),e.defineExtension("uncomment",function(e,t,n){n=n||x;var i,o=this,r=S(o,e),a=Math.min(0!=t.ch||t.line==e.line?t.line:t.line-1,o.lastLine()),s=Math.min(e.line,a),l=n.lineComment||r.lineComment,c=[],u=null==n.padding?" ":n.padding;e:if(l){for(var d=s;d<=a;++d){var f=o.getLine(d),h=f.indexOf(l);if(-1==(h=-1<h&&!/comment/.test(o.getTokenTypeAt(C(d,h+1)))?-1:h)&&w.test(f))break e;if(-1<h&&w.test(f.slice(0,h)))break e;c.push(f)}if(o.operation(function(){for(var e=s;e<=a;++e){var t=c[e-s],n=t.indexOf(l),r=n+l.length;n<0||(t.slice(r,r+u.length)==u&&(r+=u.length),i=!0,o.replaceRange("",C(e,n),C(e,r)))}}),i)return!0}var p=n.blockCommentStart||r.blockCommentStart,m=n.blockCommentEnd||r.blockCommentEnd;if(!p||!m)return!1;var g=n.blockCommentLead||r.blockCommentLead,v=o.getLine(s),y=v.indexOf(p);if(-1==y)return!1;var b=a==s?v:o.getLine(a),k=b.indexOf(m,a==s?y+p.length:0),n=C(s,y+1),r=C(a,k+1);if(-1==k||!/comment/.test(o.getTokenTypeAt(n))||!/comment/.test(o.getTokenTypeAt(r))||-1<o.getRange(n,r,"\n").indexOf(m))return!1;r=-1==(n=v.lastIndexOf(p,e.ch))?-1:v.slice(0,e.ch).indexOf(m,n+p.length);if(-1!=n&&-1!=r&&r+m.length!=e.ch)return!1;r=b.indexOf(m,t.ch),e=b.slice(t.ch).lastIndexOf(p,r-t.ch),n=-1==r||-1==e?-1:t.ch+e;return(-1==r||-1==n||n==t.ch)&&(o.operation(function(){o.replaceRange("",C(a,k-(u&&b.slice(k-u.length,k)==u?u.length:0)),C(a,k+m.length));var e=y+p.length;if(u&&v.slice(e,e+u.length)==u&&(e+=u.length),o.replaceRange("",C(s,y),C(s,e)),g)for(var t=s+1;t<=a;++t){var n,r=o.getLine(t),i=r.indexOf(g);-1==i||w.test(r.slice(0,i))||(n=i+g.length,u&&r.slice(n,n+u.length)==u&&(n+=u.length),o.replaceRange("",C(t,i),C(t,n)))}}),!0)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(u){"use strict";function i(i,o,e,a){var s;e&&e.call?(s=e,e=null):s=d(i,e,"rangeFinder"),"number"==typeof o&&(o=u.Pos(o,0));var l=d(i,e,"minFoldSize");function t(e){var t=s(i,o);if(!t||t.to.line-t.from.line<l)return null;if("fold"===a)return t;for(var n=i.findMarksAt(t.from),r=0;r<n.length;++r)if(n[r].__isFold){if(!e)return null;t.cleared=!0,n[r].clear()}return t}var n,r,c=t(!0);if(d(i,e,"scanUp"))for(;!c&&o.line>i.firstLine();)o=u.Pos(o.line-1,0),c=t(!1);c&&!c.cleared&&"unfold"!==a&&(n=function(e,t,n){t=d(e,t,"widget");"function"==typeof t&&(t=t(n.from,n.to));"string"==typeof t?(n=document.createTextNode(t),(t=document.createElement("span")).appendChild(n),t.className="CodeMirror-foldmarker"):t=t&&t.cloneNode(!0);return t}(i,e,c),u.on(n,"mousedown",function(e){r.clear(),u.e_preventDefault(e)}),(r=i.markText(c.from,c.to,{replacedWith:n,clearOnEnter:d(i,e,"clearOnEnter"),__isFold:!0})).on("clear",function(e,t){u.signal(i,"unfold",i,e,t)}),u.signal(i,"fold",i,c.from,c.to))}u.newFoldFunction=function(n,r){return function(e,t){i(e,t,{rangeFinder:n,widget:r})}},u.defineExtension("foldCode",function(e,t,n){i(this,e,t,n)}),u.defineExtension("isFolded",function(e){for(var t=this.findMarksAt(e),n=0;n<t.length;++n)if(t[n].__isFold)return!0}),u.commands.toggleFold=function(e){e.foldCode(e.getCursor())},u.commands.fold=function(e){e.foldCode(e.getCursor(),null,"fold")},u.commands.unfold=function(e){e.foldCode(e.getCursor(),{scanUp:!1},"unfold")},u.commands.foldAll=function(n){n.operation(function(){for(var e=n.firstLine(),t=n.lastLine();e<=t;e++)n.foldCode(u.Pos(e,0),{scanUp:!1},"fold")})},u.commands.unfoldAll=function(n){n.operation(function(){for(var e=n.firstLine(),t=n.lastLine();e<=t;e++)n.foldCode(u.Pos(e,0),{scanUp:!1},"unfold")})},u.registerHelper("fold","combine",function(){var i=Array.prototype.slice.call(arguments,0);return function(e,t){for(var n=0;n<i.length;++n){var r=i[n](e,t);if(r)return r}}}),u.registerHelper("fold","auto",function(e,t){for(var n=e.getHelpers(t,"fold"),r=0;r<n.length;r++){var i=n[r](e,t);if(i)return i}});var r={rangeFinder:u.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1,clearOnEnter:!0};function d(e,t,n){if(t&&void 0!==t[n])return t[n];e=e.options.foldOptions;return(e&&void 0!==e[n]?e:r)[n]}u.defineOption("foldOptions",null),u.defineExtension("foldOption",function(e,t){return d(this,e,t)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./foldcode")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./foldcode"],e):e(CodeMirror)}(function(r){"use strict";r.defineOption("foldGutter",!1,function(e,t,n){n&&n!=r.Init&&(e.clearGutter(e.state.foldGutter.options.gutter),e.state.foldGutter=null,e.off("gutterClick",s),e.off("changes",l),e.off("viewportChange",c),e.off("fold",u),e.off("unfold",u),e.off("swapDoc",l)),t&&(e.state.foldGutter=new i(function(e){!0===e&&(e={});null==e.gutter&&(e.gutter="CodeMirror-foldgutter");null==e.indicatorOpen&&(e.indicatorOpen="CodeMirror-foldgutter-open");null==e.indicatorFolded&&(e.indicatorFolded="CodeMirror-foldgutter-folded");return e}(t)),a(e),e.on("gutterClick",s),e.on("changes",l),e.on("viewportChange",c),e.on("fold",u),e.on("unfold",u),e.on("swapDoc",l))});var d=r.Pos;function i(e){this.options=e,this.from=this.to=0}function f(e,t){for(var n=e.findMarks(d(t,0),d(t+1,0)),r=0;r<n.length;++r)if(n[r].__isFold){var i=n[r].find(-1);if(i&&i.line===t)return n[r]}}function h(e){if("string"!=typeof e)return e.cloneNode(!0);var t=document.createElement("div");return t.className=e+" CodeMirror-guttermarker-subtle",t}function o(i,e,t){var o=i.state.foldGutter.options,a=e-1,s=i.foldOption(o,"minFoldSize"),l=i.foldOption(o,"rangeFinder"),c="string"==typeof o.indicatorFolded&&n(o.indicatorFolded),u="string"==typeof o.indicatorOpen&&n(o.indicatorOpen);i.eachLine(e,t,function(e){++a;var t=null,n=(n=e.gutterMarkers)&&n[o.gutter];if(f(i,a)){if(c&&n&&c.test(n.className))return;t=h(o.indicatorFolded)}else{var r=d(a,0),r=l&&l(i,r);if(r&&r.to.line-r.from.line>=s){if(u&&n&&u.test(n.className))return;t=h(o.indicatorOpen)}}(t||n)&&i.setGutterMarker(e,o.gutter,t)})}function n(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function a(e){var t=e.getViewport(),n=e.state.foldGutter;n&&(e.operation(function(){o(e,t.from,t.to)}),n.from=t.from,n.to=t.to)}function s(e,t,n){var r=e.state.foldGutter;!r||n==(n=r.options).gutter&&((r=f(e,t))?r.clear():e.foldCode(d(t,0),n))}function l(e){var t,n=e.state.foldGutter;n&&(t=n.options,n.from=n.to=0,clearTimeout(n.changeUpdate),n.changeUpdate=setTimeout(function(){a(e)},t.foldOnChangeTimeSpan||600))}function c(t){var e,n=t.state.foldGutter;n&&(e=n.options,clearTimeout(n.changeUpdate),n.changeUpdate=setTimeout(function(){var e=t.getViewport();n.from==n.to||20<e.from-n.to||20<n.from-e.to?a(t):t.operation(function(){e.from<n.from&&(o(t,e.from,n.from),n.from=e.from),e.to>n.to&&(o(t,n.to,e.to),n.to=e.to)})},e.updateViewportTimeSpan||400))}function u(e,t){var n=e.state.foldGutter;!n||(t=t.line)>=n.from&&t<n.to&&o(e,t,t+1)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var l=e.Pos;function s(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 c(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 u(e,t){t=e.cm.getTokenTypeAt(l(e.line,t));return t&&/\btag\b/.test(t)}function i(e){return!(e.line>=e.max)&&(e.ch=0,e.text=e.cm.getLine(++e.line),1)}function d(e){return!(e.line<=e.min)&&(e.text=e.cm.getLine(--e.line),e.ch=e.text.length,1)}function f(e){for(;;){var t=e.text.indexOf(">",e.ch);if(-1==t){if(i(e))continue;return}if(u(e,t+1)){var n=e.text.lastIndexOf("/",t),n=-1<n&&!/\S/.test(e.text.slice(n+1,t));return e.ch=t+1,n?"selfClose":"regular"}e.ch=t+1}}function h(e){for(;;){var t=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==t){if(d(e))continue;return}if(u(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 p(e){for(;;){r.lastIndex=e.ch;var t=r.exec(e.text);if(!t){if(i(e))continue;return}if(u(e,t.index+1))return e.ch=t.index+t[0].length,t;e.ch=t.index+1}}function m(e,t){for(var n=[];;){var r,i=p(e),o=e.line,a=e.ch-(i?i[0].length:0);if(!i||!(r=f(e)))return;if("selfClose"!=r)if(i[1]){for(var s=n.length-1;0<=s;--s)if(n[s]==i[2]){n.length=s;break}if(s<0&&(!t||t==i[2]))return{tag:i[2],from:l(o,a),to:l(e.line,e.ch)}}else n.push(i[2])}}function g(e,t){for(var n=[];;){var r=function(e){for(;;){var t=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==t){if(d(e))continue;return}if(u(e,t+1)){var n=e.text.lastIndexOf("/",t),n=-1<n&&!/\S/.test(e.text.slice(n+1,t));return e.ch=t+1,n?"selfClose":"regular"}e.ch=t}}(e);if(!r)return;if("selfClose"!=r){var i=e.line,r=e.ch,o=h(e);if(!o)return;if(o[1])n.push(o[2]);else{for(var a=n.length-1;0<=a;--a)if(n[a]==o[2]){n.length=a;break}if(a<0&&(!t||t==o[2]))return{tag:o[2],from:l(e.line,e.ch),to:l(i,r)}}}else h(e)}}e.registerHelper("fold","xml",function(e,t){for(var n=new c(e,t.line,0);;){var r=p(n);if(!r||n.line!=t.line)return;var i=f(n);if(!i)return;if(!r[1]&&"selfClose"!=i){i=l(n.line,n.ch),r=m(n,r[2]);return r&&0<s(r.from,i)?{from:i,to:r.from}:null}}}),e.findMatchingTag=function(e,t,n){var r=new c(e,t.line,t.ch,n);if(-1!=r.text.indexOf(">")||-1!=r.text.indexOf("<")){var i=f(r),o=i&&l(r.line,r.ch),a=i&&h(r);if(i&&a&&!(0<s(r,t))){t={from:l(r.line,r.ch),to:o,tag:a[2]};return"selfClose"==i?{open:t,close:null,at:"open"}:a[1]?{open:g(r,a[2]),close:t,at:"close"}:{open:t,close:m(r=new c(e,o.line,o.ch,n),a[2]),at:"open"}}}},e.findEnclosingTag=function(e,t,n,r){for(var i=new c(e,t.line,t.ch,n);;){var o=g(i,r);if(!o)break;var a=m(new c(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 c(e,t.line,t.ch,r?{from:0,to:r}:null),n)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(s){"use strict";function l(e,t){var n=e.getLine(t),r=n.search(/\S/);return-1==r||/\bcomment\b/.test(e.getTokenTypeAt(s.Pos(t,r+1)))?-1:s.countColumn(n,null,e.getOption("tabSize"))}s.registerHelper("fold","indent",function(e,t){var n=l(e,t.line);if(!(n<0)){for(var r=null,i=t.line+1,o=e.lastLine();i<=o;++i){var a=l(e,i);if(-1!=a){if(!(n<a))break;r=i}}return r?{from:s.Pos(t.line,e.getLine(t.line).length),to:s.Pos(r,e.getLine(r).length)}:void 0}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(r){var d=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),g=r.Pos,v={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function y(e){return e&&e.bracketRegex||/[(){}[\]]/}function f(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),o=!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(!o)return null;a=">"==o.charAt(1)?1:-1;if(n&&n.strict&&0<a!=(i==t.ch))return null;r=e.getTokenTypeAt(g(t.line,i+1)),n=s(e,g(t.line,i+(0<a?1:0)),a,r,n);return null==n?null:{from:g(t.line,i),to:n&&n.pos,match:n&&n.ch==o.charAt(0),forward:0<a}}function s(e,t,n,r,i){for(var o=i&&i.maxScanLineLength||1e4,a=i&&i.maxScanLines||1e3,s=[],l=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(l.test(p)&&(void 0===r||(e.getTokenTypeAt(g(u,f+1))||"")==(r||""))){var m=v[p];if(m&&">"==m.charAt(1)==0<n)s.push(p);else{if(!s.length)return{pos:g(u,f),ch:p};s.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=n&&n.highlightNonMatching,o=[],a=e.listSelections(),s=0;s<a.length;s++){var l,c=a[s].empty()&&f(e,a[s].head,n);c&&(c.match||!1!==i)&&e.getLine(c.from.line).length<=r&&(l=c.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",o.push(e.markText(c.from,g(c.from.line,c.from.ch+1),{className:l})),c.to&&e.getLine(c.to.line).length<=r&&o.push(e.markText(c.to,g(c.to.line,c.to.ch+1),{className:l})))}if(o.length){d&&e.state.focused&&e.focus();function u(){e.operation(function(){for(var e=0;e<o.length;e++)o[e].clear()})}if(!t)return u;setTimeout(u,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)})}function o(e){e.state.matchBrackets&&e.state.matchBrackets.currentlyHighlighted&&(e.state.matchBrackets.currentlyHighlighted(),e.state.matchBrackets.currentlyHighlighted=null)}r.defineOption("matchBrackets",!1,function(e,t,n){n&&n!=r.Init&&(e.off("cursorActivity",i),e.off("focus",i),e.off("blur",o),o(e)),t&&(e.state.matchBrackets="object"==typeof t?t:{},e.on("cursorActivity",i),e.on("focus",i),e.on("blur",o))}),r.defineExtension("matchBrackets",function(){t(this,!0)}),r.defineExtension("findMatchingBracket",function(e,t,n){return f(this,e,t=n||"boolean"==typeof t?n?(n.strict=t,n):t?{strict:!0}:null:t)}),r.defineExtension("scanForBracket",function(e,t,n,r){return s(this,e,t,n,r)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],e):e(CodeMirror)}(function(r){"use strict";function i(e){e.state.tagHit&&e.state.tagHit.clear(),e.state.tagOther&&e.state.tagOther.clear(),e.state.tagHit=e.state.tagOther=null}function o(n){n.state.failedTagMatch=!1,n.operation(function(){var e,t;i(n),n.somethingSelected()||(t=n.getCursor(),(e=n.getViewport()).from=Math.min(e.from,t.line),e.to=Math.max(t.line+1,e.to),(t=r.findMatchingTag(n,t,e))&&(!n.state.matchBothTags||(e="open"==t.at?t.open:t.close)&&(n.state.tagHit=n.markText(e.from,e.to,{className:"CodeMirror-matchingtag"})),(t="close"==t.at?t.open:t.close)?n.state.tagOther=n.markText(t.from,t.to,{className:"CodeMirror-matchingtag"}):n.state.failedTagMatch=!0))})}function a(e){e.state.failedTagMatch&&o(e)}r.defineOption("matchTags",!1,function(e,t,n){n&&n!=r.Init&&(e.off("cursorActivity",o),e.off("viewportChange",a),i(e)),t&&(e.state.matchBothTags="object"==typeof t&&t.bothTags,e.on("cursorActivity",o),e.on("viewportChange",a),o(e))}),r.commands.toMatchingTag=function(e){var t=r.findMatchingTag(e,e.getCursor());!t||(t="close"==t.at?t.open:t.close)&&e.extendSelection(t.to,t.from)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./matchesonscrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./matchesonscrollbar"],e):e(CodeMirror)}(function(r){"use strict";var n={style:"matchhighlight",minChars:2,delay:100,wordsOnly:!1,annotateScrollbar:!1,showToken:!1,trim:!0};function i(e){for(var t in this.options={},n)this.options[t]=(e&&e.hasOwnProperty(t)?e:n)[t];this.overlay=this.timeout=null,this.matchesonscroll=null,this.active=!1}function o(e){var t=e.state.matchHighlighter;(t.active||e.hasFocus())&&s(e,t)}function a(e){var t=e.state.matchHighlighter;t.active||(t.active=!0,s(e,t))}function s(e,t){clearTimeout(t.timeout),t.timeout=setTimeout(function(){l(e)},t.options.delay)}function c(e,t,n,r){var i,o,a,s=e.state.matchHighlighter;e.addOverlay(s.overlay=(i=t,o=n,a=r,{token:function(e){if(e.match(i)&&(!o||(n=o,!((t=e).start&&n.test(t.string.charAt(t.start-1))||t.pos!=t.string.length&&n.test(t.string.charAt(t.pos))))))return a;var t,n;e.next(),e.skipTo(i.charAt(0))||e.skipToEnd()}})),s.options.annotateScrollbar&&e.showMatchesOnScrollbar&&(t=n?new RegExp((/\w/.test(t.charAt(0))?"\\b":"")+t.replace(/[\\\[.+*?(){|^$]/g,"\\$&")+(/\w/.test(t.charAt(t.length-1))?"\\b":"")):t,s.matchesonscroll=e.showMatchesOnScrollbar(t,!1,{className:"CodeMirror-selection-highlight-scrollbar"}))}function u(e){var t=e.state.matchHighlighter;t.overlay&&(e.removeOverlay(t.overlay),t.overlay=null,t.matchesonscroll&&(t.matchesonscroll.clear(),t.matchesonscroll=null))}function l(l){l.operation(function(){var e=l.state.matchHighlighter;if(u(l),l.somethingSelected()||!e.options.showToken){var t=l.getCursor("from"),n=l.getCursor("to");t.line==n.line&&(e.options.wordsOnly&&!function(e,t,n){{if(null===e.getRange(t,n).match(/^\w+$/))return!1;if(0<t.ch){var r={line:t.line,ch:t.ch-1};if(null===e.getRange(r,t).match(/\W/))return!1}if(n.ch<e.getLine(t.line).length){r={line:n.line,ch:n.ch+1};if(null===e.getRange(n,r).match(/\W/))return!1}return!0}}(l,t,n)||(i=l.getRange(t,n),(i=e.options.trim?i.replace(/^\s+|\s+$/g,""):i).length>=e.options.minChars&&c(l,i,!1,e.options.style)))}else{for(var r=!0===e.options.showToken?/[\w$]/:e.options.showToken,i=l.getCursor(),o=l.getLine(i.line),a=i.ch,s=a;a&&r.test(o.charAt(a-1));)--a;for(;s<o.length&&r.test(o.charAt(s));)++s;a<s&&c(l,o.slice(a,s),r,e.options.style)}})}r.defineOption("highlightSelectionMatches",!1,function(e,t,n){n&&n!=r.Init&&(u(e),clearTimeout(e.state.matchHighlighter.timeout),e.state.matchHighlighter=null,e.off("cursorActivity",o),e.off("focus",a)),t&&(t=e.state.matchHighlighter=new i(t),e.hasFocus()?(t.active=!0,l(e)):e.on("focus",a),e.on("cursorActivity",o))})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],e):e(CodeMirror)}(function(v){v.defineOption("autoCloseTags",!1,function(e,t,n){n!=v.Init&&n&&e.removeKeyMap("autoCloseTags"),t&&(n={name:"autoCloseTags"},"object"==typeof t&&!1===t.whenClosing||(n["'/'"]=function(e){return(e=e).getOption("disableInput")?v.Pass:r(e,!0)}),"object"==typeof t&&!1===t.whenOpening||(n["'>'"]=function(e){if(e.getOption("disableInput"))return v.Pass;for(var t=e.listSelections(),n=[],r=e.getOption("autoCloseTags"),i=0;i<t.length;i++){if(!t[i].empty())return v.Pass;var o=t[i].head,a=e.getTokenAt(o),s=v.innerMode(e.getMode(),a.state),l=s.state,c=s.mode.xmlCurrentTag&&s.mode.xmlCurrentTag(l),u=c&&c.name;if(!u)return v.Pass;var d="html"==s.mode.configuration,f="object"==typeof r&&r.dontCloseTags||d&&y,h="object"==typeof r&&r.indentTags||d&&b,d=(u=a.end>o.ch?u.slice(0,u.length-a.end+o.ch):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<k(f,d)||x(e,s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(l)||[],u,o,!0))return v.Pass;l="object"==typeof r&&r.emptyTags;l&&-1<k(l,u)?n[i]={text:"/>",newPos:v.Pos(o.line,o.ch+2)}:(d=h&&-1<k(h,d),n[i]={indent:d,text:">"+(d?"\n\n":"")+"</"+u+">",newPos:d?v.Pos(o.line+1,0):v.Pos(o.line,o.ch+1)})}for(var p="object"==typeof r&&r.dontIndentOnAutoClose,i=t.length-1;0<=i;i--){var m=n[i];e.replaceRange(m.text,t[i].head,t[i].anchor,"+insert");var g=e.listSelections().slice(0);g[i]={head:m.newPos,anchor:m.newPos},e.setSelections(g),!p&&m.indent&&(e.indentLine(m.newPos.line,null,!0),e.indentLine(m.newPos.line+1,null,!0))}}),e.addKeyMap(n))});var y=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],b=["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 r(e,t){for(var n=e.listSelections(),r=[],i=t?"/":"</",o=e.getOption("autoCloseTags"),o="object"==typeof o&&o.dontIndentOnSlash,a=0;a<n.length;a++){if(!n[a].empty())return v.Pass;var s=n[a].head,l=e.getTokenAt(s),c=v.innerMode(e.getMode(),l.state),u=c.state;if(t&&("string"==l.type||"<"!=l.string.charAt(0)||l.start!=s.ch-1))return v.Pass;var d,f="xml"!=c.mode.name&&"htmlmixed"==e.getMode().name;if(f&&"javascript"==c.mode.name)d=i+"script";else if(f&&"css"==c.mode.name)d=i+"style";else{c=c.mode.xmlCurrentContext&&c.mode.xmlCurrentContext(u),u=c.length?c[c.length-1]:"";if(!c||c.length&&x(e,c,u,s))return v.Pass;d=i+u}">"!=e.getLine(s.line).charAt(l.end)&&(d+=">"),r[a]=d}if(e.replaceSelections(r),n=e.listSelections(),!o)for(a=0;a<n.length;a++)(a==n.length-1||n[a].head.line<n[a+1].head.line)&&e.indentLine(n[a].head.line)}function k(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 x(e,t,n,r,i){if(v.scanForClosingTag){var o=Math.min(e.lastLine()+1,r.line+500),a=v.scanForClosingTag(e,r,null,o);if(a&&a.tag==n){for(var s=i?1:0,l=t.length-1;0<=l&&t[l]==n;l--)++s;r=a.to;for(l=1;l<s;l++){var c=v.scanForClosingTag(e,r,null,o);if(!c||c.tag!=n)return;r=c.to}return 1}}}v.commands.closeTag=function(e){return r(e)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(y){var n={pairs:"()[]{}''\"\"",closeBefore:")]}'\":;>",triples:"",explode:"[]{}"},b=y.Pos;function k(e,t){return"pairs"==t&&"string"==typeof e?e:("object"==typeof e&&null!=e[t]?e:n)[t]}y.defineOption("autoCloseBrackets",!1,function(e,t,n){n&&n!=y.Init&&(e.removeKeyMap(i),e.state.closeBrackets=null),t&&(r(k(t,"pairs")),e.state.closeBrackets=t,e.addKeyMap(i))});var i={Backspace:function(e){var t=x(e);if(!t||e.getOption("disableInput"))return y.Pass;for(var n=k(t,"pairs"),r=e.listSelections(),i=0;i<r.length;i++){if(!r[i].empty())return y.Pass;var o=s(e,r[i].head);if(!o||n.indexOf(o)%2!=0)return y.Pass}for(i=r.length-1;0<=i;i--){var a=r[i].head;e.replaceRange("",b(a.line,a.ch-1),b(a.line,a.ch+1),"+delete")}},Enter:function(r){var e=x(r),t=e&&k(e,"explode");if(!t||r.getOption("disableInput"))return y.Pass;for(var i=r.listSelections(),n=0;n<i.length;n++){if(!i[n].empty())return y.Pass;var o=s(r,i[n].head);if(!o||t.indexOf(o)%2!=0)return y.Pass}r.operation(function(){var e=r.lineSeparator()||"\n";r.replaceSelection(e+e,null),w(r,-1),i=r.listSelections();for(var t=0;t<i.length;t++){var n=i[t].head.line;r.indentLine(n,null,!0),r.indentLine(n+1,null,!0)}})}};function r(e){for(var t=0;t<e.length;t++){var n=e.charAt(t),r="'"+n+"'";i[r]||(i[r]=function(t){return function(e){return function(i,e){var t=x(i);if(!t||i.getOption("disableInput"))return y.Pass;var n=k(t,"pairs"),r=n.indexOf(e);if(-1==r)return y.Pass;for(var o,a=k(t,"closeBefore"),s=k(t,"triples"),l=n.charAt(r+1)==e,c=i.listSelections(),u=r%2==0,d=0;d<c.length;d++){var f,h=c[d],p=h.head,m=i.getRange(p,b(p.line,p.ch+1));if(u&&!h.empty())f="surround";else if(!l&&u||m!=e)if(l&&1<p.ch&&0<=s.indexOf(e)&&i.getRange(b(p.line,p.ch-2),p)==e+e){if(2<p.ch&&/\bstring/.test(i.getTokenTypeAt(b(p.line,p.ch-2))))return y.Pass;f="addFour"}else if(l){h=0==p.ch?" ":i.getRange(b(p.line,p.ch-1),p);if(y.isWordChar(m)||h==e||y.isWordChar(h))return y.Pass;f="both"}else{if(!u||!(0===m.length||/\s/.test(m)||-1<a.indexOf(m)))return y.Pass;f="both"}else f=l&&function(e,t){var n=e.getTokenAt(b(t.line,t.ch+1));return/\bstring/.test(n.type)&&n.start==t.ch&&(0==t.ch||!/\bstring/.test(e.getTokenTypeAt(t)))}(i,p)?"both":0<=s.indexOf(e)&&i.getRange(p,b(p.line,p.ch+3))==e+e+e?"skipThree":"skip";if(o){if(o!=f)return y.Pass}else o=f}var g=r%2?n.charAt(r-1):e,v=r%2?e:n.charAt(r+1);i.operation(function(){if("skip"==o)w(i,1);else if("skipThree"==o)w(i,3);else if("surround"==o){for(var e=i.getSelections(),t=0;t<e.length;t++)e[t]=g+e[t]+v;i.replaceSelections(e,"around");for(e=i.listSelections().slice(),t=0;t<e.length;t++)e[t]=(n=e[t],r=void 0,r=0<y.cmpPos(n.anchor,n.head),{anchor:new b(n.anchor.line,n.anchor.ch+(r?-1:1)),head:new b(n.head.line,n.head.ch+(r?1:-1))});i.setSelections(e)}else"both"==o?(i.replaceSelection(g+v,null),i.triggerElectric(g+v),w(i,-1)):"addFour"==o&&(i.replaceSelection(g+g+g+g,"before"),w(i,1));var n,r})}(e,t)}}(n))}}function x(e){var t=e.state.closeBrackets;return t&&!t.override&&e.getModeAt(e.getCursor()).closeBrackets||t}function w(e,t){for(var n=[],r=e.listSelections(),i=0,o=0;o<r.length;o++){var a=r[o];a.head==e.getCursor()&&(i=o);a=a.head.ch||0<t?{line:a.head.line,ch:a.head.ch+t}:{line:a.head.line-1};n.push({anchor:a,head:a})}e.setSelections(n,i)}function s(e,t){t=e.getRange(b(t.line,t.ch-1),b(t.line,t.ch+1));return 2==t.length?t:null}r(n.pairs+"`")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/edit/matchbrackets")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/edit/matchbrackets"],e):e(CodeMirror)}(function(d){"use strict";var r=d.commands,f=d.Pos;function t(t,n){t.extendSelectionsBy(function(e){return t.display.shift||t.doc.extend||e.empty()?function(e,t,n){if(n<0&&0==t.ch)return e.clipPos(f(t.line-1));var r=e.getLine(t.line);if(0<n&&t.ch>=r.length)return e.clipPos(f(t.line+1,0));for(var i,o="start",a=t.ch,s=a,l=n<0?0:r.length;s!=l;s+=n,0){var c=r.charAt(n<0?s-1:s),u="_"!=c&&d.isWordChar(c)?"w":"o";if("w"==u&&c.toUpperCase()==c&&(u="W"),"start"==o)"o"!=u?(o="in",i=u):a=s+n;else if("in"==o&&i!=u){if("w"==i&&"W"==u&&n<0&&s--,"W"==i&&"w"==u&&0<n){if(s==a+1){i="w";continue}s--}break}}return f(t.line,s)}(t.doc,e.head,n):n<0?e.from():e.to()})}function n(a,s){if(a.isReadOnly())return d.Pass;a.operation(function(){for(var e=a.listSelections().length,t=[],n=-1,r=0;r<e;r++){var i,o=a.listSelections()[r].head;o.line<=n||(i=f(o.line+(s?0:1),0),a.replaceRange("\n",i,null,"+insertLine"),a.indentLine(i.line,null,!0),t.push({head:i,anchor:i}),n=o.line+1)}a.setSelections(t)}),a.execCommand("indentAuto")}function c(e,t){for(var n=t.ch,r=n,i=e.getLine(t.line);n&&d.isWordChar(i.charAt(n-1));)--n;for(;r<i.length&&d.isWordChar(i.charAt(r));)++r;return{from:f(t.line,n),to:f(t.line,r),word:i.slice(n,r)}}function i(e,t){for(var n=e.listSelections(),r=[],i=0;i<n.length;i++){var o=n[i],a=e.findPosV(o.anchor,t,"line",o.anchor.goalColumn),s=e.findPosV(o.head,t,"line",o.head.goalColumn);a.goalColumn=null!=o.anchor.goalColumn?o.anchor.goalColumn:e.cursorCoords(o.anchor,"div").left,s.goalColumn=null!=o.head.goalColumn?o.head.goalColumn:e.cursorCoords(o.head,"div").left;s={anchor:a,head:s};r.push(o),r.push(s)}e.setSelections(r)}r.goSubwordLeft=function(e){t(e,-1)},r.goSubwordRight=function(e){t(e,1)},r.scrollLineUp=function(e){var t,n=e.getScrollInfo();e.somethingSelected()||(t=e.lineAtHeight(n.top+n.clientHeight,"local"),e.getCursor().line>=t&&e.execCommand("goLineUp")),e.scrollTo(null,n.top-e.defaultTextHeight())},r.scrollLineDown=function(e){var t,n=e.getScrollInfo();e.somethingSelected()||(t=e.lineAtHeight(n.top,"local")+1,e.getCursor().line<=t&&e.execCommand("goLineDown")),e.scrollTo(null,n.top+e.defaultTextHeight())},r.splitSelectionByLine=function(e){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++)for(var i=t[r].from(),o=t[r].to(),a=i.line;a<=o.line;++a)o.line>i.line&&a==o.line&&0==o.ch||n.push({anchor:a==i.line?i:f(a,0),head:a==o.line?o:f(a)});e.setSelections(n,0)},r.singleSelectionTop=function(e){var t=e.listSelections()[0];e.setSelection(t.anchor,t.head,{scroll:!1})},r.selectLine=function(e){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){var i=t[r];n.push({anchor:f(i.from().line,0),head:f(i.to().line+1,0)})}e.setSelections(n)},r.insertLineAfter=function(e){return n(e,!1)},r.insertLineBefore=function(e){return n(e,!0)},r.selectNextOccurrence=function(e){var t=e.getCursor("from"),n=e.getCursor("to"),r=e.state.sublimeFindFullWord==e.doc.sel;if(0==d.cmpPos(t,n)){var i=c(e,t);if(!i.word)return;e.setSelection(i.from,i.to),r=!0}else{t=e.getRange(t,n),t=r?new RegExp("\\b"+t+"\\b"):t,n=e.getSearchCursor(t,n);if(!(n.findNext()||(n=e.getSearchCursor(t,f(e.firstLine(),0))).findNext())||function(e,t,n){for(var r=0;r<e.length;r++)if(0==d.cmpPos(e[r].from(),t)&&0==d.cmpPos(e[r].to(),n))return!0;return!1}(e.listSelections(),n.from(),n.to()))return;e.addSelection(n.from(),n.to())}r&&(e.state.sublimeFindFullWord=e.doc.sel)},r.skipAndSelectNextOccurrence=function(e){var t=e.getCursor("anchor"),n=e.getCursor("head");r.selectNextOccurrence(e),0!=d.cmpPos(t,n)&&e.doc.setSelections(e.doc.listSelections().filter(function(e){return e.anchor!=t||e.head!=n}))},r.addCursorToPrevLine=function(e){i(e,-1)},r.addCursorToNextLine=function(e){i(e,1)};function o(e){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){var i=t[r],o=i.head,a=e.scanForBracket(o,-1);if(!a)return;for(;;){var s=e.scanForBracket(o,1);if(!s)return;if(s.ch=="(){}[]".charAt("(){}[]".indexOf(a.ch)+1)){var l=f(a.pos.line,a.pos.ch+1);if(0!=d.cmpPos(l,i.from())||0!=d.cmpPos(s.pos,i.to())){n.push({anchor:l,head:s.pos});break}if(!(a=e.scanForBracket(a.pos,-1)))return}o=f(s.pos.line,s.pos.ch+1)}}return e.setSelections(n),1}function a(e){return e?/\bpunctuation\b/.test(e)?e:void 0:null}function s(a,s,l){if(a.isReadOnly())return d.Pass;for(var c,e=a.listSelections(),u=[],t=0;t<e.length;t++){var n=e[t];if(!n.empty()){for(var r=n.from().line,i=n.to().line;t<e.length-1&&e[t+1].from().line==i;)i=e[++t].to().line;e[t].to().ch||i--,u.push(r,i)}}u.length?c=!0:u.push(a.firstLine(),a.lastLine()),a.operation(function(){for(var e=[],t=0;t<u.length;t+=2){var n=u[t],r=u[t+1],i=f(n,0),o=f(r),n=a.getRange(i,o,!1);s?n.sort(function(e,t){return e<t?-l:e==t?0:l}):n.sort(function(e,t){var n=e.toUpperCase(),r=t.toUpperCase();return n!=r&&(e=n,t=r),e<t?-l:e==t?0:l}),a.replaceRange(n,i,o),c&&e.push({anchor:i,head:f(r+1,0)})}c&&a.setSelections(e,0)})}function l(s,l){s.operation(function(){for(var e=s.listSelections(),t=[],n=[],r=0;r<e.length;r++)(a=e[r]).empty()?(t.push(r),n.push("")):n.push(l(s.getRange(a.from(),a.to())));s.replaceSelections(n,"around","case");for(r=t.length-1;0<=r;r--){var i,o,a=e[t[r]];o&&0<d.cmpPos(a.head,o)||(o=(i=c(s,a.head)).from,s.replaceRange(l(i.word),i.from,i.to))}})}function u(e){var t=e.getCursor("from"),n=e.getCursor("to");if(0==d.cmpPos(t,n)){var r=c(e,t);if(!r.word)return;t=r.from,n=r.to}return{from:t,to:n,query:e.getRange(t,n),word:r}}function h(e,t){var n,r,i=u(e);i&&(n=i.query,r=e.getSearchCursor(n,t?i.to:i.from),(t?r.findNext():r.findPrevious())?e.setSelection(r.from(),r.to()):(r=e.getSearchCursor(n,t?f(e.firstLine(),0):e.clipPos(f(e.lastLine()))),(t?r.findNext():r.findPrevious())?e.setSelection(r.from(),r.to()):i.word&&e.setSelection(i.from,i.to)))}r.selectScope=function(e){o(e)||e.execCommand("selectAll")},r.selectBetweenBrackets=function(e){if(!o(e))return d.Pass},r.goToBracket=function(n){n.extendSelectionsBy(function(e){var t=n.scanForBracket(e.head,1,a(n.getTokenTypeAt(e.head)));if(t&&0!=d.cmpPos(t.pos,e.head))return t.pos;t=n.scanForBracket(e.head,-1,a(n.getTokenTypeAt(f(e.head.line,e.head.ch+1))));return t&&f(t.pos.line,t.pos.ch+1)||e.head})},r.swapLineUp=function(i){if(i.isReadOnly())return d.Pass;for(var e=i.listSelections(),o=[],t=i.firstLine()-1,a=[],n=0;n<e.length;n++){var r=e[n],s=r.from().line-1,l=r.to().line;a.push({anchor:f(r.anchor.line-1,r.anchor.ch),head:f(r.head.line-1,r.head.ch)}),0!=r.to().ch||r.empty()||--l,t<s?o.push(s,l):o.length&&(o[o.length-1]=l),t=l}i.operation(function(){for(var e=0;e<o.length;e+=2){var t=o[e],n=o[e+1],r=i.getLine(t);i.replaceRange("",f(t,0),f(t+1,0),"+swapLine"),n>i.lastLine()?i.replaceRange("\n"+r,f(i.lastLine()),null,"+swapLine"):i.replaceRange(r+"\n",f(n,0),null,"+swapLine")}i.setSelections(a),i.scrollIntoView()})},r.swapLineDown=function(i){if(i.isReadOnly())return d.Pass;for(var e=i.listSelections(),o=[],t=i.lastLine()+1,n=e.length-1;0<=n;n--){var r=e[n],a=r.to().line+1,s=r.from().line;0!=r.to().ch||r.empty()||a--,a<t?o.push(a,s):o.length&&(o[o.length-1]=s),t=s}i.operation(function(){for(var e=o.length-2;0<=e;e-=2){var t=o[e],n=o[e+1],r=i.getLine(t);t==i.lastLine()?i.replaceRange("",f(t-1),f(t),"+swapLine"):i.replaceRange("",f(t,0),f(t+1,0),"+swapLine"),i.replaceRange(r+"\n",f(n,0),null,"+swapLine")}i.scrollIntoView()})},r.toggleCommentIndented=function(e){e.toggleComment({indent:!0})},r.joinLines=function(l){for(var e=l.listSelections(),c=[],t=0;t<e.length;t++){for(var n=e[t],r=n.from(),i=r.line,o=n.to().line;t<e.length-1&&e[t+1].from().line==o;)o=e[++t].to().line;c.push({start:i,end:o,anchor:!n.empty()&&r})}l.operation(function(){for(var e=0,t=[],n=0;n<c.length;n++){for(var r,i=c[n],o=i.anchor&&f(i.anchor.line-e,i.anchor.ch),a=i.start;a<=i.end;a++){var s=a-e;a==i.end&&(r=f(s,l.getLine(s).length+1)),s<l.lastLine()&&(l.replaceRange(" ",f(s),f(1+s,/^\s*/.exec(l.getLine(1+s))[0].length)),++e)}t.push({anchor:o||r,head:r})}l.setSelections(t,0)})},r.duplicateLine=function(r){r.operation(function(){for(var e=r.listSelections().length,t=0;t<e;t++){var n=r.listSelections()[t];n.empty()?r.replaceRange(r.getLine(n.head.line)+"\n",f(n.head.line,0)):r.replaceRange(r.getRange(n.from(),n.to()),n.from())}r.scrollIntoView()})},r.sortLines=function(e){s(e,!0,1)},r.reverseSortLines=function(e){s(e,!0,-1)},r.sortLinesInsensitive=function(e){s(e,!1,1)},r.reverseSortLinesInsensitive=function(e){s(e,!1,-1)},r.nextBookmark=function(e){var t=e.state.sublimeBookmarks;if(t)for(;t.length;){var n=t.shift(),r=n.find();if(r)return t.push(n),e.setSelection(r.from,r.to)}},r.prevBookmark=function(e){var t=e.state.sublimeBookmarks;if(t)for(;t.length;){t.unshift(t.pop());var n=t[t.length-1].find();if(n)return e.setSelection(n.from,n.to);t.pop()}},r.toggleBookmark=function(e){for(var t=e.listSelections(),n=e.state.sublimeBookmarks||(e.state.sublimeBookmarks=[]),r=0;r<t.length;r++){for(var i=t[r].from(),o=t[r].to(),a=t[r].empty()?e.findMarksAt(i):e.findMarks(i,o),s=0;s<a.length;s++)if(a[s].sublimeBookmark){a[s].clear();for(var l=0;l<n.length;l++)n[l]==a[s]&&n.splice(l--,1);break}s==a.length&&n.push(e.markText(i,o,{sublimeBookmark:!0,clearWhenEmpty:!1}))}},r.clearBookmarks=function(e){var t=e.state.sublimeBookmarks;if(t)for(var n=0;n<t.length;n++)t[n].clear();t.length=0},r.selectBookmarks=function(e){var t=e.state.sublimeBookmarks,n=[];if(t)for(var r=0;r<t.length;r++){var i=t[r].find();i?n.push({anchor:i.from,head:i.to}):t.splice(r--,0)}n.length&&e.setSelections(n,0)},r.smartBackspace=function(s){if(s.somethingSelected())return d.Pass;s.operation(function(){for(var e=s.listSelections(),t=s.getOption("indentUnit"),n=e.length-1;0<=n;n--){var r=e[n].head,i=s.getRange({line:r.line,ch:0},r),o=d.countColumn(i,null,s.getOption("tabSize")),a=s.findPosH(r,-1,"char",!1);!i||/\S/.test(i)||o%t!=0||(o=new f(r.line,d.findColumn(i,o-t,t))).ch!=r.ch&&(a=o),s.replaceRange("",a,r,"+delete")}})},r.delLineRight=function(n){n.operation(function(){for(var e=n.listSelections(),t=e.length-1;0<=t;t--)n.replaceRange("",e[t].anchor,f(e[t].to().line),"+delete");n.scrollIntoView()})},r.upcaseAtCursor=function(e){l(e,function(e){return e.toUpperCase()})},r.downcaseAtCursor=function(e){l(e,function(e){return e.toLowerCase()})},r.setSublimeMark=function(e){e.state.sublimeMark&&e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor())},r.selectToSublimeMark=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&e.setSelection(e.getCursor(),t)},r.deleteToSublimeMark=function(e){var t,n,r=e.state.sublimeMark&&e.state.sublimeMark.find();r&&(n=e.getCursor(),0<d.cmpPos(n,t=r)&&(r=t,t=n,n=r),e.state.sublimeKilled=e.getRange(n,t),e.replaceRange("",n,t))},r.swapWithSublimeMark=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&(e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor()),e.setCursor(t))},r.sublimeYank=function(e){null!=e.state.sublimeKilled&&e.replaceSelection(e.state.sublimeKilled,null,"paste")},r.showInCenter=function(e){var t=e.cursorCoords(null,"local");e.scrollTo(null,(t.top+t.bottom)/2-e.getScrollInfo().clientHeight/2)},r.findUnder=function(e){h(e,!0)},r.findUnderPrevious=function(e){h(e,!1)},r.findAllUnder=function(e){var t=u(e);if(t){for(var n=e.getSearchCursor(t.query),r=[],i=-1;n.findNext();)r.push({anchor:n.from(),head:n.to()}),n.from().line<=t.from.line&&n.from().ch<=t.from.ch&&i++;e.setSelections(r,i)}};var e=d.keyMap;e.macSublime={"Cmd-Left":"goLineStartSmart","Shift-Tab":"indentLess","Shift-Ctrl-K":"deleteLine","Alt-Q":"wrapLines","Ctrl-Left":"goSubwordLeft","Ctrl-Right":"goSubwordRight","Ctrl-Alt-Up":"scrollLineUp","Ctrl-Alt-Down":"scrollLineDown","Cmd-L":"selectLine","Shift-Cmd-L":"splitSelectionByLine",Esc:"singleSelectionTop","Cmd-Enter":"insertLineAfter","Shift-Cmd-Enter":"insertLineBefore","Cmd-D":"selectNextOccurrence","Shift-Cmd-Space":"selectScope","Shift-Cmd-M":"selectBetweenBrackets","Cmd-M":"goToBracket","Cmd-Ctrl-Up":"swapLineUp","Cmd-Ctrl-Down":"swapLineDown","Cmd-/":"toggleCommentIndented","Cmd-J":"joinLines","Shift-Cmd-D":"duplicateLine",F5:"sortLines","Shift-F5":"reverseSortLines","Cmd-F5":"sortLinesInsensitive","Shift-Cmd-F5":"reverseSortLinesInsensitive",F2:"nextBookmark","Shift-F2":"prevBookmark","Cmd-F2":"toggleBookmark","Shift-Cmd-F2":"clearBookmarks","Alt-F2":"selectBookmarks",Backspace:"smartBackspace","Cmd-K Cmd-D":"skipAndSelectNextOccurrence","Cmd-K Cmd-K":"delLineRight","Cmd-K Cmd-U":"upcaseAtCursor","Cmd-K Cmd-L":"downcaseAtCursor","Cmd-K Cmd-Space":"setSublimeMark","Cmd-K Cmd-A":"selectToSublimeMark","Cmd-K Cmd-W":"deleteToSublimeMark","Cmd-K Cmd-X":"swapWithSublimeMark","Cmd-K Cmd-Y":"sublimeYank","Cmd-K Cmd-C":"showInCenter","Cmd-K Cmd-G":"clearBookmarks","Cmd-K Cmd-Backspace":"delLineLeft","Cmd-K Cmd-1":"foldAll","Cmd-K Cmd-0":"unfoldAll","Cmd-K Cmd-J":"unfoldAll","Ctrl-Shift-Up":"addCursorToPrevLine","Ctrl-Shift-Down":"addCursorToNextLine","Cmd-F3":"findUnder","Shift-Cmd-F3":"findUnderPrevious","Alt-F3":"findAllUnder","Shift-Cmd-[":"fold","Shift-Cmd-]":"unfold","Cmd-I":"findIncremental","Shift-Cmd-I":"findIncrementalReverse","Cmd-H":"replace",F3:"findNext","Shift-F3":"findPrev",fallthrough:"macDefault"},d.normalizeKeyMap(e.macSublime),e.pcSublime={"Shift-Tab":"indentLess","Shift-Ctrl-K":"deleteLine","Alt-Q":"wrapLines","Ctrl-T":"transposeChars","Alt-Left":"goSubwordLeft","Alt-Right":"goSubwordRight","Ctrl-Up":"scrollLineUp","Ctrl-Down":"scrollLineDown","Ctrl-L":"selectLine","Shift-Ctrl-L":"splitSelectionByLine",Esc:"singleSelectionTop","Ctrl-Enter":"insertLineAfter","Shift-Ctrl-Enter":"insertLineBefore","Ctrl-D":"selectNextOccurrence","Shift-Ctrl-Space":"selectScope","Shift-Ctrl-M":"selectBetweenBrackets","Ctrl-M":"goToBracket","Shift-Ctrl-Up":"swapLineUp","Shift-Ctrl-Down":"swapLineDown","Ctrl-/":"toggleCommentIndented","Ctrl-J":"joinLines","Shift-Ctrl-D":"duplicateLine",F9:"sortLines","Shift-F9":"reverseSortLines","Ctrl-F9":"sortLinesInsensitive","Shift-Ctrl-F9":"reverseSortLinesInsensitive",F2:"nextBookmark","Shift-F2":"prevBookmark","Ctrl-F2":"toggleBookmark","Shift-Ctrl-F2":"clearBookmarks","Alt-F2":"selectBookmarks",Backspace:"smartBackspace","Ctrl-K Ctrl-D":"skipAndSelectNextOccurrence","Ctrl-K Ctrl-K":"delLineRight","Ctrl-K Ctrl-U":"upcaseAtCursor","Ctrl-K Ctrl-L":"downcaseAtCursor","Ctrl-K Ctrl-Space":"setSublimeMark","Ctrl-K Ctrl-A":"selectToSublimeMark","Ctrl-K Ctrl-W":"deleteToSublimeMark","Ctrl-K Ctrl-X":"swapWithSublimeMark","Ctrl-K Ctrl-Y":"sublimeYank","Ctrl-K Ctrl-C":"showInCenter","Ctrl-K Ctrl-G":"clearBookmarks","Ctrl-K Ctrl-Backspace":"delLineLeft","Ctrl-K Ctrl-1":"foldAll","Ctrl-K Ctrl-0":"unfoldAll","Ctrl-K Ctrl-J":"unfoldAll","Ctrl-Alt-Up":"addCursorToPrevLine","Ctrl-Alt-Down":"addCursorToNextLine","Ctrl-F3":"findUnder","Shift-Ctrl-F3":"findUnderPrevious","Alt-F3":"findAllUnder","Shift-Ctrl-[":"fold","Shift-Ctrl-]":"unfold","Ctrl-I":"findIncremental","Shift-Ctrl-I":"findIncrementalReverse","Ctrl-H":"replace",F3:"findNext","Shift-F3":"findPrev",fallthrough:"pcDefault"},d.normalizeKeyMap(e.pcSublime);var p=e.default==e.macDefault;e.sublime=p?e.macSublime:e.pcSublime}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror")):"function"==typeof define&&define.amd?define(["../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var t=e.commands,l=e.Pos;function s(e,t){return e.line==t.line&&e.ch==t.ch}var o=[];function a(e){o.push(e),50<o.length&&o.shift()}function n(e){return o[o.length-(e?Math.min(e,1):1)]||""}var c=null;function u(e,t,n,r,i){null==i&&(i=e.getRange(t,n)),"grow"==r&&c&&c.cm==e&&s(t,c.pos)&&e.isClean(c.gen)?function(e){if(!o.length)return a(e);o[o.length-1]+=e}(i):!1!==r&&a(i),e.replaceRange("",t,n,"+delete"),c="grow"==r?{cm:e,pos:t,gen:e.changeGeneration()}:null}function r(e,t,n){return e.findPosH(t,n,"char",!0)}function i(e,t,n){return e.findPosH(t,n,"word",!0)}function d(e,t,n){return e.findPosV(t,n,"line",e.doc.sel.goalColumn)}function f(e,t,n){return e.findPosV(t,n,"page",e.doc.sel.goalColumn)}function h(e,t,n){for(var r=t.line,i=e.getLine(r),o=/\S/.test(n<0?i.slice(0,t.ch):i.slice(t.ch)),a=e.firstLine(),s=e.lastLine();;){if((r+=n)<a||s<r)return e.clipPos(l(r-n,n<0?0:null));i=e.getLine(r);if(/\S/.test(i))o=!0;else if(o)return l(r,0)}}function p(e,t,n){for(var r=t.line,i=t.ch,o=e.getLine(t.line),a=!1;;){var s=o.charAt(i+(n<0?-1:0));if(s){if(a&&/[!?.]/.test(s))return l(r,i+(0<n?1:0));a=a||/\w/.test(s),i+=n}else{if(r==(n<0?e.firstLine():e.lastLine()))return l(r,i);if(o=e.getLine(r+n),!/\S/.test(o))return l(r,i);r+=n,i=n<0?o.length:0}}}function m(e,t,n){var r;if(e.findMatchingBracket&&(r=e.findMatchingBracket(t,{strict:!0}))&&r.match&&(r.forward?1:-1)==n)return 0<n?l(r.to.line,r.to.ch+1):r.to;for(var i=!0;;i=!1){var o=e.getTokenAt(t),a=l(t.line,n<0?o.start:o.end);if(!(i&&0<n&&o.end==t.ch)&&/\w/.test(o.string))return a;o=e.findPosH(a,n,"char");if(s(a,o))return t;t=o}}function g(e,t){var n=e.state.emacsPrefix;return n?(_(e),"-"==n?-1:Number(n)):t?null:1}function v(t){var r="string"==typeof t?function(e){e.execCommand(t)}:t;return function(e){var t=g(e);r(e);for(var n=1;n<t;++n)r(e)}}function y(e,t,n,r){var i=g(e);i<0&&(r=-r,i=-i);for(var o=0;o<i;++o){var a=n(e,t,r);if(s(a,t))break;t=a}return t}function b(t,n){function e(e){e.extendSelection(y(e,e.getCursor(),t,n))}return e.motion=!0,e}function k(e,t,n,r){for(var i,o=e.listSelections(),a=o.length;a--;)u(e,i=o[a].head,y(e,i,t,n),r)}function x(e,t){if(e.somethingSelected()){for(var n,r=e.listSelections(),i=r.length;i--;)u(e,(n=r[i]).anchor,n.head,t);return!0}}function w(e,t){e.state.emacsPrefix?"-"!=t&&(e.state.emacsPrefix+=t):(e.state.emacsPrefix=t,e.on("keyHandled",S),e.on("inputRead",L))}var C={"Alt-G":!0,"Ctrl-X":!0,"Ctrl-Q":!0,"Ctrl-U":!0};function S(e,t){e.state.emacsPrefixMap||C.hasOwnProperty(t)||_(e)}function _(e){e.state.emacsPrefix=null,e.off("keyHandled",S),e.off("inputRead",L)}function L(e,t){var n=g(e);if(1<n&&"+input"==t.origin){for(var r=t.text.join("\n"),i="",o=1;o<n;++o)i+=r;e.replaceSelection(i)}}function M(e,t){"string"==typeof t&&(/^\d$/.test(t)||"Ctrl-U"==t)||(e.removeKeyMap(E),e.state.emacsPrefixMap=!1,e.off("keyHandled",M),e.off("inputRead",M))}function T(e){e.setExtending(!1),e.setCursor(e.getCursor())}function A(e,t,n){var r,i;e.openDialog?e.openDialog((r=t,i=document.createDocumentFragment(),(e=document.createElement("input")).setAttribute("type","text"),e.style.width="10em",i.appendChild(document.createTextNode(r+": ")),i.appendChild(e),i),n,{bottom:!0}):n(prompt(t,""))}function O(e,t){var n=e.getCursor(),r=e.findPosH(n,1,"word");e.replaceRange(t(e.getRange(n,r)),n,r),e.setCursor(r)}t.setMark=function(e){e.setCursor(e.getCursor()),e.setExtending(!e.getExtending()),e.on("change",function(){e.setExtending(!1)})},t.killRegion=function(e){u(e,e.getCursor("start"),e.getCursor("end"),!0)},t.killLineEmacs=v(function(e){var t=e.getCursor(),n=e.clipPos(l(t.line)),r=e.getRange(t,n);/\S/.test(r)||(r+="\n",n=l(t.line+1,0)),u(e,t,n,"grow",r)}),t.killRingSave=function(e){a(e.getSelection()),T(e)},t.yank=function(e){var t=e.getCursor();e.replaceRange(n(g(e)),t,t,"paste"),e.setSelection(t,e.getCursor())},t.yankPop=function(e){e.replaceSelection((1<o.length&&o.pop(),n()),"around","paste")},t.forwardChar=b(r,1),t.backwardChar=b(r,-1),t.deleteChar=function(e){k(e,r,1,!1)},t.deleteForwardChar=function(e){x(e,!1)||k(e,r,1,!1)},t.deleteBackwardChar=function(e){x(e,!1)||k(e,r,-1,!1)},t.forwardWord=b(i,1),t.backwardWord=b(i,-1),t.killWord=function(e){k(e,i,1,"grow")},t.backwardKillWord=function(e){k(e,i,-1,"grow")},t.nextLine=b(d,1),t.previousLine=b(d,-1),t.scrollDownCommand=b(f,-1),t.scrollUpCommand=b(f,1),t.backwardParagraph=b(h,-1),t.forwardParagraph=b(h,1),t.backwardSentence=b(p,-1),t.forwardSentence=b(p,1),t.killSentence=function(e){k(e,p,1,"grow")},t.backwardKillSentence=function(e){u(e,e.getCursor(),p(e,e.getCursor(),1),"grow")},t.killSexp=function(e){k(e,m,1,"grow")},t.backwardKillSexp=function(e){k(e,m,-1,"grow")},t.forwardSexp=b(m,1),t.backwardSexp=b(m,-1),t.markSexp=function(e){var t=e.getCursor();e.setSelection(y(e,t,m,1),t)},t.transposeSexps=function(e){var t=m(e,e.getCursor(),-1),n=m(e,t,1),r=m(e,n,1),i=m(e,r,-1);e.replaceRange(e.getRange(i,r)+e.getRange(n,i)+e.getRange(t,n),t,r)},t.backwardUpList=v(function(e){for(var t=e.getCursor(),n=t.line,r=t.ch,i=[];n>=e.firstLine();){for(var o=e.getLine(n),a=null==r?o.length:r;0<a;)if(")"==(r=o.charAt(--a)))i.push("(");else if("]"==r)i.push("[");else if("}"==r)i.push("{");else if(/[\(\{\[]/.test(r)&&(!i.length||i.pop()!=r))return e.extendSelection(l(n,a));--n,r=null}}),t.justOneSpace=function(e){for(var t=e.getCursor(),n=t.ch,r=t.ch,i=e.getLine(t.line);n&&/\s/.test(i.charAt(n-1));)--n;for(;r<i.length&&/\s/.test(i.charAt(r));)++r;e.replaceRange(" ",l(t.line,n),l(t.line,r))},t.openLine=v(function(e){e.replaceSelection("\n","start")}),t.transposeCharsRepeatable=v(function(e){e.execCommand("transposeChars")}),t.capitalizeWord=v(function(e){O(e,function(e){var t=e.search(/\w/);return-1==t?e:e.slice(0,t)+e.charAt(t).toUpperCase()+e.slice(t+1).toLowerCase()})}),t.upcaseWord=v(function(e){O(e,function(e){return e.toUpperCase()})}),t.downcaseWord=v(function(e){O(e,function(e){return e.toLowerCase()})}),t.undoRepeatable=v("undo"),t.keyboardQuit=function(e){e.execCommand("clearSearch"),T(e)},t.newline=v(function(e){e.replaceSelection("\n","end")}),t.gotoLine=function(n){var e=g(n,!0);if(null!=e&&0<e)return n.setCursor(e-1);A(n,"Goto line",function(e){var t;e&&!isNaN(t=Number(e))&&t==(0|t)&&0<t&&n.setCursor(t-1)})},t.indentRigidly=function(e){e.indentSelection(g(e,!0)||e.getOption("indentUnit"))},t.exchangePointAndMark=function(e){e.setSelection(e.getCursor("head"),e.getCursor("anchor"))},t.quotedInsertTab=v("insertTab"),t.universalArgument=function(e){e.state.emacsPrefixMap=!0,e.addKeyMap(E),e.on("keyHandled",M),e.on("inputRead",M)},e.emacs={kill:u,killRegion:x,repeated:v};var N=e.keyMap.emacs=e.normalizeKeyMap({"Ctrl-W":"killRegion","Ctrl-K":"killLineEmacs","Alt-W":"killRingSave","Ctrl-Y":"yank","Alt-Y":"yankPop","Ctrl-Space":"setMark","Ctrl-Shift-2":"setMark","Ctrl-F":"forwardChar","Ctrl-B":"backwardChar",Right:"forwardChar",Left:"backwardChar","Ctrl-D":"deleteChar",Delete:"deleteForwardChar","Ctrl-H":"deleteBackwardChar",Backspace:"deleteBackwardChar","Alt-F":"forwardWord","Alt-B":"backwardWord","Alt-Right":"forwardWord","Alt-Left":"backwardWord","Alt-D":"killWord","Alt-Backspace":"backwardKillWord","Ctrl-N":"nextLine","Ctrl-P":"previousLine",Down:"nextLine",Up:"previousLine","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd",End:"goLineEnd",Home:"goLineStart","Alt-V":"scrollDownCommand","Ctrl-V":"scrollUpCommand",PageUp:"scrollDownCommand",PageDown:"scrollUpCommand","Ctrl-Up":"backwardParagraph","Ctrl-Down":"forwardParagraph","Alt-{":"backwardParagraph","Alt-}":"forwardParagraph","Alt-A":"backwardSentence","Alt-E":"forwardSentence","Alt-K":"killSentence","Ctrl-X Delete":"backwardKillSentence","Ctrl-Alt-K":"killSexp","Ctrl-Alt-Backspace":"backwardKillSexp","Ctrl-Alt-F":"forwardSexp","Ctrl-Alt-B":"backwardSexp","Shift-Ctrl-Alt-2":"markSexp","Ctrl-Alt-T":"transposeSexps","Ctrl-Alt-U":"backwardUpList","Alt-Space":"justOneSpace","Ctrl-O":"openLine","Ctrl-T":"transposeCharsRepeatable","Alt-C":"capitalizeWord","Alt-U":"upcaseWord","Alt-L":"downcaseWord","Alt-;":"toggleComment","Ctrl-/":"undoRepeatable","Shift-Ctrl--":"undoRepeatable","Ctrl-Z":"undoRepeatable","Cmd-Z":"undoRepeatable","Ctrl-X U":"undoRepeatable","Shift-Ctrl-Z":"redo","Shift-Alt-,":"goDocStart","Shift-Alt-.":"goDocEnd","Ctrl-S":"findPersistentNext","Ctrl-R":"findPersistentPrev","Ctrl-G":"keyboardQuit","Shift-Alt-5":"replace","Alt-/":"autocomplete",Enter:"newlineAndIndent","Ctrl-J":"newline",Tab:"indentAuto","Alt-G G":"gotoLine","Ctrl-X Tab":"indentRigidly","Ctrl-X Ctrl-X":"exchangePointAndMark","Ctrl-X Ctrl-S":"save","Ctrl-X Ctrl-W":"save","Ctrl-X S":"saveAll","Ctrl-X F":"open","Ctrl-X K":"close","Ctrl-X H":"selectAll","Ctrl-Q Tab":"quotedInsertTab","Ctrl-U":"universalArgument",fallthrough:"default"}),E={"Ctrl-G":_};function I(t){E[t]=function(e){w(e,t)},N["Ctrl-"+t]=function(e){w(e,t)},C["Ctrl-"+t]=!0}for(var P=0;P<10;++P)I(String(P));I("-")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/dialog/dialog"),require("../addon/edit/matchbrackets.js")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/dialog/dialog","../addon/edit/matchbrackets"],e):e(CodeMirror)}(function(Ye){"use strict";var Qe=[{keys:"<Left>",type:"keyToKey",toKeys:"h"},{keys:"<Right>",type:"keyToKey",toKeys:"l"},{keys:"<Up>",type:"keyToKey",toKeys:"k"},{keys:"<Down>",type:"keyToKey",toKeys:"j"},{keys:"<Space>",type:"keyToKey",toKeys:"l"},{keys:"<BS>",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"<Del>",type:"keyToKey",toKeys:"x",context:"normal"},{keys:"<C-Space>",type:"keyToKey",toKeys:"W"},{keys:"<C-BS>",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"<S-Space>",type:"keyToKey",toKeys:"w"},{keys:"<S-BS>",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"<C-n>",type:"keyToKey",toKeys:"j"},{keys:"<C-p>",type:"keyToKey",toKeys:"k"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"<Home>",type:"keyToKey",toKeys:"0"},{keys:"<End>",type:"keyToKey",toKeys:"$"},{keys:"<PageUp>",type:"keyToKey",toKeys:"<C-b>"},{keys:"<PageDown>",type:"keyToKey",toKeys:"<C-f>"},{keys:"<CR>",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"<Ins>",type:"action",action:"toggleOverwrite",context:"insert"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"(",type:"motion",motion:"moveBySentence",motionArgs:{forward:!1}},{keys:")",type:"motion",motion:"moveBySentence",motionArgs:{forward:!0}},{keys:"<C-f>",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"<C-b>",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"<C-d>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"<C-u>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'<character>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<character>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:"=",type:"operator",operator:"indentAuto"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"gn",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!0}},{keys:"gN",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!1}},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"expandToLine",motionArgs:{linewise:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"<C-w>",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"<C-w>",type:"idle",context:"normal"},{keys:"<C-i>",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"<C-o>",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"<C-e>",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"<C-y>",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"gi",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"lastEdit"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"gI",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"bol"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"<C-v>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"<C-q>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"gJ",type:"action",action:"joinLines",actionArgs:{keepSpaces:!0},isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r<character>",type:"action",action:"replace",isEdit:!0},{keys:"@<character>",type:"action",action:"replayMacro"},{keys:"q<character>",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0},context:"normal"},{keys:"R",type:"operator",operator:"change",operatorArgs:{linewise:!0,fullLine:!0},context:"visual",exitVisualBlock:!0},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"<C-r>",type:"action",action:"redo"},{keys:"m<character>",type:"action",action:"setMark"},{keys:'"<character>',type:"action",action:"setRegister"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z<CR>",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"<C-a>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"<C-x>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"<C-t>",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"<C-d>",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a<character>",type:"motion",motion:"textObjectManipulation"},{keys:"i<character>",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],Je=Qe.length,Ze=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"unmap"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"vglobal",shortName:"v"},{name:"global",shortName:"g"}],et=Ye.Pos;Ye.Vim=function(){function e(e,t){var n;this==Ye.keyMap.vim&&(Ye.rmClass(e.getWrapperElement(),"cm-fat-cursor"),"contenteditable"==e.getOption("inputStyle")&&null!=document.body.style.caretColor&&(a(n=e),n.off("cursorActivity",i),n.state.fatCursorMarks=null,e.getInputField().style.caretColor="")),t&&t.attach==r||((e=e).setOption("disableInput",!1),e.off("cursorActivity",je),Ye.off(e.getInputField(),"paste",l(e)),e.state.vim=null)}function r(e,t){var n;this==Ye.keyMap.vim&&(Ye.addClass(e.getWrapperElement(),"cm-fat-cursor"),"contenteditable"==e.getOption("inputStyle")&&null!=document.body.style.caretColor&&((n=e).state.fatCursorMarks=[],i(n),n.on("cursorActivity",i),e.getInputField().style.caretColor="transparent")),t&&t.attach==r||((e=e).setOption("disableInput",!0),e.setOption("showCursorWhenSelecting",!1),Ye.signal(e,"vim-mode-change",{mode:"normal"}),e.on("cursorActivity",je),I(e),Ye.on(e.getInputField(),"paste",l(e)))}function i(e){if(e.state.fatCursorMarks){a(e);for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){var i,o=t[r];o.empty()&&(i=e.getLine(o.anchor.line).length,o.anchor.ch<i?n.push(e.markText(o.anchor,et(o.anchor.line,o.anchor.ch+1),{className:"cm-fat-cursor-mark"})):n.push(e.markText(et(o.anchor.line,i-1),et(o.anchor.line,i),{className:"cm-fat-cursor-mark"})))}e.state.fatCursorMarks=n}}function a(e){var t=e.state.fatCursorMarks;if(t)for(var n=0;n<t.length;n++)t[n].clear()}function t(e,t){if(t){if(this[e])return this[e];var n=function(e){if("'"==e.charAt(0))return e.charAt(1);var t=e.split(/-(?!$)/),e=t[t.length-1];{if(1==t.length&&1==t[0].length)return!1;if(2==t.length&&"Shift"==t[0]&&1==e.length)return!1}for(var n=!1,r=0;r<t.length;r++){var i=t[r];i in o?t[r]=o[i]:n=!0,i in s&&(t[r]=s[i])}if(!n)return!1;k(e)&&(t[t.length-1]=e.toLowerCase());return"<"+t.join("-")+">"}(e);if(!n)return!1;e=Ye.Vim.findKey(t,n);return"function"==typeof e&&Ye.signal(t,"vim-keypress",n),e}}Ye.defineOption("vimMode",!1,function(e,t,n){t&&"vim"!=e.getOption("keyMap")?e.setOption("keyMap","vim"):!t&&n!=Ye.Init&&/^vim/.test(e.getOption("keyMap"))&&e.setOption("keyMap","default")});var o={Shift:"S",Ctrl:"C",Alt:"A",Cmd:"D",Mod:"A",CapsLock:""},s={Enter:"CR",Backspace:"BS",Delete:"Del",Insert:"Ins"};function l(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor($(e.getCursor(),0,1)),K.enterInsertMode(e,{},t))}),t.onPasteFn}var c=/[\d]/,m=[Ye.isWordChar,function(e){return e&&!Ye.isWordChar(e)&&!/\s/.test(e)}],g=[function(e){return/\S/.test(e)}];function n(e,t){for(var n=[],r=e;r<e+t;r++)n.push(String.fromCharCode(r));return n}var u,d=n(65,26),f=n(97,26),h=n(48,10),p=[].concat(d,f,h,["<",">"]),v=[].concat(d,f,h,["-",'"',".",":","_","/"]);try{u=new RegExp("^[\\p{Lu}]$","u")}catch(e){u=/^[A-Z]$/}function y(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function b(e){return/^[a-z]$/.test(e)}function k(e){return u.test(e)}function _(e){return/^\s*$/.test(e)}function x(e){return-1!=".?!".indexOf(e)}function w(e,t){for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1}var C={};function S(e,t,n,r,i){if(void 0===t&&!i)throw Error("defaultValue is required unless callback is provided");if(C[e]={type:n=n||"string",defaultValue:t,callback:i},r)for(var o=0;o<r.length;o++)C[r[o]]=C[e];t&&L(e,t)}function L(e,t,n,r){var i=C[e],r=(r=r||{}).scope;if(!i)return new Error("Unknown option: "+e);if("boolean"==i.type){if(t&&!0!==t)return new Error("Invalid argument: "+e+"="+t);!1!==t&&(t=!0)}i.callback?("local"!==r&&i.callback(t,void 0),"global"!==r&&n&&i.callback(t,n)):("local"!==r&&(i.value="boolean"==i.type?!!t:t),"global"!==r&&n&&(n.state.vim.options[e]={value:t}))}function M(e,t,n){var r=C[e],n=(n=n||{}).scope;if(!r)return new Error("Unknown option: "+e);if(r.callback){var i=t&&r.callback(void 0,t);return"global"!==n&&void 0!==i?i:"local"!==n?r.callback():void 0}return((i="global"!==n&&t&&t.state.vim.options[e])||"local"!==n&&r||{}).value}S("filetype",void 0,"string",["ft"],function(e,t){if(void 0!==t){if(void 0===e)return"null"==(n=t.getOption("mode"))?"":n;var n=""==e?"null":e;t.setOption("mode",n)}});function T(){var a=100,s=-1,l=0,c=0,u=new Array(a);function r(e,t){l<(s+=t)?s=l:s<c&&(s=c);var n=u[(a+s)%a];if(n&&!n.find()){var r,i=0<t?1:-1,o=e.getCursor();do{if((n=u[(a+(s+=i))%a])&&(r=n.find())&&!Y(o,r))break}while(s<l&&c<s)}return n}return{cachedCursor:void 0,add:function(r,e,t){var n=u[s%a];function i(e){var t=++s%a,n=u[t];n&&n.clear(),u[t]=r.setBookmark(e)}n&&(!(n=n.find())||Y(n,e))||i(e),i(t),(c=(l=s)-a+1)<0&&(c=0)},find:function(e,t){var n=s,t=r(e,t);return s=n,t&&t.find()},move:r}}function A(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}}var O,N;function E(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=A()}function I(e){return e.state.vim||(e.state.vim={inputState:new R,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},fakeCursor:null,insertMode:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:null,sel:{},options:{}}),e.state.vim}function P(){for(var e in O={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:T(),macroModeState:new E,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new F({}),searchHistoryController:new z,exCommandHistoryController:new z},C){e=C[e];e.value=e.defaultValue}}f={buildKeyMap:function(){},getRegisterController:function(){return O.registerController},resetVimGlobalState_:P,getVimGlobalState_:function(){return O},maybeInitVimState_:I,suppressErrorLogging:!(E.prototype={exitMacroRecordMode:function(){var e=O.macroModeState;e.onRecordingDone&&e.onRecordingDone(),e.onRecordingDone=void 0,e.isRecording=!1},enterMacroRecordMode:function(e,t){var n=O.registerController.getRegister(t);n&&(n.clear(),this.latestRegister=t,e.openDialog&&(this.onRecordingDone=e.openDialog(document.createTextNode("(recording)["+t+"]"),null,{bottom:!0})),this.isRecording=!0)}}),InsertModeKey:Ve,map:function(e,t,n){ze.map(e,t,n)},unmap:function(e,t){ze.unmap(e,t)},noremap:function(e,t,n){function r(e){return e?[e]:["normal","insert","visual"]}for(var i=r(n),o=Qe.length,a=o-Je;a<o&&i.length;a++){var s=Qe[a];if(!(s.keys!=t||n&&s.context&&s.context!==n||"ex"===s.type.substr(0,2)||"key"===s.type.substr(0,3))){var l,c={};for(l in s)c[l]=s[l];c.keys=e,n&&!c.context&&(c.context=n),this._mapCommand(c);var u=r(s.context),i=i.filter(function(e){return-1===u.indexOf(e)})}}},mapclear:function(e){var t=Qe.length,n=Je,r=Qe.slice(0,t-n);if(Qe=Qe.slice(t-n),e)for(var i=r.length-1;0<=i;i--){var o=r[i];if(e!==o.context)if(o.context)this._mapCommand(o);else{var a,s=["normal","insert","visual"];for(a in s)if(s[a]!==e){var l,c={};for(l in o)c[l]=o[l];c.context=s[a],this._mapCommand(c)}}}},setOption:L,getOption:M,defineOption:S,defineEx:function(e,t,n){if(t){if(0!==e.indexOf(t))throw new Error('(Vim.defineEx) "'+t+'" is not a prefix of "'+e+'", command not registered')}else t=e;Fe[e]=n,ze.commandMap_[t]={name:e,shortName:t,type:"api"}},handleKey:function(e,t,n){n=this.findKey(e,t,n);if("function"==typeof n)return n()},findKey:function(s,l,n){var e,c=I(s);function r(){var e,t=O.macroModeState;if(t.isRecording){if("q"==l)return t.exitMacroRecordMode(),B(s),1;"mapping"!=n&&(e=l,(t=t).isPlaying||(t=t.latestRegister,(t=O.registerController.getRegister(t))&&t.pushText(e)))}}function u(){return"<Esc>"==l&&(B(s),c.visualMode?le(s):c.insertMode&&We(s),1)}return!1===(e=(c.insertMode?function(){if(u())return!0;for(var e=c.inputState.keyBuffer=c.inputState.keyBuffer+l,t=1==l.length,n=W.matchCommand(e,Qe,c.inputState,"insert");1<e.length&&"full"!=n.type;){var e=c.inputState.keyBuffer=e.slice(1),r=W.matchCommand(e,Qe,c.inputState,"insert");"none"!=r.type&&(n=r)}if("none"==n.type)return B(s),!1;if("partial"==n.type)return N&&window.clearTimeout(N),N=window.setTimeout(function(){c.insertMode&&c.inputState.keyBuffer&&B(s)},M("insertModeEscKeysTimeout")),!t;if(N&&window.clearTimeout(N),t){for(var i=s.listSelections(),o=0;o<i.length;o++){var a=i[o].head;s.replaceRange("",$(a,0,-(e.length-1)),a,"+input")}O.macroModeState.lastInsertModeChanges.changes.pop()}return B(s),n.command}:function(){if(r()||u())return!0;var e=c.inputState.keyBuffer=c.inputState.keyBuffer+l;if(/^[1-9]\d*$/.test(e))return!0;var t=/^(\d*)(.*)$/.exec(e);if(!t)return B(s),!1;var n=c.visualMode?"visual":"normal";return"none"==(n=W.matchCommand(t[2]||t[1],Qe,c.inputState,n)).type?(B(s),!1):"partial"==n.type||(c.inputState.keyBuffer="",(t=/^(\d*)(.*)$/.exec(e))[1]&&"0"!=t[1]&&c.inputState.pushRepeatDigit(t[1]),n.command)})())?c.insertMode||1!==l.length?void 0:function(){return!0}:!0===e?function(){return!0}:function(){return s.operation(function(){s.curOp.isVimOp=!0;try{"keyToKey"==e.type?function(e){for(var t;e;)t=/<\w+-.+?>|<\w+>|./.exec(e),l=t[0],e=e.substring(t.index+l.length),Ye.Vim.handleKey(s,l,"mapping")}(e.toKeys):W.processCommand(s,c,e)}catch(e){throw s.state.vim=void 0,I(s),Ye.Vim.suppressErrorLogging||console.log(e),e}return!0})}},handleEx:function(e,t){ze.processCommand(e,t)},defineMotion:function(e,t){q[e]=t},defineAction:function(e,t){K[e]=t},defineOperator:function(e,t){j[e]=t},mapCommand:function(e,t,n,r,i){var o,a={keys:e,type:t};for(o in a[t]=n,a[t+"Args"]=r,i)a[o]=i[o];qe(a)},_mapCommand:qe,defineRegister:function(e,t){var n=O.registerController.registers;if(!e||1!=e.length)throw Error("Register name must be 1 character");if(n[e])throw Error("Register already defined "+e);n[e]=t,v.push(e)},exitVisualMode:le,exitInsertMode:We};function R(){this.prefixRepeat=[],this.motionRepeat=[],this.operator=null,this.operatorArgs=null,this.motion=null,this.motionArgs=null,this.keyBuffer=[],this.registerName=null}function B(e,t){e.state.vim.inputState=new R,Ye.signal(e,"vim-command-done",t)}function D(e,t,n){this.clear(),this.keyBuffer=[e||""],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!t,this.blockwise=!!n}function F(e){this.registers=e,this.unnamedRegister=e['"']=new D,e["."]=new D,e[":"]=new D,e["/"]=new D}function z(){this.historyBuffer=[],this.iterator=0,this.initialPrefix=null}R.prototype.pushRepeatDigit=function(e){this.operator?this.motionRepeat=this.motionRepeat.concat(e):this.prefixRepeat=this.prefixRepeat.concat(e)},R.prototype.getRepeat=function(){var e=0;return(0<this.prefixRepeat.length||0<this.motionRepeat.length)&&(e=1,0<this.prefixRepeat.length&&(e*=parseInt(this.prefixRepeat.join(""),10)),0<this.motionRepeat.length&&(e*=parseInt(this.motionRepeat.join(""),10))),e},D.prototype={setText:function(e,t,n){this.keyBuffer=[e||""],this.linewise=!!t,this.blockwise=!!n},pushText:function(e,t){t&&(this.linewise||this.keyBuffer.push("\n"),this.linewise=!0),this.keyBuffer.push(e)},pushInsertModeChanges:function(e){this.insertModeChanges.push(A(e))},pushSearchQuery:function(e){this.searchQueries.push(e)},clear:function(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1},toString:function(){return this.keyBuffer.join("")}},F.prototype={pushText:function(e,t,n,r,i){if("_"!==e){r&&"\n"!==n.charAt(n.length-1)&&(n+="\n");var o=this.isValidRegister(e)?this.getRegister(e):null;if(o)k(e)?o.pushText(n,r):o.setText(n,r,i),this.unnamedRegister.setText(o.toString(),r);else{switch(t){case"yank":this.registers[0]=new D(n,r,i);break;case"delete":case"change":-1==n.indexOf("\n")?this.registers["-"]=new D(n,r):(this.shiftNumericRegisters_(),this.registers[1]=new D(n,r))}this.unnamedRegister.setText(n,r,i)}}},getRegister:function(e){return this.isValidRegister(e)?(e=e.toLowerCase(),this.registers[e]||(this.registers[e]=new D),this.registers[e]):this.unnamedRegister},isValidRegister:function(e){return e&&w(e,v)},shiftNumericRegisters_:function(){for(var e=9;2<=e;e--)this.registers[e]=this.getRegister(""+(e-1))}},z.prototype={nextMatch:function(e,t){var n=this.historyBuffer,r=t?-1:1;null===this.initialPrefix&&(this.initialPrefix=e);for(var i=this.iterator+r;t?0<=i:i<n.length;i+=r)for(var o=n[i],a=0;a<=o.length;a++)if(this.initialPrefix==o.substring(0,a))return this.iterator=i,o;return i>=n.length?(this.iterator=n.length,this.initialPrefix):i<0?e:void 0},pushInput:function(e){var t=this.historyBuffer.indexOf(e);-1<t&&this.historyBuffer.splice(t,1),e.length&&this.historyBuffer.push(e)},reset:function(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}};var W={matchCommand:function(e,t,n,r){var i=function(e,t,n,r){for(var i,o=[],a=[],s=0;s<t.length;s++){var l=t[s];"insert"==n&&"insert"!=l.context||l.context&&l.context!=n||r.operator&&"action"==l.type||!(i=function(e,t){{if("<character>"!=t.slice(-11))return e==t?"full":0==t.indexOf(e)&&"partial";var n=t.length-11,r=e.slice(0,n),t=t.slice(0,n);return r==t&&e.length>n?"full":0==t.indexOf(r)&&"partial"}}(e,l.keys))||("partial"==i&&o.push(l),"full"==i&&a.push(l))}return{partial:o.length&&o,full:a.length&&a}}(e,t,r,n);if(!i.full&&!i.partial)return{type:"none"};if(!i.full&&i.partial)return{type:"partial"};for(var o=0;o<i.full.length;o++)var a=i.full[o],s=s||a;if("<character>"==s.keys.slice(-11)){e=function(e){var t=/^.*(<[^>]+>)$/.exec(e),n=t?t[1]:e.slice(-1);if(1<n.length)switch(n){case"<CR>":n="\n";break;case"<Space>":n=" ";break;default:n=""}return n}(e);if(!e)return{type:"none"};n.selectedCharacter=e}return{type:"full",command:s}},processCommand:function(e,t,n){switch(t.inputState.repeatOverride=n.repeatOverride,n.type){case"motion":this.processMotion(e,t,n);break;case"operator":this.processOperator(e,t,n);break;case"operatorMotion":this.processOperatorMotion(e,t,n);break;case"action":this.processAction(e,t,n);break;case"search":this.processSearch(e,t,n);break;case"ex":case"keyToEx":this.processEx(e,t,n)}},processMotion:function(e,t,n){t.inputState.motion=n.motion,t.inputState.motionArgs=V(n.motionArgs),this.evalInput(e,t)},processOperator:function(e,t,n){var r=t.inputState;if(r.operator){if(r.operator==n.operator)return r.motion="expandToLine",r.motionArgs={linewise:!0},void this.evalInput(e,t);B(e)}r.operator=n.operator,r.operatorArgs=V(n.operatorArgs),n.exitVisualBlock&&(t.visualBlock=!1,ae(e)),t.visualMode&&this.evalInput(e,t)},processOperatorMotion:function(e,t,n){var r=t.visualMode,i=V(n.operatorMotionArgs);i&&r&&i.visualLine&&(t.visualLine=!0),this.processOperator(e,t,n),r||this.processMotion(e,t,n)},processAction:function(e,t,n){var r=t.inputState,i=r.getRepeat(),o=!!i,a=V(n.actionArgs)||{};r.selectedCharacter&&(a.selectedCharacter=r.selectedCharacter),n.operator&&this.processOperator(e,t,n),n.motion&&this.processMotion(e,t,n),(n.motion||n.operator)&&this.evalInput(e,t),a.repeat=i||1,a.repeatIsExplicit=o,a.registerName=r.registerName,B(e),t.lastMotion=null,n.isEdit&&this.recordLastEdit(t,r,n),K[n.action](e,a,t)},processSearch:function(a,r,i){if(a.getSearchCursor){var s=i.searchArgs.forward,e=i.searchArgs.wholeWordOnly;ke(a).setReversed(!s);var t=s?"/":"?",o=ke(a).getQuery(),l=a.getScrollInfo();switch(i.searchArgs.querySrc){case"prompt":var n=O.macroModeState;n.isPlaying?d(u=n.replaySearchQueries.shift(),!0,!1):Ae(a,{onClose:f,prefix:t,desc:"(JavaScript regexp)",onKeyUp:function(e,t,n){var r,i,o=Ye.keyName(e);"Up"==o||"Down"==o?(r=e.target?e.target.selectionEnd:0,n(t=O.searchHistoryController.nextMatch(t,"Up"==o)||""),r&&e.target&&(e.target.selectionEnd=e.target.selectionStart=Math.min(r,e.target.value.length))):"Left"!=o&&"Right"!=o&&"Ctrl"!=o&&"Alt"!=o&&"Shift"!=o&&O.searchHistoryController.reset();try{i=Oe(a,t,!0,!0)}catch(e){}i?a.scrollIntoView(Ie(a,!s,i),30):(Pe(a),a.scrollTo(l.left,l.top))},onKeyDown:function(e,t,n){var r=Ye.keyName(e);"Esc"==r||"Ctrl-C"==r||"Ctrl-["==r||"Backspace"==r&&""==t?(O.searchHistoryController.pushInput(t),O.searchHistoryController.reset(),Oe(a,o),Pe(a),a.scrollTo(l.left,l.top),Ye.e_stop(e),B(a),n(),a.focus()):"Up"==r||"Down"==r?Ye.e_stop(e):"Ctrl-U"==r&&(Ye.e_stop(e),n(""))}});break;case"wordUnderCursor":var c=ue(a,!1,0,!1,!0),n=!0;if(c||(c=ue(a,!1,0,!1,!1),n=!1),!c)return;var u=a.getLine(c.start.line).substring(c.start.ch,c.end.ch);u=n&&e?"\\b"+u+"\\b":u.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1"),O.jumpList.cachedCursor=a.getCursor(),a.setCursor(c.start),d(u,!0,!1)}}function d(t,e,n){O.searchHistoryController.pushInput(t),O.searchHistoryController.reset();try{Oe(a,t,e,n)}catch(e){return Te(a,"Invalid regex: "+t),void B(a)}W.processMotion(a,r,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:i.searchArgs.toJumplist}})}function f(e){a.scrollTo(l.left,l.top),d(e,!0,!0);var t=O.macroModeState;t.isRecording&&(e=e,(t=t).isPlaying||(t=t.latestRegister,(t=O.registerController.getRegister(t))&&t.pushSearchQuery&&t.pushSearchQuery(e)))}},processEx:function(o,e,t){function n(e){O.exCommandHistoryController.pushInput(e),O.exCommandHistoryController.reset(),ze.processCommand(o,e)}function r(e,t,n){var r,i=Ye.keyName(e);("Esc"==i||"Ctrl-C"==i||"Ctrl-["==i||"Backspace"==i&&""==t)&&(O.exCommandHistoryController.pushInput(t),O.exCommandHistoryController.reset(),Ye.e_stop(e),B(o),n(),o.focus()),"Up"==i||"Down"==i?(Ye.e_stop(e),r=e.target?e.target.selectionEnd:0,n(t=O.exCommandHistoryController.nextMatch(t,"Up"==i)||""),r&&e.target&&(e.target.selectionEnd=e.target.selectionStart=Math.min(r,e.target.value.length))):"Ctrl-U"==i?(Ye.e_stop(e),n("")):"Left"!=i&&"Right"!=i&&"Ctrl"!=i&&"Alt"!=i&&"Shift"!=i&&O.exCommandHistoryController.reset()}"keyToEx"==t.type?ze.processCommand(o,t.exArgs.input):e.visualMode?Ae(o,{onClose:n,prefix:":",value:"'<,'>",onKeyDown:r,selectValueOnOpen:!1}):Ae(o,{onClose:n,prefix:":",onKeyDown:r})},evalInput:function(e,t){var n,r,i,o,a,s=t.inputState,l=s.motion,c=s.motionArgs||{},u=s.operator,d=s.operatorArgs||{},f=s.registerName,h=t.sel,p=X(t.visualMode?U(e,h.head):e.getCursor("head")),m=X(t.visualMode?U(e,h.anchor):e.getCursor("anchor")),g=X(p),v=X(m);if(u&&this.recordLastEdit(t,s),0<(m=void 0!==s.repeatOverride?s.repeatOverride:s.getRepeat())&&c.explicitRepeat?c.repeatIsExplicit=!0:(c.noRepeat||!c.explicitRepeat&&0===m)&&(c.repeatIsExplicit=!(m=1)),s.selectedCharacter&&(c.selectedCharacter=d.selectedCharacter=s.selectedCharacter),c.repeat=m,B(e),l){var y,b=q[l](e,p,c,t,s);if(t.lastMotion=q[l],!b)return;c.toJumplist&&((S=(y=O.jumpList).cachedCursor)?(de(e,S,b),delete y.cachedCursor):de(e,p,b)),S=(S=b instanceof Array?(n=b[0],b[1]):b)||X(p),t.visualMode?(t.visualBlock&&S.ch===1/0||(S=U(e,S)),n=n&&U(e,n),h.anchor=n=n||v,h.head=S,ae(e),ve(e,t,"<",Q(n,S)?n:S),ve(e,t,">",Q(n,S)?S:n)):u||(S=U(e,S),e.setCursor(S.line,S.ch))}if(u){if(d.lastSel?(n=v,y=d.lastSel,b=Math.abs(y.head.line-y.anchor.line),p=Math.abs(y.head.ch-y.anchor.ch),S=y.visualLine?et(v.line+b,v.ch):y.visualBlock?et(v.line+b,v.ch+p):y.head.line==y.anchor.line?et(v.line,v.ch+p):et(v.line+b,v.ch),t.visualMode=!0,t.visualLine=y.visualLine,t.visualBlock=y.visualBlock,h=t.sel={anchor:n,head:S},ae(e)):t.visualMode&&(d.lastSel={anchor:X(h.anchor),head:X(h.head),visualBlock:t.visualBlock,visualLine:t.visualLine}),t.visualMode){if(i=J(h.head,h.anchor),o=Z(h.head,h.anchor),r=t.visualLine||d.linewise,C=se(e,{anchor:i,head:o},w=t.visualBlock?"block":r?"line":"char"),r){var k=C.ranges;if("block"==w)for(var x=0;x<k.length;x++)k[x].head.ch=te(e,k[x].head.line);else"line"==w&&(k[0].head=et(k[0].head.line+1,0))}}else{i=X(n||v),Q(o=X(S||g),i)&&(a=i,i=o,o=a),(r=c.linewise||d.linewise)?(a=o,i.ch=0,a.ch=0,a.line++):c.forward&&function(e,t,n){t=e.getRange(t,n);if(/\n\s*$/.test(t)){var r=t.split("\n");r.pop();for(var i=r.pop();0<r.length&&i&&_(i);i=r.pop())n.line--,n.ch=0;i?(n.line--,n.ch=te(e,n.line)):n.ch=0}}(e,i,o);var w="char",c=!c.inclusive||r,C=se(e,{anchor:i,head:o},w,c)}e.setSelections(C.ranges,C.primary),t.lastMotion=null,d.repeat=m,d.registerName=f,d.linewise=r;var S=j[u](e,d,C.ranges,v,S);t.visualMode&&le(e,null!=S),S&&e.setCursor(S)}},recordLastEdit:function(e,t,n){var r=O.macroModeState;r.isPlaying||(e.lastEditInputState=t,e.lastEditActionCommand=n,r.lastInsertModeChanges.changes=[],r.lastInsertModeChanges.expectCursorActivityForChange=!1,r.lastInsertModeChanges.visualBlock=e.visualBlock?e.sel.head.line-e.sel.anchor.line:0)}},q={moveToTopLine:function(e,t,n){n=Re(e).top+n.repeat-1;return et(n,ce(e.getLine(n)))},moveToMiddleLine:function(e){var t=Re(e),t=Math.floor(.5*(t.top+t.bottom));return et(t,ce(e.getLine(t)))},moveToBottomLine:function(e,t,n){n=Re(e).bottom-n.repeat+1;return et(n,ce(e.getLine(n)))},expandToLine:function(e,t,n){return et(t.line+n.repeat-1,1/0)},findNext:function(e,t,n){var r=ke(e),i=r.getQuery();if(i){var o=!n.forward,o=r.isReversed()?!o:o;return Ee(e,i),Ie(e,o,i,n.repeat)}},findAndSelectNextInclusive:function(e,t,n,r,i){var o=ke(e),a=o.getQuery();if(a){var s=!n.forward,l=function(i,o,a,s,l){void 0===s&&(s=1);return i.operation(function(){var e=i.getCursor(),t=i.getSearchCursor(a,e),n=t.find(!o);!l.visualMode&&n&&Y(t.from(),e)&&t.find(!o);for(var r=0;r<s;r++)if(!(n=t.find(o))&&!(t=i.getSearchCursor(a,o?et(i.lastLine()):et(i.firstLine(),0))).find(o))return;return[t.from(),t.to()]})}(e,s=o.isReversed()?!s:s,a,n.repeat,r);if(l){if(i.operator)return l;a=l[0],i=et(l[1].line,l[1].ch-1);if(r.visualMode){(r.visualLine||r.visualBlock)&&(r.visualLine=!1,r.visualBlock=!1,Ye.signal(e,"vim-mode-change",{mode:"visual",subMode:""}));l=r.sel.anchor;if(l)return o.isReversed()?n.forward?[l,a]:[l,i]:n.forward?[l,i]:[l,a]}else r.visualMode=!0,r.visualLine=!1,r.visualBlock=!1,Ye.signal(e,"vim-mode-change",{mode:"visual",subMode:""});return s?[i,a]:[a,i]}}},goToMark:function(e,t,n,r){r=Be(e,r,n.selectedCharacter);return r?n.linewise?{line:r.line,ch:ce(e.getLine(r.line))}:r:null},moveToOtherHighlightedEnd:function(e,t,n,r){if(r.visualBlock&&n.sameLine){n=r.sel;return[U(e,et(n.anchor.line,n.head.ch)),U(e,et(n.head.line,n.anchor.ch))]}return[r.sel.head,r.sel.anchor]},jumpToMark:function(e,t,n,r){for(var i=t,o=0;o<n.repeat;o++){var a,s,l,c,u=i;for(a in r.marks)b(a)&&(s=r.marks[a].find(),(n.forward?Q(s,u):Q(u,s))||n.linewise&&s.line==u.line||(l=Y(u,i),c=n.forward?ee(u,s,i):ee(i,s,u),(l||c)&&(i=s)))}return i=n.linewise?et(i.line,ce(e.getLine(i.line))):i},moveByCharacters:function(e,t,n){var r=n.repeat,r=n.forward?t.ch+r:t.ch-r;return et(t.line,r)},moveByLines:function(e,t,n,r){var i=t,o=i.ch;switch(r.lastMotion){case this.moveByLines:case this.moveByDisplayLines:case this.moveByScroll:case this.moveToColumn:case this.moveToEol:o=r.lastHPos;break;default:r.lastHPos=o}var a=n.repeat+(n.repeatOffset||0),s=n.forward?i.line+a:i.line-a,l=e.firstLine(),c=e.lastLine(),a=e.findPosV(i,n.forward?a:-a,"line",r.lastHSPos);return(n.forward?a.line>s:a.line<s)&&(s=a.line,o=a.ch),s<l&&i.line==l?this.moveToStartOfLine(e,t,n,r):c<s&&i.line==c?me(e,t,n,r,!0):(n.toFirstChar&&(o=ce(e.getLine(s)),r.lastHPos=o),r.lastHSPos=e.charCoords(et(s,o),"div").left,et(s,o))},moveByDisplayLines:function(e,t,n,r){var i=t;switch(r.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:r.lastHSPos=e.charCoords(i,"div").left}var o,t=n.repeat,t=e.findPosV(i,n.forward?t:-t,"line",r.lastHSPos);return t.hitSide&&(t=n.forward?(o={top:e.charCoords(t,"div").top+8,left:r.lastHSPos},e.coordsChar(o,"div")):((o=e.charCoords(et(e.firstLine(),0),"div")).left=r.lastHSPos,e.coordsChar(o,"div"))),r.lastHPos=t.ch,t},moveByPage:function(e,t,n){var r=n.repeat;return e.findPosV(t,n.forward?r:-r,"page")},moveByParagraph:function(e,t,n){var r=n.forward?1:-1;return ye(e,t,n.repeat,r)},moveBySentence:function(e,t,n){var r=n.forward?1:-1;return function(e,t,n,r){function u(e,t){if(t.pos+t.dir<0||t.pos+t.dir>=t.line.length){if(t.ln+=t.dir,!y(e,t.ln))return t.line=null,t.ln=null,void(t.pos=null);t.line=e.getLine(t.ln),t.pos=0<t.dir?0:t.line.length-1}else t.pos+=t.dir}var i={ln:t.line,pos:t.ch};for(;0<n;)i=(r<0?function(e,t,n,r){var i={line:s=e.getLine(t),ln:t,pos:n,dir:r},o={ln:i.ln,pos:null},a=""===i.line;for(u(e,i);null!==i.line;){if(""===i.line&&!a)return null!==o.pos?o:{ln:i.ln,pos:i.pos};if(x(i.line[i.pos])&&null!==o.pos&&(i.ln!==o.ln||i.pos+1!==o.pos))return o;""===i.line||_(i.line[i.pos])||(a=!1,o={ln:i.ln,pos:i.pos}),u(e,i)}for(var s=e.getLine(o.ln),l=o.pos=0;l<s.length;++l)if(!_(s[l])){o.pos=l;break}return o}:function(e,t,n,r){var i=""===(l=e.getLine(t)),o={line:l,ln:t,pos:n,dir:r},a={ln:o.ln,pos:o.pos},s=""===o.line;for(u(e,o);null!==o.line;){if(a.ln=o.ln,a.pos=o.pos,""===o.line&&!s)return{ln:o.ln,pos:o.pos};if(i&&""!==o.line&&!_(o.line[o.pos]))return{ln:o.ln,pos:o.pos};!x(o.line[o.pos])||i||o.pos!==o.line.length-1&&!_(o.line[o.pos+1])||(i=!0),u(e,o)}var l=e.getLine(a.ln);a.pos=0;for(var c=l.length-1;0<=c;--c)if(!_(l[c])){a.pos=c;break}return a})(e,i.ln,i.pos,r),n--;return et(i.ln,i.pos)}(e,t,n.repeat,r)},moveByScroll:function(e,t,n,r){var i=e.getScrollInfo(),o=null,a=(a=n.repeat)||i.clientHeight/(2*e.defaultTextHeight()),s=e.charCoords(t,"local");if(n.repeat=a,!(o=q.moveByDisplayLines(e,t,n,r)))return null;r=e.charCoords(o,"local");return e.scrollTo(null,i.top+r.top-s.top),o},moveByWords:function(e,t,n){return function(e,t,n,r,i,o){var a=X(t),s=[];(r&&!i||!r&&i)&&n++;for(var l=!(r&&i),c=0;c<n;c++){var u=function(e,t,n,r,i){var o=t.line,a=t.ch,s=e.getLine(o),l=n?1:-1,c=r?g:m;if(i&&""==s){if(o+=l,s=e.getLine(o),!y(e,o))return null;a=n?0:s.length}for(;;){if(i&&""==s)return{from:0,to:0,line:o};for(var u=0<l?s.length:-1,d=u,f=u;a!=u;){for(var h=!1,p=0;p<c.length&&!h;++p)if(c[p](s.charAt(a))){for(d=a;a!=u&&c[p](s.charAt(a));)a+=l;if(h=d!=(f=a),d!=t.ch||o!=t.line||f!=d+l)return{from:Math.min(d,f+1),to:Math.max(d,f),line:o}}h||(a+=l)}if(!y(e,o+=l))return null;s=e.getLine(o),a=0<l?0:s.length}}(e,t,r,o,l);if(!u){var d=te(e,e.lastLine());s.push(r?{line:e.lastLine(),from:d,to:d}:{line:0,from:0,to:0});break}s.push(u),t=et(u.line,r?u.to-1:u.from)}var f=s.length!=n,h=s[0],p=s.pop();return r&&!i?(f||h.from==a.ch&&h.line==a.line||(p=s.pop()),et(p.line,p.from)):r&&i?et(p.line,p.to-1):!r&&i?(f||h.to==a.ch&&h.line==a.line||(p=s.pop()),et(p.line,p.to)):et(p.line,p.from)}(e,t,n.repeat,!!n.forward,!!n.wordEnd,!!n.bigWord)},moveTillCharacter:function(e,t,n){var r=ge(e,n.repeat,n.forward,n.selectedCharacter),e=n.forward?-1:1;return fe(e,n),r?(r.ch+=e,r):null},moveToCharacter:function(e,t,n){var r=n.repeat;return fe(0,n),ge(e,r,n.forward,n.selectedCharacter)||t},moveToSymbol:function(e,t,n){return function(e,t,n,r){var i=X(e.getCursor()),o=n?1:-1,a=n?e.lineCount():-1,s=i.ch,l=i.line,c=e.getLine(l),u={lineText:c,nextCh:c.charAt(s),lastCh:null,index:s,symb:r,reverseSymb:(n?{")":"(","}":"{"}:{"(":")","{":"}"})[r],forward:n,depth:0,curMoveThrough:!1},n=he[r];if(!n)return i;var r=pe[n].init,d=pe[n].isComplete;r&&r(u);for(;l!==a&&t;){var f;u.index+=o,u.nextCh=u.lineText.charAt(u.index),u.nextCh||(l+=o,u.lineText=e.getLine(l)||"",0<o?u.index=0:(f=u.lineText.length,u.index=0<f?f-1:0),u.nextCh=u.lineText.charAt(u.index)),d(u)&&(i.line=l,i.ch=u.index,t--)}if(u.nextCh||u.curMoveThrough)return et(l,u.index);return i}(e,n.repeat,n.forward,n.selectedCharacter)||t},moveToColumn:function(e,t,n,r){n=n.repeat;return r.lastHPos=n-1,r.lastHSPos=e.charCoords(t,"div").left,t=n,e=(n=e).getCursor().line,U(n,et(e,t-1))},moveToEol:function(e,t,n,r){return me(e,t,n,r,!1)},moveToFirstNonWhiteSpaceCharacter:function(e,t){return et(t.line,ce(e.getLine(t.line)))},moveToMatchedSymbol:function(e,t){for(var n=t,r=n.line,i=n.ch,o=e.getLine(r);i<o.length;i++)if((a=o.charAt(i))&&-1!="()[]{}".indexOf(a)){var a=e.getTokenTypeAt(et(r,i+1));if("string"!==a&&"comment"!==a)break}if(i<o.length){t="<"===i||">"===i?/[(){}[\]<>]/:/[(){}[\]]/;return e.findMatchingBracket(et(r,i),{bracketRegex:t}).to}return n},moveToStartOfLine:function(e,t){return et(t.line,0)},moveToLineOrEdgeOfDocument:function(e,t,n){var r=n.forward?e.lastLine():e.firstLine();return n.repeatIsExplicit&&(r=n.repeat-e.getOption("firstLineNumber")),et(r,ce(e.getLine(r)))},textObjectManipulation:function(e,t,n,r){var i=n.selectedCharacter;"b"==i?i="(":"B"==i&&(i="{");var o=!n.textObjectInner;if({"(":")",")":"(","{":"}","}":"{","[":"]","]":"[","<":">",">":"<"}[i])a=function(e,t,n,r){var i=t,o={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/,"<":/[<>]/,">":/[<>]/}[n],t={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{","<":"<",">":"<"}[n],n=e.getLine(i.line).charAt(i.ch)===t?1:0;if(t=e.scanForBracket(et(i.line,i.ch+n),-1,void 0,{bracketRegex:o}),o=e.scanForBracket(et(i.line,i.ch+n),1,void 0,{bracketRegex:o}),!t||!o)return{start:i,end:i};t=t.pos,o=o.pos,(t.line==o.line&&t.ch>o.ch||t.line>o.line)&&(i=t,t=o,o=i);r?o.ch+=1:t.ch+=1;return{start:t,end:o}}(e,t,i,o);else if({"'":!0,'"':!0,"`":!0}[i])a=function(e,t,n,r){var i,o,a,s,t=X(t),l=e.getLine(t.line).split(""),e=l.indexOf(n);t.ch<e?t.ch=e:e<t.ch&&l[t.ch]==n&&(o=t.ch,--t.ch);if(l[t.ch]!=n||o)for(a=t.ch;-1<a&&!i;a--)l[a]==n&&(i=a+1);else i=t.ch+1;if(i&&!o)for(a=i,s=l.length;a<s&&!o;a++)l[a]==n&&(o=a);if(!i||!o)return{start:t,end:t};r&&(--i,++o);return{start:et(t.line,i),end:et(t.line,o)}}(e,t,i,o);else if("W"===i)a=ue(e,o,0,!0);else if("w"===i)a=ue(e,o,0,!1);else if("p"===i){var a=ye(e,t,n.repeat,0,o);n.linewise=!0,r.visualMode?r.visualLine||(r.visualLine=!0):((r=r.inputState.operatorArgs)&&(r.linewise=!0),a.end.line--)}else{if("t"!==i)return null;a=function(e,t,n){var r=t;if(!Ye.findMatchingTag||!Ye.findEnclosingTag)return{start:r,end:r};t=Ye.findMatchingTag(e,t)||Ye.findEnclosingTag(e,t);if(!t||!t.open||!t.close)return{start:r,end:r};if(n)return{start:t.open.from,end:t.close.to};return{start:t.open.to,end:t.close.from}}(e,t,o)}return e.state.vim.visualMode?function(e,t,n){var r=e.state.vim.sel,i=r.head,o=r.anchor;Q(n,t)&&(r=n,n=t,t=r);Q(i,o)?(i=J(t,i),o=Z(o,n)):(o=J(t,o),-1==(i=$(i=Z(i,n),0,-1)).ch&&i.line!=e.firstLine()&&(i=et(i.line-1,te(e,i.line-1))));return[o,i]}(e,a.start,a.end):[a.start,a.end]},repeatLastCharacterSearch:function(e,t,n){var r=O.lastCharacterSearch,i=n.repeat,o=n.forward===r.forward,a=(r.increment?1:0)*(o?-1:1);e.moveH(-a,"char");r=ge(e,i,n.inclusive=o,r.selectedCharacter);return r?(r.ch+=a,r):(e.moveH(a,"char"),t)}};function H(e,t){for(var n=[],r=0;r<t;r++)n.push(e);return n}var j={change:function(e,t,n){var r,i,o,a=e.state.vim,s=n[0].anchor,l=n[0].head,s=a.visualMode?t.fullLine?(l.ch=Number.MAX_VALUE,l.line--,e.setSelection(s,l),i=e.getSelection(),e.replaceSelection(""),s):(i=e.getSelection(),r=H("",n.length),e.replaceSelections(r),J(n[0].head,n[0].anchor)):(i=e.getRange(s,l),"moveByWords"!=(a=a.lastEditInputState||{}).motion||_(i)||(o=/\s+$/.exec(i))&&a.motionArgs&&a.motionArgs.forward&&(l=$(l,0,-o[0].length),i=i.slice(0,-o[0].length)),a=new et(s.line-1,Number.MAX_VALUE),o=e.firstLine()==e.lastLine(),l.line>e.lastLine()&&t.linewise&&!o?e.replaceRange("",a,l):e.replaceRange("",s,l),t.linewise&&(o||(e.setCursor(a),Ye.commands.newlineAndIndent(e)),s.ch=Number.MAX_VALUE),s);O.registerController.pushText(t.registerName,"change",i,t.linewise,1<n.length),K.enterInsertMode(e,{head:s},e.state.vim)},delete:function(e,t,n){var r,i,o,a=e.state.vim;return a.visualBlock?(i=e.getSelection(),o=H("",n.length),e.replaceSelections(o),r=n[0].anchor):(o=n[0].anchor,n=n[0].head,t.linewise&&n.line!=e.firstLine()&&o.line==e.lastLine()&&o.line==n.line-1&&(o.line==e.firstLine()?o.ch=0:o=et(o.line-1,te(e,o.line-1))),i=e.getRange(o,n),e.replaceRange("",o,n),r=o,t.linewise&&(r=q.moveToFirstNonWhiteSpaceCharacter(e,o))),O.registerController.pushText(t.registerName,"delete",i,t.linewise,a.visualBlock),U(e,r)},indent:function(e,t,n){var r=e.state.vim,i=n[0].anchor.line,o=(r.visualBlock?n[n.length-1].anchor:n[0].head).line,a=r.visualMode?t.repeat:1;t.linewise&&o--;for(var s=i;s<=o;s++)for(var l=0;l<a;l++)e.indentLine(s,t.indentRight);return q.moveToFirstNonWhiteSpaceCharacter(e,n[0].anchor)},indentAuto:function(e,t,n){return e.execCommand("indentAuto"),q.moveToFirstNonWhiteSpaceCharacter(e,n[0].anchor)},changeCase:function(e,t,n,r,i){for(var o=e.getSelections(),a=[],s=t.toLower,l=0;l<o.length;l++){var c=o[l],u="";if(!0===s)u=c.toLowerCase();else if(!1===s)u=c.toUpperCase();else for(var d=0;d<c.length;d++){var f=c.charAt(d);u+=k(f)?f.toLowerCase():f.toUpperCase()}a.push(u)}return e.replaceSelections(a),t.shouldMoveCursor?i:!e.state.vim.visualMode&&t.linewise&&n[0].anchor.line+1==n[0].head.line?q.moveToFirstNonWhiteSpaceCharacter(e,r):t.linewise?r:J(n[0].anchor,n[0].head)},yank:function(e,t,n,r){var i=e.state.vim,e=e.getSelection(),r=i.visualMode?J(i.sel.anchor,i.sel.head,n[0].head,n[0].anchor):r;return O.registerController.pushText(t.registerName,"yank",e,t.linewise,i.visualBlock),r}};var K={jumpListWalk:function(e,t,n){n.visualMode||(n=t.repeat,t=t.forward,n=(n=(n=O.jumpList.move(e,t?n:-n))?n.find():void 0)||e.getCursor(),e.setCursor(n))},scroll:function(e,t,n){var r,i,o;n.visualMode||(i=t.repeat||1,r=e.defaultTextHeight(),o=e.getScrollInfo().top,n=r*i,i=t.forward?o+n:o-n,o=X(e.getCursor()),n=e.charCoords(o,"local"),t.forward?i>n.top?(o.line+=(i-n.top)/r,o.line=Math.ceil(o.line),e.setCursor(o),n=e.charCoords(o,"local"),e.scrollTo(null,n.top)):e.scrollTo(null,i):(t=i+e.getScrollInfo().clientHeight)<n.bottom?(o.line-=(n.bottom-t)/r,o.line=Math.floor(o.line),e.setCursor(o),n=e.charCoords(o,"local"),e.scrollTo(null,n.bottom-e.getScrollInfo().clientHeight)):e.scrollTo(null,i))},scrollToCursor:function(e,t){var n=e.getCursor().line,n=e.charCoords(et(n,0),"local"),r=e.getScrollInfo().clientHeight,i=n.top,o=n.bottom-i;switch(t.position){case"center":i=i-r/2+o;break;case"bottom":i=i-r+o}e.scrollTo(null,i)},replayMacro:function(e,t,n){var r=t.selectedCharacter,i=t.repeat,o=O.macroModeState;for("@"==r?r=o.latestRegister:o.latestRegister=r;i--;)!function(e,t,n,r){var i=O.registerController.getRegister(r);if(":"!=r){var o=i.keyBuffer,a=0;n.isPlaying=!0,n.replaySearchQueries=i.searchQueries.slice(0);for(var s=0;s<o.length;s++)for(var l,c,u=o[s];u;)l=/<\w+-.+?>|<\w+>|./.exec(u),c=l[0],u=u.substring(l.index+c.length),Ye.Vim.handleKey(e,c,"macro"),t.insertMode&&(c=i.insertModeChanges[a++].changes,O.macroModeState.lastInsertModeChanges.changes=c,Xe(e,c,1),We(e));n.isPlaying=!1}else i.keyBuffer[0]&&ze.processCommand(e,i.keyBuffer[0]),n.isPlaying=!1}(e,n,o,r)},enterMacroRecordMode:function(e,t){var n=O.macroModeState,t=t.selectedCharacter;O.registerController.isValidRegister(t)&&n.enterMacroRecordMode(e,t)},toggleOverwrite:function(e){e.state.overwrite?(e.toggleOverwrite(!1),e.setOption("keyMap","vim-insert"),Ye.signal(e,"vim-mode-change",{mode:"insert"})):(e.toggleOverwrite(!0),e.setOption("keyMap","vim-replace"),Ye.signal(e,"vim-mode-change",{mode:"replace"}))},enterInsertMode:function(e,t,n){if(!e.getOption("readOnly")){n.insertMode=!0,n.insertModeRepeat=t&&t.repeat||1;var r=t?t.insertAt:null,i=n.sel,o=t.head||e.getCursor("head"),a=e.listSelections().length;if("eol"==r)o=et(o.line,te(e,o.line));else if("bol"==r)o=et(o.line,0);else if("charAfter"==r)o=$(o,0,1);else if("firstNonBlank"==r)o=q.moveToFirstNonWhiteSpaceCharacter(e,o);else if("startOfSelectedArea"==r){if(!n.visualMode)return;n.visualBlock?(o=et(Math.min(i.head.line,i.anchor.line),Math.min(i.head.ch,i.anchor.ch)),a=Math.abs(i.head.line-i.anchor.line)+1):o=i.head.line<i.anchor.line?i.head:et(i.anchor.line,0)}else if("endOfSelectedArea"==r){if(!n.visualMode)return;n.visualBlock?(o=et(Math.min(i.head.line,i.anchor.line),Math.max(i.head.ch+1,i.anchor.ch)),a=Math.abs(i.head.line-i.anchor.line)+1):o=i.head.line>=i.anchor.line?$(i.head,0,1):et(i.anchor.line,0)}else if("inplace"==r){if(n.visualMode)return}else"lastEdit"==r&&(o=De(e)||o);e.setOption("disableInput",!1),t&&t.replace?(e.toggleOverwrite(!0),e.setOption("keyMap","vim-replace"),Ye.signal(e,"vim-mode-change",{mode:"replace"})):(e.toggleOverwrite(!1),e.setOption("keyMap","vim-insert"),Ye.signal(e,"vim-mode-change",{mode:"insert"})),O.macroModeState.isPlaying||(e.on("change",He),Ye.on(e.getInputField(),"keydown",$e)),n.visualMode&&le(e),ie(e,o,a)}},toggleVisualMode:function(e,t,n){var r=t.repeat,i=e.getCursor();n.visualMode?n.visualLine^t.linewise||n.visualBlock^t.blockwise?(n.visualLine=!!t.linewise,n.visualBlock=!!t.blockwise,Ye.signal(e,"vim-mode-change",{mode:"visual",subMode:n.visualLine?"linewise":n.visualBlock?"blockwise":""}),ae(e)):le(e):(n.visualMode=!0,n.visualLine=!!t.linewise,n.visualBlock=!!t.blockwise,r=U(e,et(i.line,i.ch+r-1)),n.sel={anchor:i,head:r},Ye.signal(e,"vim-mode-change",{mode:"visual",subMode:n.visualLine?"linewise":n.visualBlock?"blockwise":""}),ae(e),ve(e,n,"<",J(i,r)),ve(e,n,">",Z(i,r)))},reselectLastSelection:function(e,t,n){var r,i,o=n.lastSelection;n.visualMode&&oe(e,n),o&&(r=o.anchorMark.find(),i=o.headMark.find(),r&&i&&(n.sel={anchor:r,head:i},n.visualMode=!0,n.visualLine=o.visualLine,n.visualBlock=o.visualBlock,ae(e),ve(e,n,"<",J(r,i)),ve(e,n,">",Z(r,i)),Ye.signal(e,"vim-mode-change",{mode:"visual",subMode:n.visualLine?"linewise":n.visualBlock?"blockwise":""})))},joinLines:function(e,t,n){var r,i;n.visualMode?(i=e.getCursor("anchor"),Q(r=e.getCursor("head"),i)&&(s=r,r=i,i=s),r.ch=te(e,r.line)-1):(c=Math.max(t.repeat,2),i=e.getCursor(),r=U(e,et(i.line+c-1,1/0)));for(var o=0,a=i.line;a<r.line;a++){var o=te(e,i.line),s=et(i.line+1,te(e,i.line+1)),l=e.getRange(i,s),l=t.keepSpaces?l.replace(/\n\r?/g,""):l.replace(/\n\s*/g," ");e.replaceRange(l,i,s)}var c=et(i.line,o);n.visualMode&&le(e,!1),e.setCursor(c)},newLineAndEnterInsertMode:function(e,t,n){n.insertMode=!0;var r=X(e.getCursor());r.line!==e.firstLine()||t.after?(r.line=t.after?r.line:r.line-1,r.ch=te(e,r.line),e.setCursor(r),(Ye.commands.newlineAndIndentContinueComment||Ye.commands.newlineAndIndent)(e)):(e.replaceRange("\n",et(e.firstLine(),0)),e.setCursor(e.firstLine(),0)),this.enterInsertMode(e,{repeat:t.repeat},n)},paste:function(n,e,t){var r,i,o,a,s=X(n.getCursor()),l=O.registerController.getRegister(e.registerName),c=l.toString();if(c){e.matchIndent&&(r=n.getOption("tabSize"),i=function(e){var t=e.split("\t").length-1,e=e.split(" ").length-1;return t*r+e},y=n.getLine(n.getCursor().line),o=i(y.match(/^\s*/)[0]),k=c.replace(/\n$/,""),w=c!==k,a=i(c.match(/^\s*/)[0]),c=k.replace(/^\s*/gm,function(e){var t=o+(i(e)-a);if(t<0)return"";if(n.getOption("indentWithTabs")){e=Math.floor(t/r);return Array(e+1).join("\t")}return Array(t+1).join(" ")}),c+=w?"\n":""),1<e.repeat&&(c=Array(e.repeat+1).join(c));var u,d,f,h,p,m,g,v=l.linewise,y=l.blockwise;if(y){c=c.split("\n"),v&&c.pop();for(var b=0;b<c.length;b++)c[b]=""==c[b]?" ":c[b];s.ch+=e.after?1:0,s.ch=Math.min(te(n,s.line),s.ch)}else v?t.visualMode?c=t.visualLine?c.slice(0,-1):"\n"+c.slice(0,c.length-1)+"\n":e.after?(c="\n"+c.slice(0,c.length-1),s.ch=te(n,s.line)):s.ch=0:s.ch+=e.after?1:0;if(t.visualMode){t.lastPastedText=c;var k=(m=n,g=t.lastSelection,(t.visualMode?function(){var e=m.listSelections(),t=e[0],e=e[e.length-1];return[Q(t.anchor,t.head)?t.anchor:t.head,Q(e.anchor,e.head)?e.head:e.anchor]}:function(){var e=m.getCursor(),t=m.getCursor(),n=g.visualBlock;if(n){for(var r=n.width,i=n.height,t=et(e.line+i,e.ch+r),o=[],a=e.line;a<t.line;a++){var s=et(a,e.ch),l=et(a,t.ch);o.push({anchor:s,head:l})}m.setSelections(o)}else{n=g.anchorMark.find(),i=g.headMark.find(),r=i.line-n.line,n=i.ch-n.ch;t={line:t.line+r,ch:r?t.ch:n+t.ch},g.visualLine&&(e=et(e.line,0),t=et(t.line,te(m,t.line))),m.setSelection(e,t)}return[e,t]})()),x=k[0],w=k[1],l=n.getSelection(),k=n.listSelections(),k=new Array(k.length).join("1").split("1");t.lastSelection&&(d=t.lastSelection.headMark.find()),O.registerController.unnamedRegister.setText(l),x=y?(n.replaceSelections(k),w=et(x.line+c.length-1,x.ch),n.setCursor(x),re(n,w),n.replaceSelections(c),x):t.visualBlock?(n.replaceSelections(k),n.setCursor(x),n.replaceRange(c,x,x),x):(n.replaceRange(c,x,w),n.posFromIndex(n.indexFromPos(x)+c.length-1)),d&&(t.lastSelection.headMark=n.setBookmark(d)),v&&(x.ch=0)}else if(y){n.setCursor(s);for(b=0;b<c.length;b++){var C=s.line+b;C>n.lastLine()&&n.replaceRange("\n",et(C,0)),te(n,C)<s.ch&&(f=n,h=C,p=s.ch,C=void 0,C=te(f,h),p=new Array(p-C+1).join(" "),f.setCursor(et(h,C)),f.replaceRange(p,f.getCursor()))}n.setCursor(s),re(n,et(s.line+c.length-1,s.ch)),n.replaceSelections(c),x=s}else n.replaceRange(c,s),x=v&&e.after?et(s.line+1,ce(n.getLine(s.line+1))):v&&!e.after?et(s.line,ce(n.getLine(s.line))):!v&&e.after?(u=n.indexFromPos(s),n.posFromIndex(u+c.length-1)):(u=n.indexFromPos(s),n.posFromIndex(u+c.length));t.visualMode&&le(n,!1),n.setCursor(x)}},undo:function(e,t){e.operation(function(){G(e,Ye.commands.undo,t.repeat)(),e.setCursor(e.getCursor("anchor"))})},redo:function(e,t){G(e,Ye.commands.redo,t.repeat)()},setRegister:function(e,t,n){n.inputState.registerName=t.selectedCharacter},setMark:function(e,t,n){ve(e,n,t.selectedCharacter,e.getCursor())},replace:function(e,t,n){var r,i,o=t.selectedCharacter,a=e.getCursor(),s=e.listSelections(),t=n.visualMode?(a=e.getCursor("start"),e.getCursor("end")):(i=e.getLine(a.line),(r=a.ch+t.repeat)>i.length&&(r=i.length),et(a.line,r));"\n"==o?(n.visualMode||e.replaceRange("",a,t),(Ye.commands.newlineAndIndentContinueComment||Ye.commands.newlineAndIndent)(e)):(i=(i=e.getRange(a,t)).replace(/[^\n]/g,o),n.visualBlock?(r=new Array(e.getOption("tabSize")+1).join(" "),i=(i=e.getSelection()).replace(/\t/g,r).replace(/[^\n]/g,o).split("\n"),e.replaceSelections(i)):e.replaceRange(i,a,t),n.visualMode?(a=Q(s[0].anchor,s[0].head)?s[0].anchor:s[0].head,e.setCursor(a),le(e,!1)):e.setCursor($(t,0,-1)))},incrementNumberToken:function(e,t){for(var n,r,i,o,a,s,l,c=e.getCursor(),u=e.getLine(c.line),d=/(-?)(?:(0x)([\da-f]+)|(0b|0|)(\d+))/gi;null!==(n=d.exec(u))&&(i=(r=n.index)+n[0].length,!(c.ch<i)););!t.backtrack&&i<=c.ch||n&&(s=n[2]||n[4],l=n[3]||n[5],o=t.increase?1:-1,a={"0b":2,0:8,"":10,"0x":16}[s.toLowerCase()],a=(parseInt(n[1]+l,a)+o*t.repeat).toString(a),l=s?new Array(l.length-a.length+1+n[1].length).join("0"):"",a="-"===a.charAt(0)?"-"+s+l+a.substr(1):s+l+a,s=et(c.line,r),l=et(c.line,i),e.replaceRange(a,s,l),e.setCursor(et(c.line,r+a.length-1)))},repeatLastEdit:function(e,t,n){var r;n.lastEditInputState&&((r=t.repeat)&&t.repeatIsExplicit?n.lastEditInputState.repeatOverride=r:r=n.lastEditInputState.repeatOverride||r,Ge(e,n,r,!1))},indent:function(e,t){e.indentLine(e.getCursor().line,t.indentRight)},exitInsertMode:We};function U(e,t){var n=e.state.vim,r=n.insertMode||n.visualMode,n=Math.min(Math.max(e.firstLine(),t.line),e.lastLine()),r=te(e,n)-1+!!r,r=Math.min(Math.max(0,t.ch),r);return et(n,r)}function V(e){var t,n={};for(t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);return n}function $(e,t,n){return"object"==typeof t&&(n=t.ch,t=t.line),et(e.line+t,e.ch+n)}function G(t,n,r){return function(){for(var e=0;e<r;e++)n(t)}}function X(e){return et(e.line,e.ch)}function Y(e,t){return e.ch==t.ch&&e.line==t.line}function Q(e,t){return e.line<t.line||e.line==t.line&&e.ch<t.ch}function J(e,t){return Q(e,t=2<arguments.length?J.apply(void 0,Array.prototype.slice.call(arguments,1)):t)?e:t}function Z(e,t){return Q(e,t=2<arguments.length?Z.apply(void 0,Array.prototype.slice.call(arguments,1)):t)?t:e}function ee(e,t,n){e=Q(e,t),n=Q(t,n);return e&&n}function te(e,t){return e.getLine(t).length}function ne(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function re(e,t){var n=[],r=e.listSelections(),i=X(e.clipPos(t)),o=!Y(t,i),a=function(e,t,n){for(var r=0;r<e.length;r++){var i="head"!=n&&Y(e[r].anchor,t),o="anchor"!=n&&Y(e[r].head,t);if(i||o)return r}return-1}(r,e.getCursor("head")),s=Y(r[a].head,r[a].anchor),l=r.length-1,c=a<l-a?l:0,a=r[c].anchor,l=Math.min(a.line,i.line),u=Math.max(a.line,i.line),d=a.ch,f=i.ch,r=r[c].head.ch-d,c=f-d;0<r&&c<=0?(d++,o||f--):r<0&&0<=c?(d--,s||f++):r<0&&-1==c&&(d--,f++);for(var h=l;h<=u;h++){var p={anchor:new et(h,d),head:new et(h,f)};n.push(p)}return e.setSelections(n),t.ch=f,a.ch=d,a}function ie(e,t,n){for(var r=[],i=0;i<n;i++){var o=$(t,i,0);r.push({anchor:o,head:o})}e.setSelections(r,0)}function oe(e,t){var n=t.sel.anchor,r=t.sel.head;t.lastPastedText&&(r=e.posFromIndex(e.indexFromPos(n)+t.lastPastedText.length),t.lastPastedText=null),t.lastSelection={anchorMark:e.setBookmark(n),headMark:e.setBookmark(r),anchor:X(n),head:X(r),visualMode:t.visualMode,visualLine:t.visualLine,visualBlock:t.visualBlock}}function ae(e,t,n){var r=e.state.vim,n=se(e,t=t||r.sel,n=n||r.visualLine?"line":r.visualBlock?"block":"char");e.setSelections(n.ranges,n.primary),Ke(e)}function se(e,t,n,r){var i=X(t.head),o=X(t.anchor);if("char"==n){var a=r||Q(t.head,t.anchor)?0:1,r=Q(t.head,t.anchor)?1:0,i=$(t.head,0,a);return{ranges:[{anchor:o=$(t.anchor,0,r),head:i}],primary:0}}if("line"==n)return Q(t.head,t.anchor)?(i.ch=0,o.ch=te(e,o.line)):(o.ch=0,t=e.lastLine(),i.line>t&&(i.line=t),i.ch=te(e,i.line)),{ranges:[{anchor:o,head:i}],primary:0};if("block"==n){for(var s=Math.min(o.line,i.line),l=Math.min(o.ch,i.ch),n=Math.max(o.line,i.line),c=Math.max(o.ch,i.ch)+1,u=n-s+1,i=i.line==s?0:u-1,d=[],f=0;f<u;f++)d.push({anchor:et(s+f,l),head:et(s+f,c)});return{ranges:d,primary:i}}}function le(e,t){var n=e.state.vim;!1!==t&&e.setCursor(U(e,n.sel.head)),oe(e,n),n.visualMode=!1,n.visualLine=!1,n.visualBlock=!1,n.insertMode||Ye.signal(e,"vim-mode-change",{mode:"normal"}),Ue(n)}function ce(e){if(!e)return 0;var t=e.search(/\S/);return-1==t?e.length:t}function ue(e,t,n,r,i){for(var o,a,a=(a=(o=e).getCursor("head"),a=1==o.getSelection().length?J(a,o.getCursor("anchor")):a),s=e.getLine(a.line),l=a.ch,c=(i?m:g)[0];!c(s.charAt(l));)if(++l>=s.length)return null;r?c=g[0]:(c=m[0])(s.charAt(l))||(c=m[1]);for(var u=l,d=l;c(s.charAt(u))&&u<s.length;)u++;for(;c(s.charAt(d))&&0<=d;)d--;if(d++,t){for(t=u;/\s/.test(s.charAt(u))&&u<s.length;)u++;if(t==u){for(t=d;/\s/.test(s.charAt(d-1))&&0<d;)d--;d=d||t}}return{start:et(a.line,d),end:et(a.line,u)}}function de(e,t,n){Y(t,n)||O.jumpList.add(e,t,n)}function fe(e,t){O.lastCharacterSearch.increment=e,O.lastCharacterSearch.forward=t.forward,O.lastCharacterSearch.selectedCharacter=t.selectedCharacter}var he={"(":"bracket",")":"bracket","{":"bracket","}":"bracket","[":"section","]":"section","*":"comment","/":"comment",m:"method",M:"method","#":"preprocess"},pe={bracket:{isComplete:function(e){if(e.nextCh===e.symb){if(e.depth++,1<=e.depth)return!0}else e.nextCh===e.reverseSymb&&e.depth--;return!1}},section:{init:function(e){e.curMoveThrough=!0,e.symb=(e.forward?"]":"[")===e.symb?"{":"}"},isComplete:function(e){return 0===e.index&&e.nextCh===e.symb}},comment:{isComplete:function(e){var t="*"===e.lastCh&&"/"===e.nextCh;return e.lastCh=e.nextCh,t}},method:{init:function(e){e.symb="m"===e.symb?"{":"}",e.reverseSymb="{"===e.symb?"}":"{"},isComplete:function(e){return e.nextCh===e.symb}},preprocess:{init:function(e){e.index=0},isComplete:function(e){if("#"===e.nextCh){var t=e.lineText.match(/^#(\w+)/)[1];if("endif"===t){if(e.forward&&0===e.depth)return!0;e.depth++}else if("if"===t){if(!e.forward&&0===e.depth)return!0;e.depth--}if("else"===t&&0===e.depth)return!0}return!1}}};function me(e,t,n,r,i){t=et(t.line+n.repeat-1,1/0),n=e.clipPos(t);return n.ch--,i||(r.lastHPos=1/0,r.lastHSPos=e.charCoords(n,"div").left),t}function ge(e,t,n,r){for(var i,o=e.getCursor(),a=o.ch,s=0;s<t;s++){if(-1==(i=function(e,t,n,r,i){var o;r?-1==(o=t.indexOf(n,e+1))||i||--o:-1==(o=t.lastIndexOf(n,e-1))||i||(o+=1);return o}(a,e.getLine(o.line),r,n,!0)))return null;a=i}return et(e.getCursor().line,i)}function ve(e,t,n,r){w(n,p)&&(t.marks[n]&&t.marks[n].clear(),t.marks[n]=e.setBookmark(r))}function ye(t,e,n,r,i){var o=e.line,a=t.firstLine(),s=t.lastLine(),l=o;function c(e){return!t.getLine(e)}function u(e,t,n){return n?c(e)!=c(e+t):!c(e)&&c(e+t)}if(r){for(;a<=l&&l<=s&&0<n;)u(l,r)&&n--,l+=r;return new et(l,0)}var d,e=t.state.vim;e.visualLine&&u(o,1,!0)&&(u((d=e.sel.anchor).line,-1,!0)&&(i&&d.line==o||(o+=1)));for(var f=c(o),l=o;l<=s&&n;l++)u(l,1,!0)&&(i&&c(l)==f||n--);for(d=new et(l,0),s<l&&!f?f=!0:i=!1,l=o;a<l&&(i&&c(l)!=f&&l!=o||!u(l,-1,!0));l--);return{start:new et(l,0),end:d}}function be(){}function ke(e){e=e.state.vim;return e.searchState_||(e.searchState_=new be)}function xe(e,t){var n=we(e,t)||[];if(!n.length)return[];var r=[];if(0===n[0]){for(var i=0;i<n.length;i++)"number"==typeof n[i]&&r.push(e.substring(n[i]+1,n[i+1]));return r}}function we(e,t){t=t||"/";for(var n=!1,r=[],i=0;i<e.length;i++){var o=e.charAt(i);n||o!=t||r.push(i),n=!n&&"\\"==o}return r}S("pcre",!0,"boolean"),be.prototype={getQuery:function(){return O.query},setQuery:function(e){O.query=e},getOverlay:function(){return this.searchOverlay},setOverlay:function(e){this.searchOverlay=e},isReversed:function(){return O.isReversed},setReversed:function(e){O.isReversed=e},getScrollbarAnnotate:function(){return this.annotate},setScrollbarAnnotate:function(e){this.annotate=e}};var Ce={"\\n":"\n","\\r":"\r","\\t":"\t"};function Se(e){for(var t=!1,n=[],r=-1;r<e.length;r++){var i=e.charAt(r)||"",o=e.charAt(r+1)||"";Ce[i+o]?(n.push(Ce[i+o]),r++):t?(n.push(i),t=!1):"\\"===i?(t=!0,c.test(o)||"$"===o?n.push("$"):"/"!==o&&"\\"!==o&&n.push("\\")):("$"===i&&n.push("$"),n.push(i),"/"===o&&n.push("\\"))}return n.join("")}var _e={"\\/":"/","\\\\":"\\","\\n":"\n","\\r":"\r","\\t":"\t","\\&":"&"};function Le(e,t,n){if(O.registerController.getRegister("/").setText(e),e instanceof RegExp)return e;var r,i,o=we(e,"/");return o.length?(r=e.substring(0,o[0]),i=-1!=e.substring(o[0]).indexOf("i")):r=e,r?(M("pcre")||(r=function(e){for(var t=!1,n=[],r=-1;r<e.length;r++){var i=e.charAt(r)||"",o=e.charAt(r+1)||"",a=o&&-1!="|(){".indexOf(o);t?("\\"===i&&a||n.push(i),t=!1):"\\"===i?(t=!0,(a=o&&-1!="}".indexOf(o)?!0:a)&&"\\"!==o||n.push(i)):(n.push(i),a&&"\\"!==o&&n.push("\\"))}return n.join("")}(r)),n&&(t=/^[^A-Z]*$/.test(r)),new RegExp(r,t||i?"i":void 0)):null}function Me(e){"string"==typeof e&&(e=document.createElement(e));for(var t,n=1;n<arguments.length;n++)if(t=arguments[n])if((t="object"!=typeof t?document.createTextNode(t):t).nodeType)e.appendChild(t);else for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&("$"===r[0]?e.style[r.slice(1)]=t[r]:e.setAttribute(r,t[r]));return e}function Te(e,t){t=Me("pre",{$color:"red"},t);e.openNotification?e.openNotification(t,{bottom:!0,duration:5e3}):alert(t.innerText)}function Ae(e,t){var n,r,i=(t.prefix||"")+" "+(t.desc||""),r=(n=t.prefix,r=t.desc,Me(document.createDocumentFragment(),Me("span",{$fontFamily:"monospace",$whiteSpace:"pre"},n,Me("input",{type:"text",autocorrect:"off",autocapitalize:"off",spellcheck:"false"})),r&&Me("span",{$color:"#888"},r)));e.openDialog?e.openDialog(r,t.onClose,{onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,bottom:!0,selectValueOnOpen:!1,value:t.value}):t.onClose(prompt(i,""))}function Oe(e,t,n,r){if(t){var i=ke(e),r=Le(t,!!n,!!r);if(r)return Ee(e,r),function(e,t){if(e instanceof RegExp&&t instanceof RegExp){for(var n=["global","multiline","ignoreCase","source"],r=0;r<n.length;r++){var i=n[r];if(e[i]!==t[i])return}return 1}}(r,i.getQuery())||i.setQuery(r),r}}var Ne=0;function Ee(i,o){clearTimeout(Ne),Ne=setTimeout(function(){var n,r,e=ke(i),t=e.getOverlay();t&&o==t.query||(t&&i.removeOverlay(t),"^"==(n=o).source.charAt(0)&&(r=!0),i.addOverlay(t={token:function(e){if(!r||e.sol()){var t=e.match(n,!1);if(t)return 0==t[0].length?(e.next(),"searching"):e.sol()||(e.backUp(1),n.exec(e.next()+t[0]))?(e.match(n),"searching"):(e.next(),null);for(;!e.eol()&&(e.next(),!e.match(n,!1)););}else e.skipToEnd()},query:n}),i.showMatchesOnScrollbar&&(e.getScrollbarAnnotate()&&e.getScrollbarAnnotate().clear(),e.setScrollbarAnnotate(i.showMatchesOnScrollbar(o))),e.setOverlay(t))},50)}function Ie(i,o,a,s){return void 0===s&&(s=1),i.operation(function(){for(var e=i.getCursor(),t=i.getSearchCursor(a,e),n=0;n<s;n++){var r=t.find(o);if(!(r=0==n&&r&&Y(t.from(),e)?t.find(o):r)&&!(t=i.getSearchCursor(a,o?et(i.lastLine()):et(i.firstLine(),0))).find(o))return}return t.from()})}function Pe(e){var t=ke(e);e.removeOverlay(ke(e).getOverlay()),t.setOverlay(null),t.getScrollbarAnnotate()&&(t.getScrollbarAnnotate().clear(),t.setScrollbarAnnotate(null))}function Re(e){var t=e.getScrollInfo(),n=e.coordsChar({left:0,top:6+t.top},"local"),t=t.clientHeight-10+t.top,t=e.coordsChar({left:0,top:t},"local");return{top:n.line,bottom:t.line}}function Be(e,t,n){if("'"==n||"`"==n)return O.jumpList.find(e,-1)||et(0,0);if("."==n)return De(e);n=t.marks[n];return n&&n.find()}function De(e){for(var t=e.doc.history.done,n=t.length;n--;)if(t[n].changes)return X(t[n].changes[0].to)}h=function(){this.buildCommandMap_()};h.prototype={processCommand:function(e,t,n){var r=this;e.operation(function(){e.curOp.isVimOp=!0,r._processCommand(e,t,n)})},_processCommand:function(t,e,n){var r=t.state.vim,i=O.registerController.getRegister(":"),o=i.toString();r.visualMode&&le(t);r=new Ye.StringStream(e);i.setText(e);var a,s,n=n||{};n.input=e;try{this.parseInput_(t,r,n)}catch(e){throw Te(t,e.toString()),e}if(n.commandName){if(a=this.matchCommand_(n.commandName)){if(s=a.name,a.excludeFromCommandHistory&&i.setText(o),this.parseCommandArgs_(r,n,a),"exToKey"==a.type){for(var l=0;l<a.toKeys.length;l++)Ye.Vim.handleKey(t,a.toKeys[l],"mapping");return}if("exToEx"==a.type)return void this.processCommand(t,a.toInput)}}else void 0!==n.line&&(s="move");if(s)try{Fe[s](t,n),a&&a.possiblyAsync||!n.callback||n.callback()}catch(e){throw Te(t,e.toString()),e}else Te(t,'Not an editor command ":'+e+'"')},parseInput_:function(e,t,n){t.eatWhile(":"),t.eat("%")?(n.line=e.firstLine(),n.lineEnd=e.lastLine()):(n.line=this.parseLineSpec_(e,t),void 0!==n.line&&t.eat(",")&&(n.lineEnd=this.parseLineSpec_(e,t)));e=t.match(/^(\w+|!!|@@|[!#&*<=>@~])/);return n.commandName=e?e[1]:t.match(/.*/)[0],n},parseLineSpec_:function(e,t){var n=t.match(/^(\d+)/);if(n)return parseInt(n[1],10)-1;switch(t.next()){case".":return this.parseLineSpecOffset_(t,e.getCursor().line);case"$":return this.parseLineSpecOffset_(t,e.lastLine());case"'":var r=t.next(),r=Be(e,e.state.vim,r);if(!r)throw new Error("Mark not set");return this.parseLineSpecOffset_(t,r.line);case"-":case"+":return t.backUp(1),this.parseLineSpecOffset_(t,e.getCursor().line);default:return void t.backUp(1)}},parseLineSpecOffset_:function(e,t){var n=e.match(/^([+-])?(\d+)/);return n&&(e=parseInt(n[2],10),"-"==n[1]?t-=e:t+=e),t},parseCommandArgs_:function(e,t,n){e.eol()||(t.argString=e.match(/.*/)[0],n=n.argDelimiter||/\s+/,(n=ne(t.argString).split(n)).length&&n[0]&&(t.args=n))},matchCommand_:function(e){for(var t=e.length;0<t;t--){var n=e.substring(0,t);if(this.commandMap_[n]){n=this.commandMap_[n];if(0===n.name.indexOf(e))return n}}return null},buildCommandMap_:function(){this.commandMap_={};for(var e=0;e<Ze.length;e++){var t=Ze[e],n=t.shortName||t.name;this.commandMap_[n]=t}},map:function(e,t,n){if(":"!=e&&":"==e.charAt(0)){if(n)throw Error("Mode not supported for ex mappings");var r=e.substring(1);":"!=t&&":"==t.charAt(0)?this.commandMap_[r]={name:r,type:"exToEx",toInput:t.substring(1),user:!0}:this.commandMap_[r]={name:r,type:"exToKey",toKeys:t,user:!0}}else t=":"!=t&&":"==t.charAt(0)?{keys:e,type:"keyToEx",exArgs:{input:t.substring(1)}}:{keys:e,type:"keyToKey",toKeys:t},n&&(t.context=n),Qe.unshift(t)},unmap:function(e,t){if(":"!=e&&":"==e.charAt(0)){if(t)throw Error("Mode not supported for ex mappings");var n=e.substring(1);if(this.commandMap_[n]&&this.commandMap_[n].user)return void delete this.commandMap_[n]}else for(var r=e,i=0;i<Qe.length;i++)if(r==Qe[i].keys&&Qe[i].context===t)return void Qe.splice(i,1);throw Error("No such mapping.")}};var Fe={colorscheme:function(e,t){!t.args||t.args.length<1?Te(e,e.getOption("theme")):e.setOption("theme",t.args[0])},map:function(e,t,n){var r=t.args;!r||r.length<2?e&&Te(e,"Invalid mapping: "+t.input):ze.map(r[0],r[1],n)},imap:function(e,t){this.map(e,t,"insert")},nmap:function(e,t){this.map(e,t,"normal")},vmap:function(e,t){this.map(e,t,"visual")},unmap:function(e,t,n){var r=t.args;!r||r.length<1?e&&Te(e,"No such mapping: "+t.input):ze.unmap(r[0],n)},move:function(e,t){W.processCommand(e,e.state.vim,{type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0},repeatOverride:t.line+1})},set:function(e,t){var n=t.args,r=t.setCfg||{};if(!n||n.length<1)e&&Te(e,"Invalid mapping: "+t.input);else{var i=n[0].split("="),o=i[0],n=i[1],i=!1;if("?"==o.charAt(o.length-1)){if(n)throw Error("Trailing characters: "+t.argString);o=o.substring(0,o.length-1),i=!0}void 0===n&&"no"==o.substring(0,2)&&(o=o.substring(2),n=!1);t=C[o]&&"boolean"==C[o].type;t&&null==n&&(n=!0),!t&&void 0===n||i?(i=M(o,e,r))instanceof Error?Te(e,i.message):Te(e,!0===i||!1===i?" "+(i?"":"no")+o:" "+o+"="+i):(r=L(o,n,e,r))instanceof Error&&Te(e,r.message)}},setlocal:function(e,t){t.setCfg={scope:"local"},this.set(e,t)},setglobal:function(e,t){t.setCfg={scope:"global"},this.set(e,t)},registers:function(e,t){var n=t.args,r=O.registerController.registers,i="----------Registers----------\n\n";if(n)for(var n=n.join(""),o=0;o<n.length;o++)a=n.charAt(o),O.registerController.isValidRegister(a)&&(i+='"'+a+" "+(r[a]||new D).toString()+"\n");else for(var a in r){var s=r[a].toString();s.length&&(i+='"'+a+" "+s+"\n")}Te(e,i)},sort:function(e,i){var o,a,s,l,c;var t=function(){if(i.argString){var e=new Ye.StringStream(i.argString);if(e.eat("!")&&(o=!0),!e.eol()){if(!e.eatSpace())return"Invalid arguments";var t=e.match(/([dinuox]+)?\s*(\/.+\/)?\s*/);if(!t&&!e.eol())return"Invalid arguments";if(t[1]){a=-1!=t[1].indexOf("i"),s=-1!=t[1].indexOf("u");var n=-1!=t[1].indexOf("d")||-1!=t[1].indexOf("n")&&1,r=-1!=t[1].indexOf("x")&&1,e=-1!=t[1].indexOf("o")&&1;if(1<n+r+e)return"Invalid arguments";l=(n?"decimal":r&&"hex")||e&&"octal"}t[2]&&(c=new RegExp(t[2].substr(1,t[2].length-2),a?"i":""))}}}();if(t)Te(e,t+": "+i.argString);else{var n=i.line||e.firstLine(),t=i.lineEnd||i.line||e.lastLine();if(n!=t){var n=et(n,0),t=et(t,te(e,t)),r=e.getRange(n,t).split("\n"),u=c||("decimal"==l?/(-?)([\d]+)/:"hex"==l?/(-?)(?:0x)?([0-9a-f]+)/i:"octal"==l?/([0-7]+)/:null),d="decimal"==l?10:"hex"==l?16:"octal"==l?8:null,f=[],h=[];if(l||c)for(var p=0;p<r.length;p++){var m=c?r[p].match(c):null;m&&""!=m[0]?f.push(m):(!c&&u.exec(r[p])?f:h).push(r[p])}else h=r;if(f.sort(c?function(e,t){var n;return o&&(n=e,e=t,t=n),a&&(e[0]=e[0].toLowerCase(),t[0]=t[0].toLowerCase()),e[0]<t[0]?-1:1}:y),c)for(p=0;p<f.length;p++)f[p]=f[p].input;else l||h.sort(y);if(r=o?f.concat(h):h.concat(f),s)for(var g,v=r,r=[],p=0;p<v.length;p++)v[p]!=g&&r.push(v[p]),g=v[p];e.replaceRange(r.join("\n"),n,t)}}function y(e,t){o&&(r=e,e=t,t=r),a&&(e=e.toLowerCase(),t=t.toLowerCase());var n=l&&u.exec(e),r=l&&u.exec(t);return n?parseInt((n[1]+n[2]).toLowerCase(),d)-(r=parseInt((r[1]+r[2]).toLowerCase(),d)):e<t?-1:1}},vglobal:function(e,t){this.global(e,t)},global:function(t,e){var n=e.argString;if(n){var r,i="v"===e.commandName[0],o=void 0!==e.line?e.line:t.firstLine(),a=e.lineEnd||e.line||t.lastLine(),e=xe(n,"/"),n=n;if(e.length&&(n=e[0],r=e.slice(1,e.length).join("/")),n)try{Oe(t,n,!0,!0)}catch(e){return void Te(t,"Invalid regex: "+n)}for(var s,l,c=ke(t).getQuery(),u=[],d=o;d<=a;d++){var f=t.getLineHandle(d);c.test(f.text)!==i&&u.push(r?f:f.text)}r?(s=0,(l=function(){var e;s<u.length&&(e=u[s++],null!=(e=t.getLineNumber(e))?(e=e+1+r,ze.processCommand(t,e,{callback:l})):l())})()):Te(t,u.join("\n"))}else Te(t,"Regular Expression missing from global")},substitute:function(t,e){if(!t.getSearchCursor)throw new Error("Search feature not available. Requires searchcursor.js or any other getSearchCursor implementation.");var n,r,i,o,a=e.argString,s=a?xe(a,a[0]):[],l="",c=!1,u=!1;if(s.length)i=s[0],M("pcre")&&""!==i&&(i=new RegExp(i).source),l=s[1],/(^|[^\\])(\\\\)*\$$/.test(i)&&(i=i.slice(0,-1)+"\\n",l=(l||"")+"\n"),void 0!==l&&(l=M("pcre")?function(e){for(var t=new Ye.StringStream(e),n=[];!t.eol();){for(;t.peek()&&"\\"!=t.peek();)n.push(t.next());var r,i=!1;for(r in _e)if(t.match(r,!0)){i=!0,n.push(_e[r]);break}i||n.push(t.next())}return n.join("")}(l.replace(/([^\\])&/g,"$1$$&")):Se(l),O.lastSubstituteReplacePart=l),n=s[2]?s[2].split(" "):[];else if(a&&a.length)return void Te(t,"Substitutions should be of the form :s/pattern/replace/");if(n&&(r=n[0],o=parseInt(n[1]),r&&(-1!=r.indexOf("c")&&(c=!0),-1!=r.indexOf("g")&&(u=!0),i=M("pcre")?i+"/"+r:i.replace(/\//g,"\\/")+"/"+r)),i)try{Oe(t,i,!0,!0)}catch(e){return void Te(t,"Invalid regex: "+i)}void 0!==(l=l||O.lastSubstituteReplacePart)?(n=ke(t).getQuery(),r=(void 0!==e.line?e:t.getCursor()).line,i=e.lineEnd||r,r==t.firstLine()&&i==t.lastLine()&&(i=1/0),o&&(i=(r=i)+o-1),o=U(t,et(r,0)),o=t.getSearchCursor(n,o),function(i,e,r,o,a,s,n,l,c){i.state.vim.exMode=!0;var u,d,f,h=!1;function p(){i.operation(function(){for(;!h;)m(),g();v()})}function m(){var e=i.getRange(s.from(),s.to()).replace(n,l),t=s.to().line;s.replace(e),d=s.to().line,a+=d-t,f=d<t}function g(){for(;s.findNext()&&(e=s.from(),t=o,n=a,"number"!=typeof e&&(e=e.line),t instanceof Array?w(e,t):"number"==typeof n?t<=e&&e<=n:e==t);)if(r||s.from().line!=d||f)return i.scrollIntoView(s.from(),30),i.setSelection(s.from(),s.to()),u=s.from(),void(h=!1);var e,t,n;h=!0}function v(e){e&&e(),i.focus(),u&&(i.setCursor(u),(e=i.state.vim).exMode=!1,e.lastHPos=e.lastHSPos=u.ch),c&&c()}g(),h?Te(i,"No matches for "+n.source):e?Ae(i,{prefix:Me("span","replace with ",Me("strong",l)," (y/n/a/q/l)"),onKeyDown:function(e,t,n){switch(Ye.e_stop(e),Ye.keyName(e)){case"Y":m(),g();break;case"N":g();break;case"A":var r=c;c=void 0,i.operation(p),c=r;break;case"L":m();case"Q":case"Esc":case"Ctrl-C":case"Ctrl-[":v(n)}h&&v(n);return!0}}):(p(),c&&c())}(t,c,u,r,i,o,n,l,e.callback)):Te(t,"No previous substitute regular expression")},redo:Ye.commands.redo,undo:Ye.commands.undo,write:function(e){Ye.commands.save?Ye.commands.save(e):e.save&&e.save()},nohlsearch:function(e){Pe(e)},yank:function(e){var t=X(e.getCursor()).line,t=e.getLine(t);O.registerController.pushText("0","yank",t,!0,!0)},delmarks:function(e,t){if(t.argString&&ne(t.argString))for(var n=e.state.vim,r=new Ye.StringStream(ne(t.argString));!r.eol();){r.eatSpace();var i=r.pos;if(!r.match(/[a-zA-Z]/,!1))return void Te(e,"Invalid argument: "+t.argString.substring(i));var o=r.next();if(r.match("-",!0)){if(!r.match(/[a-zA-Z]/,!1))return void Te(e,"Invalid argument: "+t.argString.substring(i));var a=o,s=r.next();if(!(b(a)&&b(s)||k(a)&&k(s)))return void Te(e,"Invalid argument: "+a+"-");var l=a.charCodeAt(0),c=s.charCodeAt(0);if(c<=l)return void Te(e,"Invalid argument: "+t.argString.substring(i));for(var u=0;u<=c-l;u++){var d=String.fromCharCode(l+u);delete n.marks[d]}}else delete n.marks[o]}else Te(e,"Argument required")}},ze=new h;function We(e){var t=e.state.vim,n=O.macroModeState,r=O.registerController.getRegister("."),i=n.isPlaying,o=n.lastInsertModeChanges;i||(e.off("change",He),Ye.off(e.getInputField(),"keydown",$e)),!i&&1<t.insertModeRepeat&&(Ge(e,t,t.insertModeRepeat-1,!0),t.lastEditInputState.repeatOverride=t.insertModeRepeat),delete t.insertModeRepeat,t.insertMode=!1,e.setCursor(e.getCursor().line,e.getCursor().ch-1),e.setOption("keyMap","vim"),e.setOption("disableInput",!0),e.toggleOverwrite(!1),r.setText(o.changes.join("")),Ye.signal(e,"vim-mode-change",{mode:"normal"}),n.isRecording&&((e=n).isPlaying||(n=e.latestRegister,(n=O.registerController.getRegister(n))&&n.pushInsertModeChanges&&n.pushInsertModeChanges(e.lastInsertModeChanges)))}function qe(e){Qe.unshift(e)}function He(e,t){var n,r=O.macroModeState,i=r.lastInsertModeChanges;if(!r.isPlaying)for(;t;)i.expectCursorActivityForChange=!0,1<i.ignoreCount?i.ignoreCount--:"+input"!=t.origin&&"paste"!=t.origin&&void 0!==t.origin||(1<(n=e.listSelections().length)&&(i.ignoreCount=n),n=t.text.join("\n"),i.maybeReset&&(i.changes=[],i.maybeReset=!1),n&&(e.state.overwrite&&!/\n/.test(n)?i.changes.push([n]):i.changes.push(n))),t=t.next}function je(e){var t=e.state.vim;if(t.insertMode){var n=O.macroModeState;if(n.isPlaying)return;n=n.lastInsertModeChanges;n.expectCursorActivityForChange?n.expectCursorActivityForChange=!1:n.maybeReset=!0}else e.curOp.isVimOp||function(e,t){var n=e.getCursor("anchor"),r=e.getCursor("head");t.visualMode&&!e.somethingSelected()?le(e,!1):t.visualMode||t.insertMode||!e.somethingSelected()||(t.visualMode=!0,t.visualLine=!1,Ye.signal(e,"vim-mode-change",{mode:"visual"}));{var i,o;t.visualMode?(i=Q(r,n)?0:-1,o=Q(r,n)?-1:0,r=$(r,0,i),n=$(n,0,o),t.sel={anchor:n,head:r},ve(e,t,"<",J(r,n)),ve(e,t,">",Z(r,n))):t.insertMode||(t.lastHPos=e.getCursor().ch)}}(e,t);t.visualMode&&Ke(e)}function Ke(e){var t,n="cm-animate-fat-cursor",r=e.state.vim,i=U(e,X(r.sel.head)),o=$(i,0,1);Ue(r),i.ch==e.getLine(i.line).length?(t=Me("span",{class:n}," "),r.fakeCursorBookmark=e.setBookmark(i,{widget:t})):r.fakeCursor=e.markText(i,o,{className:n})}function Ue(e){e.fakeCursor&&(e.fakeCursor.clear(),e.fakeCursor=null),e.fakeCursorBookmark&&(e.fakeCursorBookmark.clear(),e.fakeCursorBookmark=null)}function Ve(e){this.keyName=e}function $e(e){var t=O.macroModeState.lastInsertModeChanges,n=Ye.keyName(e);n&&(-1==n.indexOf("Delete")&&-1==n.indexOf("Backspace")||Ye.lookupKey(n,"vim-insert",function(){return t.maybeReset&&(t.changes=[],t.maybeReset=!1),t.changes.push(new Ve(n)),!0}))}function Ge(n,r,e,t){var i=O.macroModeState;i.isPlaying=!0;var o=!!r.lastEditActionCommand,a=r.inputState;function s(){o?W.processAction(n,r,r.lastEditActionCommand):W.evalInput(n,r)}function l(e){var t;0<i.lastInsertModeChanges.changes.length&&(e=r.lastEditActionCommand?e:1,t=i.lastInsertModeChanges,Xe(n,t.changes,e))}if(r.inputState=r.lastEditInputState,o&&r.lastEditActionCommand.interlaceInsertRepeat)for(var c=0;c<e;c++)s(),l(1);else t||s(),l(e);r.inputState=a,r.insertMode&&!t&&We(n),i.isPlaying=!1}function Xe(t,e,n){function r(e){return"string"==typeof e?Ye.commands[e](t):e(t),!0}var i=t.getCursor("head"),o=O.macroModeState.lastInsertModeChanges.visualBlock;o&&(ie(t,i,o+1),n=t.listSelections().length,t.setCursor(i));for(var a=0;a<n;a++){o&&t.setCursor($(i,a,0));for(var s=0;s<e.length;s++){var l,c,u=e[s];u instanceof Ve?Ye.lookupKey(u.keyName,"vim-insert",r):"string"==typeof u?(c=t.getCursor(),t.replaceRange(u,c,c)):(c=$(l=t.getCursor(),0,u[0].length),t.replaceRange(u[0],l,c))}}o&&t.setCursor($(i,0,1))}return Ye.keyMap.vim={attach:r,detach:e,call:t},S("insertModeEscKeysTimeout",200,"number"),Ye.keyMap["vim-insert"]={fallthrough:["default"],attach:r,detach:e,call:t},Ye.keyMap["vim-replace"]={Backspace:"goCharLeft",fallthrough:["vim-insert"],attach:r,detach:e,call:t},P(),f}()}),function(i,u,o,t,a){"use strict";var d,s,l,c=i.getElementById("CodeMirror-settings"),r=i.getElementById("CodeMirror-settings__form"),f=i.getElementById("ed_toolbar"),h=i.getElementById("content")||i.getElementById("newcontent"),n=i.getElementById("content-html"),p=i.getElementById("content-tmce"),m=null!=i.getElementById("post_ID")?i.getElementById("post_ID").value:0,g=i.getElementById("editor-expand-toggle"),v={isVisualEnabled:null!=i.getElementById("content-tmce"),isThemeOrPlugin:null!=i.getElementById("newcontent"),isActive:function(){return null!=d},isVisualActive:function(){return null!=i.getElementsByClassName("tmce-active")[0]},isGutenberg:null!=(wp.data&&wp.data.select("core/edit-post")),isGutenbergVisualActive:function(){return"visual"===wp.data.select("core/edit-post").getEditorMode()},isFullHeight:function(){return!!g&&g.checked},previousSettingsPosition:"none",settingsPosition:function(){var e=this,t=f?"absolute"===f.style.position?"0px"===f.style.top?"top":"bottom":"fixed"===f.style.position?"middle":"normal":"none";return u.setTimeout(function(){e.previousSettingsPosition=t},0),t},charWidth:0},y={mode:"wordpresspost",tabMode:"indent",indentWithTabs:!0,smartIndent:!1,enterMode:"keep",styleActiveLine:!0,electricChars:!1,showCursorWhenSelecting:!0,viewportMargin:10,extraKeys:{F11:function(){P()},Esc:function(){P(!0)},"Ctrl-S":function(){e()},"Cmd-S":function(){e()}}};function e(){v.isGutenberg?(Q(),wp.data.dispatch("core/editor").savePost()):(i.getElementById("save-post")||i.getElementById("publish")||i.getElementById("submit")).click()}function b(e){var t=!1;return function(){t||(e.apply(this,arguments),t=!0,u.requestAnimationFrame(function(){u.requestAnimationFrame(function(){t=!1})}))}}function k(){for(var e=-1;e<c.children.length;e++){var t=e<0?l:c.children[e];null!=t&&(t.style.position="",t.style.top="",t.style.left="",t.style.right="",t.style.width="")}}var x=b(w);function w(e){S();var t=v.settingsPosition();if(t!==v.previousSettingsPosition||e&&"resize"===e.type)switch(R(),t){case"top":k();break;case"middle":!function(){for(var e=f.getBoundingClientRect(),t=-1;t<c.children.length;t++){var n=t<0?l:c.children[t];null!=n&&(n.style.position="fixed",n.style.top=e.bottom+"px",n.style.right=i.documentElement.getBoundingClientRect().width-e.right+"px",n.id.match(/toggle/gi)||(n.style.left=e.left+"px",n.style.width="auto"))}}();break;case"bottom":!function(){for(var e=f.getBoundingClientRect(),t=d.getWrapperElement().getBoundingClientRect(),n=-1;n<c.children.length;n++){var r=n<0?l:c.children[n];null!=r&&(r.style.position="absolute",r.style.top=-1*(t.top-e.bottom)+"px",r.style.left="",r.style.right="",r.style.width="")}}()}}var C=!!navigator.userAgent.match(/Trident/gi);function S(){var e,t,n;r&&(e=r.getBoundingClientRect().top,t=i.getElementById("post-status-info").getBoundingClientRect().top,n=u.innerHeight-e,r.style.maxHeight=Math.min(t-e,n)-6+"px",C&&(r.style.height=r.style.maxHeight))}function _(){v.isFullHeight()?(d.setOption("viewportMargin",1/0),d.on("change",R),u.addEventListener("scroll",x),u.addEventListener("resize",x),u.addEventListener("resize",D),d.getWrapperElement().style.height="auto",w(),F(),u.setTimeout(function(){S(),R()},100)):(d.setOption("viewportMargin",y.viewportMargin),d.off("change",R),u.removeEventListener("scroll",x),u.removeEventListener("resize",x),u.removeEventListener("resize",D),d.getWrapperElement().style.marginTop="",r.style.maxHeight="",C&&(r.style.height=""),k(),B())}function L(e){for(var t=0;t<e.length;t++){var n=e[t];if(n.addedNodes[0]&&n.addedNodes[0].classList.contains("CodeMirror-dialog"))for(var r=(l=n.addedNodes[0]).getElementsByTagName("button"),i=0;i<r.length;i++)r[i].classList="button button-small";else l=void 0}}function M(e){e.target.id.match(/advanced/gi)?c.classList.contains("open-advanced")?T("open"):T("advanced"):c.classList.contains("open")?T("closed"):T("open")}function T(e){switch(e){case"open":c.classList.add("open"),c.classList.remove("open-advanced"),c.classList.remove("closed");break;case"advanced":c.classList.add("open"),c.classList.add("open-advanced"),c.classList.remove("closed");break;default:c.classList.remove("open"),c.classList.remove("open-advanced"),c.classList.add("closed")}}function A(){v.charWidth=d.defaultCharWidth()*(a.fontSize/13)}function O(e){var t=+e.target.value,t=isNaN(t)?e.target.value:t;switch("checkbox"===e.target.type&&(t=e.target.checked),e.target.id){case"fontSize":a.fontSize=t,s.style.fontSize=t+"px",A(),d.refresh();break;case"lineHeight":a.lineHeight=t,s.style.lineHeight=t+"em",d.refresh();break;case"matchTags":a.matchTags=t,d.setOption("matchTags",t?{bothTags:!0}:null);break;case"scrollbarStyle":a.scrollbarStyle=t,d.setOption("scrollbarStyle",t?"overlay":null);break;case"foldGutter":d.setOption("gutters",t?["CodeMirror-linenumbers","CodeMirror-foldgutter"]:[]);case"tabSize":d.setOption("indentUnit",t);default:a[e.target.id]=t,d.setOption(e.target.id,t)}"lineNumbers"===e.target.id&&t&&a.foldGutter&&d.setOption("gutters",["CodeMirror-linenumbers","CodeMirror-foldgutter"])}function N(){var e=t(r).serializeArray();t.post(a.ajaxUrl,e,function(e){})}var E=i.getElementById("wp-content-editor-container"),I="heshFullscreen";function P(e){e=!0===e,v.isFullHeight()?E.classList.remove(I):(E.classList.contains(I)||e?E.classList.remove(I):E.classList.add(I),d.focus())}function R(){d.save(),d.getTextArea().style.height=d.getWrapperElement().getBoundingClientRect().height+"px"}function B(){d.getWrapperElement().style.height=d.getTextArea().style.height}var D=b(F);function F(){d.getWrapperElement().style.marginTop=f.offsetHeight+"px"}var z,W,q=200,H=500;function j(e){W=H+(e.pageY-z),d.getWrapperElement().style.height=Math.max(q,W)+"px"}function K(e){z=e.pageY,i.addEventListener("mousemove",j),i.addEventListener("mouseup",U),e.preventDefault()}function U(e){H=Math.max(q,W),i.removeEventListener("mousemove",j),d.refresh(),i.removeEventListener("mouseup",U)}function V(e){W=H=e,d.getWrapperElement().style.height=H+"px";e=i.createElement("div");e.className="hesh-content-resize-handle",e.id="content-resize-handle",d.getWrapperElement().appendChild(e),i.getElementById("content-resize-handle").addEventListener("mousedown",K)}function $(){var e=(function(e){if(2===(e=("; "+i.cookie).split("; "+e+"=")).length)return e.pop().split(";").shift()}("hesh_plugin_selection_state")||"0,0,0,0,0,0,0").split(",");m===e[0]&&(d.doc.setSelection({line:+e[1],ch:+e[2]},{line:+e[3],ch:+e[4]},{scroll:!1}),d.scrollTo(+e[5],+e[6]))}var G=b(X);function X(){var e=d.doc.listSelections()[0],t=d.getScrollInfo();i.cookie="hesh_plugin_selection_state="+m+","+e.anchor.line+","+e.anchor.ch+","+e.head.line+","+e.head.ch+","+t.left+","+t.top}function Y(){var t,n,r,e,i,o=d.doc.listSelections()[0];function a(){u.clearInterval(i),d.off("focus",a)}t=n=r=0,d.doc.eachLine(function(e){r<=o.head.line-1&&(t+=e.text.length+1),r<=o.anchor.line-1&&(n+=e.text.length+1),r++}),t+=o.head.ch,n+=o.anchor.ch,d.getTextArea().setSelectionRange(Math.min(n,t),Math.max(n,t)),d.getTextArea().focus(),e=d.getTextArea().value.length,i=u.setInterval(function(){e!==d.getTextArea().value.length&&(u.clearInterval(i),function(){var e=d.getTextArea().selectionStart,t=d.getTextArea().selectionEnd,n=d.getScrollInfo(),r={top:u.pageYOffset,left:u.pageXOffset};d.doc.setValue(d.getTextArea().value),d.focus();var i=0,o=0,a=0,s=e,l=t,c=d.getLineHandle(a).text.length+1;for(;c<=s&&c<=l;)a++,c<=s&&(s-=c,i=a),c<=l&&(l-=c,o=a),c=d.getLineHandle(a).text.length+1;d.doc.setSelection({line:i,ch:s},{line:o,ch:l},{scroll:!1}),u.scrollTo(r.left,r.top),d.scrollTo(n.left,n.top),d.save()}())},10),d.on("focus",a)}function Q(){d.save(),X(),wp.data.dispatch("core/editor").resetBlocks(wp.blocks.parse(d.getTextArea().value)),d.setValue(wp.data.select("core/editor").getEditedPostContent()),$()}function J(){var t,e,n,r;v.isActive()||null!=(h=v.isGutenberg?i.getElementsByClassName("editor-post-text-editor")[0]:h)&&(y.theme=a.theme,y.lineNumbers=!!a.lineNumbers,y.foldGutter=!!a.foldGutter,y.gutters=y.foldGutter?["CodeMirror-linenumbers","CodeMirror-foldgutter"]:[],y.tabSize=y.indentUnit=+a.tabSize,y.lineWrapping=!!a.lineWrapping,y.matchBrackets=!!a.matchBrackets,y.autoCloseTags=!!a.autoCloseTags,y.autoCloseBrackets=!!a.autoCloseBrackets,y.surveyNoticeDismissedB=!!a.surveyNoticeDismissedB,y.highlightSelectionMatches=!!a.highlightSelectionMatches,y.matchTags=!!a.matchTags&&{bothTags:!0},y.scrollbarStyle=a.scrollbarStyle?"overlay":null,y.keyMap=a.keyMap,y.autofocus=i.getElementById("title")&&!!i.getElementById("title").value&&0<i.getElementById("title").value.length,v.isThemeOrPlugin&&(e=(e=i.querySelector(".fileedit-sub .alignleft").textContent.match(/\.[a-z\d]{2,}/gi))[e.length-1].match(/[a-z]*/gi)[1],y.mode={php:"php",css:"css",xml:"xml",html:"htmlmixed",js:"javascript",json:"javascript"}[e]),d=o.fromTextArea(h,y),s=d.getWrapperElement().querySelector(".CodeMirror-code"),h.classList.add("CodeMirror-mirrored"),v.isGutenberg?d.on("blur",Q):d.on("change",function(){d.save()}),$(),d.on("cursorActivity",G),d.on("scroll",G),v.isThemeOrPlugin?V(u.innerHeight-d.getWrapperElement().getBoundingClientRect().top-100):v.isGutenberg?V(u.innerHeight-d.getWrapperElement().getBoundingClientRect().top-16):(f.addEventListener("mousedown",Y),t=u.send_to_editor,u.send_to_editor=function(e){v.isActive()&&"content"===u.wpActiveEditor?(d.replaceSelection(e),d.save()):t(e)},i.getElementById("content-resize-handle").addEventListener("mousedown",function(){i.addEventListener("mousemove",B)}),i.addEventListener("mouseup",function(){i.removeEventListener("mousemove",B)}),g&&(g.addEventListener("change",_),_()),f.insertAdjacentHTML("afterbegin",'<button type="button" id="cm_content_fullscreen" class="ed_button qt-dfw" title="Full Screen"></button>'),i.getElementById("cm_content_fullscreen").onclick=P),function(){d.getWrapperElement().appendChild(c),c.style.display="block",c.querySelector(".CodeMirror-settings__toggle").addEventListener("click",M),c.querySelector(".CodeMirror-settings__toggle-advanced").addEventListener("click",M),new MutationObserver(L).observe(d.getWrapperElement(),{childList:!0});for(var e=c.querySelectorAll(".CodeMirror-settings__option"),t=0;t<e.length;t++){var n=e[t];n.addEventListener("change",N),n.addEventListener("change",O)}}(),n=+a.fontSize,r=+a.lineHeight,s.style.fontSize=n+"px",a.fontSize=n,s.style.lineHeight=r+"em",a.lineHeight=r,A(),d.refresh(),e=".CodeMirror pre > * { text-indent: 0px; }",n=i.head||i.getElementsByTagName("head")[0],(r=i.createElement("style")).type="text/css",r.styleSheet?r.styleSheet.cssText=e:r.appendChild(i.createTextNode(e)),n.appendChild(r),d.on("renderLine",function(e,t,n){e=o.countColumn(t.text,null,e.getOption("tabSize"))*v.charWidth;n.style.textIndent="-"+e+"px",n.style.paddingLeft=4+e+"px"}),d.refresh())}function Z(){v.isActive()&&(T("closed"),d.toTextArea(),d=void 0)}function ee(){var e,t;(e=i.querySelector(".notice-hesh .notice-dismiss"))&&e.addEventListener("click",function(){var e=r.elements.surveyNoticeDismissedB;e&&(e.value=!0),N()}),v.isThemeOrPlugin?J():v.isGutenberg?(t=v.isGutenbergVisualActive(),wp.data.subscribe(function(){v.isGutenbergVisualActive()!==t&&((t=v.isGutenbergVisualActive())?Z():u.setTimeout(J,0))}),t||J()):v.isVisualEnabled?(n.addEventListener("click",function(){u.setTimeout(J,0)}),p.addEventListener("click",Z),v.isVisualActive()||J()):(J(),i.body.className+=" visual-editor-is-disabled")}"complete"!==i.readyState?u.addEventListener?u.addEventListener("load",ee,!1):u.attachEvent&&u.attachEvent("onload",ee):ee()}(document,window,window.CodeMirror,window.jQuery,window.heshOptions);
html-editor-syntax-highlighter.php CHANGED
@@ -6,7 +6,7 @@
6
  * Author URI: http://bradford.digital/
7
  * Author: Petr Mukhortov
8
  * Author URI: http://mukhortov.com/
9
- * Version: 2.4.3
10
  *
11
  * @package HESH_plugin
12
  **/
@@ -485,41 +485,59 @@ class Wp_Html_Editor_Syntax_Highlighter {
485
  <?php
486
  } */
487
 
 
488
  private $cssThemes = array(
489
- 'none',
490
- 'wordpress',
491
- 'default',
492
- '3024-day',
493
- '3024-night',
 
 
 
494
  'abcdef',
495
- 'ambiance-mobile',
496
  'ambiance',
 
 
497
  'base16-dark',
498
  'base16-light',
499
  'bespin',
500
  'blackboard',
501
  'cobalt',
502
- 'codepen',
503
  'colorforth',
 
504
  'dracula',
505
  'duotone-dark',
506
  'duotone-light',
507
  'eclipse',
508
  'elegant',
509
  'erlang-dark',
 
 
510
  'hopscotch',
511
  'icecoder',
 
512
  'isotope',
 
513
  'lesser-dark',
514
  'liquibyte',
 
 
 
 
515
  'material',
516
  'mbo',
517
  'mdn-like',
518
  'midnight',
519
  'monokai',
520
- 'neat',
 
521
  'neo',
522
  'night',
 
 
523
  'panda-syntax',
524
  'paraiso-dark',
525
  'paraiso-light',
@@ -527,7 +545,9 @@ class Wp_Html_Editor_Syntax_Highlighter {
527
  'railscasts',
528
  'rubyblue',
529
  'seti',
 
530
  'solarized',
 
531
  'the-matrix',
532
  'tomorrow-night-bright',
533
  'tomorrow-night-eighties',
@@ -535,8 +555,9 @@ class Wp_Html_Editor_Syntax_Highlighter {
535
  'twilight',
536
  'vibrant-ink',
537
  'xq-dark',
538
- 'xq-light',
539
  'yeti',
 
540
  'zenburn'
541
  );
542
 
6
  * Author URI: http://bradford.digital/
7
  * Author: Petr Mukhortov
8
  * Author URI: http://mukhortov.com/
9
+ * Version: 2.4.4
10
  *
11
  * @package HESH_plugin
12
  **/
485
  <?php
486
  } */
487
 
488
+ // to get a list of theme names: `cd node_modules/codemirror/theme/` then run `ls > css-themes.txt`
489
  private $cssThemes = array(
490
+ 'none', // special
491
+ 'wordpress', // custom
492
+ 'default', // special
493
+
494
+ // node_modules/codemirror/theme/
495
+ '3024-day', // SUCKS
496
+ '3024-night', //??
497
+ 'abbott',
498
  'abcdef',
499
+ 'ambiance-mobile',// BROKEN
500
  'ambiance',
501
+ 'ayu-dark',
502
+ 'ayu-mirage',
503
  'base16-dark',
504
  'base16-light',
505
  'bespin',
506
  'blackboard',
507
  'cobalt',
508
+ 'codepen', // custom
509
  'colorforth',
510
+ 'darcula',
511
  'dracula',
512
  'duotone-dark',
513
  'duotone-light',
514
  'eclipse',
515
  'elegant',
516
  'erlang-dark',
517
+ 'gruvbox-dark',
518
+ 'github', // from npm
519
  'hopscotch',
520
  'icecoder',
521
+ 'idea',
522
  'isotope',
523
+ 'juejin',
524
  'lesser-dark',
525
  'liquibyte',
526
+ 'lucario',
527
+ 'material-darker',
528
+ 'material-ocean',
529
+ 'material-palenight',
530
  'material',
531
  'mbo',
532
  'mdn-like',
533
  'midnight',
534
  'monokai',
535
+ 'moxer',
536
+ 'neat', // SUCKS
537
  'neo',
538
  'night',
539
+ 'nord',
540
+ 'oceanic-next',
541
  'panda-syntax',
542
  'paraiso-dark',
543
  'paraiso-light',
545
  'railscasts',
546
  'rubyblue',
547
  'seti',
548
+ 'shadowfox',
549
  'solarized',
550
+ 'ssms', // SUCKS
551
  'the-matrix',
552
  'tomorrow-night-bright',
553
  'tomorrow-night-eighties',
555
  'twilight',
556
  'vibrant-ink',
557
  'xq-dark',
558
+ 'xq-light', // SUCKS, that yellow...
559
  'yeti',
560
+ 'yonce',
561
  'zenburn'
562
  );
563
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: nixdns, arniebradfo, rraub, collinprice
3
  Donate link: https://www.paypal.me/mukhortov/5
4
  Tags: syntax highlighter, codemirror, text editor, code highlighter, code coloring, editor, html editor, gutenberg, code editor, theme editor, plugin editor, syntax, highlighting, highlighter, syntax highlighting, codemirror.js, code,
5
  Requires at least: 4.0
6
- Tested up to: 5.8.0
7
- Stable tag: 2.4.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -123,6 +123,9 @@ __Not really...__ It is partially supported in IE 11. Known bugs are tracked [he
123
 
124
  == Changelog ==
125
 
 
 
 
126
  = 2.4.3 =
127
  * Updated css for wordpress v5.8
128
 
3
  Donate link: https://www.paypal.me/mukhortov/5
4
  Tags: syntax highlighter, codemirror, text editor, code highlighter, code coloring, editor, html editor, gutenberg, code editor, theme editor, plugin editor, syntax, highlighting, highlighter, syntax highlighting, codemirror.js, code,
5
  Requires at least: 4.0
6
+ Tested up to: 5.8.1
7
+ Stable tag: 2.4.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
123
 
124
  == Changelog ==
125
 
126
+ = 2.4.4 =
127
+ * Added about 15 new themes
128
+
129
  = 2.4.3 =
130
  * Updated css for wordpress v5.8
131