TJ Custom CSS - Version 0.1.4

Version Description

  • 9/06/2015 =
  • Support WordPress 4.3
  • Update language
  • Sanitize output with wp_filter_nohtml_kses to prevent user add any HTML code to the custom css
Download this release

Release Info

Developer themejunkie
Plugin Icon wp plugin TJ Custom CSS
Version 0.1.4
Comparing to
See all releases

Code changes from version 0.1.3 to 0.1.4

admin/admin.php CHANGED
@@ -1,142 +1,149 @@
1
- <?php
2
- /**
3
- * Custom CSS setting.
4
- *
5
- * @package Theme_Junkie_Custom_CSS
6
- * @since 0.1.0
7
- * @author Theme Junkie
8
- * @copyright Copyright (c) 2014, Theme Junkie
9
- * @license http://www.gnu.org/licenses/gpl-2.0.html
10
- */
11
-
12
- /**
13
- * Add the custom css menu to the admin menu.
14
- *
15
- * @since 0.1.0
16
- * @link http://codex.wordpress.org/Function_Reference/add_theme_page
17
- */
18
- function tjcc_custom_css_menu() {
19
-
20
- /* Add Custom CSS menu under the Appearance. */
21
- $setting = add_theme_page(
22
- __( 'Theme Junkie Custom CSS', 'tjcc' ),
23
- __( 'Custom CSS', 'tjcc' ),
24
- 'edit_theme_options',
25
- 'tj-custom-css',
26
- 'tjcc_custom_css_page'
27
- );
28
-
29
- if ( ! $setting )
30
- return;
31
-
32
- /* Provided hook_suffix that's returned to add scripts only on custom css page. */
33
- add_action( 'load-' . $setting, 'tjcc_scripts' );
34
-
35
- }
36
- add_action( 'admin_menu', 'tjcc_custom_css_menu', 20 );
37
-
38
- /**
39
- * Load scripts and styles for the custom css page.
40
- *
41
- * @since 0.1.0
42
- * @link http://codex.wordpress.org/Function_Reference/wp_enqueue_script
43
- * @link http://codex.wordpress.org/Function_Reference/wp_enqueue_style
44
- */
45
- function tjcc_scripts() {
46
-
47
- /* Load the javascript file. */
48
- wp_enqueue_script( 'codemirror-js', trailingslashit( TJCC_ASSETS ) . 'js/codemirror.js', array( 'jquery' ), null );
49
-
50
- /* Load the custom javascript file. */
51
- wp_enqueue_script( 'tjcc-js', trailingslashit( TJCC_ASSETS ) . 'js/tjcc.js', array( 'jquery' ), null );
52
-
53
- /* Load the css file. */
54
- wp_enqueue_style( 'codemirror-css', trailingslashit( TJCC_ASSETS ) . 'css/codemirror.css', null, null );
55
- wp_enqueue_style( 'tjcc-css', trailingslashit( TJCC_ASSETS ) . 'css/tjcc.css', null, null );
56
-
57
- }
58
-
59
- /**
60
- * Register the custom css setting.
61
- *
62
- * @since 0.1.0
63
- * @link http://codex.wordpress.org/Function_Reference/register_setting
64
- */
65
- function tjcc_register_setting() {
66
-
67
- register_setting(
68
- 'tj_custom_css', // Option group
69
- 'tj_custom_css', // Option name
70
- 'tj_custom_css_setting_validate' // Sanitize callback
71
- );
72
-
73
- }
74
- add_action( 'admin_init', 'tjcc_register_setting' );
75
-
76
- /**
77
- * Render the custom CSS page
78
- *
79
- * @since 0.1.0
80
- */
81
- function tjcc_custom_css_page() {
82
- $options = get_option( 'tj_custom_css' );
83
- $custom_css = isset( $options['custom_css'] ) ? $options['custom_css'] : '';
84
- ?>
85
-
86
- <div class="wrap">
87
-
88
- <h2><?php _e( 'Theme Junkie Custom CSS', 'tjcc' ) ?></h2>
89
- <p><?php printf( __( 'Hi There, thanks for using our plugin we hope you will enjoy it. Check out our %1$sPremium WordPress Themes%2$s.', 'tjcc' ), '<a href="http://www.theme-junkie.com/" target="_blank"><strong>', '</strong></a>' ); ?></p>
90
-
91
- <?php settings_errors(); ?>
92
-
93
- <div id="post-body" class="tjcc-custom-css metabox-holder columns-2">
94
-
95
- <div id="post-body-content">
96
-
97
- <form action="options.php" method="post">
98
-
99
- <?php settings_fields( 'tj_custom_css' ); ?>
100
-
101
- <div class="tjcc-custom-css-container">
102
- <textarea name="tj_custom_css[custom_css]" id="tjcc-custom-css-textarea"><?php echo wp_filter_nohtml_kses( $custom_css ) ?></textarea>
103
- </div>
104
-
105
- <p class="description">
106
- <?php printf( __( '%1$sGetting started with CSS%2$s.', 'tjcc' ), '<a href="https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_started" target="_blank">', '</a>' ); ?>
107
- </p>
108
-
109
- <?php submit_button( esc_attr__( 'Save', 'tjcc' ), 'primary large' ); ?>
110
-
111
- </form>
112
-
113
- </div><!-- .post-body-content -->
114
-
115
- <div id="postbox-container-1" class="postbox-container">
116
- <div>
117
-
118
- <div class="postbox">
119
- <h3 class="hndle"><span><?php _e( 'Live Preview', 'tjcc' ); ?></span></h3>
120
- <div class="inside">
121
- <p><?php printf( __( 'If you want to add custom css and see the live preview, please go to the %1$sCustomize%2$s page and open the Custom CSS section.', 'tjcc' ), '<a href="' . esc_url( admin_url( 'customize.php' ) ) . '">', '</a>' ); ?></p>
122
- </div>
123
- </div>
124
-
125
- </div>
126
- </div><!-- .postbox-container -->
127
-
128
- </div><!-- .tjcc-custom-css -->
129
-
130
- </div>
131
- <?php
132
- }
133
-
134
- /**
135
- * Sanitize and validate form input.
136
- *
137
- * @since 0.1.0
138
- */
139
- function tj_custom_css_setting_validate( $input ) {
140
- $input['custom_css'] = stripslashes( $input['custom_css'] );
141
- return $input;
 
 
 
 
 
 
 
142
  }
1
+ <?php
2
+ /**
3
+ * Custom CSS setting.
4
+ *
5
+ * @package Theme_Junkie_Custom_CSS
6
+ * @since 0.1.0
7
+ * @author Theme Junkie
8
+ * @copyright Copyright (c) 2014, Theme Junkie
9
+ * @license http://www.gnu.org/licenses/gpl-2.0.html
10
+ */
11
+
12
+ /**
13
+ * Add the custom css menu to the admin menu.
14
+ *
15
+ * @since 0.1.0
16
+ * @link http://codex.wordpress.org/Function_Reference/add_theme_page
17
+ */
18
+ function tjcc_custom_css_menu() {
19
+
20
+ /* Add Custom CSS menu under the Appearance. */
21
+ $setting = add_theme_page(
22
+ __( 'TJ Custom CSS', 'tjcc' ),
23
+ __( 'Custom CSS', 'tjcc' ),
24
+ 'edit_theme_options',
25
+ 'tj-custom-css',
26
+ 'tjcc_custom_css_page'
27
+ );
28
+
29
+ if ( ! $setting )
30
+ return;
31
+
32
+ /* Provided hook_suffix that's returned to add scripts only on custom css page. */
33
+ add_action( 'load-' . $setting, 'tjcc_scripts' );
34
+
35
+ }
36
+ add_action( 'admin_menu', 'tjcc_custom_css_menu', 20 );
37
+
38
+ /**
39
+ * Load scripts and styles for the custom css page.
40
+ *
41
+ * @since 0.1.0
42
+ * @link http://codex.wordpress.org/Function_Reference/wp_enqueue_script
43
+ * @link http://codex.wordpress.org/Function_Reference/wp_enqueue_style
44
+ */
45
+ function tjcc_scripts() {
46
+
47
+ /* Load the javascript file. */
48
+ wp_enqueue_script( 'codemirror-js', trailingslashit( TJCC_ASSETS ) . 'js/codemirror.js', array( 'jquery' ), null );
49
+
50
+ /* Load the custom javascript file. */
51
+ wp_enqueue_script( 'tjcc-js', trailingslashit( TJCC_ASSETS ) . 'js/tjcc.js', array( 'jquery' ), null );
52
+
53
+ /* Load the css file. */
54
+ wp_enqueue_style( 'codemirror-css', trailingslashit( TJCC_ASSETS ) . 'css/codemirror.css', null, null );
55
+ wp_enqueue_style( 'tjcc-css', trailingslashit( TJCC_ASSETS ) . 'css/tjcc.css', null, null );
56
+
57
+ }
58
+
59
+ /**
60
+ * Register the custom css setting.
61
+ *
62
+ * @since 0.1.0
63
+ * @link http://codex.wordpress.org/Function_Reference/register_setting
64
+ */
65
+ function tjcc_register_setting() {
66
+
67
+ register_setting(
68
+ 'tj_custom_css', // Option group
69
+ 'tj_custom_css', // Option name
70
+ 'tj_custom_css_setting_validate' // Sanitize callback
71
+ );
72
+
73
+ }
74
+ add_action( 'admin_init', 'tjcc_register_setting' );
75
+
76
+ /**
77
+ * Render the custom CSS page
78
+ *
79
+ * @since 0.1.0
80
+ */
81
+ function tjcc_custom_css_page() {
82
+ $options = get_option( 'tj_custom_css' );
83
+ $custom_css = isset( $options['custom_css'] ) ? $options['custom_css'] : '';
84
+ ?>
85
+
86
+ <div class="wrap">
87
+
88
+ <h2><?php _e( 'TJ Custom CSS', 'tjcc' ) ?></h2>
89
+ <p><?php _e( 'Hi There, thanks for using our plugin we hope you enjoy it.', 'tjcc' ); ?></p>
90
+
91
+ <?php settings_errors(); ?>
92
+
93
+ <div id="post-body" class="tjcc-custom-css metabox-holder columns-2">
94
+
95
+ <div id="post-body-content">
96
+
97
+ <form action="options.php" method="post">
98
+
99
+ <?php settings_fields( 'tj_custom_css' ); ?>
100
+
101
+ <div class="tjcc-custom-css-container">
102
+ <textarea name="tj_custom_css[custom_css]" id="tjcc-custom-css-textarea"><?php echo wp_filter_nohtml_kses( $custom_css ) ?></textarea>
103
+ </div>
104
+
105
+ <p class="description">
106
+ <?php printf( __( '%1$sGetting started with CSS%2$s.', 'tjcc' ), '<a href="https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_started" target="_blank">', '</a>' ); ?>
107
+ </p>
108
+
109
+ <?php submit_button( esc_attr__( 'Save', 'tjcc' ), 'primary large' ); ?>
110
+
111
+ </form>
112
+
113
+ </div><!-- .post-body-content -->
114
+
115
+ <div id="postbox-container-1" class="postbox-container">
116
+ <div>
117
+
118
+ <div class="postbox">
119
+ <h3 class="hndle"><span><?php _e( 'Premium Themes', 'tjcc' ); ?></span></h3>
120
+ <div class="inside">
121
+ <p><?php printf( __( 'Get our 59 premium WordPress themes for only $49! %1$sGet it now%2$s.', 'tjcc' ), '<a href="http://www.theme-junkie.com/themes/?utm_source=Custom%20CSS%20Sidebar&utm_medium=text&utm_campaign=plugin%20option%20convertion" target="_blank">', '</a>' ); ?></p>
122
+ </div>
123
+ </div>
124
+
125
+ <div class="postbox">
126
+ <h3 class="hndle"><span><?php _e( 'Live Preview', 'tjcc' ); ?></span></h3>
127
+ <div class="inside">
128
+ <p><?php printf( __( 'If you want to add custom css and see the live preview, please go to the %1$sCustomize%2$s page and open the Custom CSS section.', 'tjcc' ), '<a href="' . esc_url( admin_url( 'customize.php' ) ) . '">', '</a>' ); ?></p>
129
+ </div>
130
+ </div>
131
+
132
+ </div>
133
+ </div><!-- .postbox-container -->
134
+
135
+ </div><!-- .tjcc-custom-css -->
136
+
137
+ </div>
138
+ <?php
139
+ }
140
+
141
+ /**
142
+ * Sanitize and validate form input.
143
+ *
144
+ * @since 0.1.0
145
+ */
146
+ function tj_custom_css_setting_validate( $input ) {
147
+ $input['custom_css'] = wp_filter_nohtml_kses( $input['custom_css'] );
148
+ return $input;
149
  }
admin/customize-control-textarea.php CHANGED
@@ -1,43 +1,43 @@
1
- <?php
2
- /**
3
- * The textarea customize control extends the WP_Customize_Control class. This class allows
4
- * developers to create textarea settings within the WordPress theme customizer.
5
- *
6
- * @package Theme_Junkie_Custom_CSS
7
- * @since 0.1.0
8
- * @author Theme Junkie
9
- * @copyright Copyright (c) 2014, Theme Junkie
10
- * @link http://otto42.com/bj
11
- * @license http://www.gnu.org/licenses/gpl-2.0.html
12
- */
13
-
14
- /**
15
- * Textarea customize control class.
16
- *
17
- * @since 0.1.0
18
- * @access public
19
- */
20
- class Tj_Customize_Control_Textarea extends WP_Customize_Control {
21
-
22
- /**
23
- * The type of customize control being rendered.
24
- *
25
- * @since 0.1.0
26
- */
27
- public $type = 'textarea';
28
-
29
- /**
30
- * Displays the textarea on the customize screen.
31
- *
32
- * @since 0.1.0
33
- */
34
- public function render_content() { ?>
35
- <label>
36
- <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
37
- <div class="customize-control-content">
38
- <textarea class="widefat" cols="45" rows="5" <?php $this->link(); ?>><?php echo esc_textarea( $this->value() ); ?></textarea>
39
- </div>
40
- </label>
41
- <?php }
42
-
43
  }
1
+ <?php
2
+ /**
3
+ * The textarea customize control extends the WP_Customize_Control class. This class allows
4
+ * developers to create textarea settings within the WordPress theme customizer.
5
+ *
6
+ * @package Theme_Junkie_Custom_CSS
7
+ * @since 0.1.0
8
+ * @author Theme Junkie
9
+ * @copyright Copyright (c) 2014, Theme Junkie
10
+ * @link http://otto42.com/bj
11
+ * @license http://www.gnu.org/licenses/gpl-2.0.html
12
+ */
13
+
14
+ /**
15
+ * Textarea customize control class.
16
+ *
17
+ * @since 0.1.0
18
+ * @access public
19
+ */
20
+ class Tj_Customize_Control_Textarea extends WP_Customize_Control {
21
+
22
+ /**
23
+ * The type of customize control being rendered.
24
+ *
25
+ * @since 0.1.0
26
+ */
27
+ public $type = 'textarea';
28
+
29
+ /**
30
+ * Displays the textarea on the customize screen.
31
+ *
32
+ * @since 0.1.0
33
+ */
34
+ public function render_content() { ?>
35
+ <label>
36
+ <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
37
+ <div class="customize-control-content">
38
+ <textarea class="widefat" cols="45" rows="5" <?php $this->link(); ?>><?php echo esc_textarea( $this->value() ); ?></textarea>
39
+ </div>
40
+ </label>
41
+ <?php }
42
+
43
  }
admin/customize.php CHANGED
@@ -1,56 +1,57 @@
1
- <?php
2
- /**
3
- * Customizer setting.
4
- *
5
- * @package Theme_Junkie_Custom_CSS
6
- * @since 0.1.0
7
- * @author Theme Junkie
8
- * @copyright Copyright (c) 2014, Theme Junkie
9
- * @link https://codex.wordpress.org/Theme_Customization_API
10
- * @license http://www.gnu.org/licenses/gpl-2.0.html
11
- */
12
-
13
- /**
14
- * Load textarea function for customizer.
15
- *
16
- * @since 0.1.0
17
- * @access public
18
- */
19
- function tjcc_textarea_customize_control() {
20
- require_once( TJCC_ADMIN . 'customize-control-textarea.php' );
21
- }
22
- add_action( 'customize_register', 'tjcc_textarea_customize_control', 1 );
23
-
24
- /**
25
- * Register customizer.
26
- *
27
- * @since 0.1.0
28
- * @access public
29
- */
30
- function tjcc_register_customize( $wp_customize ) {
31
-
32
- $wp_customize->add_section( 'tj_custom_css_section',
33
- array(
34
- 'title' => esc_html__( 'Custom CSS', 'tjcc' ),
35
- 'description' => esc_html__( 'After you add your custom css to the box, then please click outside it to see the changes.', 'tjcc' ),
36
- 'priority' => 150,
37
- )
38
- );
39
-
40
- $wp_customize->add_setting( 'tj_custom_css[custom_css]' ,
41
- array(
42
- 'type' => 'option',
43
- 'capability' => 'edit_theme_options'
44
- )
45
- );
46
-
47
- $wp_customize->add_control( new Tj_Customize_Control_Textarea( $wp_customize, 'tj_custom_css',
48
- array(
49
- 'label' => '',
50
- 'section' => 'tj_custom_css_section',
51
- 'settings' => 'tj_custom_css[custom_css]'
52
- )
53
- ) );
54
-
55
- }
 
56
  add_action( 'customize_register', 'tjcc_register_customize' );
1
+ <?php
2
+ /**
3
+ * Customizer setting.
4
+ *
5
+ * @package Theme_Junkie_Custom_CSS
6
+ * @since 0.1.0
7
+ * @author Theme Junkie
8
+ * @copyright Copyright (c) 2014, Theme Junkie
9
+ * @link https://codex.wordpress.org/Theme_Customization_API
10
+ * @license http://www.gnu.org/licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ * Load textarea function for customizer.
15
+ *
16
+ * @since 0.1.0
17
+ * @access public
18
+ */
19
+ function tjcc_textarea_customize_control() {
20
+ require_once( TJCC_ADMIN . 'customize-control-textarea.php' );
21
+ }
22
+ add_action( 'customize_register', 'tjcc_textarea_customize_control', 1 );
23
+
24
+ /**
25
+ * Register customizer.
26
+ *
27
+ * @since 0.1.0
28
+ * @access public
29
+ */
30
+ function tjcc_register_customize( $wp_customize ) {
31
+
32
+ $wp_customize->add_section( 'tj_custom_css_section',
33
+ array(
34
+ 'title' => esc_html__( 'Custom CSS', 'tjcc' ),
35
+ 'description' => esc_html__( 'Add your custom css code below.', 'tjcc' ),
36
+ 'priority' => 150,
37
+ )
38
+ );
39
+
40
+ $wp_customize->add_setting( 'tj_custom_css[custom_css]' ,
41
+ array(
42
+ 'type' => 'option',
43
+ 'capability' => 'edit_theme_options',
44
+ 'sanitize_callback' => 'wp_filter_nohtml_kses',
45
+ )
46
+ );
47
+
48
+ $wp_customize->add_control( new Tj_Customize_Control_Textarea( $wp_customize, 'tj_custom_css',
49
+ array(
50
+ 'label' => '',
51
+ 'section' => 'tj_custom_css_section',
52
+ 'settings' => 'tj_custom_css[custom_css]'
53
+ )
54
+ ) );
55
+
56
+ }
57
  add_action( 'customize_register', 'tjcc_register_customize' );
assets/css/tjcc.css CHANGED
@@ -1,7 +1,7 @@
1
- .tjcc-custom-css {
2
- margin-right: 300px;
3
- }
4
-
5
- .tjcc-custom-css-container {
6
- border: 1px solid #dfdfdf;
7
  }
1
+ .tjcc-custom-css {
2
+ margin-right: 300px;
3
+ }
4
+
5
+ .tjcc-custom-css-container {
6
+ border: 1px solid #dfdfdf;
7
  }
assets/js/codemirror.js CHANGED
@@ -1,5 +1,5 @@
1
- !function(a){if("object"==typeof exports&&"object"==typeof module)module.exports=a();else{if("function"==typeof define&&define.amd)return define([],a);this.CodeMirror=a()}}(function(){"use strict";function z(a,c){if(!(this instanceof z))return new z(a,c);this.options=c=c||{},Fg($d,c,!1),N(c);var d=c.value;"string"==typeof d&&(d=new zf(d,c.mode)),this.doc=d;var e=this.display=new A(a,d);e.wrapper.CodeMirror=this,J(this),H(this),c.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),c.autofocus&&!r&&Rc(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new vg},b&&setTimeout(Gg(Qc,this,!0),20),Uc(this);var f=this;Ac(this,function(){f.curOp.forceUpdate=!0,Df(f,d),c.autofocus&&!r||Rg()==e.input?setTimeout(Gg(vd,f),20):wd(f);for(var a in _d)_d.hasOwnProperty(a)&&_d[a](f,c[a],be);for(var b=0;b<fe.length;++b)fe[b](f)})}function A(a,b){var d=this,e=d.input=Mg("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none");h?e.style.width="1000px":e.setAttribute("wrap","off"),q&&(e.style.border="1px solid black"),e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck","false"),d.inputDiv=Mg("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),d.scrollbarH=Mg("div",[Mg("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar"),d.scrollbarV=Mg("div",[Mg("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),d.scrollbarFiller=Mg("div",null,"CodeMirror-scrollbar-filler"),d.gutterFiller=Mg("div",null,"CodeMirror-gutter-filler"),d.lineDiv=Mg("div",null,"CodeMirror-code"),d.selectionDiv=Mg("div",null,null,"position: relative; z-index: 1"),d.cursorDiv=Mg("div",null,"CodeMirror-cursors"),d.measure=Mg("div",null,"CodeMirror-measure"),d.lineMeasure=Mg("div",null,"CodeMirror-measure"),d.lineSpace=Mg("div",[d.measure,d.lineMeasure,d.selectionDiv,d.cursorDiv,d.lineDiv],null,"position: relative; outline: none"),d.mover=Mg("div",[Mg("div",[d.lineSpace],"CodeMirror-lines")],null,"position: relative"),d.sizer=Mg("div",[d.mover],"CodeMirror-sizer"),d.heightForcer=Mg("div",null,null,"position: absolute; height: "+qg+"px; width: 1px;"),d.gutters=Mg("div",null,"CodeMirror-gutters"),d.lineGutter=null,d.scroller=Mg("div",[d.sizer,d.heightForcer,d.gutters],"CodeMirror-scroll"),d.scroller.setAttribute("tabIndex","-1"),d.wrapper=Mg("div",[d.inputDiv,d.scrollbarH,d.scrollbarV,d.scrollbarFiller,d.gutterFiller,d.scroller],"CodeMirror"),c&&(d.gutters.style.zIndex=-1,d.scroller.style.paddingRight=0),q&&(e.style.width="0px"),h||(d.scroller.draggable=!0),m&&(d.inputDiv.style.height="1px",d.inputDiv.style.position="absolute"),c&&(d.scrollbarH.style.minHeight=d.scrollbarV.style.minWidth="18px"),a.appendChild?a.appendChild(d.wrapper):a(d.wrapper),d.viewFrom=d.viewTo=b.first,d.view=[],d.externalMeasured=null,d.viewOffset=0,d.lastSizeC=0,d.updateLineNumbers=null,d.lineNumWidth=d.lineNumInnerWidth=d.lineNumChars=null,d.prevInput="",d.alignWidgets=!1,d.pollingFast=!1,d.poll=new vg,d.cachedCharWidth=d.cachedTextHeight=d.cachedPaddingH=null,d.inaccurateSelection=!1,d.maxLine=null,d.maxLineLength=0,d.maxLineChanged=!1,d.wheelDX=d.wheelDY=d.wheelStartX=d.wheelStartY=null,d.shift=!1}function B(a){a.doc.mode=z.getMode(a.options,a.doc.modeOption),C(a)}function C(a){a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null)}),a.doc.frontier=a.doc.first,Tb(a,100),a.state.modeGen++,a.curOp&&Gc(a)}function D(a){a.options.lineWrapping?(Ug(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth=""):(Tg(a.display.wrapper,"CodeMirror-wrap"),M(a)),F(a),Gc(a),jc(a),setTimeout(function(){P(a)},100)}function E(a){var b=vc(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/wc(a.display)-3);return function(e){if(Ve(a.doc,e))return 0;var f=0;if(e.widgets)for(var g=0;g<e.widgets.length;g++)e.widgets[g].height&&(f+=e.widgets[g].height);return c?f+(Math.ceil(e.text.length/d)||1)*b:f+b}}function F(a){var b=a.doc,c=E(a);b.iter(function(a){var b=c(a);b!=a.height&&Hf(a,b)})}function G(a){var b=ke[a.options.keyMap],c=b.style;a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(c?" cm-keymap-"+c:"")}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-"),jc(a)}function I(a){J(a),Gc(a),setTimeout(function(){R(a)},20)}function J(a){var b=a.display.gutters,c=a.options.gutters;Og(b);for(var d=0;d<c.length;++d){var e=c[d],f=b.appendChild(Mg("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",K(a)}function K(a){var b=a.display.gutters.offsetWidth;a.display.sizer.style.marginLeft=b+"px",a.display.scrollbarH.style.left=a.options.fixedGutter?b+"px":0}function L(a){if(0==a.height)return 0;for(var c,b=a.text.length,d=a;c=Oe(d);){var e=c.find(0,!0);d=e.from.line,b+=e.from.ch-e.to.ch}for(d=a;c=Pe(d);){var e=c.find(0,!0);b-=d.text.length-e.from.ch,d=e.to.line,b+=d.text.length-e.to.ch}return b}function M(a){var b=a.display,c=a.doc;b.maxLine=Ef(c,c.first),b.maxLineLength=L(b.maxLine),b.maxLineChanged=!0,c.iter(function(a){var c=L(a);c>b.maxLineLength&&(b.maxLineLength=c,b.maxLine=a)})}function N(a){var b=Cg(a.gutters,"CodeMirror-linenumbers");-1==b&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]):b>-1&&!a.lineNumbers&&(a.gutters=a.gutters.slice(0),a.gutters.splice(b,1))}function O(a){var b=a.display.scroller;return{clientHeight:b.clientHeight,barHeight:a.display.scrollbarV.clientHeight,scrollWidth:b.scrollWidth,clientWidth:b.clientWidth,barWidth:a.display.scrollbarH.clientWidth,docHeight:Math.round(a.doc.height+Yb(a.display))}}function P(a,b){b||(b=O(a));var c=a.display,d=b.docHeight+qg,e=b.scrollWidth>b.clientWidth,f=d>b.clientHeight;if(f?(c.scrollbarV.style.display="block",c.scrollbarV.style.bottom=e?Yg(c.measure)+"px":"0",c.scrollbarV.firstChild.style.height=Math.max(0,d-b.clientHeight+(b.barHeight||c.scrollbarV.clientHeight))+"px"):(c.scrollbarV.style.display="",c.scrollbarV.firstChild.style.height="0"),e?(c.scrollbarH.style.display="block",c.scrollbarH.style.right=f?Yg(c.measure)+"px":"0",c.scrollbarH.firstChild.style.width=b.scrollWidth-b.clientWidth+(b.barWidth||c.scrollbarH.clientWidth)+"px"):(c.scrollbarH.style.display="",c.scrollbarH.firstChild.style.width="0"),e&&f?(c.scrollbarFiller.style.display="block",c.scrollbarFiller.style.height=c.scrollbarFiller.style.width=Yg(c.measure)+"px"):c.scrollbarFiller.style.display="",e&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(c.gutterFiller.style.display="block",c.gutterFiller.style.height=Yg(c.measure)+"px",c.gutterFiller.style.width=c.gutters.offsetWidth+"px"):c.gutterFiller.style.display="",n&&0===Yg(c.measure)){c.scrollbarV.style.minWidth=c.scrollbarH.style.minHeight=o?"18px":"12px";var g=function(b){dg(b)!=c.scrollbarV&&dg(b)!=c.scrollbarH&&Bc(a,Xc)(b)};fg(c.scrollbarV,"mousedown",g),fg(c.scrollbarH,"mousedown",g)}}function Q(a,b,c){var d=c&&null!=c.top?c.top:a.scroller.scrollTop;d=Math.floor(d-Xb(a));var e=c&&null!=c.bottom?c.bottom:d+a.wrapper.clientHeight,f=Jf(b,d),g=Jf(b,e);if(c&&c.ensure){var h=c.ensure.from.line,i=c.ensure.to.line;if(f>h)return{from:h,to:Jf(b,Kf(Ef(b,h))+a.wrapper.clientHeight)};if(Math.min(i,b.lastLine())>=g)return{from:Jf(b,Kf(Ef(b,i))-a.wrapper.clientHeight),to:i}}return{from:f,to:g}}function R(a){var b=a.display,c=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=U(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,f=d+"px",g=0;g<c.length;g++)if(!c[g].hidden){a.options.fixedGutter&&c[g].gutter&&(c[g].gutter.style.left=f);var h=c[g].alignable;if(h)for(var i=0;i<h.length;i++)h[i].style.left=f}a.options.fixedGutter&&(b.gutters.style.left=d+e+"px")}}function S(a){if(!a.options.lineNumbers)return!1;var b=a.doc,c=T(a.options,b.first+b.size-1),d=a.display;if(c.length!=d.lineNumChars){var e=d.measure.appendChild(Mg("div",[Mg("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",K(a),!0}return!1}function T(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function U(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function V(a,b,c){for(var f,d=a.display.viewFrom,e=a.display.viewTo,g=Q(a.display,a.doc,b),i=!0;;i=!1){var j=a.display.scroller.clientWidth;if(!W(a,g,c))break;f=!0,a.display.maxLineChanged&&!a.options.lineWrapping&&X(a);var k=O(a);if(Pb(a),Y(a,k),P(a,k),h&&a.options.lineWrapping&&Z(a,k),i&&a.options.lineWrapping&&j!=a.display.scroller.clientWidth)c=!0;else if(c=!1,b&&null!=b.top&&(b={top:Math.min(k.docHeight-qg-k.clientHeight,b.top)}),g=Q(a.display,a.doc,b),g.from>=a.display.viewFrom&&g.to<=a.display.viewTo)break}return a.display.updateLineNumbers=null,f&&(kg(a,"update",a),(a.display.viewFrom!=d||a.display.viewTo!=e)&&kg(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo)),f}function W(a,b,c){var d=a.display,e=a.doc;if(!d.wrapper.offsetWidth)return Ic(a),void 0;if(!(!c&&b.from>=d.viewFrom&&b.to<=d.viewTo&&0==Mc(a))){S(a)&&Ic(a);var f=ab(a),g=e.first+e.size,h=Math.max(b.from-a.options.viewportMargin,e.first),i=Math.min(g,b.to+a.options.viewportMargin);d.viewFrom<h&&h-d.viewFrom<20&&(h=Math.max(e.first,d.viewFrom)),d.viewTo>i&&d.viewTo-i<20&&(i=Math.min(g,d.viewTo)),y&&(h=Te(a.doc,h),i=Ue(a.doc,i));var j=h!=d.viewFrom||i!=d.viewTo||d.lastSizeC!=d.wrapper.clientHeight;Lc(a,h,i),d.viewOffset=Kf(Ef(a.doc,d.viewFrom)),a.display.mover.style.top=d.viewOffset+"px";var k=Mc(a);if(j||0!=k||c){var l=Rg();return k>4&&(d.lineDiv.style.display="none"),bb(a,d.updateLineNumbers,f),k>4&&(d.lineDiv.style.display=""),l&&Rg()!=l&&l.offsetHeight&&l.focus(),Og(d.cursorDiv),Og(d.selectionDiv),j&&(d.lastSizeC=d.wrapper.clientHeight,Tb(a,400)),$(a),!0}}}function X(a){var b=a.display,c=bc(a,b.maxLine,b.maxLine.text.length).left;b.maxLineChanged=!1;var d=Math.max(0,c+3),e=Math.max(0,b.sizer.offsetLeft+d+qg-b.scroller.clientWidth);b.sizer.style.minWidth=d+"px",e<a.doc.scrollLeft&&hd(a,Math.min(b.scroller.scrollLeft,e),!0)}function Y(a,b){a.display.sizer.style.minHeight=a.display.heightForcer.style.top=b.docHeight+"px",a.display.gutters.style.height=Math.max(b.docHeight,b.clientHeight-qg)+"px"}function Z(a,b){a.display.sizer.offsetWidth+a.display.gutters.offsetWidth<a.display.scroller.clientWidth-1&&(a.display.sizer.style.minHeight=a.display.heightForcer.style.top="0px",a.display.gutters.style.height=b.docHeight+"px")}function $(a){for(var b=a.display,d=b.lineDiv.offsetTop,e=0;e<b.view.length;e++){var g,f=b.view[e];if(!f.hidden){if(c){var h=f.node.offsetTop+f.node.offsetHeight;g=h-d,d=h}else{var i=f.node.getBoundingClientRect();g=i.bottom-i.top}var j=f.line.height-g;if(2>g&&(g=vc(b)),(j>.001||-.001>j)&&(Hf(f.line,g),_(f.line),f.rest))for(var k=0;k<f.rest.length;k++)_(f.rest[k])}}}function _(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b)a.widgets[b].height=a.widgets[b].node.offsetHeight}function ab(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:U(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function bb(a,b,c){function i(b){var c=b.nextSibling;return h&&s&&a.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b),c}for(var d=a.display,e=a.options.lineNumbers,f=d.lineDiv,g=f.firstChild,j=d.view,k=d.viewFrom,l=0;l<j.length;l++){var m=j[l];if(m.hidden);else if(m.node){for(;g!=m.node;)g=i(g);var o=e&&null!=b&&k>=b&&m.lineNumber;m.changes&&(Cg(m.changes,"gutter")>-1&&(o=!1),cb(a,m,k,c)),o&&(Og(m.lineNumber),m.lineNumber.appendChild(document.createTextNode(T(a.options,k)))),g=m.node.nextSibling}else{var n=kb(a,m,k,c);f.insertBefore(n,g)}k+=m.size}for(;g;)g=i(g)}function cb(a,b,c,d){for(var e=0;e<b.changes.length;e++){var f=b.changes[e];"text"==f?gb(a,b):"gutter"==f?ib(a,b,c,d):"class"==f?hb(b):"widget"==f&&jb(b,d)}b.changes=null}function db(a){return a.node==a.text&&(a.node=Mg("div",null,null,"position: relative"),a.text.parentNode&&a.text.parentNode.replaceChild(a.node,a.text),a.node.appendChild(a.text),c&&(a.node.style.zIndex=2)),a.node}function eb(a){var b=a.bgClass?a.bgClass+" "+(a.line.bgClass||""):a.line.bgClass;if(b&&(b+=" CodeMirror-linebackground"),a.background)b?a.background.className=b:(a.background.parentNode.removeChild(a.background),a.background=null);else if(b){var c=db(a);a.background=c.insertBefore(Mg("div",null,b),c.firstChild)}}function fb(a,b){var c=a.display.externalMeasured;return c&&c.line==b.line?(a.display.externalMeasured=null,b.measure=c.measure,c.built):nf(a,b)}function gb(a,b){var c=b.text.className,d=fb(a,b);b.text==b.node&&(b.node=d.pre),b.text.parentNode.replaceChild(d.pre,b.text),b.text=d.pre,d.bgClass!=b.bgClass||d.textClass!=b.textClass?(b.bgClass=d.bgClass,b.textClass=d.textClass,hb(b)):c&&(b.text.className=c)}function hb(a){eb(a),a.line.wrapClass?db(a).className=a.line.wrapClass:a.node!=a.text&&(a.node.className="");var b=a.textClass?a.textClass+" "+(a.line.textClass||""):a.line.textClass;a.text.className=b||""}function ib(a,b,c,d){b.gutter&&(b.node.removeChild(b.gutter),b.gutter=null);var e=b.line.gutterMarkers;if(a.options.lineNumbers||e){var f=db(b),g=b.gutter=f.insertBefore(Mg("div",null,"CodeMirror-gutter-wrapper","position: absolute; left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px"),b.text);if(!a.options.lineNumbers||e&&e["CodeMirror-linenumbers"]||(b.lineNumber=g.appendChild(Mg("div",T(a.options,c),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+d.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+a.display.lineNumInnerWidth+"px"))),e)for(var h=0;h<a.options.gutters.length;++h){var i=a.options.gutters[h],j=e.hasOwnProperty(i)&&e[i];j&&g.appendChild(Mg("div",[j],"CodeMirror-gutter-elt","left: "+d.gutterLeft[i]+"px; width: "+d.gutterWidth[i]+"px"))}}}function jb(a,b){a.alignable&&(a.alignable=null);for(var d,c=a.node.firstChild;c;c=d){var d=c.nextSibling;"CodeMirror-linewidget"==c.className&&a.node.removeChild(c)}lb(a,b)}function kb(a,b,c,d){var e=fb(a,b);return b.text=b.node=e.pre,e.bgClass&&(b.bgClass=e.bgClass),e.textClass&&(b.textClass=e.textClass),hb(b),ib(a,b,c,d),lb(b,d),b.node}function lb(a,b){if(mb(a.line,a,b,!0),a.rest)for(var c=0;c<a.rest.length;c++)mb(a.rest[c],a,b,!1)}function mb(a,b,c,d){if(a.widgets)for(var e=db(b),f=0,g=a.widgets;f<g.length;++f){var h=g[f],i=Mg("div",[h.node],"CodeMirror-linewidget");h.handleMouseEvents||(i.ignoreEvents=!0),nb(h,i,b,c),d&&h.above?e.insertBefore(i,b.gutter||b.text):e.appendChild(i),kg(h,"redraw")}}function nb(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 qb(a){return ob(a.line,a.ch)}function rb(a,b){return pb(a,b)<0?b:a}function sb(a,b){return pb(a,b)<0?a:b}function tb(a,b){this.ranges=a,this.primIndex=b}function ub(a,b){this.anchor=a,this.head=b}function vb(a,b){var c=a[b];a.sort(function(a,b){return pb(a.from(),b.from())}),b=Cg(a,c);for(var d=1;d<a.length;d++){var e=a[d],f=a[d-1];if(pb(f.to(),e.from())>=0){var g=sb(f.from(),e.from()),h=rb(f.to(),e.to()),i=f.empty()?e.from()==e.head:f.from()==f.head;b>=d&&--b,a.splice(--d,2,new ub(i?h:g,i?g:h))}}return new tb(a,b)}function wb(a,b){return new tb([new ub(a,b||a)],0)}function xb(a,b){return Math.max(a.first,Math.min(b,a.first+a.size-1))}function yb(a,b){if(b.line<a.first)return ob(a.first,0);var c=a.first+a.size-1;return b.line>c?ob(c,Ef(a,c).text.length):zb(b,Ef(a,b.line).text.length)}function zb(a,b){var c=a.ch;return null==c||c>b?ob(a.line,b):0>c?ob(a.line,0):a}function Ab(a,b){return b>=a.first&&b<a.first+a.size}function Bb(a,b){for(var c=[],d=0;d<b.length;d++)c[d]=yb(a,b[d]);return c}function Cb(a,b,c,d){if(a.cm&&a.cm.display.shift||a.extend){var e=b.anchor;if(d){var f=pb(c,e)<0;f!=pb(d,e)<0?(e=c,c=d):f!=pb(c,d)<0&&(c=d)}return new ub(e,c)}return new ub(d||c,c)}function Db(a,b,c,d){Jb(a,new tb([Cb(a,a.sel.primary(),b,c)],0),d)}function Eb(a,b,c){for(var d=[],e=0;e<a.sel.ranges.length;e++)d[e]=Cb(a,a.sel.ranges[e],b[e],null);var f=vb(d,a.sel.primIndex);Jb(a,f,c)}function Fb(a,b,c,d){var e=a.sel.ranges.slice(0);e[b]=c,Jb(a,vb(e,a.sel.primIndex),d)}function Gb(a,b,c,d){Jb(a,wb(b,c),d)}function Hb(a,b){var c={ranges:b.ranges,update:function(b){this.ranges=[];for(var c=0;c<b.length;c++)this.ranges[c]=new ub(yb(a,b[c].anchor),yb(a,b[c].head))}};return hg(a,"beforeSelectionChange",a,c),a.cm&&hg(a.cm,"beforeSelectionChange",a.cm,c),c.ranges!=b.ranges?vb(c.ranges,c.ranges.length-1):b}function Ib(a,b,c){var d=a.history.done,e=Ag(d);e&&e.ranges?(d[d.length-1]=b,Kb(a,b,c)):Jb(a,b,c)}function Jb(a,b,c){Kb(a,b,c),Sf(a,a.sel,a.cm?a.cm.curOp.id:0/0,c)}function Kb(a,b,c){(og(a,"beforeSelectionChange")||a.cm&&og(a.cm,"beforeSelectionChange"))&&(b=Hb(a,b));var d=pb(b.primary().head,a.sel.primary().head)<0?-1:1;Lb(a,Nb(a,b,d,!0)),c&&c.scroll===!1||!a.cm||Sd(a.cm)}function Lb(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=!0,ng(a.cm)),kg(a,"cursorActivity",a))}function Mb(a){Lb(a,Nb(a,a.sel,null,!1),sg)}function Nb(a,b,c,d){for(var e,f=0;f<b.ranges.length;f++){var g=b.ranges[f],h=Ob(a,g.anchor,c,d),i=Ob(a,g.head,c,d);(e||h!=g.anchor||i!=g.head)&&(e||(e=b.ranges.slice(0,f)),e[f]=new ub(h,i))}return e?vb(e,b.primIndex):b}function Ob(a,b,c,d){var e=!1,f=b,g=c||1;a.cantEdit=!1;a:for(;;){var h=Ef(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&&(hg(k,"beforeCursorEnter"),k.explicitlyCleared)){if(h.markedSpans){--i;continue}break}if(!k.atomic)continue;var l=k.find(0>g?-1:1);if(0==pb(l,f)&&(l.ch+=g,l.ch<0?l=l.line>a.first?yb(a,ob(l.line-1)):null:l.ch>h.text.length&&(l=l.line<a.first+a.size-1?ob(l.line+1,0):null),!l)){if(e)return d?(a.cantEdit=!0,ob(a.first,0)):Ob(a,b,c,!0);e=!0,l=b,g=-g}f=l;continue a}}return f}}function Pb(a){for(var b=a.display,c=a.doc,d=document.createDocumentFragment(),e=document.createDocumentFragment(),f=0;f<c.sel.ranges.length;f++){var g=c.sel.ranges[f],h=g.empty();(h||a.options.showCursorWhenSelecting)&&Qb(a,g,d),h||Rb(a,g,e)}if(a.options.moveInputWithCursor){var i=pc(a,c.sel.primary().head,"div"),j=b.wrapper.getBoundingClientRect(),k=b.lineDiv.getBoundingClientRect(),l=Math.max(0,Math.min(b.wrapper.clientHeight-10,i.top+k.top-j.top)),m=Math.max(0,Math.min(b.wrapper.clientWidth-10,i.left+k.left-j.left));b.inputDiv.style.top=l+"px",b.inputDiv.style.left=m+"px"}Pg(b.cursorDiv,d),Pg(b.selectionDiv,e)}function Qb(a,b,c){var d=pc(a,b.head,"div"),e=c.appendChild(Mg("div","\xa0","CodeMirror-cursor"));if(e.style.left=d.left+"px",e.style.top=d.top+"px",e.style.height=Math.max(0,d.bottom-d.top)*a.options.cursorHeight+"px",d.other){var f=c.appendChild(Mg("div","\xa0","CodeMirror-cursor CodeMirror-secondarycursor"));f.style.display="",f.style.left=d.other.left+"px",f.style.top=d.other.top+"px",f.style.height=.85*(d.other.bottom-d.other.top)+"px"}}function Rb(a,b,c){function j(a,b,c,d){0>b&&(b=0),b=Math.round(b),d=Math.round(d),f.appendChild(Mg("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px; top: "+b+"px; width: "+(null==c?i-a:c)+"px; height: "+(d-b)+"px"))}function k(b,c,d){function m(c,d){return oc(a,ob(b,c),"div",f,d)}var k,l,f=Ef(e,b),g=f.text.length;return fh(Lf(f),c||0,null==d?g:d,function(a,b,e){var n,o,p,f=m(a,"left");if(a==b)n=f,o=p=f.left;else{if(n=m(b-1,"right"),"rtl"==e){var q=f;f=n,n=q}o=f.left,p=n.right}null==c&&0==a&&(o=h),n.top-f.top>3&&(j(o,f.top,null,f.bottom),o=h,f.bottom<n.top&&j(o,f.bottom,null,n.top)),null==d&&b==g&&(p=i),(!k||f.top<k.top||f.top==k.top&&f.left<k.left)&&(k=f),(!l||n.bottom>l.bottom||n.bottom==l.bottom&&n.right>l.right)&&(l=n),h+1>o&&(o=h),j(o,n.top,p-o,n.bottom)}),{start:k,end:l}}var d=a.display,e=a.doc,f=document.createDocumentFragment(),g=Zb(a.display),h=g.left,i=d.lineSpace.offsetWidth-g.right,l=b.from(),m=b.to();if(l.line==m.line)k(l.line,l.ch,m.ch);else{var n=Ef(e,l.line),o=Ef(e,m.line),p=Re(n)==Re(o),q=k(l.line,l.ch,p?n.text.length+1:null).end,r=k(m.line,p?0:null,m.ch).start;p&&(q.top<r.top-2?(j(q.right,q.top,null,q.bottom),j(h,r.top,r.left,r.bottom)):j(q.right,q.top,r.left-q.right,q.bottom)),q.bottom<r.top&&j(h,q.bottom,null,r.top)}c.appendChild(f)}function Sb(a){if(a.state.focused){var b=a.display;clearInterval(b.blinker);var c=!0;b.cursorDiv.style.visibility="",a.options.cursorBlinkRate>0&&(b.blinker=setInterval(function(){b.cursorDiv.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate))}}function Tb(a,b){a.doc.mode.startState&&a.doc.frontier<a.display.viewTo&&a.state.highlight.set(b,Gg(Ub,a))}function Ub(a){var b=a.doc;if(b.frontier<b.first&&(b.frontier=b.first),!(b.frontier>=a.display.viewTo)){var c=+new Date+a.options.workTime,d=he(b.mode,Wb(a,b.frontier));Ac(a,function(){b.iter(b.frontier,Math.min(b.first+b.size,a.display.viewTo+500),function(e){if(b.frontier>=a.display.viewFrom){var f=e.styles,g=gf(a,e,d,!0);e.styles=g.styles,g.classes?e.styleClasses=g.classes:e.styleClasses&&(e.styleClasses=null);for(var h=!f||f.length!=e.styles.length,i=0;!h&&i<f.length;++i)h=f[i]!=e.styles[i];h&&Hc(a,b.frontier,"text"),e.stateAfter=he(b.mode,d)}else jf(a,e.text,d),e.stateAfter=0==b.frontier%5?he(b.mode,d):null;return++b.frontier,+new Date>c?(Tb(a,a.options.workDelay),!0):void 0})})}}function Vb(a,b,c){for(var d,e,f=a.doc,g=c?-1:b-(a.doc.mode.innerMode?1e3:100),h=b;h>g;--h){if(h<=f.first)return f.first;var i=Ef(f,h-1);if(i.stateAfter&&(!c||h<=f.frontier))return h;var j=wg(i.text,null,a.options.tabSize);(null==e||d>j)&&(e=h-1,d=j)}return e}function Wb(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return!0;var f=Vb(a,b,c),g=f>d.first&&Ef(d,f-1).stateAfter;return g=g?he(d.mode,g):ie(d.mode),d.iter(f,b,function(c){jf(a,c.text,g);var h=f==b-1||0==f%5||f>=e.viewFrom&&f<e.viewTo;c.stateAfter=h?he(d.mode,g):null,++f}),c&&(d.frontier=f),g}function Xb(a){return a.lineSpace.offsetTop}function Yb(a){return a.mover.offsetHeight-a.lineSpace.offsetHeight}function Zb(a){if(a.cachedPaddingH)return a.cachedPaddingH;var b=Pg(a.measure,Mg("pre","x")),c=window.getComputedStyle?window.getComputedStyle(b):b.currentStyle,d={left:parseInt(c.paddingLeft),right:parseInt(c.paddingRight)};return isNaN(d.left)||isNaN(d.right)||(a.cachedPaddingH=d),d}function $b(a,b,c){var d=a.options.lineWrapping,e=d&&a.display.scroller.clientWidth;if(!b.measure.heights||d&&b.measure.width!=e){var f=b.measure.heights=[];if(d){b.measure.width=e;for(var g=b.text.firstChild.getClientRects(),h=0;h<g.length-1;h++){var i=g[h],j=g[h+1];Math.abs(i.bottom-j.bottom)>2&&f.push((i.bottom+j.top)/2-c.top)}}f.push(c.bottom-c.top)}}function _b(a,b,c){if(a.line==b)return{map:a.measure.map,cache:a.measure.cache};for(var d=0;d<a.rest.length;d++)if(a.rest[d]==b)return{map:a.measure.maps[d],cache:a.measure.caches[d]};for(var d=0;d<a.rest.length;d++)if(If(a.rest[d])>c)return{map:a.measure.maps[d],cache:a.measure.caches[d],before:!0}}function ac(a,b){b=Re(b);var c=If(b),d=a.display.externalMeasured=new Ec(a.doc,b,c);d.lineN=c;var e=d.built=nf(a,d);return d.text=e.pre,Pg(a.display.lineMeasure,e.pre),d}function bc(a,b,c,d){return ec(a,dc(a,b),c,d)}function cc(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo)return a.display.view[Jc(a,b)];var c=a.display.externalMeasured;return c&&b>=c.lineN&&b<c.lineN+c.size?c:void 0}function dc(a,b){var c=If(b),d=cc(a,c);d&&!d.text?d=null:d&&d.changes&&cb(a,d,c,ab(a)),d||(d=ac(a,b));var e=_b(d,b,c);return{line:b,view:d,rect:null,map:e.map,cache:e.cache,before:e.before,hasHeights:!1}}function ec(a,b,c,d){b.before&&(c=-1);var f,e=c+(d||"");return b.cache.hasOwnProperty(e)?f=b.cache[e]:(b.rect||(b.rect=b.view.text.getBoundingClientRect()),b.hasHeights||($b(a,b.view,b.rect),b.hasHeights=!0),f=gc(a,b,c,d),f.bogus||(b.cache[e]=f)),{left:f.left,right:f.right,top:f.top,bottom:f.bottom}}function gc(a,b,c,e){for(var h,i,j,k,f=b.map,l=0;l<f.length;l+=3){var m=f[l],n=f[l+1];if(m>c?(i=0,j=1,k="left"):n>c?(i=c-m,j=i+1):(l==f.length-3||c==n&&f[l+3]>c)&&(j=n-m,i=j-1,c>=n&&(k="right")),null!=i){if(h=f[l+2],m==n&&e==(h.insertLeft?"left":"right")&&(k=e),"left"==e&&0==i)for(;l&&f[l-2]==f[l-3]&&f[l-1].insertLeft;)h=f[(l-=3)+2],k="left";if("right"==e&&i==n-m)for(;l<f.length-3&&f[l+3]==f[l+4]&&!f[l+5].insertLeft;)h=f[(l+=3)+2],k="right";break}}var o;if(3==h.nodeType){for(;i&&Lg(b.line.text.charAt(m+i));)--i;for(;n>m+j&&Lg(b.line.text.charAt(m+j));)++j;if(d&&0==i&&j==n-m)o=h.parentNode.getBoundingClientRect();else if(g&&a.options.lineWrapping){var p=Ng(h,i,j).getClientRects();o=p.length?p["right"==e?p.length-1:0]:fc}else o=Ng(h,i,j).getBoundingClientRect()}else{i>0&&(k=e="right");var p;o=a.options.lineWrapping&&(p=h.getClientRects()).length>1?p["right"==e?p.length-1:0]:h.getBoundingClientRect()}if(d&&!i&&(!o||!o.left&&!o.right)){var q=h.parentNode.getClientRects()[0];o=q?{left:q.left,right:q.left+wc(a.display),top:q.top,bottom:q.bottom}:fc}for(var r,s=(o.bottom+o.top)/2-b.rect.top,t=b.view.measure.heights,l=0;l<t.length-1&&!(s<t[l]);l++);r=l?t[l-1]:0,s=t[l];var u={left:("right"==k?o.right:o.left)-b.rect.left,right:("left"==k?o.left:o.right)-b.rect.left,top:r,bottom:s};return o.left||o.right||(u.bogus=!0),u}function hc(a){if(a.measure&&(a.measure.cache={},a.measure.heights=null,a.rest))for(var b=0;b<a.rest.length;b++)a.measure.caches[b]={}}function ic(a){a.display.externalMeasure=null,Og(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++)hc(a.display.view[b])}function jc(a){ic(a),a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH=null,a.options.lineWrapping||(a.display.maxLineChanged=!0),a.display.lineNumChars=null}function kc(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function lc(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function mc(a,b,c,d){if(b.widgets)for(var e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f=Ze(b.widgets[e]);c.top+=f,c.bottom+=f}if("line"==d)return c;d||(d="local");var g=Kf(b);if("local"==d?g+=Xb(a.display):g-=a.display.viewOffset,"page"==d||"window"==d){var h=a.display.lineSpace.getBoundingClientRect();g+=h.top+("window"==d?0:lc());var i=h.left+("window"==d?0:kc());c.left+=i,c.right+=i}return c.top+=g,c.bottom+=g,c}function nc(a,b,c){if("div"==c)return b;var d=b.left,e=b.top;if("page"==c)d-=kc(),e-=lc();else if("local"==c||!c){var f=a.display.sizer.getBoundingClientRect();d+=f.left,e+=f.top}var g=a.display.lineSpace.getBoundingClientRect();return{left:d-g.left,top:e-g.top}}function oc(a,b,c,d,e){return d||(d=Ef(a.doc,b.line)),mc(a,d,bc(a,d,b.ch,e),c)}function pc(a,b,c,d,e){function f(b,f){var g=ec(a,e,b,f?"right":"left");return f?g.left=g.right:g.right=g.left,mc(a,d,g,c)}function g(a,b){var c=h[b],d=c.level%2;return a==gh(c)&&b&&c.level<h[b-1].level?(c=h[--b],a=hh(c)-(c.level%2?0:1),d=!0):a==hh(c)&&b<h.length-1&&c.level<h[b+1].level&&(c=h[++b],a=gh(c)-c.level%2,d=!1),d&&a==c.to&&a>c.from?f(a-1):f(a,d)}d=d||Ef(a.doc,b.line),e||(e=dc(a,d));var h=Lf(d),i=b.ch;if(!h)return f(i);var j=oh(h,i),k=g(i,j);return null!=nh&&(k.other=g(i,nh)),k}function qc(a,b){var c=0,b=yb(a.doc,b);a.options.lineWrapping||(c=wc(a.display)*b.ch);var d=Ef(a.doc,b.line),e=Kf(d)+Xb(a.display);return{left:c,right:c,top:e,bottom:e+d.height}}function rc(a,b,c,d){var e=ob(a,b);return e.xRel=d,c&&(e.outside=!0),e}function sc(a,b,c){var d=a.doc;if(c+=a.display.viewOffset,0>c)return rc(d.first,0,!0,-1);var e=Jf(d,c),f=d.first+d.size-1;if(e>f)return rc(d.first+d.size-1,Ef(d,f).text.length,!0,1);0>b&&(b=0);for(var g=Ef(d,e);;){var h=tc(a,g,e,b,c),i=Pe(g),j=i&&i.find(0,!0);if(!i||!(h.ch>j.from.ch||h.ch==j.from.ch&&h.xRel>0))return h;e=If(g=j.to.line)}}function tc(a,b,c,d,e){function j(d){var e=pc(a,ob(c,d),"line",b,i);return g=!0,f>e.bottom?e.left-h:f<e.top?e.left+h:(g=!1,e.left)}var f=e-Kf(b),g=!1,h=2*a.display.wrapper.clientWidth,i=dc(a,b),k=Lf(b),l=b.text.length,m=ih(b),n=jh(b),o=j(m),p=g,q=j(n),r=g;if(d>q)return rc(c,n,r,1);for(;;){if(k?n==m||n==qh(b,m,1):1>=n-m){for(var s=o>d||q-d>=d-o?m:n,t=d-(s==m?o:q);Lg(b.text.charAt(s));)++s;var u=rc(c,s,s==m?p:r,-1>t?-1:t>1?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=qh(b,w,1)}var y=j(w);y>d?(n=w,q=y,(r=g)&&(q+=1e3),l=v):(m=w,o=y,p=g,l-=v)}}function vc(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==uc){uc=Mg("pre");for(var b=0;49>b;++b)uc.appendChild(document.createTextNode("x")),uc.appendChild(Mg("br"));uc.appendChild(document.createTextNode("x"))}Pg(a.measure,uc);var c=uc.offsetHeight/50;return c>3&&(a.cachedTextHeight=c),Og(a.measure),c||1}function wc(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=Mg("span","xxxxxxxxxx"),c=Mg("pre",[b]);Pg(a.measure,c);var d=b.getBoundingClientRect(),e=(d.right-d.left)/10;return e>2&&(a.cachedCharWidth=e),e||10}function yc(a){a.curOp={viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,id:++xc},jg++||(ig=[])}function zc(a){var b=a.curOp,c=a.doc,d=a.display;if(a.curOp=null,b.updateMaxLine&&M(a),b.viewChanged||b.forceUpdate||null!=b.scrollTop||b.scrollToPos&&(b.scrollToPos.from.line<d.viewFrom||b.scrollToPos.to.line>=d.viewTo)||d.maxLineChanged&&a.options.lineWrapping){var e=V(a,{top:b.scrollTop,ensure:b.scrollToPos},b.forceUpdate);a.display.scroller.offsetHeight&&(a.doc.scrollTop=a.display.scroller.scrollTop)}if(!e&&b.selectionChanged&&Pb(a),e||b.startHeight==a.doc.height||P(a),null!=b.scrollTop&&d.scroller.scrollTop!=b.scrollTop){var f=Math.max(0,Math.min(d.scroller.scrollHeight-d.scroller.clientHeight,b.scrollTop));d.scroller.scrollTop=d.scrollbarV.scrollTop=c.scrollTop=f}if(null!=b.scrollLeft&&d.scroller.scrollLeft!=b.scrollLeft){var g=Math.max(0,Math.min(d.scroller.scrollWidth-d.scroller.clientWidth,b.scrollLeft));d.scroller.scrollLeft=d.scrollbarH.scrollLeft=c.scrollLeft=g,R(a)}if(b.scrollToPos){var h=Od(a,yb(a.doc,b.scrollToPos.from),yb(a.doc,b.scrollToPos.to),b.scrollToPos.margin);b.scrollToPos.isCursor&&a.state.focused&&Nd(a,h)}b.selectionChanged&&Sb(a),a.state.focused&&b.updateInput&&Qc(a,b.typing);var i=b.maybeHiddenMarkers,j=b.maybeUnhiddenMarkers;if(i)for(var k=0;k<i.length;++k)i[k].lines.length||hg(i[k],"hide");if(j)for(var k=0;k<j.length;++k)j[k].lines.length&&hg(j[k],"unhide");var l;if(--jg||(l=ig,ig=null),b.changeObjs&&hg(a,"changes",a,b.changeObjs),l)for(var k=0;k<l.length;++k)l[k]();if(b.cursorActivityHandlers)for(var k=0;k<b.cursorActivityHandlers.length;k++)b.cursorActivityHandlers[k](a)}function Ac(a,b){if(a.curOp)return b();yc(a);try{return b()}finally{zc(a)}}function Bc(a,b){return function(){if(a.curOp)return b.apply(a,arguments);yc(a);try{return b.apply(a,arguments)}finally{zc(a)}}}function Cc(a){return function(){if(this.curOp)return a.apply(this,arguments);yc(this);try{return a.apply(this,arguments)}finally{zc(this)}}}function Dc(a){return function(){var b=this.cm;if(!b||b.curOp)return a.apply(this,arguments);yc(b);try{return a.apply(this,arguments)}finally{zc(b)}}}function Ec(a,b,c){this.line=b,this.rest=Se(b),this.size=this.rest?If(Ag(this.rest))-c+1:1,this.node=this.text=null,this.hidden=Ve(a,b)
2
- }function Fc(a,b,c){for(var e,d=[],f=b;c>f;f=e){var g=new Ec(a.doc,Ef(a.doc,f),f);e=f+g.size,d.push(g)}return d}function Gc(a,b,c,d){null==b&&(b=a.doc.first),null==c&&(c=a.doc.first+a.doc.size),d||(d=0);var e=a.display;if(d&&c<e.viewTo&&(null==e.updateLineNumbers||e.updateLineNumbers>b)&&(e.updateLineNumbers=b),a.curOp.viewChanged=!0,b>=e.viewTo)y&&Te(a.doc,b)<e.viewTo&&Ic(a);else if(c<=e.viewFrom)y&&Ue(a.doc,c+d)>e.viewFrom?Ic(a):(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)Ic(a);else if(b<=e.viewFrom){var f=Kc(a,c,c+d,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=d):Ic(a)}else if(c>=e.viewTo){var f=Kc(a,b,b,-1);f?(e.view=e.view.slice(0,f.index),e.viewTo=f.lineN):Ic(a)}else{var g=Kc(a,b,b,-1),h=Kc(a,c,c+d,1);g&&h?(e.view=e.view.slice(0,g.index).concat(Fc(a,g.lineN,h.lineN)).concat(e.view.slice(h.index)),e.viewTo+=d):Ic(a)}var i=e.externalMeasured;i&&(c<i.lineN?i.lineN+=d:b<i.lineN+i.size&&(e.externalMeasured=null))}function Hc(a,b,c){a.curOp.viewChanged=!0;var d=a.display,e=a.display.externalMeasured;if(e&&b>=e.lineN&&b<e.lineN+e.size&&(d.externalMeasured=null),!(b<d.viewFrom||b>=d.viewTo)){var f=d.view[Jc(a,b)];if(null!=f.node){var g=f.changes||(f.changes=[]);-1==Cg(g,c)&&g.push(c)}}}function Ic(a){a.display.viewFrom=a.display.viewTo=a.doc.first,a.display.view=[],a.display.viewOffset=0}function Jc(a,b){if(b>=a.display.viewTo)return null;if(b-=a.display.viewFrom,0>b)return null;for(var c=a.display.view,d=0;d<c.length;d++)if(b-=c[d].size,0>b)return d}function Kc(a,b,c,d){var f,e=Jc(a,b),g=a.display.view;if(!y)return{index:e,lineN:c};for(var h=0,i=a.display.viewFrom;e>h;h++)i+=g[h].size;if(i!=b){if(d>0){if(e==g.length-1)return null;f=i+g[e].size-b,e++}else f=i-b;b+=f,c+=f}for(;Te(a.doc,c)!=c;){if(e==(0>d?0:g.length-1))return null;c+=d*g[e-(0>d?1:0)].size,e+=d}return{index:e,lineN:c}}function Lc(a,b,c){var d=a.display,e=d.view;0==e.length||b>=d.viewTo||c<=d.viewFrom?(d.view=Fc(a,b,c),d.viewFrom=b):(d.viewFrom>b?d.view=Fc(a,b,d.viewFrom).concat(d.view):d.viewFrom<b&&(d.view=d.view.slice(Jc(a,b))),d.viewFrom=b,d.viewTo<c?d.view=d.view.concat(Fc(a,d.viewTo,c)):d.viewTo>c&&(d.view=d.view.slice(0,Jc(a,c)))),d.viewTo=c}function Mc(a){for(var b=a.display.view,c=0,d=0;d<b.length;d++){var e=b[d];e.hidden||e.node&&!e.changes||++c}return c}function Nc(a){a.display.pollingFast||a.display.poll.set(a.options.pollInterval,function(){Pc(a),a.state.focused&&Nc(a)})}function Oc(a){function c(){var d=Pc(a);d||b?(a.display.pollingFast=!1,Nc(a)):(b=!0,a.display.poll.set(60,c))}var b=!1;a.display.pollingFast=!0,a.display.poll.set(20,c)}function Pc(a){var b=a.display.input,c=a.display.prevInput,e=a.doc;if(!a.state.focused||ch(b)&&!c||Tc(a)||a.options.disableInput)return!1;a.state.pasteIncoming&&a.state.fakedLastChar&&(b.value=b.value.substring(0,b.value.length-1),a.state.fakedLastChar=!1);var f=b.value;if(f==c&&!a.somethingSelected())return!1;if(g&&!d&&a.display.inputHasSelection===f)return Qc(a),!1;var h=!a.curOp;h&&yc(a),a.display.shift=!1;for(var i=0,j=Math.min(c.length,f.length);j>i&&c.charCodeAt(i)==f.charCodeAt(i);)++i;for(var k=f.slice(i),l=bh(k),m=a.state.pasteIncoming&&l.length>1&&e.sel.ranges.length==l.length,n=e.sel.ranges.length-1;n>=0;n--){var o=e.sel.ranges[n],p=o.from(),q=o.to();i<c.length?p=ob(p.line,p.ch-(c.length-i)):a.state.overwrite&&o.empty()&&!a.state.pasteIncoming&&(q=ob(q.line,Math.min(Ef(e,q.line).text.length,q.ch+Ag(l).length)));var r=a.curOp.updateInput,s={from:p,to:q,text:m?[l[n]]:l,origin:a.state.pasteIncoming?"paste":a.state.cutIncoming?"cut":"+input"};if(Gd(a.doc,s),kg(a,"inputRead",a,s),k&&!a.state.pasteIncoming&&a.options.electricChars&&a.options.smartIndent&&o.head.ch<100&&(!n||e.sel.ranges[n-1].head.line!=o.head.line)){var t=a.getModeAt(o.head);if(t.electricChars){for(var u=0;u<t.electricChars.length;u++)if(k.indexOf(t.electricChars.charAt(u))>-1){Ud(a,o.head.line,"smart");break}}else if(t.electricInput){var v=Ad(s);t.electricInput.test(Ef(e,v.line).text.slice(0,v.ch))&&Ud(a,o.head.line,"smart")}}}return Sd(a),a.curOp.updateInput=r,a.curOp.typing=!0,f.length>1e3||f.indexOf("\n")>-1?b.value=a.display.prevInput="":a.display.prevInput=f,h&&zc(a),a.state.pasteIncoming=a.state.cutIncoming=!1,!0}function Qc(a,b){var c,e,f=a.doc;if(a.somethingSelected()){a.display.prevInput="";var h=f.sel.primary();c=dh&&(h.to().line-h.from().line>100||(e=a.getSelection()).length>1e3);var i=c?"-":e||a.getSelection();a.display.input.value=i,a.state.focused&&Bg(a.display.input),g&&!d&&(a.display.inputHasSelection=i)}else b||(a.display.prevInput=a.display.input.value="",g&&!d&&(a.display.inputHasSelection=null));a.display.inaccurateSelection=c}function Rc(a){"nocursor"==a.options.readOnly||r&&Rg()==a.display.input||a.display.input.focus()}function Sc(a){a.state.focused||(Rc(a),vd(a))}function Tc(a){return a.options.readOnly||a.doc.cantEdit}function Uc(a){function e(){a.state.focused&&setTimeout(Gg(Rc,a),0)}function i(){null==f&&(f=setTimeout(function(){f=null,c.cachedCharWidth=c.cachedTextHeight=c.cachedPaddingH=Xg=null,a.setSize()},100))}function j(){Qg(document.body,c.wrapper)?setTimeout(j,5e3):gg(window,"resize",i)}function k(b){mg(a,b)||cg(b)}function l(b){if(a.somethingSelected())c.inaccurateSelection&&(c.prevInput="",c.inaccurateSelection=!1,c.input.value=a.getSelection(),Bg(c.input));else{for(var d="",e=[],f=0;f<a.doc.sel.ranges.length;f++){var g=a.doc.sel.ranges[f].head.line,h={anchor:ob(g,0),head:ob(g+1,0)};e.push(h),d+=a.getRange(h.anchor,h.head)}"cut"==b.type?a.setSelections(e,null,sg):(c.prevInput="",c.input.value=d,Bg(c.input))}"cut"==b.type&&(a.state.cutIncoming=!0)}var c=a.display;fg(c.scroller,"mousedown",Bc(a,Xc)),b?fg(c.scroller,"dblclick",Bc(a,function(b){if(!mg(a,b)){var c=Wc(a,b);if(c&&!cd(a,b)&&!Vc(a.display,b)){_f(b);var d=Zd(a.doc,c);Db(a.doc,d.anchor,d.head)}}})):fg(c.scroller,"dblclick",function(b){mg(a,b)||_f(b)}),fg(c.lineSpace,"selectstart",function(a){Vc(c,a)||_f(a)}),w||fg(c.scroller,"contextmenu",function(b){yd(a,b)}),fg(c.scroller,"scroll",function(){c.scroller.clientHeight&&(gd(a,c.scroller.scrollTop),hd(a,c.scroller.scrollLeft,!0),hg(a,"scroll",a))}),fg(c.scrollbarV,"scroll",function(){c.scroller.clientHeight&&gd(a,c.scrollbarV.scrollTop)}),fg(c.scrollbarH,"scroll",function(){c.scroller.clientHeight&&hd(a,c.scrollbarH.scrollLeft)}),fg(c.scroller,"mousewheel",function(b){kd(a,b)}),fg(c.scroller,"DOMMouseScroll",function(b){kd(a,b)}),fg(c.scrollbarH,"mousedown",e),fg(c.scrollbarV,"mousedown",e),fg(c.wrapper,"scroll",function(){c.wrapper.scrollTop=c.wrapper.scrollLeft=0});var f;fg(window,"resize",i),setTimeout(j,5e3),fg(c.input,"keyup",Bc(a,td)),fg(c.input,"input",function(){g&&!d&&a.display.inputHasSelection&&(a.display.inputHasSelection=null),Oc(a)}),fg(c.input,"keydown",Bc(a,rd)),fg(c.input,"keypress",Bc(a,ud)),fg(c.input,"focus",Gg(vd,a)),fg(c.input,"blur",Gg(wd,a)),a.options.dragDrop&&(fg(c.scroller,"dragstart",function(b){fd(a,b)}),fg(c.scroller,"dragenter",k),fg(c.scroller,"dragover",k),fg(c.scroller,"drop",Bc(a,ed))),fg(c.scroller,"paste",function(b){Vc(c,b)||(a.state.pasteIncoming=!0,Rc(a),Oc(a))}),fg(c.input,"paste",function(){if(h&&!a.state.fakedLastChar&&!(new Date-a.state.lastMiddleDown<200)){var b=c.input.selectionStart,d=c.input.selectionEnd;c.input.value+="$",c.input.selectionStart=b,c.input.selectionEnd=d,a.state.fakedLastChar=!0}a.state.pasteIncoming=!0,Oc(a)}),fg(c.input,"cut",l),fg(c.input,"copy",l),m&&fg(c.sizer,"mouseup",function(){Rg()==c.input&&c.input.blur(),Rc(a)})}function Vc(a,b){for(var c=dg(b);c!=a.wrapper;c=c.parentNode)if(!c||c.ignoreEvents||c.parentNode==a.sizer&&c!=a.mover)return!0}function Wc(a,b,c,d){var e=a.display;if(!c){var f=dg(b);if(f==e.scrollbarH||f==e.scrollbarV||f==e.scrollbarFiller||f==e.gutterFiller)return null}var g,h,i=e.lineSpace.getBoundingClientRect();try{g=b.clientX-i.left,h=b.clientY-i.top}catch(b){return null}var k,j=sc(a,g,h);if(d&&1==j.xRel&&(k=Ef(a.doc,j.line).text).length==j.ch){var l=wg(k,k.length,a.options.tabSize)-k.length;j=ob(j.line,Math.round((g-Zb(a.display).left)/wc(a.display))-l)}return j}function Xc(a){if(!mg(this,a)){var b=this,c=b.display;if(c.shift=a.shiftKey,Vc(c,a))return h||(c.scroller.draggable=!1,setTimeout(function(){c.scroller.draggable=!0},100)),void 0;if(!cd(b,a)){var d=Wc(b,a);switch(window.focus(),eg(a)){case 1:d?$c(b,a,d):dg(a)==c.scroller&&_f(a);break;case 2:h&&(b.state.lastMiddleDown=+new Date),d&&Db(b.doc,d),setTimeout(Gg(Rc,b),20),_f(a);break;case 3:w&&yd(b,a)}}}}function $c(a,b,c){setTimeout(Gg(Sc,a),0);var e,d=+new Date;Zc&&Zc.time>d-400&&0==pb(Zc.pos,c)?e="triple":Yc&&Yc.time>d-400&&0==pb(Yc.pos,c)?(e="double",Zc={time:d,pos:c}):(e="single",Yc={time:d,pos:c});var f=a.doc.sel,g=s?b.metaKey:b.ctrlKey;a.options.dragDrop&&Wg&&!g&&!Tc(a)&&"single"==e&&f.contains(c)>-1&&f.somethingSelected()?_c(a,b,c):ad(a,b,c,e,g)}function _c(a,c,e){var f=a.display,g=Bc(a,function(i){h&&(f.scroller.draggable=!1),a.state.draggingText=!1,gg(document,"mouseup",g),gg(f.scroller,"drop",g),Math.abs(c.clientX-i.clientX)+Math.abs(c.clientY-i.clientY)<10&&(_f(i),Db(a.doc,e),Rc(a),b&&!d&&setTimeout(function(){document.body.focus(),Rc(a)},20))});h&&(f.scroller.draggable=!0),a.state.draggingText=g,f.scroller.dragDrop&&f.scroller.dragDrop(),fg(document,"mouseup",g),fg(f.scroller,"drop",g)}function ad(a,b,c,d,f){function p(b){if(0!=pb(o,b))if(o=b,"rect"==d){for(var e=[],f=a.options.tabSize,g=wg(Ef(i,c.line).text,c.ch,f),h=wg(Ef(i,b.line).text,b.ch,f),m=Math.min(g,h),n=Math.max(g,h),p=Math.min(c.line,b.line),q=Math.min(a.lastLine(),Math.max(c.line,b.line));q>=p;p++){var r=Ef(i,p).text,s=xg(r,m,f);m==n?e.push(new ub(ob(p,s),ob(p,s))):r.length>s&&e.push(new ub(ob(p,s),ob(p,xg(r,n,f))))}e.length||e.push(new ub(c,c)),Jb(i,vb(l.ranges.slice(0,k).concat(e),k),tg)}else{var t=j,u=t.anchor,v=b;if("single"!=d){if("double"==d)var w=Zd(i,b);else var w=new ub(ob(b.line,0),yb(i,ob(b.line+1,0)));pb(w.anchor,u)>0?(v=w.head,u=sb(t.from(),w.anchor)):(v=w.anchor,u=rb(t.to(),w.head))}var e=l.ranges.slice(0);e[k]=new ub(yb(i,u),v),Jb(i,vb(e,k),tg)}}function s(b){var c=++r,e=Wc(a,b,!0,"rect"==d);if(e)if(0!=pb(e,o)){Sc(a),p(e);var f=Q(h,i);(e.line>=f.to||e.line<f.from)&&setTimeout(Bc(a,function(){r==c&&s(b)}),150)}else{var g=b.clientY<q.top?-20:b.clientY>q.bottom?20:0;g&&setTimeout(Bc(a,function(){r==c&&(h.scroller.scrollTop+=g,s(b))}),50)}}function t(b){r=1/0,_f(b),Rc(a),gg(document,"mousemove",u),gg(document,"mouseup",v),i.history.lastSelOrigin=null}var h=a.display,i=a.doc;_f(b);var j,k,l=i.sel;if(f?(k=i.sel.contains(c),j=k>-1?i.sel.ranges[k]:new ub(c,c)):j=i.sel.primary(),b.altKey)d="rect",f||(j=new ub(c,c)),c=Wc(a,b,!0,!0),k=-1;else if("double"==d){var m=Zd(i,c);j=a.display.shift||i.extend?Cb(i,j,m.anchor,m.head):m}else if("triple"==d){var n=new ub(ob(c.line,0),yb(i,ob(c.line+1,0)));j=a.display.shift||i.extend?Cb(i,j,n.anchor,n.head):n}else j=Cb(i,j,c);f?k>-1?Fb(i,k,j,tg):(k=i.sel.ranges.length,Jb(i,vb(i.sel.ranges.concat([j]),k),{scroll:!1,origin:"*mouse"})):(k=0,Jb(i,new tb([j],0),tg));var o=c,q=h.wrapper.getBoundingClientRect(),r=0,u=Bc(a,function(a){(g&&!e?a.buttons:eg(a))?s(a):t(a)}),v=Bc(a,t);fg(document,"mousemove",u),fg(document,"mouseup",v)}function bd(a,b,c,d,e){try{var f=b.clientX,g=b.clientY}catch(b){return!1}if(f>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&_f(b);var h=a.display,i=h.lineDiv.getBoundingClientRect();if(g>i.bottom||!og(a,c))return bg(b);g-=i.top-h.viewOffset;for(var j=0;j<a.options.gutters.length;++j){var k=h.gutters.childNodes[j];if(k&&k.getBoundingClientRect().right>=f){var l=Jf(a.doc,g),m=a.options.gutters[j];return e(a,c,a,l,m,b),bg(b)}}}function cd(a,b){return bd(a,b,"gutterClick",!0,kg)}function ed(a){var c=this;if(!mg(c,a)&&!Vc(c.display,a)){_f(a),b&&(dd=+new Date);var d=Wc(c,a,!0),e=a.dataTransfer.files;if(d&&!Tc(c))if(e&&e.length&&window.FileReader&&window.File)for(var f=e.length,g=Array(f),h=0,i=function(a,b){var e=new FileReader;e.onload=Bc(c,function(){if(g[b]=e.result,++h==f){d=yb(c.doc,d);var a={from:d,to:d,text:bh(g.join("\n")),origin:"paste"};Gd(c.doc,a),Ib(c.doc,wb(d,Ad(a)))}}),e.readAsText(a)},j=0;f>j;++j)i(e[j],j);else{if(c.state.draggingText&&c.doc.sel.contains(d)>-1)return c.state.draggingText(a),setTimeout(Gg(Rc,c),20),void 0;try{var g=a.dataTransfer.getData("Text");if(g){var k=c.state.draggingText&&c.listSelections();if(Kb(c.doc,wb(d,d)),k)for(var j=0;j<k.length;++j)Md(c.doc,"",k[j].anchor,k[j].head,"drag");c.replaceSelection(g,"around","paste"),Rc(c)}}catch(a){}}}}function fd(a,c){if(b&&(!a.state.draggingText||+new Date-dd<100))return cg(c),void 0;if(!mg(a,c)&&!Vc(a.display,c)&&(c.dataTransfer.setData("Text",a.getSelection()),c.dataTransfer.setDragImage&&!l)){var d=Mg("img",null,null,"position: fixed; left: 0; top: 0;");d.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",k&&(d.width=d.height=1,a.display.wrapper.appendChild(d),d._top=d.offsetTop),c.dataTransfer.setDragImage(d,0,0),k&&d.parentNode.removeChild(d)}}function gd(b,c){Math.abs(b.doc.scrollTop-c)<2||(b.doc.scrollTop=c,a||V(b,{top:c}),b.display.scroller.scrollTop!=c&&(b.display.scroller.scrollTop=c),b.display.scrollbarV.scrollTop!=c&&(b.display.scrollbarV.scrollTop=c),a&&V(b),Tb(b,100))}function hd(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,R(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbarH.scrollLeft!=b&&(a.display.scrollbarH.scrollLeft=b))}function kd(b,c){var d=c.wheelDeltaX,e=c.wheelDeltaY;null==d&&c.detail&&c.axis==c.HORIZONTAL_AXIS&&(d=c.detail),null==e&&c.detail&&c.axis==c.VERTICAL_AXIS?e=c.detail:null==e&&(e=c.wheelDelta);var f=b.display,g=f.scroller;if(d&&g.scrollWidth>g.clientWidth||e&&g.scrollHeight>g.clientHeight){if(e&&s&&h)a:for(var i=c.target,j=f.view;i!=g;i=i.parentNode)for(var l=0;l<j.length;l++)if(j[l].node==i){b.display.currentWheelTarget=i;break a}if(d&&!a&&!k&&null!=jd)return e&&gd(b,Math.max(0,Math.min(g.scrollTop+e*jd,g.scrollHeight-g.clientHeight))),hd(b,Math.max(0,Math.min(g.scrollLeft+d*jd,g.scrollWidth-g.clientWidth))),_f(c),f.wheelStartX=null,void 0;if(e&&null!=jd){var m=e*jd,n=b.doc.scrollTop,o=n+f.wrapper.clientHeight;0>m?n=Math.max(0,n+m-50):o=Math.min(b.doc.height,o+m+50),V(b,{top:n,bottom:o})}20>id&&(null==f.wheelStartX?(f.wheelStartX=g.scrollLeft,f.wheelStartY=g.scrollTop,f.wheelDX=d,f.wheelDY=e,setTimeout(function(){if(null!=f.wheelStartX){var a=g.scrollLeft-f.wheelStartX,b=g.scrollTop-f.wheelStartY,c=b&&f.wheelDY&&b/f.wheelDY||a&&f.wheelDX&&a/f.wheelDX;f.wheelStartX=f.wheelStartY=null,c&&(jd=(jd*id+c)/(id+1),++id)}},200)):(f.wheelDX+=d,f.wheelDY+=e))}}function ld(a,b,c){if("string"==typeof b&&(b=je[b],!b))return!1;a.display.pollingFast&&Pc(a)&&(a.display.pollingFast=!1);var d=a.display.shift,e=!1;try{Tc(a)&&(a.state.suppressEdits=!0),c&&(a.display.shift=!1),e=b(a)!=rg}finally{a.display.shift=d,a.state.suppressEdits=!1}return e}function md(a){var b=a.state.keyMaps.slice(0);return a.options.extraKeys&&b.push(a.options.extraKeys),b.push(a.options.keyMap),b}function od(a,b){var c=le(a.options.keyMap),d=c.auto;clearTimeout(nd),d&&!ne(b)&&(nd=setTimeout(function(){le(a.options.keyMap)==c&&(a.options.keyMap=d.call?d.call(null,a):d,G(a))},50));var e=oe(b,!0),f=!1;if(!e)return!1;var g=md(a);return f=b.shiftKey?me("Shift-"+e,g,function(b){return ld(a,b,!0)})||me(e,g,function(b){return("string"==typeof b?/^go[A-Z]/.test(b):b.motion)?ld(a,b):void 0}):me(e,g,function(b){return ld(a,b)}),f&&(_f(b),Sb(a),kg(a,"keyHandled",a,e,b)),f}function pd(a,b,c){var d=me("'"+c+"'",md(a),function(b){return ld(a,b,!0)});return d&&(_f(b),Sb(a),kg(a,"keyHandled",a,"'"+c+"'",b)),d}function rd(a){var c=this;if(Sc(c),!mg(c,a)){b&&27==a.keyCode&&(a.returnValue=!1);var d=a.keyCode;c.display.shift=16==d||a.shiftKey;var e=od(c,a);k&&(qd=e?d:null,!e&&88==d&&!dh&&(s?a.metaKey:a.ctrlKey)&&c.replaceSelection("",null,"cut")),18!=d||/\bCodeMirror-crosshair\b/.test(c.display.lineDiv.className)||sd(c)}}function sd(a){function c(a){18!=a.keyCode&&a.altKey||(Tg(b,"CodeMirror-crosshair"),gg(document,"keyup",c),gg(document,"mouseover",c))}var b=a.display.lineDiv;Ug(b,"CodeMirror-crosshair"),fg(document,"keyup",c),fg(document,"mouseover",c)}function td(a){mg(this,a)||16==a.keyCode&&(this.doc.sel.shift=!1)}function ud(a){var b=this;if(!mg(b,a)){var c=a.keyCode,e=a.charCode;if(k&&c==qd)return qd=null,_f(a),void 0;if(!(k&&(!a.which||a.which<10)||m)||!od(b,a)){var f=String.fromCharCode(null==e?c:e);pd(b,a,f)||(g&&!d&&(b.display.inputHasSelection=null),Oc(b))}}}function vd(a){"nocursor"!=a.options.readOnly&&(a.state.focused||(hg(a,"focus",a),a.state.focused=!0,Ug(a.display.wrapper,"CodeMirror-focused"),a.curOp||"\u200b"==a.display.prevInput||(Qc(a),h&&setTimeout(Gg(Qc,a,!0),0))),Nc(a),Sb(a))}function wd(a){a.state.focused&&(hg(a,"blur",a),a.state.focused=!1,Tg(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.display.shift=!1)},150)}function yd(a,b){function j(){if(null!=c.input.selectionStart){var b=c.input.value="\u200b"+(a.somethingSelected()?c.input.value:"");c.prevInput="\u200b",c.input.selectionStart=1,c.input.selectionEnd=b.length}}function l(){if(c.inputDiv.style.position="relative",c.input.style.cssText=i,d&&(c.scrollbarV.scrollTop=c.scroller.scrollTop=f),Nc(a),null!=c.input.selectionStart){(!g||d)&&j(),clearTimeout(xd);var b=0,e=function(){"\u200b"==c.prevInput&&0==c.input.selectionStart?Bc(a,je.selectAll)(a):b++<10?xd=setTimeout(e,500):Qc(a)};xd=setTimeout(e,200)}}if(!mg(a,b,"contextmenu")){var c=a.display;if(!Vc(c,b)&&!zd(a,b)){var e=Wc(a,b),f=c.scroller.scrollTop;if(e&&!k){var h=a.options.resetSelectionOnContextMenu;h&&-1==a.doc.sel.contains(e)&&Bc(a,Jb)(a.doc,wb(e),sg);var i=c.input.style.cssText;if(c.inputDiv.style.position="absolute",c.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(b.clientY-5)+"px; left: "+(b.clientX-5)+"px; z-index: 1000; background: "+(g?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",Rc(a),Qc(a),a.somethingSelected()||(c.input.value=c.prevInput=" "),g&&!d&&j(),w){cg(b);var m=function(){gg(window,"mouseup",m),setTimeout(l,20)};fg(window,"mouseup",m)}else setTimeout(l,50)}}}}function zd(a,b){return og(a,"gutterContextMenu")?bd(a,b,"gutterContextMenu",!1,hg):!1}function Bd(a,b){if(pb(a,b.from)<0)return a;if(pb(a,b.to)<=0)return Ad(b);var c=a.line+b.text.length-(b.to.line-b.from.line)-1,d=a.ch;return a.line==b.to.line&&(d+=Ad(b).ch-b.to.ch),ob(c,d)}function Cd(a,b){for(var c=[],d=0;d<a.sel.ranges.length;d++){var e=a.sel.ranges[d];c.push(new ub(Bd(e.anchor,b),Bd(e.head,b)))}return vb(c,a.sel.primIndex)}function Dd(a,b,c){return a.line==b.line?ob(c.line,a.ch-b.ch+c.ch):ob(c.line+(a.line-b.line),a.ch)}function Ed(a,b,c){for(var d=[],e=ob(a.first,0),f=e,g=0;g<b.length;g++){var h=b[g],i=Dd(h.from,e,f),j=Dd(Ad(h),e,f);if(e=h.to,f=j,"around"==c){var k=a.sel.ranges[g],l=pb(k.head,k.anchor)<0;d[g]=new ub(l?j:i,l?i:j)}else d[g]=new ub(i,i)}return new tb(d,a.sel.primIndex)}function Fd(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=yb(a,b)),c&&(this.to=yb(a,c)),d&&(this.text=d),void 0!==e&&(this.origin=e)}),hg(a,"beforeChange",a,d),a.cm&&hg(a.cm,"beforeChange",a.cm,d),d.canceled?null:{from:d.from,to:d.to,text:d.text,origin:d.origin}}function Gd(a,b,c){if(a.cm){if(!a.cm.curOp)return Bc(a.cm,Gd)(a,b,c);if(a.cm.state.suppressEdits)return}if(!(og(a,"beforeChange")||a.cm&&og(a.cm,"beforeChange"))||(b=Fd(a,b,!0))){var d=x&&!c&&He(a,b.from,b.to);if(d)for(var e=d.length-1;e>=0;--e)Hd(a,{from:d[e].from,to:d[e].to,text:e?[""]:b.text});else Hd(a,b)}}function Hd(a,b){if(1!=b.text.length||""!=b.text[0]||0!=pb(b.from,b.to)){var c=Cd(a,b);Qf(a,b,c,a.cm?a.cm.curOp.id:0/0),Kd(a,b,c,Ee(a,b));var d=[];Cf(a,function(a,c){c||-1!=Cg(d,a.history)||($f(a.history,b),d.push(a.history)),Kd(a,b,null,Ee(a,b))})}}function Id(a,b,c){if(!a.cm||!a.cm.state.suppressEdits){for(var e,d=a.history,f=a.sel,g="undo"==b?d.done:d.undone,h="undo"==b?d.undone:d.done,i=0;i<g.length&&(e=g[i],c?!e.ranges||e.equals(a.sel):e.ranges);i++);if(i!=g.length){for(d.lastOrigin=d.lastSelOrigin=null;e=g.pop(),e.ranges;){if(Tf(e,h),c&&!e.equals(a.sel))return Jb(a,e,{clearRedo:!1}),void 0;f=e}var j=[];Tf(f,h),h.push({changes:j,generation:d.generation}),d.generation=e.generation||++d.maxGeneration;for(var k=og(a,"beforeChange")||a.cm&&og(a.cm,"beforeChange"),i=e.changes.length-1;i>=0;--i){var l=e.changes[i];if(l.origin=b,k&&!Fd(a,l,!1))return g.length=0,void 0;j.push(Nf(a,l));var m=i?Cd(a,l,null):Ag(g);Kd(a,l,m,Ge(a,l)),a.cm&&Sd(a.cm);var n=[];Cf(a,function(a,b){b||-1!=Cg(n,a.history)||($f(a.history,l),n.push(a.history)),Kd(a,l,null,Ge(a,l))})}}}}function Jd(a,b){a.first+=b,a.sel=new tb(Dg(a.sel.ranges,function(a){return new ub(ob(a.anchor.line+b,a.anchor.ch),ob(a.head.line+b,a.head.ch))}),a.sel.primIndex),a.cm&&Gc(a.cm,a.first,a.first-b,b)}function Kd(a,b,c,d){if(a.cm&&!a.cm.curOp)return Bc(a.cm,Kd)(a,b,c,d);if(b.to.line<a.first)return Jd(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);Jd(a,e),b={from:ob(a.first,0),to:ob(b.to.line+e,b.to.ch),text:[Ag(b.text)],origin:b.origin}}var f=a.lastLine();b.to.line>f&&(b={from:b.from,to:ob(f,Ef(a,f).text.length),text:[b.text[0]],origin:b.origin}),b.removed=Ff(a,b.from,b.to),c||(c=Cd(a,b,null)),a.cm?Ld(a.cm,b,d):vf(a,b,d),Kb(a,c,sg)}}function Ld(a,b,c){var d=a.doc,e=a.display,f=b.from,g=b.to,h=!1,i=f.line;a.options.lineWrapping||(i=If(Re(Ef(d,f.line))),d.iter(i,g.line+1,function(a){return a==e.maxLine?(h=!0,!0):void 0})),d.sel.contains(b.from,b.to)>-1&&ng(a),vf(d,b,c,E(a)),a.options.lineWrapping||(d.iter(i,f.line+b.text.length,function(a){var b=L(a);b>e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,h=!1)}),h&&(a.curOp.updateMaxLine=!0)),d.frontier=Math.min(d.frontier,f.line),Tb(a,400);var j=b.text.length-(g.line-f.line)-1;f.line!=g.line||1!=b.text.length||uf(a.doc,b)?Gc(a,f.line,g.line+1,j):Hc(a,f.line,"text");var k=og(a,"changes"),l=og(a,"change");if(l||k){var m={from:f,to:g,text:b.text,removed:b.removed,origin:b.origin};l&&kg(a,"change",a,m),k&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(m)}}function Md(a,b,c,d,e){if(d||(d=c),pb(d,c)<0){var f=d;d=c,c=f}"string"==typeof b&&(b=bh(b)),Gd(a,{from:c,to:d,text:b,origin:e})}function Nd(a,b){var c=a.display,d=c.sizer.getBoundingClientRect(),e=null;if(b.top+d.top<0?e=!0:b.bottom+d.top>(window.innerHeight||document.documentElement.clientHeight)&&(e=!1),null!=e&&!p){var f=Mg("div","\u200b",null,"position: absolute; top: "+(b.top-c.viewOffset-Xb(a.display))+"px; height: "+(b.bottom-b.top+qg)+"px; left: "+b.left+"px; width: 2px;");a.display.lineSpace.appendChild(f),f.scrollIntoView(e),a.display.lineSpace.removeChild(f)}}function Od(a,b,c,d){for(null==d&&(d=0);;){var e=!1,f=pc(a,b),g=c&&c!=b?pc(a,c):f,h=Qd(a,Math.min(f.left,g.left),Math.min(f.top,g.top)-d,Math.max(f.left,g.left),Math.max(f.bottom,g.bottom)+d),i=a.doc.scrollTop,j=a.doc.scrollLeft;if(null!=h.scrollTop&&(gd(a,h.scrollTop),Math.abs(a.doc.scrollTop-i)>1&&(e=!0)),null!=h.scrollLeft&&(hd(a,h.scrollLeft),Math.abs(a.doc.scrollLeft-j)>1&&(e=!0)),!e)return f}}function Pd(a,b,c,d,e){var f=Qd(a,b,c,d,e);null!=f.scrollTop&&gd(a,f.scrollTop),null!=f.scrollLeft&&hd(a,f.scrollLeft)}function Qd(a,b,c,d,e){var f=a.display,g=vc(a.display);0>c&&(c=0);var h=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:f.scroller.scrollTop,i=f.scroller.clientHeight-qg,j={},k=a.doc.height+Yb(f),l=g>c,m=e>k-g;if(h>c)j.scrollTop=l?0:c;else if(e>h+i){var n=Math.min(c,(m?k:e)-i);n!=h&&(j.scrollTop=n)}var o=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:f.scroller.scrollLeft,p=f.scroller.clientWidth-qg;b+=f.gutters.offsetWidth,d+=f.gutters.offsetWidth;var q=f.gutters.offsetWidth,r=q+10>b;return o+q>b||r?(r&&(b=0),j.scrollLeft=Math.max(0,b-10-q)):d>p+o-3&&(j.scrollLeft=d+10-p),j}function Rd(a,b,c){(null!=b||null!=c)&&Td(a),null!=b&&(a.curOp.scrollLeft=(null==a.curOp.scrollLeft?a.doc.scrollLeft:a.curOp.scrollLeft)+b),null!=c&&(a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+c)}function Sd(a){Td(a);var b=a.getCursor(),c=b,d=b;a.options.lineWrapping||(c=b.ch?ob(b.line,b.ch-1):b,d=ob(b.line,b.ch+1)),a.curOp.scrollToPos={from:c,to:d,margin:a.options.cursorScrollMargin,isCursor:!0}}function Td(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=qc(a,b.from),d=qc(a,b.to),e=Qd(a,Math.min(c.left,d.left),Math.min(c.top,d.top)-b.margin,Math.max(c.right,d.right),Math.max(c.bottom,d.bottom)+b.margin);a.scrollTo(e.scrollLeft,e.scrollTop)}}function Ud(a,b,c,d){var f,e=a.doc;null==c&&(c="add"),"smart"==c&&(a.doc.mode.indent?f=Wb(a,b):c="prev");var g=a.options.tabSize,h=Ef(e,b),i=wg(h.text,null,g);h.stateAfter&&(h.stateAfter=null);var k,j=h.text.match(/^\s*/)[0];if(d||/\S/.test(h.text)){if("smart"==c&&(k=a.doc.mode.indent(f,h.text.slice(j.length),h.text),k==rg)){if(!d)return;c="prev"}}else k=0,c="not";"prev"==c?k=b>e.first?wg(Ef(e,b-1).text,null,g):0:"add"==c?k=i+a.options.indentUnit:"subtract"==c?k=i-a.options.indentUnit:"number"==typeof c&&(k=i+c),k=Math.max(0,k);var l="",m=0;if(a.options.indentWithTabs)for(var n=Math.floor(k/g);n;--n)m+=g,l+=" ";if(k>m&&(l+=zg(k-m)),l!=j)Md(a.doc,l,ob(b,0),ob(b,j.length),"+input");else for(var n=0;n<e.sel.ranges.length;n++){var o=e.sel.ranges[n];if(o.head.line==b&&o.head.ch<j.length){var m=ob(b,j.length);Fb(e,n,new ub(m,m));break}}h.stateAfter=null}function Vd(a,b,c,d){var e=b,f=b,g=a.doc;return"number"==typeof b?f=Ef(g,xb(g,b)):e=If(b),null==e?null:(d(f,e)&&Hc(a,e,c),f)}function Wd(a,b){for(var c=a.doc.sel.ranges,d=[],e=0;e<c.length;e++){for(var f=b(c[e]);d.length&&pb(f.from,Ag(d).to)<=0;){var g=d.pop();if(pb(g.from,f.from)<0){f.from=g.from;break}}d.push(f)}Ac(a,function(){for(var b=d.length-1;b>=0;b--)Md(a.doc,"",d[b].from,d[b].to,"+delete");Sd(a)})}function Xd(a,b,c,d,e){function k(){var b=f+c;return b<a.first||b>=a.first+a.size?j=!1:(f=b,i=Ef(a,b))}function l(a){var b=(e?qh:rh)(i,g,c,!0);if(null==b){if(a||!k())return j=!1;g=e?(0>c?jh:ih)(i):0>c?i.text.length:0}else g=b;return!0}var f=b.line,g=b.ch,h=c,i=Ef(a,f),j=!0;if("char"==d)l();else if("column"==d)l(!0);else if("word"==d||"group"==d)for(var m=null,n="group"==d,o=!0;!(0>c)||l(!o);o=!1){var p=i.text.charAt(g)||"\n",q=Ig(p)?"w":n&&"\n"==p?"n":!n||/\s/.test(p)?null:"p";if(!n||o||q||(q="s"),m&&m!=q){0>c&&(c=1,l());break}if(q&&(m=q),c>0&&!l(!o))break}var r=Ob(a,ob(f,g),h,!0);return j||(r.hitSide=!0),r}function Yd(a,b,c,d){var g,e=a.doc,f=b.left;if("page"==d){var h=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);g=b.top+c*(h-(0>c?1.5:.5)*vc(a.display))}else"line"==d&&(g=c>0?b.bottom+3:b.top-3);for(;;){var i=sc(a,f,g);if(!i.outside)break;if(0>c?0>=g:g>=e.height){i.hitSide=!0;break}g+=5*c}return i}function Zd(a,b){var c=Ef(a,b.line).text,d=b.ch,e=b.ch;if(c){(b.xRel<0||e==c.length)&&d?--d:++e;for(var f=c.charAt(d),g=Ig(f)?Ig:/\s/.test(f)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!Ig(a)};d>0&&g(c.charAt(d-1));)--d;for(;e<c.length&&g(c.charAt(e));)++e}return new ub(ob(b.line,d),ob(b.line,e))}function ae(a,b,c,d){z.defaults[a]=b,c&&(_d[a]=d?function(a,b,d){d!=be&&c(a,b,d)}:c)}function le(a){return"string"==typeof a?ke[a]:a}function se(a,b,c,d,e){if(d&&d.shared)return ue(a,b,c,d,e);if(a.cm&&!a.cm.curOp)return Bc(a.cm,se)(a,b,c,d,e);var f=new qe(a,e),g=pb(b,c);if(d&&Fg(d,f,!1),g>0||0==g&&f.clearWhenEmpty!==!1)return f;if(f.replacedWith&&(f.collapsed=!0,f.widgetNode=Mg("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||(f.widgetNode.ignoreEvents=!0),d.insertLeft&&(f.widgetNode.insertLeft=!0)),f.collapsed){if(Qe(a,b.line,b,c,f)||b.line!=c.line&&Qe(a,c.line,b,c,f))throw new Error("Inserting collapsed marker partially overlapping an existing one");y=!0}f.addToHistory&&Qf(a,{from:b,to:c,origin:"markText"},a.sel,0/0);var j,h=b.line,i=a.cm;if(a.iter(h,c.line+1,function(a){i&&f.collapsed&&!i.options.lineWrapping&&Re(a)==i.display.maxLine&&(j=!0),f.collapsed&&h!=b.line&&Hf(a,0),Be(a,new ye(f,h==b.line?b.ch:null,h==c.line?c.ch:null)),++h}),f.collapsed&&a.iter(b.line,c.line+1,function(b){Ve(a,b)&&Hf(b,0)}),f.clearOnEnter&&fg(f,"beforeCursorEnter",function(){f.clear()}),f.readOnly&&(x=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory()),f.collapsed&&(f.id=++re,f.atomic=!0),i){if(j&&(i.curOp.updateMaxLine=!0),f.collapsed)Gc(i,b.line,c.line+1);else if(f.className||f.title||f.startStyle||f.endStyle)for(var k=b.line;k<=c.line;k++)Hc(i,k,"text");f.atomic&&Mb(i.doc),kg(i,"markerAdded",i,f)}return f}function ue(a,b,c,d,e){d=Fg(d),d.shared=!1;var f=[se(a,b,c,d,e)],g=f[0],h=d.widgetNode;return Cf(a,function(a){h&&(d.widgetNode=h.cloneNode(!0)),f.push(se(a,yb(a,b),yb(a,c),d,e));for(var i=0;i<a.linked.length;++i)if(a.linked[i].isParent)return;g=Ag(f)}),new te(f,g)}function ve(a){return a.findMarks(ob(a.first,0),a.clipPos(ob(a.lastLine())),function(a){return a.parent})}function we(a,b){for(var c=0;c<b.length;c++){var d=b[c],e=d.find(),f=a.clipPos(e.from),g=a.clipPos(e.to);if(pb(f,g)){var h=se(a,f,g,d.primary,d.primary.type);d.markers.push(h),h.parent=d}}}function xe(a){for(var b=0;b<a.length;b++){var c=a[b],d=[c.primary.doc];Cf(c.primary.doc,function(a){d.push(a)});for(var e=0;e<c.markers.length;e++){var f=c.markers[e];-1==Cg(d,f.doc)&&(f.parent=null,c.markers.splice(e--,1))}}}function ye(a,b,c){this.marker=a,this.from=b,this.to=c}function ze(a,b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function Ae(a,b){for(var c,d=0;d<a.length;++d)a[d]!=b&&(c||(c=[])).push(a[d]);return c}function Be(a,b){a.markedSpans=a.markedSpans?a.markedSpans.concat([b]):[b],b.marker.attachLine(a)}function Ce(a,b,c){if(a)for(var e,d=0;d<a.length;++d){var f=a[d],g=f.marker,h=null==f.from||(g.inclusiveLeft?f.from<=b:f.from<b);if(h||f.from==b&&"bookmark"==g.type&&(!c||!f.marker.insertLeft)){var i=null==f.to||(g.inclusiveRight?f.to>=b:f.to>b);(e||(e=[])).push(new ye(g,f.from,i?null:f.to))}}return e}function De(a,b,c){if(a)for(var e,d=0;d<a.length;++d){var f=a[d],g=f.marker,h=null==f.to||(g.inclusiveRight?f.to>=b:f.to>b);if(h||f.from==b&&"bookmark"==g.type&&(!c||f.marker.insertLeft)){var i=null==f.from||(g.inclusiveLeft?f.from<=b:f.from<b);(e||(e=[])).push(new ye(g,i?null:f.from-b,null==f.to?null:f.to-b))}}return e}function Ee(a,b){var c=Ab(a,b.from.line)&&Ef(a,b.from.line).markedSpans,d=Ab(a,b.to.line)&&Ef(a,b.to.line).markedSpans;if(!c&&!d)return null;var e=b.from.ch,f=b.to.ch,g=0==pb(b.from,b.to),h=Ce(c,e,g),i=De(d,f,g),j=1==b.text.length,k=Ag(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=ze(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=ze(h,m.marker);n||(m.from=k,j&&(h||(h=[])).push(m))}else m.from+=k,j&&(h||(h=[])).push(m)}h&&(h=Fe(h)),i&&i!=h&&(i=Fe(i));var o=[h];if(!j){var q,p=b.text.length-2;if(p>0&&h)for(var l=0;l<h.length;++l)null==h[l].to&&(q||(q=[])).push(new ye(h[l].marker,null,null));for(var l=0;p>l;++l)o.push(q);o.push(i)}return o}function Fe(a){for(var b=0;b<a.length;++b){var c=a[b];null!=c.from&&c.from==c.to&&c.marker.clearWhenEmpty!==!1&&a.splice(b--,1)}return a.length?a:null}function Ge(a,b){var c=Wf(a,b),d=Ee(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 He(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!=Cg(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(0),i=0;i<e.length;++i){var j=e[i];
3
- if(!(pb(j.to,h.from)<0||pb(j.from,h.to)>0)){var k=[i,1],l=pb(j.from,h.from),m=pb(j.to,h.to);(0>l||!g.inclusiveLeft&&!l)&&k.push({from:j.from,to:h.from}),(m>0||!g.inclusiveRight&&!m)&&k.push({from:h.to,to:j.to}),e.splice.apply(e,k),i+=k.length-1}}return e}function Ie(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function Je(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function Ke(a){return a.inclusiveLeft?-1:0}function Le(a){return a.inclusiveRight?1:0}function Me(a,b){var c=a.lines.length-b.lines.length;if(0!=c)return c;var d=a.find(),e=b.find(),f=pb(d.from,e.from)||Ke(a)-Ke(b);if(f)return-f;var g=pb(d.to,e.to)||Le(a)-Le(b);return g?g:b.id-a.id}function Ne(a,b){var d,c=y&&a.markedSpans;if(c)for(var e,f=0;f<c.length;++f)e=c[f],e.marker.collapsed&&null==(b?e.from:e.to)&&(!d||Me(d,e.marker)<0)&&(d=e.marker);return d}function Oe(a){return Ne(a,!0)}function Pe(a){return Ne(a,!1)}function Qe(a,b,c,d,e){var f=Ef(a,b),g=y&&f.markedSpans;if(g)for(var h=0;h<g.length;++h){var i=g[h];if(i.marker.collapsed){var j=i.marker.find(0),k=pb(j.from,c)||Ke(i.marker)-Ke(e),l=pb(j.to,d)||Le(i.marker)-Le(e);if(!(k>=0&&0>=l||0>=k&&l>=0)&&(0>=k&&(pb(j.to,c)||Le(i.marker)-Ke(e))>0||k>=0&&(pb(j.from,d)||Ke(i.marker)-Le(e))<0))return!0}}}function Re(a){for(var b;b=Oe(a);)a=b.find(-1,!0).line;return a}function Se(a){for(var b,c;b=Pe(a);)a=b.find(1,!0).line,(c||(c=[])).push(a);return c}function Te(a,b){var c=Ef(a,b),d=Re(c);return c==d?b:If(d)}function Ue(a,b){if(b>a.lastLine())return b;var d,c=Ef(a,b);if(!Ve(a,c))return b;for(;d=Pe(c);)c=d.find(1,!0).line;return If(c)+1}function Ve(a,b){var c=y&&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.widgetNode&&0==d.from&&d.marker.inclusiveLeft&&We(a,b,d))return!0}}function We(a,b,c){if(null==c.to){var d=c.marker.find(1,!0);return We(a,d.line,ze(d.line.markedSpans,c.marker))}if(c.marker.inclusiveRight&&c.to==b.text.length)return!0;for(var e,f=0;f<b.markedSpans.length;++f)if(e=b.markedSpans[f],e.marker.collapsed&&!e.marker.widgetNode&&e.from==c.to&&(null==e.to||e.to!=c.from)&&(e.marker.inclusiveLeft||c.marker.inclusiveRight)&&We(a,b,e))return!0}function Ye(a,b,c){Kf(b)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop)&&Rd(a,null,c)}function Ze(a){return null!=a.height?a.height:(Qg(document.body,a.node)||Pg(a.cm.display.measure,Mg("div",[a.node],null,"position: relative")),a.height=a.node.offsetHeight)}function $e(a,b,c,d){var e=new Xe(a,c,d);return e.noHScroll&&(a.display.alignWidgets=!0),Vd(a,b,"widget",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,!Ve(a.doc,b)){var d=Kf(b)<a.doc.scrollTop;Hf(b,b.height+Ze(e)),d&&Rd(a,null,e.height),a.curOp.forceUpdate=!0}return!0}),e}function af(a,b,c,d){a.text=b,a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null),null!=a.order&&(a.order=null),Ie(a),Je(a,c);var e=d?d(a):1;e!=a.height&&Hf(a,e)}function bf(a){a.parent=null,Ie(a)}function cf(a,b){if(a)for(;;){var c=a.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!c)break;a=a.slice(0,c.index)+a.slice(c.index+c[0].length);var d=c[1]?"bgClass":"textClass";null==b[d]?b[d]=c[2]:new RegExp("(?:^|s)"+c[2]+"(?:$|s)").test(b[d])||(b[d]+=" "+c[2])}return a}function df(a,b){if(a.blankLine)return a.blankLine(b);if(a.innerMode){var c=z.innerMode(a,b);return c.mode.blankLine?c.mode.blankLine(c.state):void 0}}function ef(a,b,c){var d=a.token(b,c);if(b.pos<=b.start)throw new Error("Mode "+a.name+" failed to advance stream.");return d}function ff(a,b,c,d,e,f,g){var h=c.flattenSpans;null==h&&(h=a.options.flattenSpans);var l,i=0,j=null,k=new pe(b,a.options.tabSize);for(""==b&&cf(df(c,d),f);!k.eol();){if(k.pos>a.options.maxHighlightLength?(h=!1,g&&jf(a,b,d,k.pos),k.pos=b.length,l=null):l=cf(ef(c,k,d),f),a.options.addModeClass){var m=z.innerMode(c,d).mode.name;m&&(l="m-"+(l?m+" "+l:m))}h&&j==l||(i<k.start&&e(k.start,j),i=k.start,j=l),k.start=k.pos}for(;i<k.pos;){var n=Math.min(k.pos,i+5e4);e(n,j),i=n}}function gf(a,b,c,d){var e=[a.state.modeGen],f={};ff(a,b.text,a.doc.mode,c,function(a,b){e.push(a,b)},f,d);for(var g=0;g<a.state.overlays.length;++g){var h=a.state.overlays[g],i=1,j=0;ff(a,b.text,h.mode,!0,function(a,b){for(var c=i;a>j;){var d=e[i];d>a&&e.splice(i,1,a,e[i+1],d),i+=2,j=Math.min(a,d)}if(b)if(h.opaque)e.splice(c,i-c,a,"cm-overlay "+b),i=c+2;else for(;i>c;c+=2){var f=e[c+1];e[c+1]=(f?f+" ":"")+"cm-overlay "+b}},f)}return{styles:e,classes:f.bgClass||f.textClass?f:null}}function hf(a,b){if(!b.styles||b.styles[0]!=a.state.modeGen){var c=gf(a,b,b.stateAfter=Wb(a,If(b)));b.styles=c.styles,c.classes?b.styleClasses=c.classes:b.styleClasses&&(b.styleClasses=null)}return b.styles}function jf(a,b,c,d){var e=a.doc.mode,f=new pe(b,a.options.tabSize);for(f.start=f.pos=d||0,""==b&&df(e,c);!f.eol()&&f.pos<=a.options.maxHighlightLength;)ef(e,f,c),f.start=f.pos}function mf(a,b){if(!a||/^\s*$/.test(a))return null;var c=b.addModeClass?lf:kf;return c[a]||(c[a]=a.replace(/\S+/g,"cm-$&"))}function nf(a,b){var c=Mg("span",null,null,h?"padding-right: .1px":null),d={pre:Mg("pre",[c]),content:c,col:0,pos:0,cm:a};b.measure={};for(var e=0;e<=(b.rest?b.rest.length:0);e++){var i,f=e?b.rest[e-1]:b.line;d.pos=0,d.addToken=pf,(g||h)&&a.getOption("lineWrapping")&&(d.addToken=qf(d.addToken)),ah(a.display.measure)&&(i=Lf(f))&&(d.addToken=rf(d.addToken,i)),d.map=[],tf(f,d,hf(a,f)),f.styleClasses&&(f.styleClasses.bgClass&&(d.bgClass=Vg(f.styleClasses.bgClass,d.bgClass||"")),f.styleClasses.textClass&&(d.textClass=Vg(f.styleClasses.textClass,d.textClass||""))),0==d.map.length&&d.map.push(0,0,d.content.appendChild($g(a.display.measure))),0==e?(b.measure.map=d.map,b.measure.cache={}):((b.measure.maps||(b.measure.maps=[])).push(d.map),(b.measure.caches||(b.measure.caches=[])).push({}))}return hg(a,"renderLine",a,b.line,d.pre),d}function of(a){var b=Mg("span","\u2022","cm-invalidchar");return b.title="\\u"+a.charCodeAt(0).toString(16),b}function pf(a,b,c,e,f,g){if(b){var h=a.cm.options.specialChars,i=!1;if(h.test(b))for(var j=document.createDocumentFragment(),k=0;;){h.lastIndex=k;var l=h.exec(b),m=l?l.index-k:b.length-k;if(m){var n=document.createTextNode(b.slice(k,k+m));d?j.appendChild(Mg("span",[n])):j.appendChild(n),a.map.push(a.pos,a.pos+m,n),a.col+=m,a.pos+=m}if(!l)break;if(k+=m+1," "==l[0]){var o=a.cm.options.tabSize,p=o-a.col%o,n=j.appendChild(Mg("span",zg(p),"cm-tab"));a.col+=p}else{var n=a.cm.options.specialCharPlaceholder(l[0]);d?j.appendChild(Mg("span",[n])):j.appendChild(n),a.col+=1}a.map.push(a.pos,a.pos+1,n),a.pos++}else{a.col+=b.length;var j=document.createTextNode(b);a.map.push(a.pos,a.pos+b.length,j),d&&(i=!0),a.pos+=b.length}if(c||e||f||i){var q=c||"";e&&(q+=e),f&&(q+=f);var r=Mg("span",[j],q);return g&&(r.title=g),a.content.appendChild(r)}a.content.appendChild(j)}}function qf(a){function b(a){for(var b=" ",c=0;c<a.length-2;++c)b+=c%2?" ":"\xa0";return b+=" "}return function(c,d,e,f,g,h){a(c,d.replace(/ {3,}/g,b),e,f,g,h)}}function rf(a,b){return function(c,d,e,f,g,h){e=e?e+" cm-force-border":"cm-force-border";for(var i=c.pos,j=i+d.length;;){for(var k=0;k<b.length;k++){var l=b[k];if(l.to>i&&l.from<=i)break}if(l.to>=j)return a(c,d,e,f,g,h);a(c,d.slice(0,l.to-i),e,f,null,h),f=null,d=d.slice(l.to-i),i=l.to}}}function sf(a,b,c,d){var e=!d&&c.widgetNode;e&&(a.map.push(a.pos,a.pos+b,e),a.content.appendChild(e)),a.pos+=b}function tf(a,b,c){var d=a.markedSpans,e=a.text,f=0;if(d)for(var k,m,n,o,p,q,h=e.length,i=0,g=1,j="",l=0;;){if(l==i){m=n=o=p="",q=null,l=1/0;for(var r=[],s=0;s<d.length;++s){var t=d[s],u=t.marker;t.from<=i&&(null==t.to||t.to>i)?(null!=t.to&&l>t.to&&(l=t.to,n=""),u.className&&(m+=" "+u.className),u.startStyle&&t.from==i&&(o+=" "+u.startStyle),u.endStyle&&t.to==l&&(n+=" "+u.endStyle),u.title&&!p&&(p=u.title),u.collapsed&&(!q||Me(q.marker,u)<0)&&(q=t)):t.from>i&&l>t.from&&(l=t.from),"bookmark"==u.type&&t.from==i&&u.widgetNode&&r.push(u)}if(q&&(q.from||0)==i&&(sf(b,(null==q.to?h+1:q.to)-i,q.marker,null==q.from),null==q.to))return;if(!q&&r.length)for(var s=0;s<r.length;++s)sf(b,0,r[s])}if(i>=h)break;for(var v=Math.min(h,l);;){if(j){var w=i+j.length;if(!q){var x=w>v?j.slice(0,v-i):j;b.addToken(b,x,k?k+m:m,o,i+x.length==l?n:"",p)}if(w>=v){j=j.slice(v-i),i=v;break}i=w,o=""}j=e.slice(f,f=c[g++]),k=mf(c[g++],b.cm.options)}}else for(var g=1;g<c.length;g+=2)b.addToken(b,e.slice(f,f=c[g]),mf(c[g+1],b.cm.options))}function uf(a,b){return 0==b.from.ch&&0==b.to.ch&&""==Ag(b.text)&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}function vf(a,b,c,d){function e(a){return c?c[a]:null}function f(a,c,e){af(a,c,e,d),kg(a,"change",a,b)}var g=b.from,h=b.to,i=b.text,j=Ef(a,g.line),k=Ef(a,h.line),l=Ag(i),m=e(i.length-1),n=h.line-g.line;if(uf(a,b)){for(var o=0,p=[];o<i.length-1;++o)p.push(new _e(i[o],e(o),d));f(k,k.text,m),n&&a.remove(g.line,n),p.length&&a.insert(g.line,p)}else if(j==k)if(1==i.length)f(j,j.text.slice(0,g.ch)+l+j.text.slice(h.ch),m);else{for(var p=[],o=1;o<i.length-1;++o)p.push(new _e(i[o],e(o),d));p.push(new _e(l+j.text.slice(h.ch),m,d)),f(j,j.text.slice(0,g.ch)+i[0],e(0)),a.insert(g.line+1,p)}else if(1==i.length)f(j,j.text.slice(0,g.ch)+i[0]+k.text.slice(h.ch),e(0)),a.remove(g.line+1,n);else{f(j,j.text.slice(0,g.ch)+i[0],e(0)),f(k,l+k.text.slice(h.ch),m);for(var o=1,p=[];o<i.length-1;++o)p.push(new _e(i[o],e(o),d));n>1&&a.remove(g.line+1,n-1),a.insert(g.line+1,p)}kg(a,"change",a,b)}function wf(a){this.lines=a,this.parent=null;for(var b=0,c=0;b<a.length;++b)a[b].parent=this,c+=a[b].height;this.height=c}function xf(a){this.children=a;for(var b=0,c=0,d=0;d<a.length;++d){var e=a[d];b+=e.chunkSize(),c+=e.height,e.parent=this}this.size=b,this.height=c,this.parent=null}function Cf(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 Df(a,b){if(b.cm)throw new Error("This document is already in use.");a.doc=b,b.cm=a,F(a),B(a),a.options.lineWrapping||M(a),a.options.mode=b.modeOption,Gc(a)}function Ef(a,b){if(b-=a.first,0>b||b>=a.size)throw new Error("There is no line "+(b+a.first)+" in the document.");for(var c=a;!c.lines;)for(var d=0;;++d){var e=c.children[d],f=e.chunkSize();if(f>b){c=e;break}b-=f}return c.lines[b]}function Ff(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 Gf(a,b,c){var d=[];return a.iter(b,c,function(a){d.push(a.text)}),d}function Hf(a,b){var c=b-a.height;if(c)for(var d=a;d;d=d.parent)d.height+=c}function If(a){if(null==a.parent)return null;for(var b=a.parent,c=Cg(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}function Jf(a,b){var c=a.first;a:do{for(var d=0;d<a.children.length;++d){var e=a.children[d],f=e.height;if(f>b){a=e;continue a}b-=f,c+=e.chunkSize()}return c}while(!a.lines);for(var d=0;d<a.lines.length;++d){var g=a.lines[d],h=g.height;if(h>b)break;b-=h}return c+d}function Kf(a){a=Re(a);for(var b=0,c=a.parent,d=0;d<c.lines.length;++d){var e=c.lines[d];if(e==a)break;b+=e.height}for(var f=c.parent;f;c=f,f=c.parent)for(var d=0;d<f.children.length;++d){var g=f.children[d];if(g==c)break;b+=g.height}return b}function Lf(a){var b=a.order;return null==b&&(b=a.order=sh(a.text)),b}function Mf(a){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=a||1}function Nf(a,b){var c={from:qb(b.from),to:Ad(b),text:Ff(a,b.from,b.to)};return Uf(a,c,b.from.line,b.to.line+1),Cf(a,function(a){Uf(a,c,b.from.line,b.to.line+1)},!0),c}function Of(a){for(;a.length;){var b=Ag(a);if(!b.ranges)break;a.pop()}}function Pf(a,b){return b?(Of(a.done),Ag(a.done)):a.done.length&&!Ag(a.done).ranges?Ag(a.done):a.done.length>1&&!a.done[a.done.length-2].ranges?(a.done.pop(),Ag(a.done)):void 0}function Qf(a,b,c,d){var e=a.history;e.undone.length=0;var g,f=+new Date;if((e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastModTime>f-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))&&(g=Pf(e,e.lastOp==d))){var h=Ag(g.changes);0==pb(b.from,b.to)&&0==pb(b.from,h.to)?h.to=Ad(b):g.changes.push(Nf(a,b))}else{var i=Ag(e.done);for(i&&i.ranges||Tf(a.sel,e.done),g={changes:[Nf(a,b)],generation:e.generation},e.done.push(g);e.done.length>e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift()}e.done.push(c),e.generation=++e.maxGeneration,e.lastModTime=e.lastSelTime=f,e.lastOp=d,e.lastOrigin=e.lastSelOrigin=b.origin,h||hg(a,"historyAdded")}function Rf(a,b,c,d){var e=b.charAt(0);return"*"==e||"+"==e&&c.ranges.length==d.ranges.length&&c.somethingSelected()==d.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}function Sf(a,b,c,d){var e=a.history,f=d&&d.origin;c==e.lastOp||f&&e.lastSelOrigin==f&&(e.lastModTime==e.lastSelTime&&e.lastOrigin==f||Rf(a,f,Ag(e.done),b))?e.done[e.done.length-1]=b:Tf(b,e.done),e.lastSelTime=+new Date,e.lastSelOrigin=f,e.lastOp=c,d&&d.clearRedo!==!1&&Of(e.undone)}function Tf(a,b){var c=Ag(b);c&&c.ranges&&c.equals(a)||b.push(a)}function Uf(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 Vf(a){if(!a)return null;for(var c,b=0;b<a.length;++b)a[b].marker.explicitlyCleared?c||(c=a.slice(0,b)):c&&c.push(a[b]);return c?c.length?c:null:a}function Wf(a,b){var c=b["spans_"+a.id];if(!c)return null;for(var d=0,e=[];d<b.text.length;++d)e.push(Vf(c[d]));return e}function Xf(a,b,c){for(var d=0,e=[];d<a.length;++d){var f=a[d];if(f.ranges)e.push(c?tb.prototype.deepCopy.call(f):f);else{var g=f.changes,h=[];e.push({changes:h});for(var i=0;i<g.length;++i){var k,j=g[i];if(h.push({from:j.from,to:j.to,text:j.text}),b)for(var l in j)(k=l.match(/^spans_(\d+)$/))&&Cg(b,Number(k[1]))>-1&&(Ag(h)[l]=j[l],delete j[l])}}}return e}function Yf(a,b,c,d){c<a.line?a.line+=d:b<a.line&&(a.line=b,a.ch=0)}function Zf(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e],g=!0;if(f.ranges){f.copied||(f=a[e]=f.deepCopy(),f.copied=!0);for(var h=0;h<f.ranges.length;h++)Yf(f.ranges[h].anchor,b,c,d),Yf(f.ranges[h].head,b,c,d)}else{for(var h=0;h<f.changes.length;++h){var i=f.changes[h];if(c<i.from.line)i.from=ob(i.from.line+d,i.from.ch),i.to=ob(i.to.line+d,i.to.ch);else if(b<=i.to.line){g=!1;break}}g||(a.splice(0,e+1),e=0)}}}function $f(a,b){var c=b.from.line,d=b.to.line,e=b.text.length-(d-c)-1;Zf(a.done,c,d,e),Zf(a.undone,c,d,e)}function bg(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function dg(a){return a.target||a.srcElement}function eg(a){var b=a.which;return null==b&&(1&a.button?b=1:2&a.button?b=3:4&a.button&&(b=2)),s&&a.ctrlKey&&1==b&&(b=3),b}function kg(a,b){function e(a){return function(){a.apply(null,d)}}var c=a._handlers&&a._handlers[b];if(c){var d=Array.prototype.slice.call(arguments,2);ig||(++jg,ig=[],setTimeout(lg,0));for(var f=0;f<c.length;++f)ig.push(e(c[f]))}}function lg(){--jg;var a=ig;ig=null;for(var b=0;b<a.length;++b)a[b]()}function mg(a,b,c){return hg(a,c||b.type,a,b),bg(b)||b.codemirrorIgnore}function ng(a){var b=a._handlers&&a._handlers.cursorActivity;if(b)for(var c=a.curOp.cursorActivityHandlers||(a.curOp.cursorActivityHandlers=[]),d=0;d<b.length;++d)-1==Cg(c,b[d])&&c.push(b[d])}function og(a,b){var c=a._handlers&&a._handlers[b];return c&&c.length>0}function pg(a){a.prototype.on=function(a,b){fg(this,a,b)},a.prototype.off=function(a,b){gg(this,a,b)}}function vg(){this.id=null}function xg(a,b,c){for(var d=0,e=0;;){var f=a.indexOf(" ",d);-1==f&&(f=a.length);var g=f-d;if(f==a.length||e+g>=b)return d+Math.min(g,b-e);if(e+=f-d,e+=c-e%c,d=f+1,e>=b)return d}}function zg(a){for(;yg.length<=a;)yg.push(Ag(yg)+" ");return yg[a]}function Ag(a){return a[a.length-1]}function Cg(a,b){for(var c=0;c<a.length;++c)if(a[c]==b)return c;return-1}function Dg(a,b){for(var c=[],d=0;d<a.length;d++)c[d]=b(a[d],d);return c}function Eg(a,b){var c;if(Object.create)c=Object.create(a);else{var d=function(){};d.prototype=a,c=new d}return b&&Fg(b,c),c}function Fg(a,b,c){b||(b={});for(var d in a)!a.hasOwnProperty(d)||c===!1&&b.hasOwnProperty(d)||(b[d]=a[d]);return b}function Gg(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function Jg(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function Lg(a){return a.charCodeAt(0)>=768&&Kg.test(a)}function Mg(a,b,c,d){var e=document.createElement(a);if(c&&(e.className=c),d&&(e.style.cssText=d),"string"==typeof b)e.appendChild(document.createTextNode(b));else if(b)for(var f=0;f<b.length;++f)e.appendChild(b[f]);return e}function Og(a){for(var b=a.childNodes.length;b>0;--b)a.removeChild(a.firstChild);return a}function Pg(a,b){return Og(a).appendChild(b)}function Qg(a,b){if(a.contains)return a.contains(b);for(;b=b.parentNode;)if(b==a)return!0}function Rg(){return document.activeElement}function Sg(a){return new RegExp("\\b"+a+"\\b\\s*")}function Tg(a,b){var c=Sg(b);c.test(a.className)&&(a.className=a.className.replace(c,""))}function Ug(a,b){Sg(b).test(a.className)||(a.className+=" "+b)}function Vg(a,b){for(var c=a.split(" "),d=0;d<c.length;d++)c[d]&&!Sg(c[d]).test(b)&&(b+=" "+c[d]);return b}function Yg(a){if(null!=Xg)return Xg;var b=Mg("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return Pg(a,b),b.offsetWidth&&(Xg=b.offsetHeight-b.clientHeight),Xg||0}function $g(a){if(null==Zg){var b=Mg("span","\u200b");Pg(a,Mg("span",[b,document.createTextNode("x")])),0!=a.firstChild.offsetHeight&&(Zg=b.offsetWidth<=1&&b.offsetHeight>2&&!c)}return Zg?Mg("span","\u200b"):Mg("span","\xa0",null,"display: inline-block; width: 1px; margin-right: -1px")}function ah(a){if(null!=_g)return _g;var b=Pg(a,document.createTextNode("A\u062eA")),c=Ng(b,0,1).getBoundingClientRect();if(c.left==c.right)return!1;var d=Ng(b,1,2).getBoundingClientRect();return _g=d.right-c.right<3}function fh(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 gh(a){return a.level%2?a.to:a.from}function hh(a){return a.level%2?a.from:a.to}function ih(a){var b=Lf(a);return b?gh(b[0]):0}function jh(a){var b=Lf(a);return b?hh(Ag(b)):a.text.length}function kh(a,b){var c=Ef(a.doc,b),d=Re(c);d!=c&&(b=If(d));var e=Lf(d),f=e?e[0].level%2?jh(d):ih(d):0;return ob(b,f)}function lh(a,b){for(var c,d=Ef(a.doc,b);c=Pe(d);)d=c.find(1,!0).line,b=null;var e=Lf(d),f=e?e[0].level%2?ih(d):jh(d):d.text.length;return ob(null==b?If(d):b,f)}function mh(a,b,c){var d=a[0].level;return b==d?!0:c==d?!1:c>b}function oh(a,b){nh=null;for(var d,c=0;c<a.length;++c){var e=a[c];if(e.from<b&&e.to>b)return c;if(e.from==b||e.to==b){if(null!=d)return mh(a,e.level,a[d].level)?(e.from!=e.to&&(nh=d),c):(e.from!=e.to&&(nh=c),d);d=c}}return d}function ph(a,b,c,d){if(!d)return b+c;do b+=c;while(b>0&&Lg(a.text.charAt(b)));return b}function qh(a,b,c,d){var e=Lf(a);if(!e)return rh(a,b,c,d);for(var f=oh(e,b),g=e[f],h=ph(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 oh(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?ph(a,g.to,-1,d):ph(a,g.from,1,d)}}function rh(a,b,c,d){var e=b+c;if(d)for(;e>0&&Lg(a.text.charAt(e));)e+=c;return 0>e||e>a.text.length?null:e}var a=/gecko\/\d/i.test(navigator.userAgent),b=/MSIE \d/.test(navigator.userAgent),c=b&&(null==document.documentMode||document.documentMode<8),d=b&&(null==document.documentMode||document.documentMode<9),e=b&&(null==document.documentMode||document.documentMode<10),f=/Trident\/([7-9]|\d{2,})\./.test(navigator.userAgent),g=b||f,h=/WebKit\//.test(navigator.userAgent),i=h&&/Qt\/\d+\.\d+/.test(navigator.userAgent),j=/Chrome\//.test(navigator.userAgent),k=/Opera\//.test(navigator.userAgent),l=/Apple Computer/.test(navigator.vendor),m=/KHTML\//.test(navigator.userAgent),n=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),o=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),p=/PhantomJS/.test(navigator.userAgent),q=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),r=q||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),s=q||/Mac/.test(navigator.platform),t=/win/i.test(navigator.platform),u=k&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);u&&(u=Number(u[1])),u&&u>=15&&(k=!1,h=!0);var v=s&&(i||k&&(null==u||12.11>u)),w=a||g&&!d,x=!1,y=!1,ob=z.Pos=function(a,b){return this instanceof ob?(this.line=a,this.ch=b,void 0):new ob(a,b)},pb=z.cmpPos=function(a,b){return a.line-b.line||a.ch-b.ch};tb.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(a){if(a==this)return!0;if(a.primIndex!=this.primIndex||a.ranges.length!=this.ranges.length)return!1;for(var b=0;b<this.ranges.length;b++){var c=this.ranges[b],d=a.ranges[b];if(0!=pb(c.anchor,d.anchor)||0!=pb(c.head,d.head))return!1}return!0},deepCopy:function(){for(var a=[],b=0;b<this.ranges.length;b++)a[b]=new ub(qb(this.ranges[b].anchor),qb(this.ranges[b].head));return new tb(a,this.primIndex)},somethingSelected:function(){for(var a=0;a<this.ranges.length;a++)if(!this.ranges[a].empty())return!0;return!1},contains:function(a,b){b||(b=a);for(var c=0;c<this.ranges.length;c++){var d=this.ranges[c];if(pb(b,d.from())>=0&&pb(a,d.to())<=0)return c}return-1}},ub.prototype={from:function(){return sb(this.anchor,this.head)},to:function(){return rb(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var uc,Yc,Zc,fc={left:0,right:0,top:0,bottom:0},xc=0,dd=0,id=0,jd=null;g?jd=-.53:a?jd=15:j?jd=-.7:l&&(jd=-1/3);var nd,xd,qd=null,Ad=z.changeEnd=function(a){return a.text?ob(a.from.line+a.text.length-1,Ag(a.text).length+(1==a.text.length?a.from.ch:0)):a.to};z.prototype={constructor:z,focus:function(){window.focus(),Rc(this),Oc(this)},setOption:function(a,b){var c=this.options,d=c[a];(c[a]!=b||"mode"==a)&&(c[a]=b,_d.hasOwnProperty(a)&&Bc(this,_d[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:Cc(function(a,b){var c=a.token?a:z.getMode(this.options,a);if(c.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:c,modeSpec:a,opaque:b&&b.opaque}),this.state.modeGen++,Gc(this)}),removeOverlay:Cc(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++,Gc(this),void 0}}),indentLine:Cc(function(a,b,c){"string"!=typeof b&&"number"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract"),Ab(this.doc,a)&&Ud(this,a,b,c)}),indentSelection:Cc(function(a){for(var b=this.doc.sel.ranges,c=-1,d=0;d<b.length;d++){var e=b[d];if(e.empty())e.head.line>c&&(Ud(this,e.head.line,a,!0),c=e.head.line,d==this.doc.sel.primIndex&&Sd(this));else{var f=Math.max(c,e.from().line),g=e.to();c=Math.min(this.lastLine(),g.line-(g.ch?0:1))+1;for(var h=f;c>h;++h)Ud(this,h,a)}}}),getTokenAt:function(a,b){var c=this.doc;a=yb(c,a);for(var d=Wb(this,a.line,b),e=this.doc.mode,f=Ef(c,a.line),g=new pe(f.text,this.options.tabSize);g.pos<a.ch&&!g.eol();){g.start=g.pos;var h=ef(e,g,d)}return{start:g.start,end:g.pos,string:g.current(),type:h||null,state:d}},getTokenTypeAt:function(a){a=yb(this.doc,a);var f,b=hf(this,Ef(this.doc,a.line)),c=0,d=(b.length-1)/2,e=a.ch;if(0==e)f=b[2];else for(;;){var g=c+d>>1;if((g?b[2*g-1]:0)>=e)d=g;else{if(!(b[2*g+1]<e)){f=b[2*g+2];break}c=g+1}}var h=f?f.indexOf("cm-overlay "):-1;return 0>h?f:0==h?null:f.slice(0,h-1)},getModeAt:function(a){var b=this.doc.mode;return b.innerMode?z.innerMode(b,this.getTokenAt(a).state).mode:b},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,b){var c=[];if(!ge.hasOwnProperty(b))return ge;var d=ge[b],e=this.getModeAt(a);if("string"==typeof e[b])d[e[b]]&&c.push(d[e[b]]);else if(e[b])for(var f=0;f<e[b].length;f++){var g=d[e[b][f]];g&&c.push(g)}else e.helperType&&d[e.helperType]?c.push(d[e.helperType]):d[e.name]&&c.push(d[e.name]);for(var f=0;f<d._global.length;f++){var h=d._global[f];h.pred(e,this)&&-1==Cg(c,h.val)&&c.push(h.val)}return c},getStateAfter:function(a,b){var c=this.doc;return a=xb(c,null==a?c.first+c.size-1:a),Wb(this,a+1,b)},cursorCoords:function(a,b){var c,d=this.doc.sel.primary();return c=null==a?d.head:"object"==typeof a?yb(this.doc,a):a?d.from():d.to(),pc(this,c,b||"page")},charCoords:function(a,b){return oc(this,yb(this.doc,a),b||"page")},coordsChar:function(a,b){return a=nc(this,a,b||"page"),sc(this,a.left,a.top)},lineAtHeight:function(a,b){return a=nc(this,{top:a,left:0},b||"page").top,Jf(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=Ef(this.doc,a);return mc(this,e,{top:0,left:0},b||"page").top+(c?this.doc.height-Kf(e):0)},defaultTextHeight:function(){return vc(this.display)},defaultCharWidth:function(){return wc(this.display)},setGutterMarker:Cc(function(a,b,c){return Vd(this,a,"gutter",function(a){var d=a.gutterMarkers||(a.gutterMarkers={});return d[b]=c,!c&&Jg(d)&&(a.gutterMarkers=null),!0})}),clearGutter:Cc(function(a){var b=this,c=b.doc,d=c.first;c.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&(c.gutterMarkers[a]=null,Hc(b,d,"gutter"),Jg(c.gutterMarkers)&&(c.gutterMarkers=null)),++d})}),addLineClass:Cc(function(a,b,c){return Vd(this,a,"class",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:Cc(function(a,b,c){return Vd(this,a,"class",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:Cc(function(a,b,c){return $e(this,a,b,c)}),removeLineWidget:function(a){a.clear()},lineInfo:function(a){if("number"==typeof a){if(!Ab(this.doc,a))return null;var b=a;if(a=Ef(this.doc,a),!a)return null}else{var b=If(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.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=pc(this,yb(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&&Pd(this,h,g,h+b.offsetWidth,g+b.offsetHeight)},triggerOnKeyDown:Cc(rd),triggerOnKeyPress:Cc(ud),triggerOnKeyUp:Cc(td),execCommand:function(a){return je.hasOwnProperty(a)?je[a](this):void 0},findPosH:function(a,b,c,d){var e=1;0>b&&(e=-1,b=-b);for(var f=0,g=yb(this.doc,a);b>f&&(g=Xd(this.doc,g,e,c,d),!g.hitSide);++f);return g},moveH:Cc(function(a,b){var c=this;c.extendSelectionsBy(function(d){return c.display.shift||c.doc.extend||d.empty()?Xd(c.doc,d.head,a,b,c.options.rtlMoveVisually):0>a?d.from():d.to()},ug)}),deleteH:Cc(function(a,b){var c=this.doc.sel,d=this.doc;c.somethingSelected()?d.replaceSelection("",null,"+delete"):Wd(this,function(c){var e=Xd(d,c.head,a,b,!1);return 0>a?{from:e,to:c.head}:{from:c.head,to:e}})}),findPosV:function(a,b,c,d){var e=1,f=d;0>b&&(e=-1,b=-b);for(var g=0,h=yb(this.doc,a);b>g;++g){var i=pc(this,h,"div");if(null==f?f=i.left:i.left=f,h=Yd(this,i,e,c),h.hitSide)break}return h},moveV:Cc(function(a,b){var c=this,d=this.doc,e=[],f=!c.display.shift&&!d.extend&&d.sel.somethingSelected();if(d.extendSelectionsBy(function(g){if(f)return 0>a?g.from():g.to();var h=pc(c,g.head,"div");null!=g.goalColumn&&(h.left=g.goalColumn),e.push(h.left);var i=Yd(c,h,a,b);return"page"==b&&g==d.sel.primary()&&Rd(c,null,oc(c,i,"div").top-h.top),i},ug),e.length)for(var g=0;g<d.sel.ranges.length;g++)d.sel.ranges[g].goalColumn=e[g]}),toggleOverwrite:function(a){(null==a||a!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?Ug(this.display.cursorDiv,"CodeMirror-overwrite"):Tg(this.display.cursorDiv,"CodeMirror-overwrite"),hg(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return Rg()==this.display.input},scrollTo:Cc(function(a,b){(null!=a||null!=b)&&Td(this),null!=a&&(this.curOp.scrollLeft=a),null!=b&&(this.curOp.scrollTop=b)}),getScrollInfo:function(){var a=this.display.scroller,b=qg;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-b,width:a.scrollWidth-b,clientHeight:a.clientHeight-b,clientWidth:a.clientWidth-b}},scrollIntoView:Cc(function(a,b){if(null==a?(a={from:this.doc.sel.primary().head,to:null},null==b&&(b=this.options.cursorScrollMargin)):"number"==typeof a?a={from:ob(a,0),to:null}:null==a.from&&(a={from:a,to:null}),a.to||(a.to=a.from),a.margin=b||0,null!=a.from.line)Td(this),this.curOp.scrollToPos=a;else{var c=Qd(this,Math.min(a.from.left,a.to.left),Math.min(a.from.top,a.to.top)-a.margin,Math.max(a.from.right,a.to.right),Math.max(a.from.bottom,a.to.bottom)+a.margin);this.scrollTo(c.scrollLeft,c.scrollTop)}}),setSize:Cc(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&&ic(this),this.curOp.forceUpdate=!0,hg(this,"refresh",this)}),operation:function(a){return Ac(this,a)},refresh:Cc(function(){var a=this.display.cachedTextHeight;Gc(this),this.curOp.forceUpdate=!0,jc(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),K(this),(null==a||Math.abs(a-vc(this.display))>.5)&&F(this),hg(this,"refresh",this)}),swapDoc:Cc(function(a){var b=this.doc;return b.cm=null,Df(this,a),jc(this),Qc(this),this.scrollTo(a.scrollLeft,a.scrollTop),kg(this,"swapDoc",this,b),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}},pg(z);var $d=z.defaults={},_d=z.optionHandlers={},be=z.Init={toString:function(){return"CodeMirror.Init"}};ae("value","",function(a,b){a.setValue(b)},!0),ae("mode",null,function(a,b){a.doc.modeOption=b,B(a)},!0),ae("indentUnit",2,B,!0),ae("indentWithTabs",!1),ae("smartIndent",!0),ae("tabSize",4,function(a){C(a),jc(a),Gc(a)},!0),ae("specialChars",/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/g,function(a,b){a.options.specialChars=new RegExp(b.source+(b.test(" ")?"":"| "),"g"),a.refresh()},!0),ae("specialCharPlaceholder",of,function(a){a.refresh()},!0),ae("electricChars",!0),ae("rtlMoveVisually",!t),ae("wholeLineUpdateBefore",!0),ae("theme","default",function(a){H(a),I(a)},!0),ae("keyMap","default",G),ae("extraKeys",null),ae("lineWrapping",!1,D,!0),ae("gutters",[],function(a){N(a.options),I(a)},!0),ae("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?U(a.display)+"px":"0",a.refresh()
4
- },!0),ae("coverGutterNextToScrollbar",!1,P,!0),ae("lineNumbers",!1,function(a){N(a.options),I(a)},!0),ae("firstLineNumber",1,I,!0),ae("lineNumberFormatter",function(a){return a},I,!0),ae("showCursorWhenSelecting",!1,Pb,!0),ae("resetSelectionOnContextMenu",!0),ae("readOnly",!1,function(a,b){"nocursor"==b?(wd(a),a.display.input.blur(),a.display.disabled=!0):(a.display.disabled=!1,b||Qc(a))}),ae("disableInput",!1,function(a,b){b||Qc(a)},!0),ae("dragDrop",!0),ae("cursorBlinkRate",530),ae("cursorScrollMargin",0),ae("cursorHeight",1),ae("workTime",100),ae("workDelay",100),ae("flattenSpans",!0,C,!0),ae("addModeClass",!1,C,!0),ae("pollInterval",100),ae("undoDepth",200,function(a,b){a.doc.history.undoDepth=b}),ae("historyEventDelay",1250),ae("viewportMargin",10,function(a){a.refresh()},!0),ae("maxHighlightLength",1e4,C,!0),ae("moveInputWithCursor",!0,function(a,b){b||(a.display.inputDiv.style.top=a.display.inputDiv.style.left=0)}),ae("tabindex",null,function(a,b){a.display.input.tabIndex=b||""}),ae("autofocus",null);var ce=z.modes={},de=z.mimeModes={};z.defineMode=function(a,b){if(z.defaults.mode||"null"==a||(z.defaults.mode=a),arguments.length>2){b.dependencies=[];for(var c=2;c<arguments.length;++c)b.dependencies.push(arguments[c])}ce[a]=b},z.defineMIME=function(a,b){de[a]=b},z.resolveMode=function(a){if("string"==typeof a&&de.hasOwnProperty(a))a=de[a];else if(a&&"string"==typeof a.name&&de.hasOwnProperty(a.name)){var b=de[a.name];"string"==typeof b&&(b={name:b}),a=Eg(b,a),a.name=b.name}else if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return z.resolveMode("application/xml");return"string"==typeof a?{name:a}:a||{name:"null"}},z.getMode=function(a,b){var b=z.resolveMode(b),c=ce[b.name];if(!c)return z.getMode(a,"text/plain");var d=c(a,b);if(ee.hasOwnProperty(b.name)){var e=ee[b.name];for(var f in e)e.hasOwnProperty(f)&&(d.hasOwnProperty(f)&&(d["_"+f]=d[f]),d[f]=e[f])}if(d.name=b.name,b.helperType&&(d.helperType=b.helperType),b.modeProps)for(var f in b.modeProps)d[f]=b.modeProps[f];return d},z.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}}),z.defineMIME("text/plain","null");var ee=z.modeExtensions={};z.extendMode=function(a,b){var c=ee.hasOwnProperty(a)?ee[a]:ee[a]={};Fg(b,c)},z.defineExtension=function(a,b){z.prototype[a]=b},z.defineDocExtension=function(a,b){zf.prototype[a]=b},z.defineOption=ae;var fe=[];z.defineInitHook=function(a){fe.push(a)};var ge=z.helpers={};z.registerHelper=function(a,b,c){ge.hasOwnProperty(a)||(ge[a]=z[a]={_global:[]}),ge[a][b]=c},z.registerGlobalHelper=function(a,b,c,d){z.registerHelper(a,b,d),ge[a]._global.push({pred:c,val:d})};var he=z.copyState=function(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},ie=z.startState=function(a,b,c){return a.startState?a.startState(b,c):!0};z.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 je=z.commands={selectAll:function(a){a.setSelection(ob(a.firstLine(),0),ob(a.lastLine()),sg)},singleSelection:function(a){a.setSelection(a.getCursor("anchor"),a.getCursor("head"),sg)},killLine:function(a){Wd(a,function(b){if(b.empty()){var c=Ef(a.doc,b.head.line).text.length;return b.head.ch==c&&b.head.line<a.lastLine()?{from:b.head,to:ob(b.head.line+1,0)}:{from:b.head,to:ob(b.head.line,c)}}return{from:b.from(),to:b.to()}})},deleteLine:function(a){Wd(a,function(b){return{from:ob(b.from().line,0),to:yb(a.doc,ob(b.to().line+1,0))}})},delLineLeft:function(a){Wd(a,function(a){return{from:ob(a.from().line,0),to:a.from()}})},undo:function(a){a.undo()},redo:function(a){a.redo()},undoSelection:function(a){a.undoSelection()},redoSelection:function(a){a.redoSelection()},goDocStart:function(a){a.extendSelection(ob(a.firstLine(),0))},goDocEnd:function(a){a.extendSelection(ob(a.lastLine()))},goLineStart:function(a){a.extendSelectionsBy(function(b){return kh(a,b.head.line)},ug)},goLineStartSmart:function(a){a.extendSelectionsBy(function(b){var c=kh(a,b.head.line),d=a.getLineHandle(c.line),e=Lf(d);if(!e||0==e[0].level){var f=Math.max(0,d.text.search(/\S/)),g=b.head.line==c.line&&b.head.ch<=f&&b.head.ch;return ob(c.line,g?0:f)}return c},ug)},goLineEnd:function(a){a.extendSelectionsBy(function(b){return lh(a,b.head.line)},ug)},goLineRight:function(a){a.extendSelectionsBy(function(b){var c=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:c},"div")},ug)},goLineLeft:function(a){a.extendSelectionsBy(function(b){var c=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:c},"div")},ug)},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(" ")},insertSoftTab:function(a){for(var b=[],c=a.listSelections(),d=a.options.tabSize,e=0;e<c.length;e++){var f=c[e].from(),g=wg(a.getLine(f.line),f.ch,d);b.push(new Array(d-g%d+1).join(" "))}a.replaceSelections(b)},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.execCommand("insertTab")},transposeChars:function(a){Ac(a,function(){for(var b=a.listSelections(),c=0;c<b.length;c++){var d=b[c].head,e=Ef(a.doc,d.line).text;d.ch>0&&d.ch<e.length-1&&a.replaceRange(e.charAt(d.ch)+e.charAt(d.ch-1),ob(d.line,d.ch-1),ob(d.line,d.ch+1))}})},newlineAndIndent:function(a){Ac(a,function(){for(var b=a.listSelections().length,c=0;b>c;c++){var d=a.listSelections()[c];a.replaceRange("\n",d.anchor,d.head,"+input"),a.indentLine(d.from().line+1,null,!0),Sd(a)}})},toggleOverwrite:function(a){a.toggleOverwrite()}},ke=z.keyMap={};ke.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},ke.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-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","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},ke.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","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection",fallthrough:["basic","emacsy"]},ke.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"},ke["default"]=s?ke.macDefault:ke.pcDefault;var me=z.lookupKey=function(a,b,c){function d(b){b=le(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;g<f.length;++g){var h=d(f[g]);if(h)return h}return!1}for(var e=0;e<b.length;++e){var f=d(b[e]);if(f)return"stop"!=f}},ne=z.isModifierKey=function(a){var b=eh[a.keyCode];return"Ctrl"==b||"Alt"==b||"Shift"==b||"Mod"==b},oe=z.keyName=function(a,b){if(k&&34==a.keyCode&&a["char"])return!1;var c=eh[a.keyCode];return null==c||a.altGraphKey?!1:(a.altKey&&(c="Alt-"+c),(v?a.metaKey:a.ctrlKey)&&(c="Ctrl-"+c),(v?a.ctrlKey:a.metaKey)&&(c="Cmd-"+c),!b&&a.shiftKey&&(c="Shift-"+c),c)};z.fromTextArea=function(a,b){function d(){a.value=i.getValue()}if(b||(b={}),b.value=a.value,!b.tabindex&&a.tabindex&&(b.tabindex=a.tabindex),!b.placeholder&&a.placeholder&&(b.placeholder=a.placeholder),null==b.autofocus){var c=Rg();b.autofocus=c==a||null!=a.getAttribute("autofocus")&&c==document.body}if(a.form&&(fg(a.form,"submit",d),!b.leaveSubmitMethodAlone)){var e=a.form,f=e.submit;try{var g=e.submit=function(){d(),e.submit=f,e.submit(),e.submit=g}}catch(h){}}a.style.display="none";var i=z(function(b){a.parentNode.insertBefore(b,a.nextSibling)},b);return i.save=d,i.getTextArea=function(){return a},i.toTextArea=function(){d(),a.parentNode.removeChild(i.getWrapperElement()),a.style.display="",a.form&&(gg(a.form,"submit",d),"function"==typeof a.form.submit&&(a.form.submit=f))},i};var pe=z.StringStream=function(a,b){this.pos=this.start=0,this.string=a,this.tabSize=b||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};pe.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},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=wg(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?wg(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return wg(this.string,null,this.tabSize)-(this.lineStart?wg(this.string,this.lineStart,this.tabSize):0)},match:function(a,b,c){if("string"!=typeof a){var f=this.string.slice(this.pos).match(a);return f&&f.index>0?null:(f&&b!==!1&&(this.pos+=f[0].length),f)}var d=function(a){return c?a.toLowerCase():a},e=this.string.substr(this.pos,a.length);return d(e)==d(a)?(b!==!1&&(this.pos+=a.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}}};var qe=z.TextMarker=function(a,b){this.lines=[],this.type=b,this.doc=a};pg(qe),qe.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;if(b&&yc(a),og(this,"clear")){var c=this.find();c&&kg(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=ze(g.markedSpans,this);a&&!this.collapsed?Hc(a,If(g),"text"):a&&(null!=h.to&&(e=If(g)),null!=h.from&&(d=If(g))),g.markedSpans=Ae(g.markedSpans,h),null==h.from&&this.collapsed&&!Ve(this.doc,g)&&a&&Hf(g,vc(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(var f=0;f<this.lines.length;++f){var i=Re(this.lines[f]),j=L(i);j>a.display.maxLineLength&&(a.display.maxLine=i,a.display.maxLineLength=j,a.display.maxLineChanged=!0)}null!=d&&a&&this.collapsed&&Gc(a,d,e+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&Mb(a.doc)),a&&kg(a,"markerCleared",a,this),b&&zc(a),this.parent&&this.parent.clear()}},qe.prototype.find=function(a,b){null==a&&"bookmark"==this.type&&(a=1);for(var c,d,e=0;e<this.lines.length;++e){var f=this.lines[e],g=ze(f.markedSpans,this);if(null!=g.from&&(c=ob(b?f:If(f),g.from),-1==a))return c;if(null!=g.to&&(d=ob(b?f:If(f),g.to),1==a))return d}return c&&{from:c,to:d}},qe.prototype.changed=function(){var a=this.find(-1,!0),b=this,c=this.doc.cm;a&&c&&Ac(c,function(){var d=a.line,e=If(a.line),f=cc(c,e);if(f&&(hc(f),c.curOp.selectionChanged=c.curOp.forceUpdate=!0),c.curOp.updateMaxLine=!0,!Ve(b.doc,d)&&null!=b.height){var g=b.height;b.height=null;var h=Ze(b)-g;h&&Hf(d,d.height+h)}})},qe.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&-1!=Cg(b.maybeHiddenMarkers,this)||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)},qe.prototype.detachLine=function(a){if(this.lines.splice(Cg(this.lines,a),1),!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;(b.maybeHiddenMarkers||(b.maybeHiddenMarkers=[])).push(this)}};var re=0,te=z.SharedTextMarker=function(a,b){this.markers=a,this.primary=b;for(var c=0;c<a.length;++c)a[c].parent=this};pg(te),te.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();kg(this,"clear")}},te.prototype.find=function(a,b){return this.primary.find(a,b)};var Xe=z.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};pg(Xe),Xe.prototype.clear=function(){var a=this.cm,b=this.line.widgets,c=this.line,d=If(c);if(null!=d&&b){for(var e=0;e<b.length;++e)b[e]==this&&b.splice(e--,1);b.length||(c.widgets=null);var f=Ze(this);Ac(a,function(){Ye(a,c,-f),Hc(a,d,"widget"),Hf(c,Math.max(0,c.height-f))})}},Xe.prototype.changed=function(){var a=this.height,b=this.cm,c=this.line;this.height=null;var d=Ze(this)-a;d&&Ac(b,function(){b.curOp.forceUpdate=!0,Ye(b,c,d),Hf(c,c.height+d)})};var _e=z.Line=function(a,b,c){this.text=a,Je(this,b),this.height=c?c(this):1};pg(_e),_e.prototype.lineNo=function(){return If(this)};var kf={},lf={};wf.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,bf(e),kg(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.push.apply(a,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;d<b.length;++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}},xf.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&&(this.children.length>1||!(this.children[0]instanceof wf))){var h=[];this.collapse(h),this.children=[new wf(h)],this.children[0].parent=this}},collapse:function(a){for(var b=0;b<this.children.length;++b)this.children[b].collapse(a)},insertInner:function(a,b,c){this.size+=b.length,this.height+=c;for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(f>=a){if(e.insertInner(a,b,c),e.lines&&e.lines.length>50){for(;e.lines.length>50;){var g=e.lines.splice(e.lines.length-25,25),h=new wf(g);e.height-=h.height,this.children.splice(d+1,0,h),h.parent=this}this.maybeSpill()}break}a-=f}},maybeSpill:function(){if(!(this.children.length<=10)){var a=this;do{var b=a.children.splice(a.children.length-5,5),c=new xf(b);if(a.parent){a.size-=c.size,a.height-=c.height;var e=Cg(a.parent.children,a);a.parent.children.splice(e+1,0,c)}else{var d=new xf(a.children);d.parent=a,a.children=[d,c],a=d}c.parent=a.parent}while(a.children.length>10);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(f>a){var g=Math.min(b,f-a);if(e.iterN(a,g,c))return!0;if(0==(b-=g))break;a=0}else a-=f}}};var yf=0,zf=z.Doc=function(a,b,c){if(!(this instanceof zf))return new zf(a,b,c);null==c&&(c=0),xf.call(this,[new wf([new _e("",null)])]),this.first=c,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=c;var d=ob(c,0);this.sel=wb(d),this.history=new Mf(null),this.id=++yf,this.modeOption=b,"string"==typeof a&&(a=bh(a)),vf(this,{from:d,to:d,text:a}),Jb(this,wb(d),sg)};zf.prototype=Eg(xf.prototype,{constructor:zf,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;d<b.length;++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=Gf(this,this.first,this.first+this.size);return a===!1?b:b.join(a||"\n")},setValue:Dc(function(a){var b=ob(this.first,0),c=this.first+this.size-1;Gd(this,{from:b,to:ob(c,Ef(this,c).text.length),text:bh(a),origin:"setValue"},!0),Jb(this,wb(b))}),replaceRange:function(a,b,c,d){b=yb(this,b),c=c?yb(this,c):b,Md(this,a,b,c,d)},getRange:function(a,b,c){var d=Ff(this,yb(this,a),yb(this,b));return c===!1?d:d.join(c||"\n")},getLine:function(a){var b=this.getLineHandle(a);return b&&b.text},getLineHandle:function(a){return Ab(this,a)?Ef(this,a):void 0},getLineNumber:function(a){return If(a)},getLineHandleVisualStart:function(a){return"number"==typeof a&&(a=Ef(this,a)),Re(a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return yb(this,a)},getCursor:function(a){var c,b=this.sel.primary();return c=null==a||"head"==a?b.head:"anchor"==a?b.anchor:"end"==a||"to"==a||a===!1?b.to():b.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Dc(function(a,b,c){Gb(this,yb(this,"number"==typeof a?ob(a,b||0):a),null,c)}),setSelection:Dc(function(a,b,c){Gb(this,yb(this,a),yb(this,b||a),c)}),extendSelection:Dc(function(a,b,c){Db(this,yb(this,a),b&&yb(this,b),c)}),extendSelections:Dc(function(a,b){Eb(this,Bb(this,a,b))}),extendSelectionsBy:Dc(function(a,b){Eb(this,Dg(this.sel.ranges,a),b)}),setSelections:Dc(function(a,b,c){if(a.length){for(var d=0,e=[];d<a.length;d++)e[d]=new ub(yb(this,a[d].anchor),yb(this,a[d].head));null==b&&(b=Math.min(a.length-1,this.sel.primIndex)),Jb(this,vb(e,b),c)}}),addSelection:Dc(function(a,b,c){var d=this.sel.ranges.slice(0);d.push(new ub(yb(this,a),yb(this,b||a))),Jb(this,vb(d,d.length-1),c)}),getSelection:function(a){for(var c,b=this.sel.ranges,d=0;d<b.length;d++){var e=Ff(this,b[d].from(),b[d].to());c=c?c.concat(e):e}return a===!1?c:c.join(a||"\n")},getSelections:function(a){for(var b=[],c=this.sel.ranges,d=0;d<c.length;d++){var e=Ff(this,c[d].from(),c[d].to());a!==!1&&(e=e.join(a||"\n")),b[d]=e}return b},replaceSelection:Dc(function(a,b,c){for(var d=[],e=0;e<this.sel.ranges.length;e++)d[e]=a;this.replaceSelections(d,b,c||"+input")}),replaceSelections:function(a,b,c){for(var d=[],e=this.sel,f=0;f<e.ranges.length;f++){var g=e.ranges[f];d[f]={from:g.from(),to:g.to(),text:bh(a[f]),origin:c}}for(var h=b&&"end"!=b&&Ed(this,d,b),f=d.length-1;f>=0;f--)Gd(this,d[f]);h?Ib(this,h):this.cm&&Sd(this.cm)},undo:Dc(function(){Id(this,"undo")}),redo:Dc(function(){Id(this,"redo")}),undoSelection:Dc(function(){Id(this,"undo",!0)}),redoSelection:Dc(function(){Id(this,"redo",!0)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=this.history,b=0,c=0,d=0;d<a.done.length;d++)a.done[d].ranges||++b;for(var d=0;d<a.undone.length;d++)a.undone[d].ranges||++c;return{undo:b,redo:c}},clearHistory:function(){this.history=new Mf(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(a){return a&&(this.history.lastOp=this.history.lastOrigin=null),this.history.generation},isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},getHistory:function(){return{done:Xf(this.history.done),undone:Xf(this.history.undone)}},setHistory:function(a){var b=this.history=new Mf(this.history.maxGeneration);b.done=Xf(a.done.slice(0),null,!0),b.undone=Xf(a.undone.slice(0),null,!0)},markText:function(a,b,c){return se(this,yb(this,a),yb(this,b),c,"range")},setBookmark:function(a,b){var c={replacedWith:b&&(null==b.nodeType?b.widget:b),insertLeft:b&&b.insertLeft,clearWhenEmpty:!1,shared:b&&b.shared};return a=yb(this,a),se(this,a,a,c,"bookmark")},findMarksAt:function(a){a=yb(this,a);var b=[],c=Ef(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},findMarks:function(a,b,c){a=yb(this,a),b=yb(this,b);var d=[],e=a.line;return this.iter(a.line,b.line+1,function(f){var g=f.markedSpans;if(g)for(var h=0;h<g.length;h++){var i=g[h];e==a.line&&a.ch>i.to||null==i.from&&e!=a.line||e==b.line&&i.from>b.ch||c&&!c(i.marker)||d.push(i.marker.parent||i.marker)}++e}),d},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)}),yb(this,ob(c,b))},indexFromPos:function(a){a=yb(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 zf(Gf(this,this.first,this.first+this.size),this.modeOption,this.first);return b.scrollTop=this.scrollTop,b.scrollLeft=this.scrollLeft,b.sel=this.sel,b.extend=!1,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 zf(Gf(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}],we(d,ve(this)),d},unlinkDoc:function(a){if(a instanceof z&&(a=a.doc),this.linked)for(var b=0;b<this.linked.length;++b){var c=this.linked[b];if(c.doc==a){this.linked.splice(b,1),a.unlinkDoc(this),xe(ve(this));break}}if(a.history==this.history){var d=[a.id];Cf(a,function(a){d.push(a.id)},!0),a.history=new Mf(null),a.history.done=Xf(this.history.done,d),a.history.undone=Xf(this.history.undone,d)}},iterLinkedDocs:function(a){Cf(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),zf.prototype.eachLine=zf.prototype.iter;var Af="iter insert remove copy getEditor".split(" ");for(var Bf in zf.prototype)zf.prototype.hasOwnProperty(Bf)&&Cg(Af,Bf)<0&&(z.prototype[Bf]=function(a){return function(){return a.apply(this.doc,arguments)}}(zf.prototype[Bf]));pg(zf);var ig,_f=z.e_preventDefault=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1},ag=z.e_stopPropagation=function(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},cg=z.e_stop=function(a){_f(a),ag(a)},fg=z.on=function(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)}},gg=z.off=function(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}}},hg=z.signal=function(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)},jg=0,qg=30,rg=z.Pass={toString:function(){return"CodeMirror.Pass"}},sg={scroll:!1},tg={origin:"*mouse"},ug={origin:"+move"};vg.prototype.set=function(a,b){clearTimeout(this.id),this.id=setTimeout(b,a)};var wg=z.countColumn=function(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;;){var h=a.indexOf(" ",f);if(0>h||h>=b)return g+(b-f);g+=h-f,g+=c-g%c,f=h+1}},yg=[""],Bg=function(a){a.select()};q?Bg=function(a){a.selectionStart=0,a.selectionEnd=a.value.length}:g&&(Bg=function(a){try{a.select()}catch(b){}}),[].indexOf&&(Cg=function(a,b){return a.indexOf(b)}),[].map&&(Dg=function(a,b){return a.map(b)});var Ng,Hg=/[\u00df\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Ig=z.isWordChar=function(a){return/\w/.test(a)||a>"\x80"&&(a.toUpperCase()!=a.toLowerCase()||Hg.test(a))},Kg=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;Ng=document.createRange?function(a,b,c){var d=document.createRange();return d.setEnd(a,c),d.setStart(a,b),d}:function(a,b,c){var d=document.body.createTextRange();return d.moveToElementText(a.parentNode),d.collapse(!0),d.moveEnd("character",c),d.moveStart("character",b),d},b&&(Rg=function(){try{return document.activeElement}catch(a){return document.body}});var Xg,Zg,_g,Wg=function(){if(d)return!1;var a=Mg("div");return"draggable"in a||"dragDrop"in a}(),bh=z.splitLines=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/)},ch=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},dh=function(){var a=Mg("div");return"oncopy"in a?!0:(a.setAttribute("oncopy","return;"),"function"==typeof a.oncopy)}(),eh={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};z.keyNames=eh,function(){for(var a=0;10>a;a++)eh[a+48]=eh[a+96]=String(a);for(var a=65;90>=a;a++)eh[a]=String.fromCharCode(a);for(var a=1;12>=a;a++)eh[a+111]=eh[a+63235]="F"+a}();var nh,sh=function(){function c(c){return 247>=c?a.charAt(c):c>=1424&&1524>=c?"R":c>=1536&&1773>=c?b.charAt(c-1536):c>=1774&&2220>=c?"r":c>=8192&&8203>=c?"w":8204==c?"b":"L"}function j(a,b,c){this.level=a,this.from=b,this.to=c}var a="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",b="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",d=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,e=/[stwN]/,f=/[LRr]/,g=/[Lb1n]/,h=/[1n]/,i="L";return function(a){if(!d.test(a))return!1;for(var m,b=a.length,k=[],l=0;b>l;++l)k.push(m=c(a.charCodeAt(l)));for(var l=0,n=i;b>l;++l){var m=k[l];"m"==m?k[l]=n:n=m}for(var l=0,o=i;b>l;++l){var m=k[l];"1"==m&&"r"==o?k[l]="n":f.test(m)&&(o=m,"r"==m&&(k[l]="R"))}for(var l=1,n=k[0];b-1>l;++l){var m=k[l];"+"==m&&"1"==n&&"1"==k[l+1]?k[l]="1":","!=m||n!=k[l+1]||"1"!=n&&"n"!=n||(k[l]=n),n=m}for(var l=0;b>l;++l){var m=k[l];if(","==m)k[l]="N";else if("%"==m){for(var p=l+1;b>p&&"%"==k[p];++p);for(var q=l&&"!"==k[l-1]||b>p&&"1"==k[p]?"1":"N",r=l;p>r;++r)k[r]=q;l=p-1}}for(var l=0,o=i;b>l;++l){var m=k[l];"L"==o&&"1"==m?k[l]="L":f.test(m)&&(o=m)}for(var l=0;b>l;++l)if(e.test(k[l])){for(var p=l+1;b>p&&e.test(k[p]);++p);for(var s="L"==(l?k[l-1]:i),t="L"==(b>p?k[p]:i),q=s||t?"L":"R",r=l;p>r;++r)k[r]=q;l=p-1}for(var v,u=[],l=0;b>l;)if(g.test(k[l])){var w=l;for(++l;b>l&&g.test(k[l]);++l);u.push(new j(0,w,l))}else{var x=l,y=u.length;for(++l;b>l&&"L"!=k[l];++l);for(var r=x;l>r;)if(h.test(k[r])){r>x&&u.splice(y,0,new j(1,x,r));var z=r;for(++r;l>r&&h.test(k[r]);++r);u.splice(y,0,new j(2,z,r)),x=r}else++r;l>x&&u.splice(y,0,new j(1,x,l))}return 1==u[0].level&&(v=a.match(/^\s+/))&&(u[0].from=v[0].length,u.unshift(new j(0,0,v[0].length))),1==Ag(u).level&&(v=a.match(/\s+$/))&&(Ag(u).to-=v[0].length,u.push(new j(0,b-v[0].length,b))),u[0].level!=Ag(u).level&&u.push(new j(u[0].level,b,b)),u}}();return z.version="4.0.4",z}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";function b(a){for(var b={},c=0;c<a.length;++c)b[a[c]]=!0;return b}function q(a,b){for(var d,c=!1;null!=(d=a.next());){if(c&&"/"==d){b.tokenize=null;
5
  break}c="*"==d}return["comment","comment"]}function r(a,b){return a.skipTo("-->")?(a.match("-->"),b.tokenize=null):a.skipToEnd(),["comment","comment"]}a.defineMode("css",function(b,c){function p(a,b){return n=b,a}function q(a,b){var c=a.next();if(e[c]){var d=e[c](a,b);if(d!==!1)return d}return"@"==c?(a.eatWhile(/[\w\\\-]/),p("def",a.current())):"="==c||("~"==c||"|"==c)&&a.eat("=")?p(null,"compare"):'"'==c||"'"==c?(b.tokenize=r(c),b.tokenize(a,b)):"#"==c?(a.eatWhile(/[\w\\\-]/),p("atom","hash")):"!"==c?(a.match(/^\s*\w*/),p("keyword","important")):/\d/.test(c)||"."==c&&a.eat(/\d/)?(a.eatWhile(/[\w.%]/),p("number","unit")):"-"!==c?/[,+>*\/]/.test(c)?p(null,"select-op"):"."==c&&a.match(/^-?[_a-z][_a-z0-9-]*/i)?p("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(c)?p(null,c):"u"==c&&a.match("rl(")?(a.backUp(1),b.tokenize=s,p("property","word")):/[\w\\\-]/.test(c)?(a.eatWhile(/[\w\\\-]/),p("property","word")):p(null,null):/[\d.]/.test(a.peek())?(a.eatWhile(/[\w.%]/),p("number","unit")):a.match(/^[^-]+-/)?p("meta","meta"):void 0}function r(a){return function(b,c){for(var e,d=!1;null!=(e=b.next());){if(e==a&&!d){")"==a&&b.backUp(1);break}d=!d&&"\\"==e}return(e==a||!d&&")"!=a)&&(c.tokenize=null),p("string","string")}}function s(a,b){return a.next(),b.tokenize=a.match(/\s*[\"\')]/,!1)?null:r(")"),p(null,"(")}function t(a,b,c){this.type=a,this.indent=b,this.prev=c}function u(a,b,c){return a.context=new t(c,b.indentation()+d,a.context),c}function v(a){return a.context=a.context.prev,a.context.type}function w(a,b,c){return z[c.context.type](a,b,c)}function x(a,b,c,d){for(var e=d||1;e>0;e--)c.context=c.context.prev;return w(a,b,c)}function y(a){var b=a.current().toLowerCase();o=k.hasOwnProperty(b)?"atom":j.hasOwnProperty(b)?"keyword":"variable"}c.propertyKeywords||(c=a.resolveMode("text/css"));var n,o,d=b.indentUnit,e=c.tokenHooks,f=c.mediaTypes||{},g=c.mediaFeatures||{},h=c.propertyKeywords||{},i=c.nonStandardPropertyKeywords||{},j=c.colorKeywords||{},k=c.valueKeywords||{},l=c.fontProperties||{},m=c.allowNested,z={};return z.top=function(a,b,c){if("{"==a)return u(c,b,"block");if("}"==a&&c.context.prev)return v(c);if("@media"==a)return u(c,b,"media");if("@font-face"==a)return"font_face_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(a))return"keyframes";if(a&&"@"==a.charAt(0))return u(c,b,"at");if("hash"==a)o="builtin";else if("word"==a)o="tag";else{if("variable-definition"==a)return"maybeprop";if("interpolation"==a)return u(c,b,"interpolation");if(":"==a)return"pseudo";if(m&&"("==a)return u(c,b,"params")}return c.context.type},z.block=function(a,b,c){if("word"==a){var d=b.current().toLowerCase();return h.hasOwnProperty(d)?(o="property","maybeprop"):i.hasOwnProperty(d)?(o="string-2","maybeprop"):m?(o=b.match(/^\s*:/,!1)?"property":"tag","block"):(o+=" error","maybeprop")}return"meta"==a?"block":m||"hash"!=a&&"qualifier"!=a?z.top(a,b,c):(o="error","block")},z.maybeprop=function(a,b,c){return":"==a?u(c,b,"prop"):w(a,b,c)},z.prop=function(a,b,c){if(";"==a)return v(c);if("{"==a&&m)return u(c,b,"propBlock");if("}"==a||"{"==a)return x(a,b,c);if("("==a)return u(c,b,"parens");if("hash"!=a||/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(b.current())){if("word"==a)y(b);else if("interpolation"==a)return u(c,b,"interpolation")}else o+=" error";return"prop"},z.propBlock=function(a,b,c){return"}"==a?v(c):"word"==a?(o="property","maybeprop"):c.context.type},z.parens=function(a,b,c){return"{"==a||"}"==a?x(a,b,c):")"==a?v(c):"parens"},z.pseudo=function(a,b,c){return"word"==a?(o="variable-3",c.context.type):w(a,b,c)},z.media=function(a,b,c){if("("==a)return u(c,b,"media_parens");if("}"==a)return x(a,b,c);if("{"==a)return v(c)&&u(c,b,m?"block":"top");if("word"==a){var d=b.current().toLowerCase();o="only"==d||"not"==d||"and"==d?"keyword":f.hasOwnProperty(d)?"attribute":g.hasOwnProperty(d)?"property":"error"}return c.context.type},z.media_parens=function(a,b,c){return")"==a?v(c):"{"==a||"}"==a?x(a,b,c,2):z.media(a,b,c)},z.font_face_before=function(a,b,c){return"{"==a?u(c,b,"font_face"):w(a,b,c)},z.font_face=function(a,b,c){return"}"==a?v(c):"word"==a?(o=l.hasOwnProperty(b.current().toLowerCase())?"property":"error","maybeprop"):"font_face"},z.keyframes=function(a,b,c){return"word"==a?(o="variable","keyframes"):"{"==a?u(c,b,"top"):w(a,b,c)},z.at=function(a,b,c){return";"==a?v(c):"{"==a||"}"==a?x(a,b,c):("word"==a?o="tag":"hash"==a&&(o="builtin"),"at")},z.interpolation=function(a,b,c){return"}"==a?v(c):"{"==a||";"==a?x(a,b,c):("variable"!=a&&(o="error"),"interpolation")},z.params=function(a,b,c){return")"==a?v(c):"{"==a||"}"==a?x(a,b,c):("word"==a&&y(b),"params")},{startState:function(a){return{tokenize:null,state:"top",context:new t("top",a||0,null)}},token:function(a,b){if(!b.tokenize&&a.eatSpace())return null;var c=(b.tokenize||q)(a,b);return c&&"object"==typeof c&&(n=c[1],c=c[0]),o=c,b.state=z[b.state](n,a,b),o},indent:function(a,b){var c=a.context,e=b&&b.charAt(0),f=c.indent;return"prop"==c.type&&"}"==e&&(c=c.prev),!c.prev||("}"!=e||"block"!=c.type&&"top"!=c.type&&"interpolation"!=c.type&&"font_face"!=c.type)&&(")"!=e||"parens"!=c.type&&"params"!=c.type&&"media_parens"!=c.type)&&("{"!=e||"at"!=c.type&&"media"!=c.type)||(f=c.indent-d,c=c.prev),f},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});var c=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],d=b(c),e=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"],f=b(e),g=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-inside","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-profile","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","kerning","text-anchor","writing-mode"],h=b(g),i=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],i=b(i),j=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],k=b(j),l=["above","absolute","activeborder","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","cover","crop","cross","crosshair","currentcolor","cursive","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ew-resize","expanded","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-table","inset","inside","intrinsic","invert","italic","justify","kannada","katakana","katakana-iroha","keep-all","khmer","landscape","lao","large","larger","left","level","lighter","line-through","linear","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","single","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","x-large","x-small","xor","xx-large","xx-small"],m=b(l),n=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],o=b(n),p=c.concat(e).concat(g).concat(i).concat(j).concat(l);a.registerHelper("hintWords","css",p),a.defineMIME("text/css",{mediaTypes:d,mediaFeatures:f,propertyKeywords:h,nonStandardPropertyKeywords:i,colorKeywords:k,valueKeywords:m,fontProperties:o,tokenHooks:{"<":function(a,b){return a.match("!--")?(b.tokenize=r,r(a,b)):!1},"/":function(a,b){return a.eat("*")?(b.tokenize=q,q(a,b)):!1}},name:"css"}),a.defineMIME("text/x-scss",{mediaTypes:d,mediaFeatures:f,propertyKeywords:h,nonStandardPropertyKeywords:i,colorKeywords:k,valueKeywords:m,fontProperties:o,allowNested:!0,tokenHooks:{"/":function(a,b){return a.eat("/")?(a.skipToEnd(),["comment","comment"]):a.eat("*")?(b.tokenize=q,q(a,b)):["operator","operator"]},":":function(a){return a.match(/\s*{/)?[null,"{"]:!1},$:function(a){return a.match(/^[\w-]+/),a.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(a){return a.eat("{")?[null,"interpolation"]:!1}},name:"css",helperType:"scss"}),a.defineMIME("text/x-less",{mediaTypes:d,mediaFeatures:f,propertyKeywords:h,nonStandardPropertyKeywords:i,colorKeywords:k,valueKeywords:m,fontProperties:o,allowNested:!0,tokenHooks:{"/":function(a,b){return a.eat("/")?(a.skipToEnd(),["comment","comment"]):a.eat("*")?(b.tokenize=q,q(a,b)):["operator","operator"]},"@":function(a){return a.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)?!1:(a.eatWhile(/[\w\\\-]/),a.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"})}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";function d(a){for(var d=0;d<a.state.activeLines.length;d++)a.removeLineClass(a.state.activeLines[d],"wrap",b),a.removeLineClass(a.state.activeLines[d],"background",c)}function e(a,b){if(a.length!=b.length)return!1;for(var c=0;c<a.length;c++)if(a[c]!=b[c])return!1;return!0}function f(a,f){for(var g=[],h=0;h<f.length;h++){var i=a.getLineHandleVisualStart(f[h].head.line);g[g.length-1]!=i&&g.push(i)}e(a.state.activeLines,g)||a.operation(function(){d(a);for(var e=0;e<g.length;e++)a.addLineClass(g[e],"wrap",b),a.addLineClass(g[e],"background",c);a.state.activeLines=g})}function g(a,b){f(a,b.ranges)}var b="CodeMirror-activeline",c="CodeMirror-activeline-background";a.defineOption("styleActiveLine",!1,function(b,c,e){var h=e&&e!=a.Init;c&&!h?(b.state.activeLines=[],f(b,b.listSelections()),b.on("beforeSelectionChange",g)):!c&&h&&(b.off("beforeSelectionChange",g),d(b),delete b.state.activeLines)})}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){function e(a,b,e,g){var h=a.getLineHandle(b.line),i=b.ch-1,j=i>=0&&d[h.text.charAt(i)]||d[h.text.charAt(++i)];if(!j)return null;var k=">"==j.charAt(1)?1:-1;if(e&&k>0!=(i==b.ch))return null;var l=a.getTokenTypeAt(c(b.line,i+1)),m=f(a,c(b.line,i+(k>0?1:0)),k,l||null,g);return null==m?null:{from:c(b.line,i),to:m&&m.pos,match:m&&m.ch==j.charAt(0),forward:k>0}}function f(a,b,e,f,g){for(var h=g&&g.maxScanLineLength||1e4,i=g&&g.maxScanLines||1e3,j=[],k=g&&g.bracketRegex?g.bracketRegex:/[(){}[\]]/,l=e>0?Math.min(b.line+i,a.lastLine()+1):Math.max(a.firstLine()-1,b.line-i),m=b.line;m!=l;m+=e){var n=a.getLine(m);if(n){var o=e>0?0:n.length-1,p=e>0?n.length:-1;if(!(n.length>h))for(m==b.line&&(o=b.ch-(0>e?1:0));o!=p;o+=e){var q=n.charAt(o);if(k.test(q)&&(void 0===f||a.getTokenTypeAt(c(m,o+1))==f)){var r=d[q];if(">"==r.charAt(1)==e>0)j.push(q);else{if(!j.length)return{pos:c(m,o),ch:q};j.pop()}}}}}return m-e==(e>0?a.lastLine():a.firstLine())?!1:null}function g(a,d,f){for(var g=a.state.matchBrackets.maxHighlightLineLength||1e3,h=[],i=a.listSelections(),j=0;j<i.length;j++){var k=i[j].empty()&&e(a,i[j].head,!1,f);if(k&&a.getLine(k.from.line).length<=g){var l=k.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";h.push(a.markText(k.from,c(k.from.line,k.from.ch+1),{className:l})),k.to&&a.getLine(k.to.line).length<=g&&h.push(a.markText(k.to,c(k.to.line,k.to.ch+1),{className:l}))}}if(h.length){b&&a.state.focused&&a.display.input.focus();var m=function(){a.operation(function(){for(var a=0;a<h.length;a++)h[a].clear()})};if(!d)return m;setTimeout(m,800)}}function i(a){a.operation(function(){h&&(h(),h=null),h=g(a,!1,a.state.matchBrackets)})}var b=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),c=a.Pos,d={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},h=null;a.defineOption("matchBrackets",!1,function(b,c,d){d&&d!=a.Init&&b.off("cursorActivity",i),c&&(b.state.matchBrackets="object"==typeof c?c:{},b.on("cursorActivity",i))}),a.defineExtension("matchBrackets",function(){g(this,!0)}),a.defineExtension("findMatchingBracket",function(a,b,c){return e(this,a,b,c)}),a.defineExtension("scanForBracket",function(a,b,c,d){return f(this,a,b,c,d)})});
1
+ !function(a){if("object"==typeof exports&&"object"==typeof module)module.exports=a();else{if("function"==typeof define&&define.amd)return define([],a);this.CodeMirror=a()}}(function(){"use strict";function z(a,c){if(!(this instanceof z))return new z(a,c);this.options=c=c||{},Fg($d,c,!1),N(c);var d=c.value;"string"==typeof d&&(d=new zf(d,c.mode)),this.doc=d;var e=this.display=new A(a,d);e.wrapper.CodeMirror=this,J(this),H(this),c.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),c.autofocus&&!r&&Rc(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new vg},b&&setTimeout(Gg(Qc,this,!0),20),Uc(this);var f=this;Ac(this,function(){f.curOp.forceUpdate=!0,Df(f,d),c.autofocus&&!r||Rg()==e.input?setTimeout(Gg(vd,f),20):wd(f);for(var a in _d)_d.hasOwnProperty(a)&&_d[a](f,c[a],be);for(var b=0;b<fe.length;++b)fe[b](f)})}function A(a,b){var d=this,e=d.input=Mg("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none");h?e.style.width="1000px":e.setAttribute("wrap","off"),q&&(e.style.border="1px solid black"),e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck","false"),d.inputDiv=Mg("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),d.scrollbarH=Mg("div",[Mg("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar"),d.scrollbarV=Mg("div",[Mg("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),d.scrollbarFiller=Mg("div",null,"CodeMirror-scrollbar-filler"),d.gutterFiller=Mg("div",null,"CodeMirror-gutter-filler"),d.lineDiv=Mg("div",null,"CodeMirror-code"),d.selectionDiv=Mg("div",null,null,"position: relative; z-index: 1"),d.cursorDiv=Mg("div",null,"CodeMirror-cursors"),d.measure=Mg("div",null,"CodeMirror-measure"),d.lineMeasure=Mg("div",null,"CodeMirror-measure"),d.lineSpace=Mg("div",[d.measure,d.lineMeasure,d.selectionDiv,d.cursorDiv,d.lineDiv],null,"position: relative; outline: none"),d.mover=Mg("div",[Mg("div",[d.lineSpace],"CodeMirror-lines")],null,"position: relative"),d.sizer=Mg("div",[d.mover],"CodeMirror-sizer"),d.heightForcer=Mg("div",null,null,"position: absolute; height: "+qg+"px; width: 1px;"),d.gutters=Mg("div",null,"CodeMirror-gutters"),d.lineGutter=null,d.scroller=Mg("div",[d.sizer,d.heightForcer,d.gutters],"CodeMirror-scroll"),d.scroller.setAttribute("tabIndex","-1"),d.wrapper=Mg("div",[d.inputDiv,d.scrollbarH,d.scrollbarV,d.scrollbarFiller,d.gutterFiller,d.scroller],"CodeMirror"),c&&(d.gutters.style.zIndex=-1,d.scroller.style.paddingRight=0),q&&(e.style.width="0px"),h||(d.scroller.draggable=!0),m&&(d.inputDiv.style.height="1px",d.inputDiv.style.position="absolute"),c&&(d.scrollbarH.style.minHeight=d.scrollbarV.style.minWidth="18px"),a.appendChild?a.appendChild(d.wrapper):a(d.wrapper),d.viewFrom=d.viewTo=b.first,d.view=[],d.externalMeasured=null,d.viewOffset=0,d.lastSizeC=0,d.updateLineNumbers=null,d.lineNumWidth=d.lineNumInnerWidth=d.lineNumChars=null,d.prevInput="",d.alignWidgets=!1,d.pollingFast=!1,d.poll=new vg,d.cachedCharWidth=d.cachedTextHeight=d.cachedPaddingH=null,d.inaccurateSelection=!1,d.maxLine=null,d.maxLineLength=0,d.maxLineChanged=!1,d.wheelDX=d.wheelDY=d.wheelStartX=d.wheelStartY=null,d.shift=!1}function B(a){a.doc.mode=z.getMode(a.options,a.doc.modeOption),C(a)}function C(a){a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null)}),a.doc.frontier=a.doc.first,Tb(a,100),a.state.modeGen++,a.curOp&&Gc(a)}function D(a){a.options.lineWrapping?(Ug(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth=""):(Tg(a.display.wrapper,"CodeMirror-wrap"),M(a)),F(a),Gc(a),jc(a),setTimeout(function(){P(a)},100)}function E(a){var b=vc(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/wc(a.display)-3);return function(e){if(Ve(a.doc,e))return 0;var f=0;if(e.widgets)for(var g=0;g<e.widgets.length;g++)e.widgets[g].height&&(f+=e.widgets[g].height);return c?f+(Math.ceil(e.text.length/d)||1)*b:f+b}}function F(a){var b=a.doc,c=E(a);b.iter(function(a){var b=c(a);b!=a.height&&Hf(a,b)})}function G(a){var b=ke[a.options.keyMap],c=b.style;a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(c?" cm-keymap-"+c:"")}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-"),jc(a)}function I(a){J(a),Gc(a),setTimeout(function(){R(a)},20)}function J(a){var b=a.display.gutters,c=a.options.gutters;Og(b);for(var d=0;d<c.length;++d){var e=c[d],f=b.appendChild(Mg("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",K(a)}function K(a){var b=a.display.gutters.offsetWidth;a.display.sizer.style.marginLeft=b+"px",a.display.scrollbarH.style.left=a.options.fixedGutter?b+"px":0}function L(a){if(0==a.height)return 0;for(var c,b=a.text.length,d=a;c=Oe(d);){var e=c.find(0,!0);d=e.from.line,b+=e.from.ch-e.to.ch}for(d=a;c=Pe(d);){var e=c.find(0,!0);b-=d.text.length-e.from.ch,d=e.to.line,b+=d.text.length-e.to.ch}return b}function M(a){var b=a.display,c=a.doc;b.maxLine=Ef(c,c.first),b.maxLineLength=L(b.maxLine),b.maxLineChanged=!0,c.iter(function(a){var c=L(a);c>b.maxLineLength&&(b.maxLineLength=c,b.maxLine=a)})}function N(a){var b=Cg(a.gutters,"CodeMirror-linenumbers");-1==b&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]):b>-1&&!a.lineNumbers&&(a.gutters=a.gutters.slice(0),a.gutters.splice(b,1))}function O(a){var b=a.display.scroller;return{clientHeight:b.clientHeight,barHeight:a.display.scrollbarV.clientHeight,scrollWidth:b.scrollWidth,clientWidth:b.clientWidth,barWidth:a.display.scrollbarH.clientWidth,docHeight:Math.round(a.doc.height+Yb(a.display))}}function P(a,b){b||(b=O(a));var c=a.display,d=b.docHeight+qg,e=b.scrollWidth>b.clientWidth,f=d>b.clientHeight;if(f?(c.scrollbarV.style.display="block",c.scrollbarV.style.bottom=e?Yg(c.measure)+"px":"0",c.scrollbarV.firstChild.style.height=Math.max(0,d-b.clientHeight+(b.barHeight||c.scrollbarV.clientHeight))+"px"):(c.scrollbarV.style.display="",c.scrollbarV.firstChild.style.height="0"),e?(c.scrollbarH.style.display="block",c.scrollbarH.style.right=f?Yg(c.measure)+"px":"0",c.scrollbarH.firstChild.style.width=b.scrollWidth-b.clientWidth+(b.barWidth||c.scrollbarH.clientWidth)+"px"):(c.scrollbarH.style.display="",c.scrollbarH.firstChild.style.width="0"),e&&f?(c.scrollbarFiller.style.display="block",c.scrollbarFiller.style.height=c.scrollbarFiller.style.width=Yg(c.measure)+"px"):c.scrollbarFiller.style.display="",e&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(c.gutterFiller.style.display="block",c.gutterFiller.style.height=Yg(c.measure)+"px",c.gutterFiller.style.width=c.gutters.offsetWidth+"px"):c.gutterFiller.style.display="",n&&0===Yg(c.measure)){c.scrollbarV.style.minWidth=c.scrollbarH.style.minHeight=o?"18px":"12px";var g=function(b){dg(b)!=c.scrollbarV&&dg(b)!=c.scrollbarH&&Bc(a,Xc)(b)};fg(c.scrollbarV,"mousedown",g),fg(c.scrollbarH,"mousedown",g)}}function Q(a,b,c){var d=c&&null!=c.top?c.top:a.scroller.scrollTop;d=Math.floor(d-Xb(a));var e=c&&null!=c.bottom?c.bottom:d+a.wrapper.clientHeight,f=Jf(b,d),g=Jf(b,e);if(c&&c.ensure){var h=c.ensure.from.line,i=c.ensure.to.line;if(f>h)return{from:h,to:Jf(b,Kf(Ef(b,h))+a.wrapper.clientHeight)};if(Math.min(i,b.lastLine())>=g)return{from:Jf(b,Kf(Ef(b,i))-a.wrapper.clientHeight),to:i}}return{from:f,to:g}}function R(a){var b=a.display,c=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=U(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,f=d+"px",g=0;g<c.length;g++)if(!c[g].hidden){a.options.fixedGutter&&c[g].gutter&&(c[g].gutter.style.left=f);var h=c[g].alignable;if(h)for(var i=0;i<h.length;i++)h[i].style.left=f}a.options.fixedGutter&&(b.gutters.style.left=d+e+"px")}}function S(a){if(!a.options.lineNumbers)return!1;var b=a.doc,c=T(a.options,b.first+b.size-1),d=a.display;if(c.length!=d.lineNumChars){var e=d.measure.appendChild(Mg("div",[Mg("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",K(a),!0}return!1}function T(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function U(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function V(a,b,c){for(var f,d=a.display.viewFrom,e=a.display.viewTo,g=Q(a.display,a.doc,b),i=!0;;i=!1){var j=a.display.scroller.clientWidth;if(!W(a,g,c))break;f=!0,a.display.maxLineChanged&&!a.options.lineWrapping&&X(a);var k=O(a);if(Pb(a),Y(a,k),P(a,k),h&&a.options.lineWrapping&&Z(a,k),i&&a.options.lineWrapping&&j!=a.display.scroller.clientWidth)c=!0;else if(c=!1,b&&null!=b.top&&(b={top:Math.min(k.docHeight-qg-k.clientHeight,b.top)}),g=Q(a.display,a.doc,b),g.from>=a.display.viewFrom&&g.to<=a.display.viewTo)break}return a.display.updateLineNumbers=null,f&&(kg(a,"update",a),(a.display.viewFrom!=d||a.display.viewTo!=e)&&kg(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo)),f}function W(a,b,c){var d=a.display,e=a.doc;if(!d.wrapper.offsetWidth)return Ic(a),void 0;if(!(!c&&b.from>=d.viewFrom&&b.to<=d.viewTo&&0==Mc(a))){S(a)&&Ic(a);var f=ab(a),g=e.first+e.size,h=Math.max(b.from-a.options.viewportMargin,e.first),i=Math.min(g,b.to+a.options.viewportMargin);d.viewFrom<h&&h-d.viewFrom<20&&(h=Math.max(e.first,d.viewFrom)),d.viewTo>i&&d.viewTo-i<20&&(i=Math.min(g,d.viewTo)),y&&(h=Te(a.doc,h),i=Ue(a.doc,i));var j=h!=d.viewFrom||i!=d.viewTo||d.lastSizeC!=d.wrapper.clientHeight;Lc(a,h,i),d.viewOffset=Kf(Ef(a.doc,d.viewFrom)),a.display.mover.style.top=d.viewOffset+"px";var k=Mc(a);if(j||0!=k||c){var l=Rg();return k>4&&(d.lineDiv.style.display="none"),bb(a,d.updateLineNumbers,f),k>4&&(d.lineDiv.style.display=""),l&&Rg()!=l&&l.offsetHeight&&l.focus(),Og(d.cursorDiv),Og(d.selectionDiv),j&&(d.lastSizeC=d.wrapper.clientHeight,Tb(a,400)),$(a),!0}}}function X(a){var b=a.display,c=bc(a,b.maxLine,b.maxLine.text.length).left;b.maxLineChanged=!1;var d=Math.max(0,c+3),e=Math.max(0,b.sizer.offsetLeft+d+qg-b.scroller.clientWidth);b.sizer.style.minWidth=d+"px",e<a.doc.scrollLeft&&hd(a,Math.min(b.scroller.scrollLeft,e),!0)}function Y(a,b){a.display.sizer.style.minHeight=a.display.heightForcer.style.top=b.docHeight+"px",a.display.gutters.style.height=Math.max(b.docHeight,b.clientHeight-qg)+"px"}function Z(a,b){a.display.sizer.offsetWidth+a.display.gutters.offsetWidth<a.display.scroller.clientWidth-1&&(a.display.sizer.style.minHeight=a.display.heightForcer.style.top="0px",a.display.gutters.style.height=b.docHeight+"px")}function $(a){for(var b=a.display,d=b.lineDiv.offsetTop,e=0;e<b.view.length;e++){var g,f=b.view[e];if(!f.hidden){if(c){var h=f.node.offsetTop+f.node.offsetHeight;g=h-d,d=h}else{var i=f.node.getBoundingClientRect();g=i.bottom-i.top}var j=f.line.height-g;if(2>g&&(g=vc(b)),(j>.001||-.001>j)&&(Hf(f.line,g),_(f.line),f.rest))for(var k=0;k<f.rest.length;k++)_(f.rest[k])}}}function _(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b)a.widgets[b].height=a.widgets[b].node.offsetHeight}function ab(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:U(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function bb(a,b,c){function i(b){var c=b.nextSibling;return h&&s&&a.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b),c}for(var d=a.display,e=a.options.lineNumbers,f=d.lineDiv,g=f.firstChild,j=d.view,k=d.viewFrom,l=0;l<j.length;l++){var m=j[l];if(m.hidden);else if(m.node){for(;g!=m.node;)g=i(g);var o=e&&null!=b&&k>=b&&m.lineNumber;m.changes&&(Cg(m.changes,"gutter")>-1&&(o=!1),cb(a,m,k,c)),o&&(Og(m.lineNumber),m.lineNumber.appendChild(document.createTextNode(T(a.options,k)))),g=m.node.nextSibling}else{var n=kb(a,m,k,c);f.insertBefore(n,g)}k+=m.size}for(;g;)g=i(g)}function cb(a,b,c,d){for(var e=0;e<b.changes.length;e++){var f=b.changes[e];"text"==f?gb(a,b):"gutter"==f?ib(a,b,c,d):"class"==f?hb(b):"widget"==f&&jb(b,d)}b.changes=null}function db(a){return a.node==a.text&&(a.node=Mg("div",null,null,"position: relative"),a.text.parentNode&&a.text.parentNode.replaceChild(a.node,a.text),a.node.appendChild(a.text),c&&(a.node.style.zIndex=2)),a.node}function eb(a){var b=a.bgClass?a.bgClass+" "+(a.line.bgClass||""):a.line.bgClass;if(b&&(b+=" CodeMirror-linebackground"),a.background)b?a.background.className=b:(a.background.parentNode.removeChild(a.background),a.background=null);else if(b){var c=db(a);a.background=c.insertBefore(Mg("div",null,b),c.firstChild)}}function fb(a,b){var c=a.display.externalMeasured;return c&&c.line==b.line?(a.display.externalMeasured=null,b.measure=c.measure,c.built):nf(a,b)}function gb(a,b){var c=b.text.className,d=fb(a,b);b.text==b.node&&(b.node=d.pre),b.text.parentNode.replaceChild(d.pre,b.text),b.text=d.pre,d.bgClass!=b.bgClass||d.textClass!=b.textClass?(b.bgClass=d.bgClass,b.textClass=d.textClass,hb(b)):c&&(b.text.className=c)}function hb(a){eb(a),a.line.wrapClass?db(a).className=a.line.wrapClass:a.node!=a.text&&(a.node.className="");var b=a.textClass?a.textClass+" "+(a.line.textClass||""):a.line.textClass;a.text.className=b||""}function ib(a,b,c,d){b.gutter&&(b.node.removeChild(b.gutter),b.gutter=null);var e=b.line.gutterMarkers;if(a.options.lineNumbers||e){var f=db(b),g=b.gutter=f.insertBefore(Mg("div",null,"CodeMirror-gutter-wrapper","position: absolute; left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px"),b.text);if(!a.options.lineNumbers||e&&e["CodeMirror-linenumbers"]||(b.lineNumber=g.appendChild(Mg("div",T(a.options,c),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+d.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+a.display.lineNumInnerWidth+"px"))),e)for(var h=0;h<a.options.gutters.length;++h){var i=a.options.gutters[h],j=e.hasOwnProperty(i)&&e[i];j&&g.appendChild(Mg("div",[j],"CodeMirror-gutter-elt","left: "+d.gutterLeft[i]+"px; width: "+d.gutterWidth[i]+"px"))}}}function jb(a,b){a.alignable&&(a.alignable=null);for(var d,c=a.node.firstChild;c;c=d){var d=c.nextSibling;"CodeMirror-linewidget"==c.className&&a.node.removeChild(c)}lb(a,b)}function kb(a,b,c,d){var e=fb(a,b);return b.text=b.node=e.pre,e.bgClass&&(b.bgClass=e.bgClass),e.textClass&&(b.textClass=e.textClass),hb(b),ib(a,b,c,d),lb(b,d),b.node}function lb(a,b){if(mb(a.line,a,b,!0),a.rest)for(var c=0;c<a.rest.length;c++)mb(a.rest[c],a,b,!1)}function mb(a,b,c,d){if(a.widgets)for(var e=db(b),f=0,g=a.widgets;f<g.length;++f){var h=g[f],i=Mg("div",[h.node],"CodeMirror-linewidget");h.handleMouseEvents||(i.ignoreEvents=!0),nb(h,i,b,c),d&&h.above?e.insertBefore(i,b.gutter||b.text):e.appendChild(i),kg(h,"redraw")}}function nb(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 qb(a){return ob(a.line,a.ch)}function rb(a,b){return pb(a,b)<0?b:a}function sb(a,b){return pb(a,b)<0?a:b}function tb(a,b){this.ranges=a,this.primIndex=b}function ub(a,b){this.anchor=a,this.head=b}function vb(a,b){var c=a[b];a.sort(function(a,b){return pb(a.from(),b.from())}),b=Cg(a,c);for(var d=1;d<a.length;d++){var e=a[d],f=a[d-1];if(pb(f.to(),e.from())>=0){var g=sb(f.from(),e.from()),h=rb(f.to(),e.to()),i=f.empty()?e.from()==e.head:f.from()==f.head;b>=d&&--b,a.splice(--d,2,new ub(i?h:g,i?g:h))}}return new tb(a,b)}function wb(a,b){return new tb([new ub(a,b||a)],0)}function xb(a,b){return Math.max(a.first,Math.min(b,a.first+a.size-1))}function yb(a,b){if(b.line<a.first)return ob(a.first,0);var c=a.first+a.size-1;return b.line>c?ob(c,Ef(a,c).text.length):zb(b,Ef(a,b.line).text.length)}function zb(a,b){var c=a.ch;return null==c||c>b?ob(a.line,b):0>c?ob(a.line,0):a}function Ab(a,b){return b>=a.first&&b<a.first+a.size}function Bb(a,b){for(var c=[],d=0;d<b.length;d++)c[d]=yb(a,b[d]);return c}function Cb(a,b,c,d){if(a.cm&&a.cm.display.shift||a.extend){var e=b.anchor;if(d){var f=pb(c,e)<0;f!=pb(d,e)<0?(e=c,c=d):f!=pb(c,d)<0&&(c=d)}return new ub(e,c)}return new ub(d||c,c)}function Db(a,b,c,d){Jb(a,new tb([Cb(a,a.sel.primary(),b,c)],0),d)}function Eb(a,b,c){for(var d=[],e=0;e<a.sel.ranges.length;e++)d[e]=Cb(a,a.sel.ranges[e],b[e],null);var f=vb(d,a.sel.primIndex);Jb(a,f,c)}function Fb(a,b,c,d){var e=a.sel.ranges.slice(0);e[b]=c,Jb(a,vb(e,a.sel.primIndex),d)}function Gb(a,b,c,d){Jb(a,wb(b,c),d)}function Hb(a,b){var c={ranges:b.ranges,update:function(b){this.ranges=[];for(var c=0;c<b.length;c++)this.ranges[c]=new ub(yb(a,b[c].anchor),yb(a,b[c].head))}};return hg(a,"beforeSelectionChange",a,c),a.cm&&hg(a.cm,"beforeSelectionChange",a.cm,c),c.ranges!=b.ranges?vb(c.ranges,c.ranges.length-1):b}function Ib(a,b,c){var d=a.history.done,e=Ag(d);e&&e.ranges?(d[d.length-1]=b,Kb(a,b,c)):Jb(a,b,c)}function Jb(a,b,c){Kb(a,b,c),Sf(a,a.sel,a.cm?a.cm.curOp.id:0/0,c)}function Kb(a,b,c){(og(a,"beforeSelectionChange")||a.cm&&og(a.cm,"beforeSelectionChange"))&&(b=Hb(a,b));var d=pb(b.primary().head,a.sel.primary().head)<0?-1:1;Lb(a,Nb(a,b,d,!0)),c&&c.scroll===!1||!a.cm||Sd(a.cm)}function Lb(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=!0,ng(a.cm)),kg(a,"cursorActivity",a))}function Mb(a){Lb(a,Nb(a,a.sel,null,!1),sg)}function Nb(a,b,c,d){for(var e,f=0;f<b.ranges.length;f++){var g=b.ranges[f],h=Ob(a,g.anchor,c,d),i=Ob(a,g.head,c,d);(e||h!=g.anchor||i!=g.head)&&(e||(e=b.ranges.slice(0,f)),e[f]=new ub(h,i))}return e?vb(e,b.primIndex):b}function Ob(a,b,c,d){var e=!1,f=b,g=c||1;a.cantEdit=!1;a:for(;;){var h=Ef(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&&(hg(k,"beforeCursorEnter"),k.explicitlyCleared)){if(h.markedSpans){--i;continue}break}if(!k.atomic)continue;var l=k.find(0>g?-1:1);if(0==pb(l,f)&&(l.ch+=g,l.ch<0?l=l.line>a.first?yb(a,ob(l.line-1)):null:l.ch>h.text.length&&(l=l.line<a.first+a.size-1?ob(l.line+1,0):null),!l)){if(e)return d?(a.cantEdit=!0,ob(a.first,0)):Ob(a,b,c,!0);e=!0,l=b,g=-g}f=l;continue a}}return f}}function Pb(a){for(var b=a.display,c=a.doc,d=document.createDocumentFragment(),e=document.createDocumentFragment(),f=0;f<c.sel.ranges.length;f++){var g=c.sel.ranges[f],h=g.empty();(h||a.options.showCursorWhenSelecting)&&Qb(a,g,d),h||Rb(a,g,e)}if(a.options.moveInputWithCursor){var i=pc(a,c.sel.primary().head,"div"),j=b.wrapper.getBoundingClientRect(),k=b.lineDiv.getBoundingClientRect(),l=Math.max(0,Math.min(b.wrapper.clientHeight-10,i.top+k.top-j.top)),m=Math.max(0,Math.min(b.wrapper.clientWidth-10,i.left+k.left-j.left));b.inputDiv.style.top=l+"px",b.inputDiv.style.left=m+"px"}Pg(b.cursorDiv,d),Pg(b.selectionDiv,e)}function Qb(a,b,c){var d=pc(a,b.head,"div"),e=c.appendChild(Mg("div","\xa0","CodeMirror-cursor"));if(e.style.left=d.left+"px",e.style.top=d.top+"px",e.style.height=Math.max(0,d.bottom-d.top)*a.options.cursorHeight+"px",d.other){var f=c.appendChild(Mg("div","\xa0","CodeMirror-cursor CodeMirror-secondarycursor"));f.style.display="",f.style.left=d.other.left+"px",f.style.top=d.other.top+"px",f.style.height=.85*(d.other.bottom-d.other.top)+"px"}}function Rb(a,b,c){function j(a,b,c,d){0>b&&(b=0),b=Math.round(b),d=Math.round(d),f.appendChild(Mg("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px; top: "+b+"px; width: "+(null==c?i-a:c)+"px; height: "+(d-b)+"px"))}function k(b,c,d){function m(c,d){return oc(a,ob(b,c),"div",f,d)}var k,l,f=Ef(e,b),g=f.text.length;return fh(Lf(f),c||0,null==d?g:d,function(a,b,e){var n,o,p,f=m(a,"left");if(a==b)n=f,o=p=f.left;else{if(n=m(b-1,"right"),"rtl"==e){var q=f;f=n,n=q}o=f.left,p=n.right}null==c&&0==a&&(o=h),n.top-f.top>3&&(j(o,f.top,null,f.bottom),o=h,f.bottom<n.top&&j(o,f.bottom,null,n.top)),null==d&&b==g&&(p=i),(!k||f.top<k.top||f.top==k.top&&f.left<k.left)&&(k=f),(!l||n.bottom>l.bottom||n.bottom==l.bottom&&n.right>l.right)&&(l=n),h+1>o&&(o=h),j(o,n.top,p-o,n.bottom)}),{start:k,end:l}}var d=a.display,e=a.doc,f=document.createDocumentFragment(),g=Zb(a.display),h=g.left,i=d.lineSpace.offsetWidth-g.right,l=b.from(),m=b.to();if(l.line==m.line)k(l.line,l.ch,m.ch);else{var n=Ef(e,l.line),o=Ef(e,m.line),p=Re(n)==Re(o),q=k(l.line,l.ch,p?n.text.length+1:null).end,r=k(m.line,p?0:null,m.ch).start;p&&(q.top<r.top-2?(j(q.right,q.top,null,q.bottom),j(h,r.top,r.left,r.bottom)):j(q.right,q.top,r.left-q.right,q.bottom)),q.bottom<r.top&&j(h,q.bottom,null,r.top)}c.appendChild(f)}function Sb(a){if(a.state.focused){var b=a.display;clearInterval(b.blinker);var c=!0;b.cursorDiv.style.visibility="",a.options.cursorBlinkRate>0&&(b.blinker=setInterval(function(){b.cursorDiv.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate))}}function Tb(a,b){a.doc.mode.startState&&a.doc.frontier<a.display.viewTo&&a.state.highlight.set(b,Gg(Ub,a))}function Ub(a){var b=a.doc;if(b.frontier<b.first&&(b.frontier=b.first),!(b.frontier>=a.display.viewTo)){var c=+new Date+a.options.workTime,d=he(b.mode,Wb(a,b.frontier));Ac(a,function(){b.iter(b.frontier,Math.min(b.first+b.size,a.display.viewTo+500),function(e){if(b.frontier>=a.display.viewFrom){var f=e.styles,g=gf(a,e,d,!0);e.styles=g.styles,g.classes?e.styleClasses=g.classes:e.styleClasses&&(e.styleClasses=null);for(var h=!f||f.length!=e.styles.length,i=0;!h&&i<f.length;++i)h=f[i]!=e.styles[i];h&&Hc(a,b.frontier,"text"),e.stateAfter=he(b.mode,d)}else jf(a,e.text,d),e.stateAfter=0==b.frontier%5?he(b.mode,d):null;return++b.frontier,+new Date>c?(Tb(a,a.options.workDelay),!0):void 0})})}}function Vb(a,b,c){for(var d,e,f=a.doc,g=c?-1:b-(a.doc.mode.innerMode?1e3:100),h=b;h>g;--h){if(h<=f.first)return f.first;var i=Ef(f,h-1);if(i.stateAfter&&(!c||h<=f.frontier))return h;var j=wg(i.text,null,a.options.tabSize);(null==e||d>j)&&(e=h-1,d=j)}return e}function Wb(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return!0;var f=Vb(a,b,c),g=f>d.first&&Ef(d,f-1).stateAfter;return g=g?he(d.mode,g):ie(d.mode),d.iter(f,b,function(c){jf(a,c.text,g);var h=f==b-1||0==f%5||f>=e.viewFrom&&f<e.viewTo;c.stateAfter=h?he(d.mode,g):null,++f}),c&&(d.frontier=f),g}function Xb(a){return a.lineSpace.offsetTop}function Yb(a){return a.mover.offsetHeight-a.lineSpace.offsetHeight}function Zb(a){if(a.cachedPaddingH)return a.cachedPaddingH;var b=Pg(a.measure,Mg("pre","x")),c=window.getComputedStyle?window.getComputedStyle(b):b.currentStyle,d={left:parseInt(c.paddingLeft),right:parseInt(c.paddingRight)};return isNaN(d.left)||isNaN(d.right)||(a.cachedPaddingH=d),d}function $b(a,b,c){var d=a.options.lineWrapping,e=d&&a.display.scroller.clientWidth;if(!b.measure.heights||d&&b.measure.width!=e){var f=b.measure.heights=[];if(d){b.measure.width=e;for(var g=b.text.firstChild.getClientRects(),h=0;h<g.length-1;h++){var i=g[h],j=g[h+1];Math.abs(i.bottom-j.bottom)>2&&f.push((i.bottom+j.top)/2-c.top)}}f.push(c.bottom-c.top)}}function _b(a,b,c){if(a.line==b)return{map:a.measure.map,cache:a.measure.cache};for(var d=0;d<a.rest.length;d++)if(a.rest[d]==b)return{map:a.measure.maps[d],cache:a.measure.caches[d]};for(var d=0;d<a.rest.length;d++)if(If(a.rest[d])>c)return{map:a.measure.maps[d],cache:a.measure.caches[d],before:!0}}function ac(a,b){b=Re(b);var c=If(b),d=a.display.externalMeasured=new Ec(a.doc,b,c);d.lineN=c;var e=d.built=nf(a,d);return d.text=e.pre,Pg(a.display.lineMeasure,e.pre),d}function bc(a,b,c,d){return ec(a,dc(a,b),c,d)}function cc(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo)return a.display.view[Jc(a,b)];var c=a.display.externalMeasured;return c&&b>=c.lineN&&b<c.lineN+c.size?c:void 0}function dc(a,b){var c=If(b),d=cc(a,c);d&&!d.text?d=null:d&&d.changes&&cb(a,d,c,ab(a)),d||(d=ac(a,b));var e=_b(d,b,c);return{line:b,view:d,rect:null,map:e.map,cache:e.cache,before:e.before,hasHeights:!1}}function ec(a,b,c,d){b.before&&(c=-1);var f,e=c+(d||"");return b.cache.hasOwnProperty(e)?f=b.cache[e]:(b.rect||(b.rect=b.view.text.getBoundingClientRect()),b.hasHeights||($b(a,b.view,b.rect),b.hasHeights=!0),f=gc(a,b,c,d),f.bogus||(b.cache[e]=f)),{left:f.left,right:f.right,top:f.top,bottom:f.bottom}}function gc(a,b,c,e){for(var h,i,j,k,f=b.map,l=0;l<f.length;l+=3){var m=f[l],n=f[l+1];if(m>c?(i=0,j=1,k="left"):n>c?(i=c-m,j=i+1):(l==f.length-3||c==n&&f[l+3]>c)&&(j=n-m,i=j-1,c>=n&&(k="right")),null!=i){if(h=f[l+2],m==n&&e==(h.insertLeft?"left":"right")&&(k=e),"left"==e&&0==i)for(;l&&f[l-2]==f[l-3]&&f[l-1].insertLeft;)h=f[(l-=3)+2],k="left";if("right"==e&&i==n-m)for(;l<f.length-3&&f[l+3]==f[l+4]&&!f[l+5].insertLeft;)h=f[(l+=3)+2],k="right";break}}var o;if(3==h.nodeType){for(;i&&Lg(b.line.text.charAt(m+i));)--i;for(;n>m+j&&Lg(b.line.text.charAt(m+j));)++j;if(d&&0==i&&j==n-m)o=h.parentNode.getBoundingClientRect();else if(g&&a.options.lineWrapping){var p=Ng(h,i,j).getClientRects();o=p.length?p["right"==e?p.length-1:0]:fc}else o=Ng(h,i,j).getBoundingClientRect()}else{i>0&&(k=e="right");var p;o=a.options.lineWrapping&&(p=h.getClientRects()).length>1?p["right"==e?p.length-1:0]:h.getBoundingClientRect()}if(d&&!i&&(!o||!o.left&&!o.right)){var q=h.parentNode.getClientRects()[0];o=q?{left:q.left,right:q.left+wc(a.display),top:q.top,bottom:q.bottom}:fc}for(var r,s=(o.bottom+o.top)/2-b.rect.top,t=b.view.measure.heights,l=0;l<t.length-1&&!(s<t[l]);l++);r=l?t[l-1]:0,s=t[l];var u={left:("right"==k?o.right:o.left)-b.rect.left,right:("left"==k?o.left:o.right)-b.rect.left,top:r,bottom:s};return o.left||o.right||(u.bogus=!0),u}function hc(a){if(a.measure&&(a.measure.cache={},a.measure.heights=null,a.rest))for(var b=0;b<a.rest.length;b++)a.measure.caches[b]={}}function ic(a){a.display.externalMeasure=null,Og(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++)hc(a.display.view[b])}function jc(a){ic(a),a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH=null,a.options.lineWrapping||(a.display.maxLineChanged=!0),a.display.lineNumChars=null}function kc(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function lc(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function mc(a,b,c,d){if(b.widgets)for(var e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f=Ze(b.widgets[e]);c.top+=f,c.bottom+=f}if("line"==d)return c;d||(d="local");var g=Kf(b);if("local"==d?g+=Xb(a.display):g-=a.display.viewOffset,"page"==d||"window"==d){var h=a.display.lineSpace.getBoundingClientRect();g+=h.top+("window"==d?0:lc());var i=h.left+("window"==d?0:kc());c.left+=i,c.right+=i}return c.top+=g,c.bottom+=g,c}function nc(a,b,c){if("div"==c)return b;var d=b.left,e=b.top;if("page"==c)d-=kc(),e-=lc();else if("local"==c||!c){var f=a.display.sizer.getBoundingClientRect();d+=f.left,e+=f.top}var g=a.display.lineSpace.getBoundingClientRect();return{left:d-g.left,top:e-g.top}}function oc(a,b,c,d,e){return d||(d=Ef(a.doc,b.line)),mc(a,d,bc(a,d,b.ch,e),c)}function pc(a,b,c,d,e){function f(b,f){var g=ec(a,e,b,f?"right":"left");return f?g.left=g.right:g.right=g.left,mc(a,d,g,c)}function g(a,b){var c=h[b],d=c.level%2;return a==gh(c)&&b&&c.level<h[b-1].level?(c=h[--b],a=hh(c)-(c.level%2?0:1),d=!0):a==hh(c)&&b<h.length-1&&c.level<h[b+1].level&&(c=h[++b],a=gh(c)-c.level%2,d=!1),d&&a==c.to&&a>c.from?f(a-1):f(a,d)}d=d||Ef(a.doc,b.line),e||(e=dc(a,d));var h=Lf(d),i=b.ch;if(!h)return f(i);var j=oh(h,i),k=g(i,j);return null!=nh&&(k.other=g(i,nh)),k}function qc(a,b){var c=0,b=yb(a.doc,b);a.options.lineWrapping||(c=wc(a.display)*b.ch);var d=Ef(a.doc,b.line),e=Kf(d)+Xb(a.display);return{left:c,right:c,top:e,bottom:e+d.height}}function rc(a,b,c,d){var e=ob(a,b);return e.xRel=d,c&&(e.outside=!0),e}function sc(a,b,c){var d=a.doc;if(c+=a.display.viewOffset,0>c)return rc(d.first,0,!0,-1);var e=Jf(d,c),f=d.first+d.size-1;if(e>f)return rc(d.first+d.size-1,Ef(d,f).text.length,!0,1);0>b&&(b=0);for(var g=Ef(d,e);;){var h=tc(a,g,e,b,c),i=Pe(g),j=i&&i.find(0,!0);if(!i||!(h.ch>j.from.ch||h.ch==j.from.ch&&h.xRel>0))return h;e=If(g=j.to.line)}}function tc(a,b,c,d,e){function j(d){var e=pc(a,ob(c,d),"line",b,i);return g=!0,f>e.bottom?e.left-h:f<e.top?e.left+h:(g=!1,e.left)}var f=e-Kf(b),g=!1,h=2*a.display.wrapper.clientWidth,i=dc(a,b),k=Lf(b),l=b.text.length,m=ih(b),n=jh(b),o=j(m),p=g,q=j(n),r=g;if(d>q)return rc(c,n,r,1);for(;;){if(k?n==m||n==qh(b,m,1):1>=n-m){for(var s=o>d||q-d>=d-o?m:n,t=d-(s==m?o:q);Lg(b.text.charAt(s));)++s;var u=rc(c,s,s==m?p:r,-1>t?-1:t>1?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=qh(b,w,1)}var y=j(w);y>d?(n=w,q=y,(r=g)&&(q+=1e3),l=v):(m=w,o=y,p=g,l-=v)}}function vc(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==uc){uc=Mg("pre");for(var b=0;49>b;++b)uc.appendChild(document.createTextNode("x")),uc.appendChild(Mg("br"));uc.appendChild(document.createTextNode("x"))}Pg(a.measure,uc);var c=uc.offsetHeight/50;return c>3&&(a.cachedTextHeight=c),Og(a.measure),c||1}function wc(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=Mg("span","xxxxxxxxxx"),c=Mg("pre",[b]);Pg(a.measure,c);var d=b.getBoundingClientRect(),e=(d.right-d.left)/10;return e>2&&(a.cachedCharWidth=e),e||10}function yc(a){a.curOp={viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,id:++xc},jg++||(ig=[])}function zc(a){var b=a.curOp,c=a.doc,d=a.display;if(a.curOp=null,b.updateMaxLine&&M(a),b.viewChanged||b.forceUpdate||null!=b.scrollTop||b.scrollToPos&&(b.scrollToPos.from.line<d.viewFrom||b.scrollToPos.to.line>=d.viewTo)||d.maxLineChanged&&a.options.lineWrapping){var e=V(a,{top:b.scrollTop,ensure:b.scrollToPos},b.forceUpdate);a.display.scroller.offsetHeight&&(a.doc.scrollTop=a.display.scroller.scrollTop)}if(!e&&b.selectionChanged&&Pb(a),e||b.startHeight==a.doc.height||P(a),null!=b.scrollTop&&d.scroller.scrollTop!=b.scrollTop){var f=Math.max(0,Math.min(d.scroller.scrollHeight-d.scroller.clientHeight,b.scrollTop));d.scroller.scrollTop=d.scrollbarV.scrollTop=c.scrollTop=f}if(null!=b.scrollLeft&&d.scroller.scrollLeft!=b.scrollLeft){var g=Math.max(0,Math.min(d.scroller.scrollWidth-d.scroller.clientWidth,b.scrollLeft));d.scroller.scrollLeft=d.scrollbarH.scrollLeft=c.scrollLeft=g,R(a)}if(b.scrollToPos){var h=Od(a,yb(a.doc,b.scrollToPos.from),yb(a.doc,b.scrollToPos.to),b.scrollToPos.margin);b.scrollToPos.isCursor&&a.state.focused&&Nd(a,h)}b.selectionChanged&&Sb(a),a.state.focused&&b.updateInput&&Qc(a,b.typing);var i=b.maybeHiddenMarkers,j=b.maybeUnhiddenMarkers;if(i)for(var k=0;k<i.length;++k)i[k].lines.length||hg(i[k],"hide");if(j)for(var k=0;k<j.length;++k)j[k].lines.length&&hg(j[k],"unhide");var l;if(--jg||(l=ig,ig=null),b.changeObjs&&hg(a,"changes",a,b.changeObjs),l)for(var k=0;k<l.length;++k)l[k]();if(b.cursorActivityHandlers)for(var k=0;k<b.cursorActivityHandlers.length;k++)b.cursorActivityHandlers[k](a)}function Ac(a,b){if(a.curOp)return b();yc(a);try{return b()}finally{zc(a)}}function Bc(a,b){return function(){if(a.curOp)return b.apply(a,arguments);yc(a);try{return b.apply(a,arguments)}finally{zc(a)}}}function Cc(a){return function(){if(this.curOp)return a.apply(this,arguments);yc(this);try{return a.apply(this,arguments)}finally{zc(this)}}}function Dc(a){return function(){var b=this.cm;if(!b||b.curOp)return a.apply(this,arguments);yc(b);try{return a.apply(this,arguments)}finally{zc(b)}}}function Ec(a,b,c){this.line=b,this.rest=Se(b),this.size=this.rest?If(Ag(this.rest))-c+1:1,this.node=this.text=null,this.hidden=Ve(a,b)
2
+ }function Fc(a,b,c){for(var e,d=[],f=b;c>f;f=e){var g=new Ec(a.doc,Ef(a.doc,f),f);e=f+g.size,d.push(g)}return d}function Gc(a,b,c,d){null==b&&(b=a.doc.first),null==c&&(c=a.doc.first+a.doc.size),d||(d=0);var e=a.display;if(d&&c<e.viewTo&&(null==e.updateLineNumbers||e.updateLineNumbers>b)&&(e.updateLineNumbers=b),a.curOp.viewChanged=!0,b>=e.viewTo)y&&Te(a.doc,b)<e.viewTo&&Ic(a);else if(c<=e.viewFrom)y&&Ue(a.doc,c+d)>e.viewFrom?Ic(a):(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)Ic(a);else if(b<=e.viewFrom){var f=Kc(a,c,c+d,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=d):Ic(a)}else if(c>=e.viewTo){var f=Kc(a,b,b,-1);f?(e.view=e.view.slice(0,f.index),e.viewTo=f.lineN):Ic(a)}else{var g=Kc(a,b,b,-1),h=Kc(a,c,c+d,1);g&&h?(e.view=e.view.slice(0,g.index).concat(Fc(a,g.lineN,h.lineN)).concat(e.view.slice(h.index)),e.viewTo+=d):Ic(a)}var i=e.externalMeasured;i&&(c<i.lineN?i.lineN+=d:b<i.lineN+i.size&&(e.externalMeasured=null))}function Hc(a,b,c){a.curOp.viewChanged=!0;var d=a.display,e=a.display.externalMeasured;if(e&&b>=e.lineN&&b<e.lineN+e.size&&(d.externalMeasured=null),!(b<d.viewFrom||b>=d.viewTo)){var f=d.view[Jc(a,b)];if(null!=f.node){var g=f.changes||(f.changes=[]);-1==Cg(g,c)&&g.push(c)}}}function Ic(a){a.display.viewFrom=a.display.viewTo=a.doc.first,a.display.view=[],a.display.viewOffset=0}function Jc(a,b){if(b>=a.display.viewTo)return null;if(b-=a.display.viewFrom,0>b)return null;for(var c=a.display.view,d=0;d<c.length;d++)if(b-=c[d].size,0>b)return d}function Kc(a,b,c,d){var f,e=Jc(a,b),g=a.display.view;if(!y)return{index:e,lineN:c};for(var h=0,i=a.display.viewFrom;e>h;h++)i+=g[h].size;if(i!=b){if(d>0){if(e==g.length-1)return null;f=i+g[e].size-b,e++}else f=i-b;b+=f,c+=f}for(;Te(a.doc,c)!=c;){if(e==(0>d?0:g.length-1))return null;c+=d*g[e-(0>d?1:0)].size,e+=d}return{index:e,lineN:c}}function Lc(a,b,c){var d=a.display,e=d.view;0==e.length||b>=d.viewTo||c<=d.viewFrom?(d.view=Fc(a,b,c),d.viewFrom=b):(d.viewFrom>b?d.view=Fc(a,b,d.viewFrom).concat(d.view):d.viewFrom<b&&(d.view=d.view.slice(Jc(a,b))),d.viewFrom=b,d.viewTo<c?d.view=d.view.concat(Fc(a,d.viewTo,c)):d.viewTo>c&&(d.view=d.view.slice(0,Jc(a,c)))),d.viewTo=c}function Mc(a){for(var b=a.display.view,c=0,d=0;d<b.length;d++){var e=b[d];e.hidden||e.node&&!e.changes||++c}return c}function Nc(a){a.display.pollingFast||a.display.poll.set(a.options.pollInterval,function(){Pc(a),a.state.focused&&Nc(a)})}function Oc(a){function c(){var d=Pc(a);d||b?(a.display.pollingFast=!1,Nc(a)):(b=!0,a.display.poll.set(60,c))}var b=!1;a.display.pollingFast=!0,a.display.poll.set(20,c)}function Pc(a){var b=a.display.input,c=a.display.prevInput,e=a.doc;if(!a.state.focused||ch(b)&&!c||Tc(a)||a.options.disableInput)return!1;a.state.pasteIncoming&&a.state.fakedLastChar&&(b.value=b.value.substring(0,b.value.length-1),a.state.fakedLastChar=!1);var f=b.value;if(f==c&&!a.somethingSelected())return!1;if(g&&!d&&a.display.inputHasSelection===f)return Qc(a),!1;var h=!a.curOp;h&&yc(a),a.display.shift=!1;for(var i=0,j=Math.min(c.length,f.length);j>i&&c.charCodeAt(i)==f.charCodeAt(i);)++i;for(var k=f.slice(i),l=bh(k),m=a.state.pasteIncoming&&l.length>1&&e.sel.ranges.length==l.length,n=e.sel.ranges.length-1;n>=0;n--){var o=e.sel.ranges[n],p=o.from(),q=o.to();i<c.length?p=ob(p.line,p.ch-(c.length-i)):a.state.overwrite&&o.empty()&&!a.state.pasteIncoming&&(q=ob(q.line,Math.min(Ef(e,q.line).text.length,q.ch+Ag(l).length)));var r=a.curOp.updateInput,s={from:p,to:q,text:m?[l[n]]:l,origin:a.state.pasteIncoming?"paste":a.state.cutIncoming?"cut":"+input"};if(Gd(a.doc,s),kg(a,"inputRead",a,s),k&&!a.state.pasteIncoming&&a.options.electricChars&&a.options.smartIndent&&o.head.ch<100&&(!n||e.sel.ranges[n-1].head.line!=o.head.line)){var t=a.getModeAt(o.head);if(t.electricChars){for(var u=0;u<t.electricChars.length;u++)if(k.indexOf(t.electricChars.charAt(u))>-1){Ud(a,o.head.line,"smart");break}}else if(t.electricInput){var v=Ad(s);t.electricInput.test(Ef(e,v.line).text.slice(0,v.ch))&&Ud(a,o.head.line,"smart")}}}return Sd(a),a.curOp.updateInput=r,a.curOp.typing=!0,f.length>1e3||f.indexOf("\n")>-1?b.value=a.display.prevInput="":a.display.prevInput=f,h&&zc(a),a.state.pasteIncoming=a.state.cutIncoming=!1,!0}function Qc(a,b){var c,e,f=a.doc;if(a.somethingSelected()){a.display.prevInput="";var h=f.sel.primary();c=dh&&(h.to().line-h.from().line>100||(e=a.getSelection()).length>1e3);var i=c?"-":e||a.getSelection();a.display.input.value=i,a.state.focused&&Bg(a.display.input),g&&!d&&(a.display.inputHasSelection=i)}else b||(a.display.prevInput=a.display.input.value="",g&&!d&&(a.display.inputHasSelection=null));a.display.inaccurateSelection=c}function Rc(a){"nocursor"==a.options.readOnly||r&&Rg()==a.display.input||a.display.input.focus()}function Sc(a){a.state.focused||(Rc(a),vd(a))}function Tc(a){return a.options.readOnly||a.doc.cantEdit}function Uc(a){function e(){a.state.focused&&setTimeout(Gg(Rc,a),0)}function i(){null==f&&(f=setTimeout(function(){f=null,c.cachedCharWidth=c.cachedTextHeight=c.cachedPaddingH=Xg=null,a.setSize()},100))}function j(){Qg(document.body,c.wrapper)?setTimeout(j,5e3):gg(window,"resize",i)}function k(b){mg(a,b)||cg(b)}function l(b){if(a.somethingSelected())c.inaccurateSelection&&(c.prevInput="",c.inaccurateSelection=!1,c.input.value=a.getSelection(),Bg(c.input));else{for(var d="",e=[],f=0;f<a.doc.sel.ranges.length;f++){var g=a.doc.sel.ranges[f].head.line,h={anchor:ob(g,0),head:ob(g+1,0)};e.push(h),d+=a.getRange(h.anchor,h.head)}"cut"==b.type?a.setSelections(e,null,sg):(c.prevInput="",c.input.value=d,Bg(c.input))}"cut"==b.type&&(a.state.cutIncoming=!0)}var c=a.display;fg(c.scroller,"mousedown",Bc(a,Xc)),b?fg(c.scroller,"dblclick",Bc(a,function(b){if(!mg(a,b)){var c=Wc(a,b);if(c&&!cd(a,b)&&!Vc(a.display,b)){_f(b);var d=Zd(a.doc,c);Db(a.doc,d.anchor,d.head)}}})):fg(c.scroller,"dblclick",function(b){mg(a,b)||_f(b)}),fg(c.lineSpace,"selectstart",function(a){Vc(c,a)||_f(a)}),w||fg(c.scroller,"contextmenu",function(b){yd(a,b)}),fg(c.scroller,"scroll",function(){c.scroller.clientHeight&&(gd(a,c.scroller.scrollTop),hd(a,c.scroller.scrollLeft,!0),hg(a,"scroll",a))}),fg(c.scrollbarV,"scroll",function(){c.scroller.clientHeight&&gd(a,c.scrollbarV.scrollTop)}),fg(c.scrollbarH,"scroll",function(){c.scroller.clientHeight&&hd(a,c.scrollbarH.scrollLeft)}),fg(c.scroller,"mousewheel",function(b){kd(a,b)}),fg(c.scroller,"DOMMouseScroll",function(b){kd(a,b)}),fg(c.scrollbarH,"mousedown",e),fg(c.scrollbarV,"mousedown",e),fg(c.wrapper,"scroll",function(){c.wrapper.scrollTop=c.wrapper.scrollLeft=0});var f;fg(window,"resize",i),setTimeout(j,5e3),fg(c.input,"keyup",Bc(a,td)),fg(c.input,"input",function(){g&&!d&&a.display.inputHasSelection&&(a.display.inputHasSelection=null),Oc(a)}),fg(c.input,"keydown",Bc(a,rd)),fg(c.input,"keypress",Bc(a,ud)),fg(c.input,"focus",Gg(vd,a)),fg(c.input,"blur",Gg(wd,a)),a.options.dragDrop&&(fg(c.scroller,"dragstart",function(b){fd(a,b)}),fg(c.scroller,"dragenter",k),fg(c.scroller,"dragover",k),fg(c.scroller,"drop",Bc(a,ed))),fg(c.scroller,"paste",function(b){Vc(c,b)||(a.state.pasteIncoming=!0,Rc(a),Oc(a))}),fg(c.input,"paste",function(){if(h&&!a.state.fakedLastChar&&!(new Date-a.state.lastMiddleDown<200)){var b=c.input.selectionStart,d=c.input.selectionEnd;c.input.value+="$",c.input.selectionStart=b,c.input.selectionEnd=d,a.state.fakedLastChar=!0}a.state.pasteIncoming=!0,Oc(a)}),fg(c.input,"cut",l),fg(c.input,"copy",l),m&&fg(c.sizer,"mouseup",function(){Rg()==c.input&&c.input.blur(),Rc(a)})}function Vc(a,b){for(var c=dg(b);c!=a.wrapper;c=c.parentNode)if(!c||c.ignoreEvents||c.parentNode==a.sizer&&c!=a.mover)return!0}function Wc(a,b,c,d){var e=a.display;if(!c){var f=dg(b);if(f==e.scrollbarH||f==e.scrollbarV||f==e.scrollbarFiller||f==e.gutterFiller)return null}var g,h,i=e.lineSpace.getBoundingClientRect();try{g=b.clientX-i.left,h=b.clientY-i.top}catch(b){return null}var k,j=sc(a,g,h);if(d&&1==j.xRel&&(k=Ef(a.doc,j.line).text).length==j.ch){var l=wg(k,k.length,a.options.tabSize)-k.length;j=ob(j.line,Math.round((g-Zb(a.display).left)/wc(a.display))-l)}return j}function Xc(a){if(!mg(this,a)){var b=this,c=b.display;if(c.shift=a.shiftKey,Vc(c,a))return h||(c.scroller.draggable=!1,setTimeout(function(){c.scroller.draggable=!0},100)),void 0;if(!cd(b,a)){var d=Wc(b,a);switch(window.focus(),eg(a)){case 1:d?$c(b,a,d):dg(a)==c.scroller&&_f(a);break;case 2:h&&(b.state.lastMiddleDown=+new Date),d&&Db(b.doc,d),setTimeout(Gg(Rc,b),20),_f(a);break;case 3:w&&yd(b,a)}}}}function $c(a,b,c){setTimeout(Gg(Sc,a),0);var e,d=+new Date;Zc&&Zc.time>d-400&&0==pb(Zc.pos,c)?e="triple":Yc&&Yc.time>d-400&&0==pb(Yc.pos,c)?(e="double",Zc={time:d,pos:c}):(e="single",Yc={time:d,pos:c});var f=a.doc.sel,g=s?b.metaKey:b.ctrlKey;a.options.dragDrop&&Wg&&!g&&!Tc(a)&&"single"==e&&f.contains(c)>-1&&f.somethingSelected()?_c(a,b,c):ad(a,b,c,e,g)}function _c(a,c,e){var f=a.display,g=Bc(a,function(i){h&&(f.scroller.draggable=!1),a.state.draggingText=!1,gg(document,"mouseup",g),gg(f.scroller,"drop",g),Math.abs(c.clientX-i.clientX)+Math.abs(c.clientY-i.clientY)<10&&(_f(i),Db(a.doc,e),Rc(a),b&&!d&&setTimeout(function(){document.body.focus(),Rc(a)},20))});h&&(f.scroller.draggable=!0),a.state.draggingText=g,f.scroller.dragDrop&&f.scroller.dragDrop(),fg(document,"mouseup",g),fg(f.scroller,"drop",g)}function ad(a,b,c,d,f){function p(b){if(0!=pb(o,b))if(o=b,"rect"==d){for(var e=[],f=a.options.tabSize,g=wg(Ef(i,c.line).text,c.ch,f),h=wg(Ef(i,b.line).text,b.ch,f),m=Math.min(g,h),n=Math.max(g,h),p=Math.min(c.line,b.line),q=Math.min(a.lastLine(),Math.max(c.line,b.line));q>=p;p++){var r=Ef(i,p).text,s=xg(r,m,f);m==n?e.push(new ub(ob(p,s),ob(p,s))):r.length>s&&e.push(new ub(ob(p,s),ob(p,xg(r,n,f))))}e.length||e.push(new ub(c,c)),Jb(i,vb(l.ranges.slice(0,k).concat(e),k),tg)}else{var t=j,u=t.anchor,v=b;if("single"!=d){if("double"==d)var w=Zd(i,b);else var w=new ub(ob(b.line,0),yb(i,ob(b.line+1,0)));pb(w.anchor,u)>0?(v=w.head,u=sb(t.from(),w.anchor)):(v=w.anchor,u=rb(t.to(),w.head))}var e=l.ranges.slice(0);e[k]=new ub(yb(i,u),v),Jb(i,vb(e,k),tg)}}function s(b){var c=++r,e=Wc(a,b,!0,"rect"==d);if(e)if(0!=pb(e,o)){Sc(a),p(e);var f=Q(h,i);(e.line>=f.to||e.line<f.from)&&setTimeout(Bc(a,function(){r==c&&s(b)}),150)}else{var g=b.clientY<q.top?-20:b.clientY>q.bottom?20:0;g&&setTimeout(Bc(a,function(){r==c&&(h.scroller.scrollTop+=g,s(b))}),50)}}function t(b){r=1/0,_f(b),Rc(a),gg(document,"mousemove",u),gg(document,"mouseup",v),i.history.lastSelOrigin=null}var h=a.display,i=a.doc;_f(b);var j,k,l=i.sel;if(f?(k=i.sel.contains(c),j=k>-1?i.sel.ranges[k]:new ub(c,c)):j=i.sel.primary(),b.altKey)d="rect",f||(j=new ub(c,c)),c=Wc(a,b,!0,!0),k=-1;else if("double"==d){var m=Zd(i,c);j=a.display.shift||i.extend?Cb(i,j,m.anchor,m.head):m}else if("triple"==d){var n=new ub(ob(c.line,0),yb(i,ob(c.line+1,0)));j=a.display.shift||i.extend?Cb(i,j,n.anchor,n.head):n}else j=Cb(i,j,c);f?k>-1?Fb(i,k,j,tg):(k=i.sel.ranges.length,Jb(i,vb(i.sel.ranges.concat([j]),k),{scroll:!1,origin:"*mouse"})):(k=0,Jb(i,new tb([j],0),tg));var o=c,q=h.wrapper.getBoundingClientRect(),r=0,u=Bc(a,function(a){(g&&!e?a.buttons:eg(a))?s(a):t(a)}),v=Bc(a,t);fg(document,"mousemove",u),fg(document,"mouseup",v)}function bd(a,b,c,d,e){try{var f=b.clientX,g=b.clientY}catch(b){return!1}if(f>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&_f(b);var h=a.display,i=h.lineDiv.getBoundingClientRect();if(g>i.bottom||!og(a,c))return bg(b);g-=i.top-h.viewOffset;for(var j=0;j<a.options.gutters.length;++j){var k=h.gutters.childNodes[j];if(k&&k.getBoundingClientRect().right>=f){var l=Jf(a.doc,g),m=a.options.gutters[j];return e(a,c,a,l,m,b),bg(b)}}}function cd(a,b){return bd(a,b,"gutterClick",!0,kg)}function ed(a){var c=this;if(!mg(c,a)&&!Vc(c.display,a)){_f(a),b&&(dd=+new Date);var d=Wc(c,a,!0),e=a.dataTransfer.files;if(d&&!Tc(c))if(e&&e.length&&window.FileReader&&window.File)for(var f=e.length,g=Array(f),h=0,i=function(a,b){var e=new FileReader;e.onload=Bc(c,function(){if(g[b]=e.result,++h==f){d=yb(c.doc,d);var a={from:d,to:d,text:bh(g.join("\n")),origin:"paste"};Gd(c.doc,a),Ib(c.doc,wb(d,Ad(a)))}}),e.readAsText(a)},j=0;f>j;++j)i(e[j],j);else{if(c.state.draggingText&&c.doc.sel.contains(d)>-1)return c.state.draggingText(a),setTimeout(Gg(Rc,c),20),void 0;try{var g=a.dataTransfer.getData("Text");if(g){var k=c.state.draggingText&&c.listSelections();if(Kb(c.doc,wb(d,d)),k)for(var j=0;j<k.length;++j)Md(c.doc,"",k[j].anchor,k[j].head,"drag");c.replaceSelection(g,"around","paste"),Rc(c)}}catch(a){}}}}function fd(a,c){if(b&&(!a.state.draggingText||+new Date-dd<100))return cg(c),void 0;if(!mg(a,c)&&!Vc(a.display,c)&&(c.dataTransfer.setData("Text",a.getSelection()),c.dataTransfer.setDragImage&&!l)){var d=Mg("img",null,null,"position: fixed; left: 0; top: 0;");d.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",k&&(d.width=d.height=1,a.display.wrapper.appendChild(d),d._top=d.offsetTop),c.dataTransfer.setDragImage(d,0,0),k&&d.parentNode.removeChild(d)}}function gd(b,c){Math.abs(b.doc.scrollTop-c)<2||(b.doc.scrollTop=c,a||V(b,{top:c}),b.display.scroller.scrollTop!=c&&(b.display.scroller.scrollTop=c),b.display.scrollbarV.scrollTop!=c&&(b.display.scrollbarV.scrollTop=c),a&&V(b),Tb(b,100))}function hd(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,R(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbarH.scrollLeft!=b&&(a.display.scrollbarH.scrollLeft=b))}function kd(b,c){var d=c.wheelDeltaX,e=c.wheelDeltaY;null==d&&c.detail&&c.axis==c.HORIZONTAL_AXIS&&(d=c.detail),null==e&&c.detail&&c.axis==c.VERTICAL_AXIS?e=c.detail:null==e&&(e=c.wheelDelta);var f=b.display,g=f.scroller;if(d&&g.scrollWidth>g.clientWidth||e&&g.scrollHeight>g.clientHeight){if(e&&s&&h)a:for(var i=c.target,j=f.view;i!=g;i=i.parentNode)for(var l=0;l<j.length;l++)if(j[l].node==i){b.display.currentWheelTarget=i;break a}if(d&&!a&&!k&&null!=jd)return e&&gd(b,Math.max(0,Math.min(g.scrollTop+e*jd,g.scrollHeight-g.clientHeight))),hd(b,Math.max(0,Math.min(g.scrollLeft+d*jd,g.scrollWidth-g.clientWidth))),_f(c),f.wheelStartX=null,void 0;if(e&&null!=jd){var m=e*jd,n=b.doc.scrollTop,o=n+f.wrapper.clientHeight;0>m?n=Math.max(0,n+m-50):o=Math.min(b.doc.height,o+m+50),V(b,{top:n,bottom:o})}20>id&&(null==f.wheelStartX?(f.wheelStartX=g.scrollLeft,f.wheelStartY=g.scrollTop,f.wheelDX=d,f.wheelDY=e,setTimeout(function(){if(null!=f.wheelStartX){var a=g.scrollLeft-f.wheelStartX,b=g.scrollTop-f.wheelStartY,c=b&&f.wheelDY&&b/f.wheelDY||a&&f.wheelDX&&a/f.wheelDX;f.wheelStartX=f.wheelStartY=null,c&&(jd=(jd*id+c)/(id+1),++id)}},200)):(f.wheelDX+=d,f.wheelDY+=e))}}function ld(a,b,c){if("string"==typeof b&&(b=je[b],!b))return!1;a.display.pollingFast&&Pc(a)&&(a.display.pollingFast=!1);var d=a.display.shift,e=!1;try{Tc(a)&&(a.state.suppressEdits=!0),c&&(a.display.shift=!1),e=b(a)!=rg}finally{a.display.shift=d,a.state.suppressEdits=!1}return e}function md(a){var b=a.state.keyMaps.slice(0);return a.options.extraKeys&&b.push(a.options.extraKeys),b.push(a.options.keyMap),b}function od(a,b){var c=le(a.options.keyMap),d=c.auto;clearTimeout(nd),d&&!ne(b)&&(nd=setTimeout(function(){le(a.options.keyMap)==c&&(a.options.keyMap=d.call?d.call(null,a):d,G(a))},50));var e=oe(b,!0),f=!1;if(!e)return!1;var g=md(a);return f=b.shiftKey?me("Shift-"+e,g,function(b){return ld(a,b,!0)})||me(e,g,function(b){return("string"==typeof b?/^go[A-Z]/.test(b):b.motion)?ld(a,b):void 0}):me(e,g,function(b){return ld(a,b)}),f&&(_f(b),Sb(a),kg(a,"keyHandled",a,e,b)),f}function pd(a,b,c){var d=me("'"+c+"'",md(a),function(b){return ld(a,b,!0)});return d&&(_f(b),Sb(a),kg(a,"keyHandled",a,"'"+c+"'",b)),d}function rd(a){var c=this;if(Sc(c),!mg(c,a)){b&&27==a.keyCode&&(a.returnValue=!1);var d=a.keyCode;c.display.shift=16==d||a.shiftKey;var e=od(c,a);k&&(qd=e?d:null,!e&&88==d&&!dh&&(s?a.metaKey:a.ctrlKey)&&c.replaceSelection("",null,"cut")),18!=d||/\bCodeMirror-crosshair\b/.test(c.display.lineDiv.className)||sd(c)}}function sd(a){function c(a){18!=a.keyCode&&a.altKey||(Tg(b,"CodeMirror-crosshair"),gg(document,"keyup",c),gg(document,"mouseover",c))}var b=a.display.lineDiv;Ug(b,"CodeMirror-crosshair"),fg(document,"keyup",c),fg(document,"mouseover",c)}function td(a){mg(this,a)||16==a.keyCode&&(this.doc.sel.shift=!1)}function ud(a){var b=this;if(!mg(b,a)){var c=a.keyCode,e=a.charCode;if(k&&c==qd)return qd=null,_f(a),void 0;if(!(k&&(!a.which||a.which<10)||m)||!od(b,a)){var f=String.fromCharCode(null==e?c:e);pd(b,a,f)||(g&&!d&&(b.display.inputHasSelection=null),Oc(b))}}}function vd(a){"nocursor"!=a.options.readOnly&&(a.state.focused||(hg(a,"focus",a),a.state.focused=!0,Ug(a.display.wrapper,"CodeMirror-focused"),a.curOp||"\u200b"==a.display.prevInput||(Qc(a),h&&setTimeout(Gg(Qc,a,!0),0))),Nc(a),Sb(a))}function wd(a){a.state.focused&&(hg(a,"blur",a),a.state.focused=!1,Tg(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.display.shift=!1)},150)}function yd(a,b){function j(){if(null!=c.input.selectionStart){var b=c.input.value="\u200b"+(a.somethingSelected()?c.input.value:"");c.prevInput="\u200b",c.input.selectionStart=1,c.input.selectionEnd=b.length}}function l(){if(c.inputDiv.style.position="relative",c.input.style.cssText=i,d&&(c.scrollbarV.scrollTop=c.scroller.scrollTop=f),Nc(a),null!=c.input.selectionStart){(!g||d)&&j(),clearTimeout(xd);var b=0,e=function(){"\u200b"==c.prevInput&&0==c.input.selectionStart?Bc(a,je.selectAll)(a):b++<10?xd=setTimeout(e,500):Qc(a)};xd=setTimeout(e,200)}}if(!mg(a,b,"contextmenu")){var c=a.display;if(!Vc(c,b)&&!zd(a,b)){var e=Wc(a,b),f=c.scroller.scrollTop;if(e&&!k){var h=a.options.resetSelectionOnContextMenu;h&&-1==a.doc.sel.contains(e)&&Bc(a,Jb)(a.doc,wb(e),sg);var i=c.input.style.cssText;if(c.inputDiv.style.position="absolute",c.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(b.clientY-5)+"px; left: "+(b.clientX-5)+"px; z-index: 1000; background: "+(g?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",Rc(a),Qc(a),a.somethingSelected()||(c.input.value=c.prevInput=" "),g&&!d&&j(),w){cg(b);var m=function(){gg(window,"mouseup",m),setTimeout(l,20)};fg(window,"mouseup",m)}else setTimeout(l,50)}}}}function zd(a,b){return og(a,"gutterContextMenu")?bd(a,b,"gutterContextMenu",!1,hg):!1}function Bd(a,b){if(pb(a,b.from)<0)return a;if(pb(a,b.to)<=0)return Ad(b);var c=a.line+b.text.length-(b.to.line-b.from.line)-1,d=a.ch;return a.line==b.to.line&&(d+=Ad(b).ch-b.to.ch),ob(c,d)}function Cd(a,b){for(var c=[],d=0;d<a.sel.ranges.length;d++){var e=a.sel.ranges[d];c.push(new ub(Bd(e.anchor,b),Bd(e.head,b)))}return vb(c,a.sel.primIndex)}function Dd(a,b,c){return a.line==b.line?ob(c.line,a.ch-b.ch+c.ch):ob(c.line+(a.line-b.line),a.ch)}function Ed(a,b,c){for(var d=[],e=ob(a.first,0),f=e,g=0;g<b.length;g++){var h=b[g],i=Dd(h.from,e,f),j=Dd(Ad(h),e,f);if(e=h.to,f=j,"around"==c){var k=a.sel.ranges[g],l=pb(k.head,k.anchor)<0;d[g]=new ub(l?j:i,l?i:j)}else d[g]=new ub(i,i)}return new tb(d,a.sel.primIndex)}function Fd(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=yb(a,b)),c&&(this.to=yb(a,c)),d&&(this.text=d),void 0!==e&&(this.origin=e)}),hg(a,"beforeChange",a,d),a.cm&&hg(a.cm,"beforeChange",a.cm,d),d.canceled?null:{from:d.from,to:d.to,text:d.text,origin:d.origin}}function Gd(a,b,c){if(a.cm){if(!a.cm.curOp)return Bc(a.cm,Gd)(a,b,c);if(a.cm.state.suppressEdits)return}if(!(og(a,"beforeChange")||a.cm&&og(a.cm,"beforeChange"))||(b=Fd(a,b,!0))){var d=x&&!c&&He(a,b.from,b.to);if(d)for(var e=d.length-1;e>=0;--e)Hd(a,{from:d[e].from,to:d[e].to,text:e?[""]:b.text});else Hd(a,b)}}function Hd(a,b){if(1!=b.text.length||""!=b.text[0]||0!=pb(b.from,b.to)){var c=Cd(a,b);Qf(a,b,c,a.cm?a.cm.curOp.id:0/0),Kd(a,b,c,Ee(a,b));var d=[];Cf(a,function(a,c){c||-1!=Cg(d,a.history)||($f(a.history,b),d.push(a.history)),Kd(a,b,null,Ee(a,b))})}}function Id(a,b,c){if(!a.cm||!a.cm.state.suppressEdits){for(var e,d=a.history,f=a.sel,g="undo"==b?d.done:d.undone,h="undo"==b?d.undone:d.done,i=0;i<g.length&&(e=g[i],c?!e.ranges||e.equals(a.sel):e.ranges);i++);if(i!=g.length){for(d.lastOrigin=d.lastSelOrigin=null;e=g.pop(),e.ranges;){if(Tf(e,h),c&&!e.equals(a.sel))return Jb(a,e,{clearRedo:!1}),void 0;f=e}var j=[];Tf(f,h),h.push({changes:j,generation:d.generation}),d.generation=e.generation||++d.maxGeneration;for(var k=og(a,"beforeChange")||a.cm&&og(a.cm,"beforeChange"),i=e.changes.length-1;i>=0;--i){var l=e.changes[i];if(l.origin=b,k&&!Fd(a,l,!1))return g.length=0,void 0;j.push(Nf(a,l));var m=i?Cd(a,l,null):Ag(g);Kd(a,l,m,Ge(a,l)),a.cm&&Sd(a.cm);var n=[];Cf(a,function(a,b){b||-1!=Cg(n,a.history)||($f(a.history,l),n.push(a.history)),Kd(a,l,null,Ge(a,l))})}}}}function Jd(a,b){a.first+=b,a.sel=new tb(Dg(a.sel.ranges,function(a){return new ub(ob(a.anchor.line+b,a.anchor.ch),ob(a.head.line+b,a.head.ch))}),a.sel.primIndex),a.cm&&Gc(a.cm,a.first,a.first-b,b)}function Kd(a,b,c,d){if(a.cm&&!a.cm.curOp)return Bc(a.cm,Kd)(a,b,c,d);if(b.to.line<a.first)return Jd(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);Jd(a,e),b={from:ob(a.first,0),to:ob(b.to.line+e,b.to.ch),text:[Ag(b.text)],origin:b.origin}}var f=a.lastLine();b.to.line>f&&(b={from:b.from,to:ob(f,Ef(a,f).text.length),text:[b.text[0]],origin:b.origin}),b.removed=Ff(a,b.from,b.to),c||(c=Cd(a,b,null)),a.cm?Ld(a.cm,b,d):vf(a,b,d),Kb(a,c,sg)}}function Ld(a,b,c){var d=a.doc,e=a.display,f=b.from,g=b.to,h=!1,i=f.line;a.options.lineWrapping||(i=If(Re(Ef(d,f.line))),d.iter(i,g.line+1,function(a){return a==e.maxLine?(h=!0,!0):void 0})),d.sel.contains(b.from,b.to)>-1&&ng(a),vf(d,b,c,E(a)),a.options.lineWrapping||(d.iter(i,f.line+b.text.length,function(a){var b=L(a);b>e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,h=!1)}),h&&(a.curOp.updateMaxLine=!0)),d.frontier=Math.min(d.frontier,f.line),Tb(a,400);var j=b.text.length-(g.line-f.line)-1;f.line!=g.line||1!=b.text.length||uf(a.doc,b)?Gc(a,f.line,g.line+1,j):Hc(a,f.line,"text");var k=og(a,"changes"),l=og(a,"change");if(l||k){var m={from:f,to:g,text:b.text,removed:b.removed,origin:b.origin};l&&kg(a,"change",a,m),k&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(m)}}function Md(a,b,c,d,e){if(d||(d=c),pb(d,c)<0){var f=d;d=c,c=f}"string"==typeof b&&(b=bh(b)),Gd(a,{from:c,to:d,text:b,origin:e})}function Nd(a,b){var c=a.display,d=c.sizer.getBoundingClientRect(),e=null;if(b.top+d.top<0?e=!0:b.bottom+d.top>(window.innerHeight||document.documentElement.clientHeight)&&(e=!1),null!=e&&!p){var f=Mg("div","\u200b",null,"position: absolute; top: "+(b.top-c.viewOffset-Xb(a.display))+"px; height: "+(b.bottom-b.top+qg)+"px; left: "+b.left+"px; width: 2px;");a.display.lineSpace.appendChild(f),f.scrollIntoView(e),a.display.lineSpace.removeChild(f)}}function Od(a,b,c,d){for(null==d&&(d=0);;){var e=!1,f=pc(a,b),g=c&&c!=b?pc(a,c):f,h=Qd(a,Math.min(f.left,g.left),Math.min(f.top,g.top)-d,Math.max(f.left,g.left),Math.max(f.bottom,g.bottom)+d),i=a.doc.scrollTop,j=a.doc.scrollLeft;if(null!=h.scrollTop&&(gd(a,h.scrollTop),Math.abs(a.doc.scrollTop-i)>1&&(e=!0)),null!=h.scrollLeft&&(hd(a,h.scrollLeft),Math.abs(a.doc.scrollLeft-j)>1&&(e=!0)),!e)return f}}function Pd(a,b,c,d,e){var f=Qd(a,b,c,d,e);null!=f.scrollTop&&gd(a,f.scrollTop),null!=f.scrollLeft&&hd(a,f.scrollLeft)}function Qd(a,b,c,d,e){var f=a.display,g=vc(a.display);0>c&&(c=0);var h=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:f.scroller.scrollTop,i=f.scroller.clientHeight-qg,j={},k=a.doc.height+Yb(f),l=g>c,m=e>k-g;if(h>c)j.scrollTop=l?0:c;else if(e>h+i){var n=Math.min(c,(m?k:e)-i);n!=h&&(j.scrollTop=n)}var o=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:f.scroller.scrollLeft,p=f.scroller.clientWidth-qg;b+=f.gutters.offsetWidth,d+=f.gutters.offsetWidth;var q=f.gutters.offsetWidth,r=q+10>b;return o+q>b||r?(r&&(b=0),j.scrollLeft=Math.max(0,b-10-q)):d>p+o-3&&(j.scrollLeft=d+10-p),j}function Rd(a,b,c){(null!=b||null!=c)&&Td(a),null!=b&&(a.curOp.scrollLeft=(null==a.curOp.scrollLeft?a.doc.scrollLeft:a.curOp.scrollLeft)+b),null!=c&&(a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+c)}function Sd(a){Td(a);var b=a.getCursor(),c=b,d=b;a.options.lineWrapping||(c=b.ch?ob(b.line,b.ch-1):b,d=ob(b.line,b.ch+1)),a.curOp.scrollToPos={from:c,to:d,margin:a.options.cursorScrollMargin,isCursor:!0}}function Td(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=qc(a,b.from),d=qc(a,b.to),e=Qd(a,Math.min(c.left,d.left),Math.min(c.top,d.top)-b.margin,Math.max(c.right,d.right),Math.max(c.bottom,d.bottom)+b.margin);a.scrollTo(e.scrollLeft,e.scrollTop)}}function Ud(a,b,c,d){var f,e=a.doc;null==c&&(c="add"),"smart"==c&&(a.doc.mode.indent?f=Wb(a,b):c="prev");var g=a.options.tabSize,h=Ef(e,b),i=wg(h.text,null,g);h.stateAfter&&(h.stateAfter=null);var k,j=h.text.match(/^\s*/)[0];if(d||/\S/.test(h.text)){if("smart"==c&&(k=a.doc.mode.indent(f,h.text.slice(j.length),h.text),k==rg)){if(!d)return;c="prev"}}else k=0,c="not";"prev"==c?k=b>e.first?wg(Ef(e,b-1).text,null,g):0:"add"==c?k=i+a.options.indentUnit:"subtract"==c?k=i-a.options.indentUnit:"number"==typeof c&&(k=i+c),k=Math.max(0,k);var l="",m=0;if(a.options.indentWithTabs)for(var n=Math.floor(k/g);n;--n)m+=g,l+=" ";if(k>m&&(l+=zg(k-m)),l!=j)Md(a.doc,l,ob(b,0),ob(b,j.length),"+input");else for(var n=0;n<e.sel.ranges.length;n++){var o=e.sel.ranges[n];if(o.head.line==b&&o.head.ch<j.length){var m=ob(b,j.length);Fb(e,n,new ub(m,m));break}}h.stateAfter=null}function Vd(a,b,c,d){var e=b,f=b,g=a.doc;return"number"==typeof b?f=Ef(g,xb(g,b)):e=If(b),null==e?null:(d(f,e)&&Hc(a,e,c),f)}function Wd(a,b){for(var c=a.doc.sel.ranges,d=[],e=0;e<c.length;e++){for(var f=b(c[e]);d.length&&pb(f.from,Ag(d).to)<=0;){var g=d.pop();if(pb(g.from,f.from)<0){f.from=g.from;break}}d.push(f)}Ac(a,function(){for(var b=d.length-1;b>=0;b--)Md(a.doc,"",d[b].from,d[b].to,"+delete");Sd(a)})}function Xd(a,b,c,d,e){function k(){var b=f+c;return b<a.first||b>=a.first+a.size?j=!1:(f=b,i=Ef(a,b))}function l(a){var b=(e?qh:rh)(i,g,c,!0);if(null==b){if(a||!k())return j=!1;g=e?(0>c?jh:ih)(i):0>c?i.text.length:0}else g=b;return!0}var f=b.line,g=b.ch,h=c,i=Ef(a,f),j=!0;if("char"==d)l();else if("column"==d)l(!0);else if("word"==d||"group"==d)for(var m=null,n="group"==d,o=!0;!(0>c)||l(!o);o=!1){var p=i.text.charAt(g)||"\n",q=Ig(p)?"w":n&&"\n"==p?"n":!n||/\s/.test(p)?null:"p";if(!n||o||q||(q="s"),m&&m!=q){0>c&&(c=1,l());break}if(q&&(m=q),c>0&&!l(!o))break}var r=Ob(a,ob(f,g),h,!0);return j||(r.hitSide=!0),r}function Yd(a,b,c,d){var g,e=a.doc,f=b.left;if("page"==d){var h=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);g=b.top+c*(h-(0>c?1.5:.5)*vc(a.display))}else"line"==d&&(g=c>0?b.bottom+3:b.top-3);for(;;){var i=sc(a,f,g);if(!i.outside)break;if(0>c?0>=g:g>=e.height){i.hitSide=!0;break}g+=5*c}return i}function Zd(a,b){var c=Ef(a,b.line).text,d=b.ch,e=b.ch;if(c){(b.xRel<0||e==c.length)&&d?--d:++e;for(var f=c.charAt(d),g=Ig(f)?Ig:/\s/.test(f)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!Ig(a)};d>0&&g(c.charAt(d-1));)--d;for(;e<c.length&&g(c.charAt(e));)++e}return new ub(ob(b.line,d),ob(b.line,e))}function ae(a,b,c,d){z.defaults[a]=b,c&&(_d[a]=d?function(a,b,d){d!=be&&c(a,b,d)}:c)}function le(a){return"string"==typeof a?ke[a]:a}function se(a,b,c,d,e){if(d&&d.shared)return ue(a,b,c,d,e);if(a.cm&&!a.cm.curOp)return Bc(a.cm,se)(a,b,c,d,e);var f=new qe(a,e),g=pb(b,c);if(d&&Fg(d,f,!1),g>0||0==g&&f.clearWhenEmpty!==!1)return f;if(f.replacedWith&&(f.collapsed=!0,f.widgetNode=Mg("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||(f.widgetNode.ignoreEvents=!0),d.insertLeft&&(f.widgetNode.insertLeft=!0)),f.collapsed){if(Qe(a,b.line,b,c,f)||b.line!=c.line&&Qe(a,c.line,b,c,f))throw new Error("Inserting collapsed marker partially overlapping an existing one");y=!0}f.addToHistory&&Qf(a,{from:b,to:c,origin:"markText"},a.sel,0/0);var j,h=b.line,i=a.cm;if(a.iter(h,c.line+1,function(a){i&&f.collapsed&&!i.options.lineWrapping&&Re(a)==i.display.maxLine&&(j=!0),f.collapsed&&h!=b.line&&Hf(a,0),Be(a,new ye(f,h==b.line?b.ch:null,h==c.line?c.ch:null)),++h}),f.collapsed&&a.iter(b.line,c.line+1,function(b){Ve(a,b)&&Hf(b,0)}),f.clearOnEnter&&fg(f,"beforeCursorEnter",function(){f.clear()}),f.readOnly&&(x=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory()),f.collapsed&&(f.id=++re,f.atomic=!0),i){if(j&&(i.curOp.updateMaxLine=!0),f.collapsed)Gc(i,b.line,c.line+1);else if(f.className||f.title||f.startStyle||f.endStyle)for(var k=b.line;k<=c.line;k++)Hc(i,k,"text");f.atomic&&Mb(i.doc),kg(i,"markerAdded",i,f)}return f}function ue(a,b,c,d,e){d=Fg(d),d.shared=!1;var f=[se(a,b,c,d,e)],g=f[0],h=d.widgetNode;return Cf(a,function(a){h&&(d.widgetNode=h.cloneNode(!0)),f.push(se(a,yb(a,b),yb(a,c),d,e));for(var i=0;i<a.linked.length;++i)if(a.linked[i].isParent)return;g=Ag(f)}),new te(f,g)}function ve(a){return a.findMarks(ob(a.first,0),a.clipPos(ob(a.lastLine())),function(a){return a.parent})}function we(a,b){for(var c=0;c<b.length;c++){var d=b[c],e=d.find(),f=a.clipPos(e.from),g=a.clipPos(e.to);if(pb(f,g)){var h=se(a,f,g,d.primary,d.primary.type);d.markers.push(h),h.parent=d}}}function xe(a){for(var b=0;b<a.length;b++){var c=a[b],d=[c.primary.doc];Cf(c.primary.doc,function(a){d.push(a)});for(var e=0;e<c.markers.length;e++){var f=c.markers[e];-1==Cg(d,f.doc)&&(f.parent=null,c.markers.splice(e--,1))}}}function ye(a,b,c){this.marker=a,this.from=b,this.to=c}function ze(a,b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function Ae(a,b){for(var c,d=0;d<a.length;++d)a[d]!=b&&(c||(c=[])).push(a[d]);return c}function Be(a,b){a.markedSpans=a.markedSpans?a.markedSpans.concat([b]):[b],b.marker.attachLine(a)}function Ce(a,b,c){if(a)for(var e,d=0;d<a.length;++d){var f=a[d],g=f.marker,h=null==f.from||(g.inclusiveLeft?f.from<=b:f.from<b);if(h||f.from==b&&"bookmark"==g.type&&(!c||!f.marker.insertLeft)){var i=null==f.to||(g.inclusiveRight?f.to>=b:f.to>b);(e||(e=[])).push(new ye(g,f.from,i?null:f.to))}}return e}function De(a,b,c){if(a)for(var e,d=0;d<a.length;++d){var f=a[d],g=f.marker,h=null==f.to||(g.inclusiveRight?f.to>=b:f.to>b);if(h||f.from==b&&"bookmark"==g.type&&(!c||f.marker.insertLeft)){var i=null==f.from||(g.inclusiveLeft?f.from<=b:f.from<b);(e||(e=[])).push(new ye(g,i?null:f.from-b,null==f.to?null:f.to-b))}}return e}function Ee(a,b){var c=Ab(a,b.from.line)&&Ef(a,b.from.line).markedSpans,d=Ab(a,b.to.line)&&Ef(a,b.to.line).markedSpans;if(!c&&!d)return null;var e=b.from.ch,f=b.to.ch,g=0==pb(b.from,b.to),h=Ce(c,e,g),i=De(d,f,g),j=1==b.text.length,k=Ag(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=ze(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=ze(h,m.marker);n||(m.from=k,j&&(h||(h=[])).push(m))}else m.from+=k,j&&(h||(h=[])).push(m)}h&&(h=Fe(h)),i&&i!=h&&(i=Fe(i));var o=[h];if(!j){var q,p=b.text.length-2;if(p>0&&h)for(var l=0;l<h.length;++l)null==h[l].to&&(q||(q=[])).push(new ye(h[l].marker,null,null));for(var l=0;p>l;++l)o.push(q);o.push(i)}return o}function Fe(a){for(var b=0;b<a.length;++b){var c=a[b];null!=c.from&&c.from==c.to&&c.marker.clearWhenEmpty!==!1&&a.splice(b--,1)}return a.length?a:null}function Ge(a,b){var c=Wf(a,b),d=Ee(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 He(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!=Cg(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(0),i=0;i<e.length;++i){var j=e[i];
3
+ if(!(pb(j.to,h.from)<0||pb(j.from,h.to)>0)){var k=[i,1],l=pb(j.from,h.from),m=pb(j.to,h.to);(0>l||!g.inclusiveLeft&&!l)&&k.push({from:j.from,to:h.from}),(m>0||!g.inclusiveRight&&!m)&&k.push({from:h.to,to:j.to}),e.splice.apply(e,k),i+=k.length-1}}return e}function Ie(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function Je(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function Ke(a){return a.inclusiveLeft?-1:0}function Le(a){return a.inclusiveRight?1:0}function Me(a,b){var c=a.lines.length-b.lines.length;if(0!=c)return c;var d=a.find(),e=b.find(),f=pb(d.from,e.from)||Ke(a)-Ke(b);if(f)return-f;var g=pb(d.to,e.to)||Le(a)-Le(b);return g?g:b.id-a.id}function Ne(a,b){var d,c=y&&a.markedSpans;if(c)for(var e,f=0;f<c.length;++f)e=c[f],e.marker.collapsed&&null==(b?e.from:e.to)&&(!d||Me(d,e.marker)<0)&&(d=e.marker);return d}function Oe(a){return Ne(a,!0)}function Pe(a){return Ne(a,!1)}function Qe(a,b,c,d,e){var f=Ef(a,b),g=y&&f.markedSpans;if(g)for(var h=0;h<g.length;++h){var i=g[h];if(i.marker.collapsed){var j=i.marker.find(0),k=pb(j.from,c)||Ke(i.marker)-Ke(e),l=pb(j.to,d)||Le(i.marker)-Le(e);if(!(k>=0&&0>=l||0>=k&&l>=0)&&(0>=k&&(pb(j.to,c)||Le(i.marker)-Ke(e))>0||k>=0&&(pb(j.from,d)||Ke(i.marker)-Le(e))<0))return!0}}}function Re(a){for(var b;b=Oe(a);)a=b.find(-1,!0).line;return a}function Se(a){for(var b,c;b=Pe(a);)a=b.find(1,!0).line,(c||(c=[])).push(a);return c}function Te(a,b){var c=Ef(a,b),d=Re(c);return c==d?b:If(d)}function Ue(a,b){if(b>a.lastLine())return b;var d,c=Ef(a,b);if(!Ve(a,c))return b;for(;d=Pe(c);)c=d.find(1,!0).line;return If(c)+1}function Ve(a,b){var c=y&&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.widgetNode&&0==d.from&&d.marker.inclusiveLeft&&We(a,b,d))return!0}}function We(a,b,c){if(null==c.to){var d=c.marker.find(1,!0);return We(a,d.line,ze(d.line.markedSpans,c.marker))}if(c.marker.inclusiveRight&&c.to==b.text.length)return!0;for(var e,f=0;f<b.markedSpans.length;++f)if(e=b.markedSpans[f],e.marker.collapsed&&!e.marker.widgetNode&&e.from==c.to&&(null==e.to||e.to!=c.from)&&(e.marker.inclusiveLeft||c.marker.inclusiveRight)&&We(a,b,e))return!0}function Ye(a,b,c){Kf(b)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop)&&Rd(a,null,c)}function Ze(a){return null!=a.height?a.height:(Qg(document.body,a.node)||Pg(a.cm.display.measure,Mg("div",[a.node],null,"position: relative")),a.height=a.node.offsetHeight)}function $e(a,b,c,d){var e=new Xe(a,c,d);return e.noHScroll&&(a.display.alignWidgets=!0),Vd(a,b,"widget",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,!Ve(a.doc,b)){var d=Kf(b)<a.doc.scrollTop;Hf(b,b.height+Ze(e)),d&&Rd(a,null,e.height),a.curOp.forceUpdate=!0}return!0}),e}function af(a,b,c,d){a.text=b,a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null),null!=a.order&&(a.order=null),Ie(a),Je(a,c);var e=d?d(a):1;e!=a.height&&Hf(a,e)}function bf(a){a.parent=null,Ie(a)}function cf(a,b){if(a)for(;;){var c=a.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!c)break;a=a.slice(0,c.index)+a.slice(c.index+c[0].length);var d=c[1]?"bgClass":"textClass";null==b[d]?b[d]=c[2]:new RegExp("(?:^|s)"+c[2]+"(?:$|s)").test(b[d])||(b[d]+=" "+c[2])}return a}function df(a,b){if(a.blankLine)return a.blankLine(b);if(a.innerMode){var c=z.innerMode(a,b);return c.mode.blankLine?c.mode.blankLine(c.state):void 0}}function ef(a,b,c){var d=a.token(b,c);if(b.pos<=b.start)throw new Error("Mode "+a.name+" failed to advance stream.");return d}function ff(a,b,c,d,e,f,g){var h=c.flattenSpans;null==h&&(h=a.options.flattenSpans);var l,i=0,j=null,k=new pe(b,a.options.tabSize);for(""==b&&cf(df(c,d),f);!k.eol();){if(k.pos>a.options.maxHighlightLength?(h=!1,g&&jf(a,b,d,k.pos),k.pos=b.length,l=null):l=cf(ef(c,k,d),f),a.options.addModeClass){var m=z.innerMode(c,d).mode.name;m&&(l="m-"+(l?m+" "+l:m))}h&&j==l||(i<k.start&&e(k.start,j),i=k.start,j=l),k.start=k.pos}for(;i<k.pos;){var n=Math.min(k.pos,i+5e4);e(n,j),i=n}}function gf(a,b,c,d){var e=[a.state.modeGen],f={};ff(a,b.text,a.doc.mode,c,function(a,b){e.push(a,b)},f,d);for(var g=0;g<a.state.overlays.length;++g){var h=a.state.overlays[g],i=1,j=0;ff(a,b.text,h.mode,!0,function(a,b){for(var c=i;a>j;){var d=e[i];d>a&&e.splice(i,1,a,e[i+1],d),i+=2,j=Math.min(a,d)}if(b)if(h.opaque)e.splice(c,i-c,a,"cm-overlay "+b),i=c+2;else for(;i>c;c+=2){var f=e[c+1];e[c+1]=(f?f+" ":"")+"cm-overlay "+b}},f)}return{styles:e,classes:f.bgClass||f.textClass?f:null}}function hf(a,b){if(!b.styles||b.styles[0]!=a.state.modeGen){var c=gf(a,b,b.stateAfter=Wb(a,If(b)));b.styles=c.styles,c.classes?b.styleClasses=c.classes:b.styleClasses&&(b.styleClasses=null)}return b.styles}function jf(a,b,c,d){var e=a.doc.mode,f=new pe(b,a.options.tabSize);for(f.start=f.pos=d||0,""==b&&df(e,c);!f.eol()&&f.pos<=a.options.maxHighlightLength;)ef(e,f,c),f.start=f.pos}function mf(a,b){if(!a||/^\s*$/.test(a))return null;var c=b.addModeClass?lf:kf;return c[a]||(c[a]=a.replace(/\S+/g,"cm-$&"))}function nf(a,b){var c=Mg("span",null,null,h?"padding-right: .1px":null),d={pre:Mg("pre",[c]),content:c,col:0,pos:0,cm:a};b.measure={};for(var e=0;e<=(b.rest?b.rest.length:0);e++){var i,f=e?b.rest[e-1]:b.line;d.pos=0,d.addToken=pf,(g||h)&&a.getOption("lineWrapping")&&(d.addToken=qf(d.addToken)),ah(a.display.measure)&&(i=Lf(f))&&(d.addToken=rf(d.addToken,i)),d.map=[],tf(f,d,hf(a,f)),f.styleClasses&&(f.styleClasses.bgClass&&(d.bgClass=Vg(f.styleClasses.bgClass,d.bgClass||"")),f.styleClasses.textClass&&(d.textClass=Vg(f.styleClasses.textClass,d.textClass||""))),0==d.map.length&&d.map.push(0,0,d.content.appendChild($g(a.display.measure))),0==e?(b.measure.map=d.map,b.measure.cache={}):((b.measure.maps||(b.measure.maps=[])).push(d.map),(b.measure.caches||(b.measure.caches=[])).push({}))}return hg(a,"renderLine",a,b.line,d.pre),d}function of(a){var b=Mg("span","\u2022","cm-invalidchar");return b.title="\\u"+a.charCodeAt(0).toString(16),b}function pf(a,b,c,e,f,g){if(b){var h=a.cm.options.specialChars,i=!1;if(h.test(b))for(var j=document.createDocumentFragment(),k=0;;){h.lastIndex=k;var l=h.exec(b),m=l?l.index-k:b.length-k;if(m){var n=document.createTextNode(b.slice(k,k+m));d?j.appendChild(Mg("span",[n])):j.appendChild(n),a.map.push(a.pos,a.pos+m,n),a.col+=m,a.pos+=m}if(!l)break;if(k+=m+1," "==l[0]){var o=a.cm.options.tabSize,p=o-a.col%o,n=j.appendChild(Mg("span",zg(p),"cm-tab"));a.col+=p}else{var n=a.cm.options.specialCharPlaceholder(l[0]);d?j.appendChild(Mg("span",[n])):j.appendChild(n),a.col+=1}a.map.push(a.pos,a.pos+1,n),a.pos++}else{a.col+=b.length;var j=document.createTextNode(b);a.map.push(a.pos,a.pos+b.length,j),d&&(i=!0),a.pos+=b.length}if(c||e||f||i){var q=c||"";e&&(q+=e),f&&(q+=f);var r=Mg("span",[j],q);return g&&(r.title=g),a.content.appendChild(r)}a.content.appendChild(j)}}function qf(a){function b(a){for(var b=" ",c=0;c<a.length-2;++c)b+=c%2?" ":"\xa0";return b+=" "}return function(c,d,e,f,g,h){a(c,d.replace(/ {3,}/g,b),e,f,g,h)}}function rf(a,b){return function(c,d,e,f,g,h){e=e?e+" cm-force-border":"cm-force-border";for(var i=c.pos,j=i+d.length;;){for(var k=0;k<b.length;k++){var l=b[k];if(l.to>i&&l.from<=i)break}if(l.to>=j)return a(c,d,e,f,g,h);a(c,d.slice(0,l.to-i),e,f,null,h),f=null,d=d.slice(l.to-i),i=l.to}}}function sf(a,b,c,d){var e=!d&&c.widgetNode;e&&(a.map.push(a.pos,a.pos+b,e),a.content.appendChild(e)),a.pos+=b}function tf(a,b,c){var d=a.markedSpans,e=a.text,f=0;if(d)for(var k,m,n,o,p,q,h=e.length,i=0,g=1,j="",l=0;;){if(l==i){m=n=o=p="",q=null,l=1/0;for(var r=[],s=0;s<d.length;++s){var t=d[s],u=t.marker;t.from<=i&&(null==t.to||t.to>i)?(null!=t.to&&l>t.to&&(l=t.to,n=""),u.className&&(m+=" "+u.className),u.startStyle&&t.from==i&&(o+=" "+u.startStyle),u.endStyle&&t.to==l&&(n+=" "+u.endStyle),u.title&&!p&&(p=u.title),u.collapsed&&(!q||Me(q.marker,u)<0)&&(q=t)):t.from>i&&l>t.from&&(l=t.from),"bookmark"==u.type&&t.from==i&&u.widgetNode&&r.push(u)}if(q&&(q.from||0)==i&&(sf(b,(null==q.to?h+1:q.to)-i,q.marker,null==q.from),null==q.to))return;if(!q&&r.length)for(var s=0;s<r.length;++s)sf(b,0,r[s])}if(i>=h)break;for(var v=Math.min(h,l);;){if(j){var w=i+j.length;if(!q){var x=w>v?j.slice(0,v-i):j;b.addToken(b,x,k?k+m:m,o,i+x.length==l?n:"",p)}if(w>=v){j=j.slice(v-i),i=v;break}i=w,o=""}j=e.slice(f,f=c[g++]),k=mf(c[g++],b.cm.options)}}else for(var g=1;g<c.length;g+=2)b.addToken(b,e.slice(f,f=c[g]),mf(c[g+1],b.cm.options))}function uf(a,b){return 0==b.from.ch&&0==b.to.ch&&""==Ag(b.text)&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}function vf(a,b,c,d){function e(a){return c?c[a]:null}function f(a,c,e){af(a,c,e,d),kg(a,"change",a,b)}var g=b.from,h=b.to,i=b.text,j=Ef(a,g.line),k=Ef(a,h.line),l=Ag(i),m=e(i.length-1),n=h.line-g.line;if(uf(a,b)){for(var o=0,p=[];o<i.length-1;++o)p.push(new _e(i[o],e(o),d));f(k,k.text,m),n&&a.remove(g.line,n),p.length&&a.insert(g.line,p)}else if(j==k)if(1==i.length)f(j,j.text.slice(0,g.ch)+l+j.text.slice(h.ch),m);else{for(var p=[],o=1;o<i.length-1;++o)p.push(new _e(i[o],e(o),d));p.push(new _e(l+j.text.slice(h.ch),m,d)),f(j,j.text.slice(0,g.ch)+i[0],e(0)),a.insert(g.line+1,p)}else if(1==i.length)f(j,j.text.slice(0,g.ch)+i[0]+k.text.slice(h.ch),e(0)),a.remove(g.line+1,n);else{f(j,j.text.slice(0,g.ch)+i[0],e(0)),f(k,l+k.text.slice(h.ch),m);for(var o=1,p=[];o<i.length-1;++o)p.push(new _e(i[o],e(o),d));n>1&&a.remove(g.line+1,n-1),a.insert(g.line+1,p)}kg(a,"change",a,b)}function wf(a){this.lines=a,this.parent=null;for(var b=0,c=0;b<a.length;++b)a[b].parent=this,c+=a[b].height;this.height=c}function xf(a){this.children=a;for(var b=0,c=0,d=0;d<a.length;++d){var e=a[d];b+=e.chunkSize(),c+=e.height,e.parent=this}this.size=b,this.height=c,this.parent=null}function Cf(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 Df(a,b){if(b.cm)throw new Error("This document is already in use.");a.doc=b,b.cm=a,F(a),B(a),a.options.lineWrapping||M(a),a.options.mode=b.modeOption,Gc(a)}function Ef(a,b){if(b-=a.first,0>b||b>=a.size)throw new Error("There is no line "+(b+a.first)+" in the document.");for(var c=a;!c.lines;)for(var d=0;;++d){var e=c.children[d],f=e.chunkSize();if(f>b){c=e;break}b-=f}return c.lines[b]}function Ff(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 Gf(a,b,c){var d=[];return a.iter(b,c,function(a){d.push(a.text)}),d}function Hf(a,b){var c=b-a.height;if(c)for(var d=a;d;d=d.parent)d.height+=c}function If(a){if(null==a.parent)return null;for(var b=a.parent,c=Cg(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}function Jf(a,b){var c=a.first;a:do{for(var d=0;d<a.children.length;++d){var e=a.children[d],f=e.height;if(f>b){a=e;continue a}b-=f,c+=e.chunkSize()}return c}while(!a.lines);for(var d=0;d<a.lines.length;++d){var g=a.lines[d],h=g.height;if(h>b)break;b-=h}return c+d}function Kf(a){a=Re(a);for(var b=0,c=a.parent,d=0;d<c.lines.length;++d){var e=c.lines[d];if(e==a)break;b+=e.height}for(var f=c.parent;f;c=f,f=c.parent)for(var d=0;d<f.children.length;++d){var g=f.children[d];if(g==c)break;b+=g.height}return b}function Lf(a){var b=a.order;return null==b&&(b=a.order=sh(a.text)),b}function Mf(a){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=a||1}function Nf(a,b){var c={from:qb(b.from),to:Ad(b),text:Ff(a,b.from,b.to)};return Uf(a,c,b.from.line,b.to.line+1),Cf(a,function(a){Uf(a,c,b.from.line,b.to.line+1)},!0),c}function Of(a){for(;a.length;){var b=Ag(a);if(!b.ranges)break;a.pop()}}function Pf(a,b){return b?(Of(a.done),Ag(a.done)):a.done.length&&!Ag(a.done).ranges?Ag(a.done):a.done.length>1&&!a.done[a.done.length-2].ranges?(a.done.pop(),Ag(a.done)):void 0}function Qf(a,b,c,d){var e=a.history;e.undone.length=0;var g,f=+new Date;if((e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastModTime>f-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))&&(g=Pf(e,e.lastOp==d))){var h=Ag(g.changes);0==pb(b.from,b.to)&&0==pb(b.from,h.to)?h.to=Ad(b):g.changes.push(Nf(a,b))}else{var i=Ag(e.done);for(i&&i.ranges||Tf(a.sel,e.done),g={changes:[Nf(a,b)],generation:e.generation},e.done.push(g);e.done.length>e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift()}e.done.push(c),e.generation=++e.maxGeneration,e.lastModTime=e.lastSelTime=f,e.lastOp=d,e.lastOrigin=e.lastSelOrigin=b.origin,h||hg(a,"historyAdded")}function Rf(a,b,c,d){var e=b.charAt(0);return"*"==e||"+"==e&&c.ranges.length==d.ranges.length&&c.somethingSelected()==d.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}function Sf(a,b,c,d){var e=a.history,f=d&&d.origin;c==e.lastOp||f&&e.lastSelOrigin==f&&(e.lastModTime==e.lastSelTime&&e.lastOrigin==f||Rf(a,f,Ag(e.done),b))?e.done[e.done.length-1]=b:Tf(b,e.done),e.lastSelTime=+new Date,e.lastSelOrigin=f,e.lastOp=c,d&&d.clearRedo!==!1&&Of(e.undone)}function Tf(a,b){var c=Ag(b);c&&c.ranges&&c.equals(a)||b.push(a)}function Uf(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 Vf(a){if(!a)return null;for(var c,b=0;b<a.length;++b)a[b].marker.explicitlyCleared?c||(c=a.slice(0,b)):c&&c.push(a[b]);return c?c.length?c:null:a}function Wf(a,b){var c=b["spans_"+a.id];if(!c)return null;for(var d=0,e=[];d<b.text.length;++d)e.push(Vf(c[d]));return e}function Xf(a,b,c){for(var d=0,e=[];d<a.length;++d){var f=a[d];if(f.ranges)e.push(c?tb.prototype.deepCopy.call(f):f);else{var g=f.changes,h=[];e.push({changes:h});for(var i=0;i<g.length;++i){var k,j=g[i];if(h.push({from:j.from,to:j.to,text:j.text}),b)for(var l in j)(k=l.match(/^spans_(\d+)$/))&&Cg(b,Number(k[1]))>-1&&(Ag(h)[l]=j[l],delete j[l])}}}return e}function Yf(a,b,c,d){c<a.line?a.line+=d:b<a.line&&(a.line=b,a.ch=0)}function Zf(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e],g=!0;if(f.ranges){f.copied||(f=a[e]=f.deepCopy(),f.copied=!0);for(var h=0;h<f.ranges.length;h++)Yf(f.ranges[h].anchor,b,c,d),Yf(f.ranges[h].head,b,c,d)}else{for(var h=0;h<f.changes.length;++h){var i=f.changes[h];if(c<i.from.line)i.from=ob(i.from.line+d,i.from.ch),i.to=ob(i.to.line+d,i.to.ch);else if(b<=i.to.line){g=!1;break}}g||(a.splice(0,e+1),e=0)}}}function $f(a,b){var c=b.from.line,d=b.to.line,e=b.text.length-(d-c)-1;Zf(a.done,c,d,e),Zf(a.undone,c,d,e)}function bg(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function dg(a){return a.target||a.srcElement}function eg(a){var b=a.which;return null==b&&(1&a.button?b=1:2&a.button?b=3:4&a.button&&(b=2)),s&&a.ctrlKey&&1==b&&(b=3),b}function kg(a,b){function e(a){return function(){a.apply(null,d)}}var c=a._handlers&&a._handlers[b];if(c){var d=Array.prototype.slice.call(arguments,2);ig||(++jg,ig=[],setTimeout(lg,0));for(var f=0;f<c.length;++f)ig.push(e(c[f]))}}function lg(){--jg;var a=ig;ig=null;for(var b=0;b<a.length;++b)a[b]()}function mg(a,b,c){return hg(a,c||b.type,a,b),bg(b)||b.codemirrorIgnore}function ng(a){var b=a._handlers&&a._handlers.cursorActivity;if(b)for(var c=a.curOp.cursorActivityHandlers||(a.curOp.cursorActivityHandlers=[]),d=0;d<b.length;++d)-1==Cg(c,b[d])&&c.push(b[d])}function og(a,b){var c=a._handlers&&a._handlers[b];return c&&c.length>0}function pg(a){a.prototype.on=function(a,b){fg(this,a,b)},a.prototype.off=function(a,b){gg(this,a,b)}}function vg(){this.id=null}function xg(a,b,c){for(var d=0,e=0;;){var f=a.indexOf(" ",d);-1==f&&(f=a.length);var g=f-d;if(f==a.length||e+g>=b)return d+Math.min(g,b-e);if(e+=f-d,e+=c-e%c,d=f+1,e>=b)return d}}function zg(a){for(;yg.length<=a;)yg.push(Ag(yg)+" ");return yg[a]}function Ag(a){return a[a.length-1]}function Cg(a,b){for(var c=0;c<a.length;++c)if(a[c]==b)return c;return-1}function Dg(a,b){for(var c=[],d=0;d<a.length;d++)c[d]=b(a[d],d);return c}function Eg(a,b){var c;if(Object.create)c=Object.create(a);else{var d=function(){};d.prototype=a,c=new d}return b&&Fg(b,c),c}function Fg(a,b,c){b||(b={});for(var d in a)!a.hasOwnProperty(d)||c===!1&&b.hasOwnProperty(d)||(b[d]=a[d]);return b}function Gg(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function Jg(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function Lg(a){return a.charCodeAt(0)>=768&&Kg.test(a)}function Mg(a,b,c,d){var e=document.createElement(a);if(c&&(e.className=c),d&&(e.style.cssText=d),"string"==typeof b)e.appendChild(document.createTextNode(b));else if(b)for(var f=0;f<b.length;++f)e.appendChild(b[f]);return e}function Og(a){for(var b=a.childNodes.length;b>0;--b)a.removeChild(a.firstChild);return a}function Pg(a,b){return Og(a).appendChild(b)}function Qg(a,b){if(a.contains)return a.contains(b);for(;b=b.parentNode;)if(b==a)return!0}function Rg(){return document.activeElement}function Sg(a){return new RegExp("\\b"+a+"\\b\\s*")}function Tg(a,b){var c=Sg(b);c.test(a.className)&&(a.className=a.className.replace(c,""))}function Ug(a,b){Sg(b).test(a.className)||(a.className+=" "+b)}function Vg(a,b){for(var c=a.split(" "),d=0;d<c.length;d++)c[d]&&!Sg(c[d]).test(b)&&(b+=" "+c[d]);return b}function Yg(a){if(null!=Xg)return Xg;var b=Mg("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return Pg(a,b),b.offsetWidth&&(Xg=b.offsetHeight-b.clientHeight),Xg||0}function $g(a){if(null==Zg){var b=Mg("span","\u200b");Pg(a,Mg("span",[b,document.createTextNode("x")])),0!=a.firstChild.offsetHeight&&(Zg=b.offsetWidth<=1&&b.offsetHeight>2&&!c)}return Zg?Mg("span","\u200b"):Mg("span","\xa0",null,"display: inline-block; width: 1px; margin-right: -1px")}function ah(a){if(null!=_g)return _g;var b=Pg(a,document.createTextNode("A\u062eA")),c=Ng(b,0,1).getBoundingClientRect();if(c.left==c.right)return!1;var d=Ng(b,1,2).getBoundingClientRect();return _g=d.right-c.right<3}function fh(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 gh(a){return a.level%2?a.to:a.from}function hh(a){return a.level%2?a.from:a.to}function ih(a){var b=Lf(a);return b?gh(b[0]):0}function jh(a){var b=Lf(a);return b?hh(Ag(b)):a.text.length}function kh(a,b){var c=Ef(a.doc,b),d=Re(c);d!=c&&(b=If(d));var e=Lf(d),f=e?e[0].level%2?jh(d):ih(d):0;return ob(b,f)}function lh(a,b){for(var c,d=Ef(a.doc,b);c=Pe(d);)d=c.find(1,!0).line,b=null;var e=Lf(d),f=e?e[0].level%2?ih(d):jh(d):d.text.length;return ob(null==b?If(d):b,f)}function mh(a,b,c){var d=a[0].level;return b==d?!0:c==d?!1:c>b}function oh(a,b){nh=null;for(var d,c=0;c<a.length;++c){var e=a[c];if(e.from<b&&e.to>b)return c;if(e.from==b||e.to==b){if(null!=d)return mh(a,e.level,a[d].level)?(e.from!=e.to&&(nh=d),c):(e.from!=e.to&&(nh=c),d);d=c}}return d}function ph(a,b,c,d){if(!d)return b+c;do b+=c;while(b>0&&Lg(a.text.charAt(b)));return b}function qh(a,b,c,d){var e=Lf(a);if(!e)return rh(a,b,c,d);for(var f=oh(e,b),g=e[f],h=ph(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 oh(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?ph(a,g.to,-1,d):ph(a,g.from,1,d)}}function rh(a,b,c,d){var e=b+c;if(d)for(;e>0&&Lg(a.text.charAt(e));)e+=c;return 0>e||e>a.text.length?null:e}var a=/gecko\/\d/i.test(navigator.userAgent),b=/MSIE \d/.test(navigator.userAgent),c=b&&(null==document.documentMode||document.documentMode<8),d=b&&(null==document.documentMode||document.documentMode<9),e=b&&(null==document.documentMode||document.documentMode<10),f=/Trident\/([7-9]|\d{2,})\./.test(navigator.userAgent),g=b||f,h=/WebKit\//.test(navigator.userAgent),i=h&&/Qt\/\d+\.\d+/.test(navigator.userAgent),j=/Chrome\//.test(navigator.userAgent),k=/Opera\//.test(navigator.userAgent),l=/Apple Computer/.test(navigator.vendor),m=/KHTML\//.test(navigator.userAgent),n=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),o=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),p=/PhantomJS/.test(navigator.userAgent),q=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),r=q||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),s=q||/Mac/.test(navigator.platform),t=/win/i.test(navigator.platform),u=k&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);u&&(u=Number(u[1])),u&&u>=15&&(k=!1,h=!0);var v=s&&(i||k&&(null==u||12.11>u)),w=a||g&&!d,x=!1,y=!1,ob=z.Pos=function(a,b){return this instanceof ob?(this.line=a,this.ch=b,void 0):new ob(a,b)},pb=z.cmpPos=function(a,b){return a.line-b.line||a.ch-b.ch};tb.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(a){if(a==this)return!0;if(a.primIndex!=this.primIndex||a.ranges.length!=this.ranges.length)return!1;for(var b=0;b<this.ranges.length;b++){var c=this.ranges[b],d=a.ranges[b];if(0!=pb(c.anchor,d.anchor)||0!=pb(c.head,d.head))return!1}return!0},deepCopy:function(){for(var a=[],b=0;b<this.ranges.length;b++)a[b]=new ub(qb(this.ranges[b].anchor),qb(this.ranges[b].head));return new tb(a,this.primIndex)},somethingSelected:function(){for(var a=0;a<this.ranges.length;a++)if(!this.ranges[a].empty())return!0;return!1},contains:function(a,b){b||(b=a);for(var c=0;c<this.ranges.length;c++){var d=this.ranges[c];if(pb(b,d.from())>=0&&pb(a,d.to())<=0)return c}return-1}},ub.prototype={from:function(){return sb(this.anchor,this.head)},to:function(){return rb(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var uc,Yc,Zc,fc={left:0,right:0,top:0,bottom:0},xc=0,dd=0,id=0,jd=null;g?jd=-.53:a?jd=15:j?jd=-.7:l&&(jd=-1/3);var nd,xd,qd=null,Ad=z.changeEnd=function(a){return a.text?ob(a.from.line+a.text.length-1,Ag(a.text).length+(1==a.text.length?a.from.ch:0)):a.to};z.prototype={constructor:z,focus:function(){window.focus(),Rc(this),Oc(this)},setOption:function(a,b){var c=this.options,d=c[a];(c[a]!=b||"mode"==a)&&(c[a]=b,_d.hasOwnProperty(a)&&Bc(this,_d[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:Cc(function(a,b){var c=a.token?a:z.getMode(this.options,a);if(c.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:c,modeSpec:a,opaque:b&&b.opaque}),this.state.modeGen++,Gc(this)}),removeOverlay:Cc(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++,Gc(this),void 0}}),indentLine:Cc(function(a,b,c){"string"!=typeof b&&"number"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract"),Ab(this.doc,a)&&Ud(this,a,b,c)}),indentSelection:Cc(function(a){for(var b=this.doc.sel.ranges,c=-1,d=0;d<b.length;d++){var e=b[d];if(e.empty())e.head.line>c&&(Ud(this,e.head.line,a,!0),c=e.head.line,d==this.doc.sel.primIndex&&Sd(this));else{var f=Math.max(c,e.from().line),g=e.to();c=Math.min(this.lastLine(),g.line-(g.ch?0:1))+1;for(var h=f;c>h;++h)Ud(this,h,a)}}}),getTokenAt:function(a,b){var c=this.doc;a=yb(c,a);for(var d=Wb(this,a.line,b),e=this.doc.mode,f=Ef(c,a.line),g=new pe(f.text,this.options.tabSize);g.pos<a.ch&&!g.eol();){g.start=g.pos;var h=ef(e,g,d)}return{start:g.start,end:g.pos,string:g.current(),type:h||null,state:d}},getTokenTypeAt:function(a){a=yb(this.doc,a);var f,b=hf(this,Ef(this.doc,a.line)),c=0,d=(b.length-1)/2,e=a.ch;if(0==e)f=b[2];else for(;;){var g=c+d>>1;if((g?b[2*g-1]:0)>=e)d=g;else{if(!(b[2*g+1]<e)){f=b[2*g+2];break}c=g+1}}var h=f?f.indexOf("cm-overlay "):-1;return 0>h?f:0==h?null:f.slice(0,h-1)},getModeAt:function(a){var b=this.doc.mode;return b.innerMode?z.innerMode(b,this.getTokenAt(a).state).mode:b},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,b){var c=[];if(!ge.hasOwnProperty(b))return ge;var d=ge[b],e=this.getModeAt(a);if("string"==typeof e[b])d[e[b]]&&c.push(d[e[b]]);else if(e[b])for(var f=0;f<e[b].length;f++){var g=d[e[b][f]];g&&c.push(g)}else e.helperType&&d[e.helperType]?c.push(d[e.helperType]):d[e.name]&&c.push(d[e.name]);for(var f=0;f<d._global.length;f++){var h=d._global[f];h.pred(e,this)&&-1==Cg(c,h.val)&&c.push(h.val)}return c},getStateAfter:function(a,b){var c=this.doc;return a=xb(c,null==a?c.first+c.size-1:a),Wb(this,a+1,b)},cursorCoords:function(a,b){var c,d=this.doc.sel.primary();return c=null==a?d.head:"object"==typeof a?yb(this.doc,a):a?d.from():d.to(),pc(this,c,b||"page")},charCoords:function(a,b){return oc(this,yb(this.doc,a),b||"page")},coordsChar:function(a,b){return a=nc(this,a,b||"page"),sc(this,a.left,a.top)},lineAtHeight:function(a,b){return a=nc(this,{top:a,left:0},b||"page").top,Jf(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=Ef(this.doc,a);return mc(this,e,{top:0,left:0},b||"page").top+(c?this.doc.height-Kf(e):0)},defaultTextHeight:function(){return vc(this.display)},defaultCharWidth:function(){return wc(this.display)},setGutterMarker:Cc(function(a,b,c){return Vd(this,a,"gutter",function(a){var d=a.gutterMarkers||(a.gutterMarkers={});return d[b]=c,!c&&Jg(d)&&(a.gutterMarkers=null),!0})}),clearGutter:Cc(function(a){var b=this,c=b.doc,d=c.first;c.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&(c.gutterMarkers[a]=null,Hc(b,d,"gutter"),Jg(c.gutterMarkers)&&(c.gutterMarkers=null)),++d})}),addLineClass:Cc(function(a,b,c){return Vd(this,a,"class",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:Cc(function(a,b,c){return Vd(this,a,"class",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:Cc(function(a,b,c){return $e(this,a,b,c)}),removeLineWidget:function(a){a.clear()},lineInfo:function(a){if("number"==typeof a){if(!Ab(this.doc,a))return null;var b=a;if(a=Ef(this.doc,a),!a)return null}else{var b=If(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.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=pc(this,yb(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&&Pd(this,h,g,h+b.offsetWidth,g+b.offsetHeight)},triggerOnKeyDown:Cc(rd),triggerOnKeyPress:Cc(ud),triggerOnKeyUp:Cc(td),execCommand:function(a){return je.hasOwnProperty(a)?je[a](this):void 0},findPosH:function(a,b,c,d){var e=1;0>b&&(e=-1,b=-b);for(var f=0,g=yb(this.doc,a);b>f&&(g=Xd(this.doc,g,e,c,d),!g.hitSide);++f);return g},moveH:Cc(function(a,b){var c=this;c.extendSelectionsBy(function(d){return c.display.shift||c.doc.extend||d.empty()?Xd(c.doc,d.head,a,b,c.options.rtlMoveVisually):0>a?d.from():d.to()},ug)}),deleteH:Cc(function(a,b){var c=this.doc.sel,d=this.doc;c.somethingSelected()?d.replaceSelection("",null,"+delete"):Wd(this,function(c){var e=Xd(d,c.head,a,b,!1);return 0>a?{from:e,to:c.head}:{from:c.head,to:e}})}),findPosV:function(a,b,c,d){var e=1,f=d;0>b&&(e=-1,b=-b);for(var g=0,h=yb(this.doc,a);b>g;++g){var i=pc(this,h,"div");if(null==f?f=i.left:i.left=f,h=Yd(this,i,e,c),h.hitSide)break}return h},moveV:Cc(function(a,b){var c=this,d=this.doc,e=[],f=!c.display.shift&&!d.extend&&d.sel.somethingSelected();if(d.extendSelectionsBy(function(g){if(f)return 0>a?g.from():g.to();var h=pc(c,g.head,"div");null!=g.goalColumn&&(h.left=g.goalColumn),e.push(h.left);var i=Yd(c,h,a,b);return"page"==b&&g==d.sel.primary()&&Rd(c,null,oc(c,i,"div").top-h.top),i},ug),e.length)for(var g=0;g<d.sel.ranges.length;g++)d.sel.ranges[g].goalColumn=e[g]}),toggleOverwrite:function(a){(null==a||a!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?Ug(this.display.cursorDiv,"CodeMirror-overwrite"):Tg(this.display.cursorDiv,"CodeMirror-overwrite"),hg(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return Rg()==this.display.input},scrollTo:Cc(function(a,b){(null!=a||null!=b)&&Td(this),null!=a&&(this.curOp.scrollLeft=a),null!=b&&(this.curOp.scrollTop=b)}),getScrollInfo:function(){var a=this.display.scroller,b=qg;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-b,width:a.scrollWidth-b,clientHeight:a.clientHeight-b,clientWidth:a.clientWidth-b}},scrollIntoView:Cc(function(a,b){if(null==a?(a={from:this.doc.sel.primary().head,to:null},null==b&&(b=this.options.cursorScrollMargin)):"number"==typeof a?a={from:ob(a,0),to:null}:null==a.from&&(a={from:a,to:null}),a.to||(a.to=a.from),a.margin=b||0,null!=a.from.line)Td(this),this.curOp.scrollToPos=a;else{var c=Qd(this,Math.min(a.from.left,a.to.left),Math.min(a.from.top,a.to.top)-a.margin,Math.max(a.from.right,a.to.right),Math.max(a.from.bottom,a.to.bottom)+a.margin);this.scrollTo(c.scrollLeft,c.scrollTop)}}),setSize:Cc(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&&ic(this),this.curOp.forceUpdate=!0,hg(this,"refresh",this)}),operation:function(a){return Ac(this,a)},refresh:Cc(function(){var a=this.display.cachedTextHeight;Gc(this),this.curOp.forceUpdate=!0,jc(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),K(this),(null==a||Math.abs(a-vc(this.display))>.5)&&F(this),hg(this,"refresh",this)}),swapDoc:Cc(function(a){var b=this.doc;return b.cm=null,Df(this,a),jc(this),Qc(this),this.scrollTo(a.scrollLeft,a.scrollTop),kg(this,"swapDoc",this,b),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}},pg(z);var $d=z.defaults={},_d=z.optionHandlers={},be=z.Init={toString:function(){return"CodeMirror.Init"}};ae("value","",function(a,b){a.setValue(b)},!0),ae("mode",null,function(a,b){a.doc.modeOption=b,B(a)},!0),ae("indentUnit",2,B,!0),ae("indentWithTabs",!1),ae("smartIndent",!0),ae("tabSize",4,function(a){C(a),jc(a),Gc(a)},!0),ae("specialChars",/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/g,function(a,b){a.options.specialChars=new RegExp(b.source+(b.test(" ")?"":"| "),"g"),a.refresh()},!0),ae("specialCharPlaceholder",of,function(a){a.refresh()},!0),ae("electricChars",!0),ae("rtlMoveVisually",!t),ae("wholeLineUpdateBefore",!0),ae("theme","default",function(a){H(a),I(a)},!0),ae("keyMap","default",G),ae("extraKeys",null),ae("lineWrapping",!1,D,!0),ae("gutters",[],function(a){N(a.options),I(a)},!0),ae("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?U(a.display)+"px":"0",a.refresh()
4
+ },!0),ae("coverGutterNextToScrollbar",!1,P,!0),ae("lineNumbers",!1,function(a){N(a.options),I(a)},!0),ae("firstLineNumber",1,I,!0),ae("lineNumberFormatter",function(a){return a},I,!0),ae("showCursorWhenSelecting",!1,Pb,!0),ae("resetSelectionOnContextMenu",!0),ae("readOnly",!1,function(a,b){"nocursor"==b?(wd(a),a.display.input.blur(),a.display.disabled=!0):(a.display.disabled=!1,b||Qc(a))}),ae("disableInput",!1,function(a,b){b||Qc(a)},!0),ae("dragDrop",!0),ae("cursorBlinkRate",530),ae("cursorScrollMargin",0),ae("cursorHeight",1),ae("workTime",100),ae("workDelay",100),ae("flattenSpans",!0,C,!0),ae("addModeClass",!1,C,!0),ae("pollInterval",100),ae("undoDepth",200,function(a,b){a.doc.history.undoDepth=b}),ae("historyEventDelay",1250),ae("viewportMargin",10,function(a){a.refresh()},!0),ae("maxHighlightLength",1e4,C,!0),ae("moveInputWithCursor",!0,function(a,b){b||(a.display.inputDiv.style.top=a.display.inputDiv.style.left=0)}),ae("tabindex",null,function(a,b){a.display.input.tabIndex=b||""}),ae("autofocus",null);var ce=z.modes={},de=z.mimeModes={};z.defineMode=function(a,b){if(z.defaults.mode||"null"==a||(z.defaults.mode=a),arguments.length>2){b.dependencies=[];for(var c=2;c<arguments.length;++c)b.dependencies.push(arguments[c])}ce[a]=b},z.defineMIME=function(a,b){de[a]=b},z.resolveMode=function(a){if("string"==typeof a&&de.hasOwnProperty(a))a=de[a];else if(a&&"string"==typeof a.name&&de.hasOwnProperty(a.name)){var b=de[a.name];"string"==typeof b&&(b={name:b}),a=Eg(b,a),a.name=b.name}else if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return z.resolveMode("application/xml");return"string"==typeof a?{name:a}:a||{name:"null"}},z.getMode=function(a,b){var b=z.resolveMode(b),c=ce[b.name];if(!c)return z.getMode(a,"text/plain");var d=c(a,b);if(ee.hasOwnProperty(b.name)){var e=ee[b.name];for(var f in e)e.hasOwnProperty(f)&&(d.hasOwnProperty(f)&&(d["_"+f]=d[f]),d[f]=e[f])}if(d.name=b.name,b.helperType&&(d.helperType=b.helperType),b.modeProps)for(var f in b.modeProps)d[f]=b.modeProps[f];return d},z.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}}),z.defineMIME("text/plain","null");var ee=z.modeExtensions={};z.extendMode=function(a,b){var c=ee.hasOwnProperty(a)?ee[a]:ee[a]={};Fg(b,c)},z.defineExtension=function(a,b){z.prototype[a]=b},z.defineDocExtension=function(a,b){zf.prototype[a]=b},z.defineOption=ae;var fe=[];z.defineInitHook=function(a){fe.push(a)};var ge=z.helpers={};z.registerHelper=function(a,b,c){ge.hasOwnProperty(a)||(ge[a]=z[a]={_global:[]}),ge[a][b]=c},z.registerGlobalHelper=function(a,b,c,d){z.registerHelper(a,b,d),ge[a]._global.push({pred:c,val:d})};var he=z.copyState=function(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},ie=z.startState=function(a,b,c){return a.startState?a.startState(b,c):!0};z.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 je=z.commands={selectAll:function(a){a.setSelection(ob(a.firstLine(),0),ob(a.lastLine()),sg)},singleSelection:function(a){a.setSelection(a.getCursor("anchor"),a.getCursor("head"),sg)},killLine:function(a){Wd(a,function(b){if(b.empty()){var c=Ef(a.doc,b.head.line).text.length;return b.head.ch==c&&b.head.line<a.lastLine()?{from:b.head,to:ob(b.head.line+1,0)}:{from:b.head,to:ob(b.head.line,c)}}return{from:b.from(),to:b.to()}})},deleteLine:function(a){Wd(a,function(b){return{from:ob(b.from().line,0),to:yb(a.doc,ob(b.to().line+1,0))}})},delLineLeft:function(a){Wd(a,function(a){return{from:ob(a.from().line,0),to:a.from()}})},undo:function(a){a.undo()},redo:function(a){a.redo()},undoSelection:function(a){a.undoSelection()},redoSelection:function(a){a.redoSelection()},goDocStart:function(a){a.extendSelection(ob(a.firstLine(),0))},goDocEnd:function(a){a.extendSelection(ob(a.lastLine()))},goLineStart:function(a){a.extendSelectionsBy(function(b){return kh(a,b.head.line)},ug)},goLineStartSmart:function(a){a.extendSelectionsBy(function(b){var c=kh(a,b.head.line),d=a.getLineHandle(c.line),e=Lf(d);if(!e||0==e[0].level){var f=Math.max(0,d.text.search(/\S/)),g=b.head.line==c.line&&b.head.ch<=f&&b.head.ch;return ob(c.line,g?0:f)}return c},ug)},goLineEnd:function(a){a.extendSelectionsBy(function(b){return lh(a,b.head.line)},ug)},goLineRight:function(a){a.extendSelectionsBy(function(b){var c=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:c},"div")},ug)},goLineLeft:function(a){a.extendSelectionsBy(function(b){var c=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:c},"div")},ug)},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(" ")},insertSoftTab:function(a){for(var b=[],c=a.listSelections(),d=a.options.tabSize,e=0;e<c.length;e++){var f=c[e].from(),g=wg(a.getLine(f.line),f.ch,d);b.push(new Array(d-g%d+1).join(" "))}a.replaceSelections(b)},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.execCommand("insertTab")},transposeChars:function(a){Ac(a,function(){for(var b=a.listSelections(),c=0;c<b.length;c++){var d=b[c].head,e=Ef(a.doc,d.line).text;d.ch>0&&d.ch<e.length-1&&a.replaceRange(e.charAt(d.ch)+e.charAt(d.ch-1),ob(d.line,d.ch-1),ob(d.line,d.ch+1))}})},newlineAndIndent:function(a){Ac(a,function(){for(var b=a.listSelections().length,c=0;b>c;c++){var d=a.listSelections()[c];a.replaceRange("\n",d.anchor,d.head,"+input"),a.indentLine(d.from().line+1,null,!0),Sd(a)}})},toggleOverwrite:function(a){a.toggleOverwrite()}},ke=z.keyMap={};ke.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},ke.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-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","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},ke.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","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection",fallthrough:["basic","emacsy"]},ke.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"},ke["default"]=s?ke.macDefault:ke.pcDefault;var me=z.lookupKey=function(a,b,c){function d(b){b=le(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;g<f.length;++g){var h=d(f[g]);if(h)return h}return!1}for(var e=0;e<b.length;++e){var f=d(b[e]);if(f)return"stop"!=f}},ne=z.isModifierKey=function(a){var b=eh[a.keyCode];return"Ctrl"==b||"Alt"==b||"Shift"==b||"Mod"==b},oe=z.keyName=function(a,b){if(k&&34==a.keyCode&&a["char"])return!1;var c=eh[a.keyCode];return null==c||a.altGraphKey?!1:(a.altKey&&(c="Alt-"+c),(v?a.metaKey:a.ctrlKey)&&(c="Ctrl-"+c),(v?a.ctrlKey:a.metaKey)&&(c="Cmd-"+c),!b&&a.shiftKey&&(c="Shift-"+c),c)};z.fromTextArea=function(a,b){function d(){a.value=i.getValue()}if(b||(b={}),b.value=a.value,!b.tabindex&&a.tabindex&&(b.tabindex=a.tabindex),!b.placeholder&&a.placeholder&&(b.placeholder=a.placeholder),null==b.autofocus){var c=Rg();b.autofocus=c==a||null!=a.getAttribute("autofocus")&&c==document.body}if(a.form&&(fg(a.form,"submit",d),!b.leaveSubmitMethodAlone)){var e=a.form,f=e.submit;try{var g=e.submit=function(){d(),e.submit=f,e.submit(),e.submit=g}}catch(h){}}a.style.display="none";var i=z(function(b){a.parentNode.insertBefore(b,a.nextSibling)},b);return i.save=d,i.getTextArea=function(){return a},i.toTextArea=function(){d(),a.parentNode.removeChild(i.getWrapperElement()),a.style.display="",a.form&&(gg(a.form,"submit",d),"function"==typeof a.form.submit&&(a.form.submit=f))},i};var pe=z.StringStream=function(a,b){this.pos=this.start=0,this.string=a,this.tabSize=b||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};pe.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},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=wg(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?wg(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return wg(this.string,null,this.tabSize)-(this.lineStart?wg(this.string,this.lineStart,this.tabSize):0)},match:function(a,b,c){if("string"!=typeof a){var f=this.string.slice(this.pos).match(a);return f&&f.index>0?null:(f&&b!==!1&&(this.pos+=f[0].length),f)}var d=function(a){return c?a.toLowerCase():a},e=this.string.substr(this.pos,a.length);return d(e)==d(a)?(b!==!1&&(this.pos+=a.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}}};var qe=z.TextMarker=function(a,b){this.lines=[],this.type=b,this.doc=a};pg(qe),qe.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;if(b&&yc(a),og(this,"clear")){var c=this.find();c&&kg(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=ze(g.markedSpans,this);a&&!this.collapsed?Hc(a,If(g),"text"):a&&(null!=h.to&&(e=If(g)),null!=h.from&&(d=If(g))),g.markedSpans=Ae(g.markedSpans,h),null==h.from&&this.collapsed&&!Ve(this.doc,g)&&a&&Hf(g,vc(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(var f=0;f<this.lines.length;++f){var i=Re(this.lines[f]),j=L(i);j>a.display.maxLineLength&&(a.display.maxLine=i,a.display.maxLineLength=j,a.display.maxLineChanged=!0)}null!=d&&a&&this.collapsed&&Gc(a,d,e+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&Mb(a.doc)),a&&kg(a,"markerCleared",a,this),b&&zc(a),this.parent&&this.parent.clear()}},qe.prototype.find=function(a,b){null==a&&"bookmark"==this.type&&(a=1);for(var c,d,e=0;e<this.lines.length;++e){var f=this.lines[e],g=ze(f.markedSpans,this);if(null!=g.from&&(c=ob(b?f:If(f),g.from),-1==a))return c;if(null!=g.to&&(d=ob(b?f:If(f),g.to),1==a))return d}return c&&{from:c,to:d}},qe.prototype.changed=function(){var a=this.find(-1,!0),b=this,c=this.doc.cm;a&&c&&Ac(c,function(){var d=a.line,e=If(a.line),f=cc(c,e);if(f&&(hc(f),c.curOp.selectionChanged=c.curOp.forceUpdate=!0),c.curOp.updateMaxLine=!0,!Ve(b.doc,d)&&null!=b.height){var g=b.height;b.height=null;var h=Ze(b)-g;h&&Hf(d,d.height+h)}})},qe.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&-1!=Cg(b.maybeHiddenMarkers,this)||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)},qe.prototype.detachLine=function(a){if(this.lines.splice(Cg(this.lines,a),1),!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;(b.maybeHiddenMarkers||(b.maybeHiddenMarkers=[])).push(this)}};var re=0,te=z.SharedTextMarker=function(a,b){this.markers=a,this.primary=b;for(var c=0;c<a.length;++c)a[c].parent=this};pg(te),te.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();kg(this,"clear")}},te.prototype.find=function(a,b){return this.primary.find(a,b)};var Xe=z.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};pg(Xe),Xe.prototype.clear=function(){var a=this.cm,b=this.line.widgets,c=this.line,d=If(c);if(null!=d&&b){for(var e=0;e<b.length;++e)b[e]==this&&b.splice(e--,1);b.length||(c.widgets=null);var f=Ze(this);Ac(a,function(){Ye(a,c,-f),Hc(a,d,"widget"),Hf(c,Math.max(0,c.height-f))})}},Xe.prototype.changed=function(){var a=this.height,b=this.cm,c=this.line;this.height=null;var d=Ze(this)-a;d&&Ac(b,function(){b.curOp.forceUpdate=!0,Ye(b,c,d),Hf(c,c.height+d)})};var _e=z.Line=function(a,b,c){this.text=a,Je(this,b),this.height=c?c(this):1};pg(_e),_e.prototype.lineNo=function(){return If(this)};var kf={},lf={};wf.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,bf(e),kg(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.push.apply(a,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;d<b.length;++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}},xf.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&&(this.children.length>1||!(this.children[0]instanceof wf))){var h=[];this.collapse(h),this.children=[new wf(h)],this.children[0].parent=this}},collapse:function(a){for(var b=0;b<this.children.length;++b)this.children[b].collapse(a)},insertInner:function(a,b,c){this.size+=b.length,this.height+=c;for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(f>=a){if(e.insertInner(a,b,c),e.lines&&e.lines.length>50){for(;e.lines.length>50;){var g=e.lines.splice(e.lines.length-25,25),h=new wf(g);e.height-=h.height,this.children.splice(d+1,0,h),h.parent=this}this.maybeSpill()}break}a-=f}},maybeSpill:function(){if(!(this.children.length<=10)){var a=this;do{var b=a.children.splice(a.children.length-5,5),c=new xf(b);if(a.parent){a.size-=c.size,a.height-=c.height;var e=Cg(a.parent.children,a);a.parent.children.splice(e+1,0,c)}else{var d=new xf(a.children);d.parent=a,a.children=[d,c],a=d}c.parent=a.parent}while(a.children.length>10);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(f>a){var g=Math.min(b,f-a);if(e.iterN(a,g,c))return!0;if(0==(b-=g))break;a=0}else a-=f}}};var yf=0,zf=z.Doc=function(a,b,c){if(!(this instanceof zf))return new zf(a,b,c);null==c&&(c=0),xf.call(this,[new wf([new _e("",null)])]),this.first=c,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=c;var d=ob(c,0);this.sel=wb(d),this.history=new Mf(null),this.id=++yf,this.modeOption=b,"string"==typeof a&&(a=bh(a)),vf(this,{from:d,to:d,text:a}),Jb(this,wb(d),sg)};zf.prototype=Eg(xf.prototype,{constructor:zf,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;d<b.length;++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=Gf(this,this.first,this.first+this.size);return a===!1?b:b.join(a||"\n")},setValue:Dc(function(a){var b=ob(this.first,0),c=this.first+this.size-1;Gd(this,{from:b,to:ob(c,Ef(this,c).text.length),text:bh(a),origin:"setValue"},!0),Jb(this,wb(b))}),replaceRange:function(a,b,c,d){b=yb(this,b),c=c?yb(this,c):b,Md(this,a,b,c,d)},getRange:function(a,b,c){var d=Ff(this,yb(this,a),yb(this,b));return c===!1?d:d.join(c||"\n")},getLine:function(a){var b=this.getLineHandle(a);return b&&b.text},getLineHandle:function(a){return Ab(this,a)?Ef(this,a):void 0},getLineNumber:function(a){return If(a)},getLineHandleVisualStart:function(a){return"number"==typeof a&&(a=Ef(this,a)),Re(a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return yb(this,a)},getCursor:function(a){var c,b=this.sel.primary();return c=null==a||"head"==a?b.head:"anchor"==a?b.anchor:"end"==a||"to"==a||a===!1?b.to():b.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Dc(function(a,b,c){Gb(this,yb(this,"number"==typeof a?ob(a,b||0):a),null,c)}),setSelection:Dc(function(a,b,c){Gb(this,yb(this,a),yb(this,b||a),c)}),extendSelection:Dc(function(a,b,c){Db(this,yb(this,a),b&&yb(this,b),c)}),extendSelections:Dc(function(a,b){Eb(this,Bb(this,a,b))}),extendSelectionsBy:Dc(function(a,b){Eb(this,Dg(this.sel.ranges,a),b)}),setSelections:Dc(function(a,b,c){if(a.length){for(var d=0,e=[];d<a.length;d++)e[d]=new ub(yb(this,a[d].anchor),yb(this,a[d].head));null==b&&(b=Math.min(a.length-1,this.sel.primIndex)),Jb(this,vb(e,b),c)}}),addSelection:Dc(function(a,b,c){var d=this.sel.ranges.slice(0);d.push(new ub(yb(this,a),yb(this,b||a))),Jb(this,vb(d,d.length-1),c)}),getSelection:function(a){for(var c,b=this.sel.ranges,d=0;d<b.length;d++){var e=Ff(this,b[d].from(),b[d].to());c=c?c.concat(e):e}return a===!1?c:c.join(a||"\n")},getSelections:function(a){for(var b=[],c=this.sel.ranges,d=0;d<c.length;d++){var e=Ff(this,c[d].from(),c[d].to());a!==!1&&(e=e.join(a||"\n")),b[d]=e}return b},replaceSelection:Dc(function(a,b,c){for(var d=[],e=0;e<this.sel.ranges.length;e++)d[e]=a;this.replaceSelections(d,b,c||"+input")}),replaceSelections:function(a,b,c){for(var d=[],e=this.sel,f=0;f<e.ranges.length;f++){var g=e.ranges[f];d[f]={from:g.from(),to:g.to(),text:bh(a[f]),origin:c}}for(var h=b&&"end"!=b&&Ed(this,d,b),f=d.length-1;f>=0;f--)Gd(this,d[f]);h?Ib(this,h):this.cm&&Sd(this.cm)},undo:Dc(function(){Id(this,"undo")}),redo:Dc(function(){Id(this,"redo")}),undoSelection:Dc(function(){Id(this,"undo",!0)}),redoSelection:Dc(function(){Id(this,"redo",!0)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=this.history,b=0,c=0,d=0;d<a.done.length;d++)a.done[d].ranges||++b;for(var d=0;d<a.undone.length;d++)a.undone[d].ranges||++c;return{undo:b,redo:c}},clearHistory:function(){this.history=new Mf(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(a){return a&&(this.history.lastOp=this.history.lastOrigin=null),this.history.generation},isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},getHistory:function(){return{done:Xf(this.history.done),undone:Xf(this.history.undone)}},setHistory:function(a){var b=this.history=new Mf(this.history.maxGeneration);b.done=Xf(a.done.slice(0),null,!0),b.undone=Xf(a.undone.slice(0),null,!0)},markText:function(a,b,c){return se(this,yb(this,a),yb(this,b),c,"range")},setBookmark:function(a,b){var c={replacedWith:b&&(null==b.nodeType?b.widget:b),insertLeft:b&&b.insertLeft,clearWhenEmpty:!1,shared:b&&b.shared};return a=yb(this,a),se(this,a,a,c,"bookmark")},findMarksAt:function(a){a=yb(this,a);var b=[],c=Ef(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},findMarks:function(a,b,c){a=yb(this,a),b=yb(this,b);var d=[],e=a.line;return this.iter(a.line,b.line+1,function(f){var g=f.markedSpans;if(g)for(var h=0;h<g.length;h++){var i=g[h];e==a.line&&a.ch>i.to||null==i.from&&e!=a.line||e==b.line&&i.from>b.ch||c&&!c(i.marker)||d.push(i.marker.parent||i.marker)}++e}),d},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)}),yb(this,ob(c,b))},indexFromPos:function(a){a=yb(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 zf(Gf(this,this.first,this.first+this.size),this.modeOption,this.first);return b.scrollTop=this.scrollTop,b.scrollLeft=this.scrollLeft,b.sel=this.sel,b.extend=!1,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 zf(Gf(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}],we(d,ve(this)),d},unlinkDoc:function(a){if(a instanceof z&&(a=a.doc),this.linked)for(var b=0;b<this.linked.length;++b){var c=this.linked[b];if(c.doc==a){this.linked.splice(b,1),a.unlinkDoc(this),xe(ve(this));break}}if(a.history==this.history){var d=[a.id];Cf(a,function(a){d.push(a.id)},!0),a.history=new Mf(null),a.history.done=Xf(this.history.done,d),a.history.undone=Xf(this.history.undone,d)}},iterLinkedDocs:function(a){Cf(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),zf.prototype.eachLine=zf.prototype.iter;var Af="iter insert remove copy getEditor".split(" ");for(var Bf in zf.prototype)zf.prototype.hasOwnProperty(Bf)&&Cg(Af,Bf)<0&&(z.prototype[Bf]=function(a){return function(){return a.apply(this.doc,arguments)}}(zf.prototype[Bf]));pg(zf);var ig,_f=z.e_preventDefault=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1},ag=z.e_stopPropagation=function(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},cg=z.e_stop=function(a){_f(a),ag(a)},fg=z.on=function(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)}},gg=z.off=function(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}}},hg=z.signal=function(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)},jg=0,qg=30,rg=z.Pass={toString:function(){return"CodeMirror.Pass"}},sg={scroll:!1},tg={origin:"*mouse"},ug={origin:"+move"};vg.prototype.set=function(a,b){clearTimeout(this.id),this.id=setTimeout(b,a)};var wg=z.countColumn=function(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;;){var h=a.indexOf(" ",f);if(0>h||h>=b)return g+(b-f);g+=h-f,g+=c-g%c,f=h+1}},yg=[""],Bg=function(a){a.select()};q?Bg=function(a){a.selectionStart=0,a.selectionEnd=a.value.length}:g&&(Bg=function(a){try{a.select()}catch(b){}}),[].indexOf&&(Cg=function(a,b){return a.indexOf(b)}),[].map&&(Dg=function(a,b){return a.map(b)});var Ng,Hg=/[\u00df\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Ig=z.isWordChar=function(a){return/\w/.test(a)||a>"\x80"&&(a.toUpperCase()!=a.toLowerCase()||Hg.test(a))},Kg=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;Ng=document.createRange?function(a,b,c){var d=document.createRange();return d.setEnd(a,c),d.setStart(a,b),d}:function(a,b,c){var d=document.body.createTextRange();return d.moveToElementText(a.parentNode),d.collapse(!0),d.moveEnd("character",c),d.moveStart("character",b),d},b&&(Rg=function(){try{return document.activeElement}catch(a){return document.body}});var Xg,Zg,_g,Wg=function(){if(d)return!1;var a=Mg("div");return"draggable"in a||"dragDrop"in a}(),bh=z.splitLines=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/)},ch=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},dh=function(){var a=Mg("div");return"oncopy"in a?!0:(a.setAttribute("oncopy","return;"),"function"==typeof a.oncopy)}(),eh={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};z.keyNames=eh,function(){for(var a=0;10>a;a++)eh[a+48]=eh[a+96]=String(a);for(var a=65;90>=a;a++)eh[a]=String.fromCharCode(a);for(var a=1;12>=a;a++)eh[a+111]=eh[a+63235]="F"+a}();var nh,sh=function(){function c(c){return 247>=c?a.charAt(c):c>=1424&&1524>=c?"R":c>=1536&&1773>=c?b.charAt(c-1536):c>=1774&&2220>=c?"r":c>=8192&&8203>=c?"w":8204==c?"b":"L"}function j(a,b,c){this.level=a,this.from=b,this.to=c}var a="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",b="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",d=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,e=/[stwN]/,f=/[LRr]/,g=/[Lb1n]/,h=/[1n]/,i="L";return function(a){if(!d.test(a))return!1;for(var m,b=a.length,k=[],l=0;b>l;++l)k.push(m=c(a.charCodeAt(l)));for(var l=0,n=i;b>l;++l){var m=k[l];"m"==m?k[l]=n:n=m}for(var l=0,o=i;b>l;++l){var m=k[l];"1"==m&&"r"==o?k[l]="n":f.test(m)&&(o=m,"r"==m&&(k[l]="R"))}for(var l=1,n=k[0];b-1>l;++l){var m=k[l];"+"==m&&"1"==n&&"1"==k[l+1]?k[l]="1":","!=m||n!=k[l+1]||"1"!=n&&"n"!=n||(k[l]=n),n=m}for(var l=0;b>l;++l){var m=k[l];if(","==m)k[l]="N";else if("%"==m){for(var p=l+1;b>p&&"%"==k[p];++p);for(var q=l&&"!"==k[l-1]||b>p&&"1"==k[p]?"1":"N",r=l;p>r;++r)k[r]=q;l=p-1}}for(var l=0,o=i;b>l;++l){var m=k[l];"L"==o&&"1"==m?k[l]="L":f.test(m)&&(o=m)}for(var l=0;b>l;++l)if(e.test(k[l])){for(var p=l+1;b>p&&e.test(k[p]);++p);for(var s="L"==(l?k[l-1]:i),t="L"==(b>p?k[p]:i),q=s||t?"L":"R",r=l;p>r;++r)k[r]=q;l=p-1}for(var v,u=[],l=0;b>l;)if(g.test(k[l])){var w=l;for(++l;b>l&&g.test(k[l]);++l);u.push(new j(0,w,l))}else{var x=l,y=u.length;for(++l;b>l&&"L"!=k[l];++l);for(var r=x;l>r;)if(h.test(k[r])){r>x&&u.splice(y,0,new j(1,x,r));var z=r;for(++r;l>r&&h.test(k[r]);++r);u.splice(y,0,new j(2,z,r)),x=r}else++r;l>x&&u.splice(y,0,new j(1,x,l))}return 1==u[0].level&&(v=a.match(/^\s+/))&&(u[0].from=v[0].length,u.unshift(new j(0,0,v[0].length))),1==Ag(u).level&&(v=a.match(/\s+$/))&&(Ag(u).to-=v[0].length,u.push(new j(0,b-v[0].length,b))),u[0].level!=Ag(u).level&&u.push(new j(u[0].level,b,b)),u}}();return z.version="4.0.4",z}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";function b(a){for(var b={},c=0;c<a.length;++c)b[a[c]]=!0;return b}function q(a,b){for(var d,c=!1;null!=(d=a.next());){if(c&&"/"==d){b.tokenize=null;
5
  break}c="*"==d}return["comment","comment"]}function r(a,b){return a.skipTo("-->")?(a.match("-->"),b.tokenize=null):a.skipToEnd(),["comment","comment"]}a.defineMode("css",function(b,c){function p(a,b){return n=b,a}function q(a,b){var c=a.next();if(e[c]){var d=e[c](a,b);if(d!==!1)return d}return"@"==c?(a.eatWhile(/[\w\\\-]/),p("def",a.current())):"="==c||("~"==c||"|"==c)&&a.eat("=")?p(null,"compare"):'"'==c||"'"==c?(b.tokenize=r(c),b.tokenize(a,b)):"#"==c?(a.eatWhile(/[\w\\\-]/),p("atom","hash")):"!"==c?(a.match(/^\s*\w*/),p("keyword","important")):/\d/.test(c)||"."==c&&a.eat(/\d/)?(a.eatWhile(/[\w.%]/),p("number","unit")):"-"!==c?/[,+>*\/]/.test(c)?p(null,"select-op"):"."==c&&a.match(/^-?[_a-z][_a-z0-9-]*/i)?p("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(c)?p(null,c):"u"==c&&a.match("rl(")?(a.backUp(1),b.tokenize=s,p("property","word")):/[\w\\\-]/.test(c)?(a.eatWhile(/[\w\\\-]/),p("property","word")):p(null,null):/[\d.]/.test(a.peek())?(a.eatWhile(/[\w.%]/),p("number","unit")):a.match(/^[^-]+-/)?p("meta","meta"):void 0}function r(a){return function(b,c){for(var e,d=!1;null!=(e=b.next());){if(e==a&&!d){")"==a&&b.backUp(1);break}d=!d&&"\\"==e}return(e==a||!d&&")"!=a)&&(c.tokenize=null),p("string","string")}}function s(a,b){return a.next(),b.tokenize=a.match(/\s*[\"\')]/,!1)?null:r(")"),p(null,"(")}function t(a,b,c){this.type=a,this.indent=b,this.prev=c}function u(a,b,c){return a.context=new t(c,b.indentation()+d,a.context),c}function v(a){return a.context=a.context.prev,a.context.type}function w(a,b,c){return z[c.context.type](a,b,c)}function x(a,b,c,d){for(var e=d||1;e>0;e--)c.context=c.context.prev;return w(a,b,c)}function y(a){var b=a.current().toLowerCase();o=k.hasOwnProperty(b)?"atom":j.hasOwnProperty(b)?"keyword":"variable"}c.propertyKeywords||(c=a.resolveMode("text/css"));var n,o,d=b.indentUnit,e=c.tokenHooks,f=c.mediaTypes||{},g=c.mediaFeatures||{},h=c.propertyKeywords||{},i=c.nonStandardPropertyKeywords||{},j=c.colorKeywords||{},k=c.valueKeywords||{},l=c.fontProperties||{},m=c.allowNested,z={};return z.top=function(a,b,c){if("{"==a)return u(c,b,"block");if("}"==a&&c.context.prev)return v(c);if("@media"==a)return u(c,b,"media");if("@font-face"==a)return"font_face_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(a))return"keyframes";if(a&&"@"==a.charAt(0))return u(c,b,"at");if("hash"==a)o="builtin";else if("word"==a)o="tag";else{if("variable-definition"==a)return"maybeprop";if("interpolation"==a)return u(c,b,"interpolation");if(":"==a)return"pseudo";if(m&&"("==a)return u(c,b,"params")}return c.context.type},z.block=function(a,b,c){if("word"==a){var d=b.current().toLowerCase();return h.hasOwnProperty(d)?(o="property","maybeprop"):i.hasOwnProperty(d)?(o="string-2","maybeprop"):m?(o=b.match(/^\s*:/,!1)?"property":"tag","block"):(o+=" error","maybeprop")}return"meta"==a?"block":m||"hash"!=a&&"qualifier"!=a?z.top(a,b,c):(o="error","block")},z.maybeprop=function(a,b,c){return":"==a?u(c,b,"prop"):w(a,b,c)},z.prop=function(a,b,c){if(";"==a)return v(c);if("{"==a&&m)return u(c,b,"propBlock");if("}"==a||"{"==a)return x(a,b,c);if("("==a)return u(c,b,"parens");if("hash"!=a||/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(b.current())){if("word"==a)y(b);else if("interpolation"==a)return u(c,b,"interpolation")}else o+=" error";return"prop"},z.propBlock=function(a,b,c){return"}"==a?v(c):"word"==a?(o="property","maybeprop"):c.context.type},z.parens=function(a,b,c){return"{"==a||"}"==a?x(a,b,c):")"==a?v(c):"parens"},z.pseudo=function(a,b,c){return"word"==a?(o="variable-3",c.context.type):w(a,b,c)},z.media=function(a,b,c){if("("==a)return u(c,b,"media_parens");if("}"==a)return x(a,b,c);if("{"==a)return v(c)&&u(c,b,m?"block":"top");if("word"==a){var d=b.current().toLowerCase();o="only"==d||"not"==d||"and"==d?"keyword":f.hasOwnProperty(d)?"attribute":g.hasOwnProperty(d)?"property":"error"}return c.context.type},z.media_parens=function(a,b,c){return")"==a?v(c):"{"==a||"}"==a?x(a,b,c,2):z.media(a,b,c)},z.font_face_before=function(a,b,c){return"{"==a?u(c,b,"font_face"):w(a,b,c)},z.font_face=function(a,b,c){return"}"==a?v(c):"word"==a?(o=l.hasOwnProperty(b.current().toLowerCase())?"property":"error","maybeprop"):"font_face"},z.keyframes=function(a,b,c){return"word"==a?(o="variable","keyframes"):"{"==a?u(c,b,"top"):w(a,b,c)},z.at=function(a,b,c){return";"==a?v(c):"{"==a||"}"==a?x(a,b,c):("word"==a?o="tag":"hash"==a&&(o="builtin"),"at")},z.interpolation=function(a,b,c){return"}"==a?v(c):"{"==a||";"==a?x(a,b,c):("variable"!=a&&(o="error"),"interpolation")},z.params=function(a,b,c){return")"==a?v(c):"{"==a||"}"==a?x(a,b,c):("word"==a&&y(b),"params")},{startState:function(a){return{tokenize:null,state:"top",context:new t("top",a||0,null)}},token:function(a,b){if(!b.tokenize&&a.eatSpace())return null;var c=(b.tokenize||q)(a,b);return c&&"object"==typeof c&&(n=c[1],c=c[0]),o=c,b.state=z[b.state](n,a,b),o},indent:function(a,b){var c=a.context,e=b&&b.charAt(0),f=c.indent;return"prop"==c.type&&"}"==e&&(c=c.prev),!c.prev||("}"!=e||"block"!=c.type&&"top"!=c.type&&"interpolation"!=c.type&&"font_face"!=c.type)&&(")"!=e||"parens"!=c.type&&"params"!=c.type&&"media_parens"!=c.type)&&("{"!=e||"at"!=c.type&&"media"!=c.type)||(f=c.indent-d,c=c.prev),f},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});var c=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],d=b(c),e=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"],f=b(e),g=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-inside","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-profile","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","kerning","text-anchor","writing-mode"],h=b(g),i=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],i=b(i),j=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],k=b(j),l=["above","absolute","activeborder","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","cover","crop","cross","crosshair","currentcolor","cursive","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ew-resize","expanded","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-table","inset","inside","intrinsic","invert","italic","justify","kannada","katakana","katakana-iroha","keep-all","khmer","landscape","lao","large","larger","left","level","lighter","line-through","linear","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","single","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","x-large","x-small","xor","xx-large","xx-small"],m=b(l),n=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],o=b(n),p=c.concat(e).concat(g).concat(i).concat(j).concat(l);a.registerHelper("hintWords","css",p),a.defineMIME("text/css",{mediaTypes:d,mediaFeatures:f,propertyKeywords:h,nonStandardPropertyKeywords:i,colorKeywords:k,valueKeywords:m,fontProperties:o,tokenHooks:{"<":function(a,b){return a.match("!--")?(b.tokenize=r,r(a,b)):!1},"/":function(a,b){return a.eat("*")?(b.tokenize=q,q(a,b)):!1}},name:"css"}),a.defineMIME("text/x-scss",{mediaTypes:d,mediaFeatures:f,propertyKeywords:h,nonStandardPropertyKeywords:i,colorKeywords:k,valueKeywords:m,fontProperties:o,allowNested:!0,tokenHooks:{"/":function(a,b){return a.eat("/")?(a.skipToEnd(),["comment","comment"]):a.eat("*")?(b.tokenize=q,q(a,b)):["operator","operator"]},":":function(a){return a.match(/\s*{/)?[null,"{"]:!1},$:function(a){return a.match(/^[\w-]+/),a.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(a){return a.eat("{")?[null,"interpolation"]:!1}},name:"css",helperType:"scss"}),a.defineMIME("text/x-less",{mediaTypes:d,mediaFeatures:f,propertyKeywords:h,nonStandardPropertyKeywords:i,colorKeywords:k,valueKeywords:m,fontProperties:o,allowNested:!0,tokenHooks:{"/":function(a,b){return a.eat("/")?(a.skipToEnd(),["comment","comment"]):a.eat("*")?(b.tokenize=q,q(a,b)):["operator","operator"]},"@":function(a){return a.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)?!1:(a.eatWhile(/[\w\\\-]/),a.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"})}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";function d(a){for(var d=0;d<a.state.activeLines.length;d++)a.removeLineClass(a.state.activeLines[d],"wrap",b),a.removeLineClass(a.state.activeLines[d],"background",c)}function e(a,b){if(a.length!=b.length)return!1;for(var c=0;c<a.length;c++)if(a[c]!=b[c])return!1;return!0}function f(a,f){for(var g=[],h=0;h<f.length;h++){var i=a.getLineHandleVisualStart(f[h].head.line);g[g.length-1]!=i&&g.push(i)}e(a.state.activeLines,g)||a.operation(function(){d(a);for(var e=0;e<g.length;e++)a.addLineClass(g[e],"wrap",b),a.addLineClass(g[e],"background",c);a.state.activeLines=g})}function g(a,b){f(a,b.ranges)}var b="CodeMirror-activeline",c="CodeMirror-activeline-background";a.defineOption("styleActiveLine",!1,function(b,c,e){var h=e&&e!=a.Init;c&&!h?(b.state.activeLines=[],f(b,b.listSelections()),b.on("beforeSelectionChange",g)):!c&&h&&(b.off("beforeSelectionChange",g),d(b),delete b.state.activeLines)})}),function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){function e(a,b,e,g){var h=a.getLineHandle(b.line),i=b.ch-1,j=i>=0&&d[h.text.charAt(i)]||d[h.text.charAt(++i)];if(!j)return null;var k=">"==j.charAt(1)?1:-1;if(e&&k>0!=(i==b.ch))return null;var l=a.getTokenTypeAt(c(b.line,i+1)),m=f(a,c(b.line,i+(k>0?1:0)),k,l||null,g);return null==m?null:{from:c(b.line,i),to:m&&m.pos,match:m&&m.ch==j.charAt(0),forward:k>0}}function f(a,b,e,f,g){for(var h=g&&g.maxScanLineLength||1e4,i=g&&g.maxScanLines||1e3,j=[],k=g&&g.bracketRegex?g.bracketRegex:/[(){}[\]]/,l=e>0?Math.min(b.line+i,a.lastLine()+1):Math.max(a.firstLine()-1,b.line-i),m=b.line;m!=l;m+=e){var n=a.getLine(m);if(n){var o=e>0?0:n.length-1,p=e>0?n.length:-1;if(!(n.length>h))for(m==b.line&&(o=b.ch-(0>e?1:0));o!=p;o+=e){var q=n.charAt(o);if(k.test(q)&&(void 0===f||a.getTokenTypeAt(c(m,o+1))==f)){var r=d[q];if(">"==r.charAt(1)==e>0)j.push(q);else{if(!j.length)return{pos:c(m,o),ch:q};j.pop()}}}}}return m-e==(e>0?a.lastLine():a.firstLine())?!1:null}function g(a,d,f){for(var g=a.state.matchBrackets.maxHighlightLineLength||1e3,h=[],i=a.listSelections(),j=0;j<i.length;j++){var k=i[j].empty()&&e(a,i[j].head,!1,f);if(k&&a.getLine(k.from.line).length<=g){var l=k.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";h.push(a.markText(k.from,c(k.from.line,k.from.ch+1),{className:l})),k.to&&a.getLine(k.to.line).length<=g&&h.push(a.markText(k.to,c(k.to.line,k.to.ch+1),{className:l}))}}if(h.length){b&&a.state.focused&&a.display.input.focus();var m=function(){a.operation(function(){for(var a=0;a<h.length;a++)h[a].clear()})};if(!d)return m;setTimeout(m,800)}}function i(a){a.operation(function(){h&&(h(),h=null),h=g(a,!1,a.state.matchBrackets)})}var b=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),c=a.Pos,d={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},h=null;a.defineOption("matchBrackets",!1,function(b,c,d){d&&d!=a.Init&&b.off("cursorActivity",i),c&&(b.state.matchBrackets="object"==typeof c?c:{},b.on("cursorActivity",i))}),a.defineExtension("matchBrackets",function(){g(this,!0)}),a.defineExtension("findMatchingBracket",function(a,b,c){return e(this,a,b,c)}),a.defineExtension("scanForBracket",function(a,b,c,d){return f(this,a,b,c,d)})});
assets/js/tjcc.js CHANGED
@@ -1,9 +1,9 @@
1
- jQuery(function($){
2
- var editor = CodeMirror.fromTextArea(document.getElementById("tjcc-custom-css-textarea"), {
3
- mode: "css",
4
- theme: "default",
5
- styleActiveLine: true,
6
- matchBrackets: true,
7
- lineNumbers: true
8
- });
9
  })
1
+ jQuery(function($){
2
+ var editor = CodeMirror.fromTextArea(document.getElementById("tjcc-custom-css-textarea"), {
3
+ mode: "css",
4
+ theme: "default",
5
+ styleActiveLine: true,
6
+ matchBrackets: true,
7
+ lineNumbers: true
8
+ });
9
  })
inc/functions.php CHANGED
@@ -1,34 +1,34 @@
1
- <?php
2
- /**
3
- * Custom functions needed by the plugin.
4
- *
5
- * @package Theme_Junkie_Custom_CSS
6
- * @since 0.1.0
7
- * @author Theme Junkie
8
- * @copyright Copyright (c) 2014, Theme Junkie
9
- * @license http://www.gnu.org/licenses/gpl-2.0.html
10
- */
11
-
12
- /**
13
- * Get the custom css value and display it on front-end
14
- *
15
- * @since 0.1.0
16
- * @access public
17
- */
18
- function tjcc_get_custom_css() {
19
-
20
- $option = get_option( 'tj_custom_css' );
21
- $output = isset( $option['custom_css'] ) ? $option['custom_css'] : '';
22
-
23
- if ( $output ) {
24
- $css = '<!-- Custom CSS -->' . "\n";
25
- $css .= '<style>' . "\n";
26
- $css .= stripslashes( $output ) . "\n";
27
- $css .= '</style>' . "\n";
28
- $css .= '<!-- Generate by Theme Junkie Custom CSS -->' . "\n";
29
-
30
- echo $css;
31
- }
32
-
33
- }
34
  add_action( 'wp_head', 'tjcc_get_custom_css', 20 );
1
+ <?php
2
+ /**
3
+ * Custom functions needed by the plugin.
4
+ *
5
+ * @package Theme_Junkie_Custom_CSS
6
+ * @since 0.1.0
7
+ * @author Theme Junkie
8
+ * @copyright Copyright (c) 2014, Theme Junkie
9
+ * @license http://www.gnu.org/licenses/gpl-2.0.html
10
+ */
11
+
12
+ /**
13
+ * Get the custom css value and display it on front-end
14
+ *
15
+ * @since 0.1.0
16
+ * @access public
17
+ */
18
+ function tjcc_get_custom_css() {
19
+
20
+ $option = get_option( 'tj_custom_css' );
21
+ $output = isset( $option['custom_css'] ) ? $option['custom_css'] : '';
22
+
23
+ if ( $output ) {
24
+ $css = '<!-- Custom CSS -->' . "\n";
25
+ $css .= '<style>' . "\n";
26
+ $css .= wp_filter_nohtml_kses( $output ) . "\n";
27
+ $css .= '</style>' . "\n";
28
+ $css .= '<!-- Generate by https://wordpress.org/plugins/theme-junkie-custom-css/ -->' . "\n";
29
+
30
+ echo $css;
31
+ }
32
+
33
+ }
34
  add_action( 'wp_head', 'tjcc_get_custom_css', 20 );
languages/tjcc.mo DELETED
Binary file
languages/tjcc.po DELETED
@@ -1,58 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: Theme Junkie Custom CSS\n"
4
- "POT-Creation-Date: 2014-04-18 14:11+0700\n"
5
- "PO-Revision-Date: 2014-04-18 14:11+0700\n"
6
- "Last-Translator: Satrya <satrya@satrya.me>\n"
7
- "Language-Team: Theme Junkie <satrya@theme-junkie.com>\n"
8
- "Language: en\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 1.6.3\n"
13
- "X-Poedit-Basepath: .\n"
14
- "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
- "X-Poedit-SourceCharset: UTF-8\n"
16
- "X-Poedit-KeywordsList: __;_e;esc_attr__;esc_html__\n"
17
- "X-Poedit-SearchPath-0: ..\n"
18
-
19
- #: ../admin/admin.php:29 ../admin/admin.php:96
20
- msgid "Theme Junkie Custom CSS"
21
- msgstr ""
22
-
23
- #: ../admin/admin.php:30 ../admin/customize.php:39
24
- msgid "Custom CSS"
25
- msgstr ""
26
-
27
- #: ../admin/admin.php:97
28
- #, php-format
29
- msgid ""
30
- "Hi There, thanks for using our plugin we hope you will enjoy it. Check out "
31
- "our %1$sPremium WordPress Themes%2$s."
32
- msgstr ""
33
-
34
- #: ../admin/admin.php:114
35
- #, php-format
36
- msgid "%1$sGetting started with CSS%2$s."
37
- msgstr ""
38
-
39
- #: ../admin/admin.php:117
40
- msgid "Save"
41
- msgstr ""
42
-
43
- #: ../admin/admin.php:127
44
- msgid "Live Preview"
45
- msgstr ""
46
-
47
- #: ../admin/admin.php:129
48
- #, php-format
49
- msgid ""
50
- "If you want to add custom css and see the live preview, please go to the "
51
- "%1$sCustomize%2$s page and open the Custom CSS section."
52
- msgstr ""
53
-
54
- #: ../admin/customize.php:40
55
- msgid ""
56
- "After you add your custom css to the box, then please click outside it to "
57
- "see the changes."
58
- msgstr ""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
languages/tjcc.pot ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2015 Theme Junkie
2
+ # This file is distributed under the same license as the TJ Custom CSS package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: TJ Custom CSS 0.1.4\n"
6
+ "Report-Msgid-Bugs-To: http://www.theme-junkie.com/support/\n"
7
+ "POT-Creation-Date: 2015-09-06 11:05:55+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=utf-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: Theme Junkie (support@theme-junkie.com)\n"
13
+ "Language-Team: Theme Junkie (support@theme-junkie.com)\n"
14
+ "X-Generator: grunt-wp-i18n 0.5.3\n"
15
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
16
+ "X-Poedit-Basepath: ..\n"
17
+ "X-Poedit-Language: English\n"
18
+ "X-Poedit-Country: UNITED STATES\n"
19
+ "X-Poedit-SourceCharset: utf-8\n"
20
+ "X-Poedit-SearchPath-0: .\n"
21
+ "X-Poedit-KeywordsList: "
22
+ "__;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c;_nc:4c,1,2;_"
23
+ "x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
24
+ "X-Textdomain-Support: yes\n"
25
+
26
+ #. Plugin Name of the plugin/theme
27
+ msgid "TJ Custom CSS"
28
+ msgstr ""
29
+
30
+ #: admin/admin.php:23 admin/customize.php:34
31
+ msgid "Custom CSS"
32
+ msgstr ""
33
+
34
+ #: admin/admin.php:89
35
+ msgid "Hi There, thanks for using our plugin we hope you enjoy it."
36
+ msgstr ""
37
+
38
+ #: admin/admin.php:106
39
+ msgid "%1$sGetting started with CSS%2$s."
40
+ msgstr ""
41
+
42
+ #: admin/admin.php:109
43
+ msgid "Save"
44
+ msgstr ""
45
+
46
+ #: admin/admin.php:119
47
+ msgid "Premium Themes"
48
+ msgstr ""
49
+
50
+ #: admin/admin.php:121
51
+ msgid "Get our 59 premium WordPress themes for only $49! %1$sGet it now%2$s."
52
+ msgstr ""
53
+
54
+ #: admin/admin.php:126
55
+ msgid "Live Preview"
56
+ msgstr ""
57
+
58
+ #: admin/admin.php:128
59
+ msgid ""
60
+ "If you want to add custom css and see the live preview, please go to the "
61
+ "%1$sCustomize%2$s page and open the Custom CSS section."
62
+ msgstr ""
63
+
64
+ #: admin/customize.php:35
65
+ msgid "Add your custom css code below."
66
+ msgstr ""
67
+
68
+ #. Author URI of the plugin/theme
69
+ msgid "http://www.theme-junkie.com/"
70
+ msgstr ""
71
+
72
+ #. Description of the plugin/theme
73
+ msgid "Easily to add custom css code to your site."
74
+ msgstr ""
75
+
76
+ #. Author of the plugin/theme
77
+ msgid "Theme Junkie"
78
+ msgstr ""
readme.txt CHANGED
@@ -1,77 +1,77 @@
1
- === Theme Junkie Custom CSS ===
2
- Contributors: themejunkie
3
- Tags: custom css, customizer, css, style, theme, child theme
4
- Requires at least: 3.6
5
- Tested up to: 4.0
6
- Stable tag: 0.1.3
7
- License: GPLv2 or later
8
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
-
10
- Easily to add any Custom CSS Code to your WordPress website.
11
-
12
- == Description ==
13
-
14
- This plugin will enable a custom css manager on administration page to add Custom CSS code to your WordPress website. It will automatically override any theme or plugin default styles. It also very useful if you want to add customization to your website but do not want to edit your theme or plugin css files.
15
-
16
- It comes with two ways to add the custom css code:
17
-
18
- **1. Setting**
19
- You can go to Appearance &rarr; Custom CSS, then you will see a big box/textarea. Put your css code there.
20
-
21
- **2. Customizer - Live Preview**
22
- If you want to see the live preview while you adding the custom css code, then you can go to Appearance &rarr; Customize, after that open the Custom CSS section tab.
23
-
24
- = Features Include: =
25
-
26
- * No configuration needed
27
- * Live preview
28
- * Easy-to-use
29
- * Child theme alternative to add customization
30
- * Uninstall procedure
31
-
32
- = Plugin Info =
33
- * Developed by [Theme Junkie](http://www.theme-junkie.com/)
34
- * Check out the [Github](https://github.com/themejunkie/theme-junkie-custom-css) repo to contribute.
35
-
36
- == Installation ==
37
-
38
- **Through Dashboard**
39
-
40
- 1. Log in to your WordPress admin panel and go to Plugins -> Add New
41
- 2. Type **theme junkie custom css** in the search box and click on search button.
42
- 3. Find Theme Junkie Custom CSS plugin.
43
- 4. Then click on Install Now after that activate the plugin.
44
- 5. Go to Appearance &rarr; Custom CSS.
45
-
46
- **Installing Via FTP**
47
-
48
- 1. Download the plugin to your hardisk.
49
- 2. Unzip.
50
- 3. Upload the **theme-junkie-custom-css** folder into your plugins directory.
51
- 4. Log in to your WordPress admin panel and click the Plugins menu.
52
- 5. Then activate the plugin.
53
- 6. Go to Appearance &rarr; Custom CSS.
54
-
55
- == Frequently Asked Questions ==
56
-
57
- = Can I use this plugin without being Theme Junkie customer? =
58
- Yes, this plugin was developed to support all themes.
59
-
60
- == Screenshots ==
61
-
62
- 1. Custom CSS settings.
63
- 2. Customizer.
64
-
65
- == Changelog ==
66
-
67
- = 0.1.3 - 9/04/2014 =
68
- * Tested for WordPress 4.0
69
-
70
- = 0.1.2 - 8/26/2014 =
71
- * Fixed: `stripslashes` error when using customizer.
72
-
73
- = 0.1.1 - 8/18/2014 =
74
- * Allow html entities in css selector eg. `#id > .class`
75
-
76
- = 0.1 - 4/20/2014 =
77
  * Initial Release
1
+ === TJ Custom CSS ===
2
+ Contributors: themejunkie, satrya
3
+ Tags: custom css, customizer, css, style, theme, child theme
4
+ Requires at least: 4.0
5
+ Tested up to: 4.3
6
+ Stable tag: 0.1.4
7
+ License: GPLv2 or later
8
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
+
10
+ Easily to add any Custom CSS code to your WordPress website.
11
+
12
+ == Description ==
13
+
14
+ This plugin will enable a custom css manager on administration page to add Custom CSS code to your WordPress website. It will automatically override any theme or plugin default styles. It also very useful if you want to add customization to your website but do not want to edit your theme or plugin css files.
15
+
16
+ It comes with two ways to add the custom css code:
17
+
18
+ **1. Setting**
19
+ You can go to Appearance &rarr; Custom CSS, then you will see a big box/textarea. Put your css code there.
20
+
21
+ **2. Customizer - Live Preview**
22
+ If you want to see the live preview while you adding the custom css code, then you can go to Appearance &rarr; Customize, after that open the Custom CSS section tab.
23
+
24
+ = Features Include: =
25
+
26
+ * No configuration needed
27
+ * Live preview
28
+ * Easy-to-use
29
+ * Child theme alternative to add customization
30
+ * Uninstall procedure
31
+
32
+ = Plugin Info =
33
+ * Developed by [Theme Junkie](http://www.theme-junkie.com/?utm_source=wporg&utm_medium=text_link&utm_campaign=Site%20Promotion)
34
+ * Check out the [Github](https://github.com/themejunkie/theme-junkie-custom-css) repo to contribute.
35
+
36
+ == Installation ==
37
+
38
+ **Through Dashboard**
39
+
40
+ 1. Log in to your WordPress admin panel and go to Plugins -> Add New
41
+ 2. Type **theme junkie custom css** in the search box and click on search button.
42
+ 3. Find Theme Junkie Custom CSS plugin.
43
+ 4. Then click on Install Now after that activate the plugin.
44
+ 5. Go to Appearance &rarr; Custom CSS.
45
+
46
+ **Installing Via FTP**
47
+
48
+ 1. Download the plugin to your hardisk.
49
+ 2. Unzip.
50
+ 3. Upload the **theme-junkie-custom-css** folder into your plugins directory.
51
+ 4. Log in to your WordPress admin panel and click the Plugins menu.
52
+ 5. Then activate the plugin.
53
+ 6. Go to Appearance &rarr; Custom CSS.
54
+
55
+ == Screenshots ==
56
+
57
+ 1. Custom CSS settings.
58
+ 2. Customizer.
59
+
60
+ == Changelog ==
61
+
62
+ = 0.1.4 - 9/06/2015 =
63
+ * Support WordPress 4.3
64
+ * Update language
65
+ * Sanitize output with `wp_filter_nohtml_kses` to prevent user add any HTML code to the custom css
66
+
67
+ = 0.1.3 - 9/04/2014 =
68
+ * Tested for WordPress 4.0
69
+
70
+ = 0.1.2 - 8/26/2014 =
71
+ * Fixed: `stripslashes` error when using customizer.
72
+
73
+ = 0.1.1 - 8/18/2014 =
74
+ * Allow html entities in css selector eg. `#id > .class`
75
+
76
+ = 0.1 - 4/20/2014 =
77
  * Initial Release
tj-custom-css.php CHANGED
@@ -1,109 +1,109 @@
1
- <?php
2
- /**
3
- * Plugin Name: Theme Junkie Custom CSS
4
- * Plugin URI: http://www.theme-junkie.com/
5
- * Description: Easily to add custom css code to your site.
6
- * Version: 0.1.3
7
- * Author: Theme Junkie
8
- * Author URI: http://www.theme-junkie.com/
9
- * Author Email: satrya@theme-junkie.com
10
- *
11
- * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
12
- * General Public License as published by the Free Software Foundation; either version 2 of the License,
13
- * or (at your option) any later version.
14
- *
15
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
16
- * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
- *
18
- * You should have received a copy of the GNU General Public License along with this program; if not, write
19
- * to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
- *
21
- * @package Theme_Junkie_Custom_CSS
22
- * @since 0.1.0
23
- * @author Theme Junkie
24
- * @copyright Copyright (c) 2014, Theme Junkie
25
- * @license http://www.gnu.org/licenses/gpl-2.0.html
26
- */
27
-
28
- // Exit if accessed directly
29
- if ( ! defined( 'ABSPATH' ) ) exit;
30
-
31
- class Tj_Custom_CSS {
32
-
33
- /**
34
- * PHP5 constructor method.
35
- *
36
- * @since 0.1.0
37
- */
38
- public function __construct() {
39
-
40
- /* Set constant path to the plugin directory. */
41
- add_action( 'plugins_loaded', array( &$this, 'constants' ), 1 );
42
-
43
- /* Internationalize the text strings used. */
44
- add_action( 'plugins_loaded', array( &$this, 'i18n' ), 2 );
45
-
46
- /* Load the admin functions files. */
47
- add_action( 'plugins_loaded', array( &$this, 'admin' ), 3 );
48
-
49
- /* Load the admin functions files. */
50
- add_action( 'plugins_loaded', array( &$this, 'includes' ), 4 );
51
-
52
- }
53
-
54
- /**
55
- * Defines constants used by the plugin.
56
- *
57
- * @since 0.1.0
58
- */
59
- public function constants() {
60
-
61
- /* Set constant path to the plugin directory. */
62
- define( 'TJCC_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
63
-
64
- /* Set the constant path to the plugin directory URI. */
65
- define( 'TJCC_URI', trailingslashit( plugin_dir_url( __FILE__ ) ) );
66
-
67
- /* Set the constant path to the admin directory. */
68
- define( 'TJCC_ADMIN', TJCC_DIR . trailingslashit( 'admin' ) );
69
-
70
- /* Set the constant path to the inc directory. */
71
- define( 'TJCC_INC', TJCC_DIR . trailingslashit( 'inc' ) );
72
-
73
- /* Set the constant path to the assets directory. */
74
- define( 'TJCC_ASSETS', TJCC_URI . trailingslashit( 'assets' ) );
75
-
76
- }
77
-
78
- /**
79
- * Loads the translation files.
80
- *
81
- * @since 0.1.0
82
- */
83
- public function i18n() {
84
- load_plugin_textdomain( 'tjcc', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
85
- }
86
-
87
- /**
88
- * Loads the initial files needed by the plugin.
89
- * Loads the admin functions.
90
- *
91
- * @since 0.1.0
92
- */
93
- public function admin() {
94
- require_once( TJCC_ADMIN . 'admin.php' );
95
- require_once( TJCC_ADMIN . 'customize.php' );
96
- }
97
-
98
- /**
99
- * Loads the initial files needed by the plugin.
100
- *
101
- * @since 0.1.0
102
- */
103
- public function includes() {
104
- require_once( TJCC_INC . 'functions.php' );
105
- }
106
-
107
- }
108
-
109
  new Tj_Custom_CSS;
1
+ <?php
2
+ /**
3
+ * Plugin Name: TJ Custom CSS
4
+ * Plugin URI: http://www.theme-junkie.com/
5
+ * Description: Easily to add custom css code to your site.
6
+ * Version: 0.1.4
7
+ * Author: Theme Junkie
8
+ * Author URI: http://www.theme-junkie.com/
9
+ * Author Email: support@theme-junkie.com
10
+ *
11
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
12
+ * General Public License as published by the Free Software Foundation; either version 2 of the License,
13
+ * or (at your option) any later version.
14
+ *
15
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
16
+ * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
+ *
18
+ * You should have received a copy of the GNU General Public License along with this program; if not, write
19
+ * to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
+ *
21
+ * @package Theme_Junkie_Custom_CSS
22
+ * @since 0.1.0
23
+ * @author Theme Junkie
24
+ * @copyright Copyright (c) 2014, Theme Junkie
25
+ * @license http://www.gnu.org/licenses/gpl-2.0.html
26
+ */
27
+
28
+ // Exit if accessed directly
29
+ if ( ! defined( 'ABSPATH' ) ) exit;
30
+
31
+ class Tj_Custom_CSS {
32
+
33
+ /**
34
+ * PHP5 constructor method.
35
+ *
36
+ * @since 0.1.0
37
+ */
38
+ public function __construct() {
39
+
40
+ /* Set constant path to the plugin directory. */
41
+ add_action( 'plugins_loaded', array( &$this, 'constants' ), 1 );
42
+
43
+ /* Internationalize the text strings used. */
44
+ add_action( 'plugins_loaded', array( &$this, 'i18n' ), 2 );
45
+
46
+ /* Load the admin functions files. */
47
+ add_action( 'plugins_loaded', array( &$this, 'admin' ), 3 );
48
+
49
+ /* Load the admin functions files. */
50
+ add_action( 'plugins_loaded', array( &$this, 'includes' ), 4 );
51
+
52
+ }
53
+
54
+ /**
55
+ * Defines constants used by the plugin.
56
+ *
57
+ * @since 0.1.0
58
+ */
59
+ public function constants() {
60
+
61
+ /* Set constant path to the plugin directory. */
62
+ define( 'TJCC_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
63
+
64
+ /* Set the constant path to the plugin directory URI. */
65
+ define( 'TJCC_URI', trailingslashit( plugin_dir_url( __FILE__ ) ) );
66
+
67
+ /* Set the constant path to the admin directory. */
68
+ define( 'TJCC_ADMIN', TJCC_DIR . trailingslashit( 'admin' ) );
69
+
70
+ /* Set the constant path to the inc directory. */
71
+ define( 'TJCC_INC', TJCC_DIR . trailingslashit( 'inc' ) );
72
+
73
+ /* Set the constant path to the assets directory. */
74
+ define( 'TJCC_ASSETS', TJCC_URI . trailingslashit( 'assets' ) );
75
+
76
+ }
77
+
78
+ /**
79
+ * Loads the translation files.
80
+ *
81
+ * @since 0.1.0
82
+ */
83
+ public function i18n() {
84
+ load_plugin_textdomain( 'tjcc', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
85
+ }
86
+
87
+ /**
88
+ * Loads the initial files needed by the plugin.
89
+ * Loads the admin functions.
90
+ *
91
+ * @since 0.1.0
92
+ */
93
+ public function admin() {
94
+ require_once( TJCC_ADMIN . 'admin.php' );
95
+ require_once( TJCC_ADMIN . 'customize.php' );
96
+ }
97
+
98
+ /**
99
+ * Loads the initial files needed by the plugin.
100
+ *
101
+ * @since 0.1.0
102
+ */
103
+ public function includes() {
104
+ require_once( TJCC_INC . 'functions.php' );
105
+ }
106
+
107
+ }
108
+
109
  new Tj_Custom_CSS;
uninstall.php CHANGED
@@ -1,17 +1,17 @@
1
- <?php
2
- /**
3
- * Uninstall procedure for the plugin.
4
- *
5
- * @package Theme_Junkie_Custom_CSS
6
- * @since 0.1.0
7
- * @author Theme Junkie
8
- * @copyright Copyright (c) 2014, Theme Junkie
9
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10
- */
11
-
12
- /* If uninstall not called from WordPress exit. */
13
- if ( !defined( 'WP_UNINSTALL_PLUGIN' ) )
14
- exit();
15
-
16
- /* Delete plugin settings. */
17
  delete_option( 'tj_custom_css' );
1
+ <?php
2
+ /**
3
+ * Uninstall procedure for the plugin.
4
+ *
5
+ * @package Theme_Junkie_Custom_CSS
6
+ * @since 0.1.0
7
+ * @author Theme Junkie
8
+ * @copyright Copyright (c) 2014, Theme Junkie
9
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10
+ */
11
+
12
+ /* If uninstall not called from WordPress exit. */
13
+ if ( !defined( 'WP_UNINSTALL_PLUGIN' ) )
14
+ exit();
15
+
16
+ /* Delete plugin settings. */
17
  delete_option( 'tj_custom_css' );