Code Snippets - Version 1.8.1.1

Version Description

  • Updated MP6 icon implementation
Download this release

Release Info

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

Code changes from version 1.8.1 to 1.8.1.1

assets/css/menu-icon-mp6.css CHANGED
@@ -1 +1 @@
1
- #toplevel_page_snippets .wp-menu-image{background-image:url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+DQoNCjxzdmcgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNDRwdCIgd2lkdGg9IjQ4cHQiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDQ4IDQ0Ij4NCg0KCTxwYXRoIGNsYXNzPSJzbmlwcGV0cy1pY29uLXN2ZyIgZD0iTTMyLjcyLDEuODFjMy4xNy0yLjI3LDkuNzEtMS4xNiwxMC4zMiwzLjEzLTIuOCwzLjcyLTYuNDksNi42NS05LjY0LDEwLjA2LDQuODIsMC41MywxMC4xNi0xLjIyLDE0LjYsMS4xNnYxLjU1Yy0wLjM3LDMuMTEtMi4zNSw2LjE0LTUuNDksNi45Ny02Ljc5LDEuMjktMTQuMDQtMS4wMi0yMC42MiwxLjI1LDIuNjYsMS42Nyw1LjU2LDMuNzQsNi4wNyw3LjEsMS4yNCw1LjEyLTIuOTEsMTAuNDMtOC4wOCwxMC44LTUuMjcsMC41LTEwLjM3LTQuNDUtOS42Ni05Ljc5LDAuMzYtNC42Niw0LjczLTcuMjIsNy40Ni0xMC40OSwxLjE1LTAuOTgsMS4wMi0zLjE2LTAuNzMtMy4zNy0zLjc4LTAuNTctNy43NSwwLjQzLTExLjQyLTAuODktMy4wNi0xLjItNC45OS00LjE5LTUuNTMtNy4zNXYtMi4xNWMwLjgzLTUuODcsNy43OC05Ljc0LDEzLjA4LTYuNzksNC41OSwyLjE3LDUuNzcsNy44Myw0LjIxLDEyLjMyLDAuNTgtMC4yMSwxLjc1LTAuNjEsMi4zNC0wLjgyLDQuNTctNCw4LjM4LTguODQsMTMuMDktMTIuNjl6IE03LjMzLDcuNGMyLjQ4LTEuMjcsNS43OSwwLjgxLDUuNjksMy42MSwwLjEzLDMuMDYtMy44OCw1LjE3LTYuMjgsMy4yMy0yLjU4LTEuNDktMi4xNS01Ljc3LDAuNTktNi44NHogTTE3LjM2LDMxLjM4YzIuODEtMS43OCw2Ljc0LDEuNDUsNS42Niw0LjU2LTAuNjgsMi44My00LjY4LDMuOS02LjY1LDEuNzQtMS45My0xLjc3LTEuNC01LjIxLDAuOTktNi4zeiIgZmlsbC1ydWxlPSJldmVub2RkIiBmaWxsPSIjODg4ODg4Ii8+DQoNCjwvc3ZnPg0K') !important;background-position:center center !important;background-size:20px 20px !important;background-repeat:no-repeat}#toplevel_page_snippets.wp-has-current-submenu .wp-menu-image,#toplevel_page_snippets.wp-has-current-submenu:hover .wp-menu-image{background-image:url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+DQoNCjxzdmcgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNDRwdCIgd2lkdGg9IjQ4cHQiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDQ4IDQ0Ij4NCg0KCTxwYXRoIGNsYXNzPSJzbmlwcGV0cy1pY29uLXN2ZyIgZD0iTTMyLjcyLDEuODFjMy4xNy0yLjI3LDkuNzEtMS4xNiwxMC4zMiwzLjEzLTIuOCwzLjcyLTYuNDksNi42NS05LjY0LDEwLjA2LDQuODIsMC41MywxMC4xNi0xLjIyLDE0LjYsMS4xNnYxLjU1Yy0wLjM3LDMuMTEtMi4zNSw2LjE0LTUuNDksNi45Ny02Ljc5LDEuMjktMTQuMDQtMS4wMi0yMC42MiwxLjI1LDIuNjYsMS42Nyw1LjU2LDMuNzQsNi4wNyw3LjEsMS4yNCw1LjEyLTIuOTEsMTAuNDMtOC4wOCwxMC44LTUuMjcsMC41LTEwLjM3LTQuNDUtOS42Ni05Ljc5LDAuMzYtNC42Niw0LjczLTcuMjIsNy40Ni0xMC40OSwxLjE1LTAuOTgsMS4wMi0zLjE2LTAuNzMtMy4zNy0zLjc4LTAuNTctNy43NSwwLjQzLTExLjQyLTAuODktMy4wNi0xLjItNC45OS00LjE5LTUuNTMtNy4zNXYtMi4xNWMwLjgzLTUuODcsNy43OC05Ljc0LDEzLjA4LTYuNzksNC41OSwyLjE3LDUuNzcsNy44Myw0LjIxLDEyLjMyLDAuNTgtMC4yMSwxLjc1LTAuNjEsMi4zNC0wLjgyLDQuNTctNCw4LjM4LTguODQsMTMuMDktMTIuNjl6IE03LjMzLDcuNGMyLjQ4LTEuMjcsNS43OSwwLjgxLDUuNjksMy42MSwwLjEzLDMuMDYtMy44OCw1LjE3LTYuMjgsMy4yMy0yLjU4LTEuNDktMi4xNS01Ljc3LDAuNTktNi44NHogTTE3LjM2LDMxLjM4YzIuODEtMS43OCw2Ljc0LDEuNDUsNS42Niw0LjU2LTAuNjgsMi44My00LjY4LDMuOS02LjY1LDEuNzQtMS45My0xLjc3LTEuNC01LjIxLDAuOTktNi4zeiIgZmlsbC1ydWxlPSJldmVub2RkIiBmaWxsPSIjZmZmIi8+DQoNCjwvc3ZnPg0K') !important}#toplevel_page_snippets:hover .wp-menu-image{background-image:url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+DQoNCjxzdmcgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNDRwdCIgd2lkdGg9IjQ4cHQiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDQ4IDQ0Ij4NCg0KCTxwYXRoIGNsYXNzPSJzbmlwcGV0cy1pY29uLXN2ZyIgZD0iTTMyLjcyLDEuODFjMy4xNy0yLjI3LDkuNzEtMS4xNiwxMC4zMiwzLjEzLTIuOCwzLjcyLTYuNDksNi42NS05LjY0LDEwLjA2LDQuODIsMC41MywxMC4xNi0xLjIyLDE0LjYsMS4xNnYxLjU1Yy0wLjM3LDMuMTEtMi4zNSw2LjE0LTUuNDksNi45Ny02Ljc5LDEuMjktMTQuMDQtMS4wMi0yMC42MiwxLjI1LDIuNjYsMS42Nyw1LjU2LDMuNzQsNi4wNyw3LjEsMS4yNCw1LjEyLTIuOTEsMTAuNDMtOC4wOCwxMC44LTUuMjcsMC41LTEwLjM3LTQuNDUtOS42Ni05Ljc5LDAuMzYtNC42Niw0LjczLTcuMjIsNy40Ni0xMC40OSwxLjE1LTAuOTgsMS4wMi0zLjE2LTAuNzMtMy4zNy0zLjc4LTAuNTctNy43NSwwLjQzLTExLjQyLTAuODktMy4wNi0xLjItNC45OS00LjE5LTUuNTMtNy4zNXYtMi4xNWMwLjgzLTUuODcsNy43OC05Ljc0LDEzLjA4LTYuNzksNC41OSwyLjE3LDUuNzcsNy44Myw0LjIxLDEyLjMyLDAuNTgtMC4yMSwxLjc1LTAuNjEsMi4zNC0wLjgyLDQuNTctNCw4LjM4LTguODQsMTMuMDktMTIuNjl6IE03LjMzLDcuNGMyLjQ4LTEuMjcsNS43OSwwLjgxLDUuNjksMy42MSwwLjEzLDMuMDYtMy44OCw1LjE3LTYuMjgsMy4yMy0yLjU4LTEuNDktMi4xNS01Ljc3LDAuNTktNi44NHogTTE3LjM2LDMxLjM4YzIuODEtMS43OCw2Ljc0LDEuNDUsNS42Niw0LjU2LTAuNjgsMi44My00LjY4LDMuOS02LjY1LDEuNzQtMS45My0xLjc3LTEuNC01LjIxLDAuOTktNi4zeiIgZmlsbC1ydWxlPSJldmVub2RkIiBmaWxsPSIjMmVhMmNjIi8+DQoNCjwvc3ZnPg0K') !important}
1
+ #toplevel_page_snippets div.wp-menu-image{background-image:url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+DQoNCjxzdmcgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNDRwdCIgd2lkdGg9IjQ4cHQiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDQ4IDQ0Ij4NCg0KCTxwYXRoIGNsYXNzPSJzbmlwcGV0cy1pY29uLXN2ZyIgZD0iTTMyLjcyLDEuODFjMy4xNy0yLjI3LDkuNzEtMS4xNiwxMC4zMiwzLjEzLTIuOCwzLjcyLTYuNDksNi42NS05LjY0LDEwLjA2LDQuODIsMC41MywxMC4xNi0xLjIyLDE0LjYsMS4xNnYxLjU1Yy0wLjM3LDMuMTEtMi4zNSw2LjE0LTUuNDksNi45Ny02Ljc5LDEuMjktMTQuMDQtMS4wMi0yMC42MiwxLjI1LDIuNjYsMS42Nyw1LjU2LDMuNzQsNi4wNyw3LjEsMS4yNCw1LjEyLTIuOTEsMTAuNDMtOC4wOCwxMC44LTUuMjcsMC41LTEwLjM3LTQuNDUtOS42Ni05Ljc5LDAuMzYtNC42Niw0LjczLTcuMjIsNy40Ni0xMC40OSwxLjE1LTAuOTgsMS4wMi0zLjE2LTAuNzMtMy4zNy0zLjc4LTAuNTctNy43NSwwLjQzLTExLjQyLTAuODktMy4wNi0xLjItNC45OS00LjE5LTUuNTMtNy4zNXYtMi4xNWMwLjgzLTUuODcsNy43OC05Ljc0LDEzLjA4LTYuNzksNC41OSwyLjE3LDUuNzcsNy44Myw0LjIxLDEyLjMyLDAuNTgtMC4yMSwxLjc1LTAuNjEsMi4zNC0wLjgyLDQuNTctNCw4LjM4LTguODQsMTMuMDktMTIuNjl6IE03LjMzLDcuNGMyLjQ4LTEuMjcsNS43OSwwLjgxLDUuNjksMy42MSwwLjEzLDMuMDYtMy44OCw1LjE3LTYuMjgsMy4yMy0yLjU4LTEuNDktMi4xNS01Ljc3LDAuNTktNi44NHogTTE3LjM2LDMxLjM4YzIuODEtMS43OCw2Ljc0LDEuNDUsNS42Niw0LjU2LTAuNjgsMi44My00LjY4LDMuOS02LjY1LDEuNzQtMS45My0xLjc3LTEuNC01LjIxLDAuOTktNi4zeiIgZmlsbC1ydWxlPSJldmVub2RkIiBmaWxsPSIjOTk5OTk5Ii8+DQoNCjwvc3ZnPg0K') !important;background-position:center center !important;background-size:20px 20px;background-repeat:no-repeat;margin-top:2px}#toplevel_page_snippets div.wp-menu-image:before{display:none}
assets/images/menu-icon-mp6.svg CHANGED
@@ -2,6 +2,6 @@
2
 
3
  <svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="44pt" width="48pt" version="1.1" viewBox="0 0 48 44">
4
 
5
- <path class="snippets-icon-svg" d="M32.72,1.81c3.17-2.27,9.71-1.16,10.32,3.13-2.8,3.72-6.49,6.65-9.64,10.06,4.82,0.53,10.16-1.22,14.6,1.16v1.55c-0.37,3.11-2.35,6.14-5.49,6.97-6.79,1.29-14.04-1.02-20.62,1.25,2.66,1.67,5.56,3.74,6.07,7.1,1.24,5.12-2.91,10.43-8.08,10.8-5.27,0.5-10.37-4.45-9.66-9.79,0.36-4.66,4.73-7.22,7.46-10.49,1.15-0.98,1.02-3.16-0.73-3.37-3.78-0.57-7.75,0.43-11.42-0.89-3.06-1.2-4.99-4.19-5.53-7.35v-2.15c0.83-5.87,7.78-9.74,13.08-6.79,4.59,2.17,5.77,7.83,4.21,12.32,0.58-0.21,1.75-0.61,2.34-0.82,4.57-4,8.38-8.84,13.09-12.69z M7.33,7.4c2.48-1.27,5.79,0.81,5.69,3.61,0.13,3.06-3.88,5.17-6.28,3.23-2.58-1.49-2.15-5.77,0.59-6.84z M17.36,31.38c2.81-1.78,6.74,1.45,5.66,4.56-0.68,2.83-4.68,3.9-6.65,1.74-1.93-1.77-1.4-5.21,0.99-6.3z" fill-rule="evenodd" fill="#888888"/>
6
 
7
  </svg>
2
 
3
  <svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="44pt" width="48pt" version="1.1" viewBox="0 0 48 44">
4
 
5
+ <path class="snippets-icon-svg" d="M32.72,1.81c3.17-2.27,9.71-1.16,10.32,3.13-2.8,3.72-6.49,6.65-9.64,10.06,4.82,0.53,10.16-1.22,14.6,1.16v1.55c-0.37,3.11-2.35,6.14-5.49,6.97-6.79,1.29-14.04-1.02-20.62,1.25,2.66,1.67,5.56,3.74,6.07,7.1,1.24,5.12-2.91,10.43-8.08,10.8-5.27,0.5-10.37-4.45-9.66-9.79,0.36-4.66,4.73-7.22,7.46-10.49,1.15-0.98,1.02-3.16-0.73-3.37-3.78-0.57-7.75,0.43-11.42-0.89-3.06-1.2-4.99-4.19-5.53-7.35v-2.15c0.83-5.87,7.78-9.74,13.08-6.79,4.59,2.17,5.77,7.83,4.21,12.32,0.58-0.21,1.75-0.61,2.34-0.82,4.57-4,8.38-8.84,13.09-12.69z M7.33,7.4c2.48-1.27,5.79,0.81,5.69,3.61,0.13,3.06-3.88,5.17-6.28,3.23-2.58-1.49-2.15-5.77,0.59-6.84z M17.36,31.38c2.81-1.78,6.74,1.45,5.66,4.56-0.68,2.83-4.68,3.9-6.65,1.74-1.93-1.77-1.4-5.21,0.99-6.3z" fill-rule="evenodd" fill="#999999"/>
6
 
7
  </svg>
assets/scss/menu-icon-mp6.scss CHANGED
@@ -2,25 +2,17 @@
2
  * Use our awesome SVG icon on MP6 admin pages
3
  */
4
 
5
- #toplevel_page_snippets {
6
 
7
- .wp-menu-image {
8
- background: {
9
- image: inline-image( 'menu-icon-mp6.svg' ) !important;
10
- position: center center !important;
11
- size: 20px 20px !important;
12
- repeat: no-repeat;
13
- }
14
  }
15
 
16
- &.wp-has-current-submenu .wp-menu-image,
17
- &.wp-has-current-submenu:hover .wp-menu-image {
18
- background-image: inline-image( 'menu-icon-mp6-active.svg' ) !important;
 
 
19
  }
20
-
21
- &:hover .wp-menu-image {
22
- background-image: inline-image( 'menu-icon-mp6-hover.svg' ) !important;
23
- }
24
-
25
  }
26
-
2
  * Use our awesome SVG icon on MP6 admin pages
3
  */
4
 
5
+ #toplevel_page_snippets div.wp-menu-image {
6
 
7
+ &:before {
8
+ display: none;
 
 
 
 
 
9
  }
10
 
11
+ background: {
12
+ image: inline-image( 'menu-icon-mp6.svg') !important;
13
+ position: center center !important;
14
+ size: 20px 20px;
15
+ repeat: no-repeat;
16
  }
17
+ margin-top: 2px;
 
 
 
 
18
  }
 
code-snippets.php CHANGED
@@ -7,7 +7,7 @@
7
  * contribute to the localization, please see http://code-snippets.bungeshea.com
8
  *
9
  * @package Code_Snippets
10
- * @version 1.8.1
11
  * @author Shea Bunge <http://bungeshea.com/>
12
  * @copyright Copyright (c) 2012-2013, Shea Bunge
13
  * @link http://code-snippets.bungeshea.com
@@ -20,7 +20,7 @@
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: http://bungeshea.com
23
- * Version: 1.8.1
24
  * License: MIT
25
  * License URI: license.txt
26
  * Text Domain: code-snippets
@@ -58,7 +58,7 @@ final class Code_Snippets {
58
  * @access public
59
  * @var string A PHP-standardized version number string
60
  */
61
- public $version = '1.8.1';
62
 
63
  /**
64
  * Variables to hold plugin paths
@@ -184,6 +184,10 @@ final class Code_Snippets {
184
  /* Load the global functions file */
185
  $this->get_include( 'functions' );
186
 
 
 
 
 
187
  /* Let extension plugins know that it's okay to load */
188
  do_action( 'code_snippets_init' );
189
  }
@@ -512,16 +516,18 @@ final class Code_Snippets {
512
  *
513
  * @since 1.5
514
  * @access private
515
- * @param boolean $install true to add the capabilities, false to remove
516
  * @return void
517
  */
518
  function setup_roles( $install = true ) {
519
 
520
- $this->caps = apply_filters( 'code_snippets_caps', array(
 
521
  'manage_snippets',
522
  'install_snippets',
523
  'edit_snippets'
524
- ) );
 
525
 
526
  $this->role = get_role( apply_filters( 'code_snippets_role', 'administrator' ) );
527
 
@@ -538,7 +544,7 @@ final class Code_Snippets {
538
  *
539
  * @since 1.5
540
  * @access private
541
- * @param boolean $install true to add the capabilities, false to remove
542
  * @return void
543
  */
544
  function setup_ms_roles( $install = true ) {
@@ -546,21 +552,62 @@ final class Code_Snippets {
546
  if ( ! is_multisite() )
547
  return;
548
 
549
- $this->network_caps = apply_filters( 'code_snippets_network_caps', array(
 
550
  'manage_network_snippets',
551
  'install_network_snippets',
552
  'edit_network_snippets'
553
- ) );
 
554
 
555
  $supers = get_super_admins();
 
556
  foreach ( $supers as $admin ) {
557
  $user = new WP_User( 0, $admin );
558
- foreach ( $this->network_caps as $cap ) {
559
- if ( $install )
560
- $user->add_cap( $cap );
561
- else
562
- $user->remove_cap( $cap );
563
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
564
  }
565
  }
566
 
7
  * contribute to the localization, please see http://code-snippets.bungeshea.com
8
  *
9
  * @package Code_Snippets
10
+ * @version 1.8.1.1
11
  * @author Shea Bunge <http://bungeshea.com/>
12
  * @copyright Copyright (c) 2012-2013, Shea Bunge
13
  * @link http://code-snippets.bungeshea.com
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: http://bungeshea.com
23
+ * Version: 1.8.1.1
24
  * License: MIT
25
  * License URI: license.txt
26
  * Text Domain: code-snippets
58
  * @access public
59
  * @var string A PHP-standardized version number string
60
  */
61
+ public $version = '1.8.1.1';
62
 
63
  /**
64
  * Variables to hold plugin paths
184
  /* Load the global functions file */
185
  $this->get_include( 'functions' );
186
 
187
+ /* Add and remove capabilities from Super Admins if their statuses change */
188
+ add_action( 'grant_super_admin', array( $this, 'add_ms_caps' ) );
189
+ add_action( 'remove_super_admin', array( $this, 'remove_ms_caps' ) );
190
+
191
  /* Let extension plugins know that it's okay to load */
192
  do_action( 'code_snippets_init' );
193
  }
516
  *
517
  * @since 1.5
518
  * @access private
519
+ * @param boolean $install true to add the capabilities, false to remove
520
  * @return void
521
  */
522
  function setup_roles( $install = true ) {
523
 
524
+ $this->caps = apply_filters( 'code_snippets_caps',
525
+ array(
526
  'manage_snippets',
527
  'install_snippets',
528
  'edit_snippets'
529
+ )
530
+ );
531
 
532
  $this->role = get_role( apply_filters( 'code_snippets_role', 'administrator' ) );
533
 
544
  *
545
  * @since 1.5
546
  * @access private
547
+ * @param boolean $install true to add the capabilities, false to remove
548
  * @return void
549
  */
550
  function setup_ms_roles( $install = true ) {
552
  if ( ! is_multisite() )
553
  return;
554
 
555
+ $this->network_caps = apply_filters( 'code_snippets_network_caps',
556
+ array(
557
  'manage_network_snippets',
558
  'install_network_snippets',
559
  'edit_network_snippets'
560
+ )
561
+ );
562
 
563
  $supers = get_super_admins();
564
+
565
  foreach ( $supers as $admin ) {
566
  $user = new WP_User( 0, $admin );
567
+
568
+ if ( $install )
569
+ $this->grant_ms_caps( $user );
570
+ else
571
+ $this->remove_ms_caps( $user );
572
+ }
573
+
574
+ }
575
+
576
+ /**
577
+ * Add the multisite capabilities to a user
578
+ *
579
+ * @since 1.8.2
580
+ * @param object|integer $user An instance of the WP_User class or a user ID
581
+ * @return void
582
+ */
583
+ function add_ms_caps( $user ) {
584
+
585
+ /* If a user ID is passed in, convert it to a WP_User */
586
+ if ( is_int( $user ) )
587
+ $user = new WP_User( $user );
588
+
589
+ /* Add the capabilities */
590
+ foreach ( $this->network_caps as $cap ) {
591
+ $user->add_cap( $cap );
592
+ }
593
+ }
594
+
595
+ /**
596
+ * Remove the multisite capabilities from a user
597
+ *
598
+ * @since 1.8.2
599
+ * @param object|integer $user An instance of the WP_User class or a user ID
600
+ * @return void
601
+ */
602
+ function remove_ms_caps( $user ) {
603
+
604
+ /* If a user ID is passed in, convert it to a WP_User */
605
+ if ( is_int( $user ) )
606
+ $user = new WP_User( $user );
607
+
608
+ /* Remove the capabilities */
609
+ foreach ( $this->network_caps as $cap ) {
610
+ $user->remove_cap( $cap );
611
  }
612
  }
613
 
includes/class-admin.php CHANGED
@@ -435,31 +435,28 @@ class Code_Snippets_Admin {
435
 
436
  /* CodeMirror modes */
437
 
438
- $modes = array( 'php', 'clike' );
439
-
440
- foreach ( $modes as $mode ) {
 
 
 
441
 
442
- wp_register_script(
443
- "codemirror-mode-$mode",
444
- plugins_url( "vendor/codemirror/mode/$mode.js", $code_snippets->file ),
445
- array( 'codemirror' ),
446
- $codemirror_version
447
- );
448
- }
449
 
450
  /* CodeMirror addons */
451
 
452
- $addons = array( 'dialog', 'searchcursor', 'search', 'matchbrackets' );
453
-
454
- foreach ( $addons as $addon ) {
455
-
456
- wp_register_script(
457
- "codemirror-addon-$addon",
458
- plugins_url( "vendor/codemirror/addon/$addon.js", $code_snippets->file ),
459
- array( 'codemirror' ),
460
- $codemirror_version
461
- );
462
- }
463
 
464
  wp_register_style(
465
  'codemirror-addon-dialog',
@@ -468,20 +465,39 @@ class Code_Snippets_Admin {
468
  $codemirror_version
469
  );
470
 
471
- if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
472
 
473
  /* Enqueue the registered scripts */
474
  wp_enqueue_script( array(
475
- 'codemirror-addon-matchbrackets',
476
- 'codemirror-mode-clike',
477
  'codemirror-mode-php',
 
478
  'codemirror-addon-search',
479
  ) );
480
 
481
  } else {
482
 
483
- /* Load the minified version if SCRIPT_DEBUG is turned off */
484
- wp_enqueue_script(
485
  'code-snippets-codemirror-min-js',
486
  plugins_url( 'vendor/codemirror.min.js', $code_snippets->file ),
487
  false,
@@ -490,27 +506,35 @@ class Code_Snippets_Admin {
490
 
491
  }
492
 
493
- /* Enqueue the registered stylesheets */
494
- wp_enqueue_style( array(
495
- 'codemirror',
496
- 'codemirror-addon-dialog',
497
- ) );
498
 
499
- /* Enqueue custom styling */
500
  wp_enqueue_style(
501
  'code-snippets-admin-single',
502
  plugins_url( 'assets/css/admin-single.css', $code_snippets->file ),
503
- false,
504
  $code_snippets->version
505
  );
506
 
507
- /* Enqueue custom scripts */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
508
  wp_enqueue_script(
509
  'code-snippets-admin-single',
510
  plugins_url( 'assets/js/admin-single.js', $code_snippets->file ),
511
- false,
512
- $code_snippets->version,
513
- true // Load in footer
514
  );
515
  }
516
 
435
 
436
  /* CodeMirror modes */
437
 
438
+ wp_register_script(
439
+ "codemirror-mode-clike",
440
+ plugins_url( "vendor/codemirror/mode/clike.js", $code_snippets->file ),
441
+ array( 'codemirror' ),
442
+ $codemirror_version
443
+ );
444
 
445
+ wp_register_script(
446
+ "codemirror-mode-php",
447
+ plugins_url( "vendor/codemirror/mode/php.js", $code_snippets->file ),
448
+ array( 'codemirror', 'codemirror-mode-clike' ),
449
+ $codemirror_version
450
+ );
 
451
 
452
  /* CodeMirror addons */
453
 
454
+ wp_register_script(
455
+ "codemirror-addon-dialog",
456
+ plugins_url( "vendor/codemirror/addon/dialog.js", $code_snippets->file ),
457
+ array( 'codemirror' ),
458
+ $codemirror_version
459
+ );
 
 
 
 
 
460
 
461
  wp_register_style(
462
  'codemirror-addon-dialog',
465
  $codemirror_version
466
  );
467
 
468
+ wp_register_script(
469
+ "codemirror-addon-searchcursor",
470
+ plugins_url( "vendor/codemirror/addon/searchcursor.js", $code_snippets->file ),
471
+ array( 'codemirror' ),
472
+ $codemirror_version
473
+ );
474
+
475
+ wp_register_script(
476
+ "codemirror-addon-search",
477
+ plugins_url( "vendor/codemirror/addon/search.js", $code_snippets->file ),
478
+ array( 'codemirror', 'codemirror-addon-dialog', 'codemirror-addon-searchcursor' ),
479
+ $codemirror_version
480
+ );
481
+
482
+ wp_register_script(
483
+ "codemirror-addon-matchbrackets",
484
+ plugins_url( "vendor/codemirror/addon/matchbrackets.js", $code_snippets->file ),
485
+ array( 'codemirror' ),
486
+ $codemirror_version
487
+ );
488
+
489
+ if ( $debug ) {
490
 
491
  /* Enqueue the registered scripts */
492
  wp_enqueue_script( array(
 
 
493
  'codemirror-mode-php',
494
+ 'codemirror-addon-matchbrackets',
495
  'codemirror-addon-search',
496
  ) );
497
 
498
  } else {
499
 
500
+ wp_register_script(
 
501
  'code-snippets-codemirror-min-js',
502
  plugins_url( 'vendor/codemirror.min.js', $code_snippets->file ),
503
  false,
506
 
507
  }
508
 
509
+ /* Enqueue stylesheets */
 
 
 
 
510
 
 
511
  wp_enqueue_style(
512
  'code-snippets-admin-single',
513
  plugins_url( 'assets/css/admin-single.css', $code_snippets->file ),
514
+ array( 'codemirror', 'codemirror-addon-dialog' ),
515
  $code_snippets->version
516
  );
517
 
518
+ /* Enqueue scripts */
519
+
520
+ /* Load the minified version of CodeMirror if SCRIPT_DEBUG is turned off */
521
+ if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG || defined( 'CODEMIRROR_SCRIPT_DEBUG' ) && CODEMIRROR_SCRIPT_DEBUG ) {
522
+
523
+ $deps = array(
524
+ 'codemirror-mode-php',
525
+ 'codemirror-addon-matchbrackets',
526
+ 'codemirror-addon-search'
527
+ );
528
+
529
+ } else {
530
+ $deps = array( 'code-snippets-codemirror-min-js' );
531
+ }
532
+
533
  wp_enqueue_script(
534
  'code-snippets-admin-single',
535
  plugins_url( 'assets/js/admin-single.js', $code_snippets->file ),
536
+ $deps,
537
+ $code_snippets->version
 
538
  );
539
  }
540
 
readme.txt CHANGED
@@ -111,6 +111,9 @@ That's fantastic! Join me on [GitHub](https://github.com/bungeshea/code-snippets
111
 
112
  == Changelog ==
113
 
 
 
 
114
  = 1.8.1 =
115
  * Compiled all CodeMirror scripts into a single file
116
  * Use Sass + Compass for CSS
@@ -228,6 +231,9 @@ Plugin updates will be posted on the [plugin's homepage](http://code-snippets.bu
228
 
229
  == Upgrade Notice ==
230
 
 
 
 
231
  = 1.8.1 =
232
  Minimize CSS and JS; updated CodeMirror; fixed export files
233
 
111
 
112
  == Changelog ==
113
 
114
+ = 1.8.1.1 =
115
+ * Updated MP6 icon implementation
116
+
117
  = 1.8.1 =
118
  * Compiled all CodeMirror scripts into a single file
119
  * Use Sass + Compass for CSS
231
 
232
  == Upgrade Notice ==
233
 
234
+ = 1.8.1.1 =
235
+ Updated MP6 icon implementation
236
+
237
  = 1.8.1 =
238
  Minimize CSS and JS; updated CodeMirror; fixed export files
239
 
vendor/codemirror.min.js CHANGED
@@ -1,5 +1,5 @@
1
- window.CodeMirror=function(){"use strict";function a(c,d){if(!(this instanceof a))return new a(c,d);this.options=d=d||{};for(var e in cf)!d.hasOwnProperty(e)&&cf.hasOwnProperty(e)&&(d[e]=cf[e]);m(d);var f="string"==typeof d.value?0:d.value.first,g=this.display=b(c,f);g.wrapper.CodeMirror=this,j(this),d.autofocus&&!Ke&&nb(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,draggingText:!1,highlight:new Sd},h(this),d.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");var i=d.value;"string"==typeof i&&(i=new rf(d.value,d.mode)),fb(this,jd)(this,i),xe&&setTimeout(_d(mb,this,!0),20),pb(this);var k;try{k=document.activeElement==g.input}catch(l){}k||d.autofocus&&!Ke?setTimeout(_d(Fb,this),20):Gb(this),fb(this,function(){for(var a in bf)bf.propertyIsEnumerable(a)&&bf[a](this,d[a],df);for(var b=0;b<hf.length;++b)hf[b](this)})()}function b(a,b){var c={},d=c.input=ce("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none; font-size: 4px;");return Ae?d.style.width="1000px":d.setAttribute("wrap","off"),Je&&(d.style.border="1px solid black"),d.setAttribute("autocorrect","off"),d.setAttribute("autocapitalize","off"),d.setAttribute("spellcheck","false"),c.inputDiv=ce("div",[d],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),c.scrollbarH=ce("div",[ce("div",null,null,"height: 1px")],"CodeMirror-hscrollbar"),c.scrollbarV=ce("div",[ce("div",null,null,"width: 1px")],"CodeMirror-vscrollbar"),c.scrollbarFiller=ce("div",null,"CodeMirror-scrollbar-filler"),c.gutterFiller=ce("div",null,"CodeMirror-gutter-filler"),c.lineDiv=ce("div",null,"CodeMirror-code"),c.selectionDiv=ce("div",null,null,"position: relative; z-index: 1"),c.cursor=ce("div"," ","CodeMirror-cursor"),c.otherCursor=ce("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"),c.measure=ce("div",null,"CodeMirror-measure"),c.lineSpace=ce("div",[c.measure,c.selectionDiv,c.lineDiv,c.cursor,c.otherCursor],null,"position: relative; outline: none"),c.mover=ce("div",[ce("div",[c.lineSpace],"CodeMirror-lines")],null,"position: relative"),c.sizer=ce("div",[c.mover],"CodeMirror-sizer"),c.heightForcer=ce("div",null,null,"position: absolute; height: "+wf+"px; width: 1px;"),c.gutters=ce("div",null,"CodeMirror-gutters"),c.lineGutter=null,c.scroller=ce("div",[c.sizer,c.heightForcer,c.gutters],"CodeMirror-scroll"),c.scroller.setAttribute("tabIndex","-1"),c.wrapper=ce("div",[c.inputDiv,c.scrollbarH,c.scrollbarV,c.scrollbarFiller,c.gutterFiller,c.scroller],"CodeMirror"),ye&&(c.gutters.style.zIndex=-1,c.scroller.style.paddingRight=0),a.appendChild?a.appendChild(c.wrapper):a(c.wrapper),Je&&(d.style.width="0px"),Ae||(c.scroller.draggable=!0),Fe?(c.inputDiv.style.height="1px",c.inputDiv.style.position="absolute"):ye&&(c.scrollbarH.style.minWidth=c.scrollbarV.style.minWidth="18px"),c.viewOffset=c.lastSizeC=0,c.showingFrom=c.showingTo=b,c.lineNumWidth=c.lineNumInnerWidth=c.lineNumChars=null,c.prevInput="",c.alignWidgets=!1,c.pollingFast=!1,c.poll=new Sd,c.cachedCharWidth=c.cachedTextHeight=null,c.measureLineCache=[],c.measureLineCachePos=0,c.inaccurateSelection=!1,c.maxLine=null,c.maxLineLength=0,c.maxLineChanged=!1,c.wheelDX=c.wheelDY=c.wheelStartX=c.wheelStartY=null,c}function c(b){b.doc.mode=a.getMode(b.options,b.doc.modeOption),b.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null)}),b.doc.frontier=b.doc.first,G(b,100),b.state.modeGen++,b.curOp&&ib(b)}function d(a){a.options.lineWrapping?(a.display.wrapper.className+=" CodeMirror-wrap",a.display.sizer.style.minWidth=""):(a.display.wrapper.className=a.display.wrapper.className.replace(" CodeMirror-wrap",""),l(a)),f(a),ib(a),T(a),setTimeout(function(){n(a)},100)}function e(a){var b=bb(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/cb(a.display)-3);return function(e){return Nc(a.doc,e)?0:c?(Math.ceil(e.text.length/d)||1)*b:b}}function f(a){var b=a.doc,c=e(a);b.iter(function(a){var b=c(a);b!=a.height&&nd(a,b)})}function g(a){var b=lf[a.options.keyMap],c=b.style;a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(c?" cm-keymap-"+c:""),a.state.disableInput=b.disableInput}function h(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-"),T(a)}function i(a){j(a),ib(a),setTimeout(function(){p(a)},20)}function j(a){var b=a.display.gutters,c=a.options.gutters;de(b);for(var d=0;d<c.length;++d){var e=c[d],f=b.appendChild(ce("div",null,"CodeMirror-gutter "+e));"CodeMirror-linenumbers"==e&&(a.display.lineGutter=f,f.style.width=(a.display.lineNumWidth||1)+"px")}b.style.display=d?"":"none"}function k(a,b){if(0==b.height)return 0;for(var c,d=b.text.length,e=b;c=Kc(e);){var f=c.find();e=kd(a,f.from.line),d+=f.from.ch-f.to.ch}for(e=b;c=Lc(e);){var f=c.find();d-=e.text.length-f.from.ch,e=kd(a,f.to.line),d+=e.text.length-f.to.ch}return d}function l(a){var b=a.display,c=a.doc;b.maxLine=kd(c,c.first),b.maxLineLength=k(c,b.maxLine),b.maxLineChanged=!0,c.iter(function(a){var d=k(c,a);d>b.maxLineLength&&(b.maxLineLength=d,b.maxLine=a)})}function m(a){for(var b=!1,c=0;c<a.gutters.length;++c)"CodeMirror-linenumbers"==a.gutters[c]&&(a.lineNumbers?b=!0:a.gutters.splice(c--,1));!b&&a.lineNumbers&&a.gutters.push("CodeMirror-linenumbers")}function n(a){var b=a.display,c=a.doc.height,d=c+L(b);b.sizer.style.minHeight=b.heightForcer.style.top=d+"px",b.gutters.style.height=Math.max(d,b.scroller.clientHeight-wf)+"px";var e=Math.max(d,b.scroller.scrollHeight),f=b.scroller.scrollWidth>b.scroller.clientWidth+1,g=e>b.scroller.clientHeight+1;g?(b.scrollbarV.style.display="block",b.scrollbarV.style.bottom=f?ie(b.measure)+"px":"0",b.scrollbarV.firstChild.style.height=e-b.scroller.clientHeight+b.scrollbarV.clientHeight+"px"):b.scrollbarV.style.display="",f?(b.scrollbarH.style.display="block",b.scrollbarH.style.right=g?ie(b.measure)+"px":"0",b.scrollbarH.firstChild.style.width=b.scroller.scrollWidth-b.scroller.clientWidth+b.scrollbarH.clientWidth+"px"):b.scrollbarH.style.display="",f&&g?(b.scrollbarFiller.style.display="block",b.scrollbarFiller.style.height=b.scrollbarFiller.style.width=ie(b.measure)+"px"):b.scrollbarFiller.style.display="",f&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(b.gutterFiller.style.display="block",b.gutterFiller.style.height=ie(b.measure)+"px",b.gutterFiller.style.width=b.gutters.offsetWidth+"px"):b.gutterFiller.style.display="",Ge&&0===ie(b.measure)&&(b.scrollbarV.style.minWidth=b.scrollbarH.style.minHeight=He?"18px":"12px")}function o(a,b,c){var d=a.scroller.scrollTop,e=a.wrapper.clientHeight;"number"==typeof c?d=c:c&&(d=c.top,e=c.bottom-c.top),d=Math.floor(d-K(a));var f=Math.ceil(d+e);return{from:pd(b,d),to:pd(b,f)}}function p(a){var b=a.display;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var c=s(b)-b.scroller.scrollLeft+a.doc.scrollLeft,d=b.gutters.offsetWidth,e=c+"px",f=b.lineDiv.firstChild;f;f=f.nextSibling)if(f.alignable)for(var g=0,h=f.alignable;g<h.length;++g)h[g].style.left=e;a.options.fixedGutter&&(b.gutters.style.left=c+d+"px")}}function q(a){if(!a.options.lineNumbers)return!1;var b=a.doc,c=r(a.options,b.first+b.size-1),d=a.display;if(c.length!=d.lineNumChars){var e=d.measure.appendChild(ce("div",[ce("div",c)],"CodeMirror-linenumber CodeMirror-gutter-elt")),f=e.firstChild.offsetWidth,g=e.offsetWidth-f;return d.lineGutter.style.width="",d.lineNumInnerWidth=Math.max(f,d.lineGutter.offsetWidth-g),d.lineNumWidth=d.lineNumInnerWidth+g,d.lineNumChars=d.lineNumInnerWidth?c.length:-1,d.lineGutter.style.width=d.lineNumWidth+"px",!0}return!1}function r(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function s(a){return ge(a.scroller).left-ge(a.sizer).left}function t(a,b,c,d){for(var e,f=a.display.showingFrom,g=a.display.showingTo,h=o(a.display,a.doc,c);u(a,b,h,d)&&(d=!1,e=!0,C(a),n(a),c&&(c=Math.min(a.display.scroller.scrollHeight-a.display.scroller.clientHeight,"number"==typeof c?c:c.top)),h=o(a.display,a.doc,c),!(h.from>=a.display.showingFrom&&h.to<=a.display.showingTo));)b=[];return e&&(Nd(a,"update",a),(a.display.showingFrom!=f||a.display.showingTo!=g)&&Nd(a,"viewportChange",a,a.display.showingFrom,a.display.showingTo)),e}function u(a,b,c,d){var e=a.display,f=a.doc;if(!e.wrapper.clientWidth)return e.showingFrom=e.showingTo=f.first,e.viewOffset=0,void 0;if(!(!d&&0==b.length&&c.from>e.showingFrom&&c.to<e.showingTo)){q(a)&&(b=[{from:f.first,to:f.first+f.size}]);var g=e.sizer.style.marginLeft=e.gutters.offsetWidth+"px";e.scrollbarH.style.left=a.options.fixedGutter?g:"0";var h=1/0;if(a.options.lineNumbers)for(var i=0;i<b.length;++i)if(b[i].diff){h=b[i].from;break}var j=f.first+f.size,k=Math.max(c.from-a.options.viewportMargin,f.first),l=Math.min(j,c.to+a.options.viewportMargin);if(e.showingFrom<k&&k-e.showingFrom<20&&(k=Math.max(f.first,e.showingFrom)),e.showingTo>l&&e.showingTo-l<20&&(l=Math.min(j,e.showingTo)),Ue)for(k=od(Mc(f,kd(f,k)));j>l&&Nc(f,kd(f,l));)++l;var m=[{from:Math.max(e.showingFrom,f.first),to:Math.min(e.showingTo,j)}];if(m=m[0].from>=m[0].to?[]:x(m,b),Ue)for(var i=0;i<m.length;++i)for(var n,o=m[i];n=Lc(kd(f,o.to-1));){var p=n.find().from.line;if(!(p>o.from)){m.splice(i--,1);break}o.to=p}for(var r=0,i=0;i<m.length;++i){var o=m[i];o.from<k&&(o.from=k),o.to>l&&(o.to=l),o.from>=o.to?m.splice(i--,1):r+=o.to-o.from}if(!d&&r==l-k&&k==e.showingFrom&&l==e.showingTo)return w(a),void 0;m.sort(function(a,b){return a.from-b.from});try{var s=document.activeElement}catch(t){}.7*(l-k)>r&&(e.lineDiv.style.display="none"),z(a,k,l,m,h),e.lineDiv.style.display="",s&&document.activeElement!=s&&s.offsetHeight&&s.focus();var u=k!=e.showingFrom||l!=e.showingTo||e.lastSizeC!=e.wrapper.clientHeight;return u&&(e.lastSizeC=e.wrapper.clientHeight,G(a,400)),e.showingFrom=k,e.showingTo=l,v(a),w(a),!0}}function v(a){for(var b,c=a.display,d=c.lineDiv.offsetTop,e=c.lineDiv.firstChild;e;e=e.nextSibling)if(e.lineObj){if(ye){var f=e.offsetTop+e.offsetHeight;b=f-d,d=f}else{var g=ge(e);b=g.bottom-g.top}var h=e.lineObj.height-b;if(2>b&&(b=bb(c)),h>.001||-.001>h){nd(e.lineObj,b);var i=e.lineObj.widgets;if(i)for(var j=0;j<i.length;++j)i[j].height=i[j].node.offsetHeight}}}function w(a){var b=a.display.viewOffset=qd(a,kd(a.doc,a.display.showingFrom));a.display.mover.style.top=b+"px"}function x(a,b){for(var c=0,d=b.length||0;d>c;++c){for(var e=b[c],f=[],g=e.diff||0,h=0,i=a.length;i>h;++h){var j=a[h];e.to<=j.from&&e.diff?f.push({from:j.from+g,to:j.to+g}):e.to<=j.from||e.from>=j.to?f.push(j):(e.from>j.from&&f.push({from:j.from,to:e.from}),e.to<j.to&&f.push({from:e.to+g,to:j.to+g}))}a=f}return a}function y(a){for(var b=a.display,c={},d={},e=b.gutters.firstChild,f=0;e;e=e.nextSibling,++f)c[a.options.gutters[f]]=e.offsetLeft,d[a.options.gutters[f]]=e.offsetWidth;return{fixedPos:s(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function z(a,b,c,d,e){function f(b){var c=b.nextSibling;return Ae&&Le&&a.display.currentWheelTarget==b?(b.style.display="none",b.lineObj=null):b.parentNode.removeChild(b),c}var g=y(a),h=a.display,i=a.options.lineNumbers;d.length||Ae&&a.display.currentWheelTarget||de(h.lineDiv);var j=h.lineDiv,k=j.firstChild,l=d.shift(),m=b;for(a.doc.iter(b,c,function(b){if(l&&l.to==m&&(l=d.shift()),Nc(a.doc,b)){if(0!=b.height&&nd(b,0),b.widgets&&k.previousSibling)for(var c=0;c<b.widgets.length;++c){var h=b.widgets[c];if(h.showIfHidden){var n=k.previousSibling;if(/pre/i.test(n.nodeName)){var o=ce("div",null,null,"position: relative");n.parentNode.replaceChild(o,n),o.appendChild(n),n=o}var p=n.appendChild(ce("div",[h.node],"CodeMirror-linewidget"));h.handleMouseEvents||(p.ignoreEvents=!0),B(h,p,n,g)}}}else if(l&&l.from<=m&&l.to>m){for(;k.lineObj!=b;)k=f(k);i&&m>=e&&k.lineNumber&&fe(k.lineNumber,r(a.options,m)),k=k.nextSibling}else{if(b.widgets)for(var q,s=0,t=k;t&&20>s;++s,t=t.nextSibling)if(t.lineObj==b&&/div/i.test(t.nodeName)){q=t;break}var u=A(a,b,m,g,q);if(u!=q)j.insertBefore(u,k);else{for(;k!=q;)k=f(k);k=k.nextSibling}u.lineObj=b}++m});k;)k=f(k)}function A(a,b,c,d,e){var f,g=_c(a,b),h=b.gutterMarkers,i=a.display;if(!(a.options.lineNumbers||h||b.bgClass||b.wrapClass||b.widgets))return g;if(e){e.alignable=null;for(var j,k=!0,l=0,m=null,n=e.firstChild;n;n=j)if(j=n.nextSibling,/\bCodeMirror-linewidget\b/.test(n.className)){for(var o=0;o<b.widgets.length;++o){var p=b.widgets[o];if(p.node==n.firstChild){p.above||m||(m=n),B(p,n,e,d),++l;break}}if(o==b.widgets.length){k=!1;break}}else e.removeChild(n);e.insertBefore(g,m),k&&l==b.widgets.length&&(f=e,e.className=b.wrapClass||"")}if(f||(f=ce("div",null,b.wrapClass,"position: relative"),f.appendChild(g)),b.bgClass&&f.insertBefore(ce("div",null,b.bgClass+" CodeMirror-linebackground"),f.firstChild),a.options.lineNumbers||h){var q=f.insertBefore(ce("div",null,null,"position: absolute; left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px"),f.firstChild);if(a.options.fixedGutter&&(f.alignable||(f.alignable=[])).push(q),!a.options.lineNumbers||h&&h["CodeMirror-linenumbers"]||(f.lineNumber=q.appendChild(ce("div",r(a.options,c),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+d.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+i.lineNumInnerWidth+"px"))),h)for(var s=0;s<a.options.gutters.length;++s){var t=a.options.gutters[s],u=h.hasOwnProperty(t)&&h[t];u&&q.appendChild(ce("div",[u],"CodeMirror-gutter-elt","left: "+d.gutterLeft[t]+"px; width: "+d.gutterWidth[t]+"px"))}}if(ye&&(f.style.zIndex=2),b.widgets&&f!=e)for(var o=0,v=b.widgets;o<v.length;++o){var p=v[o],w=ce("div",[p.node],"CodeMirror-linewidget");p.handleMouseEvents||(w.ignoreEvents=!0),B(p,w,f,d),p.above?f.insertBefore(w,a.options.lineNumbers&&0!=b.height?q:g):f.appendChild(w),Nd(p,"redraw")}return f}function B(a,b,c,d){if(a.noHScroll){(c.alignable||(c.alignable=[])).push(b);var e=d.wrapperWidth;b.style.left=d.fixedPos+"px",a.coverGutter||(e-=d.gutterTotalWidth,b.style.paddingLeft=d.gutterTotalWidth+"px"),b.style.width=e+"px"}a.coverGutter&&(b.style.zIndex=5,b.style.position="relative",a.noHScroll||(b.style.marginLeft=-d.gutterTotalWidth+"px"))}function C(a){var b=a.display,c=Tb(a.doc.sel.from,a.doc.sel.to);if(c||a.options.showCursorWhenSelecting?D(a):b.cursor.style.display=b.otherCursor.style.display="none",c?b.selectionDiv.style.display="none":E(a),a.options.moveInputWithCursor){var d=Z(a,a.doc.sel.head,"div"),e=ge(b.wrapper),f=ge(b.lineDiv);b.inputDiv.style.top=Math.max(0,Math.min(b.wrapper.clientHeight-10,d.top+f.top-e.top))+"px",b.inputDiv.style.left=Math.max(0,Math.min(b.wrapper.clientWidth-10,d.left+f.left-e.left))+"px"}}function D(a){var b=a.display,c=Z(a,a.doc.sel.head,"div");b.cursor.style.left=c.left+"px",b.cursor.style.top=c.top+"px",b.cursor.style.height=Math.max(0,c.bottom-c.top)*a.options.cursorHeight+"px",b.cursor.style.display="",c.other?(b.otherCursor.style.display="",b.otherCursor.style.left=c.other.left+"px",b.otherCursor.style.top=c.other.top+"px",b.otherCursor.style.height=.85*(c.other.bottom-c.other.top)+"px"):b.otherCursor.style.display="none"}function E(a){function b(a,b,c,d){0>b&&(b=0),g.appendChild(ce("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px; top: "+b+"px; width: "+(null==c?h-a:c)+"px; height: "+(d-b)+"px"))}function c(c,d,f){function g(b,d){return Y(a,Sb(c,b),"div",l,d)}var j,k,l=kd(e,c),m=l.text.length;return ke(rd(l),d||0,null==f?m:f,function(a,c,e){var l,n,o,p=g(a,"left");if(a==c)l=p,n=o=p.left;else{if(l=g(c-1,"right"),"rtl"==e){var q=p;p=l,l=q}n=p.left,o=l.right}null==d&&0==a&&(n=i),l.top-p.top>3&&(b(n,p.top,null,p.bottom),n=i,p.bottom<l.top&&b(n,p.bottom,null,l.top)),null==f&&c==m&&(o=h),(!j||p.top<j.top||p.top==j.top&&p.left<j.left)&&(j=p),(!k||l.bottom>k.bottom||l.bottom==k.bottom&&l.right>k.right)&&(k=l),i+1>n&&(n=i),b(n,l.top,o-n,l.bottom)}),{start:j,end:k}}var d=a.display,e=a.doc,f=a.doc.sel,g=document.createDocumentFragment(),h=d.lineSpace.offsetWidth,i=M(a.display);if(f.from.line==f.to.line)c(f.from.line,f.from.ch,f.to.ch);else{var j=kd(e,f.from.line),k=kd(e,f.to.line),l=Mc(e,j)==Mc(e,k),m=c(f.from.line,f.from.ch,l?j.text.length:null).end,n=c(f.to.line,l?0:null,f.to.ch).start;l&&(m.top<n.top-2?(b(m.right,m.top,null,m.bottom),b(i,n.top,n.left,n.bottom)):b(m.right,m.top,n.left-m.right,m.bottom)),m.bottom<n.top&&b(i,m.bottom,null,n.top)}ee(d.selectionDiv,g),d.selectionDiv.style.display=""}function F(a){if(a.state.focused){var b=a.display;clearInterval(b.blinker);var c=!0;b.cursor.style.visibility=b.otherCursor.style.visibility="",b.blinker=setInterval(function(){b.cursor.style.visibility=b.otherCursor.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate)}}function G(a,b){a.doc.mode.startState&&a.doc.frontier<a.display.showingTo&&a.state.highlight.set(b,_d(H,a))}function H(a){var b=a.doc;if(b.frontier<b.first&&(b.frontier=b.first),!(b.frontier>=a.display.showingTo)){var c,d=+new Date+a.options.workTime,e=qc(b.mode,J(a,b.frontier)),f=[];b.iter(b.frontier,Math.min(b.first+b.size,a.display.showingTo+500),function(g){if(b.frontier>=a.display.showingFrom){var h=g.styles;g.styles=Xc(a,g,e);for(var i=!h||h.length!=g.styles.length,j=0;!i&&j<h.length;++j)i=h[j]!=g.styles[j];i&&(c&&c.end==b.frontier?c.end++:f.push(c={start:b.frontier,end:b.frontier+1})),g.stateAfter=qc(b.mode,e)}else Zc(a,g,e),g.stateAfter=0==b.frontier%5?qc(b.mode,e):null;return++b.frontier,+new Date>d?(G(a,a.options.workDelay),!0):void 0}),f.length&&fb(a,function(){for(var a=0;a<f.length;++a)ib(this,f[a].start,f[a].end)})()}}function I(a,b,c){for(var d,e,f=a.doc,g=b,h=b-100;g>h;--g){if(g<=f.first)return f.first;var i=kd(f,g-1);if(i.stateAfter&&(!c||g<=f.frontier))return g;var j=Td(i.text,null,a.options.tabSize);(null==e||d>j)&&(e=g-1,d=j)}return e}function J(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return!0;var f=I(a,b,c),g=f>d.first&&kd(d,f-1).stateAfter;return g=g?qc(d.mode,g):rc(d.mode),d.iter(f,b,function(c){Zc(a,c,g);var h=f==b-1||0==f%5||f>=e.showingFrom&&f<e.showingTo;c.stateAfter=h?qc(d.mode,g):null,++f}),g}function K(a){return a.lineSpace.offsetTop}function L(a){return a.mover.offsetHeight-a.lineSpace.offsetHeight}function M(a){var b=ee(a.measure,ce("pre",null,null,"text-align: left")).appendChild(ce("span","x"));return b.offsetLeft}function N(a,b,c,d,e){var f=-1;d=d||Q(a,b);for(var g=c;;g+=f){var h=d[g];if(h)break;0>f&&0==g&&(f=1)}return e=g>c?"left":c>g?"right":e,"left"==e&&h.leftSide?h=h.leftSide:"right"==e&&h.rightSide&&(h=h.rightSide),{left:c>g?h.right:h.left,right:g>c?h.left:h.right,top:h.top,bottom:h.bottom}}function O(a,b){for(var c=a.display.measureLineCache,d=0;d<c.length;++d){var e=c[d];if(e.text==b.text&&e.markedSpans==b.markedSpans&&a.display.scroller.clientWidth==e.width&&e.classes==b.textClass+"|"+b.bgClass+"|"+b.wrapClass)return e}}function P(a,b){var c=O(a,b);c&&(c.text=c.measure=c.markedSpans=null)}function Q(a,b){var c=O(a,b);if(c)return c.measure;var d=R(a,b),e=a.display.measureLineCache,f={text:b.text,width:a.display.scroller.clientWidth,markedSpans:b.markedSpans,measure:d,classes:b.textClass+"|"+b.bgClass+"|"+b.wrapClass};return 16==e.length?e[++a.display.measureLineCachePos%16]=f:e.push(f),d}function R(a,b){function c(a){var b=a.top-o.top,c=a.bottom-o.top;c>r&&(c=r),0>b&&(b=0);for(var d=p.length-2;d>=0;d-=2){var e=p[d],f=p[d+1];if(!(e>c||b>f)&&(b>=e&&f>=c||e>=b&&c>=f||Math.min(c,f)-Math.max(b,e)>=c-b>>1)){p[d]=Math.min(b,e),p[d+1]=Math.max(c,f);break}}return 0>d&&(d=p.length,p.push(b,c)),{left:a.left-o.left,right:a.right-o.left,top:d,bottom:null}}function d(a){a.bottom=p[a.top+1],a.top=p[a.top]}var e=a.display,f=$d(b.text.length),g=_c(a,b,f,!0);if(xe&&!ye&&!a.options.lineWrapping&&g.childNodes.length>100){for(var h=document.createDocumentFragment(),i=10,j=g.childNodes.length,k=0,l=Math.ceil(j/i);l>k;++k){for(var m=ce("div",null,null,"display: inline-block"),n=0;i>n&&j;++n)m.appendChild(g.firstChild),--j;h.appendChild(m)}g.appendChild(h)}ee(e.measure,g);var o=ge(e.lineDiv),p=[],q=$d(b.text.length),r=g.offsetHeight;ze&&e.measure.first!=g&&ee(e.measure,g);for(var s,k=0;k<f.length;++k)if(s=f[k]){var t=s,u=null;if(/\bCodeMirror-widget\b/.test(s.className)&&s.getClientRects){1==s.firstChild.nodeType&&(t=s.firstChild);var v=t.getClientRects();v.length>1&&(u=q[k]=c(v[0]),u.rightSide=c(v[v.length-1]))}u||(u=q[k]=c(ge(t))),s.measureRight&&(u.right=ge(s.measureRight).left),s.leftSide&&(u.leftSide=c(ge(s.leftSide)))}for(var s,k=0;k<q.length;++k)(s=q[k])&&(d(s),s.leftSide&&d(s.leftSide),s.rightSide&&d(s.rightSide));return q}function S(a,b){var c=!1;if(b.markedSpans)for(var d=0;d<b.markedSpans;++d){var e=b.markedSpans[d];!e.collapsed||null!=e.to&&e.to!=b.text.length||(c=!0)}var f=!c&&O(a,b);if(f)return N(a,b,b.text.length,f.measure,"right").right;var g=_c(a,b,null,!0),h=g.appendChild(je(a.display.measure));return ee(a.display.measure,g),ge(h).right-ge(a.display.lineDiv).left}function T(a){a.display.measureLineCache.length=a.display.measureLineCachePos=0,a.display.cachedCharWidth=a.display.cachedTextHeight=null,a.options.lineWrapping||(a.display.maxLineChanged=!0),a.display.lineNumChars=null}function U(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function V(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function W(a,b,c,d){if(b.widgets)for(var e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f=Sc(b.widgets[e]);c.top+=f,c.bottom+=f}if("line"==d)return c;d||(d="local");var g=qd(a,b);if("local"==d?g+=K(a.display):g-=a.display.viewOffset,"page"==d||"window"==d){var h=ge(a.display.lineSpace);g+=h.top+("window"==d?0:V());var i=h.left+("window"==d?0:U());c.left+=i,c.right+=i}return c.top+=g,c.bottom+=g,c}function X(a,b,c){if("div"==c)return b;var d=b.left,e=b.top;if("page"==c)d-=U(),e-=V();else if("local"==c||!c){var f=ge(a.display.sizer);d+=f.left,e+=f.top}var g=ge(a.display.lineSpace);return{left:d-g.left,top:e-g.top}}function Y(a,b,c,d,e){return d||(d=kd(a.doc,b.line)),W(a,d,N(a,d,b.ch,null,e),c)}function Z(a,b,c,d,e){function f(b,f){var g=N(a,d,b,e,f?"right":"left");return f?g.left=g.right:g.right=g.left,W(a,d,g,c)}function g(a,b){var c=h[b],d=c.level%2;return a==le(c)&&b&&c.level<h[b-1].level?(c=h[--b],a=me(c)-(c.level%2?0:1),d=!0):a==me(c)&&b<h.length-1&&c.level<h[b+1].level&&(c=h[++b],a=le(c)-c.level%2,d=!1),d&&a==c.to&&a>c.from?f(a-1):f(a,d)}d=d||kd(a.doc,b.line),e||(e=Q(a,d));var h=rd(d),i=b.ch;if(!h)return f(i);var j=se(h,i),k=g(i,j);return null!=If&&(k.other=g(i,If)),k}function $(a,b,c,d){var e=new Sb(a,b);return e.xRel=d,c&&(e.outside=!0),e}function _(a,b,c){var d=a.doc;if(c+=a.display.viewOffset,0>c)return $(d.first,0,!0,-1);var e=pd(d,c),f=d.first+d.size-1;if(e>f)return $(d.first+d.size-1,kd(d,f).text.length,!0,1);for(0>b&&(b=0);;){var g=kd(d,e),h=ab(a,g,e,b,c),i=Lc(g),j=i&&i.find();if(!i||!(h.ch>j.from.ch||h.ch==j.from.ch&&h.xRel>0))return h;e=j.to.line}}function ab(a,b,c,d,e){function f(d){var e=Z(a,Sb(c,d),"line",b,j);return h=!0,g>e.bottom?e.left-i:g<e.top?e.left+i:(h=!1,e.left)}var g=e-qd(a,b),h=!1,i=2*a.display.wrapper.clientWidth,j=Q(a,b),k=rd(b),l=b.text.length,m=ne(b),n=oe(b),o=f(m),p=h,q=f(n),r=h;if(d>q)return $(c,n,r,1);for(;;){if(k?n==m||n==ue(b,m,1):1>=n-m){for(var s=o>d||q-d>=d-o?m:n,t=d-(s==m?o:q);Af.test(b.text.charAt(s));)++s;var u=$(c,s,s==m?p:r,0>t?-1:t?1:0);return u}var v=Math.ceil(l/2),w=m+v;if(k){w=m;for(var x=0;v>x;++x)w=ue(b,w,1)}var y=f(w);y>d?(n=w,q=y,(r=h)&&(q+=1e3),l=v):(m=w,o=y,p=h,l-=v)}}function bb(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==Oe){Oe=ce("pre");for(var b=0;49>b;++b)Oe.appendChild(document.createTextNode("x")),Oe.appendChild(ce("br"));Oe.appendChild(document.createTextNode("x"))}ee(a.measure,Oe);var c=Oe.offsetHeight/50;return c>3&&(a.cachedTextHeight=c),de(a.measure),c||1}function cb(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=ce("span","x"),c=ce("pre",[b]);ee(a.measure,c);var d=b.offsetWidth;return d>2&&(a.cachedCharWidth=d),d||10}function db(a){a.curOp={changes:[],forceUpdate:!1,updateInput:null,userSelChange:null,textChanged:null,selectionChanged:!1,cursorActivity:!1,updateMaxLine:!1,updateScrollPos:!1,id:++Ve},vf++||(uf=[])}function eb(a){var b=a.curOp,c=a.doc,d=a.display;if(a.curOp=null,b.updateMaxLine&&l(a),d.maxLineChanged&&!a.options.lineWrapping&&d.maxLine){var e=S(a,d.maxLine);d.sizer.style.minWidth=Math.max(0,e+3+wf)+"px",d.maxLineChanged=!1;var f=Math.max(0,d.sizer.offsetLeft+d.sizer.offsetWidth-d.scroller.clientWidth);f<c.scrollLeft&&!b.updateScrollPos&&xb(a,Math.min(d.scroller.scrollLeft,f),!0)}var g,h;if(b.updateScrollPos)g=b.updateScrollPos;else if(b.selectionChanged&&d.scroller.clientHeight){var i=Z(a,c.sel.head);g=gc(a,i.left,i.top,i.left,i.bottom)}(b.changes.length||b.forceUpdate||g&&null!=g.scrollTop)&&(h=t(a,b.changes,g&&g.scrollTop,b.forceUpdate),a.display.scroller.offsetHeight&&(a.doc.scrollTop=a.display.scroller.scrollTop)),!h&&b.selectionChanged&&C(a),b.updateScrollPos?(d.scroller.scrollTop=d.scrollbarV.scrollTop=c.scrollTop=g.scrollTop,d.scroller.scrollLeft=d.scrollbarH.scrollLeft=c.scrollLeft=g.scrollLeft,p(a),b.scrollToPos&&ec(a,Xb(a.doc,b.scrollToPos),b.scrollToPosMargin)):g&&dc(a),b.selectionChanged&&F(a),a.state.focused&&b.updateInput&&mb(a,b.userSelChange);var j=b.maybeHiddenMarkers,k=b.maybeUnhiddenMarkers;if(j)for(var m=0;m<j.length;++m)j[m].lines.length||Md(j[m],"hide");if(k)for(var m=0;m<k.length;++m)k[m].lines.length&&Md(k[m],"unhide");var n;if(--vf||(n=uf,uf=null),b.textChanged&&Md(a,"change",a,b.textChanged),b.cursorActivity&&Md(a,"cursorActivity",a),n)for(var m=0;m<n.length;++m)n[m]()}function fb(a,b){return function(){var c=a||this,d=!c.curOp;d&&db(c);try{var e=b.apply(c,arguments)}finally{d&&eb(c)}return e}}function gb(a){return function(){var b,c=this.cm&&!this.cm.curOp;c&&db(this.cm);try{b=a.apply(this,arguments)}finally{c&&eb(this.cm)}return b}}function hb(a,b){var c,d=!a.curOp;d&&db(a);try{c=b()}finally{d&&eb(a)}return c}function ib(a,b,c,d){null==b&&(b=a.doc.first),null==c&&(c=a.doc.first+a.doc.size),a.curOp.changes.push({from:b,to:c,diff:d})}function jb(a){a.display.pollingFast||a.display.poll.set(a.options.pollInterval,function(){lb(a),a.state.focused&&jb(a)})}function kb(a){function b(){var d=lb(a);d||c?(a.display.pollingFast=!1,jb(a)):(c=!0,a.display.poll.set(60,b))}var c=!1;a.display.pollingFast=!0,a.display.poll.set(20,b)}function lb(a){var b=a.display.input,c=a.display.prevInput,d=a.doc,e=d.sel;if(!a.state.focused||Ff(b)||ob(a)||a.state.disableInput)return!1;var f=b.value;if(f==c&&Tb(e.from,e.to))return!1;if(xe&&!ze&&a.display.inputHasSelection===f)return mb(a,!0),!1;var g=!a.curOp;g&&db(a),e.shift=!1;for(var h=0,i=Math.min(c.length,f.length);i>h&&c.charCodeAt(h)==f.charCodeAt(h);)++h;var j=e.from,k=e.to;h<c.length?j=Sb(j.line,j.ch-(c.length-h)):a.state.overwrite&&Tb(j,k)&&!a.state.pasteIncoming&&(k=Sb(k.line,Math.min(kd(d,k.line).text.length,k.ch+(f.length-h))));var l=a.curOp.updateInput,m={from:j,to:k,text:Ef(f.slice(h)),origin:a.state.pasteIncoming?"paste":"+input"};return Lb(a.doc,m,"end"),a.curOp.updateInput=l,Nd(a,"inputRead",a,m),f.length>1e3||f.indexOf("\n")>-1?b.value=a.display.prevInput="":a.display.prevInput=f,g&&eb(a),a.state.pasteIncoming=!1,!0}function mb(a,b){var c,d,e=a.doc;if(Tb(e.sel.from,e.sel.to))b&&(a.display.prevInput=a.display.input.value="",xe&&!ze&&(a.display.inputHasSelection=null));else{a.display.prevInput="",c=Gf&&(e.sel.to.line-e.sel.from.line>100||(d=a.getSelection()).length>1e3);var f=c?"-":d||a.getSelection();a.display.input.value=f,a.state.focused&&Wd(a.display.input),xe&&!ze&&(a.display.inputHasSelection=f)}a.display.inaccurateSelection=c}function nb(a){"nocursor"==a.options.readOnly||Ke&&document.activeElement==a.display.input||a.display.input.focus()}function ob(a){return a.options.readOnly||a.doc.cantEdit}function pb(a){function b(){a.state.focused&&setTimeout(_d(nb,a),0)}function c(){null==h&&(h=setTimeout(function(){h=null,g.cachedCharWidth=g.cachedTextHeight=Cf=null,T(a),hb(a,_d(ib,a))},100))}function d(){for(var a=g.wrapper.parentNode;a&&a!=document.body;a=a.parentNode);a?setTimeout(d,5e3):Ld(window,"resize",c)}function e(b){Od(a,b)||a.options.onDragEvent&&a.options.onDragEvent(a,Dd(b))||Hd(b)}function f(){g.inaccurateSelection&&(g.prevInput="",g.inaccurateSelection=!1,g.input.value=a.getSelection(),Wd(g.input))}var g=a.display;Kd(g.scroller,"mousedown",fb(a,sb)),xe?Kd(g.scroller,"dblclick",fb(a,function(b){if(!Od(a,b)){var c=rb(a,b);if(c&&!tb(a,b)&&!qb(a.display,b)){Ed(b);var d=nc(kd(a.doc,c.line).text,c);$b(a.doc,d.from,d.to)}}})):Kd(g.scroller,"dblclick",function(b){Od(a,b)||Ed(b)}),Kd(g.lineSpace,"selectstart",function(a){qb(g,a)||Ed(a)}),Se||Kd(g.scroller,"contextmenu",function(b){Hb(a,b)}),Kd(g.scroller,"scroll",function(){g.scroller.clientHeight&&(wb(a,g.scroller.scrollTop),xb(a,g.scroller.scrollLeft,!0),Md(a,"scroll",a))}),Kd(g.scrollbarV,"scroll",function(){g.scroller.clientHeight&&wb(a,g.scrollbarV.scrollTop)}),Kd(g.scrollbarH,"scroll",function(){g.scroller.clientHeight&&xb(a,g.scrollbarH.scrollLeft)}),Kd(g.scroller,"mousewheel",function(b){yb(a,b)}),Kd(g.scroller,"DOMMouseScroll",function(b){yb(a,b)}),Kd(g.scrollbarH,"mousedown",b),Kd(g.scrollbarV,"mousedown",b),Kd(g.wrapper,"scroll",function(){g.wrapper.scrollTop=g.wrapper.scrollLeft=0});var h;Kd(window,"resize",c),setTimeout(d,5e3),Kd(g.input,"keyup",fb(a,function(b){Od(a,b)||a.options.onKeyEvent&&a.options.onKeyEvent(a,Dd(b))||16==b.keyCode&&(a.doc.sel.shift=!1)})),Kd(g.input,"input",_d(kb,a)),Kd(g.input,"keydown",fb(a,Db)),Kd(g.input,"keypress",fb(a,Eb)),Kd(g.input,"focus",_d(Fb,a)),Kd(g.input,"blur",_d(Gb,a)),a.options.dragDrop&&(Kd(g.scroller,"dragstart",function(b){vb(a,b)}),Kd(g.scroller,"dragenter",e),Kd(g.scroller,"dragover",e),Kd(g.scroller,"drop",fb(a,ub))),Kd(g.scroller,"paste",function(b){qb(g,b)||(nb(a),kb(a))}),Kd(g.input,"paste",function(){a.state.pasteIncoming=!0,kb(a)}),Kd(g.input,"cut",f),Kd(g.input,"copy",f),Fe&&Kd(g.sizer,"mouseup",function(){document.activeElement==g.input&&g.input.blur(),nb(a)})}function qb(a,b){for(var c=Id(b);c!=a.wrapper;c=c.parentNode)if(!c||c.ignoreEvents||c.parentNode==a.sizer&&c!=a.mover)return!0}function rb(a,b,c){var d=a.display;if(!c){var e=Id(b);if(e==d.scrollbarH||e==d.scrollbarH.firstChild||e==d.scrollbarV||e==d.scrollbarV.firstChild||e==d.scrollbarFiller||e==d.gutterFiller)return null}var f,g,h=ge(d.lineSpace);try{f=b.clientX,g=b.clientY}catch(b){return null}return _(a,f-h.left,g-h.top)}function sb(a){function b(a){if(!Tb(r,a)){if(r=a,"single"==k)return $b(e.doc,Xb(g,i),a),void 0;if(p=Xb(g,p),q=Xb(g,q),"double"==k){var b=nc(kd(g,a.line).text,a);Ub(a,p)?$b(e.doc,b.from,q):$b(e.doc,p,b.to)}else"triple"==k&&(Ub(a,p)?$b(e.doc,q,Xb(g,Sb(a.line,0))):$b(e.doc,p,Xb(g,Sb(a.line+1,0))))}}function c(a){var d=++t,h=rb(e,a,!0);if(h)if(Tb(h,m)){var i=a.clientY<s.top?-20:a.clientY>s.bottom?20:0;i&&setTimeout(fb(e,function(){t==d&&(f.scroller.scrollTop+=i,c(a))}),50)}else{e.state.focused||Fb(e),m=h,b(h);var j=o(f,g);(h.line>=j.to||h.line<j.from)&&setTimeout(fb(e,function(){t==d&&c(a)}),150)}}function d(a){t=1/0,Ed(a),nb(e),Ld(document,"mousemove",u),Ld(document,"mouseup",v)}if(!Od(this,a)){var e=this,f=e.display,g=e.doc,h=g.sel;if(h.shift=a.shiftKey,qb(f,a))return Ae||(f.scroller.draggable=!1,setTimeout(function(){f.scroller.draggable=!0},100)),void 0;if(!tb(e,a)){var i=rb(e,a);switch(Jd(a)){case 3:return Se&&Hb.call(e,e,a),void 0;case 2:return i&&$b(e.doc,i),setTimeout(_d(nb,e),20),Ed(a),void 0}if(!i)return Id(a)==f.scroller&&Ed(a),void 0;e.state.focused||Fb(e);var j=+new Date,k="single";if(Qe&&Qe.time>j-400&&Tb(Qe.pos,i))k="triple",Ed(a),setTimeout(_d(nb,e),20),oc(e,i.line);else if(Pe&&Pe.time>j-400&&Tb(Pe.pos,i)){k="double",Qe={time:j,pos:i},Ed(a);var l=nc(kd(g,i.line).text,i);$b(e.doc,l.from,l.to)}else Pe={time:j,pos:i};var m=i;if(e.options.dragDrop&&Bf&&!ob(e)&&!Tb(h.from,h.to)&&!Ub(i,h.from)&&!Ub(h.to,i)&&"single"==k){var n=fb(e,function(b){Ae&&(f.scroller.draggable=!1),e.state.draggingText=!1,Ld(document,"mouseup",n),Ld(f.scroller,"drop",n),Math.abs(a.clientX-b.clientX)+Math.abs(a.clientY-b.clientY)<10&&(Ed(b),$b(e.doc,i),nb(e))
2
- });return Ae&&(f.scroller.draggable=!0),e.state.draggingText=n,f.scroller.dragDrop&&f.scroller.dragDrop(),Kd(document,"mouseup",n),Kd(f.scroller,"drop",n),void 0}Ed(a),"single"==k&&$b(e.doc,Xb(g,i));var p=h.from,q=h.to,r=i,s=ge(f.wrapper),t=0,u=fb(e,function(a){xe||Jd(a)?c(a):d(a)}),v=fb(e,d);Kd(document,"mousemove",u),Kd(document,"mouseup",v)}}}function tb(a,b){var c=a.display;try{var d=b.clientX,e=b.clientY}catch(b){return!1}if(d>=Math.floor(ge(c.gutters).right))return!1;if(Ed(b),!Qd(a,"gutterClick"))return!0;var f=ge(c.lineDiv);if(e>f.bottom)return!0;e-=f.top-c.viewOffset;for(var g=0;g<a.options.gutters.length;++g){var h=c.gutters.childNodes[g];if(h&&ge(h).right>=d){var i=pd(a.doc,e),j=a.options.gutters[g];Nd(a,"gutterClick",a,i,j,b);break}}return!0}function ub(a){var b=this;if(!(Od(b,a)||qb(b.display,a)||b.options.onDragEvent&&b.options.onDragEvent(b,Dd(a)))){Ed(a),xe&&(We=+new Date);var c=rb(b,a,!0),d=a.dataTransfer.files;if(c&&!ob(b))if(d&&d.length&&window.FileReader&&window.File)for(var e=d.length,f=Array(e),g=0,h=function(a,d){var h=new FileReader;h.onload=function(){f[d]=h.result,++g==e&&(c=Xb(b.doc,c),Lb(b.doc,{from:c,to:c,text:Ef(f.join("\n")),origin:"paste"},"around"))},h.readAsText(a)},i=0;e>i;++i)h(d[i],i);else{if(b.state.draggingText&&!Ub(c,b.doc.sel.from)&&!Ub(b.doc.sel.to,c))return b.state.draggingText(a),setTimeout(_d(nb,b),20),void 0;try{var f=a.dataTransfer.getData("Text");if(f){var j=b.doc.sel.from,k=b.doc.sel.to;ac(b.doc,c,c),b.state.draggingText&&Rb(b.doc,"",j,k,"paste"),b.replaceSelection(f,null,"paste"),nb(b),Fb(b)}}catch(a){}}}}function vb(a,b){if(xe&&(!a.state.draggingText||+new Date-We<100))return Hd(b),void 0;if(!Od(a,b)&&!qb(a.display,b)){var c=a.getSelection();if(b.dataTransfer.setData("Text",c),b.dataTransfer.setDragImage&&!Ee){var d=ce("img",null,null,"position: fixed; left: 0; top: 0;");De&&(d.width=d.height=1,a.display.wrapper.appendChild(d),d._top=d.offsetTop),b.dataTransfer.setDragImage(d,0,0),De&&d.parentNode.removeChild(d)}}}function wb(a,b){Math.abs(a.doc.scrollTop-b)<2||(a.doc.scrollTop=b,we||t(a,[],b),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b),a.display.scrollbarV.scrollTop!=b&&(a.display.scrollbarV.scrollTop=b),we&&t(a,[]),G(a,100))}function xb(a,b,c){(c?b==a.doc.scrollLeft:Math.abs(a.doc.scrollLeft-b)<2)||(b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth),a.doc.scrollLeft=b,p(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbarH.scrollLeft!=b&&(a.display.scrollbarH.scrollLeft=b))}function yb(a,b){var c=b.wheelDeltaX,d=b.wheelDeltaY;null==c&&b.detail&&b.axis==b.HORIZONTAL_AXIS&&(c=b.detail),null==d&&b.detail&&b.axis==b.VERTICAL_AXIS?d=b.detail:null==d&&(d=b.wheelDelta);var e=a.display,f=e.scroller;if(c&&f.scrollWidth>f.clientWidth||d&&f.scrollHeight>f.clientHeight){if(d&&Le&&Ae)for(var g=b.target;g!=f;g=g.parentNode)if(g.lineObj){a.display.currentWheelTarget=g;break}if(c&&!we&&!De&&null!=Ye)return d&&wb(a,Math.max(0,Math.min(f.scrollTop+d*Ye,f.scrollHeight-f.clientHeight))),xb(a,Math.max(0,Math.min(f.scrollLeft+c*Ye,f.scrollWidth-f.clientWidth))),Ed(b),e.wheelStartX=null,void 0;if(d&&null!=Ye){var h=d*Ye,i=a.doc.scrollTop,j=i+e.wrapper.clientHeight;0>h?i=Math.max(0,i+h-50):j=Math.min(a.doc.height,j+h+50),t(a,[],{top:i,bottom:j})}20>Xe&&(null==e.wheelStartX?(e.wheelStartX=f.scrollLeft,e.wheelStartY=f.scrollTop,e.wheelDX=c,e.wheelDY=d,setTimeout(function(){if(null!=e.wheelStartX){var a=f.scrollLeft-e.wheelStartX,b=f.scrollTop-e.wheelStartY,c=b&&e.wheelDY&&b/e.wheelDY||a&&e.wheelDX&&a/e.wheelDX;e.wheelStartX=e.wheelStartY=null,c&&(Ye=(Ye*Xe+c)/(Xe+1),++Xe)}},200)):(e.wheelDX+=c,e.wheelDY+=d))}}function zb(a,b,c){if("string"==typeof b&&(b=kf[b],!b))return!1;a.display.pollingFast&&lb(a)&&(a.display.pollingFast=!1);var d=a.doc,e=d.sel.shift,f=!1;try{ob(a)&&(a.state.suppressEdits=!0),c&&(d.sel.shift=!1),f=b(a)!=xf}finally{d.sel.shift=e,a.state.suppressEdits=!1}return f}function Ab(a){var b=a.state.keyMaps.slice(0);return a.options.extraKeys&&b.push(a.options.extraKeys),b.push(a.options.keyMap),b}function Bb(a,b){var c=sc(a.options.keyMap),d=c.auto;clearTimeout(Ze),d&&!uc(b)&&(Ze=setTimeout(function(){sc(a.options.keyMap)==c&&(a.options.keyMap=d.call?d.call(null,a):d,g(a))},50));var e=vc(b,!0),f=!1;if(!e)return!1;var h=Ab(a);return f=b.shiftKey?tc("Shift-"+e,h,function(b){return zb(a,b,!0)})||tc(e,h,function(b){return("string"==typeof b?/^go[A-Z]/.test(b):b.motion)?zb(a,b):void 0}):tc(e,h,function(b){return zb(a,b)}),f&&(Ed(b),F(a),ze&&(b.oldKeyCode=b.keyCode,b.keyCode=0),Nd(a,"keyHandled",a,e,b)),f}function Cb(a,b,c){var d=tc("'"+c+"'",Ab(a),function(b){return zb(a,b,!0)});return d&&(Ed(b),F(a),Nd(a,"keyHandled",a,"'"+c+"'",b)),d}function Db(a){var b=this;if(b.state.focused||Fb(b),xe&&27==a.keyCode&&(a.returnValue=!1),!(Od(b,a)||b.options.onKeyEvent&&b.options.onKeyEvent(b,Dd(a)))){var c=a.keyCode;b.doc.sel.shift=16==c||a.shiftKey;var d=Bb(b,a);De&&(_e=d?c:null,!d&&88==c&&!Gf&&(Le?a.metaKey:a.ctrlKey)&&b.replaceSelection(""))}}function Eb(a){var b=this;if(!(Od(b,a)||b.options.onKeyEvent&&b.options.onKeyEvent(b,Dd(a)))){var c=a.keyCode,d=a.charCode;if(De&&c==_e)return _e=null,Ed(a),void 0;if(!(De&&(!a.which||a.which<10)||Fe)||!Bb(b,a)){var e=String.fromCharCode(null==d?c:d);this.options.electricChars&&this.doc.mode.electricChars&&this.options.smartIndent&&!ob(this)&&this.doc.mode.electricChars.indexOf(e)>-1&&setTimeout(fb(b,function(){jc(b,b.doc.sel.to.line,"smart")}),75),Cb(b,a,e)||(xe&&!ze&&(b.display.inputHasSelection=null),kb(b))}}}function Fb(a){"nocursor"!=a.options.readOnly&&(a.state.focused||(Md(a,"focus",a),a.state.focused=!0,-1==a.display.wrapper.className.search(/\bCodeMirror-focused\b/)&&(a.display.wrapper.className+=" CodeMirror-focused"),mb(a,!0)),jb(a),F(a))}function Gb(a){a.state.focused&&(Md(a,"blur",a),a.state.focused=!1,a.display.wrapper.className=a.display.wrapper.className.replace(" CodeMirror-focused","")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.doc.sel.shift=!1)},150)}function Hb(a,b){function c(){if(null!=e.input.selectionStart){var a=e.input.value=" "+(Tb(f.from,f.to)?"":e.input.value);e.prevInput=" ",e.input.selectionStart=1,e.input.selectionEnd=a.length}}function d(){if(e.inputDiv.style.position="relative",e.input.style.cssText=i,ze&&(e.scrollbarV.scrollTop=e.scroller.scrollTop=h),jb(a),null!=e.input.selectionStart){(!xe||ze)&&c(),clearTimeout($e);var b=0,d=function(){" "==e.prevInput&&0==e.input.selectionStart?fb(a,kf.selectAll)(a):b++<10?$e=setTimeout(d,500):mb(a)};$e=setTimeout(d,200)}}if(!Od(a,b,"contextmenu")){var e=a.display,f=a.doc.sel;if(!qb(e,b)){var g=rb(a,b),h=e.scroller.scrollTop;if(g&&!De){(Tb(f.from,f.to)||Ub(g,f.from)||!Ub(g,f.to))&&fb(a,ac)(a.doc,g,g);var i=e.input.style.cssText;if(e.inputDiv.style.position="absolute",e.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(b.clientY-5)+"px; left: "+(b.clientX-5)+"px; z-index: 1000; background: white; outline: none;"+"border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);",nb(a),mb(a,!0),Tb(f.from,f.to)&&(e.input.value=e.prevInput=" "),xe&&!ze&&c(),Se){Hd(b);var j=function(){Ld(window,"mouseup",j),setTimeout(d,20)};Kd(window,"mouseup",j)}else setTimeout(d,50)}}}}function Ib(a,b,c){if(!Ub(b.from,c))return Xb(a,c);var d=b.text.length-1-(b.to.line-b.from.line);if(c.line>b.to.line+d){var e=c.line-d,f=a.first+a.size-1;return e>f?Sb(f,kd(a,f).text.length):Yb(c,kd(a,e).text.length)}if(c.line==b.to.line+d)return Yb(c,Vd(b.text).length+(1==b.text.length?b.from.ch:0)+kd(a,b.to.line).text.length-b.to.ch);var g=c.line-b.from.line;return Yb(c,b.text[g].length+(g?0:b.from.ch))}function Jb(a,b,c){if(c&&"object"==typeof c)return{anchor:Ib(a,b,c.anchor),head:Ib(a,b,c.head)};if("start"==c)return{anchor:b.from,head:b.from};var d=af(b);if("around"==c)return{anchor:b.from,head:d};if("end"==c)return{anchor:d,head:d};var e=function(a){if(Ub(a,b.from))return a;if(!Ub(b.to,a))return d;var c=a.line+b.text.length-(b.to.line-b.from.line)-1,e=a.ch;return a.line==b.to.line&&(e+=d.ch-b.to.ch),Sb(c,e)};return{anchor:e(a.sel.anchor),head:e(a.sel.head)}}function Kb(a,b,c){var d={canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){this.canceled=!0}};return c&&(d.update=function(b,c,d,e){b&&(this.from=Xb(a,b)),c&&(this.to=Xb(a,c)),d&&(this.text=d),void 0!==e&&(this.origin=e)}),Md(a,"beforeChange",a,d),a.cm&&Md(a.cm,"beforeChange",a.cm,d),d.canceled?null:{from:d.from,to:d.to,text:d.text,origin:d.origin}}function Lb(a,b,c,d){if(a.cm){if(!a.cm.curOp)return fb(a.cm,Lb)(a,b,c,d);if(a.cm.state.suppressEdits)return}if(!(Qd(a,"beforeChange")||a.cm&&Qd(a.cm,"beforeChange"))||(b=Kb(a,b,!0))){var e=Te&&!d&&Ic(a,b.from,b.to);if(e){for(var f=e.length-1;f>=1;--f)Mb(a,{from:e[f].from,to:e[f].to,text:[""]});e.length&&Mb(a,{from:e[0].from,to:e[0].to,text:b.text},c)}else Mb(a,b,c)}}function Mb(a,b,c){var d=Jb(a,b,c);vd(a,b,d,a.cm?a.cm.curOp.id:0/0),Pb(a,b,d,Gc(a,b));var e=[];id(a,function(a,c){c||-1!=Xd(e,a.history)||(Bd(a.history,b),e.push(a.history)),Pb(a,b,null,Gc(a,b))})}function Nb(a,b){if(!a.cm||!a.cm.state.suppressEdits){var c=a.history,d=("undo"==b?c.done:c.undone).pop();if(d){var e={changes:[],anchorBefore:d.anchorAfter,headBefore:d.headAfter,anchorAfter:d.anchorBefore,headAfter:d.headBefore,generation:c.generation};("undo"==b?c.undone:c.done).push(e),c.generation=d.generation||++c.maxGeneration;for(var f=Qd(a,"beforeChange")||a.cm&&Qd(a.cm,"beforeChange"),g=d.changes.length-1;g>=0;--g){var h=d.changes[g];if(h.origin=b,f&&!Kb(a,h,!1))return("undo"==b?c.done:c.undone).length=0,void 0;e.changes.push(ud(a,h));var i=g?Jb(a,h,null):{anchor:d.anchorBefore,head:d.headBefore};Pb(a,h,i,Hc(a,h));var j=[];id(a,function(a,b){b||-1!=Xd(j,a.history)||(Bd(a.history,h),j.push(a.history)),Pb(a,h,null,Hc(a,h))})}}}}function Ob(a,b){function c(a){return Sb(a.line+b,a.ch)}a.first+=b,a.cm&&ib(a.cm,a.first,a.first,b),a.sel.head=c(a.sel.head),a.sel.anchor=c(a.sel.anchor),a.sel.from=c(a.sel.from),a.sel.to=c(a.sel.to)}function Pb(a,b,c,d){if(a.cm&&!a.cm.curOp)return fb(a.cm,Pb)(a,b,c,d);if(b.to.line<a.first)return Ob(a,b.text.length-1-(b.to.line-b.from.line)),void 0;if(!(b.from.line>a.lastLine())){if(b.from.line<a.first){var e=b.text.length-1-(a.first-b.from.line);Ob(a,e),b={from:Sb(a.first,0),to:Sb(b.to.line+e,b.to.ch),text:[Vd(b.text)],origin:b.origin}}var f=a.lastLine();b.to.line>f&&(b={from:b.from,to:Sb(f,kd(a,f).text.length),text:[b.text[0]],origin:b.origin}),b.removed=ld(a,b.from,b.to),c||(c=Jb(a,b,null)),a.cm?Qb(a.cm,b,d,c):fd(a,b,d,c)}}function Qb(a,b,c,d){var f=a.doc,g=a.display,h=b.from,i=b.to,j=!1,l=h.line;a.options.lineWrapping||(l=od(Mc(f,kd(f,h.line))),f.iter(l,i.line+1,function(a){return a==g.maxLine?(j=!0,!0):void 0})),Ub(f.sel.head,b.from)||Ub(b.to,f.sel.head)||(a.curOp.cursorActivity=!0),fd(f,b,c,d,e(a)),a.options.lineWrapping||(f.iter(l,h.line+b.text.length,function(a){var b=k(f,a);b>g.maxLineLength&&(g.maxLine=a,g.maxLineLength=b,g.maxLineChanged=!0,j=!1)}),j&&(a.curOp.updateMaxLine=!0)),f.frontier=Math.min(f.frontier,h.line),G(a,400);var m=b.text.length-(i.line-h.line)-1;if(ib(a,h.line,i.line+1,m),Qd(a,"change")){var n={from:h,to:i,text:b.text,removed:b.removed,origin:b.origin};if(a.curOp.textChanged){for(var o=a.curOp.textChanged;o.next;o=o.next);o.next=n}else a.curOp.textChanged=n}}function Rb(a,b,c,d,e){if(d||(d=c),Ub(d,c)){var f=d;d=c,c=f}"string"==typeof b&&(b=Ef(b)),Lb(a,{from:c,to:d,text:b,origin:e},null)}function Sb(a,b){return this instanceof Sb?(this.line=a,this.ch=b,void 0):new Sb(a,b)}function Tb(a,b){return a.line==b.line&&a.ch==b.ch}function Ub(a,b){return a.line<b.line||a.line==b.line&&a.ch<b.ch}function Vb(a){return Sb(a.line,a.ch)}function Wb(a,b){return Math.max(a.first,Math.min(b,a.first+a.size-1))}function Xb(a,b){if(b.line<a.first)return Sb(a.first,0);var c=a.first+a.size-1;return b.line>c?Sb(c,kd(a,c).text.length):Yb(b,kd(a,b.line).text.length)}function Yb(a,b){var c=a.ch;return null==c||c>b?Sb(a.line,b):0>c?Sb(a.line,0):a}function Zb(a,b){return b>=a.first&&b<a.first+a.size}function $b(a,b,c,d){if(a.sel.shift||a.sel.extend){var e=a.sel.anchor;if(c){var f=Ub(b,e);f!=Ub(c,e)?(e=b,b=c):f!=Ub(b,c)&&(b=c)}ac(a,e,b,d)}else ac(a,b,c||b,d);a.cm&&(a.cm.curOp.userSelChange=!0)}function _b(a,b,c){var d={anchor:b,head:c};return Md(a,"beforeSelectionChange",a,d),a.cm&&Md(a.cm,"beforeSelectionChange",a.cm,d),d.anchor=Xb(a,d.anchor),d.head=Xb(a,d.head),d}function ac(a,b,c,d,e){if(!e&&Qd(a,"beforeSelectionChange")||a.cm&&Qd(a.cm,"beforeSelectionChange")){var f=_b(a,b,c);c=f.head,b=f.anchor}var g=a.sel;if(g.goalColumn=null,(e||!Tb(b,g.anchor))&&(b=cc(a,b,d,"push"!=e)),(e||!Tb(c,g.head))&&(c=cc(a,c,d,"push"!=e)),!Tb(g.anchor,b)||!Tb(g.head,c)){g.anchor=b,g.head=c;var h=Ub(c,b);g.from=h?c:b,g.to=h?b:c,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=a.cm.curOp.cursorActivity=!0),Nd(a,"cursorActivity",a)}}function bc(a){ac(a.doc,a.doc.sel.from,a.doc.sel.to,null,"push")}function cc(a,b,c,d){var e=!1,f=b,g=c||1;a.cantEdit=!1;a:for(;;){var h=kd(a,f.line);if(h.markedSpans)for(var i=0;i<h.markedSpans.length;++i){var j=h.markedSpans[i],k=j.marker;if((null==j.from||(k.inclusiveLeft?j.from<=f.ch:j.from<f.ch))&&(null==j.to||(k.inclusiveRight?j.to>=f.ch:j.to>f.ch))){if(d&&(Md(k,"beforeCursorEnter"),k.explicitlyCleared)){if(h.markedSpans){--i;continue}break}if(!k.atomic)continue;var l=k.find()[0>g?"from":"to"];if(Tb(l,f)&&(l.ch+=g,l.ch<0?l=l.line>a.first?Xb(a,Sb(l.line-1)):null:l.ch>h.text.length&&(l=l.line<a.first+a.size-1?Sb(l.line+1,0):null),!l)){if(e)return d?(a.cantEdit=!0,Sb(a.first,0)):cc(a,b,c,!0);e=!0,l=b,g=-g}f=l;continue a}}return f}}function dc(a){var b=ec(a,a.doc.sel.head,a.options.cursorScrollMargin);if(a.state.focused){var c=a.display,d=ge(c.sizer),e=null;if(b.top+d.top<0?e=!0:b.bottom+d.top>(window.innerHeight||document.documentElement.clientHeight)&&(e=!1),null!=e&&!Ie){var f="none"==c.cursor.style.display;f&&(c.cursor.style.display="",c.cursor.style.left=b.left+"px",c.cursor.style.top=b.top-c.viewOffset+"px"),c.cursor.scrollIntoView(e),f&&(c.cursor.style.display="none")}}}function ec(a,b,c){for(null==c&&(c=0);;){var d=!1,e=Z(a,b),f=gc(a,e.left,e.top-c,e.left,e.bottom+c),g=a.doc.scrollTop,h=a.doc.scrollLeft;if(null!=f.scrollTop&&(wb(a,f.scrollTop),Math.abs(a.doc.scrollTop-g)>1&&(d=!0)),null!=f.scrollLeft&&(xb(a,f.scrollLeft),Math.abs(a.doc.scrollLeft-h)>1&&(d=!0)),!d)return e}}function fc(a,b,c,d,e){var f=gc(a,b,c,d,e);null!=f.scrollTop&&wb(a,f.scrollTop),null!=f.scrollLeft&&xb(a,f.scrollLeft)}function gc(a,b,c,d,e){var f=a.display,g=bb(a.display);0>c&&(c=0);var h=f.scroller.clientHeight-wf,i=f.scroller.scrollTop,j={},k=a.doc.height+L(f),l=g>c,m=e>k-g;if(i>c)j.scrollTop=l?0:c;else if(e>i+h){var n=Math.min(c,(m?k:e)-h);n!=i&&(j.scrollTop=n)}var o=f.scroller.clientWidth-wf,p=f.scroller.scrollLeft;b+=f.gutters.offsetWidth,d+=f.gutters.offsetWidth;var q=f.gutters.offsetWidth,r=q+10>b;return p+q>b||r?(r&&(b=0),j.scrollLeft=Math.max(0,b-10-q)):d>o+p-3&&(j.scrollLeft=d+10-o),j}function hc(a,b,c){a.curOp.updateScrollPos={scrollLeft:null==b?a.doc.scrollLeft:b,scrollTop:null==c?a.doc.scrollTop:c}}function ic(a,b,c){var d=a.curOp.updateScrollPos||(a.curOp.updateScrollPos={scrollLeft:a.doc.scrollLeft,scrollTop:a.doc.scrollTop}),e=a.display.scroller;d.scrollTop=Math.max(0,Math.min(e.scrollHeight-e.clientHeight,d.scrollTop+c)),d.scrollLeft=Math.max(0,Math.min(e.scrollWidth-e.clientWidth,d.scrollLeft+b))}function jc(a,b,c,d){var e=a.doc;if(null==c&&(c="add"),"smart"==c)if(a.doc.mode.indent)var f=J(a,b);else c="prev";var g,h=a.options.tabSize,i=kd(e,b),j=Td(i.text,null,h),k=i.text.match(/^\s*/)[0];if("smart"==c&&(g=a.doc.mode.indent(f,i.text.slice(k.length),i.text),g==xf)){if(!d)return;c="prev"}"prev"==c?g=b>e.first?Td(kd(e,b-1).text,null,h):0:"add"==c?g=j+a.options.indentUnit:"subtract"==c?g=j-a.options.indentUnit:"number"==typeof c&&(g=j+c),g=Math.max(0,g);var l="",m=0;if(a.options.indentWithTabs)for(var n=Math.floor(g/h);n;--n)m+=h,l+=" ";g>m&&(l+=Ud(g-m)),l!=k&&Rb(a.doc,l,Sb(b,0),Sb(b,k.length),"+input"),i.stateAfter=null}function kc(a,b,c){var d=b,e=b,f=a.doc;return"number"==typeof b?e=kd(f,Wb(f,b)):d=od(b),null==d?null:c(e,d)?(ib(a,d,d+1),e):null}function lc(a,b,c,d,e){function f(){var b=h+c;return b<a.first||b>=a.first+a.size?l=!1:(h=b,k=kd(a,b))}function g(a){var b=(e?ue:ve)(k,i,c,!0);if(null==b){if(a||!f())return l=!1;i=e?(0>c?oe:ne)(k):0>c?k.text.length:0}else i=b;return!0}var h=b.line,i=b.ch,j=c,k=kd(a,h),l=!0;if("char"==d)g();else if("column"==d)g(!0);else if("word"==d||"group"==d)for(var m=null,n="group"==d,o=!0;!(0>c)||g(!o);o=!1){var p=k.text.charAt(i)||"\n",q=ae(p)?"w":n?/\s/.test(p)?null:"p":null;if(m&&m!=q){0>c&&(c=1,g());break}if(q&&(m=q),c>0&&!g(!o))break}var r=cc(a,Sb(h,i),j,!0);return l||(r.hitSide=!0),r}function mc(a,b,c,d){var e,f=a.doc,g=b.left;if("page"==d){var h=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);e=b.top+c*(h-(0>c?1.5:.5)*bb(a.display))}else"line"==d&&(e=c>0?b.bottom+3:b.top-3);for(;;){var i=_(a,g,e);if(!i.outside)break;if(0>c?0>=e:e>=f.height){i.hitSide=!0;break}e+=5*c}return i}function nc(a,b){var c=b.ch,d=b.ch;if(a){(b.xRel<0||d==a.length)&&c?--c:++d;for(var e=a.charAt(c),f=ae(e)?ae:/\s/.test(e)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!ae(a)};c>0&&f(a.charAt(c-1));)--c;for(;d<a.length&&f(a.charAt(d));)++d}return{from:Sb(b.line,c),to:Sb(b.line,d)}}function oc(a,b){$b(a.doc,Sb(b,0),Xb(a.doc,Sb(b+1,0)))}function pc(b,c,d,e){a.defaults[b]=c,d&&(bf[b]=e?function(a,b,c){c!=df&&d(a,b,c)}:d)}function qc(a,b){if(b===!0)return b;if(a.copyState)return a.copyState(b);var c={};for(var d in b){var e=b[d];e instanceof Array&&(e=e.concat([])),c[d]=e}return c}function rc(a,b,c){return a.startState?a.startState(b,c):!0}function sc(a){return"string"==typeof a?lf[a]:a}function tc(a,b,c){function d(b){b=sc(b);var e=b[a];if(e===!1)return"stop";if(null!=e&&c(e))return!0;if(b.nofallthrough)return"stop";var f=b.fallthrough;if(null==f)return!1;if("[object Array]"!=Object.prototype.toString.call(f))return d(f);for(var g=0,h=f.length;h>g;++g){var i=d(f[g]);if(i)return i}return!1}for(var e=0;e<b.length;++e){var f=d(b[e]);if(f)return"stop"!=f}}function uc(a){var b=Hf[a.keyCode];return"Ctrl"==b||"Alt"==b||"Shift"==b||"Mod"==b}function vc(a,b){if(De&&34==a.keyCode&&a["char"])return!1;var c=Hf[a.keyCode];return null==c||a.altGraphKey?!1:(a.altKey&&(c="Alt-"+c),(Re?a.metaKey:a.ctrlKey)&&(c="Ctrl-"+c),(Re?a.ctrlKey:a.metaKey)&&(c="Cmd-"+c),!b&&a.shiftKey&&(c="Shift-"+c),c)}function wc(a,b){this.pos=this.start=0,this.string=a,this.tabSize=b||8,this.lastColumnPos=this.lastColumnValue=0}function xc(a,b){this.lines=[],this.type=b,this.doc=a}function yc(a,b,c,d,e){if(d&&d.shared)return Ac(a,b,c,d,e);if(a.cm&&!a.cm.curOp)return fb(a.cm,yc)(a,b,c,d,e);var f=new xc(a,e);if("range"==e&&!Ub(b,c))return f;d&&Zd(d,f),f.replacedWith&&(f.collapsed=!0,f.replacedWith=ce("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||(f.replacedWith.ignoreEvents=!0)),f.collapsed&&(Ue=!0),f.addToHistory&&vd(a,{from:b,to:c,origin:"markText"},{head:a.sel.head,anchor:a.sel.anchor},0/0);var g,h,i,j=b.line,k=0,l=a.cm;if(a.iter(j,c.line+1,function(d){l&&f.collapsed&&!l.options.lineWrapping&&Mc(a,d)==l.display.maxLine&&(i=!0);var e={from:null,to:null,marker:f};k+=d.text.length,j==b.line&&(e.from=b.ch,k-=b.ch),j==c.line&&(e.to=c.ch,k-=d.text.length-c.ch),f.collapsed&&(j==c.line&&(h=Jc(d,c.ch)),j==b.line?g=Jc(d,b.ch):nd(d,0)),Dc(d,e),++j}),f.collapsed&&a.iter(b.line,c.line+1,function(b){Nc(a,b)&&nd(b,0)}),f.clearOnEnter&&Kd(f,"beforeCursorEnter",function(){f.clear()}),f.readOnly&&(Te=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory()),f.collapsed){if(g!=h)throw new Error("Inserting collapsed marker overlapping an existing one");f.size=k,f.atomic=!0}return l&&(i&&(l.curOp.updateMaxLine=!0),(f.className||f.title||f.startStyle||f.endStyle||f.collapsed)&&ib(l,b.line,c.line+1),f.atomic&&bc(l)),f}function zc(a,b){this.markers=a,this.primary=b;for(var c=0,d=this;c<a.length;++c)a[c].parent=this,Kd(a[c],"clear",function(){d.clear()})}function Ac(a,b,c,d,e){d=Zd(d),d.shared=!1;var f=[yc(a,b,c,d,e)],g=f[0],h=d.replacedWith;return id(a,function(a){h&&(d.replacedWith=h.cloneNode(!0)),f.push(yc(a,Xb(a,b),Xb(a,c),d,e));for(var i=0;i<a.linked.length;++i)if(a.linked[i].isParent)return;g=Vd(f)}),new zc(f,g)}function Bc(a,b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function Cc(a,b){for(var c,d=0;d<a.length;++d)a[d]!=b&&(c||(c=[])).push(a[d]);return c}function Dc(a,b){a.markedSpans=a.markedSpans?a.markedSpans.concat([b]):[b],b.marker.attachLine(a)}function Ec(a,b,c){if(a)for(var d,e=0;e<a.length;++e){var f=a[e],g=f.marker,h=null==f.from||(g.inclusiveLeft?f.from<=b:f.from<b);if(h||"bookmark"==g.type&&f.from==b&&(!c||!f.marker.insertLeft)){var i=null==f.to||(g.inclusiveRight?f.to>=b:f.to>b);(d||(d=[])).push({from:f.from,to:i?null:f.to,marker:g})}}return d}function Fc(a,b,c){if(a)for(var d,e=0;e<a.length;++e){var f=a[e],g=f.marker,h=null==f.to||(g.inclusiveRight?f.to>=b:f.to>b);if(h||"bookmark"==g.type&&f.from==b&&(!c||f.marker.insertLeft)){var i=null==f.from||(g.inclusiveLeft?f.from<=b:f.from<b);(d||(d=[])).push({from:i?null:f.from-b,to:null==f.to?null:f.to-b,marker:g})}}return d}function Gc(a,b){var c=Zb(a,b.from.line)&&kd(a,b.from.line).markedSpans,d=Zb(a,b.to.line)&&kd(a,b.to.line).markedSpans;if(!c&&!d)return null;var e=b.from.ch,f=b.to.ch,g=Tb(b.from,b.to),h=Ec(c,e,g),i=Fc(d,f,g),j=1==b.text.length,k=Vd(b.text).length+(j?e:0);if(h)for(var l=0;l<h.length;++l){var m=h[l];if(null==m.to){var n=Bc(i,m.marker);n?j&&(m.to=null==n.to?null:n.to+k):m.to=e}}if(i)for(var l=0;l<i.length;++l){var m=i[l];if(null!=m.to&&(m.to+=k),null==m.from){var n=Bc(h,m.marker);n||(m.from=k,j&&(h||(h=[])).push(m))}else m.from+=k,j&&(h||(h=[])).push(m)}if(j&&h){for(var l=0;l<h.length;++l)null!=h[l].from&&h[l].from==h[l].to&&"bookmark"!=h[l].marker.type&&h.splice(l--,1);h.length||(h=null)}var o=[h];if(!j){var p,q=b.text.length-2;if(q>0&&h)for(var l=0;l<h.length;++l)null==h[l].to&&(p||(p=[])).push({from:null,to:null,marker:h[l].marker});for(var l=0;q>l;++l)o.push(p);o.push(i)}return o}function Hc(a,b){var c=xd(a,b),d=Gc(a,b);if(!c)return d;if(!d)return c;for(var e=0;e<c.length;++e){var f=c[e],g=d[e];if(f&&g)a:for(var h=0;h<g.length;++h){for(var i=g[h],j=0;j<f.length;++j)if(f[j].marker==i.marker)continue a;f.push(i)}else g&&(c[e]=g)}return c}function Ic(a,b,c){var d=null;if(a.iter(b.line,c.line+1,function(a){if(a.markedSpans)for(var b=0;b<a.markedSpans.length;++b){var c=a.markedSpans[b].marker;!c.readOnly||d&&-1!=Xd(d,c)||(d||(d=[])).push(c)}}),!d)return null;for(var e=[{from:b,to:c}],f=0;f<d.length;++f)for(var g=d[f],h=g.find(),i=0;i<e.length;++i){var j=e[i];if(!Ub(j.to,h.from)&&!Ub(h.to,j.from)){var k=[i,1];(Ub(j.from,h.from)||!g.inclusiveLeft&&Tb(j.from,h.from))&&k.push({from:j.from,to:h.from}),(Ub(h.to,j.to)||!g.inclusiveRight&&Tb(j.to,h.to))&&k.push({from:h.to,to:j.to}),e.splice.apply(e,k),i+=k.length-1}}return e}function Jc(a,b){var c,d=Ue&&a.markedSpans;if(d)for(var e,f=0;f<d.length;++f)e=d[f],e.marker.collapsed&&(null==e.from||e.from<b)&&(null==e.to||e.to>b)&&(!c||c.width<e.marker.width)&&(c=e.marker);return c}function Kc(a){return Jc(a,-1)}function Lc(a){return Jc(a,a.text.length+1)}function Mc(a,b){for(var c;c=Kc(b);)b=kd(a,c.find().from.line);return b}function Nc(a,b){var c=Ue&&b.markedSpans;if(c)for(var d,e=0;e<c.length;++e)if(d=c[e],d.marker.collapsed){if(null==d.from)return!0;if(!d.marker.replacedWith&&0==d.from&&d.marker.inclusiveLeft&&Oc(a,b,d))return!0}}function Oc(a,b,c){if(null==c.to){var d=c.marker.find().to,e=kd(a,d.line);return Oc(a,e,Bc(e.markedSpans,c.marker))}if(c.marker.inclusiveRight&&c.to==b.text.length)return!0;for(var f,g=0;g<b.markedSpans.length;++g)if(f=b.markedSpans[g],f.marker.collapsed&&!f.marker.replacedWith&&f.from==c.to&&(f.marker.inclusiveLeft||c.marker.inclusiveRight)&&Oc(a,b,f))return!0}function Pc(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function Qc(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function Rc(a){return function(){var b=!this.cm.curOp;b&&db(this.cm);try{var c=a.apply(this,arguments)}finally{b&&eb(this.cm)}return c}}function Sc(a){return null!=a.height?a.height:(a.node.parentNode&&1==a.node.parentNode.nodeType||ee(a.cm.display.measure,ce("div",[a.node],null,"position: relative")),a.height=a.node.offsetHeight)}function Tc(a,b,c,d){var e=new mf(a,c,d);return e.noHScroll&&(a.display.alignWidgets=!0),kc(a,b,function(b){var c=b.widgets||(b.widgets=[]);if(null==e.insertAt?c.push(e):c.splice(Math.min(c.length-1,Math.max(0,e.insertAt)),0,e),e.line=b,!Nc(a.doc,b)||e.showIfHidden){var d=qd(a,b)<a.doc.scrollTop;nd(b,b.height+Sc(e)),d&&ic(a,0,e.height)}return!0}),e}function Uc(a,b,c,d){a.text=b,a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null),null!=a.order&&(a.order=null),Pc(a),Qc(a,c);var e=d?d(a):1;e!=a.height&&nd(a,e)}function Vc(a){a.parent=null,Pc(a)}function Wc(a,b,c,d,e){var f=c.flattenSpans;null==f&&(f=a.options.flattenSpans);var g,h=0,i=null,j=new wc(b,a.options.tabSize);for(""==b&&c.blankLine&&c.blankLine(d);!j.eol();)j.pos>a.options.maxHighlightLength?(f=!1,j.pos=Math.min(b.length,j.start+5e4),g=null):g=c.token(j,d),f&&i==g||(h<j.start&&e(j.start,i),h=j.start,i=g),j.start=j.pos;h<j.pos&&e(j.pos,i)}function Xc(a,b,c){var d=[a.state.modeGen];Wc(a,b.text,a.doc.mode,c,function(a,b){d.push(a,b)});for(var e=0;e<a.state.overlays.length;++e){var f=a.state.overlays[e],g=1,h=0;Wc(a,b.text,f.mode,!0,function(a,b){for(var c=g;a>h;){var e=d[g];e>a&&d.splice(g,1,a,d[g+1],e),g+=2,h=Math.min(a,e)}if(b)if(f.opaque)d.splice(c,g-c,a,b),g=c+2;else for(;g>c;c+=2){var i=d[c+1];d[c+1]=i?i+" "+b:b}})}return d}function Yc(a,b){return b.styles&&b.styles[0]==a.state.modeGen||(b.styles=Xc(a,b,b.stateAfter=J(a,od(b)))),b.styles}function Zc(a,b,c){var d=a.doc.mode,e=new wc(b.text,a.options.tabSize);for(""==b.text&&d.blankLine&&d.blankLine(c);!e.eol()&&e.pos<=a.options.maxHighlightLength;)d.token(e,c),e.start=e.pos}function $c(a){return a?of[a]||(of[a]="cm-"+a.replace(/ +/g," cm-")):null}function _c(a,b,c,d){for(var e,f=b,g=!0;e=Kc(f);)f=kd(a.doc,e.find().from.line);var h={pre:ce("pre"),col:0,pos:0,measure:null,measuredSomething:!1,cm:a,copyWidgets:d};f.textClass&&(h.pre.className=f.textClass);do{f.text&&(g=!1),h.measure=f==b&&c,h.pos=0,h.addToken=h.measure?bd:ad,(xe||Ae)&&a.getOption("lineWrapping")&&(h.addToken=cd(h.addToken));var i=ed(f,h,Yc(a,f));c&&f==b&&!h.measuredSomething&&(c[0]=h.pre.appendChild(je(a.display.measure)),h.measuredSomething=!0),i&&(f=kd(a.doc,i.to.line))}while(i);!c||h.measuredSomething||c[0]||(c[0]=h.pre.appendChild(g?ce("span"," "):je(a.display.measure))),h.pre.firstChild||Nc(a.doc,b)||h.pre.appendChild(document.createTextNode(" "));var j;if(c&&xe&&(j=rd(f))){var k=j.length-1;j[k].from==j[k].to&&--k;var l=j[k],m=j[k-1];if(l.from+1==l.to&&m&&l.level<m.level){var n=c[h.pos-1];n&&n.parentNode.insertBefore(n.measureRight=je(a.display.measure),n.nextSibling)}}return Md(a,"renderLine",a,b,h.pre),h.pre}function ad(a,b,c,d,e,f){if(b){if(pf.test(b))for(var g=document.createDocumentFragment(),h=0;;){pf.lastIndex=h;var i=pf.exec(b),j=i?i.index-h:b.length-h;if(j&&(g.appendChild(document.createTextNode(b.slice(h,h+j))),a.col+=j),!i)break;if(h+=j+1," "==i[0]){var k=a.cm.options.tabSize,l=k-a.col%k;g.appendChild(ce("span",Ud(l),"cm-tab")),a.col+=l}else{var m=ce("span","•","cm-invalidchar");m.title="\\u"+i[0].charCodeAt(0).toString(16),g.appendChild(m),a.col+=1}}else{a.col+=b.length;var g=document.createTextNode(b)}if(c||d||e||a.measure){var n=c||"";d&&(n+=d),e&&(n+=e);var m=ce("span",[g],n);return f&&(m.title=f),a.pre.appendChild(m)}a.pre.appendChild(g)}}function bd(a,b,c,d,e){for(var f=a.cm.options.lineWrapping,g=0;g<b.length;++g){var h=b.charAt(g),i=0==g;h>="���"&&"���">h&&g<b.length-1?(h=b.slice(g,g+2),++g):g&&f&&he(b,g)&&a.pre.appendChild(ce("wbr"));var j=a.measure[a.pos],k=a.measure[a.pos]=ad(a,h,c,i&&d,g==b.length-1&&e);j&&(k.leftSide=j.leftSide||j),xe&&f&&" "==h&&g&&!/\s/.test(b.charAt(g-1))&&g<b.length-1&&!/\s/.test(b.charAt(g+1))&&(k.style.whiteSpace="normal"),a.pos+=h.length}b.length&&(a.measuredSomething=!0)}function cd(a){function b(a){for(var b=" ",c=0;c<a.length-2;++c)b+=c%2?" ":" ";return b+=" "}return function(c,d,e,f,g,h){return a(c,d.replace(/ {3,}/,b),e,f,g,h)}}function dd(a,b,c,d){var e=!d&&c.replacedWith;if(e&&(a.copyWidgets&&(e=e.cloneNode(!0)),a.pre.appendChild(e),a.measure)){if(b)a.measure[a.pos]=e;else{var f=a.measure[a.pos]=je(a.cm.display.measure);"bookmark"!=c.type||c.insertLeft?a.pre.insertBefore(f,e):a.pre.appendChild(f)}a.measuredSomething=!0}a.pos+=b}function ed(a,b,c){var d=a.markedSpans,e=a.text,f=0;if(d)for(var g,h,i,j,k,l,m=e.length,n=0,o=1,p="",q=0;;){if(q==n){h=i=j=k="",l=null,q=1/0;for(var r=null,s=0;s<d.length;++s){var t=d[s],u=t.marker;t.from<=n&&(null==t.to||t.to>n)?(null!=t.to&&q>t.to&&(q=t.to,i=""),u.className&&(h+=" "+u.className),u.startStyle&&t.from==n&&(j+=" "+u.startStyle),u.endStyle&&t.to==q&&(i+=" "+u.endStyle),u.title&&!k&&(k=u.title),u.collapsed&&(!l||l.marker.size<u.size)&&(l=t)):t.from>n&&q>t.from&&(q=t.from),"bookmark"==u.type&&t.from==n&&u.replacedWith&&(r=u)}if(l&&(l.from||0)==n&&(dd(b,(null==l.to?m:l.to)-n,l.marker,null==l.from),null==l.to))return l.marker.find();r&&!l&&dd(b,0,r)}if(n>=m)break;for(var v=Math.min(m,q);;){if(p){var w=n+p.length;if(!l){var x=w>v?p.slice(0,v-n):p;b.addToken(b,x,g?g+h:h,j,n+x.length==q?i:"",k)}if(w>=v){p=p.slice(v-n),n=v;break}n=w,j=""}p=e.slice(f,f=c[o++]),g=$c(c[o++])}}else for(var o=1;o<c.length;o+=2)b.addToken(b,e.slice(f,f=c[o]),$c(c[o+1]))}function fd(a,b,c,d,e){function f(a){return c?c[a]:null}function g(a,c,d){Uc(a,c,d,e),Nd(a,"change",a,b)}var h=b.from,i=b.to,j=b.text,k=kd(a,h.line),l=kd(a,i.line),m=Vd(j),n=f(j.length-1),o=i.line-h.line;if(0==h.ch&&0==i.ch&&""==m){for(var p=0,q=j.length-1,r=[];q>p;++p)r.push(new nf(j[p],f(p),e));g(l,l.text,n),o&&a.remove(h.line,o),r.length&&a.insert(h.line,r)}else if(k==l)if(1==j.length)g(k,k.text.slice(0,h.ch)+m+k.text.slice(i.ch),n);else{for(var r=[],p=1,q=j.length-1;q>p;++p)r.push(new nf(j[p],f(p),e));r.push(new nf(m+k.text.slice(i.ch),n,e)),g(k,k.text.slice(0,h.ch)+j[0],f(0)),a.insert(h.line+1,r)}else if(1==j.length)g(k,k.text.slice(0,h.ch)+j[0]+l.text.slice(i.ch),f(0)),a.remove(h.line+1,o);else{g(k,k.text.slice(0,h.ch)+j[0],f(0)),g(l,m+l.text.slice(i.ch),n);for(var p=1,q=j.length-1,r=[];q>p;++p)r.push(new nf(j[p],f(p),e));o>1&&a.remove(h.line+1,o-1),a.insert(h.line+1,r)}Nd(a,"change",a,b),ac(a,d.anchor,d.head,null,!0)}function gd(a){this.lines=a,this.parent=null;for(var b=0,c=a.length,d=0;c>b;++b)a[b].parent=this,d+=a[b].height;this.height=d}function hd(a){this.children=a;for(var b=0,c=0,d=0,e=a.length;e>d;++d){var f=a[d];b+=f.chunkSize(),c+=f.height,f.parent=this}this.size=b,this.height=c,this.parent=null}function id(a,b,c){function d(a,e,f){if(a.linked)for(var g=0;g<a.linked.length;++g){var h=a.linked[g];if(h.doc!=e){var i=f&&h.sharedHist;(!c||i)&&(b(h.doc,i),d(h.doc,a,i))}}}d(a,null,!0)}function jd(a,b){if(b.cm)throw new Error("This document is already in use.");a.doc=b,b.cm=a,f(a),c(a),a.options.lineWrapping||l(a),a.options.mode=b.modeOption,ib(a)}function kd(a,b){for(b-=a.first;!a.lines;)for(var c=0;;++c){var d=a.children[c],e=d.chunkSize();if(e>b){a=d;break}b-=e}return a.lines[b]}function ld(a,b,c){var d=[],e=b.line;return a.iter(b.line,c.line+1,function(a){var f=a.text;e==c.line&&(f=f.slice(0,c.ch)),e==b.line&&(f=f.slice(b.ch)),d.push(f),++e}),d}function md(a,b,c){var d=[];return a.iter(b,c,function(a){d.push(a.text)}),d}function nd(a,b){for(var c=b-a.height,d=a;d;d=d.parent)d.height+=c}function od(a){if(null==a.parent)return null;for(var b=a.parent,c=Xd(b.lines,a),d=b.parent;d;b=d,d=d.parent)for(var e=0;d.children[e]!=b;++e)c+=d.children[e].chunkSize();return c+b.first
3
- }function pd(a,b){var c=a.first;a:do{for(var d=0,e=a.children.length;e>d;++d){var f=a.children[d],g=f.height;if(g>b){a=f;continue a}b-=g,c+=f.chunkSize()}return c}while(!a.lines);for(var d=0,e=a.lines.length;e>d;++d){var h=a.lines[d],i=h.height;if(i>b)break;b-=i}return c+d}function qd(a,b){b=Mc(a.doc,b);for(var c=0,d=b.parent,e=0;e<d.lines.length;++e){var f=d.lines[e];if(f==b)break;c+=f.height}for(var g=d.parent;g;d=g,g=d.parent)for(var e=0;e<g.children.length;++e){var h=g.children[e];if(h==d)break;c+=h.height}return c}function rd(a){var b=a.order;return null==b&&(b=a.order=Jf(a.text)),b}function sd(a){return{done:[],undone:[],undoDepth:1/0,lastTime:0,lastOp:null,lastOrigin:null,generation:a||1,maxGeneration:a||1}}function td(a,b,c,d){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,c),Math.min(a.first+a.size,d),function(c){c.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=c.markedSpans),++f})}function ud(a,b){var c={line:b.from.line,ch:b.from.ch},d={from:c,to:af(b),text:ld(a,b.from,b.to)};return td(a,d,b.from.line,b.to.line+1),id(a,function(a){td(a,d,b.from.line,b.to.line+1)},!0),d}function vd(a,b,c,d){var e=a.history;e.undone.length=0;var f=+new Date,g=Vd(e.done);if(g&&(e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastTime>f-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))){var h=Vd(g.changes);Tb(b.from,b.to)&&Tb(b.from,h.to)?h.to=af(b):g.changes.push(ud(a,b)),g.anchorAfter=c.anchor,g.headAfter=c.head}else for(g={changes:[ud(a,b)],generation:e.generation,anchorBefore:a.sel.anchor,headBefore:a.sel.head,anchorAfter:c.anchor,headAfter:c.head},e.done.push(g),e.generation=++e.maxGeneration;e.done.length>e.undoDepth;)e.done.shift();e.lastTime=f,e.lastOp=d,e.lastOrigin=b.origin}function wd(a){if(!a)return null;for(var b,c=0;c<a.length;++c)a[c].marker.explicitlyCleared?b||(b=a.slice(0,c)):b&&b.push(a[c]);return b?b.length?b:null:a}function xd(a,b){var c=b["spans_"+a.id];if(!c)return null;for(var d=0,e=[];d<b.text.length;++d)e.push(wd(c[d]));return e}function yd(a,b){for(var c=0,d=[];c<a.length;++c){var e=a[c],f=e.changes,g=[];d.push({changes:g,anchorBefore:e.anchorBefore,headBefore:e.headBefore,anchorAfter:e.anchorAfter,headAfter:e.headAfter});for(var h=0;h<f.length;++h){var i,j=f[h];if(g.push({from:j.from,to:j.to,text:j.text}),b)for(var k in j)(i=k.match(/^spans_(\d+)$/))&&Xd(b,Number(i[1]))>-1&&(Vd(g)[k]=j[k],delete j[k])}}return d}function zd(a,b,c,d){c<a.line?a.line+=d:b<a.line&&(a.line=b,a.ch=0)}function Ad(a,b,c,d){for(var e=0;e<a.length;++e){for(var f=a[e],g=!0,h=0;h<f.changes.length;++h){var i=f.changes[h];if(f.copied||(i.from=Vb(i.from),i.to=Vb(i.to)),c<i.from.line)i.from.line+=d,i.to.line+=d;else if(b<=i.to.line){g=!1;break}}f.copied||(f.anchorBefore=Vb(f.anchorBefore),f.headBefore=Vb(f.headBefore),f.anchorAfter=Vb(f.anchorAfter),f.readAfter=Vb(f.headAfter),f.copied=!0),g?(zd(f.anchorBefore),zd(f.headBefore),zd(f.anchorAfter),zd(f.headAfter)):(a.splice(0,e+1),e=0)}}function Bd(a,b){var c=b.from.line,d=b.to.line,e=b.text.length-(d-c)-1;Ad(a.done,c,d,e),Ad(a.undone,c,d,e)}function Cd(){Hd(this)}function Dd(a){return a.stop||(a.stop=Cd),a}function Ed(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function Fd(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function Gd(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function Hd(a){Ed(a),Fd(a)}function Id(a){return a.target||a.srcElement}function Jd(a){var b=a.which;return null==b&&(1&a.button?b=1:2&a.button?b=3:4&a.button&&(b=2)),Le&&a.ctrlKey&&1==b&&(b=3),b}function Kd(a,b,c){if(a.addEventListener)a.addEventListener(b,c,!1);else if(a.attachEvent)a.attachEvent("on"+b,c);else{var d=a._handlers||(a._handlers={}),e=d[b]||(d[b]=[]);e.push(c)}}function Ld(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);else{var d=a._handlers&&a._handlers[b];if(!d)return;for(var e=0;e<d.length;++e)if(d[e]==c){d.splice(e,1);break}}}function Md(a,b){var c=a._handlers&&a._handlers[b];if(c)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,d)}function Nd(a,b){function c(a){return function(){a.apply(null,e)}}var d=a._handlers&&a._handlers[b];if(d){var e=Array.prototype.slice.call(arguments,2);uf||(++vf,uf=[],setTimeout(Pd,0));for(var f=0;f<d.length;++f)uf.push(c(d[f]))}}function Od(a,b,c){return Md(a,c||b.type,a,b),Gd(b)||b.codemirrorIgnore}function Pd(){--vf;var a=uf;uf=null;for(var b=0;b<a.length;++b)a[b]()}function Qd(a,b){var c=a._handlers&&a._handlers[b];return c&&c.length>0}function Rd(a){a.prototype.on=function(a,b){Kd(this,a,b)},a.prototype.off=function(a,b){Ld(this,a,b)}}function Sd(){this.id=null}function Td(a,b,c,d,e){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));for(var f=d||0,g=e||0;b>f;++f)" "==a.charAt(f)?g+=c-g%c:++g;return g}function Ud(a){for(;yf.length<=a;)yf.push(Vd(yf)+" ");return yf[a]}function Vd(a){return a[a.length-1]}function Wd(a){if(Je)a.selectionStart=0,a.selectionEnd=a.value.length;else try{a.select()}catch(b){}}function Xd(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0,d=a.length;d>c;++c)if(a[c]==b)return c;return-1}function Yd(a,b){function c(){}c.prototype=a;var d=new c;return b&&Zd(b,d),d}function Zd(a,b){b||(b={});for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function $d(a){for(var b=[],c=0;a>c;++c)b.push(void 0);return b}function _d(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function ae(a){return/\w/.test(a)||a>"€"&&(a.toUpperCase()!=a.toLowerCase()||zf.test(a))}function be(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function ce(a,b,c,d){var e=document.createElement(a);if(c&&(e.className=c),d&&(e.style.cssText=d),"string"==typeof b)fe(e,b);else if(b)for(var f=0;f<b.length;++f)e.appendChild(b[f]);return e}function de(a){for(var b=a.childNodes.length;b>0;--b)a.removeChild(a.firstChild);return a}function ee(a,b){return de(a).appendChild(b)}function fe(a,b){ze?(a.innerHTML="",a.appendChild(document.createTextNode(b))):a.textContent=b}function ge(a){return a.getBoundingClientRect()}function he(){return!1}function ie(a){if(null!=Cf)return Cf;var b=ce("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return ee(a,b),b.offsetWidth&&(Cf=b.offsetHeight-b.clientHeight),Cf||0}function je(a){if(null==Df){var b=ce("span","​");ee(a,ce("span",[b,document.createTextNode("x")])),0!=a.firstChild.offsetHeight&&(Df=b.offsetWidth<=1&&b.offsetHeight>2&&!ye)}return Df?ce("span","​"):ce("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function ke(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=!1,f=0;f<a.length;++f){var g=a[f];(g.from<c&&g.to>b||b==c&&g.to==b)&&(d(Math.max(g.from,b),Math.min(g.to,c),1==g.level?"rtl":"ltr"),e=!0)}e||d(b,c,"ltr")}function le(a){return a.level%2?a.to:a.from}function me(a){return a.level%2?a.from:a.to}function ne(a){var b=rd(a);return b?le(b[0]):0}function oe(a){var b=rd(a);return b?me(Vd(b)):a.text.length}function pe(a,b){var c=kd(a.doc,b),d=Mc(a.doc,c);d!=c&&(b=od(d));var e=rd(d),f=e?e[0].level%2?oe(d):ne(d):0;return Sb(b,f)}function qe(a,b){for(var c,d;c=Lc(d=kd(a.doc,b));)b=c.find().to.line;var e=rd(d),f=e?e[0].level%2?ne(d):oe(d):d.text.length;return Sb(b,f)}function re(a,b,c){var d=a[0].level;return b==d?!0:c==d?!1:c>b}function se(a,b){for(var c,d=0;d<a.length;++d){var e=a[d];if(e.from<b&&e.to>b)return If=null,d;if(e.from==b||e.to==b){if(null!=c)return re(a,e.level,a[c].level)?(If=c,d):(If=d,c);c=d}}return If=null,c}function te(a,b,c,d){if(!d)return b+c;do b+=c;while(b>0&&Af.test(a.text.charAt(b)));return b}function ue(a,b,c,d){var e=rd(a);if(!e)return ve(a,b,c,d);for(var f=se(e,b),g=e[f],h=te(a,b,g.level%2?-c:c,d);;){if(h>g.from&&h<g.to)return h;if(h==g.from||h==g.to)return se(e,h)==f?h:(g=e[f+=c],c>0==g.level%2?g.to:g.from);if(g=e[f+=c],!g)return null;h=c>0==g.level%2?te(a,g.to,-1,d):te(a,g.from,1,d)}}function ve(a,b,c,d){var e=b+c;if(d)for(;e>0&&Af.test(a.text.charAt(e));)e+=c;return 0>e||e>a.text.length?null:e}var we=/gecko\/\d/i.test(navigator.userAgent),xe=/MSIE \d/.test(navigator.userAgent),ye=xe&&(null==document.documentMode||document.documentMode<8),ze=xe&&(null==document.documentMode||document.documentMode<9),Ae=/WebKit\//.test(navigator.userAgent),Be=Ae&&/Qt\/\d+\.\d+/.test(navigator.userAgent),Ce=/Chrome\//.test(navigator.userAgent),De=/Opera\//.test(navigator.userAgent),Ee=/Apple Computer/.test(navigator.vendor),Fe=/KHTML\//.test(navigator.userAgent),Ge=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),He=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),Ie=/PhantomJS/.test(navigator.userAgent),Je=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),Ke=Je||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),Le=Je||/Mac/.test(navigator.platform),Me=/windows/i.test(navigator.platform),Ne=De&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);Ne&&(Ne=Number(Ne[1])),Ne&&Ne>=15&&(De=!1,Ae=!0);var Oe,Pe,Qe,Re=Le&&(Be||De&&(null==Ne||12.11>Ne)),Se=we||xe&&!ze,Te=!1,Ue=!1,Ve=0,We=0,Xe=0,Ye=null;xe?Ye=-.53:we?Ye=15:Ce?Ye=-.7:Ee&&(Ye=-1/3);var Ze,$e,_e=null,af=a.changeEnd=function(a){return a.text?Sb(a.from.line+a.text.length-1,Vd(a.text).length+(1==a.text.length?a.from.ch:0)):a.to};a.Pos=Sb,a.prototype={constructor:a,focus:function(){window.focus(),nb(this),Fb(this),kb(this)},setOption:function(a,b){var c=this.options,d=c[a];(c[a]!=b||"mode"==a)&&(c[a]=b,bf.hasOwnProperty(a)&&fb(this,bf[a])(this,b,d))},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](a)},removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;c<b.length;++c)if(b[c]==a||"string"!=typeof b[c]&&b[c].name==a)return b.splice(c,1),!0},addOverlay:fb(null,function(b,c){var d=b.token?b:a.getMode(this.options,b);if(d.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:d,modeSpec:b,opaque:c&&c.opaque}),this.state.modeGen++,ib(this)}),removeOverlay:fb(null,function(a){for(var b=this.state.overlays,c=0;c<b.length;++c){var d=b[c].modeSpec;if(d==a||"string"==typeof a&&d.name==a)return b.splice(c,1),this.state.modeGen++,ib(this),void 0}}),indentLine:fb(null,function(a,b,c){"string"!=typeof b&&"number"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract"),Zb(this.doc,a)&&jc(this,a,b,c)}),indentSelection:fb(null,function(a){var b=this.doc.sel;if(Tb(b.from,b.to))return jc(this,b.from.line,a);for(var c=b.to.line-(b.to.ch?0:1),d=b.from.line;c>=d;++d)jc(this,d,a)}),getTokenAt:function(a,b){var c=this.doc;a=Xb(c,a);for(var d=J(this,a.line,b),e=this.doc.mode,f=kd(c,a.line),g=new wc(f.text,this.options.tabSize);g.pos<a.ch&&!g.eol();){g.start=g.pos;var h=e.token(g,d)}return{start:g.start,end:g.pos,string:g.current(),className:h||null,type:h||null,state:d}},getTokenTypeAt:function(a){a=Xb(this.doc,a);var b=Yc(this,kd(this.doc,a.line)),c=0,d=(b.length-1)/2,e=a.ch;if(0==e)return b[2];for(;;){var f=c+d>>1;if((f?b[2*f-1]:0)>=e)d=f;else{if(!(b[2*f+1]<e))return b[2*f+2];c=f+1}}},getModeAt:function(b){var c=this.doc.mode;return c.innerMode?a.innerMode(c,this.getTokenAt(b).state).mode:c},getHelper:function(a,b){if(jf.hasOwnProperty(b)){var c=jf[b],d=this.getModeAt(a);return d[b]&&c[d[b]]||d.helperType&&c[d.helperType]||c[d.name]}},getStateAfter:function(a,b){var c=this.doc;return a=Wb(c,null==a?c.first+c.size-1:a),J(this,a+1,b)},cursorCoords:function(a,b){var c,d=this.doc.sel;return c=null==a?d.head:"object"==typeof a?Xb(this.doc,a):a?d.from:d.to,Z(this,c,b||"page")},charCoords:function(a,b){return Y(this,Xb(this.doc,a),b||"page")},coordsChar:function(a,b){return a=X(this,a,b||"page"),_(this,a.left,a.top)},lineAtHeight:function(a,b){return a=X(this,{top:a,left:0},b||"page").top,pd(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b){var c=!1,d=this.doc.first+this.doc.size-1;a<this.doc.first?a=this.doc.first:a>d&&(a=d,c=!0);var e=kd(this.doc,a);return W(this,kd(this.doc,a),{top:0,left:0},b||"page").top+(c?e.height:0)},defaultTextHeight:function(){return bb(this.display)},defaultCharWidth:function(){return cb(this.display)},setGutterMarker:fb(null,function(a,b,c){return kc(this,a,function(a){var d=a.gutterMarkers||(a.gutterMarkers={});return d[b]=c,!c&&be(d)&&(a.gutterMarkers=null),!0})}),clearGutter:fb(null,function(a){var b=this,c=b.doc,d=c.first;c.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&(c.gutterMarkers[a]=null,ib(b,d,d+1),be(c.gutterMarkers)&&(c.gutterMarkers=null)),++d})}),addLineClass:fb(null,function(a,b,c){return kc(this,a,function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"wrapClass";if(a[d]){if(new RegExp("(?:^|\\s)"+c+"(?:$|\\s)").test(a[d]))return!1;a[d]+=" "+c}else a[d]=c;return!0})}),removeLineClass:fb(null,function(a,b,c){return kc(this,a,function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"wrapClass",e=a[d];if(!e)return!1;if(null==c)a[d]=null;else{var f=e.match(new RegExp("(?:^|\\s+)"+c+"(?:$|\\s+)"));if(!f)return!1;var g=f.index+f[0].length;a[d]=e.slice(0,f.index)+(f.index&&g!=e.length?" ":"")+e.slice(g)||null}return!0})}),addLineWidget:fb(null,function(a,b,c){return Tc(this,a,b,c)}),removeLineWidget:function(a){a.clear()},lineInfo:function(a){if("number"==typeof a){if(!Zb(this.doc,a))return null;var b=a;if(a=kd(this.doc,a),!a)return null}else{var b=od(a);if(null==b)return null}return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},getViewport:function(){return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=Z(this,Xb(this.doc,a));var g=a.bottom,h=a.left;if(b.style.position="absolute",f.sizer.appendChild(b),"over"==d)g=a.top;else if("above"==d||"near"==d){var i=Math.max(f.wrapper.clientHeight,this.doc.height),j=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);("above"==d||a.bottom+b.offsetHeight>i)&&a.top>b.offsetHeight?g=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=i&&(g=a.bottom),h+b.offsetWidth>j&&(h=j-b.offsetWidth)}b.style.top=g+"px",b.style.left=b.style.right="","right"==e?(h=f.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==e?h=0:"middle"==e&&(h=(f.sizer.clientWidth-b.offsetWidth)/2),b.style.left=h+"px"),c&&fc(this,h,g,h+b.offsetWidth,g+b.offsetHeight)},triggerOnKeyDown:fb(null,Db),execCommand:function(a){return kf[a](this)},findPosH:function(a,b,c,d){var e=1;0>b&&(e=-1,b=-b);for(var f=0,g=Xb(this.doc,a);b>f&&(g=lc(this.doc,g,e,c,d),!g.hitSide);++f);return g},moveH:fb(null,function(a,b){var c,d=this.doc.sel;c=d.shift||d.extend||Tb(d.from,d.to)?lc(this.doc,d.head,a,b,this.options.rtlMoveVisually):0>a?d.from:d.to,$b(this.doc,c,c,a)}),deleteH:fb(null,function(a,b){var c=this.doc.sel;Tb(c.from,c.to)?Rb(this.doc,"",c.from,lc(this.doc,c.head,a,b,!1),"+delete"):Rb(this.doc,"",c.from,c.to,"+delete"),this.curOp.userSelChange=!0}),findPosV:function(a,b,c,d){var e=1,f=d;0>b&&(e=-1,b=-b);for(var g=0,h=Xb(this.doc,a);b>g;++g){var i=Z(this,h,"div");if(null==f?f=i.left:i.left=f,h=mc(this,i,e,c),h.hitSide)break}return h},moveV:fb(null,function(a,b){var c=this.doc.sel,d=Z(this,c.head,"div");null!=c.goalColumn&&(d.left=c.goalColumn);var e=mc(this,d,a,b);"page"==b&&ic(this,0,Y(this,e,"div").top-d.top),$b(this.doc,e,e,a),c.goalColumn=d.left}),toggleOverwrite:function(a){(null==a||a!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?this.display.cursor.className+=" CodeMirror-overwrite":this.display.cursor.className=this.display.cursor.className.replace(" CodeMirror-overwrite",""))},hasFocus:function(){return this.state.focused},scrollTo:fb(null,function(a,b){hc(this,a,b)}),getScrollInfo:function(){var a=this.display.scroller,b=wf;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-b,width:a.scrollWidth-b,clientHeight:a.clientHeight-b,clientWidth:a.clientWidth-b}},scrollIntoView:fb(null,function(a,b){"number"==typeof a&&(a=Sb(a,0)),b||(b=0);var c=a;a&&null==a.line||(this.curOp.scrollToPos=a?Xb(this.doc,a):this.doc.sel.head,this.curOp.scrollToPosMargin=b,c=Z(this,this.curOp.scrollToPos));var d=gc(this,c.left,c.top-b,c.right,c.bottom+b);hc(this,d.scrollLeft,d.scrollTop)}),setSize:fb(null,function(a,b){function c(a){return"number"==typeof a||/^\d+$/.test(String(a))?a+"px":a}null!=a&&(this.display.wrapper.style.width=c(a)),null!=b&&(this.display.wrapper.style.height=c(b)),this.options.lineWrapping&&(this.display.measureLineCache.length=this.display.measureLineCachePos=0),this.curOp.forceUpdate=!0}),operation:function(a){return hb(this,a)},refresh:fb(null,function(){T(this),hc(this,this.doc.scrollLeft,this.doc.scrollTop),ib(this)}),swapDoc:fb(null,function(a){var b=this.doc;return b.cm=null,jd(this,a),T(this),mb(this,!0),hc(this,a.scrollLeft,a.scrollTop),b}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Rd(a);var bf=a.optionHandlers={},cf=a.defaults={},df=a.Init={toString:function(){return"CodeMirror.Init"}};pc("value","",function(a,b){a.setValue(b)},!0),pc("mode",null,function(a,b){a.doc.modeOption=b,c(a)},!0),pc("indentUnit",2,c,!0),pc("indentWithTabs",!1),pc("smartIndent",!0),pc("tabSize",4,function(a){c(a),T(a),ib(a)},!0),pc("electricChars",!0),pc("rtlMoveVisually",!Me),pc("theme","default",function(a){h(a),i(a)},!0),pc("keyMap","default",g),pc("extraKeys",null),pc("onKeyEvent",null),pc("onDragEvent",null),pc("lineWrapping",!1,d,!0),pc("gutters",[],function(a){m(a.options),i(a)},!0),pc("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?s(a.display)+"px":"0",a.refresh()},!0),pc("coverGutterNextToScrollbar",!1,n,!0),pc("lineNumbers",!1,function(a){m(a.options),i(a)},!0),pc("firstLineNumber",1,i,!0),pc("lineNumberFormatter",function(a){return a},i,!0),pc("showCursorWhenSelecting",!1,C,!0),pc("readOnly",!1,function(a,b){"nocursor"==b?(Gb(a),a.display.input.blur()):b||mb(a,!0)}),pc("dragDrop",!0),pc("cursorBlinkRate",530),pc("cursorScrollMargin",0),pc("cursorHeight",1),pc("workTime",100),pc("workDelay",100),pc("flattenSpans",!0),pc("pollInterval",100),pc("undoDepth",40,function(a,b){a.doc.history.undoDepth=b}),pc("historyEventDelay",500),pc("viewportMargin",10,function(a){a.refresh()},!0),pc("maxHighlightLength",1e4,function(a){c(a),a.refresh()},!0),pc("moveInputWithCursor",!0,function(a,b){b||(a.display.inputDiv.style.top=a.display.inputDiv.style.left=0)}),pc("tabindex",null,function(a,b){a.display.input.tabIndex=b||""}),pc("autofocus",null);var ef=a.modes={},ff=a.mimeModes={};a.defineMode=function(b,c){if(a.defaults.mode||"null"==b||(a.defaults.mode=b),arguments.length>2){c.dependencies=[];for(var d=2;d<arguments.length;++d)c.dependencies.push(arguments[d])}ef[b]=c},a.defineMIME=function(a,b){ff[a]=b},a.resolveMode=function(b){if("string"==typeof b&&ff.hasOwnProperty(b))b=ff[b];else if(b&&"string"==typeof b.name&&ff.hasOwnProperty(b.name)){var c=ff[b.name];b=Yd(c,b),b.name=c.name}else if("string"==typeof b&&/^[\w\-]+\/[\w\-]+\+xml$/.test(b))return a.resolveMode("application/xml");return"string"==typeof b?{name:b}:b||{name:"null"}},a.getMode=function(b,c){var c=a.resolveMode(c),d=ef[c.name];if(!d)return a.getMode(b,"text/plain");var e=d(b,c);if(gf.hasOwnProperty(c.name)){var f=gf[c.name];for(var g in f)f.hasOwnProperty(g)&&(e.hasOwnProperty(g)&&(e["_"+g]=e[g]),e[g]=f[g])}return e.name=c.name,e},a.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}}),a.defineMIME("text/plain","null");var gf=a.modeExtensions={};a.extendMode=function(a,b){var c=gf.hasOwnProperty(a)?gf[a]:gf[a]={};Zd(b,c)},a.defineExtension=function(b,c){a.prototype[b]=c},a.defineDocExtension=function(a,b){rf.prototype[a]=b},a.defineOption=pc;var hf=[];a.defineInitHook=function(a){hf.push(a)};var jf=a.helpers={};a.registerHelper=function(b,c,d){jf.hasOwnProperty(b)||(jf[b]=a[b]={}),jf[b][c]=d},a.isWordChar=ae,a.copyState=qc,a.startState=rc,a.innerMode=function(a,b){for(;a.innerMode;){var c=a.innerMode(b);if(!c||c.mode==a)break;b=c.state,a=c.mode}return c||{mode:a,state:b}};var kf=a.commands={selectAll:function(a){a.setSelection(Sb(a.firstLine(),0),Sb(a.lastLine()))},killLine:function(a){var b=a.getCursor(!0),c=a.getCursor(!1),d=!Tb(b,c);d||a.getLine(b.line).length!=b.ch?a.replaceRange("",b,d?c:Sb(b.line),"+delete"):a.replaceRange("",b,Sb(b.line+1,0),"+delete")},deleteLine:function(a){var b=a.getCursor().line;a.replaceRange("",Sb(b,0),Sb(b),"+delete")},delLineLeft:function(a){var b=a.getCursor();a.replaceRange("",Sb(b.line,0),b,"+delete")},undo:function(a){a.undo()},redo:function(a){a.redo()},goDocStart:function(a){a.extendSelection(Sb(a.firstLine(),0))},goDocEnd:function(a){a.extendSelection(Sb(a.lastLine()))},goLineStart:function(a){a.extendSelection(pe(a,a.getCursor().line))},goLineStartSmart:function(a){var b=a.getCursor(),c=pe(a,b.line),d=a.getLineHandle(c.line),e=rd(d);if(e&&0!=e[0].level)a.extendSelection(c);else{var f=Math.max(0,d.text.search(/\S/)),g=b.line==c.line&&b.ch<=f&&b.ch;a.extendSelection(Sb(c.line,g?0:f))}},goLineEnd:function(a){a.extendSelection(qe(a,a.getCursor().line))},goLineRight:function(a){var b=a.charCoords(a.getCursor(),"div").top+5;a.extendSelection(a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:b},"div"))},goLineLeft:function(a){var b=a.charCoords(a.getCursor(),"div").top+5;a.extendSelection(a.coordsChar({left:0,top:b},"div"))},goLineUp:function(a){a.moveV(-1,"line")},goLineDown:function(a){a.moveV(1,"line")},goPageUp:function(a){a.moveV(-1,"page")},goPageDown:function(a){a.moveV(1,"page")},goCharLeft:function(a){a.moveH(-1,"char")},goCharRight:function(a){a.moveH(1,"char")},goColumnLeft:function(a){a.moveH(-1,"column")},goColumnRight:function(a){a.moveH(1,"column")},goWordLeft:function(a){a.moveH(-1,"word")},goGroupRight:function(a){a.moveH(1,"group")},goGroupLeft:function(a){a.moveH(-1,"group")},goWordRight:function(a){a.moveH(1,"word")},delCharBefore:function(a){a.deleteH(-1,"char")},delCharAfter:function(a){a.deleteH(1,"char")},delWordBefore:function(a){a.deleteH(-1,"word")},delWordAfter:function(a){a.deleteH(1,"word")},delGroupBefore:function(a){a.deleteH(-1,"group")},delGroupAfter:function(a){a.deleteH(1,"group")},indentAuto:function(a){a.indentSelection("smart")},indentMore:function(a){a.indentSelection("add")},indentLess:function(a){a.indentSelection("subtract")},insertTab:function(a){a.replaceSelection(" ","end","+input")},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.replaceSelection(" ","end","+input")},transposeChars:function(a){var b=a.getCursor(),c=a.getLine(b.line);b.ch>0&&b.ch<c.length-1&&a.replaceRange(c.charAt(b.ch)+c.charAt(b.ch-1),Sb(b.line,b.ch-1),Sb(b.line,b.ch+1))},newlineAndIndent:function(a){fb(a,function(){a.replaceSelection("\n","end","+input"),a.indentLine(a.getCursor().line,null,!0)})()},toggleOverwrite:function(a){a.toggleOverwrite()}},lf=a.keyMap={};lf.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite"},lf.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Alt-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","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",fallthrough:"basic"},lf.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","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":"delLineLeft",fallthrough:["basic","emacsy"]},lf["default"]=Le?lf.macDefault:lf.pcDefault,lf.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"},a.lookupKey=tc,a.isModifierKey=uc,a.keyName=vc,a.fromTextArea=function(b,c){function d(){b.value=j.getValue()}if(c||(c={}),c.value=b.value,!c.tabindex&&b.tabindex&&(c.tabindex=b.tabindex),!c.placeholder&&b.placeholder&&(c.placeholder=b.placeholder),null==c.autofocus){var e=document.body;try{e=document.activeElement}catch(f){}c.autofocus=e==b||null!=b.getAttribute("autofocus")&&e==document.body}if(b.form&&(Kd(b.form,"submit",d),!c.leaveSubmitMethodAlone)){var g=b.form,h=g.submit;try{var i=g.submit=function(){d(),g.submit=h,g.submit(),g.submit=i}}catch(f){}}b.style.display="none";var j=a(function(a){b.parentNode.insertBefore(a,b.nextSibling)},c);return j.save=d,j.getTextArea=function(){return b},j.toTextArea=function(){d(),b.parentNode.removeChild(j.getWrapperElement()),b.style.display="",b.form&&(Ld(b.form,"submit",d),"function"==typeof b.form.submit&&(b.form.submit=h))},j},wc.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return 0==this.pos},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},eat:function(a){var b=this.string.charAt(this.pos);if("string"==typeof a)var c=b==a;else var c=b&&(a.test?a.test(b):a(b));return c?(++this.pos,b):void 0},eatWhile:function(a){for(var b=this.pos;this.eat(a););return this.pos>b},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){var b=this.string.indexOf(a,this.pos);return b>-1?(this.pos=b,!0):void 0},backUp:function(a){this.pos-=a},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Td(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue},indentation:function(){return Td(this.string,null,this.tabSize)},match:function(a,b,c){if("string"!=typeof a){var d=this.string.slice(this.pos).match(a);return d&&d.index>0?null:(d&&b!==!1&&(this.pos+=d[0].length),d)}var e=function(a){return c?a.toLowerCase():a},f=this.string.substr(this.pos,a.length);return e(f)==e(a)?(b!==!1&&(this.pos+=a.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)}},a.StringStream=wc,a.TextMarker=xc,Rd(xc),xc.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;if(b&&db(a),Qd(this,"clear")){var c=this.find();c&&Nd(this,"clear",c.from,c.to)}for(var d=null,e=null,f=0;f<this.lines.length;++f){var g=this.lines[f],h=Bc(g.markedSpans,this);null!=h.to&&(e=od(g)),g.markedSpans=Cc(g.markedSpans,h),null!=h.from?d=od(g):this.collapsed&&!Nc(this.doc,g)&&a&&nd(g,bb(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(var f=0;f<this.lines.length;++f){var i=Mc(a.doc,this.lines[f]),j=k(a.doc,i);j>a.display.maxLineLength&&(a.display.maxLine=i,a.display.maxLineLength=j,a.display.maxLineChanged=!0)}null!=d&&a&&ib(a,d,e+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&bc(a)),b&&eb(a)}},xc.prototype.find=function(){for(var a,b,c=0;c<this.lines.length;++c){var d=this.lines[c],e=Bc(d.markedSpans,this);if(null!=e.from||null!=e.to){var f=od(d);null!=e.from&&(a=Sb(f,e.from)),null!=e.to&&(b=Sb(f,e.to))}}return"bookmark"==this.type?a:a&&{from:a,to:b}},xc.prototype.changed=function(){var a=this.find(),b=this.doc.cm;if(a&&b){var c=kd(this.doc,a.from.line);if(P(b,c),a.from.line>=b.display.showingFrom&&a.from.line<b.display.showingTo){for(var d=b.display.lineDiv.firstChild;d;d=d.nextSibling)if(d.lineObj==c){d.offsetHeight!=c.height&&nd(c,d.offsetHeight);break}hb(b,function(){b.curOp.selectionChanged=b.curOp.forceUpdate=b.curOp.updateMaxLine=!0})}}},xc.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&-1!=Xd(b.maybeHiddenMarkers,this)||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)},xc.prototype.detachLine=function(a){if(this.lines.splice(Xd(this.lines,a),1),!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;(b.maybeHiddenMarkers||(b.maybeHiddenMarkers=[])).push(this)}},a.SharedTextMarker=zc,Rd(zc),zc.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();Nd(this,"clear")}},zc.prototype.find=function(){return this.primary.find()};var mf=a.LineWidget=function(a,b,c){if(c)for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);this.cm=a,this.node=b};Rd(mf),mf.prototype.clear=Rc(function(){var a=this.line.widgets,b=od(this.line);if(null!=b&&a){for(var c=0;c<a.length;++c)a[c]==this&&a.splice(c--,1);a.length||(this.line.widgets=null);var d=qd(this.cm,this.line)<this.cm.doc.scrollTop;nd(this.line,Math.max(0,this.line.height-Sc(this))),d&&ic(this.cm,0,-this.height),ib(this.cm,b,b+1)}}),mf.prototype.changed=Rc(function(){var a=this.height;this.height=null;var b=Sc(this)-a;if(b){nd(this.line,this.line.height+b);var c=od(this.line);ib(this.cm,c,c+1)}});var nf=a.Line=function(a,b,c){this.text=a,Qc(this,b),this.height=c?c(this):1};Rd(nf);var of={},pf=/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\uFEFF]/g;gd.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var c=a,d=a+b;d>c;++c){var e=this.lines[c];this.height-=e.height,Vc(e),Nd(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.splice.apply(a,[a.length,0].concat(this.lines))},insertInner:function(a,b,c){this.height+=c,this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));for(var d=0,e=b.length;e>d;++d)b[d].parent=this},iterN:function(a,b,c){for(var d=a+b;d>a;++a)if(c(this.lines[a]))return!0}},hd.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){this.size-=b;for(var c=0;c<this.children.length;++c){var d=this.children[c],e=d.chunkSize();if(e>a){var f=Math.min(b,e-a),g=d.height;if(d.removeInner(a,f),this.height-=g-d.height,e==f&&(this.children.splice(c--,1),d.parent=null),0==(b-=f))break;a=0}else a-=e}if(this.size-b<25){var h=[];this.collapse(h),this.children=[new gd(h)],this.children[0].parent=this}},collapse:function(a){for(var b=0,c=this.children.length;c>b;++b)this.children[b].collapse(a)},insertInner:function(a,b,c){this.size+=b.length,this.height+=c;for(var d=0,e=this.children.length;e>d;++d){var f=this.children[d],g=f.chunkSize();if(g>=a){if(f.insertInner(a,b,c),f.lines&&f.lines.length>50){for(;f.lines.length>50;){var h=f.lines.splice(f.lines.length-25,25),i=new gd(h);f.height-=i.height,this.children.splice(d+1,0,i),i.parent=this}this.maybeSpill()}break}a-=g}},maybeSpill:function(){if(!(this.children.length<=10)){var a=this;do{var b=a.children.splice(a.children.length-5,5),c=new hd(b);if(a.parent){a.size-=c.size,a.height-=c.height;var d=Xd(a.parent.children,a);a.parent.children.splice(d+1,0,c)}else{var e=new hd(a.children);e.parent=a,a.children=[e,c],a=e}c.parent=a.parent}while(a.children.length>10);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=0,e=this.children.length;e>d;++d){var f=this.children[d],g=f.chunkSize();
4
- if(g>a){var h=Math.min(b,g-a);if(f.iterN(a,h,c))return!0;if(0==(b-=h))break;a=0}else a-=g}}};var qf=0,rf=a.Doc=function(a,b,c){if(!(this instanceof rf))return new rf(a,b,c);null==c&&(c=0),hd.call(this,[new gd([new nf("",null)])]),this.first=c,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.history=sd(),this.cleanGeneration=1,this.frontier=c;var d=Sb(c,0);this.sel={from:d,to:d,head:d,anchor:d,shift:!1,extend:!1,goalColumn:null},this.id=++qf,this.modeOption=b,"string"==typeof a&&(a=Ef(a)),fd(this,{from:d,to:d,text:a},null,{head:d,anchor:d})};rf.prototype=Yd(hd.prototype,{constructor:rf,iter:function(a,b,c){c?this.iterN(a-this.first,b-a,c):this.iterN(this.first,this.first+this.size,a)},insert:function(a,b){for(var c=0,d=0,e=b.length;e>d;++d)c+=b[d].height;this.insertInner(a-this.first,b,c)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a){var b=md(this,this.first,this.first+this.size);return a===!1?b:b.join(a||"\n")},setValue:function(a){var b=Sb(this.first,0),c=this.first+this.size-1;Lb(this,{from:b,to:Sb(c,kd(this,c).text.length),text:Ef(a),origin:"setValue"},{head:b,anchor:b},!0)},replaceRange:function(a,b,c,d){b=Xb(this,b),c=c?Xb(this,c):b,Rb(this,a,b,c,d)},getRange:function(a,b,c){var d=ld(this,Xb(this,a),Xb(this,b));return c===!1?d:d.join(c||"\n")},getLine:function(a){var b=this.getLineHandle(a);return b&&b.text},setLine:function(a,b){Zb(this,a)&&Rb(this,b,Sb(a,0),Xb(this,Sb(a)))},removeLine:function(a){a?Rb(this,"",Xb(this,Sb(a-1)),Xb(this,Sb(a))):Rb(this,"",Sb(0,0),Xb(this,Sb(1,0)))},getLineHandle:function(a){return Zb(this,a)?kd(this,a):void 0},getLineNumber:function(a){return od(a)},getLineHandleVisualStart:function(a){return"number"==typeof a&&(a=kd(this,a)),Mc(this,a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return Xb(this,a)},getCursor:function(a){var b,c=this.sel;return b=null==a||"head"==a?c.head:"anchor"==a?c.anchor:"end"==a||a===!1?c.to:c.from,Vb(b)},somethingSelected:function(){return!Tb(this.sel.head,this.sel.anchor)},setCursor:gb(function(a,b,c){var d=Xb(this,"number"==typeof a?Sb(a,b||0):a);c?$b(this,d):ac(this,d,d)}),setSelection:gb(function(a,b){ac(this,Xb(this,a),Xb(this,b||a))}),extendSelection:gb(function(a,b){$b(this,Xb(this,a),b&&Xb(this,b))}),getSelection:function(a){return this.getRange(this.sel.from,this.sel.to,a)},replaceSelection:function(a,b,c){Lb(this,{from:this.sel.from,to:this.sel.to,text:Ef(a),origin:c},b||"around")},undo:gb(function(){Nb(this,"undo")}),redo:gb(function(){Nb(this,"redo")}),setExtending:function(a){this.sel.extend=a},historySize:function(){var a=this.history;return{undo:a.done.length,redo:a.undone.length}},clearHistory:function(){this.history=sd(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration()},changeGeneration:function(){return this.history.lastOp=this.history.lastOrigin=null,this.history.generation},isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},getHistory:function(){return{done:yd(this.history.done),undone:yd(this.history.undone)}},setHistory:function(a){var b=this.history=sd(this.history.maxGeneration);b.done=a.done.slice(0),b.undone=a.undone.slice(0)},markText:function(a,b,c){return yc(this,Xb(this,a),Xb(this,b),c,"range")},setBookmark:function(a,b){var c={replacedWith:b&&(null==b.nodeType?b.widget:b),insertLeft:b&&b.insertLeft};return a=Xb(this,a),yc(this,a,a,c,"bookmark")},findMarksAt:function(a){a=Xb(this,a);var b=[],c=kd(this,a.line).markedSpans;if(c)for(var d=0;d<c.length;++d){var e=c[d];(null==e.from||e.from<=a.ch)&&(null==e.to||e.to>=a.ch)&&b.push(e.marker.parent||e.marker)}return b},getAllMarks:function(){var a=[];return this.iter(function(b){var c=b.markedSpans;if(c)for(var d=0;d<c.length;++d)null!=c[d].from&&a.push(c[d].marker)}),a},posFromIndex:function(a){var b,c=this.first;return this.iter(function(d){var e=d.text.length+1;return e>a?(b=a,!0):(a-=e,++c,void 0)}),Xb(this,Sb(c,b))},indexFromPos:function(a){a=Xb(this,a);var b=a.ch;return a.line<this.first||a.ch<0?0:(this.iter(this.first,a.line,function(a){b+=a.text.length+1}),b)},copy:function(a){var b=new rf(md(this,this.first,this.first+this.size),this.modeOption,this.first);return b.scrollTop=this.scrollTop,b.scrollLeft=this.scrollLeft,b.sel={from:this.sel.from,to:this.sel.to,head:this.sel.head,anchor:this.sel.anchor,shift:this.sel.shift,extend:!1,goalColumn:this.sel.goalColumn},a&&(b.history.undoDepth=this.history.undoDepth,b.setHistory(this.getHistory())),b},linkedDoc:function(a){a||(a={});var b=this.first,c=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from),null!=a.to&&a.to<c&&(c=a.to);var d=new rf(md(this,b,c),a.mode||this.modeOption,b);return a.sharedHist&&(d.history=this.history),(this.linked||(this.linked=[])).push({doc:d,sharedHist:a.sharedHist}),d.linked=[{doc:this,isParent:!0,sharedHist:a.sharedHist}],d},unlinkDoc:function(b){if(b instanceof a&&(b=b.doc),this.linked)for(var c=0;c<this.linked.length;++c){var d=this.linked[c];if(d.doc==b){this.linked.splice(c,1),b.unlinkDoc(this);break}}if(b.history==this.history){var e=[b.id];id(b,function(a){e.push(a.id)},!0),b.history=sd(),b.history.done=yd(this.history.done,e),b.history.undone=yd(this.history.undone,e)}},iterLinkedDocs:function(a){id(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),rf.prototype.eachLine=rf.prototype.iter;var sf="iter insert remove copy getEditor".split(" ");for(var tf in rf.prototype)rf.prototype.hasOwnProperty(tf)&&Xd(sf,tf)<0&&(a.prototype[tf]=function(a){return function(){return a.apply(this.doc,arguments)}}(rf.prototype[tf]));Rd(rf),a.e_stop=Hd,a.e_preventDefault=Ed,a.e_stopPropagation=Fd;var uf,vf=0;a.on=Kd,a.off=Ld,a.signal=Md;var wf=30,xf=a.Pass={toString:function(){return"CodeMirror.Pass"}};Sd.prototype={set:function(a,b){clearTimeout(this.id),this.id=setTimeout(b,a)}},a.countColumn=Td;var yf=[""],zf=/[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Af=/[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\uA66F\uA670-\uA672\uA674-\uA67D\uA69F\udc00-\udfff]/;a.replaceGetRect=function(a){ge=a};var Bf=function(){if(ze)return!1;var a=ce("div");return"draggable"in a||"dragDrop"in a}();we?he=function(a,b){return 36==a.charCodeAt(b-1)&&39==a.charCodeAt(b)}:Ee&&!/Version\/([6-9]|\d\d)\b/.test(navigator.userAgent)?he=function(a,b){return/\-[^ \-?]|\?[^ !\'\"\),.\-\/:;\?\]\}]/.test(a.slice(b-1,b+1))}:Ae&&!/Chrome\/(?:29|[3-9]\d|\d\d\d)\./.test(navigator.userAgent)&&(he=function(a,b){if(b>1&&45==a.charCodeAt(b-1)){if(/\w/.test(a.charAt(b-2))&&/[^\-?\.]/.test(a.charAt(b)))return!0;if(b>2&&/[\d\.,]/.test(a.charAt(b-2))&&/[\d\.,]/.test(a.charAt(b)))return!1}return/[~!#%&*)=+}\]|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\^&*(_=+{[|><]|…[\w~`@#$%\^&*(_=+{[><]/.test(a.slice(b-1,b+1))});var Cf,Df,Ef=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;d>=b;){var e=a.indexOf("\n",b);-1==e&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");-1!=g?(c.push(f.slice(0,g)),b+=g+1):(c.push(f),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)};a.splitLines=Ef;var Ff=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){}return b&&b.parentElement()==a?0!=b.compareEndPoints("StartToEnd",b):!1},Gf=function(){var a=ce("div");return"oncopy"in a?!0:(a.setAttribute("oncopy","return;"),"function"==typeof a.oncopy)}(),Hf={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:";",91:"Mod",92:"Mod",93:"Mod",109:"-",107:"=",127:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};a.keyNames=Hf,function(){for(var a=0;10>a;a++)Hf[a+48]=String(a);for(var a=65;90>=a;a++)Hf[a]=String.fromCharCode(a);for(var a=1;12>=a;a++)Hf[a+111]=Hf[a+63235]="F"+a}();var If,Jf=function(){function a(a){return 255>=a?b.charAt(a):a>=1424&&1524>=a?"R":a>=1536&&1791>=a?c.charAt(a-1536):a>=1792&&2220>=a?"r":"L"}var b="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL",c="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr",d=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,e=/[stwN]/,f=/[LRr]/,g=/[Lb1n]/,h=/[1n]/,i="L";return function(b){if(!d.test(b))return!1;for(var c,j=b.length,k=[],l=0;j>l;++l)k.push(c=a(b.charCodeAt(l)));for(var l=0,m=i;j>l;++l){var c=k[l];"m"==c?k[l]=m:m=c}for(var l=0,n=i;j>l;++l){var c=k[l];"1"==c&&"r"==n?k[l]="n":f.test(c)&&(n=c,"r"==c&&(k[l]="R"))}for(var l=1,m=k[0];j-1>l;++l){var c=k[l];"+"==c&&"1"==m&&"1"==k[l+1]?k[l]="1":","!=c||m!=k[l+1]||"1"!=m&&"n"!=m||(k[l]=m),m=c}for(var l=0;j>l;++l){var c=k[l];if(","==c)k[l]="N";else if("%"==c){for(var o=l+1;j>o&&"%"==k[o];++o);for(var p=l&&"!"==k[l-1]||j-1>o&&"1"==k[o]?"1":"N",q=l;o>q;++q)k[q]=p;l=o-1}}for(var l=0,n=i;j>l;++l){var c=k[l];"L"==n&&"1"==c?k[l]="L":f.test(c)&&(n=c)}for(var l=0;j>l;++l)if(e.test(k[l])){for(var o=l+1;j>o&&e.test(k[o]);++o);for(var r="L"==(l?k[l-1]:i),s="L"==(j-1>o?k[o]:i),p=r||s?"L":"R",q=l;o>q;++q)k[q]=p;l=o-1}for(var t,u=[],l=0;j>l;)if(g.test(k[l])){var v=l;for(++l;j>l&&g.test(k[l]);++l);u.push({from:v,to:l,level:0})}else{var w=l,x=u.length;for(++l;j>l&&"L"!=k[l];++l);for(var q=w;l>q;)if(h.test(k[q])){q>w&&u.splice(x,0,{from:w,to:q,level:1});var y=q;for(++q;l>q&&h.test(k[q]);++q);u.splice(x,0,{from:y,to:q,level:2}),w=q}else++q;l>w&&u.splice(x,0,{from:w,to:l,level:1})}return 1==u[0].level&&(t=b.match(/^\s+/))&&(u[0].from=t[0].length,u.unshift({from:0,to:t[0].length,level:0})),1==Vd(u).level&&(t=b.match(/\s+$/))&&(Vd(u).to-=t[0].length,u.push({from:j-t[0].length,to:j,level:0})),u[0].level!=Vd(u).level&&u.push({from:j,to:j,level:u[0].level}),u}}();return a.version="3.15.0",a}(),CodeMirror.defineMode("clike",function(a,b){function c(a,b){var c=a.next();if(q[c]){var f=q[c](a,b);if(f!==!1)return f}if('"'==c||"'"==c)return b.tokenize=d(c),b.tokenize(a,b);if(/[\[\]{}\(\),;\:\.]/.test(c))return i=c,null;if(/\d/.test(c))return a.eatWhile(/[\w\.]/),"number";if("/"==c){if(a.eat("*"))return b.tokenize=e,e(a,b);if(a.eat("/"))return a.skipToEnd(),"comment"}if(s.test(c))return a.eatWhile(s),"operator";a.eatWhile(/[\w\$_]/);var g=a.current();return m.propertyIsEnumerable(g)?(o.propertyIsEnumerable(g)&&(i="newstatement"),"keyword"):n.propertyIsEnumerable(g)?(o.propertyIsEnumerable(g)&&(i="newstatement"),"builtin"):p.propertyIsEnumerable(g)?"atom":"variable"}function d(a){return function(b,c){for(var d,e=!1,f=!1;null!=(d=b.next());){if(d==a&&!e){f=!0;break}e=!e&&"\\"==d}return(f||!e&&!r)&&(c.tokenize=null),"string"}}function e(a,b){for(var c,d=!1;c=a.next();){if("/"==c&&d){b.tokenize=null;break}d="*"==c}return"comment"}function f(a,b,c,d,e){this.indented=a,this.column=b,this.type=c,this.align=d,this.prev=e}function g(a,b,c){var d=a.indented;return a.context&&"statement"==a.context.type&&(d=a.context.indented),a.context=new f(d,b,c,null,a.context)}function h(a){var b=a.context.type;return(")"==b||"]"==b||"}"==b)&&(a.indented=a.context.indented),a.context=a.context.prev}var i,j=a.indentUnit,k=b.statementIndentUnit||j,l=b.dontAlignCalls,m=b.keywords||{},n=b.builtin||{},o=b.blockKeywords||{},p=b.atoms||{},q=b.hooks||{},r=b.multiLineStrings,s=/[+\-*&%=<>!?|\/]/;return{startState:function(a){return{tokenize:null,context:new f((a||0)-j,0,"top",!1),indented:0,startOfLine:!0}},token:function(a,b){var d=b.context;if(a.sol()&&(null==d.align&&(d.align=!1),b.indented=a.indentation(),b.startOfLine=!0),a.eatSpace())return null;i=null;var e=(b.tokenize||c)(a,b);if("comment"==e||"meta"==e)return e;if(null==d.align&&(d.align=!0),";"!=i&&":"!=i&&","!=i||"statement"!=d.type)if("{"==i)g(b,a.column(),"}");else if("["==i)g(b,a.column(),"]");else if("("==i)g(b,a.column(),")");else if("}"==i){for(;"statement"==d.type;)d=h(b);for("}"==d.type&&(d=h(b));"statement"==d.type;)d=h(b)}else i==d.type?h(b):(("}"==d.type||"top"==d.type)&&";"!=i||"statement"==d.type&&"newstatement"==i)&&g(b,a.column(),"statement");else h(b);return b.startOfLine=!1,e},indent:function(a,b){if(a.tokenize!=c&&null!=a.tokenize)return CodeMirror.Pass;var d=a.context,e=b&&b.charAt(0);"statement"==d.type&&"}"==e&&(d=d.prev);var f=e==d.type;return"statement"==d.type?d.indented+("{"==e?0:k):!d.align||l&&")"==d.type?")"!=d.type||f?d.indented+(f?0:j):d.indented+k:d.column+(f?0:1)},electricChars:"{}",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",fold:"brace"}}),function(){function a(a){for(var b={},c=a.split(" "),d=0;d<c.length;++d)b[c[d]]=!0;return b}function b(a,c){if(!c.startOfLine)return!1;for(;;){if(!a.skipTo("\\")){a.skipToEnd(),c.tokenize=null;break}if(a.next(),a.eol()){c.tokenize=b;break}}return"meta"}function c(a,b){for(var c;null!=(c=a.next());)if('"'==c&&!a.eat('"')){b.tokenize=null;break}return"string"}function d(a,b){for(var c=0;c<a.length;++c)CodeMirror.defineMIME(a[c],b)}var e="auto if break int case long char register continue return default short do sizeof double static else struct entry switch extern typedef float union for unsigned goto while enum void const signed volatile";d(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:a(e),blockKeywords:a("case do else for if switch while struct"),atoms:a("null"),hooks:{"#":b}}),d(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:a(e+" asm dynamic_cast namespace reinterpret_cast try bool explicit new "+"static_cast typeid catch operator template typename class friend private "+"this using const_cast inline public throw virtual delete mutable protected "+"wchar_t"),blockKeywords:a("catch class do else finally for if struct switch try while"),atoms:a("true false null"),hooks:{"#":b}}),CodeMirror.defineMIME("text/x-java",{name:"clike",keywords:a("abstract assert boolean break byte case catch char class const continue default do double else enum extends final finally float for goto if implements import instanceof int interface long native new package private protected public return short static strictfp super switch synchronized this throw throws transient try void volatile while"),blockKeywords:a("catch class do else finally for if switch try while"),atoms:a("true false null"),hooks:{"@":function(a){return a.eatWhile(/[\w\$_]/),"meta"}}}),CodeMirror.defineMIME("text/x-csharp",{name:"clike",keywords:a("abstract as 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"),blockKeywords:a("catch class do else finally for foreach if struct switch try while"),builtin:a("Boolean Byte Char DateTime DateTimeOffset Decimal Double Guid Int16 Int32 Int64 Object SByte Single String TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),atoms:a("true false null"),hooks:{"@":function(a,b){return a.eat('"')?(b.tokenize=c,c(a,b)):(a.eatWhile(/[\w\$_]/),"meta")}}}),CodeMirror.defineMIME("text/x-scala",{name:"clike",keywords:a("abstract case catch class def do else extends false final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try trye type val var while with yield _ : = => <- <: <% >: # @ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq 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"),blockKeywords:a("catch class do else finally for forSome if match switch try while"),atoms:a("true false null"),hooks:{"@":function(a){return a.eatWhile(/[\w\$_]/),"meta"}}}),d(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:a("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4 sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadowconst attribute uniform varying break continue discard return for while do if else struct in out inout"),blockKeywords:a("for while do if else struct"),builtin:a("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 smootstep 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:a("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_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragColor 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"),hooks:{"#":b}})}(),function(){function a(a){for(var b={},c=a.split(" "),d=0;d<c.length;++d)b[c[d]]=!0;return b}function b(a){return function(b,c){return b.match(a)?c.tokenize=null:b.skipToEnd(),"string"}}var c={name:"clike",keywords:a("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"),blockKeywords:a("catch do else elseif for foreach if switch try while"),atoms:a("true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__"),builtin:a("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 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 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 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 echo print global static exit array empty eval isset unset die include require include_once require_once"),multiLineStrings:!0,hooks:{$:function(a){return a.eatWhile(/[\w\$_]/),"variable-2"},"<":function(a,c){return a.match(/<</)?(a.eatWhile(/[\w\.]/),c.tokenize=b(a.current().slice(3)),c.tokenize(a,c)):!1},"#":function(a){for(;!a.eol()&&!a.match("?>",!1);)a.next();return"comment"},"/":function(a){if(a.eat("/")){for(;!a.eol()&&!a.match("?>",!1);)a.next();return"comment"}return!1}}};CodeMirror.defineMode("php",function(a,b){function d(a,b){var c=b.curMode==f;if(a.sol()&&'"'!=b.pending&&(b.pending=null),c)return c&&null==b.php.tokenize&&a.match("?>")?(b.curMode=e,b.curState=b.html,"meta"):f.token(a,b.curState);if(a.match(/^<\?\w*/))return b.curMode=f,b.curState=b.php,"meta";if('"'==b.pending){for(;!a.eol()&&'"'!=a.next(););var d="string"}else if(b.pending&&a.pos<b.pending.end){a.pos=b.pending.end;var d=b.pending.style}else var d=e.token(a,b.curState);b.pending=null;var g=a.current(),h=g.search(/<\?/);return-1!=h&&(b.pending="string"==d&&/\"$/.test(g)&&!/\?>/.test(g)?'"':{end:a.pos,style:d},a.backUp(g.length-h)),d}var e=CodeMirror.getMode(a,"text/html"),f=CodeMirror.getMode(a,c);return{startState:function(){var a=CodeMirror.startState(e),c=CodeMirror.startState(f);return{html:a,php:c,curMode:b.startOpen?f:e,curState:b.startOpen?c:a,pending:null}},copyState:function(a){var b,c=a.html,d=CodeMirror.copyState(e,c),g=a.php,h=CodeMirror.copyState(f,g);return b=a.curMode==e?d:h,{html:d,php:h,curMode:a.curMode,curState:b,pending:a.pending}},token:d,indent:function(a,b){return a.curMode!=f&&/^\s*<\//.test(b)||a.curMode==f&&/^\?>/.test(b)?e.indent(a.html,b):a.curMode.indent(a.curState,b)},electricChars:"/{}:",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",innerMode:function(a){return{state:a.curState,mode:a.curMode}}}},"htmlmixed","clike"),CodeMirror.defineMIME("application/x-httpd-php","php"),CodeMirror.defineMIME("application/x-httpd-php-open",{name:"php",startOpen:!0}),CodeMirror.defineMIME("text/x-php",c)}(),function(){function a(a,c,d,e){if(this.atOccurrence=!1,this.doc=a,null==e&&"string"==typeof c&&(e=!1),d=d?a.clipPos(d):b(0,0),this.pos={from:d,to:d},"string"!=typeof c)c.global||(c=new RegExp(c.source,c.ignoreCase?"ig":"g")),this.matches=function(d,e){if(d){c.lastIndex=0;for(var f,g,h=a.getLine(e.line).slice(0,e.ch),i=0;;){c.lastIndex=i;var j=c.exec(h);if(!j)break;if(f=j,g=f.index,i=f.index+(f[0].length||1),i==h.length)break}var k=f&&f[0].length||0;k||(0==g&&0==h.length?f=void 0:g!=a.getLine(e.line).length&&k++)}else{c.lastIndex=e.ch;var h=a.getLine(e.line),f=c.exec(h),k=f&&f[0].length||0,g=f&&f.index;g+k==h.length||k||(k=1)}return f&&k?{from:b(e.line,g),to:b(e.line,g+k),match:f}:void 0};else{e&&(c=c.toLowerCase());var f=e?function(a){return a.toLowerCase()}:function(a){return a},g=c.split("\n");this.matches=1==g.length?c.length?function(d,e){var g,h=f(a.getLine(e.line)),i=c.length;return(d?e.ch>=i&&-1!=(g=h.lastIndexOf(c,e.ch-i)):-1!=(g=h.indexOf(c,e.ch)))?{from:b(e.line,g),to:b(e.line,g+i)}:void 0}:function(){}:function(c,d){var e=d.line,h=c?g.length-1:0,i=g[h],j=f(a.getLine(e)),k=c?j.indexOf(i)+i.length:j.lastIndexOf(i);if(!(c?k>=d.ch||k!=i.length:k<=d.ch||k!=j.length-i.length))for(;;){if(c?!e:e==a.lineCount()-1)return;if(j=f(a.getLine(e+=c?-1:1)),i=g[c?--h:++h],!(h>0&&h<g.length-1)){var l=c?j.lastIndexOf(i):j.indexOf(i)+i.length;if(c?l!=j.length-i.length:l!=i.length)return;var m=b(d.line,k),n=b(e,l);return{from:c?n:m,to:c?m:n}}if(j!=i)return}}}}var b=CodeMirror.Pos;a.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(a){function c(a){var c=b(a,0);return d.pos={from:c,to:c},d.atOccurrence=!1,!1}for(var d=this,e=this.doc.clipPos(a?this.pos.from:this.pos.to);;){if(this.pos=this.matches(a,e))return this.pos.from&&this.pos.to||console.log(this.matches,this.pos),this.atOccurrence=!0,this.pos.match||!0;if(a){if(!e.line)return c(0);e=b(e.line-1,this.doc.getLine(e.line-1).length)}else{var f=this.doc.lineCount();if(e.line==f-1)return c(f);e=b(e.line+1,0)}}},from:function(){return this.atOccurrence?this.pos.from:void 0
5
  },to:function(){return this.atOccurrence?this.pos.to:void 0},replace:function(a){if(this.atOccurrence){var c=CodeMirror.splitLines(a);this.doc.replaceRange(c,this.pos.from,this.pos.to),this.pos.to=b(this.pos.from.line+c.length-1,c[c.length-1].length+(1==c.length?this.pos.from.ch:0))}}},CodeMirror.defineExtension("getSearchCursor",function(b,c,d){return new a(this.doc,b,c,d)}),CodeMirror.defineDocExtension("getSearchCursor",function(b,c,d){return new a(this,b,c,d)})}(),function(){function a(a){return"string"==typeof a?{token:function(b){return b.match(a)?"searching":(b.next(),b.skipTo(a.charAt(0))||b.skipToEnd(),void 0)}}:{token:function(b){if(b.match(a))return"searching";for(;!b.eol()&&(b.next(),!b.match(a,!1)););}}}function b(){this.posFrom=this.posTo=this.query=null,this.overlay=null}function c(a){return a.state.search||(a.state.search=new b)}function d(a,b,c){return a.getSearchCursor(b,c,"string"==typeof b&&b==b.toLowerCase())}function e(a,b,c,d){a.openDialog?a.openDialog(b,d):d(prompt(c,""))}function f(a,b,c,d){a.openConfirm?a.openConfirm(b,d):confirm(c)&&d[0]()}function g(a){var b=a.match(/^\/(.*)\/([a-z]*)$/);return b?new RegExp(b[1],-1==b[2].indexOf("i")?"":"i"):a}function h(b,d){var f=c(b);return f.query?i(b,d):(e(b,l,"Search for:",function(c){b.operation(function(){c&&!f.query&&(f.query=g(c),b.removeOverlay(f.overlay),f.overlay=a(f.query),b.addOverlay(f.overlay),f.posFrom=f.posTo=b.getCursor(),i(b,d))})}),void 0)}function i(a,b){a.operation(function(){var e=c(a),f=d(a,e.query,b?e.posFrom:e.posTo);(f.find(b)||(f=d(a,e.query,b?CodeMirror.Pos(a.lastLine()):CodeMirror.Pos(a.firstLine(),0)),f.find(b)))&&(a.setSelection(f.from(),f.to()),e.posFrom=f.from(),e.posTo=f.to())})}function j(a){a.operation(function(){var b=c(a);b.query&&(b.query=null,a.removeOverlay(b.overlay))})}function k(a,b){e(a,m,"Replace:",function(c){c&&(c=g(c),e(a,n,"Replace with:",function(e){if(b)a.operation(function(){for(var b=d(a,c);b.findNext();)if("string"!=typeof c){var f=a.getRange(b.from(),b.to()).match(c);b.replace(e.replace(/\$(\d)/,function(a,b){return f[b]}))}else b.replace(e)});else{j(a);var g=d(a,c,a.getCursor()),h=function(){var b,e=g.from();!(b=g.findNext())&&(g=d(a,c),!(b=g.findNext())||e&&g.from().line==e.line&&g.from().ch==e.ch)||(a.setSelection(g.from(),g.to()),f(a,o,"Replace?",[function(){i(b)},h]))},i=function(a){g.replace("string"==typeof c?e:e.replace(/\$(\d)/,function(b,c){return a[c]})),h()};h()}}))})}var l='Search: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)</span>',m='Replace: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)</span>',n='With: <input type="text" style="width: 10em"/>',o="Replace? <button>Yes</button> <button>No</button> <button>Stop</button>";CodeMirror.commands.find=function(a){j(a),h(a)},CodeMirror.commands.findNext=h,CodeMirror.commands.findPrev=function(a){h(a,!0)},CodeMirror.commands.clearSearch=j,CodeMirror.commands.replace=k,CodeMirror.commands.replaceAll=function(a){k(a,!0)}}(),function(){function a(a,b,c){function d(b,c,d){if(b.text){var g=m?0:b.text.length-1,i=m?b.text.length:-1;if(b.text.length>h)return null;for(null!=d&&(g=d+n);g!=i;g+=n){var j=b.text.charAt(g);if(r.test(j)&&a.getTokenTypeAt(e(c,g+1))==p){var k=f[j];if(">"==k.charAt(1)==m)q.push(j);else{if(q.pop()!=k.charAt(0))return{pos:g,match:!1};if(!q.length)return{pos:g,match:!0}}}}}}var g=a.state.matchBrackets,h=g&&g.maxScanLineLength||1e4,i=b||a.getCursor(),j=a.getLineHandle(i.line),k=i.ch-1,l=k>=0&&f[j.text.charAt(k)]||f[j.text.charAt(++k)];if(!l)return null;var m=">"==l.charAt(1),n=m?1:-1;if(c&&m!=(k==i.ch))return null;for(var o,p=a.getTokenTypeAt(e(i.line,k+1)),q=[j.text.charAt(k)],r=/[(){}[\]]/,s=i.line,t=m?Math.min(s+100,a.lineCount()):Math.max(-1,s-100);s!=t&&!(o=s==i.line?d(j,s,k):d(a.getLineHandle(s),s));s+=n);return{from:e(i.line,k),to:o&&e(s,o.pos),match:o&&o.match,forward:m}}function b(b,c){var f=b.state.matchBrackets.maxHighlightLineLength||1e3,g=a(b);if(!(!g||b.getLine(g.from.line).length>f||g.to&&b.getLine(g.to.line).length>f)){var h=g.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",i=b.markText(g.from,e(g.from.line,g.from.ch+1),{className:h}),j=g.to&&b.markText(g.to,e(g.to.line,g.to.ch+1),{className:h});d&&b.state.focused&&b.display.input.focus();var k=function(){b.operation(function(){i.clear(),j&&j.clear()})};return c?(setTimeout(k,800),void 0):k}}function c(a){a.operation(function(){g&&(g(),g=null),a.somethingSelected()||(g=b(a,!1))})}var d=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),e=CodeMirror.Pos,f={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},g=null;CodeMirror.defineOption("matchBrackets",!1,function(a,b,d){d&&d!=CodeMirror.Init&&a.off("cursorActivity",c),b&&(a.state.matchBrackets="object"==typeof b?b:{},a.on("cursorActivity",c))}),CodeMirror.defineExtension("matchBrackets",function(){b(this,!0)}),CodeMirror.defineExtension("findMatchingBracket",function(b,c){return a(this,b,c)})}();
1
+ window.CodeMirror=function(){"use strict";function a(c,d){if(!(this instanceof a))return new a(c,d);this.options=d=d||{};for(var e in cf)!d.hasOwnProperty(e)&&cf.hasOwnProperty(e)&&(d[e]=cf[e]);m(d);var f="string"==typeof d.value?0:d.value.first,g=this.display=b(c,f);g.wrapper.CodeMirror=this,j(this),d.autofocus&&!Ke&&nb(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,draggingText:!1,highlight:new Sd},h(this),d.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");var i=d.value;"string"==typeof i&&(i=new rf(d.value,d.mode)),fb(this,jd)(this,i),xe&&setTimeout(_d(mb,this,!0),20),pb(this);var k;try{k=document.activeElement==g.input}catch(l){}k||d.autofocus&&!Ke?setTimeout(_d(Fb,this),20):Gb(this),fb(this,function(){for(var a in bf)bf.propertyIsEnumerable(a)&&bf[a](this,d[a],df);for(var b=0;b<hf.length;++b)hf[b](this)})()}function b(a,b){var c={},d=c.input=ce("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none; font-size: 4px;");return Ae?d.style.width="1000px":d.setAttribute("wrap","off"),Je&&(d.style.border="1px solid black"),d.setAttribute("autocorrect","off"),d.setAttribute("autocapitalize","off"),d.setAttribute("spellcheck","false"),c.inputDiv=ce("div",[d],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),c.scrollbarH=ce("div",[ce("div",null,null,"height: 1px")],"CodeMirror-hscrollbar"),c.scrollbarV=ce("div",[ce("div",null,null,"width: 1px")],"CodeMirror-vscrollbar"),c.scrollbarFiller=ce("div",null,"CodeMirror-scrollbar-filler"),c.gutterFiller=ce("div",null,"CodeMirror-gutter-filler"),c.lineDiv=ce("div",null,"CodeMirror-code"),c.selectionDiv=ce("div",null,null,"position: relative; z-index: 1"),c.cursor=ce("div"," ","CodeMirror-cursor"),c.otherCursor=ce("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"),c.measure=ce("div",null,"CodeMirror-measure"),c.lineSpace=ce("div",[c.measure,c.selectionDiv,c.lineDiv,c.cursor,c.otherCursor],null,"position: relative; outline: none"),c.mover=ce("div",[ce("div",[c.lineSpace],"CodeMirror-lines")],null,"position: relative"),c.sizer=ce("div",[c.mover],"CodeMirror-sizer"),c.heightForcer=ce("div",null,null,"position: absolute; height: "+wf+"px; width: 1px;"),c.gutters=ce("div",null,"CodeMirror-gutters"),c.lineGutter=null,c.scroller=ce("div",[c.sizer,c.heightForcer,c.gutters],"CodeMirror-scroll"),c.scroller.setAttribute("tabIndex","-1"),c.wrapper=ce("div",[c.inputDiv,c.scrollbarH,c.scrollbarV,c.scrollbarFiller,c.gutterFiller,c.scroller],"CodeMirror"),ye&&(c.gutters.style.zIndex=-1,c.scroller.style.paddingRight=0),a.appendChild?a.appendChild(c.wrapper):a(c.wrapper),Je&&(d.style.width="0px"),Ae||(c.scroller.draggable=!0),Fe?(c.inputDiv.style.height="1px",c.inputDiv.style.position="absolute"):ye&&(c.scrollbarH.style.minWidth=c.scrollbarV.style.minWidth="18px"),c.viewOffset=c.lastSizeC=0,c.showingFrom=c.showingTo=b,c.lineNumWidth=c.lineNumInnerWidth=c.lineNumChars=null,c.prevInput="",c.alignWidgets=!1,c.pollingFast=!1,c.poll=new Sd,c.cachedCharWidth=c.cachedTextHeight=null,c.measureLineCache=[],c.measureLineCachePos=0,c.inaccurateSelection=!1,c.maxLine=null,c.maxLineLength=0,c.maxLineChanged=!1,c.wheelDX=c.wheelDY=c.wheelStartX=c.wheelStartY=null,c}function c(b){b.doc.mode=a.getMode(b.options,b.doc.modeOption),b.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null)}),b.doc.frontier=b.doc.first,G(b,100),b.state.modeGen++,b.curOp&&ib(b)}function d(a){a.options.lineWrapping?(a.display.wrapper.className+=" CodeMirror-wrap",a.display.sizer.style.minWidth=""):(a.display.wrapper.className=a.display.wrapper.className.replace(" CodeMirror-wrap",""),l(a)),f(a),ib(a),T(a),setTimeout(function(){n(a)},100)}function e(a){var b=bb(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/cb(a.display)-3);return function(e){return Nc(a.doc,e)?0:c?(Math.ceil(e.text.length/d)||1)*b:b}}function f(a){var b=a.doc,c=e(a);b.iter(function(a){var b=c(a);b!=a.height&&nd(a,b)})}function g(a){var b=lf[a.options.keyMap],c=b.style;a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(c?" cm-keymap-"+c:""),a.state.disableInput=b.disableInput}function h(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-"),T(a)}function i(a){j(a),ib(a),setTimeout(function(){p(a)},20)}function j(a){var b=a.display.gutters,c=a.options.gutters;de(b);for(var d=0;d<c.length;++d){var e=c[d],f=b.appendChild(ce("div",null,"CodeMirror-gutter "+e));"CodeMirror-linenumbers"==e&&(a.display.lineGutter=f,f.style.width=(a.display.lineNumWidth||1)+"px")}b.style.display=d?"":"none"}function k(a,b){if(0==b.height)return 0;for(var c,d=b.text.length,e=b;c=Kc(e);){var f=c.find();e=kd(a,f.from.line),d+=f.from.ch-f.to.ch}for(e=b;c=Lc(e);){var f=c.find();d-=e.text.length-f.from.ch,e=kd(a,f.to.line),d+=e.text.length-f.to.ch}return d}function l(a){var b=a.display,c=a.doc;b.maxLine=kd(c,c.first),b.maxLineLength=k(c,b.maxLine),b.maxLineChanged=!0,c.iter(function(a){var d=k(c,a);d>b.maxLineLength&&(b.maxLineLength=d,b.maxLine=a)})}function m(a){for(var b=!1,c=0;c<a.gutters.length;++c)"CodeMirror-linenumbers"==a.gutters[c]&&(a.lineNumbers?b=!0:a.gutters.splice(c--,1));!b&&a.lineNumbers&&a.gutters.push("CodeMirror-linenumbers")}function n(a){var b=a.display,c=a.doc.height,d=c+L(b);b.sizer.style.minHeight=b.heightForcer.style.top=d+"px",b.gutters.style.height=Math.max(d,b.scroller.clientHeight-wf)+"px";var e=Math.max(d,b.scroller.scrollHeight),f=b.scroller.scrollWidth>b.scroller.clientWidth+1,g=e>b.scroller.clientHeight+1;g?(b.scrollbarV.style.display="block",b.scrollbarV.style.bottom=f?ie(b.measure)+"px":"0",b.scrollbarV.firstChild.style.height=e-b.scroller.clientHeight+b.scrollbarV.clientHeight+"px"):b.scrollbarV.style.display="",f?(b.scrollbarH.style.display="block",b.scrollbarH.style.right=g?ie(b.measure)+"px":"0",b.scrollbarH.firstChild.style.width=b.scroller.scrollWidth-b.scroller.clientWidth+b.scrollbarH.clientWidth+"px"):b.scrollbarH.style.display="",f&&g?(b.scrollbarFiller.style.display="block",b.scrollbarFiller.style.height=b.scrollbarFiller.style.width=ie(b.measure)+"px"):b.scrollbarFiller.style.display="",f&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(b.gutterFiller.style.display="block",b.gutterFiller.style.height=ie(b.measure)+"px",b.gutterFiller.style.width=b.gutters.offsetWidth+"px"):b.gutterFiller.style.display="",Ge&&0===ie(b.measure)&&(b.scrollbarV.style.minWidth=b.scrollbarH.style.minHeight=He?"18px":"12px")}function o(a,b,c){var d=a.scroller.scrollTop,e=a.wrapper.clientHeight;"number"==typeof c?d=c:c&&(d=c.top,e=c.bottom-c.top),d=Math.floor(d-K(a));var f=Math.ceil(d+e);return{from:pd(b,d),to:pd(b,f)}}function p(a){var b=a.display;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var c=s(b)-b.scroller.scrollLeft+a.doc.scrollLeft,d=b.gutters.offsetWidth,e=c+"px",f=b.lineDiv.firstChild;f;f=f.nextSibling)if(f.alignable)for(var g=0,h=f.alignable;g<h.length;++g)h[g].style.left=e;a.options.fixedGutter&&(b.gutters.style.left=c+d+"px")}}function q(a){if(!a.options.lineNumbers)return!1;var b=a.doc,c=r(a.options,b.first+b.size-1),d=a.display;if(c.length!=d.lineNumChars){var e=d.measure.appendChild(ce("div",[ce("div",c)],"CodeMirror-linenumber CodeMirror-gutter-elt")),f=e.firstChild.offsetWidth,g=e.offsetWidth-f;return d.lineGutter.style.width="",d.lineNumInnerWidth=Math.max(f,d.lineGutter.offsetWidth-g),d.lineNumWidth=d.lineNumInnerWidth+g,d.lineNumChars=d.lineNumInnerWidth?c.length:-1,d.lineGutter.style.width=d.lineNumWidth+"px",!0}return!1}function r(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function s(a){return ge(a.scroller).left-ge(a.sizer).left}function t(a,b,c,d){for(var e,f=a.display.showingFrom,g=a.display.showingTo,h=o(a.display,a.doc,c);u(a,b,h,d)&&(d=!1,e=!0,C(a),n(a),c&&(c=Math.min(a.display.scroller.scrollHeight-a.display.scroller.clientHeight,"number"==typeof c?c:c.top)),h=o(a.display,a.doc,c),!(h.from>=a.display.showingFrom&&h.to<=a.display.showingTo));)b=[];return e&&(Nd(a,"update",a),(a.display.showingFrom!=f||a.display.showingTo!=g)&&Nd(a,"viewportChange",a,a.display.showingFrom,a.display.showingTo)),e}function u(a,b,c,d){var e=a.display,f=a.doc;if(!e.wrapper.clientWidth)return e.showingFrom=e.showingTo=f.first,e.viewOffset=0,void 0;if(!(!d&&0==b.length&&c.from>e.showingFrom&&c.to<e.showingTo)){q(a)&&(b=[{from:f.first,to:f.first+f.size}]);var g=e.sizer.style.marginLeft=e.gutters.offsetWidth+"px";e.scrollbarH.style.left=a.options.fixedGutter?g:"0";var h=1/0;if(a.options.lineNumbers)for(var i=0;i<b.length;++i)if(b[i].diff){h=b[i].from;break}var j=f.first+f.size,k=Math.max(c.from-a.options.viewportMargin,f.first),l=Math.min(j,c.to+a.options.viewportMargin);if(e.showingFrom<k&&k-e.showingFrom<20&&(k=Math.max(f.first,e.showingFrom)),e.showingTo>l&&e.showingTo-l<20&&(l=Math.min(j,e.showingTo)),Ue)for(k=od(Mc(f,kd(f,k)));j>l&&Nc(f,kd(f,l));)++l;var m=[{from:Math.max(e.showingFrom,f.first),to:Math.min(e.showingTo,j)}];if(m=m[0].from>=m[0].to?[]:x(m,b),Ue)for(var i=0;i<m.length;++i)for(var n,o=m[i];n=Lc(kd(f,o.to-1));){var p=n.find().from.line;if(!(p>o.from)){m.splice(i--,1);break}o.to=p}for(var r=0,i=0;i<m.length;++i){var o=m[i];o.from<k&&(o.from=k),o.to>l&&(o.to=l),o.from>=o.to?m.splice(i--,1):r+=o.to-o.from}if(!d&&r==l-k&&k==e.showingFrom&&l==e.showingTo)return w(a),void 0;m.sort(function(a,b){return a.from-b.from});try{var s=document.activeElement}catch(t){}.7*(l-k)>r&&(e.lineDiv.style.display="none"),z(a,k,l,m,h),e.lineDiv.style.display="",s&&document.activeElement!=s&&s.offsetHeight&&s.focus();var u=k!=e.showingFrom||l!=e.showingTo||e.lastSizeC!=e.wrapper.clientHeight;return u&&(e.lastSizeC=e.wrapper.clientHeight,G(a,400)),e.showingFrom=k,e.showingTo=l,v(a),w(a),!0}}function v(a){for(var b,c=a.display,d=c.lineDiv.offsetTop,e=c.lineDiv.firstChild;e;e=e.nextSibling)if(e.lineObj){if(ye){var f=e.offsetTop+e.offsetHeight;b=f-d,d=f}else{var g=ge(e);b=g.bottom-g.top}var h=e.lineObj.height-b;if(2>b&&(b=bb(c)),h>.001||-.001>h){nd(e.lineObj,b);var i=e.lineObj.widgets;if(i)for(var j=0;j<i.length;++j)i[j].height=i[j].node.offsetHeight}}}function w(a){var b=a.display.viewOffset=qd(a,kd(a.doc,a.display.showingFrom));a.display.mover.style.top=b+"px"}function x(a,b){for(var c=0,d=b.length||0;d>c;++c){for(var e=b[c],f=[],g=e.diff||0,h=0,i=a.length;i>h;++h){var j=a[h];e.to<=j.from&&e.diff?f.push({from:j.from+g,to:j.to+g}):e.to<=j.from||e.from>=j.to?f.push(j):(e.from>j.from&&f.push({from:j.from,to:e.from}),e.to<j.to&&f.push({from:e.to+g,to:j.to+g}))}a=f}return a}function y(a){for(var b=a.display,c={},d={},e=b.gutters.firstChild,f=0;e;e=e.nextSibling,++f)c[a.options.gutters[f]]=e.offsetLeft,d[a.options.gutters[f]]=e.offsetWidth;return{fixedPos:s(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function z(a,b,c,d,e){function f(b){var c=b.nextSibling;return Ae&&Le&&a.display.currentWheelTarget==b?(b.style.display="none",b.lineObj=null):b.parentNode.removeChild(b),c}var g=y(a),h=a.display,i=a.options.lineNumbers;d.length||Ae&&a.display.currentWheelTarget||de(h.lineDiv);var j=h.lineDiv,k=j.firstChild,l=d.shift(),m=b;for(a.doc.iter(b,c,function(b){if(l&&l.to==m&&(l=d.shift()),Nc(a.doc,b)){if(0!=b.height&&nd(b,0),b.widgets&&k.previousSibling)for(var c=0;c<b.widgets.length;++c){var h=b.widgets[c];if(h.showIfHidden){var n=k.previousSibling;if(/pre/i.test(n.nodeName)){var o=ce("div",null,null,"position: relative");n.parentNode.replaceChild(o,n),o.appendChild(n),n=o}var p=n.appendChild(ce("div",[h.node],"CodeMirror-linewidget"));h.handleMouseEvents||(p.ignoreEvents=!0),B(h,p,n,g)}}}else if(l&&l.from<=m&&l.to>m){for(;k.lineObj!=b;)k=f(k);i&&m>=e&&k.lineNumber&&fe(k.lineNumber,r(a.options,m)),k=k.nextSibling}else{if(b.widgets)for(var q,s=0,t=k;t&&20>s;++s,t=t.nextSibling)if(t.lineObj==b&&/div/i.test(t.nodeName)){q=t;break}var u=A(a,b,m,g,q);if(u!=q)j.insertBefore(u,k);else{for(;k!=q;)k=f(k);k=k.nextSibling}u.lineObj=b}++m});k;)k=f(k)}function A(a,b,c,d,e){var f,g=_c(a,b),h=b.gutterMarkers,i=a.display;if(!(a.options.lineNumbers||h||b.bgClass||b.wrapClass||b.widgets))return g;if(e){e.alignable=null;for(var j,k=!0,l=0,m=null,n=e.firstChild;n;n=j)if(j=n.nextSibling,/\bCodeMirror-linewidget\b/.test(n.className)){for(var o=0;o<b.widgets.length;++o){var p=b.widgets[o];if(p.node==n.firstChild){p.above||m||(m=n),B(p,n,e,d),++l;break}}if(o==b.widgets.length){k=!1;break}}else e.removeChild(n);e.insertBefore(g,m),k&&l==b.widgets.length&&(f=e,e.className=b.wrapClass||"")}if(f||(f=ce("div",null,b.wrapClass,"position: relative"),f.appendChild(g)),b.bgClass&&f.insertBefore(ce("div",null,b.bgClass+" CodeMirror-linebackground"),f.firstChild),a.options.lineNumbers||h){var q=f.insertBefore(ce("div",null,null,"position: absolute; left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px"),f.firstChild);if(a.options.fixedGutter&&(f.alignable||(f.alignable=[])).push(q),!a.options.lineNumbers||h&&h["CodeMirror-linenumbers"]||(f.lineNumber=q.appendChild(ce("div",r(a.options,c),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+d.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+i.lineNumInnerWidth+"px"))),h)for(var s=0;s<a.options.gutters.length;++s){var t=a.options.gutters[s],u=h.hasOwnProperty(t)&&h[t];u&&q.appendChild(ce("div",[u],"CodeMirror-gutter-elt","left: "+d.gutterLeft[t]+"px; width: "+d.gutterWidth[t]+"px"))}}if(ye&&(f.style.zIndex=2),b.widgets&&f!=e)for(var o=0,v=b.widgets;o<v.length;++o){var p=v[o],w=ce("div",[p.node],"CodeMirror-linewidget");p.handleMouseEvents||(w.ignoreEvents=!0),B(p,w,f,d),p.above?f.insertBefore(w,a.options.lineNumbers&&0!=b.height?q:g):f.appendChild(w),Nd(p,"redraw")}return f}function B(a,b,c,d){if(a.noHScroll){(c.alignable||(c.alignable=[])).push(b);var e=d.wrapperWidth;b.style.left=d.fixedPos+"px",a.coverGutter||(e-=d.gutterTotalWidth,b.style.paddingLeft=d.gutterTotalWidth+"px"),b.style.width=e+"px"}a.coverGutter&&(b.style.zIndex=5,b.style.position="relative",a.noHScroll||(b.style.marginLeft=-d.gutterTotalWidth+"px"))}function C(a){var b=a.display,c=Tb(a.doc.sel.from,a.doc.sel.to);if(c||a.options.showCursorWhenSelecting?D(a):b.cursor.style.display=b.otherCursor.style.display="none",c?b.selectionDiv.style.display="none":E(a),a.options.moveInputWithCursor){var d=Z(a,a.doc.sel.head,"div"),e=ge(b.wrapper),f=ge(b.lineDiv);b.inputDiv.style.top=Math.max(0,Math.min(b.wrapper.clientHeight-10,d.top+f.top-e.top))+"px",b.inputDiv.style.left=Math.max(0,Math.min(b.wrapper.clientWidth-10,d.left+f.left-e.left))+"px"}}function D(a){var b=a.display,c=Z(a,a.doc.sel.head,"div");b.cursor.style.left=c.left+"px",b.cursor.style.top=c.top+"px",b.cursor.style.height=Math.max(0,c.bottom-c.top)*a.options.cursorHeight+"px",b.cursor.style.display="",c.other?(b.otherCursor.style.display="",b.otherCursor.style.left=c.other.left+"px",b.otherCursor.style.top=c.other.top+"px",b.otherCursor.style.height=.85*(c.other.bottom-c.other.top)+"px"):b.otherCursor.style.display="none"}function E(a){function b(a,b,c,d){0>b&&(b=0),g.appendChild(ce("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px; top: "+b+"px; width: "+(null==c?h-a:c)+"px; height: "+(d-b)+"px"))}function c(c,d,f){function g(b,d){return Y(a,Sb(c,b),"div",l,d)}var j,k,l=kd(e,c),m=l.text.length;return ke(rd(l),d||0,null==f?m:f,function(a,c,e){var l,n,o,p=g(a,"left");if(a==c)l=p,n=o=p.left;else{if(l=g(c-1,"right"),"rtl"==e){var q=p;p=l,l=q}n=p.left,o=l.right}null==d&&0==a&&(n=i),l.top-p.top>3&&(b(n,p.top,null,p.bottom),n=i,p.bottom<l.top&&b(n,p.bottom,null,l.top)),null==f&&c==m&&(o=h),(!j||p.top<j.top||p.top==j.top&&p.left<j.left)&&(j=p),(!k||l.bottom>k.bottom||l.bottom==k.bottom&&l.right>k.right)&&(k=l),i+1>n&&(n=i),b(n,l.top,o-n,l.bottom)}),{start:j,end:k}}var d=a.display,e=a.doc,f=a.doc.sel,g=document.createDocumentFragment(),h=d.lineSpace.offsetWidth,i=M(a.display);if(f.from.line==f.to.line)c(f.from.line,f.from.ch,f.to.ch);else{var j=kd(e,f.from.line),k=kd(e,f.to.line),l=Mc(e,j)==Mc(e,k),m=c(f.from.line,f.from.ch,l?j.text.length:null).end,n=c(f.to.line,l?0:null,f.to.ch).start;l&&(m.top<n.top-2?(b(m.right,m.top,null,m.bottom),b(i,n.top,n.left,n.bottom)):b(m.right,m.top,n.left-m.right,m.bottom)),m.bottom<n.top&&b(i,m.bottom,null,n.top)}ee(d.selectionDiv,g),d.selectionDiv.style.display=""}function F(a){if(a.state.focused){var b=a.display;clearInterval(b.blinker);var c=!0;b.cursor.style.visibility=b.otherCursor.style.visibility="",b.blinker=setInterval(function(){b.cursor.style.visibility=b.otherCursor.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate)}}function G(a,b){a.doc.mode.startState&&a.doc.frontier<a.display.showingTo&&a.state.highlight.set(b,_d(H,a))}function H(a){var b=a.doc;if(b.frontier<b.first&&(b.frontier=b.first),!(b.frontier>=a.display.showingTo)){var c,d=+new Date+a.options.workTime,e=qc(b.mode,J(a,b.frontier)),f=[];b.iter(b.frontier,Math.min(b.first+b.size,a.display.showingTo+500),function(g){if(b.frontier>=a.display.showingFrom){var h=g.styles;g.styles=Xc(a,g,e);for(var i=!h||h.length!=g.styles.length,j=0;!i&&j<h.length;++j)i=h[j]!=g.styles[j];i&&(c&&c.end==b.frontier?c.end++:f.push(c={start:b.frontier,end:b.frontier+1})),g.stateAfter=qc(b.mode,e)}else Zc(a,g,e),g.stateAfter=0==b.frontier%5?qc(b.mode,e):null;return++b.frontier,+new Date>d?(G(a,a.options.workDelay),!0):void 0}),f.length&&fb(a,function(){for(var a=0;a<f.length;++a)ib(this,f[a].start,f[a].end)})()}}function I(a,b,c){for(var d,e,f=a.doc,g=b,h=b-100;g>h;--g){if(g<=f.first)return f.first;var i=kd(f,g-1);if(i.stateAfter&&(!c||g<=f.frontier))return g;var j=Td(i.text,null,a.options.tabSize);(null==e||d>j)&&(e=g-1,d=j)}return e}function J(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return!0;var f=I(a,b,c),g=f>d.first&&kd(d,f-1).stateAfter;return g=g?qc(d.mode,g):rc(d.mode),d.iter(f,b,function(c){Zc(a,c,g);var h=f==b-1||0==f%5||f>=e.showingFrom&&f<e.showingTo;c.stateAfter=h?qc(d.mode,g):null,++f}),g}function K(a){return a.lineSpace.offsetTop}function L(a){return a.mover.offsetHeight-a.lineSpace.offsetHeight}function M(a){var b=ee(a.measure,ce("pre",null,null,"text-align: left")).appendChild(ce("span","x"));return b.offsetLeft}function N(a,b,c,d,e){var f=-1;d=d||Q(a,b);for(var g=c;;g+=f){var h=d[g];if(h)break;0>f&&0==g&&(f=1)}return e=g>c?"left":c>g?"right":e,"left"==e&&h.leftSide?h=h.leftSide:"right"==e&&h.rightSide&&(h=h.rightSide),{left:c>g?h.right:h.left,right:g>c?h.left:h.right,top:h.top,bottom:h.bottom}}function O(a,b){for(var c=a.display.measureLineCache,d=0;d<c.length;++d){var e=c[d];if(e.text==b.text&&e.markedSpans==b.markedSpans&&a.display.scroller.clientWidth==e.width&&e.classes==b.textClass+"|"+b.bgClass+"|"+b.wrapClass)return e}}function P(a,b){var c=O(a,b);c&&(c.text=c.measure=c.markedSpans=null)}function Q(a,b){var c=O(a,b);if(c)return c.measure;var d=R(a,b),e=a.display.measureLineCache,f={text:b.text,width:a.display.scroller.clientWidth,markedSpans:b.markedSpans,measure:d,classes:b.textClass+"|"+b.bgClass+"|"+b.wrapClass};return 16==e.length?e[++a.display.measureLineCachePos%16]=f:e.push(f),d}function R(a,b){function c(a){var b=a.top-o.top,c=a.bottom-o.top;c>r&&(c=r),0>b&&(b=0);for(var d=p.length-2;d>=0;d-=2){var e=p[d],f=p[d+1];if(!(e>c||b>f)&&(b>=e&&f>=c||e>=b&&c>=f||Math.min(c,f)-Math.max(b,e)>=c-b>>1)){p[d]=Math.min(b,e),p[d+1]=Math.max(c,f);break}}return 0>d&&(d=p.length,p.push(b,c)),{left:a.left-o.left,right:a.right-o.left,top:d,bottom:null}}function d(a){a.bottom=p[a.top+1],a.top=p[a.top]}var e=a.display,f=$d(b.text.length),g=_c(a,b,f,!0);if(xe&&!ye&&!a.options.lineWrapping&&g.childNodes.length>100){for(var h=document.createDocumentFragment(),i=10,j=g.childNodes.length,k=0,l=Math.ceil(j/i);l>k;++k){for(var m=ce("div",null,null,"display: inline-block"),n=0;i>n&&j;++n)m.appendChild(g.firstChild),--j;h.appendChild(m)}g.appendChild(h)}ee(e.measure,g);var o=ge(e.lineDiv),p=[],q=$d(b.text.length),r=g.offsetHeight;ze&&e.measure.first!=g&&ee(e.measure,g);for(var s,k=0;k<f.length;++k)if(s=f[k]){var t=s,u=null;if(/\bCodeMirror-widget\b/.test(s.className)&&s.getClientRects){1==s.firstChild.nodeType&&(t=s.firstChild);var v=t.getClientRects();v.length>1&&(u=q[k]=c(v[0]),u.rightSide=c(v[v.length-1]))}u||(u=q[k]=c(ge(t))),s.measureRight&&(u.right=ge(s.measureRight).left),s.leftSide&&(u.leftSide=c(ge(s.leftSide)))}for(var s,k=0;k<q.length;++k)(s=q[k])&&(d(s),s.leftSide&&d(s.leftSide),s.rightSide&&d(s.rightSide));return q}function S(a,b){var c=!1;if(b.markedSpans)for(var d=0;d<b.markedSpans;++d){var e=b.markedSpans[d];!e.collapsed||null!=e.to&&e.to!=b.text.length||(c=!0)}var f=!c&&O(a,b);if(f)return N(a,b,b.text.length,f.measure,"right").right;var g=_c(a,b,null,!0),h=g.appendChild(je(a.display.measure));return ee(a.display.measure,g),ge(h).right-ge(a.display.lineDiv).left}function T(a){a.display.measureLineCache.length=a.display.measureLineCachePos=0,a.display.cachedCharWidth=a.display.cachedTextHeight=null,a.options.lineWrapping||(a.display.maxLineChanged=!0),a.display.lineNumChars=null}function U(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function V(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function W(a,b,c,d){if(b.widgets)for(var e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f=Sc(b.widgets[e]);c.top+=f,c.bottom+=f}if("line"==d)return c;d||(d="local");var g=qd(a,b);if("local"==d?g+=K(a.display):g-=a.display.viewOffset,"page"==d||"window"==d){var h=ge(a.display.lineSpace);g+=h.top+("window"==d?0:V());var i=h.left+("window"==d?0:U());c.left+=i,c.right+=i}return c.top+=g,c.bottom+=g,c}function X(a,b,c){if("div"==c)return b;var d=b.left,e=b.top;if("page"==c)d-=U(),e-=V();else if("local"==c||!c){var f=ge(a.display.sizer);d+=f.left,e+=f.top}var g=ge(a.display.lineSpace);return{left:d-g.left,top:e-g.top}}function Y(a,b,c,d,e){return d||(d=kd(a.doc,b.line)),W(a,d,N(a,d,b.ch,null,e),c)}function Z(a,b,c,d,e){function f(b,f){var g=N(a,d,b,e,f?"right":"left");return f?g.left=g.right:g.right=g.left,W(a,d,g,c)}function g(a,b){var c=h[b],d=c.level%2;return a==le(c)&&b&&c.level<h[b-1].level?(c=h[--b],a=me(c)-(c.level%2?0:1),d=!0):a==me(c)&&b<h.length-1&&c.level<h[b+1].level&&(c=h[++b],a=le(c)-c.level%2,d=!1),d&&a==c.to&&a>c.from?f(a-1):f(a,d)}d=d||kd(a.doc,b.line),e||(e=Q(a,d));var h=rd(d),i=b.ch;if(!h)return f(i);var j=se(h,i),k=g(i,j);return null!=If&&(k.other=g(i,If)),k}function $(a,b,c,d){var e=new Sb(a,b);return e.xRel=d,c&&(e.outside=!0),e}function _(a,b,c){var d=a.doc;if(c+=a.display.viewOffset,0>c)return $(d.first,0,!0,-1);var e=pd(d,c),f=d.first+d.size-1;if(e>f)return $(d.first+d.size-1,kd(d,f).text.length,!0,1);for(0>b&&(b=0);;){var g=kd(d,e),h=ab(a,g,e,b,c),i=Lc(g),j=i&&i.find();if(!i||!(h.ch>j.from.ch||h.ch==j.from.ch&&h.xRel>0))return h;e=j.to.line}}function ab(a,b,c,d,e){function f(d){var e=Z(a,Sb(c,d),"line",b,j);return h=!0,g>e.bottom?e.left-i:g<e.top?e.left+i:(h=!1,e.left)}var g=e-qd(a,b),h=!1,i=2*a.display.wrapper.clientWidth,j=Q(a,b),k=rd(b),l=b.text.length,m=ne(b),n=oe(b),o=f(m),p=h,q=f(n),r=h;if(d>q)return $(c,n,r,1);for(;;){if(k?n==m||n==ue(b,m,1):1>=n-m){for(var s=o>d||q-d>=d-o?m:n,t=d-(s==m?o:q);Af.test(b.text.charAt(s));)++s;var u=$(c,s,s==m?p:r,0>t?-1:t?1:0);return u}var v=Math.ceil(l/2),w=m+v;if(k){w=m;for(var x=0;v>x;++x)w=ue(b,w,1)}var y=f(w);y>d?(n=w,q=y,(r=h)&&(q+=1e3),l=v):(m=w,o=y,p=h,l-=v)}}function bb(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==Oe){Oe=ce("pre");for(var b=0;49>b;++b)Oe.appendChild(document.createTextNode("x")),Oe.appendChild(ce("br"));Oe.appendChild(document.createTextNode("x"))}ee(a.measure,Oe);var c=Oe.offsetHeight/50;return c>3&&(a.cachedTextHeight=c),de(a.measure),c||1}function cb(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=ce("span","x"),c=ce("pre",[b]);ee(a.measure,c);var d=b.offsetWidth;return d>2&&(a.cachedCharWidth=d),d||10}function db(a){a.curOp={changes:[],forceUpdate:!1,updateInput:null,userSelChange:null,textChanged:null,selectionChanged:!1,cursorActivity:!1,updateMaxLine:!1,updateScrollPos:!1,id:++Ve},vf++||(uf=[])}function eb(a){var b=a.curOp,c=a.doc,d=a.display;if(a.curOp=null,b.updateMaxLine&&l(a),d.maxLineChanged&&!a.options.lineWrapping&&d.maxLine){var e=S(a,d.maxLine);d.sizer.style.minWidth=Math.max(0,e+3+wf)+"px",d.maxLineChanged=!1;var f=Math.max(0,d.sizer.offsetLeft+d.sizer.offsetWidth-d.scroller.clientWidth);f<c.scrollLeft&&!b.updateScrollPos&&xb(a,Math.min(d.scroller.scrollLeft,f),!0)}var g,h;if(b.updateScrollPos)g=b.updateScrollPos;else if(b.selectionChanged&&d.scroller.clientHeight){var i=Z(a,c.sel.head);g=gc(a,i.left,i.top,i.left,i.bottom)}(b.changes.length||b.forceUpdate||g&&null!=g.scrollTop)&&(h=t(a,b.changes,g&&g.scrollTop,b.forceUpdate),a.display.scroller.offsetHeight&&(a.doc.scrollTop=a.display.scroller.scrollTop)),!h&&b.selectionChanged&&C(a),b.updateScrollPos?(d.scroller.scrollTop=d.scrollbarV.scrollTop=c.scrollTop=g.scrollTop,d.scroller.scrollLeft=d.scrollbarH.scrollLeft=c.scrollLeft=g.scrollLeft,p(a),b.scrollToPos&&ec(a,Xb(a.doc,b.scrollToPos),b.scrollToPosMargin)):g&&dc(a),b.selectionChanged&&F(a),a.state.focused&&b.updateInput&&mb(a,b.userSelChange);var j=b.maybeHiddenMarkers,k=b.maybeUnhiddenMarkers;if(j)for(var m=0;m<j.length;++m)j[m].lines.length||Md(j[m],"hide");if(k)for(var m=0;m<k.length;++m)k[m].lines.length&&Md(k[m],"unhide");var n;if(--vf||(n=uf,uf=null),b.textChanged&&Md(a,"change",a,b.textChanged),b.cursorActivity&&Md(a,"cursorActivity",a),n)for(var m=0;m<n.length;++m)n[m]()}function fb(a,b){return function(){var c=a||this,d=!c.curOp;d&&db(c);try{var e=b.apply(c,arguments)}finally{d&&eb(c)}return e}}function gb(a){return function(){var b,c=this.cm&&!this.cm.curOp;c&&db(this.cm);try{b=a.apply(this,arguments)}finally{c&&eb(this.cm)}return b}}function hb(a,b){var c,d=!a.curOp;d&&db(a);try{c=b()}finally{d&&eb(a)}return c}function ib(a,b,c,d){null==b&&(b=a.doc.first),null==c&&(c=a.doc.first+a.doc.size),a.curOp.changes.push({from:b,to:c,diff:d})}function jb(a){a.display.pollingFast||a.display.poll.set(a.options.pollInterval,function(){lb(a),a.state.focused&&jb(a)})}function kb(a){function b(){var d=lb(a);d||c?(a.display.pollingFast=!1,jb(a)):(c=!0,a.display.poll.set(60,b))}var c=!1;a.display.pollingFast=!0,a.display.poll.set(20,b)}function lb(a){var b=a.display.input,c=a.display.prevInput,d=a.doc,e=d.sel;if(!a.state.focused||Ff(b)||ob(a)||a.state.disableInput)return!1;var f=b.value;if(f==c&&Tb(e.from,e.to))return!1;if(xe&&!ze&&a.display.inputHasSelection===f)return mb(a,!0),!1;var g=!a.curOp;g&&db(a),e.shift=!1;for(var h=0,i=Math.min(c.length,f.length);i>h&&c.charCodeAt(h)==f.charCodeAt(h);)++h;var j=e.from,k=e.to;h<c.length?j=Sb(j.line,j.ch-(c.length-h)):a.state.overwrite&&Tb(j,k)&&!a.state.pasteIncoming&&(k=Sb(k.line,Math.min(kd(d,k.line).text.length,k.ch+(f.length-h))));var l=a.curOp.updateInput,m={from:j,to:k,text:Ef(f.slice(h)),origin:a.state.pasteIncoming?"paste":"+input"};return Lb(a.doc,m,"end"),a.curOp.updateInput=l,Nd(a,"inputRead",a,m),f.length>1e3||f.indexOf("\n")>-1?b.value=a.display.prevInput="":a.display.prevInput=f,g&&eb(a),a.state.pasteIncoming=!1,!0}function mb(a,b){var c,d,e=a.doc;if(Tb(e.sel.from,e.sel.to))b&&(a.display.prevInput=a.display.input.value="",xe&&!ze&&(a.display.inputHasSelection=null));else{a.display.prevInput="",c=Gf&&(e.sel.to.line-e.sel.from.line>100||(d=a.getSelection()).length>1e3);var f=c?"-":d||a.getSelection();a.display.input.value=f,a.state.focused&&Wd(a.display.input),xe&&!ze&&(a.display.inputHasSelection=f)}a.display.inaccurateSelection=c}function nb(a){"nocursor"==a.options.readOnly||Ke&&document.activeElement==a.display.input||a.display.input.focus()}function ob(a){return a.options.readOnly||a.doc.cantEdit}function pb(a){function b(){a.state.focused&&setTimeout(_d(nb,a),0)}function c(){null==h&&(h=setTimeout(function(){h=null,g.cachedCharWidth=g.cachedTextHeight=Cf=null,T(a),hb(a,_d(ib,a))},100))}function d(){for(var a=g.wrapper.parentNode;a&&a!=document.body;a=a.parentNode);a?setTimeout(d,5e3):Ld(window,"resize",c)}function e(b){Od(a,b)||a.options.onDragEvent&&a.options.onDragEvent(a,Dd(b))||Hd(b)}function f(){g.inaccurateSelection&&(g.prevInput="",g.inaccurateSelection=!1,g.input.value=a.getSelection(),Wd(g.input))}var g=a.display;Kd(g.scroller,"mousedown",fb(a,sb)),xe?Kd(g.scroller,"dblclick",fb(a,function(b){if(!Od(a,b)){var c=rb(a,b);if(c&&!tb(a,b)&&!qb(a.display,b)){Ed(b);var d=nc(kd(a.doc,c.line).text,c);$b(a.doc,d.from,d.to)}}})):Kd(g.scroller,"dblclick",function(b){Od(a,b)||Ed(b)}),Kd(g.lineSpace,"selectstart",function(a){qb(g,a)||Ed(a)}),Se||Kd(g.scroller,"contextmenu",function(b){Hb(a,b)}),Kd(g.scroller,"scroll",function(){g.scroller.clientHeight&&(wb(a,g.scroller.scrollTop),xb(a,g.scroller.scrollLeft,!0),Md(a,"scroll",a))}),Kd(g.scrollbarV,"scroll",function(){g.scroller.clientHeight&&wb(a,g.scrollbarV.scrollTop)}),Kd(g.scrollbarH,"scroll",function(){g.scroller.clientHeight&&xb(a,g.scrollbarH.scrollLeft)}),Kd(g.scroller,"mousewheel",function(b){yb(a,b)}),Kd(g.scroller,"DOMMouseScroll",function(b){yb(a,b)}),Kd(g.scrollbarH,"mousedown",b),Kd(g.scrollbarV,"mousedown",b),Kd(g.wrapper,"scroll",function(){g.wrapper.scrollTop=g.wrapper.scrollLeft=0});var h;Kd(window,"resize",c),setTimeout(d,5e3),Kd(g.input,"keyup",fb(a,function(b){Od(a,b)||a.options.onKeyEvent&&a.options.onKeyEvent(a,Dd(b))||16==b.keyCode&&(a.doc.sel.shift=!1)})),Kd(g.input,"input",_d(kb,a)),Kd(g.input,"keydown",fb(a,Db)),Kd(g.input,"keypress",fb(a,Eb)),Kd(g.input,"focus",_d(Fb,a)),Kd(g.input,"blur",_d(Gb,a)),a.options.dragDrop&&(Kd(g.scroller,"dragstart",function(b){vb(a,b)}),Kd(g.scroller,"dragenter",e),Kd(g.scroller,"dragover",e),Kd(g.scroller,"drop",fb(a,ub))),Kd(g.scroller,"paste",function(b){qb(g,b)||(nb(a),kb(a))}),Kd(g.input,"paste",function(){a.state.pasteIncoming=!0,kb(a)}),Kd(g.input,"cut",f),Kd(g.input,"copy",f),Fe&&Kd(g.sizer,"mouseup",function(){document.activeElement==g.input&&g.input.blur(),nb(a)})}function qb(a,b){for(var c=Id(b);c!=a.wrapper;c=c.parentNode)if(!c||c.ignoreEvents||c.parentNode==a.sizer&&c!=a.mover)return!0}function rb(a,b,c){var d=a.display;if(!c){var e=Id(b);if(e==d.scrollbarH||e==d.scrollbarH.firstChild||e==d.scrollbarV||e==d.scrollbarV.firstChild||e==d.scrollbarFiller||e==d.gutterFiller)return null}var f,g,h=ge(d.lineSpace);try{f=b.clientX,g=b.clientY}catch(b){return null}return _(a,f-h.left,g-h.top)}function sb(a){function b(a){if(!Tb(r,a)){if(r=a,"single"==k)return $b(e.doc,Xb(g,i),a),void 0;if(p=Xb(g,p),q=Xb(g,q),"double"==k){var b=nc(kd(g,a.line).text,a);Ub(a,p)?$b(e.doc,b.from,q):$b(e.doc,p,b.to)}else"triple"==k&&(Ub(a,p)?$b(e.doc,q,Xb(g,Sb(a.line,0))):$b(e.doc,p,Xb(g,Sb(a.line+1,0))))}}function c(a){var d=++t,h=rb(e,a,!0);if(h)if(Tb(h,m)){var i=a.clientY<s.top?-20:a.clientY>s.bottom?20:0;i&&setTimeout(fb(e,function(){t==d&&(f.scroller.scrollTop+=i,c(a))}),50)}else{e.state.focused||Fb(e),m=h,b(h);var j=o(f,g);(h.line>=j.to||h.line<j.from)&&setTimeout(fb(e,function(){t==d&&c(a)}),150)}}function d(a){t=1/0,Ed(a),nb(e),Ld(document,"mousemove",u),Ld(document,"mouseup",v)}if(!Od(this,a)){var e=this,f=e.display,g=e.doc,h=g.sel;if(h.shift=a.shiftKey,qb(f,a))return Ae||(f.scroller.draggable=!1,setTimeout(function(){f.scroller.draggable=!0},100)),void 0;if(!tb(e,a)){var i=rb(e,a);switch(Jd(a)){case 3:return Se&&Hb.call(e,e,a),void 0;case 2:return i&&$b(e.doc,i),setTimeout(_d(nb,e),20),Ed(a),void 0}if(!i)return Id(a)==f.scroller&&Ed(a),void 0;e.state.focused||Fb(e);var j=+new Date,k="single";if(Qe&&Qe.time>j-400&&Tb(Qe.pos,i))k="triple",Ed(a),setTimeout(_d(nb,e),20),oc(e,i.line);else if(Pe&&Pe.time>j-400&&Tb(Pe.pos,i)){k="double",Qe={time:j,pos:i},Ed(a);var l=nc(kd(g,i.line).text,i);$b(e.doc,l.from,l.to)}else Pe={time:j,pos:i};var m=i;if(e.options.dragDrop&&Bf&&!ob(e)&&!Tb(h.from,h.to)&&!Ub(i,h.from)&&!Ub(h.to,i)&&"single"==k){var n=fb(e,function(b){Ae&&(f.scroller.draggable=!1),e.state.draggingText=!1,Ld(document,"mouseup",n),Ld(f.scroller,"drop",n),Math.abs(a.clientX-b.clientX)+Math.abs(a.clientY-b.clientY)<10&&(Ed(b),$b(e.doc,i),nb(e))
2
+ });return Ae&&(f.scroller.draggable=!0),e.state.draggingText=n,f.scroller.dragDrop&&f.scroller.dragDrop(),Kd(document,"mouseup",n),Kd(f.scroller,"drop",n),void 0}Ed(a),"single"==k&&$b(e.doc,Xb(g,i));var p=h.from,q=h.to,r=i,s=ge(f.wrapper),t=0,u=fb(e,function(a){xe||Jd(a)?c(a):d(a)}),v=fb(e,d);Kd(document,"mousemove",u),Kd(document,"mouseup",v)}}}function tb(a,b){var c=a.display;try{var d=b.clientX,e=b.clientY}catch(b){return!1}if(d>=Math.floor(ge(c.gutters).right))return!1;if(Ed(b),!Qd(a,"gutterClick"))return!0;var f=ge(c.lineDiv);if(e>f.bottom)return!0;e-=f.top-c.viewOffset;for(var g=0;g<a.options.gutters.length;++g){var h=c.gutters.childNodes[g];if(h&&ge(h).right>=d){var i=pd(a.doc,e),j=a.options.gutters[g];Nd(a,"gutterClick",a,i,j,b);break}}return!0}function ub(a){var b=this;if(!(Od(b,a)||qb(b.display,a)||b.options.onDragEvent&&b.options.onDragEvent(b,Dd(a)))){Ed(a),xe&&(We=+new Date);var c=rb(b,a,!0),d=a.dataTransfer.files;if(c&&!ob(b))if(d&&d.length&&window.FileReader&&window.File)for(var e=d.length,f=Array(e),g=0,h=function(a,d){var h=new FileReader;h.onload=function(){f[d]=h.result,++g==e&&(c=Xb(b.doc,c),Lb(b.doc,{from:c,to:c,text:Ef(f.join("\n")),origin:"paste"},"around"))},h.readAsText(a)},i=0;e>i;++i)h(d[i],i);else{if(b.state.draggingText&&!Ub(c,b.doc.sel.from)&&!Ub(b.doc.sel.to,c))return b.state.draggingText(a),setTimeout(_d(nb,b),20),void 0;try{var f=a.dataTransfer.getData("Text");if(f){var j=b.doc.sel.from,k=b.doc.sel.to;ac(b.doc,c,c),b.state.draggingText&&Rb(b.doc,"",j,k,"paste"),b.replaceSelection(f,null,"paste"),nb(b),Fb(b)}}catch(a){}}}}function vb(a,b){if(xe&&(!a.state.draggingText||+new Date-We<100))return Hd(b),void 0;if(!Od(a,b)&&!qb(a.display,b)){var c=a.getSelection();if(b.dataTransfer.setData("Text",c),b.dataTransfer.setDragImage&&!Ee){var d=ce("img",null,null,"position: fixed; left: 0; top: 0;");De&&(d.width=d.height=1,a.display.wrapper.appendChild(d),d._top=d.offsetTop),b.dataTransfer.setDragImage(d,0,0),De&&d.parentNode.removeChild(d)}}}function wb(a,b){Math.abs(a.doc.scrollTop-b)<2||(a.doc.scrollTop=b,we||t(a,[],b),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b),a.display.scrollbarV.scrollTop!=b&&(a.display.scrollbarV.scrollTop=b),we&&t(a,[]),G(a,100))}function xb(a,b,c){(c?b==a.doc.scrollLeft:Math.abs(a.doc.scrollLeft-b)<2)||(b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth),a.doc.scrollLeft=b,p(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbarH.scrollLeft!=b&&(a.display.scrollbarH.scrollLeft=b))}function yb(a,b){var c=b.wheelDeltaX,d=b.wheelDeltaY;null==c&&b.detail&&b.axis==b.HORIZONTAL_AXIS&&(c=b.detail),null==d&&b.detail&&b.axis==b.VERTICAL_AXIS?d=b.detail:null==d&&(d=b.wheelDelta);var e=a.display,f=e.scroller;if(c&&f.scrollWidth>f.clientWidth||d&&f.scrollHeight>f.clientHeight){if(d&&Le&&Ae)for(var g=b.target;g!=f;g=g.parentNode)if(g.lineObj){a.display.currentWheelTarget=g;break}if(c&&!we&&!De&&null!=Ye)return d&&wb(a,Math.max(0,Math.min(f.scrollTop+d*Ye,f.scrollHeight-f.clientHeight))),xb(a,Math.max(0,Math.min(f.scrollLeft+c*Ye,f.scrollWidth-f.clientWidth))),Ed(b),e.wheelStartX=null,void 0;if(d&&null!=Ye){var h=d*Ye,i=a.doc.scrollTop,j=i+e.wrapper.clientHeight;0>h?i=Math.max(0,i+h-50):j=Math.min(a.doc.height,j+h+50),t(a,[],{top:i,bottom:j})}20>Xe&&(null==e.wheelStartX?(e.wheelStartX=f.scrollLeft,e.wheelStartY=f.scrollTop,e.wheelDX=c,e.wheelDY=d,setTimeout(function(){if(null!=e.wheelStartX){var a=f.scrollLeft-e.wheelStartX,b=f.scrollTop-e.wheelStartY,c=b&&e.wheelDY&&b/e.wheelDY||a&&e.wheelDX&&a/e.wheelDX;e.wheelStartX=e.wheelStartY=null,c&&(Ye=(Ye*Xe+c)/(Xe+1),++Xe)}},200)):(e.wheelDX+=c,e.wheelDY+=d))}}function zb(a,b,c){if("string"==typeof b&&(b=kf[b],!b))return!1;a.display.pollingFast&&lb(a)&&(a.display.pollingFast=!1);var d=a.doc,e=d.sel.shift,f=!1;try{ob(a)&&(a.state.suppressEdits=!0),c&&(d.sel.shift=!1),f=b(a)!=xf}finally{d.sel.shift=e,a.state.suppressEdits=!1}return f}function Ab(a){var b=a.state.keyMaps.slice(0);return a.options.extraKeys&&b.push(a.options.extraKeys),b.push(a.options.keyMap),b}function Bb(a,b){var c=sc(a.options.keyMap),d=c.auto;clearTimeout(Ze),d&&!uc(b)&&(Ze=setTimeout(function(){sc(a.options.keyMap)==c&&(a.options.keyMap=d.call?d.call(null,a):d,g(a))},50));var e=vc(b,!0),f=!1;if(!e)return!1;var h=Ab(a);return f=b.shiftKey?tc("Shift-"+e,h,function(b){return zb(a,b,!0)})||tc(e,h,function(b){return("string"==typeof b?/^go[A-Z]/.test(b):b.motion)?zb(a,b):void 0}):tc(e,h,function(b){return zb(a,b)}),f&&(Ed(b),F(a),ze&&(b.oldKeyCode=b.keyCode,b.keyCode=0),Nd(a,"keyHandled",a,e,b)),f}function Cb(a,b,c){var d=tc("'"+c+"'",Ab(a),function(b){return zb(a,b,!0)});return d&&(Ed(b),F(a),Nd(a,"keyHandled",a,"'"+c+"'",b)),d}function Db(a){var b=this;if(b.state.focused||Fb(b),xe&&27==a.keyCode&&(a.returnValue=!1),!(Od(b,a)||b.options.onKeyEvent&&b.options.onKeyEvent(b,Dd(a)))){var c=a.keyCode;b.doc.sel.shift=16==c||a.shiftKey;var d=Bb(b,a);De&&(_e=d?c:null,!d&&88==c&&!Gf&&(Le?a.metaKey:a.ctrlKey)&&b.replaceSelection(""))}}function Eb(a){var b=this;if(!(Od(b,a)||b.options.onKeyEvent&&b.options.onKeyEvent(b,Dd(a)))){var c=a.keyCode,d=a.charCode;if(De&&c==_e)return _e=null,Ed(a),void 0;if(!(De&&(!a.which||a.which<10)||Fe)||!Bb(b,a)){var e=String.fromCharCode(null==d?c:d);this.options.electricChars&&this.doc.mode.electricChars&&this.options.smartIndent&&!ob(this)&&this.doc.mode.electricChars.indexOf(e)>-1&&setTimeout(fb(b,function(){jc(b,b.doc.sel.to.line,"smart")}),75),Cb(b,a,e)||(xe&&!ze&&(b.display.inputHasSelection=null),kb(b))}}}function Fb(a){"nocursor"!=a.options.readOnly&&(a.state.focused||(Md(a,"focus",a),a.state.focused=!0,-1==a.display.wrapper.className.search(/\bCodeMirror-focused\b/)&&(a.display.wrapper.className+=" CodeMirror-focused"),mb(a,!0)),jb(a),F(a))}function Gb(a){a.state.focused&&(Md(a,"blur",a),a.state.focused=!1,a.display.wrapper.className=a.display.wrapper.className.replace(" CodeMirror-focused","")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.doc.sel.shift=!1)},150)}function Hb(a,b){function c(){if(null!=e.input.selectionStart){var a=e.input.value=" "+(Tb(f.from,f.to)?"":e.input.value);e.prevInput=" ",e.input.selectionStart=1,e.input.selectionEnd=a.length}}function d(){if(e.inputDiv.style.position="relative",e.input.style.cssText=i,ze&&(e.scrollbarV.scrollTop=e.scroller.scrollTop=h),jb(a),null!=e.input.selectionStart){(!xe||ze)&&c(),clearTimeout($e);var b=0,d=function(){" "==e.prevInput&&0==e.input.selectionStart?fb(a,kf.selectAll)(a):b++<10?$e=setTimeout(d,500):mb(a)};$e=setTimeout(d,200)}}if(!Od(a,b,"contextmenu")){var e=a.display,f=a.doc.sel;if(!qb(e,b)){var g=rb(a,b),h=e.scroller.scrollTop;if(g&&!De){(Tb(f.from,f.to)||Ub(g,f.from)||!Ub(g,f.to))&&fb(a,ac)(a.doc,g,g);var i=e.input.style.cssText;if(e.inputDiv.style.position="absolute",e.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(b.clientY-5)+"px; left: "+(b.clientX-5)+"px; z-index: 1000; background: white; outline: none;"+"border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);",nb(a),mb(a,!0),Tb(f.from,f.to)&&(e.input.value=e.prevInput=" "),xe&&!ze&&c(),Se){Hd(b);var j=function(){Ld(window,"mouseup",j),setTimeout(d,20)};Kd(window,"mouseup",j)}else setTimeout(d,50)}}}}function Ib(a,b,c){if(!Ub(b.from,c))return Xb(a,c);var d=b.text.length-1-(b.to.line-b.from.line);if(c.line>b.to.line+d){var e=c.line-d,f=a.first+a.size-1;return e>f?Sb(f,kd(a,f).text.length):Yb(c,kd(a,e).text.length)}if(c.line==b.to.line+d)return Yb(c,Vd(b.text).length+(1==b.text.length?b.from.ch:0)+kd(a,b.to.line).text.length-b.to.ch);var g=c.line-b.from.line;return Yb(c,b.text[g].length+(g?0:b.from.ch))}function Jb(a,b,c){if(c&&"object"==typeof c)return{anchor:Ib(a,b,c.anchor),head:Ib(a,b,c.head)};if("start"==c)return{anchor:b.from,head:b.from};var d=af(b);if("around"==c)return{anchor:b.from,head:d};if("end"==c)return{anchor:d,head:d};var e=function(a){if(Ub(a,b.from))return a;if(!Ub(b.to,a))return d;var c=a.line+b.text.length-(b.to.line-b.from.line)-1,e=a.ch;return a.line==b.to.line&&(e+=d.ch-b.to.ch),Sb(c,e)};return{anchor:e(a.sel.anchor),head:e(a.sel.head)}}function Kb(a,b,c){var d={canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){this.canceled=!0}};return c&&(d.update=function(b,c,d,e){b&&(this.from=Xb(a,b)),c&&(this.to=Xb(a,c)),d&&(this.text=d),void 0!==e&&(this.origin=e)}),Md(a,"beforeChange",a,d),a.cm&&Md(a.cm,"beforeChange",a.cm,d),d.canceled?null:{from:d.from,to:d.to,text:d.text,origin:d.origin}}function Lb(a,b,c,d){if(a.cm){if(!a.cm.curOp)return fb(a.cm,Lb)(a,b,c,d);if(a.cm.state.suppressEdits)return}if(!(Qd(a,"beforeChange")||a.cm&&Qd(a.cm,"beforeChange"))||(b=Kb(a,b,!0))){var e=Te&&!d&&Ic(a,b.from,b.to);if(e){for(var f=e.length-1;f>=1;--f)Mb(a,{from:e[f].from,to:e[f].to,text:[""]});e.length&&Mb(a,{from:e[0].from,to:e[0].to,text:b.text},c)}else Mb(a,b,c)}}function Mb(a,b,c){var d=Jb(a,b,c);vd(a,b,d,a.cm?a.cm.curOp.id:0/0),Pb(a,b,d,Gc(a,b));var e=[];id(a,function(a,c){c||-1!=Xd(e,a.history)||(Bd(a.history,b),e.push(a.history)),Pb(a,b,null,Gc(a,b))})}function Nb(a,b){if(!a.cm||!a.cm.state.suppressEdits){var c=a.history,d=("undo"==b?c.done:c.undone).pop();if(d){var e={changes:[],anchorBefore:d.anchorAfter,headBefore:d.headAfter,anchorAfter:d.anchorBefore,headAfter:d.headBefore,generation:c.generation};("undo"==b?c.undone:c.done).push(e),c.generation=d.generation||++c.maxGeneration;for(var f=Qd(a,"beforeChange")||a.cm&&Qd(a.cm,"beforeChange"),g=d.changes.length-1;g>=0;--g){var h=d.changes[g];if(h.origin=b,f&&!Kb(a,h,!1))return("undo"==b?c.done:c.undone).length=0,void 0;e.changes.push(ud(a,h));var i=g?Jb(a,h,null):{anchor:d.anchorBefore,head:d.headBefore};Pb(a,h,i,Hc(a,h));var j=[];id(a,function(a,b){b||-1!=Xd(j,a.history)||(Bd(a.history,h),j.push(a.history)),Pb(a,h,null,Hc(a,h))})}}}}function Ob(a,b){function c(a){return Sb(a.line+b,a.ch)}a.first+=b,a.cm&&ib(a.cm,a.first,a.first,b),a.sel.head=c(a.sel.head),a.sel.anchor=c(a.sel.anchor),a.sel.from=c(a.sel.from),a.sel.to=c(a.sel.to)}function Pb(a,b,c,d){if(a.cm&&!a.cm.curOp)return fb(a.cm,Pb)(a,b,c,d);if(b.to.line<a.first)return Ob(a,b.text.length-1-(b.to.line-b.from.line)),void 0;if(!(b.from.line>a.lastLine())){if(b.from.line<a.first){var e=b.text.length-1-(a.first-b.from.line);Ob(a,e),b={from:Sb(a.first,0),to:Sb(b.to.line+e,b.to.ch),text:[Vd(b.text)],origin:b.origin}}var f=a.lastLine();b.to.line>f&&(b={from:b.from,to:Sb(f,kd(a,f).text.length),text:[b.text[0]],origin:b.origin}),b.removed=ld(a,b.from,b.to),c||(c=Jb(a,b,null)),a.cm?Qb(a.cm,b,d,c):fd(a,b,d,c)}}function Qb(a,b,c,d){var f=a.doc,g=a.display,h=b.from,i=b.to,j=!1,l=h.line;a.options.lineWrapping||(l=od(Mc(f,kd(f,h.line))),f.iter(l,i.line+1,function(a){return a==g.maxLine?(j=!0,!0):void 0})),Ub(f.sel.head,b.from)||Ub(b.to,f.sel.head)||(a.curOp.cursorActivity=!0),fd(f,b,c,d,e(a)),a.options.lineWrapping||(f.iter(l,h.line+b.text.length,function(a){var b=k(f,a);b>g.maxLineLength&&(g.maxLine=a,g.maxLineLength=b,g.maxLineChanged=!0,j=!1)}),j&&(a.curOp.updateMaxLine=!0)),f.frontier=Math.min(f.frontier,h.line),G(a,400);var m=b.text.length-(i.line-h.line)-1;if(ib(a,h.line,i.line+1,m),Qd(a,"change")){var n={from:h,to:i,text:b.text,removed:b.removed,origin:b.origin};if(a.curOp.textChanged){for(var o=a.curOp.textChanged;o.next;o=o.next);o.next=n}else a.curOp.textChanged=n}}function Rb(a,b,c,d,e){if(d||(d=c),Ub(d,c)){var f=d;d=c,c=f}"string"==typeof b&&(b=Ef(b)),Lb(a,{from:c,to:d,text:b,origin:e},null)}function Sb(a,b){return this instanceof Sb?(this.line=a,this.ch=b,void 0):new Sb(a,b)}function Tb(a,b){return a.line==b.line&&a.ch==b.ch}function Ub(a,b){return a.line<b.line||a.line==b.line&&a.ch<b.ch}function Vb(a){return Sb(a.line,a.ch)}function Wb(a,b){return Math.max(a.first,Math.min(b,a.first+a.size-1))}function Xb(a,b){if(b.line<a.first)return Sb(a.first,0);var c=a.first+a.size-1;return b.line>c?Sb(c,kd(a,c).text.length):Yb(b,kd(a,b.line).text.length)}function Yb(a,b){var c=a.ch;return null==c||c>b?Sb(a.line,b):0>c?Sb(a.line,0):a}function Zb(a,b){return b>=a.first&&b<a.first+a.size}function $b(a,b,c,d){if(a.sel.shift||a.sel.extend){var e=a.sel.anchor;if(c){var f=Ub(b,e);f!=Ub(c,e)?(e=b,b=c):f!=Ub(b,c)&&(b=c)}ac(a,e,b,d)}else ac(a,b,c||b,d);a.cm&&(a.cm.curOp.userSelChange=!0)}function _b(a,b,c){var d={anchor:b,head:c};return Md(a,"beforeSelectionChange",a,d),a.cm&&Md(a.cm,"beforeSelectionChange",a.cm,d),d.anchor=Xb(a,d.anchor),d.head=Xb(a,d.head),d}function ac(a,b,c,d,e){if(!e&&Qd(a,"beforeSelectionChange")||a.cm&&Qd(a.cm,"beforeSelectionChange")){var f=_b(a,b,c);c=f.head,b=f.anchor}var g=a.sel;if(g.goalColumn=null,(e||!Tb(b,g.anchor))&&(b=cc(a,b,d,"push"!=e)),(e||!Tb(c,g.head))&&(c=cc(a,c,d,"push"!=e)),!Tb(g.anchor,b)||!Tb(g.head,c)){g.anchor=b,g.head=c;var h=Ub(c,b);g.from=h?c:b,g.to=h?b:c,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=a.cm.curOp.cursorActivity=!0),Nd(a,"cursorActivity",a)}}function bc(a){ac(a.doc,a.doc.sel.from,a.doc.sel.to,null,"push")}function cc(a,b,c,d){var e=!1,f=b,g=c||1;a.cantEdit=!1;a:for(;;){var h=kd(a,f.line);if(h.markedSpans)for(var i=0;i<h.markedSpans.length;++i){var j=h.markedSpans[i],k=j.marker;if((null==j.from||(k.inclusiveLeft?j.from<=f.ch:j.from<f.ch))&&(null==j.to||(k.inclusiveRight?j.to>=f.ch:j.to>f.ch))){if(d&&(Md(k,"beforeCursorEnter"),k.explicitlyCleared)){if(h.markedSpans){--i;continue}break}if(!k.atomic)continue;var l=k.find()[0>g?"from":"to"];if(Tb(l,f)&&(l.ch+=g,l.ch<0?l=l.line>a.first?Xb(a,Sb(l.line-1)):null:l.ch>h.text.length&&(l=l.line<a.first+a.size-1?Sb(l.line+1,0):null),!l)){if(e)return d?(a.cantEdit=!0,Sb(a.first,0)):cc(a,b,c,!0);e=!0,l=b,g=-g}f=l;continue a}}return f}}function dc(a){var b=ec(a,a.doc.sel.head,a.options.cursorScrollMargin);if(a.state.focused){var c=a.display,d=ge(c.sizer),e=null;if(b.top+d.top<0?e=!0:b.bottom+d.top>(window.innerHeight||document.documentElement.clientHeight)&&(e=!1),null!=e&&!Ie){var f="none"==c.cursor.style.display;f&&(c.cursor.style.display="",c.cursor.style.left=b.left+"px",c.cursor.style.top=b.top-c.viewOffset+"px"),c.cursor.scrollIntoView(e),f&&(c.cursor.style.display="none")}}}function ec(a,b,c){for(null==c&&(c=0);;){var d=!1,e=Z(a,b),f=gc(a,e.left,e.top-c,e.left,e.bottom+c),g=a.doc.scrollTop,h=a.doc.scrollLeft;if(null!=f.scrollTop&&(wb(a,f.scrollTop),Math.abs(a.doc.scrollTop-g)>1&&(d=!0)),null!=f.scrollLeft&&(xb(a,f.scrollLeft),Math.abs(a.doc.scrollLeft-h)>1&&(d=!0)),!d)return e}}function fc(a,b,c,d,e){var f=gc(a,b,c,d,e);null!=f.scrollTop&&wb(a,f.scrollTop),null!=f.scrollLeft&&xb(a,f.scrollLeft)}function gc(a,b,c,d,e){var f=a.display,g=bb(a.display);0>c&&(c=0);var h=f.scroller.clientHeight-wf,i=f.scroller.scrollTop,j={},k=a.doc.height+L(f),l=g>c,m=e>k-g;if(i>c)j.scrollTop=l?0:c;else if(e>i+h){var n=Math.min(c,(m?k:e)-h);n!=i&&(j.scrollTop=n)}var o=f.scroller.clientWidth-wf,p=f.scroller.scrollLeft;b+=f.gutters.offsetWidth,d+=f.gutters.offsetWidth;var q=f.gutters.offsetWidth,r=q+10>b;return p+q>b||r?(r&&(b=0),j.scrollLeft=Math.max(0,b-10-q)):d>o+p-3&&(j.scrollLeft=d+10-o),j}function hc(a,b,c){a.curOp.updateScrollPos={scrollLeft:null==b?a.doc.scrollLeft:b,scrollTop:null==c?a.doc.scrollTop:c}}function ic(a,b,c){var d=a.curOp.updateScrollPos||(a.curOp.updateScrollPos={scrollLeft:a.doc.scrollLeft,scrollTop:a.doc.scrollTop}),e=a.display.scroller;d.scrollTop=Math.max(0,Math.min(e.scrollHeight-e.clientHeight,d.scrollTop+c)),d.scrollLeft=Math.max(0,Math.min(e.scrollWidth-e.clientWidth,d.scrollLeft+b))}function jc(a,b,c,d){var e=a.doc;if(null==c&&(c="add"),"smart"==c)if(a.doc.mode.indent)var f=J(a,b);else c="prev";var g,h=a.options.tabSize,i=kd(e,b),j=Td(i.text,null,h),k=i.text.match(/^\s*/)[0];if("smart"==c&&(g=a.doc.mode.indent(f,i.text.slice(k.length),i.text),g==xf)){if(!d)return;c="prev"}"prev"==c?g=b>e.first?Td(kd(e,b-1).text,null,h):0:"add"==c?g=j+a.options.indentUnit:"subtract"==c?g=j-a.options.indentUnit:"number"==typeof c&&(g=j+c),g=Math.max(0,g);var l="",m=0;if(a.options.indentWithTabs)for(var n=Math.floor(g/h);n;--n)m+=h,l+=" ";g>m&&(l+=Ud(g-m)),l!=k&&Rb(a.doc,l,Sb(b,0),Sb(b,k.length),"+input"),i.stateAfter=null}function kc(a,b,c){var d=b,e=b,f=a.doc;return"number"==typeof b?e=kd(f,Wb(f,b)):d=od(b),null==d?null:c(e,d)?(ib(a,d,d+1),e):null}function lc(a,b,c,d,e){function f(){var b=h+c;return b<a.first||b>=a.first+a.size?l=!1:(h=b,k=kd(a,b))}function g(a){var b=(e?ue:ve)(k,i,c,!0);if(null==b){if(a||!f())return l=!1;i=e?(0>c?oe:ne)(k):0>c?k.text.length:0}else i=b;return!0}var h=b.line,i=b.ch,j=c,k=kd(a,h),l=!0;if("char"==d)g();else if("column"==d)g(!0);else if("word"==d||"group"==d)for(var m=null,n="group"==d,o=!0;!(0>c)||g(!o);o=!1){var p=k.text.charAt(i)||"\n",q=ae(p)?"w":n?/\s/.test(p)?null:"p":null;if(m&&m!=q){0>c&&(c=1,g());break}if(q&&(m=q),c>0&&!g(!o))break}var r=cc(a,Sb(h,i),j,!0);return l||(r.hitSide=!0),r}function mc(a,b,c,d){var e,f=a.doc,g=b.left;if("page"==d){var h=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);e=b.top+c*(h-(0>c?1.5:.5)*bb(a.display))}else"line"==d&&(e=c>0?b.bottom+3:b.top-3);for(;;){var i=_(a,g,e);if(!i.outside)break;if(0>c?0>=e:e>=f.height){i.hitSide=!0;break}e+=5*c}return i}function nc(a,b){var c=b.ch,d=b.ch;if(a){(b.xRel<0||d==a.length)&&c?--c:++d;for(var e=a.charAt(c),f=ae(e)?ae:/\s/.test(e)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!ae(a)};c>0&&f(a.charAt(c-1));)--c;for(;d<a.length&&f(a.charAt(d));)++d}return{from:Sb(b.line,c),to:Sb(b.line,d)}}function oc(a,b){$b(a.doc,Sb(b,0),Xb(a.doc,Sb(b+1,0)))}function pc(b,c,d,e){a.defaults[b]=c,d&&(bf[b]=e?function(a,b,c){c!=df&&d(a,b,c)}:d)}function qc(a,b){if(b===!0)return b;if(a.copyState)return a.copyState(b);var c={};for(var d in b){var e=b[d];e instanceof Array&&(e=e.concat([])),c[d]=e}return c}function rc(a,b,c){return a.startState?a.startState(b,c):!0}function sc(a){return"string"==typeof a?lf[a]:a}function tc(a,b,c){function d(b){b=sc(b);var e=b[a];if(e===!1)return"stop";if(null!=e&&c(e))return!0;if(b.nofallthrough)return"stop";var f=b.fallthrough;if(null==f)return!1;if("[object Array]"!=Object.prototype.toString.call(f))return d(f);for(var g=0,h=f.length;h>g;++g){var i=d(f[g]);if(i)return i}return!1}for(var e=0;e<b.length;++e){var f=d(b[e]);if(f)return"stop"!=f}}function uc(a){var b=Hf[a.keyCode];return"Ctrl"==b||"Alt"==b||"Shift"==b||"Mod"==b}function vc(a,b){if(De&&34==a.keyCode&&a["char"])return!1;var c=Hf[a.keyCode];return null==c||a.altGraphKey?!1:(a.altKey&&(c="Alt-"+c),(Re?a.metaKey:a.ctrlKey)&&(c="Ctrl-"+c),(Re?a.ctrlKey:a.metaKey)&&(c="Cmd-"+c),!b&&a.shiftKey&&(c="Shift-"+c),c)}function wc(a,b){this.pos=this.start=0,this.string=a,this.tabSize=b||8,this.lastColumnPos=this.lastColumnValue=0}function xc(a,b){this.lines=[],this.type=b,this.doc=a}function yc(a,b,c,d,e){if(d&&d.shared)return Ac(a,b,c,d,e);if(a.cm&&!a.cm.curOp)return fb(a.cm,yc)(a,b,c,d,e);var f=new xc(a,e);if("range"==e&&!Ub(b,c))return f;d&&Zd(d,f),f.replacedWith&&(f.collapsed=!0,f.replacedWith=ce("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||(f.replacedWith.ignoreEvents=!0)),f.collapsed&&(Ue=!0),f.addToHistory&&vd(a,{from:b,to:c,origin:"markText"},{head:a.sel.head,anchor:a.sel.anchor},0/0);var g,h,i,j=b.line,k=0,l=a.cm;if(a.iter(j,c.line+1,function(d){l&&f.collapsed&&!l.options.lineWrapping&&Mc(a,d)==l.display.maxLine&&(i=!0);var e={from:null,to:null,marker:f};k+=d.text.length,j==b.line&&(e.from=b.ch,k-=b.ch),j==c.line&&(e.to=c.ch,k-=d.text.length-c.ch),f.collapsed&&(j==c.line&&(h=Jc(d,c.ch)),j==b.line?g=Jc(d,b.ch):nd(d,0)),Dc(d,e),++j}),f.collapsed&&a.iter(b.line,c.line+1,function(b){Nc(a,b)&&nd(b,0)}),f.clearOnEnter&&Kd(f,"beforeCursorEnter",function(){f.clear()}),f.readOnly&&(Te=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory()),f.collapsed){if(g!=h)throw new Error("Inserting collapsed marker overlapping an existing one");f.size=k,f.atomic=!0}return l&&(i&&(l.curOp.updateMaxLine=!0),(f.className||f.title||f.startStyle||f.endStyle||f.collapsed)&&ib(l,b.line,c.line+1),f.atomic&&bc(l)),f}function zc(a,b){this.markers=a,this.primary=b;for(var c=0,d=this;c<a.length;++c)a[c].parent=this,Kd(a[c],"clear",function(){d.clear()})}function Ac(a,b,c,d,e){d=Zd(d),d.shared=!1;var f=[yc(a,b,c,d,e)],g=f[0],h=d.replacedWith;return id(a,function(a){h&&(d.replacedWith=h.cloneNode(!0)),f.push(yc(a,Xb(a,b),Xb(a,c),d,e));for(var i=0;i<a.linked.length;++i)if(a.linked[i].isParent)return;g=Vd(f)}),new zc(f,g)}function Bc(a,b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function Cc(a,b){for(var c,d=0;d<a.length;++d)a[d]!=b&&(c||(c=[])).push(a[d]);return c}function Dc(a,b){a.markedSpans=a.markedSpans?a.markedSpans.concat([b]):[b],b.marker.attachLine(a)}function Ec(a,b,c){if(a)for(var d,e=0;e<a.length;++e){var f=a[e],g=f.marker,h=null==f.from||(g.inclusiveLeft?f.from<=b:f.from<b);if(h||"bookmark"==g.type&&f.from==b&&(!c||!f.marker.insertLeft)){var i=null==f.to||(g.inclusiveRight?f.to>=b:f.to>b);(d||(d=[])).push({from:f.from,to:i?null:f.to,marker:g})}}return d}function Fc(a,b,c){if(a)for(var d,e=0;e<a.length;++e){var f=a[e],g=f.marker,h=null==f.to||(g.inclusiveRight?f.to>=b:f.to>b);if(h||"bookmark"==g.type&&f.from==b&&(!c||f.marker.insertLeft)){var i=null==f.from||(g.inclusiveLeft?f.from<=b:f.from<b);(d||(d=[])).push({from:i?null:f.from-b,to:null==f.to?null:f.to-b,marker:g})}}return d}function Gc(a,b){var c=Zb(a,b.from.line)&&kd(a,b.from.line).markedSpans,d=Zb(a,b.to.line)&&kd(a,b.to.line).markedSpans;if(!c&&!d)return null;var e=b.from.ch,f=b.to.ch,g=Tb(b.from,b.to),h=Ec(c,e,g),i=Fc(d,f,g),j=1==b.text.length,k=Vd(b.text).length+(j?e:0);if(h)for(var l=0;l<h.length;++l){var m=h[l];if(null==m.to){var n=Bc(i,m.marker);n?j&&(m.to=null==n.to?null:n.to+k):m.to=e}}if(i)for(var l=0;l<i.length;++l){var m=i[l];if(null!=m.to&&(m.to+=k),null==m.from){var n=Bc(h,m.marker);n||(m.from=k,j&&(h||(h=[])).push(m))}else m.from+=k,j&&(h||(h=[])).push(m)}if(j&&h){for(var l=0;l<h.length;++l)null!=h[l].from&&h[l].from==h[l].to&&"bookmark"!=h[l].marker.type&&h.splice(l--,1);h.length||(h=null)}var o=[h];if(!j){var p,q=b.text.length-2;if(q>0&&h)for(var l=0;l<h.length;++l)null==h[l].to&&(p||(p=[])).push({from:null,to:null,marker:h[l].marker});for(var l=0;q>l;++l)o.push(p);o.push(i)}return o}function Hc(a,b){var c=xd(a,b),d=Gc(a,b);if(!c)return d;if(!d)return c;for(var e=0;e<c.length;++e){var f=c[e],g=d[e];if(f&&g)a:for(var h=0;h<g.length;++h){for(var i=g[h],j=0;j<f.length;++j)if(f[j].marker==i.marker)continue a;f.push(i)}else g&&(c[e]=g)}return c}function Ic(a,b,c){var d=null;if(a.iter(b.line,c.line+1,function(a){if(a.markedSpans)for(var b=0;b<a.markedSpans.length;++b){var c=a.markedSpans[b].marker;!c.readOnly||d&&-1!=Xd(d,c)||(d||(d=[])).push(c)}}),!d)return null;for(var e=[{from:b,to:c}],f=0;f<d.length;++f)for(var g=d[f],h=g.find(),i=0;i<e.length;++i){var j=e[i];if(!Ub(j.to,h.from)&&!Ub(h.to,j.from)){var k=[i,1];(Ub(j.from,h.from)||!g.inclusiveLeft&&Tb(j.from,h.from))&&k.push({from:j.from,to:h.from}),(Ub(h.to,j.to)||!g.inclusiveRight&&Tb(j.to,h.to))&&k.push({from:h.to,to:j.to}),e.splice.apply(e,k),i+=k.length-1}}return e}function Jc(a,b){var c,d=Ue&&a.markedSpans;if(d)for(var e,f=0;f<d.length;++f)e=d[f],e.marker.collapsed&&(null==e.from||e.from<b)&&(null==e.to||e.to>b)&&(!c||c.width<e.marker.width)&&(c=e.marker);return c}function Kc(a){return Jc(a,-1)}function Lc(a){return Jc(a,a.text.length+1)}function Mc(a,b){for(var c;c=Kc(b);)b=kd(a,c.find().from.line);return b}function Nc(a,b){var c=Ue&&b.markedSpans;if(c)for(var d,e=0;e<c.length;++e)if(d=c[e],d.marker.collapsed){if(null==d.from)return!0;if(!d.marker.replacedWith&&0==d.from&&d.marker.inclusiveLeft&&Oc(a,b,d))return!0}}function Oc(a,b,c){if(null==c.to){var d=c.marker.find().to,e=kd(a,d.line);return Oc(a,e,Bc(e.markedSpans,c.marker))}if(c.marker.inclusiveRight&&c.to==b.text.length)return!0;for(var f,g=0;g<b.markedSpans.length;++g)if(f=b.markedSpans[g],f.marker.collapsed&&!f.marker.replacedWith&&f.from==c.to&&(f.marker.inclusiveLeft||c.marker.inclusiveRight)&&Oc(a,b,f))return!0}function Pc(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function Qc(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function Rc(a){return function(){var b=!this.cm.curOp;b&&db(this.cm);try{var c=a.apply(this,arguments)}finally{b&&eb(this.cm)}return c}}function Sc(a){return null!=a.height?a.height:(a.node.parentNode&&1==a.node.parentNode.nodeType||ee(a.cm.display.measure,ce("div",[a.node],null,"position: relative")),a.height=a.node.offsetHeight)}function Tc(a,b,c,d){var e=new mf(a,c,d);return e.noHScroll&&(a.display.alignWidgets=!0),kc(a,b,function(b){var c=b.widgets||(b.widgets=[]);if(null==e.insertAt?c.push(e):c.splice(Math.min(c.length-1,Math.max(0,e.insertAt)),0,e),e.line=b,!Nc(a.doc,b)||e.showIfHidden){var d=qd(a,b)<a.doc.scrollTop;nd(b,b.height+Sc(e)),d&&ic(a,0,e.height)}return!0}),e}function Uc(a,b,c,d){a.text=b,a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null),null!=a.order&&(a.order=null),Pc(a),Qc(a,c);var e=d?d(a):1;e!=a.height&&nd(a,e)}function Vc(a){a.parent=null,Pc(a)}function Wc(a,b,c,d,e){var f=c.flattenSpans;null==f&&(f=a.options.flattenSpans);var g,h=0,i=null,j=new wc(b,a.options.tabSize);for(""==b&&c.blankLine&&c.blankLine(d);!j.eol();)j.pos>a.options.maxHighlightLength?(f=!1,j.pos=Math.min(b.length,j.start+5e4),g=null):g=c.token(j,d),f&&i==g||(h<j.start&&e(j.start,i),h=j.start,i=g),j.start=j.pos;h<j.pos&&e(j.pos,i)}function Xc(a,b,c){var d=[a.state.modeGen];Wc(a,b.text,a.doc.mode,c,function(a,b){d.push(a,b)});for(var e=0;e<a.state.overlays.length;++e){var f=a.state.overlays[e],g=1,h=0;Wc(a,b.text,f.mode,!0,function(a,b){for(var c=g;a>h;){var e=d[g];e>a&&d.splice(g,1,a,d[g+1],e),g+=2,h=Math.min(a,e)}if(b)if(f.opaque)d.splice(c,g-c,a,b),g=c+2;else for(;g>c;c+=2){var i=d[c+1];d[c+1]=i?i+" "+b:b}})}return d}function Yc(a,b){return b.styles&&b.styles[0]==a.state.modeGen||(b.styles=Xc(a,b,b.stateAfter=J(a,od(b)))),b.styles}function Zc(a,b,c){var d=a.doc.mode,e=new wc(b.text,a.options.tabSize);for(""==b.text&&d.blankLine&&d.blankLine(c);!e.eol()&&e.pos<=a.options.maxHighlightLength;)d.token(e,c),e.start=e.pos}function $c(a){return a?of[a]||(of[a]="cm-"+a.replace(/ +/g," cm-")):null}function _c(a,b,c,d){for(var e,f=b,g=!0;e=Kc(f);)f=kd(a.doc,e.find().from.line);var h={pre:ce("pre"),col:0,pos:0,measure:null,measuredSomething:!1,cm:a,copyWidgets:d};f.textClass&&(h.pre.className=f.textClass);do{f.text&&(g=!1),h.measure=f==b&&c,h.pos=0,h.addToken=h.measure?bd:ad,(xe||Ae)&&a.getOption("lineWrapping")&&(h.addToken=cd(h.addToken));var i=ed(f,h,Yc(a,f));c&&f==b&&!h.measuredSomething&&(c[0]=h.pre.appendChild(je(a.display.measure)),h.measuredSomething=!0),i&&(f=kd(a.doc,i.to.line))}while(i);!c||h.measuredSomething||c[0]||(c[0]=h.pre.appendChild(g?ce("span"," "):je(a.display.measure))),h.pre.firstChild||Nc(a.doc,b)||h.pre.appendChild(document.createTextNode(" "));var j;if(c&&xe&&(j=rd(f))){var k=j.length-1;j[k].from==j[k].to&&--k;var l=j[k],m=j[k-1];if(l.from+1==l.to&&m&&l.level<m.level){var n=c[h.pos-1];n&&n.parentNode.insertBefore(n.measureRight=je(a.display.measure),n.nextSibling)}}return Md(a,"renderLine",a,b,h.pre),h.pre}function ad(a,b,c,d,e,f){if(b){if(pf.test(b))for(var g=document.createDocumentFragment(),h=0;;){pf.lastIndex=h;var i=pf.exec(b),j=i?i.index-h:b.length-h;if(j&&(g.appendChild(document.createTextNode(b.slice(h,h+j))),a.col+=j),!i)break;if(h+=j+1," "==i[0]){var k=a.cm.options.tabSize,l=k-a.col%k;g.appendChild(ce("span",Ud(l),"cm-tab")),a.col+=l}else{var m=ce("span","•","cm-invalidchar");m.title="\\u"+i[0].charCodeAt(0).toString(16),g.appendChild(m),a.col+=1}}else{a.col+=b.length;var g=document.createTextNode(b)}if(c||d||e||a.measure){var n=c||"";d&&(n+=d),e&&(n+=e);var m=ce("span",[g],n);return f&&(m.title=f),a.pre.appendChild(m)}a.pre.appendChild(g)}}function bd(a,b,c,d,e){for(var f=a.cm.options.lineWrapping,g=0;g<b.length;++g){var h=b.charAt(g),i=0==g;h>="���"&&"���">h&&g<b.length-1?(h=b.slice(g,g+2),++g):g&&f&&he(b,g)&&a.pre.appendChild(ce("wbr"));var j=a.measure[a.pos],k=a.measure[a.pos]=ad(a,h,c,i&&d,g==b.length-1&&e);j&&(k.leftSide=j.leftSide||j),xe&&f&&" "==h&&g&&!/\s/.test(b.charAt(g-1))&&g<b.length-1&&!/\s/.test(b.charAt(g+1))&&(k.style.whiteSpace="normal"),a.pos+=h.length}b.length&&(a.measuredSomething=!0)}function cd(a){function b(a){for(var b=" ",c=0;c<a.length-2;++c)b+=c%2?" ":" ";return b+=" "}return function(c,d,e,f,g,h){return a(c,d.replace(/ {3,}/,b),e,f,g,h)}}function dd(a,b,c,d){var e=!d&&c.replacedWith;if(e&&(a.copyWidgets&&(e=e.cloneNode(!0)),a.pre.appendChild(e),a.measure)){if(b)a.measure[a.pos]=e;else{var f=a.measure[a.pos]=je(a.cm.display.measure);"bookmark"!=c.type||c.insertLeft?a.pre.insertBefore(f,e):a.pre.appendChild(f)}a.measuredSomething=!0}a.pos+=b}function ed(a,b,c){var d=a.markedSpans,e=a.text,f=0;if(d)for(var g,h,i,j,k,l,m=e.length,n=0,o=1,p="",q=0;;){if(q==n){h=i=j=k="",l=null,q=1/0;for(var r=null,s=0;s<d.length;++s){var t=d[s],u=t.marker;t.from<=n&&(null==t.to||t.to>n)?(null!=t.to&&q>t.to&&(q=t.to,i=""),u.className&&(h+=" "+u.className),u.startStyle&&t.from==n&&(j+=" "+u.startStyle),u.endStyle&&t.to==q&&(i+=" "+u.endStyle),u.title&&!k&&(k=u.title),u.collapsed&&(!l||l.marker.size<u.size)&&(l=t)):t.from>n&&q>t.from&&(q=t.from),"bookmark"==u.type&&t.from==n&&u.replacedWith&&(r=u)}if(l&&(l.from||0)==n&&(dd(b,(null==l.to?m:l.to)-n,l.marker,null==l.from),null==l.to))return l.marker.find();r&&!l&&dd(b,0,r)}if(n>=m)break;for(var v=Math.min(m,q);;){if(p){var w=n+p.length;if(!l){var x=w>v?p.slice(0,v-n):p;b.addToken(b,x,g?g+h:h,j,n+x.length==q?i:"",k)}if(w>=v){p=p.slice(v-n),n=v;break}n=w,j=""}p=e.slice(f,f=c[o++]),g=$c(c[o++])}}else for(var o=1;o<c.length;o+=2)b.addToken(b,e.slice(f,f=c[o]),$c(c[o+1]))}function fd(a,b,c,d,e){function f(a){return c?c[a]:null}function g(a,c,d){Uc(a,c,d,e),Nd(a,"change",a,b)}var h=b.from,i=b.to,j=b.text,k=kd(a,h.line),l=kd(a,i.line),m=Vd(j),n=f(j.length-1),o=i.line-h.line;if(0==h.ch&&0==i.ch&&""==m){for(var p=0,q=j.length-1,r=[];q>p;++p)r.push(new nf(j[p],f(p),e));g(l,l.text,n),o&&a.remove(h.line,o),r.length&&a.insert(h.line,r)}else if(k==l)if(1==j.length)g(k,k.text.slice(0,h.ch)+m+k.text.slice(i.ch),n);else{for(var r=[],p=1,q=j.length-1;q>p;++p)r.push(new nf(j[p],f(p),e));r.push(new nf(m+k.text.slice(i.ch),n,e)),g(k,k.text.slice(0,h.ch)+j[0],f(0)),a.insert(h.line+1,r)}else if(1==j.length)g(k,k.text.slice(0,h.ch)+j[0]+l.text.slice(i.ch),f(0)),a.remove(h.line+1,o);else{g(k,k.text.slice(0,h.ch)+j[0],f(0)),g(l,m+l.text.slice(i.ch),n);for(var p=1,q=j.length-1,r=[];q>p;++p)r.push(new nf(j[p],f(p),e));o>1&&a.remove(h.line+1,o-1),a.insert(h.line+1,r)}Nd(a,"change",a,b),ac(a,d.anchor,d.head,null,!0)}function gd(a){this.lines=a,this.parent=null;for(var b=0,c=a.length,d=0;c>b;++b)a[b].parent=this,d+=a[b].height;this.height=d}function hd(a){this.children=a;for(var b=0,c=0,d=0,e=a.length;e>d;++d){var f=a[d];b+=f.chunkSize(),c+=f.height,f.parent=this}this.size=b,this.height=c,this.parent=null}function id(a,b,c){function d(a,e,f){if(a.linked)for(var g=0;g<a.linked.length;++g){var h=a.linked[g];if(h.doc!=e){var i=f&&h.sharedHist;(!c||i)&&(b(h.doc,i),d(h.doc,a,i))}}}d(a,null,!0)}function jd(a,b){if(b.cm)throw new Error("This document is already in use.");a.doc=b,b.cm=a,f(a),c(a),a.options.lineWrapping||l(a),a.options.mode=b.modeOption,ib(a)}function kd(a,b){for(b-=a.first;!a.lines;)for(var c=0;;++c){var d=a.children[c],e=d.chunkSize();if(e>b){a=d;break}b-=e}return a.lines[b]}function ld(a,b,c){var d=[],e=b.line;return a.iter(b.line,c.line+1,function(a){var f=a.text;e==c.line&&(f=f.slice(0,c.ch)),e==b.line&&(f=f.slice(b.ch)),d.push(f),++e}),d}function md(a,b,c){var d=[];return a.iter(b,c,function(a){d.push(a.text)}),d}function nd(a,b){for(var c=b-a.height,d=a;d;d=d.parent)d.height+=c}function od(a){if(null==a.parent)return null;for(var b=a.parent,c=Xd(b.lines,a),d=b.parent;d;b=d,d=d.parent)for(var e=0;d.children[e]!=b;++e)c+=d.children[e].chunkSize();return c+b.first
3
+ }function pd(a,b){var c=a.first;a:do{for(var d=0,e=a.children.length;e>d;++d){var f=a.children[d],g=f.height;if(g>b){a=f;continue a}b-=g,c+=f.chunkSize()}return c}while(!a.lines);for(var d=0,e=a.lines.length;e>d;++d){var h=a.lines[d],i=h.height;if(i>b)break;b-=i}return c+d}function qd(a,b){b=Mc(a.doc,b);for(var c=0,d=b.parent,e=0;e<d.lines.length;++e){var f=d.lines[e];if(f==b)break;c+=f.height}for(var g=d.parent;g;d=g,g=d.parent)for(var e=0;e<g.children.length;++e){var h=g.children[e];if(h==d)break;c+=h.height}return c}function rd(a){var b=a.order;return null==b&&(b=a.order=Jf(a.text)),b}function sd(a){return{done:[],undone:[],undoDepth:1/0,lastTime:0,lastOp:null,lastOrigin:null,generation:a||1,maxGeneration:a||1}}function td(a,b,c,d){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,c),Math.min(a.first+a.size,d),function(c){c.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=c.markedSpans),++f})}function ud(a,b){var c={line:b.from.line,ch:b.from.ch},d={from:c,to:af(b),text:ld(a,b.from,b.to)};return td(a,d,b.from.line,b.to.line+1),id(a,function(a){td(a,d,b.from.line,b.to.line+1)},!0),d}function vd(a,b,c,d){var e=a.history;e.undone.length=0;var f=+new Date,g=Vd(e.done);if(g&&(e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastTime>f-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))){var h=Vd(g.changes);Tb(b.from,b.to)&&Tb(b.from,h.to)?h.to=af(b):g.changes.push(ud(a,b)),g.anchorAfter=c.anchor,g.headAfter=c.head}else for(g={changes:[ud(a,b)],generation:e.generation,anchorBefore:a.sel.anchor,headBefore:a.sel.head,anchorAfter:c.anchor,headAfter:c.head},e.done.push(g),e.generation=++e.maxGeneration;e.done.length>e.undoDepth;)e.done.shift();e.lastTime=f,e.lastOp=d,e.lastOrigin=b.origin}function wd(a){if(!a)return null;for(var b,c=0;c<a.length;++c)a[c].marker.explicitlyCleared?b||(b=a.slice(0,c)):b&&b.push(a[c]);return b?b.length?b:null:a}function xd(a,b){var c=b["spans_"+a.id];if(!c)return null;for(var d=0,e=[];d<b.text.length;++d)e.push(wd(c[d]));return e}function yd(a,b){for(var c=0,d=[];c<a.length;++c){var e=a[c],f=e.changes,g=[];d.push({changes:g,anchorBefore:e.anchorBefore,headBefore:e.headBefore,anchorAfter:e.anchorAfter,headAfter:e.headAfter});for(var h=0;h<f.length;++h){var i,j=f[h];if(g.push({from:j.from,to:j.to,text:j.text}),b)for(var k in j)(i=k.match(/^spans_(\d+)$/))&&Xd(b,Number(i[1]))>-1&&(Vd(g)[k]=j[k],delete j[k])}}return d}function zd(a,b,c,d){c<a.line?a.line+=d:b<a.line&&(a.line=b,a.ch=0)}function Ad(a,b,c,d){for(var e=0;e<a.length;++e){for(var f=a[e],g=!0,h=0;h<f.changes.length;++h){var i=f.changes[h];if(f.copied||(i.from=Vb(i.from),i.to=Vb(i.to)),c<i.from.line)i.from.line+=d,i.to.line+=d;else if(b<=i.to.line){g=!1;break}}f.copied||(f.anchorBefore=Vb(f.anchorBefore),f.headBefore=Vb(f.headBefore),f.anchorAfter=Vb(f.anchorAfter),f.readAfter=Vb(f.headAfter),f.copied=!0),g?(zd(f.anchorBefore),zd(f.headBefore),zd(f.anchorAfter),zd(f.headAfter)):(a.splice(0,e+1),e=0)}}function Bd(a,b){var c=b.from.line,d=b.to.line,e=b.text.length-(d-c)-1;Ad(a.done,c,d,e),Ad(a.undone,c,d,e)}function Cd(){Hd(this)}function Dd(a){return a.stop||(a.stop=Cd),a}function Ed(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function Fd(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function Gd(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function Hd(a){Ed(a),Fd(a)}function Id(a){return a.target||a.srcElement}function Jd(a){var b=a.which;return null==b&&(1&a.button?b=1:2&a.button?b=3:4&a.button&&(b=2)),Le&&a.ctrlKey&&1==b&&(b=3),b}function Kd(a,b,c){if(a.addEventListener)a.addEventListener(b,c,!1);else if(a.attachEvent)a.attachEvent("on"+b,c);else{var d=a._handlers||(a._handlers={}),e=d[b]||(d[b]=[]);e.push(c)}}function Ld(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);else{var d=a._handlers&&a._handlers[b];if(!d)return;for(var e=0;e<d.length;++e)if(d[e]==c){d.splice(e,1);break}}}function Md(a,b){var c=a._handlers&&a._handlers[b];if(c)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,d)}function Nd(a,b){function c(a){return function(){a.apply(null,e)}}var d=a._handlers&&a._handlers[b];if(d){var e=Array.prototype.slice.call(arguments,2);uf||(++vf,uf=[],setTimeout(Pd,0));for(var f=0;f<d.length;++f)uf.push(c(d[f]))}}function Od(a,b,c){return Md(a,c||b.type,a,b),Gd(b)||b.codemirrorIgnore}function Pd(){--vf;var a=uf;uf=null;for(var b=0;b<a.length;++b)a[b]()}function Qd(a,b){var c=a._handlers&&a._handlers[b];return c&&c.length>0}function Rd(a){a.prototype.on=function(a,b){Kd(this,a,b)},a.prototype.off=function(a,b){Ld(this,a,b)}}function Sd(){this.id=null}function Td(a,b,c,d,e){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));for(var f=d||0,g=e||0;b>f;++f)" "==a.charAt(f)?g+=c-g%c:++g;return g}function Ud(a){for(;yf.length<=a;)yf.push(Vd(yf)+" ");return yf[a]}function Vd(a){return a[a.length-1]}function Wd(a){if(Je)a.selectionStart=0,a.selectionEnd=a.value.length;else try{a.select()}catch(b){}}function Xd(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0,d=a.length;d>c;++c)if(a[c]==b)return c;return-1}function Yd(a,b){function c(){}c.prototype=a;var d=new c;return b&&Zd(b,d),d}function Zd(a,b){b||(b={});for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function $d(a){for(var b=[],c=0;a>c;++c)b.push(void 0);return b}function _d(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function ae(a){return/\w/.test(a)||a>"€"&&(a.toUpperCase()!=a.toLowerCase()||zf.test(a))}function be(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function ce(a,b,c,d){var e=document.createElement(a);if(c&&(e.className=c),d&&(e.style.cssText=d),"string"==typeof b)fe(e,b);else if(b)for(var f=0;f<b.length;++f)e.appendChild(b[f]);return e}function de(a){for(var b=a.childNodes.length;b>0;--b)a.removeChild(a.firstChild);return a}function ee(a,b){return de(a).appendChild(b)}function fe(a,b){ze?(a.innerHTML="",a.appendChild(document.createTextNode(b))):a.textContent=b}function ge(a){return a.getBoundingClientRect()}function he(){return!1}function ie(a){if(null!=Cf)return Cf;var b=ce("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return ee(a,b),b.offsetWidth&&(Cf=b.offsetHeight-b.clientHeight),Cf||0}function je(a){if(null==Df){var b=ce("span","​");ee(a,ce("span",[b,document.createTextNode("x")])),0!=a.firstChild.offsetHeight&&(Df=b.offsetWidth<=1&&b.offsetHeight>2&&!ye)}return Df?ce("span","​"):ce("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function ke(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=!1,f=0;f<a.length;++f){var g=a[f];(g.from<c&&g.to>b||b==c&&g.to==b)&&(d(Math.max(g.from,b),Math.min(g.to,c),1==g.level?"rtl":"ltr"),e=!0)}e||d(b,c,"ltr")}function le(a){return a.level%2?a.to:a.from}function me(a){return a.level%2?a.from:a.to}function ne(a){var b=rd(a);return b?le(b[0]):0}function oe(a){var b=rd(a);return b?me(Vd(b)):a.text.length}function pe(a,b){var c=kd(a.doc,b),d=Mc(a.doc,c);d!=c&&(b=od(d));var e=rd(d),f=e?e[0].level%2?oe(d):ne(d):0;return Sb(b,f)}function qe(a,b){for(var c,d;c=Lc(d=kd(a.doc,b));)b=c.find().to.line;var e=rd(d),f=e?e[0].level%2?ne(d):oe(d):d.text.length;return Sb(b,f)}function re(a,b,c){var d=a[0].level;return b==d?!0:c==d?!1:c>b}function se(a,b){for(var c,d=0;d<a.length;++d){var e=a[d];if(e.from<b&&e.to>b)return If=null,d;if(e.from==b||e.to==b){if(null!=c)return re(a,e.level,a[c].level)?(If=c,d):(If=d,c);c=d}}return If=null,c}function te(a,b,c,d){if(!d)return b+c;do b+=c;while(b>0&&Af.test(a.text.charAt(b)));return b}function ue(a,b,c,d){var e=rd(a);if(!e)return ve(a,b,c,d);for(var f=se(e,b),g=e[f],h=te(a,b,g.level%2?-c:c,d);;){if(h>g.from&&h<g.to)return h;if(h==g.from||h==g.to)return se(e,h)==f?h:(g=e[f+=c],c>0==g.level%2?g.to:g.from);if(g=e[f+=c],!g)return null;h=c>0==g.level%2?te(a,g.to,-1,d):te(a,g.from,1,d)}}function ve(a,b,c,d){var e=b+c;if(d)for(;e>0&&Af.test(a.text.charAt(e));)e+=c;return 0>e||e>a.text.length?null:e}var we=/gecko\/\d/i.test(navigator.userAgent),xe=/MSIE \d/.test(navigator.userAgent),ye=xe&&(null==document.documentMode||document.documentMode<8),ze=xe&&(null==document.documentMode||document.documentMode<9),Ae=/WebKit\//.test(navigator.userAgent),Be=Ae&&/Qt\/\d+\.\d+/.test(navigator.userAgent),Ce=/Chrome\//.test(navigator.userAgent),De=/Opera\//.test(navigator.userAgent),Ee=/Apple Computer/.test(navigator.vendor),Fe=/KHTML\//.test(navigator.userAgent),Ge=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),He=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),Ie=/PhantomJS/.test(navigator.userAgent),Je=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),Ke=Je||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),Le=Je||/Mac/.test(navigator.platform),Me=/windows/i.test(navigator.platform),Ne=De&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);Ne&&(Ne=Number(Ne[1])),Ne&&Ne>=15&&(De=!1,Ae=!0);var Oe,Pe,Qe,Re=Le&&(Be||De&&(null==Ne||12.11>Ne)),Se=we||xe&&!ze,Te=!1,Ue=!1,Ve=0,We=0,Xe=0,Ye=null;xe?Ye=-.53:we?Ye=15:Ce?Ye=-.7:Ee&&(Ye=-1/3);var Ze,$e,_e=null,af=a.changeEnd=function(a){return a.text?Sb(a.from.line+a.text.length-1,Vd(a.text).length+(1==a.text.length?a.from.ch:0)):a.to};a.Pos=Sb,a.prototype={constructor:a,focus:function(){window.focus(),nb(this),Fb(this),kb(this)},setOption:function(a,b){var c=this.options,d=c[a];(c[a]!=b||"mode"==a)&&(c[a]=b,bf.hasOwnProperty(a)&&fb(this,bf[a])(this,b,d))},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](a)},removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;c<b.length;++c)if(b[c]==a||"string"!=typeof b[c]&&b[c].name==a)return b.splice(c,1),!0},addOverlay:fb(null,function(b,c){var d=b.token?b:a.getMode(this.options,b);if(d.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:d,modeSpec:b,opaque:c&&c.opaque}),this.state.modeGen++,ib(this)}),removeOverlay:fb(null,function(a){for(var b=this.state.overlays,c=0;c<b.length;++c){var d=b[c].modeSpec;if(d==a||"string"==typeof a&&d.name==a)return b.splice(c,1),this.state.modeGen++,ib(this),void 0}}),indentLine:fb(null,function(a,b,c){"string"!=typeof b&&"number"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract"),Zb(this.doc,a)&&jc(this,a,b,c)}),indentSelection:fb(null,function(a){var b=this.doc.sel;if(Tb(b.from,b.to))return jc(this,b.from.line,a);for(var c=b.to.line-(b.to.ch?0:1),d=b.from.line;c>=d;++d)jc(this,d,a)}),getTokenAt:function(a,b){var c=this.doc;a=Xb(c,a);for(var d=J(this,a.line,b),e=this.doc.mode,f=kd(c,a.line),g=new wc(f.text,this.options.tabSize);g.pos<a.ch&&!g.eol();){g.start=g.pos;var h=e.token(g,d)}return{start:g.start,end:g.pos,string:g.current(),className:h||null,type:h||null,state:d}},getTokenTypeAt:function(a){a=Xb(this.doc,a);var b=Yc(this,kd(this.doc,a.line)),c=0,d=(b.length-1)/2,e=a.ch;if(0==e)return b[2];for(;;){var f=c+d>>1;if((f?b[2*f-1]:0)>=e)d=f;else{if(!(b[2*f+1]<e))return b[2*f+2];c=f+1}}},getModeAt:function(b){var c=this.doc.mode;return c.innerMode?a.innerMode(c,this.getTokenAt(b).state).mode:c},getHelper:function(a,b){if(jf.hasOwnProperty(b)){var c=jf[b],d=this.getModeAt(a);return d[b]&&c[d[b]]||d.helperType&&c[d.helperType]||c[d.name]}},getStateAfter:function(a,b){var c=this.doc;return a=Wb(c,null==a?c.first+c.size-1:a),J(this,a+1,b)},cursorCoords:function(a,b){var c,d=this.doc.sel;return c=null==a?d.head:"object"==typeof a?Xb(this.doc,a):a?d.from:d.to,Z(this,c,b||"page")},charCoords:function(a,b){return Y(this,Xb(this.doc,a),b||"page")},coordsChar:function(a,b){return a=X(this,a,b||"page"),_(this,a.left,a.top)},lineAtHeight:function(a,b){return a=X(this,{top:a,left:0},b||"page").top,pd(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b){var c=!1,d=this.doc.first+this.doc.size-1;a<this.doc.first?a=this.doc.first:a>d&&(a=d,c=!0);var e=kd(this.doc,a);return W(this,kd(this.doc,a),{top:0,left:0},b||"page").top+(c?e.height:0)},defaultTextHeight:function(){return bb(this.display)},defaultCharWidth:function(){return cb(this.display)},setGutterMarker:fb(null,function(a,b,c){return kc(this,a,function(a){var d=a.gutterMarkers||(a.gutterMarkers={});return d[b]=c,!c&&be(d)&&(a.gutterMarkers=null),!0})}),clearGutter:fb(null,function(a){var b=this,c=b.doc,d=c.first;c.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&(c.gutterMarkers[a]=null,ib(b,d,d+1),be(c.gutterMarkers)&&(c.gutterMarkers=null)),++d})}),addLineClass:fb(null,function(a,b,c){return kc(this,a,function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"wrapClass";if(a[d]){if(new RegExp("(?:^|\\s)"+c+"(?:$|\\s)").test(a[d]))return!1;a[d]+=" "+c}else a[d]=c;return!0})}),removeLineClass:fb(null,function(a,b,c){return kc(this,a,function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"wrapClass",e=a[d];if(!e)return!1;if(null==c)a[d]=null;else{var f=e.match(new RegExp("(?:^|\\s+)"+c+"(?:$|\\s+)"));if(!f)return!1;var g=f.index+f[0].length;a[d]=e.slice(0,f.index)+(f.index&&g!=e.length?" ":"")+e.slice(g)||null}return!0})}),addLineWidget:fb(null,function(a,b,c){return Tc(this,a,b,c)}),removeLineWidget:function(a){a.clear()},lineInfo:function(a){if("number"==typeof a){if(!Zb(this.doc,a))return null;var b=a;if(a=kd(this.doc,a),!a)return null}else{var b=od(a);if(null==b)return null}return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},getViewport:function(){return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=Z(this,Xb(this.doc,a));var g=a.bottom,h=a.left;if(b.style.position="absolute",f.sizer.appendChild(b),"over"==d)g=a.top;else if("above"==d||"near"==d){var i=Math.max(f.wrapper.clientHeight,this.doc.height),j=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);("above"==d||a.bottom+b.offsetHeight>i)&&a.top>b.offsetHeight?g=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=i&&(g=a.bottom),h+b.offsetWidth>j&&(h=j-b.offsetWidth)}b.style.top=g+"px",b.style.left=b.style.right="","right"==e?(h=f.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==e?h=0:"middle"==e&&(h=(f.sizer.clientWidth-b.offsetWidth)/2),b.style.left=h+"px"),c&&fc(this,h,g,h+b.offsetWidth,g+b.offsetHeight)},triggerOnKeyDown:fb(null,Db),execCommand:function(a){return kf[a](this)},findPosH:function(a,b,c,d){var e=1;0>b&&(e=-1,b=-b);for(var f=0,g=Xb(this.doc,a);b>f&&(g=lc(this.doc,g,e,c,d),!g.hitSide);++f);return g},moveH:fb(null,function(a,b){var c,d=this.doc.sel;c=d.shift||d.extend||Tb(d.from,d.to)?lc(this.doc,d.head,a,b,this.options.rtlMoveVisually):0>a?d.from:d.to,$b(this.doc,c,c,a)}),deleteH:fb(null,function(a,b){var c=this.doc.sel;Tb(c.from,c.to)?Rb(this.doc,"",c.from,lc(this.doc,c.head,a,b,!1),"+delete"):Rb(this.doc,"",c.from,c.to,"+delete"),this.curOp.userSelChange=!0}),findPosV:function(a,b,c,d){var e=1,f=d;0>b&&(e=-1,b=-b);for(var g=0,h=Xb(this.doc,a);b>g;++g){var i=Z(this,h,"div");if(null==f?f=i.left:i.left=f,h=mc(this,i,e,c),h.hitSide)break}return h},moveV:fb(null,function(a,b){var c=this.doc.sel,d=Z(this,c.head,"div");null!=c.goalColumn&&(d.left=c.goalColumn);var e=mc(this,d,a,b);"page"==b&&ic(this,0,Y(this,e,"div").top-d.top),$b(this.doc,e,e,a),c.goalColumn=d.left}),toggleOverwrite:function(a){(null==a||a!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?this.display.cursor.className+=" CodeMirror-overwrite":this.display.cursor.className=this.display.cursor.className.replace(" CodeMirror-overwrite",""))},hasFocus:function(){return this.state.focused},scrollTo:fb(null,function(a,b){hc(this,a,b)}),getScrollInfo:function(){var a=this.display.scroller,b=wf;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-b,width:a.scrollWidth-b,clientHeight:a.clientHeight-b,clientWidth:a.clientWidth-b}},scrollIntoView:fb(null,function(a,b){"number"==typeof a&&(a=Sb(a,0)),b||(b=0);var c=a;a&&null==a.line||(this.curOp.scrollToPos=a?Xb(this.doc,a):this.doc.sel.head,this.curOp.scrollToPosMargin=b,c=Z(this,this.curOp.scrollToPos));var d=gc(this,c.left,c.top-b,c.right,c.bottom+b);hc(this,d.scrollLeft,d.scrollTop)}),setSize:fb(null,function(a,b){function c(a){return"number"==typeof a||/^\d+$/.test(String(a))?a+"px":a}null!=a&&(this.display.wrapper.style.width=c(a)),null!=b&&(this.display.wrapper.style.height=c(b)),this.options.lineWrapping&&(this.display.measureLineCache.length=this.display.measureLineCachePos=0),this.curOp.forceUpdate=!0}),operation:function(a){return hb(this,a)},refresh:fb(null,function(){T(this),hc(this,this.doc.scrollLeft,this.doc.scrollTop),ib(this)}),swapDoc:fb(null,function(a){var b=this.doc;return b.cm=null,jd(this,a),T(this),mb(this,!0),hc(this,a.scrollLeft,a.scrollTop),b}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Rd(a);var bf=a.optionHandlers={},cf=a.defaults={},df=a.Init={toString:function(){return"CodeMirror.Init"}};pc("value","",function(a,b){a.setValue(b)},!0),pc("mode",null,function(a,b){a.doc.modeOption=b,c(a)},!0),pc("indentUnit",2,c,!0),pc("indentWithTabs",!1),pc("smartIndent",!0),pc("tabSize",4,function(a){c(a),T(a),ib(a)},!0),pc("electricChars",!0),pc("rtlMoveVisually",!Me),pc("theme","default",function(a){h(a),i(a)},!0),pc("keyMap","default",g),pc("extraKeys",null),pc("onKeyEvent",null),pc("onDragEvent",null),pc("lineWrapping",!1,d,!0),pc("gutters",[],function(a){m(a.options),i(a)},!0),pc("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?s(a.display)+"px":"0",a.refresh()},!0),pc("coverGutterNextToScrollbar",!1,n,!0),pc("lineNumbers",!1,function(a){m(a.options),i(a)},!0),pc("firstLineNumber",1,i,!0),pc("lineNumberFormatter",function(a){return a},i,!0),pc("showCursorWhenSelecting",!1,C,!0),pc("readOnly",!1,function(a,b){"nocursor"==b?(Gb(a),a.display.input.blur()):b||mb(a,!0)}),pc("dragDrop",!0),pc("cursorBlinkRate",530),pc("cursorScrollMargin",0),pc("cursorHeight",1),pc("workTime",100),pc("workDelay",100),pc("flattenSpans",!0),pc("pollInterval",100),pc("undoDepth",40,function(a,b){a.doc.history.undoDepth=b}),pc("historyEventDelay",500),pc("viewportMargin",10,function(a){a.refresh()},!0),pc("maxHighlightLength",1e4,function(a){c(a),a.refresh()},!0),pc("moveInputWithCursor",!0,function(a,b){b||(a.display.inputDiv.style.top=a.display.inputDiv.style.left=0)}),pc("tabindex",null,function(a,b){a.display.input.tabIndex=b||""}),pc("autofocus",null);var ef=a.modes={},ff=a.mimeModes={};a.defineMode=function(b,c){if(a.defaults.mode||"null"==b||(a.defaults.mode=b),arguments.length>2){c.dependencies=[];for(var d=2;d<arguments.length;++d)c.dependencies.push(arguments[d])}ef[b]=c},a.defineMIME=function(a,b){ff[a]=b},a.resolveMode=function(b){if("string"==typeof b&&ff.hasOwnProperty(b))b=ff[b];else if(b&&"string"==typeof b.name&&ff.hasOwnProperty(b.name)){var c=ff[b.name];b=Yd(c,b),b.name=c.name}else if("string"==typeof b&&/^[\w\-]+\/[\w\-]+\+xml$/.test(b))return a.resolveMode("application/xml");return"string"==typeof b?{name:b}:b||{name:"null"}},a.getMode=function(b,c){var c=a.resolveMode(c),d=ef[c.name];if(!d)return a.getMode(b,"text/plain");var e=d(b,c);if(gf.hasOwnProperty(c.name)){var f=gf[c.name];for(var g in f)f.hasOwnProperty(g)&&(e.hasOwnProperty(g)&&(e["_"+g]=e[g]),e[g]=f[g])}return e.name=c.name,e},a.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}}),a.defineMIME("text/plain","null");var gf=a.modeExtensions={};a.extendMode=function(a,b){var c=gf.hasOwnProperty(a)?gf[a]:gf[a]={};Zd(b,c)},a.defineExtension=function(b,c){a.prototype[b]=c},a.defineDocExtension=function(a,b){rf.prototype[a]=b},a.defineOption=pc;var hf=[];a.defineInitHook=function(a){hf.push(a)};var jf=a.helpers={};a.registerHelper=function(b,c,d){jf.hasOwnProperty(b)||(jf[b]=a[b]={}),jf[b][c]=d},a.isWordChar=ae,a.copyState=qc,a.startState=rc,a.innerMode=function(a,b){for(;a.innerMode;){var c=a.innerMode(b);if(!c||c.mode==a)break;b=c.state,a=c.mode}return c||{mode:a,state:b}};var kf=a.commands={selectAll:function(a){a.setSelection(Sb(a.firstLine(),0),Sb(a.lastLine()))},killLine:function(a){var b=a.getCursor(!0),c=a.getCursor(!1),d=!Tb(b,c);d||a.getLine(b.line).length!=b.ch?a.replaceRange("",b,d?c:Sb(b.line),"+delete"):a.replaceRange("",b,Sb(b.line+1,0),"+delete")},deleteLine:function(a){var b=a.getCursor().line;a.replaceRange("",Sb(b,0),Sb(b),"+delete")},delLineLeft:function(a){var b=a.getCursor();a.replaceRange("",Sb(b.line,0),b,"+delete")},undo:function(a){a.undo()},redo:function(a){a.redo()},goDocStart:function(a){a.extendSelection(Sb(a.firstLine(),0))},goDocEnd:function(a){a.extendSelection(Sb(a.lastLine()))},goLineStart:function(a){a.extendSelection(pe(a,a.getCursor().line))},goLineStartSmart:function(a){var b=a.getCursor(),c=pe(a,b.line),d=a.getLineHandle(c.line),e=rd(d);if(e&&0!=e[0].level)a.extendSelection(c);else{var f=Math.max(0,d.text.search(/\S/)),g=b.line==c.line&&b.ch<=f&&b.ch;a.extendSelection(Sb(c.line,g?0:f))}},goLineEnd:function(a){a.extendSelection(qe(a,a.getCursor().line))},goLineRight:function(a){var b=a.charCoords(a.getCursor(),"div").top+5;a.extendSelection(a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:b},"div"))},goLineLeft:function(a){var b=a.charCoords(a.getCursor(),"div").top+5;a.extendSelection(a.coordsChar({left:0,top:b},"div"))},goLineUp:function(a){a.moveV(-1,"line")},goLineDown:function(a){a.moveV(1,"line")},goPageUp:function(a){a.moveV(-1,"page")},goPageDown:function(a){a.moveV(1,"page")},goCharLeft:function(a){a.moveH(-1,"char")},goCharRight:function(a){a.moveH(1,"char")},goColumnLeft:function(a){a.moveH(-1,"column")},goColumnRight:function(a){a.moveH(1,"column")},goWordLeft:function(a){a.moveH(-1,"word")},goGroupRight:function(a){a.moveH(1,"group")},goGroupLeft:function(a){a.moveH(-1,"group")},goWordRight:function(a){a.moveH(1,"word")},delCharBefore:function(a){a.deleteH(-1,"char")},delCharAfter:function(a){a.deleteH(1,"char")},delWordBefore:function(a){a.deleteH(-1,"word")},delWordAfter:function(a){a.deleteH(1,"word")},delGroupBefore:function(a){a.deleteH(-1,"group")},delGroupAfter:function(a){a.deleteH(1,"group")},indentAuto:function(a){a.indentSelection("smart")},indentMore:function(a){a.indentSelection("add")},indentLess:function(a){a.indentSelection("subtract")},insertTab:function(a){a.replaceSelection(" ","end","+input")},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.replaceSelection(" ","end","+input")},transposeChars:function(a){var b=a.getCursor(),c=a.getLine(b.line);b.ch>0&&b.ch<c.length-1&&a.replaceRange(c.charAt(b.ch)+c.charAt(b.ch-1),Sb(b.line,b.ch-1),Sb(b.line,b.ch+1))},newlineAndIndent:function(a){fb(a,function(){a.replaceSelection("\n","end","+input"),a.indentLine(a.getCursor().line,null,!0)})()},toggleOverwrite:function(a){a.toggleOverwrite()}},lf=a.keyMap={};lf.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite"},lf.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Alt-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","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",fallthrough:"basic"},lf.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","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":"delLineLeft",fallthrough:["basic","emacsy"]},lf["default"]=Le?lf.macDefault:lf.pcDefault,lf.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"},a.lookupKey=tc,a.isModifierKey=uc,a.keyName=vc,a.fromTextArea=function(b,c){function d(){b.value=j.getValue()}if(c||(c={}),c.value=b.value,!c.tabindex&&b.tabindex&&(c.tabindex=b.tabindex),!c.placeholder&&b.placeholder&&(c.placeholder=b.placeholder),null==c.autofocus){var e=document.body;try{e=document.activeElement}catch(f){}c.autofocus=e==b||null!=b.getAttribute("autofocus")&&e==document.body}if(b.form&&(Kd(b.form,"submit",d),!c.leaveSubmitMethodAlone)){var g=b.form,h=g.submit;try{var i=g.submit=function(){d(),g.submit=h,g.submit(),g.submit=i}}catch(f){}}b.style.display="none";var j=a(function(a){b.parentNode.insertBefore(a,b.nextSibling)},c);return j.save=d,j.getTextArea=function(){return b},j.toTextArea=function(){d(),b.parentNode.removeChild(j.getWrapperElement()),b.style.display="",b.form&&(Ld(b.form,"submit",d),"function"==typeof b.form.submit&&(b.form.submit=h))},j},wc.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return 0==this.pos},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},eat:function(a){var b=this.string.charAt(this.pos);if("string"==typeof a)var c=b==a;else var c=b&&(a.test?a.test(b):a(b));return c?(++this.pos,b):void 0},eatWhile:function(a){for(var b=this.pos;this.eat(a););return this.pos>b},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){var b=this.string.indexOf(a,this.pos);return b>-1?(this.pos=b,!0):void 0},backUp:function(a){this.pos-=a},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Td(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue},indentation:function(){return Td(this.string,null,this.tabSize)},match:function(a,b,c){if("string"!=typeof a){var d=this.string.slice(this.pos).match(a);return d&&d.index>0?null:(d&&b!==!1&&(this.pos+=d[0].length),d)}var e=function(a){return c?a.toLowerCase():a},f=this.string.substr(this.pos,a.length);return e(f)==e(a)?(b!==!1&&(this.pos+=a.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)}},a.StringStream=wc,a.TextMarker=xc,Rd(xc),xc.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;if(b&&db(a),Qd(this,"clear")){var c=this.find();c&&Nd(this,"clear",c.from,c.to)}for(var d=null,e=null,f=0;f<this.lines.length;++f){var g=this.lines[f],h=Bc(g.markedSpans,this);null!=h.to&&(e=od(g)),g.markedSpans=Cc(g.markedSpans,h),null!=h.from?d=od(g):this.collapsed&&!Nc(this.doc,g)&&a&&nd(g,bb(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(var f=0;f<this.lines.length;++f){var i=Mc(a.doc,this.lines[f]),j=k(a.doc,i);j>a.display.maxLineLength&&(a.display.maxLine=i,a.display.maxLineLength=j,a.display.maxLineChanged=!0)}null!=d&&a&&ib(a,d,e+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&bc(a)),b&&eb(a)}},xc.prototype.find=function(){for(var a,b,c=0;c<this.lines.length;++c){var d=this.lines[c],e=Bc(d.markedSpans,this);if(null!=e.from||null!=e.to){var f=od(d);null!=e.from&&(a=Sb(f,e.from)),null!=e.to&&(b=Sb(f,e.to))}}return"bookmark"==this.type?a:a&&{from:a,to:b}},xc.prototype.changed=function(){var a=this.find(),b=this.doc.cm;if(a&&b){var c=kd(this.doc,a.from.line);if(P(b,c),a.from.line>=b.display.showingFrom&&a.from.line<b.display.showingTo){for(var d=b.display.lineDiv.firstChild;d;d=d.nextSibling)if(d.lineObj==c){d.offsetHeight!=c.height&&nd(c,d.offsetHeight);break}hb(b,function(){b.curOp.selectionChanged=b.curOp.forceUpdate=b.curOp.updateMaxLine=!0})}}},xc.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&-1!=Xd(b.maybeHiddenMarkers,this)||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)},xc.prototype.detachLine=function(a){if(this.lines.splice(Xd(this.lines,a),1),!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;(b.maybeHiddenMarkers||(b.maybeHiddenMarkers=[])).push(this)}},a.SharedTextMarker=zc,Rd(zc),zc.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();Nd(this,"clear")}},zc.prototype.find=function(){return this.primary.find()};var mf=a.LineWidget=function(a,b,c){if(c)for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);this.cm=a,this.node=b};Rd(mf),mf.prototype.clear=Rc(function(){var a=this.line.widgets,b=od(this.line);if(null!=b&&a){for(var c=0;c<a.length;++c)a[c]==this&&a.splice(c--,1);a.length||(this.line.widgets=null);var d=qd(this.cm,this.line)<this.cm.doc.scrollTop;nd(this.line,Math.max(0,this.line.height-Sc(this))),d&&ic(this.cm,0,-this.height),ib(this.cm,b,b+1)}}),mf.prototype.changed=Rc(function(){var a=this.height;this.height=null;var b=Sc(this)-a;if(b){nd(this.line,this.line.height+b);var c=od(this.line);ib(this.cm,c,c+1)}});var nf=a.Line=function(a,b,c){this.text=a,Qc(this,b),this.height=c?c(this):1};Rd(nf);var of={},pf=/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\uFEFF]/g;gd.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var c=a,d=a+b;d>c;++c){var e=this.lines[c];this.height-=e.height,Vc(e),Nd(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.splice.apply(a,[a.length,0].concat(this.lines))},insertInner:function(a,b,c){this.height+=c,this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));for(var d=0,e=b.length;e>d;++d)b[d].parent=this},iterN:function(a,b,c){for(var d=a+b;d>a;++a)if(c(this.lines[a]))return!0}},hd.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){this.size-=b;for(var c=0;c<this.children.length;++c){var d=this.children[c],e=d.chunkSize();if(e>a){var f=Math.min(b,e-a),g=d.height;if(d.removeInner(a,f),this.height-=g-d.height,e==f&&(this.children.splice(c--,1),d.parent=null),0==(b-=f))break;a=0}else a-=e}if(this.size-b<25){var h=[];this.collapse(h),this.children=[new gd(h)],this.children[0].parent=this}},collapse:function(a){for(var b=0,c=this.children.length;c>b;++b)this.children[b].collapse(a)},insertInner:function(a,b,c){this.size+=b.length,this.height+=c;for(var d=0,e=this.children.length;e>d;++d){var f=this.children[d],g=f.chunkSize();if(g>=a){if(f.insertInner(a,b,c),f.lines&&f.lines.length>50){for(;f.lines.length>50;){var h=f.lines.splice(f.lines.length-25,25),i=new gd(h);f.height-=i.height,this.children.splice(d+1,0,i),i.parent=this}this.maybeSpill()}break}a-=g}},maybeSpill:function(){if(!(this.children.length<=10)){var a=this;do{var b=a.children.splice(a.children.length-5,5),c=new hd(b);if(a.parent){a.size-=c.size,a.height-=c.height;var d=Xd(a.parent.children,a);a.parent.children.splice(d+1,0,c)}else{var e=new hd(a.children);e.parent=a,a.children=[e,c],a=e}c.parent=a.parent}while(a.children.length>10);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=0,e=this.children.length;e>d;++d){var f=this.children[d],g=f.chunkSize();
4
+ if(g>a){var h=Math.min(b,g-a);if(f.iterN(a,h,c))return!0;if(0==(b-=h))break;a=0}else a-=g}}};var qf=0,rf=a.Doc=function(a,b,c){if(!(this instanceof rf))return new rf(a,b,c);null==c&&(c=0),hd.call(this,[new gd([new nf("",null)])]),this.first=c,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.history=sd(),this.cleanGeneration=1,this.frontier=c;var d=Sb(c,0);this.sel={from:d,to:d,head:d,anchor:d,shift:!1,extend:!1,goalColumn:null},this.id=++qf,this.modeOption=b,"string"==typeof a&&(a=Ef(a)),fd(this,{from:d,to:d,text:a},null,{head:d,anchor:d})};rf.prototype=Yd(hd.prototype,{constructor:rf,iter:function(a,b,c){c?this.iterN(a-this.first,b-a,c):this.iterN(this.first,this.first+this.size,a)},insert:function(a,b){for(var c=0,d=0,e=b.length;e>d;++d)c+=b[d].height;this.insertInner(a-this.first,b,c)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a){var b=md(this,this.first,this.first+this.size);return a===!1?b:b.join(a||"\n")},setValue:function(a){var b=Sb(this.first,0),c=this.first+this.size-1;Lb(this,{from:b,to:Sb(c,kd(this,c).text.length),text:Ef(a),origin:"setValue"},{head:b,anchor:b},!0)},replaceRange:function(a,b,c,d){b=Xb(this,b),c=c?Xb(this,c):b,Rb(this,a,b,c,d)},getRange:function(a,b,c){var d=ld(this,Xb(this,a),Xb(this,b));return c===!1?d:d.join(c||"\n")},getLine:function(a){var b=this.getLineHandle(a);return b&&b.text},setLine:function(a,b){Zb(this,a)&&Rb(this,b,Sb(a,0),Xb(this,Sb(a)))},removeLine:function(a){a?Rb(this,"",Xb(this,Sb(a-1)),Xb(this,Sb(a))):Rb(this,"",Sb(0,0),Xb(this,Sb(1,0)))},getLineHandle:function(a){return Zb(this,a)?kd(this,a):void 0},getLineNumber:function(a){return od(a)},getLineHandleVisualStart:function(a){return"number"==typeof a&&(a=kd(this,a)),Mc(this,a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return Xb(this,a)},getCursor:function(a){var b,c=this.sel;return b=null==a||"head"==a?c.head:"anchor"==a?c.anchor:"end"==a||a===!1?c.to:c.from,Vb(b)},somethingSelected:function(){return!Tb(this.sel.head,this.sel.anchor)},setCursor:gb(function(a,b,c){var d=Xb(this,"number"==typeof a?Sb(a,b||0):a);c?$b(this,d):ac(this,d,d)}),setSelection:gb(function(a,b){ac(this,Xb(this,a),Xb(this,b||a))}),extendSelection:gb(function(a,b){$b(this,Xb(this,a),b&&Xb(this,b))}),getSelection:function(a){return this.getRange(this.sel.from,this.sel.to,a)},replaceSelection:function(a,b,c){Lb(this,{from:this.sel.from,to:this.sel.to,text:Ef(a),origin:c},b||"around")},undo:gb(function(){Nb(this,"undo")}),redo:gb(function(){Nb(this,"redo")}),setExtending:function(a){this.sel.extend=a},historySize:function(){var a=this.history;return{undo:a.done.length,redo:a.undone.length}},clearHistory:function(){this.history=sd(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration()},changeGeneration:function(){return this.history.lastOp=this.history.lastOrigin=null,this.history.generation},isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},getHistory:function(){return{done:yd(this.history.done),undone:yd(this.history.undone)}},setHistory:function(a){var b=this.history=sd(this.history.maxGeneration);b.done=a.done.slice(0),b.undone=a.undone.slice(0)},markText:function(a,b,c){return yc(this,Xb(this,a),Xb(this,b),c,"range")},setBookmark:function(a,b){var c={replacedWith:b&&(null==b.nodeType?b.widget:b),insertLeft:b&&b.insertLeft};return a=Xb(this,a),yc(this,a,a,c,"bookmark")},findMarksAt:function(a){a=Xb(this,a);var b=[],c=kd(this,a.line).markedSpans;if(c)for(var d=0;d<c.length;++d){var e=c[d];(null==e.from||e.from<=a.ch)&&(null==e.to||e.to>=a.ch)&&b.push(e.marker.parent||e.marker)}return b},getAllMarks:function(){var a=[];return this.iter(function(b){var c=b.markedSpans;if(c)for(var d=0;d<c.length;++d)null!=c[d].from&&a.push(c[d].marker)}),a},posFromIndex:function(a){var b,c=this.first;return this.iter(function(d){var e=d.text.length+1;return e>a?(b=a,!0):(a-=e,++c,void 0)}),Xb(this,Sb(c,b))},indexFromPos:function(a){a=Xb(this,a);var b=a.ch;return a.line<this.first||a.ch<0?0:(this.iter(this.first,a.line,function(a){b+=a.text.length+1}),b)},copy:function(a){var b=new rf(md(this,this.first,this.first+this.size),this.modeOption,this.first);return b.scrollTop=this.scrollTop,b.scrollLeft=this.scrollLeft,b.sel={from:this.sel.from,to:this.sel.to,head:this.sel.head,anchor:this.sel.anchor,shift:this.sel.shift,extend:!1,goalColumn:this.sel.goalColumn},a&&(b.history.undoDepth=this.history.undoDepth,b.setHistory(this.getHistory())),b},linkedDoc:function(a){a||(a={});var b=this.first,c=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from),null!=a.to&&a.to<c&&(c=a.to);var d=new rf(md(this,b,c),a.mode||this.modeOption,b);return a.sharedHist&&(d.history=this.history),(this.linked||(this.linked=[])).push({doc:d,sharedHist:a.sharedHist}),d.linked=[{doc:this,isParent:!0,sharedHist:a.sharedHist}],d},unlinkDoc:function(b){if(b instanceof a&&(b=b.doc),this.linked)for(var c=0;c<this.linked.length;++c){var d=this.linked[c];if(d.doc==b){this.linked.splice(c,1),b.unlinkDoc(this);break}}if(b.history==this.history){var e=[b.id];id(b,function(a){e.push(a.id)},!0),b.history=sd(),b.history.done=yd(this.history.done,e),b.history.undone=yd(this.history.undone,e)}},iterLinkedDocs:function(a){id(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),rf.prototype.eachLine=rf.prototype.iter;var sf="iter insert remove copy getEditor".split(" ");for(var tf in rf.prototype)rf.prototype.hasOwnProperty(tf)&&Xd(sf,tf)<0&&(a.prototype[tf]=function(a){return function(){return a.apply(this.doc,arguments)}}(rf.prototype[tf]));Rd(rf),a.e_stop=Hd,a.e_preventDefault=Ed,a.e_stopPropagation=Fd;var uf,vf=0;a.on=Kd,a.off=Ld,a.signal=Md;var wf=30,xf=a.Pass={toString:function(){return"CodeMirror.Pass"}};Sd.prototype={set:function(a,b){clearTimeout(this.id),this.id=setTimeout(b,a)}},a.countColumn=Td;var yf=[""],zf=/[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Af=/[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\uA66F\uA670-\uA672\uA674-\uA67D\uA69F\udc00-\udfff]/;a.replaceGetRect=function(a){ge=a};var Bf=function(){if(ze)return!1;var a=ce("div");return"draggable"in a||"dragDrop"in a}();we?he=function(a,b){return 36==a.charCodeAt(b-1)&&39==a.charCodeAt(b)}:Ee&&!/Version\/([6-9]|\d\d)\b/.test(navigator.userAgent)?he=function(a,b){return/\-[^ \-?]|\?[^ !\'\"\),.\-\/:;\?\]\}]/.test(a.slice(b-1,b+1))}:Ae&&!/Chrome\/(?:29|[3-9]\d|\d\d\d)\./.test(navigator.userAgent)&&(he=function(a,b){if(b>1&&45==a.charCodeAt(b-1)){if(/\w/.test(a.charAt(b-2))&&/[^\-?\.]/.test(a.charAt(b)))return!0;if(b>2&&/[\d\.,]/.test(a.charAt(b-2))&&/[\d\.,]/.test(a.charAt(b)))return!1}return/[~!#%&*)=+}\]|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\^&*(_=+{[|><]|…[\w~`@#$%\^&*(_=+{[><]/.test(a.slice(b-1,b+1))});var Cf,Df,Ef=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;d>=b;){var e=a.indexOf("\n",b);-1==e&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");-1!=g?(c.push(f.slice(0,g)),b+=g+1):(c.push(f),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)};a.splitLines=Ef;var Ff=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){}return b&&b.parentElement()==a?0!=b.compareEndPoints("StartToEnd",b):!1},Gf=function(){var a=ce("div");return"oncopy"in a?!0:(a.setAttribute("oncopy","return;"),"function"==typeof a.oncopy)}(),Hf={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:";",91:"Mod",92:"Mod",93:"Mod",109:"-",107:"=",127:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};a.keyNames=Hf,function(){for(var a=0;10>a;a++)Hf[a+48]=String(a);for(var a=65;90>=a;a++)Hf[a]=String.fromCharCode(a);for(var a=1;12>=a;a++)Hf[a+111]=Hf[a+63235]="F"+a}();var If,Jf=function(){function a(a){return 255>=a?b.charAt(a):a>=1424&&1524>=a?"R":a>=1536&&1791>=a?c.charAt(a-1536):a>=1792&&2220>=a?"r":"L"}var b="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL",c="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr",d=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,e=/[stwN]/,f=/[LRr]/,g=/[Lb1n]/,h=/[1n]/,i="L";return function(b){if(!d.test(b))return!1;for(var c,j=b.length,k=[],l=0;j>l;++l)k.push(c=a(b.charCodeAt(l)));for(var l=0,m=i;j>l;++l){var c=k[l];"m"==c?k[l]=m:m=c}for(var l=0,n=i;j>l;++l){var c=k[l];"1"==c&&"r"==n?k[l]="n":f.test(c)&&(n=c,"r"==c&&(k[l]="R"))}for(var l=1,m=k[0];j-1>l;++l){var c=k[l];"+"==c&&"1"==m&&"1"==k[l+1]?k[l]="1":","!=c||m!=k[l+1]||"1"!=m&&"n"!=m||(k[l]=m),m=c}for(var l=0;j>l;++l){var c=k[l];if(","==c)k[l]="N";else if("%"==c){for(var o=l+1;j>o&&"%"==k[o];++o);for(var p=l&&"!"==k[l-1]||j-1>o&&"1"==k[o]?"1":"N",q=l;o>q;++q)k[q]=p;l=o-1}}for(var l=0,n=i;j>l;++l){var c=k[l];"L"==n&&"1"==c?k[l]="L":f.test(c)&&(n=c)}for(var l=0;j>l;++l)if(e.test(k[l])){for(var o=l+1;j>o&&e.test(k[o]);++o);for(var r="L"==(l?k[l-1]:i),s="L"==(j-1>o?k[o]:i),p=r||s?"L":"R",q=l;o>q;++q)k[q]=p;l=o-1}for(var t,u=[],l=0;j>l;)if(g.test(k[l])){var v=l;for(++l;j>l&&g.test(k[l]);++l);u.push({from:v,to:l,level:0})}else{var w=l,x=u.length;for(++l;j>l&&"L"!=k[l];++l);for(var q=w;l>q;)if(h.test(k[q])){q>w&&u.splice(x,0,{from:w,to:q,level:1});var y=q;for(++q;l>q&&h.test(k[q]);++q);u.splice(x,0,{from:y,to:q,level:2}),w=q}else++q;l>w&&u.splice(x,0,{from:w,to:l,level:1})}return 1==u[0].level&&(t=b.match(/^\s+/))&&(u[0].from=t[0].length,u.unshift({from:0,to:t[0].length,level:0})),1==Vd(u).level&&(t=b.match(/\s+$/))&&(Vd(u).to-=t[0].length,u.push({from:j-t[0].length,to:j,level:0})),u[0].level!=Vd(u).level&&u.push({from:j,to:j,level:u[0].level}),u}}();return a.version="3.15.0",a}(),CodeMirror.defineMode("clike",function(a,b){function c(a,b){var c=a.next();if(q[c]){var f=q[c](a,b);if(f!==!1)return f}if('"'==c||"'"==c)return b.tokenize=d(c),b.tokenize(a,b);if(/[\[\]{}\(\),;\:\.]/.test(c))return i=c,null;if(/\d/.test(c))return a.eatWhile(/[\w\.]/),"number";if("/"==c){if(a.eat("*"))return b.tokenize=e,e(a,b);if(a.eat("/"))return a.skipToEnd(),"comment"}if(s.test(c))return a.eatWhile(s),"operator";a.eatWhile(/[\w\$_]/);var g=a.current();return m.propertyIsEnumerable(g)?(o.propertyIsEnumerable(g)&&(i="newstatement"),"keyword"):n.propertyIsEnumerable(g)?(o.propertyIsEnumerable(g)&&(i="newstatement"),"builtin"):p.propertyIsEnumerable(g)?"atom":"variable"}function d(a){return function(b,c){for(var d,e=!1,f=!1;null!=(d=b.next());){if(d==a&&!e){f=!0;break}e=!e&&"\\"==d}return(f||!e&&!r)&&(c.tokenize=null),"string"}}function e(a,b){for(var c,d=!1;c=a.next();){if("/"==c&&d){b.tokenize=null;break}d="*"==c}return"comment"}function f(a,b,c,d,e){this.indented=a,this.column=b,this.type=c,this.align=d,this.prev=e}function g(a,b,c){var d=a.indented;return a.context&&"statement"==a.context.type&&(d=a.context.indented),a.context=new f(d,b,c,null,a.context)}function h(a){var b=a.context.type;return(")"==b||"]"==b||"}"==b)&&(a.indented=a.context.indented),a.context=a.context.prev}var i,j=a.indentUnit,k=b.statementIndentUnit||j,l=b.dontAlignCalls,m=b.keywords||{},n=b.builtin||{},o=b.blockKeywords||{},p=b.atoms||{},q=b.hooks||{},r=b.multiLineStrings,s=/[+\-*&%=<>!?|\/]/;return{startState:function(a){return{tokenize:null,context:new f((a||0)-j,0,"top",!1),indented:0,startOfLine:!0}},token:function(a,b){var d=b.context;if(a.sol()&&(null==d.align&&(d.align=!1),b.indented=a.indentation(),b.startOfLine=!0),a.eatSpace())return null;i=null;var e=(b.tokenize||c)(a,b);if("comment"==e||"meta"==e)return e;if(null==d.align&&(d.align=!0),";"!=i&&":"!=i&&","!=i||"statement"!=d.type)if("{"==i)g(b,a.column(),"}");else if("["==i)g(b,a.column(),"]");else if("("==i)g(b,a.column(),")");else if("}"==i){for(;"statement"==d.type;)d=h(b);for("}"==d.type&&(d=h(b));"statement"==d.type;)d=h(b)}else i==d.type?h(b):(("}"==d.type||"top"==d.type)&&";"!=i||"statement"==d.type&&"newstatement"==i)&&g(b,a.column(),"statement");else h(b);return b.startOfLine=!1,e},indent:function(a,b){if(a.tokenize!=c&&null!=a.tokenize)return CodeMirror.Pass;var d=a.context,e=b&&b.charAt(0);"statement"==d.type&&"}"==e&&(d=d.prev);var f=e==d.type;return"statement"==d.type?d.indented+("{"==e?0:k):!d.align||l&&")"==d.type?")"!=d.type||f?d.indented+(f?0:j):d.indented+k:d.column+(f?0:1)},electricChars:"{}",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",fold:"brace"}}),function(){function a(a){for(var b={},c=a.split(" "),d=0;d<c.length;++d)b[c[d]]=!0;return b}function b(a,c){if(!c.startOfLine)return!1;for(;;){if(!a.skipTo("\\")){a.skipToEnd(),c.tokenize=null;break}if(a.next(),a.eol()){c.tokenize=b;break}}return"meta"}function c(a,b){for(var c;null!=(c=a.next());)if('"'==c&&!a.eat('"')){b.tokenize=null;break}return"string"}function d(a,b){for(var c=0;c<a.length;++c)CodeMirror.defineMIME(a[c],b)}var e="auto if break int case long char register continue return default short do sizeof double static else struct entry switch extern typedef float union for unsigned goto while enum void const signed volatile";d(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:a(e),blockKeywords:a("case do else for if switch while struct"),atoms:a("null"),hooks:{"#":b}}),d(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:a(e+" asm dynamic_cast namespace reinterpret_cast try bool explicit new "+"static_cast typeid catch operator template typename class friend private "+"this using const_cast inline public throw virtual delete mutable protected "+"wchar_t"),blockKeywords:a("catch class do else finally for if struct switch try while"),atoms:a("true false null"),hooks:{"#":b}}),CodeMirror.defineMIME("text/x-java",{name:"clike",keywords:a("abstract assert boolean break byte case catch char class const continue default do double else enum extends final finally float for goto if implements import instanceof int interface long native new package private protected public return short static strictfp super switch synchronized this throw throws transient try void volatile while"),blockKeywords:a("catch class do else finally for if switch try while"),atoms:a("true false null"),hooks:{"@":function(a){return a.eatWhile(/[\w\$_]/),"meta"}}}),CodeMirror.defineMIME("text/x-csharp",{name:"clike",keywords:a("abstract as 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"),blockKeywords:a("catch class do else finally for foreach if struct switch try while"),builtin:a("Boolean Byte Char DateTime DateTimeOffset Decimal Double Guid Int16 Int32 Int64 Object SByte Single String TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),atoms:a("true false null"),hooks:{"@":function(a,b){return a.eat('"')?(b.tokenize=c,c(a,b)):(a.eatWhile(/[\w\$_]/),"meta")}}}),CodeMirror.defineMIME("text/x-scala",{name:"clike",keywords:a("abstract case catch class def do else extends false final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try trye type val var while with yield _ : = => <- <: <% >: # @ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq 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"),blockKeywords:a("catch class do else finally for forSome if match switch try while"),atoms:a("true false null"),hooks:{"@":function(a){return a.eatWhile(/[\w\$_]/),"meta"}}}),d(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:a("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4 sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadowconst attribute uniform varying break continue discard return for while do if else struct in out inout"),blockKeywords:a("for while do if else struct"),builtin:a("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 smootstep 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:a("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_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragColor 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"),hooks:{"#":b}})}(),function(){function a(a){for(var b={},c=a.split(" "),d=0;d<c.length;++d)b[c[d]]=!0;return b}function b(a){return function(b,c){return b.match(a)?c.tokenize=null:b.skipToEnd(),"string"}}var c={name:"clike",keywords:a("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"),blockKeywords:a("catch do else elseif for foreach if switch try while"),atoms:a("true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__"),builtin:a("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 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 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 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 echo print global static exit array empty eval isset unset die include require include_once require_once"),multiLineStrings:!0,hooks:{$:function(a){return a.eatWhile(/[\w\$_]/),"variable-2"},"<":function(a,c){return a.match(/<</)?(a.eatWhile(/[\w\.]/),c.tokenize=b(a.current().slice(3)),c.tokenize(a,c)):!1},"#":function(a){for(;!a.eol()&&!a.match("?>",!1);)a.next();return"comment"},"/":function(a){if(a.eat("/")){for(;!a.eol()&&!a.match("?>",!1);)a.next();return"comment"}return!1}}};CodeMirror.defineMode("php",function(a,b){function d(a,b){var c=b.curMode==f;if(a.sol()&&'"'!=b.pending&&(b.pending=null),c)return c&&null==b.php.tokenize&&a.match("?>")?(b.curMode=e,b.curState=b.html,"meta"):f.token(a,b.curState);if(a.match(/^<\?\w*/))return b.curMode=f,b.curState=b.php,"meta";if('"'==b.pending){for(;!a.eol()&&'"'!=a.next(););var d="string"}else if(b.pending&&a.pos<b.pending.end){a.pos=b.pending.end;var d=b.pending.style}else var d=e.token(a,b.curState);b.pending=null;var g=a.current(),h=g.search(/<\?/);return-1!=h&&(b.pending="string"==d&&/\"$/.test(g)&&!/\?>/.test(g)?'"':{end:a.pos,style:d},a.backUp(g.length-h)),d}var e=CodeMirror.getMode(a,"text/html"),f=CodeMirror.getMode(a,c);return{startState:function(){var a=CodeMirror.startState(e),c=CodeMirror.startState(f);return{html:a,php:c,curMode:b.startOpen?f:e,curState:b.startOpen?c:a,pending:null}},copyState:function(a){var b,c=a.html,d=CodeMirror.copyState(e,c),g=a.php,h=CodeMirror.copyState(f,g);return b=a.curMode==e?d:h,{html:d,php:h,curMode:a.curMode,curState:b,pending:a.pending}},token:d,indent:function(a,b){return a.curMode!=f&&/^\s*<\//.test(b)||a.curMode==f&&/^\?>/.test(b)?e.indent(a.html,b):a.curMode.indent(a.curState,b)},electricChars:"/{}:",blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",innerMode:function(a){return{state:a.curState,mode:a.curMode}}}},"htmlmixed","clike"),CodeMirror.defineMIME("application/x-httpd-php","php"),CodeMirror.defineMIME("application/x-httpd-php-open",{name:"php",startOpen:!0}),CodeMirror.defineMIME("text/x-php",c)}(),function(){function a(a,c,d,e){if(this.atOccurrence=!1,this.doc=a,null==e&&"string"==typeof c&&(e=!1),d=d?a.clipPos(d):b(0,0),this.pos={from:d,to:d},"string"!=typeof c)c.global||(c=new RegExp(c.source,c.ignoreCase?"ig":"g")),this.matches=function(d,e){if(d){c.lastIndex=0;for(var f,g,h=a.getLine(e.line).slice(0,e.ch),i=0;;){c.lastIndex=i;var j=c.exec(h);if(!j)break;if(f=j,g=f.index,i=f.index+(f[0].length||1),i==h.length)break}var k=f&&f[0].length||0;k||(0==g&&0==h.length?f=void 0:g!=a.getLine(e.line).length&&k++)}else{c.lastIndex=e.ch;var h=a.getLine(e.line),f=c.exec(h),k=f&&f[0].length||0,g=f&&f.index;g+k==h.length||k||(k=1)}return f&&k?{from:b(e.line,g),to:b(e.line,g+k),match:f}:void 0};else{e&&(c=c.toLowerCase());var f=e?function(a){return a.toLowerCase()}:function(a){return a},g=c.split("\n");this.matches=1==g.length?c.length?function(d,e){var g,h=f(a.getLine(e.line)),i=c.length;return(d?e.ch>=i&&-1!=(g=h.lastIndexOf(c,e.ch-i)):-1!=(g=h.indexOf(c,e.ch)))?{from:b(e.line,g),to:b(e.line,g+i)}:void 0}:function(){}:function(c,d){var e=d.line,h=c?g.length-1:0,i=g[h],j=f(a.getLine(e)),k=c?j.indexOf(i)+i.length:j.lastIndexOf(i);if(!(c?k>=d.ch||k!=i.length:k<=d.ch||k!=j.length-i.length))for(;;){if(c?!e:e==a.lineCount()-1)return;if(j=f(a.getLine(e+=c?-1:1)),i=g[c?--h:++h],!(h>0&&h<g.length-1)){var l=c?j.lastIndexOf(i):j.indexOf(i)+i.length;if(c?l!=j.length-i.length:l!=i.length)return;var m=b(d.line,k),n=b(e,l);return{from:c?n:m,to:c?m:n}}if(j!=i)return}}}}var b=CodeMirror.Pos;a.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(a){function c(a){var c=b(a,0);return d.pos={from:c,to:c},d.atOccurrence=!1,!1}for(var d=this,e=this.doc.clipPos(a?this.pos.from:this.pos.to);;){if(this.pos=this.matches(a,e))return this.pos.from&&this.pos.to||console.log(this.matches,this.pos),this.atOccurrence=!0,this.pos.match||!0;if(a){if(!e.line)return c(0);e=b(e.line-1,this.doc.getLine(e.line-1).length)}else{var f=this.doc.lineCount();if(e.line==f-1)return c(f);e=b(e.line+1,0)}}},from:function(){return this.atOccurrence?this.pos.from:void 0
5
  },to:function(){return this.atOccurrence?this.pos.to:void 0},replace:function(a){if(this.atOccurrence){var c=CodeMirror.splitLines(a);this.doc.replaceRange(c,this.pos.from,this.pos.to),this.pos.to=b(this.pos.from.line+c.length-1,c[c.length-1].length+(1==c.length?this.pos.from.ch:0))}}},CodeMirror.defineExtension("getSearchCursor",function(b,c,d){return new a(this.doc,b,c,d)}),CodeMirror.defineDocExtension("getSearchCursor",function(b,c,d){return new a(this,b,c,d)})}(),function(){function a(a){return"string"==typeof a?{token:function(b){return b.match(a)?"searching":(b.next(),b.skipTo(a.charAt(0))||b.skipToEnd(),void 0)}}:{token:function(b){if(b.match(a))return"searching";for(;!b.eol()&&(b.next(),!b.match(a,!1)););}}}function b(){this.posFrom=this.posTo=this.query=null,this.overlay=null}function c(a){return a.state.search||(a.state.search=new b)}function d(a,b,c){return a.getSearchCursor(b,c,"string"==typeof b&&b==b.toLowerCase())}function e(a,b,c,d){a.openDialog?a.openDialog(b,d):d(prompt(c,""))}function f(a,b,c,d){a.openConfirm?a.openConfirm(b,d):confirm(c)&&d[0]()}function g(a){var b=a.match(/^\/(.*)\/([a-z]*)$/);return b?new RegExp(b[1],-1==b[2].indexOf("i")?"":"i"):a}function h(b,d){var f=c(b);return f.query?i(b,d):(e(b,l,"Search for:",function(c){b.operation(function(){c&&!f.query&&(f.query=g(c),b.removeOverlay(f.overlay),f.overlay=a(f.query),b.addOverlay(f.overlay),f.posFrom=f.posTo=b.getCursor(),i(b,d))})}),void 0)}function i(a,b){a.operation(function(){var e=c(a),f=d(a,e.query,b?e.posFrom:e.posTo);(f.find(b)||(f=d(a,e.query,b?CodeMirror.Pos(a.lastLine()):CodeMirror.Pos(a.firstLine(),0)),f.find(b)))&&(a.setSelection(f.from(),f.to()),e.posFrom=f.from(),e.posTo=f.to())})}function j(a){a.operation(function(){var b=c(a);b.query&&(b.query=null,a.removeOverlay(b.overlay))})}function k(a,b){e(a,m,"Replace:",function(c){c&&(c=g(c),e(a,n,"Replace with:",function(e){if(b)a.operation(function(){for(var b=d(a,c);b.findNext();)if("string"!=typeof c){var f=a.getRange(b.from(),b.to()).match(c);b.replace(e.replace(/\$(\d)/,function(a,b){return f[b]}))}else b.replace(e)});else{j(a);var g=d(a,c,a.getCursor()),h=function(){var b,e=g.from();!(b=g.findNext())&&(g=d(a,c),!(b=g.findNext())||e&&g.from().line==e.line&&g.from().ch==e.ch)||(a.setSelection(g.from(),g.to()),f(a,o,"Replace?",[function(){i(b)},h]))},i=function(a){g.replace("string"==typeof c?e:e.replace(/\$(\d)/,function(b,c){return a[c]})),h()};h()}}))})}var l='Search: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)</span>',m='Replace: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)</span>',n='With: <input type="text" style="width: 10em"/>',o="Replace? <button>Yes</button> <button>No</button> <button>Stop</button>";CodeMirror.commands.find=function(a){j(a),h(a)},CodeMirror.commands.findNext=h,CodeMirror.commands.findPrev=function(a){h(a,!0)},CodeMirror.commands.clearSearch=j,CodeMirror.commands.replace=k,CodeMirror.commands.replaceAll=function(a){k(a,!0)}}(),function(){function a(a,b,c){function d(b,c,d){if(b.text){var g=m?0:b.text.length-1,i=m?b.text.length:-1;if(b.text.length>h)return null;for(null!=d&&(g=d+n);g!=i;g+=n){var j=b.text.charAt(g);if(r.test(j)&&a.getTokenTypeAt(e(c,g+1))==p){var k=f[j];if(">"==k.charAt(1)==m)q.push(j);else{if(q.pop()!=k.charAt(0))return{pos:g,match:!1};if(!q.length)return{pos:g,match:!0}}}}}}var g=a.state.matchBrackets,h=g&&g.maxScanLineLength||1e4,i=b||a.getCursor(),j=a.getLineHandle(i.line),k=i.ch-1,l=k>=0&&f[j.text.charAt(k)]||f[j.text.charAt(++k)];if(!l)return null;var m=">"==l.charAt(1),n=m?1:-1;if(c&&m!=(k==i.ch))return null;for(var o,p=a.getTokenTypeAt(e(i.line,k+1)),q=[j.text.charAt(k)],r=/[(){}[\]]/,s=i.line,t=m?Math.min(s+100,a.lineCount()):Math.max(-1,s-100);s!=t&&!(o=s==i.line?d(j,s,k):d(a.getLineHandle(s),s));s+=n);return{from:e(i.line,k),to:o&&e(s,o.pos),match:o&&o.match,forward:m}}function b(b,c){var f=b.state.matchBrackets.maxHighlightLineLength||1e3,g=a(b);if(!(!g||b.getLine(g.from.line).length>f||g.to&&b.getLine(g.to.line).length>f)){var h=g.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",i=b.markText(g.from,e(g.from.line,g.from.ch+1),{className:h}),j=g.to&&b.markText(g.to,e(g.to.line,g.to.ch+1),{className:h});d&&b.state.focused&&b.display.input.focus();var k=function(){b.operation(function(){i.clear(),j&&j.clear()})};return c?(setTimeout(k,800),void 0):k}}function c(a){a.operation(function(){g&&(g(),g=null),a.somethingSelected()||(g=b(a,!1))})}var d=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),e=CodeMirror.Pos,f={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},g=null;CodeMirror.defineOption("matchBrackets",!1,function(a,b,d){d&&d!=CodeMirror.Init&&a.off("cursorActivity",c),b&&(a.state.matchBrackets="object"==typeof b?b:{},a.on("cursorActivity",c))}),CodeMirror.defineExtension("matchBrackets",function(){b(this,!0)}),CodeMirror.defineExtension("findMatchingBracket",function(b,c){return a(this,b,c)})}();