Code Snippets - Version 2.12.0

Version Description

(23 Sep 2018) = * Fixed: Prevented hidden columns setting from reverting to default * Improved: Updated import page to improve usability * Improved: Added Import button next to page title on manage page * Improved: Added coloured banner indicating whether a snippet is active when editing * Update CodeMirror to 5.40.0

Download this release

Release Info

Developer bungeshea
Plugin Icon Code Snippets
Version 2.12.0
Comparing to
See all releases

Code changes from version 2.10.1 to 2.12.0

code-snippets.php CHANGED
@@ -10,7 +10,7 @@
10
  * @author Shea Bunge <shea@bungeshea.com>
11
  * @copyright 2012-2018 Shea Bunge
12
  * @license MIT http://opensource.org/licenses/MIT
13
- * @version 2.10.1
14
  * @link https://github.com/sheabunge/code-snippets
15
  */
16
 
@@ -20,7 +20,7 @@ Plugin URI: https://github.com/sheabunge/code-snippets
20
  Description: An easy, clean and simple way to add code snippets to your site. No need to edit to your theme's functions.php file again!
21
  Author: Shea Bunge
22
  Author URI: https://bungeshea.com
23
- Version: 2.10.1.1
24
  License: MIT
25
  License URI: license.txt
26
  Text Domain: code-snippets
@@ -42,7 +42,7 @@ if ( ! defined( 'ABSPATH' ) ) {
42
  * @since 2.0
43
  * @var string A PHP-standardized version number string
44
  */
45
- define( 'CODE_SNIPPETS_VERSION', '2.10.1.1' );
46
 
47
  /**
48
  * The full path to the main file of this plugin
10
  * @author Shea Bunge <shea@bungeshea.com>
11
  * @copyright 2012-2018 Shea Bunge
12
  * @license MIT http://opensource.org/licenses/MIT
13
+ * @version 2.12.0
14
  * @link https://github.com/sheabunge/code-snippets
15
  */
16
 
20
  Description: An easy, clean and simple way to add code snippets to your site. No need to edit to your theme's functions.php file again!
21
  Author: Shea Bunge
22
  Author URI: https://bungeshea.com
23
+ Version: 2.12.0
24
  License: MIT
25
  License URI: license.txt
26
  Text Domain: code-snippets
42
  * @since 2.0
43
  * @var string A PHP-standardized version number string
44
  */
45
+ define( 'CODE_SNIPPETS_VERSION', '2.12.0' );
46
 
47
  /**
48
  * The full path to the main file of this plugin
css/min/cmthemes/darcula.css ADDED
@@ -0,0 +1 @@
 
1
+ .cm-s-darcula span.cm-meta{color:#bbb529}.cm-s-darcula span.cm-number{color:#6897bb}.cm-s-darcula span.cm-keyword{line-height:1em;font-weight:700;color:#cc7832}.cm-s-darcula span.cm-def{color:#ffc66d}.cm-s-darcula span.cm-operator,.cm-s-darcula span.cm-property,.cm-s-darcula span.cm-type,.cm-s-darcula span.cm-variable,.cm-s-darcula span.cm-variable-2,.cm-s-darcula span.cm-variable-3{color:#a9b7c6}.cm-s-darcula span.cm-string,.cm-s-darcula span.cm-string-2{color:#6a8759}.cm-s-darcula span.cm-comment{color:gray}.cm-s-darcula span.cm-link{color:#287bde}.cm-s-darcula span.cm-atom{font-weight:700;color:#cc7832}.cm-s-darcula span.cm-error{color:#bc3f3c}.cm-s-darcula span.cm-tag{color:#cc7832}.cm-s-darcula span.cm-attribute,.cm-s-darcula span.cm-qualifier{color:#6a8759}.cm-s-darcula span.cm-bracket,.cm-s-darcula span.cm-builtin{color:#a9b7c6}.cm-s-darcula.CodeMirror{background:#2b2b2b;color:#a9b7c6}.cm-s-darcula .CodeMirror-cursor{border-left:1px solid #ddd}.cm-s-darcula .CodeMirror-activeline-background{background:#3a3a3a}.cm-s-darcula div.CodeMirror-selected{background:#085a9c}.cm-s-darcula .CodeMirror-gutters{background:#484848;border-right:1px solid gray;color:#606366}.cm-s-darcula{font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif}.cm-s-darcula .CodeMirror-matchingbracket{outline:1px solid #a9b7c6;color:#ff0!important}.CodeMirror-hints{font-family:Menlo,Monaco,Consolas,'Courier New',monospace;color:#9c9e9e;background-color:#3b3e3f!important}.CodeMirror-hint-active{background-color:#494d4e!important;color:#9c9e9e!important}
css/min/cmthemes/gruvbox-dark.css ADDED
@@ -0,0 +1 @@
 
1
+ .cm-s-gruvbox-dark .CodeMirror-gutters,.cm-s-gruvbox-dark.CodeMirror{background-color:#282828;color:#bdae93}.cm-s-gruvbox-dark .CodeMirror-gutters{background:#282828;border-right:0}.cm-s-gruvbox-dark .CodeMirror-linenumber{color:#7c6f64}.cm-s-gruvbox-dark .CodeMirror-cursor{border-left:1px solid #ebdbb2}.cm-s-gruvbox-dark div.CodeMirror-selected{background:#928374}.cm-s-gruvbox-dark span.cm-meta{color:olive}.cm-s-gruvbox-dark span.cm-comment{color:#928374}.cm-s-gruvbox-dark span.cm-number,span.cm-atom{color:#d3869b}.cm-s-gruvbox-dark span.cm-keyword{color:#f84934}.cm-s-gruvbox-dark span.cm-variable,.cm-s-gruvbox-dark span.cm-variable-2{color:#ebdbb2}.cm-s-gruvbox-dark span.cm-type,.cm-s-gruvbox-dark span.cm-variable-3{color:#000}.cm-s-gruvbox-dark span.cm-def,.cm-s-gruvbox-dark span.cm-operator{color:#ebdbb2}.cm-s-gruvbox-dark span.cm-string{color:#b8bb26}.cm-s-gruvbox-dark span.cm-string-2{color:#8ec07c}.cm-s-gruvbox-dark span.cm-qualifier{color:#555}.cm-s-gruvbox-dark span.cm-attribute{color:#8ec07c}.cm-s-gruvbox-dark .CodeMirror-activeline-background{background:#3c3836}.cm-s-gruvbox-dark .CodeMirror-matchingbracket{background:#928374;color:#282828!important}.cm-s-gruvbox-dark span.cm-builtin{color:#fe8019}
css/min/cmthemes/idea.css ADDED
@@ -0,0 +1 @@
 
1
+ .cm-s-idea span.cm-meta{color:olive}.cm-s-idea span.cm-number{color:#00f}.cm-s-idea span.cm-keyword{line-height:1em;font-weight:700;color:navy}.cm-s-idea span.cm-atom{font-weight:700;color:navy}.cm-s-idea span.cm-def,.cm-s-idea span.cm-operator,.cm-s-idea span.cm-property,.cm-s-idea span.cm-type,.cm-s-idea span.cm-variable,.cm-s-idea span.cm-variable-2,.cm-s-idea span.cm-variable-3{color:#000}.cm-s-idea span.cm-comment{color:gray}.cm-s-idea span.cm-string,.cm-s-idea span.cm-string-2{color:green}.cm-s-idea span.cm-qualifier{color:#555}.cm-s-idea span.cm-error{color:red}.cm-s-idea span.cm-attribute{color:#00f}.cm-s-idea span.cm-tag{color:navy}.cm-s-idea span.cm-link{color:#00f}.cm-s-idea .CodeMirror-activeline-background{background:#fffae3}.cm-s-idea span.cm-builtin{color:#30a}.cm-s-idea span.cm-bracket{color:#cc7}.cm-s-idea{font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif}.cm-s-idea .CodeMirror-matchingbracket{outline:1px solid gray;color:#000!important}.CodeMirror-hints{font-family:Menlo,Monaco,Consolas,'Courier New',monospace;color:#616569;background-color:#ebf3fd!important}.CodeMirror-hint-active{background-color:#a2b8c9!important;color:#5c6065!important}
css/min/cmthemes/lesser-dark.css CHANGED
@@ -1 +1 @@
1
- .cm-s-lesser-dark{line-height:1.3em}.cm-s-lesser-dark.CodeMirror{background:#262626;color:#ebefe7;text-shadow:0 -1px 1px #262626}.cm-s-lesser-dark div.CodeMirror-selected{background:#45443b}.cm-s-lesser-dark .CodeMirror-line::selection,.cm-s-lesser-dark .CodeMirror-line>span::selection,.cm-s-lesser-dark .CodeMirror-line>span>span::selection{background:rgba(69,68,59,.99)}.cm-s-lesser-dark .CodeMirror-line::-moz-selection,.cm-s-lesser-dark .CodeMirror-line>span::-moz-selection,.cm-s-lesser-dark .CodeMirror-line>span>span::-moz-selection{background:rgba(69,68,59,.99)}.cm-s-lesser-dark .CodeMirror-cursor{border-left:1px solid #fff}.cm-s-lesser-dark pre{padding:0 8px}.cm-s-lesser-dark.CodeMirror span.CodeMirror-matchingbracket{color:#7efc7e}.cm-s-lesser-dark .CodeMirror-gutters{background:#262626;border-right:1px solid #aaa}.cm-s-lesser-dark .CodeMirror-guttermarker{color:#599eff}.cm-s-lesser-dark .CodeMirror-guttermarker-subtle,.cm-s-lesser-dark .CodeMirror-linenumber{color:#777}.cm-s-lesser-dark span.cm-header{color:#a0a}.cm-s-lesser-dark span.cm-quote{color:#090}.cm-s-lesser-dark span.cm-keyword{color:#599eff}.cm-s-lesser-dark span.cm-atom{color:#c2b470}.cm-s-lesser-dark span.cm-number{color:#b35e4d}.cm-s-lesser-dark span.cm-def{color:#fff}.cm-s-lesser-dark span.cm-variable{color:#d9bf8c}.cm-s-lesser-dark span.cm-variable-2{color:#669199}.cm-s-lesser-dark span.cm-type,.cm-s-lesser-dark span.cm-variable-3{color:#fff}.cm-s-lesser-dark span.cm-operator,.cm-s-lesser-dark span.cm-property{color:#92a75c}.cm-s-lesser-dark span.cm-comment{color:#666}.cm-s-lesser-dark span.cm-string{color:#bcd279}.cm-s-lesser-dark span.cm-string-2{color:#f50}.cm-s-lesser-dark span.cm-meta{color:#738c73}.cm-s-lesser-dark span.cm-qualifier{color:#555}.cm-s-lesser-dark span.cm-builtin{color:#ff9e59}.cm-s-lesser-dark span.cm-bracket{color:#ebefe7}.cm-s-lesser-dark span.cm-tag{color:#669199}.cm-s-lesser-dark span.cm-attribute{color:#00c}.cm-s-lesser-dark span.cm-hr{color:#999}.cm-s-lesser-dark span.cm-link{color:#00c}.cm-s-lesser-dark span.cm-error{color:#9d1e15}.cm-s-lesser-dark .CodeMirror-activeline-background{background:#3c3a3a}.cm-s-lesser-dark .CodeMirror-matchingbracket{outline:1px solid gray;color:#fff!important}
1
+ .cm-s-lesser-dark{line-height:1.3em}.cm-s-lesser-dark.CodeMirror{background:#262626;color:#ebefe7;text-shadow:0 -1px 1px #262626}.cm-s-lesser-dark div.CodeMirror-selected{background:#45443b}.cm-s-lesser-dark .CodeMirror-line::selection,.cm-s-lesser-dark .CodeMirror-line>span::selection,.cm-s-lesser-dark .CodeMirror-line>span>span::selection{background:rgba(69,68,59,.99)}.cm-s-lesser-dark .CodeMirror-line::-moz-selection,.cm-s-lesser-dark .CodeMirror-line>span::-moz-selection,.cm-s-lesser-dark .CodeMirror-line>span>span::-moz-selection{background:rgba(69,68,59,.99)}.cm-s-lesser-dark .CodeMirror-cursor{border-left:1px solid #fff}.cm-s-lesser-dark pre{padding:0 8px}.cm-s-lesser-dark.CodeMirror span.CodeMirror-matchingbracket{color:#7efc7e}.cm-s-lesser-dark .CodeMirror-gutters{background:#262626;border-right:1px solid #aaa}.cm-s-lesser-dark .CodeMirror-guttermarker{color:#599eff}.cm-s-lesser-dark .CodeMirror-guttermarker-subtle,.cm-s-lesser-dark .CodeMirror-linenumber{color:#777}.cm-s-lesser-dark span.cm-header{color:#a0a}.cm-s-lesser-dark span.cm-quote{color:#090}.cm-s-lesser-dark span.cm-keyword{color:#599eff}.cm-s-lesser-dark span.cm-atom{color:#c2b470}.cm-s-lesser-dark span.cm-number{color:#b35e4d}.cm-s-lesser-dark span.cm-def{color:#fff}.cm-s-lesser-dark span.cm-variable{color:#d9bf8c}.cm-s-lesser-dark span.cm-variable-2{color:#669199}.cm-s-lesser-dark span.cm-type,.cm-s-lesser-dark span.cm-variable-3{color:#fff}.cm-s-lesser-dark span.cm-operator,.cm-s-lesser-dark span.cm-property{color:#92a75c}.cm-s-lesser-dark span.cm-comment{color:#666}.cm-s-lesser-dark span.cm-string{color:#bcd279}.cm-s-lesser-dark span.cm-string-2{color:#f50}.cm-s-lesser-dark span.cm-meta{color:#738c73}.cm-s-lesser-dark span.cm-qualifier{color:#555}.cm-s-lesser-dark span.cm-builtin{color:#ff9e59}.cm-s-lesser-dark span.cm-bracket{color:#ebefe7}.cm-s-lesser-dark span.cm-tag{color:#669199}.cm-s-lesser-dark span.cm-attribute{color:#81a4d5}.cm-s-lesser-dark span.cm-hr{color:#999}.cm-s-lesser-dark span.cm-link{color:#00c}.cm-s-lesser-dark span.cm-error{color:#9d1e15}.cm-s-lesser-dark .CodeMirror-activeline-background{background:#3c3a3a}.cm-s-lesser-dark .CodeMirror-matchingbracket{outline:1px solid gray;color:#fff!important}
css/min/cmthemes/lucario.css ADDED
@@ -0,0 +1 @@
 
1
+ .cm-s-lucario .CodeMirror-gutters,.cm-s-lucario.CodeMirror{background-color:#2b3e50!important;color:#f8f8f2!important;border:0}.cm-s-lucario .CodeMirror-gutters{}.cm-s-lucario .CodeMirror-cursor{border-left:solid thin #e6c845}.cm-s-lucario .CodeMirror-linenumber{color:#f8f8f2}.cm-s-lucario .CodeMirror-activeline-background,.cm-s-lucario .CodeMirror-selected{background:#243443}.cm-s-lucario .CodeMirror-line::selection,.cm-s-lucario .CodeMirror-line>span::selection,.cm-s-lucario .CodeMirror-line>span>span::selection{background:#243443}.cm-s-lucario .CodeMirror-line::-moz-selection,.cm-s-lucario .CodeMirror-line>span::-moz-selection,.cm-s-lucario .CodeMirror-line>span>span::-moz-selection{background:#243443}.cm-s-lucario span.cm-comment{color:#5c98cd}.cm-s-lucario span.cm-string,.cm-s-lucario span.cm-string-2{color:#e6db74}.cm-s-lucario span.cm-number{color:#ca94ff}.cm-s-lucario span.cm-variable,.cm-s-lucario span.cm-variable-2{color:#f8f8f2}.cm-s-lucario span.cm-def{color:#72c05d}.cm-s-lucario span.cm-operator{color:#66d9ef}.cm-s-lucario span.cm-keyword{color:#ff6541}.cm-s-lucario span.cm-atom{color:#bd93f9}.cm-s-lucario span.cm-meta{color:#f8f8f2}.cm-s-lucario span.cm-tag{color:#ff6541}.cm-s-lucario span.cm-attribute{color:#66d9ef}.cm-s-lucario span.cm-qualifier{color:#72c05d}.cm-s-lucario span.cm-property{color:#f8f8f2}.cm-s-lucario span.cm-builtin{color:#72c05d}.cm-s-lucario span.cm-type,.cm-s-lucario span.cm-variable-3{color:#ffb86c}.cm-s-lucario .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important}
css/min/cmthemes/monokai.css CHANGED
@@ -1 +1 @@
1
- .cm-s-monokai.CodeMirror{background:#272822;color:#f8f8f2}.cm-s-monokai div.CodeMirror-selected{background:#49483e}.cm-s-monokai .CodeMirror-line::selection,.cm-s-monokai .CodeMirror-line>span::selection,.cm-s-monokai .CodeMirror-line>span>span::selection{background:rgba(73,72,62,.99)}.cm-s-monokai .CodeMirror-line::-moz-selection,.cm-s-monokai .CodeMirror-line>span::-moz-selection,.cm-s-monokai .CodeMirror-line>span>span::-moz-selection{background:rgba(73,72,62,.99)}.cm-s-monokai .CodeMirror-gutters{background:#272822;border-right:0}.cm-s-monokai .CodeMirror-guttermarker{color:#fff}.cm-s-monokai .CodeMirror-guttermarker-subtle,.cm-s-monokai .CodeMirror-linenumber{color:#d0d0d0}.cm-s-monokai .CodeMirror-cursor{border-left:1px solid #f8f8f0}.cm-s-monokai span.cm-comment{color:#75715e}.cm-s-monokai span.cm-atom,.cm-s-monokai span.cm-number{color:#ae81ff}.cm-s-monokai span.cm-attribute,.cm-s-monokai span.cm-property{color:#a6e22e}.cm-s-monokai span.cm-keyword{color:#f92672}.cm-s-monokai span.cm-builtin{color:#66d9ef}.cm-s-monokai span.cm-string{color:#e6db74}.cm-s-monokai span.cm-variable{color:#f8f8f2}.cm-s-monokai span.cm-variable-2{color:#9effff}.cm-s-monokai span.cm-type,.cm-s-monokai span.cm-variable-3{color:#66d9ef}.cm-s-monokai span.cm-def{color:#fd971f}.cm-s-monokai span.cm-bracket{color:#f8f8f2}.cm-s-monokai span.cm-tag{color:#f92672}.cm-s-monokai span.cm-header,.cm-s-monokai span.cm-link{color:#ae81ff}.cm-s-monokai span.cm-error{background:#f92672;color:#f8f8f0}.cm-s-monokai .CodeMirror-activeline-background{background:#373831}.cm-s-monokai .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important}
1
+ .cm-s-monokai.CodeMirror{background:#272822;color:#f8f8f2}.cm-s-monokai div.CodeMirror-selected{background:#49483e}.cm-s-monokai .CodeMirror-line::selection,.cm-s-monokai .CodeMirror-line>span::selection,.cm-s-monokai .CodeMirror-line>span>span::selection{background:rgba(73,72,62,.99)}.cm-s-monokai .CodeMirror-line::-moz-selection,.cm-s-monokai .CodeMirror-line>span::-moz-selection,.cm-s-monokai .CodeMirror-line>span>span::-moz-selection{background:rgba(73,72,62,.99)}.cm-s-monokai .CodeMirror-gutters{background:#272822;border-right:0}.cm-s-monokai .CodeMirror-guttermarker{color:#fff}.cm-s-monokai .CodeMirror-guttermarker-subtle,.cm-s-monokai .CodeMirror-linenumber{color:#d0d0d0}.cm-s-monokai .CodeMirror-cursor{border-left:1px solid #f8f8f0}.cm-s-monokai span.cm-comment{color:#75715e}.cm-s-monokai span.cm-atom,.cm-s-monokai span.cm-number{color:#ae81ff}.cm-s-monokai span.cm-comment.cm-attribute{color:#97b757}.cm-s-monokai span.cm-comment.cm-def{color:#bc9262}.cm-s-monokai span.cm-comment.cm-tag{color:#bc6283}.cm-s-monokai span.cm-comment.cm-type{color:#5998a6}.cm-s-monokai span.cm-attribute,.cm-s-monokai span.cm-property{color:#a6e22e}.cm-s-monokai span.cm-keyword{color:#f92672}.cm-s-monokai span.cm-builtin{color:#66d9ef}.cm-s-monokai span.cm-string{color:#e6db74}.cm-s-monokai span.cm-variable{color:#f8f8f2}.cm-s-monokai span.cm-variable-2{color:#9effff}.cm-s-monokai span.cm-type,.cm-s-monokai span.cm-variable-3{color:#66d9ef}.cm-s-monokai span.cm-def{color:#fd971f}.cm-s-monokai span.cm-bracket{color:#f8f8f2}.cm-s-monokai span.cm-tag{color:#f92672}.cm-s-monokai span.cm-header,.cm-s-monokai span.cm-link{color:#ae81ff}.cm-s-monokai span.cm-error{background:#f92672;color:#f8f8f0}.cm-s-monokai .CodeMirror-activeline-background{background:#373831}.cm-s-monokai .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important}
css/min/cmthemes/oceanic-next.css ADDED
@@ -0,0 +1 @@
 
1
+ .cm-s-oceanic-next.CodeMirror{background:#304148;color:#f8f8f2}.cm-s-oceanic-next div.CodeMirror-selected{background:rgba(101,115,126,.33)}.cm-s-oceanic-next .CodeMirror-line::selection,.cm-s-oceanic-next .CodeMirror-line>span::selection,.cm-s-oceanic-next .CodeMirror-line>span>span::selection{background:rgba(101,115,126,.33)}.cm-s-oceanic-next .CodeMirror-line::-moz-selection,.cm-s-oceanic-next .CodeMirror-line>span::-moz-selection,.cm-s-oceanic-next .CodeMirror-line>span>span::-moz-selection{background:rgba(101,115,126,.33)}.cm-s-oceanic-next .CodeMirror-gutters{background:#304148;border-right:10px}.cm-s-oceanic-next .CodeMirror-guttermarker{color:#fff}.cm-s-oceanic-next .CodeMirror-guttermarker-subtle,.cm-s-oceanic-next .CodeMirror-linenumber{color:#d0d0d0}.cm-s-oceanic-next .CodeMirror-cursor{border-left:1px solid #f8f8f0}.cm-s-oceanic-next span.cm-comment{color:#65737e}.cm-s-oceanic-next span.cm-atom{color:#c594c5}.cm-s-oceanic-next span.cm-number{color:#f99157}.cm-s-oceanic-next span.cm-property{color:#99c794}.cm-s-oceanic-next span.cm-attribute,.cm-s-oceanic-next span.cm-keyword{color:#c594c5}.cm-s-oceanic-next span.cm-builtin{color:#66d9ef}.cm-s-oceanic-next span.cm-string{color:#99c794}.cm-s-oceanic-next span.cm-variable,.cm-s-oceanic-next span.cm-variable-2,.cm-s-oceanic-next span.cm-variable-3{color:#f8f8f2}.cm-s-oceanic-next span.cm-def{color:#69c}.cm-s-oceanic-next span.cm-bracket{color:#5fb3b3}.cm-s-oceanic-next span.cm-header,.cm-s-oceanic-next span.cm-link,.cm-s-oceanic-next span.cm-tag{color:#c594c5}.cm-s-oceanic-next span.cm-error{background:#c594c5;color:#f8f8f0}.cm-s-oceanic-next .CodeMirror-activeline-background{background:rgba(101,115,126,.33)}.cm-s-oceanic-next .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important}
css/min/cmthemes/shadowfox.css ADDED
@@ -0,0 +1 @@
 
1
+ .cm-s-shadowfox.CodeMirror{background:#2a2a2e;color:#b1b1b3}.cm-s-shadowfox div.CodeMirror-selected{background:#353b48}.cm-s-shadowfox .CodeMirror-line::selection,.cm-s-shadowfox .CodeMirror-line>span::selection,.cm-s-shadowfox .CodeMirror-line>span>span::selection{background:#353b48}.cm-s-shadowfox .CodeMirror-line::-moz-selection,.cm-s-shadowfox .CodeMirror-line>span::-moz-selection,.cm-s-shadowfox .CodeMirror-line>span>span::-moz-selection{background:#353b48}.cm-s-shadowfox .CodeMirror-gutters{background:#0c0c0d;border-right:1px solid #0c0c0d}.cm-s-shadowfox .CodeMirror-guttermarker{color:#555}.cm-s-shadowfox .CodeMirror-linenumber,.cm-s-shadowfox span.cm-comment{color:#939393}.cm-s-shadowfox .CodeMirror-cursor{border-left:1px solid #fff}.cm-s-shadowfox span.cm-atom,.cm-s-shadowfox span.cm-attribute,.cm-s-shadowfox span.cm-builtin,.cm-s-shadowfox span.cm-error,.cm-s-shadowfox span.cm-keyword,.cm-s-shadowfox span.cm-quote{color:#ff7de9}.cm-s-shadowfox span.cm-number,.cm-s-shadowfox span.cm-string,.cm-s-shadowfox span.cm-string-2{color:#6b89ff}.cm-s-shadowfox span.cm-hr,.cm-s-shadowfox span.cm-meta{color:#939393}.cm-s-shadowfox span.cm-header,.cm-s-shadowfox span.cm-qualifier,.cm-s-shadowfox span.cm-variable-2{color:#75bfff}.cm-s-shadowfox span.cm-property{color:#86de74}.cm-s-shadowfox span.cm-bracket,.cm-s-shadowfox span.cm-def,.cm-s-shadowfox span.cm-link:visited,.cm-s-shadowfox span.cm-tag{color:#75bfff}.cm-s-shadowfox span.cm-variable{color:#b98eff}.cm-s-shadowfox span.cm-variable-3{color:#d7d7db}.cm-s-shadowfox span.cm-link{color:#737373}.cm-s-shadowfox span.cm-operator{color:#b1b1b3}.cm-s-shadowfox span.cm-special{color:#d7d7db}.cm-s-shadowfox .CodeMirror-activeline-background{background:rgba(185,215,253,.15)}.cm-s-shadowfox .CodeMirror-matchingbracket{outline:solid 1px rgba(255,255,255,.25);color:#fff!important}
css/min/cmthemes/ssms.css ADDED
@@ -0,0 +1 @@
 
1
+ .cm-s-ssms span.cm-keyword{color:#00f}.cm-s-ssms span.cm-comment{color:#006400}.cm-s-ssms span.cm-string{color:red}.cm-s-ssms span.cm-def,.cm-s-ssms span.cm-variable,.cm-s-ssms span.cm-variable-2{color:#000}.cm-s-ssms span.cm-atom{color:#a9a9a9}.cm-s-ssms .CodeMirror-linenumber{color:teal}.cm-s-ssms .CodeMirror-activeline-background{background:#fff}.cm-s-ssms span.cm-string-2{color:#f0f}.cm-s-ssms span.cm-bracket,.cm-s-ssms span.cm-operator,.cm-s-ssms span.cm-punctuation{color:#a9a9a9}.cm-s-ssms .CodeMirror-gutters{border-right:3px solid #ffee62;background-color:#fff}.cm-s-ssms div.CodeMirror-selected{background:#add6ff}
css/min/edit.css CHANGED
@@ -1 +1 @@
1
- .form-table th{width:auto}h2{margin:25px 0 15px}h2:first-of-type{margin-top:20px}h2 label{cursor:auto}label[for=snippet_description] h3 div{position:absolute}ul.tagit{background-color:#fff!important}.submit .button{margin-right:.5em}.snippet-scope{margin-top:15px}.snippet-scope label{margin-right:30px;display:inline-block}.CodeMirror{width:100%;height:auto!important;border:1px solid #dfdfdf;border-radius:3px;background-color:#fff}.CodeMirror-code{outline:0;direction:ltr;text-align:left}.CodeMirror-sizer{min-height:300px!important}.CodeMirror-focused .cm-matchhighlight{color:#fff!important;outline:1px solid green}.cm-s-rubyblue .CodeMirror-cursor{border-left:1px solid #fff!important}
1
+ .form-table th{width:auto}h2{margin:25px 0 15px}h2:first-of-type{margin-top:20px}h2 label{cursor:auto}.active-snippet #title,.inactive-snippet #title{border-left-width:4px}.active-snippet #title{border-left-color:#46b450}.inactive-snippet #title{border-left-color:#dc3232}label[for=snippet_description] h3 div{position:absolute}ul.tagit{background-color:#fff!important}.submit .button{margin-right:.5em}.snippet-scope{margin-top:15px}.snippet-scope label{margin-right:30px;display:inline-block}.snippet-priority{float:right}.snippet-priority label{font-weight:700;cursor:help;font-size:1.1em;padding-right:.5em}.snippet-priority input{width:4em}.CodeMirror{width:100%;height:auto!important;border:1px solid #dfdfdf;border-radius:3px;background-color:#fff}.CodeMirror-code{outline:0;direction:ltr;text-align:left}.CodeMirror-sizer{min-height:300px!important}.CodeMirror-sizer::before{content:"<?php";color:#bbb;display:block;padding-bottom:6px}.CodeMirror-focused .cm-matchhighlight{color:#fff!important;outline:1px solid green}.cm-s-rubyblue .CodeMirror-cursor{border-left:1px solid #fff!important}
css/min/manage.css CHANGED
@@ -1 +1 @@
1
- .column-name .dashicons{font-size:16px;width:16px;height:16px}.column-name .dashicons-clock{vertical-align:middle}.snippets .badge{margin-left:4px;padding:3px 6px;text-decoration:none;border:medium;border-radius:2px;background:#e0e0e0;font-size:smaller}.clear-filters{vertical-align:bottom}.snippets td,.snippets th{color:#000}.snippets tr{background:#fff}.snippets .row-actions{color:#ddd}.snippets .clear-filters{vertical-align:middle}.snippets tfoot th{border-top:none!important}.snippets tfoot th.check-column{padding:13px 0 0 3px}.snippets .inactive th.check-column,.snippets tfoot th.check-column,.snippets thead th.check-column{padding-left:5px}.snippets .column-description p{color:#333}.snippets .inactive a{color:#579}.snippets .active td,.snippets .active th,.snippets .inactive td,.snippets .inactive th{padding:10px 9px;border:0;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.1);box-shadow:inset 0 -1px 0 rgba(0,0,0,.1)}.snippets .active td,.snippets .active th{background-color:rgba(120,200,230,.06)}.snippets .active th.check-column{border-left:2px solid #2ea2cc}.snippets tr.active+tr.inactive td,.snippets tr.active+tr.inactive th{border-top:1px solid rgba(0,0,0,.03);-webkit-box-shadow:inset 0 1px 0 rgba(0,0,0,.02),inset 0 -1px 0 #e1e1e1;box-shadow:inset 0 1px 0 rgba(0,0,0,.02),inset 0 -1px 0 #e1e1e1}.snippets #all-snippets-table a.delete:hover,.snippets #search-snippets-table a.delete:hover,.snippets a.delete:hover{border-bottom:1px solid red;color:red}#wpbody-content .snippets .column-name{white-space:nowrap}
1
+ .column-name .dashicons{font-size:16px;width:16px;height:16px}.column-name .dashicons-clock{vertical-align:middle}.active-snippet .column-name>a{font-weight:600}.column-priority input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:0 0;border:0;box-shadow:none;width:4em}.column-priority input:disabled{color:inherit}.snippets .row-actions,.snippets .snippet-name{margin-left:40px}.snippets .row-actions{position:relative;left:0}.snippet-activation-switch{position:absolute;display:inline-block;margin-top:5px;width:30px;height:17px;background-color:#ccc;transition:.4s;border-radius:34px}.snippet-activation-switch::before{content:"";height:13px;width:13px;display:inline-block;margin:1.5px 2px;background-color:#fff;transition:.4s,background-color 1000ms linear;border-radius:50%}.snippets .active-snippet .snippet-activation-switch{background-color:#2196f3}.snippets .active-snippet .snippet-activation-switch::before{-webkit-transform:translateX(100%);transform:translateX(100%)}.clear-filters{vertical-align:bottom}.snippets .badge{margin-left:4px;padding:3px 6px;text-decoration:none;border:medium;border-radius:2px;background:#e0e0e0;font-size:smaller}.snippets td,.snippets th{color:#000}.snippets tr{background:#fff}.snippets .row-actions{color:#ddd}.snippets .clear-filters{vertical-align:middle}.snippets tfoot th{border-top:none!important}.snippets tfoot th.check-column{padding:13px 0 0 3px}.snippets .inactive-snippet th.check-column,.snippets tfoot th.check-column,.snippets thead th.check-column{padding-left:5px}.snippets .column-description p{color:#333}.snippets .inactive-snippet a{color:#579}.snippets .active-snippet td,.snippets .active-snippet th,.snippets .inactive-snippet td,.snippets .inactive-snippet th{padding:10px 9px;border:0;box-shadow:inset 0 -1px 0 rgba(0,0,0,.1)}.snippets .active-snippet td,.snippets .active-snippet th{background-color:rgba(120,200,230,.06)}.snippets .active-snippet th.check-column{border-left:2px solid #2ea2cc}.snippets tr.active-snippet+tr.inactive-snippet td,.snippets tr.active-snippet+tr.inactive-snippet th{border-top:1px solid rgba(0,0,0,.03);box-shadow:inset 0 1px 0 rgba(0,0,0,.02),inset 0 -1px 0 #e1e1e1}.snippets #all-snippets-table a.delete:hover,.snippets #search-snippets-table a.delete:hover,.snippets a.delete:hover{border-bottom:1px solid red;color:red}#wpbody-content .snippets .column-name{white-space:nowrap}
js/min/codemirror.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.CodeMirror=t()}(this,function(){"use strict";var e=navigator.userAgent,t=navigator.platform,r=/gecko\/\d/i.test(e),n=/MSIE \d/.test(e),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),o=/Edge\/(\d+)/.exec(e),l=n||i||o,s=l&&(n?document.documentMode||6:+(o||i)[1]),a=!o&&/WebKit\//.test(e),c=a&&/Qt\/\d+\.\d+/.test(e),u=!o&&/Chrome\//.test(e),f=/Opera\//.test(e),h=/Apple Computer/.test(navigator.vendor),d=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),p=/PhantomJS/.test(e),g=!o&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),m=/Android/.test(e),v=g||m||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),y=g||/Mac/.test(t),b=/\bCrOS\b/.test(e),_=/win/i.test(t),x=f&&e.match(/Version\/(\d*\.\d*)/);x&&(x=Number(x[1])),x&&x>=15&&(f=!1,a=!0);var w=y&&(c||f&&(null==x||x<12.11)),k=r||l&&s>=9;function C(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var S=function(e,t){var r=e.className,n=C(t).exec(r);if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}};function L(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function T(e,t){return L(e).appendChild(t)}function M(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"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 N(e,t,r,n){var i=M(e,t,r,n);return i.setAttribute("role","presentation"),i}var A;A=document.createRange?function(e,t,r,n){var i=document.createRange();return i.setEnd(n||e,r),i.setStart(e,t),i}:function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(e){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};function O(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if(11==t.nodeType&&(t=t.host),t==e)return!0}while(t=t.parentNode)}function D(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function W(e,t){var r=e.className;C(t).test(r)||(e.className+=(r?" ":"")+t)}function P(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!C(r[n]).test(t)&&(t+=" "+r[n]);return t}var z=function(e){e.select()};g?z=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:l&&(z=function(e){try{e.select()}catch(e){}});function q(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function F(e,t,r){t||(t={});for(var n in e)!e.hasOwnProperty(n)||!1===r&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function E(e,t,r,n,i){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var o=n||0,l=i||0;;){var s=e.indexOf("\t",o);if(s<0||s>=t)return l+(t-o);l+=s-o,l+=r-l%r,o=s+1}}var H=function(){this.id=null};H.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};function I(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}var R=30,B={toString:function(){return"CodeMirror.Pass"}},j={scroll:!1},U={origin:"*mouse"},G={origin:"+move"};function K(e,t,r){for(var n=0,i=0;;){var o=e.indexOf("\t",n);-1==o&&(o=e.length);var l=o-n;if(o==e.length||i+l>=t)return n+Math.min(l,t-i);if(i+=o-n,n=o+1,(i+=r-i%r)>=t)return n}}var V=[""];function $(e){for(;V.length<=e;)V.push(X(V)+" ");return V[e]}function X(e){return e[e.length-1]}function Y(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function Z(){}function Q(e,t){var r;return Object.create?r=Object.create(e):(Z.prototype=e,r=new Z),t&&F(t,r),r}var J=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ee(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||J.test(e))}function te(e,t){return t?!!(t.source.indexOf("\\w")>-1&&ee(e))||t.test(e):ee(e)}function re(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ne=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ie(e){return e.charCodeAt(0)>=768&&ne.test(e)}function oe(e,t,r){for(;(r<0?t>0:t<e.length)&&ie(e.charAt(t));)t+=r;return t}function le(e,t,r){for(var n=t>r?-1:1;;){if(t==r)return t;var i=(t+r)/2,o=n<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:r;e(o)?r=o:t=o+n}}function se(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 r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(t<o){r=i;break}t-=o}return r.lines[t]}function ae(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i}),n}function ce(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function ue(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function fe(e){if(null==e.parent)return null;for(var t=e.parent,r=I(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function he(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height;if(t<o){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var l=0;l<e.lines.length;++l){var s=e.lines[l].height;if(t<s)break;t-=s}return r+l}function de(e,t){return t>=e.first&&t<e.first+e.size}function pe(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function ge(e,t,r){if(void 0===r&&(r=null),!(this instanceof ge))return new ge(e,t,r);this.line=e,this.ch=t,this.sticky=r}function me(e,t){return e.line-t.line||e.ch-t.ch}function ve(e,t){return e.sticky==t.sticky&&0==me(e,t)}function ye(e){return ge(e.line,e.ch)}function be(e,t){return me(e,t)<0?t:e}function _e(e,t){return me(e,t)<0?e:t}function xe(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function we(e,t){if(t.line<e.first)return ge(e.first,0);var r=e.first+e.size-1;return t.line>r?ge(r,se(e,r).text.length):function(e,t){var r=e.ch;return null==r||r>t?ge(e.line,t):r<0?ge(e.line,0):e}(t,se(e,t.line).text.length)}function ke(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=we(e,t[n]);return r}var Ce=!1,Se=!1;function Le(e,t,r){this.marker=e,this.from=t,this.to=r}function Te(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function Me(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function Ne(e,t){if(t.full)return null;var r=de(e,t.from.line)&&se(e,t.from.line).markedSpans,n=de(e,t.to.line)&&se(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,l=0==me(t.from,t.to),s=function(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker;if(null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t)||o.from==t&&"bookmark"==l.type&&(!r||!o.marker.insertLeft)){var s=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new Le(l,o.from,s?null:o.to))}}return n}(r,i,l),a=function(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker;if(null==o.to||(l.inclusiveRight?o.to>=t:o.to>t)||o.from==t&&"bookmark"==l.type&&(!r||o.marker.insertLeft)){var s=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new Le(l,s?null:o.from-t,null==o.to?null:o.to-t))}}return n}(n,o,l),c=1==t.text.length,u=X(t.text).length+(c?i:0);if(s)for(var f=0;f<s.length;++f){var h=s[f];if(null==h.to){var d=Te(a,h.marker);d?c&&(h.to=null==d.to?null:d.to+u):h.to=i}}if(a)for(var p=0;p<a.length;++p){var g=a[p];if(null!=g.to&&(g.to+=u),null==g.from){Te(s,g.marker)||(g.from=u,c&&(s||(s=[])).push(g))}else g.from+=u,c&&(s||(s=[])).push(g)}s&&(s=Ae(s)),a&&a!=s&&(a=Ae(a));var m=[s];if(!c){var v,y=t.text.length-2;if(y>0&&s)for(var b=0;b<s.length;++b)null==s[b].to&&(v||(v=[])).push(new Le(s[b].marker,null,null));for(var _=0;_<y;++_)m.push(v);m.push(a)}return m}function Ae(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&!1!==r.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function Oe(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function De(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function We(e){return e.inclusiveLeft?-1:0}function Pe(e){return e.inclusiveRight?1:0}function ze(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=me(n.from,i.from)||We(e)-We(t);if(o)return-o;var l=me(n.to,i.to)||Pe(e)-Pe(t);return l||t.id-e.id}function qe(e,t){var r,n=Se&&e.markedSpans;if(n)for(var i=void 0,o=0;o<n.length;++o)(i=n[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!r||ze(r,i.marker)<0)&&(r=i.marker);return r}function Fe(e){return qe(e,!0)}function Ee(e){return qe(e,!1)}function He(e,t,r,n,i){var o=se(e,t),l=Se&&o.markedSpans;if(l)for(var s=0;s<l.length;++s){var a=l[s];if(a.marker.collapsed){var c=a.marker.find(0),u=me(c.from,r)||We(a.marker)-We(i),f=me(c.to,n)||Pe(a.marker)-Pe(i);if(!(u>=0&&f<=0||u<=0&&f>=0)&&(u<=0&&(a.marker.inclusiveRight&&i.inclusiveLeft?me(c.to,r)>=0:me(c.to,r)>0)||u>=0&&(a.marker.inclusiveRight&&i.inclusiveLeft?me(c.from,n)<=0:me(c.from,n)<0)))return!0}}}function Ie(e){for(var t;t=Fe(e);)e=t.find(-1,!0).line;return e}function Re(e,t){var r=se(e,t),n=Ie(r);return r==n?t:fe(n)}function Be(e,t){if(t>e.lastLine())return t;var r,n=se(e,t);if(!je(e,n))return t;for(;r=Ee(n);)n=r.find(1,!0).line;return fe(n)+1}function je(e,t){var r=Se&&t.markedSpans;if(r)for(var n=void 0,i=0;i<r.length;++i)if((n=r[i]).marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&Ue(e,t,n))return!0}}function Ue(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return Ue(e,n.line,Te(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if((i=t.markedSpans[o]).marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&Ue(e,t,i))return!0}function Ge(e){for(var t=0,r=(e=Ie(e)).parent,n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var o=r.parent;o;r=o,o=r.parent)for(var l=0;l<o.children.length;++l){var s=o.children[l];if(s==r)break;t+=s.height}return t}function Ke(e){if(0==e.height)return 0;for(var t,r=e.text.length,n=e;t=Fe(n);){var i=t.find(0,!0);n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=Ee(n);){var o=t.find(0,!0);r-=n.text.length-o.from.ch,r+=(n=o.to.line).text.length-o.to.ch}return r}function Ve(e){var t=e.display,r=e.doc;t.maxLine=se(r,r.first),t.maxLineLength=Ke(t.maxLine),t.maxLineChanged=!0,r.iter(function(e){var r=Ke(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}var $e=null;function Xe(e,t,r){var n;$e=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"==r?n=i:$e=i),o.from==t&&(o.from!=o.to&&"before"!=r?n=i:$e=i)}return null!=n?n:$e}var Ye=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,i=/[LRr]/,o=/[Lb1n]/,l=/[1n]/;function s(e,t,r){this.level=e,this.from=t,this.to=r}return function(a,c){var u="ltr"==c?"L":"R";if(0==a.length||"ltr"==c&&!r.test(a))return!1;for(var f=a.length,h=[],d=0;d<f;++d)h.push((p=a.charCodeAt(d))<=247?e.charAt(p):1424<=p&&p<=1524?"R":1536<=p&&p<=1785?t.charAt(p-1536):1774<=p&&p<=2220?"r":8192<=p&&p<=8203?"w":8204==p?"b":"L");for(var p,g=0,m=u;g<f;++g){var v=h[g];"m"==v?h[g]=m:m=v}for(var y=0,b=u;y<f;++y){var _=h[y];"1"==_&&"r"==b?h[y]="n":i.test(_)&&(b=_,"r"==_&&(h[y]="R"))}for(var x=1,w=h[0];x<f-1;++x){var k=h[x];"+"==k&&"1"==w&&"1"==h[x+1]?h[x]="1":","!=k||w!=h[x+1]||"1"!=w&&"n"!=w||(h[x]=w),w=k}for(var C=0;C<f;++C){var S=h[C];if(","==S)h[C]="N";else if("%"==S){var L=void 0;for(L=C+1;L<f&&"%"==h[L];++L);for(var T=C&&"!"==h[C-1]||L<f&&"1"==h[L]?"1":"N",M=C;M<L;++M)h[M]=T;C=L-1}}for(var N=0,A=u;N<f;++N){var O=h[N];"L"==A&&"1"==O?h[N]="L":i.test(O)&&(A=O)}for(var D=0;D<f;++D)if(n.test(h[D])){var W=void 0;for(W=D+1;W<f&&n.test(h[W]);++W);for(var P="L"==(D?h[D-1]:u),z=P==("L"==(W<f?h[W]:u))?P?"L":"R":u,q=D;q<W;++q)h[q]=z;D=W-1}for(var F,E=[],H=0;H<f;)if(o.test(h[H])){var I=H;for(++H;H<f&&o.test(h[H]);++H);E.push(new s(0,I,H))}else{var R=H,B=E.length;for(++H;H<f&&"L"!=h[H];++H);for(var j=R;j<H;)if(l.test(h[j])){R<j&&E.splice(B,0,new s(1,R,j));var U=j;for(++j;j<H&&l.test(h[j]);++j);E.splice(B,0,new s(2,U,j)),R=j}else++j;R<H&&E.splice(B,0,new s(1,R,H))}return"ltr"==c&&(1==E[0].level&&(F=a.match(/^\s+/))&&(E[0].from=F[0].length,E.unshift(new s(0,0,F[0].length))),1==X(E).level&&(F=a.match(/\s+$/))&&(X(E).to-=F[0].length,E.push(new s(0,f-F[0].length,f)))),"rtl"==c?E.reverse():E}}();function Ze(e,t){var r=e.order;return null==r&&(r=e.order=Ye(e.text,t)),r}var Qe=[],Je=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={});n[t]=(n[t]||Qe).concat(r)}};function et(e,t){return e._handlers&&e._handlers[t]||Qe}function tt(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers,i=n&&n[t];if(i){var o=I(i,r);o>-1&&(n[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function rt(e,t){var r=et(e,t);if(r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)}function nt(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),rt(e,r||t.type,e,t),ct(t)||t.codemirrorIgnore}function it(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)-1==I(r,t[n])&&r.push(t[n])}function ot(e,t){return et(e,t).length>0}function lt(e){e.prototype.on=function(e,t){Je(this,e,t)},e.prototype.off=function(e,t){tt(this,e,t)}}function st(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function at(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ct(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function ut(e){st(e),at(e)}function ft(e){return e.target||e.srcElement}function ht(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),y&&e.ctrlKey&&1==t&&(t=3),t}var dt,pt=function(){if(l&&s<9)return!1;var e=M("div");return"draggable"in e||"dragDrop"in e}();function gt(e){if(null==dt){var t=M("span","​");T(e,M("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(dt=t.offsetWidth<=1&&t.offsetHeight>2&&!(l&&s<8))}var r=dt?M("span","​"):M("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var mt;function vt(e){if(null!=mt)return mt;var t=T(e,document.createTextNode("AخA")),r=A(t,0,1).getBoundingClientRect(),n=A(t,1,2).getBoundingClientRect();return L(e),!(!r||r.left==r.right)&&(mt=n.right-r.right<3)}var yt=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;t<=n;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),l=o.indexOf("\r");-1!=l?(r.push(o.slice(0,l)),t+=l+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},bt=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)},_t=function(){var e=M("div");return"oncopy"in e||(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),xt=null;var wt={},kt={};function Ct(e){if("string"==typeof e&&kt.hasOwnProperty(e))e=kt[e];else if(e&&"string"==typeof e.name&&kt.hasOwnProperty(e.name)){var t=kt[e.name];"string"==typeof t&&(t={name:t}),(e=Q(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ct("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ct("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function St(e,t){t=Ct(t);var r=wt[t.name];if(!r)return St(e,"text/plain");var n=r(e,t);if(Lt.hasOwnProperty(t.name)){var i=Lt[t.name];for(var o in i)i.hasOwnProperty(o)&&(n.hasOwnProperty(o)&&(n["_"+o]=n[o]),n[o]=i[o])}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var l in t.modeProps)n[l]=t.modeProps[l];return n}var Lt={};function Tt(e,t){F(t,Lt.hasOwnProperty(e)?Lt[e]:Lt[e]={})}function Mt(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function Nt(e,t){for(var r;e.innerMode&&(r=e.innerMode(t))&&r.mode!=e;)t=r.state,e=r.mode;return r||{mode:e,state:t}}function At(e,t,r){return!e.startState||e.startState(t,r)}var Ot=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};Ot.prototype.eol=function(){return this.pos>=this.string.length},Ot.prototype.sol=function(){return this.pos==this.lineStart},Ot.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ot.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ot.prototype.eat=function(e){var t=this.string.charAt(this.pos);if("string"==typeof e?t==e:t&&(e.test?e.test(t):e(t)))return++this.pos,t},Ot.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ot.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ot.prototype.skipToEnd=function(){this.pos=this.string.length},Ot.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ot.prototype.backUp=function(e){this.pos-=e},Ot.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=E(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?E(this.string,this.lineStart,this.tabSize):0)},Ot.prototype.indentation=function(){return E(this.string,null,this.tabSize)-(this.lineStart?E(this.string,this.lineStart,this.tabSize):0)},Ot.prototype.match=function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&!1!==t&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e};if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},Ot.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ot.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ot.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ot.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var Dt=function(e,t){this.state=e,this.lookAhead=t},Wt=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};Wt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},Wt.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}},Wt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Wt.fromSaved=function(e,t,r){return t instanceof Dt?new Wt(e,Mt(e.mode,t.state),r,t.lookAhead):new Wt(e,Mt(e.mode,t),r)},Wt.prototype.save=function(e){var t=!1!==e?Mt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Dt(t,this.maxLookAhead):t};function Pt(e,t,r,n){var i=[e.state.modeGen],o={};jt(e,t.text,e.doc.mode,r,function(e,t){return i.push(e,t)},o,n);for(var l=r.state,s=function(n){r.baseTokens=i;var s=e.state.overlays[n],a=1,c=0;r.state=!0,jt(e,t.text,s.mode,r,function(e,t){for(var r=a;c<e;){var n=i[a];n>e&&i.splice(a,1,e,i[a+1],n),a+=2,c=Math.min(e,n)}if(t)if(s.opaque)i.splice(r,a-r,e,"overlay "+t),a=r+2;else for(;r<a;r+=2){var o=i[r+1];i[r+1]=(o?o+" ":"")+"overlay "+t}},o),r.state=l,r.baseTokens=null,r.baseTokenPos=1},a=0;a<e.state.overlays.length;++a)s(a);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function zt(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=qt(e,fe(t)),i=t.text.length>e.options.maxHighlightLength&&Mt(e.doc.mode,n.state),o=Pt(e,t,n);i&&(n.state=i),t.stateAfter=n.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function qt(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return new Wt(n,!0,t);var o=function(e,t,r){for(var n,i,o=e.doc,l=r?-1:t-(e.doc.mode.innerMode?1e3:100),s=t;s>l;--s){if(s<=o.first)return o.first;var a=se(o,s-1),c=a.stateAfter;if(c&&(!r||s+(c instanceof Dt?c.lookAhead:0)<=o.modeFrontier))return s;var u=E(a.text,null,e.options.tabSize);(null==i||n>u)&&(i=s-1,n=u)}return i}(e,t,r),l=o>n.first&&se(n,o-1).stateAfter,s=l?Wt.fromSaved(n,l,o):new Wt(n,At(n.mode),o);return n.iter(o,t,function(r){Ft(e,r.text,s);var n=s.line;r.stateAfter=n==t-1||n%5==0||n>=i.viewFrom&&n<i.viewTo?s.save():null,s.nextLine()}),r&&(n.modeFrontier=s.line),s}function Ft(e,t,r,n){var i=e.doc.mode,o=new Ot(t,e.options.tabSize,r);for(o.start=o.pos=n||0,""==t&&Et(i,r.state);!o.eol();)Ht(i,o,r.state),o.start=o.pos}function Et(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var r=Nt(e,t);return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function Ht(e,t,r,n){for(var i=0;i<10;i++){n&&(n[0]=Nt(e,r).mode);var o=e.token(t,r);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}var It=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function Rt(e,t,r,n){var i,o,l=e.doc,s=l.mode,a=se(l,(t=we(l,t)).line),c=qt(e,t.line,r),u=new Ot(a.text,e.options.tabSize,c);for(n&&(o=[]);(n||u.pos<t.ch)&&!u.eol();)u.start=u.pos,i=Ht(s,u,c.state),n&&o.push(new It(u,i,Mt(l.mode,c.state)));return n?o:new It(u,i,c.state)}function Bt(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(t[n])||(t[n]+=" "+r[2])}return e}function jt(e,t,r,n,i,o,l){var s=r.flattenSpans;null==s&&(s=e.options.flattenSpans);var a,c=0,u=null,f=new Ot(t,e.options.tabSize,n),h=e.options.addModeClass&&[null];for(""==t&&Bt(Et(r,n.state),o);!f.eol();){if(f.pos>e.options.maxHighlightLength?(s=!1,l&&Ft(e,t,n,f.pos),f.pos=t.length,a=null):a=Bt(Ht(r,f,n.state,h),o),h){var d=h[0].name;d&&(a="m-"+(a?d+" "+a:d))}if(!s||u!=a){for(;c<f.start;)i(c=Math.min(f.start,c+5e3),u);u=a}f.start=f.pos}for(;c<f.pos;){var p=Math.min(f.pos,c+5e3);i(p,u),c=p}}var Ut=function(e,t,r){this.text=e,De(this,t),this.height=r?r(this):1};Ut.prototype.lineNo=function(){return fe(this)},lt(Ut);var Gt={},Kt={};function Vt(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Kt:Gt;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function $t(e,t){var r=N("span",null,null,a?"padding-right: .1px":null),n={pre:N("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:(l||a)&&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,s=void 0;n.pos=0,n.addToken=Yt,vt(e.display.measure)&&(s=Ze(o,e.doc.direction))&&(n.addToken=Zt(n.addToken,s)),n.map=[];Jt(o,n,zt(e,o,t!=e.display.externalMeasured&&fe(o))),o.styleClasses&&(o.styleClasses.bgClass&&(n.bgClass=P(o.styleClasses.bgClass,n.bgClass||"")),o.styleClasses.textClass&&(n.textClass=P(o.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(gt(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(a){var c=n.content.lastChild;(/\bcm-tab\b/.test(c.className)||c.querySelector&&c.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return rt(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=P(n.pre.className,n.textClass||"")),n}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,r,n,i,o,a){if(t){var c,u=e.splitSpaces?function(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!r||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),n+=o,r=" "==o}return n}(t,e.trailingSpace):t,f=e.cm.state.specialChars,h=!1;if(f.test(t)){c=document.createDocumentFragment();for(var d=0;;){f.lastIndex=d;var p=f.exec(t),g=p?p.index-d:t.length-d;if(g){var m=document.createTextNode(u.slice(d,d+g));l&&s<9?c.appendChild(M("span",[m])):c.appendChild(m),e.map.push(e.pos,e.pos+g,m),e.col+=g,e.pos+=g}if(!p)break;d+=g+1;var v=void 0;if("\t"==p[0]){var y=e.cm.options.tabSize,b=y-e.col%y;(v=c.appendChild(M("span",$(b),"cm-tab"))).setAttribute("role","presentation"),v.setAttribute("cm-text","\t"),e.col+=b}else"\r"==p[0]||"\n"==p[0]?((v=c.appendChild(M("span","\r"==p[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",p[0]),e.col+=1):((v=e.cm.options.specialCharPlaceholder(p[0])).setAttribute("cm-text",p[0]),l&&s<9?c.appendChild(M("span",[v])):c.appendChild(v),e.col+=1);e.map.push(e.pos,e.pos+1,v),e.pos++}}else e.col+=t.length,c=document.createTextNode(u),e.map.push(e.pos,e.pos+t.length,c),l&&s<9&&(h=!0),e.pos+=t.length;if(e.trailingSpace=32==u.charCodeAt(t.length-1),r||n||i||h||a){var _=r||"";n&&(_+=n),i&&(_+=i);var x=M("span",[c],_,a);return o&&(x.title=o),e.content.appendChild(x)}e.content.appendChild(c)}}function Zt(e,t){return function(r,n,i,o,l,s,a){i=i?i+" cm-force-border":"cm-force-border";for(var c=r.pos,u=c+n.length;;){for(var f=void 0,h=0;h<t.length&&!((f=t[h]).to>c&&f.from<=c);h++);if(f.to>=u)return e(r,n,i,o,l,s,a);e(r,n.slice(0,f.to-c),i,o,null,s,a),o=null,n=n.slice(f.to-c),c=f.to}}}function Qt(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Jt(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var l,s,a,c,u,f,h,d=i.length,p=0,g=1,m="",v=0;;){if(v==p){a=c=u=f=s="",h=null,v=1/0;for(var y=[],b=void 0,_=0;_<n.length;++_){var x=n[_],w=x.marker;"bookmark"==w.type&&x.from==p&&w.widgetNode?y.push(w):x.from<=p&&(null==x.to||x.to>p||w.collapsed&&x.to==p&&x.from==p)?(null!=x.to&&x.to!=p&&v>x.to&&(v=x.to,c=""),w.className&&(a+=" "+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=w.title),w.collapsed&&(!h||ze(h.marker,w)<0)&&(h=x)):x.from>p&&v>x.from&&(v=x.from)}if(b)for(var k=0;k<b.length;k+=2)b[k+1]==v&&(c+=" "+b[k]);if(!h||h.from==p)for(var C=0;C<y.length;++C)Qt(t,0,y[C]);if(h&&(h.from||0)==p){if(Qt(t,(null==h.to?d+1:h.to)-p,h.marker,null==h.from),null==h.to)return;h.to==p&&(h=!1)}}if(p>=d)break;for(var S=Math.min(d,v);;){if(m){var L=p+m.length;if(!h){var T=L>S?m.slice(0,S-p):m;t.addToken(t,T,l?l+a:a,u,p+T.length==v?c:"",f,s)}if(L>=S){m=m.slice(S-p),p=S;break}p=L,u=""}m=i.slice(o,o=r[g++]),l=Vt(r[g++],t.cm.options)}}else for(var M=1;M<r.length;M+=2)t.addToken(t,i.slice(o,o=r[M]),Vt(r[M+1],t.cm.options))}function er(e,t,r){this.line=t,this.rest=function(e){for(var t,r;t=Ee(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}(t),this.size=this.rest?fe(X(this.rest))-r+1:1,this.node=this.text=null,this.hidden=je(e,t)}function tr(e,t,r){for(var n,i=[],o=t;o<r;o=n){var l=new er(e.doc,se(e.doc,o),o);n=o+l.size,i.push(l)}return i}var rr=null;var nr=null;function ir(e,t){var r=et(e,t);if(r.length){var n,i=Array.prototype.slice.call(arguments,2);rr?n=rr.delayedCallbacks:nr?n=nr:(n=nr=[],setTimeout(or,0));for(var o=function(e){n.push(function(){return r[e].apply(null,i)})},l=0;l<r.length;++l)o(l)}}function or(){var e=nr;nr=null;for(var t=0;t<e.length;++t)e[t]()}function lr(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?cr(e,t):"gutter"==o?fr(e,t,r,n):"class"==o?ur(e,t):"widget"==o&&hr(e,t,n)}t.changes=null}function sr(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),l&&s<8&&(e.node.style.zIndex=2)),e.node}function ar(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):$t(e,t)}function cr(e,t){var r=t.text.className,n=ar(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,ur(e,t)):r&&(t.text.className=r)}function ur(e,t){!function(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),t.background)r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null);else if(r){var n=sr(t);t.background=n.insertBefore(M("div",null,r),n.firstChild),e.display.input.setUneditable(t.background)}}(e,t),t.line.wrapClass?sr(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function fr(e,t,r,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=sr(t);t.gutterBackground=M("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var l=sr(t),s=t.gutter=M("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(s),l.insertBefore(s,t.text),t.line.gutterClass&&(s.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=s.appendChild(M("div",pe(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var a=0;a<e.options.gutters.length;++a){var c=e.options.gutters[a],u=o.hasOwnProperty(c)&&o[c];u&&s.appendChild(M("div",[u],"CodeMirror-gutter-elt","left: "+n.gutterLeft[c]+"px; width: "+n.gutterWidth[c]+"px"))}}}function hr(e,t,r){t.alignable&&(t.alignable=null);for(var n=t.node.firstChild,i=void 0;n;n=i)i=n.nextSibling,"CodeMirror-linewidget"==n.className&&t.node.removeChild(n);pr(e,t,r)}function dr(e,t,r,n){var i=ar(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),ur(e,t),fr(e,t,r,n),pr(e,t,n),t.node}function pr(e,t,r){if(gr(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)gr(e,t.rest[n],t,r,!1)}function gr(e,t,r,n,i){if(t.widgets)for(var o=sr(r),l=0,s=t.widgets;l<s.length;++l){var a=s[l],c=M("div",[a.node],"CodeMirror-linewidget");a.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),mr(a,c,r,n),e.display.input.setUneditable(c),i&&a.above?o.insertBefore(c,r.gutter||r.text):o.appendChild(c),ir(a,"redraw")}}function mr(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function vr(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!O(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),T(t.display.measure,M("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function yr(e,t){for(var r=ft(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return!0}function br(e){return e.lineSpace.offsetTop}function _r(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function xr(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=T(e.measure,M("pre","x")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(n.left)||isNaN(n.right)||(e.cachedPaddingH=n),n}function wr(e){return R-e.display.nativeBarWidth}function kr(e){return e.display.scroller.clientWidth-wr(e)-e.display.barWidth}function Cr(e){return e.display.scroller.clientHeight-wr(e)-e.display.barHeight}function Sr(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var i=0;i<e.rest.length;i++)if(fe(e.rest[i])>r)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Lr(e,t,r,n){return Nr(e,Mr(e,t),r,n)}function Tr(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[on(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function Mr(e,t){var r=fe(t),n=Tr(e,r);n&&!n.text?n=null:n&&n.changes&&(lr(e,n,r,Jr(e)),e.curOp.forceUpdate=!0),n||(n=function(e,t){var r=fe(t=Ie(t)),n=e.display.externalMeasured=new er(e.doc,t,r);n.lineN=r;var i=n.built=$t(e,n);return n.text=i.pre,T(e.display.lineMeasure,i.pre),n}(e,t));var i=Sr(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Nr(e,t,r,n,i){t.before&&(r=-1);var o,a=r+(n||"");return t.cache.hasOwnProperty(a)?o=t.cache[a]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(!function(e,t,r){var n=e.options.lineWrapping,i=n&&kr(e);if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;for(var l=t.text.firstChild.getClientRects(),s=0;s<l.length-1;s++){var a=l[s],c=l[s+1];Math.abs(a.bottom-c.bottom)>2&&o.push((a.bottom+c.top)/2-r.top)}}o.push(r.bottom-r.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,r,n){var i,o=Or(t.map,r,n),a=o.node,c=o.start,u=o.end,f=o.collapse;if(3==a.nodeType){for(var h=0;h<4;h++){for(;c&&ie(t.line.text.charAt(o.coverStart+c));)--c;for(;o.coverStart+u<o.coverEnd&&ie(t.line.text.charAt(o.coverStart+u));)++u;if((i=l&&s<9&&0==c&&u==o.coverEnd-o.coverStart?a.parentNode.getBoundingClientRect():Dr(A(a,c,u).getClientRects(),n)).left||i.right||0==c)break;u=c,c-=1,f="right"}l&&s<11&&(i=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=xt)return xt;var t=T(e,M("span","x")),r=t.getBoundingClientRect(),n=A(t,0,1).getBoundingClientRect();return xt=Math.abs(r.left-n.left)>1}(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}(e.display.measure,i))}else{c>0&&(f=n="right");var d;i=e.options.lineWrapping&&(d=a.getClientRects()).length>1?d["right"==n?d.length-1:0]:a.getBoundingClientRect()}if(l&&s<9&&!c&&(!i||!i.left&&!i.right)){var p=a.parentNode.getClientRects()[0];i=p?{left:p.left,right:p.left+Qr(e.display),top:p.top,bottom:p.bottom}:Ar}for(var g=i.top-t.rect.top,m=i.bottom-t.rect.top,v=(g+m)/2,y=t.view.measure.heights,b=0;b<y.length-1&&!(v<y[b]);b++);var _=b?y[b-1]:0,x=y[b],w={left:("right"==f?i.right:i.left)-t.rect.left,right:("left"==f?i.left:i.right)-t.rect.left,top:_,bottom:x};i.left||i.right||(w.bogus=!0);e.options.singleCursorHeightPerLine||(w.rtop=g,w.rbottom=m);return w}(e,t,r,n)).bogus||(t.cache[a]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var Ar={left:0,right:0,top:0,bottom:0};function Or(e,t,r){for(var n,i,o,l,s,a,c=0;c<e.length;c+=3)if(s=e[c],a=e[c+1],t<s?(i=0,o=1,l="left"):t<a?o=(i=t-s)+1:(c==e.length-3||t==a&&e[c+3]>t)&&(i=(o=a-s)-1,t>=a&&(l="right")),null!=i){if(n=e[c+2],s==a&&r==(n.insertLeft?"left":"right")&&(l=r),"left"==r&&0==i)for(;c&&e[c-2]==e[c-3]&&e[c-1].insertLeft;)n=e[2+(c-=3)],l="left";if("right"==r&&i==a-s)for(;c<e.length-3&&e[c+3]==e[c+4]&&!e[c+5].insertLeft;)n=e[(c+=3)+2],l="right";break}return{node:n,start:i,end:o,collapse:l,coverStart:s,coverEnd:a}}function Dr(e,t){var r=Ar;if("left"==t)for(var n=0;n<e.length&&(r=e[n]).left==r.right;n++);else for(var i=e.length-1;i>=0&&(r=e[i]).left==r.right;i--);return r}function Wr(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 Pr(e){e.display.externalMeasure=null,L(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Wr(e.display.view[t])}function zr(e){Pr(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function qr(){return u&&m?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Fr(){return u&&m?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Er(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=vr(e.widgets[r]));return t}function Hr(e,t,r,n,i){if(!i){var o=Er(t);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var l=Ge(t);if("local"==n?l+=br(e.display):l-=e.display.viewOffset,"page"==n||"window"==n){var s=e.display.lineSpace.getBoundingClientRect();l+=s.top+("window"==n?0:Fr());var a=s.left+("window"==n?0:qr());r.left+=a,r.right+=a}return r.top+=l,r.bottom+=l,r}function Ir(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=qr(),i-=Fr();else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();n+=o.left,i+=o.top}var l=e.display.lineSpace.getBoundingClientRect();return{left:n-l.left,top:i-l.top}}function Rr(e,t,r,n,i){return n||(n=se(e.doc,t.line)),Hr(e,n,Lr(e,n,t.ch,i),r)}function Br(e,t,r,n,i,o){n=n||se(e.doc,t.line),i||(i=Mr(e,n));function l(t,l){var s=Nr(e,i,t,l?"right":"left",o);return l?s.left=s.right:s.right=s.left,Hr(e,n,s,r)}var s=Ze(n,e.doc.direction),a=t.ch,c=t.sticky;if(a>=n.text.length?(a=n.text.length,c="before"):a<=0&&(a=0,c="after"),!s)return l("before"==c?a-1:a,"before"==c);function u(e,t,r){var n=1==s[t].level;return l(r?e-1:e,n!=r)}var f=Xe(s,a,c),h=$e,d=u(a,f,"before"==c);return null!=h&&(d.other=u(a,h,"before"!=c)),d}function jr(e,t){var r=0;t=we(e.doc,t),e.options.lineWrapping||(r=Qr(e.display)*t.ch);var n=se(e.doc,t.line),i=Ge(n)+br(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function Ur(e,t,r,n,i){var o=ge(e,t,r);return o.xRel=i,n&&(o.outside=!0),o}function Gr(e,t,r){var n=e.doc;if((r+=e.display.viewOffset)<0)return Ur(n.first,0,null,!0,-1);var i=he(n,r),o=n.first+n.size-1;if(i>o)return Ur(n.first+n.size-1,se(n,o).text.length,null,!0,1);t<0&&(t=0);for(var l=se(n,i);;){var s=Xr(e,l,i,t,r),a=Ee(l),c=a&&a.find(0,!0);if(!a||!(s.ch>c.from.ch||s.ch==c.from.ch&&s.xRel>0))return s;i=fe(l=c.to.line)}}function Kr(e,t,r,n){n-=Er(t);var i=t.text.length,o=le(function(t){return Nr(e,r,t-1).bottom<=n},i,0);return{begin:o,end:i=le(function(t){return Nr(e,r,t).top>n},o,i)}}function Vr(e,t,r,n){r||(r=Mr(e,t));return Kr(e,t,r,Hr(e,t,Nr(e,r,n),"line").top)}function $r(e,t,r,n){return!(e.bottom<=r)&&(e.top>r||(n?e.left:e.right)>t)}function Xr(e,t,r,n,i){i-=Ge(t);var o=Mr(e,t),l=Er(t),s=0,a=t.text.length,c=!0,u=Ze(t,e.doc.direction);if(u){var f=(e.options.lineWrapping?function(e,t,r,n,i,o,l){var s=Kr(e,t,n,l),a=s.begin,c=s.end;/\s/.test(t.text.charAt(c-1))&&c--;for(var u=null,f=null,h=0;h<i.length;h++){var d=i[h];if(!(d.from>=c||d.to<=a)){var p=1!=d.level,g=Nr(e,n,p?Math.min(c,d.to)-1:Math.max(a,d.from)).right,m=g<o?o-g+1e9:g-o;(!u||f>m)&&(u=d,f=m)}}u||(u=i[i.length-1]);u.from<a&&(u={from:a,to:u.to,level:u.level});u.to>c&&(u={from:u.from,to:c,level:u.level});return u}:function(e,t,r,n,i,o,l){var s=le(function(s){var a=i[s],c=1!=a.level;return $r(Br(e,ge(r,c?a.to:a.from,c?"before":"after"),"line",t,n),o,l,!0)},0,i.length-1),a=i[s];if(s>0){var c=1!=a.level,u=Br(e,ge(r,c?a.from:a.to,c?"after":"before"),"line",t,n);$r(u,o,l,!0)&&u.top>l&&(a=i[s-1])}return a})(e,t,r,o,u,n,i);s=(c=1!=f.level)?f.from:f.to-1,a=c?f.to:f.from-1}var h,d,p=null,g=null,m=le(function(t){var r=Nr(e,o,t);return r.top+=l,r.bottom+=l,!!$r(r,n,i,!1)&&(r.top<=i&&r.left<=n&&(p=t,g=r),!0)},s,a),v=!1;if(g){var y=n-g.left<g.right-n,b=y==c;m=p+(b?0:1),d=b?"after":"before",h=y?g.left:g.right}else{c||m!=a&&m!=s||m++,d=0==m?"after":m==t.text.length?"before":Nr(e,o,m-(c?1:0)).bottom+l<=i==c?"after":"before";var _=Br(e,ge(r,m,d),"line",t,o);h=_.left,v=i<_.top||i>=_.bottom}return Ur(r,m=oe(t.text,m,1),d,v,n-h)}var Yr;function Zr(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Yr){Yr=M("pre");for(var t=0;t<49;++t)Yr.appendChild(document.createTextNode("x")),Yr.appendChild(M("br"));Yr.appendChild(document.createTextNode("x"))}T(e.measure,Yr);var r=Yr.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),L(e.measure),r||1}function Qr(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=M("span","xxxxxxxxxx"),r=M("pre",[t]);T(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Jr(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l)r[e.options.gutters[l]]=o.offsetLeft+o.clientLeft+i,n[e.options.gutters[l]]=o.clientWidth;return{fixedPos:en(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function en(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function tn(e){var t=Zr(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/Qr(e.display)-3);return function(i){if(je(e.doc,i))return 0;var o=0;if(i.widgets)for(var l=0;l<i.widgets.length;l++)i.widgets[l].height&&(o+=i.widgets[l].height);return r?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function rn(e){var t=e.doc,r=tn(e);t.iter(function(e){var t=r(e);t!=e.height&&ue(e,t)})}function nn(e,t,r,n){var i=e.display;if(!r&&"true"==ft(t).getAttribute("cm-not-content"))return null;var o,l,s=i.lineSpace.getBoundingClientRect();try{o=t.clientX-s.left,l=t.clientY-s.top}catch(t){return null}var a,c=Gr(e,o,l);if(n&&1==c.xRel&&(a=se(e.doc,c.line).text).length==c.ch){var u=E(a,a.length,e.options.tabSize)-a.length;c=ge(c.line,Math.max(0,Math.round((o-xr(e.display).left)/Qr(e.display))-u))}return c}function on(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var r=e.display.view,n=0;n<r.length;n++)if((t-=r[n].size)<0)return n}function ln(e){e.display.input.showSelection(e.display.input.prepareSelection())}function sn(e,t){void 0===t&&(t=!0);for(var r=e.doc,n={},i=n.cursors=document.createDocumentFragment(),o=n.selection=document.createDocumentFragment(),l=0;l<r.sel.ranges.length;l++)if(t||l!=r.sel.primIndex){var s=r.sel.ranges[l];if(!(s.from().line>=e.display.viewTo||s.to().line<e.display.viewFrom)){var a=s.empty();(a||e.options.showCursorWhenSelecting)&&an(e,s.head,i),a||un(e,s,o)}}return n}function an(e,t,r){var n=Br(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild(M("div"," ","CodeMirror-cursor"));if(i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var o=r.appendChild(M("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=n.other.left+"px",o.style.top=n.other.top+"px",o.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function cn(e,t){return e.top-t.top||e.left-t.left}function un(e,t,r){var n=e.display,i=e.doc,o=document.createDocumentFragment(),l=xr(e.display),s=l.left,a=Math.max(n.sizerWidth,kr(e)-n.sizer.offsetLeft)-l.right,c="ltr"==i.direction;function u(e,t,r,n){t<0&&(t=0),t=Math.round(t),n=Math.round(n),o.appendChild(M("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==r?a-e:r)+"px;\n height: "+(n-t)+"px"))}function f(t,r,n){var o,l,f=se(i,t),h=f.text.length;function d(r,n){return Rr(e,ge(t,r),"div",f,n)}function p(t,r,n){var i=Vr(e,f,null,t),o="ltr"==r==("after"==n)?"left":"right";return d("after"==n?i.begin:i.end-(/\s/.test(f.text.charAt(i.end-1))?2:1),o)[o]}var g=Ze(f,i.direction);return function(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var l=e[o];(l.from<r&&l.to>t||t==r&&l.to==t)&&(n(Math.max(l.from,t),Math.min(l.to,r),1==l.level?"rtl":"ltr",o),i=!0)}i||n(t,r,"ltr")}(g,r||0,null==n?h:n,function(e,t,i,f){var m="ltr"==i,v=d(e,m?"left":"right"),y=d(t-1,m?"right":"left"),b=null==r&&0==e,_=null==n&&t==h,x=0==f,w=!g||f==g.length-1;if(y.top-v.top<=3){var k=(c?_:b)&&w,C=(c?b:_)&&x?s:(m?v:y).left,S=k?a:(m?y:v).right;u(C,v.top,S-C,v.bottom)}else{var L,T,M,N;m?(L=c&&b&&x?s:v.left,T=c?a:p(e,i,"before"),M=c?s:p(t,i,"after"),N=c&&_&&w?a:y.right):(L=c?p(e,i,"before"):s,T=!c&&b&&x?a:v.right,M=!c&&_&&w?s:y.left,N=c?p(t,i,"after"):a),u(L,v.top,T-L,v.bottom),v.bottom<y.top&&u(s,v.bottom,null,y.top),u(M,y.top,N-M,y.bottom)}(!o||cn(v,o)<0)&&(o=v),cn(y,o)<0&&(o=y),(!l||cn(v,l)<0)&&(l=v),cn(y,l)<0&&(l=y)}),{start:o,end:l}}var h=t.from(),d=t.to();if(h.line==d.line)f(h.line,h.ch,d.ch);else{var p=se(i,h.line),g=se(i,d.line),m=Ie(p)==Ie(g),v=f(h.line,h.ch,m?p.text.length+1:null).end,y=f(d.line,m?0:null,d.ch).start;m&&(v.top<y.top-2?(u(v.right,v.top,null,v.bottom),u(s,y.top,y.left,y.bottom)):u(v.right,v.top,y.left-v.right,v.bottom)),v.bottom<y.top&&u(s,v.bottom,null,y.top)}r.appendChild(o)}function fn(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function hn(e){e.state.focused||(e.display.input.focus(),pn(e))}function dn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,gn(e))},100)}function pn(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(rt(e,"focus",e,t),e.state.focused=!0,W(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),a&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),fn(e))}function gn(e,t){e.state.delayingBlurEvent||(e.state.focused&&(rt(e,"blur",e,t),e.state.focused=!1,S(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function mn(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var i=t.view[n],o=void 0;if(!i.hidden){if(l&&s<8){var a=i.node.offsetTop+i.node.offsetHeight;o=a-r,r=a}else{var c=i.node.getBoundingClientRect();o=c.bottom-c.top}var u=i.line.height-o;if(o<2&&(o=Zr(t)),(u>.005||u<-.005)&&(ue(i.line,o),vn(i.line),i.rest))for(var f=0;f<i.rest.length;f++)vn(i.rest[f])}}}function vn(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var r=e.widgets[t],n=r.node.parentNode;n&&(r.height=n.offsetHeight)}}function yn(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-br(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=he(t,n),l=he(t,i);if(r&&r.ensure){var s=r.ensure.from.line,a=r.ensure.to.line;s<o?(o=s,l=he(t,Ge(se(t,s))+e.wrapper.clientHeight)):Math.min(a,t.lastLine())>=l&&(o=he(t,Ge(se(t,a))-e.wrapper.clientHeight),l=a)}return{from:o,to:Math.max(l,o+1)}}function bn(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=en(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",l=0;l<r.length;l++)if(!r[l].hidden){e.options.fixedGutter&&(r[l].gutter&&(r[l].gutter.style.left=o),r[l].gutterBackground&&(r[l].gutterBackground.style.left=o));var s=r[l].alignable;if(s)for(var a=0;a<s.length;a++)s[a].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function _n(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=pe(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild(M("div",[M("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,l=i.offsetWidth-o;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-l)+1,n.lineNumWidth=n.lineNumInnerWidth+l,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",oi(e),!0}return!1}function xn(e,t){var r=e.display,n=Zr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:r.scroller.scrollTop,o=Cr(e),l={};t.bottom-t.top>o&&(t.bottom=t.top+o);var s=e.doc.height+_r(r),a=t.top<n,c=t.bottom>s-n;if(t.top<i)l.scrollTop=a?0:t.top;else if(t.bottom>i+o){var u=Math.min(t.top,(c?s:t.bottom)-o);u!=i&&(l.scrollTop=u)}var f=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:r.scroller.scrollLeft,h=kr(e)-(e.options.fixedGutter?r.gutters.offsetWidth:0),d=t.right-t.left>h;return d&&(t.right=t.left+h),t.left<10?l.scrollLeft=0:t.left<f?l.scrollLeft=Math.max(0,t.left-(d?0:10)):t.right>h+f-3&&(l.scrollLeft=t.right+(d?0:10)-h),l}function wn(e,t){null!=t&&(Sn(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function kn(e){Sn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Cn(e,t,r){null==t&&null==r||Sn(e),null!=t&&(e.curOp.scrollLeft=t),null!=r&&(e.curOp.scrollTop=r)}function Sn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;Ln(e,jr(e,t.from),jr(e,t.to),t.margin)}}function Ln(e,t,r,n){var i=xn(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});Cn(e,i.scrollLeft,i.scrollTop)}function Tn(e,t){Math.abs(e.doc.scrollTop-t)<2||(r||ii(e,{top:t}),Mn(e,t,!0),r&&ii(e),Jn(e,100))}function Mn(e,t,r){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),(e.display.scroller.scrollTop!=t||r)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Nn(e,t,r,n){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n||(e.doc.scrollLeft=t,bn(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function An(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+_r(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?r:0,docHeight:n,scrollHeight:n+wr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var On=function(e,t,r){this.cm=r;var n=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");e(n),e(i),Je(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Je(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,l&&s<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};On.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},On.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},On.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},On.prototype.zeroWidthHack=function(){var e=y&&!d?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new H,this.disableVert=new H},On.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto";t.set(1e3,function n(){var i=e.getBoundingClientRect();("vert"==r?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1))!=e?e.style.pointerEvents="none":t.set(1e3,n)})},On.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Dn=function(){};Dn.prototype.update=function(){return{bottom:0,right:0}},Dn.prototype.setScrollLeft=function(){},Dn.prototype.setScrollTop=function(){},Dn.prototype.clear=function(){};function Wn(e,t){t||(t=An(e));var r=e.display.barWidth,n=e.display.barHeight;Pn(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&mn(e),Pn(e,An(e)),r=e.display.barWidth,n=e.display.barHeight}function Pn(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}var zn={native:On,null:Dn};function qn(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&S(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new zn[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Je(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,r){"horizontal"==r?Nn(e,t):Tn(e,t)},e),e.display.scrollbars.addClass&&W(e.display.wrapper,e.display.scrollbars.addClass)}var Fn=0;function En(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Fn},t=e.curOp,rr?rr.ops.push(t):t.ownsGroup=rr={ops:[t],delayedCallbacks:[]};var t}function Hn(e){!function(e,t){var r=e.ownsGroup;if(r)try{!function(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var i=e.ops[n];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(r<t.length)}(r)}finally{rr=null,t(r)}}(e.curOp,function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;!function(e){for(var t=e.ops,r=0;r<t.length;r++)In(t[r]);for(var n=0;n<t.length;n++)(i=t[n]).updatedDisplay=i.mustUpdate&&ri(i.cm,i.update);var i;for(var o=0;o<t.length;o++)Rn(t[o]);for(var l=0;l<t.length;l++)Bn(t[l]);for(var s=0;s<t.length;s++)jn(t[s])}(e)})}function In(e){var t=e.cm,r=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=wr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=wr(e)+"px",t.scrollbarsClipped=!0)}(t),e.updateMaxLine&&Ve(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new ti(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Rn(e){var t=e.cm,r=t.display;e.updatedDisplay&&mn(t),e.barMeasure=An(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Lr(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+wr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-kr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function Bn(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Nn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==D();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Wn(t,e.barMeasure),e.updatedDisplay&&li(t,e.barMeasure),e.selectionChanged&&fn(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&hn(e.cm)}function jn(e){var t=e.cm,r=t.display,n=t.doc;if(e.updatedDisplay&&ni(t,e.update),null==r.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null!=e.scrollTop&&Mn(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&Nn(t,e.scrollLeft,!0,!0),e.scrollToPos){!function(e,t){if(!nt(e,"scrollCursorIntoView")){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!p){var o=M("div","​",null,"position: absolute;\n top: "+(t.top-r.viewOffset-br(e.display))+"px;\n height: "+(t.bottom-t.top+wr(e)+r.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}(t,function(e,t,r,n){null==n&&(n=0);var i;e.options.lineWrapping||t!=r||(r="before"==(t=t.ch?ge(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?ge(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var l=!1,s=Br(e,t),a=r&&r!=t?Br(e,r):s,c=xn(e,i={left:Math.min(s.left,a.left),top:Math.min(s.top,a.top)-n,right:Math.max(s.left,a.left),bottom:Math.max(s.bottom,a.bottom)+n}),u=e.doc.scrollTop,f=e.doc.scrollLeft;if(null!=c.scrollTop&&(Tn(e,c.scrollTop),Math.abs(e.doc.scrollTop-u)>1&&(l=!0)),null!=c.scrollLeft&&(Nn(e,c.scrollLeft),Math.abs(e.doc.scrollLeft-f)>1&&(l=!0)),!l)break}return i}(t,we(n,e.scrollToPos.from),we(n,e.scrollToPos.to),e.scrollToPos.margin))}var i=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(i)for(var l=0;l<i.length;++l)i[l].lines.length||rt(i[l],"hide");if(o)for(var s=0;s<o.length;++s)o[s].lines.length&&rt(o[s],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&rt(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Un(e,t){if(e.curOp)return t();En(e);try{return t()}finally{Hn(e)}}function Gn(e,t){return function(){if(e.curOp)return t.apply(e,arguments);En(e);try{return t.apply(e,arguments)}finally{Hn(e)}}}function Kn(e){return function(){if(this.curOp)return e.apply(this,arguments);En(this);try{return e.apply(this,arguments)}finally{Hn(this)}}}function Vn(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);En(t);try{return e.apply(this,arguments)}finally{Hn(t)}}}function $n(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&r<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Se&&Re(e.doc,t)<i.viewTo&&Yn(e);else if(r<=i.viewFrom)Se&&Be(e.doc,r+n)>i.viewFrom?Yn(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)Yn(e);else if(t<=i.viewFrom){var o=Zn(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):Yn(e)}else if(r>=i.viewTo){var l=Zn(e,t,t,-1);l?(i.view=i.view.slice(0,l.index),i.viewTo=l.lineN):Yn(e)}else{var s=Zn(e,t,t,-1),a=Zn(e,r,r+n,1);s&&a?(i.view=i.view.slice(0,s.index).concat(tr(e,s.lineN,a.lineN)).concat(i.view.slice(a.index)),i.viewTo+=n):Yn(e)}var c=i.externalMeasured;c&&(r<c.lineN?c.lineN+=n:t<c.lineN+c.size&&(i.externalMeasured=null))}function Xn(e,t,r){e.curOp.viewChanged=!0;var n=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var o=n.view[on(e,t)];if(null!=o.node){var l=o.changes||(o.changes=[]);-1==I(l,r)&&l.push(r)}}}function Yn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Zn(e,t,r,n){var i,o=on(e,t),l=e.display.view;if(!Se||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var s=e.display.viewFrom,a=0;a<o;a++)s+=l[a].size;if(s!=t){if(n>0){if(o==l.length-1)return null;i=s+l[o].size-t,o++}else i=s-t;t+=i,r+=i}for(;Re(e.doc,r)!=r;){if(o==(n<0?0:l.length-1))return null;r+=n*l[o-(n<0?1:0)].size,o+=n}return{index:o,lineN:r}}function Qn(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var i=t[n];i.hidden||i.node&&!i.changes||++r}return r}function Jn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,q(ei,e))}function ei(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var r=+new Date+e.options.workTime,n=qt(e,t.highlightFrontier),i=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(n.line>=e.display.viewFrom){var l=o.styles,s=o.text.length>e.options.maxHighlightLength?Mt(t.mode,n.state):null,a=Pt(e,o,n,!0);s&&(n.state=s),o.styles=a.styles;var c=o.styleClasses,u=a.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var f=!l||l.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),h=0;!f&&h<l.length;++h)f=l[h]!=o.styles[h];f&&i.push(n.line),o.stateAfter=n.save(),n.nextLine()}else o.text.length<=e.options.maxHighlightLength&&Ft(e,o.text,n),o.stateAfter=n.line%5==0?n.save():null,n.nextLine();if(+new Date>r)return Jn(e,e.options.workDelay),!0}),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),i.length&&Un(e,function(){for(var t=0;t<i.length;t++)Xn(e,i[t],"text")})}}var ti=function(e,t,r){var n=e.display;this.viewport=t,this.visible=yn(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=kr(e),this.force=r,this.dims=Jr(e),this.events=[]};ti.prototype.signal=function(e,t){ot(e,t)&&this.events.push(arguments)},ti.prototype.finish=function(){for(var e=0;e<this.events.length;e++)rt.apply(null,this.events[e])};function ri(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return Yn(e),!1;if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==Qn(e))return!1;_n(e)&&(Yn(e),t.dims=Jr(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),l=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFrom<o&&o-r.viewFrom<20&&(o=Math.max(n.first,r.viewFrom)),r.viewTo>l&&r.viewTo-l<20&&(l=Math.min(i,r.viewTo)),Se&&(o=Re(e.doc,o),l=Be(e.doc,l));var s=o!=r.viewFrom||l!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;!function(e,t,r){var n=e.display;0==n.view.length||t>=n.viewTo||r<=n.viewFrom?(n.view=tr(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=tr(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(on(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(tr(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,on(e,r)))),n.viewTo=r}(e,o,l),r.viewOffset=Ge(se(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var c=Qn(e);if(!s&&0==c&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var u=function(e){if(e.hasFocus())return null;var t=D();if(!t||!O(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&O(e.display.lineDiv,n.anchorNode)&&(r.anchorNode=n.anchorNode,r.anchorOffset=n.anchorOffset,r.focusNode=n.focusNode,r.focusOffset=n.focusOffset)}return r}(e);return c>4&&(r.lineDiv.style.display="none"),function(e,t,r){var n=e.display,i=e.options.lineNumbers,o=n.lineDiv,l=o.firstChild;function s(t){var r=t.nextSibling;return a&&y&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var c=n.view,u=n.viewFrom,f=0;f<c.length;f++){var h=c[f];if(h.hidden);else if(h.node&&h.node.parentNode==o){for(;l!=h.node;)l=s(l);var d=i&&null!=t&&t<=u&&h.lineNumber;h.changes&&(I(h.changes,"gutter")>-1&&(d=!1),lr(e,h,u,r)),d&&(L(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(pe(e.options,u)))),l=h.node.nextSibling}else{var p=dr(e,h,u,r);o.insertBefore(p,l)}u+=h.size}for(;l;)l=s(l)}(e,r.updateLineNumbers,t.dims),c>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,function(e){if(e&&e.activeElt&&e.activeElt!=D()&&(e.activeElt.focus(),e.anchorNode&&O(document.body,e.anchorNode)&&O(document.body,e.focusNode))){var t=window.getSelection(),r=document.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),t.removeAllRanges(),t.addRange(r),t.extend(e.focusNode,e.focusOffset)}}(u),L(r.cursorDiv),L(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,s&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Jn(e,400)),r.updateLineNumbers=null,!0}function ni(e,t){for(var r=t.viewport,n=!0;(n&&e.options.lineWrapping&&t.oldDisplayWidth!=kr(e)||(r&&null!=r.top&&(r={top:Math.min(e.doc.height+_r(e.display)-Cr(e),r.top)}),t.visible=yn(e.display,e.doc,r),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&ri(e,t);n=!1){mn(e);var i=An(e);ln(e),Wn(e,i),li(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 ii(e,t){var r=new ti(e,t);if(ri(e,r)){mn(e),ni(e,r);var n=An(e);ln(e),Wn(e,n),li(e,n),r.finish()}}function oi(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function li(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+wr(e)+"px"}function si(e){var t=e.display.gutters,r=e.options.gutters;L(t);for(var n=0;n<r.length;++n){var i=r[n],o=t.appendChild(M("div",null,"CodeMirror-gutter "+i));"CodeMirror-linenumbers"==i&&(e.display.lineGutter=o,o.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=n?"":"none",oi(e)}function ai(e){var t=I(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}var ci=0,ui=null;l?ui=-.53:r?ui=15:u?ui=-.7:h&&(ui=-1/3);function fi(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta),{x:t,y:r}}function hi(e){var t=fi(e);return t.x*=ui,t.y*=ui,t}function di(e,t){var n=fi(t),i=n.x,o=n.y,l=e.display,s=l.scroller,c=s.scrollWidth>s.clientWidth,u=s.scrollHeight>s.clientHeight;if(i&&c||o&&u){if(o&&y&&a)e:for(var h=t.target,d=l.view;h!=s;h=h.parentNode)for(var p=0;p<d.length;p++)if(d[p].node==h){e.display.currentWheelTarget=h;break e}if(i&&!r&&!f&&null!=ui)return o&&u&&Tn(e,Math.max(0,s.scrollTop+o*ui)),Nn(e,Math.max(0,s.scrollLeft+i*ui)),(!o||o&&u)&&st(t),void(l.wheelStartX=null);if(o&&null!=ui){var g=o*ui,m=e.doc.scrollTop,v=m+l.wrapper.clientHeight;g<0?m=Math.max(0,m+g-50):v=Math.min(e.doc.height,v+g+50),ii(e,{top:m,bottom:v})}ci<20&&(null==l.wheelStartX?(l.wheelStartX=s.scrollLeft,l.wheelStartY=s.scrollTop,l.wheelDX=i,l.wheelDY=o,setTimeout(function(){if(null!=l.wheelStartX){var e=s.scrollLeft-l.wheelStartX,t=s.scrollTop-l.wheelStartY,r=t&&l.wheelDY&&t/l.wheelDY||e&&l.wheelDX&&e/l.wheelDX;l.wheelStartX=l.wheelStartY=null,r&&(ui=(ui*ci+r)/(ci+1),++ci)}},200)):(l.wheelDX+=i,l.wheelDY+=o))}}var pi=function(e,t){this.ranges=e,this.primIndex=t};pi.prototype.primary=function(){return this.ranges[this.primIndex]},pi.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 r=this.ranges[t],n=e.ranges[t];if(!ve(r.anchor,n.anchor)||!ve(r.head,n.head))return!1}return!0},pi.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new gi(ye(this.ranges[t].anchor),ye(this.ranges[t].head));return new pi(e,this.primIndex)},pi.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},pi.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(me(t,n.from())>=0&&me(e,n.to())<=0)return r}return-1};var gi=function(e,t){this.anchor=e,this.head=t};gi.prototype.from=function(){return _e(this.anchor,this.head)},gi.prototype.to=function(){return be(this.anchor,this.head)},gi.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function mi(e,t){var r=e[t];e.sort(function(e,t){return me(e.from(),t.from())}),t=I(e,r);for(var n=1;n<e.length;n++){var i=e[n],o=e[n-1];if(me(o.to(),i.from())>=0){var l=_e(o.from(),i.from()),s=be(o.to(),i.to()),a=o.empty()?i.from()==i.head:o.from()==o.head;n<=t&&--t,e.splice(--n,2,new gi(a?s:l,a?l:s))}}return new pi(e,t)}function vi(e,t){return new pi([new gi(e,t||e)],0)}function yi(e){return e.text?ge(e.from.line+e.text.length-1,X(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function bi(e,t){if(me(e,t.from)<0)return e;if(me(e,t.to)<=0)return yi(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=yi(t).ch-t.to.ch),ge(r,n)}function _i(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new gi(bi(i.anchor,t),bi(i.head,t)))}return mi(r,e.sel.primIndex)}function xi(e,t,r){return e.line==t.line?ge(r.line,e.ch-t.ch+r.ch):ge(r.line+(e.line-t.line),e.ch)}function wi(e){e.doc.mode=St(e.options,e.doc.modeOption),ki(e)}function ki(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,Jn(e,100),e.state.modeGen++,e.curOp&&$n(e)}function Ci(e,t){return 0==t.from.ch&&0==t.to.ch&&""==X(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Si(e,t,r,n){function i(e){return r?r[e]:null}function o(e,r,i){!function(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Oe(e),De(e,r);var i=n?n(e):1;i!=e.height&&ue(e,i)}(e,r,i,n),ir(e,"change",e,t)}function l(e,t){for(var r=[],o=e;o<t;++o)r.push(new Ut(c[o],i(o),n));return r}var s=t.from,a=t.to,c=t.text,u=se(e,s.line),f=se(e,a.line),h=X(c),d=i(c.length-1),p=a.line-s.line;if(t.full)e.insert(0,l(0,c.length)),e.remove(c.length,e.size-c.length);else if(Ci(e,t)){var g=l(0,c.length-1);o(f,f.text,d),p&&e.remove(s.line,p),g.length&&e.insert(s.line,g)}else if(u==f)if(1==c.length)o(u,u.text.slice(0,s.ch)+h+u.text.slice(a.ch),d);else{var m=l(1,c.length-1);m.push(new Ut(h+u.text.slice(a.ch),d,n)),o(u,u.text.slice(0,s.ch)+c[0],i(0)),e.insert(s.line+1,m)}else if(1==c.length)o(u,u.text.slice(0,s.ch)+c[0]+f.text.slice(a.ch),i(0)),e.remove(s.line+1,p);else{o(u,u.text.slice(0,s.ch)+c[0],i(0)),o(f,h+f.text.slice(a.ch),d);var v=l(1,c.length-1);p>1&&e.remove(s.line+1,p-1),e.insert(s.line+1,v)}ir(e,"change",e,t)}function Li(e,t,r){!function e(n,i,o){if(n.linked)for(var l=0;l<n.linked.length;++l){var s=n.linked[l];if(s.doc!=i){var a=o&&s.sharedHist;r&&!a||(t(s.doc,a),e(s.doc,n,a))}}}(e,null,!0)}function Ti(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,rn(e),wi(e),Mi(e),e.options.lineWrapping||Ve(e),e.options.mode=t.modeOption,$n(e)}function Mi(e){("rtl"==e.doc.direction?W:S)(e.display.lineDiv,"CodeMirror-rtl")}function Ni(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ai(e,t){var r={from:ye(t.from),to:yi(t),text:ae(e,t.from,t.to)};return zi(e,r,t.from.line,t.to.line+1),Li(e,function(e){return zi(e,r,t.from.line,t.to.line+1)},!0),r}function Oi(e){for(;e.length;){if(!X(e).ranges)break;e.pop()}}function Di(e,t,r,n){var i=e.history;i.undone.length=0;var o,l,s=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>s-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(c=i,u=i.lastOp==n,o=u?(Oi(c.done),X(c.done)):c.done.length&&!X(c.done).ranges?X(c.done):c.done.length>1&&!c.done[c.done.length-2].ranges?(c.done.pop(),X(c.done)):void 0))l=X(o.changes),0==me(t.from,t.to)&&0==me(t.from,l.to)?l.to=yi(t):o.changes.push(Ai(e,t));else{var a=X(i.done);for(a&&a.ranges||Pi(e.sel,i.done),o={changes:[Ai(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}var c,u;i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=s,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,l||rt(e,"historyAdded")}function Wi(e,t,r,n){var i=e.history,o=n&&n.origin;r==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||function(e,t,r,n){var i=t.charAt(0);return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,o,X(i.done),t))?i.done[i.done.length-1]=t:Pi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r,n&&!1!==n.clearRedo&&Oi(i.undone)}function Pi(e,t){var r=X(t);r&&r.ranges&&r.equals(e)||t.push(e)}function zi(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o})}function qi(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function Fi(e,t){var r=function(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=[],i=0;i<t.text.length;++i)n.push(qi(r[i]));return n}(e,t),n=Ne(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],l=n[i];if(o&&l)e:for(var s=0;s<l.length;++s){for(var a=l[s],c=0;c<o.length;++c)if(o[c].marker==a.marker)continue e;o.push(a)}else l&&(r[i]=l)}return r}function Ei(e,t,r){for(var n=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)n.push(r?pi.prototype.deepCopy.call(o):o);else{var l=o.changes,s=[];n.push({changes:s});for(var a=0;a<l.length;++a){var c=l[a],u=void 0;if(s.push({from:c.from,to:c.to,text:c.text}),t)for(var f in c)(u=f.match(/^spans_(\d+)$/))&&I(t,Number(u[1]))>-1&&(X(s)[f]=c[f],delete c[f])}}}return n}function Hi(e,t,r,n){if(n){var i=e.anchor;if(r){var o=me(t,i)<0;o!=me(r,i)<0?(i=t,t=r):o!=me(t,r)<0&&(t=r)}return new gi(i,t)}return new gi(r||t,t)}function Ii(e,t,r,n,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Gi(e,new pi([Hi(e.sel.primary(),t,r,i)],0),n)}function Ri(e,t,r){for(var n=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)n[o]=Hi(e.sel.ranges[o],t[o],null,i);Gi(e,mi(n,e.sel.primIndex),r)}function Bi(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,Gi(e,mi(i,e.sel.primIndex),n)}function ji(e,t,r,n){Gi(e,vi(t,r),n)}function Ui(e,t,r){var n=e.history.done,i=X(n);i&&i.ranges?(n[n.length-1]=t,Ki(e,t,r)):Gi(e,t,r)}function Gi(e,t,r){Ki(e,t,r),Wi(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function Ki(e,t,r){(ot(e,"beforeSelectionChange")||e.cm&&ot(e.cm,"beforeSelectionChange"))&&(t=function(e,t,r){var n={ranges:t.ranges,update:function(t){this.ranges=[];for(var r=0;r<t.length;r++)this.ranges[r]=new gi(we(e,t[r].anchor),we(e,t[r].head))},origin:r&&r.origin};return rt(e,"beforeSelectionChange",e,n),e.cm&&rt(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?mi(n.ranges,n.ranges.length-1):t}(e,t,r));Vi(e,Xi(e,t,r&&r.bias||(me(t.primary().head,e.sel.primary().head)<0?-1:1),!0)),r&&!1===r.scroll||!e.cm||kn(e.cm)}function Vi(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,it(e.cm)),ir(e,"cursorActivity",e))}function $i(e){Vi(e,Xi(e,e.sel,null,!1))}function Xi(e,t,r,n){for(var i,o=0;o<t.ranges.length;o++){var l=t.ranges[o],s=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],a=Zi(e,l.anchor,s&&s.anchor,r,n),c=Zi(e,l.head,s&&s.head,r,n);(i||a!=l.anchor||c!=l.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new gi(a,c))}return i?mi(i,t.primIndex):t}function Yi(e,t,r,n,i){var o=se(e,t.line);if(o.markedSpans)for(var l=0;l<o.markedSpans.length;++l){var s=o.markedSpans[l],a=s.marker;if((null==s.from||(a.inclusiveLeft?s.from<=t.ch:s.from<t.ch))&&(null==s.to||(a.inclusiveRight?s.to>=t.ch:s.to>t.ch))){if(i&&(rt(a,"beforeCursorEnter"),a.explicitlyCleared)){if(o.markedSpans){--l;continue}break}if(!a.atomic)continue;if(r){var c=a.find(n<0?1:-1),u=void 0;if((n<0?a.inclusiveRight:a.inclusiveLeft)&&(c=Qi(e,c,-n,c&&c.line==t.line?o:null)),c&&c.line==t.line&&(u=me(c,r))&&(n<0?u<0:u>0))return Yi(e,c,t,n,i)}var f=a.find(n<0?-1:1);return(n<0?a.inclusiveLeft:a.inclusiveRight)&&(f=Qi(e,f,n,f.line==t.line?o:null)),f?Yi(e,f,t,n,i):null}}return t}function Zi(e,t,r,n,i){var o=n||1,l=Yi(e,t,r,o,i)||!i&&Yi(e,t,r,o,!0)||Yi(e,t,r,-o,i)||!i&&Yi(e,t,r,-o,!0);return l||(e.cantEdit=!0,ge(e.first,0))}function Qi(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?we(e,ge(t.line-1)):null:r>0&&t.ch==(n||se(e,t.line)).text.length?t.line<e.first+e.size-1?ge(t.line+1,0):null:new ge(t.line,t.ch+r)}function Ji(e){e.setSelection(ge(e.firstLine(),0),ge(e.lastLine()),j)}function eo(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return n.canceled=!0}};return r&&(n.update=function(t,r,i,o){t&&(n.from=we(e,t)),r&&(n.to=we(e,r)),i&&(n.text=i),void 0!==o&&(n.origin=o)}),rt(e,"beforeChange",e,n),e.cm&&rt(e.cm,"beforeChange",e.cm,n),n.canceled?null:{from:n.from,to:n.to,text:n.text,origin:n.origin}}function to(e,t,r){if(e.cm){if(!e.cm.curOp)return Gn(e.cm,to)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(ot(e,"beforeChange")||e.cm&&ot(e.cm,"beforeChange"))||(t=eo(e,t,!0))){var n=Ce&&!r&&function(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&-1!=I(n,r)||(n||(n=[])).push(r)}}),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var l=n[o],s=l.find(0),a=0;a<i.length;++a){var c=i[a];if(!(me(c.to,s.from)<0||me(c.from,s.to)>0)){var u=[a,1],f=me(c.from,s.from),h=me(c.to,s.to);(f<0||!l.inclusiveLeft&&!f)&&u.push({from:c.from,to:s.from}),(h>0||!l.inclusiveRight&&!h)&&u.push({from:s.to,to:c.to}),i.splice.apply(i,u),a+=u.length-3}}return i}(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)ro(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text,origin:t.origin});else ro(e,t)}}function ro(e,t){if(1!=t.text.length||""!=t.text[0]||0!=me(t.from,t.to)){var r=_i(e,t);Di(e,t,r,e.cm?e.cm.curOp.id:NaN),oo(e,t,r,Ne(e,t));var n=[];Li(e,function(e,r){r||-1!=I(n,e.history)||(co(e.history,t),n.push(e.history)),oo(e,t,null,Ne(e,t))})}}function no(e,t,r){if(!e.cm||!e.cm.state.suppressEdits||r){for(var n,i=e.history,o=e.sel,l="undo"==t?i.done:i.undone,s="undo"==t?i.undone:i.done,a=0;a<l.length&&(n=l[a],r?!n.ranges||n.equals(e.sel):n.ranges);a++);if(a!=l.length){for(i.lastOrigin=i.lastSelOrigin=null;(n=l.pop()).ranges;){if(Pi(n,s),r&&!n.equals(e.sel))return void Gi(e,n,{clearRedo:!1});o=n}var c=[];Pi(o,s),s.push({changes:c,generation:i.generation}),i.generation=n.generation||++i.maxGeneration;for(var u=ot(e,"beforeChange")||e.cm&&ot(e.cm,"beforeChange"),f=function(r){var i=n.changes[r];if(i.origin=t,u&&!eo(e,i,!1))return l.length=0,{};c.push(Ai(e,i));var o=r?_i(e,i):X(l);oo(e,i,o,Fi(e,i)),!r&&e.cm&&e.cm.scrollIntoView({from:i.from,to:yi(i)});var s=[];Li(e,function(e,t){t||-1!=I(s,e.history)||(co(e.history,i),s.push(e.history)),oo(e,i,null,Fi(e,i))})},h=n.changes.length-1;h>=0;--h){var d=f(h);if(d)return d.v}}}}function io(e,t){if(0!=t&&(e.first+=t,e.sel=new pi(Y(e.sel.ranges,function(e){return new gi(ge(e.anchor.line+t,e.anchor.ch),ge(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){$n(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)Xn(e.cm,n,"gutter")}}function oo(e,t,r,n){if(e.cm&&!e.cm.curOp)return Gn(e.cm,oo)(e,t,r,n);if(t.to.line<e.first)io(e,t.text.length-1-(t.to.line-t.from.line));else if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);io(e,i),t={from:ge(e.first,0),to:ge(t.to.line+i,t.to.ch),text:[X(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:ge(o,se(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=ae(e,t.from,t.to),r||(r=_i(e,t)),e.cm?function(e,t,r){var n=e.doc,i=e.display,o=t.from,l=t.to,s=!1,a=o.line;e.options.lineWrapping||(a=fe(Ie(se(n,o.line))),n.iter(a,l.line+1,function(e){if(e==i.maxLine)return s=!0,!0}));n.sel.contains(t.from,t.to)>-1&&it(e);Si(n,t,r,tn(e)),e.options.lineWrapping||(n.iter(a,o.line+t.text.length,function(e){var t=Ke(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 r=e.first,n=t-1;n>r;n--){var i=se(e,n).stateAfter;if(i&&(!(i instanceof Dt)||n+i.lookAhead<t)){r=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}})(n,o.line),Jn(e,400);var c=t.text.length-(l.line-o.line)-1;t.full?$n(e):o.line!=l.line||1!=t.text.length||Ci(e.doc,t)?$n(e,o.line,l.line+1,c):Xn(e,o.line,"text");var u=ot(e,"changes"),f=ot(e,"change");if(f||u){var h={from:o,to:l,text:t.text,removed:t.removed,origin:t.origin};f&&ir(e,"change",e,h),u&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(h)}e.display.selForContextMenu=null}(e.cm,t,n):Si(e,t,n),Ki(e,r,j)}}function lo(e,t,r,n,i){if(n||(n=r),me(n,r)<0){var o;r=(o=[n,r])[0],n=o[1]}"string"==typeof t&&(t=e.splitLines(t)),to(e,{from:r,to:n,text:t,origin:i})}function so(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function ao(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],l=!0;if(o.ranges){o.copied||((o=e[i]=o.deepCopy()).copied=!0);for(var s=0;s<o.ranges.length;s++)so(o.ranges[s].anchor,t,r,n),so(o.ranges[s].head,t,r,n)}else{for(var a=0;a<o.changes.length;++a){var c=o.changes[a];if(r<c.from.line)c.from=ge(c.from.line+n,c.from.ch),c.to=ge(c.to.line+n,c.to.ch);else if(t<=c.to.line){l=!1;break}}l||(e.splice(0,i+1),i=0)}}}function co(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;ao(e.done,r,n,i),ao(e.undone,r,n,i)}function uo(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=se(e,xe(e,t)):i=fe(t),null==i?null:(n(o,i)&&e.cm&&Xn(e.cm,i,r),o)}function fo(e){this.lines=e,this.parent=null;for(var t=0,r=0;r<e.length;++r)e[r].parent=this,t+=e[r].height;this.height=t}fo.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,n=e+t;r<n;++r){var i=this.lines[r];this.height-=i.height,(o=i).parent=null,Oe(o),ir(i,"delete")}var o;this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;e<n;++e)if(r(this.lines[e]))return!0}};function ho(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var i=e[n];t+=i.chunkSize(),r+=i.height,i.parent=this}this.size=t,this.height=r,this.parent=null}ho.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],i=n.chunkSize();if(e<i){var o=Math.min(t,i-e),l=n.height;if(n.removeInner(e,o),this.height-=l-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof fo))){var s=[];this.collapse(s),this.children=[new fo(s)],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,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<=o){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(var l=i.lines.length%25+25,s=l;s<i.lines.length;){var a=new fo(i.lines.slice(s,s+=25));i.height-=a.height,this.children.splice(++n,0,a),a.parent=this}i.lines=i.lines.slice(0,l),this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=new ho(e.children.splice(e.children.length-5,5));if(e.parent){e.size-=t.size,e.height-=t.height;var r=I(e.parent.children,e);e.parent.children.splice(r+1,0,t)}else{var n=new ho(e.children);n.parent=e,e.children=[n,t],e=n}t.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<o){var l=Math.min(t,o-e);if(i.iterN(e,l,r))return!0;if(0==(t-=l))break;e=0}else e-=o}}};var po=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t};po.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=fe(r);if(null!=n&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(r.widgets=null);var o=vr(this);ue(r,Math.max(0,r.height-o)),e&&(Un(e,function(){go(e,r,-o),Xn(e,n,"widget")}),ir(e,"lineWidgetCleared",e,this,n))}},po.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line;this.height=null;var i=vr(this)-t;i&&(ue(n,n.height+i),r&&Un(r,function(){r.curOp.forceUpdate=!0,go(r,n,i),ir(r,"lineWidgetChanged",r,e,fe(n))}))},lt(po);function go(e,t,r){Ge(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&wn(e,r)}var mo=0,vo=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++mo};vo.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&En(e),ot(this,"clear")){var r=this.find();r&&ir(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;o<this.lines.length;++o){var l=this.lines[o],s=Te(l.markedSpans,this);e&&!this.collapsed?Xn(e,fe(l),"text"):e&&(null!=s.to&&(i=fe(l)),null!=s.from&&(n=fe(l))),l.markedSpans=Me(l.markedSpans,s),null==s.from&&this.collapsed&&!je(this.doc,l)&&e&&ue(l,Zr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var a=0;a<this.lines.length;++a){var c=Ie(this.lines[a]),u=Ke(c);u>e.display.maxLineLength&&(e.display.maxLine=c,e.display.maxLineLength=u,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&$n(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&$i(e.doc)),e&&ir(e,"markerCleared",e,this,n,i),t&&Hn(e),this.parent&&this.parent.clear()}},vo.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var r,n,i=0;i<this.lines.length;++i){var o=this.lines[i],l=Te(o.markedSpans,this);if(null!=l.from&&(r=ge(t?o:fe(o),l.from),-1==e))return r;if(null!=l.to&&(n=ge(t?o:fe(o),l.to),1==e))return n}return r&&{from:r,to:n}},vo.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,n=this.doc.cm;t&&n&&Un(n,function(){var i=t.line,o=fe(t.line),l=Tr(n,o);if(l&&(Wr(l),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!je(r.doc,i)&&null!=r.height){var s=r.height;r.height=null;var a=vr(r)-s;a&&ue(i,i.height+a)}ir(n,"markerChanged",n,e)})},vo.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=I(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},vo.prototype.detachLine=function(e){if(this.lines.splice(I(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},lt(vo);function yo(e,t,r,n,i){if(n&&n.shared)return function(e,t,r,n,i){(n=F(n)).shared=!1;var o=[yo(e,t,r,n,i)],l=o[0],s=n.widgetNode;return Li(e,function(e){s&&(n.widgetNode=s.cloneNode(!0)),o.push(yo(e,we(e,t),we(e,r),n,i));for(var a=0;a<e.linked.length;++a)if(e.linked[a].isParent)return;l=X(o)}),new bo(o,l)}(e,t,r,n,i);if(e.cm&&!e.cm.curOp)return Gn(e.cm,yo)(e,t,r,n,i);var o=new vo(e,i),l=me(t,r);if(n&&F(n,o,!1),l>0||0==l&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=N("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(He(e,t.line,t,r,o)||t.line!=r.line&&He(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Se=!0}o.addToHistory&&Di(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var s,a=t.line,c=e.cm;if(e.iter(a,r.line+1,function(e){c&&o.collapsed&&!c.options.lineWrapping&&Ie(e)==c.display.maxLine&&(s=!0),o.collapsed&&a!=t.line&&ue(e,0),n=e,i=new Le(o,a==t.line?t.ch:null,a==r.line?r.ch:null),n.markedSpans=n.markedSpans?n.markedSpans.concat([i]):[i],i.marker.attachLine(n);var n,i;++a}),o.collapsed&&e.iter(t.line,r.line+1,function(t){je(e,t)&&ue(t,0)}),o.clearOnEnter&&Je(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(Ce=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++mo,o.atomic=!0),c){if(s&&(c.curOp.updateMaxLine=!0),o.collapsed)$n(c,t.line,r.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var u=t.line;u<=r.line;u++)Xn(c,u,"text");o.atomic&&$i(c.doc),ir(c,"markerAdded",c,o)}return o}var bo=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};bo.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();ir(this,"clear")}},bo.prototype.find=function(e,t){return this.primary.find(e,t)},lt(bo);function _o(e){return e.findMarks(ge(e.first,0),e.clipPos(ge(e.lastLine())),function(e){return e.parent})}function xo(e){for(var t=function(t){var r=e[t],n=[r.primary.doc];Li(r.primary.doc,function(e){return n.push(e)});for(var i=0;i<r.markers.length;i++){var o=r.markers[i];-1==I(n,o.doc)&&(o.parent=null,r.markers.splice(i--,1))}},r=0;r<e.length;r++)t(r)}var wo=0,ko=function(e,t,r,n,i){if(!(this instanceof ko))return new ko(e,t,r,n,i);null==r&&(r=0),ho.call(this,[new fo([new Ut("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var o=ge(r,0);this.sel=vi(o),this.history=new Ni(null),this.id=++wo,this.modeOption=t,this.lineSep=n,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),Si(this,{from:o,to:o,text:e}),Gi(this,vi(o),j)};ko.prototype=Q(ho.prototype,{constructor:ko,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=ce(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:Vn(function(e){var t=ge(this.first,0),r=this.first+this.size-1;to(this,{from:t,to:ge(r,se(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Cn(this.cm,0,0),Gi(this,vi(t),j)}),replaceRange:function(e,t,r,n){lo(this,e,t=we(this,t),r=r?we(this,r):t,n)},getRange:function(e,t,r){var n=ae(this,we(this,e),we(this,t));return!1===r?n:n.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(de(this,e))return se(this,e)},getLineNumber:function(e){return fe(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=se(this,e)),Ie(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return we(this,e)},getCursor:function(e){var t=this.sel.primary();return null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Vn(function(e,t,r){ji(this,we(this,"number"==typeof e?ge(e,t||0):e),null,r)}),setSelection:Vn(function(e,t,r){ji(this,we(this,e),we(this,t||e),r)}),extendSelection:Vn(function(e,t,r){Ii(this,we(this,e),t&&we(this,t),r)}),extendSelections:Vn(function(e,t){Ri(this,ke(this,e),t)}),extendSelectionsBy:Vn(function(e,t){Ri(this,ke(this,Y(this.sel.ranges,e)),t)}),setSelections:Vn(function(e,t,r){if(e.length){for(var n=[],i=0;i<e.length;i++)n[i]=new gi(we(this,e[i].anchor),we(this,e[i].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Gi(this,mi(n,t),r)}}),addSelection:Vn(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new gi(we(this,e),we(this,t||e))),Gi(this,mi(n,n.length-1),r)}),getSelection:function(e){for(var t,r=this.sel.ranges,n=0;n<r.length;n++){var i=ae(this,r[n].from(),r[n].to());t=t?t.concat(i):i}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var i=ae(this,r[n].from(),r[n].to());!1!==e&&(i=i.join(e||this.lineSeparator())),t[n]=i}return t},replaceSelection:function(e,t,r){for(var n=[],i=0;i<this.sel.ranges.length;i++)n[i]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:Vn(function(e,t,r){for(var n=[],i=this.sel,o=0;o<i.ranges.length;o++){var l=i.ranges[o];n[o]={from:l.from(),to:l.to(),text:this.splitLines(e[o]),origin:r}}for(var s=t&&"end"!=t&&function(e,t,r){for(var n=[],i=ge(e.first,0),o=i,l=0;l<t.length;l++){var s=t[l],a=xi(s.from,i,o),c=xi(yi(s),i,o);if(i=s.to,o=c,"around"==r){var u=e.sel.ranges[l],f=me(u.head,u.anchor)<0;n[l]=new gi(f?c:a,f?a:c)}else n[l]=new gi(a,a)}return new pi(n,e.sel.primIndex)}(this,n,t),a=n.length-1;a>=0;a--)to(this,n[a]);s?Ui(this,s):this.cm&&kn(this.cm)}),undo:Vn(function(){no(this,"undo")}),redo:Vn(function(){no(this,"redo")}),undoSelection:Vn(function(){no(this,"undo",!0)}),redoSelection:Vn(function(){no(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){this.history=new Ni(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Ei(this.history.done),undone:Ei(this.history.undone)}},setHistory:function(e){var t=this.history=new Ni(this.history.maxGeneration);t.done=Ei(e.done.slice(0),null,!0),t.undone=Ei(e.undone.slice(0),null,!0)},setGutterMarker:Vn(function(e,t,r){return uo(this,e,"gutter",function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&re(n)&&(e.gutterMarkers=null),!0})}),clearGutter:Vn(function(e){var t=this;this.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&uo(t,r,"gutter",function(){return r.gutterMarkers[e]=null,re(r.gutterMarkers)&&(r.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!de(this,e))return null;if(t=e,!(e=se(this,e)))return null}else if(null==(t=fe(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:Vn(function(e,t,r){return uo(this,e,"gutter"==t?"gutter":"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[n]){if(C(r).test(e[n]))return!1;e[n]+=" "+r}else e[n]=r;return!0})}),removeLineClass:Vn(function(e,t,r){return uo(this,e,"gutter"==t?"gutter":"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",i=e[n];if(!i)return!1;if(null==r)e[n]=null;else{var o=i.match(C(r));if(!o)return!1;var l=o.index+o[0].length;e[n]=i.slice(0,o.index)+(o.index&&l!=i.length?" ":"")+i.slice(l)||null}return!0})}),addLineWidget:Vn(function(e,t,r){return function(e,t,r,n){var i=new po(e,r,n),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),uo(e,t,"widget",function(t){var r=t.widgets||(t.widgets=[]);if(null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!je(e,t)){var n=Ge(t)<e.scrollTop;ue(t,t.height+vr(i)),n&&wn(o,i.height),o.curOp.forceUpdate=!0}return!0}),ir(o,"lineWidgetAdded",o,i,"number"==typeof t?t:fe(t)),i}(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return yo(this,we(this,e),we(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return yo(this,e=we(this,e),e,r,"bookmark")},findMarksAt:function(e){var t=[],r=se(this,(e=we(this,e)).line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(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(e,t,r){e=we(this,e),t=we(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var l=o.markedSpans;if(l)for(var s=0;s<l.length;s++){var a=l[s];null!=a.to&&i==e.line&&e.ch>=a.to||null==a.from&&i!=e.line||null!=a.from&&i==t.line&&a.from>=t.ch||r&&!r(a.marker)||n.push(a.marker.parent||a.marker)}++i}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)null!=r[n].from&&e.push(r[n].marker)}),e},posFromIndex:function(e){var t,r=this.first,n=this.lineSeparator().length;return this.iter(function(i){var o=i.text.length+n;if(o>e)return t=e,!0;e-=o,++r}),we(this,ge(r,t))},indexFromPos:function(e){var t=(e=we(this,e)).ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,function(e){t+=e.text.length+r}),t},copy:function(e){var t=new ko(ce(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<r&&(r=e.to);var n=new ko(ce(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),o=e.clipPos(i.from),l=e.clipPos(i.to);if(me(o,l)){var s=yo(e,o,l,n.primary,n.primary.type);n.markers.push(s),s.parent=n}}}(n,_o(this)),n},unlinkDoc:function(e){if(e instanceof _l&&(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),xo(_o(this));break}}if(e.history==this.history){var r=[e.id];Li(e,function(e){return r.push(e.id)},!0),e.history=new Ni(null),e.history.done=Ei(this.history.done,r),e.history.undone=Ei(this.history.undone,r)}},iterLinkedDocs:function(e){Li(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):yt(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:Vn(function(e){if("rtl"!=e&&(e="ltr"),e!=this.direction){this.direction=e,this.iter(function(e){return e.order=null}),this.cm&&Un(t=this.cm,function(){Mi(t),$n(t)});var t}})}),ko.prototype.eachLine=ko.prototype.iter;var Co=0;function So(e){var t=this;if(Lo(t),!nt(t,e)&&!yr(t.display,e)){st(e),l&&(Co=+new Date);var r=nn(t,e,!0),n=e.dataTransfer.files;if(r&&!t.isReadOnly())if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),s=0,a=function(e,n){if(!t.options.allowDropFileTypes||-1!=I(t.options.allowDropFileTypes,e.type)){var l=new FileReader;l.onload=Gn(t,function(){var e=l.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[n]=e,++s==i){var a={from:r=we(t.doc,r),to:r,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"};to(t.doc,a),Ui(t.doc,vi(r,yi(a)))}}),l.readAsText(e)}},c=0;c<i;++c)a(n[c],c);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout(function(){return t.display.input.focus()},20);try{var u=e.dataTransfer.getData("Text");if(u){var f;if(t.state.draggingText&&!t.state.draggingText.copy&&(f=t.listSelections()),Ki(t.doc,vi(r,r)),f)for(var h=0;h<f.length;++h)lo(t.doc,"",f[h].anchor,f[h].head,"drag");t.replaceSelection(u,"around","paste"),t.display.input.focus()}}catch(e){}}}}function Lo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function To(e){if(document.getElementsByClassName)for(var t=document.getElementsByClassName("CodeMirror"),r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&e(n)}}var Mo=!1;function No(){Mo||(!function(){var e;Je(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,To(Ao)},100))}),Je(window,"blur",function(){return To(gn)})}(),Mo=!0)}function Ao(e){var t=e.display;t.lastWrapHeight==t.wrapper.clientHeight&&t.lastWrapWidth==t.wrapper.clientWidth||(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize())}for(var Oo={3:"Enter",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:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Do=0;Do<10;Do++)Oo[Do+48]=Oo[Do+96]=String(Do);for(var Wo=65;Wo<=90;Wo++)Oo[Wo]=String.fromCharCode(Wo);for(var Po=1;Po<=12;Po++)Oo[Po+111]=Oo[Po+63235]="F"+Po;var zo={};zo.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"},zo.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"},zo.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},zo.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"]},zo.default=y?zo.macDefault:zo.pcDefault;function qo(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var r,n,i,o,l=0;l<t.length-1;l++){var s=t[l];if(/^(cmd|meta|m)$/i.test(s))o=!0;else if(/^a(lt)?$/i.test(s))r=!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);i=!0}}return r&&(e="Alt-"+e),n&&(e="Ctrl-"+e),o&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Fo(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if("..."==n){delete e[r];continue}for(var i=Y(r.split(" "),qo),o=0;o<i.length;o++){var l=void 0,s=void 0;o==i.length-1?(s=i.join(" "),l=n):(s=i.slice(0,o+1).join(" "),l="...");var a=t[s];if(a){if(a!=l)throw new Error("Inconsistent bindings for "+s)}else t[s]=l}delete e[r]}for(var c in t)e[c]=t[c];return e}function Eo(e,t,r,n){var i=(t=Bo(t)).call?t.call(e,n):t[e];if(!1===i)return"nothing";if("..."===i)return"multi";if(null!=i&&r(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return Eo(e,t.fallthrough,r,n);for(var o=0;o<t.fallthrough.length;o++){var l=Eo(e,t.fallthrough[o],r,n);if(l)return l}}}function Ho(e){var t="string"==typeof e?e:Oo[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function Io(e,t,r){var n=e;return t.altKey&&"Alt"!=n&&(e="Alt-"+e),(w?t.metaKey:t.ctrlKey)&&"Ctrl"!=n&&(e="Ctrl-"+e),(w?t.ctrlKey:t.metaKey)&&"Cmd"!=n&&(e="Cmd-"+e),!r&&t.shiftKey&&"Shift"!=n&&(e="Shift-"+e),e}function Ro(e,t){if(f&&34==e.keyCode&&e.char)return!1;var r=Oo[e.keyCode];return null!=r&&!e.altGraphKey&&Io(r,e,t)}function Bo(e){return"string"==typeof e?zo[e]:e}function jo(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=t(r[i]);n.length&&me(o.from,X(n).to)<=0;){var l=n.pop();if(me(l.from,o.from)<0){o.from=l.from;break}}n.push(o)}Un(e,function(){for(var t=n.length-1;t>=0;t--)lo(e.doc,"",n[t].from,n[t].to,"+delete");kn(e)})}function Uo(e,t,r){var n=oe(e.text,t+r,r);return n<0||n>e.text.length?null:n}function Go(e,t,r){var n=Uo(e,t.ch,r);return null==n?null:new ge(t.line,n,r<0?"after":"before")}function Ko(e,t,r,n,i){if(e){var o=Ze(r,t.doc.direction);if(o){var l,s=i<0?X(o):o[0],a=i<0==(1==s.level)?"after":"before";if(s.level>0||"rtl"==t.doc.direction){var c=Mr(t,r);l=i<0?r.text.length-1:0;var u=Nr(t,c,l).top;l=le(function(e){return Nr(t,c,e).top==u},i<0==(1==s.level)?s.from:s.to-1,l),"before"==a&&(l=Uo(r,l,1))}else l=i<0?s.to:s.from;return new ge(n,l,a)}}return new ge(n,i<0?r.text.length:0,i<0?"before":"after")}var Vo={selectAll:Ji,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),j)},killLine:function(e){return jo(e,function(t){if(t.empty()){var r=se(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:ge(t.head.line+1,0)}:{from:t.head,to:ge(t.head.line,r)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){return jo(e,function(t){return{from:ge(t.from().line,0),to:we(e.doc,ge(t.to().line+1,0))}})},delLineLeft:function(e){return jo(e,function(e){return{from:ge(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){return jo(e,function(t){var r=e.charCoords(t.head,"div").top+5;return{from:e.coordsChar({left:0,top:r},"div"),to:t.from()}})},delWrappedLineRight:function(e){return jo(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:n}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(ge(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(ge(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return $o(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return Xo(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return function(e,t){var r=se(e.doc,t),n=function(e){for(var t;t=Ee(e);)e=t.find(1,!0).line;return e}(r);n!=r&&(t=fe(n));return Ko(!0,e,r,t,-1)}(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")},G)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},G)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return n.ch<e.getLine(n.line).search(/\S/)?Xo(e,t.head):n},G)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"char")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,i=0;i<r.length;i++){var o=r[i].from(),l=E(e.getLine(o.line),o.ch,n);t.push($(n-l%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Un(e,function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++)if(t[n].empty()){var i=t[n].head,o=se(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new ge(i.line,i.ch-1)),i.ch>0)i=new ge(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),ge(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var l=se(e.doc,i.line-1).text;l&&(i=new ge(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+l.charAt(l.length-1),ge(i.line-1,l.length-1),i,"+transpose"))}r.push(new gi(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){return Un(e,function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var n=0;n<t.length;n++)e.indentLine(t[n].from().line,null,!0);kn(e)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function $o(e,t){var r=se(e.doc,t),n=Ie(r);return n!=r&&(t=fe(n)),Ko(!0,e,n,t,1)}function Xo(e,t){var r=$o(e,t.line),n=se(e.doc,r.line),i=Ze(n,e.doc.direction);if(!i||0==i[0].level){var o=Math.max(0,n.text.search(/\S/)),l=t.line==r.line&&t.ch<=o&&t.ch;return ge(r.line,l?0:o,r.sticky)}return r}function Yo(e,t,r){if("string"==typeof t&&!(t=Vo[t]))return!1;e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=B}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}var Zo=new H;function Qo(e,t,r,n){var i=e.state.keySeq;if(i){if(Ho(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Zo.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),Jo(e,i+" "+t,r,n))return!0}return Jo(e,t,r,n)}function Jo(e,t,r,n){var i=function(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=Eo(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&Eo(t,e.options.extraKeys,r,e)||Eo(t,e.options.keyMap,r,e)}(e,t,n);return"multi"==i&&(e.state.keySeq=t),"handled"==i&&ir(e,"keyHandled",e,t,r),"handled"!=i&&"multi"!=i||(st(r),fn(e)),!!i}function el(e,t){var r=Ro(t,!0);return!!r&&(t.shiftKey&&!e.state.keySeq?Qo(e,"Shift-"+r,t,function(t){return Yo(e,t,!0)})||Qo(e,r,t,function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return Yo(e,t)}):Qo(e,r,t,function(t){return Yo(e,t)}))}var tl=null;function rl(e){if(this.curOp.focus=D(),!nt(this,e)){l&&s<11&&27==e.keyCode&&(e.returnValue=!1);var t=e.keyCode;this.display.shift=16==t||e.shiftKey;var r=el(this,e);f&&(tl=r?t:null,!r&&88==t&&!_t&&(y?e.metaKey:e.ctrlKey)&&this.replaceSelection("",null,"cut")),18!=t||/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)||function(e){var t=e.display.lineDiv;W(t,"CodeMirror-crosshair");function r(e){18!=e.keyCode&&e.altKey||(S(t,"CodeMirror-crosshair"),tt(document,"keyup",r),tt(document,"mouseover",r))}Je(document,"keyup",r),Je(document,"mouseover",r)}(this)}}function nl(e){16==e.keyCode&&(this.doc.sel.shift=!1),nt(this,e)}function il(e){if(!(yr(this.display,e)||nt(this,e)||e.ctrlKey&&!e.altKey||y&&e.metaKey)){var t=e.keyCode,r=e.charCode;if(f&&t==tl)return tl=null,void st(e);if(!f||e.which&&!(e.which<10)||!el(this,e)){var n=String.fromCharCode(null==r?t:r);if("\b"!=n&&!Qo(i=this,"'"+n+"'",e,function(e){return Yo(i,e,!0)})){var i;this.display.input.onKeyPress(e)}}}}var ol=function(e,t,r){this.time=e,this.pos=t,this.button=r};ol.prototype.compare=function(e,t,r){return this.time+400>e&&0==me(t,this.pos)&&r==this.button};var ll,sl;function al(e){var t=this.display;if(!(nt(this,e)||t.activeTouch&&t.input.supportsTouch()))if(t.input.ensurePolled(),t.shift=e.shiftKey,yr(t,e))a||(t.scroller.draggable=!1,setTimeout(function(){return t.scroller.draggable=!0},100));else if(!fl(this,e)){var r=nn(this,e),n=ht(e),i=r?function(e,t){var r=+new Date;return sl&&sl.compare(r,e,t)?(ll=sl=null,"triple"):ll&&ll.compare(r,e,t)?(sl=new ol(r,e,t),ll=null,"double"):(ll=new ol(r,e,t),sl=null,"single")}(r,n):"single";window.focus(),1==n&&this.state.selectingText&&this.state.selectingText(e),r&&function(e,t,r,n,i){var o="Click";"double"==n?o="Double"+o:"triple"==n&&(o="Triple"+o);return Qo(e,Io(o=(1==t?"Left":2==t?"Middle":"Right")+o,i),i,function(t){if("string"==typeof t&&(t=Vo[t]),!t)return!1;var n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n=t(e,r)!=B}finally{e.state.suppressEdits=!1}return n})}(this,n,r,i,e)||(1==n?r?function(e,t,r,n){l?setTimeout(q(hn,e),0):e.curOp.focus=D();var i,o=function(e,t,r){var n=e.getOption("configureMouse"),i=n?n(e,t,r):{};if(null==i.unit){var o=b?r.shiftKey&&r.metaKey:r.altKey;i.unit=o?"rectangle":"single"==t?"char":"double"==t?"word":"line"}(null==i.extend||e.doc.extend)&&(i.extend=e.doc.extend||r.shiftKey);null==i.addNew&&(i.addNew=y?r.metaKey:r.ctrlKey);null==i.moveOnDrag&&(i.moveOnDrag=!(y?r.altKey:r.ctrlKey));return i}(e,r,n),c=e.doc.sel;e.options.dragDrop&&pt&&!e.isReadOnly()&&"single"==r&&(i=c.contains(t))>-1&&(me((i=c.ranges[i]).from(),t)<0||t.xRel>0)&&(me(i.to(),t)>0||t.xRel<0)?function(e,t,r,n){var i=e.display,o=!1,c=Gn(e,function(t){a&&(i.scroller.draggable=!1),e.state.draggingText=!1,tt(document,"mouseup",c),tt(document,"mousemove",u),tt(i.scroller,"dragstart",f),tt(i.scroller,"drop",c),o||(st(t),n.addNew||Ii(e.doc,r,null,null,n.extend),a||l&&9==s?setTimeout(function(){document.body.focus(),i.input.focus()},20):i.input.focus())}),u=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},f=function(){return o=!0};a&&(i.scroller.draggable=!0);e.state.draggingText=c,c.copy=!n.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop();Je(document,"mouseup",c),Je(document,"mousemove",u),Je(i.scroller,"dragstart",f),Je(i.scroller,"drop",c),dn(e),setTimeout(function(){return i.input.focus()},20)}(e,n,t,o):function(e,t,r,n){var i=e.display,o=e.doc;st(t);var l,s,a=o.sel,c=a.ranges;n.addNew&&!n.extend?(s=o.sel.contains(r),l=s>-1?c[s]:new gi(r,r)):(l=o.sel.primary(),s=o.sel.primIndex);if("rectangle"==n.unit)n.addNew||(l=new gi(r,r)),r=nn(e,t,!0,!0),s=-1;else{var u=cl(e,r,n.unit);l=n.extend?Hi(l,u.anchor,u.head,n.extend):u}n.addNew?-1==s?(s=c.length,Gi(o,mi(c.concat([l]),s),{scroll:!1,origin:"*mouse"})):c.length>1&&c[s].empty()&&"char"==n.unit&&!n.extend?(Gi(o,mi(c.slice(0,s).concat(c.slice(s+1)),0),{scroll:!1,origin:"*mouse"}),a=o.sel):Bi(o,s,l,U):(s=0,Gi(o,new pi([l],0),U),a=o.sel);var f=r;function h(t){if(0!=me(f,t))if(f=t,"rectangle"==n.unit){for(var i=[],c=e.options.tabSize,u=E(se(o,r.line).text,r.ch,c),h=E(se(o,t.line).text,t.ch,c),d=Math.min(u,h),p=Math.max(u,h),g=Math.min(r.line,t.line),m=Math.min(e.lastLine(),Math.max(r.line,t.line));g<=m;g++){var v=se(o,g).text,y=K(v,d,c);d==p?i.push(new gi(ge(g,y),ge(g,y))):v.length>y&&i.push(new gi(ge(g,y),ge(g,K(v,p,c))))}i.length||i.push(new gi(r,r)),Gi(o,mi(a.ranges.slice(0,s).concat(i),s),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b,_=l,x=cl(e,t,n.unit),w=_.anchor;me(x.anchor,w)>0?(b=x.head,w=_e(_.from(),x.anchor)):(b=x.anchor,w=be(_.to(),x.head));var k=a.ranges.slice(0);k[s]=function(e,t){var r=t.anchor,n=t.head,i=se(e.doc,r.line);if(0==me(r,n)&&r.sticky==n.sticky)return t;var o=Ze(i);if(!o)return t;var l=Xe(o,r.ch,r.sticky),s=o[l];if(s.from!=r.ch&&s.to!=r.ch)return t;var a=l+(s.from==r.ch==(1!=s.level)?0:1);if(0==a||a==o.length)return t;var c;if(n.line!=r.line)c=(n.line-r.line)*("ltr"==e.doc.direction?1:-1)>0;else{var u=Xe(o,n.ch,n.sticky),f=u-l||(n.ch-r.ch)*(1==s.level?-1:1);c=u==a-1||u==a?f<0:f>0}var h=o[a+(c?-1:0)],d=c==(1==h.level),p=d?h.from:h.to,g=d?"after":"before";return r.ch==p&&r.sticky==g?t:new gi(new ge(r.line,p,g),n)}(e,new gi(we(o,w),b)),Gi(o,mi(k,s),U)}}var d=i.wrapper.getBoundingClientRect(),p=0;function g(t){e.state.selectingText=!1,p=1/0,st(t),i.input.focus(),tt(document,"mousemove",m),tt(document,"mouseup",v),o.history.lastSelOrigin=null}var m=Gn(e,function(t){ht(t)?function t(r){var l=++p;var s=nn(e,r,!0,"rectangle"==n.unit);if(!s)return;if(0!=me(s,f)){e.curOp.focus=D(),h(s);var a=yn(i,o);(s.line>=a.to||s.line<a.from)&&setTimeout(Gn(e,function(){p==l&&t(r)}),150)}else{var c=r.clientY<d.top?-20:r.clientY>d.bottom?20:0;c&&setTimeout(Gn(e,function(){p==l&&(i.scroller.scrollTop+=c,t(r))}),50)}}(t):g(t)}),v=Gn(e,g);e.state.selectingText=v,Je(document,"mousemove",m),Je(document,"mouseup",v)}(e,n,t,o)}(this,r,i,e):ft(e)==t.scroller&&st(e):2==n?(r&&Ii(this.doc,r),setTimeout(function(){return t.input.focus()},20)):3==n&&(k?hl(this,e):dn(this)))}}function cl(e,t,r){if("char"==r)return new gi(t,t);if("word"==r)return e.findWordAt(t);if("line"==r)return new gi(ge(t.line,0),we(e.doc,ge(t.line+1,0)));var n=r(e,t);return new gi(n.from,n.to)}function ul(e,t,r,n){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&st(t);var l=e.display,s=l.lineDiv.getBoundingClientRect();if(o>s.bottom||!ot(e,r))return ct(t);o-=s.top-l.viewOffset;for(var a=0;a<e.options.gutters.length;++a){var c=l.gutters.childNodes[a];if(c&&c.getBoundingClientRect().right>=i){return rt(e,r,e,he(e.doc,o),e.options.gutters[a],t),ct(t)}}}function fl(e,t){return ul(e,t,"gutterClick",!0)}function hl(e,t){yr(e.display,t)||function(e,t){if(!ot(e,"gutterContextMenu"))return!1;return ul(e,t,"gutterContextMenu",!1)}(e,t)||nt(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function dl(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),zr(e)}var pl={toString:function(){return"CodeMirror.Init"}},gl={},ml={};function vl(e){si(e),$n(e),bn(e)}function yl(e,t,r){if(!t!=!(r&&r!=pl)){var n=e.display.dragFunctions,i=t?Je:tt;i(e.display.scroller,"dragstart",n.start),i(e.display.scroller,"dragenter",n.enter),i(e.display.scroller,"dragover",n.over),i(e.display.scroller,"dragleave",n.leave),i(e.display.scroller,"drop",n.drop)}}function bl(e){e.options.lineWrapping?(W(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(S(e.display.wrapper,"CodeMirror-wrap"),Ve(e)),rn(e),$n(e),zr(e),setTimeout(function(){return Wn(e)},100)}function _l(e,t){var n=this;if(!(this instanceof _l))return new _l(e,t);this.options=t=t?F(t):{},F(gl,t,!1),ai(t);var i=t.value;"string"==typeof i&&(i=new ko(i,t.mode,null,t.lineSeparator,t.direction)),this.doc=i;var o=new _l.inputStyles[t.inputStyle](this),c=this.display=new function(e,t,n){this.input=n,this.scrollbarFiller=M("div",null,"CodeMirror-scrollbar-filler"),this.scrollbarFiller.setAttribute("cm-not-content","true"),this.gutterFiller=M("div",null,"CodeMirror-gutter-filler"),this.gutterFiller.setAttribute("cm-not-content","true"),this.lineDiv=N("div",null,"CodeMirror-code"),this.selectionDiv=M("div",null,null,"position: relative; z-index: 1"),this.cursorDiv=M("div",null,"CodeMirror-cursors"),this.measure=M("div",null,"CodeMirror-measure"),this.lineMeasure=M("div",null,"CodeMirror-measure"),this.lineSpace=N("div",[this.measure,this.lineMeasure,this.selectionDiv,this.cursorDiv,this.lineDiv],null,"position: relative; outline: none");var i=N("div",[this.lineSpace],"CodeMirror-lines");this.mover=M("div",[i],null,"position: relative"),this.sizer=M("div",[this.mover],"CodeMirror-sizer"),this.sizerWidth=null,this.heightForcer=M("div",null,null,"position: absolute; height: "+R+"px; width: 1px;"),this.gutters=M("div",null,"CodeMirror-gutters"),this.lineGutter=null,this.scroller=M("div",[this.sizer,this.heightForcer,this.gutters],"CodeMirror-scroll"),this.scroller.setAttribute("tabIndex","-1"),this.wrapper=M("div",[this.scrollbarFiller,this.gutterFiller,this.scroller],"CodeMirror"),l&&s<8&&(this.gutters.style.zIndex=-1,this.scroller.style.paddingRight=0),a||r&&v||(this.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(this.wrapper):e(this.wrapper)),this.viewFrom=this.viewTo=t.first,this.reportedViewFrom=this.reportedViewTo=t.first,this.view=[],this.renderedView=null,this.externalMeasured=null,this.viewOffset=0,this.lastWrapHeight=this.lastWrapWidth=0,this.updateLineNumbers=null,this.nativeBarWidth=this.barHeight=this.barWidth=0,this.scrollbarsClipped=!1,this.lineNumWidth=this.lineNumInnerWidth=this.lineNumChars=null,this.alignWidgets=!1,this.cachedCharWidth=this.cachedTextHeight=this.cachedPaddingH=null,this.maxLine=null,this.maxLineLength=0,this.maxLineChanged=!1,this.wheelDX=this.wheelDY=this.wheelStartX=this.wheelStartY=null,this.shift=!1,this.selForContextMenu=null,this.activeTouch=null,n.init(this)}(e,i,o);c.wrapper.CodeMirror=this,si(this),dl(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),qn(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 H,keySeq:null,specialChars:null},t.autofocus&&!v&&c.input.focus(),l&&s<11&&setTimeout(function(){return n.display.input.reset(!0)},20),function(e){var t=e.display;Je(t.scroller,"mousedown",Gn(e,al)),Je(t.scroller,"dblclick",l&&s<11?Gn(e,function(t){if(!nt(e,t)){var r=nn(e,t);if(r&&!fl(e,t)&&!yr(e.display,t)){st(t);var n=e.findWordAt(r);Ii(e.doc,n.anchor,n.head)}}}):function(t){return nt(e,t)||st(t)});k||Je(t.scroller,"contextmenu",function(t){return hl(e,t)});var r,n={end:0};function i(){t.activeTouch&&(r=setTimeout(function(){return t.activeTouch=null},1e3),(n=t.activeTouch).end=+new Date)}function o(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return r*r+n*n>400}Je(t.scroller,"touchstart",function(i){if(!nt(e,i)&&!function(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(i)&&!fl(e,i)){t.input.ensurePolled(),clearTimeout(r);var o=+new Date;t.activeTouch={start:o,moved:!1,prev:o-n.end<=300?n:null},1==i.touches.length&&(t.activeTouch.left=i.touches[0].pageX,t.activeTouch.top=i.touches[0].pageY)}}),Je(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Je(t.scroller,"touchend",function(r){var n=t.activeTouch;if(n&&!yr(t,r)&&null!=n.left&&!n.moved&&new Date-n.start<300){var l,s=e.coordsChar(t.activeTouch,"page");l=!n.prev||o(n,n.prev)?new gi(s,s):!n.prev.prev||o(n,n.prev.prev)?e.findWordAt(s):new gi(ge(s.line,0),we(e.doc,ge(s.line+1,0))),e.setSelection(l.anchor,l.head),e.focus(),st(r)}i()}),Je(t.scroller,"touchcancel",i),Je(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Tn(e,t.scroller.scrollTop),Nn(e,t.scroller.scrollLeft,!0),rt(e,"scroll",e))}),Je(t.scroller,"mousewheel",function(t){return di(e,t)}),Je(t.scroller,"DOMMouseScroll",function(t){return di(e,t)}),Je(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(t){nt(e,t)||ut(t)},over:function(t){nt(e,t)||(!function(e,t){var r=nn(e,t);if(r){var n=document.createDocumentFragment();an(e,r,n),e.display.dragCursor||(e.display.dragCursor=M("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),T(e.display.dragCursor,n)}}(e,t),ut(t))},start:function(t){return function(e,t){if(l&&(!e.state.draggingText||+new Date-Co<100))ut(t);else if(!nt(e,t)&&!yr(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!h)){var r=M("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",f&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),f&&r.parentNode.removeChild(r)}}(e,t)},drop:Gn(e,So),leave:function(t){nt(e,t)||Lo(e)}};var a=t.input.getField();Je(a,"keyup",function(t){return nl.call(e,t)}),Je(a,"keydown",Gn(e,rl)),Je(a,"keypress",Gn(e,il)),Je(a,"focus",function(t){return pn(e,t)}),Je(a,"blur",function(t){return gn(e,t)})}(this),No(),En(this),this.curOp.forceUpdate=!0,Ti(this,i),t.autofocus&&!v||this.hasFocus()?setTimeout(q(pn,this),20):gn(this);for(var u in ml)ml.hasOwnProperty(u)&&ml[u](n,t[u],pl);_n(this),t.finishInit&&t.finishInit(this);for(var d=0;d<xl.length;++d)xl[d](n);Hn(this),a&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(c.lineDiv).textRendering&&(c.lineDiv.style.textRendering="auto")}_l.defaults=gl,_l.optionHandlers=ml;var xl=[];_l.defineInitHook=function(e){return xl.push(e)};function wl(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=qt(e,t).state:r="prev");var l=e.options.tabSize,s=se(o,t),a=E(s.text,null,l);s.stateAfter&&(s.stateAfter=null);var c,u=s.text.match(/^\s*/)[0];if(n||/\S/.test(s.text)){if("smart"==r&&((c=o.mode.indent(i,s.text.slice(u.length),s.text))==B||c>150)){if(!n)return;r="prev"}}else c=0,r="not";"prev"==r?c=t>o.first?E(se(o,t-1).text,null,l):0:"add"==r?c=a+e.options.indentUnit:"subtract"==r?c=a-e.options.indentUnit:"number"==typeof r&&(c=a+r),c=Math.max(0,c);var f="",h=0;if(e.options.indentWithTabs)for(var d=Math.floor(c/l);d;--d)h+=l,f+="\t";if(h<c&&(f+=$(c-h)),f!=u)return lo(o,f,ge(t,0),ge(t,u.length),"+input"),s.stateAfter=null,!0;for(var p=0;p<o.sel.ranges.length;p++){var g=o.sel.ranges[p];if(g.head.line==t&&g.head.ch<u.length){var m=ge(t,u.length);Bi(o,p,new gi(m,m));break}}}var kl=null;function Cl(e){kl=e}function Sl(e,t,r,n,i){var o=e.doc;e.display.shift=!1,n||(n=o.sel);var l=e.state.pasteIncoming||"paste"==i,s=yt(t),a=null;if(l&&n.ranges.length>1)if(kl&&kl.text.join("\n")==t){if(n.ranges.length%kl.text.length==0){a=[];for(var c=0;c<kl.text.length;c++)a.push(o.splitLines(kl.text[c]))}}else s.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(a=Y(s,function(e){return[e]}));for(var u,f=n.ranges.length-1;f>=0;f--){var h=n.ranges[f],d=h.from(),p=h.to();h.empty()&&(r&&r>0?d=ge(d.line,d.ch-r):e.state.overwrite&&!l?p=ge(p.line,Math.min(se(o,p.line).text.length,p.ch+X(s).length)):kl&&kl.lineWise&&kl.text.join("\n")==t&&(d=p=ge(d.line,0))),u=e.curOp.updateInput;var g={from:d,to:p,text:a?a[f%a.length]:s,origin:i||(l?"paste":e.state.cutIncoming?"cut":"+input")};to(e.doc,g),ir(e,"inputRead",e,g)}t&&!l&&Tl(e,t),kn(e),e.curOp.updateInput=u,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function Ll(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Un(t,function(){return Sl(t,r,0,null,"paste")}),!0}function Tl(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n];if(!(i.head.ch>100||n&&r.ranges[n-1].head.line==i.head.line)){var o=e.getModeAt(i.head),l=!1;if(o.electricChars){for(var s=0;s<o.electricChars.length;s++)if(t.indexOf(o.electricChars.charAt(s))>-1){l=wl(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(se(e.doc,i.head.line).text.slice(0,i.head.ch))&&(l=wl(e,i.head.line,"smart"));l&&ir(e,"electricInput",e,i.head.line)}}}function Ml(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var i=e.doc.sel.ranges[n].head.line,o={anchor:ge(i,0),head:ge(i+1,0)};r.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:r}}function Nl(e,t){e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck",!!t)}function Al(){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 a?e.style.width="1000px":e.setAttribute("wrap","off"),g&&(e.style.border="1px solid black"),Nl(e),t}function Ol(e,t,r,n,i){var o=t,l=r,s=se(e,t.line);function a(n){var o;if(null==(o=i?function(e,t,r,n){var i=Ze(t,e.doc.direction);if(!i)return Go(t,r,n);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var o=Xe(i,r.ch,r.sticky),l=i[o];if("ltr"==e.doc.direction&&l.level%2==0&&(n>0?l.to>r.ch:l.from<r.ch))return Go(t,r,n);var s,a=function(e,r){return Uo(t,e instanceof ge?e.ch:e,r)},c=function(r){return e.options.lineWrapping?(s=s||Mr(e,t),Vr(e,t,s,r)):{begin:0,end:t.text.length}},u=c("before"==r.sticky?a(r,-1):r.ch);if("rtl"==e.doc.direction||1==l.level){var f=1==l.level==n<0,h=a(r,f?1:-1);if(null!=h&&(f?h<=l.to&&h<=u.end:h>=l.from&&h>=u.begin)){var d=f?"before":"after";return new ge(r.line,h,d)}}var p=function(e,t,n){for(var o=function(e,t){return t?new ge(r.line,a(e,1),"before"):new ge(r.line,e,"after")};e>=0&&e<i.length;e+=t){var l=i[e],s=t>0==(1!=l.level),c=s?n.begin:a(n.end,-1);if(l.from<=c&&c<l.to)return o(c,s);if(c=s?l.from:a(l.to,-1),n.begin<=c&&c<n.end)return o(c,s)}},g=p(o+n,n,u);if(g)return g;var m=n>0?u.end:a(u.begin,-1);return null==m||n>0&&m==t.text.length||!(g=p(n>0?0:i.length-1,n,c(m)))?null:g}(e.cm,s,t,r):Go(s,t,r))){if(n||!function(){var n=t.line+r;return!(n<e.first||n>=e.first+e.size)&&(t=new ge(n,t.ch,t.sticky),s=se(e,n))}())return!1;t=Ko(i,e.cm,s,t.line,r)}else t=o;return!0}if("char"==n)a();else if("column"==n)a(!0);else if("word"==n||"group"==n)for(var c=null,u="group"==n,f=e.cm&&e.cm.getHelper(t,"wordChars"),h=!0;!(r<0)||a(!h);h=!1){var d=s.text.charAt(t.ch)||"\n",p=te(d,f)?"w":u&&"\n"==d?"n":!u||/\s/.test(d)?null:"p";if(!u||h||p||(p="s"),c&&c!=p){r<0&&(r=1,a(),t.sticky="after");break}if(p&&(c=p),r>0&&!a(!h))break}var g=Zi(e,t,o,l,!0);return ve(o,g)&&(g.hitSide=!0),g}function Dl(e,t,r,n){var i,o=e.doc,l=t.left;if("page"==n){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),a=Math.max(s-.5*Zr(e.display),3);i=(r>0?t.bottom:t.top)+r*a}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(var c;(c=Gr(e,l,i)).outside;){if(r<0?i<=0:i>=o.height){c.hitSide=!0;break}i+=5*r}return c}var Wl=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new H,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Wl.prototype.init=function(e){var t=this,r=this,n=r.cm,i=r.div=e.lineDiv;Nl(i,n.options.spellcheck),Je(i,"paste",function(e){nt(n,e)||Ll(e,n)||s<=11&&setTimeout(Gn(n,function(){return t.updateFromDOM()}),20)}),Je(i,"compositionstart",function(e){t.composing={data:e.data,done:!1}}),Je(i,"compositionupdate",function(e){t.composing||(t.composing={data:e.data,done:!1})}),Je(i,"compositionend",function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Je(i,"touchstart",function(){return r.forceCompositionEnd()}),Je(i,"input",function(){t.composing||t.readFromDOMSoon()});function o(e){if(!nt(n,e)){if(n.somethingSelected())Cl({lineWise:!1,text:n.getSelections()}),"cut"==e.type&&n.replaceSelection("",null,"cut");else{if(!n.options.lineWiseCopyCut)return;var t=Ml(n);Cl({lineWise:!0,text:t.text}),"cut"==e.type&&n.operation(function(){n.setSelections(t.ranges,0,j),n.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var o=kl.text.join("\n");if(e.clipboardData.setData("Text",o),e.clipboardData.getData("Text")==o)return void e.preventDefault()}var l=Al(),s=l.firstChild;n.display.lineSpace.insertBefore(l,n.display.lineSpace.firstChild),s.value=kl.text.join("\n");var a=document.activeElement;z(s),setTimeout(function(){n.display.lineSpace.removeChild(l),a.focus(),a==i&&r.showPrimarySelection()},50)}}Je(i,"copy",o),Je(i,"cut",o)},Wl.prototype.prepareSelection=function(){var e=sn(this.cm,!1);return e.focus=this.cm.state.focused,e},Wl.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Wl.prototype.showPrimarySelection=function(){var e=window.getSelection(),t=this.cm,n=t.doc.sel.primary(),i=n.from(),o=n.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||o.line<t.display.viewFrom)e.removeAllRanges();else{var l=ql(t,e.anchorNode,e.anchorOffset),s=ql(t,e.focusNode,e.focusOffset);if(!l||l.bad||!s||s.bad||0!=me(_e(l,s),i)||0!=me(be(l,s),o)){var a=t.display.view,c=i.line>=t.display.viewFrom&&Pl(t,i)||{node:a[0].measure.map[2],offset:0},u=o.line<t.display.viewTo&&Pl(t,o);if(!u){var f=a[a.length-1].measure,h=f.maps?f.maps[f.maps.length-1]:f.map;u={node:h[h.length-1],offset:h[h.length-2]-h[h.length-3]}}if(c&&u){var d,p=e.rangeCount&&e.getRangeAt(0);try{d=A(c.node,c.offset,u.offset,u.node)}catch(e){}d&&(!r&&t.state.focused?(e.collapse(c.node,c.offset),d.collapsed||(e.removeAllRanges(),e.addRange(d))):(e.removeAllRanges(),e.addRange(d)),p&&null==e.anchorNode?e.addRange(p):r&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},Wl.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)},Wl.prototype.showMultipleSelections=function(e){T(this.cm.display.cursorDiv,e.cursors),T(this.cm.display.selectionDiv,e.selection)},Wl.prototype.rememberSelection=function(){var e=window.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Wl.prototype.selectionInEditor=function(){var e=window.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return O(this.div,t)},Wl.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())},Wl.prototype.blur=function(){this.div.blur()},Wl.prototype.getField=function(){return this.div},Wl.prototype.supportsTouch=function(){return!0},Wl.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Un(this.cm,function(){return e.cm.curOp.selectionChanged=!0});this.polling.set(this.cm.options.pollInterval,function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))})},Wl.prototype.selectionChanged=function(){var e=window.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Wl.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=window.getSelection(),t=this.cm;if(m&&u&&this.cm.options.gutters.length&&function(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}(e.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var r=ql(t,e.anchorNode,e.anchorOffset),n=ql(t,e.focusNode,e.focusOffset);r&&n&&Un(t,function(){Gi(t.doc,vi(r,n),j),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})}}},Wl.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,r=e.doc.sel.primary(),n=r.from(),i=r.to();if(0==n.ch&&n.line>e.firstLine()&&(n=ge(n.line-1,se(e.doc,n.line-1).length)),i.ch==se(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=ge(i.line+1,0)),n.line<t.viewFrom||i.line>t.viewTo-1)return!1;var o,l,s;n.line==t.viewFrom||0==(o=on(e,n.line))?(l=fe(t.view[0].line),s=t.view[0].node):(l=fe(t.view[o].line),s=t.view[o-1].node.nextSibling);var a,c,u=on(e,i.line);if(u==t.view.length-1?(a=t.viewTo-1,c=t.lineDiv.lastChild):(a=fe(t.view[u+1].line)-1,c=t.view[u+1].node.previousSibling),!s)return!1;for(var f=e.doc.splitLines(function(e,t,r,n,i){var o="",l=!1,s=e.doc.lineSeparator();function a(){l&&(o+=s,l=!1)}function c(e){e&&(a(),o+=e)}function u(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(null!=r)return void c(r||t.textContent.replace(/\u200b/g,""));var o,f=t.getAttribute("cm-marker");if(f){var h=e.findMarks(ge(n,0),ge(i+1,0),(g=+f,function(e){return e.id==g}));return void(h.length&&(o=h[0].find(0))&&c(ae(e.doc,o.from,o.to).join(s)))}if("false"==t.getAttribute("contenteditable"))return;var d=/^(pre|div|p)$/i.test(t.nodeName);d&&a();for(var p=0;p<t.childNodes.length;p++)u(t.childNodes[p]);d&&(l=!0)}else 3==t.nodeType&&c(t.nodeValue);var g}for(;u(t),t!=r;)t=t.nextSibling;return o}(e,s,c,l,a)),h=ae(e.doc,ge(l,0),ge(a,se(e.doc,a).text.length));f.length>1&&h.length>1;)if(X(f)==X(h))f.pop(),h.pop(),a--;else{if(f[0]!=h[0])break;f.shift(),h.shift(),l++}for(var d=0,p=0,g=f[0],m=h[0],v=Math.min(g.length,m.length);d<v&&g.charCodeAt(d)==m.charCodeAt(d);)++d;for(var y=X(f),b=X(h),_=Math.min(y.length-(1==f.length?d:0),b.length-(1==h.length?d:0));p<_&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p;if(1==f.length&&1==h.length&&l==n.line)for(;d&&d>n.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)d--,p++;f[f.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),f[0]=f[0].slice(d).replace(/\u200b+$/,"");var x=ge(l,d),w=ge(a,h.length?X(h).length-p:0);return f.length>1||f[0]||me(x,w)?(lo(e.doc,f,x,w,"+input"),!0):void 0},Wl.prototype.ensurePolled=function(){this.forceCompositionEnd()},Wl.prototype.reset=function(){this.forceCompositionEnd()},Wl.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Wl.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))},Wl.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Un(this.cm,function(){return $n(e.cm)})},Wl.prototype.setUneditable=function(e){e.contentEditable="false"},Wl.prototype.onKeyPress=function(e){0!=e.charCode&&(e.preventDefault(),this.cm.isReadOnly()||Gn(this.cm,Sl)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Wl.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Wl.prototype.onContextMenu=function(){},Wl.prototype.resetPosition=function(){},Wl.prototype.needsContentAttribute=!0;function Pl(e,t){var r=Tr(e,t.line);if(!r||r.hidden)return null;var n=se(e.doc,t.line),i=Sr(r,n,t.line),o=Ze(n,e.doc.direction),l="left";if(o){l=Xe(o,t.ch)%2?"right":"left"}var s=Or(i.map,t.ch,l);return s.offset="right"==s.collapse?s.end:s.start,s}function zl(e,t){return t&&(e.bad=!0),e}function ql(e,t,r){var n;if(t==e.display.lineDiv){if(!(n=e.display.lineDiv.childNodes[r]))return zl(e.clipPos(ge(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==n)return Fl(o,t,r)}}function Fl(e,t,r){var n=e.text.firstChild,i=!1;if(!t||!O(n,t))return zl(ge(fe(e.line),0),!0);if(t==n&&(i=!0,t=n.childNodes[r],r=0,!t)){var o=e.rest?X(e.rest):e.line;return zl(ge(fe(o),o.text.length),i)}var l=3==t.nodeType?t:null,s=t;for(l||1!=t.childNodes.length||3!=t.firstChild.nodeType||(l=t.firstChild,r&&(r=l.nodeValue.length));s.parentNode!=n;)s=s.parentNode;var a=e.measure,c=a.maps;function u(t,r,n){for(var i=-1;i<(c?c.length:0);i++)for(var o=i<0?a.map:c[i],l=0;l<o.length;l+=3){var s=o[l+2];if(s==t||s==r){var u=fe(i<0?e.line:e.rest[i]),f=o[l]+n;return(n<0||s!=t)&&(f=o[l+(n?1:0)]),ge(u,f)}}}var f=u(l,s,r);if(f)return zl(f,i);for(var h=s.nextSibling,d=l?l.nodeValue.length-r:0;h;h=h.nextSibling){if(f=u(h,h.firstChild,0))return zl(ge(f.line,f.ch-d),i);d+=h.textContent.length}for(var p=s.previousSibling,g=r;p;p=p.previousSibling){if(f=u(p,p.firstChild,-1))return zl(ge(f.line,f.ch+g),i);g+=p.textContent.length}}var El=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new H,this.hasSelection=!1,this.composing=null};El.prototype.init=function(e){var t=this,r=this,n=this.cm,i=this.wrapper=Al(),o=this.textarea=i.firstChild;e.wrapper.insertBefore(i,e.wrapper.firstChild),g&&(o.style.width="0px"),Je(o,"input",function(){l&&s>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),Je(o,"paste",function(e){nt(n,e)||Ll(e,n)||(n.state.pasteIncoming=!0,r.fastPoll())});function a(e){if(!nt(n,e)){if(n.somethingSelected())Cl({lineWise:!1,text:n.getSelections()});else{if(!n.options.lineWiseCopyCut)return;var t=Ml(n);Cl({lineWise:!0,text:t.text}),"cut"==e.type?n.setSelections(t.ranges,null,j):(r.prevInput="",o.value=t.text.join("\n"),z(o))}"cut"==e.type&&(n.state.cutIncoming=!0)}}Je(o,"cut",a),Je(o,"copy",a),Je(e.scroller,"paste",function(t){yr(e,t)||nt(n,t)||(n.state.pasteIncoming=!0,r.focus())}),Je(e.lineSpace,"selectstart",function(t){yr(e,t)||st(t)}),Je(o,"compositionstart",function(){var e=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}}),Je(o,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},El.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=sn(e);if(e.options.moveInputWithCursor){var i=Br(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+l.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+l.left-o.left))}return n},El.prototype.showSelection=function(e){var t=this.cm.display;T(t.cursorDiv,e.cursors),T(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},El.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&z(this.textarea),l&&s>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",l&&s>=9&&(this.hasSelection=null))}},El.prototype.getField=function(){return this.textarea},El.prototype.supportsTouch=function(){return!1},El.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!v||D()!=this.textarea))try{this.textarea.focus()}catch(e){}},El.prototype.blur=function(){this.textarea.blur()},El.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},El.prototype.receivedFocus=function(){this.slowPoll()},El.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},El.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;t.polling.set(20,function r(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,r))})},El.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||bt(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=r.value;if(i==n&&!t.somethingSelected())return!1;if(l&&s>=9&&this.hasSelection===i||y&&/[\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||n||(n="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var a=0,c=Math.min(n.length,i.length);a<c&&n.charCodeAt(a)==i.charCodeAt(a);)++a;return Un(t,function(){Sl(t,i.slice(a),n.length-a,null,e.composing?"*compose":null),i.length>1e3||i.indexOf("\n")>-1?r.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},El.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},El.prototype.onKeyPress=function(){l&&s>=9&&(this.hasSelection=null),this.fastPoll()},El.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,i=t.textarea,o=nn(r,e),c=n.scroller.scrollTop;if(o&&!f){r.options.resetSelectionOnContextMenu&&-1==r.doc.sel.contains(o)&&Gn(r,Gi)(r.doc,vi(o),j);var u=i.style.cssText,h=t.wrapper.style.cssText;t.wrapper.style.cssText="position: absolute";var d=t.wrapper.getBoundingClientRect();i.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-d.top-5)+"px; left: "+(e.clientX-d.left-5)+"px;\n z-index: 1000; background: "+(l?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var p;if(a&&(p=window.scrollY),n.input.focus(),a&&window.scrollTo(null,p),n.input.reset(),r.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=!0,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll),l&&s>=9&&m(),k){ut(e);var g=function(){tt(window,"mouseup",g),setTimeout(v,20)};Je(window,"mouseup",g)}else setTimeout(v,50)}function m(){if(null!=i.selectionStart){var e=r.somethingSelected(),o="​"+(e?i.value:"");i.value="⇚",i.value=o,t.prevInput=e?"":"​",i.selectionStart=1,i.selectionEnd=o.length,n.selForContextMenu=r.doc.sel}}function v(){if(t.contextMenuPending=!1,t.wrapper.style.cssText=h,i.style.cssText=u,l&&s<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=c),null!=i.selectionStart){(!l||l&&s<9)&&m();var e=0,o=function(){n.selForContextMenu==r.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&"​"==t.prevInput?Gn(r,Ji)(r):e++<10?n.detectingSelectAll=setTimeout(o,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(o,200)}}},El.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},El.prototype.setUneditable=function(){},El.prototype.needsContentAttribute=!1;!function(e){var t=e.optionHandlers;function r(r,n,i,o){e.defaults[r]=n,i&&(t[r]=o?function(e,t,r){r!=pl&&i(e,t,r)}:i)}e.defineOption=r,e.Init=pl,r("value","",function(e,t){return e.setValue(t)},!0),r("mode",null,function(e,t){e.doc.modeOption=t,wi(e)},!0),r("indentUnit",2,wi,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(e){ki(e),zr(e),$n(e)},!0),r("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var r=[],n=e.doc.first;e.doc.iter(function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,r.push(ge(n,o))}n++});for(var i=r.length-1;i>=0;i--)lo(e.doc,t,r[i],ge(r[i].line,r[i].ch+t.length))}}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t,r){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),r!=pl&&e.refresh()}),r("specialCharPlaceholder",Xt,function(e){return e.refresh()},!0),r("electricChars",!0),r("inputStyle",v?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),r("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),r("rtlMoveVisually",!_),r("wholeLineUpdateBefore",!0),r("theme","default",function(e){dl(e),vl(e)},!0),r("keyMap","default",function(e,t,r){var n=Bo(t),i=r!=pl&&Bo(r);i&&i.detach&&i.detach(e,n),n.attach&&n.attach(e,i||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,bl,!0),r("gutters",[],function(e){ai(e.options),vl(e)},!0),r("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?en(e.display)+"px":"0",e.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(e){return Wn(e)},!0),r("scrollbarStyle","native",function(e){qn(e),Wn(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),r("lineNumbers",!1,function(e){ai(e.options),vl(e)},!0),r("firstLineNumber",1,vl,!0),r("lineNumberFormatter",function(e){return e},vl,!0),r("showCursorWhenSelecting",!1,ln,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("readOnly",!1,function(e,t){"nocursor"==t&&(gn(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),r("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),r("dragDrop",!0,yl),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,ln,!0),r("singleCursorHeightPerLine",!0,ln,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,ki,!0),r("addModeClass",!1,ki,!0),r("pollInterval",100),r("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),r("historyEventDelay",1250),r("viewportMargin",10,function(e){return e.refresh()},!0),r("maxHighlightLength",1e4,ki,!0),r("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),r("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),r("autofocus",null),r("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0)}(_l),function(e){var t=e.optionHandlers,r=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,r){var n=this.options,i=n[e];n[e]==r&&"mode"!=e||(n[e]=r,t.hasOwnProperty(e)&&Gn(this,t[e])(this,r,i),rt(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"](Bo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;r<t.length;++r)if(t[r]==e||t[r].name==e)return t.splice(r,1),!0},addOverlay:Kn(function(t,r){var n=t.token?t:e.getMode(this.options,t);if(n.startState)throw new Error("Overlays may not be stateful.");!function(e,t,r){for(var n=0,i=r(t);n<e.length&&r(e[n])<=i;)n++;e.splice(n,0,t)}(this.state.overlays,{mode:n,modeSpec:t,opaque:r&&r.opaque,priority:r&&r.priority||0},function(e){return e.priority}),this.state.modeGen++,$n(this)}),removeOverlay:Kn(function(e){for(var t=this.state.overlays,r=0;r<t.length;++r){var n=t[r].modeSpec;if(n==e||"string"==typeof e&&n.name==e)return t.splice(r,1),this.state.modeGen++,void $n(this)}}),indentLine:Kn(function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),de(this.doc,e)&&wl(this,e,t,r)}),indentSelection:Kn(function(e){for(var t=this.doc.sel.ranges,r=-1,n=0;n<t.length;n++){var i=t[n];if(i.empty())i.head.line>r&&(wl(this,i.head.line,e,!0),r=i.head.line,n==this.doc.sel.primIndex&&kn(this));else{var o=i.from(),l=i.to(),s=Math.max(r,o.line);r=Math.min(this.lastLine(),l.line-(l.ch?0:1))+1;for(var a=s;a<r;++a)wl(this,a,e);var c=this.doc.sel.ranges;0==o.ch&&t.length==c.length&&c[n].from().ch>0&&Bi(this.doc,n,new gi(o,c[n].to()),j)}}}),getTokenAt:function(e,t){return Rt(this,e,t)},getLineTokens:function(e,t){return Rt(this,ge(e),t,!0)},getTokenTypeAt:function(e){e=we(this.doc,e);var t,r=zt(this,se(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var l=n+i>>1;if((l?r[2*l-1]:0)>=o)i=l;else{if(!(r[2*l+1]<o)){t=r[2*l+2];break}n=l+1}}var s=t?t.indexOf("overlay "):-1;return s<0?t:0==s?null:t.slice(0,s-1)},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var n=[];if(!r.hasOwnProperty(t))return n;var i=r[t],o=this.getModeAt(e);if("string"==typeof o[t])i[o[t]]&&n.push(i[o[t]]);else if(o[t])for(var l=0;l<o[t].length;l++){var s=i[o[t][l]];s&&n.push(s)}else o.helperType&&i[o.helperType]?n.push(i[o.helperType]):i[o.name]&&n.push(i[o.name]);for(var a=0;a<i._global.length;a++){var c=i._global[a];c.pred(o,this)&&-1==I(n,c.val)&&n.push(c.val)}return n},getStateAfter:function(e,t){var r=this.doc;return qt(this,(e=xe(r,null==e?r.first+r.size-1:e))+1,t).state},cursorCoords:function(e,t){var r=this.doc.sel.primary();return Br(this,null==e?r.head:"object"==typeof e?we(this.doc,e):e?r.from():r.to(),t||"page")},charCoords:function(e,t){return Rr(this,we(this.doc,e),t||"page")},coordsChar:function(e,t){return Gr(this,(e=Ir(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=Ir(this,{top:e,left:0},t||"page").top,he(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,r){var n,i=!1;if("number"==typeof e){var o=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>o&&(e=o,i=!0),n=se(this.doc,e)}else n=e;return Hr(this,n,{top:0,left:0},t||"page",r||i).top+(i?this.doc.height-Ge(n):0)},defaultTextHeight:function(){return Zr(this.display)},defaultCharWidth:function(){return Qr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o=this.display,l=(e=Br(this,we(this.doc,e))).bottom,s=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==n)l=e.top;else if("above"==n||"near"==n){var a=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>a)&&e.top>t.offsetHeight?l=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=a&&(l=e.bottom),s+t.offsetWidth>c&&(s=c-t.offsetWidth)}t.style.top=l+"px",t.style.left=t.style.right="","right"==i?(s=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?s=0:"middle"==i&&(s=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=s+"px"),r&&function(e,t){var r=xn(e,t);null!=r.scrollTop&&Tn(e,r.scrollTop),null!=r.scrollLeft&&Nn(e,r.scrollLeft)}(this,{left:s,top:l,right:s+t.offsetWidth,bottom:l+t.offsetHeight})},triggerOnKeyDown:Kn(rl),triggerOnKeyPress:Kn(il),triggerOnKeyUp:nl,triggerOnMouseDown:Kn(al),execCommand:function(e){if(Vo.hasOwnProperty(e))return Vo[e].call(null,this)},triggerElectric:Kn(function(e){Tl(this,e)}),findPosH:function(e,t,r,n){var i=1;t<0&&(i=-1,t=-t);for(var o=we(this.doc,e),l=0;l<t&&!(o=Ol(this.doc,o,i,r,n)).hitSide;++l);return o},moveH:Kn(function(e,t){var r=this;this.extendSelectionsBy(function(n){return r.display.shift||r.doc.extend||n.empty()?Ol(r.doc,n.head,e,t,r.options.rtlMoveVisually):e<0?n.from():n.to()},G)}),deleteH:Kn(function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):jo(this,function(r){var i=Ol(n,r.head,e,t,!1);return e<0?{from:i,to:r.head}:{from:r.head,to:i}})}),findPosV:function(e,t,r,n){var i=1,o=n;t<0&&(i=-1,t=-t);for(var l=we(this.doc,e),s=0;s<t;++s){var a=Br(this,l,"div");if(null==o?o=a.left:a.left=o,(l=Dl(this,a,i,r)).hitSide)break}return l},moveV:Kn(function(e,t){var r=this,n=this.doc,i=[],o=!this.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy(function(l){if(o)return e<0?l.from():l.to();var s=Br(r,l.head,"div");null!=l.goalColumn&&(s.left=l.goalColumn),i.push(s.left);var a=Dl(r,s,e,t);return"page"==t&&l==n.sel.primary()&&wn(r,Rr(r,a,"div").top-s.top),a},G),i.length)for(var l=0;l<n.sel.ranges.length;l++)n.sel.ranges[l].goalColumn=i[l]}),findWordAt:function(e){var t=se(this.doc,e.line).text,r=e.ch,n=e.ch;if(t){var i=this.getHelper(e,"wordChars");"before"!=e.sticky&&n!=t.length||!r?++n:--r;for(var o=t.charAt(r),l=te(o,i)?function(e){return te(e,i)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!te(e)};r>0&&l(t.charAt(r-1));)--r;for(;n<t.length&&l(t.charAt(n));)++n}return new gi(ge(e.line,r),ge(e.line,n))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?W(this.display.cursorDiv,"CodeMirror-overwrite"):S(this.display.cursorDiv,"CodeMirror-overwrite"),rt(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==D()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:Kn(function(e,t){Cn(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-wr(this)-this.display.barHeight,width:e.scrollWidth-wr(this)-this.display.barWidth,clientHeight:Cr(this),clientWidth:kr(this)}},scrollIntoView:Kn(function(e,t){null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:ge(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,Sn(r=this),r.curOp.scrollToPos=n):Ln(this,e.from,e.to,e.margin);var r,n}),setSize:Kn(function(e,t){var r=this,n=function(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e};null!=e&&(this.display.wrapper.style.width=n(e)),null!=t&&(this.display.wrapper.style.height=n(t)),this.options.lineWrapping&&Pr(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){Xn(r,i,"widget");break}++i}),this.curOp.forceUpdate=!0,rt(this,"refresh",this)}),operation:function(e){return Un(this,e)},startOperation:function(){return En(this)},endOperation:function(){return Hn(this)},refresh:Kn(function(){var e=this.display.cachedTextHeight;$n(this),this.curOp.forceUpdate=!0,zr(this),Cn(this,this.doc.scrollLeft,this.doc.scrollTop),oi(this),(null==e||Math.abs(e-Zr(this.display))>.5)&&rn(this),rt(this,"refresh",this)}),swapDoc:Kn(function(e){var t=this.doc;return t.cm=null,Ti(this,e),zr(this),this.display.input.reset(),Cn(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,ir(this,"swapDoc",this,t),t}),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}},lt(e),e.registerHelper=function(t,n,i){r.hasOwnProperty(t)||(r[t]=e[t]={_global:[]}),r[t][n]=i},e.registerGlobalHelper=function(t,n,i,o){e.registerHelper(t,n,o),r[t]._global.push({pred:i,val:o})}}(_l);var Hl="iter insert remove copy getEditor constructor".split(" ");for(var Il in ko.prototype)ko.prototype.hasOwnProperty(Il)&&I(Hl,Il)<0&&(_l.prototype[Il]=function(e){return function(){return e.apply(this.doc,arguments)}}(ko.prototype[Il]));lt(ko),_l.inputStyles={textarea:El,contenteditable:Wl},_l.defineMode=function(e){_l.defaults.mode||"null"==e||(_l.defaults.mode=e),function(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),wt[e]=t}.apply(this,arguments)},_l.defineMIME=function(e,t){kt[e]=t},_l.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),_l.defineMIME("text/plain","null"),_l.defineExtension=function(e,t){_l.prototype[e]=t},_l.defineDocExtension=function(e,t){ko.prototype[e]=t},_l.fromTextArea=function(e,t){if((t=t?F(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var r=D();t.autofocus=r==e||null!=e.getAttribute("autofocus")&&r==document.body}function n(){e.value=s.getValue()}var i;if(e.form&&(Je(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var l=o.submit=function(){n(),o.submit=i,o.submit(),o.submit=l}}catch(e){}}t.finishInit=function(t){t.save=n,t.getTextArea=function(){return e},t.toTextArea=function(){t.toTextArea=isNaN,n(),e.parentNode.removeChild(t.getWrapperElement()),e.style.display="",e.form&&(tt(e.form,"submit",n),"function"==typeof e.form.submit&&(e.form.submit=i))}},e.style.display="none";var s=_l(function(t){return e.parentNode.insertBefore(t,e.nextSibling)},t);return s},(Rl=_l).off=tt,Rl.on=Je,Rl.wheelEventPixels=hi,Rl.Doc=ko,Rl.splitLines=yt,Rl.countColumn=E,Rl.findColumn=K,Rl.isWordChar=ee,Rl.Pass=B,Rl.signal=rt,Rl.Line=Ut,Rl.changeEnd=yi,Rl.scrollbarModel=zn,Rl.Pos=ge,Rl.cmpPos=me,Rl.modes=wt,Rl.mimeModes=kt,Rl.resolveMode=Ct,Rl.getMode=St,Rl.modeExtensions=Lt,Rl.extendMode=Tt,Rl.copyState=Mt,Rl.startState=At,Rl.innerMode=Nt,Rl.commands=Vo,Rl.keyMap=zo,Rl.keyName=Ro,Rl.isModifierKey=Ho,Rl.lookupKey=Eo,Rl.normalizeKeyMap=Fo,Rl.StringStream=Ot,Rl.SharedTextMarker=bo,Rl.TextMarker=vo,Rl.LineWidget=po,Rl.e_preventDefault=st,Rl.e_stopPropagation=at,Rl.e_stop=ut,Rl.addClass=W,Rl.contains=O,Rl.rmClass=S,Rl.keyNames=Oo;var Rl;return _l.version="5.33.0",_l}),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";function t(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.info=n,this.align=i,this.prev=o}function r(e,r,n,i){var o=e.indented;return e.context&&"statement"==e.context.type&&"statement"!=n&&(o=e.context.indented),e.context=new t(o,r,n,i,null,e.context)}function n(e){var t=e.context.type;return")"!=t&&"]"!=t&&"}"!=t||(e.indented=e.context.indented),e.context=e.context.prev}function i(e,t,r){return"variable"==t.prevToken||"type"==t.prevToken||(!!/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(e.string.slice(0,r))||(!(!t.typeAtEndOfLine||e.column()!=e.indentation())||void 0))}function o(e){for(;;){if(!e||"top"==e.type)return!0;if("}"==e.type&&"namespace"!=e.prev.info)return!1;e=e.prev}}e.defineMode("clike",function(l,a){var c,u,f=l.indentUnit,h=a.statementIndentUnit||f,d=a.dontAlignCalls,p=a.keywords||{},g=a.types||{},m=a.builtin||{},v=a.blockKeywords||{},y=a.defKeywords||{},b=a.atoms||{},_=a.hooks||{},x=a.multiLineStrings,w=!1!==a.indentStatements,k=!1!==a.indentSwitch,C=a.namespaceSeparator,S=a.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,L=a.numberStart||/[\d\.]/,T=a.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,M=a.isOperatorChar||/[+\-*&%=<>!?|\/]/,N=a.isIdentifierChar||/[\w\$_\xa1-\uffff]/;function A(e,t){var r=e.next();if(_[r]){var n=_[r](e,t);if(!1!==n)return n}if('"'==r||"'"==r)return t.tokenize=(i=r,function(e,t){for(var r,n=!1,o=!1;null!=(r=e.next());){if(r==i&&!n){o=!0;break}n=!n&&"\\"==r}return(o||!n&&!x)&&(t.tokenize=null),"string"}),t.tokenize(e,t);var i;if(S.test(r))return c=r,null;if(L.test(r)){if(e.backUp(1),e.match(T))return"number";e.next()}if("/"==r){if(e.eat("*"))return t.tokenize=O,O(e,t);if(e.eat("/"))return e.skipToEnd(),"comment"}if(M.test(r)){for(;!e.match(/^\/[\/*]/,!1)&&e.eat(M););return"operator"}if(e.eatWhile(N),C)for(;e.match(C);)e.eatWhile(N);var o=e.current();return s(p,o)?(s(v,o)&&(c="newstatement"),s(y,o)&&(u=!0),"keyword"):s(g,o)?"type":s(m,o)?(s(v,o)&&(c="newstatement"),"builtin"):s(b,o)?"atom":"variable"}function O(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=null;break}n="*"==r}return"comment"}function D(e,t){a.typeFirstDefinitions&&e.eol()&&o(t.context)&&(t.typeAtEndOfLine=i(e,t,e.pos))}return{startState:function(e){return{tokenize:null,context:new t((e||0)-f,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(e,t){var l=t.context;if(e.sol()&&(null==l.align&&(l.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return D(e,t),null;c=u=null;var s=(t.tokenize||A)(e,t);if("comment"==s||"meta"==s)return s;if(null==l.align&&(l.align=!0),";"==c||":"==c||","==c&&e.match(/^\s*(?:\/\/.*)?$/,!1))for(;"statement"==t.context.type;)n(t);else if("{"==c)r(t,e.column(),"}");else if("["==c)r(t,e.column(),"]");else if("("==c)r(t,e.column(),")");else if("}"==c){for(;"statement"==l.type;)l=n(t);for("}"==l.type&&(l=n(t));"statement"==l.type;)l=n(t)}else c==l.type?n(t):w&&(("}"==l.type||"top"==l.type)&&";"!=c||"statement"==l.type&&"newstatement"==c)&&r(t,e.column(),"statement",e.current());if("variable"==s&&("def"==t.prevToken||a.typeFirstDefinitions&&i(e,t,e.start)&&o(t.context)&&e.match(/^\s*\(/,!1))&&(s="def"),_.token){var f=_.token(e,t,s);void 0!==f&&(s=f)}return"def"==s&&!1===a.styleDefs&&(s="variable"),t.startOfLine=!1,t.prevToken=u?"def":s||c,D(e,t),s},indent:function(t,r){if(t.tokenize!=A&&null!=t.tokenize||t.typeAtEndOfLine)return e.Pass;var n=t.context,i=r&&r.charAt(0);if("statement"==n.type&&"}"==i&&(n=n.prev),a.dontIndentStatements)for(;"statement"==n.type&&a.dontIndentStatements.test(n.info);)n=n.prev;if(_.indent){var o=_.indent(t,n,r);if("number"==typeof o)return o}var l=i==n.type,s=n.prev&&"switch"==n.prev.info;if(a.allmanIndentation&&/[{(]/.test(i)){for(;"top"!=n.type&&"}"!=n.type;)n=n.prev;return n.indented}return"statement"==n.type?n.indented+("{"==i?0:h):!n.align||d&&")"==n.type?")"!=n.type||l?n.indented+(l?0:f)+(l||!s||/^(?:case|default)\b/.test(r)?0:f):n.indented+h:n.column+(l?0:1)},electricInput:k?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:"//",fold:"brace"}});function l(e){for(var t={},r=e.split(" "),n=0;n<r.length;++n)t[r[n]]=!0;return t}function s(e,t){return"function"==typeof e?e(t):e.propertyIsEnumerable(t)}var a="auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile",c="int long char short double float unsigned signed void size_t ptrdiff_t";function u(e,t){if(!t.startOfLine)return!1;for(var r,n=null;r=e.peek();){if("\\"==r&&e.match(/^.$/)){n=u;break}if("/"==r&&e.match(/^\/[\/\*]/,!1))break;e.next()}return t.tokenize=n,"meta"}function f(e,t){return"type"==t.prevToken&&"type"}function h(e){return e.eatWhile(/[\w\.']/),"number"}function d(e,t){if(e.backUp(1),e.match(/(R|u8R|uR|UR|LR)/)){var r=e.match(/"([^\s\\()]{0,16})\(/);return!!r&&(t.cpp11RawStringDelim=r[1],t.tokenize=g,g(e,t))}return e.match(/(u8|u|U|L)/)?!!e.match(/["']/,!1)&&"string":(e.next(),!1)}function p(e,t){for(var r;null!=(r=e.next());)if('"'==r&&!e.eat('"')){t.tokenize=null;break}return"string"}function g(e,t){var r=t.cpp11RawStringDelim.replace(/[^\w\s]/g,"\\$&");return e.match(new RegExp(".*?\\)"+r+'"'))?t.tokenize=null:e.skipToEnd(),"string"}function m(t,r){"string"==typeof t&&(t=[t]);var n=[];function i(e){if(e)for(var t in e)e.hasOwnProperty(t)&&n.push(t)}i(r.keywords),i(r.types),i(r.builtin),i(r.atoms),n.length&&(r.helperType=t[0],e.registerHelper("hintWords",t[0],n));for(var o=0;o<t.length;++o)e.defineMIME(t[o],r)}m(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:l(a),types:l(c+" bool _Complex _Bool float_t double_t intptr_t intmax_t int8_t int16_t int32_t int64_t uintptr_t uintmax_t uint8_t uint16_t uint32_t uint64_t"),blockKeywords:l("case do else for if switch while struct"),defKeywords:l("struct"),typeFirstDefinitions:!0,atoms:l("null true false"),hooks:{"#":u,"*":f},modeProps:{fold:["brace","include"]}}),m(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:l(a+" asm dynamic_cast namespace reinterpret_cast try explicit new static_cast typeid catch operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected alignas alignof constexpr decltype nullptr noexcept thread_local final static_assert override"),types:l(c+" bool wchar_t"),blockKeywords:l("catch class do else finally for if struct switch try while"),defKeywords:l("class namespace struct enum union"),typeFirstDefinitions:!0,atoms:l("true false null"),dontIndentStatements:/^template$/,isIdentifierChar:/[\w\$_~\xa1-\uffff]/,hooks:{"#":u,"*":f,u:d,U:d,L:d,R:d,0:h,1:h,2:h,3:h,4:h,5:h,6:h,7:h,8:h,9:h,token:function(e,t,r){if("variable"==r&&"("==e.peek()&&(";"==t.prevToken||null==t.prevToken||"}"==t.prevToken)&&function(e){var t=/(\w+)::~?(\w+)$/.exec(e);return t&&t[1]==t[2]}(e.current()))return"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),m("text/x-java",{name:"clike",keywords:l("abstract assert break case catch class const continue default do else enum extends final finally float 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:l("byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:l("catch class do else finally for if switch try while"),defKeywords:l("class interface enum @interface"),typeFirstDefinitions:!0,atoms:l("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"]}}),m("text/x-csharp",{name:"clike",keywords:l("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:l("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:l("catch class do else finally for foreach if struct switch try while"),defKeywords:l("class interface namespace struct var"),typeFirstDefinitions:!0,atoms:l("true false null"),hooks:{"@":function(e,t){return e.eat('"')?(t.tokenize=p,p(e,t)):(e.eatWhile(/[\w\$_]/),"meta")}}});function v(e,t){for(var r=!1;!e.eol();){if(!r&&e.match('"""')){t.tokenize=null;break}r="\\"==e.next()&&!r}return"string"}m("text/x-scala",{name:"clike",keywords:l("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:l("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:l("catch class enum do else finally for forSome if match switch try while"),defKeywords:l("class enum def object package trait type val var"),atoms:l("true false null"),indentStatements:!1,indentSwitch:!1,isOperatorChar:/[+\-*&%=<>!?|\/#:@]/,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return!!e.match('""')&&(t.tokenize=v,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},"=":function(e,r){var n=r.context;return!("}"!=n.type||!n.align||!e.eat(">"))&&(r.context=new t(n.indented,n.column,n.type,n.info,null,n.prev),"operator")},"/":function(e,t){return!!e.eat("*")&&(t.tokenize=function e(t){return function(r,n){for(var i;i=r.next();){if("*"==i&&r.eat("/")){if(1==t){n.tokenize=null;break}return n.tokenize=e(t-1),n.tokenize(r,n)}if("/"==i&&r.eat("*"))return n.tokenize=e(t+1),n.tokenize(r,n)}return"comment"}}(1),t.tokenize(e,t))}},modeProps:{closeBrackets:{triples:'"'}}});m("text/x-kotlin",{name:"clike",keywords:l("package as typealias class interface this super val var fun for is in This throw return 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"),types:l("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"),intendSwitch:!1,indentStatements:!1,multiLineStrings:!0,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,blockKeywords:l("catch class do else finally for if where try while enum"),defKeywords:l("class val var object interface fun"),atoms:l("true false null this"),hooks:{'"':function(e,t){t.tokenize=(r=e.match('""'),function(e,t){for(var n,i=!1,o=!1;!e.eol();){if(!r&&!i&&e.match('"')){o=!0;break}if(r&&e.match('"""')){o=!0;break}n=e.next(),!i&&"$"==n&&e.match("{")&&e.skipTo("}"),i=!i&&"\\"==n&&!r}return!o&&r||(t.tokenize=null),"string"});var r;return t.tokenize(e,t)}},modeProps:{closeBrackets:{triples:'"'}}}),m(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:l("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:l("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:l("for while do if else struct"),builtin:l("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:l("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_TexureMatrixTranspose 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:{"#":u},modeProps:{fold:["brace","include"]}}),m("text/x-nesc",{name:"clike",keywords:l(a+"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:l(c),blockKeywords:l("case do else for if switch while struct"),atoms:l("null true false"),hooks:{"#":u},modeProps:{fold:["brace","include"]}}),m("text/x-objectivec",{name:"clike",keywords:l(a+"inline restrict _Bool _Complex _Imaginary BOOL Class bycopy byref id IMP in inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),types:l(c),atoms:l("YES NO NULL NILL ON OFF true false"),hooks:{"@":function(e){return e.eatWhile(/[\w\$]/),"keyword"},"#":u,indent:function(e,t,r){if("statement"==t.type&&/^@\w/.test(r))return t.indented}},modeProps:{fold:"brace"}}),m("text/x-squirrel",{name:"clike",keywords:l("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:l(c),blockKeywords:l("case catch class else for foreach if switch try while"),defKeywords:l("function local class"),typeFirstDefinitions:!0,atoms:l("true false null"),hooks:{"#":u},modeProps:{fold:["brace","include"]}});var y=null;m("text/x-ceylon",{name:"clike",keywords:l("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){var t=e.charAt(0);return t===t.toUpperCase()&&t!==t.toLowerCase()},blockKeywords:l("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:l("class dynamic function interface module object package value"),builtin:l("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:l("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 e(t){return function(r,n){for(var i,o=!1,l=!1;!r.eol();){if(!o&&r.match('"')&&("single"==t||r.match('""'))){l=!0;break}if(!o&&r.match("``")){y=e(t),l=!0;break}i=r.next(),o="single"==t&&!o&&"\\"==i}return l&&(n.tokenize=null),"string"}}(e.match('""')?"triple":"single"),t.tokenize(e,t)},"`":function(e,t){return!(!y||!e.match("`"))&&(t.tokenize=y,y=null,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(e,t,r){if(("variable"==r||"type"==r)&&"."==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(e){"use strict";function t(e){for(var t={},r=e.split(" "),n=0;n<r.length;++n)t[r[n]]=!0;return t}function r(e,t,i){return 0==e.length?n(t):function(o,l){for(var s=e[0],a=0;a<s.length;a++)if(o.match(s[a][0]))return l.tokenize=r(e.slice(1),t),s[a][1];return l.tokenize=n(t,i),"string"}}function n(e,t){return function(n,i){return function(e,t,n,i){if(!1!==i&&e.match("${",!1)||e.match("{$",!1))return t.tokenize=null,"string";if(!1!==i&&e.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/))return e.match("[",!1)&&(t.tokenize=r([[["[",null]],[[/\d[\w\.]*/,"number"],[/\$[a-zA-Z_][a-zA-Z0-9_]*/,"variable-2"],[/[\w\$]+/,"variable"]],[["]",null]]],n,i)),e.match(/\-\>\w/,!1)&&(t.tokenize=r([[["->",null]],[[/[\w]+/,"variable"]]],n,i)),"variable-2";var o=!1;for(;!e.eol()&&(o||!1===i||!e.match("{$",!1)&&!e.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/,!1));){if(!o&&e.match(n)){t.tokenize=null,t.tokStack.pop(),t.tokStack.pop();break}o="\\"==e.next()&&!o}return"string"}(n,i,e,t)}}var i="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",o="true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__",l="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 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";e.registerHelper("hintWords","php",[i,o,l].join(" ").split(" ")),e.registerHelper("wordChars","php",/[\w$]/);var s={name:"clike",helperType:"php",keywords:t(i),blockKeywords:t("catch do else elseif for foreach if switch try while finally"),defKeywords:t("class function interface namespace trait"),atoms:t(o),builtin:t(l),multiLineStrings:!0,hooks:{$:function(e){return e.eatWhile(/[\w\$_]/),"variable-2"},"<":function(e,t){var r;if(r=e.match(/<<\s*/)){var i=e.eat(/['"]/);e.eatWhile(/[\w\.]/);var o=e.current().slice(r[0].length+(i?2:1));if(i&&e.eat(i),o)return(t.tokStack||(t.tokStack=[])).push(o,0),t.tokenize=n(o,"'"!=i),"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=n('"'),"string"},"{":function(e,t){return t.tokStack&&t.tokStack.length&&t.tokStack[t.tokStack.length-1]++,!1},"}":function(e,t){return t.tokStack&&t.tokStack.length>0&&!--t.tokStack[t.tokStack.length-1]&&(t.tokenize=n(t.tokStack[t.tokStack.length-2])),!1}}};e.defineMode("php",function(t,r){var n=e.getMode(t,r&&r.htmlMode||"text/html"),i=e.getMode(t,s);return{startState:function(){var t=e.startState(n),o=r.startOpen?e.startState(i):null;return{html:t,php:o,curMode:r.startOpen?i:n,curState:r.startOpen?o:t,pending:null}},copyState:function(t){var r,o=t.html,l=e.copyState(n,o),s=t.php,a=s&&e.copyState(i,s);return r=t.curMode==n?l:a,{html:l,php:a,curMode:t.curMode,curState:r,pending:t.pending}},token:function(t,r){var o=r.curMode==i;if(t.sol()&&r.pending&&'"'!=r.pending&&"'"!=r.pending&&(r.pending=null),o)return o&&null==r.php.tokenize&&t.match("?>")?(r.curMode=n,r.curState=r.html,r.php.context.prev||(r.php=null),"meta"):i.token(t,r.curState);if(t.match(/^<\?\w*/))return r.curMode=i,r.php||(r.php=e.startState(i,n.indent(r.html,""))),r.curState=r.php,"meta";if('"'==r.pending||"'"==r.pending){for(;!t.eol()&&t.next()!=r.pending;);var l="string"}else r.pending&&t.pos<r.pending.end?(t.pos=r.pending.end,l=r.pending.style):l=n.token(t,r.curState);r.pending&&(r.pending=null);var s,a=t.current(),c=a.search(/<\?/);return-1!=c&&("string"==l&&(s=a.match(/[\'\"]$/))&&!/\?>/.test(a)?r.pending=s[0]:r.pending={end:t.pos,style:l},t.backUp(a.length-c)),l},indent:function(e,t){return e.curMode!=i&&/^\s*<\//.test(t)||e.curMode==i&&/^\?>/.test(t)?n.indent(e.html,t):e.curMode.indent(e.curState,t)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",innerMode:function(e){return{state:e.curState,mode:e.curMode}}}},"htmlmixed","clike"),e.defineMIME("application/x-httpd-php","php"),e.defineMIME("application/x-httpd-php-open",{name:"php",startOpen:!0}),e.defineMIME("text/x-php",s)}),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){var t=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),r=e.Pos,n={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"};function i(e,t,i){var l=e.getLineHandle(t.line),s=t.ch-1,a=i&&i.afterCursor;null==a&&(a=/(^| )cm-fat-cursor($| )/.test(e.getWrapperElement().className));var c=!a&&s>=0&&n[l.text.charAt(s)]||n[l.text.charAt(++s)];if(!c)return null;var u=">"==c.charAt(1)?1:-1;if(i&&i.strict&&u>0!=(s==t.ch))return null;var f=e.getTokenTypeAt(r(t.line,s+1)),h=o(e,r(t.line,s+(u>0?1:0)),u,f||null,i);return null==h?null:{from:r(t.line,s),to:h&&h.pos,match:h&&h.ch==c.charAt(0),forward:u>0}}function o(e,t,i,o,l){for(var s=l&&l.maxScanLineLength||1e4,a=l&&l.maxScanLines||1e3,c=[],u=l&&l.bracketRegex?l.bracketRegex:/[(){}[\]]/,f=i>0?Math.min(t.line+a,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-a),h=t.line;h!=f;h+=i){var d=e.getLine(h);if(d){var p=i>0?0:d.length-1,g=i>0?d.length:-1;if(!(d.length>s))for(h==t.line&&(p=t.ch-(i<0?1:0));p!=g;p+=i){var m=d.charAt(p);if(u.test(m)&&(void 0===o||e.getTokenTypeAt(r(h,p+1))==o)){if(">"==n[m].charAt(1)==i>0)c.push(m);else{if(!c.length)return{pos:r(h,p),ch:m};c.pop()}}}}}return h-i!=(i>0?e.lastLine():e.firstLine())&&null}function l(e,n,o){for(var l=e.state.matchBrackets.maxHighlightLineLength||1e3,s=[],a=e.listSelections(),c=0;c<a.length;c++){var u=a[c].empty()&&i(e,a[c].head,o);if(u&&e.getLine(u.from.line).length<=l){var f=u.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";s.push(e.markText(u.from,r(u.from.line,u.from.ch+1),{className:f})),u.to&&e.getLine(u.to.line).length<=l&&s.push(e.markText(u.to,r(u.to.line,u.to.ch+1),{className:f}))}}if(s.length){t&&e.state.focused&&e.focus();var h=function(){e.operation(function(){for(var e=0;e<s.length;e++)s[e].clear()})};if(!n)return h;setTimeout(h,800)}}var s=null;function a(e){e.operation(function(){s&&(s(),s=null),s=l(e,!1,e.state.matchBrackets)})}e.defineOption("matchBrackets",!1,function(t,r,n){n&&n!=e.Init&&(t.off("cursorActivity",a),s&&(s(),s=null)),r&&(t.state.matchBrackets="object"==typeof r?r:{},t.on("cursorActivity",a))}),e.defineExtension("matchBrackets",function(){l(this,!0)}),e.defineExtension("findMatchingBracket",function(e,t,r){return(r||"boolean"==typeof t)&&(r?(r.strict=t,t=r):t=t?{strict:!0}:null),i(this,e,t)}),e.defineExtension("scanForBracket",function(e,t,r,n){return o(this,e,t,r,n)})});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.CodeMirror=t()}(this,function(){"use strict";var e=navigator.userAgent,t=navigator.platform,g=/gecko\/\d/i.test(e),r=/MSIE \d/.test(e),n=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),i=/Edge\/(\d+)/.exec(e),x=r||n||i,w=x&&(r?document.documentMode||6:+(i||n)[1]),b=!i&&/WebKit\//.test(e),o=b&&/Qt\/\d+\.\d+/.test(e),l=!i&&/Chrome\//.test(e),m=/Opera\//.test(e),a=/Apple Computer/.test(navigator.vendor),s=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),c=/PhantomJS/.test(e),u=!i&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),f=/Android/.test(e),d=u||f||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),_=u||/Mac/.test(t),h=/\bCrOS\b/.test(e),p=/win/i.test(t),v=m&&e.match(/Version\/(\d*\.\d*)/);v&&(v=Number(v[1])),v&&15<=v&&(b=!(m=!1));var y=_&&(o||m&&(null==v||v<12.11)),k=g||x&&9<=w;function C(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var S,L=function(e,t){var r=e.className,n=C(t).exec(r);if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}};function T(e){for(var t=e.childNodes.length;0<t;--t)e.removeChild(e.firstChild);return e}function M(e,t){return T(e).appendChild(t)}function A(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"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 N(e,t,r,n){var i=A(e,t,r,n);return i.setAttribute("role","presentation"),i}function D(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if(11==t.nodeType&&(t=t.host),t==e)return!0}while(t=t.parentNode)}function O(){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 W(e,t){var r=e.className;C(t).test(r)||(e.className+=(r?" ":"")+t)}function P(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!C(r[n]).test(t)&&(t+=" "+r[n]);return t}S=document.createRange?function(e,t,r,n){var i=document.createRange();return i.setEnd(n||e,r),i.setStart(e,t),i}:function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(e){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};var z=function(e){e.select()};function F(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function q(e,t,r){for(var n in t||(t={}),e)!e.hasOwnProperty(n)||!1===r&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function H(e,t,r,n,i){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var o=n||0,l=i||0;;){var s=e.indexOf("\t",o);if(s<0||t<=s)return l+(t-o);l+=s-o,l+=r-l%r,o=s+1}}u?z=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:x&&(z=function(e){try{e.select()}catch(e){}});var E=function(){this.id=null};function I(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}E.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var B=30,R={toString:function(){return"CodeMirror.Pass"}},U={scroll:!1},j={origin:"*mouse"},G={origin:"+move"};function K(e,t,r){for(var n=0,i=0;;){var o=e.indexOf("\t",n);-1==o&&(o=e.length);var l=o-n;if(o==e.length||t<=i+l)return n+Math.min(l,t-i);if(i+=o-n,n=o+1,t<=(i+=r-i%r))return n}}var V=[""];function $(e){for(;V.length<=e;)V.push(X(V)+" ");return V[e]}function X(e){return e[e.length-1]}function Y(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function Z(){}function Q(e,t){var r;return r=Object.create?Object.create(e):(Z.prototype=e,new Z),t&&q(t,r),r}var J=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ee(e){return/\w/.test(e)||"€"<e&&(e.toUpperCase()!=e.toLowerCase()||J.test(e))}function te(e,t){return t?!!(-1<t.source.indexOf("\\w")&&ee(e))||t.test(e):ee(e)}function re(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ne=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ie(e){return 768<=e.charCodeAt(0)&&ne.test(e)}function oe(e,t,r){for(;(r<0?0<t:t<e.length)&&ie(e.charAt(t));)t+=r;return t}function le(e,t,r){for(var n=r<t?-1:1;;){if(t==r)return t;var i=(t+r)/2,o=n<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:r;e(o)?r=o:t=o+n}}function se(e,t,r){var n=this;this.input=r,n.scrollbarFiller=A("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=A("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=N("div",null,"CodeMirror-code"),n.selectionDiv=A("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=A("div",null,"CodeMirror-cursors"),n.measure=A("div",null,"CodeMirror-measure"),n.lineMeasure=A("div",null,"CodeMirror-measure"),n.lineSpace=N("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var i=N("div",[n.lineSpace],"CodeMirror-lines");n.mover=A("div",[i],null,"position: relative"),n.sizer=A("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=A("div",null,null,"position: absolute; height: "+B+"px; width: 1px;"),n.gutters=A("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=A("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=A("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),x&&w<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),b||g&&d||(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,r.init(n)}function ae(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 r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(t<o){r=i;break}t-=o}return r.lines[t]}function ce(e,r,n){var i=[],o=r.line;return e.iter(r.line,n.line+1,function(e){var t=e.text;o==n.line&&(t=t.slice(0,n.ch)),o==r.line&&(t=t.slice(r.ch)),i.push(t),++o}),i}function ue(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function fe(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function de(e){if(null==e.parent)return null;for(var t=e.parent,r=I(t.lines,e),n=t.parent;n;n=(t=n).parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function he(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height;if(t<o){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var l=0;l<e.lines.length;++l){var s=e.lines[l].height;if(t<s)break;t-=s}return r+l}function pe(e,t){return t>=e.first&&t<e.first+e.size}function ge(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function me(e,t,r){if(void 0===r&&(r=null),!(this instanceof me))return new me(e,t,r);this.line=e,this.ch=t,this.sticky=r}function ve(e,t){return e.line-t.line||e.ch-t.ch}function ye(e,t){return e.sticky==t.sticky&&0==ve(e,t)}function be(e){return me(e.line,e.ch)}function _e(e,t){return ve(e,t)<0?t:e}function xe(e,t){return ve(e,t)<0?e:t}function we(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ke(e,t){if(t.line<e.first)return me(e.first,0);var r,n,i,o=e.first+e.size-1;return t.line>o?me(o,ae(e,o).text.length):(n=ae(e,(r=t).line).text.length,null==(i=r.ch)||n<i?me(r.line,n):i<0?me(r.line,0):r)}function Ce(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=ke(e,t[n]);return r}var Se=!1,Le=!1;function Te(e,t,r){this.marker=e,this.from=t,this.to=r}function Me(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function Ne(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function Ae(e,t){if(t.full)return null;var r=pe(e,t.from.line)&&ae(e,t.from.line).markedSpans,n=pe(e,t.to.line)&&ae(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,l=0==ve(t.from,t.to),s=function(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker;if(null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t)||o.from==t&&"bookmark"==l.type&&(!r||!o.marker.insertLeft)){var s=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new Te(l,o.from,s?null:o.to))}}return n}(r,i,l),a=function(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker;if(null==o.to||(l.inclusiveRight?o.to>=t:o.to>t)||o.from==t&&"bookmark"==l.type&&(!r||o.marker.insertLeft)){var s=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new Te(l,s?null:o.from-t,null==o.to?null:o.to-t))}}return n}(n,o,l),c=1==t.text.length,u=X(t.text).length+(c?i:0);if(s)for(var f=0;f<s.length;++f){var d=s[f];if(null==d.to){var h=Me(a,d.marker);h?c&&(d.to=null==h.to?null:h.to+u):d.to=i}}if(a)for(var p=0;p<a.length;++p){var g=a[p];if(null!=g.to&&(g.to+=u),null==g.from)Me(s,g.marker)||(g.from=u,c&&(s||(s=[])).push(g));else g.from+=u,c&&(s||(s=[])).push(g)}s&&(s=De(s)),a&&a!=s&&(a=De(a));var m=[s];if(!c){var v,y=t.text.length-2;if(0<y&&s)for(var b=0;b<s.length;++b)null==s[b].to&&(v||(v=[])).push(new Te(s[b].marker,null,null));for(var _=0;_<y;++_)m.push(v);m.push(a)}return m}function De(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&!1!==r.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function Oe(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function We(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function Pe(e){return e.inclusiveLeft?-1:0}function ze(e){return e.inclusiveRight?1:0}function Fe(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=ve(n.from,i.from)||Pe(e)-Pe(t);if(o)return-o;var l=ve(n.to,i.to)||ze(e)-ze(t);return l||t.id-e.id}function qe(e,t){var r,n=Le&&e.markedSpans;if(n)for(var i=void 0,o=0;o<n.length;++o)(i=n[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!r||Fe(r,i.marker)<0)&&(r=i.marker);return r}function He(e){return qe(e,!0)}function Ee(e){return qe(e,!1)}function Ie(e,t){var r,n=Le&&e.markedSpans;if(n)for(var i=0;i<n.length;++i){var o=n[i];o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!r||Fe(r,o.marker)<0)&&(r=o.marker)}return r}function Be(e,t,r,n,i){var o=ae(e,t),l=Le&&o.markedSpans;if(l)for(var s=0;s<l.length;++s){var a=l[s];if(a.marker.collapsed){var c=a.marker.find(0),u=ve(c.from,r)||Pe(a.marker)-Pe(i),f=ve(c.to,n)||ze(a.marker)-ze(i);if(!(0<=u&&f<=0||u<=0&&0<=f)&&(u<=0&&(a.marker.inclusiveRight&&i.inclusiveLeft?0<=ve(c.to,r):0<ve(c.to,r))||0<=u&&(a.marker.inclusiveRight&&i.inclusiveLeft?ve(c.from,n)<=0:ve(c.from,n)<0)))return!0}}}function Re(e){for(var t;t=He(e);)e=t.find(-1,!0).line;return e}function Ue(e,t){var r=ae(e,t),n=Re(r);return r==n?t:de(n)}function je(e,t){if(t>e.lastLine())return t;var r,n=ae(e,t);if(!Ge(e,n))return t;for(;r=Ee(n);)n=r.find(1,!0).line;return de(n)+1}function Ge(e,t){var r=Le&&t.markedSpans;if(r)for(var n=void 0,i=0;i<r.length;++i)if((n=r[i]).marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&Ke(e,t,n))return!0}}function Ke(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return Ke(e,n.line,Me(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if((i=t.markedSpans[o]).marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&Ke(e,t,i))return!0}function Ve(e){for(var t=0,r=(e=Re(e)).parent,n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var o=r.parent;o;o=(r=o).parent)for(var l=0;l<o.children.length;++l){var s=o.children[l];if(s==r)break;t+=s.height}return t}function $e(e){if(0==e.height)return 0;for(var t,r=e.text.length,n=e;t=He(n);){var i=t.find(0,!0);n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=Ee(n);){var o=t.find(0,!0);r-=n.text.length-o.from.ch,r+=(n=o.to.line).text.length-o.to.ch}return r}function Xe(e){var r=e.display,t=e.doc;r.maxLine=ae(t,t.first),r.maxLineLength=$e(r.maxLine),r.maxLineChanged=!0,t.iter(function(e){var t=$e(e);t>r.maxLineLength&&(r.maxLineLength=t,r.maxLine=e)})}var Ye=null;function Ze(e,t,r){var n;Ye=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"==r?n=i:Ye=i),o.from==t&&(o.from!=o.to&&"before"!=r?n=i:Ye=i)}return null!=n?n:Ye}var Qe=function(){var q="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",H="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";var E=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,I=/[stwN]/,B=/[LRr]/,R=/[Lb1n]/,U=/[1n]/;function j(e,t,r){this.level=e,this.from=t,this.to=r}return function(e,t){var r="ltr"==t?"L":"R";if(0==e.length||"ltr"==t&&!E.test(e))return!1;for(var n,i=e.length,o=[],l=0;l<i;++l)o.push((n=e.charCodeAt(l))<=247?q.charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1785?H.charAt(n-1536):1774<=n&&n<=2220?"r":8192<=n&&n<=8203?"w":8204==n?"b":"L");for(var s=0,a=r;s<i;++s){var c=o[s];"m"==c?o[s]=a:a=c}for(var u=0,f=r;u<i;++u){var d=o[u];"1"==d&&"r"==f?o[u]="n":B.test(d)&&"r"==(f=d)&&(o[u]="R")}for(var h=1,p=o[0];h<i-1;++h){var g=o[h];"+"==g&&"1"==p&&"1"==o[h+1]?o[h]="1":","!=g||p!=o[h+1]||"1"!=p&&"n"!=p||(o[h]=p),p=g}for(var m=0;m<i;++m){var v=o[m];if(","==v)o[m]="N";else if("%"==v){var y=void 0;for(y=m+1;y<i&&"%"==o[y];++y);for(var b=m&&"!"==o[m-1]||y<i&&"1"==o[y]?"1":"N",_=m;_<y;++_)o[_]=b;m=y-1}}for(var x=0,w=r;x<i;++x){var k=o[x];"L"==w&&"1"==k?o[x]="L":B.test(k)&&(w=k)}for(var C=0;C<i;++C)if(I.test(o[C])){var S=void 0;for(S=C+1;S<i&&I.test(o[S]);++S);for(var L="L"==(C?o[C-1]:r),T=L==("L"==(S<i?o[S]:r))?L?"L":"R":r,M=C;M<S;++M)o[M]=T;C=S-1}for(var N,A=[],D=0;D<i;)if(R.test(o[D])){var O=D;for(++D;D<i&&R.test(o[D]);++D);A.push(new j(0,O,D))}else{var W=D,P=A.length;for(++D;D<i&&"L"!=o[D];++D);for(var z=W;z<D;)if(U.test(o[z])){W<z&&A.splice(P,0,new j(1,W,z));var F=z;for(++z;z<D&&U.test(o[z]);++z);A.splice(P,0,new j(2,F,z)),W=z}else++z;W<D&&A.splice(P,0,new j(1,W,D))}return"ltr"==t&&(1==A[0].level&&(N=e.match(/^\s+/))&&(A[0].from=N[0].length,A.unshift(new j(0,0,N[0].length))),1==X(A).level&&(N=e.match(/\s+$/))&&(X(A).to-=N[0].length,A.push(new j(0,i-N[0].length,i)))),"rtl"==t?A.reverse():A}}();function Je(e,t){var r=e.order;return null==r&&(r=e.order=Qe(e.text,t)),r}var et=[],tt=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={});n[t]=(n[t]||et).concat(r)}};function rt(e,t){return e._handlers&&e._handlers[t]||et}function nt(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers,i=n&&n[t];if(i){var o=I(i,r);-1<o&&(n[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function it(e,t){var r=rt(e,t);if(r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)}function ot(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),it(e,r||t.type,e,t),ft(t)||t.codemirrorIgnore}function lt(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)-1==I(r,t[n])&&r.push(t[n])}function st(e,t){return 0<rt(e,t).length}function at(e){e.prototype.on=function(e,t){tt(this,e,t)},e.prototype.off=function(e,t){nt(this,e,t)}}function ct(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ut(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ft(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function dt(e){ct(e),ut(e)}function ht(e){return e.target||e.srcElement}function pt(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),_&&e.ctrlKey&&1==t&&(t=3),t}var gt,mt,vt=function(){if(x&&w<9)return!1;var e=A("div");return"draggable"in e||"dragDrop"in e}();function yt(e){if(null==gt){var t=A("span","​");M(e,A("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(gt=t.offsetWidth<=1&&2<t.offsetHeight&&!(x&&w<8))}var r=gt?A("span","​"):A("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function bt(e){if(null!=mt)return mt;var t=M(e,document.createTextNode("AخA")),r=S(t,0,1).getBoundingClientRect(),n=S(t,1,2).getBoundingClientRect();return T(e),!(!r||r.left==r.right)&&(mt=n.right-r.right<3)}var _t,xt=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;t<=n;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),l=o.indexOf("\r");-1!=l?(r.push(o.slice(0,l)),t+=l+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},wt=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)},kt="oncopy"in(_t=A("div"))||(_t.setAttribute("oncopy","return;"),"function"==typeof _t.oncopy),Ct=null;var St={},Lt={};function Tt(e){if("string"==typeof e&&Lt.hasOwnProperty(e))e=Lt[e];else if(e&&"string"==typeof e.name&&Lt.hasOwnProperty(e.name)){var t=Lt[e.name];"string"==typeof t&&(t={name:t}),(e=Q(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Tt("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Tt("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Mt(e,t){t=Tt(t);var r=St[t.name];if(!r)return Mt(e,"text/plain");var n=r(e,t);if(Nt.hasOwnProperty(t.name)){var i=Nt[t.name];for(var o in i)i.hasOwnProperty(o)&&(n.hasOwnProperty(o)&&(n["_"+o]=n[o]),n[o]=i[o])}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var l in t.modeProps)n[l]=t.modeProps[l];return n}var Nt={};function At(e,t){q(t,Nt.hasOwnProperty(e)?Nt[e]:Nt[e]={})}function Dt(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function Ot(e,t){for(var r;e.innerMode&&(r=e.innerMode(t))&&r.mode!=e;)t=r.state,e=r.mode;return r||{mode:e,state:t}}function Wt(e,t,r){return!e.startState||e.startState(t,r)}var Pt=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};Pt.prototype.eol=function(){return this.pos>=this.string.length},Pt.prototype.sol=function(){return this.pos==this.lineStart},Pt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Pt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Pt.prototype.eat=function(e){var t=this.string.charAt(this.pos);if("string"==typeof e?t==e:t&&(e.test?e.test(t):e(t)))return++this.pos,t},Pt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Pt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Pt.prototype.skipToEnd=function(){this.pos=this.string.length},Pt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(-1<t)return this.pos=t,!0},Pt.prototype.backUp=function(e){this.pos-=e},Pt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=H(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Pt.prototype.indentation=function(){return H(this.string,null,this.tabSize)-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Pt.prototype.match=function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&0<n.index?null:(n&&!1!==t&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e};if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},Pt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Pt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Pt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Pt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var zt=function(e,t){this.state=e,this.lookAhead=t},Ft=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};function qt(t,r,n,e){var a=[t.state.modeGen],i={};Kt(t,r.text,t.doc.mode,n,function(e,t){return a.push(e,t)},i,e);for(var c=n.state,o=function(e){n.baseTokens=a;var o=t.state.overlays[e],l=1,s=0;n.state=!0,Kt(t,r.text,o.mode,n,function(e,t){for(var r=l;s<e;){var n=a[l];e<n&&a.splice(l,1,e,a[l+1],n),l+=2,s=Math.min(e,n)}if(t)if(o.opaque)a.splice(r,l-r,e,"overlay "+t),l=r+2;else for(;r<l;r+=2){var i=a[r+1];a[r+1]=(i?i+" ":"")+"overlay "+t}},i),n.state=c,n.baseTokens=null,n.baseTokenPos=1},l=0;l<t.state.overlays.length;++l)o(l);return{styles:a,classes:i.bgClass||i.textClass?i:null}}function Ht(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Et(e,de(t)),i=t.text.length>e.options.maxHighlightLength&&Dt(e.doc.mode,n.state),o=qt(e,t,n);i&&(n.state=i),t.stateAfter=n.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Et(r,n,e){var t=r.doc,i=r.display;if(!t.mode.startState)return new Ft(t,!0,n);var o=function(e,t,r){for(var n,i,o=e.doc,l=r?-1:t-(e.doc.mode.innerMode?1e3:100),s=t;l<s;--s){if(s<=o.first)return o.first;var a=ae(o,s-1),c=a.stateAfter;if(c&&(!r||s+(c instanceof zt?c.lookAhead:0)<=o.modeFrontier))return s;var u=H(a.text,null,e.options.tabSize);(null==i||u<n)&&(i=s-1,n=u)}return i}(r,n,e),l=o>t.first&&ae(t,o-1).stateAfter,s=l?Ft.fromSaved(t,l,o):new Ft(t,Wt(t.mode),o);return t.iter(o,n,function(e){It(r,e.text,s);var t=s.line;e.stateAfter=t==n-1||t%5==0||t>=i.viewFrom&&t<i.viewTo?s.save():null,s.nextLine()}),e&&(t.modeFrontier=s.line),s}function It(e,t,r,n){var i=e.doc.mode,o=new Pt(t,e.options.tabSize,r);for(o.start=o.pos=n||0,""==t&&Bt(i,r.state);!o.eol();)Rt(i,o,r.state),o.start=o.pos}function Bt(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var r=Ot(e,t);return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function Rt(e,t,r,n){for(var i=0;i<10;i++){n&&(n[0]=Ot(e,r).mode);var o=e.token(t,r);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}Ft.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},Ft.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}},Ft.prototype.nextLine=function(){this.line++,0<this.maxLookAhead&&this.maxLookAhead--},Ft.fromSaved=function(e,t,r){return t instanceof zt?new Ft(e,Dt(e.mode,t.state),r,t.lookAhead):new Ft(e,Dt(e.mode,t),r)},Ft.prototype.save=function(e){var t=!1!==e?Dt(this.doc.mode,this.state):this.state;return 0<this.maxLookAhead?new zt(t,this.maxLookAhead):t};var Ut=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function jt(e,t,r,n){var i,o,l=e.doc,s=l.mode,a=ae(l,(t=ke(l,t)).line),c=Et(e,t.line,r),u=new Pt(a.text,e.options.tabSize,c);for(n&&(o=[]);(n||u.pos<t.ch)&&!u.eol();)u.start=u.pos,i=Rt(s,u,c.state),n&&o.push(new Ut(u,i,Dt(l.mode,c.state)));return n?o:new Ut(u,i,c.state)}function Gt(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(t[n])||(t[n]+=" "+r[2])}return e}function Kt(e,t,r,n,i,o,l){var s=r.flattenSpans;null==s&&(s=e.options.flattenSpans);var a,c=0,u=null,f=new Pt(t,e.options.tabSize,n),d=e.options.addModeClass&&[null];for(""==t&&Gt(Bt(r,n.state),o);!f.eol();){if(a=f.pos>e.options.maxHighlightLength?(s=!1,l&&It(e,t,n,f.pos),f.pos=t.length,null):Gt(Rt(r,f,n.state,d),o),d){var h=d[0].name;h&&(a="m-"+(a?h+" "+a:h))}if(!s||u!=a){for(;c<f.start;)i(c=Math.min(f.start,c+5e3),u);u=a}f.start=f.pos}for(;c<f.pos;){var p=Math.min(f.pos,c+5e3);i(p,u),c=p}}var Vt=function(e,t,r){this.text=e,We(this,t),this.height=r?r(this):1};Vt.prototype.lineNo=function(){return de(this)},at(Vt);var $t={},Xt={};function Yt(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Xt:$t;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Zt(e,t){var r=N("span",null,null,b?"padding-right: .1px":null),n={pre:N("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:(x||b)&&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,l=void 0;n.pos=0,n.addToken=Jt,bt(e.display.measure)&&(l=Je(o,e.doc.direction))&&(n.addToken=er(n.addToken,l)),n.map=[],rr(o,n,Ht(e,o,t!=e.display.externalMeasured&&de(o))),o.styleClasses&&(o.styleClasses.bgClass&&(n.bgClass=P(o.styleClasses.bgClass,n.bgClass||"")),o.styleClasses.textClass&&(n.textClass=P(o.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(yt(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(b){var s=n.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return it(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=P(n.pre.className,n.textClass||"")),n}function Qt(e){var t=A("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Jt(e,t,r,n,i,o,l){if(t){var s,a=e.splitSpaces?function(e,t){if(1<e.length&&!/ /.test(e))return e;for(var r=t,n="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!r||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),n+=o,r=" "==o}return n}(t,e.trailingSpace):t,c=e.cm.state.specialChars,u=!1;if(c.test(t)){s=document.createDocumentFragment();for(var f=0;;){c.lastIndex=f;var d=c.exec(t),h=d?d.index-f:t.length-f;if(h){var p=document.createTextNode(a.slice(f,f+h));x&&w<9?s.appendChild(A("span",[p])):s.appendChild(p),e.map.push(e.pos,e.pos+h,p),e.col+=h,e.pos+=h}if(!d)break;f+=h+1;var g=void 0;if("\t"==d[0]){var m=e.cm.options.tabSize,v=m-e.col%m;(g=s.appendChild(A("span",$(v),"cm-tab"))).setAttribute("role","presentation"),g.setAttribute("cm-text","\t"),e.col+=v}else"\r"==d[0]||"\n"==d[0]?(g=s.appendChild(A("span","\r"==d[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",d[0]):((g=e.cm.options.specialCharPlaceholder(d[0])).setAttribute("cm-text",d[0]),x&&w<9?s.appendChild(A("span",[g])):s.appendChild(g)),e.col+=1;e.map.push(e.pos,e.pos+1,g),e.pos++}}else e.col+=t.length,s=document.createTextNode(a),e.map.push(e.pos,e.pos+t.length,s),x&&w<9&&(u=!0),e.pos+=t.length;if(e.trailingSpace=32==a.charCodeAt(t.length-1),r||n||i||u||l){var y=r||"";n&&(y+=n),i&&(y+=i);var b=A("span",[s],y,l);return o&&(b.title=o),e.content.appendChild(b)}e.content.appendChild(s)}}function er(f,d){return function(e,t,r,n,i,o,l){r=r?r+" cm-force-border":"cm-force-border";for(var s=e.pos,a=s+t.length;;){for(var c=void 0,u=0;u<d.length&&!((c=d[u]).to>s&&c.from<=s);u++);if(c.to>=a)return f(e,t,r,n,i,o,l);f(e,t.slice(0,c.to-s),r,n,null,o,l),n=null,t=t.slice(c.to-s),s=c.to}}}function tr(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function rr(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var l,s,a,c,u,f,d,h=i.length,p=0,g=1,m="",v=0;;){if(v==p){a=c=u=f=s="",d=null,v=1/0;for(var y=[],b=void 0,_=0;_<n.length;++_){var x=n[_],w=x.marker;"bookmark"==w.type&&x.from==p&&w.widgetNode?y.push(w):x.from<=p&&(null==x.to||x.to>p||w.collapsed&&x.to==p&&x.from==p)?(null!=x.to&&x.to!=p&&v>x.to&&(v=x.to,c=""),w.className&&(a+=" "+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=w.title),w.collapsed&&(!d||Fe(d.marker,w)<0)&&(d=x)):x.from>p&&v>x.from&&(v=x.from)}if(b)for(var k=0;k<b.length;k+=2)b[k+1]==v&&(c+=" "+b[k]);if(!d||d.from==p)for(var C=0;C<y.length;++C)tr(t,0,y[C]);if(d&&(d.from||0)==p){if(tr(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 S=Math.min(h,v);;){if(m){var L=p+m.length;if(!d){var T=S<L?m.slice(0,S-p):m;t.addToken(t,T,l?l+a:a,u,p+T.length==v?c:"",f,s)}if(S<=L){m=m.slice(S-p),p=S;break}p=L,u=""}m=i.slice(o,o=r[g++]),l=Yt(r[g++],t.cm.options)}}else for(var M=1;M<r.length;M+=2)t.addToken(t,i.slice(o,o=r[M]),Yt(r[M+1],t.cm.options))}function nr(e,t,r){this.line=t,this.rest=function(e){for(var t,r;t=Ee(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}(t),this.size=this.rest?de(X(this.rest))-r+1:1,this.node=this.text=null,this.hidden=Ge(e,t)}function ir(e,t,r){for(var n,i=[],o=t;o<r;o=n){var l=new nr(e.doc,ae(e.doc,o),o);n=o+l.size,i.push(l)}return i}var or=null;var lr=null;function sr(e,t){var r=rt(e,t);if(r.length){var n,i=Array.prototype.slice.call(arguments,2);or?n=or.delayedCallbacks:lr?n=lr:(n=lr=[],setTimeout(ar,0));for(var o=function(e){n.push(function(){return r[e].apply(null,i)})},l=0;l<r.length;++l)o(l)}}function ar(){var e=lr;lr=null;for(var t=0;t<e.length;++t)e[t]()}function cr(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?dr(e,t):"gutter"==o?pr(e,t,r,n):"class"==o?hr(e,t):"widget"==o&&gr(e,t,n)}t.changes=null}function ur(e){return e.node==e.text&&(e.node=A("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),x&&w<8&&(e.node.style.zIndex=2)),e.node}function fr(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):Zt(e,t)}function dr(e,t){var r=t.text.className,n=fr(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,hr(e,t)):r&&(t.text.className=r)}function hr(e,t){!function(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),t.background)r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null);else if(r){var n=ur(t);t.background=n.insertBefore(A("div",null,r),n.firstChild),e.display.input.setUneditable(t.background)}}(e,t),t.line.wrapClass?ur(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function pr(e,t,r,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=ur(t);t.gutterBackground=A("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var l=ur(t),s=t.gutter=A("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(s),l.insertBefore(s,t.text),t.line.gutterClass&&(s.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=s.appendChild(A("div",ge(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var a=0;a<e.options.gutters.length;++a){var c=e.options.gutters[a],u=o.hasOwnProperty(c)&&o[c];u&&s.appendChild(A("div",[u],"CodeMirror-gutter-elt","left: "+n.gutterLeft[c]+"px; width: "+n.gutterWidth[c]+"px"))}}}function gr(e,t,r){t.alignable&&(t.alignable=null);for(var n=t.node.firstChild,i=void 0;n;n=i)i=n.nextSibling,"CodeMirror-linewidget"==n.className&&t.node.removeChild(n);mr(e,t,r)}function mr(e,t,r){if(vr(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)vr(e,t.rest[n],t,r,!1)}function vr(e,t,r,n,i){if(t.widgets)for(var o=ur(r),l=0,s=t.widgets;l<s.length;++l){var a=s[l],c=A("div",[a.node],"CodeMirror-linewidget");a.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),yr(a,c,r,n),e.display.input.setUneditable(c),i&&a.above?o.insertBefore(c,r.gutter||r.text):o.appendChild(c),sr(a,"redraw")}}function yr(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function br(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!D(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),M(t.display.measure,A("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function _r(e,t){for(var r=ht(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return!0}function xr(e){return e.lineSpace.offsetTop}function wr(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function kr(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=M(e.measure,A("pre","x")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(n.left)||isNaN(n.right)||(e.cachedPaddingH=n),n}function Cr(e){return B-e.display.nativeBarWidth}function Sr(e){return e.display.scroller.clientWidth-Cr(e)-e.display.barWidth}function Lr(e){return e.display.scroller.clientHeight-Cr(e)-e.display.barHeight}function Tr(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var i=0;i<e.rest.length;i++)if(de(e.rest[i])>r)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Mr(e,t,r,n){return Dr(e,Ar(e,t),r,n)}function Nr(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[sn(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function Ar(e,t){var r=de(t),n=Nr(e,r);n&&!n.text?n=null:n&&n.changes&&(cr(e,n,r,tn(e)),e.curOp.forceUpdate=!0),n||(n=function(e,t){var r=de(t=Re(t)),n=e.display.externalMeasured=new nr(e.doc,t,r);n.lineN=r;var i=n.built=Zt(e,n);return n.text=i.pre,M(e.display.lineMeasure,i.pre),n}(e,t));var i=Tr(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Dr(e,t,r,n,i){t.before&&(r=-1);var o,l=r+(n||"");return t.cache.hasOwnProperty(l)?o=t.cache[l]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(!function(e,t,r){var n=e.options.lineWrapping,i=n&&Sr(e);if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;for(var l=t.text.firstChild.getClientRects(),s=0;s<l.length-1;s++){var a=l[s],c=l[s+1];2<Math.abs(a.bottom-c.bottom)&&o.push((a.bottom+c.top)/2-r.top)}}o.push(r.bottom-r.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,r,n){var i,o=Pr(t.map,r,n),l=o.node,s=o.start,a=o.end,c=o.collapse;if(3==l.nodeType){for(var u=0;u<4;u++){for(;s&&ie(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+a<o.coverEnd&&ie(t.line.text.charAt(o.coverStart+a));)++a;if((i=x&&w<9&&0==s&&a==o.coverEnd-o.coverStart?l.parentNode.getBoundingClientRect():zr(S(l,s,a).getClientRects(),n)).left||i.right||0==s)break;a=s,s-=1,c="right"}x&&w<11&&(i=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=Ct)return Ct;var t=M(e,A("span","x")),r=t.getBoundingClientRect(),n=S(t,0,1).getBoundingClientRect();return Ct=1<Math.abs(r.left-n.left)}(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}(e.display.measure,i))}else{var f;0<s&&(c=n="right"),i=e.options.lineWrapping&&1<(f=l.getClientRects()).length?f["right"==n?f.length-1:0]:l.getBoundingClientRect()}if(x&&w<9&&!s&&(!i||!i.left&&!i.right)){var d=l.parentNode.getClientRects()[0];i=d?{left:d.left,right:d.left+en(e.display),top:d.top,bottom:d.bottom}:Wr}for(var h=i.top-t.rect.top,p=i.bottom-t.rect.top,g=(h+p)/2,m=t.view.measure.heights,v=0;v<m.length-1&&!(g<m[v]);v++);var y=v?m[v-1]:0,b=m[v],_={left:("right"==c?i.right:i.left)-t.rect.left,right:("left"==c?i.left:i.right)-t.rect.left,top:y,bottom:b};i.left||i.right||(_.bogus=!0);e.options.singleCursorHeightPerLine||(_.rtop=h,_.rbottom=p);return _}(e,t,r,n)).bogus||(t.cache[l]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var Or,Wr={left:0,right:0,top:0,bottom:0};function Pr(e,t,r){for(var n,i,o,l,s,a,c=0;c<e.length;c+=3)if(s=e[c],a=e[c+1],t<s?(i=0,o=1,l="left"):t<a?o=(i=t-s)+1:(c==e.length-3||t==a&&e[c+3]>t)&&(i=(o=a-s)-1,a<=t&&(l="right")),null!=i){if(n=e[c+2],s==a&&r==(n.insertLeft?"left":"right")&&(l=r),"left"==r&&0==i)for(;c&&e[c-2]==e[c-3]&&e[c-1].insertLeft;)n=e[2+(c-=3)],l="left";if("right"==r&&i==a-s)for(;c<e.length-3&&e[c+3]==e[c+4]&&!e[c+5].insertLeft;)n=e[(c+=3)+2],l="right";break}return{node:n,start:i,end:o,collapse:l,coverStart:s,coverEnd:a}}function zr(e,t){var r=Wr;if("left"==t)for(var n=0;n<e.length&&(r=e[n]).left==r.right;n++);else for(var i=e.length-1;0<=i&&(r=e[i]).left==r.right;i--);return r}function Fr(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 qr(e){e.display.externalMeasure=null,T(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Fr(e.display.view[t])}function Hr(e){qr(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Er(){return l&&f?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Ir(){return l&&f?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Br(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=br(e.widgets[r]));return t}function Rr(e,t,r,n,i){if(!i){var o=Br(t);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var l=Ve(t);if("local"==n?l+=xr(e.display):l-=e.display.viewOffset,"page"==n||"window"==n){var s=e.display.lineSpace.getBoundingClientRect();l+=s.top+("window"==n?0:Ir());var a=s.left+("window"==n?0:Er());r.left+=a,r.right+=a}return r.top+=l,r.bottom+=l,r}function Ur(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=Er(),i-=Ir();else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();n+=o.left,i+=o.top}var l=e.display.lineSpace.getBoundingClientRect();return{left:n-l.left,top:i-l.top}}function jr(e,t,r,n,i){return n||(n=ae(e.doc,t.line)),Rr(e,n,Mr(e,n,t.ch,i),r)}function Gr(n,e,i,o,l,s){function a(e,t){var r=Dr(n,l,e,t?"right":"left",s);return t?r.left=r.right:r.right=r.left,Rr(n,o,r,i)}o=o||ae(n.doc,e.line),l||(l=Ar(n,o));var c=Je(o,n.doc.direction),t=e.ch,r=e.sticky;if(t>=o.text.length?(t=o.text.length,r="before"):t<=0&&(t=0,r="after"),!c)return a("before"==r?t-1:t,"before"==r);function u(e,t,r){return a(r?e-1:e,1==c[t].level!=r)}var f=Ze(c,t,r),d=Ye,h=u(t,f,"before"==r);return null!=d&&(h.other=u(t,d,"before"!=r)),h}function Kr(e,t){var r=0;t=ke(e.doc,t),e.options.lineWrapping||(r=en(e.display)*t.ch);var n=ae(e.doc,t.line),i=Ve(n)+xr(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function Vr(e,t,r,n,i){var o=me(e,t,r);return o.xRel=i,n&&(o.outside=!0),o}function $r(e,t,r){var n=e.doc;if((r+=e.display.viewOffset)<0)return Vr(n.first,0,null,!0,-1);var i=he(n,r),o=n.first+n.size-1;if(o<i)return Vr(n.first+n.size-1,ae(n,o).text.length,null,!0,1);t<0&&(t=0);for(var l=ae(n,i);;){var s=Qr(e,l,i,t,r),a=Ie(l,s.ch+(0<s.xRel?1:0));if(!a)return s;var c=a.find(1);if(c.line==i)return c;l=ae(n,i=c.line)}}function Xr(t,e,r,n){n-=Br(e);var i=e.text.length,o=le(function(e){return Dr(t,r,e-1).bottom<=n},i,0);return{begin:o,end:i=le(function(e){return Dr(t,r,e).top>n},o,i)}}function Yr(e,t,r,n){return r||(r=Ar(e,t)),Xr(e,t,r,Rr(e,t,Dr(e,r,n),"line").top)}function Zr(e,t,r,n){return!(e.bottom<=r)&&(e.top>r||(n?e.left:e.right)>t)}function Qr(r,e,t,n,i){i-=Ve(e);var o=Ar(r,e),l=Br(e),s=0,a=e.text.length,c=!0,u=Je(e,r.doc.direction);if(u){var f=(r.options.lineWrapping?function(e,t,r,n,i,o,l){var s=Xr(e,t,n,l),a=s.begin,c=s.end;/\s/.test(t.text.charAt(c-1))&&c--;for(var u=null,f=null,d=0;d<i.length;d++){var h=i[d];if(!(h.from>=c||h.to<=a)){var p=1!=h.level,g=Dr(e,n,p?Math.min(c,h.to)-1:Math.max(a,h.from)).right,m=g<o?o-g+1e9:g-o;(!u||m<f)&&(u=h,f=m)}}u||(u=i[i.length-1]);u.from<a&&(u={from:a,to:u.to,level:u.level});u.to>c&&(u={from:u.from,to:c,level:u.level});return u}:function(n,i,o,l,s,a,c){var e=le(function(e){var t=s[e],r=1!=t.level;return Zr(Gr(n,me(o,r?t.to:t.from,r?"before":"after"),"line",i,l),a,c,!0)},0,s.length-1),t=s[e];if(0<e){var r=1!=t.level,u=Gr(n,me(o,r?t.from:t.to,r?"after":"before"),"line",i,l);Zr(u,a,c,!0)&&u.top>c&&(t=s[e-1])}return t})(r,e,t,o,u,n,i);s=(c=1!=f.level)?f.from:f.to-1,a=c?f.to:f.from-1}var d,h,p=null,g=null,m=le(function(e){var t=Dr(r,o,e);return t.top+=l,t.bottom+=l,!!Zr(t,n,i,!1)&&(t.top<=i&&t.left<=n&&(p=e,g=t),!0)},s,a),v=!1;if(g){var y=n-g.left<g.right-n,b=y==c;m=p+(b?0:1),h=b?"after":"before",d=y?g.left:g.right}else{c||m!=a&&m!=s||m++,h=0==m?"after":m==e.text.length?"before":Dr(r,o,m-(c?1:0)).bottom+l<=i==c?"after":"before";var _=Gr(r,me(t,m,h),"line",e,o);d=_.left,v=i<_.top||i>=_.bottom}return Vr(t,m=oe(e.text,m,1),h,v,n-d)}function Jr(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Or){Or=A("pre");for(var t=0;t<49;++t)Or.appendChild(document.createTextNode("x")),Or.appendChild(A("br"));Or.appendChild(document.createTextNode("x"))}M(e.measure,Or);var r=Or.offsetHeight/50;return 3<r&&(e.cachedTextHeight=r),T(e.measure),r||1}function en(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=A("span","xxxxxxxxxx"),r=A("pre",[t]);M(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return 2<i&&(e.cachedCharWidth=i),i||10}function tn(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l)r[e.options.gutters[l]]=o.offsetLeft+o.clientLeft+i,n[e.options.gutters[l]]=o.clientWidth;return{fixedPos:rn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function rn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function nn(n){var i=Jr(n.display),o=n.options.lineWrapping,l=o&&Math.max(5,n.display.scroller.clientWidth/en(n.display)-3);return function(e){if(Ge(n.doc,e))return 0;var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;r++)e.widgets[r].height&&(t+=e.widgets[r].height);return o?t+(Math.ceil(e.text.length/l)||1)*i:t+i}}function on(e){var t=e.doc,r=nn(e);t.iter(function(e){var t=r(e);t!=e.height&&fe(e,t)})}function ln(e,t,r,n){var i=e.display;if(!r&&"true"==ht(t).getAttribute("cm-not-content"))return null;var o,l,s=i.lineSpace.getBoundingClientRect();try{o=t.clientX-s.left,l=t.clientY-s.top}catch(t){return null}var a,c=$r(e,o,l);if(n&&1==c.xRel&&(a=ae(e.doc,c.line).text).length==c.ch){var u=H(a,a.length,e.options.tabSize)-a.length;c=me(c.line,Math.max(0,Math.round((o-kr(e.display).left)/en(e.display))-u))}return c}function sn(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var r=e.display.view,n=0;n<r.length;n++)if((t-=r[n].size)<0)return n}function an(e){e.display.input.showSelection(e.display.input.prepareSelection())}function cn(e,t){void 0===t&&(t=!0);for(var r=e.doc,n={},i=n.cursors=document.createDocumentFragment(),o=n.selection=document.createDocumentFragment(),l=0;l<r.sel.ranges.length;l++)if(t||l!=r.sel.primIndex){var s=r.sel.ranges[l];if(!(s.from().line>=e.display.viewTo||s.to().line<e.display.viewFrom)){var a=s.empty();(a||e.options.showCursorWhenSelecting)&&un(e,s.head,i),a||dn(e,s,o)}}return n}function un(e,t,r){var n=Gr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild(A("div"," ","CodeMirror-cursor"));if(i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var o=r.appendChild(A("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=n.other.left+"px",o.style.top=n.other.top+"px",o.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function fn(e,t){return e.top-t.top||e.left-t.left}function dn(l,e,t){var r=l.display,n=l.doc,i=document.createDocumentFragment(),o=kr(l.display),L=o.left,T=Math.max(r.sizerWidth,Sr(l)-r.sizer.offsetLeft)-o.right,M="ltr"==n.direction;function N(e,t,r,n){t<0&&(t=0),t=Math.round(t),n=Math.round(n),i.appendChild(A("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==r?T-e:r)+"px;\n height: "+(n-t)+"px"))}function s(r,y,b){var _,x,o=ae(n,r),w=o.text.length;function k(e,t){return jr(l,me(r,e),"div",o,t)}function C(e,t,r){var n=Yr(l,o,null,e),i="ltr"==t==("after"==r)?"left":"right";return k("after"==r?n.begin:n.end-(/\s/.test(o.text.charAt(n.end-1))?2:1),i)[i]}var S=Je(o,n.direction);return function(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var l=e[o];(l.from<r&&l.to>t||t==r&&l.to==t)&&(n(Math.max(l.from,t),Math.min(l.to,r),1==l.level?"rtl":"ltr",o),i=!0)}i||n(t,r,"ltr")}(S,y||0,null==b?w:b,function(e,t,r,n){var i="ltr"==r,o=k(e,i?"left":"right"),l=k(t-1,i?"right":"left"),s=null==y&&0==e,a=null==b&&t==w,c=0==n,u=!S||n==S.length-1;if(l.top-o.top<=3){var f=(M?a:s)&&u,d=(M?s:a)&&c?L:(i?o:l).left,h=f?T:(i?l:o).right;N(d,o.top,h-d,o.bottom)}else{var p,g,m,v;v=i?(p=M&&s&&c?L:o.left,g=M?T:C(e,r,"before"),m=M?L:C(t,r,"after"),M&&a&&u?T:l.right):(p=M?C(e,r,"before"):L,g=!M&&s&&c?T:o.right,m=!M&&a&&u?L:l.left,M?C(t,r,"after"):T),N(p,o.top,g-p,o.bottom),o.bottom<l.top&&N(L,o.bottom,null,l.top),N(m,l.top,v-m,l.bottom)}(!_||fn(o,_)<0)&&(_=o),fn(l,_)<0&&(_=l),(!x||fn(o,x)<0)&&(x=o),fn(l,x)<0&&(x=l)}),{start:_,end:x}}var a=e.from(),c=e.to();if(a.line==c.line)s(a.line,a.ch,c.ch);else{var u=ae(n,a.line),f=ae(n,c.line),d=Re(u)==Re(f),h=s(a.line,a.ch,d?u.text.length+1:null).end,p=s(c.line,d?0:null,c.ch).start;d&&(h.top<p.top-2?(N(h.right,h.top,null,h.bottom),N(L,p.top,p.left,p.bottom)):N(h.right,h.top,p.left-h.right,h.bottom)),h.bottom<p.top&&N(L,h.bottom,null,p.top)}t.appendChild(i)}function hn(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",0<e.options.cursorBlinkRate?t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function pn(e){e.state.focused||(e.display.input.focus(),mn(e))}function gn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,vn(e))},100)}function mn(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(it(e,"focus",e,t),e.state.focused=!0,W(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),b&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),hn(e))}function vn(e,t){e.state.delayingBlurEvent||(e.state.focused&&(it(e,"blur",e,t),e.state.focused=!1,L(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function yn(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var i=t.view[n],o=void 0;if(!i.hidden){if(x&&w<8){var l=i.node.offsetTop+i.node.offsetHeight;o=l-r,r=l}else{var s=i.node.getBoundingClientRect();o=s.bottom-s.top}var a=i.line.height-o;if(o<2&&(o=Jr(t)),(.005<a||a<-.005)&&(fe(i.line,o),bn(i.line),i.rest))for(var c=0;c<i.rest.length;c++)bn(i.rest[c])}}}function bn(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var r=e.widgets[t],n=r.node.parentNode;n&&(r.height=n.offsetHeight)}}function _n(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-xr(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=he(t,n),l=he(t,i);if(r&&r.ensure){var s=r.ensure.from.line,a=r.ensure.to.line;s<o?l=he(t,Ve(ae(t,o=s))+e.wrapper.clientHeight):Math.min(a,t.lastLine())>=l&&(o=he(t,Ve(ae(t,a))-e.wrapper.clientHeight),l=a)}return{from:o,to:Math.max(l,o+1)}}function xn(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=rn(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",l=0;l<r.length;l++)if(!r[l].hidden){e.options.fixedGutter&&(r[l].gutter&&(r[l].gutter.style.left=o),r[l].gutterBackground&&(r[l].gutterBackground.style.left=o));var s=r[l].alignable;if(s)for(var a=0;a<s.length;a++)s[a].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function wn(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=ge(e.options,t.first+t.size-1),n=e.display;if(r.length==n.lineNumChars)return!1;var i=n.measure.appendChild(A("div",[A("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,l=i.offsetWidth-o;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-l)+1,n.lineNumWidth=n.lineNumInnerWidth+l,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",si(e),!0}function kn(e,t){var r=e.display,n=Jr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:r.scroller.scrollTop,o=Lr(e),l={};t.bottom-t.top>o&&(t.bottom=t.top+o);var s=e.doc.height+wr(r),a=t.top<n,c=t.bottom>s-n;if(t.top<i)l.scrollTop=a?0:t.top;else if(t.bottom>i+o){var u=Math.min(t.top,(c?s:t.bottom)-o);u!=i&&(l.scrollTop=u)}var f=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:r.scroller.scrollLeft,d=Sr(e)-(e.options.fixedGutter?r.gutters.offsetWidth:0),h=t.right-t.left>d;return h&&(t.right=t.left+d),t.left<10?l.scrollLeft=0:t.left<f?l.scrollLeft=Math.max(0,t.left-(h?0:10)):t.right>d+f-3&&(l.scrollLeft=t.right+(h?0:10)-d),l}function Cn(e,t){null!=t&&(Tn(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Sn(e){Tn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Ln(e,t,r){null==t&&null==r||Tn(e),null!=t&&(e.curOp.scrollLeft=t),null!=r&&(e.curOp.scrollTop=r)}function Tn(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Mn(e,Kr(e,t.from),Kr(e,t.to),t.margin))}function Mn(e,t,r,n){var i=kn(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});Ln(e,i.scrollLeft,i.scrollTop)}function Nn(e,t){Math.abs(e.doc.scrollTop-t)<2||(g||li(e,{top:t}),An(e,t,!0),g&&li(e),ti(e,100))}function An(e,t,r){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),(e.display.scroller.scrollTop!=t||r)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Dn(e,t,r,n){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n||(e.doc.scrollLeft=t,xn(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function On(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+wr(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?r:0,docHeight:n,scrollHeight:n+Cr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var Wn=function(e,t,r){this.cm=r;var n=this.vert=A("div",[A("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=A("div",[A("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=i.tabIndex=-1,e(n),e(i),tt(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),tt(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,x&&w<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Wn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&0<e.clientHeight&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},Wn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Wn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Wn.prototype.zeroWidthHack=function(){var e=_&&!s?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new E,this.disableVert=new E},Wn.prototype.enableZeroWidthBar=function(r,n,i){r.style.pointerEvents="auto",n.set(1e3,function e(){var t=r.getBoundingClientRect();("vert"==i?document.elementFromPoint(t.right-1,(t.top+t.bottom)/2):document.elementFromPoint((t.right+t.left)/2,t.bottom-1))!=r?r.style.pointerEvents="none":n.set(1e3,e)})},Wn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Pn=function(){};function zn(e,t){t||(t=On(e));var r=e.display.barWidth,n=e.display.barHeight;Fn(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&yn(e),Fn(e,On(e)),r=e.display.barWidth,n=e.display.barHeight}function Fn(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}Pn.prototype.update=function(){return{bottom:0,right:0}},Pn.prototype.setScrollLeft=function(){},Pn.prototype.setScrollTop=function(){},Pn.prototype.clear=function(){};var qn={native:Wn,null:Pn};function Hn(r){r.display.scrollbars&&(r.display.scrollbars.clear(),r.display.scrollbars.addClass&&L(r.display.wrapper,r.display.scrollbars.addClass)),r.display.scrollbars=new qn[r.options.scrollbarStyle](function(e){r.display.wrapper.insertBefore(e,r.display.scrollbarFiller),tt(e,"mousedown",function(){r.state.focused&&setTimeout(function(){return r.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,t){"horizontal"==t?Dn(r,e):Nn(r,e)},r),r.display.scrollbars.addClass&&W(r.display.wrapper,r.display.scrollbars.addClass)}var En=0;function In(e){var t;e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++En},t=e.curOp,or?or.ops.push(t):t.ownsGroup=or={ops:[t],delayedCallbacks:[]}}function Bn(e){!function(e,t){var r=e.ownsGroup;if(r)try{!function(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var i=e.ops[n];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(r<t.length)}(r)}finally{or=null,t(r)}}(e.curOp,function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;!function(e){for(var t=e.ops,r=0;r<t.length;r++)Rn(t[r]);for(var n=0;n<t.length;n++)(i=t[n]).updatedDisplay=i.mustUpdate&&ii(i.cm,i.update);var i;for(var o=0;o<t.length;o++)Un(t[o]);for(var l=0;l<t.length;l++)jn(t[l]);for(var s=0;s<t.length;s++)Gn(t[s])}(e)})}function Rn(e){var t,r,n=e.cm,i=n.display;!(r=(t=n).display).scrollbarsClipped&&r.scroller.offsetWidth&&(r.nativeBarWidth=r.scroller.offsetWidth-r.scroller.clientWidth,r.heightForcer.style.height=Cr(t)+"px",r.sizer.style.marginBottom=-r.nativeBarWidth+"px",r.sizer.style.borderRightWidth=Cr(t)+"px",r.scrollbarsClipped=!0),e.updateMaxLine&&Xe(n),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<i.viewFrom||e.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&n.options.lineWrapping,e.update=e.mustUpdate&&new ni(n,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Un(e){var t=e.cm,r=t.display;e.updatedDisplay&&yn(t),e.barMeasure=On(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Mr(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+Cr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Sr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function jn(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Dn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==O();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&zn(t,e.barMeasure),e.updatedDisplay&&ai(t,e.barMeasure),e.selectionChanged&&hn(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&pn(e.cm)}function Gn(e){var t=e.cm,r=t.display,n=t.doc;(e.updatedDisplay&&oi(t,e.update),null==r.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null!=e.scrollTop&&An(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&Dn(t,e.scrollLeft,!0,!0),e.scrollToPos)&&function(e,t){if(!ot(e,"scrollCursorIntoView")){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!c){var o=A("div","​",null,"position: absolute;\n top: "+(t.top-r.viewOffset-xr(e.display))+"px;\n height: "+(t.bottom-t.top+Cr(e)+r.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}(t,function(e,t,r,n){var i;null==n&&(n=0),e.options.lineWrapping||t!=r||(r="before"==(t=t.ch?me(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?me(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var l=!1,s=Gr(e,t),a=r&&r!=t?Gr(e,r):s,c=kn(e,i={left:Math.min(s.left,a.left),top:Math.min(s.top,a.top)-n,right:Math.max(s.left,a.left),bottom:Math.max(s.bottom,a.bottom)+n}),u=e.doc.scrollTop,f=e.doc.scrollLeft;if(null!=c.scrollTop&&(Nn(e,c.scrollTop),1<Math.abs(e.doc.scrollTop-u)&&(l=!0)),null!=c.scrollLeft&&(Dn(e,c.scrollLeft),1<Math.abs(e.doc.scrollLeft-f)&&(l=!0)),!l)break}return i}(t,ke(n,e.scrollToPos.from),ke(n,e.scrollToPos.to),e.scrollToPos.margin));var i=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(i)for(var l=0;l<i.length;++l)i[l].lines.length||it(i[l],"hide");if(o)for(var s=0;s<o.length;++s)o[s].lines.length&&it(o[s],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&it(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Kn(e,t){if(e.curOp)return t();In(e);try{return t()}finally{Bn(e)}}function Vn(e,t){return function(){if(e.curOp)return t.apply(e,arguments);In(e);try{return t.apply(e,arguments)}finally{Bn(e)}}}function $n(e){return function(){if(this.curOp)return e.apply(this,arguments);In(this);try{return e.apply(this,arguments)}finally{Bn(this)}}}function Xn(t){return function(){var e=this.cm;if(!e||e.curOp)return t.apply(this,arguments);In(e);try{return t.apply(this,arguments)}finally{Bn(e)}}}function Yn(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&r<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Le&&Ue(e.doc,t)<i.viewTo&&Qn(e);else if(r<=i.viewFrom)Le&&je(e.doc,r+n)>i.viewFrom?Qn(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)Qn(e);else if(t<=i.viewFrom){var o=Jn(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):Qn(e)}else if(r>=i.viewTo){var l=Jn(e,t,t,-1);l?(i.view=i.view.slice(0,l.index),i.viewTo=l.lineN):Qn(e)}else{var s=Jn(e,t,t,-1),a=Jn(e,r,r+n,1);s&&a?(i.view=i.view.slice(0,s.index).concat(ir(e,s.lineN,a.lineN)).concat(i.view.slice(a.index)),i.viewTo+=n):Qn(e)}var c=i.externalMeasured;c&&(r<c.lineN?c.lineN+=n:t<c.lineN+c.size&&(i.externalMeasured=null))}function Zn(e,t,r){e.curOp.viewChanged=!0;var n=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var o=n.view[sn(e,t)];if(null!=o.node){var l=o.changes||(o.changes=[]);-1==I(l,r)&&l.push(r)}}}function Qn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Jn(e,t,r,n){var i,o=sn(e,t),l=e.display.view;if(!Le||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var s=e.display.viewFrom,a=0;a<o;a++)s+=l[a].size;if(s!=t){if(0<n){if(o==l.length-1)return null;i=s+l[o].size-t,o++}else i=s-t;t+=i,r+=i}for(;Ue(e.doc,r)!=r;){if(o==(n<0?0:l.length-1))return null;r+=n*l[o-(n<0?1:0)].size,o+=n}return{index:o,lineN:r}}function ei(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var i=t[n];i.hidden||i.node&&!i.changes||++r}return r}function ti(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,F(ri,e))}function ri(a){var c=a.doc;if(!(c.highlightFrontier>=a.display.viewTo)){var u=+new Date+a.options.workTime,f=Et(a,c.highlightFrontier),d=[];c.iter(f.line,Math.min(c.first+c.size,a.display.viewTo+500),function(e){if(f.line>=a.display.viewFrom){var t=e.styles,r=e.text.length>a.options.maxHighlightLength?Dt(c.mode,f.state):null,n=qt(a,e,f,!0);r&&(f.state=r),e.styles=n.styles;var i=e.styleClasses,o=n.classes;o?e.styleClasses=o:i&&(e.styleClasses=null);for(var l=!t||t.length!=e.styles.length||i!=o&&(!i||!o||i.bgClass!=o.bgClass||i.textClass!=o.textClass),s=0;!l&&s<t.length;++s)l=t[s]!=e.styles[s];l&&d.push(f.line),e.stateAfter=f.save(),f.nextLine()}else e.text.length<=a.options.maxHighlightLength&&It(a,e.text,f),e.stateAfter=f.line%5==0?f.save():null,f.nextLine();if(+new Date>u)return ti(a,a.options.workDelay),!0}),c.highlightFrontier=f.line,c.modeFrontier=Math.max(c.modeFrontier,f.line),d.length&&Kn(a,function(){for(var e=0;e<d.length;e++)Zn(a,d[e],"text")})}}var ni=function(e,t,r){var n=e.display;this.viewport=t,this.visible=_n(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Sr(e),this.force=r,this.dims=tn(e),this.events=[]};function ii(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return Qn(e),!1;if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==ei(e))return!1;wn(e)&&(Qn(e),t.dims=tn(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),l=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFrom<o&&o-r.viewFrom<20&&(o=Math.max(n.first,r.viewFrom)),r.viewTo>l&&r.viewTo-l<20&&(l=Math.min(i,r.viewTo)),Le&&(o=Ue(e.doc,o),l=je(e.doc,l));var s,a,c,u,f=o!=r.viewFrom||l!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;a=o,c=l,0==(u=(s=e).display).view.length||a>=u.viewTo||c<=u.viewFrom?(u.view=ir(s,a,c),u.viewFrom=a):(u.viewFrom>a?u.view=ir(s,a,u.viewFrom).concat(u.view):u.viewFrom<a&&(u.view=u.view.slice(sn(s,a))),u.viewFrom=a,u.viewTo<c?u.view=u.view.concat(ir(s,u.viewTo,c)):u.viewTo>c&&(u.view=u.view.slice(0,sn(s,c)))),u.viewTo=c,r.viewOffset=Ve(ae(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var d=ei(e);if(!f&&0==d&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var h=function(e){if(e.hasFocus())return null;var t=O();if(!t||!D(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&D(e.display.lineDiv,n.anchorNode)&&(r.anchorNode=n.anchorNode,r.anchorOffset=n.anchorOffset,r.focusNode=n.focusNode,r.focusOffset=n.focusOffset)}return r}(e);return 4<d&&(r.lineDiv.style.display="none"),function(r,e,t){var n=r.display,i=r.options.lineNumbers,o=n.lineDiv,l=o.firstChild;function s(e){var t=e.nextSibling;return b&&_&&r.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),t}for(var a=n.view,c=n.viewFrom,u=0;u<a.length;u++){var f=a[u];if(f.hidden);else if(f.node&&f.node.parentNode==o){for(;l!=f.node;)l=s(l);var d=i&&null!=e&&e<=c&&f.lineNumber;f.changes&&(-1<I(f.changes,"gutter")&&(d=!1),cr(r,f,c,t)),d&&(T(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(ge(r.options,c)))),l=f.node.nextSibling}else{var h=(m=c,v=t,void 0,y=fr(p=r,g=f),g.text=g.node=y.pre,y.bgClass&&(g.bgClass=y.bgClass),y.textClass&&(g.textClass=y.textClass),hr(p,g),pr(p,g,m,v),mr(p,g,v),g.node);o.insertBefore(h,l)}c+=f.size}var p,g,m,v,y;for(;l;)l=s(l)}(e,r.updateLineNumbers,t.dims),4<d&&(r.lineDiv.style.display=""),r.renderedView=r.view,function(e){if(e&&e.activeElt&&e.activeElt!=O()&&(e.activeElt.focus(),e.anchorNode&&D(document.body,e.anchorNode)&&D(document.body,e.focusNode))){var t=window.getSelection(),r=document.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),t.removeAllRanges(),t.addRange(r),t.extend(e.focusNode,e.focusOffset)}}(h),T(r.cursorDiv),T(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,f&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,ti(e,400)),!(r.updateLineNumbers=null)}function oi(e,t){for(var r=t.viewport,n=!0;(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Sr(e)||(r&&null!=r.top&&(r={top:Math.min(e.doc.height+wr(e.display)-Lr(e),r.top)}),t.visible=_n(e.display,e.doc,r),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&ii(e,t);n=!1){yn(e);var i=On(e);an(e),zn(e,i),ai(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 li(e,t){var r=new ni(e,t);if(ii(e,r)){yn(e),oi(e,r);var n=On(e);an(e),zn(e,n),ai(e,n),r.finish()}}function si(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function ai(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+Cr(e)+"px"}function ci(e){var t=e.display.gutters,r=e.options.gutters;T(t);for(var n=0;n<r.length;++n){var i=r[n],o=t.appendChild(A("div",null,"CodeMirror-gutter "+i));"CodeMirror-linenumbers"==i&&((e.display.lineGutter=o).style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=n?"":"none",si(e)}function ui(e){var t=I(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):-1<t&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}ni.prototype.signal=function(e,t){st(e,t)&&this.events.push(arguments)},ni.prototype.finish=function(){for(var e=0;e<this.events.length;e++)it.apply(null,this.events[e])};var fi=0,di=null;function hi(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta),{x:t,y:r}}function pi(e){var t=hi(e);return t.x*=di,t.y*=di,t}function gi(e,t){var r=hi(t),n=r.x,i=r.y,o=e.display,l=o.scroller,s=l.scrollWidth>l.clientWidth,a=l.scrollHeight>l.clientHeight;if(n&&s||i&&a){if(i&&_&&b)e:for(var c=t.target,u=o.view;c!=l;c=c.parentNode)for(var f=0;f<u.length;f++)if(u[f].node==c){e.display.currentWheelTarget=c;break e}if(n&&!g&&!m&&null!=di)return i&&a&&Nn(e,Math.max(0,l.scrollTop+i*di)),Dn(e,Math.max(0,l.scrollLeft+n*di)),(!i||i&&a)&&ct(t),void(o.wheelStartX=null);if(i&&null!=di){var d=i*di,h=e.doc.scrollTop,p=h+o.wrapper.clientHeight;d<0?h=Math.max(0,h+d-50):p=Math.min(e.doc.height,p+d+50),li(e,{top:h,bottom:p})}fi<20&&(null==o.wheelStartX?(o.wheelStartX=l.scrollLeft,o.wheelStartY=l.scrollTop,o.wheelDX=n,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=l.scrollLeft-o.wheelStartX,t=l.scrollTop-o.wheelStartY,r=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,r&&(di=(di*fi+r)/(fi+1),++fi)}},200)):(o.wheelDX+=n,o.wheelDY+=i))}}x?di=-.53:g?di=15:l?di=-.7:a&&(di=-1/3);var mi=function(e,t){this.ranges=e,this.primIndex=t};mi.prototype.primary=function(){return this.ranges[this.primIndex]},mi.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 r=this.ranges[t],n=e.ranges[t];if(!ye(r.anchor,n.anchor)||!ye(r.head,n.head))return!1}return!0},mi.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new vi(be(this.ranges[t].anchor),be(this.ranges[t].head));return new mi(e,this.primIndex)},mi.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},mi.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(0<=ve(t,n.from())&&ve(e,n.to())<=0)return r}return-1};var vi=function(e,t){this.anchor=e,this.head=t};function yi(e,t){var r=e[t];e.sort(function(e,t){return ve(e.from(),t.from())}),t=I(e,r);for(var n=1;n<e.length;n++){var i=e[n],o=e[n-1];if(0<=ve(o.to(),i.from())){var l=xe(o.from(),i.from()),s=_e(o.to(),i.to()),a=o.empty()?i.from()==i.head:o.from()==o.head;n<=t&&--t,e.splice(--n,2,new vi(a?s:l,a?l:s))}}return new mi(e,t)}function bi(e,t){return new mi([new vi(e,t||e)],0)}function _i(e){return e.text?me(e.from.line+e.text.length-1,X(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function xi(e,t){if(ve(e,t.from)<0)return e;if(ve(e,t.to)<=0)return _i(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=_i(t).ch-t.to.ch),me(r,n)}function wi(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new vi(xi(i.anchor,t),xi(i.head,t)))}return yi(r,e.sel.primIndex)}function ki(e,t,r){return e.line==t.line?me(r.line,e.ch-t.ch+r.ch):me(r.line+(e.line-t.line),e.ch)}function Ci(e){e.doc.mode=Mt(e.options,e.doc.modeOption),Si(e)}function Si(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,ti(e,100),e.state.modeGen++,e.curOp&&Yn(e)}function Li(e,t){return 0==t.from.ch&&0==t.to.ch&&""==X(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ti(e,n,t,i){function o(e){return t?t[e]:null}function r(e,t,r){!function(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Oe(e),We(e,r);var i=n?n(e):1;i!=e.height&&fe(e,i)}(e,t,r,i),sr(e,"change",e,n)}function l(e,t){for(var r=[],n=e;n<t;++n)r.push(new Vt(c[n],o(n),i));return r}var s=n.from,a=n.to,c=n.text,u=ae(e,s.line),f=ae(e,a.line),d=X(c),h=o(c.length-1),p=a.line-s.line;if(n.full)e.insert(0,l(0,c.length)),e.remove(c.length,e.size-c.length);else if(Li(e,n)){var g=l(0,c.length-1);r(f,f.text,h),p&&e.remove(s.line,p),g.length&&e.insert(s.line,g)}else if(u==f)if(1==c.length)r(u,u.text.slice(0,s.ch)+d+u.text.slice(a.ch),h);else{var m=l(1,c.length-1);m.push(new Vt(d+u.text.slice(a.ch),h,i)),r(u,u.text.slice(0,s.ch)+c[0],o(0)),e.insert(s.line+1,m)}else if(1==c.length)r(u,u.text.slice(0,s.ch)+c[0]+f.text.slice(a.ch),o(0)),e.remove(s.line+1,p);else{r(u,u.text.slice(0,s.ch)+c[0],o(0)),r(f,d+f.text.slice(a.ch),h);var v=l(1,c.length-1);1<p&&e.remove(s.line+1,p-1),e.insert(s.line+1,v)}sr(e,"change",e,n)}function Mi(e,s,a){!function e(t,r,n){if(t.linked)for(var i=0;i<t.linked.length;++i){var o=t.linked[i];if(o.doc!=r){var l=n&&o.sharedHist;a&&!l||(s(o.doc,l),e(o.doc,t,l))}}}(e,null,!0)}function Ni(e,t){if(t.cm)throw new Error("This document is already in use.");on((e.doc=t).cm=e),Ci(e),Ai(e),e.options.lineWrapping||Xe(e),e.options.mode=t.modeOption,Yn(e)}function Ai(e){("rtl"==e.doc.direction?W:L)(e.display.lineDiv,"CodeMirror-rtl")}function Di(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Oi(e,t){var r={from:be(t.from),to:_i(t),text:ce(e,t.from,t.to)};return qi(e,r,t.from.line,t.to.line+1),Mi(e,function(e){return qi(e,r,t.from.line,t.to.line+1)},!0),r}function Wi(e){for(;e.length;){if(!X(e).ranges)break;e.pop()}}function Pi(e,t,r,n){var i=e.history;i.undone.length=0;var o,l,s,a=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastModTime>a-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=(s=i).lastOp==n?(Wi(s.done),X(s.done)):s.done.length&&!X(s.done).ranges?X(s.done):1<s.done.length&&!s.done[s.done.length-2].ranges?(s.done.pop(),X(s.done)):void 0))l=X(o.changes),0==ve(t.from,t.to)&&0==ve(t.from,l.to)?l.to=_i(t):o.changes.push(Oi(e,t));else{var c=X(i.done);for(c&&c.ranges||Fi(e.sel,i.done),o={changes:[Oi(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(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=a,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,l||it(e,"historyAdded")}function zi(e,t,r,n){var i,o,l,s,a,c=e.history,u=n&&n.origin;r==c.lastSelOp||u&&c.lastSelOrigin==u&&(c.lastModTime==c.lastSelTime&&c.lastOrigin==u||(i=e,o=u,l=X(c.done),s=t,"*"==(a=o.charAt(0))||"+"==a&&l.ranges.length==s.ranges.length&&l.somethingSelected()==s.somethingSelected()&&new Date-i.history.lastSelTime<=(i.cm?i.cm.options.historyEventDelay:500)))?c.done[c.done.length-1]=t:Fi(t,c.done),c.lastSelTime=+new Date,c.lastSelOrigin=u,c.lastSelOp=r,n&&!1!==n.clearRedo&&Wi(c.undone)}function Fi(e,t){var r=X(t);r&&r.ranges&&r.equals(e)||t.push(e)}function qi(t,r,e,n){var i=r["spans_"+t.id],o=0;t.iter(Math.max(t.first,e),Math.min(t.first+t.size,n),function(e){e.markedSpans&&((i||(i=r["spans_"+t.id]={}))[o]=e.markedSpans),++o})}function Hi(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function Ei(e,t){var r=function(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=[],i=0;i<t.text.length;++i)n.push(Hi(r[i]));return n}(e,t),n=Ae(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],l=n[i];if(o&&l)e:for(var s=0;s<l.length;++s){for(var a=l[s],c=0;c<o.length;++c)if(o[c].marker==a.marker)continue e;o.push(a)}else l&&(r[i]=l)}return r}function Ii(e,t,r){for(var n=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)n.push(r?mi.prototype.deepCopy.call(o):o);else{var l=o.changes,s=[];n.push({changes:s});for(var a=0;a<l.length;++a){var c=l[a],u=void 0;if(s.push({from:c.from,to:c.to,text:c.text}),t)for(var f in c)(u=f.match(/^spans_(\d+)$/))&&-1<I(t,Number(u[1]))&&(X(s)[f]=c[f],delete c[f])}}}return n}function Bi(e,t,r,n){if(n){var i=e.anchor;if(r){var o=ve(t,i)<0;o!=ve(r,i)<0?(i=t,t=r):o!=ve(t,r)<0&&(t=r)}return new vi(i,t)}return new vi(r||t,t)}function Ri(e,t,r,n,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Vi(e,new mi([Bi(e.sel.primary(),t,r,i)],0),n)}function Ui(e,t,r){for(var n=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)n[o]=Bi(e.sel.ranges[o],t[o],null,i);Vi(e,yi(n,e.sel.primIndex),r)}function ji(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,Vi(e,yi(i,e.sel.primIndex),n)}function Gi(e,t,r,n){Vi(e,bi(t,r),n)}function Ki(e,t,r){var n=e.history.done,i=X(n);i&&i.ranges?$i(e,n[n.length-1]=t,r):Vi(e,t,r)}function Vi(e,t,r){$i(e,t,r),zi(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function $i(e,t,r){var n,i,o,l;(st(e,"beforeSelectionChange")||e.cm&&st(e.cm,"beforeSelectionChange"))&&(n=e,o=r,l={ranges:(i=t).ranges,update:function(e){this.ranges=[];for(var t=0;t<e.length;t++)this.ranges[t]=new vi(ke(n,e[t].anchor),ke(n,e[t].head))},origin:o&&o.origin},it(n,"beforeSelectionChange",n,l),n.cm&&it(n.cm,"beforeSelectionChange",n.cm,l),t=l.ranges!=i.ranges?yi(l.ranges,l.ranges.length-1):i),Xi(e,Zi(e,t,r&&r.bias||(ve(t.primary().head,e.sel.primary().head)<0?-1:1),!0)),r&&!1===r.scroll||!e.cm||Sn(e.cm)}function Xi(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,lt(e.cm)),sr(e,"cursorActivity",e))}function Yi(e){Xi(e,Zi(e,e.sel,null,!1))}function Zi(e,t,r,n){for(var i,o=0;o<t.ranges.length;o++){var l=t.ranges[o],s=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],a=Ji(e,l.anchor,s&&s.anchor,r,n),c=Ji(e,l.head,s&&s.head,r,n);(i||a!=l.anchor||c!=l.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new vi(a,c))}return i?yi(i,t.primIndex):t}function Qi(e,t,r,n,i){var o=ae(e,t.line);if(o.markedSpans)for(var l=0;l<o.markedSpans.length;++l){var s=o.markedSpans[l],a=s.marker;if((null==s.from||(a.inclusiveLeft?s.from<=t.ch:s.from<t.ch))&&(null==s.to||(a.inclusiveRight?s.to>=t.ch:s.to>t.ch))){if(i&&(it(a,"beforeCursorEnter"),a.explicitlyCleared)){if(o.markedSpans){--l;continue}break}if(!a.atomic)continue;if(r){var c=a.find(n<0?1:-1),u=void 0;if((n<0?a.inclusiveRight:a.inclusiveLeft)&&(c=eo(e,c,-n,c&&c.line==t.line?o:null)),c&&c.line==t.line&&(u=ve(c,r))&&(n<0?u<0:0<u))return Qi(e,c,t,n,i)}var f=a.find(n<0?-1:1);return(n<0?a.inclusiveLeft:a.inclusiveRight)&&(f=eo(e,f,n,f.line==t.line?o:null)),f?Qi(e,f,t,n,i):null}}return t}function Ji(e,t,r,n,i){var o=n||1,l=Qi(e,t,r,o,i)||!i&&Qi(e,t,r,o,!0)||Qi(e,t,r,-o,i)||!i&&Qi(e,t,r,-o,!0);return l||(e.cantEdit=!0,me(e.first,0))}function eo(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?ke(e,me(t.line-1)):null:0<r&&t.ch==(n||ae(e,t.line)).text.length?t.line<e.first+e.size-1?me(t.line+1,0):null:new me(t.line,t.ch+r)}function to(e){e.setSelection(me(e.firstLine(),0),me(e.lastLine()),U)}function ro(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,r,n){e&&(o.from=ke(i,e)),t&&(o.to=ke(i,t)),r&&(o.text=r),void 0!==n&&(o.origin=n)}),it(i,"beforeChange",i,o),i.cm&&it(i.cm,"beforeChange",i.cm,o),o.canceled?null:{from:o.from,to:o.to,text:o.text,origin:o.origin}}function no(e,t,r){if(e.cm){if(!e.cm.curOp)return Vn(e.cm,no)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(st(e,"beforeChange")||e.cm&&st(e.cm,"beforeChange"))||(t=ro(e,t,!0))){var n=Se&&!r&&function(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&-1!=I(n,r)||(n||(n=[])).push(r)}}),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var l=n[o],s=l.find(0),a=0;a<i.length;++a){var c=i[a];if(!(ve(c.to,s.from)<0||0<ve(c.from,s.to))){var u=[a,1],f=ve(c.from,s.from),d=ve(c.to,s.to);(f<0||!l.inclusiveLeft&&!f)&&u.push({from:c.from,to:s.from}),(0<d||!l.inclusiveRight&&!d)&&u.push({from:s.to,to:c.to}),i.splice.apply(i,u),a+=u.length-3}}return i}(e,t.from,t.to);if(n)for(var i=n.length-1;0<=i;--i)io(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text,origin:t.origin});else io(e,t)}}function io(e,r){if(1!=r.text.length||""!=r.text[0]||0!=ve(r.from,r.to)){var t=wi(e,r);Pi(e,r,t,e.cm?e.cm.curOp.id:NaN),so(e,r,t,Ae(e,r));var n=[];Mi(e,function(e,t){t||-1!=I(n,e.history)||(fo(e.history,r),n.push(e.history)),so(e,r,null,Ae(e,r))})}}function oo(i,o,e){var t=i.cm&&i.cm.state.suppressEdits;if(!t||e){for(var l,r=i.history,n=i.sel,s="undo"==o?r.done:r.undone,a="undo"==o?r.undone:r.done,c=0;c<s.length&&(l=s[c],e?!l.ranges||l.equals(i.sel):l.ranges);c++);if(c!=s.length){for(r.lastOrigin=r.lastSelOrigin=null;;){if(!(l=s.pop()).ranges){if(t)return void s.push(l);break}if(Fi(l,a),e&&!l.equals(i.sel))return void Vi(i,l,{clearRedo:!1});n=l}var u=[];Fi(n,a),a.push({changes:u,generation:r.generation}),r.generation=l.generation||++r.maxGeneration;for(var f=st(i,"beforeChange")||i.cm&&st(i.cm,"beforeChange"),d=function(e){var r=l.changes[e];if(r.origin=o,f&&!ro(i,r,!1))return s.length=0,{};u.push(Oi(i,r));var t=e?wi(i,r):X(s);so(i,r,t,Ei(i,r)),!e&&i.cm&&i.cm.scrollIntoView({from:r.from,to:_i(r)});var n=[];Mi(i,function(e,t){t||-1!=I(n,e.history)||(fo(e.history,r),n.push(e.history)),so(e,r,null,Ei(e,r))})},h=l.changes.length-1;0<=h;--h){var p=d(h);if(p)return p.v}}}}function lo(e,t){if(0!=t&&(e.first+=t,e.sel=new mi(Y(e.sel.ranges,function(e){return new vi(me(e.anchor.line+t,e.anchor.ch),me(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Yn(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)Zn(e.cm,n,"gutter")}}function so(e,t,r,n){if(e.cm&&!e.cm.curOp)return Vn(e.cm,so)(e,t,r,n);if(t.to.line<e.first)lo(e,t.text.length-1-(t.to.line-t.from.line));else if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);lo(e,i),t={from:me(e.first,0),to:me(t.to.line+i,t.to.ch),text:[X(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:me(o,ae(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=ce(e,t.from,t.to),r||(r=wi(e,t)),e.cm?function(e,t,r){var n=e.doc,i=e.display,o=t.from,l=t.to,s=!1,a=o.line;e.options.lineWrapping||(a=de(Re(ae(n,o.line))),n.iter(a,l.line+1,function(e){if(e==i.maxLine)return s=!0}));-1<n.sel.contains(t.from,t.to)&&lt(e);Ti(n,t,r,nn(e)),e.options.lineWrapping||(n.iter(a,o.line+t.text.length,function(e){var t=$e(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 r=e.first,n=t-1;r<n;n--){var i=ae(e,n).stateAfter;if(i&&(!(i instanceof zt)||n+i.lookAhead<t)){r=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}})(n,o.line),ti(e,400);var c=t.text.length-(l.line-o.line)-1;t.full?Yn(e):o.line!=l.line||1!=t.text.length||Li(e.doc,t)?Yn(e,o.line,l.line+1,c):Zn(e,o.line,"text");var u=st(e,"changes"),f=st(e,"change");if(f||u){var d={from:o,to:l,text:t.text,removed:t.removed,origin:t.origin};f&&sr(e,"change",e,d),u&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(d)}e.display.selForContextMenu=null}(e.cm,t,n):Ti(e,t,n),$i(e,r,U)}}function ao(e,t,r,n,i){var o;(n||(n=r),ve(n,r)<0)&&(r=(o=[n,r])[0],n=o[1]);"string"==typeof t&&(t=e.splitLines(t)),no(e,{from:r,to:n,text:t,origin:i})}function co(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function uo(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],l=!0;if(o.ranges){o.copied||((o=e[i]=o.deepCopy()).copied=!0);for(var s=0;s<o.ranges.length;s++)co(o.ranges[s].anchor,t,r,n),co(o.ranges[s].head,t,r,n)}else{for(var a=0;a<o.changes.length;++a){var c=o.changes[a];if(r<c.from.line)c.from=me(c.from.line+n,c.from.ch),c.to=me(c.to.line+n,c.to.ch);else if(t<=c.to.line){l=!1;break}}l||(e.splice(0,i+1),i=0)}}}function fo(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;uo(e.done,r,n,i),uo(e.undone,r,n,i)}function ho(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=ae(e,we(e,t)):i=de(t),null==i?null:(n(o,i)&&e.cm&&Zn(e.cm,i,r),o)}function po(e){this.lines=e,this.parent=null;for(var t=0,r=0;r<e.length;++r)e[r].parent=this,t+=e[r].height;this.height=t}function go(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var i=e[n];t+=i.chunkSize(),r+=i.height,i.parent=this}this.size=t,this.height=r,this.parent=null}vi.prototype.from=function(){return xe(this.anchor,this.head)},vi.prototype.to=function(){return _e(this.anchor,this.head)},vi.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},po.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r,n=e,i=e+t;n<i;++n){var o=this.lines[n];this.height-=o.height,(r=o).parent=null,Oe(r),sr(o,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;e<n;++e)if(r(this.lines[e]))return!0}},go.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],i=n.chunkSize();if(e<i){var o=Math.min(t,i-e),l=n.height;if(n.removeInner(e,o),this.height-=l-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(1<this.children.length||!(this.children[0]instanceof po))){var s=[];this.collapse(s),this.children=[new po(s)],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,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<=o){if(i.insertInner(e,t,r),i.lines&&50<i.lines.length){for(var l=i.lines.length%25+25,s=l;s<i.lines.length;){var a=new po(i.lines.slice(s,s+=25));i.height-=a.height,this.children.splice(++n,0,a),a.parent=this}i.lines=i.lines.slice(0,l),this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=new go(e.children.splice(e.children.length-5,5));if(e.parent){e.size-=t.size,e.height-=t.height;var r=I(e.parent.children,e);e.parent.children.splice(r+1,0,t)}else{var n=new go(e.children);(n.parent=e).children=[n,t],e=n}t.parent=e.parent}while(10<e.children.length);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<o){var l=Math.min(t,o-e);if(i.iterN(e,l,r))return!0;if(0==(t-=l))break;e=0}else e-=o}}};var mo=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t};function vo(e,t,r){Ve(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Cn(e,r)}mo.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=de(r);if(null!=n&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(r.widgets=null);var o=br(this);fe(r,Math.max(0,r.height-o)),e&&(Kn(e,function(){vo(e,r,-o),Zn(e,n,"widget")}),sr(e,"lineWidgetCleared",e,this,n))}},mo.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line;this.height=null;var i=br(this)-t;i&&(fe(n,n.height+i),r&&Kn(r,function(){r.curOp.forceUpdate=!0,vo(r,n,i),sr(r,"lineWidgetChanged",r,e,de(n))}))},at(mo);var yo=0,bo=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++yo};function _o(t,n,i,e,r){if(e&&e.shared)return function(e,r,n,i,o){(i=q(i)).shared=!1;var l=[_o(e,r,n,i,o)],s=l[0],a=i.widgetNode;return Mi(e,function(e){a&&(i.widgetNode=a.cloneNode(!0)),l.push(_o(e,ke(e,r),ke(e,n),i,o));for(var t=0;t<e.linked.length;++t)if(e.linked[t].isParent)return;s=X(l)}),new xo(l,s)}(t,n,i,e,r);if(t.cm&&!t.cm.curOp)return Vn(t.cm,_o)(t,n,i,e,r);var o=new bo(t,r),l=ve(n,i);if(e&&q(e,o,!1),0<l||0==l&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=N("span",[o.replacedWith],"CodeMirror-widget"),e.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),e.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Be(t,n.line,n,i,o)||n.line!=i.line&&Be(t,i.line,n,i,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Le=!0}o.addToHistory&&Pi(t,{from:n,to:i,origin:"markText"},t.sel,NaN);var s,a=n.line,c=t.cm;if(t.iter(a,i.line+1,function(e){var t,r;c&&o.collapsed&&!c.options.lineWrapping&&Re(e)==c.display.maxLine&&(s=!0),o.collapsed&&a!=n.line&&fe(e,0),t=e,r=new Te(o,a==n.line?n.ch:null,a==i.line?i.ch:null),t.markedSpans=t.markedSpans?t.markedSpans.concat([r]):[r],r.marker.attachLine(t),++a}),o.collapsed&&t.iter(n.line,i.line+1,function(e){Ge(t,e)&&fe(e,0)}),o.clearOnEnter&&tt(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(Se=!0,(t.history.done.length||t.history.undone.length)&&t.clearHistory()),o.collapsed&&(o.id=++yo,o.atomic=!0),c){if(s&&(c.curOp.updateMaxLine=!0),o.collapsed)Yn(c,n.line,i.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var u=n.line;u<=i.line;u++)Zn(c,u,"text");o.atomic&&Yi(c.doc),sr(c,"markerAdded",c,o)}return o}bo.prototype.clear=function(){var e=this;if(!this.explicitlyCleared){var t=this.doc.cm,r=t&&!t.curOp;if(r&&In(t),st(this,"clear")){var n=this.find();n&&sr(this,"clear",n.from,n.to)}for(var i=null,o=null,l=0;l<this.lines.length;++l){var s=e.lines[l],a=Me(s.markedSpans,e);t&&!e.collapsed?Zn(t,de(s),"text"):t&&(null!=a.to&&(o=de(s)),null!=a.from&&(i=de(s))),s.markedSpans=Ne(s.markedSpans,a),null==a.from&&e.collapsed&&!Ge(e.doc,s)&&t&&fe(s,Jr(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var c=0;c<this.lines.length;++c){var u=Re(e.lines[c]),f=$e(u);f>t.display.maxLineLength&&(t.display.maxLine=u,t.display.maxLineLength=f,t.display.maxLineChanged=!0)}null!=i&&t&&this.collapsed&&Yn(t,i,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&Yi(t.doc)),t&&sr(t,"markerCleared",t,this,i,o),r&&Bn(t),this.parent&&this.parent.clear()}},bo.prototype.find=function(e,t){var r,n;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i<this.lines.length;++i){var o=this.lines[i],l=Me(o.markedSpans,this);if(null!=l.from&&(r=me(t?o:de(o),l.from),-1==e))return r;if(null!=l.to&&(n=me(t?o:de(o),l.to),1==e))return n}return r&&{from:r,to:n}},bo.prototype.changed=function(){var o=this,l=this.find(-1,!0),s=this,a=this.doc.cm;l&&a&&Kn(a,function(){var e=l.line,t=de(l.line),r=Nr(a,t);if(r&&(Fr(r),a.curOp.selectionChanged=a.curOp.forceUpdate=!0),a.curOp.updateMaxLine=!0,!Ge(s.doc,e)&&null!=s.height){var n=s.height;s.height=null;var i=br(s)-n;i&&fe(e,e.height+i)}sr(a,"markerChanged",a,o)})},bo.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=I(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},bo.prototype.detachLine=function(e){if(this.lines.splice(I(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},at(bo);var xo=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};function wo(e){return e.findMarks(me(e.first,0),e.clipPos(me(e.lastLine())),function(e){return e.parent})}function ko(o){for(var e=function(e){var t=o[e],r=[t.primary.doc];Mi(t.primary.doc,function(e){return r.push(e)});for(var n=0;n<t.markers.length;n++){var i=t.markers[n];-1==I(r,i.doc)&&(i.parent=null,t.markers.splice(n--,1))}},t=0;t<o.length;t++)e(t)}xo.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();sr(this,"clear")}},xo.prototype.find=function(e,t){return this.primary.find(e,t)},at(xo);var Co=0,So=function(e,t,r,n,i){if(!(this instanceof So))return new So(e,t,r,n,i);null==r&&(r=0),go.call(this,[new po([new Vt("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var o=me(r,0);this.sel=bi(o),this.history=new Di(null),this.id=++Co,this.modeOption=t,this.lineSep=n,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),Ti(this,{from:o,to:o,text:e}),Vi(this,bi(o),U)};So.prototype=Q(go.prototype,{constructor:So,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=ue(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:Xn(function(e){var t=me(this.first,0),r=this.first+this.size-1;no(this,{from:t,to:me(r,ae(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Ln(this.cm,0,0),Vi(this,bi(t),U)}),replaceRange:function(e,t,r,n){ao(this,e,t=ke(this,t),r=r?ke(this,r):t,n)},getRange:function(e,t,r){var n=ce(this,ke(this,e),ke(this,t));return!1===r?n:n.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(pe(this,e))return ae(this,e)},getLineNumber:function(e){return de(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=ae(this,e)),Re(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ke(this,e)},getCursor:function(e){var t=this.sel.primary();return null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Xn(function(e,t,r){Gi(this,ke(this,"number"==typeof e?me(e,t||0):e),null,r)}),setSelection:Xn(function(e,t,r){Gi(this,ke(this,e),ke(this,t||e),r)}),extendSelection:Xn(function(e,t,r){Ri(this,ke(this,e),t&&ke(this,t),r)}),extendSelections:Xn(function(e,t){Ui(this,Ce(this,e),t)}),extendSelectionsBy:Xn(function(e,t){Ui(this,Ce(this,Y(this.sel.ranges,e)),t)}),setSelections:Xn(function(e,t,r){if(e.length){for(var n=[],i=0;i<e.length;i++)n[i]=new vi(ke(this,e[i].anchor),ke(this,e[i].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Vi(this,yi(n,t),r)}}),addSelection:Xn(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new vi(ke(this,e),ke(this,t||e))),Vi(this,yi(n,n.length-1),r)}),getSelection:function(e){for(var t,r=this.sel.ranges,n=0;n<r.length;n++){var i=ce(this,r[n].from(),r[n].to());t=t?t.concat(i):i}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var i=ce(this,r[n].from(),r[n].to());!1!==e&&(i=i.join(e||this.lineSeparator())),t[n]=i}return t},replaceSelection:function(e,t,r){for(var n=[],i=0;i<this.sel.ranges.length;i++)n[i]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:Xn(function(e,t,r){for(var n=[],i=this.sel,o=0;o<i.ranges.length;o++){var l=i.ranges[o];n[o]={from:l.from(),to:l.to(),text:this.splitLines(e[o]),origin:r}}for(var s=t&&"end"!=t&&function(e,t,r){for(var n=[],i=me(e.first,0),o=i,l=0;l<t.length;l++){var s=t[l],a=ki(s.from,i,o),c=ki(_i(s),i,o);if(i=s.to,o=c,"around"==r){var u=e.sel.ranges[l],f=ve(u.head,u.anchor)<0;n[l]=new vi(f?c:a,f?a:c)}else n[l]=new vi(a,a)}return new mi(n,e.sel.primIndex)}(this,n,t),a=n.length-1;0<=a;a--)no(this,n[a]);s?Ki(this,s):this.cm&&Sn(this.cm)}),undo:Xn(function(){oo(this,"undo")}),redo:Xn(function(){oo(this,"redo")}),undoSelection:Xn(function(){oo(this,"undo",!0)}),redoSelection:Xn(function(){oo(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){this.history=new Di(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Ii(this.history.done),undone:Ii(this.history.undone)}},setHistory:function(e){var t=this.history=new Di(this.history.maxGeneration);t.done=Ii(e.done.slice(0),null,!0),t.undone=Ii(e.undone.slice(0),null,!0)},setGutterMarker:Xn(function(e,r,n){return ho(this,e,"gutter",function(e){var t=e.gutterMarkers||(e.gutterMarkers={});return!(t[r]=n)&&re(t)&&(e.gutterMarkers=null),!0})}),clearGutter:Xn(function(t){var r=this;this.iter(function(e){e.gutterMarkers&&e.gutterMarkers[t]&&ho(r,e,"gutter",function(){return e.gutterMarkers[t]=null,re(e.gutterMarkers)&&(e.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!pe(this,e))return null;if(!(e=ae(this,t=e)))return null}else if(null==(t=de(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:Xn(function(e,r,n){return ho(this,e,"gutter"==r?"gutter":"class",function(e){var t="text"==r?"textClass":"background"==r?"bgClass":"gutter"==r?"gutterClass":"wrapClass";if(e[t]){if(C(n).test(e[t]))return!1;e[t]+=" "+n}else e[t]=n;return!0})}),removeLineClass:Xn(function(e,o,l){return ho(this,e,"gutter"==o?"gutter":"class",function(e){var t="text"==o?"textClass":"background"==o?"bgClass":"gutter"==o?"gutterClass":"wrapClass",r=e[t];if(!r)return!1;if(null==l)e[t]=null;else{var n=r.match(C(l));if(!n)return!1;var i=n.index+n[0].length;e[t]=r.slice(0,n.index)+(n.index&&i!=r.length?" ":"")+r.slice(i)||null}return!0})}),addLineWidget:Xn(function(e,t,r){return i=e,o=new mo(n=this,t,r),(l=n.cm)&&o.noHScroll&&(l.display.alignWidgets=!0),ho(n,i,"widget",function(e){var t=e.widgets||(e.widgets=[]);if(null==o.insertAt?t.push(o):t.splice(Math.min(t.length-1,Math.max(0,o.insertAt)),0,o),o.line=e,l&&!Ge(n,e)){var r=Ve(e)<n.scrollTop;fe(e,e.height+br(o)),r&&Cn(l,o.height),l.curOp.forceUpdate=!0}return!0}),l&&sr(l,"lineWidgetAdded",l,o,"number"==typeof i?i:de(i)),o;var n,i,o,l}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return _o(this,ke(this,e),ke(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return _o(this,e=ke(this,e),e,r,"bookmark")},findMarksAt:function(e){var t=[],r=ae(this,(e=ke(this,e)).line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(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,l){i=ke(this,i),o=ke(this,o);var s=[],a=i.line;return this.iter(i.line,o.line+1,function(e){var t=e.markedSpans;if(t)for(var r=0;r<t.length;r++){var n=t[r];null!=n.to&&a==i.line&&i.ch>=n.to||null==n.from&&a!=i.line||null!=n.from&&a==o.line&&n.from>=o.ch||l&&!l(n.marker)||s.push(n.marker.parent||n.marker)}++a}),s},getAllMarks:function(){var n=[];return this.iter(function(e){var t=e.markedSpans;if(t)for(var r=0;r<t.length;++r)null!=t[r].from&&n.push(t[r].marker)}),n},posFromIndex:function(r){var n,i=this.first,o=this.lineSeparator().length;return this.iter(function(e){var t=e.text.length+o;if(r<t)return n=r,!0;r-=t,++i}),ke(this,me(i,n))},indexFromPos:function(e){var t=(e=ke(this,e)).ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,function(e){t+=e.text.length+r}),t},copy:function(e){var t=new So(ue(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<r&&(r=e.to);var n=new So(ue(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),o=e.clipPos(i.from),l=e.clipPos(i.to);if(ve(o,l)){var s=_o(e,o,l,n.primary,n.primary.type);n.markers.push(s),s.parent=n}}}(n,wo(this)),n},unlinkDoc:function(e){if(e instanceof wl&&(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),ko(wo(this));break}}if(e.history==this.history){var r=[e.id];Mi(e,function(e){return r.push(e.id)},!0),e.history=new Di(null),e.history.done=Ii(this.history.done,r),e.history.undone=Ii(this.history.undone,r)}},iterLinkedDocs:function(e){Mi(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):xt(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:Xn(function(e){var t;("rtl"!=e&&(e="ltr"),e!=this.direction)&&(this.direction=e,this.iter(function(e){return e.order=null}),this.cm&&Kn(t=this.cm,function(){Ai(t),Yn(t)}))})}),So.prototype.eachLine=So.prototype.iter;var Lo=0;function To(e){var i=this;if(Mo(i),!ot(i,e)&&!_r(i.display,e)){ct(e),x&&(Lo=+new Date);var o=ln(i,e,!0),t=e.dataTransfer.files;if(o&&!i.isReadOnly())if(t&&t.length&&window.FileReader&&window.File)for(var l=t.length,s=Array(l),a=0,r=function(e,r){if(!i.options.allowDropFileTypes||-1!=I(i.options.allowDropFileTypes,e.type)){var n=new FileReader;n.onload=Vn(i,function(){var e=n.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),s[r]=e,++a==l){var t={from:o=ke(i.doc,o),to:o,text:i.doc.splitLines(s.join(i.doc.lineSeparator())),origin:"paste"};no(i.doc,t),Ki(i.doc,bi(o,_i(t)))}}),n.readAsText(e)}},n=0;n<l;++n)r(t[n],n);else{if(i.state.draggingText&&-1<i.doc.sel.contains(o))return i.state.draggingText(e),void setTimeout(function(){return i.display.input.focus()},20);try{var c=e.dataTransfer.getData("Text");if(c){var u;if(i.state.draggingText&&!i.state.draggingText.copy&&(u=i.listSelections()),$i(i.doc,bi(o,o)),u)for(var f=0;f<u.length;++f)ao(i.doc,"",u[f].anchor,u[f].head,"drag");i.replaceSelection(c,"around","paste"),i.display.input.focus()}}catch(e){}}}}function Mo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function No(e){if(document.getElementsByClassName)for(var t=document.getElementsByClassName("CodeMirror"),r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&e(n)}}var Ao=!1;function Do(){var e;Ao||(tt(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,No(Oo)},100))}),tt(window,"blur",function(){return No(vn)}),Ao=!0)}function Oo(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Wo={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:"/",127:"Delete",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Po=0;Po<10;Po++)Wo[Po+48]=Wo[Po+96]=String(Po);for(var zo=65;zo<=90;zo++)Wo[zo]=String.fromCharCode(zo);for(var Fo=1;Fo<=12;Fo++)Wo[Fo+111]=Wo[Fo+63235]="F"+Fo;var qo={};function Ho(e){var t,r,n,i,o=e.split(/-(?!$)/);e=o[o.length-1];for(var l=0;l<o.length-1;l++){var s=o[l];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))r=!0;else{if(!/^s(hift)?$/i.test(s))throw new Error("Unrecognized modifier name: "+s);n=!0}}return t&&(e="Alt-"+e),r&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Eo(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if("..."==n){delete e[r];continue}for(var i=Y(r.split(" "),Ho),o=0;o<i.length;o++){var l=void 0,s=void 0;l=o==i.length-1?(s=i.join(" "),n):(s=i.slice(0,o+1).join(" "),"...");var a=t[s];if(a){if(a!=l)throw new Error("Inconsistent bindings for "+s)}else t[s]=l}delete e[r]}for(var c in t)e[c]=t[c];return e}function Io(e,t,r,n){var i=(t=jo(t)).call?t.call(e,n):t[e];if(!1===i)return"nothing";if("..."===i)return"multi";if(null!=i&&r(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return Io(e,t.fallthrough,r,n);for(var o=0;o<t.fallthrough.length;o++){var l=Io(e,t.fallthrough[o],r,n);if(l)return l}}}function Bo(e){var t="string"==typeof e?e:Wo[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function Ro(e,t,r){var n=e;return t.altKey&&"Alt"!=n&&(e="Alt-"+e),(y?t.metaKey:t.ctrlKey)&&"Ctrl"!=n&&(e="Ctrl-"+e),(y?t.ctrlKey:t.metaKey)&&"Cmd"!=n&&(e="Cmd-"+e),!r&&t.shiftKey&&"Shift"!=n&&(e="Shift-"+e),e}function Uo(e,t){if(m&&34==e.keyCode&&e.char)return!1;var r=Wo[e.keyCode];return null!=r&&!e.altGraphKey&&(3==e.keyCode&&e.code&&(r=e.code),Ro(r,e,t))}function jo(e){return"string"==typeof e?qo[e]:e}function Go(t,e){for(var r=t.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=e(r[i]);n.length&&ve(o.from,X(n).to)<=0;){var l=n.pop();if(ve(l.from,o.from)<0){o.from=l.from;break}}n.push(o)}Kn(t,function(){for(var e=n.length-1;0<=e;e--)ao(t.doc,"",n[e].from,n[e].to,"+delete");Sn(t)})}function Ko(e,t,r){var n=oe(e.text,t+r,r);return n<0||n>e.text.length?null:n}function Vo(e,t,r){var n=Ko(e,t.ch,r);return null==n?null:new me(t.line,n,r<0?"after":"before")}function $o(e,t,r,n,i){if(e){var o=Je(r,t.doc.direction);if(o){var l,s=i<0?X(o):o[0],a=i<0==(1==s.level)?"after":"before";if(0<s.level||"rtl"==t.doc.direction){var c=Ar(t,r);l=i<0?r.text.length-1:0;var u=Dr(t,c,l).top;l=le(function(e){return Dr(t,c,e).top==u},i<0==(1==s.level)?s.from:s.to-1,l),"before"==a&&(l=Ko(r,l,1))}else l=i<0?s.to:s.from;return new me(n,l,a)}}return new me(n,i<0?r.text.length:0,i<0?"before":"after")}qo.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"},qo.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"},qo.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},qo.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"]},qo.default=_?qo.macDefault:qo.pcDefault;var Xo={selectAll:to,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),U)},killLine:function(r){return Go(r,function(e){if(e.empty()){var t=ae(r.doc,e.head.line).text.length;return e.head.ch==t&&e.head.line<r.lastLine()?{from:e.head,to:me(e.head.line+1,0)}:{from:e.head,to:me(e.head.line,t)}}return{from:e.from(),to:e.to()}})},deleteLine:function(t){return Go(t,function(e){return{from:me(e.from().line,0),to:ke(t.doc,me(e.to().line+1,0))}})},delLineLeft:function(e){return Go(e,function(e){return{from:me(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(r){return Go(r,function(e){var t=r.charCoords(e.head,"div").top+5;return{from:r.coordsChar({left:0,top:t},"div"),to:e.from()}})},delWrappedLineRight:function(n){return Go(n,function(e){var t=n.charCoords(e.head,"div").top+5,r=n.coordsChar({left:n.display.lineDiv.offsetWidth+100,top:t},"div");return{from:e.from(),to:r}})},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(me(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(me(e.lastLine()))},goLineStart:function(t){return t.extendSelectionsBy(function(e){return Yo(t,e.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(t){return t.extendSelectionsBy(function(e){return Zo(t,e.head)},{origin:"+move",bias:1})},goLineEnd:function(t){return t.extendSelectionsBy(function(e){return function(e,t){var r=ae(e.doc,t),n=function(e){for(var t;t=Ee(e);)e=t.find(1,!0).line;return e}(r);n!=r&&(t=de(n));return $o(!0,e,r,t,-1)}(t,e.head.line)},{origin:"+move",bias:-1})},goLineRight:function(r){return r.extendSelectionsBy(function(e){var t=r.cursorCoords(e.head,"div").top+5;return r.coordsChar({left:r.display.lineDiv.offsetWidth+100,top:t},"div")},G)},goLineLeft:function(r){return r.extendSelectionsBy(function(e){var t=r.cursorCoords(e.head,"div").top+5;return r.coordsChar({left:0,top:t},"div")},G)},goLineLeftSmart:function(n){return n.extendSelectionsBy(function(e){var t=n.cursorCoords(e.head,"div").top+5,r=n.coordsChar({left:0,top:t},"div");return r.ch<n.getLine(r.line).search(/\S/)?Zo(n,e.head):r},G)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"char")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,i=0;i<r.length;i++){var o=r[i].from(),l=H(e.getLine(o.line),o.ch,n);t.push($(n-l%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(l){return Kn(l,function(){for(var e=l.listSelections(),t=[],r=0;r<e.length;r++)if(e[r].empty()){var n=e[r].head,i=ae(l.doc,n.line).text;if(i)if(n.ch==i.length&&(n=new me(n.line,n.ch-1)),0<n.ch)n=new me(n.line,n.ch+1),l.replaceRange(i.charAt(n.ch-1)+i.charAt(n.ch-2),me(n.line,n.ch-2),n,"+transpose");else if(n.line>l.doc.first){var o=ae(l.doc,n.line-1).text;o&&(n=new me(n.line,1),l.replaceRange(i.charAt(0)+l.doc.lineSeparator()+o.charAt(o.length-1),me(n.line-1,o.length-1),n,"+transpose"))}t.push(new vi(n,n))}l.setSelections(t)})},newlineAndIndent:function(n){return Kn(n,function(){for(var e=n.listSelections(),t=e.length-1;0<=t;t--)n.replaceRange(n.doc.lineSeparator(),e[t].anchor,e[t].head,"+input");e=n.listSelections();for(var r=0;r<e.length;r++)n.indentLine(e[r].from().line,null,!0);Sn(n)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Yo(e,t){var r=ae(e.doc,t),n=Re(r);return n!=r&&(t=de(n)),$o(!0,e,n,t,1)}function Zo(e,t){var r=Yo(e,t.line),n=ae(e.doc,r.line),i=Je(n,e.doc.direction);if(i&&0!=i[0].level)return r;var o=Math.max(0,n.text.search(/\S/)),l=t.line==r.line&&t.ch<=o&&t.ch;return me(r.line,l?0:o,r.sticky)}function Qo(e,t,r){if("string"==typeof t&&!(t=Xo[t]))return!1;e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=R}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}var Jo=new E;function el(e,t,r,n){var i=e.state.keySeq;if(i){if(Bo(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Jo.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),tl(e,i+" "+t,r,n))return!0}return tl(e,t,r,n)}function tl(e,t,r,n){var i=function(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=Io(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&Io(t,e.options.extraKeys,r,e)||Io(t,e.options.keyMap,r,e)}(e,t,n);return"multi"==i&&(e.state.keySeq=t),"handled"==i&&sr(e,"keyHandled",e,t,r),"handled"!=i&&"multi"!=i||(ct(r),hn(e)),!!i}function rl(t,e){var r=Uo(e,!0);return!!r&&(e.shiftKey&&!t.state.keySeq?el(t,"Shift-"+r,e,function(e){return Qo(t,e,!0)})||el(t,r,e,function(e){if("string"==typeof e?/^go[A-Z]/.test(e):e.motion)return Qo(t,e)}):el(t,r,e,function(e){return Qo(t,e)}))}var nl=null;function il(e){var t=this;if(t.curOp.focus=O(),!ot(t,e)){x&&w<11&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var n=rl(t,e);m&&(nl=n?r:null,!n&&88==r&&!kt&&(_?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||function(e){var t=e.display.lineDiv;function r(e){18!=e.keyCode&&e.altKey||(L(t,"CodeMirror-crosshair"),nt(document,"keyup",r),nt(document,"mouseover",r))}W(t,"CodeMirror-crosshair"),tt(document,"keyup",r),tt(document,"mouseover",r)}(t)}}function ol(e){16==e.keyCode&&(this.doc.sel.shift=!1),ot(this,e)}function ll(e){var t=this;if(!(_r(t.display,e)||ot(t,e)||e.ctrlKey&&!e.altKey||_&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(m&&r==nl)return nl=null,void ct(e);if(!m||e.which&&!(e.which<10)||!rl(t,e)){var i,o=String.fromCharCode(null==n?r:n);if("\b"!=o)if(!el(i=t,"'"+o+"'",e,function(e){return Qo(i,e,!0)}))t.display.input.onKeyPress(e)}}}var sl,al,cl=function(e,t,r){this.time=e,this.pos=t,this.button=r};function ul(e){var t=this,r=t.display;if(!(ot(t,e)||r.activeTouch&&r.input.supportsTouch()))if(r.input.ensurePolled(),r.shift=e.shiftKey,_r(r,e))b||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));else if(!hl(t,e)){var n,i,o,l=ln(t,e),s=pt(e),a=l?(n=l,i=s,o=+new Date,al&&al.compare(o,n,i)?(sl=al=null,"triple"):sl&&sl.compare(o,n,i)?(al=new cl(o,n,i),sl=null,"double"):(sl=new cl(o,n,i),al=null,"single")):"single";window.focus(),1==s&&t.state.selectingText&&t.state.selectingText(e),l&&function(r,e,n,t,i){var o="Click";"double"==t?o="Double"+o:"triple"==t&&(o="Triple"+o);return el(r,Ro(o=(1==e?"Left":2==e?"Middle":"Right")+o,i),i,function(e){if("string"==typeof e&&(e=Xo[e]),!e)return!1;var t=!1;try{r.isReadOnly()&&(r.state.suppressEdits=!0),t=e(r,n)!=R}finally{r.state.suppressEdits=!1}return t})}(t,s,l,a,e)||(1==s?l?function(e,t,r,n){x?setTimeout(F(pn,e),0):e.curOp.focus=O();var i,o=function(e,t,r){var n=e.getOption("configureMouse"),i=n?n(e,t,r):{};if(null==i.unit){var o=h?r.shiftKey&&r.metaKey:r.altKey;i.unit=o?"rectangle":"single"==t?"char":"double"==t?"word":"line"}(null==i.extend||e.doc.extend)&&(i.extend=e.doc.extend||r.shiftKey);null==i.addNew&&(i.addNew=_?r.metaKey:r.ctrlKey);null==i.moveOnDrag&&(i.moveOnDrag=!(_?r.altKey:r.ctrlKey));return i}(e,r,n),l=e.doc.sel;e.options.dragDrop&&vt&&!e.isReadOnly()&&"single"==r&&-1<(i=l.contains(t))&&(ve((i=l.ranges[i]).from(),t)<0||0<t.xRel)&&(0<ve(i.to(),t)||t.xRel<0)?function(t,r,n,i){var o=t.display,l=!1,s=Vn(t,function(e){b&&(o.scroller.draggable=!1),t.state.draggingText=!1,nt(o.wrapper.ownerDocument,"mouseup",s),nt(o.wrapper.ownerDocument,"mousemove",a),nt(o.scroller,"dragstart",c),nt(o.scroller,"drop",s),l||(ct(e),i.addNew||Ri(t.doc,n,null,null,i.extend),b||x&&9==w?setTimeout(function(){o.wrapper.ownerDocument.body.focus(),o.input.focus()},20):o.input.focus())}),a=function(e){l=l||10<=Math.abs(r.clientX-e.clientX)+Math.abs(r.clientY-e.clientY)},c=function(){return l=!0};b&&(o.scroller.draggable=!0);(t.state.draggingText=s).copy=!i.moveOnDrag,o.scroller.dragDrop&&o.scroller.dragDrop();tt(o.wrapper.ownerDocument,"mouseup",s),tt(o.wrapper.ownerDocument,"mousemove",a),tt(o.scroller,"dragstart",c),tt(o.scroller,"drop",s),gn(t),setTimeout(function(){return o.input.focus()},20)}(e,n,t,o):function(m,e,v,y){var l=m.display,b=m.doc;ct(e);var _,x,w=b.sel,t=w.ranges;y.addNew&&!y.extend?(x=b.sel.contains(v),_=-1<x?t[x]:new vi(v,v)):(_=b.sel.primary(),x=b.sel.primIndex);if("rectangle"==y.unit)y.addNew||(_=new vi(v,v)),v=ln(m,e,!0,!0),x=-1;else{var r=fl(m,v,y.unit);_=y.extend?Bi(_,r.anchor,r.head,y.extend):r}y.addNew?-1==x?(x=t.length,Vi(b,yi(t.concat([_]),x),{scroll:!1,origin:"*mouse"})):1<t.length&&t[x].empty()&&"char"==y.unit&&!y.extend?(Vi(b,yi(t.slice(0,x).concat(t.slice(x+1)),0),{scroll:!1,origin:"*mouse"}),w=b.sel):ji(b,x,_,j):(Vi(b,new mi([_],x=0),j),w=b.sel);var k=v;function s(e){if(0!=ve(k,e))if(k=e,"rectangle"==y.unit){for(var t=[],r=m.options.tabSize,n=H(ae(b,v.line).text,v.ch,r),i=H(ae(b,e.line).text,e.ch,r),o=Math.min(n,i),l=Math.max(n,i),s=Math.min(v.line,e.line),a=Math.min(m.lastLine(),Math.max(v.line,e.line));s<=a;s++){var c=ae(b,s).text,u=K(c,o,r);o==l?t.push(new vi(me(s,u),me(s,u))):c.length>u&&t.push(new vi(me(s,u),me(s,K(c,l,r))))}t.length||t.push(new vi(v,v)),Vi(b,yi(w.ranges.slice(0,x).concat(t),x),{origin:"*mouse",scroll:!1}),m.scrollIntoView(e)}else{var f,d=_,h=fl(m,e,y.unit),p=d.anchor;p=0<ve(h.anchor,p)?(f=h.head,xe(d.from(),h.anchor)):(f=h.anchor,_e(d.to(),h.head));var g=w.ranges.slice(0);g[x]=function(e,t){var r=t.anchor,n=t.head,i=ae(e.doc,r.line);if(0==ve(r,n)&&r.sticky==n.sticky)return t;var o=Je(i);if(!o)return t;var l=Ze(o,r.ch,r.sticky),s=o[l];if(s.from!=r.ch&&s.to!=r.ch)return t;var a,c=l+(s.from==r.ch==(1!=s.level)?0:1);if(0==c||c==o.length)return t;if(n.line!=r.line)a=0<(n.line-r.line)*("ltr"==e.doc.direction?1:-1);else{var u=Ze(o,n.ch,n.sticky),f=u-l||(n.ch-r.ch)*(1==s.level?-1:1);a=u==c-1||u==c?f<0:0<f}var d=o[c+(a?-1:0)],h=a==(1==d.level),p=h?d.from:d.to,g=h?"after":"before";return r.ch==p&&r.sticky==g?t:new vi(new me(r.line,p,g),n)}(m,new vi(ke(b,p),f)),Vi(b,yi(g,x),j)}}var a=l.wrapper.getBoundingClientRect(),c=0;function n(e){m.state.selectingText=!1,c=1/0,ct(e),l.input.focus(),nt(l.wrapper.ownerDocument,"mousemove",i),nt(l.wrapper.ownerDocument,"mouseup",o),b.history.lastSelOrigin=null}var i=Vn(m,function(e){0!==e.buttons&&pt(e)?function e(t){var r=++c;var n=ln(m,t,!0,"rectangle"==y.unit);if(!n)return;if(0!=ve(n,k)){m.curOp.focus=O(),s(n);var i=_n(l,b);(n.line>=i.to||n.line<i.from)&&setTimeout(Vn(m,function(){c==r&&e(t)}),150)}else{var o=t.clientY<a.top?-20:t.clientY>a.bottom?20:0;o&&setTimeout(Vn(m,function(){c==r&&(l.scroller.scrollTop+=o,e(t))}),50)}}(e):n(e)}),o=Vn(m,n);m.state.selectingText=o,tt(l.wrapper.ownerDocument,"mousemove",i),tt(l.wrapper.ownerDocument,"mouseup",o)}(e,n,t,o)}(t,l,a,e):ht(e)==r.scroller&&ct(e):2==s?(l&&Ri(t.doc,l),setTimeout(function(){return r.input.focus()},20)):3==s&&(k?pl(t,e):gn(t)))}}function fl(e,t,r){if("char"==r)return new vi(t,t);if("word"==r)return e.findWordAt(t);if("line"==r)return new vi(me(t.line,0),ke(e.doc,me(t.line+1,0)));var n=r(e,t);return new vi(n.from,n.to)}function dl(e,t,r,n){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&ct(t);var l=e.display,s=l.lineDiv.getBoundingClientRect();if(o>s.bottom||!st(e,r))return ft(t);o-=s.top-l.viewOffset;for(var a=0;a<e.options.gutters.length;++a){var c=l.gutters.childNodes[a];if(c&&c.getBoundingClientRect().right>=i)return it(e,r,e,he(e.doc,o),e.options.gutters[a],t),ft(t)}}function hl(e,t){return dl(e,t,"gutterClick",!0)}function pl(e,t){var r,n;_r(e.display,t)||(n=t,st(r=e,"gutterContextMenu")&&dl(r,n,"gutterContextMenu",!1))||(ot(e,t,"contextmenu")||e.display.input.onContextMenu(t))}function gl(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Hr(e)}cl.prototype.compare=function(e,t,r){return this.time+400>e&&0==ve(t,this.pos)&&r==this.button};var ml={toString:function(){return"CodeMirror.Init"}},vl={},yl={};function bl(e){ci(e),Yn(e),xn(e)}function _l(e,t,r){if(!t!=!(r&&r!=ml)){var n=e.display.dragFunctions,i=t?tt:nt;i(e.display.scroller,"dragstart",n.start),i(e.display.scroller,"dragenter",n.enter),i(e.display.scroller,"dragover",n.over),i(e.display.scroller,"dragleave",n.leave),i(e.display.scroller,"drop",n.drop)}}function xl(e){e.options.lineWrapping?(W(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(L(e.display.wrapper,"CodeMirror-wrap"),Xe(e)),on(e),Yn(e),Hr(e),setTimeout(function(){return zn(e)},100)}function wl(e,t){var r=this;if(!(this instanceof wl))return new wl(e,t);this.options=t=t?q(t):{},q(vl,t,!1),ui(t);var n=t.value;"string"==typeof n&&(n=new So(n,t.mode,null,t.lineSeparator,t.direction)),this.doc=n;var i=new wl.inputStyles[t.inputStyle](this),o=this.display=new se(e,n,i);for(var l in ci(o.wrapper.CodeMirror=this),gl(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Hn(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 E,keySeq:null,specialChars:null},t.autofocus&&!d&&o.input.focus(),x&&w<11&&setTimeout(function(){return r.display.input.reset(!0)},20),function(i){var o=i.display;tt(o.scroller,"mousedown",Vn(i,ul)),tt(o.scroller,"dblclick",x&&w<11?Vn(i,function(e){if(!ot(i,e)){var t=ln(i,e);if(t&&!hl(i,e)&&!_r(i.display,e)){ct(e);var r=i.findWordAt(t);Ri(i.doc,r.anchor,r.head)}}}):function(e){return ot(i,e)||ct(e)});k||tt(o.scroller,"contextmenu",function(e){return pl(i,e)});var r,n={end:0};function l(){o.activeTouch&&(r=setTimeout(function(){return o.activeTouch=null},1e3),(n=o.activeTouch).end=+new Date)}function s(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return 400<r*r+n*n}tt(o.scroller,"touchstart",function(e){if(!ot(i,e)&&!function(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(e)&&!hl(i,e)){o.input.ensurePolled(),clearTimeout(r);var t=+new Date;o.activeTouch={start:t,moved:!1,prev:t-n.end<=300?n:null},1==e.touches.length&&(o.activeTouch.left=e.touches[0].pageX,o.activeTouch.top=e.touches[0].pageY)}}),tt(o.scroller,"touchmove",function(){o.activeTouch&&(o.activeTouch.moved=!0)}),tt(o.scroller,"touchend",function(e){var t=o.activeTouch;if(t&&!_r(o,e)&&null!=t.left&&!t.moved&&new Date-t.start<300){var r,n=i.coordsChar(o.activeTouch,"page");r=!t.prev||s(t,t.prev)?new vi(n,n):!t.prev.prev||s(t,t.prev.prev)?i.findWordAt(n):new vi(me(n.line,0),ke(i.doc,me(n.line+1,0))),i.setSelection(r.anchor,r.head),i.focus(),ct(e)}l()}),tt(o.scroller,"touchcancel",l),tt(o.scroller,"scroll",function(){o.scroller.clientHeight&&(Nn(i,o.scroller.scrollTop),Dn(i,o.scroller.scrollLeft,!0),it(i,"scroll",i))}),tt(o.scroller,"mousewheel",function(e){return gi(i,e)}),tt(o.scroller,"DOMMouseScroll",function(e){return gi(i,e)}),tt(o.wrapper,"scroll",function(){return o.wrapper.scrollTop=o.wrapper.scrollLeft=0}),o.dragFunctions={enter:function(e){ot(i,e)||dt(e)},over:function(e){ot(i,e)||(!function(e,t){var r=ln(e,t);if(r){var n=document.createDocumentFragment();un(e,r,n),e.display.dragCursor||(e.display.dragCursor=A("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),M(e.display.dragCursor,n)}}(i,e),dt(e))},start:function(e){return function(e,t){if(x&&(!e.state.draggingText||+new Date-Lo<100))dt(t);else if(!ot(e,t)&&!_r(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!a)){var r=A("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",m&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),m&&r.parentNode.removeChild(r)}}(i,e)},drop:Vn(i,To),leave:function(e){ot(i,e)||Mo(i)}};var e=o.input.getField();tt(e,"keyup",function(e){return ol.call(i,e)}),tt(e,"keydown",Vn(i,il)),tt(e,"keypress",Vn(i,ll)),tt(e,"focus",function(e){return mn(i,e)}),tt(e,"blur",function(e){return vn(i,e)})}(this),Do(),In(this),this.curOp.forceUpdate=!0,Ni(this,n),t.autofocus&&!d||this.hasFocus()?setTimeout(F(mn,this),20):vn(this),yl)yl.hasOwnProperty(l)&&yl[l](r,t[l],ml);wn(this),t.finishInit&&t.finishInit(this);for(var s=0;s<kl.length;++s)kl[s](r);Bn(this),b&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}wl.defaults=vl,wl.optionHandlers=yl;var kl=[];function Cl(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=Et(e,t).state:r="prev");var l=e.options.tabSize,s=ae(o,t),a=H(s.text,null,l);s.stateAfter&&(s.stateAfter=null);var c,u=s.text.match(/^\s*/)[0];if(n||/\S/.test(s.text)){if("smart"==r&&((c=o.mode.indent(i,s.text.slice(u.length),s.text))==R||150<c)){if(!n)return;r="prev"}}else c=0,r="not";"prev"==r?c=t>o.first?H(ae(o,t-1).text,null,l):0:"add"==r?c=a+e.options.indentUnit:"subtract"==r?c=a-e.options.indentUnit:"number"==typeof r&&(c=a+r),c=Math.max(0,c);var f="",d=0;if(e.options.indentWithTabs)for(var h=Math.floor(c/l);h;--h)d+=l,f+="\t";if(d<c&&(f+=$(c-d)),f!=u)return ao(o,f,me(t,0),me(t,u.length),"+input"),!(s.stateAfter=null);for(var p=0;p<o.sel.ranges.length;p++){var g=o.sel.ranges[p];if(g.head.line==t&&g.head.ch<u.length){var m=me(t,u.length);ji(o,p,new vi(m,m));break}}}wl.defineInitHook=function(e){return kl.push(e)};var Sl=null;function Ll(e){Sl=e}function Tl(e,t,r,n,i){var o=e.doc;e.display.shift=!1,n||(n=o.sel);var l,s=e.state.pasteIncoming||"paste"==i,a=xt(t),c=null;if(s&&1<n.ranges.length)if(Sl&&Sl.text.join("\n")==t){if(n.ranges.length%Sl.text.length==0){c=[];for(var u=0;u<Sl.text.length;u++)c.push(o.splitLines(Sl.text[u]))}}else a.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(c=Y(a,function(e){return[e]}));for(var f=n.ranges.length-1;0<=f;f--){var d=n.ranges[f],h=d.from(),p=d.to();d.empty()&&(r&&0<r?h=me(h.line,h.ch-r):e.state.overwrite&&!s?p=me(p.line,Math.min(ae(o,p.line).text.length,p.ch+X(a).length)):Sl&&Sl.lineWise&&Sl.text.join("\n")==t&&(h=p=me(h.line,0))),l=e.curOp.updateInput;var g={from:h,to:p,text:c?c[f%c.length]:a,origin:i||(s?"paste":e.state.cutIncoming?"cut":"+input")};no(e.doc,g),sr(e,"inputRead",e,g)}t&&!s&&Nl(e,t),Sn(e),e.curOp.updateInput=l,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function Ml(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Kn(t,function(){return Tl(t,r,0,null,"paste")}),!0}function Nl(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;0<=n;n--){var i=r.ranges[n];if(!(100<i.head.ch||n&&r.ranges[n-1].head.line==i.head.line)){var o=e.getModeAt(i.head),l=!1;if(o.electricChars){for(var s=0;s<o.electricChars.length;s++)if(-1<t.indexOf(o.electricChars.charAt(s))){l=Cl(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(ae(e.doc,i.head.line).text.slice(0,i.head.ch))&&(l=Cl(e,i.head.line,"smart"));l&&sr(e,"electricInput",e,i.head.line)}}}function Al(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var i=e.doc.sel.ranges[n].head.line,o={anchor:me(i,0),head:me(i+1,0)};r.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:r}}function Dl(e,t){e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck",!!t)}function Ol(){var e=A("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=A("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return b?e.style.width="1000px":e.setAttribute("wrap","off"),u&&(e.style.border="1px solid black"),Dl(e),t}function Wl(n,i,o,e,l){var t=i,r=o,s=ae(n,i.line);function a(e){var t,r;if(null==(t=l?function(t,r,s,e){var a=Je(r,t.doc.direction);if(!a)return Vo(r,s,e);s.ch>=r.text.length?(s.ch=r.text.length,s.sticky="before"):s.ch<=0&&(s.ch=0,s.sticky="after");var n=Ze(a,s.ch,s.sticky),i=a[n];if("ltr"==t.doc.direction&&i.level%2==0&&(0<e?i.to>s.ch:i.from<s.ch))return Vo(r,s,e);var o,c=function(e,t){return Ko(r,e instanceof me?e.ch:e,t)},l=function(e){return t.options.lineWrapping?(o=o||Ar(t,r),Yr(t,r,o,e)):{begin:0,end:r.text.length}},u=l("before"==s.sticky?c(s,-1):s.ch);if("rtl"==t.doc.direction||1==i.level){var f=1==i.level==e<0,d=c(s,f?1:-1);if(null!=d&&(f?d<=i.to&&d<=u.end:d>=i.from&&d>=u.begin)){var h=f?"before":"after";return new me(s.line,d,h)}}var p=function(e,t,r){for(var n=function(e,t){return t?new me(s.line,c(e,1),"before"):new me(s.line,e,"after")};0<=e&&e<a.length;e+=t){var i=a[e],o=0<t==(1!=i.level),l=o?r.begin:c(r.end,-1);if(i.from<=l&&l<i.to)return n(l,o);if(l=o?i.from:c(i.to,-1),r.begin<=l&&l<r.end)return n(l,o)}},g=p(n+e,e,u);if(g)return g;var m=0<e?u.end:c(u.begin,-1);return null==m||0<e&&m==r.text.length||!(g=p(0<e?0:a.length-1,e,l(m)))?null:g}(n.cm,s,i,o):Vo(s,i,o))){if(e||(r=i.line+o)<n.first||r>=n.first+n.size||(i=new me(r,i.ch,i.sticky),!(s=ae(n,r))))return!1;i=$o(l,n.cm,s,i.line,o)}else i=t;return!0}if("char"==e)a();else if("column"==e)a(!0);else if("word"==e||"group"==e)for(var c=null,u="group"==e,f=n.cm&&n.cm.getHelper(i,"wordChars"),d=!0;!(o<0)||a(!d);d=!1){var h=s.text.charAt(i.ch)||"\n",p=te(h,f)?"w":u&&"\n"==h?"n":!u||/\s/.test(h)?null:"p";if(!u||d||p||(p="s"),c&&c!=p){o<0&&(o=1,a(),i.sticky="after");break}if(p&&(c=p),0<o&&!a(!d))break}var g=Ji(n,i,t,r,!0);return ye(t,g)&&(g.hitSide=!0),g}function Pl(e,t,r,n){var i,o,l=e.doc,s=t.left;if("page"==n){var a=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),c=Math.max(a-.5*Jr(e.display),3);i=(0<r?t.bottom:t.top)+r*c}else"line"==n&&(i=0<r?t.bottom+3:t.top-3);for(;(o=$r(e,s,i)).outside;){if(r<0?i<=0:i>=l.height){o.hitSide=!0;break}i+=5*r}return o}var zl=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new E,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Fl(e,t){var r=Nr(e,t.line);if(!r||r.hidden)return null;var n=ae(e.doc,t.line),i=Tr(r,n,t.line),o=Je(n,e.doc.direction),l="left";o&&(l=Ze(o,t.ch)%2?"right":"left");var s=Pr(i.map,t.ch,l);return s.offset="right"==s.collapse?s.end:s.start,s}function ql(e,t){return t&&(e.bad=!0),e}function Hl(e,t,r){var n;if(t==e.display.lineDiv){if(!(n=e.display.lineDiv.childNodes[r]))return ql(e.clipPos(me(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==n)return El(o,t,r)}}function El(c,e,t){var r=c.text.firstChild,n=!1;if(!e||!D(r,e))return ql(me(de(c.line),0),!0);if(e==r&&(n=!0,e=r.childNodes[t],t=0,!e)){var i=c.rest?X(c.rest):c.line;return ql(me(de(i),i.text.length),n)}var o=3==e.nodeType?e:null,l=e;for(o||1!=e.childNodes.length||3!=e.firstChild.nodeType||(o=e.firstChild,t&&(t=o.nodeValue.length));l.parentNode!=r;)l=l.parentNode;var u=c.measure,f=u.maps;function s(e,t,r){for(var n=-1;n<(f?f.length:0);n++)for(var i=n<0?u.map:f[n],o=0;o<i.length;o+=3){var l=i[o+2];if(l==e||l==t){var s=de(n<0?c.line:c.rest[n]),a=i[o]+r;return(r<0||l!=e)&&(a=i[o+(r?1:0)]),me(s,a)}}}var a=s(o,l,t);if(a)return ql(a,n);for(var d=l.nextSibling,h=o?o.nodeValue.length-t:0;d;d=d.nextSibling){if(a=s(d,d.firstChild,0))return ql(me(a.line,a.ch-h),n);h+=d.textContent.length}for(var p=l.previousSibling,g=t;p;p=p.previousSibling){if(a=s(p,p.firstChild,-1))return ql(me(a.line,a.ch+g),n);g+=p.textContent.length}}zl.prototype.init=function(e){var t=this,l=this,s=l.cm,a=l.div=e.lineDiv;function r(e){if(!ot(s,e)){if(s.somethingSelected())Ll({lineWise:!1,text:s.getSelections()}),"cut"==e.type&&s.replaceSelection("",null,"cut");else{if(!s.options.lineWiseCopyCut)return;var t=Al(s);Ll({lineWise:!0,text:t.text}),"cut"==e.type&&s.operation(function(){s.setSelections(t.ranges,0,U),s.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var r=Sl.text.join("\n");if(e.clipboardData.setData("Text",r),e.clipboardData.getData("Text")==r)return void e.preventDefault()}var n=Ol(),i=n.firstChild;s.display.lineSpace.insertBefore(n,s.display.lineSpace.firstChild),i.value=Sl.text.join("\n");var o=document.activeElement;z(i),setTimeout(function(){s.display.lineSpace.removeChild(n),o.focus(),o==a&&l.showPrimarySelection()},50)}}Dl(a,s.options.spellcheck),tt(a,"paste",function(e){ot(s,e)||Ml(e,s)||w<=11&&setTimeout(Vn(s,function(){return t.updateFromDOM()}),20)}),tt(a,"compositionstart",function(e){t.composing={data:e.data,done:!1}}),tt(a,"compositionupdate",function(e){t.composing||(t.composing={data:e.data,done:!1})}),tt(a,"compositionend",function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),tt(a,"touchstart",function(){return l.forceCompositionEnd()}),tt(a,"input",function(){t.composing||t.readFromDOMSoon()}),tt(a,"copy",r),tt(a,"cut",r)},zl.prototype.prepareSelection=function(){var e=cn(this.cm,!1);return e.focus=this.cm.state.focused,e},zl.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},zl.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},zl.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),n=r.from(),i=r.to();if(t.display.viewTo==t.display.viewFrom||n.line>=t.display.viewTo||i.line<t.display.viewFrom)e.removeAllRanges();else{var o=Hl(t,e.anchorNode,e.anchorOffset),l=Hl(t,e.focusNode,e.focusOffset);if(!o||o.bad||!l||l.bad||0!=ve(xe(o,l),n)||0!=ve(_e(o,l),i)){var s=t.display.view,a=n.line>=t.display.viewFrom&&Fl(t,n)||{node:s[0].measure.map[2],offset:0},c=i.line<t.display.viewTo&&Fl(t,i);if(!c){var u=s[s.length-1].measure,f=u.maps?u.maps[u.maps.length-1]:u.map;c={node:f[f.length-1],offset:f[f.length-2]-f[f.length-3]}}if(a&&c){var d,h=e.rangeCount&&e.getRangeAt(0);try{d=S(a.node,a.offset,c.offset,c.node)}catch(e){}d&&(!g&&t.state.focused?(e.collapse(a.node,a.offset),d.collapsed||(e.removeAllRanges(),e.addRange(d))):(e.removeAllRanges(),e.addRange(d)),h&&null==e.anchorNode?e.addRange(h):g&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},zl.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)},zl.prototype.showMultipleSelections=function(e){M(this.cm.display.cursorDiv,e.cursors),M(this.cm.display.selectionDiv,e.selection)},zl.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},zl.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return D(this.div,t)},zl.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())},zl.prototype.blur=function(){this.div.blur()},zl.prototype.getField=function(){return this.div},zl.prototype.supportsTouch=function(){return!0},zl.prototype.receivedFocus=function(){var t=this;this.selectionInEditor()?this.pollSelection():Kn(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))})},zl.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},zl.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=this.getSelection(),t=this.cm;if(f&&l&&this.cm.options.gutters.length&&function(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}(e.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var r=Hl(t,e.anchorNode,e.anchorOffset),n=Hl(t,e.focusNode,e.focusOffset);r&&n&&Kn(t,function(){Vi(t.doc,bi(r,n),U),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})}}},zl.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e,t,r,n=this.cm,i=n.display,o=n.doc.sel.primary(),l=o.from(),s=o.to();if(0==l.ch&&l.line>n.firstLine()&&(l=me(l.line-1,ae(n.doc,l.line-1).length)),s.ch==ae(n.doc,s.line).text.length&&s.line<n.lastLine()&&(s=me(s.line+1,0)),l.line<i.viewFrom||s.line>i.viewTo-1)return!1;r=l.line==i.viewFrom||0==(e=sn(n,l.line))?(t=de(i.view[0].line),i.view[0].node):(t=de(i.view[e].line),i.view[e-1].node.nextSibling);var a,c,u=sn(n,s.line);if(c=u==i.view.length-1?(a=i.viewTo-1,i.lineDiv.lastChild):(a=de(i.view[u+1].line)-1,i.view[u+1].node.previousSibling),!r)return!1;for(var f=n.doc.splitLines(function(a,e,t,c,u){var r="",f=!1,d=a.doc.lineSeparator(),h=!1;function p(){f&&(r+=d,h&&(r+=d),f=h=!1)}function g(e){e&&(p(),r+=e)}function m(e){if(1==e.nodeType){var t=e.getAttribute("cm-text");if(t)return void g(t);var r,n=e.getAttribute("cm-marker");if(n){var i=a.findMarks(me(c,0),me(u+1,0),(s=+n,function(e){return e.id==s}));return void(i.length&&(r=i[0].find(0))&&g(ce(a.doc,r.from,r.to).join(d)))}if("false"==e.getAttribute("contenteditable"))return;var o=/^(pre|div|p|li|table|br)$/i.test(e.nodeName);if(!/^br$/i.test(e.nodeName)&&0==e.textContent.length)return;o&&p();for(var l=0;l<e.childNodes.length;l++)m(e.childNodes[l]);/^(pre|p)$/i.test(e.nodeName)&&(h=!0),o&&(f=!0)}else 3==e.nodeType&&g(e.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "));var s}for(;m(e),e!=t;)e=e.nextSibling,h=!1;return r}(n,r,c,t,a)),d=ce(n.doc,me(t,0),me(a,ae(n.doc,a).text.length));1<f.length&&1<d.length;)if(X(f)==X(d))f.pop(),d.pop(),a--;else{if(f[0]!=d[0])break;f.shift(),d.shift(),t++}for(var h=0,p=0,g=f[0],m=d[0],v=Math.min(g.length,m.length);h<v&&g.charCodeAt(h)==m.charCodeAt(h);)++h;for(var y=X(f),b=X(d),_=Math.min(y.length-(1==f.length?h:0),b.length-(1==d.length?h:0));p<_&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p;if(1==f.length&&1==d.length&&t==l.line)for(;h&&h>l.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)h--,p++;f[f.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),f[0]=f[0].slice(h).replace(/\u200b+$/,"");var x=me(t,h),w=me(a,d.length?X(d).length-p:0);return 1<f.length||f[0]||ve(x,w)?(ao(n.doc,f,x,w,"+input"),!0):void 0},zl.prototype.ensurePolled=function(){this.forceCompositionEnd()},zl.prototype.reset=function(){this.forceCompositionEnd()},zl.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},zl.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))},zl.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Kn(this.cm,function(){return Yn(e.cm)})},zl.prototype.setUneditable=function(e){e.contentEditable="false"},zl.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Vn(this.cm,Tl)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},zl.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},zl.prototype.onContextMenu=function(){},zl.prototype.resetPosition=function(){},zl.prototype.needsContentAttribute=!0;var Il,Bl,Rl,Ul=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new E,this.hasSelection=!1,this.composing=null};Ul.prototype.init=function(t){var e=this,r=this,n=this.cm;this.createField(t);var i=this.textarea;function o(e){if(!ot(n,e)){if(n.somethingSelected())Ll({lineWise:!1,text:n.getSelections()});else{if(!n.options.lineWiseCopyCut)return;var t=Al(n);Ll({lineWise:!0,text:t.text}),"cut"==e.type?n.setSelections(t.ranges,null,U):(r.prevInput="",i.value=t.text.join("\n"),z(i))}"cut"==e.type&&(n.state.cutIncoming=!0)}}t.wrapper.insertBefore(this.wrapper,t.wrapper.firstChild),u&&(i.style.width="0px"),tt(i,"input",function(){x&&9<=w&&e.hasSelection&&(e.hasSelection=null),r.poll()}),tt(i,"paste",function(e){ot(n,e)||Ml(e,n)||(n.state.pasteIncoming=!0,r.fastPoll())}),tt(i,"cut",o),tt(i,"copy",o),tt(t.scroller,"paste",function(e){_r(t,e)||ot(n,e)||(n.state.pasteIncoming=!0,r.focus())}),tt(t.lineSpace,"selectstart",function(e){_r(t,e)||ct(e)}),tt(i,"compositionstart",function(){var e=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}}),tt(i,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},Ul.prototype.createField=function(e){this.wrapper=Ol(),this.textarea=this.wrapper.firstChild},Ul.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=cn(e);if(e.options.moveInputWithCursor){var i=Gr(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+l.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+l.left-o.left))}return n},Ul.prototype.showSelection=function(e){var t=this.cm.display;M(t.cursorDiv,e.cursors),M(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Ul.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&z(this.textarea),x&&9<=w&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",x&&9<=w&&(this.hasSelection=null))}},Ul.prototype.getField=function(){return this.textarea},Ul.prototype.supportsTouch=function(){return!1},Ul.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!d||O()!=this.textarea))try{this.textarea.focus()}catch(e){}},Ul.prototype.blur=function(){this.textarea.blur()},Ul.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ul.prototype.receivedFocus=function(){this.slowPoll()},Ul.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Ul.prototype.fastPoll=function(){var t=!1,r=this;r.pollingFast=!0,r.polling.set(20,function e(){r.poll()||t?(r.pollingFast=!1,r.slowPoll()):(t=!0,r.polling.set(60,e))})},Ul.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||wt(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=r.value;if(i==n&&!t.somethingSelected())return!1;if(x&&9<=w&&this.hasSelection===i||_&&/[\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||n||(n="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var l=0,s=Math.min(n.length,i.length);l<s&&n.charCodeAt(l)==i.charCodeAt(l);)++l;return Kn(t,function(){Tl(t,i.slice(l),n.length-l,null,e.composing?"*compose":null),1e3<i.length||-1<i.indexOf("\n")?r.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},Ul.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ul.prototype.onKeyPress=function(){x&&9<=w&&(this.hasSelection=null),this.fastPoll()},Ul.prototype.onContextMenu=function(e){var r=this,n=r.cm,i=n.display,o=r.textarea,t=ln(n,e),l=i.scroller.scrollTop;if(t&&!m){n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(t)&&Vn(n,Vi)(n.doc,bi(t),U);var s=o.style.cssText,a=r.wrapper.style.cssText;r.wrapper.style.cssText="position: absolute";var c,u=r.wrapper.getBoundingClientRect();if(o.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-u.top-5)+"px; left: "+(e.clientX-u.left-5)+"px;\n z-index: 1000; background: "+(x?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",b&&(c=window.scrollY),i.input.focus(),b&&window.scrollTo(null,c),i.input.reset(),n.somethingSelected()||(o.value=r.prevInput=" "),r.contextMenuPending=!0,i.selForContextMenu=n.doc.sel,clearTimeout(i.detectingSelectAll),x&&9<=w&&d(),k){dt(e);var f=function(){nt(window,"mouseup",f),setTimeout(h,20)};tt(window,"mouseup",f)}else setTimeout(h,50)}function d(){if(null!=o.selectionStart){var e=n.somethingSelected(),t="​"+(e?o.value:"");o.value="⇚",o.value=t,r.prevInput=e?"":"​",o.selectionStart=1,o.selectionEnd=t.length,i.selForContextMenu=n.doc.sel}}function h(){if(r.contextMenuPending=!1,r.wrapper.style.cssText=a,o.style.cssText=s,x&&w<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=l),null!=o.selectionStart){(!x||x&&w<9)&&d();var e=0,t=function(){i.selForContextMenu==n.doc.sel&&0==o.selectionStart&&0<o.selectionEnd&&"​"==r.prevInput?Vn(n,to)(n):e++<10?i.detectingSelectAll=setTimeout(t,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(t,200)}}},Ul.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},Ul.prototype.setUneditable=function(){},Ul.prototype.needsContentAttribute=!1,function(i){var o=i.optionHandlers;function e(e,t,n,r){i.defaults[e]=t,n&&(o[e]=r?function(e,t,r){r!=ml&&n(e,t,r)}:n)}i.defineOption=e,i.Init=ml,e("value","",function(e,t){return e.setValue(t)},!0),e("mode",null,function(e,t){e.doc.modeOption=t,Ci(e)},!0),e("indentUnit",2,Ci,!0),e("indentWithTabs",!1),e("smartIndent",!0),e("tabSize",4,function(e){Si(e),Hr(e),Yn(e)},!0),e("lineSeparator",null,function(e,n){if(e.doc.lineSep=n){var i=[],o=e.doc.first;e.doc.iter(function(e){for(var t=0;;){var r=e.text.indexOf(n,t);if(-1==r)break;t=r+n.length,i.push(me(o,r))}o++});for(var t=i.length-1;0<=t;t--)ao(e.doc,n,i[t],me(i[t].line,i[t].ch+n.length))}}),e("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t,r){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),r!=ml&&e.refresh()}),e("specialCharPlaceholder",Qt,function(e){return e.refresh()},!0),e("electricChars",!0),e("inputStyle",d?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),e("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),e("rtlMoveVisually",!p),e("wholeLineUpdateBefore",!0),e("theme","default",function(e){gl(e),bl(e)},!0),e("keyMap","default",function(e,t,r){var n=jo(t),i=r!=ml&&jo(r);i&&i.detach&&i.detach(e,n),n.attach&&n.attach(e,i||null)}),e("extraKeys",null),e("configureMouse",null),e("lineWrapping",!1,xl,!0),e("gutters",[],function(e){ui(e.options),bl(e)},!0),e("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?rn(e.display)+"px":"0",e.refresh()},!0),e("coverGutterNextToScrollbar",!1,function(e){return zn(e)},!0),e("scrollbarStyle","native",function(e){Hn(e),zn(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),e("lineNumbers",!1,function(e){ui(e.options),bl(e)},!0),e("firstLineNumber",1,bl,!0),e("lineNumberFormatter",function(e){return e},bl,!0),e("showCursorWhenSelecting",!1,an,!0),e("resetSelectionOnContextMenu",!0),e("lineWiseCopyCut",!0),e("pasteLinesPerSelection",!0),e("readOnly",!1,function(e,t){"nocursor"==t&&(vn(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),e("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),e("dragDrop",!0,_l),e("allowDropFileTypes",null),e("cursorBlinkRate",530),e("cursorScrollMargin",0),e("cursorHeight",1,an,!0),e("singleCursorHeightPerLine",!0,an,!0),e("workTime",100),e("workDelay",100),e("flattenSpans",!0,Si,!0),e("addModeClass",!1,Si,!0),e("pollInterval",100),e("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),e("historyEventDelay",1250),e("viewportMargin",10,function(e){return e.refresh()},!0),e("maxHighlightLength",1e4,Si,!0),e("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),e("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),e("autofocus",null),e("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0)}(wl),Bl=(Il=wl).optionHandlers,Rl=Il.helpers={},Il.prototype={constructor:Il,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var r=this.options,n=r[e];r[e]==t&&"mode"!=e||(r[e]=t,Bl.hasOwnProperty(e)&&Vn(this,Bl[e])(this,t,n),it(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"](jo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;r<t.length;++r)if(t[r]==e||t[r].name==e)return t.splice(r,1),!0},addOverlay:$n(function(e,t){var r=e.token?e:Il.getMode(this.options,e);if(r.startState)throw new Error("Overlays may not be stateful.");!function(e,t,r){for(var n=0,i=r(t);n<e.length&&r(e[n])<=i;)n++;e.splice(n,0,t)}(this.state.overlays,{mode:r,modeSpec:e,opaque:t&&t.opaque,priority:t&&t.priority||0},function(e){return e.priority}),this.state.modeGen++,Yn(this)}),removeOverlay:$n(function(e){for(var t=this.state.overlays,r=0;r<t.length;++r){var n=t[r].modeSpec;if(n==e||"string"==typeof e&&n.name==e)return t.splice(r,1),this.state.modeGen++,void Yn(this)}}),indentLine:$n(function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),pe(this.doc,e)&&Cl(this,e,t,r)}),indentSelection:$n(function(e){for(var t=this,r=this.doc.sel.ranges,n=-1,i=0;i<r.length;i++){var o=r[i];if(o.empty())o.head.line>n&&(Cl(t,o.head.line,e,!0),n=o.head.line,i==t.doc.sel.primIndex&&Sn(t));else{var l=o.from(),s=o.to(),a=Math.max(n,l.line);n=Math.min(t.lastLine(),s.line-(s.ch?0:1))+1;for(var c=a;c<n;++c)Cl(t,c,e);var u=t.doc.sel.ranges;0==l.ch&&r.length==u.length&&0<u[i].from().ch&&ji(t.doc,i,new vi(l,u[i].to()),U)}}}),getTokenAt:function(e,t){return jt(this,e,t)},getLineTokens:function(e,t){return jt(this,me(e),t,!0)},getTokenTypeAt:function(e){e=ke(this.doc,e);var t,r=Ht(this,ae(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var l=n+i>>1;if((l?r[2*l-1]:0)>=o)i=l;else{if(!(r[2*l+1]<o)){t=r[2*l+2];break}n=l+1}}var s=t?t.indexOf("overlay "):-1;return s<0?t:0==s?null:t.slice(0,s-1)},getModeAt:function(e){var t=this.doc.mode;return t.innerMode?Il.innerMode(t,this.getTokenAt(e).state).mode:t},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!Rl.hasOwnProperty(t))return r;var n=Rl[t],i=this.getModeAt(e);if("string"==typeof i[t])n[i[t]]&&r.push(n[i[t]]);else if(i[t])for(var o=0;o<i[t].length;o++){var l=n[i[t][o]];l&&r.push(l)}else i.helperType&&n[i.helperType]?r.push(n[i.helperType]):n[i.name]&&r.push(n[i.name]);for(var s=0;s<n._global.length;s++){var a=n._global[s];a.pred(i,this)&&-1==I(r,a.val)&&r.push(a.val)}return r},getStateAfter:function(e,t){var r=this.doc;return Et(this,(e=we(r,null==e?r.first+r.size-1:e))+1,t).state},cursorCoords:function(e,t){var r=this.doc.sel.primary();return Gr(this,null==e?r.head:"object"==typeof e?ke(this.doc,e):e?r.from():r.to(),t||"page")},charCoords:function(e,t){return jr(this,ke(this.doc,e),t||"page")},coordsChar:function(e,t){return $r(this,(e=Ur(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=Ur(this,{top:e,left:0},t||"page").top,he(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,r){var n,i=!1;if("number"==typeof e){var o=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:o<e&&(e=o,i=!0),n=ae(this.doc,e)}else n=e;return Rr(this,n,{top:0,left:0},t||"page",r||i).top+(i?this.doc.height-Ve(n):0)},defaultTextHeight:function(){return Jr(this.display)},defaultCharWidth:function(){return en(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o,l,s,a=this.display,c=(e=Gr(this,ke(this.doc,e))).bottom,u=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),a.sizer.appendChild(t),"over"==n)c=e.top;else if("above"==n||"near"==n){var f=Math.max(a.wrapper.clientHeight,this.doc.height),d=Math.max(a.sizer.clientWidth,a.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>f)&&e.top>t.offsetHeight?c=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=f&&(c=e.bottom),u+t.offsetWidth>d&&(u=d-t.offsetWidth)}t.style.top=c+"px",t.style.left=t.style.right="","right"==i?(u=a.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?u=0:"middle"==i&&(u=(a.sizer.clientWidth-t.offsetWidth)/2),t.style.left=u+"px"),r&&(o=this,l={left:u,top:c,right:u+t.offsetWidth,bottom:c+t.offsetHeight},null!=(s=kn(o,l)).scrollTop&&Nn(o,s.scrollTop),null!=s.scrollLeft&&Dn(o,s.scrollLeft))},triggerOnKeyDown:$n(il),triggerOnKeyPress:$n(ll),triggerOnKeyUp:ol,triggerOnMouseDown:$n(ul),execCommand:function(e){if(Xo.hasOwnProperty(e))return Xo[e].call(null,this)},triggerElectric:$n(function(e){Nl(this,e)}),findPosH:function(e,t,r,n){var i=1;t<0&&(i=-1,t=-t);for(var o=ke(this.doc,e),l=0;l<t&&!(o=Wl(this.doc,o,i,r,n)).hitSide;++l);return o},moveH:$n(function(t,r){var n=this;this.extendSelectionsBy(function(e){return n.display.shift||n.doc.extend||e.empty()?Wl(n.doc,e.head,t,r,n.options.rtlMoveVisually):t<0?e.from():e.to()},G)}),deleteH:$n(function(r,n){var e=this.doc.sel,i=this.doc;e.somethingSelected()?i.replaceSelection("",null,"+delete"):Go(this,function(e){var t=Wl(i,e.head,r,n,!1);return r<0?{from:t,to:e.head}:{from:e.head,to:t}})}),findPosV:function(e,t,r,n){var i=1,o=n;t<0&&(i=-1,t=-t);for(var l=ke(this.doc,e),s=0;s<t;++s){var a=Gr(this,l,"div");if(null==o?o=a.left:a.left=o,(l=Pl(this,a,i,r)).hitSide)break}return l},moveV:$n(function(n,i){var o=this,l=this.doc,s=[],a=!this.display.shift&&!l.extend&&l.sel.somethingSelected();if(l.extendSelectionsBy(function(e){if(a)return n<0?e.from():e.to();var t=Gr(o,e.head,"div");null!=e.goalColumn&&(t.left=e.goalColumn),s.push(t.left);var r=Pl(o,t,n,i);return"page"==i&&e==l.sel.primary()&&Cn(o,jr(o,r,"div").top-t.top),r},G),s.length)for(var e=0;e<l.sel.ranges.length;e++)l.sel.ranges[e].goalColumn=s[e]}),findWordAt:function(e){var t=ae(this.doc,e.line).text,r=e.ch,n=e.ch;if(t){var i=this.getHelper(e,"wordChars");"before"!=e.sticky&&n!=t.length||!r?++n:--r;for(var o=t.charAt(r),l=te(o,i)?function(e){return te(e,i)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!te(e)};0<r&&l(t.charAt(r-1));)--r;for(;n<t.length&&l(t.charAt(n));)++n}return new vi(me(e.line,r),me(e.line,n))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?W(this.display.cursorDiv,"CodeMirror-overwrite"):L(this.display.cursorDiv,"CodeMirror-overwrite"),it(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==O()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:$n(function(e,t){Ln(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Cr(this)-this.display.barHeight,width:e.scrollWidth-Cr(this)-this.display.barWidth,clientHeight:Lr(this),clientWidth:Sr(this)}},scrollIntoView:$n(function(e,t){var r,n;null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:me(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,Tn(r=this),r.curOp.scrollToPos=n):Mn(this,e.from,e.to,e.margin)}),setSize:$n(function(e,t){var r=this,n=function(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e};null!=e&&(this.display.wrapper.style.width=n(e)),null!=t&&(this.display.wrapper.style.height=n(t)),this.options.lineWrapping&&qr(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){Zn(r,i,"widget");break}++i}),this.curOp.forceUpdate=!0,it(this,"refresh",this)}),operation:function(e){return Kn(this,e)},startOperation:function(){return In(this)},endOperation:function(){return Bn(this)},refresh:$n(function(){var e=this.display.cachedTextHeight;Yn(this),this.curOp.forceUpdate=!0,Hr(this),Ln(this,this.doc.scrollLeft,this.doc.scrollTop),si(this),(null==e||.5<Math.abs(e-Jr(this.display)))&&on(this),it(this,"refresh",this)}),swapDoc:$n(function(e){var t=this.doc;return t.cm=null,Ni(this,e),Hr(this),this.display.input.reset(),Ln(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,sr(this,"swapDoc",this,t),t}),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}},at(Il),Il.registerHelper=function(e,t,r){Rl.hasOwnProperty(e)||(Rl[e]=Il[e]={_global:[]}),Rl[e][t]=r},Il.registerGlobalHelper=function(e,t,r,n){Il.registerHelper(e,t,n),Rl[e]._global.push({pred:r,val:n})};var jl,Gl="iter insert remove copy getEditor constructor".split(" ");for(var Kl in So.prototype)So.prototype.hasOwnProperty(Kl)&&I(Gl,Kl)<0&&(wl.prototype[Kl]=function(e){return function(){return e.apply(this.doc,arguments)}}(So.prototype[Kl]));return at(So),wl.inputStyles={textarea:Ul,contenteditable:zl},wl.defineMode=function(e){wl.defaults.mode||"null"==e||(wl.defaults.mode=e),function(e,t){2<arguments.length&&(t.dependencies=Array.prototype.slice.call(arguments,2)),St[e]=t}.apply(this,arguments)},wl.defineMIME=function(e,t){Lt[e]=t},wl.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),wl.defineMIME("text/plain","null"),wl.defineExtension=function(e,t){wl.prototype[e]=t},wl.defineDocExtension=function(e,t){So.prototype[e]=t},wl.fromTextArea=function(t,e){if((e=e?q(e):{}).value=t.value,!e.tabindex&&t.tabIndex&&(e.tabindex=t.tabIndex),!e.placeholder&&t.placeholder&&(e.placeholder=t.placeholder),null==e.autofocus){var r=O();e.autofocus=r==t||null!=t.getAttribute("autofocus")&&r==document.body}function n(){t.value=s.getValue()}var i;if(t.form&&(tt(t.form,"submit",n),!e.leaveSubmitMethodAlone)){var o=t.form;i=o.submit;try{var l=o.submit=function(){n(),o.submit=i,o.submit(),o.submit=l}}catch(e){}}e.finishInit=function(e){e.save=n,e.getTextArea=function(){return t},e.toTextArea=function(){e.toTextArea=isNaN,n(),t.parentNode.removeChild(e.getWrapperElement()),t.style.display="",t.form&&(nt(t.form,"submit",n),"function"==typeof t.form.submit&&(t.form.submit=i))}},t.style.display="none";var s=wl(function(e){return t.parentNode.insertBefore(e,t.nextSibling)},e);return s},(jl=wl).off=nt,jl.on=tt,jl.wheelEventPixels=pi,jl.Doc=So,jl.splitLines=xt,jl.countColumn=H,jl.findColumn=K,jl.isWordChar=ee,jl.Pass=R,jl.signal=it,jl.Line=Vt,jl.changeEnd=_i,jl.scrollbarModel=qn,jl.Pos=me,jl.cmpPos=ve,jl.modes=St,jl.mimeModes=Lt,jl.resolveMode=Tt,jl.getMode=Mt,jl.modeExtensions=Nt,jl.extendMode=At,jl.copyState=Dt,jl.startState=Wt,jl.innerMode=Ot,jl.commands=Xo,jl.keyMap=qo,jl.keyName=Uo,jl.isModifierKey=Bo,jl.lookupKey=Io,jl.normalizeKeyMap=Eo,jl.StringStream=Pt,jl.SharedTextMarker=xo,jl.TextMarker=bo,jl.LineWidget=mo,jl.e_preventDefault=ct,jl.e_stopPropagation=ut,jl.e_stop=dt,jl.addClass=W,jl.contains=D,jl.rmClass=L,jl.keyNames=Wo,wl.version="5.39.0",wl}),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 A(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.info=n,this.align=i,this.prev=o}function D(e,t,r,n){var i=e.indented;return e.context&&"statement"==e.context.type&&"statement"!=r&&(i=e.context.indented),e.context=new A(i,t,r,n,null,e.context)}function O(e){var t=e.context.type;return")"!=t&&"]"!=t&&"}"!=t||(e.indented=e.context.indented),e.context=e.context.prev}function W(e,t,r){return"variable"==t.prevToken||"type"==t.prevToken||(!!/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(e.string.slice(0,r))||(!(!t.typeAtEndOfLine||e.column()!=e.indentation())||void 0))}function P(e){for(;;){if(!e||"top"==e.type)return!0;if("}"==e.type&&"namespace"!=e.prev.info)return!1;e=e.prev}}function e(e){for(var t={},r=e.split(" "),n=0;n<r.length;++n)t[r[n]]=!0;return t}function z(e,t){return"function"==typeof e?e(t):e.propertyIsEnumerable(t)}N.defineMode("clike",function(e,s){var l,a,c=e.indentUnit,u=s.statementIndentUnit||c,f=s.dontAlignCalls,d=s.keywords||{},h=s.types||{},p=s.builtin||{},g=s.blockKeywords||{},m=s.defKeywords||{},v=s.atoms||{},y=s.hooks||{},b=s.multiLineStrings,o=!1!==s.indentStatements,t=!1!==s.indentSwitch,_=s.namespaceSeparator,x=s.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,w=s.numberStart||/[\d\.]/,k=s.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,C=s.isOperatorChar||/[+\-*&%=<>!?|\/]/,S=s.isIdentifierChar||/[\w\$_\xa1-\uffff]/;function L(e,t){var o,r=e.next();if(y[r]){var n=y[r](e,t);if(!1!==n)return n}if('"'==r||"'"==r)return t.tokenize=(o=r,function(e,t){for(var r,n=!1,i=!1;null!=(r=e.next());){if(r==o&&!n){i=!0;break}n=!n&&"\\"==r}return(i||!n&&!b)&&(t.tokenize=null),"string"}),t.tokenize(e,t);if(x.test(r))return l=r,null;if(w.test(r)){if(e.backUp(1),e.match(k))return"number";e.next()}if("/"==r){if(e.eat("*"))return(t.tokenize=T)(e,t);if(e.eat("/"))return e.skipToEnd(),"comment"}if(C.test(r)){for(;!e.match(/^\/[\/*]/,!1)&&e.eat(C););return"operator"}if(e.eatWhile(S),_)for(;e.match(_);)e.eatWhile(S);var i=e.current();return z(d,i)?(z(g,i)&&(l="newstatement"),z(m,i)&&(a=!0),"keyword"):z(h,i)?"type":z(p,i)?(z(g,i)&&(l="newstatement"),"builtin"):z(v,i)?"atom":"variable"}function T(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=null;break}n="*"==r}return"comment"}function M(e,t){s.typeFirstDefinitions&&e.eol()&&P(t.context)&&(t.typeAtEndOfLine=W(e,t,e.pos))}return{startState:function(e){return{tokenize:null,context:new A((e||0)-c,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(e,t){var r=t.context;if(e.sol()&&(null==r.align&&(r.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return M(e,t),null;l=a=null;var n=(t.tokenize||L)(e,t);if("comment"==n||"meta"==n)return n;if(null==r.align&&(r.align=!0),";"==l||":"==l||","==l&&e.match(/^\s*(?:\/\/.*)?$/,!1))for(;"statement"==t.context.type;)O(t);else if("{"==l)D(t,e.column(),"}");else if("["==l)D(t,e.column(),"]");else if("("==l)D(t,e.column(),")");else if("}"==l){for(;"statement"==r.type;)r=O(t);for("}"==r.type&&(r=O(t));"statement"==r.type;)r=O(t)}else l==r.type?O(t):o&&(("}"==r.type||"top"==r.type)&&";"!=l||"statement"==r.type&&"newstatement"==l)&&D(t,e.column(),"statement",e.current());if("variable"==n&&("def"==t.prevToken||s.typeFirstDefinitions&&W(e,t,e.start)&&P(t.context)&&e.match(/^\s*\(/,!1))&&(n="def"),y.token){var i=y.token(e,t,n);void 0!==i&&(n=i)}return"def"==n&&!1===s.styleDefs&&(n="variable"),t.startOfLine=!1,t.prevToken=a?"def":n||l,M(e,t),n},indent:function(e,t){if(e.tokenize!=L&&null!=e.tokenize||e.typeAtEndOfLine)return N.Pass;var r=e.context,n=t&&t.charAt(0);if("statement"==r.type&&"}"==n&&(r=r.prev),s.dontIndentStatements)for(;"statement"==r.type&&s.dontIndentStatements.test(r.info);)r=r.prev;if(y.indent){var i=y.indent(e,r,t);if("number"==typeof i)return i}var o=n==r.type,l=r.prev&&"switch"==r.prev.info;if(s.allmanIndentation&&/[{(]/.test(n)){for(;"top"!=r.type&&"}"!=r.type;)r=r.prev;return r.indented}return"statement"==r.type?r.indented+("{"==n?0:u):!r.align||f&&")"==r.type?")"!=r.type||o?r.indented+(o?0:c)+(o||!l||/^(?:case|default)\b/.test(t)?0:c):r.indented+u:r.column+(o?0:1)},electricInput:t?/^\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",r="int long char short double float unsigned signed void size_t ptrdiff_t";function i(e,t){if(!t.startOfLine)return!1;for(var r,n=null;r=e.peek();){if("\\"==r&&e.match(/^.$/)){n=i;break}if("/"==r&&e.match(/^\/[\/\*]/,!1))break;e.next()}return t.tokenize=n,"meta"}function n(e,t){return"type"==t.prevToken&&"type"}function o(e){return e.eatWhile(/[\w\.']/),"number"}function l(e,t){if(e.backUp(1),e.match(/(R|u8R|uR|UR|LR)/)){var r=e.match(/"([^\s\\()]{0,16})\(/);return!!r&&(t.cpp11RawStringDelim=r[1],(t.tokenize=a)(e,t))}return e.match(/(u8|u|U|L)/)?!!e.match(/["']/,!1)&&"string":(e.next(),!1)}function s(e,t){for(var r;null!=(r=e.next());)if('"'==r&&!e.eat('"')){t.tokenize=null;break}return"string"}function a(e,t){var r=t.cpp11RawStringDelim.replace(/[^\w\s]/g,"\\$&");return e.match(new RegExp(".*?\\)"+r+'"'))?t.tokenize=null:e.skipToEnd(),"string"}function c(e,t){"string"==typeof e&&(e=[e]);var r=[];function n(e){if(e)for(var t in e)e.hasOwnProperty(t)&&r.push(t)}n(t.keywords),n(t.types),n(t.builtin),n(t.atoms),r.length&&(t.helperType=e[0],N.registerHelper("hintWords",e[0],r));for(var i=0;i<e.length;++i)N.defineMIME(e[i],t)}function u(e,t){for(var r=!1;!e.eol();){if(!r&&e.match('"""')){t.tokenize=null;break}r="\\"==e.next()&&!r}return"string"}c(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:e(t),types:e(r+" bool _Complex _Bool float_t double_t intptr_t intmax_t int8_t int16_t int32_t int64_t uintptr_t uintmax_t uint8_t uint16_t uint32_t uint64_t"),blockKeywords:e("case do else for if switch while struct"),defKeywords:e("struct"),typeFirstDefinitions:!0,atoms:e("NULL true false"),hooks:{"#":i,"*":n},modeProps:{fold:["brace","include"]}}),c(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:e(t+" asm dynamic_cast namespace reinterpret_cast try explicit new static_cast typeid catch operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected alignas alignof constexpr decltype nullptr noexcept thread_local final static_assert override"),types:e(r+" bool wchar_t"),blockKeywords:e("catch class do else finally for if struct switch try while"),defKeywords:e("class namespace struct enum union"),typeFirstDefinitions:!0,atoms:e("true false NULL"),dontIndentStatements:/^template$/,isIdentifierChar:/[\w\$_~\xa1-\uffff]/,hooks:{"#":i,"*":n,u:l,U:l,L:l,R:l,0:o,1:o,2:o,3:o,4:o,5:o,6:o,7:o,8:o,9:o,token:function(e,t,r){if("variable"==r&&"("==e.peek()&&(";"==t.prevToken||null==t.prevToken||"}"==t.prevToken)&&(n=e.current(),(i=/(\w+)::~?(\w+)$/.exec(n))&&i[1]==i[2]))return"def";var n,i}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),c("text/x-java",{name:"clike",keywords:e("abstract assert break case catch class const continue default do else enum extends final finally float 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("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"]}}),c("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=s)(e,t):(e.eatWhile(/[\w\$_]/),"meta")}}}),c("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=u,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},"=":function(e,t){var r=t.context;return!("}"!=r.type||!r.align||!e.eat(">"))&&(t.context=new A(r.indented,r.column,r.type,r.info,null,r.prev),"operator")},"/":function(e,t){return!!e.eat("*")&&(t.tokenize=function n(i){return function(e,t){for(var r;r=e.next();){if("*"==r&&e.eat("/")){if(1!=i)return t.tokenize=n(i-1),t.tokenize(e,t);t.tokenize=null;break}if("/"==r&&e.eat("*"))return t.tokenize=n(i+1),t.tokenize(e,t)}return"comment"}}(1),t.tokenize(e,t))}},modeProps:{closeBrackets:{triples:'"'}}}),c("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"),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){var o;return t.tokenize=(o=e.match('""'),function(e,t){for(var r,n=!1,i=!1;!e.eol();){if(!o&&!n&&e.match('"')){i=!0;break}if(o&&e.match('"""')){i=!0;break}r=e.next(),!n&&"$"==r&&e.match("{")&&e.skipTo("}"),n=!n&&"\\"==r&&!o}return!i&&o||(t.tokenize=null),"string"}),t.tokenize(e,t)}},modeProps:{closeBrackets:{triples:'"'}}}),c(["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_TexureMatrixTranspose 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:{"#":i},modeProps:{fold:["brace","include"]}}),c("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:e(r),blockKeywords:e("case do else for if switch while struct"),atoms:e("null true false"),hooks:{"#":i},modeProps:{fold:["brace","include"]}}),c("text/x-objectivec",{name:"clike",keywords:e(t+"inline restrict _Bool _Complex _Imaginary BOOL Class bycopy byref id IMP in inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),types:e(r),atoms:e("YES NO NULL NILL ON OFF true false"),hooks:{"@":function(e){return e.eatWhile(/[\w\$]/),"keyword"},"#":i,indent:function(e,t,r){if("statement"==t.type&&/^@\w/.test(r))return t.indented}},modeProps:{fold:"brace"}}),c("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:e(r),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:{"#":i},modeProps:{fold:["brace","include"]}});var f=null;c("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){var t=e.charAt(0);return t===t.toUpperCase()&&t!==t.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(l){return function(e,t){for(var r,n=!1,i=!1;!e.eol();){if(!n&&e.match('"')&&("single"==l||e.match('""'))){i=!0;break}if(!n&&e.match("``")){f=o(l),i=!0;break}r=e.next(),n="single"==l&&!n&&"\\"==r}return i&&(t.tokenize=null),"string"}}(e.match('""')?"triple":"single"),t.tokenize(e,t)},"`":function(e,t){return!(!f||!e.match("`"))&&(t.tokenize=f,f=null,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(e,t,r){if(("variable"==r||"type"==r)&&"."==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(c){"use strict";function e(e){for(var t={},r=e.split(" "),n=0;n<r.length;++n)t[r[n]]=!0;return t}function s(i,o,l){return 0==i.length?a(o):function(e,t){for(var r=i[0],n=0;n<r.length;n++)if(e.match(r[n][0]))return t.tokenize=s(i.slice(1),o),r[n][1];return t.tokenize=a(o,l),"string"}}function a(r,n){return function(e,t){return function(e,t,r,n){if(!1!==n&&e.match("${",!1)||e.match("{$",!1))return t.tokenize=null,"string";if(!1!==n&&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]]],r,n)),e.match(/\-\>\w/,!1)&&(t.tokenize=s([[["->",null]],[[/[\w]+/,"variable"]]],r,n)),"variable-2";var i=!1;for(;!e.eol()&&(i||!1===n||!e.match("{$",!1)&&!e.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/,!1));){if(!i&&e.match(r)){t.tokenize=null,t.tokStack.pop(),t.tokStack.pop();break}i="\\"==e.next()&&!i}return"string"}(e,t,r,n)}}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",r="true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__",n="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 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";c.registerHelper("hintWords","php",[t,r,n].join(" ").split(" ")),c.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(r),builtin:e(n),multiLineStrings:!0,hooks:{$:function(e){return e.eatWhile(/[\w\$_]/),"variable-2"},"<":function(e,t){var r;if(r=e.match(/<<\s*/)){var n=e.eat(/['"]/);e.eatWhile(/[\w\.]/);var i=e.current().slice(r[0].length+(n?2:1));if(n&&e.eat(n),i)return(t.tokStack||(t.tokStack=[])).push(i,0),t.tokenize=a(i,"'"!=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=a('"'),"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=a(t.tokStack[t.tokStack.length-2])),!1}}};c.defineMode("php",function(e,r){var s=c.getMode(e,r&&r.htmlMode||"text/html"),a=c.getMode(e,i);return{startState:function(){var e=c.startState(s),t=r.startOpen?c.startState(a):null;return{html:e,php:t,curMode:r.startOpen?a:s,curState:r.startOpen?t:e,pending:null}},copyState:function(e){var t,r=e.html,n=c.copyState(s,r),i=e.php,o=i&&c.copyState(a,i);return t=e.curMode==s?n:o,{html:n,php:o,curMode:e.curMode,curState:t,pending:e.pending}},token:function(e,t){var r=t.curMode==a;if(e.sol()&&t.pending&&'"'!=t.pending&&"'"!=t.pending&&(t.pending=null),r)return r&&null==t.php.tokenize&&e.match("?>")?(t.curMode=s,t.curState=t.html,t.php.context.prev||(t.php=null),"meta"):a.token(e,t.curState);if(e.match(/^<\?\w*/))return t.curMode=a,t.php||(t.php=c.startState(a,s.indent(t.html,""))),t.curState=t.php,"meta";if('"'==t.pending||"'"==t.pending){for(;!e.eol()&&e.next()!=t.pending;);var n="string"}else n=t.pending&&e.pos<t.pending.end?(e.pos=t.pending.end,t.pending.style):s.token(e,t.curState);t.pending&&(t.pending=null);var i,o=e.current(),l=o.search(/<\?/);return-1!=l&&("string"==n&&(i=o.match(/[\'\"]$/))&&!/\?>/.test(o)?t.pending=i[0]:t.pending={end:e.pos,style:n},e.backUp(o.length-l)),n},indent:function(e,t){return e.curMode!=a&&/^\s*<\//.test(t)||e.curMode==a&&/^\?>/.test(t)?s.indent(e.html,t):e.curMode.indent(e.curState,t)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",innerMode:function(e){return{state:e.curState,mode:e.curMode}}}},"htmlmixed","clike"),c.defineMIME("application/x-httpd-php","php"),c.defineMIME("application/x-httpd-php-open",{name:"php",startOpen:!0}),c.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(n){var u=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),g=n.Pos,m={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"};function f(e,t,r){var n=e.getLineHandle(t.line),i=t.ch-1,o=r&&r.afterCursor;null==o&&(o=/(^| )cm-fat-cursor($| )/.test(e.getWrapperElement().className));var l=!o&&0<=i&&m[n.text.charAt(i)]||m[n.text.charAt(++i)];if(!l)return null;var s=">"==l.charAt(1)?1:-1;if(r&&r.strict&&0<s!=(i==t.ch))return null;var a=e.getTokenTypeAt(g(t.line,i+1)),c=d(e,g(t.line,i+(0<s?1:0)),s,a||null,r);return null==c?null:{from:g(t.line,i),to:c&&c.pos,match:c&&c.ch==l.charAt(0),forward:0<s}}function d(e,t,r,n,i){for(var o=i&&i.maxScanLineLength||1e4,l=i&&i.maxScanLines||1e3,s=[],a=i&&i.bracketRegex?i.bracketRegex:/[(){}[\]]/,c=0<r?Math.min(t.line+l,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-l),u=t.line;u!=c;u+=r){var f=e.getLine(u);if(f){var d=0<r?0:f.length-1,h=0<r?f.length:-1;if(!(f.length>o))for(u==t.line&&(d=t.ch-(r<0?1:0));d!=h;d+=r){var p=f.charAt(d);if(a.test(p)&&(void 0===n||e.getTokenTypeAt(g(u,d+1))==n))if(">"==m[p].charAt(1)==0<r)s.push(p);else{if(!s.length)return{pos:g(u,d),ch:p};s.pop()}}}}return u-r!=(0<r?e.lastLine():e.firstLine())&&null}function t(e,t,r){for(var n=e.state.matchBrackets.maxHighlightLineLength||1e3,i=[],o=e.listSelections(),l=0;l<o.length;l++){var s=o[l].empty()&&f(e,o[l].head,r);if(s&&e.getLine(s.from.line).length<=n){var a=s.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";i.push(e.markText(s.from,g(s.from.line,s.from.ch+1),{className:a})),s.to&&e.getLine(s.to.line).length<=n&&i.push(e.markText(s.to,g(s.to.line,s.to.ch+1),{className:a}))}}if(i.length){u&&e.state.focused&&e.focus();var c=function(){e.operation(function(){for(var e=0;e<i.length;e++)i[e].clear()})};if(!t)return c;setTimeout(c,800)}}function i(e){e.operation(function(){e.state.matchBrackets.currentlyHighlighted&&(e.state.matchBrackets.currentlyHighlighted(),e.state.matchBrackets.currentlyHighlighted=null),e.state.matchBrackets.currentlyHighlighted=t(e,!1,e.state.matchBrackets)})}n.defineOption("matchBrackets",!1,function(e,t,r){r&&r!=n.Init&&(e.off("cursorActivity",i),e.state.matchBrackets&&e.state.matchBrackets.currentlyHighlighted&&(e.state.matchBrackets.currentlyHighlighted(),e.state.matchBrackets.currentlyHighlighted=null)),t&&(e.state.matchBrackets="object"==typeof t?t:{},e.on("cursorActivity",i))}),n.defineExtension("matchBrackets",function(){t(this,!0)}),n.defineExtension("findMatchingBracket",function(e,t,r){return(r||"boolean"==typeof t)&&(t=r?(r.strict=t,r):t?{strict:!0}:null),f(this,e,t)}),n.defineExtension("scanForBracket",function(e,t,r,n){return d(this,e,t,r,n)})});
js/min/manage.js ADDED
@@ -0,0 +1 @@
 
1
+ "use strict";!function(){var o=document.getElementById("code_snippets_ajax_nonce").value,c="-network"===pagenow.substring(pagenow.length-"-network".length),e=function(e,t){for(var n=0;n<e.length;n++)t(e[n],n)},i=function(e,t,n,a){var i=t.querySelector(".column-id");if(i&&parseInt(i.textContent)){n.id=parseInt(i.textContent),n.shared_network=!!t.className.match(/\bshared-network-snippet\b/),n.network=n.shared_network||c;var s="action=update_code_snippet&_ajax_nonce="+o+"&field="+e+"&snippet="+JSON.stringify(n),r=new XMLHttpRequest;r.open("POST",ajaxurl,!0),r.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),r.onload=function(){r.status<200||400<=r.status||(console.log(r.responseText),void 0!==a&&a(r))},r.send(s)}},n=function(){var e=this.parentElement.parentElement,t={priority:this.value};i("priority",e,t)};e(document.getElementsByClassName("snippet-priority"),function(e,t){e.addEventListener("input",n),e.disabled=!1});var s=function(e,t){var n=parseInt(e.textContent.replace(/\((\d+)\)/,"$1"));t?n++:n--,e.textContent="("+n.toString()+")"},a=function(e){var n=this.parentElement.parentElement,t=n.className.match(/\b(?:in)?active-snippet\b/);if(t){e.preventDefault();var a="inactive-snippet"===t[0];i("active",n,{active:a},function(e){n.className=a?n.className.replace(/\binactive-snippet\b/,"active-snippet"):n.className.replace(/\bactive-snippet\b/,"inactive-snippet");var t=document.querySelector(".subsubsub");s(t.querySelector(".active .count"),a),s(t.querySelector(".inactive .count"),a)})}};e(document.getElementsByClassName("snippet-activation-switch"),function(e,t){e.addEventListener("click",a)})}();
js/min/tag-it.js CHANGED
@@ -1 +1 @@
1
- !function(t){t.widget("ui.tagit",{options:{allowDuplicates:!1,caseSensitive:!0,fieldName:"tags",placeholderText:null,readOnly:!1,removeConfirmation:!1,tagLimit:null,availableTags:[],autocomplete:{},showAutocompleteOnFocus:!1,allowSpaces:!1,singleField:!1,singleFieldDelimiter:",",singleFieldNode:null,animate:!0,tabIndex:null,beforeTagAdded:null,afterTagAdded:null,beforeTagRemoved:null,afterTagRemoved:null,onTagClicked:null,onTagLimitExceeded:null,onTagAdded:null,onTagRemoved:null,tagSource:null},_create:function(){var e=this;this.element.is("input")?(this.tagList=t("<ul></ul>").insertAfter(this.element),this.options.singleField=!0,this.options.singleFieldNode=this.element,this.element.addClass("tagit-hidden-field")):this.tagList=this.element.find("ul, ol").andSelf().last(),this.tagInput=t('<input type="text" />').addClass("ui-widget-content"),this.options.readOnly&&this.tagInput.attr("disabled","disabled"),this.options.tabIndex&&this.tagInput.attr("tabindex",this.options.tabIndex),this.options.placeholderText&&this.tagInput.attr("placeholder",this.options.placeholderText),this.options.autocomplete.source||(this.options.autocomplete.source=function(e,i){var a=e.term.toLowerCase(),s=t.grep(this.options.availableTags,function(t){return 0===t.toLowerCase().indexOf(a)});this.options.allowDuplicates||(s=this._subtractArray(s,this.assignedTags())),i(s)}),this.options.showAutocompleteOnFocus&&(this.tagInput.focus(function(t,i){e._showAutocomplete()}),void 0===this.options.autocomplete.minLength&&(this.options.autocomplete.minLength=0)),t.isFunction(this.options.autocomplete.source)&&(this.options.autocomplete.source=t.proxy(this.options.autocomplete.source,this)),t.isFunction(this.options.tagSource)&&(this.options.tagSource=t.proxy(this.options.tagSource,this)),this.tagList.addClass("tagit").addClass("ui-widget ui-widget-content ui-corner-all").append(t('<li class="tagit-new"></li>').append(this.tagInput)).click(function(i){var a=t(i.target);if(a.hasClass("tagit-label")){var s=a.closest(".tagit-choice");s.hasClass("removed")||e._trigger("onTagClicked",i,{tag:s,tagLabel:e.tagLabel(s)})}else e.tagInput.focus()});var i=!1;if(this.options.singleField)if(this.options.singleFieldNode){var a=t(this.options.singleFieldNode),s=a.val().split(this.options.singleFieldDelimiter);a.val(""),t.each(s,function(t,a){e.createTag(a,null,!0),i=!0})}else this.options.singleFieldNode=t('<input type="hidden" style="display:none;" value="" name="'+this.options.fieldName+'" />'),this.tagList.after(this.options.singleFieldNode);if(i||this.tagList.children("li").each(function(){t(this).hasClass("tagit-new")||(e.createTag(t(this).text(),t(this).attr("class"),!0),t(this).remove())}),this.tagInput.keydown(function(i){if(i.which==t.ui.keyCode.BACKSPACE&&""===e.tagInput.val()){var a=e._lastTag();!e.options.removeConfirmation||a.hasClass("remove")?e.removeTag(a):e.options.removeConfirmation&&a.addClass("remove ui-state-highlight")}else e.options.removeConfirmation&&e._lastTag().removeClass("remove ui-state-highlight");(i.which===t.ui.keyCode.COMMA&&!1===i.shiftKey||i.which===t.ui.keyCode.ENTER||i.which==t.ui.keyCode.TAB&&""!==e.tagInput.val()||i.which==t.ui.keyCode.SPACE&&!0!==e.options.allowSpaces&&('"'!=t.trim(e.tagInput.val()).replace(/^s*/,"").charAt(0)||'"'==t.trim(e.tagInput.val()).charAt(0)&&'"'==t.trim(e.tagInput.val()).charAt(t.trim(e.tagInput.val()).length-1)&&t.trim(e.tagInput.val()).length-1!=0))&&(i.which===t.ui.keyCode.ENTER&&""===e.tagInput.val()||i.preventDefault(),e.options.autocomplete.autoFocus&&e.tagInput.data("autocomplete-open")||(e.tagInput.autocomplete("close"),e.createTag(e._cleanedInput())))}).blur(function(t){e.tagInput.data("autocomplete-open")||e.createTag(e._cleanedInput())}),this.options.availableTags||this.options.tagSource||this.options.autocomplete.source){var o={select:function(t,i){return e.createTag(i.item.value),!1}};t.extend(o,this.options.autocomplete),o.source=this.options.tagSource||o.source,this.tagInput.autocomplete(o).bind("autocompleteopen.tagit",function(t,i){e.tagInput.data("autocomplete-open",!0)}).bind("autocompleteclose.tagit",function(t,i){e.tagInput.data("autocomplete-open",!1)}),this.tagInput.autocomplete("widget").addClass("tagit-autocomplete")}},destroy:function(){return t.Widget.prototype.destroy.call(this),this.element.unbind(".tagit"),this.tagList.unbind(".tagit"),this.tagInput.removeData("autocomplete-open"),this.tagList.removeClass(["tagit","ui-widget","ui-widget-content","ui-corner-all","tagit-hidden-field"].join(" ")),this.element.is("input")?(this.element.removeClass("tagit-hidden-field"),this.tagList.remove()):(this.element.children("li").each(function(){t(this).hasClass("tagit-new")?t(this).remove():(t(this).removeClass(["tagit-choice","ui-widget-content","ui-state-default","ui-state-highlight","ui-corner-all","remove","tagit-choice-editable","tagit-choice-read-only"].join(" ")),t(this).text(t(this).children(".tagit-label").text()))}),this.singleFieldNode&&this.singleFieldNode.remove()),this},_cleanedInput:function(){return t.trim(this.tagInput.val().replace(/^"(.*)"$/,"$1"))},_lastTag:function(){return this.tagList.find(".tagit-choice:last:not(.removed)")},_tags:function(){return this.tagList.find(".tagit-choice:not(.removed)")},assignedTags:function(){var e=this,i=[];return this.options.singleField?""===(i=t(this.options.singleFieldNode).val().split(this.options.singleFieldDelimiter))[0]&&(i=[]):this._tags().each(function(){i.push(e.tagLabel(this))}),i},_updateSingleTagsField:function(e){t(this.options.singleFieldNode).val(e.join(this.options.singleFieldDelimiter)).trigger("change")},_subtractArray:function(e,i){for(var a=[],s=0;s<e.length;s++)-1==t.inArray(e[s],i)&&a.push(e[s]);return a},tagLabel:function(e){return this.options.singleField?t(e).find(".tagit-label:first").text():t(e).find("input:first").val()},_showAutocomplete:function(){this.tagInput.autocomplete("search","")},_findTagByLabel:function(e){var i=this,a=null;return this._tags().each(function(s){if(i._formatStr(e)==i._formatStr(i.tagLabel(this)))return a=t(this),!1}),a},_isNew:function(t){return!this._findTagByLabel(t)},_formatStr:function(e){return this.options.caseSensitive?e:t.trim(e.toLowerCase())},_effectExists:function(e){return Boolean(t.effects&&(t.effects[e]||t.effects.effect&&t.effects.effect[e]))},createTag:function(e,i,a){var s=this;if(e=t.trim(e),this.options.preprocessTag&&(e=this.options.preprocessTag(e)),""===e)return!1;if(!this.options.allowDuplicates&&!this._isNew(e)){var o=this._findTagByLabel(e);return!1!==this._trigger("onTagExists",null,{existingTag:o,duringInitialization:a})&&this._effectExists("highlight")&&o.effect("highlight"),!1}if(this.options.tagLimit&&this._tags().length>=this.options.tagLimit)return this._trigger("onTagLimitExceeded",null,{duringInitialization:a}),!1;var n=t(this.options.onTagClicked?'<a class="tagit-label"></a>':'<span class="tagit-label"></span>').text(e),l=t("<li></li>").addClass("tagit-choice ui-widget-content ui-state-default ui-corner-all").addClass(i).append(n);if(this.options.readOnly)l.addClass("tagit-choice-read-only");else{l.addClass("tagit-choice-editable");var g=t("<span></span>").addClass("ui-icon ui-icon-close"),r=t('<a><span class="text-icon">×</span></a>').addClass("tagit-close").append(g).click(function(t){s.removeTag(l)});l.append(r)}if(!this.options.singleField){var h=n.html();l.append('<input type="hidden" value="'+h+'" name="'+this.options.fieldName+'" class="tagit-hidden-field" />')}if(!1!==this._trigger("beforeTagAdded",null,{tag:l,tagLabel:this.tagLabel(l),duringInitialization:a})){if(this.options.singleField){var u=this.assignedTags();u.push(e),this._updateSingleTagsField(u)}this._trigger("onTagAdded",null,l),this.tagInput.val(""),this.tagInput.parent().before(l),this._trigger("afterTagAdded",null,{tag:l,tagLabel:this.tagLabel(l),duringInitialization:a}),this.options.showAutocompleteOnFocus&&!a&&setTimeout(function(){s._showAutocomplete()},0)}},removeTag:function(e,i){if(i=void 0===i?this.options.animate:i,e=t(e),this._trigger("onTagRemoved",null,e),!1!==this._trigger("beforeTagRemoved",null,{tag:e,tagLabel:this.tagLabel(e)})){if(this.options.singleField){var a=this.assignedTags(),s=this.tagLabel(e);a=t.grep(a,function(t){return t!=s}),this._updateSingleTagsField(a)}if(i){e.addClass("removed");var o=this._effectExists("blind")?["blind",{direction:"horizontal"},"fast"]:["fast"],n=this;o.push(function(){e.remove(),n._trigger("afterTagRemoved",null,{tag:e,tagLabel:n.tagLabel(e)})}),e.fadeOut("fast").hide.apply(e,o).dequeue()}else e.remove(),this._trigger("afterTagRemoved",null,{tag:e,tagLabel:this.tagLabel(e)})}},removeTagByLabel:function(t,e){var i=this._findTagByLabel(t);if(!i)throw"No such tag exists with the name '"+t+"'";this.removeTag(i,e)},removeAll:function(){var t=this;this._tags().each(function(e,i){t.removeTag(i,!1)})}})}(jQuery);
1
+ !function(u){u.widget("ui.tagit",{options:{allowDuplicates:!1,caseSensitive:!0,fieldName:"tags",placeholderText:null,readOnly:!1,removeConfirmation:!1,tagLimit:null,availableTags:[],autocomplete:{},showAutocompleteOnFocus:!1,allowSpaces:!1,singleField:!1,singleFieldDelimiter:",",singleFieldNode:null,animate:!0,tabIndex:null,beforeTagAdded:null,afterTagAdded:null,beforeTagRemoved:null,afterTagRemoved:null,onTagClicked:null,onTagLimitExceeded:null,onTagAdded:null,onTagRemoved:null,tagSource:null},_create:function(){var a=this;this.element.is("input")?(this.tagList=u("<ul></ul>").insertAfter(this.element),this.options.singleField=!0,this.options.singleFieldNode=this.element,this.element.addClass("tagit-hidden-field")):this.tagList=this.element.find("ul, ol").andSelf().last(),this.tagInput=u('<input type="text" />').addClass("ui-widget-content"),this.options.readOnly&&this.tagInput.attr("disabled","disabled"),this.options.tabIndex&&this.tagInput.attr("tabindex",this.options.tabIndex),this.options.placeholderText&&this.tagInput.attr("placeholder",this.options.placeholderText),this.options.autocomplete.source||(this.options.autocomplete.source=function(t,e){var i=t.term.toLowerCase(),a=u.grep(this.options.availableTags,function(t){return 0===t.toLowerCase().indexOf(i)});this.options.allowDuplicates||(a=this._subtractArray(a,this.assignedTags())),e(a)}),this.options.showAutocompleteOnFocus&&(this.tagInput.focus(function(t,e){a._showAutocomplete()}),void 0===this.options.autocomplete.minLength&&(this.options.autocomplete.minLength=0)),u.isFunction(this.options.autocomplete.source)&&(this.options.autocomplete.source=u.proxy(this.options.autocomplete.source,this)),u.isFunction(this.options.tagSource)&&(this.options.tagSource=u.proxy(this.options.tagSource,this)),this.tagList.addClass("tagit").addClass("ui-widget ui-widget-content ui-corner-all").append(u('<li class="tagit-new"></li>').append(this.tagInput)).click(function(t){var e=u(t.target);if(e.hasClass("tagit-label")){var i=e.closest(".tagit-choice");i.hasClass("removed")||a._trigger("onTagClicked",t,{tag:i,tagLabel:a.tagLabel(i)})}else a.tagInput.focus()});var i=!1;if(this.options.singleField)if(this.options.singleFieldNode){var t=u(this.options.singleFieldNode),e=t.val().split(this.options.singleFieldDelimiter);t.val(""),u.each(e,function(t,e){a.createTag(e,null,!0),i=!0})}else this.options.singleFieldNode=u('<input type="hidden" style="display:none;" value="" name="'+this.options.fieldName+'" />'),this.tagList.after(this.options.singleFieldNode);if(i||this.tagList.children("li").each(function(){u(this).hasClass("tagit-new")||(a.createTag(u(this).text(),u(this).attr("class"),!0),u(this).remove())}),this.tagInput.keydown(function(t){if(t.which==u.ui.keyCode.BACKSPACE&&""===a.tagInput.val()){var e=a._lastTag();!a.options.removeConfirmation||e.hasClass("remove")?a.removeTag(e):a.options.removeConfirmation&&e.addClass("remove ui-state-highlight")}else a.options.removeConfirmation&&a._lastTag().removeClass("remove ui-state-highlight");(t.which===u.ui.keyCode.COMMA&&!1===t.shiftKey||t.which===u.ui.keyCode.ENTER||t.which==u.ui.keyCode.TAB&&""!==a.tagInput.val()||t.which==u.ui.keyCode.SPACE&&!0!==a.options.allowSpaces&&('"'!=u.trim(a.tagInput.val()).replace(/^s*/,"").charAt(0)||'"'==u.trim(a.tagInput.val()).charAt(0)&&'"'==u.trim(a.tagInput.val()).charAt(u.trim(a.tagInput.val()).length-1)&&u.trim(a.tagInput.val()).length-1!=0))&&(t.which===u.ui.keyCode.ENTER&&""===a.tagInput.val()||t.preventDefault(),a.options.autocomplete.autoFocus&&a.tagInput.data("autocomplete-open")||(a.tagInput.autocomplete("close"),a.createTag(a._cleanedInput())))}).blur(function(t){a.tagInput.data("autocomplete-open")||a.createTag(a._cleanedInput())}),this.options.availableTags||this.options.tagSource||this.options.autocomplete.source){var s={select:function(t,e){return a.createTag(e.item.value),!1}};u.extend(s,this.options.autocomplete),s.source=this.options.tagSource||s.source,this.tagInput.autocomplete(s).bind("autocompleteopen.tagit",function(t,e){a.tagInput.data("autocomplete-open",!0)}).bind("autocompleteclose.tagit",function(t,e){a.tagInput.data("autocomplete-open",!1)}),this.tagInput.autocomplete("widget").addClass("tagit-autocomplete")}},destroy:function(){return u.Widget.prototype.destroy.call(this),this.element.unbind(".tagit"),this.tagList.unbind(".tagit"),this.tagInput.removeData("autocomplete-open"),this.tagList.removeClass(["tagit","ui-widget","ui-widget-content","ui-corner-all","tagit-hidden-field"].join(" ")),this.element.is("input")?(this.element.removeClass("tagit-hidden-field"),this.tagList.remove()):(this.element.children("li").each(function(){u(this).hasClass("tagit-new")?u(this).remove():(u(this).removeClass(["tagit-choice","ui-widget-content","ui-state-default","ui-state-highlight","ui-corner-all","remove","tagit-choice-editable","tagit-choice-read-only"].join(" ")),u(this).text(u(this).children(".tagit-label").text()))}),this.singleFieldNode&&this.singleFieldNode.remove()),this},_cleanedInput:function(){return u.trim(this.tagInput.val().replace(/^"(.*)"$/,"$1"))},_lastTag:function(){return this.tagList.find(".tagit-choice:last:not(.removed)")},_tags:function(){return this.tagList.find(".tagit-choice:not(.removed)")},assignedTags:function(){var t=this,e=[];return this.options.singleField?""===(e=u(this.options.singleFieldNode).val().split(this.options.singleFieldDelimiter))[0]&&(e=[]):this._tags().each(function(){e.push(t.tagLabel(this))}),e},_updateSingleTagsField:function(t){u(this.options.singleFieldNode).val(t.join(this.options.singleFieldDelimiter)).trigger("change")},_subtractArray:function(t,e){for(var i=[],a=0;a<t.length;a++)-1==u.inArray(t[a],e)&&i.push(t[a]);return i},tagLabel:function(t){return this.options.singleField?u(t).find(".tagit-label:first").text():u(t).find("input:first").val()},_showAutocomplete:function(){this.tagInput.autocomplete("search","")},_findTagByLabel:function(e){var i=this,a=null;return this._tags().each(function(t){if(i._formatStr(e)==i._formatStr(i.tagLabel(this)))return a=u(this),!1}),a},_isNew:function(t){return!this._findTagByLabel(t)},_formatStr:function(t){return this.options.caseSensitive?t:u.trim(t.toLowerCase())},_effectExists:function(t){return Boolean(u.effects&&(u.effects[t]||u.effects.effect&&u.effects.effect[t]))},createTag:function(t,e,i){var a=this;if(t=u.trim(t),this.options.preprocessTag&&(t=this.options.preprocessTag(t)),""===t)return!1;if(!this.options.allowDuplicates&&!this._isNew(t)){var s=this._findTagByLabel(t);return!1!==this._trigger("onTagExists",null,{existingTag:s,duringInitialization:i})&&this._effectExists("highlight")&&s.effect("highlight"),!1}if(this.options.tagLimit&&this._tags().length>=this.options.tagLimit)return this._trigger("onTagLimitExceeded",null,{duringInitialization:i}),!1;var o=u(this.options.onTagClicked?'<a class="tagit-label"></a>':'<span class="tagit-label"></span>').text(t),n=u("<li></li>").addClass("tagit-choice ui-widget-content ui-state-default ui-corner-all").addClass(e).append(o);if(this.options.readOnly)n.addClass("tagit-choice-read-only");else{n.addClass("tagit-choice-editable");var l=u("<span></span>").addClass("ui-icon ui-icon-close"),g=u('<a><span class="text-icon">×</span></a>').addClass("tagit-close").append(l).click(function(t){a.removeTag(n)});n.append(g)}if(!this.options.singleField){var r=o.html();n.append('<input type="hidden" value="'+r+'" name="'+this.options.fieldName+'" class="tagit-hidden-field" />')}if(!1!==this._trigger("beforeTagAdded",null,{tag:n,tagLabel:this.tagLabel(n),duringInitialization:i})){if(this.options.singleField){var h=this.assignedTags();h.push(t),this._updateSingleTagsField(h)}this._trigger("onTagAdded",null,n),this.tagInput.val(""),this.tagInput.parent().before(n),this._trigger("afterTagAdded",null,{tag:n,tagLabel:this.tagLabel(n),duringInitialization:i}),this.options.showAutocompleteOnFocus&&!i&&setTimeout(function(){a._showAutocomplete()},0)}},removeTag:function(t,e){if(e=void 0===e?this.options.animate:e,t=u(t),this._trigger("onTagRemoved",null,t),!1!==this._trigger("beforeTagRemoved",null,{tag:t,tagLabel:this.tagLabel(t)})){if(this.options.singleField){var i=this.assignedTags(),a=this.tagLabel(t);i=u.grep(i,function(t){return t!=a}),this._updateSingleTagsField(i)}if(e){t.addClass("removed");var s=this._effectExists("blind")?["blind",{direction:"horizontal"},"fast"]:["fast"],o=this;s.push(function(){t.remove(),o._trigger("afterTagRemoved",null,{tag:t,tagLabel:o.tagLabel(t)})}),t.fadeOut("fast").hide.apply(t,s).dequeue()}else t.remove(),this._trigger("afterTagRemoved",null,{tag:t,tagLabel:this.tagLabel(t)})}},removeTagByLabel:function(t,e){var i=this._findTagByLabel(t);if(!i)throw"No such tag exists with the name '"+t+"'";this.removeTag(i,e)},removeAll:function(){var i=this;this._tags().each(function(t,e){i.removeTag(e,!1)})}})}(jQuery);
languages/code-snippets-bel.mo ADDED
Binary file
languages/code-snippets-bel.po ADDED
@@ -0,0 +1,778 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Translation of Plugins - Code Snippets - Stable (latest release) in Belarusian
2
+ # This file is distributed under the same license as the Plugins - Code Snippets - Stable (latest release) package.
3
+ msgid ""
4
+ msgstr ""
5
+ "PO-Revision-Date: 2018-05-24 15:11+0300\n"
6
+ "MIME-Version: 1.0\n"
7
+ "Content-Type: text/plain; charset=UTF-8\n"
8
+ "Content-Transfer-Encoding: 8bit\n"
9
+ "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
10
+ "X-Generator: Poedit 2.0.7\n"
11
+ "Language: be_BY\n"
12
+ "Project-Id-Version: Plugins - Code Snippets - Stable (latest release)\n"
13
+ "POT-Creation-Date: \n"
14
+ "Last-Translator: \n"
15
+ "Language-Team: \n"
16
+
17
+ #: php/class-contextual-help.php:86
18
+ msgid "WP-Snippets"
19
+ msgstr "WP-Snippets"
20
+
21
+ #: php/class-contextual-help.php:86
22
+ msgid "http://wp-snippets.com"
23
+ msgstr "http://wp-snippets.com"
24
+
25
+ #: php/class-contextual-help.php:87
26
+ msgid "WP Snipp"
27
+ msgstr "WP Snipp"
28
+
29
+ #: php/class-contextual-help.php:87
30
+ msgid "http://wpsnipp.com"
31
+ msgstr "http://wpsnipp.com"
32
+
33
+ #: php/class-contextual-help.php:88
34
+ msgid "Cats Who Code"
35
+ msgstr "Cats Who Code"
36
+
37
+ #: php/class-contextual-help.php:88
38
+ msgid "http://www.catswhocode.com/blog/snippets"
39
+ msgstr "http://www.catswhocode.com/blog/snippets"
40
+
41
+ #: php/class-contextual-help.php:89
42
+ msgid "WP Function Me"
43
+ msgstr "WP Function Me"
44
+
45
+ #: php/class-contextual-help.php:89
46
+ msgid "http://www.wpfunction.me"
47
+ msgstr "http://www.wpfunction.me"
48
+
49
+ #: php/class-contextual-help.php:100
50
+ msgid "Here are some links to websites which host a large number of snippets that you can add to your site:"
51
+ msgstr "Вось некалькі спасылак на сайты, на якіх размешчана вялікая колькасць снiппетаў, якія вы можаце дадаць на свой сайт:"
52
+
53
+ #: php/class-list-table.php:168
54
+ msgid "Network Active"
55
+ msgstr "Актываваны для сеткі"
56
+
57
+ #: php/class-list-table.php:170
58
+ msgid "Network Only"
59
+ msgstr "Толькі для сеткі"
60
+
61
+ #: php/class-list-table.php:702
62
+ msgid "Whoops, it looks like no snippets could be found."
63
+ msgstr "Ой, падобна, ніякіх сніппетаў не знойдзена."
64
+
65
+ #: php/class-list-table.php:706
66
+ msgid "Perhaps you would like to add a new one?"
67
+ msgstr "Магчыма, вы хацелі б дадаць новы?"
68
+
69
+ #: php/settings/settings-fields.php:70
70
+ msgid "Show Network Snippets"
71
+ msgstr "Адлюстроўваць сеткавыя сниіппеты"
72
+
73
+ #: php/settings/settings-fields.php:72
74
+ msgid "Show network-wide snippets in the snippets table on subsites"
75
+ msgstr "Паказваць сеткавыя сніппеты ў табліцы сніпетаў на падсайтах"
76
+
77
+ #. Author URI of the plugin/theme
78
+ msgid "https://bungeshea.com"
79
+ msgstr "https://bungeshea.com"
80
+
81
+ #. Author of the plugin/theme
82
+ msgid "Shea Bunge"
83
+ msgstr "Shea Bunge"
84
+
85
+ #. Description of the plugin/theme
86
+ msgid "An easy, clean and simple way to add code snippets to your site. No need to edit to your theme's functions.php file again!"
87
+ msgstr "Просты і зразумелы спосаб дадаць спіппет кода на ваш сайт без неабходнасці рэдагаваць файл тэмы functions.php."
88
+
89
+ #. Plugin URI of the plugin/theme
90
+ msgid "https://github.com/sheabunge/code-snippets"
91
+ msgstr "https://github.com/sheabunge/code-snippets"
92
+
93
+ #: php/views/manage.php:34
94
+ msgid "Search Installed Snippets"
95
+ msgstr "Шукаць устаноўленыя сніппеты"
96
+
97
+ #: php/views/import.php:39
98
+ msgid "Upload file and import"
99
+ msgstr "Загрузіць файл і імпартаваць"
100
+
101
+ #: php/views/import.php:33
102
+ msgid "(Maximum size: 8MB)"
103
+ msgstr "(Максімальны памер: 8MB)"
104
+
105
+ #: php/views/import.php:32
106
+ msgid "Choose a file from your computer:"
107
+ msgstr "Выберыце файл на вашым кампутары:"
108
+
109
+ #: php/views/import.php:25
110
+ msgid "Choose a Code Snippets (.xml) file to upload, then click Upload file and import."
111
+ msgstr "Выберыце файл экспарту (.xml), а затым націсніце \"Загрузіць файл і імпартаваць\"."
112
+
113
+ #: php/views/import.php:23
114
+ msgid "You will need to go to the <a href=\"%s\">All Snippets</a> page to activate the imported snippets."
115
+ msgstr "Для актывацыі імпартаваных сніппетоў неабходна перайсці на старонку <a href=\"%s\"> Усе сніппеты </a>."
116
+
117
+ #: php/views/import.php:21
118
+ msgid "Howdy! Upload your Code Snippets export file and we&#8217;ll import the snippets to this site."
119
+ msgstr "Прывітанне! Загрузіце файл экспарту, каб імпартаваць сніппеты на гэты сайт."
120
+
121
+ #: php/views/edit.php:118
122
+ msgid "You are about to permanently delete this snippet."
123
+ msgstr "Вы збіраецеся назаўжды выдаліць гэты сніппет."
124
+
125
+ #: php/views/edit.php:101
126
+ msgid "Save Changes and Deactivate"
127
+ msgstr "Захаваць змены і дэактываваць"
128
+
129
+ #: php/views/edit.php:81 php/views/edit.php:95
130
+ msgid "Save Changes and Activate"
131
+ msgstr "Захаваць змены і актываваць"
132
+
133
+ #: php/views/edit.php:54
134
+ msgid "Code"
135
+ msgstr "Код"
136
+
137
+ #: php/views/edit.php:49
138
+ msgid "Enter title here"
139
+ msgstr "Калі ласка, увядзіце загаловак тут"
140
+
141
+ #: php/views/edit.php:28 php/views/manage.php:22
142
+ msgctxt "snippet"
143
+ msgid "Add New"
144
+ msgstr "Дадаць новы"
145
+
146
+ #: php/settings/settings.php:176
147
+ msgid "Settings saved."
148
+ msgstr "Налады захаваныя."
149
+
150
+ #: php/settings/settings.php:119
151
+ msgid "Editor Preview"
152
+ msgstr "Папярэдні прагляд у рэдактары"
153
+
154
+ #: php/settings/settings.php:70
155
+ msgid "Code Editor"
156
+ msgstr "Рэдактар кода"
157
+
158
+ #: php/settings/settings.php:69
159
+ msgid "Description Editor"
160
+ msgstr "Рэдактар апісання"
161
+
162
+ #: php/settings/settings.php:68
163
+ msgid "General"
164
+ msgstr "Асноўныя"
165
+
166
+ #: php/settings/settings-fields.php:176
167
+ msgid "Highlight all instances of a currently selected word."
168
+ msgstr "Выдзяляць усе ўваходжанні абранага слова"
169
+
170
+ #: php/settings/settings-fields.php:175
171
+ msgid "Highlight Selection Matches"
172
+ msgstr "Выдзяляць супадзення"
173
+
174
+ #: php/settings/settings-fields.php:169
175
+ msgid "Auto-close brackets and quotes when typed."
176
+ msgstr "Аўтаматычна зачыняць дужкі і двукоссе пры наборы"
177
+
178
+ #: php/settings/settings-fields.php:167
179
+ msgid "Auto Close Brackets"
180
+ msgstr "Аўтаматычна зачыняць дужкі"
181
+
182
+ #: php/settings/settings-fields.php:161
183
+ msgid "Show line numbers to the left of the editor."
184
+ msgstr "Паказваць нумары радкоў у рэдактары злева"
185
+
186
+ #: php/settings/settings-fields.php:159
187
+ msgid "Line Numbers"
188
+ msgstr "Нумары радкоў"
189
+
190
+ #: php/settings/settings-fields.php:153
191
+ msgid "Whether the editor should scroll or wrap for long lines."
192
+ msgstr "Пракручваць або пераносіць доўгія радкі ў рэдактары"
193
+
194
+ #: php/settings/settings-fields.php:151
195
+ msgid "Wrap Lines"
196
+ msgstr "Пераносіць радкі"
197
+
198
+ #: php/settings/settings-fields.php:144
199
+ msgid "How many spaces a block should be indented."
200
+ msgstr "На колькі прабелаў зрушваць блок"
201
+
202
+ #: php/settings/settings-fields.php:142
203
+ msgid "Indent Unit"
204
+ msgstr "Крок зруху"
205
+
206
+ #: php/settings/settings-fields.php:135
207
+ msgid "The width of a tab character."
208
+ msgstr "Шырыня сімвала табуляцыі"
209
+
210
+ #: php/settings/settings-fields.php:133
211
+ msgid "Tab Size"
212
+ msgstr "Памер табулятара"
213
+
214
+ #: php/settings/settings-fields.php:127
215
+ msgid "Use hard tabs (not spaces) for indentation."
216
+ msgstr "Ужываць жорсткія табулятары (не прабелы) для зруху"
217
+
218
+ #: php/settings/settings-fields.php:125
219
+ msgid "Indent With Tabs"
220
+ msgstr "Зрушваць табулятарамі"
221
+
222
+ #: php/settings/settings-fields.php:118
223
+ msgid "Theme"
224
+ msgstr "Тэма"
225
+
226
+ #: php/settings/settings-fields.php:109
227
+ msgid "Enable the add media buttons"
228
+ msgstr "Уключыць кнопкі дадання мэдыяфайла"
229
+
230
+ #: php/settings/settings-fields.php:107
231
+ msgid "Media Buttons"
232
+ msgstr "Кнопкі медыя"
233
+
234
+ #: php/settings/settings-fields.php:102
235
+ msgid "Enable all features of the visual editor"
236
+ msgstr "Уключыць усе функцыі візуальнага рэдактара"
237
+
238
+ #: php/settings/settings-fields.php:100
239
+ msgid "Use Full Editor"
240
+ msgstr "Выкарыстоўваць пашыраны рэдактар"
241
+
242
+ #: php/settings/settings-fields.php:94
243
+ msgid "rows"
244
+ msgstr "радкоў"
245
+
246
+ #: php/settings/settings-fields.php:92
247
+ msgid "Row Height"
248
+ msgstr "Вышыня ў радках"
249
+
250
+ #: php/settings/settings-fields.php:79
251
+ msgid "Disable the syntax highlighting for the [code_snippet] shortcode on the front-end"
252
+ msgstr "Адключыць падсвятленне сінтаксісу для шорткода [code_snippet] на публічнай часткі сайта"
253
+
254
+ #: php/settings/settings-fields.php:77
255
+ msgid "Disable shortcode syntax highlighter"
256
+ msgstr "Адключыць падсвятленне сінтаксісу шорткода"
257
+
258
+ #: php/settings/settings-fields.php:65
259
+ msgid "Show snippet descriptions on admin pages"
260
+ msgstr "Паказваць апісання сніппетаў на старонках адмін-панэлі"
261
+
262
+ #: php/settings/settings-fields.php:63
263
+ msgid "Enable Snippet Descriptions"
264
+ msgstr "Ўключыць апісання сніппетаў"
265
+
266
+ #: php/settings/settings-fields.php:58
267
+ msgid "Show snippet tags on admin pages"
268
+ msgstr "Паказваць пазнакі сніппетаў на старонках адмін-панэлі"
269
+
270
+ #: php/settings/settings-fields.php:56
271
+ msgid "Enable Snippet Tags"
272
+ msgstr "Уключыць пазнакі сніппетаў"
273
+
274
+ #: php/settings/settings-fields.php:51
275
+ msgid "Enable the scope selector when editing a snippet"
276
+ msgstr "Уключыць селектар вобласці прымянення пры рэдагаванні сниппета"
277
+
278
+ #: php/settings/settings-fields.php:49
279
+ msgid "Enable Scope Selector"
280
+ msgstr "Уключыць селектар вобласці"
281
+
282
+ #: php/settings/settings-fields.php:44
283
+ msgid "Make the 'Save and Activate' button the default action when saving a snippet."
284
+ msgstr "Зрабіць кнопку 'Захаваць і актываваць' дзеяннем па змаўчанні пры захаванні сніппета"
285
+
286
+ #: php/settings/settings-fields.php:42
287
+ msgid "Activate by Default"
288
+ msgstr "Уключаць па змаўчанні"
289
+
290
+ #: php/class-list-table.php:1015
291
+ msgid "Clear Filters"
292
+ msgstr "Ачысціць фільтры"
293
+
294
+ #: php/class-list-table.php:1007
295
+ msgid " in tag &#8220;%s&#8221;"
296
+ msgstr "у пазнацы &#8220;%s&#8221;"
297
+
298
+ #: php/class-list-table.php:1003
299
+ msgid " for &#8220;%s&#8221;"
300
+ msgstr "па запыту &#8220;%s&#8221;"
301
+
302
+ #: php/class-list-table.php:1000
303
+ msgid "Search results"
304
+ msgstr "Вынікі пошуку"
305
+
306
+ #: php/class-list-table.php:516
307
+ msgid "Clear List"
308
+ msgstr "Ачысціць спіс"
309
+
310
+ #: php/class-list-table.php:508
311
+ msgid "Filter"
312
+ msgstr "Фільтр"
313
+
314
+ #: php/class-list-table.php:494
315
+ msgid "Show all tags"
316
+ msgstr "Паказаць усе пазнакі"
317
+
318
+ #: php/class-list-table.php:431
319
+ msgid "Recently Active <span class=\"count\">(%s)</span>"
320
+ msgid_plural "Recently Active <span class=\"count\">(%s)</span>"
321
+ msgstr[0] "Нядаўна актыўны <span class = \"count\"> (% s) </ span>"
322
+ msgstr[1] "Нядаўна актыўныя <span class = \"count\"> (% s) </ span>"
323
+ msgstr[2] "Нядаўна актыўныя <span class = \"count\"> (% s) </ span>"
324
+
325
+ #: php/class-list-table.php:430
326
+ msgid "Inactive <span class=\"count\">(%s)</span>"
327
+ msgid_plural "Inactive <span class=\"count\">(%s)</span>"
328
+ msgstr[0] "Неактыўны <span class=\"count\">(%s)</span>"
329
+ msgstr[1] "Неактыўныя <span class=\"count\">(%s)</span>"
330
+ msgstr[2] "Неактыўныя <span class=\"count\">(%s)</span>"
331
+
332
+ #: php/class-list-table.php:429
333
+ msgid "Active <span class=\"count\">(%s)</span>"
334
+ msgid_plural "Active <span class=\"count\">(%s)</span>"
335
+ msgstr[0] "Актыўны <span class=\"count\">(%s)</span>"
336
+ msgstr[1] "Актыўыя <span class=\"count\">(%s)</span>"
337
+ msgstr[2] "Актыўыя <span class=\"count\">(%s)</span>"
338
+
339
+ #: php/class-list-table.php:428
340
+ msgid "All <span class=\"count\">(%s)</span>"
341
+ msgid_plural "All <span class=\"count\">(%s)</span>"
342
+ msgstr[0] "Усе <span class=\"count\">(%s)</span>"
343
+ msgstr[1] "Усе <span class=\"count\">(%s)</span>"
344
+ msgstr[2] "Усе <span class=\"count\">(%s)</span>"
345
+
346
+ #: php/class-list-table.php:390
347
+ msgid "Export to PHP"
348
+ msgstr "Экспарт у PHP"
349
+
350
+ #: php/class-list-table.php:340
351
+ msgid "ID"
352
+ msgstr "ID"
353
+
354
+ #: php/class-list-table.php:339 php/views/edit.php:48
355
+ msgid "Name"
356
+ msgstr "Назва"
357
+
358
+ #: php/class-list-table.php:278
359
+ msgid "Shared on Network"
360
+ msgstr "Агульны для сеткі"
361
+
362
+ #: php/class-list-table.php:255
363
+ msgid "Untitled #%d"
364
+ msgstr "Без назвы #%d"
365
+
366
+ #: php/class-list-table.php:161 php/class-list-table.php:236
367
+ #: php/views/edit.php:119
368
+ msgid "'Cancel' to stop, 'OK' to delete."
369
+ msgstr "\"Адмена\", каб спыніць, 'OK' для выдалення."
370
+
371
+ #: php/class-list-table.php:160 php/class-list-table.php:235
372
+ msgid "You are about to permanently delete the selected item."
373
+ msgstr "Вы збіраецеся назаўжды выдаліць абраны элемент."
374
+
375
+ #: php/class-list-table.php:153 php/class-list-table.php:225
376
+ #: php/class-list-table.php:389 php/views/edit.php:124
377
+ msgid "Delete"
378
+ msgstr "Выдаліць"
379
+
380
+ #: php/class-list-table.php:144 php/class-list-table.php:213
381
+ #: php/class-list-table.php:388 php/views/edit.php:111
382
+ msgid "Export"
383
+ msgstr "Экспарт"
384
+
385
+ #: php/class-list-table.php:138 php/class-list-table.php:207
386
+ msgid "Edit"
387
+ msgstr "Змяніць"
388
+
389
+ #: php/class-list-table.php:128 php/class-list-table.php:191
390
+ #: php/class-list-table.php:386
391
+ msgid "Activate"
392
+ msgstr "Актываваць"
393
+
394
+ #: php/class-list-table.php:128 php/class-list-table.php:386
395
+ msgid "Network Activate"
396
+ msgstr "Актываваць ў сетцы"
397
+
398
+ #: php/class-list-table.php:119 php/class-list-table.php:191
399
+ #: php/class-list-table.php:387
400
+ msgid "Deactivate"
401
+ msgstr "Дэактываваць"
402
+
403
+ #: php/class-list-table.php:119 php/class-list-table.php:387
404
+ msgid "Network Deactivate"
405
+ msgstr "Дэактываваць ў сеткі"
406
+
407
+ #: php/class-list-table.php:58
408
+ msgid "Snippets per page"
409
+ msgstr "Сніппеты на старонцы"
410
+
411
+ #: php/class-export.php:96
412
+ msgid "7. You will then have to visit the 'Snippets: All Snippets' admin menu and activate desired snippets."
413
+ msgstr "7. Затым вам трэба наведаць меню 'Сніпеты: Усе сніпеты' і актываваць патрэбныя сніпеты."
414
+
415
+ #: php/class-export.php:95
416
+ msgid "6. Code Snippets will then import all of the snippets and associated information contained in this file into your site."
417
+ msgstr "6. Code Snippets імпартуе з гэтага файла на сайт усё сніпеты і спадарожную інфармацыю."
418
+
419
+ #: php/class-export.php:94
420
+ msgid "5. Upload this file using the form provided on that page."
421
+ msgstr "5. Загрузіце гэты файл праз форму на той старонцы."
422
+
423
+ #: php/class-export.php:93
424
+ msgid "4. Click on the \"Code Snippets\" importer in the list"
425
+ msgstr "4. Націсніце на імпарт \"Code Snippets\" у спісе"
426
+
427
+ #: php/class-export.php:92
428
+ msgid "3. Go to 'Tools: Import' in the WordPress admin panel."
429
+ msgstr "3. Перайдзіце ў 'Інструменты: Імпарт' у кансолі WordPress."
430
+
431
+ #: php/class-export.php:91
432
+ msgid "2. Install the Code Snippets plugin using the directions provided at the above link."
433
+ msgstr "2. Усталюйце убудову Code Snippets, выконваючы загады па спасылцы вышэй."
434
+
435
+ #: php/class-export.php:90
436
+ msgid "1. Log in to that site as an administrator."
437
+ msgstr "1. Увайдзіце на сайт як адміністратар."
438
+
439
+ #: php/class-export.php:89
440
+ msgid "To import these snippets a WordPress site follow these steps:"
441
+ msgstr "Для імпарту сніпетов на сайт WordPress выканайце гэтыя дзеянні:"
442
+
443
+ #: php/class-export.php:87
444
+ msgid "This is a code snippets export file generated by the Code Snippets WordPress plugin."
445
+ msgstr "Гэта файл экспарту сніппетоў кода, створаны ўбудовай Code Snippets для WordPress."
446
+
447
+ #: php/class-contextual-help.php:135
448
+ msgid "You can save your snippets to a Code Snippets (.xml) export file using the <a href=\"%s\">Manage Snippets</a> page."
449
+ msgstr "Вы можаце захаваць свае сніпеты ў файл экспарту (.xml) на старонцы <a href=\"%s\"> Упраўленне сніпетамі </a>."
450
+
451
+ #: php/class-contextual-help.php:134
452
+ msgid "Exporting"
453
+ msgstr "Экспарт"
454
+
455
+ #: php/class-contextual-help.php:129
456
+ msgid "Snippets will be added to the database along with your existing snippets. Regardless of whether the snippets were active on the previous site, imported snippets are always inactive until activated using the <a href=\"%s\">All Snippets</a> page.</p>"
457
+ msgstr "Сніпеты будуць дададзеныя ў вашу базу да ўжо наяўных. Незалежна ад таго, ці былі яны актыўныя на папярэднім сайце, імпартаваныя сніпеты заўсёды неактыўныя, пакуль іх не актываваць на старонцы <a href=\"%s\"> Усе сніпеты </a>. </ P>"
458
+
459
+ #: php/class-contextual-help.php:128
460
+ msgid "You can load your snippets from a code snippets (.xml) export file using this page."
461
+ msgstr "На гэтай старонцы вы можаце загрузіць свае сніпеты з файла экспарту (.xml)."
462
+
463
+ #: php/class-contextual-help.php:127
464
+ msgid "Importing"
465
+ msgstr "Імпарт"
466
+
467
+ #: php/class-contextual-help.php:122
468
+ msgid "Snippets are similar to plugins - they both extend and expand the functionality of WordPress. Snippets are more light-weight, just a few lines of code, and do not put as much load on your server. Here you can load snippets from a Code Snippets (.xml) import file into the database with your existing snippets."
469
+ msgstr "Сніпеты падобныя на ўбудовы - і тыя і іншыя пашыраюць функцыянальнасць WordPress. Сніпеты менш, яны складаюцца толькі з некалькіх радкоў кода і не моцна нагружаюць ваш сервер. Тут вы можаце загрузіць вашыя сніпеты з файла экспарту плагіна (.xml), каб дадаць іх на ваш сайт."
470
+
471
+ #: php/class-contextual-help.php:109
472
+ msgid "Please be sure to check that your snippet is valid PHP code and will not produce errors before adding it through this page. While doing so will not become active straight away, it will help to minimise the chance of a faulty snippet becoming active on your site."
473
+ msgstr "Калі ласка, перад даданне сніпета пераканайцеся ў тым, што ён з'яўляецца карэктным PHP кодам, і не прывядзе да збояў. Хоць дадаваны сніпет адразу не актывізуецца, гэта дапаможа скараціць верагоднасць ўключэння няспраўнага сніпета ў будучыні."
474
+
475
+ #: php/class-contextual-help.php:108
476
+ msgid "You need to fill out the name and code fields for your snippet to be added. While the description field will add more information about how your snippet works, what is does and where you found it, it is completely optional."
477
+ msgstr "Для даданне сніпета трэба запоўніць палі назвы і кода. У поле апісання можна дадаць дадатковыя звесткі аб тым, як працуе сніпет, але гэта зусім неабавязкова."
478
+
479
+ #: php/class-contextual-help.php:107
480
+ msgid "Adding Snippets"
481
+ msgstr "Даданне сніпетов"
482
+
483
+ #: php/class-contextual-help.php:102
484
+ msgid "More places to find snippets, as well as a selection of example snippets, can be found in the <a href=\"https://github.com/sheabunge/code-snippets/wiki/Finding-snippets\">plugin documentation</a>"
485
+ msgstr "Месцы, дзе можна знайсці сніпеты, а таксама выбраныя прыклады, знаходзяцца на <a href=\"https://github.com/sheabunge/code-snippets/wiki/Finding-snippets\"> старонцы ўбудовы </a>"
486
+
487
+ #: php/class-contextual-help.php:99
488
+ msgid "Finding Snippets"
489
+ msgstr "Пошук сніпетов"
490
+
491
+ #: php/class-contextual-help.php:82
492
+ msgid "Snippets are similar to plugins - they both extend and expand the functionality of WordPress. Snippets are more light-weight, just a few lines of code, and do not put as much load on your server. Here you can add a new snippet, or edit an existing one."
493
+ msgstr "Сніпеты падобныя на ўбудовы - і тыя і іншыя пашыраюць функцыянальнасць WordPress. Сніпеты менш, яны складаюцца толькі з некалькіх радкоў кода і не моцна нагружаюць ваш сервер. Тут можна дадаць ці адрэдагаваць сніпет."
494
+
495
+ #: php/class-contextual-help.php:70
496
+ msgid "Even if you're sure that you don't want to use Code Snippets ever again on this WordPress installation, you may want to use the export feature to back up your snippets."
497
+ msgstr "Нават калі вы ўпэўнены, што ніколі больш не будзеце выкарыстоўваць дадзены плягін на гэтым сайце, на ўсялякі выпадак зрабіце экспарт ўсіх сніпетаў."
498
+
499
+ #: php/class-contextual-help.php:69
500
+ msgid "When you delete Code Snippets through the Plugins menu in WordPress it will clear up the <code>%1$s</code> table and a few other bits of data stored in the database. If you want to keep this data (ie: you are only temporally uninstalling Code Snippets) then remove the <code>%2$s</code> folder using FTP."
501
+ msgstr "Пры выдаленні плагіна праз меню \"Даданыя модулі\" кансолі табліца <code>%1$s</code>у базе дадзеных і сякія-такія яшчэ сляды ў базе дадзеных будуць выдаленыя. Калі вы хочаце захаваць налады (сніпеты) плагіна, то выдаляйце убудова ( <code>%2$s</code>) праз FTP, а не праз кансоль."
502
+
503
+ #: php/class-contextual-help.php:68
504
+ msgid "Uninstall"
505
+ msgstr "Выдаленне"
506
+
507
+ #: php/class-contextual-help.php:63
508
+ msgid "If something goes wrong with a snippet and you can't use WordPress, you can cause all snippets to stop executing by adding <code>define('CODE_SNIPPETS_SAFE_MODE', true);</code> to your <code>wp-config.php</code> file. After you have deactivated the offending snippet, you can turn off safe mode by removing this line or replacing <strong>true</strong> with <strong>false</strong>."
509
+ msgstr "На выпадак любых праблем са сніпетам, якія прыводзяць да збою WordPress, можна адключыць усе сніпеты, дадаўшы радок <code>define('CODE_SNIPPETS_SAFE_MODE', true);</code> у ваш файл канфігурацыі <code>wp-config.php</code>. Адключыўшы вінаваты сніпет, можна адключыць бяспечны рэжым, выдаліўшы паказаную радок або памяняўшы <strong>true</strong> with <strong>false</strong>.."
510
+
511
+ #: php/class-contextual-help.php:62
512
+ msgid "Be sure to check your snippets for errors before you activate them, as a faulty snippet could bring your whole blog down. If your site starts doing strange things, deactivate all your snippets and activate them one at a time."
513
+ msgstr "Перш чым актываваць сніпеты, пераканайцеся, што яны не ўтрымліваюць памылак. Некарэктныя сніпеты могуць пакласці вам сайт! Калі ваш сайт пачынае паводзіць сябе дзіўна, адключыце ўсе сніпеты і ўключайце іх па адным."
514
+
515
+ #: php/class-contextual-help.php:61
516
+ msgid "Safe Mode"
517
+ msgstr "Бяспечны рэжым"
518
+
519
+ #: php/class-contextual-help.php:56
520
+ msgid "Snippets are similar to plugins - they both extend and expand the functionality of WordPress. Snippets are more light-weight, just a few lines of code, and do not put as much load on your server. Here you can manage your existing snippets and perform tasks on them such as activating, deactivating, deleting and exporting."
521
+ msgstr "Сніпеты падобныя на убудовы - яны дапаўняюць і пашыраюць функцыянальнасць WordPress. Сніпеты больш лёгкія, усяго некалькі радкоў кода не так моцна загружаюць ваш сервер. Тут вы можаце кіраваць сваімі сніпетами і выконваць для іх задачы, такія як актывацыя, дэактывацыя, выдаленне і экспарт."
522
+
523
+ #: php/class-contextual-help.php:55 php/class-contextual-help.php:81
524
+ #: php/class-contextual-help.php:121
525
+ msgid "Overview"
526
+ msgstr "Агляд"
527
+
528
+ #: php/class-contextual-help.php:44
529
+ msgid "Plugin Website"
530
+ msgstr "Сайт ўбудовы"
531
+
532
+ #: php/class-contextual-help.php:43
533
+ msgid "Support Forums"
534
+ msgstr "Форумы падтрымкі"
535
+
536
+ #: php/class-contextual-help.php:42
537
+ msgid "FAQ"
538
+ msgstr "FAQ"
539
+
540
+ #: php/class-contextual-help.php:41
541
+ msgid "About Plugin"
542
+ msgstr "Аб убудове"
543
+
544
+ #: php/class-contextual-help.php:40
545
+ msgid "For more information:"
546
+ msgstr "Дадатковая інфармацыя:"
547
+
548
+ #: php/class-admin.php:223
549
+ msgid "Dismiss"
550
+ msgstr "Зачыніць"
551
+
552
+ #: php/class-admin.php:220
553
+ msgid "Take the survey now"
554
+ msgstr "Пакінуць водгук"
555
+
556
+ #: php/class-admin.php:216
557
+ msgid "<strong>Have feedback on Code Snippets?</strong> Please take the time to answer a short survey on how you use this plugin and what you'd like to see changed or added in the future."
558
+ msgstr "<Strong> У вас ёсць заўвагі па працы Code Snippets?</strong> Тады калі ласка запоўніце анкету на сайце ўбудовы."
559
+
560
+ #: php/class-admin.php:185
561
+ msgid "Donate"
562
+ msgstr "Ахвяраванні"
563
+
564
+ #: php/class-admin.php:184
565
+ msgid "Support this plugin's development"
566
+ msgstr "Падтрымайце развіццё ўбудовы"
567
+
568
+ #: php/class-admin.php:180
569
+ msgid "Support"
570
+ msgstr "Падтрымка"
571
+
572
+ #: php/class-admin.php:179
573
+ msgid "Visit the support forums"
574
+ msgstr "Наведаць форумы падтрымкі"
575
+
576
+ #: php/class-admin.php:175
577
+ msgid "About"
578
+ msgstr "Аб убудове"
579
+
580
+ #: php/class-admin.php:174
581
+ msgid "Visit the WordPress.org plugin page"
582
+ msgstr "Наведаць старонку ўбудовы на WordPress.org"
583
+
584
+ #: php/class-admin.php:143
585
+ msgid "Manage your existing snippets"
586
+ msgstr "Кіраванне наяўнымі сніпетамі"
587
+
588
+ #: php/admin-menus/class-settings-menu.php:39 php/views/edit.php:135
589
+ msgid "Settings"
590
+ msgstr "Налады"
591
+
592
+ #: php/admin-menus/class-settings-menu.php:17
593
+ msgid "Snippets Settings"
594
+ msgstr "Налады сніпетаў"
595
+
596
+ #: php/admin-menus/class-settings-menu.php:16
597
+ msgctxt "menu label"
598
+ msgid "Settings"
599
+ msgstr "Налады"
600
+
601
+ #: php/admin-menus/class-manage-menu.php:92
602
+ msgid "Selected snippets <strong>deleted</strong>."
603
+ msgstr "Выбраныя сніпеты <strong> выдаленыя</strong>."
604
+
605
+ #: php/admin-menus/class-manage-menu.php:91
606
+ msgid "Snippet <strong>deleted</strong>."
607
+ msgstr "Сніпет <strong> выдалены</strong>."
608
+
609
+ #: php/admin-menus/class-manage-menu.php:90
610
+ msgid "Selected snippets <strong>deactivated</strong>."
611
+ msgstr "Выбраныя сніпеты <strong> дэактываваныя</strong>."
612
+
613
+ #: php/admin-menus/class-manage-menu.php:89
614
+ msgid "Snippet <strong>deactivated</strong>."
615
+ msgstr "Сніпет <strong> дэактываваны </ strong>."
616
+
617
+ #: php/admin-menus/class-manage-menu.php:88
618
+ msgid "Selected snippets <strong>activated</strong>."
619
+ msgstr "Выбраныя сніпеты <strong> актываваныя</strong>."
620
+
621
+ #: php/admin-menus/class-manage-menu.php:87
622
+ msgid "Snippet <strong>activated</strong>."
623
+ msgstr "Сніпет <strong> актываваны</strong>."
624
+
625
+ #: php/admin-menus/class-manage-menu.php:81
626
+ msgid "<strong>Warning:</strong> Safe mode is active and snippets will not execute! Remove the <code>CODE_SNIPPETS_SAFE_MODE</code> constant from <code>wp-config.php</code> to turn off safe mode. <a href=\"https://github.com/sheabunge/code-snippets/wiki/Safe-Mode\" target=\"_blank\">Help</a>"
627
+ msgstr "<Strong> Увага:</strong> уключаны бяспечны рэжым, і сніпеты не будуць выконваюцца! Выдаліце канстанту <code>CODE_SNIPPETS_SAFE_MODE</code> з файла <code>wp-config.php</code>, каб выключыць бяспечны рэжым. <a href=\"https://github.com/sheabunge/code-snippets/wiki/Safe-Mode\" target=\"_blank\"> Дапамога </a>"
628
+
629
+ #: php/admin-menus/class-manage-menu.php:46
630
+ msgctxt "top-level menu label"
631
+ msgid "Snippets"
632
+ msgstr "Сніпеты"
633
+
634
+ #: php/admin-menus/class-manage-menu.php:23
635
+ #: php/admin-menus/class-manage-menu.php:45 php/class-admin.php:61
636
+ #: php/class-admin.php:144 php/views/manage.php:19
637
+ msgid "Snippets"
638
+ msgstr "Сніпеты"
639
+
640
+ #: php/admin-menus/class-manage-menu.php:22
641
+ msgctxt "menu label"
642
+ msgid "All Snippets"
643
+ msgstr "Усе сніпеты"
644
+
645
+ #: php/admin-menus/class-import-menu.php:112
646
+ msgid "An error occurred when processing the import file."
647
+ msgstr "Адбылася памылка пры імпартаванні сніпета."
648
+
649
+ #: php/admin-menus/class-import-menu.php:98
650
+ msgid "Successfully imported <strong>%d</strong> snippet. <a href=\"%s\">Have fun!</a>"
651
+ msgid_plural "Successfully imported <strong>%d</strong> snippets. <a href=\"%s\">Have fun!</a>"
652
+ msgstr[0] "Паспяхова імпартаваны <strong>% d </ strong> сніпет. <a href=\"%s\"> Поспехаў! </a>"
653
+ msgstr[1] "Паспяхова імпартаваны <strong>% d </ strong> сніпеты. <a href=\"%s\"> Поспехаў! </a>"
654
+ msgstr[2] "Паспяхова імпартаваны <strong>% d </ strong> сніпетаў. <a href=\"%s\"> Поспехаў! </a>"
655
+
656
+ #: php/admin-menus/class-import-menu.php:85
657
+ msgid "Import snippets from a code snippets export file"
658
+ msgstr "Імпартаваць сніпеты з файла экспарту плагіна \"Code Snippets\"."
659
+
660
+ #. Plugin Name of the plugin/theme
661
+ #: php/admin-menus/class-import-menu.php:84
662
+ msgid "Code Snippets"
663
+ msgstr "Code Snippets"
664
+
665
+ #: php/admin-menus/class-import-menu.php:16 php/views/import.php:17
666
+ msgid "Import Snippets"
667
+ msgstr "Імпартаванне сніпетов"
668
+
669
+ #: php/admin-menus/class-import-menu.php:15
670
+ msgctxt "menu label"
671
+ msgid "Import"
672
+ msgstr "Імпарт"
673
+
674
+ #: php/admin-menus/class-edit-menu.php:447
675
+ msgid "Snippet <strong>updated</strong> and <strong>deactivated</strong>."
676
+ msgstr "Сніпет <strong> абноўлены </strong> і <strong> дэактываваны</strong>."
677
+
678
+ #: php/admin-menus/class-edit-menu.php:446
679
+ msgid "Snippet <strong>updated</strong> and <strong>activated</strong>."
680
+ msgstr "Сніпет <strong> абноўлены</strong> і <strong> актываваны </strong>."
681
+
682
+ #: php/admin-menus/class-edit-menu.php:445
683
+ msgid "Snippet <strong>added</strong> and <strong>activated</strong>."
684
+ msgstr "Сніпет <strong> дададзены </strong> і <strong> актываваны </strong>."
685
+
686
+ #: php/admin-menus/class-edit-menu.php:444
687
+ msgid "Snippet <strong>updated</strong>."
688
+ msgstr "Сніпет <strong> абноўлены</strong>."
689
+
690
+ #: php/admin-menus/class-edit-menu.php:443
691
+ msgid "Snippet <strong>added</strong>."
692
+ msgstr "Сніпет <strong>дададзены</strong>."
693
+
694
+ #: php/admin-menus/class-edit-menu.php:438
695
+ msgid "An error occurred when saving the snippet."
696
+ msgstr "Адбылася памылка пры захаванні сніпета."
697
+
698
+ #: php/admin-menus/class-edit-menu.php:431
699
+ msgid "The snippet has been deactivated due to an error in the code."
700
+ msgstr "Сніпет дэактываваны з-за памылкі ў кодзе."
701
+
702
+ #: php/admin-menus/class-edit-menu.php:426
703
+ msgid "The snippet has been deactivated due to an error on line %d:"
704
+ msgstr "Сніпет дэактываваны з-за памылкі ў радку% d:"
705
+
706
+ #: php/admin-menus/class-edit-menu.php:366
707
+ msgid "Allow this snippet to be activated on individual sites on the network"
708
+ msgstr "Дазволіць запуск гэтага сніпета на асобных сайтах у сетцы"
709
+
710
+ #: php/admin-menus/class-edit-menu.php:362
711
+ msgid "Sharing"
712
+ msgstr "Дзяліцца"
713
+
714
+ #: php/admin-menus/class-edit-menu.php:342
715
+ msgid "Scope"
716
+ msgstr "Аб'ём і змест"
717
+
718
+ #: php/admin-menus/class-edit-menu.php:338
719
+ msgid "Only run on site front-end"
720
+ msgstr "Запускаць толькі на публічнай часткі сайта"
721
+
722
+ #: php/admin-menus/class-edit-menu.php:337
723
+ msgid "Only run in administration area"
724
+ msgstr "Запускаць толькі ў адміністрацыйнай часткі сайта"
725
+
726
+ #: php/admin-menus/class-edit-menu.php:336
727
+ msgid "Run snippet everywhere"
728
+ msgstr "Запускаць сніпет ўсюды"
729
+
730
+ #: php/admin-menus/class-edit-menu.php:316
731
+ msgid "Enter a list of tags; separated by commas"
732
+ msgstr "Калі ласка, увядзіце пазнакі праз коску"
733
+
734
+ #: php/admin-menus/class-edit-menu.php:312 php/class-list-table.php:342
735
+ msgid "Tags"
736
+ msgstr "Пазнакі"
737
+
738
+ #: php/admin-menus/class-edit-menu.php:281 php/class-list-table.php:341
739
+ msgid "Description"
740
+ msgstr "Апісанне"
741
+
742
+ #: php/admin-menus/class-edit-menu.php:161
743
+ msgid "If you prefer, you can close this page and discard the changes you just made. No changes will be made to this site."
744
+ msgstr "Калі вы хочаце, вы можаце зачыніць гэтую старонку і адмовіцца ад унесеных змяненняў. Ніякіх зменаў не будзе зроблена на гэтым сайце."
745
+
746
+ #: php/admin-menus/class-edit-menu.php:160
747
+ msgid "Please use the back button in your browser to return to the previous page and try to fix the code error."
748
+ msgstr "Калі ласка, скарыстайцеся кнопкай таму ў вашым браўзэры, каб вярнуцца на папярэднюю старонку і паспрабаваць выправіць памылку ў кодзе."
749
+
750
+ #: php/admin-menus/class-edit-menu.php:159
751
+ msgid "The previous version of the snippet is unchanged, and the rest of this site should be functioning normally as before."
752
+ msgstr "Папярэдняя версія гэтага сніпета не змянілася, і астатняя частка гэтага сайта павінна функцыянаваць нармальна, як і раней."
753
+
754
+ #: php/admin-menus/class-edit-menu.php:157
755
+ msgid "The code snippet you are trying to save produced a fatal error on line %d:"
756
+ msgstr "Снііпет кода, які вы спрабавалі захаваць выклікаў фатальную памылку ў радку% d:"
757
+
758
+ #: php/admin-menus/class-edit-menu.php:156
759
+ msgid "Don't Panic"
760
+ msgstr "Без панікі"
761
+
762
+ #: php/admin-menus/class-edit-menu.php:40 php/views/edit.php:31
763
+ msgid "Add New Snippet"
764
+ msgstr "Дадаць новы сніпет"
765
+
766
+ #: php/admin-menus/class-edit-menu.php:39
767
+ msgctxt "menu label"
768
+ msgid "Add New"
769
+ msgstr "Дадаць новы"
770
+
771
+ #: php/admin-menus/class-edit-menu.php:13
772
+ #: php/admin-menus/class-edit-menu.php:14 php/views/edit.php:25
773
+ msgid "Edit Snippet"
774
+ msgstr "Рэдагаванне сніпета"
775
+
776
+ #: php/admin-menus/class-admin-menu.php:103
777
+ msgid "You are not authorized to access this page."
778
+ msgstr "У вас няма доступу да гэтай старонцы."
languages/code-snippets.pot CHANGED
@@ -6,9 +6,9 @@
6
  #, fuzzy
7
  msgid ""
8
  msgstr ""
9
- "Project-Id-Version: code-snippets 2.10.0\n"
10
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2018-02-11 00:17+1100\n"
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -23,7 +23,7 @@ msgid "You are not authorized to access this page."
23
  msgstr ""
24
 
25
  #: php/admin-menus/class-edit-menu.php:13
26
- #: php/admin-menus/class-edit-menu.php:14 php/views/edit.php:23
27
  msgid "Edit Snippet"
28
  msgstr ""
29
 
@@ -32,112 +32,122 @@ msgctxt "menu label"
32
  msgid "Add New"
33
  msgstr ""
34
 
35
- #: php/admin-menus/class-edit-menu.php:40 php/views/edit.php:29
36
  msgid "Add New Snippet"
37
  msgstr ""
38
 
39
- #: php/admin-menus/class-edit-menu.php:162
40
  msgid "Don't Panic"
41
  msgstr ""
42
 
43
- #: php/admin-menus/class-edit-menu.php:163
44
  #, php-format
45
  msgid ""
46
  "The code snippet you are trying to save produced a fatal error on line %d:"
47
  msgstr ""
48
 
49
- #: php/admin-menus/class-edit-menu.php:165
50
  msgid ""
51
  "The previous version of the snippet is unchanged, and the rest of this site "
52
  "should be functioning normally as before."
53
  msgstr ""
54
 
55
- #: php/admin-menus/class-edit-menu.php:166
56
  msgid ""
57
  "Please use the back button in your browser to return to the previous page "
58
  "and try to fix the code error."
59
  msgstr ""
60
 
61
- #: php/admin-menus/class-edit-menu.php:167
62
  msgid ""
63
  "If you prefer, you can close this page and discard the changes you just "
64
  "made. No changes will be made to this site."
65
  msgstr ""
66
 
67
- #: php/admin-menus/class-edit-menu.php:301 php/class-list-table.php:363
68
  msgid "Description"
69
  msgstr ""
70
 
71
- #: php/admin-menus/class-edit-menu.php:334 php/class-list-table.php:364
72
  msgid "Tags"
73
  msgstr ""
74
 
75
- #: php/admin-menus/class-edit-menu.php:339
76
  msgid "Enter a list of tags; separated by commas"
77
  msgstr ""
78
 
79
- #: php/admin-menus/class-edit-menu.php:362
 
 
 
 
 
 
 
 
 
 
80
  msgid "Run snippet everywhere"
81
  msgstr ""
82
 
83
- #: php/admin-menus/class-edit-menu.php:363
84
  msgid "Only run in administration area"
85
  msgstr ""
86
 
87
- #: php/admin-menus/class-edit-menu.php:364
88
  msgid "Only run on site front-end"
89
  msgstr ""
90
 
91
- #: php/admin-menus/class-edit-menu.php:365
92
  msgid "Only run once"
93
  msgstr ""
94
 
95
- #: php/admin-menus/class-edit-menu.php:368
96
  msgid "Scope"
97
  msgstr ""
98
 
99
- #: php/admin-menus/class-edit-menu.php:388
100
  msgid "Sharing Settings"
101
  msgstr ""
102
 
103
- #: php/admin-menus/class-edit-menu.php:392
104
  msgid "Allow this snippet to be activated on individual sites on the network"
105
  msgstr ""
106
 
107
- #: php/admin-menus/class-edit-menu.php:452
108
  #, php-format
109
  msgid "The snippet has been deactivated due to an error on line %d:"
110
  msgstr ""
111
 
112
- #: php/admin-menus/class-edit-menu.php:457
113
  msgid "The snippet has been deactivated due to an error in the code."
114
  msgstr ""
115
 
116
- #: php/admin-menus/class-edit-menu.php:464
117
  msgid "An error occurred when saving the snippet."
118
  msgstr ""
119
 
120
- #: php/admin-menus/class-edit-menu.php:469
121
  msgid "Snippet <strong>added</strong>."
122
  msgstr ""
123
 
124
- #: php/admin-menus/class-edit-menu.php:470
125
  msgid "Snippet <strong>updated</strong>."
126
  msgstr ""
127
 
128
- #: php/admin-menus/class-edit-menu.php:471
129
  msgid "Snippet <strong>added</strong> and <strong>activated</strong>."
130
  msgstr ""
131
 
132
- #: php/admin-menus/class-edit-menu.php:472
133
  msgid "Snippet <strong>added</strong> and <strong>executed</strong>."
134
  msgstr ""
135
 
136
- #: php/admin-menus/class-edit-menu.php:473
137
  msgid "Snippet <strong>updated</strong> and <strong>activated</strong>."
138
  msgstr ""
139
 
140
- #: php/admin-menus/class-edit-menu.php:474
141
  msgid "Snippet <strong>updated</strong> and <strong>deactivated</strong>."
142
  msgstr ""
143
 
@@ -146,7 +156,7 @@ msgctxt "menu label"
146
  msgid "Import"
147
  msgstr ""
148
 
149
- #: php/admin-menus/class-import-menu.php:16 php/views/import.php:17
150
  msgid "Import Snippets"
151
  msgstr ""
152
 
@@ -183,17 +193,17 @@ msgid "All Snippets"
183
  msgstr ""
184
 
185
  #: php/admin-menus/class-manage-menu.php:23
186
- #: php/admin-menus/class-manage-menu.php:45 php/class-admin.php:61
187
- #: php/class-admin.php:150 php/views/manage.php:19
188
  msgid "Snippets"
189
  msgstr ""
190
 
191
- #: php/admin-menus/class-manage-menu.php:46
192
  msgctxt "top-level menu label"
193
  msgid "Snippets"
194
  msgstr ""
195
 
196
- #: php/admin-menus/class-manage-menu.php:81
197
  msgid ""
198
  "<strong>Warning:</strong> Safe mode is active and snippets will not execute! "
199
  "Remove the <code>CODE_SNIPPETS_SAFE_MODE</code> constant from <code>wp-"
@@ -201,34 +211,42 @@ msgid ""
201
  "sheabunge/code-snippets/wiki/Safe-Mode\" target=\"_blank\">Help</a>"
202
  msgstr ""
203
 
204
- #: php/admin-menus/class-manage-menu.php:87
205
  msgid "Snippet <strong>executed</strong>."
206
  msgstr ""
207
 
208
- #: php/admin-menus/class-manage-menu.php:88
209
  msgid "Snippet <strong>activated</strong>."
210
  msgstr ""
211
 
212
- #: php/admin-menus/class-manage-menu.php:89
213
  msgid "Selected snippets <strong>activated</strong>."
214
  msgstr ""
215
 
216
- #: php/admin-menus/class-manage-menu.php:90
217
  msgid "Snippet <strong>deactivated</strong>."
218
  msgstr ""
219
 
220
- #: php/admin-menus/class-manage-menu.php:91
221
  msgid "Selected snippets <strong>deactivated</strong>."
222
  msgstr ""
223
 
224
- #: php/admin-menus/class-manage-menu.php:92
225
  msgid "Snippet <strong>deleted</strong>."
226
  msgstr ""
227
 
228
- #: php/admin-menus/class-manage-menu.php:93
229
  msgid "Selected snippets <strong>deleted</strong>."
230
  msgstr ""
231
 
 
 
 
 
 
 
 
 
232
  #: php/admin-menus/class-settings-menu.php:16
233
  msgctxt "menu label"
234
  msgid "Settings"
@@ -238,11 +256,19 @@ msgstr ""
238
  msgid "Snippets Settings"
239
  msgstr ""
240
 
241
- #: php/admin-menus/class-settings-menu.php:46
 
 
 
 
242
  msgid "Settings"
243
  msgstr ""
244
 
245
- #: php/admin-menus/class-settings-menu.php:81 php/settings/settings.php:204
 
 
 
 
246
  msgid "Settings saved."
247
  msgstr ""
248
 
@@ -484,147 +510,189 @@ msgid ""
484
  "<a href=\"%s\">Manage Snippets</a> page."
485
  msgstr ""
486
 
487
- #: php/class-list-table.php:58
488
- msgid "Snippets per page"
489
  msgstr ""
490
 
491
- #: php/class-list-table.php:121 php/class-list-table.php:409
492
- msgid "Network Deactivate"
493
  msgstr ""
494
 
495
- #: php/class-list-table.php:121 php/class-list-table.php:205
496
- #: php/class-list-table.php:409
497
- msgid "Deactivate"
498
  msgstr ""
499
 
500
- #: php/class-list-table.php:131
501
- msgid "Run Once"
502
  msgstr ""
503
 
504
- #: php/class-list-table.php:141 php/class-list-table.php:408
505
- msgid "Network Activate"
506
  msgstr ""
507
 
508
- #: php/class-list-table.php:141 php/class-list-table.php:205
509
- #: php/class-list-table.php:408
510
- msgid "Activate"
 
511
  msgstr ""
512
 
513
- #: php/class-list-table.php:151 php/class-list-table.php:221
514
- msgid "Edit"
515
  msgstr ""
516
 
517
- #: php/class-list-table.php:157 php/class-list-table.php:227
518
- #: php/class-list-table.php:411 php/views/edit.php:122
519
- msgid "Export"
520
  msgstr ""
521
 
522
- #: php/class-list-table.php:166 php/class-list-table.php:239
523
- #: php/class-list-table.php:412 php/views/edit.php:135
524
- msgid "Delete"
 
525
  msgstr ""
526
 
527
- #: php/class-list-table.php:173 php/class-list-table.php:249
528
- msgid "You are about to permanently delete the selected item."
529
  msgstr ""
530
 
531
- #: php/class-list-table.php:174 php/class-list-table.php:250
532
- #: php/views/edit.php:130
533
- msgid "'Cancel' to stop, 'OK' to delete."
534
  msgstr ""
535
 
536
- #: php/class-list-table.php:181
537
  msgid "Network Active"
538
  msgstr ""
539
 
540
- #: php/class-list-table.php:183
541
  msgid "Network Only"
542
  msgstr ""
543
 
544
- #: php/class-list-table.php:270
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
545
  #, php-format
546
  msgid "Untitled #%d"
547
  msgstr ""
548
 
549
- #: php/class-list-table.php:298
550
  msgid "Shared on Network"
551
  msgstr ""
552
 
553
- #: php/class-list-table.php:361 php/views/edit.php:46
554
  msgid "Name"
555
  msgstr ""
556
 
557
- #: php/class-list-table.php:362
558
  msgid "ID"
559
  msgstr ""
560
 
561
- #: php/class-list-table.php:410 php/views/edit.php:117
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
562
  msgid "Download"
563
  msgstr ""
564
 
565
- #: php/class-list-table.php:450
566
  #, php-format
567
  msgid "All <span class=\"count\">(%s)</span>"
568
  msgid_plural "All <span class=\"count\">(%s)</span>"
569
  msgstr[0] ""
570
  msgstr[1] ""
571
 
572
- #: php/class-list-table.php:451
573
  #, php-format
574
  msgid "Active <span class=\"count\">(%s)</span>"
575
  msgid_plural "Active <span class=\"count\">(%s)</span>"
576
  msgstr[0] ""
577
  msgstr[1] ""
578
 
579
- #: php/class-list-table.php:452
580
  #, php-format
581
  msgid "Inactive <span class=\"count\">(%s)</span>"
582
  msgid_plural "Inactive <span class=\"count\">(%s)</span>"
583
  msgstr[0] ""
584
  msgstr[1] ""
585
 
586
- #: php/class-list-table.php:453
587
  #, php-format
588
  msgid "Recently Active <span class=\"count\">(%s)</span>"
589
  msgid_plural "Recently Active <span class=\"count\">(%s)</span>"
590
  msgstr[0] ""
591
  msgstr[1] ""
592
 
593
- #: php/class-list-table.php:516
594
  msgid "Show all tags"
595
  msgstr ""
596
 
597
- #: php/class-list-table.php:530
598
  msgid "Filter"
599
  msgstr ""
600
 
601
- #: php/class-list-table.php:538
602
  msgid "Clear List"
603
  msgstr ""
604
 
605
- #: php/class-list-table.php:728
606
- msgid "Whoops, it looks like no snippets could be found."
607
  msgstr ""
608
 
609
- #: php/class-list-table.php:732
610
  msgid "Perhaps you would like to add a new one?"
611
  msgstr ""
612
 
613
- #: php/class-list-table.php:1030
614
  msgid "Search results"
615
  msgstr ""
616
 
617
- #: php/class-list-table.php:1033
618
  #, php-format
619
  msgid " for &#8220;%s&#8221;"
620
  msgstr ""
621
 
622
- #: php/class-list-table.php:1037
623
  #, php-format
624
  msgid " in tag &#8220;%s&#8221;"
625
  msgstr ""
626
 
627
- #: php/class-list-table.php:1045
628
  msgid "Clear Filters"
629
  msgstr ""
630
 
@@ -662,106 +730,107 @@ msgid "Show snippet descriptions on admin pages"
662
  msgstr ""
663
 
664
  #: php/settings/settings-fields.php:70
665
- msgid "Show Network Snippets"
666
  msgstr ""
667
 
668
  #: php/settings/settings-fields.php:72
669
  msgid ""
670
- "Show network-wide snippets in the snippets table on subsites to super "
671
- "administrators only"
672
  msgstr ""
673
 
674
  #: php/settings/settings-fields.php:77
675
- msgid "Disable shortcode syntax highlighter"
676
  msgstr ""
677
 
678
- #: php/settings/settings-fields.php:79
 
679
  msgid ""
680
- "Disable the syntax highlighting for the [code_snippet] shortcode on the "
681
- "front-end"
682
  msgstr ""
683
 
684
- #: php/settings/settings-fields.php:92
685
  msgid "Row Height"
686
  msgstr ""
687
 
688
- #: php/settings/settings-fields.php:94
689
  msgid "rows"
690
  msgstr ""
691
 
692
- #: php/settings/settings-fields.php:100
693
  msgid "Use Full Editor"
694
  msgstr ""
695
 
696
- #: php/settings/settings-fields.php:102
697
  msgid "Enable all features of the visual editor"
698
  msgstr ""
699
 
700
- #: php/settings/settings-fields.php:107
701
  msgid "Media Buttons"
702
  msgstr ""
703
 
704
- #: php/settings/settings-fields.php:109
705
  msgid "Enable the add media buttons"
706
  msgstr ""
707
 
708
- #: php/settings/settings-fields.php:118
709
  msgid "Theme"
710
  msgstr ""
711
 
712
- #: php/settings/settings-fields.php:125
713
  msgid "Indent With Tabs"
714
  msgstr ""
715
 
716
- #: php/settings/settings-fields.php:127
717
  msgid "Use hard tabs (not spaces) for indentation."
718
  msgstr ""
719
 
720
- #: php/settings/settings-fields.php:133
721
  msgid "Tab Size"
722
  msgstr ""
723
 
724
- #: php/settings/settings-fields.php:135
725
  msgid "The width of a tab character."
726
  msgstr ""
727
 
728
- #: php/settings/settings-fields.php:142
729
  msgid "Indent Unit"
730
  msgstr ""
731
 
732
- #: php/settings/settings-fields.php:144
733
  msgid "How many spaces a block should be indented."
734
  msgstr ""
735
 
736
- #: php/settings/settings-fields.php:151
737
  msgid "Wrap Lines"
738
  msgstr ""
739
 
740
- #: php/settings/settings-fields.php:153
741
  msgid "Whether the editor should scroll or wrap for long lines."
742
  msgstr ""
743
 
744
- #: php/settings/settings-fields.php:159
745
  msgid "Line Numbers"
746
  msgstr ""
747
 
748
- #: php/settings/settings-fields.php:161
749
  msgid "Show line numbers to the left of the editor."
750
  msgstr ""
751
 
752
- #: php/settings/settings-fields.php:167
753
  msgid "Auto Close Brackets"
754
  msgstr ""
755
 
756
- #: php/settings/settings-fields.php:169
757
  msgid "Auto-close brackets and quotes when typed."
758
  msgstr ""
759
 
760
- #: php/settings/settings-fields.php:175
761
  msgid "Highlight Selection Matches"
762
  msgstr ""
763
 
764
- #: php/settings/settings-fields.php:176
765
  msgid "Highlight all instances of a currently selected word."
766
  msgstr ""
767
 
@@ -781,88 +850,108 @@ msgstr ""
781
  msgid "Editor Preview"
782
  msgstr ""
783
 
784
- #: php/views/edit.php:26 php/views/manage.php:22
785
  msgctxt "snippet"
786
  msgid "Add New"
787
  msgstr ""
788
 
789
- #: php/views/edit.php:47
790
  msgid "Enter title here"
791
  msgstr ""
792
 
793
- #: php/views/edit.php:52
794
  msgid "Code"
795
  msgstr ""
796
 
797
- #: php/views/edit.php:77
798
  msgid "Save Changes and Execute Once"
799
  msgstr ""
800
 
801
- #: php/views/edit.php:86 php/views/edit.php:100
802
  msgid "Save Changes and Activate"
803
  msgstr ""
804
 
805
- #: php/views/edit.php:106
806
  msgid "Save Changes and Deactivate"
807
  msgstr ""
808
 
809
- #: php/views/edit.php:129
810
  msgid "You are about to permanently delete this snippet."
811
  msgstr ""
812
 
813
- #: php/views/import.php:21
814
  msgid ""
815
  "Upload one or more Code Snippets export files and the snippets will be "
816
  "imported."
817
  msgstr ""
818
 
819
- #: php/views/import.php:25
820
  #, php-format
821
  msgid ""
822
- "Afterwards, you will need to go to the <a href=\"%s\">All Snippets</a> page "
823
  "to activate the imported snippets."
824
  msgstr ""
825
 
826
- #: php/views/import.php:29
827
- msgid ""
828
- "Choose one or more Code Snippets (.xml or .json) files to upload, then click "
829
- "\"Upload files and import\"."
830
- msgstr ""
831
-
832
  #: php/views/import.php:36
833
- msgid "Choose a file from your computer:"
 
 
834
  msgstr ""
835
 
836
- #: php/views/import.php:37
837
- msgid "(Maximum size: 8MB)"
838
  msgstr ""
839
 
840
- #: php/views/import.php:44
841
  msgid ""
842
  "What should happen if an existing snippet is found with an identical name to "
843
  "an imported snippet?"
844
  msgstr ""
845
 
846
- #: php/views/import.php:50
847
  msgid ""
848
  "Ignore any duplicate snippets: import all snippets from the file regardless "
849
  "and leave all existing snippets unchanged."
850
  msgstr ""
851
 
852
- #: php/views/import.php:57
853
  msgid ""
854
  "Replace any existing snippets with a newly imported snippet of the same name."
855
  msgstr ""
856
 
857
- #: php/views/import.php:64
858
  msgid ""
859
  "Do not import any duplicate snippets; leave all existing snippets unchanged."
860
  msgstr ""
861
 
862
- #: php/views/import.php:70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
863
  msgid "Upload files and import"
864
  msgstr ""
865
 
866
- #: php/views/manage.php:34
 
 
 
 
 
867
  msgid "Search Installed Snippets"
868
  msgstr ""
6
  #, fuzzy
7
  msgid ""
8
  msgstr ""
9
+ "Project-Id-Version: code-snippets 2.12.0\n"
10
  "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2018-09-23 23:48+1000\n"
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
23
  msgstr ""
24
 
25
  #: php/admin-menus/class-edit-menu.php:13
26
+ #: php/admin-menus/class-edit-menu.php:14 php/views/edit.php:31
27
  msgid "Edit Snippet"
28
  msgstr ""
29
 
32
  msgid "Add New"
33
  msgstr ""
34
 
35
+ #: php/admin-menus/class-edit-menu.php:40 php/views/edit.php:37
36
  msgid "Add New Snippet"
37
  msgstr ""
38
 
39
+ #: php/admin-menus/class-edit-menu.php:164
40
  msgid "Don't Panic"
41
  msgstr ""
42
 
43
+ #: php/admin-menus/class-edit-menu.php:165
44
  #, php-format
45
  msgid ""
46
  "The code snippet you are trying to save produced a fatal error on line %d:"
47
  msgstr ""
48
 
49
+ #: php/admin-menus/class-edit-menu.php:167
50
  msgid ""
51
  "The previous version of the snippet is unchanged, and the rest of this site "
52
  "should be functioning normally as before."
53
  msgstr ""
54
 
55
+ #: php/admin-menus/class-edit-menu.php:168
56
  msgid ""
57
  "Please use the back button in your browser to return to the previous page "
58
  "and try to fix the code error."
59
  msgstr ""
60
 
61
+ #: php/admin-menus/class-edit-menu.php:169
62
  msgid ""
63
  "If you prefer, you can close this page and discard the changes you just "
64
  "made. No changes will be made to this site."
65
  msgstr ""
66
 
67
+ #: php/admin-menus/class-edit-menu.php:309 php/class-list-table.php:332
68
  msgid "Description"
69
  msgstr ""
70
 
71
+ #: php/admin-menus/class-edit-menu.php:342 php/class-list-table.php:333
72
  msgid "Tags"
73
  msgstr ""
74
 
75
+ #: php/admin-menus/class-edit-menu.php:347
76
  msgid "Enter a list of tags; separated by commas"
77
  msgstr ""
78
 
79
+ #: php/admin-menus/class-edit-menu.php:369
80
+ msgid ""
81
+ "Snippets with a lower priority number will run before those with a higher "
82
+ "number."
83
+ msgstr ""
84
+
85
+ #: php/admin-menus/class-edit-menu.php:370 php/class-list-table.php:334
86
+ msgid "Priority"
87
+ msgstr ""
88
+
89
+ #: php/admin-menus/class-edit-menu.php:387
90
  msgid "Run snippet everywhere"
91
  msgstr ""
92
 
93
+ #: php/admin-menus/class-edit-menu.php:388
94
  msgid "Only run in administration area"
95
  msgstr ""
96
 
97
+ #: php/admin-menus/class-edit-menu.php:389
98
  msgid "Only run on site front-end"
99
  msgstr ""
100
 
101
+ #: php/admin-menus/class-edit-menu.php:390
102
  msgid "Only run once"
103
  msgstr ""
104
 
105
+ #: php/admin-menus/class-edit-menu.php:393
106
  msgid "Scope"
107
  msgstr ""
108
 
109
+ #: php/admin-menus/class-edit-menu.php:413
110
  msgid "Sharing Settings"
111
  msgstr ""
112
 
113
+ #: php/admin-menus/class-edit-menu.php:417
114
  msgid "Allow this snippet to be activated on individual sites on the network"
115
  msgstr ""
116
 
117
+ #: php/admin-menus/class-edit-menu.php:477
118
  #, php-format
119
  msgid "The snippet has been deactivated due to an error on line %d:"
120
  msgstr ""
121
 
122
+ #: php/admin-menus/class-edit-menu.php:482
123
  msgid "The snippet has been deactivated due to an error in the code."
124
  msgstr ""
125
 
126
+ #: php/admin-menus/class-edit-menu.php:489
127
  msgid "An error occurred when saving the snippet."
128
  msgstr ""
129
 
130
+ #: php/admin-menus/class-edit-menu.php:494
131
  msgid "Snippet <strong>added</strong>."
132
  msgstr ""
133
 
134
+ #: php/admin-menus/class-edit-menu.php:495
135
  msgid "Snippet <strong>updated</strong>."
136
  msgstr ""
137
 
138
+ #: php/admin-menus/class-edit-menu.php:496
139
  msgid "Snippet <strong>added</strong> and <strong>activated</strong>."
140
  msgstr ""
141
 
142
+ #: php/admin-menus/class-edit-menu.php:497
143
  msgid "Snippet <strong>added</strong> and <strong>executed</strong>."
144
  msgstr ""
145
 
146
+ #: php/admin-menus/class-edit-menu.php:498
147
  msgid "Snippet <strong>updated</strong> and <strong>activated</strong>."
148
  msgstr ""
149
 
150
+ #: php/admin-menus/class-edit-menu.php:499
151
  msgid "Snippet <strong>updated</strong> and <strong>deactivated</strong>."
152
  msgstr ""
153
 
156
  msgid "Import"
157
  msgstr ""
158
 
159
+ #: php/admin-menus/class-import-menu.php:16 php/views/import.php:21
160
  msgid "Import Snippets"
161
  msgstr ""
162
 
193
  msgstr ""
194
 
195
  #: php/admin-menus/class-manage-menu.php:23
196
+ #: php/admin-menus/class-manage-menu.php:46 php/class-admin.php:61
197
+ #: php/class-admin.php:150 php/views/manage.php:21
198
  msgid "Snippets"
199
  msgstr ""
200
 
201
+ #: php/admin-menus/class-manage-menu.php:47
202
  msgctxt "top-level menu label"
203
  msgid "Snippets"
204
  msgstr ""
205
 
206
+ #: php/admin-menus/class-manage-menu.php:94
207
  msgid ""
208
  "<strong>Warning:</strong> Safe mode is active and snippets will not execute! "
209
  "Remove the <code>CODE_SNIPPETS_SAFE_MODE</code> constant from <code>wp-"
211
  "sheabunge/code-snippets/wiki/Safe-Mode\" target=\"_blank\">Help</a>"
212
  msgstr ""
213
 
214
+ #: php/admin-menus/class-manage-menu.php:100
215
  msgid "Snippet <strong>executed</strong>."
216
  msgstr ""
217
 
218
+ #: php/admin-menus/class-manage-menu.php:101
219
  msgid "Snippet <strong>activated</strong>."
220
  msgstr ""
221
 
222
+ #: php/admin-menus/class-manage-menu.php:102
223
  msgid "Selected snippets <strong>activated</strong>."
224
  msgstr ""
225
 
226
+ #: php/admin-menus/class-manage-menu.php:103
227
  msgid "Snippet <strong>deactivated</strong>."
228
  msgstr ""
229
 
230
+ #: php/admin-menus/class-manage-menu.php:104
231
  msgid "Selected snippets <strong>deactivated</strong>."
232
  msgstr ""
233
 
234
+ #: php/admin-menus/class-manage-menu.php:105
235
  msgid "Snippet <strong>deleted</strong>."
236
  msgstr ""
237
 
238
+ #: php/admin-menus/class-manage-menu.php:106
239
  msgid "Selected snippets <strong>deleted</strong>."
240
  msgstr ""
241
 
242
+ #: php/admin-menus/class-manage-menu.php:107
243
+ msgid "Snippet <strong>cloned</strong>."
244
+ msgstr ""
245
+
246
+ #: php/admin-menus/class-manage-menu.php:108
247
+ msgid "Selected snippets <strong>cloned</strong>."
248
+ msgstr ""
249
+
250
  #: php/admin-menus/class-settings-menu.php:16
251
  msgctxt "menu label"
252
  msgid "Settings"
256
  msgid "Snippets Settings"
257
  msgstr ""
258
 
259
+ #: php/admin-menus/class-settings-menu.php:35
260
+ msgid "All settings have been reset to their defaults."
261
+ msgstr ""
262
+
263
+ #: php/admin-menus/class-settings-menu.php:61
264
  msgid "Settings"
265
  msgstr ""
266
 
267
+ #: php/admin-menus/class-settings-menu.php:77
268
+ msgid "Reset to Default"
269
+ msgstr ""
270
+
271
+ #: php/admin-menus/class-settings-menu.php:103 php/settings/settings.php:204
272
  msgid "Settings saved."
273
  msgstr ""
274
 
510
  "<a href=\"%s\">Manage Snippets</a> page."
511
  msgstr ""
512
 
513
+ #: php/class-db.php:168
514
+ msgid "Example HTML shortcode"
515
  msgstr ""
516
 
517
+ #: php/class-db.php:171
518
+ msgid "write your HTML shortcode content here"
519
  msgstr ""
520
 
521
+ #: php/class-db.php:173
522
+ msgid ""
523
+ "This is an example snippet for demonstrating how to add an HTML shortcode."
524
  msgstr ""
525
 
526
+ #: php/class-db.php:178
527
+ msgid "Example CSS snippet"
528
  msgstr ""
529
 
530
+ #: php/class-db.php:181
531
+ msgid "write your CSS code here"
532
  msgstr ""
533
 
534
+ #: php/class-db.php:183
535
+ msgid ""
536
+ "This is an example snippet for demonstrating how to add custom CSS code to "
537
+ "your website."
538
  msgstr ""
539
 
540
+ #: php/class-db.php:189
541
+ msgid "Example JavaScript snippet"
542
  msgstr ""
543
 
544
+ #: php/class-db.php:192
545
+ msgid "write your JavaScript code here"
 
546
  msgstr ""
547
 
548
+ #: php/class-db.php:194
549
+ msgid ""
550
+ "This is an example snippet for demonstrating how to add custom JavaScript "
551
+ "code to your website."
552
  msgstr ""
553
 
554
+ #: php/class-db.php:202
555
+ msgid "You can remove it, or edit it to add your own content."
556
  msgstr ""
557
 
558
+ #: php/class-list-table.php:58
559
+ msgid "Snippets per page"
 
560
  msgstr ""
561
 
562
+ #: php/class-list-table.php:147
563
  msgid "Network Active"
564
  msgstr ""
565
 
566
+ #: php/class-list-table.php:149
567
  msgid "Network Only"
568
  msgstr ""
569
 
570
+ #: php/class-list-table.php:155
571
+ msgid "Edit"
572
+ msgstr ""
573
+
574
+ #: php/class-list-table.php:156 php/class-list-table.php:373
575
+ msgid "Clone"
576
+ msgstr ""
577
+
578
+ #: php/class-list-table.php:157 php/class-list-table.php:375
579
+ #: php/views/edit.php:130
580
+ msgid "Export"
581
+ msgstr ""
582
+
583
+ #: php/class-list-table.php:166 php/class-list-table.php:376
584
+ #: php/views/edit.php:143
585
+ msgid "Delete"
586
+ msgstr ""
587
+
588
+ #: php/class-list-table.php:170
589
+ msgid "You are about to permanently delete the selected item."
590
+ msgstr ""
591
+
592
+ #: php/class-list-table.php:171 php/views/edit.php:138
593
+ msgid "'Cancel' to stop, 'OK' to delete."
594
+ msgstr ""
595
+
596
+ #: php/class-list-table.php:230
597
  #, php-format
598
  msgid "Untitled #%d"
599
  msgstr ""
600
 
601
+ #: php/class-list-table.php:254
602
  msgid "Shared on Network"
603
  msgstr ""
604
 
605
+ #: php/class-list-table.php:330 php/views/edit.php:54
606
  msgid "Name"
607
  msgstr ""
608
 
609
+ #: php/class-list-table.php:331
610
  msgid "ID"
611
  msgstr ""
612
 
613
+ #: php/class-list-table.php:371
614
+ msgid "Network Activate"
615
+ msgstr ""
616
+
617
+ #: php/class-list-table.php:371
618
+ msgid "Activate"
619
+ msgstr ""
620
+
621
+ #: php/class-list-table.php:372
622
+ msgid "Network Deactivate"
623
+ msgstr ""
624
+
625
+ #: php/class-list-table.php:372
626
+ msgid "Deactivate"
627
+ msgstr ""
628
+
629
+ #: php/class-list-table.php:374 php/views/edit.php:125
630
  msgid "Download"
631
  msgstr ""
632
 
633
+ #: php/class-list-table.php:416
634
  #, php-format
635
  msgid "All <span class=\"count\">(%s)</span>"
636
  msgid_plural "All <span class=\"count\">(%s)</span>"
637
  msgstr[0] ""
638
  msgstr[1] ""
639
 
640
+ #: php/class-list-table.php:417
641
  #, php-format
642
  msgid "Active <span class=\"count\">(%s)</span>"
643
  msgid_plural "Active <span class=\"count\">(%s)</span>"
644
  msgstr[0] ""
645
  msgstr[1] ""
646
 
647
+ #: php/class-list-table.php:418
648
  #, php-format
649
  msgid "Inactive <span class=\"count\">(%s)</span>"
650
  msgid_plural "Inactive <span class=\"count\">(%s)</span>"
651
  msgstr[0] ""
652
  msgstr[1] ""
653
 
654
+ #: php/class-list-table.php:419
655
  #, php-format
656
  msgid "Recently Active <span class=\"count\">(%s)</span>"
657
  msgid_plural "Recently Active <span class=\"count\">(%s)</span>"
658
  msgstr[0] ""
659
  msgstr[1] ""
660
 
661
+ #: php/class-list-table.php:488
662
  msgid "Show all tags"
663
  msgstr ""
664
 
665
+ #: php/class-list-table.php:502
666
  msgid "Filter"
667
  msgstr ""
668
 
669
+ #: php/class-list-table.php:510
670
  msgid "Clear List"
671
  msgstr ""
672
 
673
+ #: php/class-list-table.php:725
674
+ msgid "It looks like you don't have any snippets."
675
  msgstr ""
676
 
677
+ #: php/class-list-table.php:729
678
  msgid "Perhaps you would like to add a new one?"
679
  msgstr ""
680
 
681
+ #: php/class-list-table.php:1025
682
  msgid "Search results"
683
  msgstr ""
684
 
685
+ #: php/class-list-table.php:1028
686
  #, php-format
687
  msgid " for &#8220;%s&#8221;"
688
  msgstr ""
689
 
690
+ #: php/class-list-table.php:1032
691
  #, php-format
692
  msgid " in tag &#8220;%s&#8221;"
693
  msgstr ""
694
 
695
+ #: php/class-list-table.php:1040
696
  msgid "Clear Filters"
697
  msgstr ""
698
 
730
  msgstr ""
731
 
732
  #: php/settings/settings-fields.php:70
733
+ msgid "Disable Shortcode Syntax Highlighter"
734
  msgstr ""
735
 
736
  #: php/settings/settings-fields.php:72
737
  msgid ""
738
+ "Disable the syntax highlighting for the [code_snippet] shortcode on the "
739
+ "front-end"
740
  msgstr ""
741
 
742
  #: php/settings/settings-fields.php:77
743
+ msgid "Complete Uninstall"
744
  msgstr ""
745
 
746
+ #: php/settings/settings-fields.php:80
747
+ #, php-format
748
  msgid ""
749
+ "When the plugin is deleted from the <a href=\"%s\">Plugins</a> menu, also "
750
+ "delete all snippets and plugin settings."
751
  msgstr ""
752
 
753
+ #: php/settings/settings-fields.php:95
754
  msgid "Row Height"
755
  msgstr ""
756
 
757
+ #: php/settings/settings-fields.php:97
758
  msgid "rows"
759
  msgstr ""
760
 
761
+ #: php/settings/settings-fields.php:103
762
  msgid "Use Full Editor"
763
  msgstr ""
764
 
765
+ #: php/settings/settings-fields.php:105
766
  msgid "Enable all features of the visual editor"
767
  msgstr ""
768
 
769
+ #: php/settings/settings-fields.php:110
770
  msgid "Media Buttons"
771
  msgstr ""
772
 
773
+ #: php/settings/settings-fields.php:112
774
  msgid "Enable the add media buttons"
775
  msgstr ""
776
 
777
+ #: php/settings/settings-fields.php:121
778
  msgid "Theme"
779
  msgstr ""
780
 
781
+ #: php/settings/settings-fields.php:128
782
  msgid "Indent With Tabs"
783
  msgstr ""
784
 
785
+ #: php/settings/settings-fields.php:130
786
  msgid "Use hard tabs (not spaces) for indentation."
787
  msgstr ""
788
 
789
+ #: php/settings/settings-fields.php:136
790
  msgid "Tab Size"
791
  msgstr ""
792
 
793
+ #: php/settings/settings-fields.php:138
794
  msgid "The width of a tab character."
795
  msgstr ""
796
 
797
+ #: php/settings/settings-fields.php:145
798
  msgid "Indent Unit"
799
  msgstr ""
800
 
801
+ #: php/settings/settings-fields.php:147
802
  msgid "How many spaces a block should be indented."
803
  msgstr ""
804
 
805
+ #: php/settings/settings-fields.php:154
806
  msgid "Wrap Lines"
807
  msgstr ""
808
 
809
+ #: php/settings/settings-fields.php:156
810
  msgid "Whether the editor should scroll or wrap for long lines."
811
  msgstr ""
812
 
813
+ #: php/settings/settings-fields.php:162
814
  msgid "Line Numbers"
815
  msgstr ""
816
 
817
+ #: php/settings/settings-fields.php:164
818
  msgid "Show line numbers to the left of the editor."
819
  msgstr ""
820
 
821
+ #: php/settings/settings-fields.php:170
822
  msgid "Auto Close Brackets"
823
  msgstr ""
824
 
825
+ #: php/settings/settings-fields.php:172
826
  msgid "Auto-close brackets and quotes when typed."
827
  msgstr ""
828
 
829
+ #: php/settings/settings-fields.php:178
830
  msgid "Highlight Selection Matches"
831
  msgstr ""
832
 
833
+ #: php/settings/settings-fields.php:179
834
  msgid "Highlight all instances of a currently selected word."
835
  msgstr ""
836
 
850
  msgid "Editor Preview"
851
  msgstr ""
852
 
853
+ #: php/views/edit.php:34 php/views/manage.php:24
854
  msgctxt "snippet"
855
  msgid "Add New"
856
  msgstr ""
857
 
858
+ #: php/views/edit.php:55
859
  msgid "Enter title here"
860
  msgstr ""
861
 
862
+ #: php/views/edit.php:60
863
  msgid "Code"
864
  msgstr ""
865
 
866
+ #: php/views/edit.php:85
867
  msgid "Save Changes and Execute Once"
868
  msgstr ""
869
 
870
+ #: php/views/edit.php:94 php/views/edit.php:108
871
  msgid "Save Changes and Activate"
872
  msgstr ""
873
 
874
+ #: php/views/edit.php:114
875
  msgid "Save Changes and Deactivate"
876
  msgstr ""
877
 
878
+ #: php/views/edit.php:137
879
  msgid "You are about to permanently delete this snippet."
880
  msgstr ""
881
 
882
+ #: php/views/import.php:25
883
  msgid ""
884
  "Upload one or more Code Snippets export files and the snippets will be "
885
  "imported."
886
  msgstr ""
887
 
888
+ #: php/views/import.php:29
889
  #, php-format
890
  msgid ""
891
+ "Afterwards, you will need to visit the <a href=\"%s\">All Snippets</a> page "
892
  "to activate the imported snippets."
893
  msgstr ""
894
 
 
 
 
 
 
 
895
  #: php/views/import.php:36
896
+ msgid ""
897
+ "Before you can upload your import file, you will need to fix the following "
898
+ "error:"
899
  msgstr ""
900
 
901
+ #: php/views/import.php:46
902
+ msgid "Duplicate Snippets"
903
  msgstr ""
904
 
905
+ #: php/views/import.php:49
906
  msgid ""
907
  "What should happen if an existing snippet is found with an identical name to "
908
  "an imported snippet?"
909
  msgstr ""
910
 
911
+ #: php/views/import.php:56
912
  msgid ""
913
  "Ignore any duplicate snippets: import all snippets from the file regardless "
914
  "and leave all existing snippets unchanged."
915
  msgstr ""
916
 
917
+ #: php/views/import.php:63
918
  msgid ""
919
  "Replace any existing snippets with a newly imported snippet of the same name."
920
  msgstr ""
921
 
922
+ #: php/views/import.php:70
923
  msgid ""
924
  "Do not import any duplicate snippets; leave all existing snippets unchanged."
925
  msgstr ""
926
 
927
+ #: php/views/import.php:75
928
+ msgid "Upload Files"
929
+ msgstr ""
930
+
931
+ #: php/views/import.php:78
932
+ msgid ""
933
+ "Choose one or more Code Snippets (.xml or .json) files to upload, then click "
934
+ "\"Upload files and import\"."
935
+ msgstr ""
936
+
937
+ #: php/views/import.php:83
938
+ msgid "Choose files from your computer:"
939
+ msgstr ""
940
+
941
+ #: php/views/import.php:84
942
+ #, php-format
943
+ msgid "(Maximum size: %s)"
944
+ msgstr ""
945
+
946
+ #: php/views/import.php:93
947
  msgid "Upload files and import"
948
  msgstr ""
949
 
950
+ #: php/views/manage.php:29
951
+ msgctxt "snippets"
952
+ msgid "Import"
953
+ msgstr ""
954
+
955
+ #: php/views/manage.php:41
956
  msgid "Search Installed Snippets"
957
  msgstr ""
php/admin-menus/class-edit-menu.php CHANGED
@@ -72,6 +72,8 @@ class Code_Snippets_Edit_Menu extends Code_Snippets_Admin_Menu {
72
  add_action( 'code_snippets/admin/single', array( $this, 'render_tags_editor' ) );
73
  }
74
 
 
 
75
  if ( code_snippets_get_setting( 'general', 'snippet_scope_enabled' ) ) {
76
  add_action( 'code_snippets/admin/single', array( $this, 'render_scope_setting' ), 1 );
77
  }
@@ -160,7 +162,7 @@ class Code_Snippets_Edit_Menu extends Code_Snippets_Admin_Menu {
160
  }
161
 
162
  $m = '<h3>' . __( "Don't Panic", 'code-snippets' ) . '</h3>';
163
- $m .= '<p>' . sprintf( __( 'The code snippet you are trying to save produced a fatal error on line %d:', 'code_snippets' ), $error['line'] ) . '</p>';
164
  $m .= '<strong>' . $error['message'] . '</strong>';
165
  $m .= '<p>' . __( 'The previous version of the snippet is unchanged, and the rest of this site should be functioning normally as before.', 'code-snippets' ) . '</p>';
166
  $m .= '<p>' . __( 'Please use the back button in your browser to return to the previous page and try to fix the code error.', 'code-snippets' );
@@ -283,10 +285,16 @@ class Code_Snippets_Edit_Menu extends Code_Snippets_Admin_Menu {
283
  }
284
 
285
  /* Redirect to edit snippet page */
286
- wp_redirect( add_query_arg(
287
  array( 'id' => $snippet_id, 'result' => $result ),
288
  code_snippets()->get_menu_url( 'edit' )
289
- ) );
 
 
 
 
 
 
290
  exit;
291
  }
292
 
@@ -343,12 +351,29 @@ class Code_Snippets_Edit_Menu extends Code_Snippets_Admin_Menu {
343
  jQuery('#snippet_tags').tagit({
344
  availableTags: <?php echo wp_json_encode( get_all_snippet_tags() ); ?>,
345
  allowSpaces: true,
346
- removeConfirmation: true
 
347
  });
348
  </script>
349
  <?php
350
  }
351
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
352
  /**
353
  * Render the snippet scope setting
354
  *
72
  add_action( 'code_snippets/admin/single', array( $this, 'render_tags_editor' ) );
73
  }
74
 
75
+ add_action( 'code_snippets/admin/single', array( $this, 'render_priority_setting' ), 0 );
76
+
77
  if ( code_snippets_get_setting( 'general', 'snippet_scope_enabled' ) ) {
78
  add_action( 'code_snippets/admin/single', array( $this, 'render_scope_setting' ), 1 );
79
  }
162
  }
163
 
164
  $m = '<h3>' . __( "Don't Panic", 'code-snippets' ) . '</h3>';
165
+ $m .= '<p>' . sprintf( __( 'The code snippet you are trying to save produced a fatal error on line %d:', 'code-snippets' ), $error['line'] ) . '</p>';
166
  $m .= '<strong>' . $error['message'] . '</strong>';
167
  $m .= '<p>' . __( 'The previous version of the snippet is unchanged, and the rest of this site should be functioning normally as before.', 'code-snippets' ) . '</p>';
168
  $m .= '<p>' . __( 'Please use the back button in your browser to return to the previous page and try to fix the code error.', 'code-snippets' );
285
  }
286
 
287
  /* Redirect to edit snippet page */
288
+ $redirect_uri = add_query_arg(
289
  array( 'id' => $snippet_id, 'result' => $result ),
290
  code_snippets()->get_menu_url( 'edit' )
291
+ );
292
+
293
+ if ( isset( $_POST['snippet_editor_cursor'] ) ) {
294
+ $redirect_uri = add_query_arg( 'cursor', $_POST['snippet_editor_cursor'], $redirect_uri );
295
+ }
296
+
297
+ wp_redirect( esc_url_raw( $redirect_uri ) );
298
  exit;
299
  }
300
 
351
  jQuery('#snippet_tags').tagit({
352
  availableTags: <?php echo wp_json_encode( get_all_snippet_tags() ); ?>,
353
  allowSpaces: true,
354
+ removeConfirmation: true,
355
+ showAutocompleteOnFocus: true,
356
  });
357
  </script>
358
  <?php
359
  }
360
 
361
+ /**
362
+ * Render the snippet priority setting
363
+ *
364
+ * @param Code_Snippet $snippet the snippet currently being edited
365
+ */
366
+ public function render_priority_setting( Code_Snippet $snippet ) {
367
+ ?>
368
+ <p class="snippet-priority"
369
+ title="<?php esc_attr_e( 'Snippets with a lower priority number will run before those with a higher number.', 'code-snippets' ); ?>">
370
+ <label for="snippet_priority"><?php esc_html_e( 'Priority', 'code-snippets' ); ?></label>
371
+
372
+ <input name="snippet_priority" type="number" id="snippet_priority" value="<?php echo intval( $snippet->priority ); ?>">
373
+ </p>
374
+ <?php
375
+ }
376
+
377
  /**
378
  * Render the snippet scope setting
379
  *
php/admin-menus/class-manage-menu.php CHANGED
@@ -30,6 +30,7 @@ class Code_Snippets_Manage_Menu extends Code_Snippets_Admin_Menu {
30
  public function run() {
31
  parent::run();
32
  add_filter( 'set-screen-option', array( $this, 'save_screen_option' ), 10, 3 );
 
33
  }
34
 
35
  /**
@@ -68,6 +69,18 @@ class Code_Snippets_Manage_Menu extends Code_Snippets_Admin_Menu {
68
  /* Initialize the list table class */
69
  $this->list_table = new Code_Snippets_List_Table();
70
  $this->list_table->prepare_items();
 
 
 
 
 
 
 
 
 
 
 
 
71
  }
72
 
73
  /**
@@ -84,13 +97,15 @@ class Code_Snippets_Manage_Menu extends Code_Snippets_Admin_Menu {
84
 
85
  echo $this->get_result_message(
86
  array(
87
- 'executed' => __( 'Snippet <strong>executed</strong>.', 'code-snippets' ),
88
- 'activated' => __( 'Snippet <strong>activated</strong>.', 'code-snippets' ),
89
- 'activated-multi' => __( 'Selected snippets <strong>activated</strong>.', 'code-snippets' ),
90
- 'deactivated' => __( 'Snippet <strong>deactivated</strong>.', 'code-snippets' ),
91
  'deactivated-multi' => __( 'Selected snippets <strong>deactivated</strong>.', 'code-snippets' ),
92
- 'deleted' => __( 'Snippet <strong>deleted</strong>.', 'code-snippets' ),
93
- 'deleted-multi' => __( 'Selected snippets <strong>deleted</strong>.', 'code-snippets' ),
 
 
94
  )
95
  );
96
  }
@@ -98,10 +113,11 @@ class Code_Snippets_Manage_Menu extends Code_Snippets_Admin_Menu {
98
  /**
99
  * Handles saving the user's snippets per page preference
100
  *
101
- * @param unknown $status
102
- * @param string $option The screen option name
103
- * @param unknown $value
104
- * @return unknown
 
105
  */
106
  function save_screen_option( $status, $option, $value ) {
107
  if ( 'snippets_per_page' === $option ) {
@@ -110,4 +126,65 @@ class Code_Snippets_Manage_Menu extends Code_Snippets_Admin_Menu {
110
 
111
  return $status;
112
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  }
30
  public function run() {
31
  parent::run();
32
  add_filter( 'set-screen-option', array( $this, 'save_screen_option' ), 10, 3 );
33
+ add_action( 'wp_ajax_update_code_snippet', array( $this, 'ajax_callback' ) );
34
  }
35
 
36
  /**
69
  /* Initialize the list table class */
70
  $this->list_table = new Code_Snippets_List_Table();
71
  $this->list_table->prepare_items();
72
+
73
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
74
+ }
75
+
76
+ public function enqueue_scripts() {
77
+ $plugin = code_snippets();
78
+
79
+ wp_enqueue_script(
80
+ 'code-snippets-manage-js',
81
+ plugins_url( 'js/min/manage.js', $plugin->file ),
82
+ array(), $plugin->version, true
83
+ );
84
  }
85
 
86
  /**
97
 
98
  echo $this->get_result_message(
99
  array(
100
+ 'executed' => __( 'Snippet <strong>executed</strong>.', 'code-snippets' ),
101
+ 'activated' => __( 'Snippet <strong>activated</strong>.', 'code-snippets' ),
102
+ 'activated-multi' => __( 'Selected snippets <strong>activated</strong>.', 'code-snippets' ),
103
+ 'deactivated' => __( 'Snippet <strong>deactivated</strong>.', 'code-snippets' ),
104
  'deactivated-multi' => __( 'Selected snippets <strong>deactivated</strong>.', 'code-snippets' ),
105
+ 'deleted' => __( 'Snippet <strong>deleted</strong>.', 'code-snippets' ),
106
+ 'deleted-multi' => __( 'Selected snippets <strong>deleted</strong>.', 'code-snippets' ),
107
+ 'cloned' => __( 'Snippet <strong>cloned</strong>.', 'code-snippets' ),
108
+ 'cloned-multi' => __( 'Selected snippets <strong>cloned</strong>.', 'code-snippets' ),
109
  )
110
  );
111
  }
113
  /**
114
  * Handles saving the user's snippets per page preference
115
  *
116
+ * @param mixed $status
117
+ * @param string $option The screen option name
118
+ * @param mixed $value
119
+ *
120
+ * @return mixed
121
  */
122
  function save_screen_option( $status, $option, $value ) {
123
  if ( 'snippets_per_page' === $option ) {
126
 
127
  return $status;
128
  }
129
+
130
+ /**
131
+ * Handle AJAX requests
132
+ */
133
+ public function ajax_callback() {
134
+ check_ajax_referer( 'code_snippets_manage' );
135
+
136
+ if ( ! isset( $_POST['field'], $_POST['snippet'] ) ) {
137
+ wp_die( 'Snippet data not provided' );
138
+ }
139
+
140
+ $snippet_data = json_decode( stripslashes( $_POST['snippet'] ), true );
141
+
142
+ $snippet = new Code_Snippet( $snippet_data );
143
+ $field = $_POST['field'];
144
+
145
+ if ( 'priority' === $field ) {
146
+
147
+ if ( ! isset( $snippet_data['priority'] ) || ! is_numeric( $snippet_data['priority'] ) ) {
148
+ wp_die( 'missing snippet priority data' );
149
+ }
150
+
151
+ global $wpdb;
152
+
153
+ $wpdb->update(
154
+ code_snippets()->db->get_table_name( $snippet->network ),
155
+ array( 'priority' => $snippet->priority ),
156
+ array( 'id' => $snippet->id ),
157
+ array( '%d' ),
158
+ array( '%d' )
159
+ );
160
+
161
+ } elseif ( 'active' === $field ) {
162
+
163
+ if ( ! isset( $snippet_data['active'] ) ) {
164
+ wp_die( 'missing snippet active data' );
165
+ }
166
+
167
+ if ( $snippet->shared_network ) {
168
+ $active_shared_snippets = get_option( 'active_shared_network_snippets', array() );
169
+
170
+ if ( in_array( $snippet->id, $active_shared_snippets ) !== $snippet->active ) {
171
+
172
+ $active_shared_snippets = $snippet->active ?
173
+ array_merge( $active_shared_snippets, array( $snippet->id ) ) :
174
+ array_diff( $active_shared_snippets, array( $snippet->id ) );
175
+
176
+ update_option( 'active_shared_network_snippets', $active_shared_snippets );
177
+ }
178
+ } else {
179
+
180
+ if ( $snippet->active ) {
181
+ activate_snippet( $snippet->id, $snippet->network );
182
+ } else {
183
+ deactivate_snippet( $snippet->id, $snippet->network );
184
+ }
185
+ }
186
+ }
187
+
188
+ wp_die();
189
+ }
190
  }
php/admin-menus/class-settings-menu.php CHANGED
@@ -24,6 +24,21 @@ class Code_Snippets_Settings_Menu extends Code_Snippets_Admin_Menu {
24
  function load() {
25
  parent::load();
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  if ( is_network_admin() ) {
28
 
29
  if ( code_snippets_unified_settings() ) {
@@ -52,9 +67,16 @@ class Code_Snippets_Settings_Menu extends Code_Snippets_Admin_Menu {
52
 
53
  settings_fields( 'code-snippets' );
54
  do_settings_sections( 'code-snippets' );
55
- submit_button();
56
 
57
  ?>
 
 
 
 
 
 
 
 
58
  </form>
59
  </div>
60
  <?php
24
  function load() {
25
  parent::load();
26
 
27
+ if ( isset( $_GET['reset_settings'] ) && $_GET['reset_settings'] ) {
28
+
29
+ if ( code_snippets_unified_settings() ) {
30
+ delete_site_option( 'code_snippets_settings' );
31
+ } else {
32
+ delete_option( 'code_snippets_settings' );
33
+ }
34
+
35
+ add_settings_error( 'code-snippets-settings-notices', 'settings_reset', __( 'All settings have been reset to their defaults.' ), 'updated' );
36
+ set_transient( 'settings_errors', get_settings_errors(), 30 );
37
+
38
+ wp_redirect( esc_url_raw( add_query_arg( 'settings-updated', true, remove_query_arg( 'reset_settings' ) ) ) );
39
+ exit;
40
+ }
41
+
42
  if ( is_network_admin() ) {
43
 
44
  if ( code_snippets_unified_settings() ) {
67
 
68
  settings_fields( 'code-snippets' );
69
  do_settings_sections( 'code-snippets' );
 
70
 
71
  ?>
72
+ <p class="submit" style="max-width: 1020px;">
73
+ <?php submit_button( null, 'primary', 'submit', false ); ?>
74
+
75
+ <a class="button button-secondary" style="float: right;"
76
+ href="<?php echo esc_url( add_query_arg( 'reset_settings', true ) ); ?>">
77
+ <?php esc_html_e( 'Reset to Default', 'code-snippets' ); ?>
78
+ </a>
79
+ </p>
80
  </form>
81
  </div>
82
  <?php
php/class-code-snippets.php CHANGED
@@ -65,7 +65,7 @@ class Code_Snippets {
65
  /* CodeMirror editor functions */
66
  require_once $includes_path . '/editor.php';
67
 
68
- /* Backwards compatability functions */
69
  require_once $includes_path . '/functions.php';
70
 
71
  /* General Administration functions */
65
  /* CodeMirror editor functions */
66
  require_once $includes_path . '/editor.php';
67
 
68
+ /* Backwards compatibility functions */
69
  require_once $includes_path . '/functions.php';
70
 
71
  /* General Administration functions */
php/class-db.php CHANGED
@@ -82,6 +82,7 @@ class Code_Snippets_DB {
82
  $multisite = $this->validate_network_param( $multisite );
83
 
84
  /* Retrieve the table name from $wpdb depending on the value of $multisite */
 
85
  return ( $multisite ? $wpdb->ms_snippets : $wpdb->snippets );
86
  }
87
 
@@ -122,6 +123,7 @@ class Code_Snippets_DB {
122
  * @uses dbDelta() to apply the SQL code
123
  *
124
  * @param string $table_name The name of the table to create
 
125
  * @return bool whether the table creation was successful
126
  */
127
  function create_table( $table_name ) {
@@ -136,6 +138,7 @@ class Code_Snippets_DB {
136
  code longtext NOT NULL default '',
137
  tags longtext NOT NULL default '',
138
  scope varchar(15) NOT NULL default 'global',
 
139
  active tinyint(1) NOT NULL default 0,
140
  PRIMARY KEY (id)
141
  ) $charset_collate;";
@@ -151,4 +154,55 @@ class Code_Snippets_DB {
151
 
152
  return $success;
153
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  }
82
  $multisite = $this->validate_network_param( $multisite );
83
 
84
  /* Retrieve the table name from $wpdb depending on the value of $multisite */
85
+
86
  return ( $multisite ? $wpdb->ms_snippets : $wpdb->snippets );
87
  }
88
 
123
  * @uses dbDelta() to apply the SQL code
124
  *
125
  * @param string $table_name The name of the table to create
126
+ *
127
  * @return bool whether the table creation was successful
128
  */
129
  function create_table( $table_name ) {
138
  code longtext NOT NULL default '',
139
  tags longtext NOT NULL default '',
140
  scope varchar(15) NOT NULL default 'global',
141
+ priority smallint NOT NULL default 10,
142
  active tinyint(1) NOT NULL default 0,
143
  PRIMARY KEY (id)
144
  ) $charset_collate;";
154
 
155
  return $success;
156
  }
157
+
158
+ /**
159
+ * Add sample snippet content to the database
160
+ *
161
+ * @param bool $network
162
+ */
163
+ public function create_sample_content( $network = false ) {
164
+
165
+ $snippets = array(
166
+
167
+ array(
168
+ 'name' => __( 'Example HTML shortcode', 'code-snippets' ),
169
+ 'code' => sprintf(
170
+ "\nadd_shortcode( 'shortcode_name', function () { ?>\n\n\t<p>%s</p>\n\n<?php } );",
171
+ strip_tags( __( 'write your HTML shortcode content here', 'code-snippets' ) )
172
+ ),
173
+ 'desc' => __( 'This is an example snippet for demonstrating how to add an HTML shortcode.', 'code-snippets' ),
174
+ 'tags' => array( 'shortcode' ),
175
+ ),
176
+
177
+ array(
178
+ 'name' => __( 'Example CSS snippet', 'code-snippets' ),
179
+ 'code' => sprintf(
180
+ "\nadd_action( 'wp_head', function () { ?>\n\t<style>\n\n\t\t/* %s */\n\n\t</style>\n<?php } );\n",
181
+ strip_tags( __( 'write your CSS code here', 'code-snippets' ) )
182
+ ),
183
+ 'desc' => __( 'This is an example snippet for demonstrating how to add custom CSS code to your website.', 'code-snippets' ),
184
+ 'tags' => array( 'css' ),
185
+ 'scope' => 'front-end',
186
+ ),
187
+
188
+ array(
189
+ 'name' => __( 'Example JavaScript snippet', 'code-snippets' ),
190
+ 'code' => sprintf(
191
+ "\nadd_action( 'wp_head', function () { ?>\n\t<script>\n\n\t\t/* %s */\n\n\t</script>\n<?php } );\n",
192
+ strip_tags( __( 'write your JavaScript code here', 'code-snippets' ) )
193
+ ),
194
+ 'desc' => __( 'This is an example snippet for demonstrating how to add custom JavaScript code to your website.', 'code-snippets' ),
195
+ 'tags' => array( 'javascript' ),
196
+ 'scope' => 'front-end',
197
+ ),
198
+ );
199
+
200
+ foreach ( $snippets as $snippet ) {
201
+ $snippet = new Code_Snippet( $snippet );
202
+ $snippet->desc .= ' ' . __( 'You can remove it, or edit it to add your own content.', 'code-snippets' );
203
+ $snippet->network = $network;
204
+
205
+ save_snippet( $snippet );
206
+ }
207
+ }
208
  }
php/class-export.php DELETED
@@ -1,294 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Exports selected snippets to a XML or PHP file.
5
- *
6
- * It's better to call the export_snippets()
7
- * function than directly using this class
8
- *
9
- * @since 1.9
10
- * @package Code_Snippets
11
- */
12
- class Code_Snippets_Export {
13
-
14
- /**
15
- * The IDs
16
- * @var array
17
- */
18
- protected $snippet_ids = array();
19
-
20
- /**
21
- * The name of the table to fetch snippets from
22
- * @var string
23
- */
24
- protected $table_name = '';
25
-
26
- /**
27
- * The export file format.
28
- * Either 'xml' or 'php'
29
- * @var string
30
- */
31
- protected $format;
32
-
33
- /**
34
- * The DOM document.
35
- * Only used in XML exports
36
- * @var DOMDocument
37
- */
38
- protected $dom;
39
-
40
- /**
41
- * The DOM document root element
42
- * Only used in XML exports
43
- * @var DOMElement
44
- */
45
- protected $root;
46
-
47
- public static $supported_formats = array( 'json', 'xml', 'php' );
48
-
49
- /**
50
- * Constructor function
51
- *
52
- * @param array $ids The IDs of the snippets to export
53
- * @param string $table The name of the table to fetch snippets from
54
- * @param string $format The format of the export file
55
- */
56
- public function __construct( $ids, $table, $format = 'json' ) {
57
- $this->snippet_ids = (array) $ids;
58
- $this->table_name = $table;
59
- $this->format = in_array( $format, self::$supported_formats ) ? $format : 'json';
60
- }
61
-
62
- /**
63
- * Build the export file name
64
- * @return string
65
- */
66
- public function get_filename() {
67
-
68
- if ( 1 == count( $this->snippet_ids ) ) {
69
- /* If there is only snippet to export, use its name instead of the site name */
70
- $snippet = get_snippet( $this->snippet_ids[0], $this->table_name );
71
- $title = strtolower( $snippet->name );
72
- } else {
73
- /* Otherwise, use the site name as set in Settings > General */
74
- $title = strtolower( get_bloginfo( 'name' ) );
75
- }
76
-
77
- $filename = "{$title}.code-snippets.{$this->format}";
78
- $filename = apply_filters( 'code_snippets/export/filename', $filename, $title );
79
- return sanitize_file_name( $filename );
80
- }
81
-
82
- /**
83
- * Append header comments to the DOM document
84
- */
85
- protected function do_header_comments() {
86
-
87
- /* Array of translated comment lines */
88
- $lines = array(
89
- __( 'This is a code snippets export file generated by the Code Snippets WordPress plugin.', 'code-snippets' ),
90
- 'https://wordpress.org/plugins/code-snippets',
91
- __( 'To import these snippets a WordPress site follow these steps:', 'code-snippets' ),
92
- __( '1. Log in to that site as an administrator.', 'code-snippets' ),
93
- __( '2. Install the Code Snippets plugin using the directions provided at the above link.', 'code-snippets' ),
94
- __( "3. Go to 'Tools: Import' in the WordPress admin panel.", 'code-snippets' ),
95
- __( '4. Click on the "Code Snippets" importer in the list', 'code-snippets' ),
96
- __( '5. Upload this file using the form provided on that page.', 'code-snippets' ),
97
- __( '6. Code Snippets will then import all of the snippets and associated information contained in this file into your site.', 'code-snippets' ),
98
- __( "7. You will then have to visit the 'Snippets: All Snippets' admin menu and activate desired snippets.", 'code-snippets' ),
99
- );
100
-
101
- /* Add each line as a comment element */
102
- foreach ( $lines as $line ) {
103
- $comment = $this->dom->createComment( " $line " );
104
- $this->dom->appendChild( $comment );
105
- }
106
-
107
- /* Build a generator line, like the WordPress export files */
108
- $gen = sprintf(
109
- 'generator="Code Snippets/%s" created="%s"',
110
- CODE_SNIPPETS_VERSION,
111
- date( 'Y-m-d H:i' )
112
- );
113
-
114
- /* Run the generator line through the standard WordPress filter */
115
- $type = 'code_snippets_export';
116
- $gen = apply_filters( "get_the_generator_$type", $gen, $type );
117
-
118
- /* Add it to the file as a comment */
119
- $gen = $this->dom->createComment( " $gen " );
120
- $this->dom->appendChild( $gen );
121
- }
122
-
123
- protected function get_snippets() {
124
- global $wpdb;
125
-
126
- $snippets = array();
127
-
128
- foreach ( $this->snippet_ids as $id ) {
129
- /* Grab the snippet from the database */
130
- $snippet = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$this->table_name} WHERE id = %d", $id ), ARRAY_A );
131
- $snippet = new Code_Snippet( $snippet );
132
-
133
- $snippets[] = $snippet;
134
- }
135
-
136
- return $snippets;
137
- }
138
-
139
- /**
140
- * Process all snippet items
141
- */
142
- protected function do_items() {
143
-
144
- if ( 'xml' === $this->format ) {
145
-
146
- /* Create the root element */
147
- $root_element = $this->dom->createElement( 'snippets' );
148
- $this->root = $this->dom->appendChild( $root_element );
149
- }
150
-
151
- /* Loop through the snippets */
152
- foreach ( $this->get_snippets() as $snippet ) {
153
-
154
- /* Process the snippet item */
155
- if ( 'php' === $this->format ) {
156
- $this->do_item_php( $snippet );
157
- } else {
158
- $this->do_item_xml( $snippet );
159
- }
160
- }
161
- }
162
-
163
- /**
164
- * Append a single snippet item to the document
165
- *
166
- * @param Code_Snippet $snippet
167
- */
168
- protected function do_item_xml( Code_Snippet $snippet ) {
169
- $item_element = $this->dom->createElement( 'snippet' );
170
- $item = $this->root->appendChild( $item_element );
171
-
172
- /* Set the scope attribute */
173
- /** @var $item DOMElement */
174
- $item->setAttribute( 'scope', $snippet->scope );
175
-
176
- /* Fields to include in the export file */
177
- $fields = array(
178
- 'name' => $snippet->name,
179
- 'desc' => $snippet->desc,
180
- 'tags' => $snippet->tags_list,
181
- 'code' => $snippet->code,
182
- );
183
-
184
- $fields = apply_filters( 'code_snippets/export/xml_fields', $fields, $snippet );
185
-
186
- foreach ( $fields as $field_name => $field_value ) {
187
-
188
- /* Create a new element for each field */
189
- $field_element = $this->dom->createElement( $field_name );
190
- $field = $item->appendChild( $field_element );
191
-
192
- /* Add the field content */
193
- $value = $this->dom->createTextNode( $field_value );
194
- $field->appendChild( $value );
195
- }
196
- }
197
-
198
- /**
199
- * Format single snippet item as PHP code
200
- *
201
- * @param Code_Snippet $snippet
202
- */
203
- protected function do_item_php( Code_Snippet $snippet ) {
204
- echo "\n/**\n * {$snippet->name}\n";
205
-
206
- if ( ! empty( $snippet->desc ) ) {
207
-
208
- /* Convert description to PhpDoc */
209
- $desc = strip_tags( str_replace( "\n", "\n * ", $snippet->desc ) );
210
-
211
- echo " *\n * $desc\n";
212
- }
213
-
214
- echo " */\n{$snippet->code}\n";
215
- }
216
-
217
- /**
218
- * Export the snippets
219
- */
220
- public function do_export() {
221
-
222
- /* Make the page act like a downloadable file instead of being shown in the browser */
223
- $filename = $this->get_filename();
224
- header( 'Content-Disposition: attachment; filename=' . $filename );
225
-
226
- if ( 'json' === $this->format ) {
227
- global $wpdb;
228
-
229
- /* Set the HTTP content type header */
230
- header( 'Content-Type: application/json; charset=' . get_bloginfo( 'charset' ) );
231
-
232
- $snippets = array();
233
-
234
- foreach ( $this->snippet_ids as $id ) {
235
- /* Grab the snippet from the database */
236
- $snippet = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$this->table_name} WHERE id = %d", $id ), ARRAY_A );
237
- $snippet = new Code_Snippet( $snippet );
238
-
239
- $fields = array( 'name', 'desc', 'tags', 'scope', 'code' );
240
- $final_snippet = array();
241
-
242
- foreach ( $fields as $field ) {
243
- if ( ! empty( $snippet->$field ) ) {
244
- $final_snippet[ $field ] = $snippet->$field;
245
- }
246
- }
247
-
248
- if ( $final_snippet ) {
249
- $snippets[] = $final_snippet;
250
- }
251
- }
252
-
253
- $data = array(
254
- 'generator' => 'Code Snippets v' . CODE_SNIPPETS_VERSION,
255
- 'date_created' => date( 'Y-m-d H:i' ),
256
- 'snippets' => $snippets,
257
- );
258
-
259
- echo json_encode( $data, apply_filters( 'code_snippets/export/json_encode_options', 0 ) );
260
- exit;
261
- }
262
-
263
- if ( 'xml' === $this->format ) {
264
-
265
- /* Set the HTTP content type header */
266
- header( 'Content-Type: text/xml; charset=' . get_bloginfo( 'charset' ) );
267
-
268
- /* Create DOM document and root element */
269
- $this->dom = new DOMDocument( '1.0', get_bloginfo( 'charset' ) );
270
- $this->dom->formatOutput = true;
271
-
272
- /* Add file header comments */
273
- $this->do_header_comments();
274
- }
275
-
276
- elseif ( 'php' === $this->format ) {
277
- echo "<?php\n";
278
- }
279
-
280
- /* Process the snippet items */
281
- $this->do_items();
282
-
283
- if ( 'xml' === $this->format ) {
284
-
285
- /* Filter DOM document */
286
- apply_filters( 'code_snippets/export_dom_document', $this->dom, $this->snippet_ids, $filename );
287
-
288
- /* Send the document to the browser */
289
- echo $this->dom->saveXML();
290
- }
291
-
292
- exit;
293
- }
294
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
php/class-list-table.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  * Contains the class for handling the snippets table
5
  *
6
- * @package Code_Snippets
7
  */
8
 
9
  /* The WP_List_Table base class is not included by default, so we need to load it */
@@ -41,7 +41,7 @@ class Code_Snippets_List_Table extends WP_List_Table {
41
  $this->is_network = is_network_admin();
42
 
43
  /* Determine the status */
44
- $status = 'all';
45
  if ( isset( $_REQUEST['status'] ) && in_array( $_REQUEST['status'], $this->statuses ) ) {
46
  $status = $_REQUEST['status'];
47
  }
@@ -55,13 +55,16 @@ class Code_Snippets_List_Table extends WP_List_Table {
55
  $page = $this->get_pagenum();
56
 
57
  add_screen_option( 'per_page', array(
58
- 'label' => __( 'Snippets per page', 'code-snippets' ),
59
  'default' => 999,
60
- 'option' => 'snippets_per_page',
61
  ) );
62
 
63
  /* Set the table columns hidden in Screen Options by default */
64
- add_filter( "get_user_option_manage{$screen->id}columnshidden", array( $this, 'get_default_hidden_columns' ), 15 );
 
 
 
65
 
66
  /* Strip the result query arg from the URL */
67
  $_SERVER['REQUEST_URI'] = remove_query_arg( 'result' );
@@ -70,13 +73,13 @@ class Code_Snippets_List_Table extends WP_List_Table {
70
  $filters = array( 'wptexturize', 'convert_smilies', 'convert_chars', 'wpautop', 'shortcode_unautop', 'capital_P_dangit' );
71
 
72
  foreach ( $filters as $filter ) {
73
- add_filter( 'code_snippets/list_table/print_snippet_description', $filter );
74
  }
75
 
76
  /* Setup the class */
77
  parent::__construct( array(
78
- 'ajax' => true,
79
- 'plural' => 'snippets',
80
  'singular' => 'snippet',
81
  ) );
82
  }
@@ -84,8 +87,8 @@ class Code_Snippets_List_Table extends WP_List_Table {
84
  /**
85
  * Define the output of all columns that have no callback function
86
  *
87
- * @param Code_Snippet $snippet The snippet used for the current row
88
- * @param string $column_name The name of the column being printed
89
  *
90
  * @return string The content of the column to output
91
  */
@@ -102,174 +105,132 @@ class Code_Snippets_List_Table extends WP_List_Table {
102
  }
103
  }
104
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  /**
106
  * Build a list of action links for individual snippets
107
  *
108
- * @param Code_Snippet $snippet The current snippet
109
  *
110
- * @return array The action links HTML
111
  */
112
  private function get_snippet_action_links( Code_Snippet $snippet ) {
113
  $actions = array();
114
- $link_format = '<a href="%2$s">%1$s</a>';
115
 
116
- if ( $this->is_network || ! $snippet->network ) {
 
117
 
118
  if ( $snippet->active ) {
119
- $actions['deactivate'] = sprintf(
120
- $link_format,
121
- $snippet->network ? esc_html__( 'Network Deactivate', 'code-snippets' ) : esc_html__( 'Deactivate', 'code-snippets' ),
122
- esc_url( add_query_arg( array(
123
- 'action' => 'deactivate',
124
- 'id' => $snippet->id,
125
- ) ) )
126
- );
127
- } elseif ( 'single-use' === $snippet->scope ) {
128
-
129
- $actions['run_once'] = sprintf(
130
- $link_format,
131
- esc_html__( 'Run Once', 'code-snippets' ),
132
- esc_url( add_query_arg( array(
133
- 'action' => 'run-once',
134
- 'id' => $snippet->id,
135
- ) ) )
136
- );
137
-
138
  } else {
139
- $actions['activate'] = sprintf(
140
- $link_format,
141
- $snippet->network ? esc_html__( 'Network Activate', 'code-snippets' ) : esc_html__( 'Activate', 'code-snippets' ),
142
- esc_url( add_query_arg( array(
143
- 'action' => 'activate',
144
- 'id' => $snippet->id,
145
- ) ) )
146
- );
147
  }
 
 
148
 
149
- $actions['edit'] = sprintf(
150
- $link_format,
151
- esc_html__( 'Edit', 'code-snippets' ),
152
- code_snippets()->get_snippet_edit_url( $snippet->id )
153
  );
154
 
155
- $actions['export'] = sprintf(
156
- $link_format,
157
- esc_html__( 'Export', 'code-snippets' ),
158
- esc_url( add_query_arg( array(
159
- 'action' => 'export',
160
- 'id' => $snippet->id,
161
- ) ) )
162
- );
163
 
164
  $actions['delete'] = sprintf(
165
  '<a href="%2$s" class="delete" onclick="%3$s">%1$s</a>',
166
  esc_html__( 'Delete', 'code-snippets' ),
167
- esc_url( add_query_arg( array(
168
- 'action' => 'delete',
169
- 'id' => $snippet->id,
170
- ) ) ),
171
  esc_js( sprintf(
172
  'return confirm("%s");',
173
  esc_html__( 'You are about to permanently delete the selected item.', 'code-snippets' ) . "\n" .
174
  esc_html__( "'Cancel' to stop, 'OK' to delete.", 'code-snippets' )
175
  ) )
176
  );
177
-
178
- } else {
179
-
180
- if ( $snippet->active ) {
181
- $actions['network_active'] = esc_html__( 'Network Active', 'code-snippets' );
182
- } else {
183
- $actions['network_only'] = esc_html__( 'Network Only', 'code-snippets' );
184
- }
185
  }
186
 
187
- return $actions;
188
  }
189
 
190
  /**
191
- * Build a list of action links for individual shared network snippets
192
- *
193
- * @param Code_Snippet $snippet The current snippet
194
- *
195
- * @return array The action links HTML
196
  */
197
- private function get_shared_network_snippet_action_links( Code_Snippet $snippet ) {
198
- $actions = array();
199
- $link_format = '<a href="%2$s">%1$s</a>';
200
-
201
- /* Only add Activate/Deactivate for subsites */
202
- if ( ! $this->is_network ) {
203
 
204
- $action = $snippet->active ? 'deactivate' : 'activate';
205
- $label = $snippet->active ? esc_html__( 'Deactivate', 'code-snippets' ) : esc_html__( 'Activate', 'code-snippets' );
206
- $activate_url = add_query_arg( array(
207
- 'action' => $action . '-shared',
208
- 'id' => $snippet->id,
209
- ) );
210
-
211
- $actions[ $action ] = sprintf( $link_format, $label, esc_url( $activate_url ) );
212
  }
213
 
214
- /* Don't add Edit/Export/Delete actions for if current user can't manage network snippets */
215
- if ( ! current_user_can( code_snippets()->get_network_cap_name() ) ) {
216
- return $actions;
217
  }
218
 
219
- $actions['edit'] = sprintf(
220
- $link_format,
221
- esc_html__( 'Edit', 'code-snippets' ),
222
- code_snippets()->get_snippet_edit_url( $snippet->id, 'network' )
223
- );
 
 
 
224
 
225
- $actions['export'] = sprintf(
226
- $link_format,
227
- esc_html__( 'Export', 'code-snippets' ),
228
- add_query_arg(
229
- array(
230
- 'action' => 'export',
231
- 'id' => $snippet->id,
232
- ),
233
- code_snippets()->get_menu_url( 'manage', 'network' )
234
- )
235
- );
236
 
237
- $actions['delete'] = sprintf(
238
- '<a href="%2$s" class="delete" onclick="%3$s">%1$s</a>',
239
- esc_html__( 'Delete', 'code-snippets' ),
240
- add_query_arg(
241
- array(
242
- 'action' => 'delete',
243
- 'id' => $snippet->id,
244
- ),
245
- code_snippets()->get_menu_url( 'manage', 'network' )
246
- ),
247
- esc_js( sprintf(
248
- 'return confirm("%s");',
249
- esc_html__( 'You are about to permanently delete the selected item.', 'code-snippets' ) . "\n" .
250
- esc_html__( "'Cancel' to stop, 'OK' to delete.", 'code-snippets' )
251
- ) )
252
- );
253
 
254
- return $actions;
 
 
 
255
  }
256
 
257
  /**
258
  * Build the content of the snippet name column
259
  *
260
- * @param Code_Snippet $snippet The snippet being used for the current row
261
  *
262
- * @return string The content of the column to output
263
  */
264
  protected function column_name( $snippet ) {
265
 
266
- $action_links = $snippet->shared_network ?
267
- $this->get_shared_network_snippet_action_links( $snippet ) :
268
- $this->get_snippet_action_links( $snippet );
269
-
270
  $title = empty( $snippet->name ) ? sprintf( __( 'Untitled #%d', 'code-snippets' ), $snippet->id ) : $snippet->name;
271
 
272
- $row_actions = $this->row_actions( $action_links,
 
273
  apply_filters( 'code_snippets/list_table/row_actions_always_visible', true )
274
  );
275
 
@@ -279,16 +240,11 @@ class Code_Snippets_List_Table extends WP_List_Table {
279
  $out .= ' <span class="dashicons dashicons-' . $snippet->scope_icon . '"></span>';
280
  }
281
 
282
- /* Only bold active snippets */
283
- if ( $snippet->active ) {
284
- $out = sprintf( '<strong>%s</strong>', $out );
285
- }
286
-
287
  /* Add a link to the snippet if it isn't an unreadable network-only snippet */
288
  if ( $this->is_network || ! $snippet->network || current_user_can( code_snippets()->get_network_cap_name() ) ) {
289
 
290
  $out = sprintf(
291
- '<a href="%s">%s</a>',
292
  code_snippets()->get_snippet_edit_url( $snippet->id, $snippet->network ? 'network' : 'admin' ),
293
  $out
294
  );
@@ -299,15 +255,16 @@ class Code_Snippets_List_Table extends WP_List_Table {
299
  }
300
 
301
  /* Return the name contents */
302
- return apply_filters( 'code_snippets/list_table/column_name', $out, $snippet ) . $row_actions;
 
303
  }
304
 
305
  /**
306
  * Builds the checkbox column content
307
  *
308
- * @param Code_Snippet $snippet The snippet being used for the current row
309
  *
310
- * @return string The column content to be printed
311
  */
312
  protected function column_cb( $snippet ) {
313
 
@@ -326,9 +283,9 @@ class Code_Snippets_List_Table extends WP_List_Table {
326
  *
327
  * @since 2.0
328
  *
329
- * @param Code_Snippet $snippet The snippet being used for the current row
330
  *
331
- * @return string The column output
332
  */
333
  protected function column_tags( $snippet ) {
334
 
@@ -350,6 +307,18 @@ class Code_Snippets_List_Table extends WP_List_Table {
350
  return join( ', ', $out );
351
  }
352
 
 
 
 
 
 
 
 
 
 
 
 
 
353
  /**
354
  * Define the column headers for the table
355
  *
@@ -362,6 +331,7 @@ class Code_Snippets_List_Table extends WP_List_Table {
362
  'id' => __( 'ID', 'code-snippets' ),
363
  'description' => __( 'Description', 'code-snippets' ),
364
  'tags' => __( 'Tags', 'code-snippets' ),
 
365
  );
366
 
367
  if ( ! code_snippets_get_setting( 'general', 'enable_description' ) ) {
@@ -382,20 +352,13 @@ class Code_Snippets_List_Table extends WP_List_Table {
382
  */
383
  public function get_sortable_columns() {
384
  $sortable_columns = array(
385
- 'id' => array( 'id', true ),
386
- 'name' => array( 'name', false ),
 
 
387
  );
388
- return apply_filters( 'code_snippets/list_table/sortable_columns', $sortable_columns );
389
- }
390
 
391
- /**
392
- * Define the columns that are hidden by default
393
- *
394
- * @param mixed $result
395
- * @return mixed|array
396
- */
397
- public function get_default_hidden_columns( $result ) {
398
- return $result ? $result : array( 'id' );
399
  }
400
 
401
  /**
@@ -407,10 +370,12 @@ class Code_Snippets_List_Table extends WP_List_Table {
407
  $actions = array(
408
  'activate-selected' => $this->is_network ? __( 'Network Activate', 'code-snippets' ) : __( 'Activate', 'code-snippets' ),
409
  'deactivate-selected' => $this->is_network ? __( 'Network Deactivate', 'code-snippets' ) : __( 'Deactivate', 'code-snippets' ),
 
410
  'download-selected' => __( 'Download', 'code-snippets' ),
411
  'export-selected' => __( 'Export', 'code-snippets' ),
412
  'delete-selected' => __( 'Delete', 'code-snippets' ),
413
  );
 
414
  return apply_filters( 'code_snippets/list_table/bulk_actions', $actions );
415
  }
416
 
@@ -423,6 +388,7 @@ class Code_Snippets_List_Table extends WP_List_Table {
423
  */
424
  public function get_table_classes() {
425
  $classes = array( 'widefat', $this->_args['plural'] );
 
426
  return apply_filters( 'code_snippets/list_table/table_classes', $classes );
427
  }
428
 
@@ -447,9 +413,9 @@ class Code_Snippets_List_Table extends WP_List_Table {
447
 
448
  /* Define the labels for each view */
449
  $labels = array(
450
- 'all' => _n( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'code-snippets' ),
451
- 'active' => _n( 'Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', $count, 'code-snippets' ),
452
- 'inactive' => _n( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $count, 'code-snippets' ),
453
  'recently_activated' => _n( 'Recently Active <span class="count">(%s)</span>', 'Recently Active <span class="count">(%s)</span>', $count, 'code-snippets' ),
454
  );
455
 
@@ -467,6 +433,7 @@ class Code_Snippets_List_Table extends WP_List_Table {
467
  }
468
 
469
  /* Filter and return the list of views */
 
470
  return apply_filters( 'code_snippets/list_table/views', $status_links );
471
  }
472
 
@@ -479,22 +446,27 @@ class Code_Snippets_List_Table extends WP_List_Table {
479
 
480
  /* If we're not viewing a snippets table, get all used tags instead */
481
  if ( ! isset( $snippets, $status ) ) {
482
- return get_all_snippet_tags();
483
- }
 
484
 
485
- $tags = array();
 
 
 
486
 
487
- /* Merge all tags into a single array */
488
- foreach ( $snippets[ $status ] as $snippet ) {
489
- $tags = array_merge( $snippet->tags, $tags );
490
  }
491
 
492
- /* Remove duplicate tags */
493
- return array_values( array_unique( $tags, SORT_REGULAR ) );
 
494
  }
495
 
496
  /**
497
  * Add filters and extra actions above and below the table
 
498
  * @param string $which Are the actions displayed on the table top or bottom
499
  */
500
  public function extra_tablenav( $which ) {
@@ -583,6 +555,7 @@ class Code_Snippets_List_Table extends WP_List_Table {
583
  } else {
584
  $action = parent::current_action();
585
  }
 
586
  return apply_filters( 'code_snippets/list_table/current_action', $action );
587
  }
588
 
@@ -600,46 +573,60 @@ class Code_Snippets_List_Table extends WP_List_Table {
600
  if ( isset( $_GET['action'], $_GET['id'] ) ) {
601
 
602
  $id = absint( $_GET['id'] );
603
- $action = sanitize_key( $_GET['action'] );
604
  $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'action', 'id' ) );
605
 
606
- if ( 'activate' === $action ) {
607
- activate_snippet( $id, $this->is_network );
608
- $result = 'activated';
609
- }
610
- elseif ( 'run-once' === $action ) {
611
- activate_snippet( $id, $this->is_network );
612
- $result = 'executed';
613
- }
614
- elseif ( 'deactivate' === $action ) {
615
- deactivate_snippet( $id, $this->is_network );
616
- $result = 'deactivated';
617
- }
618
- elseif ( 'activate-shared' === $action ) {
619
- $active_shared_snippets = get_option( 'active_shared_network_snippets', array() );
620
 
621
- if ( ! in_array( $id, $active_shared_snippets ) ) {
622
- $active_shared_snippets[] = $id;
623
- update_option( 'active_shared_network_snippets', $active_shared_snippets );
624
- }
625
 
626
- $result = 'activated';
627
- }
628
- elseif ( 'deactivate-shared' === $action ) {
629
- $active_shared_snippets = get_option( 'active_shared_network_snippets', array() );
630
- update_option( 'active_shared_network_snippets', array_diff( $active_shared_snippets, array( $id ) ) );
631
 
632
- $result = 'deactivated';
633
- }
634
- elseif ( 'delete' === $action ) {
635
- delete_snippet( $id, $this->is_network );
636
- $result = 'deleted';
637
- }
638
- elseif ( 'export' === $action ) {
639
- export_snippets( array( $id ) );
640
- }
641
- elseif ( 'download' === $action ) {
642
- download_snippets( array( $id ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
643
  }
644
 
645
  if ( isset( $result ) ) {
@@ -676,8 +663,8 @@ class Code_Snippets_List_Table extends WP_List_Table {
676
  update_option( 'active_shared_network_snippets', $active_shared_snippets );
677
  }
678
 
679
- wp_redirect( esc_url_raw( add_query_arg( 'result', 'activated-multi' ) ) );
680
- exit;
681
 
682
  case 'deactivate-selected':
683
 
@@ -693,8 +680,8 @@ class Code_Snippets_List_Table extends WP_List_Table {
693
  update_option( 'active_shared_network_snippets', $active_shared_snippets );
694
  }
695
 
696
- wp_redirect( esc_url_raw( add_query_arg( 'result', 'deactivated-multi' ) ) );
697
- exit;
698
 
699
  case 'export-selected':
700
  export_snippets( $ids );
@@ -704,12 +691,17 @@ class Code_Snippets_List_Table extends WP_List_Table {
704
  download_snippets( $ids );
705
  break;
706
 
 
 
 
 
 
707
  case 'delete-selected':
708
  foreach ( $ids as $id ) {
709
  delete_snippet( $id, $this->is_network );
710
  }
711
- wp_redirect( esc_url_raw( add_query_arg( 'result', 'deleted-multi' ) ) );
712
- exit;
713
 
714
  case 'clear-recent-list':
715
  if ( $this->is_network ) {
@@ -719,13 +711,18 @@ class Code_Snippets_List_Table extends WP_List_Table {
719
  }
720
  break;
721
  }
 
 
 
 
 
722
  }
723
 
724
  /**
725
  * Message to display if no snippets are found
726
  */
727
  public function no_items() {
728
- esc_html_e( 'Whoops, it looks like no snippets could be found.', 'code-snippets' );
729
  printf(
730
  ' <a href="%s">%s</a>',
731
  esc_url( code_snippets()->get_menu_url( 'add' ) ),
@@ -800,20 +797,7 @@ class Code_Snippets_List_Table extends WP_List_Table {
800
  $snippets = array_fill_keys( $this->statuses, array() );
801
 
802
  /* Fetch all snippets */
803
- if ( is_multisite() && ! $this->is_network && current_user_can( code_snippets()->get_network_cap_name() ) &&
804
- code_snippets_get_setting( 'general', 'show_network_snippets' ) ) {
805
- $network_snippets = get_snippets( array(), true );
806
- $network_snippets = array_filter( $network_snippets, array( $this, 'exclude_shared_network_snippets' ) );
807
-
808
- $local_snippets = get_snippets( array(), false );
809
- $snippets['all'] = array_merge( $local_snippets, $network_snippets );
810
- } else {
811
- $snippets['all'] = get_snippets( array() );
812
- }
813
-
814
- $snippets['all'] = apply_filters( 'code_snippets/list_table/get_snippets', $snippets['all'] );
815
-
816
- /* Fetch shared network snippets */
817
  $this->fetch_shared_network_snippets();
818
 
819
  /* Redirect POST'ed tag filter to GET */
@@ -920,22 +904,36 @@ class Code_Snippets_List_Table extends WP_List_Table {
920
  /* We register our pagination options and calculations */
921
  $this->set_pagination_args( array(
922
  'total_items' => $total_items, // Calculate the total number of items
923
- 'per_page' => $per_page, // Determine how many items to show on a page
924
  'total_pages' => ceil( $total_items / $per_page ), // Calculate the total number of pages
925
  ) );
926
  }
927
 
928
  /**
929
- * Callback for array_filter() to exclude shared network snippets from the
930
  *
931
  * @ignore
932
  *
933
- * @param Code_Snippet $snippet The current snippet item being filtered
 
 
934
  *
935
- * @return bool false if the snippet is a shared network snippet
936
  */
937
- private function exclude_shared_network_snippets( $snippet ) {
938
- return ! $snippet->shared_network;
 
 
 
 
 
 
 
 
 
 
 
 
939
  }
940
 
941
  /**
@@ -943,35 +941,34 @@ class Code_Snippets_List_Table extends WP_List_Table {
943
  *
944
  * @ignore
945
  *
946
- * @param Code_Snippet $a The first snippet to compare
947
- * @param Code_Snippet $b The second snippet to compare
948
  *
949
- * @return int The sort order
950
  */
951
  private function usort_reorder_callback( $a, $b ) {
952
 
953
- /* If no sort, default to ID */
954
  $orderby = (
955
- ! empty( $_REQUEST['orderby'] )
956
  ? $_REQUEST['orderby']
957
- : apply_filters( 'code_snippets/list_table/default_orderby', 'id' )
958
  );
959
 
960
- /* If no order, default to ascending */
961
  $order = (
962
- ! empty( $_REQUEST['order'] )
963
  ? $_REQUEST['order']
964
  : apply_filters( 'code_snippets/list_table/default_order', 'asc' )
965
  );
966
 
967
- /* Determine sort order */
968
- if ( 'id' === $orderby ) {
969
- $result = $a->$orderby - $b->$orderby; // get the result for numerical data
970
- } else {
971
- $result = strcmp( $a->$orderby, $b->$orderby ); // get the result for string data
972
  }
973
 
974
- /* Send final sort direction to usort */
975
  return ( 'asc' === $order ) ? $result : -$result;
976
  }
977
 
@@ -979,9 +976,9 @@ class Code_Snippets_List_Table extends WP_List_Table {
979
  * Callback for search function
980
  * @ignore
981
  *
982
- * @param Code_Snippet $snippet The snippet being filtered
983
  *
984
- * @return bool The result of the filter
985
  */
986
  private function search_callback( $snippet ) {
987
  static $term;
@@ -1002,12 +999,11 @@ class Code_Snippets_List_Table extends WP_List_Table {
1002
 
1003
  /**
1004
  * Callback for filtering snippets by tag
1005
- *
1006
  * @ignore
1007
  *
1008
- * @param Code_Snippet $snippet The snippet being filtered
1009
  *
1010
- * @return bool The result of the filter
1011
  */
1012
  private function tags_filter_callback( $snippet ) {
1013
  $tags = explode( ',', $_GET['tag'] );
@@ -1021,7 +1017,6 @@ class Code_Snippets_List_Table extends WP_List_Table {
1021
 
1022
  /**
1023
  * Display a notice showing the current search terms
1024
- *
1025
  * @since 1.7
1026
  */
1027
  public function search_notice() {
@@ -1053,18 +1048,36 @@ class Code_Snippets_List_Table extends WP_List_Table {
1053
  * @param Code_Snippet $snippet The snippet being used for the current row
1054
  */
1055
  public function single_row( $snippet ) {
1056
- $row_class = ( $snippet->active ? 'active' : 'inactive' );
1057
 
1058
  if ( code_snippets_get_setting( 'general', 'snippet_scope_enabled' ) ) {
1059
  $row_class .= sprintf( ' %s-scope', $snippet->scope );
1060
  }
1061
 
1062
  if ( $snippet->shared_network ) {
1063
- $row_class .= ' shared-network';
1064
  }
1065
 
1066
  printf( '<tr class="%s">', $row_class );
1067
  $this->single_row_columns( $snippet );
1068
  echo '</tr>';
1069
  }
1070
- } // end of class
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  /**
4
  * Contains the class for handling the snippets table
5
  *
6
+ * @package Code_Snippets
7
  */
8
 
9
  /* The WP_List_Table base class is not included by default, so we need to load it */
41
  $this->is_network = is_network_admin();
42
 
43
  /* Determine the status */
44
+ $status = apply_filters( 'code_snippets/list_table/default_view', 'all' );
45
  if ( isset( $_REQUEST['status'] ) && in_array( $_REQUEST['status'], $this->statuses ) ) {
46
  $status = $_REQUEST['status'];
47
  }
55
  $page = $this->get_pagenum();
56
 
57
  add_screen_option( 'per_page', array(
58
+ 'label' => __( 'Snippets per page', 'code-snippets' ),
59
  'default' => 999,
60
+ 'option' => 'snippets_per_page',
61
  ) );
62
 
63
  /* Set the table columns hidden in Screen Options by default */
64
+ if ( false === get_user_option( "manage{$screen->id}columnshidden" ) ) {
65
+ $user = wp_get_current_user();
66
+ update_user_option( $user->ID, "manage{$screen->id}columnshidden", array( 'id' ) );
67
+ }
68
 
69
  /* Strip the result query arg from the URL */
70
  $_SERVER['REQUEST_URI'] = remove_query_arg( 'result' );
73
  $filters = array( 'wptexturize', 'convert_smilies', 'convert_chars', 'wpautop', 'shortcode_unautop', 'capital_P_dangit' );
74
 
75
  foreach ( $filters as $filter ) {
76
+ add_filter( 'code_snippets/list_table/column_description', $filter );
77
  }
78
 
79
  /* Setup the class */
80
  parent::__construct( array(
81
+ 'ajax' => true,
82
+ 'plural' => 'snippets',
83
  'singular' => 'snippet',
84
  ) );
85
  }
87
  /**
88
  * Define the output of all columns that have no callback function
89
  *
90
+ * @param Code_Snippet $snippet The snippet used for the current row
91
+ * @param string $column_name The name of the column being printed
92
  *
93
  * @return string The content of the column to output
94
  */
105
  }
106
  }
107
 
108
+ /**
109
+ * Retrieve a URL to perform an action on a snippet
110
+ *
111
+ * @param string $action
112
+ * @param Code_Snippet $snippet
113
+ * @param bool $escape
114
+ *
115
+ * @return string
116
+ */
117
+ public function get_action_link( $action, $snippet, $escape = true ) {
118
+
119
+ // redirect actions to the network dashboard for shared network snippets
120
+ $network_redirect = $snippet->shared_network && ! $this->is_network;
121
+
122
+ // edit links go to a different menu
123
+ if ( 'edit' === $action ) {
124
+ return code_snippets()->get_snippet_edit_url( $snippet->id, $network_redirect ? 'network' : 'self' );
125
+ }
126
+
127
+ $query_args = array( 'action' => $action, 'id' => $snippet->id );
128
+
129
+ $url = $network_redirect ? add_query_arg( $query_args, code_snippets()->get_menu_url( 'manage', 'network' ) ) : add_query_arg( $query_args );
130
+ return $escape ? esc_url( $url ) : $url;
131
+ }
132
+
133
  /**
134
  * Build a list of action links for individual snippets
135
  *
136
+ * @param Code_Snippet $snippet The current snippet
137
  *
138
+ * @return array The action links HTML
139
  */
140
  private function get_snippet_action_links( Code_Snippet $snippet ) {
141
  $actions = array();
 
142
 
143
+ if ( ! $this->is_network && $snippet->network && ! $snippet->shared_network ) {
144
+ // display special links if on a subsite and dealing with a network-active snippet
145
 
146
  if ( $snippet->active ) {
147
+ $actions['network_active'] = esc_html__( 'Network Active', 'code-snippets' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  } else {
149
+ $actions['network_only'] = esc_html__( 'Network Only', 'code-snippets' );
 
 
 
 
 
 
 
150
  }
151
+ } elseif ( ! $snippet->shared_network || current_user_can( code_snippets()->get_network_cap_name() ) ) {
152
+ // if the snippet is a shared network snippet, only display extra actions if the user has network permissions
153
 
154
+ $simple_actions = array(
155
+ 'edit' => esc_html__( 'Edit', 'code-snippets' ),
156
+ 'clone' => esc_html__( 'Clone', 'code-snippets' ),
157
+ 'export' => esc_html__( 'Export', 'code-snippets' ),
158
  );
159
 
160
+ foreach ( $simple_actions as $action => $label ) {
161
+ $actions[ $action ] = sprintf( '<a href="%s">%s</a>', $this->get_action_link( $action, $snippet ), $label );
162
+ }
 
 
 
 
 
163
 
164
  $actions['delete'] = sprintf(
165
  '<a href="%2$s" class="delete" onclick="%3$s">%1$s</a>',
166
  esc_html__( 'Delete', 'code-snippets' ),
167
+ $this->get_action_link( 'delete', $snippet ),
 
 
 
168
  esc_js( sprintf(
169
  'return confirm("%s");',
170
  esc_html__( 'You are about to permanently delete the selected item.', 'code-snippets' ) . "\n" .
171
  esc_html__( "'Cancel' to stop, 'OK' to delete.", 'code-snippets' )
172
  ) )
173
  );
 
 
 
 
 
 
 
 
174
  }
175
 
176
+ return apply_filters( 'code_snippets/list_table/row_actions', $actions );
177
  }
178
 
179
  /**
180
+ * Retrieve the code for a snippet activation switch
181
+ * @param Code_Snippet $snippet
182
+ * @return string
 
 
183
  */
184
+ protected function get_activation_switch( $snippet ) {
185
+ $action = $snippet->active ? 'deactivate' : 'activate';
 
 
 
 
186
 
187
+ if ( $this->is_network && $snippet->shared_network || ( ! $this->is_network && $snippet->network && ! $snippet ) ) {
188
+ return '';
 
 
 
 
 
 
189
  }
190
 
191
+ if ( $snippet->shared_network ) {
192
+ $action .= 'shared';
 
193
  }
194
 
195
+ /*
196
+ if ( $snippet->active ) {
197
+ $actions['deactivate'] = sprintf(
198
+ $link_format,
199
+ $snippet->network ? esc_html__( 'Network Deactivate', 'code-snippets' ) : esc_html__( 'Deactivate', 'code-snippets' ),
200
+ $this->get_action_link( 'deactivate', $snippet )
201
+ );
202
+ } elseif ( 'single-use' === $snippet->scope ) {
203
 
204
+ $actions['run_once'] = sprintf( $link_format, esc_html__( 'Run Once', 'code-snippets' ), $this->get_action_link( 'run-once', $snippet ) );
 
 
 
 
 
 
 
 
 
 
205
 
206
+ } else {
207
+ $actions['activate'] = sprintf(
208
+ $link_format,
209
+ $snippet->network ? esc_html__( 'Network Activate', 'code-snippets' ) : esc_html__( 'Activate', 'code-snippets' ),
210
+ $this->get_action_link( 'activate', $snippet )
211
+ );
212
+ }
213
+ */
 
 
 
 
 
 
 
 
214
 
215
+ return sprintf(
216
+ '<a class="snippet-activation-switch" href="%s"></a> ',
217
+ $this->get_action_link( $action, $snippet )
218
+ );
219
  }
220
 
221
  /**
222
  * Build the content of the snippet name column
223
  *
224
+ * @param Code_Snippet $snippet The snippet being used for the current row
225
  *
226
+ * @return string The content of the column to output
227
  */
228
  protected function column_name( $snippet ) {
229
 
 
 
 
 
230
  $title = empty( $snippet->name ) ? sprintf( __( 'Untitled #%d', 'code-snippets' ), $snippet->id ) : $snippet->name;
231
 
232
+ $row_actions = $this->row_actions(
233
+ $this->get_snippet_action_links( $snippet ),
234
  apply_filters( 'code_snippets/list_table/row_actions_always_visible', true )
235
  );
236
 
240
  $out .= ' <span class="dashicons dashicons-' . $snippet->scope_icon . '"></span>';
241
  }
242
 
 
 
 
 
 
243
  /* Add a link to the snippet if it isn't an unreadable network-only snippet */
244
  if ( $this->is_network || ! $snippet->network || current_user_can( code_snippets()->get_network_cap_name() ) ) {
245
 
246
  $out = sprintf(
247
+ '<a href="%s" class="snippet-name">%s</a>',
248
  code_snippets()->get_snippet_edit_url( $snippet->id, $snippet->network ? 'network' : 'admin' ),
249
  $out
250
  );
255
  }
256
 
257
  /* Return the name contents */
258
+ return $this->get_activation_switch( $snippet ) .
259
+ apply_filters( 'code_snippets/list_table/column_name', $out, $snippet ) . $row_actions;
260
  }
261
 
262
  /**
263
  * Builds the checkbox column content
264
  *
265
+ * @param Code_Snippet $snippet The snippet being used for the current row
266
  *
267
+ * @return string The column content to be printed
268
  */
269
  protected function column_cb( $snippet ) {
270
 
283
  *
284
  * @since 2.0
285
  *
286
+ * @param Code_Snippet $snippet The snippet being used for the current row
287
  *
288
+ * @return string The column output
289
  */
290
  protected function column_tags( $snippet ) {
291
 
307
  return join( ', ', $out );
308
  }
309
 
310
+ /**
311
+ * Output the content of the priority column
312
+ *
313
+ * @param Code_Snippet $snippet
314
+ *
315
+ * @return string
316
+ */
317
+ protected function column_priority( $snippet ) {
318
+
319
+ return sprintf( '<input type="number" class="snippet-priority" value="%d" step="1" disabled>', $snippet->priority );
320
+ }
321
+
322
  /**
323
  * Define the column headers for the table
324
  *
331
  'id' => __( 'ID', 'code-snippets' ),
332
  'description' => __( 'Description', 'code-snippets' ),
333
  'tags' => __( 'Tags', 'code-snippets' ),
334
+ 'priority' => __( 'Priority', 'code-snippets' ),
335
  );
336
 
337
  if ( ! code_snippets_get_setting( 'general', 'enable_description' ) ) {
352
  */
353
  public function get_sortable_columns() {
354
  $sortable_columns = array(
355
+ 'id' => array( 'id', true ),
356
+ 'name' => array( 'name', false ),
357
+ 'tags' => array( 'tags_list', true ),
358
+ 'priority' => array( 'priority', true ),
359
  );
 
 
360
 
361
+ return apply_filters( 'code_snippets/list_table/sortable_columns', $sortable_columns );
 
 
 
 
 
 
 
362
  }
363
 
364
  /**
370
  $actions = array(
371
  'activate-selected' => $this->is_network ? __( 'Network Activate', 'code-snippets' ) : __( 'Activate', 'code-snippets' ),
372
  'deactivate-selected' => $this->is_network ? __( 'Network Deactivate', 'code-snippets' ) : __( 'Deactivate', 'code-snippets' ),
373
+ 'clone-selected' => __( 'Clone', 'code-snippets' ),
374
  'download-selected' => __( 'Download', 'code-snippets' ),
375
  'export-selected' => __( 'Export', 'code-snippets' ),
376
  'delete-selected' => __( 'Delete', 'code-snippets' ),
377
  );
378
+
379
  return apply_filters( 'code_snippets/list_table/bulk_actions', $actions );
380
  }
381
 
388
  */
389
  public function get_table_classes() {
390
  $classes = array( 'widefat', $this->_args['plural'] );
391
+
392
  return apply_filters( 'code_snippets/list_table/table_classes', $classes );
393
  }
394
 
413
 
414
  /* Define the labels for each view */
415
  $labels = array(
416
+ 'all' => _n( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'code-snippets' ),
417
+ 'active' => _n( 'Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', $count, 'code-snippets' ),
418
+ 'inactive' => _n( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $count, 'code-snippets' ),
419
  'recently_activated' => _n( 'Recently Active <span class="count">(%s)</span>', 'Recently Active <span class="count">(%s)</span>', $count, 'code-snippets' ),
420
  );
421
 
433
  }
434
 
435
  /* Filter and return the list of views */
436
+
437
  return apply_filters( 'code_snippets/list_table/views', $status_links );
438
  }
439
 
446
 
447
  /* If we're not viewing a snippets table, get all used tags instead */
448
  if ( ! isset( $snippets, $status ) ) {
449
+ $tags = get_all_snippet_tags();
450
+ } else {
451
+ $tags = array();
452
 
453
+ /* Merge all tags into a single array */
454
+ foreach ( $snippets[ $status ] as $snippet ) {
455
+ $tags = array_merge( $snippet->tags, $tags );
456
+ }
457
 
458
+ /* Remove duplicate tags */
459
+ $tags = array_unique( $tags );
 
460
  }
461
 
462
+ sort( $tags );
463
+
464
+ return $tags;
465
  }
466
 
467
  /**
468
  * Add filters and extra actions above and below the table
469
+ *
470
  * @param string $which Are the actions displayed on the table top or bottom
471
  */
472
  public function extra_tablenav( $which ) {
555
  } else {
556
  $action = parent::current_action();
557
  }
558
+
559
  return apply_filters( 'code_snippets/list_table/current_action', $action );
560
  }
561
 
573
  if ( isset( $_GET['action'], $_GET['id'] ) ) {
574
 
575
  $id = absint( $_GET['id'] );
 
576
  $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'action', 'id' ) );
577
 
578
+ switch ( sanitize_key( $_GET['action'] ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
579
 
580
+ case 'activate':
581
+ activate_snippet( $id, $this->is_network );
582
+ $result = 'activated';
583
+ break;
584
 
585
+ case 'run-once':
586
+ activate_snippet( $id, $this->is_network );
587
+ $result = 'executed';
588
+ break;
 
589
 
590
+ case 'deactivate':
591
+ deactivate_snippet( $id, $this->is_network );
592
+ $result = 'deactivated';
593
+ break;
594
+
595
+ case 'activate-shared':
596
+ $active_shared_snippets = get_option( 'active_shared_network_snippets', array() );
597
+
598
+ if ( ! in_array( $id, $active_shared_snippets ) ) {
599
+ $active_shared_snippets[] = $id;
600
+ update_option( 'active_shared_network_snippets', $active_shared_snippets );
601
+ }
602
+
603
+ $result = 'activated';
604
+ break;
605
+
606
+ case 'deactivate-shared':
607
+ $active_shared_snippets = get_option( 'active_shared_network_snippets', array() );
608
+ update_option( 'active_shared_network_snippets', array_diff( $active_shared_snippets, array( $id ) ) );
609
+
610
+ $result = 'deactivated';
611
+ break;
612
+
613
+ case 'clone':
614
+ $this->clone_snippets( array( $id ) );
615
+ $result = 'cloned';
616
+ break;
617
+
618
+ case 'delete':
619
+ delete_snippet( $id, $this->is_network );
620
+ $result = 'deleted';
621
+ break;
622
+
623
+ case 'export':
624
+ export_snippets( array( $id ) );
625
+ break;
626
+
627
+ case 'download':
628
+ download_snippets( array( $id ) );
629
+ break;
630
  }
631
 
632
  if ( isset( $result ) ) {
663
  update_option( 'active_shared_network_snippets', $active_shared_snippets );
664
  }
665
 
666
+ $result = 'activated-multi';
667
+ break;
668
 
669
  case 'deactivate-selected':
670
 
680
  update_option( 'active_shared_network_snippets', $active_shared_snippets );
681
  }
682
 
683
+ $result = 'deactivated-multi';
684
+ break;
685
 
686
  case 'export-selected':
687
  export_snippets( $ids );
691
  download_snippets( $ids );
692
  break;
693
 
694
+ case 'clone-selected':
695
+ $this->clone_snippets( $ids );
696
+ $result = 'cloned-multi';
697
+ break;
698
+
699
  case 'delete-selected':
700
  foreach ( $ids as $id ) {
701
  delete_snippet( $id, $this->is_network );
702
  }
703
+ $result = 'deleted-multi';
704
+ break;
705
 
706
  case 'clear-recent-list':
707
  if ( $this->is_network ) {
711
  }
712
  break;
713
  }
714
+
715
+ if ( isset( $result ) ) {
716
+ wp_redirect( esc_url_raw( add_query_arg( 'result', $result ) ) );
717
+ exit;
718
+ }
719
  }
720
 
721
  /**
722
  * Message to display if no snippets are found
723
  */
724
  public function no_items() {
725
+ esc_html_e( "It looks like you don't have any snippets.", 'code-snippets' );
726
  printf(
727
  ' <a href="%s">%s</a>',
728
  esc_url( code_snippets()->get_menu_url( 'add' ) ),
797
  $snippets = array_fill_keys( $this->statuses, array() );
798
 
799
  /* Fetch all snippets */
800
+ $snippets['all'] = apply_filters( 'code_snippets/list_table/get_snippets', get_snippets( array() ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
801
  $this->fetch_shared_network_snippets();
802
 
803
  /* Redirect POST'ed tag filter to GET */
904
  /* We register our pagination options and calculations */
905
  $this->set_pagination_args( array(
906
  'total_items' => $total_items, // Calculate the total number of items
907
+ 'per_page' => $per_page, // Determine how many items to show on a page
908
  'total_pages' => ceil( $total_items / $per_page ), // Calculate the total number of pages
909
  ) );
910
  }
911
 
912
  /**
913
+ * Determine the sort ordering for two pieces of data
914
  *
915
  * @ignore
916
  *
917
+ * @param string $field name of the field that the data belongs to
918
+ * @param string $a_data
919
+ * @param string $b_data
920
  *
921
+ * @return int
922
  */
923
+ private function get_sort_direction( $field, $a_data, $b_data ) {
924
+
925
+ // if the data is numeric, then calculate the ordering directly
926
+ if ( is_numeric( $a_data ) ) {
927
+ return $a_data - $b_data;
928
+ }
929
+
930
+ // if only one of the data points is empty, then place it before the one which is not
931
+ if ( '' === $a_data xor '' === $b_data ) {
932
+ return '' === $a_data ? 1 : -1;
933
+ }
934
+
935
+ // otherwise, sort using the default string sort order
936
+ return strcmp( $a_data, $b_data );
937
  }
938
 
939
  /**
941
  *
942
  * @ignore
943
  *
944
+ * @param Code_Snippet $a The first snippet to compare
945
+ * @param Code_Snippet $b The second snippet to compare
946
  *
947
+ * @return int The sort order
948
  */
949
  private function usort_reorder_callback( $a, $b ) {
950
 
951
+ // sort by ID by default
952
  $orderby = (
953
+ ! empty( $_REQUEST['orderby'] )
954
  ? $_REQUEST['orderby']
955
+ : apply_filters( 'code_snippets/list_table/default_orderby', 'priority' )
956
  );
957
 
958
+ // sort ascending by default
959
  $order = (
960
+ ! empty( $_REQUEST['order'] )
961
  ? $_REQUEST['order']
962
  : apply_filters( 'code_snippets/list_table/default_order', 'asc' )
963
  );
964
 
965
+ $result = $this->get_sort_direction( $orderby, $a->$orderby, $b->$orderby );
966
+
967
+ if ( 0 === $result && 'id' !== $orderby ) {
968
+ $result = $this->get_sort_direction( 'id', $a->id, $b->id );
 
969
  }
970
 
971
+ // apply the sort direction to the calculated order
972
  return ( 'asc' === $order ) ? $result : -$result;
973
  }
974
 
976
  * Callback for search function
977
  * @ignore
978
  *
979
+ * @param Code_Snippet $snippet The snippet being filtered
980
  *
981
+ * @return bool The result of the filter
982
  */
983
  private function search_callback( $snippet ) {
984
  static $term;
999
 
1000
  /**
1001
  * Callback for filtering snippets by tag
 
1002
  * @ignore
1003
  *
1004
+ * @param Code_Snippet $snippet The snippet being filtered
1005
  *
1006
+ * @return bool The result of the filter
1007
  */
1008
  private function tags_filter_callback( $snippet ) {
1009
  $tags = explode( ',', $_GET['tag'] );
1017
 
1018
  /**
1019
  * Display a notice showing the current search terms
 
1020
  * @since 1.7
1021
  */
1022
  public function search_notice() {
1048
  * @param Code_Snippet $snippet The snippet being used for the current row
1049
  */
1050
  public function single_row( $snippet ) {
1051
+ $row_class = ( $snippet->active ? 'active-snippet' : 'inactive-snippet' );
1052
 
1053
  if ( code_snippets_get_setting( 'general', 'snippet_scope_enabled' ) ) {
1054
  $row_class .= sprintf( ' %s-scope', $snippet->scope );
1055
  }
1056
 
1057
  if ( $snippet->shared_network ) {
1058
+ $row_class .= ' shared-network-snippet';
1059
  }
1060
 
1061
  printf( '<tr class="%s">', $row_class );
1062
  $this->single_row_columns( $snippet );
1063
  echo '</tr>';
1064
  }
1065
+
1066
+ /**
1067
+ * Clone a selection of snippets
1068
+ * @param array $ids
1069
+ */
1070
+ private function clone_snippets( $ids ) {
1071
+ $snippets = get_snippets( $ids, $this->is_network );
1072
+
1073
+ /** @var Code_Snippet $snippet */
1074
+ foreach ( $snippets as $snippet ) {
1075
+
1076
+ // copy all data from the previous snippet aside from the ID and active status
1077
+ $snippet->id = 0;
1078
+ $snippet->active = false;
1079
+
1080
+ save_snippet( $snippet );
1081
+ }
1082
+ }
1083
+ }
php/class-snippet.php CHANGED
@@ -6,15 +6,16 @@
6
  * @since 2.4.0
7
  * @package Code_Snippets
8
  *
9
- * @property int $id The database ID
10
- * @property string $name The display name
11
- * @property string $desc The formatted description
12
- * @property string $code The executable code
13
- * @property array $tags An array of the tags
14
- * @property int $scope The scope number
15
- * @property bool $active The active status
16
- * @property bool $network true if is multisite-wide snippet, false if site-wide
17
- * @property bool $shared_network Whether the snippet is a shared network snippet
 
18
  *
19
  * @property-read array $tags_list The tags in string list format
20
  * @property-read string $scope_name The name of the scope
@@ -28,14 +29,15 @@ class Code_Snippet {
28
  * @var array
29
  */
30
  private $fields = array(
31
- 'id' => 0,
32
- 'name' => '',
33
- 'desc' => '',
34
- 'code' => '',
35
- 'tags' => array(),
36
- 'scope' => 'global',
37
- 'active' => false,
38
- 'network' => null,
 
39
  'shared_network' => null,
40
  );
41
 
@@ -45,6 +47,7 @@ class Code_Snippet {
45
 
46
  /**
47
  * Constructor function
 
48
  * @param array|object $fields Initial snippet fields
49
  */
50
  public function __construct( $fields = null ) {
@@ -98,18 +101,23 @@ class Code_Snippet {
98
 
99
  /**
100
  * Check if a field is set
101
- * @param string $field The field name
102
- * @return bool Whether the field is set
 
 
103
  */
104
  public function __isset( $field ) {
105
  $field = $this->validate_field_name( $field );
 
106
  return isset( $this->fields[ $field ] ) || method_exists( $this, 'get_' . $field );
107
  }
108
 
109
  /**
110
  * Retrieve a field's value
111
- * @param string $field The field name
112
- * @return mixed The field value
 
 
113
  */
114
  public function __get( $field ) {
115
  $field = $this->validate_field_name( $field );
@@ -124,8 +132,6 @@ class Code_Snippet {
124
  /**
125
  * Set the value of a field
126
  *
127
- * @throws ErrorException When an invalid $field is undefined for the class
128
- *
129
  * @param string $field The field name
130
  * @param mixed $value The field value
131
  */
@@ -184,12 +190,15 @@ class Code_Snippet {
184
  }
185
 
186
  $this->__set( $field, $value );
 
187
  return true;
188
  }
189
 
190
  /**
191
  * Prepare the ID by ensuring it is an absolute integer
192
- * @param int $id
 
 
193
  * @return int
194
  */
195
  private function prepare_id( $id ) {
@@ -198,7 +207,9 @@ class Code_Snippet {
198
 
199
  /**
200
  * Prepare the code by removing php tags from beginning and end
201
- * @param string $code
 
 
202
  * @return string
203
  */
204
  private function prepare_code( $code ) {
@@ -214,8 +225,10 @@ class Code_Snippet {
214
 
215
  /**
216
  * Prepare the scope by ensuring that it is a valid number
217
- * @param int $scope The field as provided
218
- * @return int The field in the correct format
 
 
219
  */
220
  private function prepare_scope( $scope ) {
221
  $scopes = self::get_all_scopes();
@@ -233,8 +246,10 @@ class Code_Snippet {
233
 
234
  /**
235
  * Prepare the snippet tags by ensuring they are in the correct format
236
- * @param string|array $tags The tags as provided
237
- * @return array The tags as an array
 
 
238
  */
239
  private function prepare_tags( $tags ) {
240
  return code_snippets_build_tags_array( $tags );
@@ -242,8 +257,10 @@ class Code_Snippet {
242
 
243
  /**
244
  * Prepare the active field by ensuring it is the correct type
245
- * @param bool|int $active The field as provided
246
- * @return bool The field in the correct format
 
 
247
  */
248
  private function prepare_active( $active ) {
249
 
@@ -254,10 +271,23 @@ class Code_Snippet {
254
  return $active ? true : false;
255
  }
256
 
 
 
 
 
 
 
 
 
 
 
 
257
  /**
258
  * If $network is anything other than true, set it to false
259
- * @param bool $network The provided field
260
- * @return bool The filtered field
 
 
261
  */
262
  private function prepare_network( $network ) {
263
 
@@ -290,9 +320,9 @@ class Code_Snippet {
290
  */
291
  public static function get_scope_icons() {
292
  return array(
293
- 'global' => 'admin-site',
294
- 'admin' => 'admin-tools',
295
- 'front-end' => 'admin-appearance',
296
  'single-use' => 'clock',
297
  );
298
  }
@@ -311,6 +341,7 @@ class Code_Snippet {
311
  */
312
  private function get_scope_icon() {
313
  $icons = self::get_scope_icons();
 
314
  return $icons[ $this->scope ];
315
  }
316
 
6
  * @since 2.4.0
7
  * @package Code_Snippets
8
  *
9
+ * @property int $id The database ID
10
+ * @property string $name The display name
11
+ * @property string $desc The formatted description
12
+ * @property string $code The executable code
13
+ * @property array $tags An array of the tags
14
+ * @property int $scope The scope number
15
+ * @property int $priority Execution priority
16
+ * @property bool $active The active status
17
+ * @property bool $network true if is multisite-wide snippet, false if site-wide
18
+ * @property bool $shared_network Whether the snippet is a shared network snippet
19
  *
20
  * @property-read array $tags_list The tags in string list format
21
  * @property-read string $scope_name The name of the scope
29
  * @var array
30
  */
31
  private $fields = array(
32
+ 'id' => 0,
33
+ 'name' => '',
34
+ 'desc' => '',
35
+ 'code' => '',
36
+ 'tags' => array(),
37
+ 'scope' => 'global',
38
+ 'active' => false,
39
+ 'priority' => 10,
40
+ 'network' => null,
41
  'shared_network' => null,
42
  );
43
 
47
 
48
  /**
49
  * Constructor function
50
+ *
51
  * @param array|object $fields Initial snippet fields
52
  */
53
  public function __construct( $fields = null ) {
101
 
102
  /**
103
  * Check if a field is set
104
+ *
105
+ * @param string $field The field name
106
+ *
107
+ * @return bool Whether the field is set
108
  */
109
  public function __isset( $field ) {
110
  $field = $this->validate_field_name( $field );
111
+
112
  return isset( $this->fields[ $field ] ) || method_exists( $this, 'get_' . $field );
113
  }
114
 
115
  /**
116
  * Retrieve a field's value
117
+ *
118
+ * @param string $field The field name
119
+ *
120
+ * @return mixed The field value
121
  */
122
  public function __get( $field ) {
123
  $field = $this->validate_field_name( $field );
132
  /**
133
  * Set the value of a field
134
  *
 
 
135
  * @param string $field The field name
136
  * @param mixed $value The field value
137
  */
190
  }
191
 
192
  $this->__set( $field, $value );
193
+
194
  return true;
195
  }
196
 
197
  /**
198
  * Prepare the ID by ensuring it is an absolute integer
199
+ *
200
+ * @param int $id
201
+ *
202
  * @return int
203
  */
204
  private function prepare_id( $id ) {
207
 
208
  /**
209
  * Prepare the code by removing php tags from beginning and end
210
+ *
211
+ * @param string $code
212
+ *
213
  * @return string
214
  */
215
  private function prepare_code( $code ) {
225
 
226
  /**
227
  * Prepare the scope by ensuring that it is a valid number
228
+ *
229
+ * @param int $scope The field as provided
230
+ *
231
+ * @return int The field in the correct format
232
  */
233
  private function prepare_scope( $scope ) {
234
  $scopes = self::get_all_scopes();
246
 
247
  /**
248
  * Prepare the snippet tags by ensuring they are in the correct format
249
+ *
250
+ * @param string|array $tags The tags as provided
251
+ *
252
+ * @return array The tags as an array
253
  */
254
  private function prepare_tags( $tags ) {
255
  return code_snippets_build_tags_array( $tags );
257
 
258
  /**
259
  * Prepare the active field by ensuring it is the correct type
260
+ *
261
+ * @param bool|int $active The field as provided
262
+ *
263
+ * @return bool The field in the correct format
264
  */
265
  private function prepare_active( $active ) {
266
 
271
  return $active ? true : false;
272
  }
273
 
274
+ /**
275
+ * Prepare the priority field by ensuring it is an integer
276
+ *
277
+ * @param int $priority
278
+ *
279
+ * @return int
280
+ */
281
+ private function prepare_priority( $priority ) {
282
+ return intval( $priority );
283
+ }
284
+
285
  /**
286
  * If $network is anything other than true, set it to false
287
+ *
288
+ * @param bool $network The provided field
289
+ *
290
+ * @return bool The filtered field
291
  */
292
  private function prepare_network( $network ) {
293
 
320
  */
321
  public static function get_scope_icons() {
322
  return array(
323
+ 'global' => 'admin-site',
324
+ 'admin' => 'admin-tools',
325
+ 'front-end' => 'admin-appearance',
326
  'single-use' => 'clock',
327
  );
328
  }
341
  */
342
  private function get_scope_icon() {
343
  $icons = self::get_scope_icons();
344
+
345
  return $icons[ $this->scope ];
346
  }
347
 
php/editor.php CHANGED
@@ -46,7 +46,7 @@ function code_snippets_get_editor_atts( $override_atts, $json_encode ) {
46
  * @uses wp_enqueue_script() to add the scripts to the queue
47
  */
48
  function code_snippets_enqueue_codemirror() {
49
- $codemirror_version = '5.33.0';
50
  $url = plugin_dir_url( CODE_SNIPPETS_FILE );
51
 
52
  /* Remove other CodeMirror styles */
46
  * @uses wp_enqueue_script() to add the scripts to the queue
47
  */
48
  function code_snippets_enqueue_codemirror() {
49
+ $codemirror_version = '5.40.2';
50
  $url = plugin_dir_url( CODE_SNIPPETS_FILE );
51
 
52
  /* Remove other CodeMirror styles */
php/settings/settings-fields.php CHANGED
@@ -66,23 +66,26 @@ function code_snippets_get_settings_fields() {
66
  'default' => true,
67
  ),
68
 
69
- 'show_network_snippets' => array(
70
- 'name' => __( 'Show Network Snippets', 'code-snippets' ),
71
  'type' => 'checkbox',
72
- 'label' => __( 'Show network-wide snippets in the snippets table on subsites to super administrators only', 'code-snippets' ),
73
  'default' => false,
74
  ),
75
 
76
- 'disable_prism' => array(
77
- 'name' => __( 'Disable shortcode syntax highlighter', 'code-snippets' ),
78
  'type' => 'checkbox',
79
- 'label' => __( 'Disable the syntax highlighting for the [code_snippet] shortcode on the front-end', 'code-snippets' ),
 
 
 
80
  'default' => false,
81
  ),
82
  );
83
 
84
- if ( ! is_multisite() || ! current_user_can( code_snippets()->get_network_cap_name() ) ) {
85
- unset( $fields['general']['show_network_snippets'] );
86
  }
87
 
88
  /* Description Editor settings section */
66
  'default' => true,
67
  ),
68
 
69
+ 'disable_prism' => array(
70
+ 'name' => __( 'Disable Shortcode Syntax Highlighter', 'code-snippets' ),
71
  'type' => 'checkbox',
72
+ 'label' => __( 'Disable the syntax highlighting for the [code_snippet] shortcode on the front-end', 'code-snippets' ),
73
  'default' => false,
74
  ),
75
 
76
+ 'complete_uninstall' => array(
77
+ 'name' => __( 'Complete Uninstall', 'code-snippets' ),
78
  'type' => 'checkbox',
79
+ 'label' => sprintf(
80
+ __( 'When the plugin is deleted from the <a href="%s">Plugins</a> menu, also delete all snippets and plugin settings.', 'code-snippets' ),
81
+ self_admin_url( 'plugins.php' )
82
+ ),
83
  'default' => false,
84
  ),
85
  );
86
 
87
+ if ( is_multisite() && ! is_main_site() ) {
88
+ unset( $fields['general']['complete_uninstall'] );
89
  }
90
 
91
  /* Description Editor settings section */
php/snippet-ops.php CHANGED
@@ -272,6 +272,7 @@ function save_snippet( Code_Snippet $snippet ) {
272
  'code' => $snippet->code,
273
  'tags' => $snippet->tags_list,
274
  'scope' => $snippet->scope,
 
275
  'active' => intval( $snippet->active ),
276
  );
277
 
@@ -380,10 +381,11 @@ function execute_active_snippets() {
380
  $queries = array();
381
 
382
  $sql_format = "SELECT id, code, scope FROM %s WHERE scope IN ('global', 'single-use', %%s) ";
 
383
 
384
  /* Fetch snippets from site table */
385
  if ( $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->snippets'" ) === $wpdb->snippets ) {
386
- $queries[ $wpdb->snippets ] = $wpdb->prepare( sprintf( $sql_format, $wpdb->snippets ) . 'AND active=1', $current_scope );
387
  }
388
 
389
  /* Fetch snippets from the network table */
@@ -397,14 +399,14 @@ function execute_active_snippets() {
397
  $active_shared_ids_format = implode( ',', array_fill( 0, count( $active_shared_ids ), '%d' ) );
398
 
399
  /* Include them in the query */
400
- $sql = sprintf( $sql_format, $wpdb->ms_snippets ) . " AND (active=1 OR id IN ($active_shared_ids_format))";
401
 
402
  /* Add the scope number to the IDs array, so that it is the first variable in the query */
403
  array_unshift( $active_shared_ids, $current_scope );
404
  $queries[ $wpdb->ms_snippets ] = $wpdb->prepare( $sql, $active_shared_ids );
405
 
406
  } else {
407
- $sql = sprintf( $sql_format, $wpdb->ms_snippets ) . 'AND active=1';
408
  $queries[ $wpdb->ms_snippets ] = $wpdb->prepare( $sql, $current_scope );
409
  }
410
  }
272
  'code' => $snippet->code,
273
  'tags' => $snippet->tags_list,
274
  'scope' => $snippet->scope,
275
+ 'priority' => $snippet->priority,
276
  'active' => intval( $snippet->active ),
277
  );
278
 
381
  $queries = array();
382
 
383
  $sql_format = "SELECT id, code, scope FROM %s WHERE scope IN ('global', 'single-use', %%s) ";
384
+ $order = 'ORDER BY priority ASC, id ASC';
385
 
386
  /* Fetch snippets from site table */
387
  if ( $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->snippets'" ) === $wpdb->snippets ) {
388
+ $queries[ $wpdb->snippets ] = $wpdb->prepare( sprintf( $sql_format, $wpdb->snippets ) . 'AND active=1 ' . $order, $current_scope );
389
  }
390
 
391
  /* Fetch snippets from the network table */
399
  $active_shared_ids_format = implode( ',', array_fill( 0, count( $active_shared_ids ), '%d' ) );
400
 
401
  /* Include them in the query */
402
+ $sql = sprintf( $sql_format, $wpdb->ms_snippets ) . " AND (active=1 OR id IN ($active_shared_ids_format)) $order";
403
 
404
  /* Add the scope number to the IDs array, so that it is the first variable in the query */
405
  array_unshift( $active_shared_ids, $current_scope );
406
  $queries[ $wpdb->ms_snippets ] = $wpdb->prepare( $sql, $active_shared_ids );
407
 
408
  } else {
409
+ $sql = sprintf( $sql_format, $wpdb->ms_snippets ) . 'AND active=1 ' . $order;
410
  $queries[ $wpdb->ms_snippets ] = $wpdb->prepare( $sql, $current_scope );
411
  }
412
  }
php/upgrade.php CHANGED
@@ -15,6 +15,7 @@ if ( ! defined( 'ABSPATH' ) ) {
15
  */
16
  function code_snippets_upgrader() {
17
  global $wpdb;
 
18
 
19
  /* Get the current plugin version from the database */
20
  $prev_version = get_option( 'code_snippets_version' );
@@ -23,7 +24,7 @@ function code_snippets_upgrader() {
23
  if ( version_compare( $prev_version, CODE_SNIPPETS_VERSION, '<' ) ) {
24
 
25
  /* Upgrade the database tables */
26
- code_snippets()->db->create_tables( true );
27
 
28
  /* Update the plugin version stored in the database */
29
  update_option( 'code_snippets_version', CODE_SNIPPETS_VERSION );
@@ -42,6 +43,10 @@ function code_snippets_upgrader() {
42
  }
43
  }
44
 
 
 
 
 
45
  /* Run multisite-only upgrades */
46
 
47
  if ( is_multisite() && is_main_site() ) {
15
  */
16
  function code_snippets_upgrader() {
17
  global $wpdb;
18
+ $db = code_snippets()->db;
19
 
20
  /* Get the current plugin version from the database */
21
  $prev_version = get_option( 'code_snippets_version' );
24
  if ( version_compare( $prev_version, CODE_SNIPPETS_VERSION, '<' ) ) {
25
 
26
  /* Upgrade the database tables */
27
+ $db->create_tables( true );
28
 
29
  /* Update the plugin version stored in the database */
30
  update_option( 'code_snippets_version', CODE_SNIPPETS_VERSION );
43
  }
44
  }
45
 
46
+ if ( false === $prev_version ) {
47
+ $db->create_sample_content();
48
+ }
49
+
50
  /* Run multisite-only upgrades */
51
 
52
  if ( is_multisite() && is_main_site() ) {
php/views/edit.php CHANGED
@@ -16,6 +16,14 @@ $table = code_snippets()->db->get_table_name();
16
  $edit_id = code_snippets()->get_menu_slug( 'edit' ) === $_REQUEST['page'] ? absint( $_REQUEST['id'] ) : 0;
17
  $snippet = get_snippet( $edit_id );
18
 
 
 
 
 
 
 
 
 
19
  ?>
20
  <div class="wrap">
21
  <h1><?php
@@ -30,7 +38,7 @@ $snippet = get_snippet( $edit_id );
30
  }
31
  ?></h1>
32
 
33
- <form method="post" id="snippet-form" action="" style="margin-top: 10px;">
34
  <?php
35
  /* Output the hidden fields */
36
 
@@ -144,22 +152,46 @@ $snippet = get_snippet( $edit_id );
144
  </div>
145
 
146
  <script>
147
- /* Loads CodeMirror on the snippet editor */
148
- (function() {
149
-
150
- var atts = [];
151
- atts = <?php
152
- $atts = array( 'mode' => 'text/x-php' );
153
- echo code_snippets_get_editor_atts( $atts, true );
154
- ?>;
155
- atts['viewportMargin'] = Infinity;
156
-
157
- atts['extraKeys'] = {
158
- 'Ctrl-Enter': function (cm) {
159
- document.getElementById('snippet-form').submit();
 
 
 
 
 
 
 
 
 
 
 
160
  }
161
- };
162
 
163
- CodeMirror.fromTextArea(document.getElementById('snippet_code'), atts);
164
- })();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  </script>
16
  $edit_id = code_snippets()->get_menu_slug( 'edit' ) === $_REQUEST['page'] ? absint( $_REQUEST['id'] ) : 0;
17
  $snippet = get_snippet( $edit_id );
18
 
19
+ $classes = array();
20
+
21
+ if ( $edit_id ) {
22
+ $classes[] = ( $snippet->active ? '' : 'in' ) . 'active-snippet';
23
+ } else {
24
+ $classes[] = 'new-snippet';
25
+ }
26
+
27
  ?>
28
  <div class="wrap">
29
  <h1><?php
38
  }
39
  ?></h1>
40
 
41
+ <form method="post" id="snippet-form" action="" style="margin-top: 10px;" class="<?php echo implode( ' ', $classes ); ?>">
42
  <?php
43
  /* Output the hidden fields */
44
 
152
  </div>
153
 
154
  <script>
155
+ 'use strict';
156
+ /* Loads CodeMirror on the snippet editor */
157
+ var code_snippet_editor = (function() {
158
+
159
+ var atts = [];
160
+ atts = <?php
161
+ $atts = array( 'mode' => 'text/x-php' );
162
+ echo code_snippets_get_editor_atts( $atts, true );
163
+ ?>;
164
+ atts['viewportMargin'] = Infinity;
165
+
166
+ atts['extraKeys'] = {
167
+ 'Ctrl-Enter': function (cm) {
168
+ document.getElementById('snippet-form').submit();
169
+ }
170
+ };
171
+
172
+ var editor = CodeMirror.fromTextArea(document.getElementById('snippet_code'), atts);
173
+
174
+ // set the cursor to the previous position
175
+ var matches = window.location.href.match(/[?&]cursor=(\d+)_(\d+)/);
176
+ if (matches) {
177
+ editor.focus();
178
+ editor.setCursor({line: matches[1], ch: matches[2]});
179
  }
 
180
 
181
+ // send the current cursor position to the next page
182
+ document.getElementById('snippet-form').addEventListener('submit', function () {
183
+ var cursor = editor.getCursor();
184
+ this.insertAdjacentHTML('beforeend', '<input type="hidden" name="snippet_editor_cursor" value="' + cursor.line + '_' + cursor.ch + '">');
185
+ });
186
+
187
+ // submit snippet on ctrl/cmd+s
188
+ document.addEventListener('keydown', function (e) {
189
+ if ((window.navigator.platform.match('Mac') ? e.metaKey : e.ctrlKey) && 's' === e.key) {
190
+ e.preventDefault();
191
+ document.getElementById('save_snippet').click();
192
+ }
193
+ }, false);
194
+
195
+ return editor;
196
+ })();
197
  </script>
php/views/import.php CHANGED
@@ -12,6 +12,10 @@ if ( ! defined( 'ABSPATH' ) ) {
12
  return;
13
  }
14
 
 
 
 
 
15
  ?>
16
  <div class="wrap">
17
  <h1><?php _e( 'Import Snippets', 'code-snippets' ); ?></h1>
@@ -22,53 +26,73 @@ if ( ! defined( 'ABSPATH' ) ) {
22
 
23
  <p><?php
24
  printf(
25
- __( 'Afterwards, you will need to go to the <a href="%s">All Snippets</a> page to activate the imported snippets.', 'code-snippets' ),
26
  code_snippets()->get_menu_url( 'manage' )
27
  ); ?></p>
28
 
29
- <p><?php _e( 'Choose one or more Code Snippets (.xml or .json) files to upload, then click "Upload files and import".', 'code-snippets' ); ?></p>
30
 
31
- <form enctype="multipart/form-data" method="post" action="" id="import-upload-form" name="code_snippets_import">
32
- <p>
33
- <input type="hidden" name="action" value="save">
34
- <input type="hidden" name="max_file_size" value="8388608">
 
 
35
 
36
- <label for="upload"><?php _e( 'Choose a file from your computer:', 'code-snippets' ); ?></label>
37
- <?php _e( '(Maximum size: 8MB)', 'code-snippets' ); ?>
38
- <input type="file" id="upload" name="code_snippets_import_files[]" size="25" accept="application/json,text/xml" multiple="multiple">
39
- </p>
40
 
41
- <h2>Duplicate Snippets</h2>
 
 
42
 
43
  <p class="description">
44
  <?php esc_html_e( 'What should happen if an existing snippet is found with an identical name to an imported snippet?', 'code-snippets' ); ?>
45
  </p>
46
 
47
- <p>
48
- <label>
49
- <input type="radio" name="duplicate_action" value="ignore" checked="checked">
50
- <?php esc_html_e( 'Ignore any duplicate snippets: import all snippets from the file regardless and leave all existing snippets unchanged.', 'code-snippets' ); ?>
51
- </label>
52
- </p>
 
53
 
54
- <p>
55
- <label>
56
- <input type="radio" name="duplicate_action" value="replace">
57
- <?php esc_html_e( 'Replace any existing snippets with a newly imported snippet of the same name.', 'code-snippets' ); ?>
58
- </label>
59
- </p>
 
 
 
 
 
 
 
 
 
 
60
 
61
- <p>
62
- <label>
63
- <input type="radio" name="duplicate_action" value="skip">
64
- <?php esc_html_e( 'Do not import any duplicate snippets; leave all existing snippets unchanged.', 'code-snippets' ); ?>
65
- </label>
66
  </p>
67
 
 
 
 
 
 
 
 
 
 
 
68
  <?php
69
- do_action( 'code_snippets/admin/import_form' );
70
- submit_button( __( 'Upload files and import', 'code-snippets' ) );
71
  ?>
72
  </form>
 
73
  </div>
74
  </div>
12
  return;
13
  }
14
 
15
+ $max_size_bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() );
16
+ $upload_dir = wp_upload_dir();
17
+
18
+
19
  ?>
20
  <div class="wrap">
21
  <h1><?php _e( 'Import Snippets', 'code-snippets' ); ?></h1>
26
 
27
  <p><?php
28
  printf(
29
+ __( 'Afterwards, you will need to visit the <a href="%s">All Snippets</a> page to activate the imported snippets.', 'code-snippets' ),
30
  code_snippets()->get_menu_url( 'manage' )
31
  ); ?></p>
32
 
33
+ <?php if ( ! empty( $upload_dir['error'] ) ) : ?>
34
 
35
+ <div class="error">
36
+ <p><?php _e( 'Before you can upload your import file, you will need to fix the following error:' ); ?></p>
37
+ <p>
38
+ <strong><?php echo $upload_dir['error']; ?></strong>
39
+ </p>
40
+ </div>
41
 
42
+ <?php else : ?>
 
 
 
43
 
44
+ <form enctype="multipart/form-data" id="import-upload-form" method="post" class="wp-upload-form" name="code_snippets_import">
45
+
46
+ <h2><?php _e( 'Duplicate Snippets', 'code-snippets' ); ?></h2>
47
 
48
  <p class="description">
49
  <?php esc_html_e( 'What should happen if an existing snippet is found with an identical name to an imported snippet?', 'code-snippets' ); ?>
50
  </p>
51
 
52
+ <fieldset>
53
+ <p>
54
+ <label>
55
+ <input type="radio" name="duplicate_action" value="ignore" checked="checked">
56
+ <?php esc_html_e( 'Ignore any duplicate snippets: import all snippets from the file regardless and leave all existing snippets unchanged.', 'code-snippets' ); ?>
57
+ </label>
58
+ </p>
59
 
60
+ <p>
61
+ <label>
62
+ <input type="radio" name="duplicate_action" value="replace">
63
+ <?php esc_html_e( 'Replace any existing snippets with a newly imported snippet of the same name.', 'code-snippets' ); ?>
64
+ </label>
65
+ </p>
66
+
67
+ <p>
68
+ <label>
69
+ <input type="radio" name="duplicate_action" value="skip">
70
+ <?php esc_html_e( 'Do not import any duplicate snippets; leave all existing snippets unchanged.', 'code-snippets' ); ?>
71
+ </label>
72
+ </p>
73
+ </fieldset>
74
+
75
+ <h2><?php _e( 'Upload Files', 'code-snippets' ); ?></h2>
76
 
77
+ <p class="description">
78
+ <?php _e( 'Choose one or more Code Snippets (.xml or .json) files to upload, then click "Upload files and import".', 'code-snippets' ); ?>
 
 
 
79
  </p>
80
 
81
+ <fieldset>
82
+ <p>
83
+ <label for="upload"><?php esc_html_e( 'Choose files from your computer:', 'code-snippets' ); ?></label>
84
+ <?php printf( esc_html__( '(Maximum size: %s)', 'code-snippets' ), size_format( $max_size_bytes ) ); ?>
85
+ <input type="file" id="upload" name="code_snippets_import_files[]" size="25" accept="application/json,.json,text/xml" multiple="multiple">
86
+ <input type="hidden" name="action" value="save">
87
+ <input type="hidden" name="max_file_size" value="<?php echo esc_attr( $max_size_bytes ); ?>">
88
+ </p>
89
+ </fieldset>
90
+
91
  <?php
92
+ do_action( 'code_snippets/admin/import_form' );
93
+ submit_button( __( 'Upload files and import', 'code-snippets' ) );
94
  ?>
95
  </form>
96
+ <?php endif; ?>
97
  </div>
98
  </div>
php/views/manage.php CHANGED
@@ -5,6 +5,8 @@
5
  *
6
  * @package Code_Snippets
7
  * @subpackage Views
 
 
8
  */
9
 
10
  /* Bail if accessed directly */
@@ -16,14 +18,19 @@ if ( ! defined( 'ABSPATH' ) ) {
16
 
17
  <div class="wrap">
18
  <h1><?php
19
- esc_html_e( 'Snippets', 'code-snippets' );
 
 
 
 
 
20
 
21
- printf( '<a href="%2$s" class="page-title-action add-new-h2">%1$s</a>',
22
- esc_html_x( 'Add New', 'snippet', 'code-snippets' ),
23
- code_snippets_get_menu_url( 'add' )
24
- );
25
 
26
- $this->list_table->search_notice();
27
  ?></h1>
28
 
29
  <?php $this->list_table->views(); ?>
@@ -35,6 +42,8 @@ if ( ! defined( 'ABSPATH' ) ) {
35
  ?>
36
  </form>
37
  <form method="post" action="">
 
 
38
  <?php
39
  $this->list_table->required_form_fields();
40
  $this->list_table->display();
5
  *
6
  * @package Code_Snippets
7
  * @subpackage Views
8
+ *
9
+ * @var Code_Snippets_Manage_Menu $this
10
  */
11
 
12
  /* Bail if accessed directly */
18
 
19
  <div class="wrap">
20
  <h1><?php
21
+ esc_html_e( 'Snippets', 'code-snippets' );
22
+
23
+ printf( '<a href="%2$s" class="page-title-action add-new-h2">%1$s</a>',
24
+ esc_html_x( 'Add New', 'snippet', 'code-snippets' ),
25
+ code_snippets()->get_menu_url( 'add' )
26
+ );
27
 
28
+ printf( '<a href="%2$s" class="page-title-action">%1$s</a>',
29
+ esc_html_x( 'Import', 'snippets', 'code-snippets' ),
30
+ code_snippets()->get_menu_url( 'import' )
31
+ );
32
 
33
+ $this->list_table->search_notice();
34
  ?></h1>
35
 
36
  <?php $this->list_table->views(); ?>
42
  ?>
43
  </form>
44
  <form method="post" action="">
45
+ <input type="hidden" id="code_snippets_ajax_nonce" value="<?php echo esc_attr( wp_create_nonce( 'code_snippets_manage' ) ); ?>">
46
+
47
  <?php
48
  $this->list_table->required_form_fields();
49
  $this->list_table->display();
readme.txt CHANGED
@@ -1,10 +1,11 @@
1
  === Code Snippets ===
2
  Contributors: bungeshea
3
- Donate link: https://bungeshea.com/donate/
4
  Tags: code-snippets, snippets, code, php, network, multisite
5
  Requires at least: 3.6
6
- Tested up to: 4.9.4
7
- Stable tag: 2.10.1.1
 
8
  License: MIT
9
  License URI: license.txt
10
 
@@ -26,6 +27,7 @@ If you have any feedback, issues, or suggestions for improvements please leave a
26
 
27
  Code Snippets can be used in these different languages thanks to the following translators:
28
 
 
29
  * Brazilian Portuguese – [Bruno Borges](http://brunoborges.info)
30
  * French (Canada) - [Dominic Desbiens](http://www.dominicdesbiens.com/)
31
  * Indonesian - [Jordan Silaen from ChameleonJohn.com](https://www.chameleonjohn.com/)
@@ -111,6 +113,34 @@ That's fantastic! Fork the [repository on GitHub](http://github.com/sheabunge/co
111
 
112
  == Changelog ==
113
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  = 2.10.1 (10 Feb 2018) =
115
  * Fixed: Prevent errors when trying to export no snippets
116
  * Fixed: Use wp_json_encode() to encode export data
@@ -511,6 +541,9 @@ That's fantastic! Fork the [repository on GitHub](http://github.com/sheabunge/co
511
 
512
  == Upgrade Notice ==
513
 
 
 
 
514
  = 2.10.0 =
515
  Improvements for multisite and new single-use snippet scope
516
 
1
  === Code Snippets ===
2
  Contributors: bungeshea
3
+ Donate link: https://bungeshea.com/donate
4
  Tags: code-snippets, snippets, code, php, network, multisite
5
  Requires at least: 3.6
6
+ Tested up to: 4.9.8
7
+ Requires PHP: 5.2
8
+ Stable tag: 2.12.0
9
  License: MIT
10
  License URI: license.txt
11
 
27
 
28
  Code Snippets can be used in these different languages thanks to the following translators:
29
 
30
+ * Belarusian - [Hrank.com](https://www.hrank.com)
31
  * Brazilian Portuguese – [Bruno Borges](http://brunoborges.info)
32
  * French (Canada) - [Dominic Desbiens](http://www.dominicdesbiens.com/)
33
  * Indonesian - [Jordan Silaen from ChameleonJohn.com](https://www.chameleonjohn.com/)
113
 
114
  == Changelog ==
115
 
116
+ = 2.12.0 (23 Sep 2018) =
117
+ * Fixed: Prevented hidden columns setting from reverting to default
118
+ * Improved: Updated import page to improve usability
119
+ * Improved: Added Import button next to page title on manage page
120
+ * Improved: Added coloured banner indicating whether a snippet is active when editing
121
+ * Update CodeMirror to 5.40.0
122
+
123
+ = 2.11.0 (24 Jul 2018) =
124
+ * Added: Ability to assign a priority to snippets, to determine the order in which they are executed
125
+ * Improvement: The editor cursor position will be preserved when saving a snippet
126
+ * Added: Pressing Ctrl/Cmd + S while writing a snippet will save it
127
+ * Added: Shadow opening PHP tag above the code editor
128
+ * Improved: Updated the message shown when there are no snippets
129
+ * Added: Install sample snippets when the plugin is installed
130
+ * Improved: Show all available tags when selecting the tag field
131
+ * Added: Filter hook for controlling the default list table view
132
+ * Added: Action for cloning snippets
133
+
134
+ = 2.10.2 (21 Jul 2018) =
135
+ * Added: Button to reset settings to their default values
136
+ * Improved: Made uninstall cleanup optional through a plugin setting
137
+ * Fixed: Applied formatting filters to snippet descriptions in the table
138
+ * Improved: Ordered tags by name in the filter dropdown menu
139
+ * Fixed: Incorrectly translated strings
140
+ * Added: Belarusian translation by Hrank.com
141
+ * Improved: Enabled sorting snippets table by tags
142
+ * Updated CodeMirror to version 5.39.0
143
+
144
  = 2.10.1 (10 Feb 2018) =
145
  * Fixed: Prevent errors when trying to export no snippets
146
  * Fixed: Use wp_json_encode() to encode export data
541
 
542
  == Upgrade Notice ==
543
 
544
+ = 2.11.0 =
545
+ Snippet priorities and other small features
546
+
547
  = 2.10.0 =
548
  Improvements for multisite and new single-use snippet scope
549
 
uninstall.php CHANGED
@@ -11,6 +11,20 @@ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
11
  exit();
12
  }
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  /**
15
  * Clean up data created by this plugin for a single site
16
  * @since 2.0
11
  exit();
12
  }
13
 
14
+ /* Fetch the Complete Uninstall option from the database settings */
15
+ $unified = false;
16
+ if ( is_multisite() ) {
17
+ $menu_perms = get_site_option( 'menu_items', array() );
18
+ $unified = empty( $menu_perms['snippets_settings'] );
19
+ }
20
+
21
+ $settings = $unified ? get_site_option( 'code_snippets_settings' ) : get_option( 'code_snippets_settings' );
22
+
23
+ /* Short circuit the uninstall cleanup process if the option is not enabled */
24
+ if ( ! isset( $settings['general']['complete_uninstall'] ) || ! $settings['general']['complete_uninstall'] ) {
25
+ return;
26
+ }
27
+
28
  /**
29
  * Clean up data created by this plugin for a single site
30
  * @since 2.0