Insert PHP - Version 2.1.91

Version Description

  • Fixed: some users were redirected to about page an infinite number of times
  • Fixed: safe mode did not work, since it could be started only after the snippet
  • Added: php lint for code editor
  • Added: hook wbcr/factory/bootstrap/cache_enable to disable caching of Woody assets. Some users use cdn, it may be useful to them.
Download this release

Release Info

Developer webcraftic
Plugin Icon 128x128 Insert PHP
Version 2.1.91
Comparing to
See all releases

Code changes from version 2.0.6 to 2.1.91

Files changed (81) hide show
  1. admin/activation.php +52 -0
  2. admin/ajax/ajax.php +173 -0
  3. admin/ajax/index.php +2 -0
  4. admin/assets/css/cmthemes/index.php +2 -0
  5. admin/assets/css/code-editor.min.css +1 -0
  6. admin/assets/css/codemirror.css +0 -1
  7. admin/assets/css/general.css +100 -14
  8. admin/assets/css/general.css.map +1 -0
  9. admin/assets/css/general.less +120 -13
  10. admin/assets/css/index.php +2 -0
  11. admin/assets/css/list-table.css +58 -4
  12. admin/assets/css/list-table.css.map +1 -0
  13. admin/assets/css/list-table.less +86 -4
  14. admin/assets/css/new-item.css +57 -0
  15. admin/assets/css/new-item.css.map +1 -0
  16. admin/assets/css/new-item.less +73 -0
  17. admin/assets/css/snippet-block.css +51 -0
  18. admin/assets/css/snippet-block.css.map +1 -0
  19. admin/assets/css/snippet-block.less +58 -0
  20. admin/assets/css/view-opt.css +225 -0
  21. admin/assets/css/view-opt.css.map +1 -0
  22. admin/assets/css/view-opt.less +278 -0
  23. admin/assets/gutenberg/build/index.build.js +100 -0
  24. admin/assets/gutenberg/build/index.php +2 -0
  25. admin/assets/gutenberg/index.php +2 -0
  26. admin/assets/gutenberg/src/index.js +145 -0
  27. admin/assets/gutenberg/src/index.php +2 -0
  28. admin/assets/img/18x18.png +0 -0
  29. admin/assets/img/help.png +0 -0
  30. admin/assets/img/index.php +2 -0
  31. admin/assets/img/menu-icon-4.png +0 -0
  32. admin/assets/img/rio-banner.png +0 -0
  33. admin/assets/img/shortcode-icon.png +0 -0
  34. admin/assets/img/shortcode-icon5.png +0 -0
  35. admin/assets/img/snippet-cut.png +0 -0
  36. admin/assets/index.php +2 -0
  37. admin/assets/js/code-editor.min.js +1 -0
  38. admin/assets/js/codemirror.js +0 -1
  39. admin/assets/js/index.php +2 -0
  40. admin/assets/js/scripts.js +23 -0
  41. admin/assets/js/tinymce4.4.js +33 -1
  42. admin/assets/js/view-opt.js +1103 -0
  43. admin/boot.php +234 -199
  44. admin/includes/class.export.snippet.php +288 -0
  45. admin/includes/class.filter.snippet.php +80 -0
  46. admin/includes/class.gutenberg.snippet.php +167 -0
  47. admin/includes/class.import.snippet.php +189 -0
  48. admin/includes/class.notices.php +135 -0
  49. admin/includes/class.snippets.viewtable.php +172 -117
  50. admin/includes/index.php +2 -0
  51. admin/index.php +2 -0
  52. admin/metaboxes/base-options.php +633 -296
  53. admin/metaboxes/index.php +2 -0
  54. admin/metaboxes/info.php +76 -83
  55. admin/metaboxes/view-options.php +443 -0
  56. admin/pages/about.php +199 -0
  57. admin/pages/export.php +0 -76
  58. admin/pages/import.php +145 -0
  59. admin/pages/index.php +2 -0
  60. admin/pages/new-item.php +98 -0
  61. admin/pages/settings.php +237 -235
  62. admin/types/index.php +2 -0
  63. admin/types/snippets-post-types.php +119 -95
  64. admin/types/snippets-taxonomy.php +2 -3
  65. includes/class.execute.snippet.php +862 -0
  66. includes/class.helpers.php +456 -57
  67. includes/class.plugin.php +151 -216
  68. includes/index.php +2 -0
  69. includes/shortcodes.php +0 -68
  70. includes/shortcodes/index.php +2 -0
  71. includes/shortcodes/shortcode-php.php +48 -0
  72. includes/shortcodes/shortcode-text.php +45 -0
  73. includes/shortcodes/shortcode-universal.php +48 -0
  74. includes/shortcodes/shortcodes.php +128 -0
  75. index.php +2 -0
  76. insert_php.php +121 -84
  77. languages/index.php +2 -0
  78. libs/factory/bootstrap/assets/css-min/bootstrap.accordion.min.css +1 -1
  79. libs/factory/bootstrap/assets/css-min/bootstrap.blue.min.css +1 -1
  80. libs/factory/bootstrap/assets/css-min/bootstrap.coffee.min.css +1 -1
  81. libs/factory/bootstrap/assets/css-min/bootstrap.core.min.css +0 -1
admin/activation.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class of activation/deactivation of the plugin. Must be registered in file includes/class.plugin.php
4
+ *
5
+ * @author Webcraftic <wordpress.webraftic@gmail.com>
6
+ * @copyright (c) 02.12.2018, Webcraftic
7
+ * @see Wbcr_Factory410_Activator
8
+ *
9
+ * @version 1.0.1
10
+ */
11
+
12
+ // Exit if accessed directly
13
+ if ( ! defined( 'ABSPATH' ) ) {
14
+ exit;
15
+ }
16
+
17
+ class WINP_Activation extends Wbcr_Factory410_Activator {
18
+
19
+ /**
20
+ * Method is executed during the activation of the plugin.
21
+ *
22
+ * @since 1.0.0
23
+ */
24
+ public function activate() {
25
+
26
+ // Write information about the first activation of plugin
27
+ if ( ! get_option( $this->plugin->getOptionName( 'first_activation' ) ) ) {
28
+ update_option( $this->plugin->getOptionName( 'first_activation' ), array(
29
+ 'version' => $this->plugin->getPluginVersion(),
30
+ 'timestamp' => time()
31
+ ) );
32
+ }
33
+
34
+ // Create a demo snippets with examples of use
35
+ if ( ! get_option( $this->plugin->getOptionName( 'demo_snippets_created' ) ) ) {
36
+ WINP_Helper::create_demo_snippets();
37
+ }
38
+
39
+ update_option( $this->plugin->getOptionName( 'what_new_210' ), 1 );
40
+ }
41
+
42
+ /**
43
+ * The method is executed during the deactivation of the plugin.
44
+ *
45
+ * @since 1.0.0
46
+ */
47
+ public function deactivate() {
48
+ // Code to be executed during plugin deactivation
49
+ }
50
+ }
51
+
52
+
admin/ajax/ajax.php ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Ajax requests handler
4
+ * @author Webcraftic <wordpress.webraftic@gmail.com>
5
+ * @copyright (c) 2018 Webraftic Ltd
6
+ * @version 1.0
7
+ */
8
+
9
+ // Exit if accessed directly
10
+ if( !defined('ABSPATH') ) {
11
+ exit;
12
+ }
13
+
14
+ /**
15
+ * Returns a list of available roles.
16
+ */
17
+ function wbcr_inp_ajax_get_user_roles()
18
+ {
19
+ global $wp_roles;
20
+ $roles = $wp_roles->roles;
21
+
22
+ $values = array();
23
+ foreach($roles as $roleId => $role) {
24
+ $values[] = array(
25
+ 'value' => $roleId,
26
+ 'title' => $role['name']
27
+ );
28
+ }
29
+
30
+ $values[] = array(
31
+ 'value' => 'guest',
32
+ 'title' => __('Guest', 'insert-php')
33
+ );
34
+
35
+ $result = array(
36
+ 'values' => $values
37
+ );
38
+
39
+ echo json_encode($result);
40
+ exit;
41
+ }
42
+ add_action('wp_ajax_wbcr_inp_ajax_get_user_roles', 'wbcr_inp_ajax_get_user_roles');
43
+
44
+ /**
45
+ * Returns a list of public post types.
46
+ */
47
+ function wbcr_inp_ajax_get_post_types() {
48
+ $values = array();
49
+ $post_types = get_post_types( array( 'public' => true ), 'objects' );
50
+ if( !empty($post_types) ) {
51
+ foreach($post_types as $key => $value) {
52
+ $values[] = array(
53
+ 'value' => $key,
54
+ 'title' => $value->label
55
+ );
56
+ }
57
+ }
58
+
59
+ $result = array(
60
+ 'values' => $values
61
+ );
62
+
63
+ echo json_encode($result);
64
+ exit;
65
+ }
66
+ add_action('wp_ajax_wbcr_inp_ajax_get_post_types', 'wbcr_inp_ajax_get_post_types');
67
+
68
+ /**
69
+ * Returns a list of public taxonomies.
70
+ */
71
+ function wbcr_inp_ajax_get_taxonomies() {
72
+ $values = array();
73
+ $categories = get_categories( array( 'hide_empty' => false ) );
74
+
75
+ if( !empty($categories) ) {
76
+ foreach($categories as $cat) {
77
+ $values[] = array(
78
+ 'value' => $cat->term_id,
79
+ 'title' => $cat->name
80
+ );
81
+ }
82
+ }
83
+
84
+ $result = array(
85
+ 'values' => $values
86
+ );
87
+
88
+ echo json_encode($result);
89
+ exit;
90
+ }
91
+ add_action('wp_ajax_wbcr_inp_ajax_get_taxonomies', 'wbcr_inp_ajax_get_taxonomies');
92
+
93
+ /**
94
+ * Returns a list of page list values
95
+ */
96
+ function wbcr_inp_ajax_get_page_list() {
97
+ $result = array(
98
+ 'values' => array(
99
+ 'Basic' => array(
100
+ array(
101
+ 'value' => 'base_web',
102
+ 'title' => __('Entire Website', 'insert-php')
103
+ ),
104
+ array(
105
+ 'value' => 'base_sing',
106
+ 'title' => __('All Singulars', 'insert-php')
107
+ ),
108
+ array(
109
+ 'value' => 'base_arch',
110
+ 'title' => __('All Archives', 'insert-php')
111
+ )
112
+ ),
113
+ 'Special Pages' => array(
114
+ array(
115
+ 'value' => 'spec_404',
116
+ 'title' => __('404 Page', 'insert-php')
117
+ ),
118
+ array(
119
+ 'value' => 'spec_search',
120
+ 'title' => __('Search Page', 'insert-php')
121
+ ),
122
+ array(
123
+ 'value' => 'spec_blog',
124
+ 'title' => __('Blog / Posts Page', 'insert-php')
125
+ ),
126
+ array(
127
+ 'value' => 'spec_front',
128
+ 'title' => __('Front Page', 'insert-php')
129
+ ),
130
+ array(
131
+ 'value' => 'spec_date',
132
+ 'title' => __('Date Archive', 'insert-php')
133
+ ),
134
+ array(
135
+ 'value' => 'spec_auth',
136
+ 'title' => __('Author Archive', 'insert-php')
137
+ )
138
+ ),
139
+ 'Posts' => array(
140
+ array(
141
+ 'value' => 'post_all',
142
+ 'title' => __('All Posts', 'insert-php')
143
+ ),
144
+ array(
145
+ 'value' => 'post_arch',
146
+ 'title' => __('All Posts Archive', 'insert-php')
147
+ ),
148
+ array(
149
+ 'value' => 'post_cat',
150
+ 'title' => __('All Categories Archive', 'insert-php')
151
+ ),
152
+ array(
153
+ 'value' => 'post_tag',
154
+ 'title' => __('All Tags Archive', 'insert-php')
155
+ )
156
+ ),
157
+ 'Pages' => array(
158
+ array(
159
+ 'value' => 'page_all',
160
+ 'title' => __('All Pages', 'insert-php')
161
+ ),
162
+ array(
163
+ 'value' => 'page_arch',
164
+ 'title' => __('All Pages Archive', 'insert-php')
165
+ )
166
+ )
167
+ )
168
+ );
169
+
170
+ echo json_encode($result);
171
+ exit;
172
+ }
173
+ add_action('wp_ajax_wbcr_inp_ajax_get_page_list', 'wbcr_inp_ajax_get_page_list');
admin/ajax/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
admin/assets/css/cmthemes/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
admin/assets/css/code-editor.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .CodeMirror{font-family:monospace;height:300px;color:#000;direction:ltr}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:#000}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0!important;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-fat-cursor-mark{background-color:rgba(20,255,20,.5)}.cm-animate-fat-cursor,.cm-fat-cursor-mark{-webkit-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite}.cm-animate-fat-cursor{width:auto;border:0;background-color:#7e7}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-rulers{position:absolute;left:0;right:0;top:-50px;bottom:-20px;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-type,.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta,.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-invalidchar,.cm-s-default .cm-error{color:red}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0b0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#a22}.CodeMirror-matchingtag{background:rgba(255,150,0,.3)}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:#fff}.CodeMirror-scroll{overflow:scroll!important;margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;height:100%;outline:none;position:relative}.CodeMirror-sizer{position:relative;border-right:30px solid transparent}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;min-height:100%;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-30px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:none!important;border:none!important}.CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-gutter-wrapper ::selection{background-color:transparent}.CodeMirror-gutter-wrapper ::-moz-selection{background-color:transparent}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre{border-radius:0;border-width:0;background:transparent;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent;-webkit-font-variant-ligatures:contextual;-webkit-font-feature-settings:"calt";font-feature-settings:"calt";font-variant-ligatures:contextual}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;padding:.1px}.CodeMirror-rtl pre{direction:rtl}.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber,.CodeMirror-scroll,.CodeMirror-sizer{box-sizing:content-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-cursor{position:absolute;pointer-events:none}.CodeMirror-measure pre{position:static}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}.CodeMirror-focused div.CodeMirror-cursors,div.CodeMirror-dragcursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background-color:#ffa;background-color:rgba(255,255,0,.4)}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:""}span.CodeMirror-selectedtext{background:none}.CodeMirror-dialog{position:absolute;left:0;right:0;background:inherit;z-index:15;padding:.1em .8em;overflow:hidden;color:inherit}.CodeMirror-dialog-top{border-bottom:1px solid #eee;top:0}.CodeMirror-dialog-bottom{border-top:1px solid #eee;bottom:0}.CodeMirror-dialog input{border:none;outline:none;background:transparent;width:20em;color:inherit;font-family:monospace}.CodeMirror-dialog button{font-size:70%}.CodeMirror-lint-markers{width:16px}.CodeMirror-lint-tooltip{background-color:#ffd;border:1px solid #000;border-radius:4px 4px 4px 4px;color:#000;font-family:monospace;font-size:10pt;overflow:hidden;padding:2px 5px;position:fixed;white-space:pre;white-space:pre-wrap;z-index:100;max-width:600px;opacity:0;transition:opacity .4s;-moz-transition:opacity .4s;-webkit-transition:opacity .4s;-o-transition:opacity .4s;-ms-transition:opacity .4s}.CodeMirror-lint-mark-error,.CodeMirror-lint-mark-warning{background-position:0 100%;background-repeat:repeat-x}.CodeMirror-lint-mark-error{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg==)}.CodeMirror-lint-mark-warning{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII=)}.CodeMirror-lint-marker-error,.CodeMirror-lint-marker-warning{background-position:50%;background-repeat:no-repeat;cursor:pointer;display:inline-block;height:16px;width:16px;vertical-align:middle;position:relative}.CodeMirror-lint-message-error,.CodeMirror-lint-message-warning{padding-left:18px;background-position:0 0;background-repeat:no-repeat}.CodeMirror-lint-marker-error,.CodeMirror-lint-message-error{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAHlBMVEW7AAC7AACxAAC7AAC7AAAAAAC4AAC5AAD///+7AAAUdclpAAAABnRSTlMXnORSiwCK0ZKSAAAATUlEQVR42mWPOQ7AQAgDuQLx/z8csYRmPRIFIwRGnosRrpamvkKi0FTIiMASR3hhKW+hAN6/tIWhu9PDWiTGNEkTtIOucA5Oyr9ckPgAWm0GPBog6v4AAAAASUVORK5CYII=)}.CodeMirror-lint-marker-warning,.CodeMirror-lint-message-warning{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAANlBMVEX/uwDvrwD/uwD/uwD/uwD/uwD/uwD/uwD/uwD6twD/uwAAAADurwD2tQD7uAD+ugAAAAD/uwDhmeTRAAAADHRSTlMJ8mN1EYcbmiixgACm7WbuAAAAVklEQVR42n3PUQqAIBBFUU1LLc3u/jdbOJoW1P08DA9Gba8+YWJ6gNJoNYIBzAA2chBth5kLmG9YUoG0NHAUwFXwO9LuBQL1giCQb8gC9Oro2vp5rncCIY8L8uEx5ZkAAAAASUVORK5CYII=)}.CodeMirror-lint-marker-multiple{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAMAAADzjKfhAAAACVBMVEUAAAAAAAC/v7914kyHAAAAAXRSTlMAQObYZgAAACNJREFUeNo1ioEJAAAIwmz/H90iFFSGJgFMe3gaLZ0od+9/AQZ0ADosbYraAAAAAElFTkSuQmCC);background-repeat:no-repeat;background-position:100% 100%;width:100%;height:100%}.CodeMirror{border:1px solid #dfdfdf;border-radius:3px;background-color:#fff;height:auto!important}.CodeMirror-code{outline:none;direction:ltr;text-align:left}.CodeMirror-focused .cm-matchhighlight{color:#fff!important;outline:1px solid green}.cm-s-rubyblue .CodeMirror-cursor{border-left:1px solid #fff!important}.CodeMirror-lint-marker-multiple,[class*=CodeMirror-lint-marker],[class*=CodeMirror-lint-message]{background-image:none}.CodeMirror-lint-marker-error,.CodeMirror-lint-marker-warning{cursor:help}.CodeMirror-lint-marker-multiple{position:absolute;top:0}[class*=CodeMirror-lint-marker]:before{font:normal 18px/1 dashicons;position:relative;top:-2px}[class*=CodeMirror-lint-message]:before{font:normal 16px/1 dashicons;left:16px;position:absolute}.CodeMirror-lint-message-error,.CodeMirror-lint-message-warning{box-shadow:0 1px 1px 0 rgba(0,0,0,.1);margin:5px 0 2px;padding:3px 12px 3px 28px}.CodeMirror-lint-message-warning{background-color:#fff8e5;border-left:4px solid #ffb900}.CodeMirror-lint-marker-warning:before,.CodeMirror-lint-message-warning:before{content:"\f534";color:#f6a306}.CodeMirror-lint-message-error{background-color:#fbeaea;border-left:4px solid #dc3232}.CodeMirror-lint-marker-error:before,.CodeMirror-lint-message-error:before{content:"\f153";color:#dc3232}.CodeMirror-lint-tooltip{background:none;border:none;border-radius:0;direction:ltr}.CodeMirror .CodeMirror-matchingbracket{background:rgba(255,150,0,.3);color:inherit}.CodeMirror .CodeMirror-linenumber{color:#666}
admin/assets/css/codemirror.css DELETED
@@ -1 +0,0 @@
1
- @-moz-keyframes blink{50%{background-color:transparent}}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}.CodeMirror{font-family:monospace;height:300px;color:#000;direction:ltr}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px;-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent;-webkit-font-variant-ligatures:contextual;font-variant-ligatures:contextual}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:#000}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0!important;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-animate-fat-cursor,.cm-fat-cursor-mark{-webkit-animation:blink 1.06s steps(1) infinite;-moz-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite}.cm-fat-cursor-mark{background-color:rgba(20,255,20,.5)}.cm-animate-fat-cursor{width:auto;border:0;background-color:#7e7}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-rulers{position:absolute;left:0;right:0;top:-50px;bottom:-20px;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-type,.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta,.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-invalidchar,.cm-s-default .cm-error{color:red}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0b0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#a22}.CodeMirror-matchingtag{background:rgba(255,150,0,.3)}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:#fff}.CodeMirror-scroll{overflow:scroll!important;margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;height:100%;outline:0;position:relative}.CodeMirror-sizer{position:relative;border-right:30px solid transparent}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;min-height:100%;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-30px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:0 0!important;border:0!important}.CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-gutter-wrapper ::selection{background-color:transparent}.CodeMirror-gutter-wrapper ::-moz-selection{background-color:transparent}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;padding:.1px}.CodeMirror-rtl pre{direction:rtl}.CodeMirror-code{outline:0}.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber,.CodeMirror-scroll,.CodeMirror-sizer{-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-cursor{position:absolute;pointer-events:none}.CodeMirror-measure pre{position:static}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}.CodeMirror-focused div.CodeMirror-cursors,div.CodeMirror-dragcursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background-color:#ffa;background-color:rgba(255,255,0,.4)}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:''}span.CodeMirror-selectedtext{background:0 0}
 
admin/assets/css/general.css CHANGED
@@ -3,9 +3,21 @@
3
  * @author Webcraftic <wordpress.webraftic@gmail.com>
4
  * @copyright Webcraftic 28.05.2018
5
  */
 
 
 
 
 
6
  .CodeMirror {
7
  height: auto !important;
8
- border: 1px solid #dad8d8;
 
 
 
 
 
 
 
9
  }
10
  .CodeMirror-scroll {
11
  min-height: 250px;
@@ -23,13 +35,19 @@
23
  #submitdiv {
24
  display: block;
25
  }
 
 
 
 
 
 
26
  #WINP_InfoMetaBox {
27
- background: #2a2428;
28
- color: #989898;
29
  }
30
  #WINP_InfoMetaBox h2 {
31
- font-size: 16px;
32
- color: #ffe202;
 
33
  text-transform: uppercase;
34
  }
35
  #WINP_InfoMetaBox h4 {
@@ -38,22 +56,90 @@
38
  }
39
  #WINP_InfoMetaBox .inside {
40
  padding: 0;
 
41
  }
42
- #WINP_InfoMetaBox .wbcr-inp-metabox-banner {
 
 
 
43
  padding: 15px;
 
44
  }
45
- #WINP_InfoMetaBox .wbcr-inp-metabox-banner .wbcr-inp-big-text {
46
- color: #fff;
 
 
 
 
 
 
 
47
  font-size: 15px;
 
 
 
 
 
 
48
  }
49
  #WINP_InfoMetaBox .wbcr-inp-metabox-banner .wbcr-inp-button {
50
  display: block;
51
- font-size: 18px;
 
52
  letter-spacing: 0;
53
- margin-top: 10px;
54
  text-decoration: none;
55
- color: #2a2428;
56
- background-color: #f9e100;
57
- padding: 15px 50px 15px 50px;
58
- box-shadow: 0 5px 0 0 #af9800;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  }
 
3
  * @author Webcraftic <wordpress.webraftic@gmail.com>
4
  * @copyright Webcraftic 28.05.2018
5
  */
6
+ .wbcr-inp-snippet-type-php .CodeMirror-sizer:before {
7
+ content: "<?php";
8
+ color: #bbb;
9
+ padding: 4px 5px 0;
10
+ }
11
  .CodeMirror {
12
  height: auto !important;
13
+ border: 0 !important;
14
+ }
15
+ .CodeMirror .cm-winp-matchhighlight {
16
+ background-color: rgba(255, 143, 26, 0.21);
17
+ border: 0 !important;
18
+ }
19
+ .CodeMirror .CodeMirror-selection-highlight-scrollbar {
20
+ background-color: rgba(255, 143, 26, 0.61);
21
  }
22
  .CodeMirror-scroll {
23
  min-height: 250px;
35
  #submitdiv {
36
  display: block;
37
  }
38
+ #WINP_BaseOptionsMetaBox.hide-if-js,
39
+ #WINP_InfoMetaBox.hide-if-js,
40
+ #tagsdiv-wbcr-snippet-tags.hide-if-js,
41
+ #submitdiv.hide-if-js {
42
+ display: none;
43
+ }
44
  #WINP_InfoMetaBox {
45
+ color: #222;
 
46
  }
47
  #WINP_InfoMetaBox h2 {
48
+ display: none;
49
+ font-size: 12px;
50
+ color: #353535;
51
  text-transform: uppercase;
52
  }
53
  #WINP_InfoMetaBox h4 {
56
  }
57
  #WINP_InfoMetaBox .inside {
58
  padding: 0;
59
+ margin: 0;
60
  }
61
+ #WINP_InfoMetaBox .wbcr-inp-metabox-banner .wbcr-inp-big-text {
62
+ display: block;
63
+ color: #9ca096;
64
+ font-size: 15px;
65
  padding: 15px;
66
+ text-align: center;
67
  }
68
+ #WINP_InfoMetaBox .wbcr-inp-metabox-banner .wbcr-inp-image {
69
+ padding: 20px 0;
70
+ }
71
+ #WINP_InfoMetaBox .wbcr-inp-metabox-banner .wbcr-inp-image img {
72
+ width: 100%;
73
+ }
74
+ #WINP_InfoMetaBox .wbcr-inp-metabox-banner .wbcr-inp-title {
75
+ padding: 15px;
76
+ margin: 0;
77
  font-size: 15px;
78
+ text-align: center;
79
+ color: #ca4a1f;
80
+ background: #fff5f4;
81
+ }
82
+ #WINP_InfoMetaBox .wbcr-inp-metabox-banner .wbcr-inp-title span {
83
+ font-size: 12px;
84
  }
85
  #WINP_InfoMetaBox .wbcr-inp-metabox-banner .wbcr-inp-button {
86
  display: block;
87
+ font-size: 16px;
88
+ text-align: center;
89
  letter-spacing: 0;
 
90
  text-decoration: none;
91
+ color: #828282;
92
+ font-weight: 600;
93
+ background-color: #f7f7f7;
94
+ padding: 15px 30px 15px 30px;
95
+ box-shadow: 0 1px 3px #b9b9b9;
96
+ border-bottom: 1px solid #e8e8e8;
97
+ margin: 10px;
98
+ }
99
+ .winp-enable-php-wrapper {
100
+ margin: 15px 0 auto;
101
+ }
102
+ .winp-enable-php-wrapper .winp-enable-php-btn i {
103
+ font-size: 1.2em;
104
+ line-height: inherit;
105
+ height: auto;
106
+ }
107
+ .winp-editor-container {
108
+ visibility: hidden;
109
+ height: 0;
110
+ }
111
+ .winp-snippet-enabled .winp-editor-container {
112
+ margin-top: 20px;
113
+ visibility: visible;
114
+ height: auto;
115
+ }
116
+ .winp-snippet-enabled .composer-switch,
117
+ .winp-snippet-enabled .fl-builder-admin,
118
+ .winp-snippet-enabled #postdivrich,
119
+ .winp-snippet-enabled #elementor-switch-mode,
120
+ .winp-snippet-enabled.elementor-editor-active #elementor-editor,
121
+ .winp-snippet-enabled #elementor-editor {
122
+ display: none;
123
+ }
124
+ .winp-snippet-enabled #wpb_visual_composer {
125
+ display: none !important;
126
+ }
127
+ .winp-php-content {
128
+ height: 300px;
129
+ width: 100%;
130
+ box-sizing: border-box;
131
+ z-index: auto;
132
+ position: relative;
133
+ -webkit-transition: none;
134
+ transition: none;
135
+ background: transparent !important;
136
+ }
137
+ #winp-export-action {
138
+ float: left;
139
+ line-height: 28px;
140
+ padding-right: 10px;
141
+ }
142
+ .winp-import-radio-container label {
143
+ font-weight: normal;
144
  }
145
+ /*# sourceMappingURL=general.css.map */
admin/assets/css/general.css.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["general.less"],"names":[],"mappings":";;;;;AAOA,0BAA2B,kBAAiB;EAC1C,SAAS,OAAT;EACA,WAAA;EACA,kBAAA;;AAGF;EACE,uBAAA;EACA,oBAAA;;AAFF,WAIE;EACE,0CAAA;EACA,oBAAA;;AANJ,WASE;EACE,0CAAA;;AAIJ;EACE,iBAAA;;AAGF;AAAuB;EACrB,aAAA;;AAGF;EACE,aAAA;;AAGF;AAA0B;AAAmB;AAA4B;EACvE,cAAA;;AAEA,wBAAC;AAAD,iBAAC;AAAD,0BAAC;AAAD,UAAC;EACC,aAAA;;AAIJ;EAEE,WAAA;;AAFF,iBAIE;EACE,aAAA;EACA,eAAA;EACA,cAAA;EACA,yBAAA;;AARJ,iBAWE;EACE,SAAA;EACA,kBAAA;;AAbJ,iBAgBE;EACE,UAAA;EACA,SAAA;;AAlBJ,iBAqBE,yBAGE;EACE,cAAA;EACA,cAAA;EACA,eAAA;EACA,aAAA;EACA,kBAAA;;AA7BN,iBAqBE,yBAWE;EAME,eAAA;;AAtCN,iBAqBE,yBAWE,gBACE;EACE,WAAA;;AAlCR,iBAqBE,yBAoBE;EACE,aAAA;EACA,SAAA;EACA,eAAA;EACA,kBAAA;EACA,cAAA;EACA,mBAAA;;AA/CN,iBAqBE,yBAoBE,gBAQE;EACE,eAAA;;AAlDR,iBAqBE,yBAiCE;EACE,cAAA;EACA,eAAA;EACA,kBAAA;EACA,iBAAA;EACA,qBAAA;EACA,cAAA;EACA,gBAAA;EACA,yBAAA;EACA,4BAAA;EACA,6BAAA;EACA,gCAAA;EACA,YAAA;;AAMN;EACE,mBAAA;;AADF,wBAGE,qBAAqB;EACnB,gBAAA;EACA,oBAAA;EACA,YAAA;;AAIJ;EACE,kBAAA;EACA,SAAA;;AAGF,qBAAsB;EACpB,gBAAA;EACA,mBAAA;EACA,YAAA;;AAGF,qBAAsB;AACtB,qBAAsB;AACtB,qBAAsB;AACtB,qBAAsB;AACtB,qBAAqB,wBAAyB;AAC9C,qBAAsB;EACpB,aAAA;;AAGF,qBAAsB;EACpB,wBAAA;;AAGF;EACE,aAAA;EACA,WAAA;EACA,sBAAA;EACA,aAAA;EACA,kBAAA;EACA,wBAAA;EACA,gBAAA;EACA,kCAAA;;AAGF;EACE,WAAA;EACA,iBAAA;EACA,mBAAA;;AAGF,4BAA6B;EAC3B,mBAAA","file":"general.css"}
admin/assets/css/general.less CHANGED
@@ -3,10 +3,26 @@
3
  * @author Webcraftic <wordpress.webraftic@gmail.com>
4
  * @copyright Webcraftic 28.05.2018
5
  */
 
 
 
 
 
 
 
6
 
7
  .CodeMirror {
8
  height: auto !important;
9
- border: 1px solid #dad8d8;
 
 
 
 
 
 
 
 
 
10
  }
11
 
12
  .CodeMirror-scroll {
@@ -23,17 +39,23 @@
23
 
24
  #WINP_BaseOptionsMetaBox, #WINP_InfoMetaBox, #tagsdiv-wbcr-snippet-tags, #submitdiv {
25
  display: block;
 
 
 
 
26
  }
27
 
28
  #WINP_InfoMetaBox {
29
- background: #2a2428;
30
- color: #989898;
31
 
32
  h2 {
33
- font-size: 16px;
34
- color: rgb(255, 226, 2);
 
35
  text-transform: uppercase;
36
  }
 
37
  h4 {
38
  margin: 0;
39
  text-align: center;
@@ -41,26 +63,111 @@
41
 
42
  .inside {
43
  padding: 0;
 
44
  }
45
 
46
  .wbcr-inp-metabox-banner {
47
- padding: 15px;
48
 
49
  .wbcr-inp-big-text {
50
- color: #fff;
 
51
  font-size: 15px;
 
 
52
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  .wbcr-inp-button {
54
  display: block;
55
- font-size: 18px;
 
56
  letter-spacing: 0;
57
- margin-top: 10px;
58
  text-decoration: none;
59
- color: #2a2428;
60
- background-color: #f9e100;
61
- padding: 15px 50px 15px 50px;
62
- box-shadow: 0 5px 0 0 #af9800;
 
 
 
63
  }
64
  }
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  }
3
  * @author Webcraftic <wordpress.webraftic@gmail.com>
4
  * @copyright Webcraftic 28.05.2018
5
  */
6
+ //cm-matchhighlight
7
+
8
+ .wbcr-inp-snippet-type-php .CodeMirror-sizer:before {
9
+ content: "<?php";
10
+ color: #bbb;
11
+ padding: 4px 5px 0;
12
+ }
13
 
14
  .CodeMirror {
15
  height: auto !important;
16
+ border: 0 !important;
17
+
18
+ .cm-winp-matchhighlight {
19
+ background-color: rgba(255, 143, 26, 0.21);
20
+ border: 0 !important;
21
+ }
22
+
23
+ .CodeMirror-selection-highlight-scrollbar {
24
+ background-color: rgba(255, 143, 26, 0.61)
25
+ }
26
  }
27
 
28
  .CodeMirror-scroll {
39
 
40
  #WINP_BaseOptionsMetaBox, #WINP_InfoMetaBox, #tagsdiv-wbcr-snippet-tags, #submitdiv {
41
  display: block;
42
+
43
+ &.hide-if-js {
44
+ display: none;
45
+ }
46
  }
47
 
48
  #WINP_InfoMetaBox {
49
+ //background: #2a2428;
50
+ color: #222;
51
 
52
  h2 {
53
+ display: none;
54
+ font-size: 12px;
55
+ color: #353535;
56
  text-transform: uppercase;
57
  }
58
+
59
  h4 {
60
  margin: 0;
61
  text-align: center;
63
 
64
  .inside {
65
  padding: 0;
66
+ margin: 0;
67
  }
68
 
69
  .wbcr-inp-metabox-banner {
70
+ //padding: 15px;
71
 
72
  .wbcr-inp-big-text {
73
+ display: block;
74
+ color: #9ca096;
75
  font-size: 15px;
76
+ padding: 15px;
77
+ text-align: center;
78
  }
79
+
80
+ .wbcr-inp-image {
81
+ img {
82
+ width: 100%;
83
+ }
84
+
85
+ //background: #f3f3f3;
86
+ padding: 20px 0;
87
+ }
88
+
89
+ .wbcr-inp-title {
90
+ padding: 15px;
91
+ margin: 0;
92
+ font-size: 15px;
93
+ text-align: center;
94
+ color: #ca4a1f;
95
+ background: #fff5f4;
96
+
97
+ span {
98
+ font-size: 12px;
99
+ }
100
+ }
101
+
102
  .wbcr-inp-button {
103
  display: block;
104
+ font-size: 16px;
105
+ text-align: center;
106
  letter-spacing: 0;
 
107
  text-decoration: none;
108
+ color: #828282;
109
+ font-weight: 600;
110
+ background-color: #f7f7f7;
111
+ padding: 15px 30px 15px 30px;
112
+ box-shadow: 0 1px 3px #b9b9b9;
113
+ border-bottom: 1px solid #e8e8e8;
114
+ margin: 10px;
115
  }
116
  }
117
 
118
+ }
119
+
120
+ .winp-enable-php-wrapper {
121
+ margin: 15px 0 auto;
122
+
123
+ .winp-enable-php-btn i {
124
+ font-size: 1.2em;
125
+ line-height: inherit;
126
+ height: auto;
127
+ }
128
+ }
129
+
130
+ .winp-editor-container {
131
+ visibility: hidden;
132
+ height: 0;
133
+ }
134
+
135
+ .winp-snippet-enabled .winp-editor-container {
136
+ margin-top: 20px;
137
+ visibility: visible;
138
+ height: auto;
139
+ }
140
+
141
+ .winp-snippet-enabled .composer-switch,
142
+ .winp-snippet-enabled .fl-builder-admin,
143
+ .winp-snippet-enabled #postdivrich,
144
+ .winp-snippet-enabled #elementor-switch-mode,
145
+ .winp-snippet-enabled.elementor-editor-active #elementor-editor,
146
+ .winp-snippet-enabled #elementor-editor {
147
+ display: none;
148
+ }
149
+
150
+ .winp-snippet-enabled #wpb_visual_composer {
151
+ display: none !important;
152
+ }
153
+
154
+ .winp-php-content {
155
+ height: 300px;
156
+ width: 100%;
157
+ box-sizing: border-box;
158
+ z-index: auto;
159
+ position: relative;
160
+ -webkit-transition: none;
161
+ transition: none;
162
+ background: transparent !important;
163
+ }
164
+
165
+ #winp-export-action {
166
+ float: left;
167
+ line-height: 28px;
168
+ padding-right: 10px;
169
+ }
170
+
171
+ .winp-import-radio-container label {
172
+ font-weight: normal;
173
  }
admin/assets/css/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
admin/assets/css/list-table.css CHANGED
@@ -6,26 +6,56 @@
6
  .wp-list-table th#title {
7
  width: 20% !important;
8
  }
9
- .wp-list-table th#status {
10
- width: 60px !important;
11
  }
12
  .wp-list-table th#actions {
13
- width: 100px !important;
14
  }
15
  .wp-list-table th#where_use {
16
  width: 200px !important;
17
  }
18
  .wp-list-table th#taxonomy-wbcr-snippet-tags {
19
- width: 150px;
20
  }
21
  .wp-list-table td {
22
  vertical-align: middle !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  }
24
  .wp-list-table .wbcr-inp-status-marker {
25
  display: inline-block;
26
  border-radius: 100%;
27
  width: 10px;
28
  height: 10px;
 
29
  }
30
  .wp-list-table .wbcr-inp-status-marker.wbcr-inp-status-green {
31
  background: #8bc34a;
@@ -33,3 +63,27 @@
33
  .wp-list-table .wbcr-inp-status-marker.wbcr-inp-status-grey {
34
  background: #c0c0c0;
35
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  .wp-list-table th#title {
7
  width: 20% !important;
8
  }
9
+ .wp-list-table th#snippet_type {
10
+ width: 70px !important;
11
  }
12
  .wp-list-table th#actions {
13
+ width: 50px !important;
14
  }
15
  .wp-list-table th#where_use {
16
  width: 200px !important;
17
  }
18
  .wp-list-table th#taxonomy-wbcr-snippet-tags {
19
+ width: 100px;
20
  }
21
  .wp-list-table td {
22
  vertical-align: middle !important;
23
+ /*&.column-snippet_type {
24
+ text-align: center;
25
+ }*/
26
+ }
27
+ .wp-list-table .wbcr-inp-enable-snippet-button .dashicons {
28
+ margin-top: 3px;
29
+ }
30
+ .wp-list-table .wbcr-inp-enable-snippet-button .dashicons.dashicons-controls-pause {
31
+ color: #8bc34a;
32
+ }
33
+ .wp-list-table .wbcr-inp-snippet-type-label {
34
+ display: inline-block;
35
+ padding: 3px 8px 6px;
36
+ border-radius: 3px;
37
+ font-weight: bold;
38
+ width: 30px;
39
+ text-align: center;
40
+ }
41
+ .wp-list-table .wbcr-inp-snippet-type-label.wbcr-inp-type-php {
42
+ background: #777bb3;
43
+ color: #ffffff;
44
+ }
45
+ .wp-list-table .wbcr-inp-snippet-type-label.wbcr-inp-type-text {
46
+ background: #ffeb3b;
47
+ color: #655d15;
48
+ }
49
+ .wp-list-table .wbcr-inp-snippet-type-label.wbcr-inp-type-universal {
50
+ background: #cae8cc;
51
+ color: #3b6f3e;
52
  }
53
  .wp-list-table .wbcr-inp-status-marker {
54
  display: inline-block;
55
  border-radius: 100%;
56
  width: 10px;
57
  height: 10px;
58
+ margin-left: 5px;
59
  }
60
  .wp-list-table .wbcr-inp-status-marker.wbcr-inp-status-green {
61
  background: #8bc34a;
63
  .wp-list-table .wbcr-inp-status-marker.wbcr-inp-status-grey {
64
  background: #c0c0c0;
65
  }
66
+ @media screen and (max-width: 1350px) {
67
+ .wp-list-table th#description,
68
+ .wp-list-table th.column-description {
69
+ width: 0;
70
+ font-size: 0;
71
+ }
72
+ .wp-list-table th#actions {
73
+ width: 50px !important;
74
+ }
75
+ .wp-list-table th#where_use {
76
+ width: 100px !important;
77
+ }
78
+ .wp-list-table th#taxonomy-wbcr-snippet-tags {
79
+ width: 60px !important;
80
+ }
81
+ .wp-list-table th#snippet_type {
82
+ width: 50px !important;
83
+ }
84
+ .wp-list-table td.column-description {
85
+ width: 0;
86
+ font-size: 0;
87
+ }
88
+ }
89
+ /*# sourceMappingURL=list-table.css.map */
admin/assets/css/list-table.css.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["list-table.less"],"names":[],"mappings":";;;;;AAQI,cADA,GACC;EACC,qBAAA;;AAGF,cALA,GAKC;EACC,sBAAA;;AAGF,cATA,GASC;EACC,sBAAA;;AAGF,cAbA,GAaC;EACC,uBAAA;;AAGF,cAjBA,GAiBC;EACC,YAAA;;AAIJ,cAAE;EACA,iCAAA;;;;;AAxBJ,cAmCE,gCACE;EACE,eAAA;;AAEA,cAJJ,gCACE,WAGG;EACC,cAAA;;AAxCR,cA6CE;EACE,qBAAA;EACA,oBAAA;EACA,kBAAA;EACA,iBAAA;EACA,WAAA;EACA,kBAAA;;AAEA,cARF,6BAQG;EACC,mBAAA;EACA,cAAA;;AAGF,cAbF,6BAaG;EACC,mBAAA;EACA,cAAA;;AAGF,cAlBF,6BAkBG;EACC,mBAAA;EACA,cAAA;;AAjEN,cAqEE;EACE,qBAAA;EACA,mBAAA;EACA,WAAA;EACA,YAAA;EACA,gBAAA;;AAEA,cAPF,wBAOG;EACC,mBAAA;;AAGF,cAXF,wBAWG;EACC,mBAAA;;AAON,mBAAsC;EAGhC,cADA,GACC;EAAc,cADf,GACgB;IACd,QAAA;IACA,YAAA;;EAGF,cANA,GAMC;IACC,sBAAA;;EAGF,cAVA,GAUC;IACC,uBAAA;;EAGF,cAdA,GAcC;IACC,sBAAA;;EAGF,cAlBA,GAkBC;IACC,sBAAA;;EAKF,cADA,GACC;IACC,QAAA;IACA,YAAA","file":"list-table.css"}
admin/assets/css/list-table.less CHANGED
@@ -9,24 +9,68 @@
9
  &#title {
10
  width: 20% !important;
11
  }
12
- &#status {
13
- width: 60px !important;
 
14
  }
 
15
  &#actions {
16
- width: 100px !important;
17
  }
 
18
  &#where_use {
19
  width: 200px !important;
20
  }
 
21
  &#taxonomy-wbcr-snippet-tags {
22
- width: 150px;
23
  }
24
  }
 
25
  & td {
26
  vertical-align: middle !important;
 
27
  &.column-status {
28
  //text-align: center;
29
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  }
31
 
32
  .wbcr-inp-status-marker {
@@ -34,13 +78,51 @@
34
  border-radius: 100%;
35
  width: 10px;
36
  height: 10px;
 
37
 
38
  &.wbcr-inp-status-green {
39
  background: #8bc34a;
40
  }
 
41
  &.wbcr-inp-status-grey {
42
  background: #c0c0c0;
43
  }
44
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  }
46
 
9
  &#title {
10
  width: 20% !important;
11
  }
12
+
13
+ &#snippet_type {
14
+ width: 70px !important;
15
  }
16
+
17
  &#actions {
18
+ width: 50px !important;
19
  }
20
+
21
  &#where_use {
22
  width: 200px !important;
23
  }
24
+
25
  &#taxonomy-wbcr-snippet-tags {
26
+ width: 100px;
27
  }
28
  }
29
+
30
  & td {
31
  vertical-align: middle !important;
32
+
33
  &.column-status {
34
  //text-align: center;
35
  }
36
+
37
+ /*&.column-snippet_type {
38
+ text-align: center;
39
+ }*/
40
+ }
41
+
42
+ .wbcr-inp-enable-snippet-button {
43
+ .dashicons {
44
+ margin-top: 3px;
45
+
46
+ &.dashicons-controls-pause {
47
+ color: #8bc34a;
48
+ }
49
+ }
50
+ }
51
+
52
+ .wbcr-inp-snippet-type-label {
53
+ display: inline-block;
54
+ padding: 3px 8px 6px;
55
+ border-radius: 3px;
56
+ font-weight: bold;
57
+ width: 30px;
58
+ text-align: center;
59
+
60
+ &.wbcr-inp-type-php {
61
+ background: #777bb3;
62
+ color: #ffffff;
63
+ }
64
+
65
+ &.wbcr-inp-type-text {
66
+ background: #ffeb3b;
67
+ color: #655d15;
68
+ }
69
+
70
+ &.wbcr-inp-type-universal {
71
+ background: #cae8cc;
72
+ color: #3b6f3e;
73
+ }
74
  }
75
 
76
  .wbcr-inp-status-marker {
78
  border-radius: 100%;
79
  width: 10px;
80
  height: 10px;
81
+ margin-left: 5px;
82
 
83
  &.wbcr-inp-status-green {
84
  background: #8bc34a;
85
  }
86
+
87
  &.wbcr-inp-status-grey {
88
  background: #c0c0c0;
89
  }
90
  }
91
+
92
+
93
+ }
94
+
95
+ @media screen and (max-width: 1350px) {
96
+ .wp-list-table {
97
+ & th {
98
+ &#description, &.column-description {
99
+ width: 0;
100
+ font-size: 0;
101
+ }
102
+
103
+ &#actions {
104
+ width: 50px !important;
105
+ }
106
+
107
+ &#where_use {
108
+ width: 100px !important;
109
+ }
110
+
111
+ &#taxonomy-wbcr-snippet-tags {
112
+ width: 60px !important;
113
+ }
114
+
115
+ &#snippet_type {
116
+ width: 50px !important;
117
+ }
118
+ }
119
+
120
+ & td {
121
+ &.column-description {
122
+ width: 0;
123
+ font-size: 0;
124
+ }
125
+ }
126
+ }
127
  }
128
 
admin/assets/css/new-item.css ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wrap {
2
+ margin-top: 0;
3
+ }
4
+ .wbcr-inp-items {
5
+ padding-top: 10px;
6
+ padding-bottom: 20px;
7
+ overflow: hidden;
8
+ background-color: #f1f1f1;
9
+ }
10
+ .wbcr-inp-items .wbcr-inp-buttons .button {
11
+ background-color: #fff;
12
+ }
13
+ .wbcr-inp-items .wbcr-inp-item {
14
+ width: 250px;
15
+ min-width: 0;
16
+ height: 250px;
17
+ padding: 20px;
18
+ margin: 0 15px 15px 0;
19
+ vertical-align: top;
20
+ float: left;
21
+ -moz-box-sizing: border-box;
22
+ box-sizing: border-box;
23
+ line-height: 150%;
24
+ position: relative;
25
+ }
26
+ .wbcr-inp-items .wbcr-inp-item .wbcr-inp-title {
27
+ font-size: 16px;
28
+ margin: 0 0 15px 0;
29
+ }
30
+ .wbcr-inp-items .wbcr-inp-item .wbcr-inp-buttons {
31
+ position: absolute;
32
+ bottom: 0;
33
+ left: 0;
34
+ right: 0;
35
+ padding: 18px;
36
+ background-color: #f9f9f9;
37
+ height: 66px;
38
+ -moz-box-sizing: border-box;
39
+ box-sizing: border-box;
40
+ }
41
+ .wbcr-inp-items .wbcr-inp-item .wbcr-inp-buttons .dashicons {
42
+ position: relative;
43
+ font-size: 20px;
44
+ }
45
+ .wbcr-inp-items .wbcr-inp-item .wbcr-inp-buttons .dashicons + span {
46
+ margin-left: 5px;
47
+ }
48
+ .wbcr-inp-items .wbcr-inp-item .wbcr-inp-buttons .wbcr-inp-hint-button {
49
+ float: right;
50
+ }
51
+ .wbcr-inp-items .wbcr-inp-item .wbcr-inp-buttons .wbcr-inp-hint-button .dashicons {
52
+ top: 4px;
53
+ }
54
+ .wbcr-inp-items .wbcr-inp-item .wbcr-inp-buttons .wbcr-inp-create .dashicons {
55
+ top: 5px;
56
+ }
57
+ /*# sourceMappingURL=new-item.css.map */
admin/assets/css/new-item.css.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["new-item.less"],"names":[],"mappings":"AAAA;EACE,aAAA;;AAGF;EACE,iBAAA;EACA,oBAAA;EACA,gBAAA;EACA,yBAAA;;AAJF,eAME,kBAAkB;EAChB,sBAAA;;AAPJ,eAUE;EACE,YAAA;EACA,YAAA;EACA,aAAA;EAEA,aAAA;EACA,qBAAA;EAEA,mBAAA;EACA,WAAA;EAEA,2BAAA;EACA,sBAAA;EAEA,iBAAA;EACA,kBAAA;;AAzBJ,eAUE,eAiBE;EACE,eAAA;EACA,kBAAA;;AA7BN,eAUE,eAsBE;EACE,kBAAA;EACA,SAAA;EACA,OAAA;EACA,QAAA;EACA,aAAA;EACA,yBAAA;EACA,YAAA;EAEA,2BAAA;EACA,sBAAA;;AA1CN,eAUE,eAsBE,kBAYE;EACE,kBAAA;EACA,eAAA;;AA9CR,eAUE,eAsBE,kBAiBE,WAAW;EACT,gBAAA;;AAlDR,eAUE,eAsBE,kBAqBE;EACE,YAAA;;AAtDR,eAUE,eAsBE,kBAqBE,sBAGE;EACE,QAAA;;AAzDV,eAUE,eAsBE,kBA6BE,iBACE;EACE,QAAA","file":"new-item.css"}
admin/assets/css/new-item.less ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wrap {
2
+ margin-top: 0;
3
+ }
4
+
5
+ .wbcr-inp-items {
6
+ padding-top: 10px;
7
+ padding-bottom: 20px;
8
+ overflow: hidden;
9
+ background-color: #f1f1f1;
10
+
11
+ .wbcr-inp-buttons .button {
12
+ background-color: #fff;
13
+ }
14
+
15
+ .wbcr-inp-item {
16
+ width: 250px;
17
+ min-width: 0;
18
+ height: 250px;
19
+
20
+ padding: 20px;
21
+ margin: 0 15px 15px 0;
22
+
23
+ vertical-align: top;
24
+ float: left;
25
+
26
+ -moz-box-sizing: border-box;
27
+ box-sizing: border-box;
28
+
29
+ line-height: 150%;
30
+ position: relative;
31
+
32
+ .wbcr-inp-title {
33
+ font-size: 16px;
34
+ margin: 0 0 15px 0;
35
+ }
36
+
37
+ .wbcr-inp-buttons {
38
+ position: absolute;
39
+ bottom: 0;
40
+ left: 0;
41
+ right: 0;
42
+ padding: 18px;
43
+ background-color: #f9f9f9;
44
+ height: 66px;
45
+
46
+ -moz-box-sizing: border-box;
47
+ box-sizing: border-box;
48
+
49
+ .dashicons {
50
+ position: relative;
51
+ font-size: 20px;
52
+ }
53
+
54
+ .dashicons + span {
55
+ margin-left: 5px;
56
+ }
57
+
58
+ .wbcr-inp-hint-button {
59
+ float: right;
60
+
61
+ .dashicons {
62
+ top: 4px
63
+ }
64
+ }
65
+
66
+ .wbcr-inp-create {
67
+ .dashicons {
68
+ top: 5px
69
+ }
70
+ }
71
+ }
72
+ }
73
+ }
admin/assets/css/snippet-block.css ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #winp-snippet-gb-content-tags {
2
+ margin-top: 20px;
3
+ padding: 20px;
4
+ }
5
+ div[data-type="wp-plugin-insert-php/winp-snippet"] {
6
+ position: relative;
7
+ background: #fbfbfb;
8
+ border: 2px dashed #d6d6d6;
9
+ }
10
+ div[data-type="wp-plugin-insert-php/winp-snippet"]:before {
11
+ display: block;
12
+ position: absolute;
13
+ top: -15px;
14
+ left: 90%;
15
+ width: 30px;
16
+ height: 30px;
17
+ content: '';
18
+ background: url(../img/snippet-cut.png) center no-repeat;
19
+ }
20
+ .winp-snippet-gb-container {
21
+ font-size: 13px;
22
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
23
+ }
24
+ .winp-snippet-gb-container .editor-inserter {
25
+ display: block;
26
+ padding: 15px;
27
+ }
28
+ .winp-snippet-gb-container .block-list-appender__toggle {
29
+ outline: 1px dashed #d2d2d2;
30
+ background: #fbfbfb;
31
+ }
32
+ .winp-snippet-gb-container label {
33
+ display: block;
34
+ font-weight: 600;
35
+ font-size: 14px;
36
+ flex-shrink: 0;
37
+ margin-bottom: 5px;
38
+ }
39
+ .winp-snippet-gb-container select {
40
+ display: block;
41
+ margin-bottom: 15px;
42
+ width: 100%;
43
+ color: inherit;
44
+ line-height: inherit;
45
+ font-size: 15px;
46
+ border-radius: 0;
47
+ }
48
+ .winp-snippet-gb-container .editor-block-list__insertion-point-inserter {
49
+ height: 32px;
50
+ }
51
+ /*# sourceMappingURL=snippet-block.css.map */
admin/assets/css/snippet-block.css.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["snippet-block.less"],"names":[],"mappings":"AAAA;EACE,gBAAA;EACA,aAAA;;AAGF,GAAG;EACD,kBAAA;EACA,mBAAA;EACA,0BAAA;;AAEA,GALC,+CAKA;EACC,cAAA;EACA,kBAAA;EACA,UAAA;EACA,SAAA;EACA,WAAA;EACA,YAAA;EACA,SAAS,EAAT;EACA,wDAAA;;AAIJ;EACE,eAAA;EACA,gDAAgD,oDAAoD,4BAApG;;AAFF,0BAIE;EACE,cAAA;EACA,aAAA;;AANJ,0BASE;EACE,2BAAA;EACA,mBAAA;;AAXJ,0BAcE;EACE,cAAA;EACA,gBAAA;EACA,eAAA;EACA,cAAA;EACA,kBAAA;;AAnBJ,0BAsBE;EACE,cAAA;EACA,mBAAA;EACA,WAAA;EACA,cAAA;EACA,oBAAA;EACA,eAAA;EACA,gBAAA;;AA7BJ,0BAgCE;EACE,YAAA","file":"snippet-block.css"}
admin/assets/css/snippet-block.less ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #winp-snippet-gb-content-tags {
2
+ margin-top: 20px;
3
+ padding: 20px;
4
+ }
5
+
6
+ div[data-type="wp-plugin-insert-php/winp-snippet"] {
7
+ position: relative;
8
+ background: #fbfbfb;
9
+ border: 2px dashed #d6d6d6;
10
+
11
+ &:before {
12
+ display: block;
13
+ position: absolute;
14
+ top: -15px;
15
+ left: 90%;
16
+ width: 30px;
17
+ height: 30px;
18
+ content: '';
19
+ background: url(../img/snippet-cut.png) center no-repeat;
20
+ }
21
+ }
22
+
23
+ .winp-snippet-gb-container {
24
+ font-size: 13px;
25
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
26
+
27
+ .editor-inserter {
28
+ display: block;
29
+ padding: 15px;
30
+ }
31
+
32
+ .block-list-appender__toggle {
33
+ outline: 1px dashed #d2d2d2;
34
+ background: #fbfbfb;
35
+ }
36
+
37
+ label {
38
+ display: block;
39
+ font-weight: 600;
40
+ font-size: 14px;
41
+ flex-shrink: 0;
42
+ margin-bottom: 5px;
43
+ }
44
+
45
+ select {
46
+ display: block;
47
+ margin-bottom: 15px;
48
+ width: 100%;
49
+ color: inherit;
50
+ line-height: inherit;
51
+ font-size: 15px;
52
+ border-radius: 0;
53
+ }
54
+
55
+ .editor-block-list__insertion-point-inserter {
56
+ height: 32px;
57
+ }
58
+ }
admin/assets/css/view-opt.css ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #WINP_ViewOptionsMetaBox {
2
+ display: block;
3
+ }
4
+ #WINP_ViewOptionsMetaBox .winp-template {
5
+ display: none;
6
+ }
7
+ .winp-advanded-options input {
8
+ float: none;
9
+ position: relative;
10
+ top: 0;
11
+ padding: 4px;
12
+ }
13
+ .winp-advanded-options .winp-head {
14
+ overflow: auto;
15
+ background-color: #fff;
16
+ border-bottom: 1px solid #ddd;
17
+ border-left: 1px solid #ddd;
18
+ padding: 10px 15px;
19
+ }
20
+ .winp-advanded-options .winp-head .winp-left {
21
+ float: left;
22
+ }
23
+ .winp-advanded-options .winp-head .winp-right {
24
+ float: right;
25
+ }
26
+ .winp-advanded-options .winp-head .winp-left > *,
27
+ .winp-advanded-options .winp-head .winp-right > * {
28
+ display: inline-block;
29
+ vertical-align: middle;
30
+ }
31
+ .winp-advanded-options .winp-head .winp-left > span,
32
+ .winp-advanded-options .winp-head .winp-right > span {
33
+ margin: 0 5px;
34
+ }
35
+ .winp-advanded-options .winp-editor-wrap .winp-filters {
36
+ padding-left: 20px;
37
+ border-left: 1px solid #ddd;
38
+ }
39
+ .winp-advanded-options .winp-filters .winp-point {
40
+ background-color: #fff;
41
+ border: 1px solid #0073aa;
42
+ border-radius: 100%;
43
+ width: 11px;
44
+ height: 11px;
45
+ display: block;
46
+ position: absolute;
47
+ margin-left: -26px;
48
+ margin-top: 19px;
49
+ }
50
+ .winp-advanded-options .winp-filters .winp-point:after {
51
+ position: absolute;
52
+ content: " ";
53
+ display: block;
54
+ width: 15px;
55
+ border-top: 1px solid #ddd;
56
+ margin-left: 10px;
57
+ margin-top: 4px;
58
+ }
59
+ .winp-advanded-options .winp-filter + .winp-filter {
60
+ margin-top: 20px;
61
+ }
62
+ .winp-advanded-options .winp-box {
63
+ padding: 25px 15px 15px 15px;
64
+ border-left: 1px solid #ddd;
65
+ background-color: #f9f9f9;
66
+ }
67
+ .winp-advanded-options .winp-when-empty {
68
+ display: none;
69
+ }
70
+ .winp-advanded-options .winp-empty .winp-when-empty {
71
+ display: block;
72
+ }
73
+ .winp-advanded-options .winp-empty .winp-conditions {
74
+ display: none;
75
+ }
76
+ .winp-advanded-options .winp-integer {
77
+ width: 60px;
78
+ }
79
+ .winp-advanded-options .winp-text {
80
+ width: 300px;
81
+ }
82
+ /* Conditions */
83
+ .winp-condition {
84
+ position: relative;
85
+ }
86
+ .winp-condition .btn-group .btn {
87
+ height: 28px;
88
+ }
89
+ .winp-condition .winp-hint,
90
+ .winp-condition .winp-hint-content {
91
+ display: none;
92
+ }
93
+ .winp-condition .winp-hint {
94
+ position: relative;
95
+ display: inline-block;
96
+ padding: 0 6px 0 3px;
97
+ }
98
+ .winp-condition .winp-hint-icon {
99
+ background: url('../img/help.png') no-repeat 0 0 transparent;
100
+ position: relative;
101
+ height: 14px;
102
+ width: 13px;
103
+ display: inline-block;
104
+ cursor: help;
105
+ vertical-align: middle;
106
+ top: -1px;
107
+ opacity: 0.55;
108
+ }
109
+ .winp-condition .winp-hint:hover .winp-hint-content {
110
+ display: block;
111
+ position: absolute;
112
+ width: 280px;
113
+ background-color: rgba(0, 0, 0, 0.8);
114
+ white-space: normal;
115
+ padding: 10px 12px 12px 12px;
116
+ font-weight: normal;
117
+ line-height: 150%;
118
+ border-radius: 4px;
119
+ color: #fff;
120
+ font-size: 13px;
121
+ z-index: 999;
122
+ }
123
+ .winp-condition .winp-hint .winp-hint-content,
124
+ .winp-condition .winp-hint .winp-hint-content a {
125
+ color: #fff;
126
+ }
127
+ .winp-condition .winp-or {
128
+ display: none;
129
+ color: rgba(0, 0, 0, 0.4);
130
+ font-weight: bold;
131
+ padding: 1px 0 3px 0;
132
+ font-size: 80%;
133
+ text-transform: uppercase;
134
+ }
135
+ .winp-condition + .winp-condition .winp-or {
136
+ display: block;
137
+ }
138
+ .winp-condition .winp-controls {
139
+ position: absolute;
140
+ right: 0;
141
+ }
142
+ .winp-condition .btn-group {
143
+ border: 0;
144
+ }
145
+ .winp-condition > span {
146
+ display: inline-block;
147
+ vertical-align: top;
148
+ }
149
+ /* date control */
150
+ .winp-date-control {
151
+ display: inline-block;
152
+ position: relative;
153
+ }
154
+ .winp-date-control input[type='text'],
155
+ .winp-date-control select {
156
+ vertical-align: top;
157
+ }
158
+ .winp-date-control .winp-label {
159
+ display: inline-block;
160
+ vertical-align: top;
161
+ position: relative;
162
+ top: 4px;
163
+ padding: 0 4px;
164
+ }
165
+ .winp-date-control .winp-switcher {
166
+ padding: 4px 0;
167
+ }
168
+ .winp-date-control .winp-switcher * {
169
+ display: inline-block;
170
+ vertical-align: bottom;
171
+ }
172
+ .winp-date-control .winp-switcher label {
173
+ margin: 0 5px 0 0;
174
+ font-weight: normal;
175
+ }
176
+ .winp-date-control .winp-absolute-date input[type="text"] {
177
+ -moz-box-sizing: border-box;
178
+ -webkit-box-sizing: border-box;
179
+ box-sizing: border-box;
180
+ background-color: #fff;
181
+ padding-right: 20px;
182
+ width: 140px;
183
+ }
184
+ .winp-date-control .winp-absolute-date .fa-calendar {
185
+ position: absolute;
186
+ right: 7px;
187
+ top: 8px;
188
+ border-left: 1px solid rgba(0, 0, 0, 0.2);
189
+ padding-left: 6px;
190
+ }
191
+ .winp-date-control .winp-relative-date input[type="text"] {
192
+ width: 40px;
193
+ text-align: center;
194
+ }
195
+ .winp-date-control.winp-between .winp-solo-date {
196
+ display: none;
197
+ }
198
+ .winp-date-control.winp-solo .winp-between-date {
199
+ display: none;
200
+ }
201
+ .winp-date-control.winp-relative .winp-absolute-date {
202
+ display: none;
203
+ }
204
+ .winp-date-control.winp-absolute .winp-relative-date {
205
+ display: none;
206
+ }
207
+ .winp-scope .winp-and {
208
+ display: none;
209
+ color: rgba(0, 0, 0, 0.7);
210
+ font-weight: bold;
211
+ border-top: 1px solid #ddd;
212
+ margin: 18px 0;
213
+ position: relative;
214
+ }
215
+ .winp-scope .winp-and span {
216
+ position: absolute;
217
+ top: -10px;
218
+ background-color: #f9f9f9;
219
+ padding-right: 7px;
220
+ text-transform: uppercase;
221
+ }
222
+ .winp-scope + .winp-scope .winp-and {
223
+ display: block;
224
+ }
225
+ /*# sourceMappingURL=view-opt.css.map */
admin/assets/css/view-opt.css.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["view-opt.less"],"names":[],"mappings":"AAAA;EACE,cAAA;;AADF,wBAGE;EACE,aAAA;;AAIJ,sBACE;EACE,WAAA;EACA,kBAAA;EACA,MAAA;EACA,YAAA;;AALJ,sBAQE;EACE,cAAA;EACA,sBAAA;EACA,6BAAA;EACA,2BAAA;EACA,kBAAA;;AAbJ,sBAQE,WAOE;EACE,WAAA;;AAhBN,sBAQE,WAWE;EACE,YAAA;;AApBN,sBAQE,WAeE,WAAW;AAvBf,sBAQE,WAgBE,YAAY;EACV,qBAAA;EACA,sBAAA;;AA1BN,sBAQE,WAqBE,WAAW;AA7Bf,sBAQE,WAsBE,YAAY;EACV,aAAA;;AA/BN,sBAmCE,kBAAkB;EAChB,kBAAA;EACA,2BAAA;;AArCJ,sBAwCE,cAEE;EACE,sBAAA;EACA,yBAAA;EACA,mBAAA;EACA,WAAA;EACA,YAAA;EACA,cAAA;EACA,kBAAA;EACA,kBAAA;EACA,gBAAA;;AAnDN,sBAwCE,cAcE,YAAW;EACT,kBAAA;EACA,SAAS,GAAT;EACA,cAAA;EACA,WAAA;EACA,0BAAA;EACA,iBAAA;EACA,eAAA;;AA7DN,sBAiEE,aAAa;EACX,gBAAA;;AAlEJ,sBAqEE;EACE,4BAAA;EACA,2BAAA;EACA,yBAAA;;AAxEJ,sBA2EE;EACE,aAAA;;AA5EJ,sBA+EE,YAAY;EACV,cAAA;;AAhFJ,sBAmFE,YAAY;EACV,aAAA;;AApFJ,sBAuFE;EACE,WAAA;;AAxFJ,sBA2FE;EACE,YAAA;;;AAKJ;EACE,kBAAA;;AADF,eAGE,WAAW;EACT,YAAA;;AAJJ,eAOE;AAPF,eAQE;EACE,aAAA;;AATJ,eAYE;EACE,kBAAA;EACA,qBAAA;EACA,oBAAA;;AAfJ,eAkBE;EACE,gBAAgB,4CAAhB;EACA,kBAAA;EACA,YAAA;EACA,WAAA;EACA,qBAAA;EACA,YAAA;EACA,sBAAA;EACA,SAAA;EACA,aAAA;;AA3BJ,eA8BE,WAAU,MAAO;EACf,cAAA;EACA,kBAAA;EACA,YAAA;EACA,oCAAA;EACA,mBAAA;EACA,4BAAA;EACA,mBAAA;EACA,iBAAA;EACA,kBAAA;EACA,WAAA;EACA,eAAA;EACA,YAAA;;AA1CJ,eA6CE,WAAW;AA7Cb,eA8CE,WAAW,mBAAmB;EAC5B,WAAA;;AA/CJ,eAkDE;EACE,aAAA;EACA,yBAAA;EACA,iBAAA;EACA,oBAAA;EACA,cAAA;EACA,yBAAA;;AAxDJ,eA2DE,kBAAkB;EAChB,cAAA;;AA5DJ,eA+DE;EACE,kBAAA;EACA,QAAA;;AAjEJ,eAoEE;EACE,SAAA;;AAIJ,eAAgB;EACd,qBAAA;EACA,mBAAA;;;AAIF;EACE,qBAAA;EACA,kBAAA;;AAFF,kBAIE,MAAK;AAJP,kBAKE;EACE,mBAAA;;AANJ,kBASE;EACE,qBAAA;EACA,mBAAA;EACA,kBAAA;EACA,QAAA;EACA,cAAA;;AAdJ,kBAiBE;EACE,cAAA;;AAlBJ,kBAqBE,eAAe;EACb,qBAAA;EACA,sBAAA;;AAvBJ,kBA0BE,eAAe;EACb,iBAAA;EACA,mBAAA;;AA5BJ,kBA+BE,oBACE,MAAK;EACH,2BAAA;EACA,8BAAA;EACA,sBAAA;EACA,sBAAA;EACA,mBAAA;EACA,YAAA;;AAtCN,kBA+BE,oBAUE;EACE,kBAAA;EACA,UAAA;EACA,QAAA;EACA,yCAAA;EACA,iBAAA;;AA9CN,kBAkDE,oBAAoB,MAAK;EACtB,WAAA;EACA,kBAAA;;AAIL,kBAAkB,aAAc;EAC9B,aAAA;;AAGF,kBAAkB,UAAW;EAC3B,aAAA;;AAGF,kBAAkB,cAAe;EAC/B,aAAA;;AAGF,kBAAkB,cAAe;EAC/B,aAAA;;AAGF,WACE;EACE,aAAA;EACA,yBAAA;EACA,iBAAA;EACA,0BAAA;EACA,cAAA;EACA,kBAAA;;AAPJ,WAUE,UAAU;EACR,kBAAA;EACA,UAAA;EACA,yBAAA;EACA,kBAAA;EACA,yBAAA;;AAfJ,WAkBE,cAAc;EACZ,cAAA","file":"view-opt.css"}
admin/assets/css/view-opt.less ADDED
@@ -0,0 +1,278 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #WINP_ViewOptionsMetaBox {
2
+ display: block;
3
+
4
+ .winp-template {
5
+ display: none;
6
+ }
7
+ }
8
+
9
+ .winp-advanded-options {
10
+ input {
11
+ float: none;
12
+ position: relative;
13
+ top: 0;
14
+ padding: 4px;
15
+ }
16
+
17
+ .winp-head {
18
+ overflow: auto;
19
+ background-color: #fff;
20
+ border-bottom: 1px solid #ddd;
21
+ border-left: 1px solid #ddd;
22
+ padding: 10px 15px;
23
+
24
+ .winp-left {
25
+ float: left;
26
+ }
27
+
28
+ .winp-right {
29
+ float: right;
30
+ }
31
+
32
+ .winp-left > *,
33
+ .winp-right > * {
34
+ display: inline-block;
35
+ vertical-align: middle;
36
+ }
37
+
38
+ .winp-left > span,
39
+ .winp-right > span {
40
+ margin: 0 5px;
41
+ }
42
+ }
43
+
44
+ .winp-editor-wrap .winp-filters {
45
+ padding-left: 20px;
46
+ border-left: 1px solid #ddd;
47
+ }
48
+
49
+ .winp-filters {
50
+
51
+ .winp-point {
52
+ background-color: #fff;
53
+ border: 1px solid #0073aa;
54
+ border-radius: 100%;
55
+ width: 11px;
56
+ height: 11px;
57
+ display: block;
58
+ position: absolute;
59
+ margin-left: -26px;
60
+ margin-top: 19px;
61
+ }
62
+
63
+ .winp-point:after {
64
+ position: absolute;
65
+ content: " ";
66
+ display: block;
67
+ width: 15px;
68
+ border-top: 1px solid #ddd;
69
+ margin-left: 10px;
70
+ margin-top: 4px;
71
+ }
72
+ }
73
+
74
+ .winp-filter + .winp-filter {
75
+ margin-top: 20px;
76
+ }
77
+
78
+ .winp-box {
79
+ padding: 25px 15px 15px 15px;
80
+ border-left: 1px solid #ddd;
81
+ background-color: #f9f9f9;
82
+ }
83
+
84
+ .winp-when-empty {
85
+ display: none;
86
+ }
87
+
88
+ .winp-empty .winp-when-empty {
89
+ display: block;
90
+ }
91
+
92
+ .winp-empty .winp-conditions {
93
+ display: none;
94
+ }
95
+
96
+ .winp-integer {
97
+ width: 60px;
98
+ }
99
+
100
+ .winp-text {
101
+ width: 300px;
102
+ }
103
+ }
104
+
105
+ /* Conditions */
106
+ .winp-condition {
107
+ position: relative;
108
+
109
+ .btn-group .btn {
110
+ height: 28px;
111
+ }
112
+
113
+ .winp-hint,
114
+ .winp-hint-content {
115
+ display: none;
116
+ }
117
+
118
+ .winp-hint {
119
+ position: relative;
120
+ display: inline-block;
121
+ padding: 0 6px 0 3px;
122
+ }
123
+
124
+ .winp-hint-icon {
125
+ background: url('../img/help.png') no-repeat 0 0 transparent;
126
+ position: relative;
127
+ height: 14px;
128
+ width: 13px;
129
+ display: inline-block;
130
+ cursor: help;
131
+ vertical-align: middle;
132
+ top: -1px;
133
+ opacity: 0.55;
134
+ }
135
+
136
+ .winp-hint:hover .winp-hint-content {
137
+ display: block;
138
+ position: absolute;
139
+ width: 280px;
140
+ background-color: rgba(0, 0, 0, 0.8);
141
+ white-space: normal;
142
+ padding: 10px 12px 12px 12px;
143
+ font-weight: normal;
144
+ line-height: 150%;
145
+ border-radius: 4px;
146
+ color: #fff;
147
+ font-size: 13px;
148
+ z-index: 999;
149
+ }
150
+
151
+ .winp-hint .winp-hint-content,
152
+ .winp-hint .winp-hint-content a {
153
+ color: #fff;
154
+ }
155
+
156
+ .winp-or {
157
+ display: none;
158
+ color: rgba(0, 0, 0, 0.4);
159
+ font-weight: bold;
160
+ padding: 1px 0 3px 0;
161
+ font-size: 80%;
162
+ text-transform: uppercase;
163
+ }
164
+
165
+ + .winp-condition .winp-or {
166
+ display: block;
167
+ }
168
+
169
+ .winp-controls {
170
+ position: absolute;
171
+ right: 0;
172
+ }
173
+
174
+ .btn-group {
175
+ border: 0;
176
+ }
177
+ }
178
+
179
+ .winp-condition > span {
180
+ display: inline-block;
181
+ vertical-align: top;
182
+ }
183
+
184
+ /* date control */
185
+ .winp-date-control {
186
+ display: inline-block;
187
+ position: relative;
188
+
189
+ input[type='text'],
190
+ select {
191
+ vertical-align: top;
192
+ }
193
+
194
+ .winp-label {
195
+ display: inline-block;
196
+ vertical-align: top;
197
+ position: relative;
198
+ top: 4px;
199
+ padding: 0 4px;
200
+ }
201
+
202
+ .winp-switcher {
203
+ padding: 4px 0;
204
+ }
205
+
206
+ .winp-switcher * {
207
+ display: inline-block;
208
+ vertical-align: bottom;
209
+ }
210
+
211
+ .winp-switcher label {
212
+ margin: 0 5px 0 0;
213
+ font-weight: normal;
214
+ }
215
+
216
+ .winp-absolute-date {
217
+ input[type="text"] {
218
+ -moz-box-sizing: border-box;
219
+ -webkit-box-sizing: border-box;
220
+ box-sizing: border-box;
221
+ background-color: #fff;
222
+ padding-right: 20px;
223
+ width: 140px;
224
+ }
225
+
226
+ .fa-calendar {
227
+ position: absolute;
228
+ right: 7px;
229
+ top: 8px;
230
+ border-left: 1px solid rgba(0, 0, 0, 0.2);
231
+ padding-left: 6px;
232
+ }
233
+ }
234
+
235
+ .winp-relative-date input[type="text"] {
236
+ width: 40px;
237
+ text-align: center;
238
+ }
239
+ }
240
+
241
+ .winp-date-control.winp-between .winp-solo-date {
242
+ display: none;
243
+ }
244
+
245
+ .winp-date-control.winp-solo .winp-between-date {
246
+ display: none;
247
+ }
248
+
249
+ .winp-date-control.winp-relative .winp-absolute-date {
250
+ display: none;
251
+ }
252
+
253
+ .winp-date-control.winp-absolute .winp-relative-date {
254
+ display: none;
255
+ }
256
+
257
+ .winp-scope {
258
+ .winp-and {
259
+ display: none;
260
+ color: rgba(0, 0, 0, 0.7);
261
+ font-weight: bold;
262
+ border-top: 1px solid #ddd;
263
+ margin: 18px 0;
264
+ position: relative;
265
+ }
266
+
267
+ .winp-and span {
268
+ position: absolute;
269
+ top: -10px;
270
+ background-color: #f9f9f9;
271
+ padding-right: 7px;
272
+ text-transform: uppercase;
273
+ }
274
+
275
+ + .winp-scope .winp-and {
276
+ display: block;
277
+ }
278
+ }
admin/assets/gutenberg/build/index.build.js ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /******/ (function(modules) { // webpackBootstrap
2
+ /******/ // The module cache
3
+ /******/ var installedModules = {};
4
+ /******/
5
+ /******/ // The require function
6
+ /******/ function __webpack_require__(moduleId) {
7
+ /******/
8
+ /******/ // Check if module is in cache
9
+ /******/ if(installedModules[moduleId]) {
10
+ /******/ return installedModules[moduleId].exports;
11
+ /******/ }
12
+ /******/ // Create a new module (and put it into the cache)
13
+ /******/ var module = installedModules[moduleId] = {
14
+ /******/ i: moduleId,
15
+ /******/ l: false,
16
+ /******/ exports: {}
17
+ /******/ };
18
+ /******/
19
+ /******/ // Execute the module function
20
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21
+ /******/
22
+ /******/ // Flag the module as loaded
23
+ /******/ module.l = true;
24
+ /******/
25
+ /******/ // Return the exports of the module
26
+ /******/ return module.exports;
27
+ /******/ }
28
+ /******/
29
+ /******/
30
+ /******/ // expose the modules object (__webpack_modules__)
31
+ /******/ __webpack_require__.m = modules;
32
+ /******/
33
+ /******/ // expose the module cache
34
+ /******/ __webpack_require__.c = installedModules;
35
+ /******/
36
+ /******/ // define getter function for harmony exports
37
+ /******/ __webpack_require__.d = function(exports, name, getter) {
38
+ /******/ if(!__webpack_require__.o(exports, name)) {
39
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
40
+ /******/ }
41
+ /******/ };
42
+ /******/
43
+ /******/ // define __esModule on exports
44
+ /******/ __webpack_require__.r = function(exports) {
45
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47
+ /******/ }
48
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
49
+ /******/ };
50
+ /******/
51
+ /******/ // create a fake namespace object
52
+ /******/ // mode & 1: value is a module id, require it
53
+ /******/ // mode & 2: merge all properties of value into the ns
54
+ /******/ // mode & 4: return value when already ns object
55
+ /******/ // mode & 8|1: behave like require
56
+ /******/ __webpack_require__.t = function(value, mode) {
57
+ /******/ if(mode & 1) value = __webpack_require__(value);
58
+ /******/ if(mode & 8) return value;
59
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60
+ /******/ var ns = Object.create(null);
61
+ /******/ __webpack_require__.r(ns);
62
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64
+ /******/ return ns;
65
+ /******/ };
66
+ /******/
67
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
68
+ /******/ __webpack_require__.n = function(module) {
69
+ /******/ var getter = module && module.__esModule ?
70
+ /******/ function getDefault() { return module['default']; } :
71
+ /******/ function getModuleExports() { return module; };
72
+ /******/ __webpack_require__.d(getter, 'a', getter);
73
+ /******/ return getter;
74
+ /******/ };
75
+ /******/
76
+ /******/ // Object.prototype.hasOwnProperty.call
77
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
78
+ /******/
79
+ /******/ // __webpack_public_path__
80
+ /******/ __webpack_require__.p = "";
81
+ /******/
82
+ /******/
83
+ /******/ // Load entry module and return exports
84
+ /******/ return __webpack_require__(__webpack_require__.s = "./src/index.js");
85
+ /******/ })
86
+ /************************************************************************/
87
+ /******/ ({
88
+
89
+ /***/ "./src/index.js":
90
+ /*!**********************!*\
91
+ !*** ./src/index.js ***!
92
+ \**********************/
93
+ /*! no static exports found */
94
+ /***/ (function(module, exports) {
95
+
96
+ eval("var _wp$blocks = wp.blocks,\n registerBlockType = _wp$blocks.registerBlockType,\n createBlock = _wp$blocks.createBlock;\nvar Fragment = wp.element.Fragment;\nvar _wp$components = wp.components,\n TextControl = _wp$components.TextControl,\n SelectControl = _wp$components.SelectControl;\nvar _wp$editor = wp.editor,\n InspectorControls = _wp$editor.InspectorControls,\n PlainText = _wp$editor.PlainText,\n RichText = _wp$editor.RichText,\n InnerBlocks = _wp$editor.InnerBlocks;\nvar snippets = window.winp_snippets.data,\n firstSnippet = snippets[Object.keys(snippets)[0]] || '',\n __ = wp.i18n.__;\nregisterBlockType('wp-plugin-insert-php/winp-snippet', {\n title: __('Woody snippets'),\n description: __('Executes PHP code, uses conditional logic to insert ads, text, media content and external service’s code. Ensures no content duplication.'),\n //icon: 'format-aside',\n icon: React.createElement(\"svg\", {\n width: \"25\",\n height: \"25\",\n viewBox: \"0 0 254 254\",\n shapeRendering: \"geometricPrecision\",\n textRendering: \"geometricPrecision\",\n imageRendering: \"optimizeQuality\",\n fillRule: \"evenodd\",\n clipRule: \"evenodd\"\n }, React.createElement(\"path\", {\n d: \"M76 187l44 48 45-49c1-1-12 5-22 5-10-1-23-15-23-15s-3 9-19 13c-11 4-25-2-25-2z\"\n }), React.createElement(\"ellipse\", {\n cx: 99,\n cy: 134,\n rx: 11,\n ry: 12\n }), React.createElement(\"ellipse\", {\n cx: 143,\n cy: 135,\n rx: 11,\n ry: 12\n }), React.createElement(\"path\", {\n d: \"M103 103s-10-12-4-35c6-22 16-29 23-33 8-5-5 16-4 20 2 3 14-25 39-27 25-1 41 21 41 21l-13-1s13 5 18 11 11 15 10 18-5 1-5 1 19 13 20 24c1 10-11-10-39-14-29-4-50 14-45 8s17-16 29-17 27 3 27 3-21-12-19-16c2-5 16-2 16-2s-9-8-20-9c-10-2-19 3-18-1 1-5 10-13 15-12 6 1-12-6-24-2-11 5-19 11-26 25s-9 22-13 20c-3-1-4-17-4-17l-4 35zm-60 35l16-21s3-8-1-12c-5-3-9-1-9-1l-22 28s-3 3-2 6c0 2 2 5 2 5l21 28s7 3 10-2c4-5 2-9 2-9l-17-22z\"\n }), React.createElement(\"path\", {\n d: \"M199 138l-17-21s-3-8 2-12c4-3 9-1 9-1l23 28s3 3 3 6c0 2-3 5-3 5l-22 28s-7 3-11-2-2-9-2-9l18-22z\"\n })),\n category: 'formatting',\n attributes: {\n id: {\n type: 'int',\n default: ''\n },\n attrs: {\n type: 'array',\n default: firstSnippet.tags || []\n },\n attrValues: {\n type: 'array',\n default: []\n }\n },\n edit: function edit(props) {\n var _props$attributes = props.attributes,\n id = _props$attributes.id,\n attrValues = _props$attributes.attrValues,\n attrs = _props$attributes.attrs;\n var defaultProps = {};\n\n if (id === '') {\n defaultProps['id'] = firstSnippet.id || '';\n }\n\n if (defaultProps !== {}) {\n props.setAttributes(defaultProps);\n }\n\n var options = [],\n snippedIds = Object.keys(snippets),\n s = 0;\n\n for (; s < snippedIds.length; s++) {\n var currentSnippedId = snippedIds[s];\n options.push({\n label: snippets[currentSnippedId].title,\n value: currentSnippedId\n });\n }\n\n function onSnippetChange(id) {\n props.setAttributes({\n id: id,\n attrs: snippets[id].tags\n });\n }\n\n function onAttributeChange(name, value) {\n var outcome = [];\n\n for (var i = 0; i < attrs.length; i++) {\n if (attrs[i] === name) {\n outcome[i] = value;\n } else {\n if (attrValues.hasOwnProperty(i)) {\n outcome[i] = attrValues[i];\n } else {\n outcome[i] = '';\n }\n }\n }\n\n props.setAttributes({\n attrValues: outcome\n });\n }\n\n function prepareTags() {\n var tags = [];\n\n if (attrs) {\n var _loop = function _loop(i) {\n var name = attrs[i];\n tags.push(React.createElement(\"div\", {\n className: \"winp-snippet-gb-content-tag\"\n }, React.createElement(TextControl, {\n label: __('Attribute \"') + attrs[i] + '\":',\n className: \"winp-snippet-gb-tag\",\n value: attrValues[i] || '',\n name: name,\n placeholder: __('Attribute value (variable $' + attrs[i] + ')'),\n onChange: function onChange(value) {\n return onAttributeChange(name, value);\n }\n })));\n };\n\n for (var i = 0; i < attrs.length; i++) {\n _loop(i);\n }\n }\n\n return tags;\n }\n\n return [React.createElement(\"div\", {\n className: \"winp-snippet-gb-container\"\n }, React.createElement(\"div\", {\n className: \"winp-snippet-gb-dropdown\"\n }, React.createElement(SelectControl, {\n label: __('Select snippet shortcode:'),\n value: id,\n options: options,\n onChange: onSnippetChange\n })), React.createElement(\"div\", {\n className: \"winp-snippet-gb-content\"\n }, React.createElement(InnerBlocks, null)), React.createElement(InspectorControls, null, React.createElement(\"div\", {\n id: \"winp-snippet-gb-content-tags\"\n }, prepareTags())))];\n },\n save: function save(props) {\n return React.createElement(\"div\", null, React.createElement(InnerBlocks.Content, null));\n }\n});\n\n//# sourceURL=webpack:///./src/index.js?");
97
+
98
+ /***/ })
99
+
100
+ /******/ });
admin/assets/gutenberg/build/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
admin/assets/gutenberg/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
admin/assets/gutenberg/src/index.js ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const {registerBlockType, createBlock} = wp.blocks;
2
+ const {Fragment} = wp.element;
3
+ const {TextControl, SelectControl} = wp.components;
4
+ const {InspectorControls, PlainText, RichText, InnerBlocks} = wp.editor;
5
+
6
+ const snippets = window.winp_snippets.data,
7
+ firstSnippet = snippets[Object.keys(snippets)[0]] || '',
8
+ __ = wp.i18n.__;
9
+
10
+ registerBlockType('wp-plugin-insert-php/winp-snippet', {
11
+ title: __('Woody snippets'),
12
+ description: __('Executes PHP code, uses conditional logic to insert ads, text, media content and external service’s code. Ensures no content duplication.'),
13
+ //icon: 'format-aside',
14
+ icon: <svg
15
+ width="25"
16
+ height="25"
17
+ viewBox="0 0 254 254"
18
+ shapeRendering="geometricPrecision"
19
+ textRendering="geometricPrecision"
20
+ imageRendering="optimizeQuality"
21
+ fillRule="evenodd"
22
+ clipRule="evenodd">
23
+ <path d="M76 187l44 48 45-49c1-1-12 5-22 5-10-1-23-15-23-15s-3 9-19 13c-11 4-25-2-25-2z"/>
24
+ <ellipse cx={99} cy={134} rx={11} ry={12}/>
25
+ <ellipse cx={143} cy={135} rx={11} ry={12}/>
26
+ <path d="M103 103s-10-12-4-35c6-22 16-29 23-33 8-5-5 16-4 20 2 3 14-25 39-27 25-1 41 21 41 21l-13-1s13 5 18 11 11 15 10 18-5 1-5 1 19 13 20 24c1 10-11-10-39-14-29-4-50 14-45 8s17-16 29-17 27 3 27 3-21-12-19-16c2-5 16-2 16-2s-9-8-20-9c-10-2-19 3-18-1 1-5 10-13 15-12 6 1-12-6-24-2-11 5-19 11-26 25s-9 22-13 20c-3-1-4-17-4-17l-4 35zm-60 35l16-21s3-8-1-12c-5-3-9-1-9-1l-22 28s-3 3-2 6c0 2 2 5 2 5l21 28s7 3 10-2c4-5 2-9 2-9l-17-22z"/>
27
+ <path d="M199 138l-17-21s-3-8 2-12c4-3 9-1 9-1l23 28s3 3 3 6c0 2-3 5-3 5l-22 28s-7 3-11-2-2-9-2-9l18-22z"/>
28
+ </svg>,
29
+ category: 'formatting',
30
+ attributes: {
31
+ id: {
32
+ type: 'int',
33
+ default: ''
34
+ },
35
+ attrs: {
36
+ type: 'array',
37
+ default: firstSnippet.tags || []
38
+ },
39
+ attrValues: {
40
+ type: 'array',
41
+ default: []
42
+ },
43
+ },
44
+ edit(props) {
45
+
46
+ const {id, attrValues, attrs} = props.attributes;
47
+
48
+ let defaultProps = {};
49
+
50
+ if( id === '' ) {
51
+ defaultProps['id'] = firstSnippet.id || '';
52
+ }
53
+
54
+ if( defaultProps !== {} ) {
55
+ props.setAttributes(defaultProps);
56
+ }
57
+
58
+ let options = [],
59
+ snippedIds = Object.keys(snippets),
60
+ s = 0;
61
+
62
+ for( ; s < snippedIds.length; s++ ) {
63
+ let currentSnippedId = snippedIds[s];
64
+ options.push({
65
+ label: snippets[currentSnippedId].title,
66
+ value: currentSnippedId
67
+ })
68
+ }
69
+
70
+ function onSnippetChange(id) {
71
+ props.setAttributes({
72
+ id: id,
73
+ attrs: snippets[id].tags
74
+ });
75
+ }
76
+
77
+ function onAttributeChange(name, value) {
78
+ let outcome = [];
79
+
80
+ for( let i = 0; i < attrs.length; i++ ) {
81
+ if( attrs[i] === name ) {
82
+ outcome[i] = value;
83
+ } else {
84
+ if( attrValues.hasOwnProperty(i) ) {
85
+ outcome[i] = attrValues[i];
86
+ } else {
87
+ outcome[i] = '';
88
+ }
89
+ }
90
+ }
91
+
92
+ props.setAttributes({attrValues: outcome});
93
+ }
94
+
95
+ function prepareTags() {
96
+ let tags = [];
97
+
98
+ if( attrs ) {
99
+ for( let i = 0; i < attrs.length; i++ ) {
100
+ const name = attrs[i];
101
+ tags.push(<div className="winp-snippet-gb-content-tag">
102
+ <TextControl
103
+ label={__('Attribute "') + attrs[i] + '":'}
104
+ className="winp-snippet-gb-tag"
105
+ value={attrValues[i] || ''}
106
+ name={name}
107
+ placeholder={__('Attribute value (variable $' + attrs[i] + ')')}
108
+ onChange={(value) => onAttributeChange(name, value)}
109
+ />
110
+ </div>);
111
+ }
112
+ }
113
+
114
+ return tags;
115
+ }
116
+
117
+ return ([
118
+ <div className="winp-snippet-gb-container">
119
+ <div className="winp-snippet-gb-dropdown">
120
+ <SelectControl
121
+ label={__('Select snippet shortcode:')}
122
+ value={id}
123
+ options={options}
124
+ onChange={onSnippetChange}
125
+ />
126
+ </div>
127
+ <div className="winp-snippet-gb-content">
128
+ <InnerBlocks/>
129
+ </div>
130
+ <InspectorControls>
131
+ <div id="winp-snippet-gb-content-tags">
132
+ {prepareTags()}
133
+ </div>
134
+ </InspectorControls>
135
+ </div>
136
+
137
+ ]);
138
+ },
139
+
140
+ save: function(props) {
141
+ return <div>
142
+ <InnerBlocks.Content/>
143
+ </div>;
144
+ }
145
+ });
admin/assets/gutenberg/src/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
admin/assets/img/18x18.png ADDED
Binary file
admin/assets/img/help.png ADDED
Binary file
admin/assets/img/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
admin/assets/img/menu-icon-4.png ADDED
Binary file
admin/assets/img/rio-banner.png ADDED
Binary file
admin/assets/img/shortcode-icon.png DELETED
Binary file
admin/assets/img/shortcode-icon5.png ADDED
Binary file
admin/assets/img/snippet-cut.png ADDED
Binary file
admin/assets/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
admin/assets/js/code-editor.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function o(s,a,l){function c(e,t){if(!a[e]){if(!s[e]){var i="function"==typeof require&&require;if(!t&&i)return i(e,!0);if(h)return h(e,!0);var r=new Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r}var n=a[e]={exports:{}};s[e][0].call(n.exports,function(t){return c(s[e][1][t]||t)},n,n.exports,o,s,a,l)}return a[e].exports}for(var h="function"==typeof require&&require,t=0;t<l.length;t++)c(l[t]);return c}({1:[function(t,e,i){"use strict";var r,n=(r=t("codemirror/lib/codemirror"))&&r.__esModule?r:{default:r};t("codemirror/mode/php/php"),t("codemirror/addon/edit/matchbrackets"),t("codemirror/addon/edit/closebrackets"),t("codemirror/addon/search/search"),t("codemirror/addon/search/match-highlighter"),t("./php-lint"),window.Woody_CodeMirror=n.default},{"./php-lint":2,"codemirror/addon/edit/closebrackets":4,"codemirror/addon/edit/matchbrackets":5,"codemirror/addon/search/match-highlighter":8,"codemirror/addon/search/search":10,"codemirror/lib/codemirror":12,"codemirror/mode/php/php":17}],2:[function(t,e,i){"use strict";var n=r(t("php-parser")),o=r(t("codemirror/lib/codemirror"));function r(t){return t&&t.__esModule?t:{default:t}}function s(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}t("codemirror/addon/lint/lint");var a=function(){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.code=t,this.annotations=[],this.function_names=new Set,this.class_names=new Set}var t,i,r;return t=e,(i=[{key:"lint",value:function(){var t=new n.default({parser:{suppressErrors:!0},ast:{withPositions:!0}});try{var e=t.parseEval(this.code);if(e.errors&&0<e.errors.length)for(var i=0;i<e.errors.length;i++)this.annotate(e.errors[i].message,e.errors[i].loc);this.visit(e)}catch(t){this.annotate(t.message,t)}}},{key:"visit",value:function(t){if(t.hasOwnProperty("kind")&&this.validate(t),t.hasOwnProperty("children")){var e=!0,i=!1,r=void 0;try{for(var n,o=t.children[Symbol.iterator]();!(e=(n=o.next()).done);e=!0){var s=n.value;this.visit(s)}}catch(t){i=!0,r=t}finally{try{e||null==o.return||o.return()}finally{if(i)throw r}}}}},{key:"validate",value:function(t){"function"!==t.kind&&"class"!==t.kind||!t.hasOwnProperty("name")||"identifier"!==t.name.kind||("function"===t.kind?this.function_names.has(t.name.name)?this.annotate("Cannot redeclare function ".concat(t.name.name,"()"),t.name.loc):this.function_names.add(t.name.name):"class"===t.kind&&(this.class_names.has(t.name.name)?this.annotate("Cannot redeclare class ".concat(t.name.name),t.name.loc):this.class_names.add(t.name.name)))}},{key:"annotate",value:function(t,e,i){var r,n;e.lineNumber&&e.columnNumber?(r=o.default.Pos(e.lineNumber-1,e.columnNumber-1),n=o.default.Pos(e.lineNumber-1,e.columnNumber)):e.start&&e.end&&(e.end.offset<e.start.offset?(n=o.default.Pos(e.start.line-1,e.start.column),r=o.default.Pos(e.end.line-1,e.end.column)):(r=o.default.Pos(e.start.line-1,e.start.column),n=o.default.Pos(e.end.line-1,e.end.column))),r&&n&&(i=i||"error",this.annotations.push({message:t,severity:i,from:r,to:n}))}}])&&s(t.prototype,i),r&&s(t,r),e}();o.default.registerHelper("lint","php",function(t,e){var i=new a(t);return i.lint(),i.annotations})},{"codemirror/addon/lint/lint":6,"codemirror/lib/codemirror":12,"php-parser":19}],3:[function(t,e,i){var r;r=function(u){function f(t,e,i){var r,n=t.getWrapperElement();return(r=n.appendChild(document.createElement("div"))).className=i?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top","string"==typeof e?r.innerHTML=e:r.appendChild(e),u.addClass(n,"dialog-opened"),r}function d(t,e){t.state.currentNotificationClose&&t.state.currentNotificationClose(),t.state.currentNotificationClose=e}u.defineExtension("openDialog",function(t,e,i){i||(i={}),d(this,null);var r=f(this,t,i.bottom),n=!1,o=this;function s(t){if("string"==typeof t)l.value=t;else{if(n)return;n=!0,u.rmClass(r.parentNode,"dialog-opened"),r.parentNode.removeChild(r),o.focus(),i.onClose&&i.onClose(r)}}var a,l=r.getElementsByTagName("input")[0];return l?(l.focus(),i.value&&(l.value=i.value,!1!==i.selectValueOnOpen&&l.select()),i.onInput&&u.on(l,"input",function(t){i.onInput(t,l.value,s)}),i.onKeyUp&&u.on(l,"keyup",function(t){i.onKeyUp(t,l.value,s)}),u.on(l,"keydown",function(t){i&&i.onKeyDown&&i.onKeyDown(t,l.value,s)||((27==t.keyCode||!1!==i.closeOnEnter&&13==t.keyCode)&&(l.blur(),u.e_stop(t),s()),13==t.keyCode&&e(l.value,t))}),!1!==i.closeOnBlur&&u.on(l,"blur",s)):(a=r.getElementsByTagName("button")[0])&&(u.on(a,"click",function(){s(),o.focus()}),!1!==i.closeOnBlur&&u.on(a,"blur",s),a.focus()),s}),u.defineExtension("openConfirm",function(t,e,i){d(this,null);var r=f(this,t,i&&i.bottom),n=r.getElementsByTagName("button"),o=!1,s=this,a=1;function l(){o||(o=!0,u.rmClass(r.parentNode,"dialog-opened"),r.parentNode.removeChild(r),s.focus())}n[0].focus();for(var c=0;c<n.length;++c){var h=n[c];!function(e){u.on(h,"click",function(t){u.e_preventDefault(t),l(),e&&e(s)})}(e[c]),u.on(h,"blur",function(){--a,setTimeout(function(){a<=0&&l()},200)}),u.on(h,"focus",function(){++a})}}),u.defineExtension("openNotification",function(t,e){d(this,s);var i,r=f(this,t,e&&e.bottom),n=!1,o=e&&void 0!==e.duration?e.duration:5e3;function s(){n||(n=!0,clearTimeout(i),u.rmClass(r.parentNode,"dialog-opened"),r.parentNode.removeChild(r))}return u.on(r,"click",function(t){u.e_preventDefault(t),s()}),o&&(i=setTimeout(s,o)),s})},"object"==typeof i&&"object"==typeof e?r(t("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":12}],4:[function(t,e,i){var r;r=function(T){var i={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},k=T.Pos;function b(t,e){return"pairs"==e&&"string"==typeof t?t:"object"==typeof t&&null!=t[e]?t[e]:i[e]}T.defineOption("autoCloseBrackets",!1,function(t,e,i){i&&i!=T.Init&&(t.removeKeyMap(n),t.state.closeBrackets=null),e&&(r(b(e,"pairs")),t.state.closeBrackets=e,t.addKeyMap(n))});var n={Backspace:function(t){var e=w(t);if(!e||t.getOption("disableInput"))return T.Pass;for(var i=b(e,"pairs"),r=t.listSelections(),n=0;n<r.length;n++){if(!r[n].empty())return T.Pass;var o=a(t,r[n].head);if(!o||i.indexOf(o)%2!=0)return T.Pass}for(var n=r.length-1;0<=n;n--){var s=r[n].head;t.replaceRange("",k(s.line,s.ch-1),k(s.line,s.ch+1),"+delete")}},Enter:function(r){var t=w(r),e=t&&b(t,"explode");if(!e||r.getOption("disableInput"))return T.Pass;for(var n=r.listSelections(),i=0;i<n.length;i++){if(!n[i].empty())return T.Pass;var o=a(r,n[i].head);if(!o||e.indexOf(o)%2!=0)return T.Pass}r.operation(function(){var t=r.lineSeparator()||"\n";r.replaceSelection(t+t,null),r.execCommand("goCharLeft"),n=r.listSelections();for(var e=0;e<n.length;e++){var i=n[e].head.line;r.indentLine(i,null,!0),r.indentLine(i+1,null,!0)}})}};function r(t){for(var e=0;e<t.length;e++){var i=t.charAt(e),r="'"+i+"'";n[r]||(n[r]=o(i))}}function o(e){return function(t){return function(n,t){var e=w(n);if(!e||n.getOption("disableInput"))return T.Pass;var i=b(e,"pairs"),r=i.indexOf(t);if(-1==r)return T.Pass;for(var o,s=b(e,"triples"),a=i.charAt(r+1)==t,l=n.listSelections(),c=r%2==0,h=0;h<l.length;h++){var u,f=l[h],d=f.head,p=n.getRange(d,k(d.line,d.ch+1));if(c&&!f.empty())u="surround";else if(!a&&c||p!=t)if(a&&1<d.ch&&0<=s.indexOf(t)&&n.getRange(k(d.line,d.ch-2),d)==t+t){if(2<d.ch&&/\bstring/.test(n.getTokenTypeAt(k(d.line,d.ch-2))))return T.Pass;u="addFour"}else if(a){var m=0==d.ch?" ":n.getRange(k(d.line,d.ch-1),d);if(T.isWordChar(p)||m==t||T.isWordChar(m))return T.Pass;u="both"}else{if(!c)return T.Pass;u="both"}else u=!a||(_=d,void 0,v=(g=n).getTokenAt(k(_.line,_.ch+1)),!/\bstring/.test(v.type)||v.start!=_.ch||0!=_.ch&&/\bstring/.test(g.getTokenTypeAt(_)))?0<=s.indexOf(t)&&n.getRange(d,k(d.line,d.ch+3))==t+t+t?"skipThree":"skip":"both";if(o){if(o!=u)return T.Pass}else o=u}var g,_,v;var y=r%2?i.charAt(r-1):t,x=r%2?t:i.charAt(r+1);n.operation(function(){if("skip"==o)n.execCommand("goCharRight");else if("skipThree"==o)for(var t=0;t<3;t++)n.execCommand("goCharRight");else if("surround"==o){for(var e=n.getSelections(),t=0;t<e.length;t++)e[t]=y+e[t]+x;n.replaceSelections(e,"around"),e=n.listSelections().slice();for(var t=0;t<e.length;t++)e[t]=(i=e[t],void 0,r=0<T.cmpPos(i.anchor,i.head),{anchor:new k(i.anchor.line,i.anchor.ch+(r?-1:1)),head:new k(i.head.line,i.head.ch+(r?1:-1))});n.setSelections(e)}else"both"==o?(n.replaceSelection(y+x,null),n.triggerElectric(y+x),n.execCommand("goCharLeft")):"addFour"==o&&(n.replaceSelection(y+y+y+y,"before"),n.execCommand("goCharRight"));var i,r})}(t,e)}}function w(t){var e=t.state.closeBrackets;return!e||e.override?e:t.getModeAt(t.getCursor()).closeBrackets||e}function a(t,e){var i=t.getRange(k(e.line,e.ch-1),k(e.line,e.ch+1));return 2==i.length?i:null}r(i.pairs+"`")},"object"==typeof i&&"object"==typeof e?r(t("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":12}],5:[function(t,e,i){var r;r=function(r){var h=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),m=r.Pos,g={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"};function u(t,e,i){var r=t.getLineHandle(e.line),n=e.ch-1,o=i&&i.afterCursor;null==o&&(o=/(^| )cm-fat-cursor($| )/.test(t.getWrapperElement().className));var s=!o&&0<=n&&g[r.text.charAt(n)]||g[r.text.charAt(++n)];if(!s)return null;var a=">"==s.charAt(1)?1:-1;if(i&&i.strict&&0<a!=(n==e.ch))return null;var l=t.getTokenTypeAt(m(e.line,n+1)),c=f(t,m(e.line,n+(0<a?1:0)),a,l||null,i);return null==c?null:{from:m(e.line,n),to:c&&c.pos,match:c&&c.ch==s.charAt(0),forward:0<a}}function f(t,e,i,r,n){for(var o=n&&n.maxScanLineLength||1e4,s=n&&n.maxScanLines||1e3,a=[],l=n&&n.bracketRegex?n.bracketRegex:/[(){}[\]]/,c=0<i?Math.min(e.line+s,t.lastLine()+1):Math.max(t.firstLine()-1,e.line-s),h=e.line;h!=c;h+=i){var u=t.getLine(h);if(u){var f=0<i?0:u.length-1,d=0<i?u.length:-1;if(!(u.length>o))for(h==e.line&&(f=e.ch-(i<0?1:0));f!=d;f+=i){var p=u.charAt(f);if(l.test(p)&&(void 0===r||t.getTokenTypeAt(m(h,f+1))==r))if(">"==g[p].charAt(1)==0<i)a.push(p);else{if(!a.length)return{pos:m(h,f),ch:p};a.pop()}}}}return h-i!=(0<i?t.lastLine():t.firstLine())&&null}function e(t,e,i){for(var r=t.state.matchBrackets.maxHighlightLineLength||1e3,n=[],o=t.listSelections(),s=0;s<o.length;s++){var a=o[s].empty()&&u(t,o[s].head,i);if(a&&t.getLine(a.from.line).length<=r){var l=a.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";n.push(t.markText(a.from,m(a.from.line,a.from.ch+1),{className:l})),a.to&&t.getLine(a.to.line).length<=r&&n.push(t.markText(a.to,m(a.to.line,a.to.ch+1),{className:l}))}}if(n.length){h&&t.state.focused&&t.focus();var c=function(){t.operation(function(){for(var t=0;t<n.length;t++)n[t].clear()})};if(!e)return c;setTimeout(c,800)}}function n(t){t.operation(function(){t.state.matchBrackets.currentlyHighlighted&&(t.state.matchBrackets.currentlyHighlighted(),t.state.matchBrackets.currentlyHighlighted=null),t.state.matchBrackets.currentlyHighlighted=e(t,!1,t.state.matchBrackets)})}r.defineOption("matchBrackets",!1,function(t,e,i){i&&i!=r.Init&&(t.off("cursorActivity",n),t.state.matchBrackets&&t.state.matchBrackets.currentlyHighlighted&&(t.state.matchBrackets.currentlyHighlighted(),t.state.matchBrackets.currentlyHighlighted=null)),e&&(t.state.matchBrackets="object"==typeof e?e:{},t.on("cursorActivity",n))}),r.defineExtension("matchBrackets",function(){e(this,!0)}),r.defineExtension("findMatchingBracket",function(t,e,i){return(i||"boolean"==typeof e)&&(e=i?(i.strict=e,i):e?{strict:!0}:null),u(this,t,e)}),r.defineExtension("scanForBracket",function(t,e,i,r){return f(this,t,e,i,r)})},"object"==typeof i&&"object"==typeof e?r(t("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":12}],6:[function(t,e,i){var r;r=function(l){"use strict";var p="CodeMirror-lint-markers";function s(t){t.parentNode&&t.parentNode.removeChild(t)}function h(t,e,i){var r=function(t,e){var i=document.createElement("div");function r(t){if(!i.parentNode)return l.off(document,"mousemove",r);i.style.top=Math.max(0,t.clientY-i.offsetHeight-5)+"px",i.style.left=t.clientX+5+"px"}return i.className="CodeMirror-lint-tooltip",i.appendChild(e.cloneNode(!0)),document.body.appendChild(i),l.on(document,"mousemove",r),r(t),null!=i.style.opacity&&(i.style.opacity=1),i}(t,e);function n(){var t;l.off(i,"mouseout",n),r&&((t=r).parentNode&&(null==t.style.opacity&&s(t),t.style.opacity=0,setTimeout(function(){s(t)},600)),r=null)}var o=setInterval(function(){if(r)for(var t=i;;t=t.parentNode){if(t&&11==t.nodeType&&(t=t.host),t==document.body)return;if(!t){n();break}}if(!r)return clearInterval(o)},400);l.on(i,"mouseout",n)}function c(e,t,i){this.marked=[],this.options=t,this.timeout=null,this.hasGutter=i,this.onMouseOver=function(t){!function(t,e){var i=e.target||e.srcElement;if(!/\bCodeMirror-lint-mark-/.test(i.className))return;for(var r=i.getBoundingClientRect(),n=(r.left+r.right)/2,o=(r.top+r.bottom)/2,s=t.findMarksAt(t.coordsChar({left:n,top:o},"client")),a=[],l=0;l<s.length;++l){var c=s[l].__annotation;c&&a.push(c)}a.length&&function(t,e){for(var i=e.target||e.srcElement,r=document.createDocumentFragment(),n=0;n<t.length;n++){var o=t[n];r.appendChild(_(o))}h(e,r,i)}(a,e)}(e,t)},this.waitingFor=0}function m(t){var e=t.state.lint;e.hasGutter&&t.clearGutter(p);for(var i=0;i<e.marked.length;++i)e.marked[i].clear();e.marked.length=0}function g(e,t,i,r){var n=document.createElement("div"),o=n;return n.className="CodeMirror-lint-marker-"+t,i&&((o=n.appendChild(document.createElement("div"))).className="CodeMirror-lint-marker-multiple"),0!=r&&l.on(o,"mouseover",function(t){h(t,e,o)}),n}function _(t){var e=t.severity;e||(e="error");var i=document.createElement("div");return i.className="CodeMirror-lint-message-"+e,void 0!==t.messageHTML?i.innerHTML=t.messageHTML:i.appendChild(document.createTextNode(t.message)),i}function u(e){var t=e.state.lint.options,i=t.options||t,r=t.getAnnotations||e.getHelper(l.Pos(0,0),"lint");if(r)if(t.async||r.async)!function(i,t,e){var r=i.state.lint,n=++r.waitingFor;function o(){n=-1,i.off("change",o)}i.on("change",o),t(i.getValue(),function(t,e){i.off("change",o),r.waitingFor==n&&(e&&t instanceof l&&(t=e),i.operation(function(){a(i,t)}))},e,i)}(e,r,i);else{var n=r(e.getValue(),i,e);if(!n)return;n.then?n.then(function(t){e.operation(function(){a(e,t)})}):e.operation(function(){a(e,n)})}}function a(t,e){m(t);for(var i,r,n=t.state.lint,o=n.options,s=function(t){for(var e=[],i=0;i<t.length;++i){var r=t[i],n=r.from.line;(e[n]||(e[n]=[])).push(r)}return e}(e),a=0;a<s.length;++a){var l=s[a];if(l){for(var c=null,h=n.hasGutter&&document.createDocumentFragment(),u=0;u<l.length;++u){var f=l[u],d=f.severity;d||(d="error"),r=d,c="error"==(i=c)?i:r,o.formatAnnotation&&(f=o.formatAnnotation(f)),n.hasGutter&&h.appendChild(_(f)),f.to&&n.marked.push(t.markText(f.from,f.to,{className:"CodeMirror-lint-mark-"+d,__annotation:f}))}n.hasGutter&&t.setGutterMarker(a,p,g(h,c,1<l.length,n.options.tooltips))}}o.onUpdateLinting&&o.onUpdateLinting(e,s,t)}function f(t){var e=t.state.lint;e&&(clearTimeout(e.timeout),e.timeout=setTimeout(function(){u(t)},e.options.delay||500))}l.defineOption("lint",!1,function(t,e,i){if(i&&i!=l.Init&&(m(t),!1!==t.state.lint.options.lintOnChange&&t.off("change",f),l.off(t.getWrapperElement(),"mouseover",t.state.lint.onMouseOver),clearTimeout(t.state.lint.timeout),delete t.state.lint),e){for(var r=t.getOption("gutters"),n=!1,o=0;o<r.length;++o)r[o]==p&&(n=!0);var s=t.state.lint=new c(t,(a=e)instanceof Function?{getAnnotations:a}:(a&&!0!==a||(a={}),a),n);!1!==s.options.lintOnChange&&t.on("change",f),0!=s.options.tooltips&&"gutter"!=s.options.tooltips&&l.on(t.getWrapperElement(),"mouseover",s.onMouseOver),u(t)}var a}),l.defineExtension("performLint",function(){this.state.lint&&u(this)})},"object"==typeof i&&"object"==typeof e?r(t("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":12}],7:[function(t,e,i){var r;r=function(t){"use strict";function e(t,e){function i(t){clearTimeout(r.doRedraw),r.doRedraw=setTimeout(function(){r.redraw()},t)}this.cm=t,this.options=e,this.buttonHeight=e.scrollButtonHeight||t.getOption("scrollButtonHeight"),this.annotations=[],this.doRedraw=this.doUpdate=null,this.div=t.getWrapperElement().appendChild(document.createElement("div")),this.div.style.cssText="position: absolute; right: 0; top: 0; z-index: 7; pointer-events: none",this.computeScale();var r=this;t.on("refresh",this.resizeHandler=function(){clearTimeout(r.doUpdate),r.doUpdate=setTimeout(function(){r.computeScale()&&i(20)},100)}),t.on("markerAdded",this.resizeHandler),t.on("markerCleared",this.resizeHandler),!1!==e.listenForChanges&&t.on("change",this.changeHandler=function(){i(250)})}t.defineExtension("annotateScrollbar",function(t){return"string"==typeof t&&(t={className:t}),new e(this,t)}),t.defineOption("scrollButtonHeight",0),e.prototype.computeScale=function(){var t=this.cm,e=(t.getWrapperElement().clientHeight-t.display.barHeight-2*this.buttonHeight)/t.getScrollerElement().scrollHeight;if(e!=this.hScale)return this.hScale=e,!0},e.prototype.update=function(t){this.annotations=t,this.redraw()},e.prototype.redraw=function(t){!1!==t&&this.computeScale();var i=this.cm,e=this.hScale,r=document.createDocumentFragment(),n=this.annotations,o=i.getOption("lineWrapping"),s=o&&1.5*i.defaultTextHeight(),a=null,l=null;function c(t,e){return a!=t.line&&(a=t.line,l=i.getLineHandle(a)),l.widgets&&l.widgets.length||o&&l.height>s?i.charCoords(t,"local")[e?"top":"bottom"]:i.heightAtLine(l,"local")+(e?0:l.height)}var h=i.lastLine();if(i.display.barWidth)for(var u,f=0;f<n.length;f++){var d=n[f];if(!(d.to.line>h)){for(var p=u||c(d.from,!0)*e,m=c(d.to,!1)*e;f<n.length-1&&!(n[f+1].to.line>h)&&!(m+.9<(u=c(n[f+1].from,!0)*e));)m=c((d=n[++f]).to,!1)*e;if(m!=p){var g=Math.max(m-p,3),_=r.appendChild(document.createElement("div"));_.style.cssText="position: absolute; right: 0px; width: "+Math.max(i.display.barWidth-1,2)+"px; top: "+(p+this.buttonHeight)+"px; height: "+g+"px",_.className=this.options.className,d.id&&_.setAttribute("annotation-id",d.id)}}}this.div.textContent="",this.div.appendChild(r)},e.prototype.clear=function(){this.cm.off("refresh",this.resizeHandler),this.cm.off("markerAdded",this.resizeHandler),this.cm.off("markerCleared",this.resizeHandler),this.changeHandler&&this.cm.off("change",this.changeHandler),this.div.parentNode.removeChild(this.div)}},"object"==typeof i&&"object"==typeof e?r(t("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":12}],8:[function(t,e,i){var r;r=function(n){"use strict";var i={style:"matchhighlight",minChars:2,delay:100,wordsOnly:!1,annotateScrollbar:!1,showToken:!1,trim:!0};function o(t){for(var e in this.options={},i)this.options[e]=(t&&t.hasOwnProperty(e)?t:i)[e];this.overlay=this.timeout=null,this.matchesonscroll=null,this.active=!1}function s(t){var e=t.state.matchHighlighter;(e.active||t.hasFocus())&&r(t,e)}function a(t){var e=t.state.matchHighlighter;e.active||(e.active=!0,r(t,e))}function r(t,e){clearTimeout(e.timeout),e.timeout=setTimeout(function(){l(t)},e.options.delay)}function h(t,e,i,r){var n,o,s,a=t.state.matchHighlighter;if(t.addOverlay(a.overlay=(n=e,o=i,s=r,{token:function(t){if(t.match(n)&&(!o||(i=o,!((e=t).start&&i.test(e.string.charAt(e.start-1))||e.pos!=e.string.length&&i.test(e.string.charAt(e.pos))))))return s;var e,i;t.next(),t.skipTo(n.charAt(0))||t.skipToEnd()}})),a.options.annotateScrollbar&&t.showMatchesOnScrollbar){var l=i?new RegExp("\\b"+e.replace(/[\\\[.+*?(){|^$]/g,"\\$&")+"\\b"):e;a.matchesonscroll=t.showMatchesOnScrollbar(l,!1,{className:"CodeMirror-selection-highlight-scrollbar"})}}function u(t){var e=t.state.matchHighlighter;e.overlay&&(t.removeOverlay(e.overlay),e.overlay=null,e.matchesonscroll&&(e.matchesonscroll.clear(),e.matchesonscroll=null))}function l(c){c.operation(function(){var t=c.state.matchHighlighter;if(u(c),c.somethingSelected()||!t.options.showToken){var e=c.getCursor("from"),i=c.getCursor("to");if(e.line==i.line&&(!t.options.wordsOnly||function(t,e,i){{if(null===t.getRange(e,i).match(/^\w+$/))return!1;if(0<e.ch){var r={line:e.line,ch:e.ch-1},n=t.getRange(r,e);if(null===n.match(/\W/))return!1}if(i.ch<t.getLine(e.line).length){var r={line:i.line,ch:i.ch+1},n=t.getRange(i,r);if(null===n.match(/\W/))return!1}return!0}}(c,e,i))){var r=c.getRange(e,i);t.options.trim&&(r=r.replace(/^\s+|\s+$/g,"")),r.length>=t.options.minChars&&h(c,r,!1,t.options.style)}}else{for(var n=!0===t.options.showToken?/[\w$]/:t.options.showToken,o=c.getCursor(),s=c.getLine(o.line),a=o.ch,l=a;a&&n.test(s.charAt(a-1));)--a;for(;l<s.length&&n.test(s.charAt(l));)++l;a<l&&h(c,s.slice(a,l),n,t.options.style)}})}n.defineOption("highlightSelectionMatches",!1,function(t,e,i){if(i&&i!=n.Init&&(u(t),clearTimeout(t.state.matchHighlighter.timeout),t.state.matchHighlighter=null,t.off("cursorActivity",s),t.off("focus",a)),e){var r=t.state.matchHighlighter=new o(e);t.hasFocus()?(r.active=!0,l(t)):t.on("focus",a),t.on("cursorActivity",s)}})},"object"==typeof i&&"object"==typeof e?r(t("../../lib/codemirror"),t("./matchesonscrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./matchesonscrollbar"],r):r(CodeMirror)},{"../../lib/codemirror":12,"./matchesonscrollbar":9}],9:[function(t,e,i){var r;r=function(c){"use strict";function r(t,e,i,r){this.cm=t,this.options=r;var n={listenForChanges:!1};for(var o in r)n[o]=r[o];n.className||(n.className="CodeMirror-search-match"),this.annotation=t.annotateScrollbar(n),this.query=e,this.caseFold=i,this.gap={from:t.firstLine(),to:t.lastLine()+1},this.matches=[],this.update=null,this.findMatches(),this.annotation.update(this.matches);var s=this;t.on("change",this.changeHandler=function(t,e){s.onChange(e)})}c.defineExtension("showMatchesOnScrollbar",function(t,e,i){return"string"==typeof i&&(i={className:i}),i||(i={}),new r(this,t,e,i)});function h(t,e,i){return t<=e?t:Math.max(e,t+i)}r.prototype.findMatches=function(){if(this.gap){for(var t=0;t<this.matches.length;t++){if((r=this.matches[t]).from.line>=this.gap.to)break;r.to.line>=this.gap.from&&this.matches.splice(t--,1)}for(var e=this.cm.getSearchCursor(this.query,c.Pos(this.gap.from,0),this.caseFold),i=this.options&&this.options.maxMatches||1e3;e.findNext();){var r;if((r={from:e.from(),to:e.to()}).from.line>=this.gap.to)break;if(this.matches.splice(t++,0,r),this.matches.length>i)break}this.gap=null}},r.prototype.onChange=function(t){var e=t.from.line,i=c.changeEnd(t).line,r=i-t.to.line;if(this.gap?(this.gap.from=Math.min(h(this.gap.from,e,r),t.from.line),this.gap.to=Math.max(h(this.gap.to,e,r),t.from.line)):this.gap={from:t.from.line,to:i+1},r)for(var n=0;n<this.matches.length;n++){var o=this.matches[n],s=h(o.from.line,e,r);s!=o.from.line&&(o.from=c.Pos(s,o.from.ch));var a=h(o.to.line,e,r);a!=o.to.line&&(o.to=c.Pos(a,o.to.ch))}clearTimeout(this.update);var l=this;this.update=setTimeout(function(){l.updateAfterChange()},250)},r.prototype.updateAfterChange=function(){this.findMatches(),this.annotation.update(this.matches)},r.prototype.clear=function(){this.cm.off("change",this.changeHandler),this.annotation.clear()}},"object"==typeof i&&"object"==typeof e?r(t("../../lib/codemirror"),t("./searchcursor"),t("../scroll/annotatescrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../scroll/annotatescrollbar"],r):r(CodeMirror)},{"../../lib/codemirror":12,"../scroll/annotatescrollbar":7,"./searchcursor":11}],10:[function(t,e,i){var r;r=function(d){"use strict";function e(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null}function p(t){return t.state.search||(t.state.search=new e)}function o(t){return"string"==typeof t&&t==t.toLowerCase()}function m(t,e,i){return t.getSearchCursor(e,i,{caseFold:o(e),multiline:!0})}function g(t,e,i,r,n){t.openDialog?t.openDialog(e,n,{value:r,selectValueOnOpen:!0}):n(prompt(i,r))}function r(t){return t.replace(/\\(.)/g,function(t,e){return"n"==e?"\n":"r"==e?"\r":e})}function s(t){var e=t.match(/^\/(.*)\/([a-z]*)$/);if(e)try{t=new RegExp(e[1],-1==e[2].indexOf("i")?"":"i")}catch(t){}else t=r(t);return("string"==typeof t?""==t:t.test(""))&&(t=/x^/),t}function _(t,e,i){var r,n;e.queryText=i,e.query=s(i),t.removeOverlay(e.overlay,o(e.query)),e.overlay=(r=e.query,n=o(e.query),"string"==typeof r?r=new RegExp(r.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),n?"gi":"g"):r.global||(r=new RegExp(r.source,r.ignoreCase?"gi":"g")),{token:function(t){r.lastIndex=t.pos;var e=r.exec(t.string);if(e&&e.index==t.pos)return t.pos+=e[0].length||1,"searching";e?t.pos=e.index:t.skipToEnd()}}),t.addOverlay(e.overlay),t.showMatchesOnScrollbar&&(e.annotate&&(e.annotate.clear(),e.annotate=null),e.annotate=t.showMatchesOnScrollbar(e.query,o(e.query)))}function i(o,e,t,i){var r=p(o);if(r.query)return v(o,e);var n,s,a,l,c,h=o.getSelection()||r.lastQuery;if(h instanceof RegExp&&"x^"==h.source&&(h=null),t&&o.openDialog){var u=null,f=function(t,e){d.e_stop(e),t&&(t!=r.queryText&&(_(o,r,t),r.posFrom=r.posTo=o.getCursor()),u&&(u.style.opacity=1),v(o,e.shiftKey,function(t,e){var i;e.line<3&&document.querySelector&&(i=o.display.wrapper.querySelector(".CodeMirror-dialog"))&&i.getBoundingClientRect().bottom-4>o.cursorCoords(e,"window").top&&((u=i).style.opacity=.4)}))};s=x(n=o),a=h,l=f,c=function(t,e){var i=d.keyName(t),r=o.getOption("extraKeys"),n=r&&r[i]||d.keyMap[o.getOption("keyMap")][i];"findNext"==n||"findPrev"==n||"findPersistentNext"==n||"findPersistentPrev"==n?(d.e_stop(t),_(o,p(o),e),o.execCommand(n)):"find"!=n&&"findPersistent"!=n||(d.e_stop(t),f(e,t))},n.openDialog(s,l,{value:a,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){y(n)},onKeyDown:c}),i&&h&&(_(o,r,h),v(o,e))}else g(o,x(o),"Search for:",h,function(t){t&&!r.query&&o.operation(function(){_(o,r,t),r.posFrom=r.posTo=o.getCursor(),v(o,e)})})}function v(i,r,n){i.operation(function(){var t=p(i),e=m(i,t.query,r?t.posFrom:t.posTo);(e.find(r)||(e=m(i,t.query,r?d.Pos(i.lastLine()):d.Pos(i.firstLine(),0))).find(r))&&(i.setSelection(e.from(),e.to()),i.scrollIntoView({from:e.from(),to:e.to()},20),t.posFrom=e.from(),t.posTo=e.to(),n&&n(e.from(),e.to()))})}function y(e){e.operation(function(){var t=p(e);t.lastQuery=t.query,t.query&&(t.query=t.queryText=null,e.removeOverlay(t.overlay),t.annotate&&(t.annotate.clear(),t.annotate=null))})}function x(t){return'<span class="CodeMirror-search-label">'+t.phrase("Search:")+'</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">'+t.phrase("(Use /re/ syntax for regexp search)")+"</span>"}function T(e,r,n){e.operation(function(){for(var t=m(e,r);t.findNext();)if("string"!=typeof r){var i=e.getRange(t.from(),t.to()).match(r);t.replace(n.replace(/\$(\d)/g,function(t,e){return i[e]}))}else t.replace(n)})}function n(f,t){if(!f.getOption("readOnly")){var e=f.getSelection()||p(f).lastQuery,i='<span class="CodeMirror-search-label">'+(t?f.phrase("Replace all:"):f.phrase("Replace:"))+"</span>";g(f,i+(' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">'+f.phrase("(Use /re/ syntax for regexp search)")+"</span>"),i,e,function(u){u&&(u=s(u),g(f,'<span class="CodeMirror-search-label">'+f.phrase("With:")+'</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/>',f.phrase("Replace with:"),"",function(a){if(a=r(a),t)T(f,u,a);else{y(f);var l=m(f,u,f.getCursor("from")),c=function(){var t,e,i,r,n,o,s=l.from();!(t=l.findNext())&&(l=m(f,u),!(t=l.findNext())||s&&l.from().line==s.line&&l.from().ch==s.ch)||(f.setSelection(l.from(),l.to()),f.scrollIntoView({from:l.from(),to:l.to()}),i='<span class="CodeMirror-search-label">'+(o=e=f).phrase("Replace?")+"</span> <button>"+o.phrase("Yes")+"</button> <button>"+o.phrase("No")+"</button> <button>"+o.phrase("All")+"</button> <button>"+o.phrase("Stop")+"</button> ",r=f.phrase("Replace?"),n=[function(){h(t)},c,function(){T(f,u,a)}],e.openConfirm?e.openConfirm(i,n):confirm(r)&&n[0]())},h=function(i){l.replace("string"==typeof u?a:a.replace(/\$(\d)/g,function(t,e){return i[e]})),c()};c()}}))})}}d.commands.find=function(t){y(t),i(t)},d.commands.findPersistent=function(t){y(t),i(t,!1,!0)},d.commands.findPersistentNext=function(t){i(t,!1,!0,!0)},d.commands.findPersistentPrev=function(t){i(t,!0,!0,!0)},d.commands.findNext=i,d.commands.findPrev=function(t){i(t,!0)},d.commands.clearSearch=y,d.commands.replace=n,d.commands.replaceAll=function(t){n(t,!0)}},"object"==typeof i&&"object"==typeof e?r(t("../../lib/codemirror"),t("./searchcursor"),t("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],r):r(CodeMirror)},{"../../lib/codemirror":12,"../dialog/dialog":3,"./searchcursor":11}],11:[function(t,e,i){var r;r=function(n){"use strict";var _,v,y=n.Pos;function p(t,e){for(var i,r,n=null!=(r=(i=t).flags)?r:(i.ignoreCase?"i":"")+(i.global?"g":"")+(i.multiline?"m":""),o=n,s=0;s<e.length;s++)-1==o.indexOf(e.charAt(s))&&(o+=e.charAt(s));return n==o?t:new RegExp(t.source,o)}function m(t,e,i){e=p(e,"g");for(var r=i.line,n=i.ch,o=t.lastLine();r<=o;r++,n=0){e.lastIndex=n;var s=t.getLine(r),a=e.exec(s);if(a)return{from:y(r,a.index),to:y(r,a.index+a[0].length),match:a}}}function g(t,e){for(var i,r=0;;){e.lastIndex=r;var n=e.exec(t);if(!n)return i;if((r=(i=n).index+(i[0].length||1))==t.length)return i}}function x(t,e,i,r){if(t.length==e.length)return i;for(var n=0,o=i+Math.max(0,t.length-e.length);;){if(n==o)return n;var s=n+o>>1,a=r(t.slice(0,s)).length;if(a==i)return s;i<a?o=s:n=s+1}}function r(i,r,t,e){var n;this.atOccurrence=!1,this.doc=i,t=t?i.clipPos(t):y(0,0),this.pos={from:t,to:t},"object"==typeof e?n=e.caseFold:(n=e,e=null),"string"==typeof r?(null==n&&(n=!1),this.matches=function(t,e){return(t?function(t,e,i,r){if(!e.length)return null;var n=r?_:v,o=n(e).split(/\r|\n\r?/);t:for(var s=i.line,a=i.ch,l=t.firstLine()-1+o.length;l<=s;s--,a=-1){var c=t.getLine(s);-1<a&&(c=c.slice(0,a));var h=n(c);if(1==o.length){var u=h.lastIndexOf(o[0]);if(-1==u)continue t;return{from:y(s,x(c,h,u,n)),to:y(s,x(c,h,u+o[0].length,n))}}var f=o[o.length-1];if(h.slice(0,f.length)==f){var d=1;for(i=s-o.length+1;d<o.length-1;d++)if(n(t.getLine(i+d))!=o[d])continue t;var p=t.getLine(s+1-o.length),m=n(p);if(m.slice(m.length-o[0].length)==o[0])return{from:y(s+1-o.length,x(p,m,p.length-o[0].length,n)),to:y(s,x(c,h,f.length,n))}}}}:function(t,e,i,r){if(!e.length)return null;var n=r?_:v,o=n(e).split(/\r|\n\r?/);t:for(var s=i.line,a=i.ch,l=t.lastLine()+1-o.length;s<=l;s++,a=0){var c=t.getLine(s).slice(a),h=n(c);if(1==o.length){var u=h.indexOf(o[0]);if(-1==u)continue t;return i=x(c,h,u,n)+a,{from:y(s,x(c,h,u,n)+a),to:y(s,x(c,h,u+o[0].length,n)+a)}}var f=h.length-o[0].length;if(h.slice(f)==o[0]){for(var d=1;d<o.length-1;d++)if(n(t.getLine(s+d))!=o[d])continue t;var p=t.getLine(s+o.length-1),m=n(p),g=o[o.length-1];if(m.slice(0,g.length)==g)return{from:y(s,x(c,h,f,n)+a),to:y(s+o.length-1,x(p,m,g.length,n))}}}})(i,r,e,n)}):(r=p(r,"gm"),e&&!1===e.multiline?this.matches=function(t,e){return(t?function(t,e,i){e=p(e,"g");for(var r=i.line,n=i.ch,o=t.firstLine();o<=r;r--,n=-1){var s=t.getLine(r);-1<n&&(s=s.slice(0,n));var a=g(s,e);if(a)return{from:y(r,a.index),to:y(r,a.index+a[0].length),match:a}}}:m)(i,r,e)}:this.matches=function(t,e){return(t?function(t,e,i){e=p(e,"gm");for(var r,n=1,o=i.line,s=t.firstLine();s<=o;){for(var a=0;a<n;a++){var l=t.getLine(o--);r=null==r?l.slice(0,i.ch):l+"\n"+r}n*=2;var c=g(r,e);if(c){var h=r.slice(0,c.index).split("\n"),u=c[0].split("\n"),f=o+h.length,d=h[h.length-1].length;return{from:y(f,d),to:y(f+u.length-1,1==u.length?d+u[0].length:u[u.length-1].length),match:c}}}}:function(t,e,i){if(!/\\s|\\n|\n|\\W|\\D|\[\^/.test(e.source))return m(t,e,i);e=p(e,"gm");for(var r,n=1,o=i.line,s=t.lastLine();o<=s;){for(var a=0;a<n&&!(s<o);a++){var l=t.getLine(o++);r=null==r?l:r+"\n"+l}n*=2,e.lastIndex=i.ch;var c=e.exec(r);if(c){var h=r.slice(0,c.index).split("\n"),u=c[0].split("\n"),f=i.line+h.length-1,d=h[h.length-1].length;return{from:y(f,d),to:y(f+u.length-1,1==u.length?d+u[0].length:u[u.length-1].length),match:c}}}})(i,r,e)})}v=String.prototype.normalize?(_=function(t){return t.normalize("NFD").toLowerCase()},function(t){return t.normalize("NFD")}):(_=function(t){return t.toLowerCase()},function(t){return t}),r.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(t){for(var e=this.matches(t,this.doc.clipPos(t?this.pos.from:this.pos.to));e&&0==n.cmpPos(e.from,e.to);)t?e.from.ch?e.from=y(e.from.line,e.from.ch-1):e=e.from.line==this.doc.firstLine()?null:this.matches(t,this.doc.clipPos(y(e.from.line-1))):e.to.ch<this.doc.getLine(e.to.line).length?e.to=y(e.to.line,e.to.ch+1):e=e.to.line==this.doc.lastLine()?null:this.matches(t,y(e.to.line+1,0));if(e)return this.pos=e,this.atOccurrence=!0,this.pos.match||!0;var i=y(t?this.doc.firstLine():this.doc.lastLine()+1,0);return this.pos={from:i,to:i},this.atOccurrence=!1},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(t,e){if(this.atOccurrence){var i=n.splitLines(t);this.doc.replaceRange(i,this.pos.from,this.pos.to,e),this.pos.to=y(this.pos.from.line+i.length-1,i[i.length-1].length+(1==i.length?this.pos.from.ch:0))}}},n.defineExtension("getSearchCursor",function(t,e,i){return new r(this.doc,t,e,i)}),n.defineDocExtension("getSearchCursor",function(t,e,i){return new r(this,t,e,i)}),n.defineExtension("selectMatches",function(t,e){for(var i=[],r=this.getSearchCursor(t,this.getCursor("from"),e);r.findNext()&&!(0<n.cmpPos(r.to(),this.getCursor("to")));)i.push({anchor:r.from(),head:r.to()});i.length&&this.setSelections(i,0)})},"object"==typeof i&&"object"==typeof e?r(t("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":12}],12:[function(t,e,i){var r,n;r=this,n=function(){"use strict";var t=navigator.userAgent,e=navigator.platform,m=/gecko\/\d/i.test(t),i=/MSIE \d/.test(t),r=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(t),n=/Edge\/(\d+)/.exec(t),T=i||r||n,k=T&&(i?document.documentMode||6:+(n||r)[1]),y=!n&&/WebKit\//.test(t),o=y&&/Qt\/\d+\.\d+/.test(t),s=!n&&/Chrome\//.test(t),g=/Opera\//.test(t),l=/Apple Computer/.test(navigator.vendor),a=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(t),c=/PhantomJS/.test(t),h=!n&&/AppleWebKit/.test(t)&&/Mobile\/\w+/.test(t),u=/Android/.test(t),f=h||u||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(t),x=h||/Mac/.test(e),d=/\bCrOS\b/.test(t),p=/win/i.test(e),_=g&&t.match(/Version\/(\d*\.\d*)/);_&&(_=Number(_[1])),_&&15<=_&&(y=!(g=!1));var v=x&&(o||g&&(null==_||_<12.11)),b=m||T&&9<=k;function w(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}var E,C=function(t,e){var i=t.className,r=w(e).exec(i);if(r){var n=i.slice(r.index+r[0].length);t.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function S(t){for(var e=t.childNodes.length;0<e;--e)t.removeChild(t.firstChild);return t}function A(t,e){return S(t).appendChild(e)}function N(t,e,i,r){var n=document.createElement(t);if(i&&(n.className=i),r&&(n.style.cssText=r),"string"==typeof e)n.appendChild(document.createTextNode(e));else if(e)for(var o=0;o<e.length;++o)n.appendChild(e[o]);return n}function L(t,e,i,r){var n=N(t,e,i,r);return n.setAttribute("role","presentation"),n}function O(t,e){if(3==e.nodeType&&(e=e.parentNode),t.contains)return t.contains(e);do{if(11==e.nodeType&&(e=e.host),e==t)return!0}while(e=e.parentNode)}function I(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function R(t,e){var i=t.className;w(e).test(i)||(t.className+=(i?" ":"")+e)}function M(t,e){for(var i=t.split(" "),r=0;r<i.length;r++)i[r]&&!w(i[r]).test(e)&&(e+=" "+i[r]);return e}E=document.createRange?function(t,e,i,r){var n=document.createRange();return n.setEnd(r||t,i),n.setStart(t,e),n}:function(t,e,i){var r=document.body.createTextRange();try{r.moveToElementText(t.parentNode)}catch(t){return r}return r.collapse(!0),r.moveEnd("character",i),r.moveStart("character",e),r};var D=function(t){t.select()};function P(t){var e=Array.prototype.slice.call(arguments,1);return function(){return t.apply(null,e)}}function B(t,e,i){for(var r in e||(e={}),t)!t.hasOwnProperty(r)||!1===i&&e.hasOwnProperty(r)||(e[r]=t[r]);return e}function F(t,e,i,r,n){null==e&&-1==(e=t.search(/[^\s\u00a0]/))&&(e=t.length);for(var o=r||0,s=n||0;;){var a=t.indexOf("\t",o);if(a<0||e<=a)return s+(e-o);s+=a-o,s+=i-s%i,o=a+1}}h?D=function(t){t.selectionStart=0,t.selectionEnd=t.value.length}:T&&(D=function(t){try{t.select()}catch(t){}});var U=function(){this.id=null};function H(t,e){for(var i=0;i<t.length;++i)if(t[i]==e)return i;return-1}U.prototype.set=function(t,e){clearTimeout(this.id),this.id=setTimeout(e,t)};var W=30,z={toString:function(){return"CodeMirror.Pass"}},q={scroll:!1},G={origin:"*mouse"},j={origin:"+move"};function V(t,e,i){for(var r=0,n=0;;){var o=t.indexOf("\t",r);-1==o&&(o=t.length);var s=o-r;if(o==t.length||e<=n+s)return r+Math.min(s,e-n);if(n+=o-r,r=o+1,e<=(n+=i-n%i))return r}}var Y=[""];function K(t){for(;Y.length<=t;)Y.push($(Y)+" ");return Y[t]}function $(t){return t[t.length-1]}function Q(t,e){for(var i=[],r=0;r<t.length;r++)i[r]=e(t[r],r);return i}function X(){}function Z(t,e){var i;return i=Object.create?Object.create(t):(X.prototype=t,new X),e&&B(e,i),i}var J=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function tt(t){return/\w/.test(t)||"€"<t&&(t.toUpperCase()!=t.toLowerCase()||J.test(t))}function et(t,e){return e?!!(-1<e.source.indexOf("\\w")&&tt(t))||e.test(t):tt(t)}function it(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}var rt=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function nt(t){return 768<=t.charCodeAt(0)&&rt.test(t)}function ot(t,e,i){for(;(i<0?0<e:e<t.length)&&nt(t.charAt(e));)e+=i;return e}function st(t,e,i){for(var r=i<e?-1:1;;){if(e==i)return e;var n=(e+i)/2,o=r<0?Math.ceil(n):Math.floor(n);if(o==e)return t(o)?e:i;t(o)?i=o:e=o+r}}function at(t,e,i){var r=this;this.input=i,r.scrollbarFiller=N("div",null,"CodeMirror-scrollbar-filler"),r.scrollbarFiller.setAttribute("cm-not-content","true"),r.gutterFiller=N("div",null,"CodeMirror-gutter-filler"),r.gutterFiller.setAttribute("cm-not-content","true"),r.lineDiv=L("div",null,"CodeMirror-code"),r.selectionDiv=N("div",null,null,"position: relative; z-index: 1"),r.cursorDiv=N("div",null,"CodeMirror-cursors"),r.measure=N("div",null,"CodeMirror-measure"),r.lineMeasure=N("div",null,"CodeMirror-measure"),r.lineSpace=L("div",[r.measure,r.lineMeasure,r.selectionDiv,r.cursorDiv,r.lineDiv],null,"position: relative; outline: none");var n=L("div",[r.lineSpace],"CodeMirror-lines");r.mover=N("div",[n],null,"position: relative"),r.sizer=N("div",[r.mover],"CodeMirror-sizer"),r.sizerWidth=null,r.heightForcer=N("div",null,null,"position: absolute; height: "+W+"px; width: 1px;"),r.gutters=N("div",null,"CodeMirror-gutters"),r.lineGutter=null,r.scroller=N("div",[r.sizer,r.heightForcer,r.gutters],"CodeMirror-scroll"),r.scroller.setAttribute("tabIndex","-1"),r.wrapper=N("div",[r.scrollbarFiller,r.gutterFiller,r.scroller],"CodeMirror"),T&&k<8&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),y||m&&f||(r.scroller.draggable=!0),t&&(t.appendChild?t.appendChild(r.wrapper):t(r.wrapper)),r.viewFrom=r.viewTo=e.first,r.reportedViewFrom=r.reportedViewTo=e.first,r.view=[],r.renderedView=null,r.externalMeasured=null,r.viewOffset=0,r.lastWrapHeight=r.lastWrapWidth=0,r.updateLineNumbers=null,r.nativeBarWidth=r.barHeight=r.barWidth=0,r.scrollbarsClipped=!1,r.lineNumWidth=r.lineNumInnerWidth=r.lineNumChars=null,r.alignWidgets=!1,r.cachedCharWidth=r.cachedTextHeight=r.cachedPaddingH=null,r.maxLine=null,r.maxLineLength=0,r.maxLineChanged=!1,r.wheelDX=r.wheelDY=r.wheelStartX=r.wheelStartY=null,r.shift=!1,r.selForContextMenu=null,r.activeTouch=null,i.init(r)}function lt(t,e){if((e-=t.first)<0||e>=t.size)throw new Error("There is no line "+(e+t.first)+" in the document.");for(var i=t;!i.lines;)for(var r=0;;++r){var n=i.children[r],o=n.chunkSize();if(e<o){i=n;break}e-=o}return i.lines[e]}function ct(t,i,r){var n=[],o=i.line;return t.iter(i.line,r.line+1,function(t){var e=t.text;o==r.line&&(e=e.slice(0,r.ch)),o==i.line&&(e=e.slice(i.ch)),n.push(e),++o}),n}function ht(t,e,i){var r=[];return t.iter(e,i,function(t){r.push(t.text)}),r}function ut(t,e){var i=e-t.height;if(i)for(var r=t;r;r=r.parent)r.height+=i}function ft(t){if(null==t.parent)return null;for(var e=t.parent,i=H(e.lines,t),r=e.parent;r;r=(e=r).parent)for(var n=0;r.children[n]!=e;++n)i+=r.children[n].chunkSize();return i+e.first}function dt(t,e){var i=t.first;t:do{for(var r=0;r<t.children.length;++r){var n=t.children[r],o=n.height;if(e<o){t=n;continue t}e-=o,i+=n.chunkSize()}return i}while(!t.lines);for(var s=0;s<t.lines.length;++s){var a=t.lines[s].height;if(e<a)break;e-=a}return i+s}function pt(t,e){return e>=t.first&&e<t.first+t.size}function mt(t,e){return String(t.lineNumberFormatter(e+t.firstLineNumber))}function gt(t,e,i){if(void 0===i&&(i=null),!(this instanceof gt))return new gt(t,e,i);this.line=t,this.ch=e,this.sticky=i}function _t(t,e){return t.line-e.line||t.ch-e.ch}function vt(t,e){return t.sticky==e.sticky&&0==_t(t,e)}function yt(t){return gt(t.line,t.ch)}function xt(t,e){return _t(t,e)<0?e:t}function Tt(t,e){return _t(t,e)<0?t:e}function kt(t,e){return Math.max(t.first,Math.min(e,t.first+t.size-1))}function bt(t,e){if(e.line<t.first)return gt(t.first,0);var i,r,n,o=t.first+t.size-1;return e.line>o?gt(o,lt(t,o).text.length):(r=lt(t,(i=e).line).text.length,null==(n=i.ch)||r<n?gt(i.line,r):n<0?gt(i.line,0):i)}function wt(t,e){for(var i=[],r=0;r<e.length;r++)i[r]=bt(t,e[r]);return i}var Et=!1,Ct=!1;function St(t,e,i){this.marker=t,this.from=e,this.to=i}function At(t,e){if(t)for(var i=0;i<t.length;++i){var r=t[i];if(r.marker==e)return r}}function Lt(t,e){for(var i,r=0;r<t.length;++r)t[r]!=e&&(i||(i=[])).push(t[r]);return i}function Nt(t,e){if(e.full)return null;var i=pt(t,e.from.line)&&lt(t,e.from.line).markedSpans,r=pt(t,e.to.line)&&lt(t,e.to.line).markedSpans;if(!i&&!r)return null;var n=e.from.ch,o=e.to.ch,s=0==_t(e.from,e.to),a=function(t,e,i){var r;if(t)for(var n=0;n<t.length;++n){var o=t[n],s=o.marker;if(null==o.from||(s.inclusiveLeft?o.from<=e:o.from<e)||o.from==e&&"bookmark"==s.type&&(!i||!o.marker.insertLeft)){var a=null==o.to||(s.inclusiveRight?o.to>=e:o.to>e);(r||(r=[])).push(new St(s,o.from,a?null:o.to))}}return r}(i,n,s),l=function(t,e,i){var r;if(t)for(var n=0;n<t.length;++n){var o=t[n],s=o.marker;if(null==o.to||(s.inclusiveRight?o.to>=e:o.to>e)||o.from==e&&"bookmark"==s.type&&(!i||o.marker.insertLeft)){var a=null==o.from||(s.inclusiveLeft?o.from<=e:o.from<e);(r||(r=[])).push(new St(s,a?null:o.from-e,null==o.to?null:o.to-e))}}return r}(r,o,s),c=1==e.text.length,h=$(e.text).length+(c?n:0);if(a)for(var u=0;u<a.length;++u){var f=a[u];if(null==f.to){var d=At(l,f.marker);d?c&&(f.to=null==d.to?null:d.to+h):f.to=n}}if(l)for(var p=0;p<l.length;++p){var m=l[p];if(null!=m.to&&(m.to+=h),null==m.from)At(a,m.marker)||(m.from=h,c&&(a||(a=[])).push(m));else m.from+=h,c&&(a||(a=[])).push(m)}a&&(a=Ot(a)),l&&l!=a&&(l=Ot(l));var g=[a];if(!c){var _,v=e.text.length-2;if(0<v&&a)for(var y=0;y<a.length;++y)null==a[y].to&&(_||(_=[])).push(new St(a[y].marker,null,null));for(var x=0;x<v;++x)g.push(_);g.push(l)}return g}function Ot(t){for(var e=0;e<t.length;++e){var i=t[e];null!=i.from&&i.from==i.to&&!1!==i.marker.clearWhenEmpty&&t.splice(e--,1)}return t.length?t:null}function It(t){var e=t.markedSpans;if(e){for(var i=0;i<e.length;++i)e[i].marker.detachLine(t);t.markedSpans=null}}function Rt(t,e){if(e){for(var i=0;i<e.length;++i)e[i].marker.attachLine(t);t.markedSpans=e}}function Mt(t){return t.inclusiveLeft?-1:0}function Dt(t){return t.inclusiveRight?1:0}function Pt(t,e){var i=t.lines.length-e.lines.length;if(0!=i)return i;var r=t.find(),n=e.find(),o=_t(r.from,n.from)||Mt(t)-Mt(e);if(o)return-o;var s=_t(r.to,n.to)||Dt(t)-Dt(e);return s||e.id-t.id}function Bt(t,e){var i,r=Ct&&t.markedSpans;if(r)for(var n=void 0,o=0;o<r.length;++o)(n=r[o]).marker.collapsed&&null==(e?n.from:n.to)&&(!i||Pt(i,n.marker)<0)&&(i=n.marker);return i}function Ft(t){return Bt(t,!0)}function Ut(t){return Bt(t,!1)}function Ht(t,e){var i,r=Ct&&t.markedSpans;if(r)for(var n=0;n<r.length;++n){var o=r[n];o.marker.collapsed&&(null==o.from||o.from<e)&&(null==o.to||o.to>e)&&(!i||Pt(i,o.marker)<0)&&(i=o.marker)}return i}function Wt(t,e,i,r,n){var o=lt(t,e),s=Ct&&o.markedSpans;if(s)for(var a=0;a<s.length;++a){var l=s[a];if(l.marker.collapsed){var c=l.marker.find(0),h=_t(c.from,i)||Mt(l.marker)-Mt(n),u=_t(c.to,r)||Dt(l.marker)-Dt(n);if(!(0<=h&&u<=0||h<=0&&0<=u)&&(h<=0&&(l.marker.inclusiveRight&&n.inclusiveLeft?0<=_t(c.to,i):0<_t(c.to,i))||0<=h&&(l.marker.inclusiveRight&&n.inclusiveLeft?_t(c.from,r)<=0:_t(c.from,r)<0)))return!0}}}function zt(t){for(var e;e=Ft(t);)t=e.find(-1,!0).line;return t}function qt(t,e){var i=lt(t,e),r=zt(i);return i==r?e:ft(r)}function Gt(t,e){if(e>t.lastLine())return e;var i,r=lt(t,e);if(!jt(t,r))return e;for(;i=Ut(r);)r=i.find(1,!0).line;return ft(r)+1}function jt(t,e){var i=Ct&&e.markedSpans;if(i)for(var r=void 0,n=0;n<i.length;++n)if((r=i[n]).marker.collapsed){if(null==r.from)return!0;if(!r.marker.widgetNode&&0==r.from&&r.marker.inclusiveLeft&&Vt(t,e,r))return!0}}function Vt(t,e,i){if(null==i.to){var r=i.marker.find(1,!0);return Vt(t,r.line,At(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==e.text.length)return!0;for(var n=void 0,o=0;o<e.markedSpans.length;++o)if((n=e.markedSpans[o]).marker.collapsed&&!n.marker.widgetNode&&n.from==i.to&&(null==n.to||n.to!=i.from)&&(n.marker.inclusiveLeft||i.marker.inclusiveRight)&&Vt(t,e,n))return!0}function Yt(t){for(var e=0,i=(t=zt(t)).parent,r=0;r<i.lines.length;++r){var n=i.lines[r];if(n==t)break;e+=n.height}for(var o=i.parent;o;o=(i=o).parent)for(var s=0;s<o.children.length;++s){var a=o.children[s];if(a==i)break;e+=a.height}return e}function Kt(t){if(0==t.height)return 0;for(var e,i=t.text.length,r=t;e=Ft(r);){var n=e.find(0,!0);r=n.from.line,i+=n.from.ch-n.to.ch}for(r=t;e=Ut(r);){var o=e.find(0,!0);i-=r.text.length-o.from.ch,i+=(r=o.to.line).text.length-o.to.ch}return i}function $t(t){var i=t.display,e=t.doc;i.maxLine=lt(e,e.first),i.maxLineLength=Kt(i.maxLine),i.maxLineChanged=!0,e.iter(function(t){var e=Kt(t);e>i.maxLineLength&&(i.maxLineLength=e,i.maxLine=t)})}var Qt=null;function Xt(t,e,i){var r;Qt=null;for(var n=0;n<t.length;++n){var o=t[n];if(o.from<e&&o.to>e)return n;o.to==e&&(o.from!=o.to&&"before"==i?r=n:Qt=n),o.from==e&&(o.from!=o.to&&"before"!=i?r=n:Qt=n)}return null!=r?r:Qt}var Zt=function(){var B="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",F="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";var U=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,H=/[stwN]/,W=/[LRr]/,z=/[Lb1n]/,q=/[1n]/;function G(t,e,i){this.level=t,this.from=e,this.to=i}return function(t,e){var i="ltr"==e?"L":"R";if(0==t.length||"ltr"==e&&!U.test(t))return!1;for(var r,n=t.length,o=[],s=0;s<n;++s)o.push((r=t.charCodeAt(s))<=247?B.charAt(r):1424<=r&&r<=1524?"R":1536<=r&&r<=1785?F.charAt(r-1536):1774<=r&&r<=2220?"r":8192<=r&&r<=8203?"w":8204==r?"b":"L");for(var a=0,l=i;a<n;++a){var c=o[a];"m"==c?o[a]=l:l=c}for(var h=0,u=i;h<n;++h){var f=o[h];"1"==f&&"r"==u?o[h]="n":W.test(f)&&"r"==(u=f)&&(o[h]="R")}for(var d=1,p=o[0];d<n-1;++d){var m=o[d];"+"==m&&"1"==p&&"1"==o[d+1]?o[d]="1":","!=m||p!=o[d+1]||"1"!=p&&"n"!=p||(o[d]=p),p=m}for(var g=0;g<n;++g){var _=o[g];if(","==_)o[g]="N";else if("%"==_){var v=void 0;for(v=g+1;v<n&&"%"==o[v];++v);for(var y=g&&"!"==o[g-1]||v<n&&"1"==o[v]?"1":"N",x=g;x<v;++x)o[x]=y;g=v-1}}for(var T=0,k=i;T<n;++T){var b=o[T];"L"==k&&"1"==b?o[T]="L":W.test(b)&&(k=b)}for(var w=0;w<n;++w)if(H.test(o[w])){var E=void 0;for(E=w+1;E<n&&H.test(o[E]);++E);for(var C="L"==(w?o[w-1]:i),S=C==("L"==(E<n?o[E]:i))?C?"L":"R":i,A=w;A<E;++A)o[A]=S;w=E-1}for(var L,N=[],O=0;O<n;)if(z.test(o[O])){var I=O;for(++O;O<n&&z.test(o[O]);++O);N.push(new G(0,I,O))}else{var R=O,M=N.length;for(++O;O<n&&"L"!=o[O];++O);for(var D=R;D<O;)if(q.test(o[D])){R<D&&N.splice(M,0,new G(1,R,D));var P=D;for(++D;D<O&&q.test(o[D]);++D);N.splice(M,0,new G(2,P,D)),R=D}else++D;R<O&&N.splice(M,0,new G(1,R,O))}return"ltr"==e&&(1==N[0].level&&(L=t.match(/^\s+/))&&(N[0].from=L[0].length,N.unshift(new G(0,0,L[0].length))),1==$(N).level&&(L=t.match(/\s+$/))&&($(N).to-=L[0].length,N.push(new G(0,n-L[0].length,n)))),"rtl"==e?N.reverse():N}}();function Jt(t,e){var i=t.order;return null==i&&(i=t.order=Zt(t.text,e)),i}var te=[],ee=function(t,e,i){if(t.addEventListener)t.addEventListener(e,i,!1);else if(t.attachEvent)t.attachEvent("on"+e,i);else{var r=t._handlers||(t._handlers={});r[e]=(r[e]||te).concat(i)}};function ie(t,e){return t._handlers&&t._handlers[e]||te}function re(t,e,i){if(t.removeEventListener)t.removeEventListener(e,i,!1);else if(t.detachEvent)t.detachEvent("on"+e,i);else{var r=t._handlers,n=r&&r[e];if(n){var o=H(n,i);-1<o&&(r[e]=n.slice(0,o).concat(n.slice(o+1)))}}}function ne(t,e){var i=ie(t,e);if(i.length)for(var r=Array.prototype.slice.call(arguments,2),n=0;n<i.length;++n)i[n].apply(null,r)}function oe(t,e,i){return"string"==typeof e&&(e={type:e,preventDefault:function(){this.defaultPrevented=!0}}),ne(t,i||e.type,t,e),ue(e)||e.codemirrorIgnore}function se(t){var e=t._handlers&&t._handlers.cursorActivity;if(e)for(var i=t.curOp.cursorActivityHandlers||(t.curOp.cursorActivityHandlers=[]),r=0;r<e.length;++r)-1==H(i,e[r])&&i.push(e[r])}function ae(t,e){return 0<ie(t,e).length}function le(t){t.prototype.on=function(t,e){ee(this,t,e)},t.prototype.off=function(t,e){re(this,t,e)}}function ce(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function he(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function ue(t){return null!=t.defaultPrevented?t.defaultPrevented:0==t.returnValue}function fe(t){ce(t),he(t)}function de(t){return t.target||t.srcElement}function pe(t){var e=t.which;return null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2)),x&&t.ctrlKey&&1==e&&(e=3),e}var me,ge,_e=function(){if(T&&k<9)return!1;var t=N("div");return"draggable"in t||"dragDrop"in t}();function ve(t){if(null==me){var e=N("span","​");A(t,N("span",[e,document.createTextNode("x")])),0!=t.firstChild.offsetHeight&&(me=e.offsetWidth<=1&&2<e.offsetHeight&&!(T&&k<8))}var i=me?N("span","​"):N("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}function ye(t){if(null!=ge)return ge;var e=A(t,document.createTextNode("AخA")),i=E(e,0,1).getBoundingClientRect(),r=E(e,1,2).getBoundingClientRect();return S(t),!(!i||i.left==i.right)&&(ge=r.right-i.right<3)}var xe,Te=3!="\n\nb".split(/\n/).length?function(t){for(var e=0,i=[],r=t.length;e<=r;){var n=t.indexOf("\n",e);-1==n&&(n=t.length);var o=t.slice(e,"\r"==t.charAt(n-1)?n-1:n),s=o.indexOf("\r");-1!=s?(i.push(o.slice(0,s)),e+=s+1):(i.push(o),e=n+1)}return i}:function(t){return t.split(/\r\n?|\n/)},ke=window.getSelection?function(t){try{return t.selectionStart!=t.selectionEnd}catch(t){return!1}}:function(t){var e;try{e=t.ownerDocument.selection.createRange()}catch(t){}return!(!e||e.parentElement()!=t)&&0!=e.compareEndPoints("StartToEnd",e)},be="oncopy"in(xe=N("div"))||(xe.setAttribute("oncopy","return;"),"function"==typeof xe.oncopy),we=null;var Ee={},Ce={};function Se(t){if("string"==typeof t&&Ce.hasOwnProperty(t))t=Ce[t];else if(t&&"string"==typeof t.name&&Ce.hasOwnProperty(t.name)){var e=Ce[t.name];"string"==typeof e&&(e={name:e}),(t=Z(e,t)).name=e.name}else{if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return Se("application/xml");if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+json$/.test(t))return Se("application/json")}return"string"==typeof t?{name:t}:t||{name:"null"}}function Ae(t,e){e=Se(e);var i=Ee[e.name];if(!i)return Ae(t,"text/plain");var r=i(t,e);if(Le.hasOwnProperty(e.name)){var n=Le[e.name];for(var o in n)n.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=n[o])}if(r.name=e.name,e.helperType&&(r.helperType=e.helperType),e.modeProps)for(var s in e.modeProps)r[s]=e.modeProps[s];return r}var Le={};function Ne(t,e){B(e,Le.hasOwnProperty(t)?Le[t]:Le[t]={})}function Oe(t,e){if(!0===e)return e;if(t.copyState)return t.copyState(e);var i={};for(var r in e){var n=e[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function Ie(t,e){for(var i;t.innerMode&&(i=t.innerMode(e))&&i.mode!=t;)e=i.state,t=i.mode;return i||{mode:t,state:e}}function Re(t,e,i){return!t.startState||t.startState(e,i)}var Me=function(t,e,i){this.pos=this.start=0,this.string=t,this.tabSize=e||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};Me.prototype.eol=function(){return this.pos>=this.string.length},Me.prototype.sol=function(){return this.pos==this.lineStart},Me.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Me.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Me.prototype.eat=function(t){var e=this.string.charAt(this.pos);if("string"==typeof t?e==t:e&&(t.test?t.test(e):t(e)))return++this.pos,e},Me.prototype.eatWhile=function(t){for(var e=this.pos;this.eat(t););return this.pos>e},Me.prototype.eatSpace=function(){for(var t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t},Me.prototype.skipToEnd=function(){this.pos=this.string.length},Me.prototype.skipTo=function(t){var e=this.string.indexOf(t,this.pos);if(-1<e)return this.pos=e,!0},Me.prototype.backUp=function(t){this.pos-=t},Me.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=F(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?F(this.string,this.lineStart,this.tabSize):0)},Me.prototype.indentation=function(){return F(this.string,null,this.tabSize)-(this.lineStart?F(this.string,this.lineStart,this.tabSize):0)},Me.prototype.match=function(t,e,i){if("string"!=typeof t){var r=this.string.slice(this.pos).match(t);return r&&0<r.index?null:(r&&!1!==e&&(this.pos+=r[0].length),r)}var n=function(t){return i?t.toLowerCase():t};if(n(this.string.substr(this.pos,t.length))==n(t))return!1!==e&&(this.pos+=t.length),!0},Me.prototype.current=function(){return this.string.slice(this.start,this.pos)},Me.prototype.hideFirstChars=function(t,e){this.lineStart+=t;try{return e()}finally{this.lineStart-=t}},Me.prototype.lookAhead=function(t){var e=this.lineOracle;return e&&e.lookAhead(t)},Me.prototype.baseToken=function(){var t=this.lineOracle;return t&&t.baseToken(this.pos)};var De=function(t,e){this.state=t,this.lookAhead=e},Pe=function(t,e,i,r){this.state=e,this.doc=t,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};function Be(e,i,r,t){var l=[e.state.modeGen],n={};Ve(e,i.text,e.doc.mode,r,function(t,e){return l.push(t,e)},n,t);for(var c=r.state,o=function(t){r.baseTokens=l;var o=e.state.overlays[t],s=1,a=0;r.state=!0,Ve(e,i.text,o.mode,r,function(t,e){for(var i=s;a<t;){var r=l[s];t<r&&l.splice(s,1,t,l[s+1],r),s+=2,a=Math.min(t,r)}if(e)if(o.opaque)l.splice(i,s-i,t,"overlay "+e),s=i+2;else for(;i<s;i+=2){var n=l[i+1];l[i+1]=(n?n+" ":"")+"overlay "+e}},n),r.state=c,r.baseTokens=null,r.baseTokenPos=1},s=0;s<e.state.overlays.length;++s)o(s);return{styles:l,classes:n.bgClass||n.textClass?n:null}}function Fe(t,e,i){if(!e.styles||e.styles[0]!=t.state.modeGen){var r=Ue(t,ft(e)),n=e.text.length>t.options.maxHighlightLength&&Oe(t.doc.mode,r.state),o=Be(t,e,r);n&&(r.state=n),e.stateAfter=r.save(!n),e.styles=o.styles,o.classes?e.styleClasses=o.classes:e.styleClasses&&(e.styleClasses=null),i===t.doc.highlightFrontier&&(t.doc.modeFrontier=Math.max(t.doc.modeFrontier,++t.doc.highlightFrontier))}return e.styles}function Ue(i,r,t){var e=i.doc,n=i.display;if(!e.mode.startState)return new Pe(e,!0,r);var o=function(t,e,i){for(var r,n,o=t.doc,s=i?-1:e-(t.doc.mode.innerMode?1e3:100),a=e;s<a;--a){if(a<=o.first)return o.first;var l=lt(o,a-1),c=l.stateAfter;if(c&&(!i||a+(c instanceof De?c.lookAhead:0)<=o.modeFrontier))return a;var h=F(l.text,null,t.options.tabSize);(null==n||h<r)&&(n=a-1,r=h)}return n}(i,r,t),s=o>e.first&&lt(e,o-1).stateAfter,a=s?Pe.fromSaved(e,s,o):new Pe(e,Re(e.mode),o);return e.iter(o,r,function(t){He(i,t.text,a);var e=a.line;t.stateAfter=e==r-1||e%5==0||e>=n.viewFrom&&e<n.viewTo?a.save():null,a.nextLine()}),t&&(e.modeFrontier=a.line),a}function He(t,e,i,r){var n=t.doc.mode,o=new Me(e,t.options.tabSize,i);for(o.start=o.pos=r||0,""==e&&We(n,i.state);!o.eol();)ze(n,o,i.state),o.start=o.pos}function We(t,e){if(t.blankLine)return t.blankLine(e);if(t.innerMode){var i=Ie(t,e);return i.mode.blankLine?i.mode.blankLine(i.state):void 0}}function ze(t,e,i,r){for(var n=0;n<10;n++){r&&(r[0]=Ie(t,i).mode);var o=t.token(e,i);if(e.pos>e.start)return o}throw new Error("Mode "+t.name+" failed to advance stream.")}Pe.prototype.lookAhead=function(t){var e=this.doc.getLine(this.line+t);return null!=e&&t>this.maxLookAhead&&(this.maxLookAhead=t),e},Pe.prototype.baseToken=function(t){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=t;)this.baseTokenPos+=2;var e=this.baseTokens[this.baseTokenPos+1];return{type:e&&e.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-t}},Pe.prototype.nextLine=function(){this.line++,0<this.maxLookAhead&&this.maxLookAhead--},Pe.fromSaved=function(t,e,i){return e instanceof De?new Pe(t,Oe(t.mode,e.state),i,e.lookAhead):new Pe(t,Oe(t.mode,e),i)},Pe.prototype.save=function(t){var e=!1!==t?Oe(this.doc.mode,this.state):this.state;return 0<this.maxLookAhead?new De(e,this.maxLookAhead):e};var qe=function(t,e,i){this.start=t.start,this.end=t.pos,this.string=t.current(),this.type=e||null,this.state=i};function Ge(t,e,i,r){var n,o,s=t.doc,a=s.mode,l=lt(s,(e=bt(s,e)).line),c=Ue(t,e.line,i),h=new Me(l.text,t.options.tabSize,c);for(r&&(o=[]);(r||h.pos<e.ch)&&!h.eol();)h.start=h.pos,n=ze(a,h,c.state),r&&o.push(new qe(h,n,Oe(s.mode,c.state)));return r?o:new qe(h,n,c.state)}function je(t,e){if(t)for(;;){var i=t.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i)break;t=t.slice(0,i.index)+t.slice(i.index+i[0].length);var r=i[1]?"bgClass":"textClass";null==e[r]?e[r]=i[2]:new RegExp("(?:^|s)"+i[2]+"(?:$|s)").test(e[r])||(e[r]+=" "+i[2])}return t}function Ve(t,e,i,r,n,o,s){var a=i.flattenSpans;null==a&&(a=t.options.flattenSpans);var l,c=0,h=null,u=new Me(e,t.options.tabSize,r),f=t.options.addModeClass&&[null];for(""==e&&je(We(i,r.state),o);!u.eol();){if(l=u.pos>t.options.maxHighlightLength?(a=!1,s&&He(t,e,r,u.pos),u.pos=e.length,null):je(ze(i,u,r.state,f),o),f){var d=f[0].name;d&&(l="m-"+(l?d+" "+l:d))}if(!a||h!=l){for(;c<u.start;)n(c=Math.min(u.start,c+5e3),h);h=l}u.start=u.pos}for(;c<u.pos;){var p=Math.min(u.pos,c+5e3);n(p,h),c=p}}var Ye=function(t,e,i){this.text=t,Rt(this,e),this.height=i?i(this):1};Ye.prototype.lineNo=function(){return ft(this)},le(Ye);var Ke={},$e={};function Qe(t,e){if(!t||/^\s*$/.test(t))return null;var i=e.addModeClass?$e:Ke;return i[t]||(i[t]=t.replace(/\S+/g,"cm-$&"))}function Xe(t,e){var i=L("span",null,null,y?"padding-right: .1px":null),r={pre:L("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:t,trailingSpace:!1,splitSpaces:t.getOption("lineWrapping")};e.measure={};for(var n=0;n<=(e.rest?e.rest.length:0);n++){var o=n?e.rest[n-1]:e.line,s=void 0;r.pos=0,r.addToken=Je,ye(t.display.measure)&&(s=Jt(o,t.doc.direction))&&(r.addToken=ti(r.addToken,s)),r.map=[],ii(o,r,Fe(t,o,e!=t.display.externalMeasured&&ft(o))),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=M(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=M(o.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(ve(t.display.measure))),0==n?(e.measure.map=r.map,e.measure.cache={}):((e.measure.maps||(e.measure.maps=[])).push(r.map),(e.measure.caches||(e.measure.caches=[])).push({}))}if(y){var a=r.content.lastChild;(/\bcm-tab\b/.test(a.className)||a.querySelector&&a.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return ne(t,"renderLine",t,e.line,r.pre),r.pre.className&&(r.textClass=M(r.pre.className,r.textClass||"")),r}function Ze(t){var e=N("span","•","cm-invalidchar");return e.title="\\u"+t.charCodeAt(0).toString(16),e.setAttribute("aria-label",e.title),e}function Je(t,e,i,r,n,o,s){if(e){var a,l=t.splitSpaces?function(t,e){if(1<t.length&&!/ /.test(t))return t;for(var i=e,r="",n=0;n<t.length;n++){var o=t.charAt(n);" "!=o||!i||n!=t.length-1&&32!=t.charCodeAt(n+1)||(o=" "),r+=o,i=" "==o}return r}(e,t.trailingSpace):e,c=t.cm.state.specialChars,h=!1;if(c.test(e)){a=document.createDocumentFragment();for(var u=0;;){c.lastIndex=u;var f=c.exec(e),d=f?f.index-u:e.length-u;if(d){var p=document.createTextNode(l.slice(u,u+d));T&&k<9?a.appendChild(N("span",[p])):a.appendChild(p),t.map.push(t.pos,t.pos+d,p),t.col+=d,t.pos+=d}if(!f)break;u+=d+1;var m=void 0;if("\t"==f[0]){var g=t.cm.options.tabSize,_=g-t.col%g;(m=a.appendChild(N("span",K(_),"cm-tab"))).setAttribute("role","presentation"),m.setAttribute("cm-text","\t"),t.col+=_}else"\r"==f[0]||"\n"==f[0]?(m=a.appendChild(N("span","\r"==f[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",f[0]):((m=t.cm.options.specialCharPlaceholder(f[0])).setAttribute("cm-text",f[0]),T&&k<9?a.appendChild(N("span",[m])):a.appendChild(m)),t.col+=1;t.map.push(t.pos,t.pos+1,m),t.pos++}}else t.col+=e.length,a=document.createTextNode(l),t.map.push(t.pos,t.pos+e.length,a),T&&k<9&&(h=!0),t.pos+=e.length;if(t.trailingSpace=32==l.charCodeAt(e.length-1),i||r||n||h||o){var v=i||"";r&&(v+=r),n&&(v+=n);var y=N("span",[a],v,o);if(s)for(var x in s)s.hasOwnProperty(x)&&"style"!=x&&"class"!=x&&y.setAttribute(x,s[x]);return t.content.appendChild(y)}t.content.appendChild(a)}}function ti(u,f){return function(t,e,i,r,n,o,s){i=i?i+" cm-force-border":"cm-force-border";for(var a=t.pos,l=a+e.length;;){for(var c=void 0,h=0;h<f.length&&!((c=f[h]).to>a&&c.from<=a);h++);if(c.to>=l)return u(t,e,i,r,n,o,s);u(t,e.slice(0,c.to-a),i,r,null,o,s),r=null,e=e.slice(c.to-a),a=c.to}}}function ei(t,e,i,r){var n=!r&&i.widgetNode;n&&t.map.push(t.pos,t.pos+e,n),!r&&t.cm.display.input.needsContentAttribute&&(n||(n=t.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(t.cm.display.input.setUneditable(n),t.content.appendChild(n)),t.pos+=e,t.trailingSpace=!1}function ii(t,e,i){var r=t.markedSpans,n=t.text,o=0;if(r)for(var s,a,l,c,h,u,f,d=n.length,p=0,m=1,g="",_=0;;){if(_==p){l=c=h=a="",u=f=null,_=1/0;for(var v=[],y=void 0,x=0;x<r.length;++x){var T=r[x],k=T.marker;if("bookmark"==k.type&&T.from==p&&k.widgetNode)v.push(k);else if(T.from<=p&&(null==T.to||T.to>p||k.collapsed&&T.to==p&&T.from==p)){if(null!=T.to&&T.to!=p&&_>T.to&&(_=T.to,c=""),k.className&&(l+=" "+k.className),k.css&&(a=(a?a+";":"")+k.css),k.startStyle&&T.from==p&&(h+=" "+k.startStyle),k.endStyle&&T.to==_&&(y||(y=[])).push(k.endStyle,T.to),k.title&&((f||(f={})).title=k.title),k.attributes)for(var b in k.attributes)(f||(f={}))[b]=k.attributes[b];k.collapsed&&(!u||Pt(u.marker,k)<0)&&(u=T)}else T.from>p&&_>T.from&&(_=T.from)}if(y)for(var w=0;w<y.length;w+=2)y[w+1]==_&&(c+=" "+y[w]);if(!u||u.from==p)for(var E=0;E<v.length;++E)ei(e,0,v[E]);if(u&&(u.from||0)==p){if(ei(e,(null==u.to?d+1:u.to)-p,u.marker,null==u.from),null==u.to)return;u.to==p&&(u=!1)}}if(d<=p)break;for(var C=Math.min(d,_);;){if(g){var S=p+g.length;if(!u){var A=C<S?g.slice(0,C-p):g;e.addToken(e,A,s?s+l:l,h,p+A.length==_?c:"",a,f)}if(C<=S){g=g.slice(C-p),p=C;break}p=S,h=""}g=n.slice(o,o=i[m++]),s=Qe(i[m++],e.cm.options)}}else for(var L=1;L<i.length;L+=2)e.addToken(e,n.slice(o,o=i[L]),Qe(i[L+1],e.cm.options))}function ri(t,e,i){this.line=e,this.rest=function(t){for(var e,i;e=Ut(t);)t=e.find(1,!0).line,(i||(i=[])).push(t);return i}(e),this.size=this.rest?ft($(this.rest))-i+1:1,this.node=this.text=null,this.hidden=jt(t,e)}function ni(t,e,i){for(var r,n=[],o=e;o<i;o=r){var s=new ri(t.doc,lt(t.doc,o),o);r=o+s.size,n.push(s)}return n}var oi=null;var si=null;function ai(t,e){var i=ie(t,e);if(i.length){var r,n=Array.prototype.slice.call(arguments,2);oi?r=oi.delayedCallbacks:si?r=si:(r=si=[],setTimeout(li,0));for(var o=function(t){r.push(function(){return i[t].apply(null,n)})},s=0;s<i.length;++s)o(s)}}function li(){var t=si;si=null;for(var e=0;e<t.length;++e)t[e]()}function ci(t,e,i,r){for(var n=0;n<e.changes.length;n++){var o=e.changes[n];"text"==o?fi(t,e):"gutter"==o?pi(t,e,i,r):"class"==o?di(t,e):"widget"==o&&mi(t,e,r)}e.changes=null}function hi(t){return t.node==t.text&&(t.node=N("div",null,null,"position: relative"),t.text.parentNode&&t.text.parentNode.replaceChild(t.node,t.text),t.node.appendChild(t.text),T&&k<8&&(t.node.style.zIndex=2)),t.node}function ui(t,e){var i=t.display.externalMeasured;return i&&i.line==e.line?(t.display.externalMeasured=null,e.measure=i.measure,i.built):Xe(t,e)}function fi(t,e){var i=e.text.className,r=ui(t,e);e.text==e.node&&(e.node=r.pre),e.text.parentNode.replaceChild(r.pre,e.text),e.text=r.pre,r.bgClass!=e.bgClass||r.textClass!=e.textClass?(e.bgClass=r.bgClass,e.textClass=r.textClass,di(t,e)):i&&(e.text.className=i)}function di(t,e){!function(t,e){var i=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(i&&(i+=" CodeMirror-linebackground"),e.background)i?e.background.className=i:(e.background.parentNode.removeChild(e.background),e.background=null);else if(i){var r=hi(e);e.background=r.insertBefore(N("div",null,i),r.firstChild),t.display.input.setUneditable(e.background)}}(t,e),e.line.wrapClass?hi(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var i=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=i||""}function pi(t,e,i,r){if(e.gutter&&(e.node.removeChild(e.gutter),e.gutter=null),e.gutterBackground&&(e.node.removeChild(e.gutterBackground),e.gutterBackground=null),e.line.gutterClass){var n=hi(e);e.gutterBackground=N("div",null,"CodeMirror-gutter-background "+e.line.gutterClass,"left: "+(t.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),t.display.input.setUneditable(e.gutterBackground),n.insertBefore(e.gutterBackground,e.text)}var o=e.line.gutterMarkers;if(t.options.lineNumbers||o){var s=hi(e),a=e.gutter=N("div",null,"CodeMirror-gutter-wrapper","left: "+(t.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(t.display.input.setUneditable(a),s.insertBefore(a,e.text),e.line.gutterClass&&(a.className+=" "+e.line.gutterClass),!t.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(e.lineNumber=a.appendChild(N("div",mt(t.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+t.display.lineNumInnerWidth+"px"))),o)for(var l=0;l<t.options.gutters.length;++l){var c=t.options.gutters[l],h=o.hasOwnProperty(c)&&o[c];h&&a.appendChild(N("div",[h],"CodeMirror-gutter-elt","left: "+r.gutterLeft[c]+"px; width: "+r.gutterWidth[c]+"px"))}}}function mi(t,e,i){e.alignable&&(e.alignable=null);for(var r=e.node.firstChild,n=void 0;r;r=n)n=r.nextSibling,"CodeMirror-linewidget"==r.className&&e.node.removeChild(r);gi(t,e,i)}function gi(t,e,i){if(_i(t,e.line,e,i,!0),e.rest)for(var r=0;r<e.rest.length;r++)_i(t,e.rest[r],e,i,!1)}function _i(t,e,i,r,n){if(e.widgets)for(var o=hi(i),s=0,a=e.widgets;s<a.length;++s){var l=a[s],c=N("div",[l.node],"CodeMirror-linewidget");l.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),vi(l,c,i,r),t.display.input.setUneditable(c),n&&l.above?o.insertBefore(c,i.gutter||i.text):o.appendChild(c),ai(l,"redraw")}}function vi(t,e,i,r){if(t.noHScroll){(i.alignable||(i.alignable=[])).push(e);var n=r.wrapperWidth;e.style.left=r.fixedPos+"px",t.coverGutter||(n-=r.gutterTotalWidth,e.style.paddingLeft=r.gutterTotalWidth+"px"),e.style.width=n+"px"}t.coverGutter&&(e.style.zIndex=5,e.style.position="relative",t.noHScroll||(e.style.marginLeft=-r.gutterTotalWidth+"px"))}function yi(t){if(null!=t.height)return t.height;var e=t.doc.cm;if(!e)return 0;if(!O(document.body,t.node)){var i="position: relative;";t.coverGutter&&(i+="margin-left: -"+e.display.gutters.offsetWidth+"px;"),t.noHScroll&&(i+="width: "+e.display.wrapper.clientWidth+"px;"),A(e.display.measure,N("div",[t.node],null,i))}return t.height=t.node.parentNode.offsetHeight}function xi(t,e){for(var i=de(e);i!=t.wrapper;i=i.parentNode)if(!i||1==i.nodeType&&"true"==i.getAttribute("cm-ignore-events")||i.parentNode==t.sizer&&i!=t.mover)return!0}function Ti(t){return t.lineSpace.offsetTop}function ki(t){return t.mover.offsetHeight-t.lineSpace.offsetHeight}function bi(t){if(t.cachedPaddingH)return t.cachedPaddingH;var e=A(t.measure,N("pre","x")),i=window.getComputedStyle?window.getComputedStyle(e):e.currentStyle,r={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return isNaN(r.left)||isNaN(r.right)||(t.cachedPaddingH=r),r}function wi(t){return W-t.display.nativeBarWidth}function Ei(t){return t.display.scroller.clientWidth-wi(t)-t.display.barWidth}function Ci(t){return t.display.scroller.clientHeight-wi(t)-t.display.barHeight}function Si(t,e,i){if(t.line==e)return{map:t.measure.map,cache:t.measure.cache};for(var r=0;r<t.rest.length;r++)if(t.rest[r]==e)return{map:t.measure.maps[r],cache:t.measure.caches[r]};for(var n=0;n<t.rest.length;n++)if(ft(t.rest[n])>i)return{map:t.measure.maps[n],cache:t.measure.caches[n],before:!0}}function Ai(t,e,i,r){return Oi(t,Ni(t,e),i,r)}function Li(t,e){if(e>=t.display.viewFrom&&e<t.display.viewTo)return t.display.view[sr(t,e)];var i=t.display.externalMeasured;return i&&e>=i.lineN&&e<i.lineN+i.size?i:void 0}function Ni(t,e){var i=ft(e),r=Li(t,i);r&&!r.text?r=null:r&&r.changes&&(ci(t,r,i,er(t)),t.curOp.forceUpdate=!0),r||(r=function(t,e){var i=ft(e=zt(e)),r=t.display.externalMeasured=new ri(t.doc,e,i);r.lineN=i;var n=r.built=Xe(t,r);return r.text=n.pre,A(t.display.lineMeasure,n.pre),r}(t,e));var n=Si(r,e,i);return{line:e,view:r,rect:null,map:n.map,cache:n.cache,before:n.before,hasHeights:!1}}function Oi(t,e,i,r,n){e.before&&(i=-1);var o,s=i+(r||"");return e.cache.hasOwnProperty(s)?o=e.cache[s]:(e.rect||(e.rect=e.view.text.getBoundingClientRect()),e.hasHeights||(!function(t,e,i){var r=t.options.lineWrapping,n=r&&Ei(t);if(!e.measure.heights||r&&e.measure.width!=n){var o=e.measure.heights=[];if(r){e.measure.width=n;for(var s=e.text.firstChild.getClientRects(),a=0;a<s.length-1;a++){var l=s[a],c=s[a+1];2<Math.abs(l.bottom-c.bottom)&&o.push((l.bottom+c.top)/2-i.top)}}o.push(i.bottom-i.top)}}(t,e.view,e.rect),e.hasHeights=!0),(o=function(t,e,i,r){var n,o=Mi(e.map,i,r),s=o.node,a=o.start,l=o.end,c=o.collapse;if(3==s.nodeType){for(var h=0;h<4;h++){for(;a&&nt(e.line.text.charAt(o.coverStart+a));)--a;for(;o.coverStart+l<o.coverEnd&&nt(e.line.text.charAt(o.coverStart+l));)++l;if((n=T&&k<9&&0==a&&l==o.coverEnd-o.coverStart?s.parentNode.getBoundingClientRect():Di(E(s,a,l).getClientRects(),r)).left||n.right||0==a)break;l=a,a-=1,c="right"}T&&k<11&&(n=function(t,e){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(t){if(null!=we)return we;var e=A(t,N("span","x")),i=e.getBoundingClientRect(),r=E(e,0,1).getBoundingClientRect();return we=1<Math.abs(i.left-r.left)}(t))return e;var i=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:e.left*i,right:e.right*i,top:e.top*r,bottom:e.bottom*r}}(t.display.measure,n))}else{var u;0<a&&(c=r="right"),n=t.options.lineWrapping&&1<(u=s.getClientRects()).length?u["right"==r?u.length-1:0]:s.getBoundingClientRect()}if(T&&k<9&&!a&&(!n||!n.left&&!n.right)){var f=s.parentNode.getClientRects()[0];n=f?{left:f.left,right:f.left+tr(t.display),top:f.top,bottom:f.bottom}:Ri}for(var d=n.top-e.rect.top,p=n.bottom-e.rect.top,m=(d+p)/2,g=e.view.measure.heights,_=0;_<g.length-1&&!(m<g[_]);_++);var v=_?g[_-1]:0,y=g[_],x={left:("right"==c?n.right:n.left)-e.rect.left,right:("left"==c?n.left:n.right)-e.rect.left,top:v,bottom:y};n.left||n.right||(x.bogus=!0);t.options.singleCursorHeightPerLine||(x.rtop=d,x.rbottom=p);return x}(t,e,i,r)).bogus||(e.cache[s]=o)),{left:o.left,right:o.right,top:n?o.rtop:o.top,bottom:n?o.rbottom:o.bottom}}var Ii,Ri={left:0,right:0,top:0,bottom:0};function Mi(t,e,i){for(var r,n,o,s,a,l,c=0;c<t.length;c+=3)if(a=t[c],l=t[c+1],e<a?(n=0,o=1,s="left"):e<l?o=(n=e-a)+1:(c==t.length-3||e==l&&t[c+3]>e)&&(n=(o=l-a)-1,l<=e&&(s="right")),null!=n){if(r=t[c+2],a==l&&i==(r.insertLeft?"left":"right")&&(s=i),"left"==i&&0==n)for(;c&&t[c-2]==t[c-3]&&t[c-1].insertLeft;)r=t[2+(c-=3)],s="left";if("right"==i&&n==l-a)for(;c<t.length-3&&t[c+3]==t[c+4]&&!t[c+5].insertLeft;)r=t[(c+=3)+2],s="right";break}return{node:r,start:n,end:o,collapse:s,coverStart:a,coverEnd:l}}function Di(t,e){var i=Ri;if("left"==e)for(var r=0;r<t.length&&(i=t[r]).left==i.right;r++);else for(var n=t.length-1;0<=n&&(i=t[n]).left==i.right;n--);return i}function Pi(t){if(t.measure&&(t.measure.cache={},t.measure.heights=null,t.rest))for(var e=0;e<t.rest.length;e++)t.measure.caches[e]={}}function Bi(t){t.display.externalMeasure=null,S(t.display.lineMeasure);for(var e=0;e<t.display.view.length;e++)Pi(t.display.view[e])}function Fi(t){Bi(t),t.display.cachedCharWidth=t.display.cachedTextHeight=t.display.cachedPaddingH=null,t.options.lineWrapping||(t.display.maxLineChanged=!0),t.display.lineNumChars=null}function Ui(){return s&&u?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Hi(){return s&&u?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Wi(t){var e=0;if(t.widgets)for(var i=0;i<t.widgets.length;++i)t.widgets[i].above&&(e+=yi(t.widgets[i]));return e}function zi(t,e,i,r,n){if(!n){var o=Wi(e);i.top+=o,i.bottom+=o}if("line"==r)return i;r||(r="local");var s=Yt(e);if("local"==r?s+=Ti(t.display):s-=t.display.viewOffset,"page"==r||"window"==r){var a=t.display.lineSpace.getBoundingClientRect();s+=a.top+("window"==r?0:Hi());var l=a.left+("window"==r?0:Ui());i.left+=l,i.right+=l}return i.top+=s,i.bottom+=s,i}function qi(t,e,i){if("div"==i)return e;var r=e.left,n=e.top;if("page"==i)r-=Ui(),n-=Hi();else if("local"==i||!i){var o=t.display.sizer.getBoundingClientRect();r+=o.left,n+=o.top}var s=t.display.lineSpace.getBoundingClientRect();return{left:r-s.left,top:n-s.top}}function Gi(t,e,i,r,n){return r||(r=lt(t.doc,e.line)),zi(t,r,Ai(t,r,e.ch,n),i)}function ji(r,t,n,o,s,a){function l(t,e){var i=Oi(r,s,t,e?"right":"left",a);return e?i.left=i.right:i.right=i.left,zi(r,o,i,n)}o=o||lt(r.doc,t.line),s||(s=Ni(r,o));var c=Jt(o,r.doc.direction),e=t.ch,i=t.sticky;if(e>=o.text.length?(e=o.text.length,i="before"):e<=0&&(e=0,i="after"),!c)return l("before"==i?e-1:e,"before"==i);function h(t,e,i){return l(i?t-1:t,1==c[e].level!=i)}var u=Xt(c,e,i),f=Qt,d=h(e,u,"before"==i);return null!=f&&(d.other=h(e,f,"before"!=i)),d}function Vi(t,e){var i=0;e=bt(t.doc,e),t.options.lineWrapping||(i=tr(t.display)*e.ch);var r=lt(t.doc,e.line),n=Yt(r)+Ti(t.display);return{left:i,right:i,top:n,bottom:n+r.height}}function Yi(t,e,i,r,n){var o=gt(t,e,i);return o.xRel=n,r&&(o.outside=!0),o}function Ki(t,e,i){var r=t.doc;if((i+=t.display.viewOffset)<0)return Yi(r.first,0,null,!0,-1);var n=dt(r,i),o=r.first+r.size-1;if(o<n)return Yi(r.first+r.size-1,lt(r,o).text.length,null,!0,1);e<0&&(e=0);for(var s=lt(r,n);;){var a=Zi(t,s,n,e,i),l=Ht(s,a.ch+(0<a.xRel?1:0));if(!l)return a;var c=l.find(1);if(c.line==n)return c;s=lt(r,n=c.line)}}function $i(e,t,i,r){r-=Wi(t);var n=t.text.length,o=st(function(t){return Oi(e,i,t-1).bottom<=r},n,0);return{begin:o,end:n=st(function(t){return Oi(e,i,t).top>r},o,n)}}function Qi(t,e,i,r){return i||(i=Ni(t,e)),$i(t,e,i,zi(t,e,Oi(t,i,r),"line").top)}function Xi(t,e,i,r){return!(t.bottom<=i)&&(t.top>i||(r?t.left:t.right)>e)}function Zi(i,t,e,r,n){n-=Yt(t);var o=Ni(i,t),s=Wi(t),a=0,l=t.text.length,c=!0,h=Jt(t,i.doc.direction);if(h){var u=(i.options.lineWrapping?function(t,e,i,r,n,o,s){var a=$i(t,e,r,s),l=a.begin,c=a.end;/\s/.test(e.text.charAt(c-1))&&c--;for(var h=null,u=null,f=0;f<n.length;f++){var d=n[f];if(!(d.from>=c||d.to<=l)){var p=1!=d.level,m=Oi(t,r,p?Math.min(c,d.to)-1:Math.max(l,d.from)).right,g=m<o?o-m+1e9:m-o;(!h||g<u)&&(h=d,u=g)}}h||(h=n[n.length-1]);h.from<l&&(h={from:l,to:h.to,level:h.level});h.to>c&&(h={from:h.from,to:c,level:h.level});return h}:function(r,n,o,s,a,l,c){var t=st(function(t){var e=a[t],i=1!=e.level;return Xi(ji(r,gt(o,i?e.to:e.from,i?"before":"after"),"line",n,s),l,c,!0)},0,a.length-1),e=a[t];if(0<t){var i=1!=e.level,h=ji(r,gt(o,i?e.from:e.to,i?"after":"before"),"line",n,s);Xi(h,l,c,!0)&&h.top>c&&(e=a[t-1])}return e})(i,t,e,o,h,r,n);a=(c=1!=u.level)?u.from:u.to-1,l=c?u.to:u.from-1}var f,d,p=null,m=null,g=st(function(t){var e=Oi(i,o,t);return e.top+=s,e.bottom+=s,!!Xi(e,r,n,!1)&&(e.top<=n&&e.left<=r&&(p=t,m=e),!0)},a,l),_=!1;if(m){var v=r-m.left<m.right-r,y=v==c;g=p+(y?0:1),d=y?"after":"before",f=v?m.left:m.right}else{c||g!=l&&g!=a||g++,d=0==g?"after":g==t.text.length?"before":Oi(i,o,g-(c?1:0)).bottom+s<=n==c?"after":"before";var x=ji(i,gt(e,g,d),"line",t,o);f=x.left,_=n<x.top||n>=x.bottom}return Yi(e,g=ot(t.text,g,1),d,_,r-f)}function Ji(t){if(null!=t.cachedTextHeight)return t.cachedTextHeight;if(null==Ii){Ii=N("pre");for(var e=0;e<49;++e)Ii.appendChild(document.createTextNode("x")),Ii.appendChild(N("br"));Ii.appendChild(document.createTextNode("x"))}A(t.measure,Ii);var i=Ii.offsetHeight/50;return 3<i&&(t.cachedTextHeight=i),S(t.measure),i||1}function tr(t){if(null!=t.cachedCharWidth)return t.cachedCharWidth;var e=N("span","xxxxxxxxxx"),i=N("pre",[e]);A(t.measure,i);var r=e.getBoundingClientRect(),n=(r.right-r.left)/10;return 2<n&&(t.cachedCharWidth=n),n||10}function er(t){for(var e=t.display,i={},r={},n=e.gutters.clientLeft,o=e.gutters.firstChild,s=0;o;o=o.nextSibling,++s)i[t.options.gutters[s]]=o.offsetLeft+o.clientLeft+n,r[t.options.gutters[s]]=o.clientWidth;return{fixedPos:ir(e),gutterTotalWidth:e.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:e.wrapper.clientWidth}}function ir(t){return t.scroller.getBoundingClientRect().left-t.sizer.getBoundingClientRect().left}function rr(r){var n=Ji(r.display),o=r.options.lineWrapping,s=o&&Math.max(5,r.display.scroller.clientWidth/tr(r.display)-3);return function(t){if(jt(r.doc,t))return 0;var e=0;if(t.widgets)for(var i=0;i<t.widgets.length;i++)t.widgets[i].height&&(e+=t.widgets[i].height);return o?e+(Math.ceil(t.text.length/s)||1)*n:e+n}}function nr(t){var e=t.doc,i=rr(t);e.iter(function(t){var e=i(t);e!=t.height&&ut(t,e)})}function or(t,e,i,r){var n=t.display;if(!i&&"true"==de(e).getAttribute("cm-not-content"))return null;var o,s,a=n.lineSpace.getBoundingClientRect();try{o=e.clientX-a.left,s=e.clientY-a.top}catch(e){return null}var l,c=Ki(t,o,s);if(r&&1==c.xRel&&(l=lt(t.doc,c.line).text).length==c.ch){var h=F(l,l.length,t.options.tabSize)-l.length;c=gt(c.line,Math.max(0,Math.round((o-bi(t.display).left)/tr(t.display))-h))}return c}function sr(t,e){if(e>=t.display.viewTo)return null;if((e-=t.display.viewFrom)<0)return null;for(var i=t.display.view,r=0;r<i.length;r++)if((e-=i[r].size)<0)return r}function ar(t){t.display.input.showSelection(t.display.input.prepareSelection())}function lr(t,e){void 0===e&&(e=!0);for(var i=t.doc,r={},n=r.cursors=document.createDocumentFragment(),o=r.selection=document.createDocumentFragment(),s=0;s<i.sel.ranges.length;s++)if(e||s!=i.sel.primIndex){var a=i.sel.ranges[s];if(!(a.from().line>=t.display.viewTo||a.to().line<t.display.viewFrom)){var l=a.empty();(l||t.options.showCursorWhenSelecting)&&cr(t,a.head,n),l||ur(t,a,o)}}return r}function cr(t,e,i){var r=ji(t,e,"div",null,null,!t.options.singleCursorHeightPerLine),n=i.appendChild(N("div"," ","CodeMirror-cursor"));if(n.style.left=r.left+"px",n.style.top=r.top+"px",n.style.height=Math.max(0,r.bottom-r.top)*t.options.cursorHeight+"px",r.other){var o=i.appendChild(N("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=r.other.left+"px",o.style.top=r.other.top+"px",o.style.height=.85*(r.other.bottom-r.other.top)+"px"}}function hr(t,e){return t.top-e.top||t.left-e.left}function ur(s,t,e){var i=s.display,r=s.doc,n=document.createDocumentFragment(),o=bi(s.display),C=o.left,S=Math.max(i.sizerWidth,Ei(s)-i.sizer.offsetLeft)-o.right,A="ltr"==r.direction;function L(t,e,i,r){e<0&&(e=0),e=Math.round(e),r=Math.round(r),n.appendChild(N("div",null,"CodeMirror-selected","position: absolute; left: "+t+"px;\n top: "+e+"px; width: "+(null==i?S-t:i)+"px;\n height: "+(r-e)+"px"))}function a(i,v,y){var x,T,o=lt(r,i),k=o.text.length;function b(t,e){return Gi(s,gt(i,t),"div",o,e)}function w(t,e,i){var r=Qi(s,o,null,t),n="ltr"==e==("after"==i)?"left":"right";return b("after"==i?r.begin:r.end-(/\s/.test(o.text.charAt(r.end-1))?2:1),n)[n]}var E=Jt(o,r.direction);return function(t,e,i,r){if(!t)return r(e,i,"ltr",0);for(var n=!1,o=0;o<t.length;++o){var s=t[o];(s.from<i&&s.to>e||e==i&&s.to==e)&&(r(Math.max(s.from,e),Math.min(s.to,i),1==s.level?"rtl":"ltr",o),n=!0)}n||r(e,i,"ltr")}(E,v||0,null==y?k:y,function(t,e,i,r){var n="ltr"==i,o=b(t,n?"left":"right"),s=b(e-1,n?"right":"left"),a=null==v&&0==t,l=null==y&&e==k,c=0==r,h=!E||r==E.length-1;if(s.top-o.top<=3){var u=(A?l:a)&&h,f=(A?a:l)&&c?C:(n?o:s).left,d=u?S:(n?s:o).right;L(f,o.top,d-f,o.bottom)}else{var p,m,g,_;_=n?(p=A&&a&&c?C:o.left,m=A?S:w(t,i,"before"),g=A?C:w(e,i,"after"),A&&l&&h?S:s.right):(p=A?w(t,i,"before"):C,m=!A&&a&&c?S:o.right,g=!A&&l&&h?C:s.left,A?w(e,i,"after"):S),L(p,o.top,m-p,o.bottom),o.bottom<s.top&&L(C,o.bottom,null,s.top),L(g,s.top,_-g,s.bottom)}(!x||hr(o,x)<0)&&(x=o),hr(s,x)<0&&(x=s),(!T||hr(o,T)<0)&&(T=o),hr(s,T)<0&&(T=s)}),{start:x,end:T}}var l=t.from(),c=t.to();if(l.line==c.line)a(l.line,l.ch,c.ch);else{var h=lt(r,l.line),u=lt(r,c.line),f=zt(h)==zt(u),d=a(l.line,l.ch,f?h.text.length+1:null).end,p=a(c.line,f?0:null,c.ch).start;f&&(d.top<p.top-2?(L(d.right,d.top,null,d.bottom),L(C,p.top,p.left,p.bottom)):L(d.right,d.top,p.left-d.right,d.bottom)),d.bottom<p.top&&L(C,d.bottom,null,p.top)}e.appendChild(n)}function fr(t){if(t.state.focused){var e=t.display;clearInterval(e.blinker);var i=!0;e.cursorDiv.style.visibility="",0<t.options.cursorBlinkRate?e.blinker=setInterval(function(){return e.cursorDiv.style.visibility=(i=!i)?"":"hidden"},t.options.cursorBlinkRate):t.options.cursorBlinkRate<0&&(e.cursorDiv.style.visibility="hidden")}}function dr(t){t.state.focused||(t.display.input.focus(),mr(t))}function pr(t){t.state.delayingBlurEvent=!0,setTimeout(function(){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1,gr(t))},100)}function mr(t,e){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1),"nocursor"!=t.options.readOnly&&(t.state.focused||(ne(t,"focus",t,e),t.state.focused=!0,R(t.display.wrapper,"CodeMirror-focused"),t.curOp||t.display.selForContextMenu==t.doc.sel||(t.display.input.reset(),y&&setTimeout(function(){return t.display.input.reset(!0)},20)),t.display.input.receivedFocus()),fr(t))}function gr(t,e){t.state.delayingBlurEvent||(t.state.focused&&(ne(t,"blur",t,e),t.state.focused=!1,C(t.display.wrapper,"CodeMirror-focused")),clearInterval(t.display.blinker),setTimeout(function(){t.state.focused||(t.display.shift=!1)},150))}function _r(t){for(var e=t.display,i=e.lineDiv.offsetTop,r=0;r<e.view.length;r++){var n=e.view[r],o=t.options.lineWrapping,s=void 0,a=0;if(!n.hidden){if(T&&k<8){var l=n.node.offsetTop+n.node.offsetHeight;s=l-i,i=l}else{var c=n.node.getBoundingClientRect();s=c.bottom-c.top,!o&&n.text.firstChild&&(a=n.text.firstChild.getBoundingClientRect().right-c.left-1)}var h=n.line.height-s;if(s<2&&(s=Ji(e)),(.005<h||h<-.005)&&(ut(n.line,s),vr(n.line),n.rest))for(var u=0;u<n.rest.length;u++)vr(n.rest[u]);if(a>t.display.sizerWidth){var f=Math.ceil(a/tr(t.display));f>t.display.maxLineLength&&(t.display.maxLineLength=f,t.display.maxLine=n.line,t.display.maxLineChanged=!0)}}}}function vr(t){if(t.widgets)for(var e=0;e<t.widgets.length;++e){var i=t.widgets[e],r=i.node.parentNode;r&&(i.height=r.offsetHeight)}}function yr(t,e,i){var r=i&&null!=i.top?Math.max(0,i.top):t.scroller.scrollTop;r=Math.floor(r-Ti(t));var n=i&&null!=i.bottom?i.bottom:r+t.wrapper.clientHeight,o=dt(e,r),s=dt(e,n);if(i&&i.ensure){var a=i.ensure.from.line,l=i.ensure.to.line;a<o?s=dt(e,Yt(lt(e,o=a))+t.wrapper.clientHeight):Math.min(l,e.lastLine())>=s&&(o=dt(e,Yt(lt(e,l))-t.wrapper.clientHeight),s=l)}return{from:o,to:Math.max(s,o+1)}}function xr(t){var e=t.display,i=e.view;if(e.alignWidgets||e.gutters.firstChild&&t.options.fixedGutter){for(var r=ir(e)-e.scroller.scrollLeft+t.doc.scrollLeft,n=e.gutters.offsetWidth,o=r+"px",s=0;s<i.length;s++)if(!i[s].hidden){t.options.fixedGutter&&(i[s].gutter&&(i[s].gutter.style.left=o),i[s].gutterBackground&&(i[s].gutterBackground.style.left=o));var a=i[s].alignable;if(a)for(var l=0;l<a.length;l++)a[l].style.left=o}t.options.fixedGutter&&(e.gutters.style.left=r+n+"px")}}function Tr(t){if(!t.options.lineNumbers)return!1;var e=t.doc,i=mt(t.options,e.first+e.size-1),r=t.display;if(i.length==r.lineNumChars)return!1;var n=r.measure.appendChild(N("div",[N("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=n.firstChild.offsetWidth,s=n.offsetWidth-o;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(o,r.lineGutter.offsetWidth-s)+1,r.lineNumWidth=r.lineNumInnerWidth+s,r.lineNumChars=r.lineNumInnerWidth?i.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",an(t),!0}function kr(t,e){var i=t.display,r=Ji(t.display);e.top<0&&(e.top=0);var n=t.curOp&&null!=t.curOp.scrollTop?t.curOp.scrollTop:i.scroller.scrollTop,o=Ci(t),s={};e.bottom-e.top>o&&(e.bottom=e.top+o);var a=t.doc.height+ki(i),l=e.top<r,c=e.bottom>a-r;if(e.top<n)s.scrollTop=l?0:e.top;else if(e.bottom>n+o){var h=Math.min(e.top,(c?a:e.bottom)-o);h!=n&&(s.scrollTop=h)}var u=t.curOp&&null!=t.curOp.scrollLeft?t.curOp.scrollLeft:i.scroller.scrollLeft,f=Ei(t)-(t.options.fixedGutter?i.gutters.offsetWidth:0),d=e.right-e.left>f;return d&&(e.right=e.left+f),e.left<10?s.scrollLeft=0:e.left<u?s.scrollLeft=Math.max(0,e.left-(d?0:10)):e.right>f+u-3&&(s.scrollLeft=e.right+(d?0:10)-f),s}function br(t,e){null!=e&&(Cr(t),t.curOp.scrollTop=(null==t.curOp.scrollTop?t.doc.scrollTop:t.curOp.scrollTop)+e)}function wr(t){Cr(t);var e=t.getCursor();t.curOp.scrollToPos={from:e,to:e,margin:t.options.cursorScrollMargin}}function Er(t,e,i){null==e&&null==i||Cr(t),null!=e&&(t.curOp.scrollLeft=e),null!=i&&(t.curOp.scrollTop=i)}function Cr(t){var e=t.curOp.scrollToPos;e&&(t.curOp.scrollToPos=null,Sr(t,Vi(t,e.from),Vi(t,e.to),e.margin))}function Sr(t,e,i,r){var n=kr(t,{left:Math.min(e.left,i.left),top:Math.min(e.top,i.top)-r,right:Math.max(e.right,i.right),bottom:Math.max(e.bottom,i.bottom)+r});Er(t,n.scrollLeft,n.scrollTop)}function Ar(t,e){Math.abs(t.doc.scrollTop-e)<2||(m||sn(t,{top:e}),Lr(t,e,!0),m&&sn(t),tn(t,100))}function Lr(t,e,i){e=Math.min(t.display.scroller.scrollHeight-t.display.scroller.clientHeight,e),(t.display.scroller.scrollTop!=e||i)&&(t.doc.scrollTop=e,t.display.scrollbars.setScrollTop(e),t.display.scroller.scrollTop!=e&&(t.display.scroller.scrollTop=e))}function Nr(t,e,i,r){e=Math.min(e,t.display.scroller.scrollWidth-t.display.scroller.clientWidth),(i?e==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-e)<2)&&!r||(t.doc.scrollLeft=e,xr(t),t.display.scroller.scrollLeft!=e&&(t.display.scroller.scrollLeft=e),t.display.scrollbars.setScrollLeft(e))}function Or(t){var e=t.display,i=e.gutters.offsetWidth,r=Math.round(t.doc.height+ki(t.display));return{clientHeight:e.scroller.clientHeight,viewHeight:e.wrapper.clientHeight,scrollWidth:e.scroller.scrollWidth,clientWidth:e.scroller.clientWidth,viewWidth:e.wrapper.clientWidth,barLeft:t.options.fixedGutter?i:0,docHeight:r,scrollHeight:r+wi(t)+e.barHeight,nativeBarWidth:e.nativeBarWidth,gutterWidth:i}}var Ir=function(t,e,i){this.cm=i;var r=this.vert=N("div",[N("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=N("div",[N("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,t(r),t(n),ee(r,"scroll",function(){r.clientHeight&&e(r.scrollTop,"vertical")}),ee(n,"scroll",function(){n.clientWidth&&e(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,T&&k<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Ir.prototype.update=function(t){var e=t.scrollWidth>t.clientWidth+1,i=t.scrollHeight>t.clientHeight+1,r=t.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=e?r+"px":"0";var n=t.viewHeight-(e?r:0);this.vert.firstChild.style.height=Math.max(0,t.scrollHeight-t.clientHeight+n)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(e){this.horiz.style.display="block",this.horiz.style.right=i?r+"px":"0",this.horiz.style.left=t.barLeft+"px";var o=t.viewWidth-t.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,t.scrollWidth-t.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&0<t.clientHeight&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:i?r:0,bottom:e?r:0}},Ir.prototype.setScrollLeft=function(t){this.horiz.scrollLeft!=t&&(this.horiz.scrollLeft=t),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Ir.prototype.setScrollTop=function(t){this.vert.scrollTop!=t&&(this.vert.scrollTop=t),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Ir.prototype.zeroWidthHack=function(){var t=x&&!a?"12px":"18px";this.horiz.style.height=this.vert.style.width=t,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new U,this.disableVert=new U},Ir.prototype.enableZeroWidthBar=function(i,r,n){i.style.pointerEvents="auto",r.set(1e3,function t(){var e=i.getBoundingClientRect();("vert"==n?document.elementFromPoint(e.right-1,(e.top+e.bottom)/2):document.elementFromPoint((e.right+e.left)/2,e.bottom-1))!=i?i.style.pointerEvents="none":r.set(1e3,t)})},Ir.prototype.clear=function(){var t=this.horiz.parentNode;t.removeChild(this.horiz),t.removeChild(this.vert)};var Rr=function(){};function Mr(t,e){e||(e=Or(t));var i=t.display.barWidth,r=t.display.barHeight;Dr(t,e);for(var n=0;n<4&&i!=t.display.barWidth||r!=t.display.barHeight;n++)i!=t.display.barWidth&&t.options.lineWrapping&&_r(t),Dr(t,Or(t)),i=t.display.barWidth,r=t.display.barHeight}function Dr(t,e){var i=t.display,r=i.scrollbars.update(e);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=e.gutterWidth+"px"):i.gutterFiller.style.display=""}Rr.prototype.update=function(){return{bottom:0,right:0}},Rr.prototype.setScrollLeft=function(){},Rr.prototype.setScrollTop=function(){},Rr.prototype.clear=function(){};var Pr={native:Ir,null:Rr};function Br(i){i.display.scrollbars&&(i.display.scrollbars.clear(),i.display.scrollbars.addClass&&C(i.display.wrapper,i.display.scrollbars.addClass)),i.display.scrollbars=new Pr[i.options.scrollbarStyle](function(t){i.display.wrapper.insertBefore(t,i.display.scrollbarFiller),ee(t,"mousedown",function(){i.state.focused&&setTimeout(function(){return i.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,e){"horizontal"==e?Nr(i,t):Ar(i,t)},i),i.display.scrollbars.addClass&&R(i.display.wrapper,i.display.scrollbars.addClass)}var Fr=0;function Ur(t){var e;t.curOp={cm:t,viewChanged:!1,startHeight:t.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Fr},e=t.curOp,oi?oi.ops.push(e):e.ownsGroup=oi={ops:[e],delayedCallbacks:[]}}function Hr(t){var e=t.curOp;e&&function(t,e){var i=t.ownsGroup;if(i)try{!function(t){var e=t.delayedCallbacks,i=0;do{for(;i<e.length;i++)e[i].call(null);for(var r=0;r<t.ops.length;r++){var n=t.ops[r];if(n.cursorActivityHandlers)for(;n.cursorActivityCalled<n.cursorActivityHandlers.length;)n.cursorActivityHandlers[n.cursorActivityCalled++].call(null,n.cm)}}while(i<e.length)}(i)}finally{oi=null,e(i)}}(e,function(t){for(var e=0;e<t.ops.length;e++)t.ops[e].cm.curOp=null;!function(t){for(var e=t.ops,i=0;i<e.length;i++)Wr(e[i]);for(var r=0;r<e.length;r++)(n=e[r]).updatedDisplay=n.mustUpdate&&nn(n.cm,n.update);var n;for(var o=0;o<e.length;o++)zr(e[o]);for(var s=0;s<e.length;s++)qr(e[s]);for(var a=0;a<e.length;a++)Gr(e[a])}(t)})}function Wr(t){var e,i,r=t.cm,n=r.display;!(i=(e=r).display).scrollbarsClipped&&i.scroller.offsetWidth&&(i.nativeBarWidth=i.scroller.offsetWidth-i.scroller.clientWidth,i.heightForcer.style.height=wi(e)+"px",i.sizer.style.marginBottom=-i.nativeBarWidth+"px",i.sizer.style.borderRightWidth=wi(e)+"px",i.scrollbarsClipped=!0),t.updateMaxLine&&$t(r),t.mustUpdate=t.viewChanged||t.forceUpdate||null!=t.scrollTop||t.scrollToPos&&(t.scrollToPos.from.line<n.viewFrom||t.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&r.options.lineWrapping,t.update=t.mustUpdate&&new rn(r,t.mustUpdate&&{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate)}function zr(t){var e=t.cm,i=e.display;t.updatedDisplay&&_r(e),t.barMeasure=Or(e),i.maxLineChanged&&!e.options.lineWrapping&&(t.adjustWidthTo=Ai(e,i.maxLine,i.maxLine.text.length).left+3,e.display.sizerWidth=t.adjustWidthTo,t.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+t.adjustWidthTo+wi(e)+e.display.barWidth),t.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+t.adjustWidthTo-Ei(e))),(t.updatedDisplay||t.selectionChanged)&&(t.preparedSelection=i.input.prepareSelection())}function qr(t){var e=t.cm;null!=t.adjustWidthTo&&(e.display.sizer.style.minWidth=t.adjustWidthTo+"px",t.maxScrollLeft<e.doc.scrollLeft&&Nr(e,Math.min(e.display.scroller.scrollLeft,t.maxScrollLeft),!0),e.display.maxLineChanged=!1);var i=t.focus&&t.focus==I();t.preparedSelection&&e.display.input.showSelection(t.preparedSelection,i),(t.updatedDisplay||t.startHeight!=e.doc.height)&&Mr(e,t.barMeasure),t.updatedDisplay&&ln(e,t.barMeasure),t.selectionChanged&&fr(e),e.state.focused&&t.updateInput&&e.display.input.reset(t.typing),i&&dr(t.cm)}function Gr(t){var e=t.cm,i=e.display,r=e.doc;(t.updatedDisplay&&on(e,t.update),null==i.wheelStartX||null==t.scrollTop&&null==t.scrollLeft&&!t.scrollToPos||(i.wheelStartX=i.wheelStartY=null),null!=t.scrollTop&&Lr(e,t.scrollTop,t.forceScroll),null!=t.scrollLeft&&Nr(e,t.scrollLeft,!0,!0),t.scrollToPos)&&function(t,e){if(!oe(t,"scrollCursorIntoView")){var i=t.display,r=i.sizer.getBoundingClientRect(),n=null;if(e.top+r.top<0?n=!0:e.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(n=!1),null!=n&&!c){var o=N("div","​",null,"position: absolute;\n top: "+(e.top-i.viewOffset-Ti(t.display))+"px;\n height: "+(e.bottom-e.top+wi(t)+i.barHeight)+"px;\n left: "+e.left+"px; width: "+Math.max(2,e.right-e.left)+"px;");t.display.lineSpace.appendChild(o),o.scrollIntoView(n),t.display.lineSpace.removeChild(o)}}}(e,function(t,e,i,r){var n;null==r&&(r=0),t.options.lineWrapping||e!=i||(i="before"==(e=e.ch?gt(e.line,"before"==e.sticky?e.ch-1:e.ch,"after"):e).sticky?gt(e.line,e.ch+1,"before"):e);for(var o=0;o<5;o++){var s=!1,a=ji(t,e),l=i&&i!=e?ji(t,i):a,c=kr(t,n={left:Math.min(a.left,l.left),top:Math.min(a.top,l.top)-r,right:Math.max(a.left,l.left),bottom:Math.max(a.bottom,l.bottom)+r}),h=t.doc.scrollTop,u=t.doc.scrollLeft;if(null!=c.scrollTop&&(Ar(t,c.scrollTop),1<Math.abs(t.doc.scrollTop-h)&&(s=!0)),null!=c.scrollLeft&&(Nr(t,c.scrollLeft),1<Math.abs(t.doc.scrollLeft-u)&&(s=!0)),!s)break}return n}(e,bt(r,t.scrollToPos.from),bt(r,t.scrollToPos.to),t.scrollToPos.margin));var n=t.maybeHiddenMarkers,o=t.maybeUnhiddenMarkers;if(n)for(var s=0;s<n.length;++s)n[s].lines.length||ne(n[s],"hide");if(o)for(var a=0;a<o.length;++a)o[a].lines.length&&ne(o[a],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=e.display.scroller.scrollTop),t.changeObjs&&ne(e,"changes",e,t.changeObjs),t.update&&t.update.finish()}function jr(t,e){if(t.curOp)return e();Ur(t);try{return e()}finally{Hr(t)}}function Vr(t,e){return function(){if(t.curOp)return e.apply(t,arguments);Ur(t);try{return e.apply(t,arguments)}finally{Hr(t)}}}function Yr(t){return function(){if(this.curOp)return t.apply(this,arguments);Ur(this);try{return t.apply(this,arguments)}finally{Hr(this)}}}function Kr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Ur(t);try{return e.apply(this,arguments)}finally{Hr(t)}}}function $r(t,e,i,r){null==e&&(e=t.doc.first),null==i&&(i=t.doc.first+t.doc.size),r||(r=0);var n=t.display;if(r&&i<n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>e)&&(n.updateLineNumbers=e),t.curOp.viewChanged=!0,e>=n.viewTo)Ct&&qt(t.doc,e)<n.viewTo&&Xr(t);else if(i<=n.viewFrom)Ct&&Gt(t.doc,i+r)>n.viewFrom?Xr(t):(n.viewFrom+=r,n.viewTo+=r);else if(e<=n.viewFrom&&i>=n.viewTo)Xr(t);else if(e<=n.viewFrom){var o=Zr(t,i,i+r,1);o?(n.view=n.view.slice(o.index),n.viewFrom=o.lineN,n.viewTo+=r):Xr(t)}else if(i>=n.viewTo){var s=Zr(t,e,e,-1);s?(n.view=n.view.slice(0,s.index),n.viewTo=s.lineN):Xr(t)}else{var a=Zr(t,e,e,-1),l=Zr(t,i,i+r,1);a&&l?(n.view=n.view.slice(0,a.index).concat(ni(t,a.lineN,l.lineN)).concat(n.view.slice(l.index)),n.viewTo+=r):Xr(t)}var c=n.externalMeasured;c&&(i<c.lineN?c.lineN+=r:e<c.lineN+c.size&&(n.externalMeasured=null))}function Qr(t,e,i){t.curOp.viewChanged=!0;var r=t.display,n=t.display.externalMeasured;if(n&&e>=n.lineN&&e<n.lineN+n.size&&(r.externalMeasured=null),!(e<r.viewFrom||e>=r.viewTo)){var o=r.view[sr(t,e)];if(null!=o.node){var s=o.changes||(o.changes=[]);-1==H(s,i)&&s.push(i)}}}function Xr(t){t.display.viewFrom=t.display.viewTo=t.doc.first,t.display.view=[],t.display.viewOffset=0}function Zr(t,e,i,r){var n,o=sr(t,e),s=t.display.view;if(!Ct||i==t.doc.first+t.doc.size)return{index:o,lineN:i};for(var a=t.display.viewFrom,l=0;l<o;l++)a+=s[l].size;if(a!=e){if(0<r){if(o==s.length-1)return null;n=a+s[o].size-e,o++}else n=a-e;e+=n,i+=n}for(;qt(t.doc,i)!=i;){if(o==(r<0?0:s.length-1))return null;i+=r*s[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:i}}function Jr(t){for(var e=t.display.view,i=0,r=0;r<e.length;r++){var n=e[r];n.hidden||n.node&&!n.changes||++i}return i}function tn(t,e){t.doc.highlightFrontier<t.display.viewTo&&t.state.highlight.set(e,P(en,t))}function en(l){var c=l.doc;if(!(c.highlightFrontier>=l.display.viewTo)){var h=+new Date+l.options.workTime,u=Ue(l,c.highlightFrontier),f=[];c.iter(u.line,Math.min(c.first+c.size,l.display.viewTo+500),function(t){if(u.line>=l.display.viewFrom){var e=t.styles,i=t.text.length>l.options.maxHighlightLength?Oe(c.mode,u.state):null,r=Be(l,t,u,!0);i&&(u.state=i),t.styles=r.styles;var n=t.styleClasses,o=r.classes;o?t.styleClasses=o:n&&(t.styleClasses=null);for(var s=!e||e.length!=t.styles.length||n!=o&&(!n||!o||n.bgClass!=o.bgClass||n.textClass!=o.textClass),a=0;!s&&a<e.length;++a)s=e[a]!=t.styles[a];s&&f.push(u.line),t.stateAfter=u.save(),u.nextLine()}else t.text.length<=l.options.maxHighlightLength&&He(l,t.text,u),t.stateAfter=u.line%5==0?u.save():null,u.nextLine();if(+new Date>h)return tn(l,l.options.workDelay),!0}),c.highlightFrontier=u.line,c.modeFrontier=Math.max(c.modeFrontier,u.line),f.length&&jr(l,function(){for(var t=0;t<f.length;t++)Qr(l,f[t],"text")})}}var rn=function(t,e,i){var r=t.display;this.viewport=e,this.visible=yr(r,t.doc,e),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Ei(t),this.force=i,this.dims=er(t),this.events=[]};function nn(t,e){var i=t.display,r=t.doc;if(e.editorIsHidden)return Xr(t),!1;if(!e.force&&e.visible.from>=i.viewFrom&&e.visible.to<=i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&0==Jr(t))return!1;Tr(t)&&(Xr(t),e.dims=er(t));var n=r.first+r.size,o=Math.max(e.visible.from-t.options.viewportMargin,r.first),s=Math.min(n,e.visible.to+t.options.viewportMargin);i.viewFrom<o&&o-i.viewFrom<20&&(o=Math.max(r.first,i.viewFrom)),i.viewTo>s&&i.viewTo-s<20&&(s=Math.min(n,i.viewTo)),Ct&&(o=qt(t.doc,o),s=Gt(t.doc,s));var a,l,c,h,u=o!=i.viewFrom||s!=i.viewTo||i.lastWrapHeight!=e.wrapperHeight||i.lastWrapWidth!=e.wrapperWidth;l=o,c=s,0==(h=(a=t).display).view.length||l>=h.viewTo||c<=h.viewFrom?(h.view=ni(a,l,c),h.viewFrom=l):(h.viewFrom>l?h.view=ni(a,l,h.viewFrom).concat(h.view):h.viewFrom<l&&(h.view=h.view.slice(sr(a,l))),h.viewFrom=l,h.viewTo<c?h.view=h.view.concat(ni(a,h.viewTo,c)):h.viewTo>c&&(h.view=h.view.slice(0,sr(a,c)))),h.viewTo=c,i.viewOffset=Yt(lt(t.doc,i.viewFrom)),t.display.mover.style.top=i.viewOffset+"px";var f=Jr(t);if(!u&&0==f&&!e.force&&i.renderedView==i.view&&(null==i.updateLineNumbers||i.updateLineNumbers>=i.viewTo))return!1;var d=function(t){if(t.hasFocus())return null;var e=I();if(!e||!O(t.display.lineDiv,e))return null;var i={activeElt:e};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&O(t.display.lineDiv,r.anchorNode)&&(i.anchorNode=r.anchorNode,i.anchorOffset=r.anchorOffset,i.focusNode=r.focusNode,i.focusOffset=r.focusOffset)}return i}(t);return 4<f&&(i.lineDiv.style.display="none"),function(i,t,e){var r=i.display,n=i.options.lineNumbers,o=r.lineDiv,s=o.firstChild;function a(t){var e=t.nextSibling;return y&&x&&i.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),e}for(var l=r.view,c=r.viewFrom,h=0;h<l.length;h++){var u=l[h];if(u.hidden);else if(u.node&&u.node.parentNode==o){for(;s!=u.node;)s=a(s);var f=n&&null!=t&&t<=c&&u.lineNumber;u.changes&&(-1<H(u.changes,"gutter")&&(f=!1),ci(i,u,c,e)),f&&(S(u.lineNumber),u.lineNumber.appendChild(document.createTextNode(mt(i.options,c)))),s=u.node.nextSibling}else{var d=(g=c,_=e,void 0,v=ui(p=i,m=u),m.text=m.node=v.pre,v.bgClass&&(m.bgClass=v.bgClass),v.textClass&&(m.textClass=v.textClass),di(p,m),pi(p,m,g,_),gi(p,m,_),m.node);o.insertBefore(d,s)}c+=u.size}var p,m,g,_,v;for(;s;)s=a(s)}(t,i.updateLineNumbers,e.dims),4<f&&(i.lineDiv.style.display=""),i.renderedView=i.view,function(t){if(t&&t.activeElt&&t.activeElt!=I()&&(t.activeElt.focus(),t.anchorNode&&O(document.body,t.anchorNode)&&O(document.body,t.focusNode))){var e=window.getSelection(),i=document.createRange();i.setEnd(t.anchorNode,t.anchorOffset),i.collapse(!1),e.removeAllRanges(),e.addRange(i),e.extend(t.focusNode,t.focusOffset)}}(d),S(i.cursorDiv),S(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,u&&(i.lastWrapHeight=e.wrapperHeight,i.lastWrapWidth=e.wrapperWidth,tn(t,400)),!(i.updateLineNumbers=null)}function on(t,e){for(var i=e.viewport,r=!0;(r&&t.options.lineWrapping&&e.oldDisplayWidth!=Ei(t)||(i&&null!=i.top&&(i={top:Math.min(t.doc.height+ki(t.display)-Ci(t),i.top)}),e.visible=yr(t.display,t.doc,i),!(e.visible.from>=t.display.viewFrom&&e.visible.to<=t.display.viewTo)))&&nn(t,e);r=!1){_r(t);var n=Or(t);ar(t),Mr(t,n),ln(t,n),e.force=!1}e.signal(t,"update",t),t.display.viewFrom==t.display.reportedViewFrom&&t.display.viewTo==t.display.reportedViewTo||(e.signal(t,"viewportChange",t,t.display.viewFrom,t.display.viewTo),t.display.reportedViewFrom=t.display.viewFrom,t.display.reportedViewTo=t.display.viewTo)}function sn(t,e){var i=new rn(t,e);if(nn(t,i)){_r(t),on(t,i);var r=Or(t);ar(t),Mr(t,r),ln(t,r),i.finish()}}function an(t){var e=t.display.gutters.offsetWidth;t.display.sizer.style.marginLeft=e+"px"}function ln(t,e){t.display.sizer.style.minHeight=e.docHeight+"px",t.display.heightForcer.style.top=e.docHeight+"px",t.display.gutters.style.height=e.docHeight+t.display.barHeight+wi(t)+"px"}function cn(t){var e=t.display.gutters,i=t.options.gutters;S(e);for(var r=0;r<i.length;++r){var n=i[r],o=e.appendChild(N("div",null,"CodeMirror-gutter "+n));"CodeMirror-linenumbers"==n&&((t.display.lineGutter=o).style.width=(t.display.lineNumWidth||1)+"px")}e.style.display=r?"":"none",an(t)}function hn(t){var e=H(t.gutters,"CodeMirror-linenumbers");-1==e&&t.lineNumbers?t.gutters=t.gutters.concat(["CodeMirror-linenumbers"]):-1<e&&!t.lineNumbers&&(t.gutters=t.gutters.slice(0),t.gutters.splice(e,1))}rn.prototype.signal=function(t,e){ae(t,e)&&this.events.push(arguments)},rn.prototype.finish=function(){for(var t=0;t<this.events.length;t++)ne.apply(null,this.events[t])};var un=0,fn=null;function dn(t){var e=t.wheelDeltaX,i=t.wheelDeltaY;return null==e&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(e=t.detail),null==i&&t.detail&&t.axis==t.VERTICAL_AXIS?i=t.detail:null==i&&(i=t.wheelDelta),{x:e,y:i}}function pn(t){var e=dn(t);return e.x*=fn,e.y*=fn,e}function mn(t,e){var i=dn(e),r=i.x,n=i.y,o=t.display,s=o.scroller,a=s.scrollWidth>s.clientWidth,l=s.scrollHeight>s.clientHeight;if(r&&a||n&&l){if(n&&x&&y)t:for(var c=e.target,h=o.view;c!=s;c=c.parentNode)for(var u=0;u<h.length;u++)if(h[u].node==c){t.display.currentWheelTarget=c;break t}if(r&&!m&&!g&&null!=fn)return n&&l&&Ar(t,Math.max(0,s.scrollTop+n*fn)),Nr(t,Math.max(0,s.scrollLeft+r*fn)),(!n||n&&l)&&ce(e),void(o.wheelStartX=null);if(n&&null!=fn){var f=n*fn,d=t.doc.scrollTop,p=d+o.wrapper.clientHeight;f<0?d=Math.max(0,d+f-50):p=Math.min(t.doc.height,p+f+50),sn(t,{top:d,bottom:p})}un<20&&(null==o.wheelStartX?(o.wheelStartX=s.scrollLeft,o.wheelStartY=s.scrollTop,o.wheelDX=r,o.wheelDY=n,setTimeout(function(){if(null!=o.wheelStartX){var t=s.scrollLeft-o.wheelStartX,e=s.scrollTop-o.wheelStartY,i=e&&o.wheelDY&&e/o.wheelDY||t&&o.wheelDX&&t/o.wheelDX;o.wheelStartX=o.wheelStartY=null,i&&(fn=(fn*un+i)/(un+1),++un)}},200)):(o.wheelDX+=r,o.wheelDY+=n))}}T?fn=-.53:m?fn=15:s?fn=-.7:l&&(fn=-1/3);var gn=function(t,e){this.ranges=t,this.primIndex=e};gn.prototype.primary=function(){return this.ranges[this.primIndex]},gn.prototype.equals=function(t){if(t==this)return!0;if(t.primIndex!=this.primIndex||t.ranges.length!=this.ranges.length)return!1;for(var e=0;e<this.ranges.length;e++){var i=this.ranges[e],r=t.ranges[e];if(!vt(i.anchor,r.anchor)||!vt(i.head,r.head))return!1}return!0},gn.prototype.deepCopy=function(){for(var t=[],e=0;e<this.ranges.length;e++)t[e]=new _n(yt(this.ranges[e].anchor),yt(this.ranges[e].head));return new gn(t,this.primIndex)},gn.prototype.somethingSelected=function(){for(var t=0;t<this.ranges.length;t++)if(!this.ranges[t].empty())return!0;return!1},gn.prototype.contains=function(t,e){e||(e=t);for(var i=0;i<this.ranges.length;i++){var r=this.ranges[i];if(0<=_t(e,r.from())&&_t(t,r.to())<=0)return i}return-1};var _n=function(t,e){this.anchor=t,this.head=e};function vn(t,e,i){var r=t&&t.options.selectionsMayTouch,n=e[i];e.sort(function(t,e){return _t(t.from(),e.from())}),i=H(e,n);for(var o=1;o<e.length;o++){var s=e[o],a=e[o-1],l=_t(a.to(),s.from());if(r&&!s.empty()?0<l:0<=l){var c=Tt(a.from(),s.from()),h=xt(a.to(),s.to()),u=a.empty()?s.from()==s.head:a.from()==a.head;o<=i&&--i,e.splice(--o,2,new _n(u?h:c,u?c:h))}}return new gn(e,i)}function yn(t,e){return new gn([new _n(t,e||t)],0)}function xn(t){return t.text?gt(t.from.line+t.text.length-1,$(t.text).length+(1==t.text.length?t.from.ch:0)):t.to}function Tn(t,e){if(_t(t,e.from)<0)return t;if(_t(t,e.to)<=0)return xn(e);var i=t.line+e.text.length-(e.to.line-e.from.line)-1,r=t.ch;return t.line==e.to.line&&(r+=xn(e).ch-e.to.ch),gt(i,r)}function kn(t,e){for(var i=[],r=0;r<t.sel.ranges.length;r++){var n=t.sel.ranges[r];i.push(new _n(Tn(n.anchor,e),Tn(n.head,e)))}return vn(t.cm,i,t.sel.primIndex)}function bn(t,e,i){return t.line==e.line?gt(i.line,t.ch-e.ch+i.ch):gt(i.line+(t.line-e.line),t.ch)}function wn(t){t.doc.mode=Ae(t.options,t.doc.modeOption),En(t)}function En(t){t.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),t.doc.modeFrontier=t.doc.highlightFrontier=t.doc.first,tn(t,100),t.state.modeGen++,t.curOp&&$r(t)}function Cn(t,e){return 0==e.from.ch&&0==e.to.ch&&""==$(e.text)&&(!t.cm||t.cm.options.wholeLineUpdateBefore)}function Sn(t,r,e,n){function o(t){return e?e[t]:null}function i(t,e,i){!function(t,e,i,r){t.text=e,t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null),null!=t.order&&(t.order=null),It(t),Rt(t,i);var n=r?r(t):1;n!=t.height&&ut(t,n)}(t,e,i,n),ai(t,"change",t,r)}function s(t,e){for(var i=[],r=t;r<e;++r)i.push(new Ye(c[r],o(r),n));return i}var a=r.from,l=r.to,c=r.text,h=lt(t,a.line),u=lt(t,l.line),f=$(c),d=o(c.length-1),p=l.line-a.line;if(r.full)t.insert(0,s(0,c.length)),t.remove(c.length,t.size-c.length);else if(Cn(t,r)){var m=s(0,c.length-1);i(u,u.text,d),p&&t.remove(a.line,p),m.length&&t.insert(a.line,m)}else if(h==u)if(1==c.length)i(h,h.text.slice(0,a.ch)+f+h.text.slice(l.ch),d);else{var g=s(1,c.length-1);g.push(new Ye(f+h.text.slice(l.ch),d,n)),i(h,h.text.slice(0,a.ch)+c[0],o(0)),t.insert(a.line+1,g)}else if(1==c.length)i(h,h.text.slice(0,a.ch)+c[0]+u.text.slice(l.ch),o(0)),t.remove(a.line+1,p);else{i(h,h.text.slice(0,a.ch)+c[0],o(0)),i(u,f+u.text.slice(l.ch),d);var _=s(1,c.length-1);1<p&&t.remove(a.line+1,p-1),t.insert(a.line+1,_)}ai(t,"change",t,r)}function An(t,a,l){!function t(e,i,r){if(e.linked)for(var n=0;n<e.linked.length;++n){var o=e.linked[n];if(o.doc!=i){var s=r&&o.sharedHist;l&&!s||(a(o.doc,s),t(o.doc,e,s))}}}(t,null,!0)}function Ln(t,e){if(e.cm)throw new Error("This document is already in use.");nr((t.doc=e).cm=t),wn(t),Nn(t),t.options.lineWrapping||$t(t),t.options.mode=e.modeOption,$r(t)}function Nn(t){("rtl"==t.doc.direction?R:C)(t.display.lineDiv,"CodeMirror-rtl")}function On(t){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=t||1}function In(t,e){var i={from:yt(e.from),to:xn(e),text:ct(t,e.from,e.to)};return Bn(t,i,e.from.line,e.to.line+1),An(t,function(t){return Bn(t,i,e.from.line,e.to.line+1)},!0),i}function Rn(t){for(;t.length;){if(!$(t).ranges)break;t.pop()}}function Mn(t,e,i,r){var n=t.history;n.undone.length=0;var o,s,a,l=+new Date;if((n.lastOp==r||n.lastOrigin==e.origin&&e.origin&&("+"==e.origin.charAt(0)&&n.lastModTime>l-(t.cm?t.cm.options.historyEventDelay:500)||"*"==e.origin.charAt(0)))&&(o=(a=n).lastOp==r?(Rn(a.done),$(a.done)):a.done.length&&!$(a.done).ranges?$(a.done):1<a.done.length&&!a.done[a.done.length-2].ranges?(a.done.pop(),$(a.done)):void 0))s=$(o.changes),0==_t(e.from,e.to)&&0==_t(e.from,s.to)?s.to=xn(e):o.changes.push(In(t,e));else{var c=$(n.done);for(c&&c.ranges||Pn(t.sel,n.done),o={changes:[In(t,e)],generation:n.generation},n.done.push(o);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=l,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=e.origin,s||ne(t,"historyAdded")}function Dn(t,e,i,r){var n,o,s,a,l,c=t.history,h=r&&r.origin;i==c.lastSelOp||h&&c.lastSelOrigin==h&&(c.lastModTime==c.lastSelTime&&c.lastOrigin==h||(n=t,o=h,s=$(c.done),a=e,"*"==(l=o.charAt(0))||"+"==l&&s.ranges.length==a.ranges.length&&s.somethingSelected()==a.somethingSelected()&&new Date-n.history.lastSelTime<=(n.cm?n.cm.options.historyEventDelay:500)))?c.done[c.done.length-1]=e:Pn(e,c.done),c.lastSelTime=+new Date,c.lastSelOrigin=h,c.lastSelOp=i,r&&!1!==r.clearRedo&&Rn(c.undone)}function Pn(t,e){var i=$(e);i&&i.ranges&&i.equals(t)||e.push(t)}function Bn(e,i,t,r){var n=i["spans_"+e.id],o=0;e.iter(Math.max(e.first,t),Math.min(e.first+e.size,r),function(t){t.markedSpans&&((n||(n=i["spans_"+e.id]={}))[o]=t.markedSpans),++o})}function Fn(t){if(!t)return null;for(var e,i=0;i<t.length;++i)t[i].marker.explicitlyCleared?e||(e=t.slice(0,i)):e&&e.push(t[i]);return e?e.length?e:null:t}function Un(t,e){var i=function(t,e){var i=e["spans_"+t.id];if(!i)return null;for(var r=[],n=0;n<e.text.length;++n)r.push(Fn(i[n]));return r}(t,e),r=Nt(t,e);if(!i)return r;if(!r)return i;for(var n=0;n<i.length;++n){var o=i[n],s=r[n];if(o&&s)t:for(var a=0;a<s.length;++a){for(var l=s[a],c=0;c<o.length;++c)if(o[c].marker==l.marker)continue t;o.push(l)}else s&&(i[n]=s)}return i}function Hn(t,e,i){for(var r=[],n=0;n<t.length;++n){var o=t[n];if(o.ranges)r.push(i?gn.prototype.deepCopy.call(o):o);else{var s=o.changes,a=[];r.push({changes:a});for(var l=0;l<s.length;++l){var c=s[l],h=void 0;if(a.push({from:c.from,to:c.to,text:c.text}),e)for(var u in c)(h=u.match(/^spans_(\d+)$/))&&-1<H(e,Number(h[1]))&&($(a)[u]=c[u],delete c[u])}}}return r}function Wn(t,e,i,r){if(r){var n=t.anchor;if(i){var o=_t(e,n)<0;o!=_t(i,n)<0?(n=e,e=i):o!=_t(e,i)<0&&(e=i)}return new _n(n,e)}return new _n(i||e,e)}function zn(t,e,i,r,n){null==n&&(n=t.cm&&(t.cm.display.shift||t.extend)),Yn(t,new gn([Wn(t.sel.primary(),e,i,n)],0),r)}function qn(t,e,i){for(var r=[],n=t.cm&&(t.cm.display.shift||t.extend),o=0;o<t.sel.ranges.length;o++)r[o]=Wn(t.sel.ranges[o],e[o],null,n);Yn(t,vn(t.cm,r,t.sel.primIndex),i)}function Gn(t,e,i,r){var n=t.sel.ranges.slice(0);n[e]=i,Yn(t,vn(t.cm,n,t.sel.primIndex),r)}function jn(t,e,i,r){Yn(t,yn(e,i),r)}function Vn(t,e,i){var r=t.history.done,n=$(r);n&&n.ranges?Kn(t,r[r.length-1]=e,i):Yn(t,e,i)}function Yn(t,e,i){Kn(t,e,i),Dn(t,t.sel,t.cm?t.cm.curOp.id:NaN,i)}function Kn(t,e,i){var r,n,o,s;(ae(t,"beforeSelectionChange")||t.cm&&ae(t.cm,"beforeSelectionChange"))&&(r=t,o=i,s={ranges:(n=e).ranges,update:function(t){this.ranges=[];for(var e=0;e<t.length;e++)this.ranges[e]=new _n(bt(r,t[e].anchor),bt(r,t[e].head))},origin:o&&o.origin},ne(r,"beforeSelectionChange",r,s),r.cm&&ne(r.cm,"beforeSelectionChange",r.cm,s),e=s.ranges!=n.ranges?vn(r.cm,s.ranges,s.ranges.length-1):n),$n(t,Xn(t,e,i&&i.bias||(_t(e.primary().head,t.sel.primary().head)<0?-1:1),!0)),i&&!1===i.scroll||!t.cm||wr(t.cm)}function $n(t,e){e.equals(t.sel)||(t.sel=e,t.cm&&(t.cm.curOp.updateInput=t.cm.curOp.selectionChanged=!0,se(t.cm)),ai(t,"cursorActivity",t))}function Qn(t){$n(t,Xn(t,t.sel,null,!1))}function Xn(t,e,i,r){for(var n,o=0;o<e.ranges.length;o++){var s=e.ranges[o],a=e.ranges.length==t.sel.ranges.length&&t.sel.ranges[o],l=Jn(t,s.anchor,a&&a.anchor,i,r),c=Jn(t,s.head,a&&a.head,i,r);(n||l!=s.anchor||c!=s.head)&&(n||(n=e.ranges.slice(0,o)),n[o]=new _n(l,c))}return n?vn(t.cm,n,e.primIndex):e}function Zn(t,e,i,r,n){var o=lt(t,e.line);if(o.markedSpans)for(var s=0;s<o.markedSpans.length;++s){var a=o.markedSpans[s],l=a.marker;if((null==a.from||(l.inclusiveLeft?a.from<=e.ch:a.from<e.ch))&&(null==a.to||(l.inclusiveRight?a.to>=e.ch:a.to>e.ch))){if(n&&(ne(l,"beforeCursorEnter"),l.explicitlyCleared)){if(o.markedSpans){--s;continue}break}if(!l.atomic)continue;if(i){var c=l.find(r<0?1:-1),h=void 0;if((r<0?l.inclusiveRight:l.inclusiveLeft)&&(c=to(t,c,-r,c&&c.line==e.line?o:null)),c&&c.line==e.line&&(h=_t(c,i))&&(r<0?h<0:0<h))return Zn(t,c,e,r,n)}var u=l.find(r<0?-1:1);return(r<0?l.inclusiveLeft:l.inclusiveRight)&&(u=to(t,u,r,u.line==e.line?o:null)),u?Zn(t,u,e,r,n):null}}return e}function Jn(t,e,i,r,n){var o=r||1,s=Zn(t,e,i,o,n)||!n&&Zn(t,e,i,o,!0)||Zn(t,e,i,-o,n)||!n&&Zn(t,e,i,-o,!0);return s||(t.cantEdit=!0,gt(t.first,0))}function to(t,e,i,r){return i<0&&0==e.ch?e.line>t.first?bt(t,gt(e.line-1)):null:0<i&&e.ch==(r||lt(t,e.line)).text.length?e.line<t.first+t.size-1?gt(e.line+1,0):null:new gt(e.line,e.ch+i)}function eo(t){t.setSelection(gt(t.firstLine(),0),gt(t.lastLine()),q)}function io(n,t,e){var o={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return o.canceled=!0}};return e&&(o.update=function(t,e,i,r){t&&(o.from=bt(n,t)),e&&(o.to=bt(n,e)),i&&(o.text=i),void 0!==r&&(o.origin=r)}),ne(n,"beforeChange",n,o),n.cm&&ne(n.cm,"beforeChange",n.cm,o),o.canceled?null:{from:o.from,to:o.to,text:o.text,origin:o.origin}}function ro(t,e,i){if(t.cm){if(!t.cm.curOp)return Vr(t.cm,ro)(t,e,i);if(t.cm.state.suppressEdits)return}if(!(ae(t,"beforeChange")||t.cm&&ae(t.cm,"beforeChange"))||(e=io(t,e,!0))){var r=Et&&!i&&function(t,e,i){var r=null;if(t.iter(e.line,i.line+1,function(t){if(t.markedSpans)for(var e=0;e<t.markedSpans.length;++e){var i=t.markedSpans[e].marker;!i.readOnly||r&&-1!=H(r,i)||(r||(r=[])).push(i)}}),!r)return null;for(var n=[{from:e,to:i}],o=0;o<r.length;++o)for(var s=r[o],a=s.find(0),l=0;l<n.length;++l){var c=n[l];if(!(_t(c.to,a.from)<0||0<_t(c.from,a.to))){var h=[l,1],u=_t(c.from,a.from),f=_t(c.to,a.to);(u<0||!s.inclusiveLeft&&!u)&&h.push({from:c.from,to:a.from}),(0<f||!s.inclusiveRight&&!f)&&h.push({from:a.to,to:c.to}),n.splice.apply(n,h),l+=h.length-3}}return n}(t,e.from,e.to);if(r)for(var n=r.length-1;0<=n;--n)no(t,{from:r[n].from,to:r[n].to,text:n?[""]:e.text,origin:e.origin});else no(t,e)}}function no(t,i){if(1!=i.text.length||""!=i.text[0]||0!=_t(i.from,i.to)){var e=kn(t,i);Mn(t,i,e,t.cm?t.cm.curOp.id:NaN),ao(t,i,e,Nt(t,i));var r=[];An(t,function(t,e){e||-1!=H(r,t.history)||(uo(t.history,i),r.push(t.history)),ao(t,i,null,Nt(t,i))})}}function oo(n,o,t){var e=n.cm&&n.cm.state.suppressEdits;if(!e||t){for(var s,i=n.history,r=n.sel,a="undo"==o?i.done:i.undone,l="undo"==o?i.undone:i.done,c=0;c<a.length&&(s=a[c],t?!s.ranges||s.equals(n.sel):s.ranges);c++);if(c!=a.length){for(i.lastOrigin=i.lastSelOrigin=null;;){if(!(s=a.pop()).ranges){if(e)return void a.push(s);break}if(Pn(s,l),t&&!s.equals(n.sel))return void Yn(n,s,{clearRedo:!1});r=s}var h=[];Pn(r,l),l.push({changes:h,generation:i.generation}),i.generation=s.generation||++i.maxGeneration;for(var u=ae(n,"beforeChange")||n.cm&&ae(n.cm,"beforeChange"),f=function(t){var i=s.changes[t];if(i.origin=o,u&&!io(n,i,!1))return a.length=0,{};h.push(In(n,i));var e=t?kn(n,i):$(a);ao(n,i,e,Un(n,i)),!t&&n.cm&&n.cm.scrollIntoView({from:i.from,to:xn(i)});var r=[];An(n,function(t,e){e||-1!=H(r,t.history)||(uo(t.history,i),r.push(t.history)),ao(t,i,null,Un(t,i))})},d=s.changes.length-1;0<=d;--d){var p=f(d);if(p)return p.v}}}}function so(t,e){if(0!=e&&(t.first+=e,t.sel=new gn(Q(t.sel.ranges,function(t){return new _n(gt(t.anchor.line+e,t.anchor.ch),gt(t.head.line+e,t.head.ch))}),t.sel.primIndex),t.cm)){$r(t.cm,t.first,t.first-e,e);for(var i=t.cm.display,r=i.viewFrom;r<i.viewTo;r++)Qr(t.cm,r,"gutter")}}function ao(t,e,i,r){if(t.cm&&!t.cm.curOp)return Vr(t.cm,ao)(t,e,i,r);if(e.to.line<t.first)so(t,e.text.length-1-(e.to.line-e.from.line));else if(!(e.from.line>t.lastLine())){if(e.from.line<t.first){var n=e.text.length-1-(t.first-e.from.line);so(t,n),e={from:gt(t.first,0),to:gt(e.to.line+n,e.to.ch),text:[$(e.text)],origin:e.origin}}var o=t.lastLine();e.to.line>o&&(e={from:e.from,to:gt(o,lt(t,o).text.length),text:[e.text[0]],origin:e.origin}),e.removed=ct(t,e.from,e.to),i||(i=kn(t,e)),t.cm?function(t,e,i){var r=t.doc,n=t.display,o=e.from,s=e.to,a=!1,l=o.line;t.options.lineWrapping||(l=ft(zt(lt(r,o.line))),r.iter(l,s.line+1,function(t){if(t==n.maxLine)return a=!0}));-1<r.sel.contains(e.from,e.to)&&se(t);Sn(r,e,i,rr(t)),t.options.lineWrapping||(r.iter(l,o.line+e.text.length,function(t){var e=Kt(t);e>n.maxLineLength&&(n.maxLine=t,n.maxLineLength=e,n.maxLineChanged=!0,a=!1)}),a&&(t.curOp.updateMaxLine=!0));(function(t,e){if(t.modeFrontier=Math.min(t.modeFrontier,e),!(t.highlightFrontier<e-10)){for(var i=t.first,r=e-1;i<r;r--){var n=lt(t,r).stateAfter;if(n&&(!(n instanceof De)||r+n.lookAhead<e)){i=r+1;break}}t.highlightFrontier=Math.min(t.highlightFrontier,i)}})(r,o.line),tn(t,400);var c=e.text.length-(s.line-o.line)-1;e.full?$r(t):o.line!=s.line||1!=e.text.length||Cn(t.doc,e)?$r(t,o.line,s.line+1,c):Qr(t,o.line,"text");var h=ae(t,"changes"),u=ae(t,"change");if(u||h){var f={from:o,to:s,text:e.text,removed:e.removed,origin:e.origin};u&&ai(t,"change",t,f),h&&(t.curOp.changeObjs||(t.curOp.changeObjs=[])).push(f)}t.display.selForContextMenu=null}(t.cm,e,r):Sn(t,e,r),Kn(t,i,q)}}function lo(t,e,i,r,n){var o;r||(r=i),_t(r,i)<0&&(i=(o=[r,i])[0],r=o[1]),"string"==typeof e&&(e=t.splitLines(e)),ro(t,{from:i,to:r,text:e,origin:n})}function co(t,e,i,r){i<t.line?t.line+=r:e<t.line&&(t.line=e,t.ch=0)}function ho(t,e,i,r){for(var n=0;n<t.length;++n){var o=t[n],s=!0;if(o.ranges){o.copied||((o=t[n]=o.deepCopy()).copied=!0);for(var a=0;a<o.ranges.length;a++)co(o.ranges[a].anchor,e,i,r),co(o.ranges[a].head,e,i,r)}else{for(var l=0;l<o.changes.length;++l){var c=o.changes[l];if(i<c.from.line)c.from=gt(c.from.line+r,c.from.ch),c.to=gt(c.to.line+r,c.to.ch);else if(e<=c.to.line){s=!1;break}}s||(t.splice(0,n+1),n=0)}}}function uo(t,e){var i=e.from.line,r=e.to.line,n=e.text.length-(r-i)-1;ho(t.done,i,r,n),ho(t.undone,i,r,n)}function fo(t,e,i,r){var n=e,o=e;return"number"==typeof e?o=lt(t,kt(t,e)):n=ft(e),null==n?null:(r(o,n)&&t.cm&&Qr(t.cm,n,i),o)}function po(t){this.lines=t,this.parent=null;for(var e=0,i=0;i<t.length;++i)t[i].parent=this,e+=t[i].height;this.height=e}function mo(t){this.children=t;for(var e=0,i=0,r=0;r<t.length;++r){var n=t[r];e+=n.chunkSize(),i+=n.height,n.parent=this}this.size=e,this.height=i,this.parent=null}_n.prototype.from=function(){return Tt(this.anchor,this.head)},_n.prototype.to=function(){return xt(this.anchor,this.head)},_n.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},po.prototype={chunkSize:function(){return this.lines.length},removeInner:function(t,e){for(var i,r=t,n=t+e;r<n;++r){var o=this.lines[r];this.height-=o.height,(i=o).parent=null,It(i),ai(o,"delete")}this.lines.splice(t,e)},collapse:function(t){t.push.apply(t,this.lines)},insertInner:function(t,e,i){this.height+=i,this.lines=this.lines.slice(0,t).concat(e).concat(this.lines.slice(t));for(var r=0;r<e.length;++r)e[r].parent=this},iterN:function(t,e,i){for(var r=t+e;t<r;++t)if(i(this.lines[t]))return!0}},mo.prototype={chunkSize:function(){return this.size},removeInner:function(t,e){this.size-=e;for(var i=0;i<this.children.length;++i){var r=this.children[i],n=r.chunkSize();if(t<n){var o=Math.min(e,n-t),s=r.height;if(r.removeInner(t,o),this.height-=s-r.height,n==o&&(this.children.splice(i--,1),r.parent=null),0==(e-=o))break;t=0}else t-=n}if(this.size-e<25&&(1<this.children.length||!(this.children[0]instanceof po))){var a=[];this.collapse(a),this.children=[new po(a)],this.children[0].parent=this}},collapse:function(t){for(var e=0;e<this.children.length;++e)this.children[e].collapse(t)},insertInner:function(t,e,i){this.size+=e.length,this.height+=i;for(var r=0;r<this.children.length;++r){var n=this.children[r],o=n.chunkSize();if(t<=o){if(n.insertInner(t,e,i),n.lines&&50<n.lines.length){for(var s=n.lines.length%25+25,a=s;a<n.lines.length;){var l=new po(n.lines.slice(a,a+=25));n.height-=l.height,this.children.splice(++r,0,l),l.parent=this}n.lines=n.lines.slice(0,s),this.maybeSpill()}break}t-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var t=this;do{var e=new mo(t.children.splice(t.children.length-5,5));if(t.parent){t.size-=e.size,t.height-=e.height;var i=H(t.parent.children,t);t.parent.children.splice(i+1,0,e)}else{var r=new mo(t.children);(r.parent=t).children=[r,e],t=r}e.parent=t.parent}while(10<t.children.length);t.parent.maybeSpill()}},iterN:function(t,e,i){for(var r=0;r<this.children.length;++r){var n=this.children[r],o=n.chunkSize();if(t<o){var s=Math.min(e,o-t);if(n.iterN(t,s,i))return!0;if(0==(e-=s))break;t=0}else t-=o}}};var go=function(t,e,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.doc=t,this.node=e};function _o(t,e,i){Yt(e)<(t.curOp&&t.curOp.scrollTop||t.doc.scrollTop)&&br(t,i)}go.prototype.clear=function(){var t=this.doc.cm,e=this.line.widgets,i=this.line,r=ft(i);if(null!=r&&e){for(var n=0;n<e.length;++n)e[n]==this&&e.splice(n--,1);e.length||(i.widgets=null);var o=yi(this);ut(i,Math.max(0,i.height-o)),t&&(jr(t,function(){_o(t,i,-o),Qr(t,r,"widget")}),ai(t,"lineWidgetCleared",t,this,r))}},go.prototype.changed=function(){var t=this,e=this.height,i=this.doc.cm,r=this.line;this.height=null;var n=yi(this)-e;n&&(jt(this.doc,r)||ut(r,r.height+n),i&&jr(i,function(){i.curOp.forceUpdate=!0,_o(i,r,n),ai(i,"lineWidgetChanged",i,t,ft(r))}))},le(go);var vo=0,yo=function(t,e){this.lines=[],this.type=e,this.doc=t,this.id=++vo};function xo(e,r,n,t,i){if(t&&t.shared)return function(t,i,r,n,o){(n=B(n)).shared=!1;var s=[xo(t,i,r,n,o)],a=s[0],l=n.widgetNode;return An(t,function(t){l&&(n.widgetNode=l.cloneNode(!0)),s.push(xo(t,bt(t,i),bt(t,r),n,o));for(var e=0;e<t.linked.length;++e)if(t.linked[e].isParent)return;a=$(s)}),new To(s,a)}(e,r,n,t,i);if(e.cm&&!e.cm.curOp)return Vr(e.cm,xo)(e,r,n,t,i);var o=new yo(e,i),s=_t(r,n);if(t&&B(t,o,!1),0<s||0==s&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=L("span",[o.replacedWith],"CodeMirror-widget"),t.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),t.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Wt(e,r.line,r,n,o)||r.line!=n.line&&Wt(e,n.line,r,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ct=!0}o.addToHistory&&Mn(e,{from:r,to:n,origin:"markText"},e.sel,NaN);var a,l=r.line,c=e.cm;if(e.iter(l,n.line+1,function(t){var e,i;c&&o.collapsed&&!c.options.lineWrapping&&zt(t)==c.display.maxLine&&(a=!0),o.collapsed&&l!=r.line&&ut(t,0),e=t,i=new St(o,l==r.line?r.ch:null,l==n.line?n.ch:null),e.markedSpans=e.markedSpans?e.markedSpans.concat([i]):[i],i.marker.attachLine(e),++l}),o.collapsed&&e.iter(r.line,n.line+1,function(t){jt(e,t)&&ut(t,0)}),o.clearOnEnter&&ee(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(Et=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++vo,o.atomic=!0),c){if(a&&(c.curOp.updateMaxLine=!0),o.collapsed)$r(c,r.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var h=r.line;h<=n.line;h++)Qr(c,h,"text");o.atomic&&Qn(c.doc),ai(c,"markerAdded",c,o)}return o}yo.prototype.clear=function(){var t=this;if(!this.explicitlyCleared){var e=this.doc.cm,i=e&&!e.curOp;if(i&&Ur(e),ae(this,"clear")){var r=this.find();r&&ai(this,"clear",r.from,r.to)}for(var n=null,o=null,s=0;s<this.lines.length;++s){var a=t.lines[s],l=At(a.markedSpans,t);e&&!t.collapsed?Qr(e,ft(a),"text"):e&&(null!=l.to&&(o=ft(a)),null!=l.from&&(n=ft(a))),a.markedSpans=Lt(a.markedSpans,l),null==l.from&&t.collapsed&&!jt(t.doc,a)&&e&&ut(a,Ji(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var c=0;c<this.lines.length;++c){var h=zt(t.lines[c]),u=Kt(h);u>e.display.maxLineLength&&(e.display.maxLine=h,e.display.maxLineLength=u,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&$r(e,n,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Qn(e.doc)),e&&ai(e,"markerCleared",e,this,n,o),i&&Hr(e),this.parent&&this.parent.clear()}},yo.prototype.find=function(t,e){var i,r;null==t&&"bookmark"==this.type&&(t=1);for(var n=0;n<this.lines.length;++n){var o=this.lines[n],s=At(o.markedSpans,this);if(null!=s.from&&(i=gt(e?o:ft(o),s.from),-1==t))return i;if(null!=s.to&&(r=gt(e?o:ft(o),s.to),1==t))return r}return i&&{from:i,to:r}},yo.prototype.changed=function(){var o=this,s=this.find(-1,!0),a=this,l=this.doc.cm;s&&l&&jr(l,function(){var t=s.line,e=ft(s.line),i=Li(l,e);if(i&&(Pi(i),l.curOp.selectionChanged=l.curOp.forceUpdate=!0),l.curOp.updateMaxLine=!0,!jt(a.doc,t)&&null!=a.height){var r=a.height;a.height=null;var n=yi(a)-r;n&&ut(t,t.height+n)}ai(l,"markerChanged",l,o)})},yo.prototype.attachLine=function(t){if(!this.lines.length&&this.doc.cm){var e=this.doc.cm.curOp;e.maybeHiddenMarkers&&-1!=H(e.maybeHiddenMarkers,this)||(e.maybeUnhiddenMarkers||(e.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(t)},yo.prototype.detachLine=function(t){if(this.lines.splice(H(this.lines,t),1),!this.lines.length&&this.doc.cm){var e=this.doc.cm.curOp;(e.maybeHiddenMarkers||(e.maybeHiddenMarkers=[])).push(this)}},le(yo);var To=function(t,e){this.markers=t,this.primary=e;for(var i=0;i<t.length;++i)t[i].parent=this};function ko(t){return t.findMarks(gt(t.first,0),t.clipPos(gt(t.lastLine())),function(t){return t.parent})}function bo(o){for(var t=function(t){var e=o[t],i=[e.primary.doc];An(e.primary.doc,function(t){return i.push(t)});for(var r=0;r<e.markers.length;r++){var n=e.markers[r];-1==H(i,n.doc)&&(n.parent=null,e.markers.splice(r--,1))}},e=0;e<o.length;e++)t(e)}To.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var t=0;t<this.markers.length;++t)this.markers[t].clear();ai(this,"clear")}},To.prototype.find=function(t,e){return this.primary.find(t,e)},le(To);var wo=0,Eo=function(t,e,i,r,n){if(!(this instanceof Eo))return new Eo(t,e,i,r,n);null==i&&(i=0),mo.call(this,[new po([new Ye("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var o=gt(i,0);this.sel=yn(o),this.history=new On(null),this.id=++wo,this.modeOption=e,this.lineSep=r,this.direction="rtl"==n?"rtl":"ltr",this.extend=!1,"string"==typeof t&&(t=this.splitLines(t)),Sn(this,{from:o,to:o,text:t}),Yn(this,yn(o),q)};Eo.prototype=Z(mo.prototype,{constructor:Eo,iter:function(t,e,i){i?this.iterN(t-this.first,e-t,i):this.iterN(this.first,this.first+this.size,t)},insert:function(t,e){for(var i=0,r=0;r<e.length;++r)i+=e[r].height;this.insertInner(t-this.first,e,i)},remove:function(t,e){this.removeInner(t-this.first,e)},getValue:function(t){var e=ht(this,this.first,this.first+this.size);return!1===t?e:e.join(t||this.lineSeparator())},setValue:Kr(function(t){var e=gt(this.first,0),i=this.first+this.size-1;ro(this,{from:e,to:gt(i,lt(this,i).text.length),text:this.splitLines(t),origin:"setValue",full:!0},!0),this.cm&&Er(this.cm,0,0),Yn(this,yn(e),q)}),replaceRange:function(t,e,i,r){lo(this,t,e=bt(this,e),i=i?bt(this,i):e,r)},getRange:function(t,e,i){var r=ct(this,bt(this,t),bt(this,e));return!1===i?r:r.join(i||this.lineSeparator())},getLine:function(t){var e=this.getLineHandle(t);return e&&e.text},getLineHandle:function(t){if(pt(this,t))return lt(this,t)},getLineNumber:function(t){return ft(t)},getLineHandleVisualStart:function(t){return"number"==typeof t&&(t=lt(this,t)),zt(t)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(t){return bt(this,t)},getCursor:function(t){var e=this.sel.primary();return null==t||"head"==t?e.head:"anchor"==t?e.anchor:"end"==t||"to"==t||!1===t?e.to():e.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Kr(function(t,e,i){jn(this,bt(this,"number"==typeof t?gt(t,e||0):t),null,i)}),setSelection:Kr(function(t,e,i){jn(this,bt(this,t),bt(this,e||t),i)}),extendSelection:Kr(function(t,e,i){zn(this,bt(this,t),e&&bt(this,e),i)}),extendSelections:Kr(function(t,e){qn(this,wt(this,t),e)}),extendSelectionsBy:Kr(function(t,e){qn(this,wt(this,Q(this.sel.ranges,t)),e)}),setSelections:Kr(function(t,e,i){if(t.length){for(var r=[],n=0;n<t.length;n++)r[n]=new _n(bt(this,t[n].anchor),bt(this,t[n].head));null==e&&(e=Math.min(t.length-1,this.sel.primIndex)),Yn(this,vn(this.cm,r,e),i)}}),addSelection:Kr(function(t,e,i){var r=this.sel.ranges.slice(0);r.push(new _n(bt(this,t),bt(this,e||t))),Yn(this,vn(this.cm,r,r.length-1),i)}),getSelection:function(t){for(var e,i=this.sel.ranges,r=0;r<i.length;r++){var n=ct(this,i[r].from(),i[r].to());e=e?e.concat(n):n}return!1===t?e:e.join(t||this.lineSeparator())},getSelections:function(t){for(var e=[],i=this.sel.ranges,r=0;r<i.length;r++){var n=ct(this,i[r].from(),i[r].to());!1!==t&&(n=n.join(t||this.lineSeparator())),e[r]=n}return e},replaceSelection:function(t,e,i){for(var r=[],n=0;n<this.sel.ranges.length;n++)r[n]=t;this.replaceSelections(r,e,i||"+input")},replaceSelections:Kr(function(t,e,i){for(var r=[],n=this.sel,o=0;o<n.ranges.length;o++){var s=n.ranges[o];r[o]={from:s.from(),to:s.to(),text:this.splitLines(t[o]),origin:i}}for(var a=e&&"end"!=e&&function(t,e,i){for(var r=[],n=gt(t.first,0),o=n,s=0;s<e.length;s++){var a=e[s],l=bn(a.from,n,o),c=bn(xn(a),n,o);if(n=a.to,o=c,"around"==i){var h=t.sel.ranges[s],u=_t(h.head,h.anchor)<0;r[s]=new _n(u?c:l,u?l:c)}else r[s]=new _n(l,l)}return new gn(r,t.sel.primIndex)}(this,r,e),l=r.length-1;0<=l;l--)ro(this,r[l]);a?Vn(this,a):this.cm&&wr(this.cm)}),undo:Kr(function(){oo(this,"undo")}),redo:Kr(function(){oo(this,"redo")}),undoSelection:Kr(function(){oo(this,"undo",!0)}),redoSelection:Kr(function(){oo(this,"redo",!0)}),setExtending:function(t){this.extend=t},getExtending:function(){return this.extend},historySize:function(){for(var t=this.history,e=0,i=0,r=0;r<t.done.length;r++)t.done[r].ranges||++e;for(var n=0;n<t.undone.length;n++)t.undone[n].ranges||++i;return{undo:e,redo:i}},clearHistory:function(){this.history=new On(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(t){return t&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(t){return this.history.generation==(t||this.cleanGeneration)},getHistory:function(){return{done:Hn(this.history.done),undone:Hn(this.history.undone)}},setHistory:function(t){var e=this.history=new On(this.history.maxGeneration);e.done=Hn(t.done.slice(0),null,!0),e.undone=Hn(t.undone.slice(0),null,!0)},setGutterMarker:Kr(function(t,i,r){return fo(this,t,"gutter",function(t){var e=t.gutterMarkers||(t.gutterMarkers={});return!(e[i]=r)&&it(e)&&(t.gutterMarkers=null),!0})}),clearGutter:Kr(function(e){var i=this;this.iter(function(t){t.gutterMarkers&&t.gutterMarkers[e]&&fo(i,t,"gutter",function(){return t.gutterMarkers[e]=null,it(t.gutterMarkers)&&(t.gutterMarkers=null),!0})})}),lineInfo:function(t){var e;if("number"==typeof t){if(!pt(this,t))return null;if(!(t=lt(this,e=t)))return null}else if(null==(e=ft(t)))return null;return{line:e,handle:t,text:t.text,gutterMarkers:t.gutterMarkers,textClass:t.textClass,bgClass:t.bgClass,wrapClass:t.wrapClass,widgets:t.widgets}},addLineClass:Kr(function(t,i,r){return fo(this,t,"gutter"==i?"gutter":"class",function(t){var e="text"==i?"textClass":"background"==i?"bgClass":"gutter"==i?"gutterClass":"wrapClass";if(t[e]){if(w(r).test(t[e]))return!1;t[e]+=" "+r}else t[e]=r;return!0})}),removeLineClass:Kr(function(t,o,s){return fo(this,t,"gutter"==o?"gutter":"class",function(t){var e="text"==o?"textClass":"background"==o?"bgClass":"gutter"==o?"gutterClass":"wrapClass",i=t[e];if(!i)return!1;if(null==s)t[e]=null;else{var r=i.match(w(s));if(!r)return!1;var n=r.index+r[0].length;t[e]=i.slice(0,r.index)+(r.index&&n!=i.length?" ":"")+i.slice(n)||null}return!0})}),addLineWidget:Kr(function(t,e,i){return n=t,o=new go(r=this,e,i),(s=r.cm)&&o.noHScroll&&(s.display.alignWidgets=!0),fo(r,n,"widget",function(t){var e=t.widgets||(t.widgets=[]);if(null==o.insertAt?e.push(o):e.splice(Math.min(e.length-1,Math.max(0,o.insertAt)),0,o),o.line=t,s&&!jt(r,t)){var i=Yt(t)<r.scrollTop;ut(t,t.height+yi(o)),i&&br(s,o.height),s.curOp.forceUpdate=!0}return!0}),s&&ai(s,"lineWidgetAdded",s,o,"number"==typeof n?n:ft(n)),o;var r,n,o,s}),removeLineWidget:function(t){t.clear()},markText:function(t,e,i){return xo(this,bt(this,t),bt(this,e),i,i&&i.type||"range")},setBookmark:function(t,e){var i={replacedWith:e&&(null==e.nodeType?e.widget:e),insertLeft:e&&e.insertLeft,clearWhenEmpty:!1,shared:e&&e.shared,handleMouseEvents:e&&e.handleMouseEvents};return xo(this,t=bt(this,t),t,i,"bookmark")},findMarksAt:function(t){var e=[],i=lt(this,(t=bt(this,t)).line).markedSpans;if(i)for(var r=0;r<i.length;++r){var n=i[r];(null==n.from||n.from<=t.ch)&&(null==n.to||n.to>=t.ch)&&e.push(n.marker.parent||n.marker)}return e},findMarks:function(n,o,s){n=bt(this,n),o=bt(this,o);var a=[],l=n.line;return this.iter(n.line,o.line+1,function(t){var e=t.markedSpans;if(e)for(var i=0;i<e.length;i++){var r=e[i];null!=r.to&&l==n.line&&n.ch>=r.to||null==r.from&&l!=n.line||null!=r.from&&l==o.line&&r.from>=o.ch||s&&!s(r.marker)||a.push(r.marker.parent||r.marker)}++l}),a},getAllMarks:function(){var r=[];return this.iter(function(t){var e=t.markedSpans;if(e)for(var i=0;i<e.length;++i)null!=e[i].from&&r.push(e[i].marker)}),r},posFromIndex:function(i){var r,n=this.first,o=this.lineSeparator().length;return this.iter(function(t){var e=t.text.length+o;if(i<e)return r=i,!0;i-=e,++n}),bt(this,gt(n,r))},indexFromPos:function(t){var e=(t=bt(this,t)).ch;if(t.line<this.first||t.ch<0)return 0;var i=this.lineSeparator().length;return this.iter(this.first,t.line,function(t){e+=t.text.length+i}),e},copy:function(t){var e=new Eo(ht(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return e.scrollTop=this.scrollTop,e.scrollLeft=this.scrollLeft,e.sel=this.sel,e.extend=!1,t&&(e.history.undoDepth=this.history.undoDepth,e.setHistory(this.getHistory())),e},linkedDoc:function(t){t||(t={});var e=this.first,i=this.first+this.size;null!=t.from&&t.from>e&&(e=t.from),null!=t.to&&t.to<i&&(i=t.to);var r=new Eo(ht(this,e,i),t.mode||this.modeOption,e,this.lineSep,this.direction);return t.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:t.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:t.sharedHist}],function(t,e){for(var i=0;i<e.length;i++){var r=e[i],n=r.find(),o=t.clipPos(n.from),s=t.clipPos(n.to);if(_t(o,s)){var a=xo(t,o,s,r.primary,r.primary.type);r.markers.push(a),a.parent=r}}}(r,ko(this)),r},unlinkDoc:function(t){if(t instanceof ks&&(t=t.doc),this.linked)for(var e=0;e<this.linked.length;++e){if(this.linked[e].doc==t){this.linked.splice(e,1),t.unlinkDoc(this),bo(ko(this));break}}if(t.history==this.history){var i=[t.id];An(t,function(t){return i.push(t.id)},!0),t.history=new On(null),t.history.done=Hn(this.history.done,i),t.history.undone=Hn(this.history.undone,i)}},iterLinkedDocs:function(t){An(this,t)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(t){return this.lineSep?t.split(this.lineSep):Te(t)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:Kr(function(t){var e;("rtl"!=t&&(t="ltr"),t!=this.direction)&&(this.direction=t,this.iter(function(t){return t.order=null}),this.cm&&jr(e=this.cm,function(){Nn(e),$r(e)}))})}),Eo.prototype.eachLine=Eo.prototype.iter;var Co=0;function So(t){var n=this;if(Ao(n),!oe(n,t)&&!xi(n.display,t)){ce(t),T&&(Co=+new Date);var o=or(n,t,!0),e=t.dataTransfer.files;if(o&&!n.isReadOnly())if(e&&e.length&&window.FileReader&&window.File)for(var s=e.length,a=Array(s),l=0,i=function(t,i){if(!n.options.allowDropFileTypes||-1!=H(n.options.allowDropFileTypes,t.type)){var r=new FileReader;r.onload=Vr(n,function(){var t=r.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(t)&&(t=""),a[i]=t,++l==s){var e={from:o=bt(n.doc,o),to:o,text:n.doc.splitLines(a.join(n.doc.lineSeparator())),origin:"paste"};ro(n.doc,e),Vn(n.doc,yn(o,xn(e)))}}),r.readAsText(t)}},r=0;r<s;++r)i(e[r],r);else{if(n.state.draggingText&&-1<n.doc.sel.contains(o))return n.state.draggingText(t),void setTimeout(function(){return n.display.input.focus()},20);try{var c=t.dataTransfer.getData("Text");if(c){var h;if(n.state.draggingText&&!n.state.draggingText.copy&&(h=n.listSelections()),Kn(n.doc,yn(o,o)),h)for(var u=0;u<h.length;++u)lo(n.doc,"",h[u].anchor,h[u].head,"drag");n.replaceSelection(c,"around","paste"),n.display.input.focus()}}catch(t){}}}}function Ao(t){t.display.dragCursor&&(t.display.lineSpace.removeChild(t.display.dragCursor),t.display.dragCursor=null)}function Lo(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),i=[],r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&i.push(n)}i.length&&i[0].operation(function(){for(var t=0;t<i.length;t++)e(i[t])})}}var No=!1;function Oo(){var t;No||(ee(window,"resize",function(){null==t&&(t=setTimeout(function(){t=null,Lo(Io)},100))}),ee(window,"blur",function(){return Lo(gr)}),No=!0)}function Io(t){var e=t.display;e.cachedCharWidth=e.cachedTextHeight=e.cachedPaddingH=null,e.scrollbarsClipped=!1,t.setSize()}for(var Ro={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Mo=0;Mo<10;Mo++)Ro[Mo+48]=Ro[Mo+96]=String(Mo);for(var Do=65;Do<=90;Do++)Ro[Do]=String.fromCharCode(Do);for(var Po=1;Po<=12;Po++)Ro[Po+111]=Ro[Po+63235]="F"+Po;var Bo={};function Fo(t){var e,i,r,n,o=t.split(/-(?!$)/);t=o[o.length-1];for(var s=0;s<o.length-1;s++){var a=o[s];if(/^(cmd|meta|m)$/i.test(a))n=!0;else if(/^a(lt)?$/i.test(a))e=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else{if(!/^s(hift)?$/i.test(a))throw new Error("Unrecognized modifier name: "+a);r=!0}}return e&&(t="Alt-"+t),i&&(t="Ctrl-"+t),n&&(t="Cmd-"+t),r&&(t="Shift-"+t),t}function Uo(t){var e={};for(var i in t)if(t.hasOwnProperty(i)){var r=t[i];if(/^(name|fallthrough|(de|at)tach)$/.test(i))continue;if("..."==r){delete t[i];continue}for(var n=Q(i.split(" "),Fo),o=0;o<n.length;o++){var s=void 0,a=void 0;s=o==n.length-1?(a=n.join(" "),r):(a=n.slice(0,o+1).join(" "),"...");var l=e[a];if(l){if(l!=s)throw new Error("Inconsistent bindings for "+a)}else e[a]=s}delete t[i]}for(var c in e)t[c]=e[c];return t}function Ho(t,e,i,r){var n=(e=Go(e)).call?e.call(t,r):e[t];if(!1===n)return"nothing";if("..."===n)return"multi";if(null!=n&&i(n))return"handled";if(e.fallthrough){if("[object Array]"!=Object.prototype.toString.call(e.fallthrough))return Ho(t,e.fallthrough,i,r);for(var o=0;o<e.fallthrough.length;o++){var s=Ho(t,e.fallthrough[o],i,r);if(s)return s}}}function Wo(t){var e="string"==typeof t?t:Ro[t.keyCode];return"Ctrl"==e||"Alt"==e||"Shift"==e||"Mod"==e}function zo(t,e,i){var r=t;return e.altKey&&"Alt"!=r&&(t="Alt-"+t),(v?e.metaKey:e.ctrlKey)&&"Ctrl"!=r&&(t="Ctrl-"+t),(v?e.ctrlKey:e.metaKey)&&"Cmd"!=r&&(t="Cmd-"+t),!i&&e.shiftKey&&"Shift"!=r&&(t="Shift-"+t),t}function qo(t,e){if(g&&34==t.keyCode&&t.char)return!1;var i=Ro[t.keyCode];return null!=i&&!t.altGraphKey&&(3==t.keyCode&&t.code&&(i=t.code),zo(i,t,e))}function Go(t){return"string"==typeof t?Bo[t]:t}function jo(e,t){for(var i=e.doc.sel.ranges,r=[],n=0;n<i.length;n++){for(var o=t(i[n]);r.length&&_t(o.from,$(r).to)<=0;){var s=r.pop();if(_t(s.from,o.from)<0){o.from=s.from;break}}r.push(o)}jr(e,function(){for(var t=r.length-1;0<=t;t--)lo(e.doc,"",r[t].from,r[t].to,"+delete");wr(e)})}function Vo(t,e,i){var r=ot(t.text,e+i,i);return r<0||r>t.text.length?null:r}function Yo(t,e,i){var r=Vo(t,e.ch,i);return null==r?null:new gt(e.line,r,i<0?"after":"before")}function Ko(t,e,i,r,n){if(t){var o=Jt(i,e.doc.direction);if(o){var s,a=n<0?$(o):o[0],l=n<0==(1==a.level)?"after":"before";if(0<a.level||"rtl"==e.doc.direction){var c=Ni(e,i);s=n<0?i.text.length-1:0;var h=Oi(e,c,s).top;s=st(function(t){return Oi(e,c,t).top==h},n<0==(1==a.level)?a.from:a.to-1,s),"before"==l&&(s=Vo(i,s,1))}else s=n<0?a.to:a.from;return new gt(r,s,l)}}return new gt(r,n<0?i.text.length:0,n<0?"before":"after")}Bo.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"},Bo.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Bo.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Bo.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Bo.default=x?Bo.macDefault:Bo.pcDefault;var $o={selectAll:eo,singleSelection:function(t){return t.setSelection(t.getCursor("anchor"),t.getCursor("head"),q)},killLine:function(i){return jo(i,function(t){if(t.empty()){var e=lt(i.doc,t.head.line).text.length;return t.head.ch==e&&t.head.line<i.lastLine()?{from:t.head,to:gt(t.head.line+1,0)}:{from:t.head,to:gt(t.head.line,e)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){return jo(e,function(t){return{from:gt(t.from().line,0),to:bt(e.doc,gt(t.to().line+1,0))}})},delLineLeft:function(t){return jo(t,function(t){return{from:gt(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(i){return jo(i,function(t){var e=i.charCoords(t.head,"div").top+5;return{from:i.coordsChar({left:0,top:e},"div"),to:t.from()}})},delWrappedLineRight:function(r){return jo(r,function(t){var e=r.charCoords(t.head,"div").top+5,i=r.coordsChar({left:r.display.lineDiv.offsetWidth+100,top:e},"div");return{from:t.from(),to:i}})},undo:function(t){return t.undo()},redo:function(t){return t.redo()},undoSelection:function(t){return t.undoSelection()},redoSelection:function(t){return t.redoSelection()},goDocStart:function(t){return t.extendSelection(gt(t.firstLine(),0))},goDocEnd:function(t){return t.extendSelection(gt(t.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return Qo(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return Xo(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return function(t,e){var i=lt(t.doc,e),r=function(t){for(var e;e=Ut(t);)t=e.find(1,!0).line;return t}(i);r!=i&&(e=ft(r));return Ko(!0,t,i,e,-1)}(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(i){return i.extendSelectionsBy(function(t){var e=i.cursorCoords(t.head,"div").top+5;return i.coordsChar({left:i.display.lineDiv.offsetWidth+100,top:e},"div")},j)},goLineLeft:function(i){return i.extendSelectionsBy(function(t){var e=i.cursorCoords(t.head,"div").top+5;return i.coordsChar({left:0,top:e},"div")},j)},goLineLeftSmart:function(r){return r.extendSelectionsBy(function(t){var e=r.cursorCoords(t.head,"div").top+5,i=r.coordsChar({left:0,top:e},"div");return i.ch<r.getLine(i.line).search(/\S/)?Xo(r,t.head):i},j)},goLineUp:function(t){return t.moveV(-1,"line")},goLineDown:function(t){return t.moveV(1,"line")},goPageUp:function(t){return t.moveV(-1,"page")},goPageDown:function(t){return t.moveV(1,"page")},goCharLeft:function(t){return t.moveH(-1,"char")},goCharRight:function(t){return t.moveH(1,"char")},goColumnLeft:function(t){return t.moveH(-1,"column")},goColumnRight:function(t){return t.moveH(1,"column")},goWordLeft:function(t){return t.moveH(-1,"word")},goGroupRight:function(t){return t.moveH(1,"group")},goGroupLeft:function(t){return t.moveH(-1,"group")},goWordRight:function(t){return t.moveH(1,"word")},delCharBefore:function(t){return t.deleteH(-1,"char")},delCharAfter:function(t){return t.deleteH(1,"char")},delWordBefore:function(t){return t.deleteH(-1,"word")},delWordAfter:function(t){return t.deleteH(1,"word")},delGroupBefore:function(t){return t.deleteH(-1,"group")},delGroupAfter:function(t){return t.deleteH(1,"group")},indentAuto:function(t){return t.indentSelection("smart")},indentMore:function(t){return t.indentSelection("add")},indentLess:function(t){return t.indentSelection("subtract")},insertTab:function(t){return t.replaceSelection("\t")},insertSoftTab:function(t){for(var e=[],i=t.listSelections(),r=t.options.tabSize,n=0;n<i.length;n++){var o=i[n].from(),s=F(t.getLine(o.line),o.ch,r);e.push(K(r-s%r))}t.replaceSelections(e)},defaultTab:function(t){t.somethingSelected()?t.indentSelection("add"):t.execCommand("insertTab")},transposeChars:function(s){return jr(s,function(){for(var t=s.listSelections(),e=[],i=0;i<t.length;i++)if(t[i].empty()){var r=t[i].head,n=lt(s.doc,r.line).text;if(n)if(r.ch==n.length&&(r=new gt(r.line,r.ch-1)),0<r.ch)r=new gt(r.line,r.ch+1),s.replaceRange(n.charAt(r.ch-1)+n.charAt(r.ch-2),gt(r.line,r.ch-2),r,"+transpose");else if(r.line>s.doc.first){var o=lt(s.doc,r.line-1).text;o&&(r=new gt(r.line,1),s.replaceRange(n.charAt(0)+s.doc.lineSeparator()+o.charAt(o.length-1),gt(r.line-1,o.length-1),r,"+transpose"))}e.push(new _n(r,r))}s.setSelections(e)})},newlineAndIndent:function(r){return jr(r,function(){for(var t=r.listSelections(),e=t.length-1;0<=e;e--)r.replaceRange(r.doc.lineSeparator(),t[e].anchor,t[e].head,"+input");t=r.listSelections();for(var i=0;i<t.length;i++)r.indentLine(t[i].from().line,null,!0);wr(r)})},openLine:function(t){return t.replaceSelection("\n","start")},toggleOverwrite:function(t){return t.toggleOverwrite()}};function Qo(t,e){var i=lt(t.doc,e),r=zt(i);return r!=i&&(e=ft(r)),Ko(!0,t,r,e,1)}function Xo(t,e){var i=Qo(t,e.line),r=lt(t.doc,i.line),n=Jt(r,t.doc.direction);if(n&&0!=n[0].level)return i;var o=Math.max(0,r.text.search(/\S/)),s=e.line==i.line&&e.ch<=o&&e.ch;return gt(i.line,s?0:o,i.sticky)}function Zo(t,e,i){if("string"==typeof e&&!(e=$o[e]))return!1;t.display.input.ensurePolled();var r=t.display.shift,n=!1;try{t.isReadOnly()&&(t.state.suppressEdits=!0),i&&(t.display.shift=!1),n=e(t)!=z}finally{t.display.shift=r,t.state.suppressEdits=!1}return n}var Jo=new U;function ts(t,e,i,r){var n=t.state.keySeq;if(n){if(Wo(e))return"handled";if(/\'$/.test(e)?t.state.keySeq=null:Jo.set(50,function(){t.state.keySeq==n&&(t.state.keySeq=null,t.display.input.reset())}),es(t,n+" "+e,i,r))return!0}return es(t,e,i,r)}function es(t,e,i,r){var n=function(t,e,i){for(var r=0;r<t.state.keyMaps.length;r++){var n=Ho(e,t.state.keyMaps[r],i,t);if(n)return n}return t.options.extraKeys&&Ho(e,t.options.extraKeys,i,t)||Ho(e,t.options.keyMap,i,t)}(t,e,r);return"multi"==n&&(t.state.keySeq=e),"handled"==n&&ai(t,"keyHandled",t,e,i),"handled"!=n&&"multi"!=n||(ce(i),fr(t)),!!n}function is(e,t){var i=qo(t,!0);return!!i&&(t.shiftKey&&!e.state.keySeq?ts(e,"Shift-"+i,t,function(t){return Zo(e,t,!0)})||ts(e,i,t,function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return Zo(e,t)}):ts(e,i,t,function(t){return Zo(e,t)}))}var rs=null;function ns(t){if(this.curOp.focus=I(),!oe(this,t)){T&&k<11&&27==t.keyCode&&(t.returnValue=!1);var e=t.keyCode;this.display.shift=16==e||t.shiftKey;var i=is(this,t);g&&(rs=i?e:null,!i&&88==e&&!be&&(x?t.metaKey:t.ctrlKey)&&this.replaceSelection("",null,"cut")),18!=e||/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)||function(t){var e=t.display.lineDiv;function i(t){18!=t.keyCode&&t.altKey||(C(e,"CodeMirror-crosshair"),re(document,"keyup",i),re(document,"mouseover",i))}R(e,"CodeMirror-crosshair"),ee(document,"keyup",i),ee(document,"mouseover",i)}(this)}}function os(t){16==t.keyCode&&(this.doc.sel.shift=!1),oe(this,t)}function ss(t){if(!(xi(this.display,t)||oe(this,t)||t.ctrlKey&&!t.altKey||x&&t.metaKey)){var e=t.keyCode,i=t.charCode;if(g&&e==rs)return rs=null,void ce(t);if(!g||t.which&&!(t.which<10)||!is(this,t)){var r,n=String.fromCharCode(null==i?e:i);if("\b"!=n)if(!ts(r=this,"'"+n+"'",t,function(t){return Zo(r,t,!0)}))this.display.input.onKeyPress(t)}}}var as,ls,cs=function(t,e,i){this.time=t,this.pos=e,this.button=i};function hs(t){var e=this,i=e.display;if(!(oe(e,t)||i.activeTouch&&i.input.supportsTouch()))if(i.input.ensurePolled(),i.shift=t.shiftKey,xi(i,t))y||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));else if(!ds(e,t)){var r,n,o,s=or(e,t),a=pe(t),l=s?(r=s,n=a,o=+new Date,ls&&ls.compare(o,r,n)?(as=ls=null,"triple"):as&&as.compare(o,r,n)?(ls=new cs(o,r,n),as=null,"double"):(as=new cs(o,r,n),ls=null,"single")):"single";window.focus(),1==a&&e.state.selectingText&&e.state.selectingText(t),s&&function(i,t,r,e,n){var o="Click";"double"==e?o="Double"+o:"triple"==e&&(o="Triple"+o);return ts(i,zo(o=(1==t?"Left":2==t?"Middle":"Right")+o,n),n,function(t){if("string"==typeof t&&(t=$o[t]),!t)return!1;var e=!1;try{i.isReadOnly()&&(i.state.suppressEdits=!0),e=t(i,r)!=z}finally{i.state.suppressEdits=!1}return e})}(e,a,s,l,t)||(1==a?s?function(t,e,i,r){T?setTimeout(P(dr,t),0):t.curOp.focus=I();var n,o=function(t,e,i){var r=t.getOption("configureMouse"),n=r?r(t,e,i):{};if(null==n.unit){var o=d?i.shiftKey&&i.metaKey:i.altKey;n.unit=o?"rectangle":"single"==e?"char":"double"==e?"word":"line"}(null==n.extend||t.doc.extend)&&(n.extend=t.doc.extend||i.shiftKey);null==n.addNew&&(n.addNew=x?i.metaKey:i.ctrlKey);null==n.moveOnDrag&&(n.moveOnDrag=!(x?i.altKey:i.ctrlKey));return n}(t,i,r),s=t.doc.sel;t.options.dragDrop&&_e&&!t.isReadOnly()&&"single"==i&&-1<(n=s.contains(e))&&(_t((n=s.ranges[n]).from(),e)<0||0<e.xRel)&&(0<_t(n.to(),e)||e.xRel<0)?function(e,i,r,n){var o=e.display,s=!1,a=Vr(e,function(t){y&&(o.scroller.draggable=!1),e.state.draggingText=!1,re(o.wrapper.ownerDocument,"mouseup",a),re(o.wrapper.ownerDocument,"mousemove",l),re(o.scroller,"dragstart",c),re(o.scroller,"drop",a),s||(ce(t),n.addNew||zn(e.doc,r,null,null,n.extend),y||T&&9==k?setTimeout(function(){o.wrapper.ownerDocument.body.focus(),o.input.focus()},20):o.input.focus())}),l=function(t){s=s||10<=Math.abs(i.clientX-t.clientX)+Math.abs(i.clientY-t.clientY)},c=function(){return s=!0};y&&(o.scroller.draggable=!0);(e.state.draggingText=a).copy=!n.moveOnDrag,o.scroller.dragDrop&&o.scroller.dragDrop();ee(o.wrapper.ownerDocument,"mouseup",a),ee(o.wrapper.ownerDocument,"mousemove",l),ee(o.scroller,"dragstart",c),ee(o.scroller,"drop",a),pr(e),setTimeout(function(){return o.input.focus()},20)}(t,r,e,o):function(g,t,_,v){var s=g.display,y=g.doc;ce(t);var x,T,k=y.sel,e=k.ranges;v.addNew&&!v.extend?(T=y.sel.contains(_),x=-1<T?e[T]:new _n(_,_)):(x=y.sel.primary(),T=y.sel.primIndex);if("rectangle"==v.unit)v.addNew||(x=new _n(_,_)),_=or(g,t,!0,!0),T=-1;else{var i=us(g,_,v.unit);x=v.extend?Wn(x,i.anchor,i.head,v.extend):i}v.addNew?-1==T?(T=e.length,Yn(y,vn(g,e.concat([x]),T),{scroll:!1,origin:"*mouse"})):1<e.length&&e[T].empty()&&"char"==v.unit&&!v.extend?(Yn(y,vn(g,e.slice(0,T).concat(e.slice(T+1)),0),{scroll:!1,origin:"*mouse"}),k=y.sel):Gn(y,T,x,G):(Yn(y,new gn([x],T=0),G),k=y.sel);var b=_;function a(t){if(0!=_t(b,t))if(b=t,"rectangle"==v.unit){for(var e=[],i=g.options.tabSize,r=F(lt(y,_.line).text,_.ch,i),n=F(lt(y,t.line).text,t.ch,i),o=Math.min(r,n),s=Math.max(r,n),a=Math.min(_.line,t.line),l=Math.min(g.lastLine(),Math.max(_.line,t.line));a<=l;a++){var c=lt(y,a).text,h=V(c,o,i);o==s?e.push(new _n(gt(a,h),gt(a,h))):c.length>h&&e.push(new _n(gt(a,h),gt(a,V(c,s,i))))}e.length||e.push(new _n(_,_)),Yn(y,vn(g,k.ranges.slice(0,T).concat(e),T),{origin:"*mouse",scroll:!1}),g.scrollIntoView(t)}else{var u,f=x,d=us(g,t,v.unit),p=f.anchor;p=0<_t(d.anchor,p)?(u=d.head,Tt(f.from(),d.anchor)):(u=d.anchor,xt(f.to(),d.head));var m=k.ranges.slice(0);m[T]=function(t,e){var i=e.anchor,r=e.head,n=lt(t.doc,i.line);if(0==_t(i,r)&&i.sticky==r.sticky)return e;var o=Jt(n);if(!o)return e;var s=Xt(o,i.ch,i.sticky),a=o[s];if(a.from!=i.ch&&a.to!=i.ch)return e;var l,c=s+(a.from==i.ch==(1!=a.level)?0:1);if(0==c||c==o.length)return e;if(r.line!=i.line)l=0<(r.line-i.line)*("ltr"==t.doc.direction?1:-1);else{var h=Xt(o,r.ch,r.sticky),u=h-s||(r.ch-i.ch)*(1==a.level?-1:1);l=h==c-1||h==c?u<0:0<u}var f=o[c+(l?-1:0)],d=l==(1==f.level),p=d?f.from:f.to,m=d?"after":"before";return i.ch==p&&i.sticky==m?e:new _n(new gt(i.line,p,m),r)}(g,new _n(bt(y,p),u)),Yn(y,vn(g,m,T),G)}}var l=s.wrapper.getBoundingClientRect(),c=0;function r(t){g.state.selectingText=!1,c=1/0,ce(t),s.input.focus(),re(s.wrapper.ownerDocument,"mousemove",n),re(s.wrapper.ownerDocument,"mouseup",o),y.history.lastSelOrigin=null}var n=Vr(g,function(t){0!==t.buttons&&pe(t)?function t(e){var i=++c;var r=or(g,e,!0,"rectangle"==v.unit);if(!r)return;if(0!=_t(r,b)){g.curOp.focus=I(),a(r);var n=yr(s,y);(r.line>=n.to||r.line<n.from)&&setTimeout(Vr(g,function(){c==i&&t(e)}),150)}else{var o=e.clientY<l.top?-20:e.clientY>l.bottom?20:0;o&&setTimeout(Vr(g,function(){c==i&&(s.scroller.scrollTop+=o,t(e))}),50)}}(t):r(t)}),o=Vr(g,r);g.state.selectingText=o,ee(s.wrapper.ownerDocument,"mousemove",n),ee(s.wrapper.ownerDocument,"mouseup",o)}(t,r,e,o)}(e,s,l,t):de(t)==i.scroller&&ce(t):2==a?(s&&zn(e.doc,s),setTimeout(function(){return i.input.focus()},20)):3==a&&(b?e.display.input.onContextMenu(t):pr(e)))}}function us(t,e,i){if("char"==i)return new _n(e,e);if("word"==i)return t.findWordAt(e);if("line"==i)return new _n(gt(e.line,0),bt(t.doc,gt(e.line+1,0)));var r=i(t,e);return new _n(r.from,r.to)}function fs(t,e,i,r){var n,o;if(e.touches)n=e.touches[0].clientX,o=e.touches[0].clientY;else try{n=e.clientX,o=e.clientY}catch(e){return!1}if(n>=Math.floor(t.display.gutters.getBoundingClientRect().right))return!1;r&&ce(e);var s=t.display,a=s.lineDiv.getBoundingClientRect();if(o>a.bottom||!ae(t,i))return ue(e);o-=a.top-s.viewOffset;for(var l=0;l<t.options.gutters.length;++l){var c=s.gutters.childNodes[l];if(c&&c.getBoundingClientRect().right>=n)return ne(t,i,t,dt(t.doc,o),t.options.gutters[l],e),ue(e)}}function ds(t,e){return fs(t,e,"gutterClick",!0)}function ps(t,e){var i,r;xi(t.display,e)||(r=e,ae(i=t,"gutterContextMenu")&&fs(i,r,"gutterContextMenu",!1))||(oe(t,e,"contextmenu")||b||t.display.input.onContextMenu(e))}function ms(t){t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+t.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Fi(t)}cs.prototype.compare=function(t,e,i){return this.time+400>t&&0==_t(e,this.pos)&&i==this.button};var gs={toString:function(){return"CodeMirror.Init"}},_s={},vs={};function ys(t){cn(t),$r(t),xr(t)}function xs(t,e,i){if(!e!=!(i&&i!=gs)){var r=t.display.dragFunctions,n=e?ee:re;n(t.display.scroller,"dragstart",r.start),n(t.display.scroller,"dragenter",r.enter),n(t.display.scroller,"dragover",r.over),n(t.display.scroller,"dragleave",r.leave),n(t.display.scroller,"drop",r.drop)}}function Ts(t){t.options.lineWrapping?(R(t.display.wrapper,"CodeMirror-wrap"),t.display.sizer.style.minWidth="",t.display.sizerWidth=null):(C(t.display.wrapper,"CodeMirror-wrap"),$t(t)),nr(t),$r(t),Fi(t),setTimeout(function(){return Mr(t)},100)}function ks(t,e){var i=this;if(!(this instanceof ks))return new ks(t,e);this.options=e=e?B(e):{},B(_s,e,!1),hn(e);var r=e.value;"string"==typeof r?r=new Eo(r,e.mode,null,e.lineSeparator,e.direction):e.mode&&(r.modeOption=e.mode),this.doc=r;var n=new ks.inputStyles[e.inputStyle](this),o=this.display=new at(t,r,n);for(var s in cn(o.wrapper.CodeMirror=this),ms(this),e.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Br(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new U,keySeq:null,specialChars:null},e.autofocus&&!f&&o.input.focus(),T&&k<11&&setTimeout(function(){return i.display.input.reset(!0)},20),function(n){var o=n.display;ee(o.scroller,"mousedown",Vr(n,hs)),ee(o.scroller,"dblclick",T&&k<11?Vr(n,function(t){if(!oe(n,t)){var e=or(n,t);if(e&&!ds(n,t)&&!xi(n.display,t)){ce(t);var i=n.findWordAt(e);zn(n.doc,i.anchor,i.head)}}}):function(t){return oe(n,t)||ce(t)});ee(o.scroller,"contextmenu",function(t){return ps(n,t)});var i,r={end:0};function s(){o.activeTouch&&(i=setTimeout(function(){return o.activeTouch=null},1e3),(r=o.activeTouch).end=+new Date)}function a(t,e){if(null==e.left)return!0;var i=e.left-t.left,r=e.top-t.top;return 400<i*i+r*r}ee(o.scroller,"touchstart",function(t){if(!oe(n,t)&&!function(t){if(1!=t.touches.length)return!1;var e=t.touches[0];return e.radiusX<=1&&e.radiusY<=1}(t)&&!ds(n,t)){o.input.ensurePolled(),clearTimeout(i);var e=+new Date;o.activeTouch={start:e,moved:!1,prev:e-r.end<=300?r:null},1==t.touches.length&&(o.activeTouch.left=t.touches[0].pageX,o.activeTouch.top=t.touches[0].pageY)}}),ee(o.scroller,"touchmove",function(){o.activeTouch&&(o.activeTouch.moved=!0)}),ee(o.scroller,"touchend",function(t){var e=o.activeTouch;if(e&&!xi(o,t)&&null!=e.left&&!e.moved&&new Date-e.start<300){var i,r=n.coordsChar(o.activeTouch,"page");i=!e.prev||a(e,e.prev)?new _n(r,r):!e.prev.prev||a(e,e.prev.prev)?n.findWordAt(r):new _n(gt(r.line,0),bt(n.doc,gt(r.line+1,0))),n.setSelection(i.anchor,i.head),n.focus(),ce(t)}s()}),ee(o.scroller,"touchcancel",s),ee(o.scroller,"scroll",function(){o.scroller.clientHeight&&(Ar(n,o.scroller.scrollTop),Nr(n,o.scroller.scrollLeft,!0),ne(n,"scroll",n))}),ee(o.scroller,"mousewheel",function(t){return mn(n,t)}),ee(o.scroller,"DOMMouseScroll",function(t){return mn(n,t)}),ee(o.wrapper,"scroll",function(){return o.wrapper.scrollTop=o.wrapper.scrollLeft=0}),o.dragFunctions={enter:function(t){oe(n,t)||fe(t)},over:function(t){oe(n,t)||(!function(t,e){var i=or(t,e);if(i){var r=document.createDocumentFragment();cr(t,i,r),t.display.dragCursor||(t.display.dragCursor=N("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),t.display.lineSpace.insertBefore(t.display.dragCursor,t.display.cursorDiv)),A(t.display.dragCursor,r)}}(n,t),fe(t))},start:function(t){return function(t,e){if(T&&(!t.state.draggingText||+new Date-Co<100))fe(e);else if(!oe(t,e)&&!xi(t.display,e)&&(e.dataTransfer.setData("Text",t.getSelection()),e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.setDragImage&&!l)){var i=N("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",g&&(i.width=i.height=1,t.display.wrapper.appendChild(i),i._top=i.offsetTop),e.dataTransfer.setDragImage(i,0,0),g&&i.parentNode.removeChild(i)}}(n,t)},drop:Vr(n,So),leave:function(t){oe(n,t)||Ao(n)}};var t=o.input.getField();ee(t,"keyup",function(t){return os.call(n,t)}),ee(t,"keydown",Vr(n,ns)),ee(t,"keypress",Vr(n,ss)),ee(t,"focus",function(t){return mr(n,t)}),ee(t,"blur",function(t){return gr(n,t)})}(this),Oo(),Ur(this),this.curOp.forceUpdate=!0,Ln(this,r),e.autofocus&&!f||this.hasFocus()?setTimeout(P(mr,this),20):gr(this),vs)vs.hasOwnProperty(s)&&vs[s](i,e[s],gs);Tr(this),e.finishInit&&e.finishInit(this);for(var a=0;a<bs.length;++a)bs[a](i);Hr(this),y&&e.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}ks.defaults=_s,ks.optionHandlers=vs;var bs=[];function ws(t,e,i,r){var n,o=t.doc;null==i&&(i="add"),"smart"==i&&(o.mode.indent?n=Ue(t,e).state:i="prev");var s=t.options.tabSize,a=lt(o,e),l=F(a.text,null,s);a.stateAfter&&(a.stateAfter=null);var c,h=a.text.match(/^\s*/)[0];if(r||/\S/.test(a.text)){if("smart"==i&&((c=o.mode.indent(n,a.text.slice(h.length),a.text))==z||150<c)){if(!r)return;i="prev"}}else c=0,i="not";"prev"==i?c=e>o.first?F(lt(o,e-1).text,null,s):0:"add"==i?c=l+t.options.indentUnit:"subtract"==i?c=l-t.options.indentUnit:"number"==typeof i&&(c=l+i),c=Math.max(0,c);var u="",f=0;if(t.options.indentWithTabs)for(var d=Math.floor(c/s);d;--d)f+=s,u+="\t";if(f<c&&(u+=K(c-f)),u!=h)return lo(o,u,gt(e,0),gt(e,h.length),"+input"),!(a.stateAfter=null);for(var p=0;p<o.sel.ranges.length;p++){var m=o.sel.ranges[p];if(m.head.line==e&&m.head.ch<h.length){var g=gt(e,h.length);Gn(o,p,new _n(g,g));break}}}ks.defineInitHook=function(t){return bs.push(t)};var Es=null;function Cs(t){Es=t}function Ss(t,e,i,r,n){var o=t.doc;t.display.shift=!1,r||(r=o.sel);var s,a=t.state.pasteIncoming||"paste"==n,l=Te(e),c=null;if(a&&1<r.ranges.length)if(Es&&Es.text.join("\n")==e){if(r.ranges.length%Es.text.length==0){c=[];for(var h=0;h<Es.text.length;h++)c.push(o.splitLines(Es.text[h]))}}else l.length==r.ranges.length&&t.options.pasteLinesPerSelection&&(c=Q(l,function(t){return[t]}));for(var u=r.ranges.length-1;0<=u;u--){var f=r.ranges[u],d=f.from(),p=f.to();f.empty()&&(i&&0<i?d=gt(d.line,d.ch-i):t.state.overwrite&&!a?p=gt(p.line,Math.min(lt(o,p.line).text.length,p.ch+$(l).length)):a&&Es&&Es.lineWise&&Es.text.join("\n")==e&&(d=p=gt(d.line,0))),s=t.curOp.updateInput;var m={from:d,to:p,text:c?c[u%c.length]:l,origin:n||(a?"paste":t.state.cutIncoming?"cut":"+input")};ro(t.doc,m),ai(t,"inputRead",t,m)}e&&!a&&Ls(t,e),wr(t),t.curOp.updateInput=s,t.curOp.typing=!0,t.state.pasteIncoming=t.state.cutIncoming=!1}function As(t,e){var i=t.clipboardData&&t.clipboardData.getData("Text");if(i)return t.preventDefault(),e.isReadOnly()||e.options.disableInput||jr(e,function(){return Ss(e,i,0,null,"paste")}),!0}function Ls(t,e){if(t.options.electricChars&&t.options.smartIndent)for(var i=t.doc.sel,r=i.ranges.length-1;0<=r;r--){var n=i.ranges[r];if(!(100<n.head.ch||r&&i.ranges[r-1].head.line==n.head.line)){var o=t.getModeAt(n.head),s=!1;if(o.electricChars){for(var a=0;a<o.electricChars.length;a++)if(-1<e.indexOf(o.electricChars.charAt(a))){s=ws(t,n.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(lt(t.doc,n.head.line).text.slice(0,n.head.ch))&&(s=ws(t,n.head.line,"smart"));s&&ai(t,"electricInput",t,n.head.line)}}}function Ns(t){for(var e=[],i=[],r=0;r<t.doc.sel.ranges.length;r++){var n=t.doc.sel.ranges[r].head.line,o={anchor:gt(n,0),head:gt(n+1,0)};i.push(o),e.push(t.getRange(o.anchor,o.head))}return{text:e,ranges:i}}function Os(t,e){t.setAttribute("autocorrect","off"),t.setAttribute("autocapitalize","off"),t.setAttribute("spellcheck",!!e)}function Is(){var t=N("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),e=N("div",[t],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return y?t.style.width="1000px":t.setAttribute("wrap","off"),h&&(t.style.border="1px solid black"),Os(t),e}function Rs(r,n,o,t,s){var e=n,i=o,a=lt(r,n.line);function l(t){var e,i;if(null==(e=s?function(e,i,a,t){var l=Jt(i,e.doc.direction);if(!l)return Yo(i,a,t);a.ch>=i.text.length?(a.ch=i.text.length,a.sticky="before"):a.ch<=0&&(a.ch=0,a.sticky="after");var r=Xt(l,a.ch,a.sticky),n=l[r];if("ltr"==e.doc.direction&&n.level%2==0&&(0<t?n.to>a.ch:n.from<a.ch))return Yo(i,a,t);var o,c=function(t,e){return Vo(i,t instanceof gt?t.ch:t,e)},s=function(t){return e.options.lineWrapping?(o=o||Ni(e,i),Qi(e,i,o,t)):{begin:0,end:i.text.length}},h=s("before"==a.sticky?c(a,-1):a.ch);if("rtl"==e.doc.direction||1==n.level){var u=1==n.level==t<0,f=c(a,u?1:-1);if(null!=f&&(u?f<=n.to&&f<=h.end:f>=n.from&&f>=h.begin)){var d=u?"before":"after";return new gt(a.line,f,d)}}var p=function(t,e,i){for(var r=function(t,e){return e?new gt(a.line,c(t,1),"before"):new gt(a.line,t,"after")};0<=t&&t<l.length;t+=e){var n=l[t],o=0<e==(1!=n.level),s=o?i.begin:c(i.end,-1);if(n.from<=s&&s<n.to)return r(s,o);if(s=o?n.from:c(n.to,-1),i.begin<=s&&s<i.end)return r(s,o)}},m=p(r+t,t,h);if(m)return m;var g=0<t?h.end:c(h.begin,-1);return null==g||0<t&&g==i.text.length||!(m=p(0<t?0:l.length-1,t,s(g)))?null:m}(r.cm,a,n,o):Yo(a,n,o))){if(t||(i=n.line+o)<r.first||i>=r.first+r.size||(n=new gt(i,n.ch,n.sticky),!(a=lt(r,i))))return!1;n=Ko(s,r.cm,a,n.line,o)}else n=e;return!0}if("char"==t)l();else if("column"==t)l(!0);else if("word"==t||"group"==t)for(var c=null,h="group"==t,u=r.cm&&r.cm.getHelper(n,"wordChars"),f=!0;!(o<0)||l(!f);f=!1){var d=a.text.charAt(n.ch)||"\n",p=et(d,u)?"w":h&&"\n"==d?"n":!h||/\s/.test(d)?null:"p";if(!h||f||p||(p="s"),c&&c!=p){o<0&&(o=1,l(),n.sticky="after");break}if(p&&(c=p),0<o&&!l(!f))break}var m=Jn(r,n,e,i,!0);return vt(e,m)&&(m.hitSide=!0),m}function Ms(t,e,i,r){var n,o,s=t.doc,a=e.left;if("page"==r){var l=Math.min(t.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),c=Math.max(l-.5*Ji(t.display),3);n=(0<i?e.bottom:e.top)+i*c}else"line"==r&&(n=0<i?e.bottom+3:e.top-3);for(;(o=Ki(t,a,n)).outside;){if(i<0?n<=0:n>=s.height){o.hitSide=!0;break}n+=5*i}return o}var Ds=function(t){this.cm=t,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new U,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Ps(t,e){var i=Li(t,e.line);if(!i||i.hidden)return null;var r=lt(t.doc,e.line),n=Si(i,r,e.line),o=Jt(r,t.doc.direction),s="left";o&&(s=Xt(o,e.ch)%2?"right":"left");var a=Mi(n.map,e.ch,s);return a.offset="right"==a.collapse?a.end:a.start,a}function Bs(t,e){return e&&(t.bad=!0),t}function Fs(t,e,i){var r;if(e==t.display.lineDiv){if(!(r=t.display.lineDiv.childNodes[i]))return Bs(t.clipPos(gt(t.display.viewTo-1)),!0);e=null,i=0}else for(r=e;;r=r.parentNode){if(!r||r==t.display.lineDiv)return null;if(r.parentNode&&r.parentNode==t.display.lineDiv)break}for(var n=0;n<t.display.view.length;n++){var o=t.display.view[n];if(o.node==r)return Us(o,e,i)}}function Us(c,t,e){var i=c.text.firstChild,r=!1;if(!t||!O(i,t))return Bs(gt(ft(c.line),0),!0);if(t==i&&(r=!0,t=i.childNodes[e],e=0,!t)){var n=c.rest?$(c.rest):c.line;return Bs(gt(ft(n),n.text.length),r)}var o=3==t.nodeType?t:null,s=t;for(o||1!=t.childNodes.length||3!=t.firstChild.nodeType||(o=t.firstChild,e&&(e=o.nodeValue.length));s.parentNode!=i;)s=s.parentNode;var h=c.measure,u=h.maps;function a(t,e,i){for(var r=-1;r<(u?u.length:0);r++)for(var n=r<0?h.map:u[r],o=0;o<n.length;o+=3){var s=n[o+2];if(s==t||s==e){var a=ft(r<0?c.line:c.rest[r]),l=n[o]+i;return(i<0||s!=t)&&(l=n[o+(i?1:0)]),gt(a,l)}}}var l=a(o,s,e);if(l)return Bs(l,r);for(var f=s.nextSibling,d=o?o.nodeValue.length-e:0;f;f=f.nextSibling){if(l=a(f,f.firstChild,0))return Bs(gt(l.line,l.ch-d),r);d+=f.textContent.length}for(var p=s.previousSibling,m=e;p;p=p.previousSibling){if(l=a(p,p.firstChild,-1))return Bs(gt(l.line,l.ch+m),r);m+=p.textContent.length}}Ds.prototype.init=function(t){var e=this,s=this,a=s.cm,l=s.div=t.lineDiv;function i(t){if(!oe(a,t)){if(a.somethingSelected())Cs({lineWise:!1,text:a.getSelections()}),"cut"==t.type&&a.replaceSelection("",null,"cut");else{if(!a.options.lineWiseCopyCut)return;var e=Ns(a);Cs({lineWise:!0,text:e.text}),"cut"==t.type&&a.operation(function(){a.setSelections(e.ranges,0,q),a.replaceSelection("",null,"cut")})}if(t.clipboardData){t.clipboardData.clearData();var i=Es.text.join("\n");if(t.clipboardData.setData("Text",i),t.clipboardData.getData("Text")==i)return void t.preventDefault()}var r=Is(),n=r.firstChild;a.display.lineSpace.insertBefore(r,a.display.lineSpace.firstChild),n.value=Es.text.join("\n");var o=document.activeElement;D(n),setTimeout(function(){a.display.lineSpace.removeChild(r),o.focus(),o==l&&s.showPrimarySelection()},50)}}Os(l,a.options.spellcheck),ee(l,"paste",function(t){oe(a,t)||As(t,a)||k<=11&&setTimeout(Vr(a,function(){return e.updateFromDOM()}),20)}),ee(l,"compositionstart",function(t){e.composing={data:t.data,done:!1}}),ee(l,"compositionupdate",function(t){e.composing||(e.composing={data:t.data,done:!1})}),ee(l,"compositionend",function(t){e.composing&&(t.data!=e.composing.data&&e.readFromDOMSoon(),e.composing.done=!0)}),ee(l,"touchstart",function(){return s.forceCompositionEnd()}),ee(l,"input",function(){e.composing||e.readFromDOMSoon()}),ee(l,"copy",i),ee(l,"cut",i)},Ds.prototype.prepareSelection=function(){var t=lr(this.cm,!1);return t.focus=this.cm.state.focused,t},Ds.prototype.showSelection=function(t,e){t&&this.cm.display.view.length&&((t.focus||e)&&this.showPrimarySelection(),this.showMultipleSelections(t))},Ds.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Ds.prototype.showPrimarySelection=function(){var t=this.getSelection(),e=this.cm,i=e.doc.sel.primary(),r=i.from(),n=i.to();if(e.display.viewTo==e.display.viewFrom||r.line>=e.display.viewTo||n.line<e.display.viewFrom)t.removeAllRanges();else{var o=Fs(e,t.anchorNode,t.anchorOffset),s=Fs(e,t.focusNode,t.focusOffset);if(!o||o.bad||!s||s.bad||0!=_t(Tt(o,s),r)||0!=_t(xt(o,s),n)){var a=e.display.view,l=r.line>=e.display.viewFrom&&Ps(e,r)||{node:a[0].measure.map[2],offset:0},c=n.line<e.display.viewTo&&Ps(e,n);if(!c){var h=a[a.length-1].measure,u=h.maps?h.maps[h.maps.length-1]:h.map;c={node:u[u.length-1],offset:u[u.length-2]-u[u.length-3]}}if(l&&c){var f,d=t.rangeCount&&t.getRangeAt(0);try{f=E(l.node,l.offset,c.offset,c.node)}catch(t){}f&&(!m&&e.state.focused?(t.collapse(l.node,l.offset),f.collapsed||(t.removeAllRanges(),t.addRange(f))):(t.removeAllRanges(),t.addRange(f)),d&&null==t.anchorNode?t.addRange(d):m&&this.startGracePeriod()),this.rememberSelection()}else t.removeAllRanges()}}},Ds.prototype.startGracePeriod=function(){var t=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){t.gracePeriod=!1,t.selectionChanged()&&t.cm.operation(function(){return t.cm.curOp.selectionChanged=!0})},20)},Ds.prototype.showMultipleSelections=function(t){A(this.cm.display.cursorDiv,t.cursors),A(this.cm.display.selectionDiv,t.selection)},Ds.prototype.rememberSelection=function(){var t=this.getSelection();this.lastAnchorNode=t.anchorNode,this.lastAnchorOffset=t.anchorOffset,this.lastFocusNode=t.focusNode,this.lastFocusOffset=t.focusOffset},Ds.prototype.selectionInEditor=function(){var t=this.getSelection();if(!t.rangeCount)return!1;var e=t.getRangeAt(0).commonAncestorContainer;return O(this.div,e)},Ds.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())},Ds.prototype.blur=function(){this.div.blur()},Ds.prototype.getField=function(){return this.div},Ds.prototype.supportsTouch=function(){return!0},Ds.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():jr(this.cm,function(){return e.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))})},Ds.prototype.selectionChanged=function(){var t=this.getSelection();return t.anchorNode!=this.lastAnchorNode||t.anchorOffset!=this.lastAnchorOffset||t.focusNode!=this.lastFocusNode||t.focusOffset!=this.lastFocusOffset},Ds.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var t=this.getSelection(),e=this.cm;if(u&&s&&this.cm.options.gutters.length&&function(t){for(var e=t;e;e=e.parentNode)if(/CodeMirror-gutter-wrapper/.test(e.className))return!0;return!1}(t.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var i=Fs(e,t.anchorNode,t.anchorOffset),r=Fs(e,t.focusNode,t.focusOffset);i&&r&&jr(e,function(){Yn(e.doc,yn(i,r),q),(i.bad||r.bad)&&(e.curOp.selectionChanged=!0)})}}},Ds.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var t,e,i,r=this.cm,n=r.display,o=r.doc.sel.primary(),s=o.from(),a=o.to();if(0==s.ch&&s.line>r.firstLine()&&(s=gt(s.line-1,lt(r.doc,s.line-1).length)),a.ch==lt(r.doc,a.line).text.length&&a.line<r.lastLine()&&(a=gt(a.line+1,0)),s.line<n.viewFrom||a.line>n.viewTo-1)return!1;i=s.line==n.viewFrom||0==(t=sr(r,s.line))?(e=ft(n.view[0].line),n.view[0].node):(e=ft(n.view[t].line),n.view[t-1].node.nextSibling);var l,c,h=sr(r,a.line);if(c=h==n.view.length-1?(l=n.viewTo-1,n.lineDiv.lastChild):(l=ft(n.view[h+1].line)-1,n.view[h+1].node.previousSibling),!i)return!1;for(var u=r.doc.splitLines(function(l,t,e,c,h){var i="",u=!1,f=l.doc.lineSeparator(),d=!1;function p(){u&&(i+=f,d&&(i+=f),u=d=!1)}function m(t){t&&(p(),i+=t)}function g(t){if(1==t.nodeType){var e=t.getAttribute("cm-text");if(e)return void m(e);var i,r=t.getAttribute("cm-marker");if(r){var n=l.findMarks(gt(c,0),gt(h+1,0),(a=+r,function(t){return t.id==a}));return void(n.length&&(i=n[0].find(0))&&m(ct(l.doc,i.from,i.to).join(f)))}if("false"==t.getAttribute("contenteditable"))return;var o=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;o&&p();for(var s=0;s<t.childNodes.length;s++)g(t.childNodes[s]);/^(pre|p)$/i.test(t.nodeName)&&(d=!0),o&&(u=!0)}else 3==t.nodeType&&m(t.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "));var a}for(;g(t),t!=e;)t=t.nextSibling,d=!1;return i}(r,i,c,e,l)),f=ct(r.doc,gt(e,0),gt(l,lt(r.doc,l).text.length));1<u.length&&1<f.length;)if($(u)==$(f))u.pop(),f.pop(),l--;else{if(u[0]!=f[0])break;u.shift(),f.shift(),e++}for(var d=0,p=0,m=u[0],g=f[0],_=Math.min(m.length,g.length);d<_&&m.charCodeAt(d)==g.charCodeAt(d);)++d;for(var v=$(u),y=$(f),x=Math.min(v.length-(1==u.length?d:0),y.length-(1==f.length?d:0));p<x&&v.charCodeAt(v.length-p-1)==y.charCodeAt(y.length-p-1);)++p;if(1==u.length&&1==f.length&&e==s.line)for(;d&&d>s.ch&&v.charCodeAt(v.length-p-1)==y.charCodeAt(y.length-p-1);)d--,p++;u[u.length-1]=v.slice(0,v.length-p).replace(/^\u200b+/,""),u[0]=u[0].slice(d).replace(/\u200b+$/,"");var T=gt(e,d),k=gt(l,f.length?$(f).length-p:0);return 1<u.length||u[0]||_t(T,k)?(lo(r.doc,u,T,k,"+input"),!0):void 0},Ds.prototype.ensurePolled=function(){this.forceCompositionEnd()},Ds.prototype.reset=function(){this.forceCompositionEnd()},Ds.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Ds.prototype.readFromDOMSoon=function(){var t=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(t.readDOMTimeout=null,t.composing){if(!t.composing.done)return;t.composing=null}t.updateFromDOM()},80))},Ds.prototype.updateFromDOM=function(){var t=this;!this.cm.isReadOnly()&&this.pollContent()||jr(this.cm,function(){return $r(t.cm)})},Ds.prototype.setUneditable=function(t){t.contentEditable="false"},Ds.prototype.onKeyPress=function(t){0==t.charCode||this.composing||(t.preventDefault(),this.cm.isReadOnly()||Vr(this.cm,Ss)(this.cm,String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),0))},Ds.prototype.readOnlyChanged=function(t){this.div.contentEditable=String("nocursor"!=t)},Ds.prototype.onContextMenu=function(){},Ds.prototype.resetPosition=function(){},Ds.prototype.needsContentAttribute=!0;var Hs,Ws,zs,qs=function(t){this.cm=t,this.prevInput="",this.pollingFast=!1,this.polling=new U,this.hasSelection=!1,this.composing=null};qs.prototype.init=function(e){var t=this,i=this,r=this.cm;this.createField(e);var n=this.textarea;function o(t){if(!oe(r,t)){if(r.somethingSelected())Cs({lineWise:!1,text:r.getSelections()});else{if(!r.options.lineWiseCopyCut)return;var e=Ns(r);Cs({lineWise:!0,text:e.text}),"cut"==t.type?r.setSelections(e.ranges,null,q):(i.prevInput="",n.value=e.text.join("\n"),D(n))}"cut"==t.type&&(r.state.cutIncoming=!0)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),h&&(n.style.width="0px"),ee(n,"input",function(){T&&9<=k&&t.hasSelection&&(t.hasSelection=null),i.poll()}),ee(n,"paste",function(t){oe(r,t)||As(t,r)||(r.state.pasteIncoming=!0,i.fastPoll())}),ee(n,"cut",o),ee(n,"copy",o),ee(e.scroller,"paste",function(t){xi(e,t)||oe(r,t)||(r.state.pasteIncoming=!0,i.focus())}),ee(e.lineSpace,"selectstart",function(t){xi(e,t)||ce(t)}),ee(n,"compositionstart",function(){var t=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:t,range:r.markText(t,r.getCursor("to"),{className:"CodeMirror-composing"})}}),ee(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},qs.prototype.createField=function(t){this.wrapper=Is(),this.textarea=this.wrapper.firstChild},qs.prototype.prepareSelection=function(){var t=this.cm,e=t.display,i=t.doc,r=lr(t);if(t.options.moveInputWithCursor){var n=ji(t,i.sel.primary().head,"div"),o=e.wrapper.getBoundingClientRect(),s=e.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(e.wrapper.clientHeight-10,n.top+s.top-o.top)),r.teLeft=Math.max(0,Math.min(e.wrapper.clientWidth-10,n.left+s.left-o.left))}return r},qs.prototype.showSelection=function(t){var e=this.cm.display;A(e.cursorDiv,t.cursors),A(e.selectionDiv,t.selection),null!=t.teTop&&(this.wrapper.style.top=t.teTop+"px",this.wrapper.style.left=t.teLeft+"px")},qs.prototype.reset=function(t){if(!this.contextMenuPending&&!this.composing){var e=this.cm;if(e.somethingSelected()){this.prevInput="";var i=e.getSelection();this.textarea.value=i,e.state.focused&&D(this.textarea),T&&9<=k&&(this.hasSelection=i)}else t||(this.prevInput=this.textarea.value="",T&&9<=k&&(this.hasSelection=null))}},qs.prototype.getField=function(){return this.textarea},qs.prototype.supportsTouch=function(){return!1},qs.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!f||I()!=this.textarea))try{this.textarea.focus()}catch(t){}},qs.prototype.blur=function(){this.textarea.blur()},qs.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},qs.prototype.receivedFocus=function(){this.slowPoll()},qs.prototype.slowPoll=function(){var t=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){t.poll(),t.cm.state.focused&&t.slowPoll()})},qs.prototype.fastPoll=function(){var e=!1,i=this;i.pollingFast=!0,i.polling.set(20,function t(){i.poll()||e?(i.pollingFast=!1,i.slowPoll()):(e=!0,i.polling.set(60,t))})},qs.prototype.poll=function(){var t=this,e=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||!e.state.focused||ke(i)&&!r&&!this.composing||e.isReadOnly()||e.options.disableInput||e.state.keySeq)return!1;var n=i.value;if(n==r&&!e.somethingSelected())return!1;if(T&&9<=k&&this.hasSelection===n||x&&/[\uf700-\uf7ff]/.test(n))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var o=n.charCodeAt(0);if(8203!=o||r||(r="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var s=0,a=Math.min(r.length,n.length);s<a&&r.charCodeAt(s)==n.charCodeAt(s);)++s;return jr(e,function(){Ss(e,n.slice(s),r.length-s,null,t.composing?"*compose":null),1e3<n.length||-1<n.indexOf("\n")?i.value=t.prevInput="":t.prevInput=n,t.composing&&(t.composing.range.clear(),t.composing.range=e.markText(t.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},qs.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},qs.prototype.onKeyPress=function(){T&&9<=k&&(this.hasSelection=null),this.fastPoll()},qs.prototype.onContextMenu=function(t){var i=this,r=i.cm,n=r.display,o=i.textarea,e=or(r,t),s=n.scroller.scrollTop;if(e&&!g){r.options.resetSelectionOnContextMenu&&-1==r.doc.sel.contains(e)&&Vr(r,Yn)(r.doc,yn(e),q);var a=o.style.cssText,l=i.wrapper.style.cssText;i.wrapper.style.cssText="position: absolute";var c,h=i.wrapper.getBoundingClientRect();if(o.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(t.clientY-h.top-5)+"px; left: "+(t.clientX-h.left-5)+"px;\n z-index: 1000; background: "+(T?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",y&&(c=window.scrollY),n.input.focus(),y&&window.scrollTo(null,c),n.input.reset(),r.somethingSelected()||(o.value=i.prevInput=" "),i.contextMenuPending=!0,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll),T&&9<=k&&f(),b){fe(t);var u=function(){re(window,"mouseup",u),setTimeout(d,20)};ee(window,"mouseup",u)}else setTimeout(d,50)}function f(){if(null!=o.selectionStart){var t=r.somethingSelected(),e="​"+(t?o.value:"");o.value="⇚",o.value=e,i.prevInput=t?"":"​",o.selectionStart=1,o.selectionEnd=e.length,n.selForContextMenu=r.doc.sel}}function d(){if(i.contextMenuPending=!1,i.wrapper.style.cssText=l,o.style.cssText=a,T&&k<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=s),null!=o.selectionStart){(!T||T&&k<9)&&f();var t=0,e=function(){n.selForContextMenu==r.doc.sel&&0==o.selectionStart&&0<o.selectionEnd&&"​"==i.prevInput?Vr(r,eo)(r):t++<10?n.detectingSelectAll=setTimeout(e,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(e,200)}}},qs.prototype.readOnlyChanged=function(t){t||this.reset(),this.textarea.disabled="nocursor"==t},qs.prototype.setUneditable=function(){},qs.prototype.needsContentAttribute=!1,function(n){var o=n.optionHandlers;function t(t,e,r,i){n.defaults[t]=e,r&&(o[t]=i?function(t,e,i){i!=gs&&r(t,e,i)}:r)}n.defineOption=t,n.Init=gs,t("value","",function(t,e){return t.setValue(e)},!0),t("mode",null,function(t,e){t.doc.modeOption=e,wn(t)},!0),t("indentUnit",2,wn,!0),t("indentWithTabs",!1),t("smartIndent",!0),t("tabSize",4,function(t){En(t),Fi(t),$r(t)},!0),t("lineSeparator",null,function(t,r){if(t.doc.lineSep=r){var n=[],o=t.doc.first;t.doc.iter(function(t){for(var e=0;;){var i=t.text.indexOf(r,e);if(-1==i)break;e=i+r.length,n.push(gt(o,i))}o++});for(var e=n.length-1;0<=e;e--)lo(t.doc,r,n[e],gt(n[e].line,n[e].ch+r.length))}}),t("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,e,i){t.state.specialChars=new RegExp(e.source+(e.test("\t")?"":"|\t"),"g"),i!=gs&&t.refresh()}),t("specialCharPlaceholder",Ze,function(t){return t.refresh()},!0),t("electricChars",!0),t("inputStyle",f?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),t("spellcheck",!1,function(t,e){return t.getInputField().spellcheck=e},!0),t("rtlMoveVisually",!p),t("wholeLineUpdateBefore",!0),t("theme","default",function(t){ms(t),ys(t)},!0),t("keyMap","default",function(t,e,i){var r=Go(e),n=i!=gs&&Go(i);n&&n.detach&&n.detach(t,r),r.attach&&r.attach(t,n||null)}),t("extraKeys",null),t("configureMouse",null),t("lineWrapping",!1,Ts,!0),t("gutters",[],function(t){hn(t.options),ys(t)},!0),t("fixedGutter",!0,function(t,e){t.display.gutters.style.left=e?ir(t.display)+"px":"0",t.refresh()},!0),t("coverGutterNextToScrollbar",!1,function(t){return Mr(t)},!0),t("scrollbarStyle","native",function(t){Br(t),Mr(t),t.display.scrollbars.setScrollTop(t.doc.scrollTop),t.display.scrollbars.setScrollLeft(t.doc.scrollLeft)},!0),t("lineNumbers",!1,function(t){hn(t.options),ys(t)},!0),t("firstLineNumber",1,ys,!0),t("lineNumberFormatter",function(t){return t},ys,!0),t("showCursorWhenSelecting",!1,ar,!0),t("resetSelectionOnContextMenu",!0),t("lineWiseCopyCut",!0),t("pasteLinesPerSelection",!0),t("selectionsMayTouch",!1),t("readOnly",!1,function(t,e){"nocursor"==e&&(gr(t),t.display.input.blur()),t.display.input.readOnlyChanged(e)}),t("disableInput",!1,function(t,e){e||t.display.input.reset()},!0),t("dragDrop",!0,xs),t("allowDropFileTypes",null),t("cursorBlinkRate",530),t("cursorScrollMargin",0),t("cursorHeight",1,ar,!0),t("singleCursorHeightPerLine",!0,ar,!0),t("workTime",100),t("workDelay",100),t("flattenSpans",!0,En,!0),t("addModeClass",!1,En,!0),t("pollInterval",100),t("undoDepth",200,function(t,e){return t.doc.history.undoDepth=e}),t("historyEventDelay",1250),t("viewportMargin",10,function(t){return t.refresh()},!0),t("maxHighlightLength",1e4,En,!0),t("moveInputWithCursor",!0,function(t,e){e||t.display.input.resetPosition()}),t("tabindex",null,function(t,e){return t.display.input.getField().tabIndex=e||""}),t("autofocus",null),t("direction","ltr",function(t,e){return t.doc.setDirection(e)},!0),t("phrases",null)}(ks),Ws=(Hs=ks).optionHandlers,zs=Hs.helpers={},Hs.prototype={constructor:Hs,focus:function(){window.focus(),this.display.input.focus()},setOption:function(t,e){var i=this.options,r=i[t];i[t]==e&&"mode"!=t||(i[t]=e,Ws.hasOwnProperty(t)&&Vr(this,Ws[t])(this,e,r),ne(this,"optionChange",this,t))},getOption:function(t){return this.options[t]},getDoc:function(){return this.doc},addKeyMap:function(t,e){this.state.keyMaps[e?"push":"unshift"](Go(t))},removeKeyMap:function(t){for(var e=this.state.keyMaps,i=0;i<e.length;++i)if(e[i]==t||e[i].name==t)return e.splice(i,1),!0},addOverlay:Yr(function(t,e){var i=t.token?t:Hs.getMode(this.options,t);if(i.startState)throw new Error("Overlays may not be stateful.");!function(t,e,i){for(var r=0,n=i(e);r<t.length&&i(t[r])<=n;)r++;t.splice(r,0,e)}(this.state.overlays,{mode:i,modeSpec:t,opaque:e&&e.opaque,priority:e&&e.priority||0},function(t){return t.priority}),this.state.modeGen++,$r(this)}),removeOverlay:Yr(function(t){for(var e=this.state.overlays,i=0;i<e.length;++i){var r=e[i].modeSpec;if(r==t||"string"==typeof t&&r.name==t)return e.splice(i,1),this.state.modeGen++,void $r(this)}}),indentLine:Yr(function(t,e,i){"string"!=typeof e&&"number"!=typeof e&&(e=null==e?this.options.smartIndent?"smart":"prev":e?"add":"subtract"),pt(this.doc,t)&&ws(this,t,e,i)}),indentSelection:Yr(function(t){for(var e=this.doc.sel.ranges,i=-1,r=0;r<e.length;r++){var n=e[r];if(n.empty())n.head.line>i&&(ws(this,n.head.line,t,!0),i=n.head.line,r==this.doc.sel.primIndex&&wr(this));else{var o=n.from(),s=n.to(),a=Math.max(i,o.line);i=Math.min(this.lastLine(),s.line-(s.ch?0:1))+1;for(var l=a;l<i;++l)ws(this,l,t);var c=this.doc.sel.ranges;0==o.ch&&e.length==c.length&&0<c[r].from().ch&&Gn(this.doc,r,new _n(o,c[r].to()),q)}}}),getTokenAt:function(t,e){return Ge(this,t,e)},getLineTokens:function(t,e){return Ge(this,gt(t),e,!0)},getTokenTypeAt:function(t){t=bt(this.doc,t);var e,i=Fe(this,lt(this.doc,t.line)),r=0,n=(i.length-1)/2,o=t.ch;if(0==o)e=i[2];else for(;;){var s=r+n>>1;if((s?i[2*s-1]:0)>=o)n=s;else{if(!(i[2*s+1]<o)){e=i[2*s+2];break}r=s+1}}var a=e?e.indexOf("overlay "):-1;return a<0?e:0==a?null:e.slice(0,a-1)},getModeAt:function(t){var e=this.doc.mode;return e.innerMode?Hs.innerMode(e,this.getTokenAt(t).state).mode:e},getHelper:function(t,e){return this.getHelpers(t,e)[0]},getHelpers:function(t,e){var i=[];if(!zs.hasOwnProperty(e))return i;var r=zs[e],n=this.getModeAt(t);if("string"==typeof n[e])r[n[e]]&&i.push(r[n[e]]);else if(n[e])for(var o=0;o<n[e].length;o++){var s=r[n[e][o]];s&&i.push(s)}else n.helperType&&r[n.helperType]?i.push(r[n.helperType]):r[n.name]&&i.push(r[n.name]);for(var a=0;a<r._global.length;a++){var l=r._global[a];l.pred(n,this)&&-1==H(i,l.val)&&i.push(l.val)}return i},getStateAfter:function(t,e){var i=this.doc;return Ue(this,(t=kt(i,null==t?i.first+i.size-1:t))+1,e).state},cursorCoords:function(t,e){var i=this.doc.sel.primary();return ji(this,null==t?i.head:"object"==typeof t?bt(this.doc,t):t?i.from():i.to(),e||"page")},charCoords:function(t,e){return Gi(this,bt(this.doc,t),e||"page")},coordsChar:function(t,e){return Ki(this,(t=qi(this,t,e||"page")).left,t.top)},lineAtHeight:function(t,e){return t=qi(this,{top:t,left:0},e||"page").top,dt(this.doc,t+this.display.viewOffset)},heightAtLine:function(t,e,i){var r,n=!1;if("number"==typeof t){var o=this.doc.first+this.doc.size-1;t<this.doc.first?t=this.doc.first:o<t&&(t=o,n=!0),r=lt(this.doc,t)}else r=t;return zi(this,r,{top:0,left:0},e||"page",i||n).top+(n?this.doc.height-Yt(r):0)},defaultTextHeight:function(){return Ji(this.display)},defaultCharWidth:function(){return tr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(t,e,i,r,n){var o,s,a,l=this.display,c=(t=ji(this,bt(this.doc,t))).bottom,h=t.left;if(e.style.position="absolute",e.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(e),l.sizer.appendChild(e),"over"==r)c=t.top;else if("above"==r||"near"==r){var u=Math.max(l.wrapper.clientHeight,this.doc.height),f=Math.max(l.sizer.clientWidth,l.lineSpace.clientWidth);("above"==r||t.bottom+e.offsetHeight>u)&&t.top>e.offsetHeight?c=t.top-e.offsetHeight:t.bottom+e.offsetHeight<=u&&(c=t.bottom),h+e.offsetWidth>f&&(h=f-e.offsetWidth)}e.style.top=c+"px",e.style.left=e.style.right="","right"==n?(h=l.sizer.clientWidth-e.offsetWidth,e.style.right="0px"):("left"==n?h=0:"middle"==n&&(h=(l.sizer.clientWidth-e.offsetWidth)/2),e.style.left=h+"px"),i&&(o=this,s={left:h,top:c,right:h+e.offsetWidth,bottom:c+e.offsetHeight},null!=(a=kr(o,s)).scrollTop&&Ar(o,a.scrollTop),null!=a.scrollLeft&&Nr(o,a.scrollLeft))},triggerOnKeyDown:Yr(ns),triggerOnKeyPress:Yr(ss),triggerOnKeyUp:os,triggerOnMouseDown:Yr(hs),execCommand:function(t){if($o.hasOwnProperty(t))return $o[t].call(null,this)},triggerElectric:Yr(function(t){Ls(this,t)}),findPosH:function(t,e,i,r){var n=1;e<0&&(n=-1,e=-e);for(var o=bt(this.doc,t),s=0;s<e&&!(o=Rs(this.doc,o,n,i,r)).hitSide;++s);return o},moveH:Yr(function(e,i){var r=this;this.extendSelectionsBy(function(t){return r.display.shift||r.doc.extend||t.empty()?Rs(r.doc,t.head,e,i,r.options.rtlMoveVisually):e<0?t.from():t.to()},j)}),deleteH:Yr(function(i,r){var t=this.doc.sel,n=this.doc;t.somethingSelected()?n.replaceSelection("",null,"+delete"):jo(this,function(t){var e=Rs(n,t.head,i,r,!1);return i<0?{from:e,to:t.head}:{from:t.head,to:e}})}),findPosV:function(t,e,i,r){var n=1,o=r;e<0&&(n=-1,e=-e);for(var s=bt(this.doc,t),a=0;a<e;++a){var l=ji(this,s,"div");if(null==o?o=l.left:l.left=o,(s=Ms(this,l,n,i)).hitSide)break}return s},moveV:Yr(function(r,n){var o=this,s=this.doc,a=[],l=!this.display.shift&&!s.extend&&s.sel.somethingSelected();if(s.extendSelectionsBy(function(t){if(l)return r<0?t.from():t.to();var e=ji(o,t.head,"div");null!=t.goalColumn&&(e.left=t.goalColumn),a.push(e.left);var i=Ms(o,e,r,n);return"page"==n&&t==s.sel.primary()&&br(o,Gi(o,i,"div").top-e.top),i},j),a.length)for(var t=0;t<s.sel.ranges.length;t++)s.sel.ranges[t].goalColumn=a[t]}),findWordAt:function(t){var e=lt(this.doc,t.line).text,i=t.ch,r=t.ch;if(e){var n=this.getHelper(t,"wordChars");"before"!=t.sticky&&r!=e.length||!i?++r:--i;for(var o=e.charAt(i),s=et(o,n)?function(t){return et(t,n)}:/\s/.test(o)?function(t){return/\s/.test(t)}:function(t){return!/\s/.test(t)&&!et(t)};0<i&&s(e.charAt(i-1));)--i;for(;r<e.length&&s(e.charAt(r));)++r}return new _n(gt(t.line,i),gt(t.line,r))},toggleOverwrite:function(t){null!=t&&t==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?R(this.display.cursorDiv,"CodeMirror-overwrite"):C(this.display.cursorDiv,"CodeMirror-overwrite"),ne(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==I()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:Yr(function(t,e){Er(this,t,e)}),getScrollInfo:function(){var t=this.display.scroller;return{left:t.scrollLeft,top:t.scrollTop,height:t.scrollHeight-wi(this)-this.display.barHeight,width:t.scrollWidth-wi(this)-this.display.barWidth,clientHeight:Ci(this),clientWidth:Ei(this)}},scrollIntoView:Yr(function(t,e){var i,r;null==t?(t={from:this.doc.sel.primary().head,to:null},null==e&&(e=this.options.cursorScrollMargin)):"number"==typeof t?t={from:gt(t,0),to:null}:null==t.from&&(t={from:t,to:null}),t.to||(t.to=t.from),t.margin=e||0,null!=t.from.line?(r=t,Cr(i=this),i.curOp.scrollToPos=r):Sr(this,t.from,t.to,t.margin)}),setSize:Yr(function(t,e){var i=this,r=function(t){return"number"==typeof t||/^\d+$/.test(String(t))?t+"px":t};null!=t&&(this.display.wrapper.style.width=r(t)),null!=e&&(this.display.wrapper.style.height=r(e)),this.options.lineWrapping&&Bi(this);var n=this.display.viewFrom;this.doc.iter(n,this.display.viewTo,function(t){if(t.widgets)for(var e=0;e<t.widgets.length;e++)if(t.widgets[e].noHScroll){Qr(i,n,"widget");break}++n}),this.curOp.forceUpdate=!0,ne(this,"refresh",this)}),operation:function(t){return jr(this,t)},startOperation:function(){return Ur(this)},endOperation:function(){return Hr(this)},refresh:Yr(function(){var t=this.display.cachedTextHeight;$r(this),this.curOp.forceUpdate=!0,Fi(this),Er(this,this.doc.scrollLeft,this.doc.scrollTop),an(this),(null==t||.5<Math.abs(t-Ji(this.display)))&&nr(this),ne(this,"refresh",this)}),swapDoc:Yr(function(t){var e=this.doc;return e.cm=null,Ln(this,t),Fi(this),this.display.input.reset(),Er(this,t.scrollLeft,t.scrollTop),this.curOp.forceScroll=!0,ai(this,"swapDoc",this,e),e}),phrase:function(t){var e=this.options.phrases;return e&&Object.prototype.hasOwnProperty.call(e,t)?e[t]:t},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},le(Hs),Hs.registerHelper=function(t,e,i){zs.hasOwnProperty(t)||(zs[t]=Hs[t]={_global:[]}),zs[t][e]=i},Hs.registerGlobalHelper=function(t,e,i,r){Hs.registerHelper(t,e,r),zs[t]._global.push({pred:i,val:r})};var Gs,js="iter insert remove copy getEditor constructor".split(" ");for(var Vs in Eo.prototype)Eo.prototype.hasOwnProperty(Vs)&&H(js,Vs)<0&&(ks.prototype[Vs]=function(t){return function(){return t.apply(this.doc,arguments)}}(Eo.prototype[Vs]));return le(Eo),ks.inputStyles={textarea:qs,contenteditable:Ds},ks.defineMode=function(t){ks.defaults.mode||"null"==t||(ks.defaults.mode=t),function(t,e){2<arguments.length&&(e.dependencies=Array.prototype.slice.call(arguments,2)),Ee[t]=e}.apply(this,arguments)},ks.defineMIME=function(t,e){Ce[t]=e},ks.defineMode("null",function(){return{token:function(t){return t.skipToEnd()}}}),ks.defineMIME("text/plain","null"),ks.defineExtension=function(t,e){ks.prototype[t]=e},ks.defineDocExtension=function(t,e){Eo.prototype[t]=e},ks.fromTextArea=function(e,t){if((t=t?B(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var i=I();t.autofocus=i==e||null!=e.getAttribute("autofocus")&&i==document.body}function r(){e.value=a.getValue()}var n;if(e.form&&(ee(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var o=e.form;n=o.submit;try{var s=o.submit=function(){r(),o.submit=n,o.submit(),o.submit=s}}catch(t){}}t.finishInit=function(t){t.save=r,t.getTextArea=function(){return e},t.toTextArea=function(){t.toTextArea=isNaN,r(),e.parentNode.removeChild(t.getWrapperElement()),e.style.display="",e.form&&(re(e.form,"submit",r),"function"==typeof e.form.submit&&(e.form.submit=n))}},e.style.display="none";var a=ks(function(t){return e.parentNode.insertBefore(t,e.nextSibling)},t);return a},(Gs=ks).off=re,Gs.on=ee,Gs.wheelEventPixels=pn,Gs.Doc=Eo,Gs.splitLines=Te,Gs.countColumn=F,Gs.findColumn=V,Gs.isWordChar=tt,Gs.Pass=z,Gs.signal=ne,Gs.Line=Ye,Gs.changeEnd=xn,Gs.scrollbarModel=Pr,Gs.Pos=gt,Gs.cmpPos=_t,Gs.modes=Ee,Gs.mimeModes=Ce,Gs.resolveMode=Se,Gs.getMode=Ae,Gs.modeExtensions=Le,Gs.extendMode=Ne,Gs.copyState=Oe,Gs.startState=Re,Gs.innerMode=Ie,Gs.commands=$o,Gs.keyMap=Bo,Gs.keyName=qo,Gs.isModifierKey=Wo,Gs.lookupKey=Ho,Gs.normalizeKeyMap=Uo,Gs.StringStream=Me,Gs.SharedTextMarker=To,Gs.TextMarker=yo,Gs.LineWidget=go,Gs.e_preventDefault=ce,Gs.e_stopPropagation=he,Gs.e_stop=fe,Gs.addClass=R,Gs.contains=O,Gs.rmClass=C,Gs.keyNames=Ro,ks.version="5.42.0",ks},"object"==typeof i&&void 0!==e?e.exports=n():"function"==typeof define&&define.amd?define(n):r.CodeMirror=n()},{}],13:[function(t,e,i){var r;r=function(N){"use strict";function O(t,e,i,r,n,o){this.indented=t,this.column=e,this.type=i,this.info=r,this.align=n,this.prev=o}function I(t,e,i,r){var n=t.indented;return t.context&&"statement"==t.context.type&&"statement"!=i&&(n=t.context.indented),t.context=new O(n,e,i,r,null,t.context)}function R(t){var e=t.context.type;return")"!=e&&"]"!=e&&"}"!=e||(t.indented=t.context.indented),t.context=t.context.prev}function M(t,e,i){return"variable"==e.prevToken||"type"==e.prevToken||(!!/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(t.string.slice(0,i))||(!(!e.typeAtEndOfLine||t.column()!=t.indentation())||void 0))}function D(t){for(;;){if(!t||"top"==t.type)return!0;if("}"==t.type&&"namespace"!=t.prev.info)return!1;t=t.prev}}function t(t){for(var e={},i=t.split(" "),r=0;r<i.length;++r)e[i[r]]=!0;return e}function P(t,e){return"function"==typeof t?t(e):t.propertyIsEnumerable(e)}N.defineMode("clike",function(t,a){var s,l,c=t.indentUnit,h=a.statementIndentUnit||c,u=a.dontAlignCalls,f=a.keywords||{},d=a.types||{},p=a.builtin||{},m=a.blockKeywords||{},g=a.defKeywords||{},_=a.atoms||{},v=a.hooks||{},y=a.multiLineStrings,o=!1!==a.indentStatements,e=!1!==a.indentSwitch,x=a.namespaceSeparator,T=a.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,k=a.numberStart||/[\d\.]/,b=a.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,w=a.isOperatorChar||/[+\-*&%=<>!?|\/]/,E=a.isIdentifierChar||/[\w\$_\xa1-\uffff]/,C=a.isReservedIdentifier||!1;function S(t,e){var o,i=t.next();if(v[i]){var r=v[i](t,e);if(!1!==r)return r}if('"'==i||"'"==i)return e.tokenize=(o=i,function(t,e){for(var i,r=!1,n=!1;null!=(i=t.next());){if(i==o&&!r){n=!0;break}r=!r&&"\\"==i}return(n||!r&&!y)&&(e.tokenize=null),"string"}),e.tokenize(t,e);if(T.test(i))return s=i,null;if(k.test(i)){if(t.backUp(1),t.match(b))return"number";t.next()}if("/"==i){if(t.eat("*"))return(e.tokenize=A)(t,e);if(t.eat("/"))return t.skipToEnd(),"comment"}if(w.test(i)){for(;!t.match(/^\/[\/*]/,!1)&&t.eat(w););return"operator"}if(t.eatWhile(E),x)for(;t.match(x);)t.eatWhile(E);var n=t.current();return P(f,n)?(P(m,n)&&(s="newstatement"),P(g,n)&&(l=!0),"keyword"):P(d,n)?"type":P(p,n)||C&&C(n)?(P(m,n)&&(s="newstatement"),"builtin"):P(_,n)?"atom":"variable"}function A(t,e){for(var i,r=!1;i=t.next();){if("/"==i&&r){e.tokenize=null;break}r="*"==i}return"comment"}function L(t,e){a.typeFirstDefinitions&&t.eol()&&D(e.context)&&(e.typeAtEndOfLine=M(t,e,t.pos))}return{startState:function(t){return{tokenize:null,context:new O((t||0)-c,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(t,e){var i=e.context;if(t.sol()&&(null==i.align&&(i.align=!1),e.indented=t.indentation(),e.startOfLine=!0),t.eatSpace())return L(t,e),null;s=l=null;var r=(e.tokenize||S)(t,e);if("comment"==r||"meta"==r)return r;if(null==i.align&&(i.align=!0),";"==s||":"==s||","==s&&t.match(/^\s*(?:\/\/.*)?$/,!1))for(;"statement"==e.context.type;)R(e);else if("{"==s)I(e,t.column(),"}");else if("["==s)I(e,t.column(),"]");else if("("==s)I(e,t.column(),")");else if("}"==s){for(;"statement"==i.type;)i=R(e);for("}"==i.type&&(i=R(e));"statement"==i.type;)i=R(e)}else s==i.type?R(e):o&&(("}"==i.type||"top"==i.type)&&";"!=s||"statement"==i.type&&"newstatement"==s)&&I(e,t.column(),"statement",t.current());if("variable"==r&&("def"==e.prevToken||a.typeFirstDefinitions&&M(t,e,t.start)&&D(e.context)&&t.match(/^\s*\(/,!1))&&(r="def"),v.token){var n=v.token(t,e,r);void 0!==n&&(r=n)}return"def"==r&&!1===a.styleDefs&&(r="variable"),e.startOfLine=!1,e.prevToken=l?"def":r||s,L(t,e),r},indent:function(t,e){if(t.tokenize!=S&&null!=t.tokenize||t.typeAtEndOfLine)return N.Pass;var i=t.context,r=e&&e.charAt(0),n=r==i.type;if("statement"==i.type&&"}"==r&&(i=i.prev),a.dontIndentStatements)for(;"statement"==i.type&&a.dontIndentStatements.test(i.info);)i=i.prev;if(v.indent){var o=v.indent(t,i,e,c);if("number"==typeof o)return o}var s=i.prev&&"switch"==i.prev.info;if(a.allmanIndentation&&/[{(]/.test(r)){for(;"top"!=i.type&&"}"!=i.type;)i=i.prev;return i.indented}return"statement"==i.type?i.indented+("{"==r?0:h):!i.align||u&&")"==i.type?")"!=i.type||n?i.indented+(n?0:c)+(n||!s||/^(?:case|default)\b/.test(e)?0:c):i.indented+h:i.column+(n?0:1)},electricInput:e?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:"//",fold:"brace"}});var e="auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile inline restrict asm fortran",i=t("int long char short double float unsigned signed void bool"),r=t("SEL instancetype id Class Protocol BOOL");function n(t){return P(i,t)||/.+_t/.test(t)}var o="case do else for if switch while struct enum union",s="struct enum union";function a(t,e){if(!e.startOfLine)return!1;for(var i,r=null;i=t.peek();){if("\\"==i&&t.match(/^.$/)){r=a;break}if("/"==i&&t.match(/^\/[\/\*]/,!1))break;t.next()}return e.tokenize=r,"meta"}function l(t,e){return"type"==e.prevToken&&"type"}function c(t){return!(!t||t.length<2)&&("_"==t[0]&&("_"==t[1]||t[1]!==t[1].toLowerCase()))}function h(t){return t.eatWhile(/[\w\.']/),"number"}function u(t,e){if(t.backUp(1),t.match(/(R|u8R|uR|UR|LR)/)){var i=t.match(/"([^\s\\()]{0,16})\(/);return!!i&&(e.cpp11RawStringDelim=i[1],(e.tokenize=d)(t,e))}return t.match(/(u8|u|U|L)/)?!!t.match(/["']/,!1)&&"string":(t.next(),!1)}function f(t,e){for(var i;null!=(i=t.next());)if('"'==i&&!t.eat('"')){e.tokenize=null;break}return"string"}function d(t,e){var i=e.cpp11RawStringDelim.replace(/[^\w\s]/g,"\\$&");return t.match(new RegExp(".*?\\)"+i+'"'))?e.tokenize=null:t.skipToEnd(),"string"}function p(t,e){"string"==typeof t&&(t=[t]);var i=[];function r(t){if(t)for(var e in t)t.hasOwnProperty(e)&&i.push(e)}r(e.keywords),r(e.types),r(e.builtin),r(e.atoms),i.length&&(e.helperType=t[0],N.registerHelper("hintWords",t[0],i));for(var n=0;n<t.length;++n)N.defineMIME(t[n],e)}function m(t,e){for(var i=!1;!t.eol();){if(!i&&t.match('"""')){e.tokenize=null;break}i="\\"==t.next()&&!i}return"string"}p(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:t(e),types:n,blockKeywords:t(o),defKeywords:t(s),typeFirstDefinitions:!0,atoms:t("NULL true false"),isReservedIdentifier:c,hooks:{"#":a,"*":l},modeProps:{fold:["brace","include"]}}),p(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:t(e+"alignas alignof and and_eq audit axiom bitand bitor catch class compl concept constexpr const_cast decltype delete dynamic_cast explicit export final friend import module mutable namespace new noexcept not not_eq operator or or_eq override private protected public reinterpret_cast requires static_assert static_cast template this thread_local throw try typeid typename using virtual xor xor_eq"),types:n,blockKeywords:t(o+" class try catch"),defKeywords:t(s+" class namespace"),typeFirstDefinitions:!0,atoms:t("true false NULL nullptr"),dontIndentStatements:/^template$/,isIdentifierChar:/[\w\$_~\xa1-\uffff]/,isReservedIdentifier:c,hooks:{"#":a,"*":l,u:u,U:u,L:u,R:u,0:h,1:h,2:h,3:h,4:h,5:h,6:h,7:h,8:h,9:h,token:function(t,e,i){if("variable"==i&&"("==t.peek()&&(";"==e.prevToken||null==e.prevToken||"}"==e.prevToken)&&(r=t.current(),(n=/(\w+)::~?(\w+)$/.exec(r))&&n[1]==n[2]))return"def";var r,n}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),p("text/x-java",{name:"clike",keywords:t("abstract assert break case catch class const continue default do else enum extends final finally float for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while @interface"),types:t("byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:t("catch class do else finally for if switch try while"),defKeywords:t("class interface enum @interface"),typeFirstDefinitions:!0,atoms:t("true false null"),number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,hooks:{"@":function(t){return!t.match("interface",!1)&&(t.eatWhile(/[\w\$_]/),"meta")}},modeProps:{fold:["brace","import"]}}),p("text/x-csharp",{name:"clike",keywords:t("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:t("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:t("catch class do else finally for foreach if struct switch try while"),defKeywords:t("class interface namespace struct var"),typeFirstDefinitions:!0,atoms:t("true false null"),hooks:{"@":function(t,e){return t.eat('"')?(e.tokenize=f)(t,e):(t.eatWhile(/[\w\$_]/),"meta")}}}),p("text/x-scala",{name:"clike",keywords:t("abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble"),types:t("AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:t("catch class enum do else finally for forSome if match switch try while"),defKeywords:t("class enum def object package trait type val var"),atoms:t("true false null"),indentStatements:!1,indentSwitch:!1,isOperatorChar:/[+\-*&%=<>!?|\/#:@]/,hooks:{"@":function(t){return t.eatWhile(/[\w\$_]/),"meta"},'"':function(t,e){return!!t.match('""')&&(e.tokenize=m,e.tokenize(t,e))},"'":function(t){return t.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},"=":function(t,e){var i=e.context;return!("}"!=i.type||!i.align||!t.eat(">"))&&(e.context=new O(i.indented,i.column,i.type,i.info,null,i.prev),"operator")},"/":function(t,e){return!!t.eat("*")&&(e.tokenize=function r(n){return function(t,e){for(var i;i=t.next();){if("*"==i&&t.eat("/")){if(1!=n)return e.tokenize=r(n-1),e.tokenize(t,e);e.tokenize=null;break}if("/"==i&&t.eat("*"))return e.tokenize=r(n+1),e.tokenize(t,e)}return"comment"}}(1),e.tokenize(t,e))}},modeProps:{closeBrackets:{pairs:'()[]{}""',triples:'"'}}}),p("text/x-kotlin",{name:"clike",keywords:t("package as typealias class interface this super val operator var fun for is in This throw return annotation break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix suspend actual expect setparam"),types:t("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void Annotation Any BooleanArray ByteArray Char CharArray DeprecationLevel DoubleArray Enum FloatArray Function Int IntArray Lazy LazyThreadSafetyMode LongArray Nothing ShortArray Unit"),intendSwitch:!1,indentStatements:!1,multiLineStrings:!0,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+(\.\d+)?|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,blockKeywords:t("catch class do else finally for if where try while enum"),defKeywords:t("class val var object interface fun"),atoms:t("true false null this"),hooks:{"@":function(t){return t.eatWhile(/[\w\$_]/),"meta"},"*":function(t,e){return"."==e.prevToken?"variable":"operator"},'"':function(t,e){var o;return e.tokenize=(o=t.match('""'),function(t,e){for(var i,r=!1,n=!1;!t.eol();){if(!o&&!r&&t.match('"')){n=!0;break}if(o&&t.match('"""')){n=!0;break}i=t.next(),!r&&"$"==i&&t.match("{")&&t.skipTo("}"),r=!r&&"\\"==i&&!o}return!n&&o||(e.tokenize=null),"string"}),e.tokenize(t,e)},indent:function(t,e,i,r){var n=i&&i.charAt(0);return"}"!=t.prevToken&&")"!=t.prevToken||""!=i?"operator"==t.prevToken&&"}"!=i||"variable"==t.prevToken&&"."==n||("}"==t.prevToken||")"==t.prevToken)&&"."==n?2*r+e.indented:e.align&&"}"==e.type?e.indented+(t.context.type==(i||"").charAt(0)?0:r):void 0:t.indented}},modeProps:{closeBrackets:{triples:'"'}}}),p(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:t("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:t("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:t("for while do if else struct"),builtin:t("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:t("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":a},modeProps:{fold:["brace","include"]}}),p("text/x-nesc",{name:"clike",keywords:t(e+" as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:n,blockKeywords:t(o),atoms:t("null true false"),hooks:{"#":a},modeProps:{fold:["brace","include"]}}),p("text/x-objectivec",{name:"clike",keywords:t(e+" bycopy byref in inout oneway out self super atomic nonatomic retain copy readwrite readonly strong weak assign typeof nullable nonnull null_resettable _cmd @interface @implementation @end @protocol @encode @property @synthesize @dynamic @class @public @package @private @protected @required @optional @try @catch @finally @import @selector @encode @defs @synchronized @autoreleasepool @compatibility_alias @available"),types:function(t){return n(t)||P(r,t)},builtin:t("FOUNDATION_EXPORT FOUNDATION_EXTERN NS_INLINE NS_FORMAT_FUNCTION NS_RETURNS_RETAINED NS_ERROR_ENUM NS_RETURNS_NOT_RETAINED NS_RETURNS_INNER_POINTER NS_DESIGNATED_INITIALIZER NS_ENUM NS_OPTIONS NS_REQUIRES_NIL_TERMINATION NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END NS_SWIFT_NAME NS_REFINED_FOR_SWIFT"),blockKeywords:t(o+" @synthesize @try @catch @finally @autoreleasepool @synchronized"),defKeywords:t(s+" @interface @implementation @protocol @class"),dontIndentStatements:/^@.*$/,typeFirstDefinitions:!0,atoms:t("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:c,hooks:{"#":a,"*":l},modeProps:{fold:["brace","include"]}}),p("text/x-squirrel",{name:"clike",keywords:t("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:n,blockKeywords:t("case catch class else for foreach if switch try while"),defKeywords:t("function local class"),typeFirstDefinitions:!0,atoms:t("true false null"),hooks:{"#":a},modeProps:{fold:["brace","include"]}});var g=null;p("text/x-ceylon",{name:"clike",keywords:t("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(t){var e=t.charAt(0);return e===e.toUpperCase()&&e!==e.toLowerCase()},blockKeywords:t("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:t("class dynamic function interface module object package value"),builtin:t("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:t("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(t){return t.eatWhile(/[\w\$_]/),"meta"},'"':function(t,e){return e.tokenize=function o(s){return function(t,e){for(var i,r=!1,n=!1;!t.eol();){if(!r&&t.match('"')&&("single"==s||t.match('""'))){n=!0;break}if(!r&&t.match("``")){g=o(s),n=!0;break}i=t.next(),r="single"==s&&!r&&"\\"==i}return n&&(e.tokenize=null),"string"}}(t.match('""')?"triple":"single"),e.tokenize(t,e)},"`":function(t,e){return!(!g||!t.match("`"))&&(e.tokenize=g,g=null,e.tokenize(t,e))},"'":function(t){return t.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(t,e,i){if(("variable"==i||"type"==i)&&"."==e.prevToken)return"variable-2"}},modeProps:{fold:["brace","import"],closeBrackets:{triples:'"'}}})},"object"==typeof i&&"object"==typeof e?r(t("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":12}],14:[function(t,e,i){var r;r=function(N){"use strict";function t(t){for(var e={},i=0;i<t.length;++i)e[t[i].toLowerCase()]=!0;return e}N.defineMode("css",function(t,e){var i=e.inline;e.propertyKeywords||(e=N.resolveMode("text/css"));var r,n,o=t.indentUnit,s=e.tokenHooks,a=e.documentTypes||{},l=e.mediaTypes||{},c=e.mediaFeatures||{},h=e.mediaValueKeywords||{},u=e.propertyKeywords||{},f=e.nonStandardPropertyKeywords||{},d=e.fontProperties||{},p=e.counterDescriptors||{},m=e.colorKeywords||{},g=e.valueKeywords||{},_=e.allowNested,v=e.lineComment,y=!0===e.supportsAtComponent;function x(t,e){return r=e,t}function T(n){return function(t,e){for(var i,r=!1;null!=(i=t.next());){if(i==n&&!r){")"==n&&t.backUp(1);break}r=!r&&"\\"==i}return(i==n||!r&&")"!=n)&&(e.tokenize=null),x("string","string")}}function k(t,e){return t.next(),t.match(/\s*[\"\')]/,!1)?e.tokenize=null:e.tokenize=T(")"),x(null,"(")}function b(t,e,i){this.type=t,this.indent=e,this.prev=i}function w(t,e,i,r){return t.context=new b(i,e.indentation()+(!1===r?0:o),t.context),i}function E(t){return t.context.prev&&(t.context=t.context.prev),t.context.type}function C(t,e,i){return L[i.context.type](t,e,i)}function S(t,e,i,r){for(var n=r||1;0<n;n--)i.context=i.context.prev;return C(t,e,i)}function A(t){var e=t.current().toLowerCase();n=g.hasOwnProperty(e)?"atom":m.hasOwnProperty(e)?"keyword":"variable"}var L={top:function(t,e,i){if("{"==t)return w(i,e,"block");if("}"==t&&i.context.prev)return E(i);if(y&&/@component/i.test(t))return w(i,e,"atComponentBlock");if(/^@(-moz-)?document$/i.test(t))return w(i,e,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/i.test(t))return w(i,e,"atBlock");if(/^@(font-face|counter-style)/i.test(t))return i.stateArg=t,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(t))return"keyframes";if(t&&"@"==t.charAt(0))return w(i,e,"at");if("hash"==t)n="builtin";else if("word"==t)n="tag";else{if("variable-definition"==t)return"maybeprop";if("interpolation"==t)return w(i,e,"interpolation");if(":"==t)return"pseudo";if(_&&"("==t)return w(i,e,"parens")}return i.context.type},block:function(t,e,i){if("word"!=t)return"meta"==t?"block":_||"hash"!=t&&"qualifier"!=t?L.top(t,e,i):(n="error","block");var r=e.current().toLowerCase();return u.hasOwnProperty(r)?(n="property","maybeprop"):f.hasOwnProperty(r)?(n="string-2","maybeprop"):_?(n=e.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(n+=" error","maybeprop")},maybeprop:function(t,e,i){return":"==t?w(i,e,"prop"):C(t,e,i)},prop:function(t,e,i){if(";"==t)return E(i);if("{"==t&&_)return w(i,e,"propBlock");if("}"==t||"{"==t)return S(t,e,i);if("("==t)return w(i,e,"parens");if("hash"!=t||/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(e.current())){if("word"==t)A(e);else if("interpolation"==t)return w(i,e,"interpolation")}else n+=" error";return"prop"},propBlock:function(t,e,i){return"}"==t?E(i):"word"==t?(n="property","maybeprop"):i.context.type},parens:function(t,e,i){return"{"==t||"}"==t?S(t,e,i):")"==t?E(i):"("==t?w(i,e,"parens"):"interpolation"==t?w(i,e,"interpolation"):("word"==t&&A(e),"parens")},pseudo:function(t,e,i){return"meta"==t?"pseudo":"word"==t?(n="variable-3",i.context.type):C(t,e,i)},documentTypes:function(t,e,i){return"word"==t&&a.hasOwnProperty(e.current())?(n="tag",i.context.type):L.atBlock(t,e,i)},atBlock:function(t,e,i){if("("==t)return w(i,e,"atBlock_parens");if("}"==t||";"==t)return S(t,e,i);if("{"==t)return E(i)&&w(i,e,_?"block":"top");if("interpolation"==t)return w(i,e,"interpolation");if("word"==t){var r=e.current().toLowerCase();n="only"==r||"not"==r||"and"==r||"or"==r?"keyword":l.hasOwnProperty(r)?"attribute":c.hasOwnProperty(r)?"property":h.hasOwnProperty(r)?"keyword":u.hasOwnProperty(r)?"property":f.hasOwnProperty(r)?"string-2":g.hasOwnProperty(r)?"atom":m.hasOwnProperty(r)?"keyword":"error"}return i.context.type},atComponentBlock:function(t,e,i){return"}"==t?S(t,e,i):"{"==t?E(i)&&w(i,e,_?"block":"top",!1):("word"==t&&(n="error"),i.context.type)},atBlock_parens:function(t,e,i){return")"==t?E(i):"{"==t||"}"==t?S(t,e,i,2):L.atBlock(t,e,i)},restricted_atBlock_before:function(t,e,i){return"{"==t?w(i,e,"restricted_atBlock"):"word"==t&&"@counter-style"==i.stateArg?(n="variable","restricted_atBlock_before"):C(t,e,i)},restricted_atBlock:function(t,e,i){return"}"==t?(i.stateArg=null,E(i)):"word"==t?(n="@font-face"==i.stateArg&&!d.hasOwnProperty(e.current().toLowerCase())||"@counter-style"==i.stateArg&&!p.hasOwnProperty(e.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},keyframes:function(t,e,i){return"word"==t?(n="variable","keyframes"):"{"==t?w(i,e,"top"):C(t,e,i)},at:function(t,e,i){return";"==t?E(i):"{"==t||"}"==t?S(t,e,i):("word"==t?n="tag":"hash"==t&&(n="builtin"),"at")},interpolation:function(t,e,i){return"}"==t?E(i):"{"==t||";"==t?S(t,e,i):("word"==t?n="variable":"variable"!=t&&"("!=t&&")"!=t&&(n="error"),"interpolation")}};return{startState:function(t){return{tokenize:null,state:i?"block":"top",stateArg:null,context:new b(i?"block":"top",t||0,null)}},token:function(t,e){if(!e.tokenize&&t.eatSpace())return null;var i=(e.tokenize||function(t,e){var i=t.next();if(s[i]){var r=s[i](t,e);if(!1!==r)return r}return"@"==i?(t.eatWhile(/[\w\\\-]/),x("def",t.current())):"="==i||("~"==i||"|"==i)&&t.eat("=")?x(null,"compare"):'"'==i||"'"==i?(e.tokenize=T(i),e.tokenize(t,e)):"#"==i?(t.eatWhile(/[\w\\\-]/),x("atom","hash")):"!"==i?(t.match(/^\s*\w*/),x("keyword","important")):/\d/.test(i)||"."==i&&t.eat(/\d/)?(t.eatWhile(/[\w.%]/),x("number","unit")):"-"!==i?/[,+>*\/]/.test(i)?x(null,"select-op"):"."==i&&t.match(/^-?[_a-z][_a-z0-9-]*/i)?x("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(i)?x(null,i):("u"==i||"U"==i)&&t.match(/rl(-prefix)?\(/i)||("d"==i||"D"==i)&&t.match("omain(",!0,!0)||("r"==i||"R"==i)&&t.match("egexp(",!0,!0)?(t.backUp(1),e.tokenize=k,x("property","word")):/[\w\\\-]/.test(i)?(t.eatWhile(/[\w\\\-]/),x("property","word")):x(null,null):/[\d.]/.test(t.peek())?(t.eatWhile(/[\w.%]/),x("number","unit")):t.match(/^-[\w\\\-]+/)?(t.eatWhile(/[\w\\\-]/),t.match(/^\s*:/,!1)?x("variable-2","variable-definition"):x("variable-2","variable")):t.match(/^\w+-/)?x("meta","meta"):void 0})(t,e);return i&&"object"==typeof i&&(r=i[1],i=i[0]),n=i,"comment"!=r&&(e.state=L[e.state](r,t,e)),n},indent:function(t,e){var i=t.context,r=e&&e.charAt(0),n=i.indent;return"prop"!=i.type||"}"!=r&&")"!=r||(i=i.prev),i.prev&&("}"!=r||"block"!=i.type&&"top"!=i.type&&"interpolation"!=i.type&&"restricted_atBlock"!=i.type?(")"!=r||"parens"!=i.type&&"atBlock_parens"!=i.type)&&("{"!=r||"at"!=i.type&&"atBlock"!=i.type)||(n=Math.max(0,i.indent-o)):n=(i=i.prev).indent),n},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:v,fold:"brace"}});var e=["domain","regexp","url","url-prefix"],i=t(e),r=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],n=t(r),o=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","orientation","device-pixel-ratio","min-device-pixel-ratio","max-device-pixel-ratio","pointer","any-pointer","hover","any-hover"],s=t(o),a=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive"],l=t(a),c=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-gap","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-gap","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","justify-items","justify-self","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","mix-blend-mode","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","place-content","place-items","place-self","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","user-select","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],h=t(c),u=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],f=t(u),d=t(["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"]),p=t(["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"]),m=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],g=t(m),_=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","graytext","grid","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","multiply","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","opacity","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unset","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"],v=t(_),y=e.concat(r).concat(o).concat(a).concat(c).concat(u).concat(m).concat(_);function x(t,e){for(var i,r=!1;null!=(i=t.next());){if(r&&"/"==i){e.tokenize=null;break}r="*"==i}return["comment","comment"]}N.registerHelper("hintWords","css",y),N.defineMIME("text/css",{documentTypes:i,mediaTypes:n,mediaFeatures:s,mediaValueKeywords:l,propertyKeywords:h,nonStandardPropertyKeywords:f,fontProperties:d,counterDescriptors:p,colorKeywords:g,valueKeywords:v,tokenHooks:{"/":function(t,e){return!!t.eat("*")&&(e.tokenize=x)(t,e)}},name:"css"}),N.defineMIME("text/x-scss",{mediaTypes:n,mediaFeatures:s,mediaValueKeywords:l,propertyKeywords:h,nonStandardPropertyKeywords:f,colorKeywords:g,valueKeywords:v,fontProperties:d,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(t,e){return t.eat("/")?(t.skipToEnd(),["comment","comment"]):t.eat("*")?(e.tokenize=x)(t,e):["operator","operator"]},":":function(t){return!!t.match(/\s*\{/,!1)&&[null,null]},$:function(t){return t.match(/^[\w-]+/),t.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(t){return!!t.eat("{")&&[null,"interpolation"]}},name:"css",helperType:"scss"}),N.defineMIME("text/x-less",{mediaTypes:n,mediaFeatures:s,mediaValueKeywords:l,propertyKeywords:h,nonStandardPropertyKeywords:f,colorKeywords:g,valueKeywords:v,fontProperties:d,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(t,e){return t.eat("/")?(t.skipToEnd(),["comment","comment"]):t.eat("*")?(e.tokenize=x)(t,e):["operator","operator"]},"@":function(t){return t.eat("{")?[null,"interpolation"]:!t.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/i,!1)&&(t.eatWhile(/[\w\\\-]/),t.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),N.defineMIME("text/x-gss",{documentTypes:i,mediaTypes:n,mediaFeatures:s,propertyKeywords:h,nonStandardPropertyKeywords:f,fontProperties:d,counterDescriptors:p,colorKeywords:g,valueKeywords:v,supportsAtComponent:!0,tokenHooks:{"/":function(t,e){return!!t.eat("*")&&(e.tokenize=x)(t,e)}},name:"css",helperType:"gss"})},"object"==typeof i&&"object"==typeof e?r(t("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":12}],15:[function(t,e,i){var r;r=function(p){"use strict";var n={script:[["lang",/(javascript|babel)/i,"javascript"],["type",/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i,"javascript"],["type",/./,"text/plain"],[null,null,"javascript"]],style:[["lang",/^css$/i,"css"],["type",/^(text\/)?(x-)?(stylesheet|css)$/i,"css"],["type",/./,"text/plain"],[null,null,"css"]]};var o={};function m(t,e){var i,r=t.match(o[i=e]||(o[i]=new RegExp("\\s+"+i+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*")));return r?/^\s*(.*?)\s*$/.exec(r[2])[1]:""}function g(t,e){return new RegExp((e?"^":"")+"</s*"+t+"s*>","i")}function s(t,e){for(var i in t)for(var r=e[i]||(e[i]=[]),n=t[i],o=n.length-1;0<=o;o--)r.unshift(n[o])}p.defineMode("htmlmixed",function(h,t){var u=p.getMode(h,{name:"xml",htmlMode:!0,multilineTagIndentFactor:t.multilineTagIndentFactor,multilineTagIndentPastTag:t.multilineTagIndentPastTag}),f={},e=t&&t.tags,i=t&&t.scriptTypes;if(s(n,f),e&&s(e,f),i)for(var r=i.length-1;0<=r;r--)f.script.unshift(["type",i[r].matches,i[r].mode]);function d(t,e){var i,r=u.token(t,e.htmlState),n=/\btag\b/.test(r);if(n&&!/[<>\s\/]/.test(t.current())&&(i=e.htmlState.tagName&&e.htmlState.tagName.toLowerCase())&&f.hasOwnProperty(i))e.inTag=i+" ";else if(e.inTag&&n&&/>$/.test(t.current())){var o=/^([\S]+) (.*)/.exec(e.inTag);e.inTag=null;var s=">"==t.current()&&function(t,e){for(var i=0;i<t.length;i++){var r=t[i];if(!r[0]||r[1].test(m(e,r[0])))return r[2]}}(f[o[1]],o[2]),a=p.getMode(h,s),l=g(o[1],!0),c=g(o[1],!1);e.token=function(t,e){return t.match(l,!1)?(e.token=d,e.localState=e.localMode=null,null):(i=t,r=c,n=e.localMode.token(t,e.localState),o=i.current(),-1<(s=o.search(r))?i.backUp(o.length-s):o.match(/<\/?$/)&&(i.backUp(o.length),i.match(r,!1)||i.match(o)),n);var i,r,n,o,s},e.localMode=a,e.localState=p.startState(a,u.indent(e.htmlState,""))}else e.inTag&&(e.inTag+=t.current(),t.eol()&&(e.inTag+=" "));return r}return{startState:function(){return{token:d,inTag:null,localMode:null,localState:null,htmlState:p.startState(u)}},copyState:function(t){var e;return t.localState&&(e=p.copyState(t.localMode,t.localState)),{token:t.token,inTag:t.inTag,localMode:t.localMode,localState:e,htmlState:p.copyState(u,t.htmlState)}},token:function(t,e){return e.token(t,e)},indent:function(t,e,i){return!t.localMode||/^\s*<\//.test(e)?u.indent(t.htmlState,e):t.localMode.indent?t.localMode.indent(t.localState,e,i):p.Pass},innerMode:function(t){return{state:t.localState||t.htmlState,mode:t.localMode||u}}}},"xml","javascript","css"),p.defineMIME("text/html","htmlmixed")},"object"==typeof i&&"object"==typeof e?r(t("../../lib/codemirror"),t("../xml/xml"),t("../javascript/javascript"),t("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],r):r(CodeMirror)},{"../../lib/codemirror":12,"../css/css":14,"../javascript/javascript":16,"../xml/xml":18}],16:[function(t,e,i){var r;r=function(Yt){"use strict";Yt.defineMode("javascript",function(t,u){var r,n,f=t.indentUnit,d=u.statementIndent,s=u.jsonld,a=u.json||s,c=u.typescript,h=u.wordCharacters||/[\w$\xa1-\uffff]/,l=function(){function t(t){return{type:t,style:"keyword"}}var e=t("keyword a"),i=t("keyword b"),r=t("keyword c"),n=t("keyword d"),o=t("operator"),s={type:"atom",style:"atom"};return{if:t("if"),while:e,with:e,else:i,do:i,try:i,finally:i,return:n,break:n,continue:n,new:t("new"),delete:r,void:r,throw:r,debugger:t("debugger"),var:t("var"),const:t("var"),let:t("var"),function:t("function"),catch:t("catch"),for:t("for"),switch:t("switch"),case:t("case"),default:t("default"),in:o,typeof:o,instanceof:o,true:s,false:s,null:s,undefined:s,NaN:s,Infinity:s,this:t("this"),class:t("class"),super:t("atom"),yield:r,export:t("export"),import:t("import"),extends:r,await:r}}(),p=/[+\-*&%=<>!?|~^@]/,m=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function g(t,e,i){return r=t,n=i,e}function _(t,e){var n,i=t.next();if('"'==i||"'"==i)return e.tokenize=(n=i,function(t,e){var i,r=!1;if(s&&"@"==t.peek()&&t.match(m))return e.tokenize=_,g("jsonld-keyword","meta");for(;null!=(i=t.next())&&(i!=n||r);)r=!r&&"\\"==i;return r||(e.tokenize=_),g("string","string")}),e.tokenize(t,e);if("."==i&&t.match(/^\d+(?:[eE][+\-]?\d+)?/))return g("number","number");if("."==i&&t.match(".."))return g("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(i))return g(i);if("="==i&&t.eat(">"))return g("=>","operator");if("0"==i&&t.match(/^(?:x[\da-f]+|o[0-7]+|b[01]+)n?/i))return g("number","number");if(/\d/.test(i))return t.match(/^\d*(?:n|(?:\.\d*)?(?:[eE][+\-]?\d+)?)?/),g("number","number");if("/"==i)return t.eat("*")?(e.tokenize=v)(t,e):t.eat("/")?(t.skipToEnd(),g("comment","comment")):Vt(t,e,1)?(function(t){for(var e,i=!1,r=!1;null!=(e=t.next());){if(!i){if("/"==e&&!r)return;"["==e?r=!0:r&&"]"==e&&(r=!1)}i=!i&&"\\"==e}}(t),t.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),g("regexp","string-2")):(t.eat("="),g("operator","operator",t.current()));if("`"==i)return(e.tokenize=y)(t,e);if("#"==i)return t.skipToEnd(),g("error","error");if(p.test(i))return">"==i&&e.lexical&&">"==e.lexical.type||(t.eat("=")?"!"!=i&&"="!=i||t.eat("="):/[<>*+\-]/.test(i)&&(t.eat(i),">"==i&&t.eat(i))),g("operator","operator",t.current());if(h.test(i)){t.eatWhile(h);var r=t.current();if("."!=e.lastType){if(l.propertyIsEnumerable(r)){var o=l[r];return g(o.type,o.style,r)}if("async"==r&&t.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/,!1))return g("async","keyword",r)}return g("variable","variable",r)}}function v(t,e){for(var i,r=!1;i=t.next();){if("/"==i&&r){e.tokenize=_;break}r="*"==i}return g("comment","comment")}function y(t,e){for(var i,r=!1;null!=(i=t.next());){if(!r&&("`"==i||"$"==i&&t.eat("{"))){e.tokenize=_;break}r=!r&&"\\"==i}return g("quasi","string-2",t.current())}var x="([{}])";function o(t,e){e.fatArrowAt&&(e.fatArrowAt=null);var i=t.string.indexOf("=>",t.start);if(!(i<0)){if(c){var r=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(t.string.slice(t.start,i));r&&(i=r.index)}for(var n=0,o=!1,s=i-1;0<=s;--s){var a=t.string.charAt(s),l=x.indexOf(a);if(0<=l&&l<3){if(!n){++s;break}if(0==--n){"("==a&&(o=!0);break}}else if(3<=l&&l<6)++n;else if(h.test(a))o=!0;else{if(/["'\/]/.test(a))return;if(o&&!n){++s;break}}}o&&!n&&(e.fatArrowAt=s)}}var T={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0};function k(t,e,i,r,n,o){this.indented=t,this.column=e,this.type=i,this.prev=n,this.info=o,null!=r&&(this.align=r)}function b(t,e){for(var i=t.localVars;i;i=i.next)if(i.name==e)return!0;for(var r=t.context;r;r=r.prev)for(i=r.vars;i;i=i.next)if(i.name==e)return!0}var w={state:null,column:null,marked:null,cc:null};function E(){for(var t=arguments.length-1;0<=t;t--)w.cc.push(arguments[t])}function C(){return E.apply(null,arguments),!0}function S(t,e){for(var i=e;i;i=i.next)if(i.name==t)return!0;return!1}function i(t){var e=w.state;if(w.marked="def",e.context)if("var"==e.lexical.info&&e.context&&e.context.block){var i=function t(e,i){{if(i){if(i.block){var r=t(e,i.prev);return r?r==i.prev?i:new L(r,i.vars,!0):null}return S(e,i.vars)?i:new L(i.prev,new N(e,i.vars),!1)}return null}}(t,e.context);if(null!=i)return void(e.context=i)}else if(!S(t,e.localVars))return void(e.localVars=new N(t,e.localVars));u.globalVars&&!S(t,e.globalVars)&&(e.globalVars=new N(t,e.globalVars))}function A(t){return"public"==t||"private"==t||"protected"==t||"abstract"==t||"readonly"==t}function L(t,e,i){this.prev=t,this.vars=e,this.block=i}function N(t,e){this.name=t,this.next=e}var e=new N("this",new N("arguments",null));function O(){w.state.context=new L(w.state.context,w.state.localVars,!1),w.state.localVars=e}function I(){w.state.context=new L(w.state.context,w.state.localVars,!0),w.state.localVars=null}function R(){w.state.localVars=w.state.context.vars,w.state.context=w.state.context.prev}function M(r,n){var t=function(){var t=w.state,e=t.indented;if("stat"==t.lexical.type)e=t.lexical.indented;else for(var i=t.lexical;i&&")"==i.type&&i.align;i=i.prev)e=i.indented;t.lexical=new k(e,w.stream.column(),r,null,t.lexical,n)};return t.lex=!0,t}function D(){var t=w.state;t.lexical.prev&&(")"==t.lexical.type&&(t.indented=t.lexical.indented),t.lexical=t.lexical.prev)}function P(i){return function t(e){return e==i?C():";"==i||"}"==e||")"==e||"]"==e?E():C(t)}}function B(t,e){return"var"==t?C(M("vardef",e),_t,P(";"),D):"keyword a"==t?C(M("form"),W,B,D):"keyword b"==t?C(M("form"),B,D):"keyword d"==t?w.stream.match(/^\s*$/,!1)?C():C(M("stat"),q,P(";"),D):"debugger"==t?C(P(";")):"{"==t?C(M("}"),I,ot,D,R):";"==t?C():"if"==t?("else"==w.state.lexical.info&&w.state.cc[w.state.cc.length-1]==D&&w.state.cc.pop()(),C(M("form"),W,B,D,bt)):"function"==t?C(Lt):"for"==t?C(M("form"),wt,B,D):"class"==t||c&&"interface"==e?(w.marked="keyword",C(M("form"),It,D)):"variable"==t?c&&"declare"==e?(w.marked="keyword",C(B)):c&&("module"==e||"enum"==e||"type"==e)&&w.stream.match(/^\s*\w/,!1)?(w.marked="keyword","enum"==e?C(Gt):"type"==e?C(ct,P("operator"),ct,P(";")):C(M("form"),vt,P("{"),M("}"),ot,D,D)):c&&"namespace"==e?(w.marked="keyword",C(M("form"),U,ot,D)):c&&"abstract"==e?(w.marked="keyword",C(B)):C(M("stat"),Z):"switch"==t?C(M("form"),W,P("{"),M("}","switch"),I,ot,D,D,R):"case"==t?C(U,P(":")):"default"==t?C(P(":")):"catch"==t?C(M("form"),O,F,B,D,R):"export"==t?C(M("stat"),Pt,D):"import"==t?C(M("stat"),Ft,D):"async"==t?C(B):"@"==e?C(U,B):E(M("stat"),U,P(";"),D)}function F(t){if("("==t)return C(Nt,P(")"))}function U(t,e){return z(t,e,!1)}function H(t,e){return z(t,e,!0)}function W(t){return"("!=t?E():C(M(")"),U,P(")"),D)}function z(t,e,i){if(w.state.fatArrowAt==w.stream.start){var r=i?$:K;if("("==t)return C(O,M(")"),rt(Nt,")"),D,P("=>"),r,R);if("variable"==t)return E(O,vt,P("=>"),r,R)}var n,o=i?j:G;return T.hasOwnProperty(t)?C(o):"function"==t?C(Lt,o):"class"==t||c&&"interface"==e?(w.marked="keyword",C(M("form"),Ot,D)):"keyword c"==t||"async"==t?C(i?H:U):"("==t?C(M(")"),q,P(")"),D,o):"operator"==t||"spread"==t?C(i?H:U):"["==t?C(M("]"),qt,D,o):"{"==t?nt(tt,"}",null,o):"quasi"==t?E(V,o):"new"==t?C((n=i,function(t){return"."==t?C(n?X:Q):"variable"==t&&c?C(pt,n?j:G):E(n?H:U)})):"import"==t?C(U):C()}function q(t){return t.match(/[;\}\)\],]/)?E():E(U)}function G(t,e){return","==t?C(U):j(t,e,!1)}function j(t,e,i){var r=0==i?G:j,n=0==i?U:H;return"=>"==t?C(O,i?$:K,R):"operator"==t?/\+\+|--/.test(e)||c&&"!"==e?C(r):c&&"<"==e&&w.stream.match(/^([^>]|<.*?>)*>\s*\(/,!1)?C(M(">"),rt(ct,">"),D,r):"?"==e?C(U,P(":"),n):C(n):"quasi"==t?E(V,r):";"!=t?"("==t?nt(H,")","call",r):"."==t?C(J,r):"["==t?C(M("]"),q,P("]"),D,r):c&&"as"==e?(w.marked="keyword",C(ct,r)):"regexp"==t?(w.state.lastType=w.marked="operator",w.stream.backUp(w.stream.pos-w.stream.start-1),C(n)):void 0:void 0}function V(t,e){return"quasi"!=t?E():"${"!=e.slice(e.length-2)?C(V):C(U,Y)}function Y(t){if("}"==t)return w.marked="string-2",w.state.tokenize=y,C(V)}function K(t){return o(w.stream,w.state),E("{"==t?B:U)}function $(t){return o(w.stream,w.state),E("{"==t?B:H)}function Q(t,e){if("target"==e)return w.marked="keyword",C(G)}function X(t,e){if("target"==e)return w.marked="keyword",C(j)}function Z(t){return":"==t?C(D,B):E(G,P(";"),D)}function J(t){if("variable"==t)return w.marked="property",C()}function tt(t,e){if("async"==t)return w.marked="property",C(tt);if("variable"==t||"keyword"==w.style){return w.marked="property","get"==e||"set"==e?C(et):(c&&w.state.fatArrowAt==w.stream.start&&(i=w.stream.match(/^\s*:\s*/,!1))&&(w.state.fatArrowAt=w.stream.pos+i[0].length),C(it));var i}else{if("number"==t||"string"==t)return w.marked=s?"property":w.style+" property",C(it);if("jsonld-keyword"==t)return C(it);if(c&&A(e))return w.marked="keyword",C(tt);if("["==t)return C(U,st,P("]"),it);if("spread"==t)return C(H,it);if("*"==e)return w.marked="keyword",C(tt);if(":"==t)return E(it)}}function et(t){return"variable"!=t?E(it):(w.marked="property",C(Lt))}function it(t){return":"==t?C(H):"("==t?E(Lt):void 0}function rt(r,n,o){function s(t,e){if(o?-1<o.indexOf(t):","==t){var i=w.state.lexical;return"call"==i.info&&(i.pos=(i.pos||0)+1),C(function(t,e){return t==n||e==n?E():E(r)},s)}return t==n||e==n?C():C(P(n))}return function(t,e){return t==n||e==n?C():E(r,s)}}function nt(t,e,i){for(var r=3;r<arguments.length;r++)w.cc.push(arguments[r]);return C(M(e,i),rt(t,e),D)}function ot(t){return"}"==t?C():E(B,ot)}function st(t,e){if(c){if(":"==t)return C(ct);if("?"==e)return C(st)}}function at(t){if(c&&":"==t)return w.stream.match(/^\s*\w+\s+is\b/,!1)?C(U,lt,ct):C(ct)}function lt(t,e){if("is"==e)return w.marked="keyword",C()}function ct(t,e){return"keyof"==e||"typeof"==e?(w.marked="keyword",C("keyof"==e?ct:H)):"variable"==t||"void"==e?(w.marked="type",C(dt)):"string"==t||"number"==t||"atom"==t?C(dt):"["==t?C(M("]"),rt(ct,"]",","),D,dt):"{"==t?C(M("}"),rt(ut,"}",",;"),D,dt):"("==t?C(rt(ft,")"),ht):"<"==t?C(rt(ct,">"),ct):void 0}function ht(t){if("=>"==t)return C(ct)}function ut(t,e){return"variable"==t||"keyword"==w.style?(w.marked="property",C(ut)):"?"==e?C(ut):":"==t?C(ct):"["==t?C(U,st,P("]"),ut):void 0}function ft(t,e){return"variable"==t&&w.stream.match(/^\s*[?:]/,!1)||"?"==e?C(ft):":"==t?C(ct):E(ct)}function dt(t,e){return"<"==e?C(M(">"),rt(ct,">"),D,dt):"|"==e||"."==t||"&"==e?C(ct):"["==t?C(P("]"),dt):"extends"==e||"implements"==e?(w.marked="keyword",C(ct)):void 0}function pt(t,e){if("<"==e)return C(M(">"),rt(ct,">"),D,dt)}function mt(){return E(ct,gt)}function gt(t,e){if("="==e)return C(ct)}function _t(t,e){return"enum"==e?(w.marked="keyword",C(Gt)):E(vt,st,Tt,kt)}function vt(t,e){return c&&A(e)?(w.marked="keyword",C(vt)):"variable"==t?(i(e),C()):"spread"==t?C(vt):"["==t?nt(xt,"]"):"{"==t?nt(yt,"}"):void 0}function yt(t,e){return"variable"!=t||w.stream.match(/^\s*:/,!1)?("variable"==t&&(w.marked="property"),"spread"==t?C(vt):"}"==t?E():"["==t?C(U,P("]"),P(":"),yt):C(P(":"),vt,Tt)):(i(e),C(Tt))}function xt(){return E(vt,Tt)}function Tt(t,e){if("="==e)return C(H)}function kt(t){if(","==t)return C(_t)}function bt(t,e){if("keyword b"==t&&"else"==e)return C(M("form","else"),B,D)}function wt(t,e){return"await"==e?C(wt):"("==t?C(M(")"),Et,P(")"),D):void 0}function Et(t){return"var"==t?C(_t,P(";"),St):";"==t?C(St):"variable"==t?C(Ct):E(U,P(";"),St)}function Ct(t,e){return"in"==e||"of"==e?(w.marked="keyword",C(U)):C(G,St)}function St(t,e){return";"==t?C(At):"in"==e||"of"==e?(w.marked="keyword",C(U)):E(U,P(";"),At)}function At(t){")"!=t&&C(U)}function Lt(t,e){return"*"==e?(w.marked="keyword",C(Lt)):"variable"==t?(i(e),C(Lt)):"("==t?C(O,M(")"),rt(Nt,")"),D,at,B,R):c&&"<"==e?C(M(">"),rt(mt,">"),D,Lt):void 0}function Nt(t,e){return"@"==e&&C(U,Nt),"spread"==t?C(Nt):c&&A(e)?(w.marked="keyword",C(Nt)):E(vt,st,Tt)}function Ot(t,e){return"variable"==t?It(t,e):Rt(t,e)}function It(t,e){if("variable"==t)return i(e),C(Rt)}function Rt(t,e){return"<"==e?C(M(">"),rt(mt,">"),D,Rt):"extends"==e||"implements"==e||c&&","==t?("implements"==e&&(w.marked="keyword"),C(c?ct:U,Rt)):"{"==t?C(M("}"),Mt,D):void 0}function Mt(t,e){return"async"==t||"variable"==t&&("static"==e||"get"==e||"set"==e||c&&A(e))&&w.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(w.marked="keyword",C(Mt)):"variable"==t||"keyword"==w.style?(w.marked="property",C(c?Dt:Lt,Mt)):"["==t?C(U,st,P("]"),c?Dt:Lt,Mt):"*"==e?(w.marked="keyword",C(Mt)):";"==t?C(Mt):"}"==t?C():"@"==e?C(U,Mt):void 0}function Dt(t,e){return"?"==e?C(Dt):":"==t?C(ct,Tt):"="==e?C(H):E(Lt)}function Pt(t,e){return"*"==e?(w.marked="keyword",C(zt,P(";"))):"default"==e?(w.marked="keyword",C(U,P(";"))):"{"==t?C(rt(Bt,"}"),zt,P(";")):E(B)}function Bt(t,e){return"as"==e?(w.marked="keyword",C(P("variable"))):"variable"==t?E(H,Bt):void 0}function Ft(t){return"string"==t?C():"("==t?E(U):E(Ut,Ht,zt)}function Ut(t,e){return"{"==t?nt(Ut,"}"):("variable"==t&&i(e),"*"==e&&(w.marked="keyword"),C(Wt))}function Ht(t){if(","==t)return C(Ut,Ht)}function Wt(t,e){if("as"==e)return w.marked="keyword",C(Ut)}function zt(t,e){if("from"==e)return w.marked="keyword",C(U)}function qt(t){return"]"==t?C():E(rt(H,"]"))}function Gt(){return E(M("form"),vt,P("{"),M("}"),rt(jt,"}"),D,D)}function jt(){return E(vt,Tt)}function Vt(t,e,i){return e.tokenize==_&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(e.lastType)||"quasi"==e.lastType&&/\{\s*$/.test(t.string.slice(0,t.pos-(i||0)))}return D.lex=R.lex=!0,{startState:function(t){var e={tokenize:_,lastType:"sof",cc:[],lexical:new k((t||0)-f,0,"block",!1),localVars:u.localVars,context:u.localVars&&new L(null,null,!1),indented:t||0};return u.globalVars&&"object"==typeof u.globalVars&&(e.globalVars=u.globalVars),e},token:function(t,e){if(t.sol()&&(e.lexical.hasOwnProperty("align")||(e.lexical.align=!1),e.indented=t.indentation(),o(t,e)),e.tokenize!=v&&t.eatSpace())return null;var i=e.tokenize(t,e);return"comment"==r?i:(e.lastType="operator"!=r||"++"!=n&&"--"!=n?r:"incdec",function(t,e,i,r,n){var o=t.cc;for(w.state=t,w.stream=n,w.marked=null,w.cc=o,w.style=e,t.lexical.hasOwnProperty("align")||(t.lexical.align=!0);;)if((o.length?o.pop():a?U:B)(i,r)){for(;o.length&&o[o.length-1].lex;)o.pop()();return w.marked?w.marked:"variable"==i&&b(t,r)?"variable-2":e}}(e,i,r,n,t))},indent:function(t,e){if(t.tokenize==v)return Yt.Pass;if(t.tokenize!=_)return 0;var i,r=e&&e.charAt(0),n=t.lexical;if(!/^\s*else\b/.test(e))for(var o=t.cc.length-1;0<=o;--o){var s=t.cc[o];if(s==D)n=n.prev;else if(s!=bt)break}for(;("stat"==n.type||"form"==n.type)&&("}"==r||(i=t.cc[t.cc.length-1])&&(i==G||i==j)&&!/^[,\.=+\-*:?[\(]/.test(e));)n=n.prev;d&&")"==n.type&&"stat"==n.prev.type&&(n=n.prev);var a,l,c=n.type,h=r==c;return"vardef"==c?n.indented+("operator"==t.lastType||","==t.lastType?n.info.length+1:0):"form"==c&&"{"==r?n.indented:"form"==c?n.indented+f:"stat"==c?n.indented+(l=e,"operator"==(a=t).lastType||","==a.lastType||p.test(l.charAt(0))||/[,.]/.test(l.charAt(0))?d||f:0):"switch"!=n.info||h||0==u.doubleIndentSwitch?n.align?n.column+(h?0:1):n.indented+(h?0:f):n.indented+(/^(?:case|default)\b/.test(e)?f:2*f)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:a?null:"/*",blockCommentEnd:a?null:"*/",blockCommentContinue:a?null:" * ",lineComment:a?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:a?"json":"javascript",jsonldMode:s,jsonMode:a,expressionAllowed:Vt,skipExpression:function(t){var e=t.cc[t.cc.length-1];e!=U&&e!=H||t.cc.pop()}}}),Yt.registerHelper("wordChars","javascript",/[\w$]/),Yt.defineMIME("text/javascript","javascript"),Yt.defineMIME("text/ecmascript","javascript"),Yt.defineMIME("application/javascript","javascript"),Yt.defineMIME("application/x-javascript","javascript"),Yt.defineMIME("application/ecmascript","javascript"),Yt.defineMIME("application/json",{name:"javascript",json:!0}),Yt.defineMIME("application/x-json",{name:"javascript",json:!0}),Yt.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),Yt.defineMIME("text/typescript",{name:"javascript",typescript:!0}),Yt.defineMIME("application/typescript",{name:"javascript",typescript:!0})},"object"==typeof i&&"object"==typeof e?r(t("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":12}],17:[function(t,e,i){var r;r=function(c){"use strict";function t(t){for(var e={},i=t.split(" "),r=0;r<i.length;++r)e[i[r]]=!0;return e}function a(n,o,s){return 0==n.length?l(o):function(t,e){for(var i=n[0],r=0;r<i.length;r++)if(t.match(i[r][0]))return e.tokenize=a(n.slice(1),o),i[r][1];return e.tokenize=l(o,s),"string"}}function l(i,r){return function(t,e){return function(t,e,i,r){if(!1!==r&&t.match("${",!1)||t.match("{$",!1))return e.tokenize=null,"string";if(!1!==r&&t.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/))return t.match("[",!1)&&(e.tokenize=a([[["[",null]],[[/\d[\w\.]*/,"number"],[/\$[a-zA-Z_][a-zA-Z0-9_]*/,"variable-2"],[/[\w\$]+/,"variable"]],[["]",null]]],i,r)),t.match(/\-\>\w/,!1)&&(e.tokenize=a([[["->",null]],[[/[\w]+/,"variable"]]],i,r)),"variable-2";var n=!1;for(;!t.eol()&&(n||!1===r||!t.match("{$",!1)&&!t.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/,!1));){if(!n&&t.match(i)){e.tokenize=null,e.tokStack.pop(),e.tokStack.pop();break}n="\\"==t.next()&&!n}return"string"}(t,e,i,r)}}var e="abstract and array as break case catch class clone const continue declare default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach function global goto if implements interface instanceof namespace new or private protected public static switch throw trait try use var while xor die echo empty exit eval include include_once isset list require require_once return print unset __halt_compiler self static parent yield insteadof finally",i="true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__",r="func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents file_put_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists array_intersect_key array_combine array_column pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count";c.registerHelper("hintWords","php",[e,i,r].join(" ").split(" ")),c.registerHelper("wordChars","php",/[\w$]/);var n={name:"clike",helperType:"php",keywords:t(e),blockKeywords:t("catch do else elseif for foreach if switch try while finally"),defKeywords:t("class function interface namespace trait"),atoms:t(i),builtin:t(r),multiLineStrings:!0,hooks:{$:function(t){return t.eatWhile(/[\w\$_]/),"variable-2"},"<":function(t,e){var i;if(i=t.match(/<<\s*/)){var r=t.eat(/['"]/);t.eatWhile(/[\w\.]/);var n=t.current().slice(i[0].length+(r?2:1));if(r&&t.eat(r),n)return(e.tokStack||(e.tokStack=[])).push(n,0),e.tokenize=l(n,"'"!=r),"string"}return!1},"#":function(t){for(;!t.eol()&&!t.match("?>",!1);)t.next();return"comment"},"/":function(t){if(t.eat("/")){for(;!t.eol()&&!t.match("?>",!1);)t.next();return"comment"}return!1},'"':function(t,e){return(e.tokStack||(e.tokStack=[])).push('"',0),e.tokenize=l('"'),"string"},"{":function(t,e){return e.tokStack&&e.tokStack.length&&e.tokStack[e.tokStack.length-1]++,!1},"}":function(t,e){return e.tokStack&&0<e.tokStack.length&&!--e.tokStack[e.tokStack.length-1]&&(e.tokenize=l(e.tokStack[e.tokStack.length-2])),!1}}};c.defineMode("php",function(t,i){var a=c.getMode(t,i&&i.htmlMode||"text/html"),l=c.getMode(t,n);return{startState:function(){var t=c.startState(a),e=i.startOpen?c.startState(l):null;return{html:t,php:e,curMode:i.startOpen?l:a,curState:i.startOpen?e:t,pending:null}},copyState:function(t){var e,i=t.html,r=c.copyState(a,i),n=t.php,o=n&&c.copyState(l,n);return e=t.curMode==a?r:o,{html:r,php:o,curMode:t.curMode,curState:e,pending:t.pending}},token:function(t,e){var i=e.curMode==l;if(t.sol()&&e.pending&&'"'!=e.pending&&"'"!=e.pending&&(e.pending=null),i)return i&&null==e.php.tokenize&&t.match("?>")?(e.curMode=a,e.curState=e.html,e.php.context.prev||(e.php=null),"meta"):l.token(t,e.curState);if(t.match(/^<\?\w*/))return e.curMode=l,e.php||(e.php=c.startState(l,a.indent(e.html,""))),e.curState=e.php,"meta";if('"'==e.pending||"'"==e.pending){for(;!t.eol()&&t.next()!=e.pending;);var r="string"}else r=e.pending&&t.pos<e.pending.end?(t.pos=e.pending.end,e.pending.style):a.token(t,e.curState);e.pending&&(e.pending=null);var n,o=t.current(),s=o.search(/<\?/);return-1!=s&&("string"==r&&(n=o.match(/[\'\"]$/))&&!/\?>/.test(o)?e.pending=n[0]:e.pending={end:t.pos,style:r},t.backUp(o.length-s)),r},indent:function(t,e){return t.curMode!=l&&/^\s*<\//.test(e)||t.curMode==l&&/^\?>/.test(e)?a.indent(t.html,e):t.curMode.indent(t.curState,e)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",innerMode:function(t){return{state:t.curState,mode:t.curMode}}}},"htmlmixed","clike"),c.defineMIME("application/x-httpd-php","php"),c.defineMIME("application/x-httpd-php-open",{name:"php",startOpen:!0}),c.defineMIME("text/x-php",n)},"object"==typeof i&&"object"==typeof e?r(t("../../lib/codemirror"),t("../htmlmixed/htmlmixed"),t("../clike/clike")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../clike/clike"],r):r(CodeMirror)},{"../../lib/codemirror":12,"../clike/clike":13,"../htmlmixed/htmlmixed":15}],18:[function(t,e,i){var r;r=function(b){"use strict";var w={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},E={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};b.defineMode("xml",function(t,e){var s,o,a=t.indentUnit,l={},i=e.htmlMode?w:E;for(var r in i)l[r]=i[r];for(var r in e)l[r]=e[r];function c(e,i){function t(t){return(i.tokenize=t)(e,i)}var r=e.next();return"<"==r?e.eat("!")?e.eat("[")?e.match("CDATA[")?t(n("atom","]]>")):null:e.match("--")?t(n("comment","--\x3e")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),t(function r(n){return function(t,e){for(var i;null!=(i=t.next());){if("<"==i)return e.tokenize=r(n+1),e.tokenize(t,e);if(">"==i){if(1!=n)return e.tokenize=r(n-1),e.tokenize(t,e);e.tokenize=c;break}}return"meta"}}(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),i.tokenize=n("meta","?>"),"meta"):(s=e.eat("/")?"closeTag":"openTag",i.tokenize=h,"tag bracket"):"&"!=r?(e.eatWhile(/[^&<]/),null):(e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"))?"atom":"error"}function h(t,e){var i=t.next();if(">"==i||"/"==i&&t.eat(">"))return e.tokenize=c,s=">"==i?"endTag":"selfcloseTag","tag bracket";if("="==i)return s="equals",null;if("<"!=i)return/[\'\"]/.test(i)?(e.tokenize=(r=i,(n=function(t,e){for(;!t.eol();)if(t.next()==r){e.tokenize=h;break}return"string"}).isInAttribute=!0,n),e.stringStartCol=t.column(),e.tokenize(t,e)):(t.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word");e.tokenize=c,e.state=p,e.tagName=e.tagStart=null;var r,n,o=e.tokenize(t,e);return o?o+" tag error":"tag error"}function n(i,r){return function(t,e){for(;!t.eol();){if(t.match(r)){e.tokenize=c;break}t.next()}return i}}function u(t,e,i){this.prev=t.context,this.tagName=e,this.indent=t.indented,this.startOfLine=i,(l.doNotIndent.hasOwnProperty(e)||t.context&&t.context.noIndent)&&(this.noIndent=!0)}function f(t){t.context&&(t.context=t.context.prev)}function d(t,e){for(var i;;){if(!t.context)return;if(i=t.context.tagName,!l.contextGrabbers.hasOwnProperty(i)||!l.contextGrabbers[i].hasOwnProperty(e))return;f(t)}}function p(t,e,i){return"openTag"==t?(i.tagStart=e.column(),m):"closeTag"==t?g:p}function m(t,e,i){return"word"==t?(i.tagName=e.current(),o="tag",y):l.allowMissingTagName&&"endTag"==t?(o="tag bracket",y(t,e,i)):(o="error",m)}function g(t,e,i){if("word"!=t)return l.allowMissingTagName&&"endTag"==t?(o="tag bracket",_(t,e,i)):(o="error",v);var r=e.current();return i.context&&i.context.tagName!=r&&l.implicitlyClosed.hasOwnProperty(i.context.tagName)&&f(i),i.context&&i.context.tagName==r||!1===l.matchClosing?(o="tag",_):(o="tag error",v)}function _(t,e,i){return"endTag"!=t?(o="error",_):(f(i),p)}function v(t,e,i){return o="error",_(t,0,i)}function y(t,e,i){if("word"==t)return o="attribute",x;if("endTag"!=t&&"selfcloseTag"!=t)return o="error",y;var r=i.tagName,n=i.tagStart;return i.tagName=i.tagStart=null,"selfcloseTag"==t||l.autoSelfClosers.hasOwnProperty(r)?d(i,r):(d(i,r),i.context=new u(i,r,n==i.indented)),p}function x(t,e,i){return"equals"==t?T:(l.allowMissing||(o="error"),y(t,0,i))}function T(t,e,i){return"string"==t?k:"word"==t&&l.allowUnquoted?(o="string",y):(o="error",y(t,0,i))}function k(t,e,i){return"string"==t?k:y(t,0,i)}return c.isInText=!0,{startState:function(t){var e={tokenize:c,state:p,indented:t||0,tagName:null,tagStart:null,context:null};return null!=t&&(e.baseIndent=t),e},token:function(t,e){if(!e.tagName&&t.sol()&&(e.indented=t.indentation()),t.eatSpace())return null;s=null;var i=e.tokenize(t,e);return(i||s)&&"comment"!=i&&(o=null,e.state=e.state(s||i,t,e),o&&(i="error"==o?i+" error":o)),i},indent:function(t,e,i){var r=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+a;if(r&&r.noIndent)return b.Pass;if(t.tokenize!=h&&t.tokenize!=c)return i?i.match(/^(\s*)/)[0].length:0;if(t.tagName)return!1!==l.multilineTagIndentPastTag?t.tagStart+t.tagName.length+2:t.tagStart+a*(l.multilineTagIndentFactor||1);if(l.alignCDATA&&/<!\[CDATA\[/.test(e))return 0;var n=e&&/^<(\/)?([\w_:\.-]*)/.exec(e);if(n&&n[1])for(;r;){if(r.tagName==n[2]){r=r.prev;break}if(!l.implicitlyClosed.hasOwnProperty(r.tagName))break;r=r.prev}else if(n)for(;r;){var o=l.contextGrabbers[r.tagName];if(!o||!o.hasOwnProperty(n[2]))break;r=r.prev}for(;r&&r.prev&&!r.startOfLine;)r=r.prev;return r?r.indent+a:t.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:l.htmlMode?"html":"xml",helperType:l.htmlMode?"html":"xml",skipAttribute:function(t){t.state==T&&(t.state=y)}}}),b.defineMIME("text/xml","xml"),b.defineMIME("application/xml","xml"),b.mimeModes.hasOwnProperty("text/html")||b.defineMIME("text/html",{name:"xml",htmlMode:!0})},"object"==typeof i&&"object"==typeof e?r(t("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":12}],19:[function(NIa,OIa,PIa){var RIa,SIa;RIa=window,SIa=function(){return function(i){var r={};function n(t){if(r[t])return r[t].exports;var e=r[t]={i:t,l:!1,exports:{}};return i[t].call(e.exports,e,e.exports,n),e.l=!0,e.exports}return n.m=i,n.c=r,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=12)}([function(t,e,i){"use strict";var r=i(2);t.exports=r.extends("statement",function(t,e,i){r.apply(this,[t||"statement",e,i])})},function(t,e,i){"use strict";var r=i(2),n="expression";t.exports=r.extends(n,function(t,e,i){r.apply(this,[t||n,e,i])})},function(t,e,i){"use strict";var r=function(t,e,i){this.kind=t,e&&(this.leadingComments=e),i&&(this.loc=i)};r.prototype.setTrailingComments=function(t){this.trailingComments=t},r.prototype.includeToken=function(t){return this.loc&&(this.loc.end&&(this.loc.end.line=t.lexer.yylloc.last_line,this.loc.end.column=t.lexer.yylloc.last_column,this.loc.end.offset=t.lexer.offset),t.ast.withSource&&(this.loc.source=t.lexer._input.substring(this.loc.start.offset,t.lexer.offset))),this},r.extends=function(t,e){return e.prototype=Object.create(this.prototype),e.extends=this.extends,(e.prototype.constructor=e).kind=t,e},t.exports=r},function(t,e,i){"use strict";var o=i(1);t.exports=o.extends("literal",function(t,e,i,r,n){o.apply(this,[t||"literal",r,n]),this.value=e,i&&(this.raw=i)})},function(t,e,i){"use strict";var n=i(0),o="declaration",r=n.extends(o,function(t,e,i,r){n.apply(this,[t||o,i,r]),this.name=e});r.prototype.parseFlags=function(t){this.isAbstract=1===t[2],this.isFinal=2===t[2],"class"!==this.kind&&(-1===t[0]?this.visibility="":null===t[0]?this.visibility=null:0===t[0]?this.visibility="public":1===t[0]?this.visibility="protected":2===t[0]&&(this.visibility="private"),this.isStatic=1===t[1])},t.exports=r},function(t,e,i){"use strict";var r=i(1);t.exports=r.extends("operation",function(t,e,i){r.apply(this,[t||"operation",e,i])})},function(t,e,i){"use strict";var r=i(2),n=r.extends("reference",function(t,e,i){r.apply(this,[t||"reference",e,i])});t.exports=n},function(t,e,i){"use strict";var n=i(0);t.exports=n.extends("block",function(t,e,i,r){n.apply(this,[t||"block",i,r]),this.children=e.filter(Boolean)})},function(t,e,i){"use strict";var o=i(1);t.exports=o.extends("lookup",function(t,e,i,r,n){o.apply(this,[t||"lookup",r,n]),this.what=e,this.offset=i})},function(t,e,i){"use strict";var n=i(2);t.exports=n.extends("comment",function(t,e,i,r){n.apply(this,[t,i,r]),this.value=e})},function(t,e,i){"use strict";var n=i(0),o="constantstatement";t.exports=n.extends(o,function(t,e,i,r){n.apply(this,[t||o,i,r]),this.items=e})},function(t,e,i){"use strict";var a=i(4);t.exports=a.extends("function",function(t,e,i,r,n,o,s){a.apply(this,["function",t,o,s]),this.arguments=e,this.byref=i,this.type=r,this.nullable=n,this.body=null})},function(t,e,h){"use strict";(function(e){var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=h(18),r=h(28),n=h(44),o=h(45);function a(t,e){for(var i=Object.keys(t),r=i.length;r--;){var n=i[r],o=t[n];null===o?delete e[n]:"function"==typeof o?e[n]=o.bind(e):Array.isArray(o)?e[n]=Array.isArray(e[n])?e[n].concat(o):o:"object"===(void 0===o?"undefined":s(o))?e[n]="object"===s(e[n])?a(o,e[n]):o:e[n]=o}return e}var l=function(t){if("function"==typeof this)return new this(t);this.tokens=n,this.lexer=new i(this),this.ast=new o,this.parser=new r(this.lexer,this.ast),t&&"object"===(void 0===t?"undefined":s(t))&&(t.parser&&!1===t.parser.php7&&(t.lexer||(t.lexer={}),t.lexer.php7=!1),a(t,this))},c=function(t){return e.isBuffer(t)?t.toString():t};l.create=function(t){return new l(t)},l.parseEval=function(t,e){return new l(e).parseEval(t)},l.prototype.parseEval=function(t){return this.lexer.mode_eval=!0,this.lexer.all_tokens=!1,t=c(t),this.parser.parse(t,"eval")},l.parseCode=function(t,e,i){return"object"!==(void 0===e?"undefined":s(e))||i||(i=e,e="unknown"),new l(i).parseCode(t,e)},l.prototype.parseCode=function(t,e){return this.lexer.mode_eval=!1,this.lexer.all_tokens=!1,t=c(t),this.parser.parse(t,e)},l.tokenGetAll=function(t,e){return new l(e).tokenGetAll(t)},l.prototype.tokenGetAll=function(t){this.lexer.mode_eval=!1,this.lexer.all_tokens=!0,t=c(t);var e=this.lexer.EOF,i=this.tokens.values;this.lexer.setInput(t);for(var r=this.lexer.lex()||e,n=[];r!=e;){var o=this.lexer.yytext;i.hasOwnProperty(r)&&(o=[i[r],o,this.lexer.yylloc.first_line]),n.push(o),r=this.lexer.lex()||e}return n},t.exports=l,t.exports.tokens=n,t.exports.lexer=i,t.exports.AST=o,t.exports.parser=r,t.exports.combine=a,t.exports.default=l}).call(this,h(13).Buffer)},function(t,F,e){"use strict";(function(t){var r=e(15),o=e(16),s=e(17);function i(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(i()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,i){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,i);if("number"!=typeof t)return n(this,t,e,i);if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return c(this,t)}function n(t,e,i,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,i,r){if(e.byteLength,i<0||e.byteLength<i)throw new RangeError("'offset' is out of bounds");if(e.byteLength<i+(r||0))throw new RangeError("'length' is out of bounds");e=void 0===i&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,i):new Uint8Array(e,i,r);u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=h(t,e);return t}(t,e,i,r):"string"==typeof e?function(t,e,i){"string"==typeof i&&""!==i||(i="utf8");if(!u.isEncoding(i))throw new TypeError('"encoding" must be a valid string encoding');var r=0|d(e,i),n=(t=a(t,r)).write(e,i);n!==r&&(t=t.slice(0,n));return t}(t,e,i):function(t,e){if(u.isBuffer(e)){var i=0|f(e.length);return 0===(t=a(t,i)).length||e.copy(t,0,0,i),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(r=e.length)!=r?a(t,0):h(t,e);if("Buffer"===e.type&&s(e.data))return h(t,e.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function c(t,e){if(l(e),t=a(t,e<0?0:0|f(e)),!u.TYPED_ARRAY_SUPPORT)for(var i=0;i<e;++i)t[i]=0;return t}function h(t,e){var i=e.length<0?0:0|f(e.length);t=a(t,i);for(var r=0;r<i;r+=1)t[r]=255&e[r];return t}function f(t){if(t>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|t}function d(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var i=t.length;if(0===i)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return D(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return P(t).length;default:if(r)return D(t).length;e=(""+e).toLowerCase(),r=!0}}function p(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function m(t,e,i,r,n){if(0===t.length)return-1;if("string"==typeof i?(r=i,i=0):2147483647<i?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=n?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(n)return-1;i=t.length-1}else if(i<0){if(!n)return-1;i=0}if("string"==typeof e&&(e=u.from(e,r)),u.isBuffer(e))return 0===e.length?-1:g(t,e,i,r,n);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,i):Uint8Array.prototype.lastIndexOf.call(t,e,i):g(t,[e],i,r,n);throw new TypeError("val must be string, number or Buffer")}function g(t,e,i,r,n){var o,s=1,a=t.length,l=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a/=s=2,l/=2,i/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(n){var h=-1;for(o=i;o<a;o++)if(c(t,o)===c(e,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===l)return h*s}else-1!==h&&(o-=o-h),h=-1}else for(a<i+l&&(i=a-l),o=i;0<=o;o--){for(var u=!0,f=0;f<l;f++)if(c(t,o+f)!==c(e,f)){u=!1;break}if(u)return o}return-1}function _(t,e,i,r){i=Number(i)||0;var n=t.length-i;r?n<(r=Number(r))&&(r=n):r=n;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");o/2<r&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[i+s]=a}return s}function v(t,e,i,r){return B(function(t){for(var e=[],i=0;i<t.length;++i)e.push(255&t.charCodeAt(i));return e}(e),t,i,r)}function y(t,e,i){return 0===e&&i===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,i))}function x(t,e,i){i=Math.min(t.length,i);for(var r=[],n=e;n<i;){var o,s,a,l,c=t[n],h=null,u=239<c?4:223<c?3:191<c?2:1;if(n+u<=i)switch(u){case 1:c<128&&(h=c);break;case 2:128==(192&(o=t[n+1]))&&127<(l=(31&c)<<6|63&o)&&(h=l);break;case 3:o=t[n+1],s=t[n+2],128==(192&o)&&128==(192&s)&&2047<(l=(15&c)<<12|(63&o)<<6|63&s)&&(l<55296||57343<l)&&(h=l);break;case 4:o=t[n+1],s=t[n+2],a=t[n+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&65535<(l=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)&&l<1114112&&(h=l)}null===h?(h=65533,u=1):65535<h&&(h-=65536,r.push(h>>>10&1023|55296),h=56320|1023&h),r.push(h),n+=u}return function(t){var e=t.length;if(e<=T)return String.fromCharCode.apply(String,t);var i="",r=0;for(;r<e;)i+=String.fromCharCode.apply(String,t.slice(r,r+=T));return i}(r)}F.Buffer=u,F.SlowBuffer=function(t){+t!=t&&(t=0);return u.alloc(+t)},F.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),F.kMaxLength=i(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,i){return n(null,t,e,i)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,i){return r=null,o=e,s=i,l(n=t),n<=0?a(r,n):void 0!==o?"string"==typeof s?a(r,n).fill(o,s):a(r,n).fill(o):a(r,n);var r,n,o,s},u.allocUnsafe=function(t){return c(null,t)},u.allocUnsafeSlow=function(t){return c(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var i=t.length,r=e.length,n=0,o=Math.min(i,r);n<o;++n)if(t[n]!==e[n]){i=t[n],r=e[n];break}return i<r?-1:r<i?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!s(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var i;if(void 0===e)for(i=e=0;i<t.length;++i)e+=t[i].length;var r=u.allocUnsafe(e),n=0;for(i=0;i<t.length;++i){var o=t[i];if(!u.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,n),n+=o.length}return r},u.byteLength=d,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)p(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)p(this,e,e+3),p(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)p(this,e,e+7),p(this,e+1,e+6),p(this,e+2,e+5),p(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?x(this,0,t):function(t,e,i){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return w(this,e,i);case"utf8":case"utf-8":return x(this,e,i);case"ascii":return k(this,e,i);case"latin1":case"binary":return b(this,e,i);case"base64":return y(this,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,i);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",e=F.INSPECT_MAX_BYTES;return 0<this.length&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,i,r,n){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===i&&(i=t?t.length:0),void 0===r&&(r=0),void 0===n&&(n=this.length),e<0||i>t.length||r<0||n>this.length)throw new RangeError("out of range index");if(n<=r&&i<=e)return 0;if(n<=r)return-1;if(i<=e)return 1;if(this===t)return 0;for(var o=(n>>>=0)-(r>>>=0),s=(i>>>=0)-(e>>>=0),a=Math.min(o,s),l=this.slice(r,n),c=t.slice(e,i),h=0;h<a;++h)if(l[h]!==c[h]){o=l[h],s=c[h];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(t,e,i){return-1!==this.indexOf(t,e,i)},u.prototype.indexOf=function(t,e,i){return m(this,t,e,i,!0)},u.prototype.lastIndexOf=function(t,e,i){return m(this,t,e,i,!1)},u.prototype.write=function(t,e,i,r){if(void 0===e)r="utf8",i=this.length,e=0;else if(void 0===i&&"string"==typeof e)r=e,i=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(i)?(i|=0,void 0===r&&(r="utf8")):(r=i,i=void 0)}var n=this.length-e;if((void 0===i||n<i)&&(i=n),0<t.length&&(i<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o,s,a,l,c,h,u,f,d,p=!1;;)switch(r){case"hex":return _(this,t,e,i);case"utf8":case"utf-8":return f=e,d=i,B(D(t,(u=this).length-f),u,f,d);case"ascii":return v(this,t,e,i);case"latin1":case"binary":return v(this,t,e,i);case"base64":return l=this,c=e,h=i,B(P(t),l,c,h);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s=e,a=i,B(function(t,e){for(var i,r,n,o=[],s=0;s<t.length&&!((e-=2)<0);++s)i=t.charCodeAt(s),r=i>>8,n=i%256,o.push(n),o.push(r);return o}(t,(o=this).length-s),o,s,a);default:if(p)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),p=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function k(t,e,i){var r="";i=Math.min(t.length,i);for(var n=e;n<i;++n)r+=String.fromCharCode(127&t[n]);return r}function b(t,e,i){var r="";i=Math.min(t.length,i);for(var n=e;n<i;++n)r+=String.fromCharCode(t[n]);return r}function w(t,e,i){var r=t.length;(!e||e<0)&&(e=0),(!i||i<0||r<i)&&(i=r);for(var n="",o=e;o<i;++o)n+=M(t[o]);return n}function E(t,e,i){for(var r=t.slice(e,i),n="",o=0;o<r.length;o+=2)n+=String.fromCharCode(r[o]+256*r[o+1]);return n}function C(t,e,i){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(i<t+e)throw new RangeError("Trying to access beyond buffer length")}function S(t,e,i,r,n,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(n<e||e<o)throw new RangeError('"value" argument is out of bounds');if(i+r>t.length)throw new RangeError("Index out of range")}function A(t,e,i,r){e<0&&(e=65535+e+1);for(var n=0,o=Math.min(t.length-i,2);n<o;++n)t[i+n]=(e&255<<8*(r?n:1-n))>>>8*(r?n:1-n)}function L(t,e,i,r){e<0&&(e=4294967295+e+1);for(var n=0,o=Math.min(t.length-i,4);n<o;++n)t[i+n]=e>>>8*(r?n:3-n)&255}function N(t,e,i,r,n,o){if(i+r>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function O(t,e,i,r,n){return n||N(t,0,i,4),o.write(t,e,i,r,23,4),i+4}function I(t,e,i,r,n){return n||N(t,0,i,8),o.write(t,e,i,r,52,8),i+8}u.prototype.slice=function(t,e){var i,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):r<t&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):r<e&&(e=r),e<t&&(e=t),u.TYPED_ARRAY_SUPPORT)(i=this.subarray(t,e)).__proto__=u.prototype;else{var n=e-t;i=new u(n,void 0);for(var o=0;o<n;++o)i[o]=this[o+t]}return i},u.prototype.readUIntLE=function(t,e,i){t|=0,e|=0,i||C(t,e,this.length);for(var r=this[t],n=1,o=0;++o<e&&(n*=256);)r+=this[t+o]*n;return r},u.prototype.readUIntBE=function(t,e,i){t|=0,e|=0,i||C(t,e,this.length);for(var r=this[t+--e],n=1;0<e&&(n*=256);)r+=this[t+--e]*n;return r},u.prototype.readUInt8=function(t,e){return e||C(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||C(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||C(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,i){t|=0,e|=0,i||C(t,e,this.length);for(var r=this[t],n=1,o=0;++o<e&&(n*=256);)r+=this[t+o]*n;return(n*=128)<=r&&(r-=Math.pow(2,8*e)),r},u.prototype.readIntBE=function(t,e,i){t|=0,e|=0,i||C(t,e,this.length);for(var r=e,n=1,o=this[t+--r];0<r&&(n*=256);)o+=this[t+--r]*n;return(n*=128)<=o&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||C(t,2,this.length);var i=this[t]|this[t+1]<<8;return 32768&i?4294901760|i:i},u.prototype.readInt16BE=function(t,e){e||C(t,2,this.length);var i=this[t+1]|this[t]<<8;return 32768&i?4294901760|i:i},u.prototype.readInt32LE=function(t,e){return e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||C(t,4,this.length),o.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||C(t,4,this.length),o.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||C(t,8,this.length),o.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||C(t,8,this.length),o.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,i,r){(t=+t,e|=0,i|=0,r)||S(this,t,e,i,Math.pow(2,8*i)-1,0);var n=1,o=0;for(this[e]=255&t;++o<i&&(n*=256);)this[e+o]=t/n&255;return e+i},u.prototype.writeUIntBE=function(t,e,i,r){(t=+t,e|=0,i|=0,r)||S(this,t,e,i,Math.pow(2,8*i)-1,0);var n=i-1,o=1;for(this[e+n]=255&t;0<=--n&&(o*=256);)this[e+n]=t/o&255;return e+i},u.prototype.writeUInt8=function(t,e,i){return t=+t,e|=0,i||S(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,i){return t=+t,e|=0,i||S(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):A(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,i){return t=+t,e|=0,i||S(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):A(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,i){return t=+t,e|=0,i||S(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):L(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,i){return t=+t,e|=0,i||S(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):L(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,i,r){if(t=+t,e|=0,!r){var n=Math.pow(2,8*i-1);S(this,t,e,i,n-1,-n)}var o=0,s=1,a=0;for(this[e]=255&t;++o<i&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+i},u.prototype.writeIntBE=function(t,e,i,r){if(t=+t,e|=0,!r){var n=Math.pow(2,8*i-1);S(this,t,e,i,n-1,-n)}var o=i-1,s=1,a=0;for(this[e+o]=255&t;0<=--o&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+i},u.prototype.writeInt8=function(t,e,i){return t=+t,e|=0,i||S(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,i){return t=+t,e|=0,i||S(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):A(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,i){return t=+t,e|=0,i||S(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):A(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,i){return t=+t,e|=0,i||S(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):L(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,i){return t=+t,e|=0,i||S(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):L(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,i){return O(this,t,e,!0,i)},u.prototype.writeFloatBE=function(t,e,i){return O(this,t,e,!1,i)},u.prototype.writeDoubleLE=function(t,e,i){return I(this,t,e,!0,i)},u.prototype.writeDoubleBE=function(t,e,i){return I(this,t,e,!1,i)},u.prototype.copy=function(t,e,i,r){if(i||(i=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),0<r&&r<i&&(r=i),r===i)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-i&&(r=t.length-e+i);var n,o=r-i;if(this===t&&i<e&&e<r)for(n=o-1;0<=n;--n)t[n+e]=this[n+i];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(n=0;n<o;++n)t[n+e]=this[n+i];else Uint8Array.prototype.set.call(t,this.subarray(i,i+o),e);return o},u.prototype.fill=function(t,e,i,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,i=this.length):"string"==typeof i&&(r=i,i=this.length),1===t.length){var n=t.charCodeAt(0);n<256&&(t=n)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!u.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<i)throw new RangeError("Out of range index");if(i<=e)return this;var o;if(e>>>=0,i=void 0===i?this.length:i>>>0,t||(t=0),"number"==typeof t)for(o=e;o<i;++o)this[o]=t;else{var s=u.isBuffer(t)?t:D(new u(t,r).toString()),a=s.length;for(o=0;o<i-e;++o)this[o+e]=s[o%a]}return this};var R=/[^+\/0-9A-Za-z-_]/g;function M(t){return t<16?"0"+t.toString(16):t.toString(16)}function D(t,e){var i;e=e||1/0;for(var r=t.length,n=null,o=[],s=0;s<r;++s){if(55295<(i=t.charCodeAt(s))&&i<57344){if(!n){if(56319<i){-1<(e-=3)&&o.push(239,191,189);continue}if(s+1===r){-1<(e-=3)&&o.push(239,191,189);continue}n=i;continue}if(i<56320){-1<(e-=3)&&o.push(239,191,189),n=i;continue}i=65536+(n-55296<<10|i-56320)}else n&&-1<(e-=3)&&o.push(239,191,189);if(n=null,i<128){if((e-=1)<0)break;o.push(i)}else if(i<2048){if((e-=2)<0)break;o.push(i>>6|192,63&i|128)}else if(i<65536){if((e-=3)<0)break;o.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return o}function P(t){return r.toByteArray(function(t){var e;if((t=(e=t,e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")).replace(R,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function B(t,e,i,r){for(var n=0;n<r&&!(n+i>=e.length||n>=t.length);++n)e[n+i]=t[n];return n}}).call(this,e(14))},function(aWa,bWa){var cWa;cWa=function(){return this}();try{cWa=cWa||Function("return this")()||eval("this")}catch(t){"object"==typeof window&&(cWa=window)}aWa.exports=cWa},function(t,e,i){"use strict";e.byteLength=function(t){var e=d(t),i=e[0],r=e[1];return 3*(i+r)/4-r},e.toByteArray=function(t){for(var e,i=d(t),r=i[0],n=i[1],o=new f((c=r,h=n,3*(c+h)/4-h)),s=0,a=0<n?r-4:r,l=0;l<a;l+=4)e=u[t.charCodeAt(l)]<<18|u[t.charCodeAt(l+1)]<<12|u[t.charCodeAt(l+2)]<<6|u[t.charCodeAt(l+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=255&e;var c,h;2===n&&(e=u[t.charCodeAt(l)]<<2|u[t.charCodeAt(l+1)]>>4,o[s++]=255&e);1===n&&(e=u[t.charCodeAt(l)]<<10|u[t.charCodeAt(l+1)]<<4|u[t.charCodeAt(l+2)]>>2,o[s++]=e>>8&255,o[s++]=255&e);return o},e.fromByteArray=function(t){for(var e,i=t.length,r=i%3,n=[],o=0,s=i-r;o<s;o+=16383)n.push(l(t,o,s<o+16383?s:o+16383));1===r?(e=t[i-1],n.push(a[e>>2]+a[e<<4&63]+"==")):2===r&&(e=(t[i-2]<<8)+t[i-1],n.push(a[e>>10]+a[e>>4&63]+a[e<<2&63]+"="));return n.join("")};for(var a=[],u=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,o=r.length;n<o;++n)a[n]=r[n],u[r.charCodeAt(n)]=n;function d(t){var e=t.length;if(0<e%4)throw new Error("Invalid string. Length must be a multiple of 4");var i=t.indexOf("=");return-1===i&&(i=e),[i,i===e?0:4-i%4]}function l(t,e,i){for(var r,n,o=[],s=e;s<i;s+=3)r=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),o.push(a[(n=r)>>18&63]+a[n>>12&63]+a[n>>6&63]+a[63&n]);return o.join("")}u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,i,r,n){var o,s,a=8*n-r-1,l=(1<<a)-1,c=l>>1,h=-7,u=i?n-1:0,f=i?-1:1,d=t[e+u];for(u+=f,o=d&(1<<-h)-1,d>>=-h,h+=a;0<h;o=256*o+t[e+u],u+=f,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=r;0<h;s=256*s+t[e+u],u+=f,h-=8);if(0===o)o=1-c;else{if(o===l)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),o-=c}return(d?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,i,r,n,o){var s,a,l,c=8*o-n-1,h=(1<<c)-1,u=h>>1,f=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),2<=(e+=1<=s+u?f/l:f*Math.pow(2,1-u))*l&&(s++,l/=2),h<=s+u?(a=0,s=h):1<=s+u?(a=(e*l-1)*Math.pow(2,n),s+=u):(a=e*Math.pow(2,u-1)*Math.pow(2,n),s=0));8<=n;t[i+d]=255&a,d+=p,a/=256,n-=8);for(s=s<<n|a,c+=n;0<c;t[i+d]=255&s,d+=p,s/=256,c-=8);t[i+d-p]|=128*m}},function(t,e){var i={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==i.call(t)}},function(t,e,i){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n=function(t){this.engine=t,this.tok=this.engine.tokens.names,this.EOF=1,this.debug=!1,this.all_tokens=!0,this.comment_tokens=!1,this.mode_eval=!1,this.asp_tags=!1,this.short_tags=!0,this.php7=!0,this.yyprevcol=0,this.keywords={__class__:this.tok.T_CLASS_C,__trait__:this.tok.T_TRAIT_C,__function__:this.tok.T_FUNC_C,__method__:this.tok.T_METHOD_C,__line__:this.tok.T_LINE,__file__:this.tok.T_FILE,__dir__:this.tok.T_DIR,__namespace__:this.tok.T_NS_C,exit:this.tok.T_EXIT,die:this.tok.T_EXIT,function:this.tok.T_FUNCTION,const:this.tok.T_CONST,return:this.tok.T_RETURN,try:this.tok.T_TRY,catch:this.tok.T_CATCH,finally:this.tok.T_FINALLY,throw:this.tok.T_THROW,if:this.tok.T_IF,elseif:this.tok.T_ELSEIF,endif:this.tok.T_ENDIF,else:this.tok.T_ELSE,while:this.tok.T_WHILE,endwhile:this.tok.T_ENDWHILE,do:this.tok.T_DO,for:this.tok.T_FOR,endfor:this.tok.T_ENDFOR,foreach:this.tok.T_FOREACH,endforeach:this.tok.T_ENDFOREACH,declare:this.tok.T_DECLARE,enddeclare:this.tok.T_ENDDECLARE,instanceof:this.tok.T_INSTANCEOF,as:this.tok.T_AS,switch:this.tok.T_SWITCH,endswitch:this.tok.T_ENDSWITCH,case:this.tok.T_CASE,default:this.tok.T_DEFAULT,break:this.tok.T_BREAK,continue:this.tok.T_CONTINUE,goto:this.tok.T_GOTO,echo:this.tok.T_ECHO,print:this.tok.T_PRINT,class:this.tok.T_CLASS,interface:this.tok.T_INTERFACE,trait:this.tok.T_TRAIT,extends:this.tok.T_EXTENDS,implements:this.tok.T_IMPLEMENTS,new:this.tok.T_NEW,clone:this.tok.T_CLONE,var:this.tok.T_VAR,eval:this.tok.T_EVAL,include:this.tok.T_INCLUDE,include_once:this.tok.T_INCLUDE_ONCE,require:this.tok.T_REQUIRE,require_once:this.tok.T_REQUIRE_ONCE,namespace:this.tok.T_NAMESPACE,use:this.tok.T_USE,insteadof:this.tok.T_INSTEADOF,global:this.tok.T_GLOBAL,isset:this.tok.T_ISSET,empty:this.tok.T_EMPTY,__halt_compiler:this.tok.T_HALT_COMPILER,static:this.tok.T_STATIC,abstract:this.tok.T_ABSTRACT,final:this.tok.T_FINAL,private:this.tok.T_PRIVATE,protected:this.tok.T_PROTECTED,public:this.tok.T_PUBLIC,unset:this.tok.T_UNSET,list:this.tok.T_LIST,array:this.tok.T_ARRAY,callable:this.tok.T_CALLABLE,or:this.tok.T_LOGICAL_OR,and:this.tok.T_LOGICAL_AND,xor:this.tok.T_LOGICAL_XOR},this.castKeywords={int:this.tok.T_INT_CAST,integer:this.tok.T_INT_CAST,real:this.tok.T_DOUBLE_CAST,double:this.tok.T_DOUBLE_CAST,float:this.tok.T_DOUBLE_CAST,string:this.tok.T_STRING_CAST,binary:this.tok.T_STRING_CAST,array:this.tok.T_ARRAY_CAST,object:this.tok.T_OBJECT_CAST,bool:this.tok.T_BOOL_CAST,boolean:this.tok.T_BOOL_CAST,unset:this.tok.T_UNSET_CAST}};n.prototype.setInput=function(t){return this._input=t,this.size=t.length,this.yylineno=1,this.offset=0,this.yyprevcol=0,this.yytext="",this.yylloc={first_offset:0,first_line:1,first_column:0,prev_offset:0,prev_line:1,prev_column:0,last_line:1,last_column:0},this.tokens=[],this.done=this.offset>=this.size,!this.all_tokens&&this.mode_eval?(this.conditionStack=["INITIAL"],this.begin("ST_IN_SCRIPTING")):(this.conditionStack=[],this.begin("INITIAL")),this},n.prototype.input=function(){var t=this._input[this.offset];return t?(this.yytext+=t,this.offset++,"\r"===t&&"\n"===this._input[this.offset]&&(this.yytext+="\n",this.offset++),"\n"===t||"\r"===t?(this.yylloc.last_line=++this.yylineno,this.yyprevcol=this.yylloc.last_column,this.yylloc.last_column=0):this.yylloc.last_column++,t):""},n.prototype.unput=function(t){if(1===t)this.offset--,"\n"===this._input[this.offset]&&"\r"===this._input[this.offset-1]&&(this.offset--,t++),"\r"===this._input[this.offset]||"\n"===this._input[this.offset]?(this.yylloc.last_line--,this.yylineno--,this.yylloc.last_column=this.yyprevcol):this.yylloc.last_column--,this.yytext=this.yytext.substring(0,this.yytext.length-t);else if(0<t)if(this.offset-=t,t<this.yytext.length){this.yytext=this.yytext.substring(0,this.yytext.length-t),this.yylloc.last_line=this.yylloc.first_line,this.yylloc.last_column=this.yyprevcol=this.yylloc.first_column;for(var e=0;e<this.yytext.length;e++){var i=this.yytext[e];"\r"===i?(i=this.yytext[++e],this.yyprevcol=this.yylloc.last_column,this.yylloc.last_line++,this.yylloc.last_column=0,"\n"!==i&&("\r"===i?this.yylloc.last_line++:this.yylloc.last_column++)):"\n"===i?(this.yyprevcol=this.yylloc.last_column,this.yylloc.last_line++,this.yylloc.last_column=0):this.yylloc.last_column++}this.yylineno=this.yylloc.last_line}else this.yytext="",this.yylloc.last_line=this.yylineno=this.yylloc.first_line,this.yylloc.last_column=this.yylloc.first_column;return this},n.prototype.tryMatch=function(t){return t===this.ahead(t.length)},n.prototype.tryMatchCaseless=function(t){return t===this.ahead(t.length).toLowerCase()},n.prototype.ahead=function(t){var e=this._input.substring(this.offset,this.offset+t);return"\r"===e[e.length-1]&&"\n"===this._input[this.offset+t+1]&&(e+="\n"),e},n.prototype.consume=function(t){for(var e=0;e<t;e++){var i=this._input[this.offset];if(!i)break;this.yytext+=i,this.offset++,"\r"===i&&"\n"===this._input[this.offset]&&(this.yytext+="\n",this.offset++,e++),"\n"===i||"\r"===i?(this.yylloc.last_line=++this.yylineno,this.yyprevcol=this.yylloc.last_column,this.yylloc.last_column=0):this.yylloc.last_column++}return this},n.prototype.getState=function(){return{yytext:this.yytext,offset:this.offset,yylineno:this.yylineno,yyprevcol:this.yyprevcol,yylloc:{first_offset:this.yylloc.first_offset,first_line:this.yylloc.first_line,first_column:this.yylloc.first_column,last_line:this.yylloc.last_line,last_column:this.yylloc.last_column}}},n.prototype.setState=function(t){return this.yytext=t.yytext,this.offset=t.offset,this.yylineno=t.yylineno,this.yyprevcol=t.yyprevcol,this.yylloc=t.yylloc,this},n.prototype.appendToken=function(t,e){return this.tokens.push([t,e]),this},n.prototype.lex=function(){this.yylloc.prev_offset=this.offset,this.yylloc.prev_line=this.yylloc.last_line,this.yylloc.prev_column=this.yylloc.last_column;var t=this.next()||this.lex();if(!this.all_tokens){for(;t===this.tok.T_WHITESPACE||!this.comment_tokens&&(t===this.tok.T_COMMENT||t===this.tok.T_DOC_COMMENT)||t===this.tok.T_OPEN_TAG;)t=this.next()||this.lex();if(t==this.tok.T_OPEN_TAG_WITH_ECHO)return this.tok.T_ECHO;if(t===this.tok.T_CLOSE_TAG)return";"}return this.yylloc.prev_offset||(this.yylloc.prev_offset=this.yylloc.first_offset,this.yylloc.prev_line=this.yylloc.first_line,this.yylloc.prev_column=this.yylloc.first_column),t},n.prototype.begin=function(t){if(this.conditionStack.push(t),this.curCondition=t,this.stateCb=this["match"+t],"function"!=typeof this.stateCb)throw new Error('Undefined condition state "'+t+'"');return this},n.prototype.popState=function(){var t=0<this.conditionStack.length-1?this.conditionStack.pop():this.conditionStack[0];if(this.curCondition=this.conditionStack[this.conditionStack.length-1],this.stateCb=this["match"+this.curCondition],"function"!=typeof this.stateCb)throw new Error('Undefined condition state "'+this.curCondition+'"');return t},n.prototype.next=function(){var t=void 0;if(this._input||(this.done=!0),this.yylloc.first_offset=this.offset,this.yylloc.first_line=this.yylloc.last_line,this.yylloc.first_column=this.yylloc.last_column,this.yytext="",this.done)return this.yylloc.prev_offset=this.yylloc.first_offset,this.yylloc.prev_line=this.yylloc.first_line,this.yylloc.prev_column=this.yylloc.first_column,this.EOF;if(t=0<this.tokens.length?(t=this.tokens.shift(),"object"===r(t[1])?this.setState(t[1]):this.consume(t[1]),t[0]):this.stateCb.apply(this,[]),this.offset>=this.size&&0===this.tokens.length&&(this.done=!0),this.debug){var e=t;e="number"==typeof e?this.engine.tokens.values[e]:'"'+e+'"';var i=new Error(e+"\tfrom "+this.yylloc.first_line+","+this.yylloc.first_column+"\t - to "+this.yylloc.last_line+","+this.yylloc.last_column+'\t"'+this.yytext+'"');console.error(i.stack)}return t},[i(19),i(20),i(21),i(23),i(24),i(25),i(26),i(27)].forEach(function(t){for(var e in t)n.prototype[e]=t[e]}),t.exports=n},function(t,e,i){"use strict";t.exports={T_COMMENT:function(){for(;this.offset<this.size;){var t=this.input();if("\n"===t||"\r"===t)return this.tok.T_COMMENT;if("?"===t&&!this.aspTagMode&&">"===this._input[this.offset])return this.unput(1),this.tok.T_COMMENT;if("%"===t&&this.aspTagMode&&">"===this._input[this.offset])return this.unput(1),this.tok.T_COMMENT}return this.tok.T_COMMENT},T_DOC_COMMENT:function(){var t=this.input(),e=this.tok.T_COMMENT;if("*"===t){if(t=this.input(),this.is_WHITESPACE()&&(e=this.tok.T_DOC_COMMENT),"/"===t)return e;this.unput(1)}for(;this.offset<this.size;)if("*"===(t=this.input())&&"/"===this._input[this.offset]){this.input();break}return e}}},function(t,e,i){"use strict";t.exports={nextINITIAL:function(){return 1<this.conditionStack.length&&"INITIAL"===this.conditionStack[this.conditionStack.length-1]?this.popState():this.begin("ST_IN_SCRIPTING"),this},matchINITIAL:function(){for(;this.offset<this.size;){var t=this.input();if("<"==t)if("?"==(t=this.ahead(1))){if(this.tryMatch("?=")){this.unput(1).appendToken(this.tok.T_OPEN_TAG_WITH_ECHO,3).nextINITIAL();break}if(this.tryMatchCaseless("?php")&&(" "===(t=this._input[this.offset+4])||"\t"===t||"\n"===t||"\r"===t)){this.unput(1).appendToken(this.tok.T_OPEN_TAG,6).nextINITIAL();break}if(this.short_tags){this.unput(1).appendToken(this.tok.T_OPEN_TAG,2).nextINITIAL();break}}else if(this.asp_tags&&"%"==t){if(this.tryMatch("%=")){this.aspTagMode=!0,this.unput(1).appendToken(this.tok.T_OPEN_TAG_WITH_ECHO,3).nextINITIAL();break}this.aspTagMode=!0,this.unput(1).appendToken(this.tok.T_OPEN_TAG,2).nextINITIAL();break}}return 0<this.yytext.length&&this.tok.T_INLINE_HTML}}},function(e,t,i){"use strict";(function(t){var i=10,r="2147483648";"x64"==t.arch&&(i=19,r="9223372036854775808"),e.exports={consume_NUM:function(){var t=this.yytext[0],e="."===this.yytext[0];if("0"===t)if("x"===(t=this.input())||"X"===t){if(t=this.input(),this.is_HEX())return this.consume_HNUM();this.unput(t?2:1)}else if("b"===t||"B"===t){if("0"===(t=this.input())||"1"===t)return this.consume_BNUM();this.unput(t?2:1)}else this.is_NUM()||t&&this.unput(1);for(;this.offset<this.size;)if(t=this.input(),!this.is_NUM()){if("."!==t||e){if("e"===t||"E"===t){if("+"===(t=this.input())||"-"===t){if(t=this.input(),this.is_NUM())return this.consume_LNUM(),this.tok.T_DNUMBER;this.unput(t?3:2);break}if(this.is_NUM())return this.consume_LNUM(),this.tok.T_DNUMBER;this.unput(t?2:1);break}t&&this.unput(1);break}e=!0}return e?this.tok.T_DNUMBER:this.yytext.length<i-1?this.tok.T_LNUMBER:this.yytext.length<i||this.yytext.length==i&&this.yytext<r?this.tok.T_LNUMBER:this.tok.T_DNUMBER},consume_HNUM:function(){for(;this.offset<this.size;){var t=this.input();if(!this.is_HEX()){t&&this.unput(1);break}}return this.tok.T_LNUMBER},consume_LNUM:function(){for(;this.offset<this.size;){var t=this.input();if(!this.is_NUM()){t&&this.unput(1);break}}return this.tok.T_LNUMBER},consume_BNUM:function(){for(var t=void 0;this.offset<this.size;)if("0"!==(t=this.input())&&"1"!==t){t&&this.unput(1);break}return this.tok.T_LNUMBER}}}).call(this,i(22))},function(t,e){var i,r,n=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(i===setTimeout)return setTimeout(e,0);if((i===o||!i)&&setTimeout)return i=setTimeout,setTimeout(e,0);try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:o}catch(t){i=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var l,c=[],h=!1,u=-1;function f(){h&&l&&(h=!1,l.length?c=l.concat(c):u=-1,c.length&&d())}function d(){if(!h){var t=a(f);h=!0;for(var e=c.length;e;){for(l=c,c=[];++u<e;)l&&l[u].run();u=-1,e=c.length}l=null,h=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function m(){}n.nextTick=function(t){var e=new Array(arguments.length-1);if(1<arguments.length)for(var i=1;i<arguments.length;i++)e[i-1]=arguments[i];c.push(new p(t,e)),1!==c.length||h||a(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=m,n.addListener=m,n.once=m,n.off=m,n.removeListener=m,n.removeAllListeners=m,n.emit=m,n.prependListener=m,n.prependOnceListener=m,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},function(t,e,i){"use strict";t.exports={matchST_LOOKING_FOR_PROPERTY:function(){var t=this.input();if("-"===t){if(">"===(t=this.input()))return this.tok.T_OBJECT_OPERATOR;t&&this.unput(1)}else{if(this.is_WHITESPACE())return this.tok.T_WHITESPACE;if(this.is_LABEL_START())return this.consume_LABEL(),this.popState(),this.tok.T_STRING}return this.popState(),t&&this.unput(1),!1},matchST_LOOKING_FOR_VARNAME:function(){var t=this.input();if(this.popState(),this.begin("ST_IN_SCRIPTING"),this.is_LABEL_START()){if(this.consume_LABEL(),"["===(t=this.input())||"}"===t)return this.unput(1),this.tok.T_STRING_VARNAME;this.unput(this.yytext.length)}else t&&this.unput(1);return!1},matchST_VAR_OFFSET:function(){var t=this.input();if(this.is_NUM())return this.consume_NUM(),this.tok.T_NUM_STRING;if("]"===t)return this.popState(),"]";if("$"===t){if(this.input(),this.is_LABEL_START())return this.consume_LABEL(),this.tok.T_VARIABLE;throw new Error("Unexpected terminal")}if(this.is_LABEL_START())return this.consume_LABEL(),this.tok.T_STRING;if(this.is_WHITESPACE()||"\\"===t||"'"===t||"#"===t)return this.tok.T_ENCAPSED_AND_WHITESPACE;if("["===t||"{"===t||"}"===t||'"'===t||"`"===t||this.is_TOKEN())return t;throw new Error("Unexpected terminal")}}},function(t,e,i){"use strict";t.exports={matchST_IN_SCRIPTING:function(){var t=this.input();switch(t){case" ":case"\t":case"\n":case"\r":case"\r\n":return this.T_WHITESPACE();case"#":return this.T_COMMENT();case"/":return"/"===this._input[this.offset]?this.T_COMMENT():"*"===this._input[this.offset]?(this.input(),this.T_DOC_COMMENT()):this.consume_TOKEN();case"'":return this.T_CONSTANT_ENCAPSED_STRING();case'"':return this.ST_DOUBLE_QUOTES();case"`":return this.begin("ST_BACKQUOTE"),"`";case"?":if(this.aspTagMode||!this.tryMatch(">"))return this.consume_TOKEN();this.input();var e=this._input[this.offset];return"\n"!==e&&"\r"!==e||this.input(),1<this.conditionStack.length&&this.begin("INITIAL"),this.tok.T_CLOSE_TAG;case"%":return this.aspTagMode&&">"===this._input[this.offset]?(this.input(),"\n"!==(t=this._input[this.offset])&&"\r"!==t||this.input(),this.aspTagMode=!1,1<this.conditionStack.length&&this.begin("INITIAL"),this.tok.T_CLOSE_TAG):this.consume_TOKEN();case"{":return this.begin("ST_IN_SCRIPTING"),"{";case"}":return 2<this.conditionStack.length&&this.popState(),"}";default:if("."===t){if(t=this.input(),this.is_NUM())return this.consume_NUM();t&&this.unput(1)}if(this.is_NUM())return this.consume_NUM();if(this.is_LABEL_START())return this.consume_LABEL().T_STRING();if(this.is_TOKEN())return this.consume_TOKEN()}throw new Error('Bad terminal sequence "'+t+'" at line '+this.yylineno+" (offset "+this.offset+")")},T_WHITESPACE:function(){for(;this.offset<this.size;){var t=this.input();if(" "!==t&&"\t"!==t&&"\n"!==t&&"\r"!==t){t&&this.unput(1);break}}return this.tok.T_WHITESPACE}}},function(t,e,i){"use strict";t.exports={T_CONSTANT_ENCAPSED_STRING:function(){for(var t=void 0;this.offset<this.size;)if("\\"==(t=this.input()))this.input();else if("'"==t)break;return this.tok.T_CONSTANT_ENCAPSED_STRING},is_HEREDOC:function(){var t=this.offset;if("<"===this._input[this.offset-1]&&"<"===this._input[this.offset]&&"<"===this._input[this.offset+1]){if(this.offset+=3,this.is_TABSPACE())for(;this.offset<this.size&&(this.offset++,this.is_TABSPACE()););var e=this._input[this.offset-1];if("'"===e||'"'===e?this.offset++:e=null,this.is_LABEL_START()){for(var i=this.offset-1;this.offset<this.size&&(this.offset++,this.is_LABEL()););var r=this._input.substring(i,this.offset-1);if((!e||e===this._input[this.offset-1])&&(e&&this.offset++,"\r"===this._input[this.offset-1]||"\n"===this._input[this.offset-1]))return this.heredoc_label=r,i=this.offset-t,this.offset=t,this.consume(i),"'"===e?this.begin("ST_NOWDOC"):this.begin("ST_HEREDOC"),this.tok.T_START_HEREDOC}}return this.offset=t,!1},ST_DOUBLE_QUOTES:function(){for(var t=void 0;this.offset<this.size;)if("\\"==(t=this.input()))this.input();else{if('"'==t)break;if("$"==t){if("{"==(t=this.input())||this.is_LABEL_START()){this.unput(2);break}t&&this.unput(1)}else if("{"==t){if("$"==(t=this.input())){this.unput(2);break}t&&this.unput(1)}}if('"'==t)return this.tok.T_CONSTANT_ENCAPSED_STRING;var e=1;return"b"!==this.yytext[0]&&"B"!==this.yytext[0]||(e=2),2<this.yytext.length&&this.appendToken(this.tok.T_ENCAPSED_AND_WHITESPACE,this.yytext.length-e),this.unput(this.yytext.length-e),this.begin("ST_DOUBLE_QUOTES"),this.yytext},isDOC_MATCH:function(){if(this._input.substring(this.offset-1,this.offset-1+this.heredoc_label.length)===this.heredoc_label){var t=this._input[this.offset-1+this.heredoc_label.length];if("\n"===t||"\r"===t||";"===t)return!0}return!1},matchST_NOWDOC:function(){if(this.isDOC_MATCH())return this.consume(this.heredoc_label.length),this.popState(),this.tok.T_END_HEREDOC;for(var t=this._input[this.offset-1];this.offset<this.size;)if("\n"===t||"\r"===t){if(t=this.input(),this.isDOC_MATCH())return this.unput(1).popState(),this.appendToken(this.tok.T_END_HEREDOC,this.heredoc_label.length),this.tok.T_ENCAPSED_AND_WHITESPACE}else t=this.input();return this.tok.T_ENCAPSED_AND_WHITESPACE},matchST_HEREDOC:function(){var t=this.input();if(this.isDOC_MATCH())return this.consume(this.heredoc_label.length-1),this.popState(),this.tok.T_END_HEREDOC;for(;this.offset<this.size;)if("\\"===t&&"\n"!==(t=this.input())&&"\r"!==t&&(t=this.input()),"\n"===t||"\r"===t){if(t=this.input(),this.isDOC_MATCH())return this.unput(1).popState(),this.appendToken(this.tok.T_END_HEREDOC,this.heredoc_label.length),this.tok.T_ENCAPSED_AND_WHITESPACE}else if("$"===t){if("{"===(t=this.input()))return this.begin("ST_LOOKING_FOR_VARNAME"),2<this.yytext.length?(this.appendToken(this.tok.T_DOLLAR_OPEN_CURLY_BRACES,2),this.unput(2),this.tok.T_ENCAPSED_AND_WHITESPACE):this.tok.T_DOLLAR_OPEN_CURLY_BRACES;if(this.is_LABEL_START()){var e=this.offset,i=this.consume_VARIABLE();return this.yytext.length>this.offset-e+2?(this.appendToken(i,this.offset-e+2),this.unput(this.offset-e+2),this.tok.T_ENCAPSED_AND_WHITESPACE):i}}else if("{"===t){if("$"===(t=this.input()))return this.begin("ST_IN_SCRIPTING"),2<this.yytext.length?(this.appendToken(this.tok.T_CURLY_OPEN,1),this.unput(2),this.tok.T_ENCAPSED_AND_WHITESPACE):(this.unput(1),this.tok.T_CURLY_OPEN)}else t=this.input();return this.tok.T_ENCAPSED_AND_WHITESPACE},consume_VARIABLE:function(){this.consume_LABEL();var t=this.input();if("["==t)return this.unput(1),this.begin("ST_VAR_OFFSET"),this.tok.T_VARIABLE;if("-"===t){if(">"===this.input())return this.input(),this.is_LABEL_START()&&this.begin("ST_LOOKING_FOR_PROPERTY"),this.unput(3),this.tok.T_VARIABLE;this.unput(2)}else t&&this.unput(1);return this.tok.T_VARIABLE},matchST_BACKQUOTE:function(){var t=this.input();if("$"===t){if("{"===(t=this.input()))return this.begin("ST_LOOKING_FOR_VARNAME"),this.tok.T_DOLLAR_OPEN_CURLY_BRACES;if(this.is_LABEL_START())return this.consume_VARIABLE()}else if("{"===t){if("$"===this._input[this.offset])return this.begin("ST_IN_SCRIPTING"),this.tok.T_CURLY_OPEN}else if("`"===t)return this.popState(),"`";for(;this.offset<this.size;){if("\\"===t)this.input();else{if("`"===t){this.unput(1),this.popState(),this.appendToken("`",1);break}if("$"===t){if("{"===(t=this.input()))return this.begin("ST_LOOKING_FOR_VARNAME"),2<this.yytext.length?(this.appendToken(this.tok.T_DOLLAR_OPEN_CURLY_BRACES,2),this.unput(2),this.tok.T_ENCAPSED_AND_WHITESPACE):this.tok.T_DOLLAR_OPEN_CURLY_BRACES;if(this.is_LABEL_START()){var e=this.offset,i=this.consume_VARIABLE();return this.yytext.length>this.offset-e+2?(this.appendToken(i,this.offset-e+2),this.unput(this.offset-e+2),this.tok.T_ENCAPSED_AND_WHITESPACE):i}continue}if("{"===t){if("$"===(t=this.input()))return this.begin("ST_IN_SCRIPTING"),2<this.yytext.length?(this.appendToken(this.tok.T_CURLY_OPEN,1),this.unput(2),this.tok.T_ENCAPSED_AND_WHITESPACE):(this.unput(1),this.tok.T_CURLY_OPEN);continue}}t=this.input()}return this.tok.T_ENCAPSED_AND_WHITESPACE},matchST_DOUBLE_QUOTES:function(){var t=this.input();if("$"===t){if("{"===(t=this.input()))return this.begin("ST_LOOKING_FOR_VARNAME"),this.tok.T_DOLLAR_OPEN_CURLY_BRACES;if(this.is_LABEL_START())return this.consume_VARIABLE()}else if("{"===t){if("$"===this._input[this.offset])return this.begin("ST_IN_SCRIPTING"),this.tok.T_CURLY_OPEN}else if('"'===t)return this.popState(),'"';for(;this.offset<this.size;){if("\\"===t)this.input();else{if('"'===t){this.unput(1),this.popState(),this.appendToken('"',1);break}if("$"===t){if("{"===(t=this.input()))return this.begin("ST_LOOKING_FOR_VARNAME"),2<this.yytext.length?(this.appendToken(this.tok.T_DOLLAR_OPEN_CURLY_BRACES,2),this.unput(2),this.tok.T_ENCAPSED_AND_WHITESPACE):this.tok.T_DOLLAR_OPEN_CURLY_BRACES;if(this.is_LABEL_START()){var e=this.offset,i=this.consume_VARIABLE();return this.yytext.length>this.offset-e+2?(this.appendToken(i,this.offset-e+2),this.unput(this.offset-e+2),this.tok.T_ENCAPSED_AND_WHITESPACE):i}t&&this.unput(1)}else if("{"===t){if("$"===(t=this.input()))return this.begin("ST_IN_SCRIPTING"),2<this.yytext.length?(this.appendToken(this.tok.T_CURLY_OPEN,1),this.unput(2),this.tok.T_ENCAPSED_AND_WHITESPACE):(this.unput(1),this.tok.T_CURLY_OPEN);t&&this.unput(1)}}t=this.input()}return this.tok.T_ENCAPSED_AND_WHITESPACE}}},function(t,e,i){"use strict";t.exports={T_STRING:function(){var t=this.yytext.toLowerCase(),e=this.keywords[t];if("number"!=typeof e)if("yield"===t)e=this.php7&&this.tryMatch(" from")?(this.consume(5),this.tok.T_YIELD_FROM):this.tok.T_YIELD;else if(e=this.tok.T_STRING,"b"===t||"B"===t){var i=this.input(1);if('"'===i)return this.ST_DOUBLE_QUOTES();if("'"===i)return this.T_CONSTANT_ENCAPSED_STRING();i&&this.unput(1)}return e},consume_TOKEN:function(){var t=this._input[this.offset-1],e=this.tokenTerminals[t];return e?e.apply(this,[]):this.yytext},tokenTerminals:{$:function(){return this.offset++,this.is_LABEL_START()?(this.offset--,this.consume_LABEL(),this.tok.T_VARIABLE):(this.offset--,"$")},"-":function(){var t=this._input[this.offset];return">"===t?(this.begin("ST_LOOKING_FOR_PROPERTY").input(),this.tok.T_OBJECT_OPERATOR):"-"===t?(this.input(),this.tok.T_DEC):"="===t?(this.input(),this.tok.T_MINUS_EQUAL):"-"},"\\":function(){return this.tok.T_NS_SEPARATOR},"/":function(){return"="===this._input[this.offset]?(this.input(),this.tok.T_DIV_EQUAL):"/"},":":function(){return":"===this._input[this.offset]?(this.input(),this.tok.T_DOUBLE_COLON):":"},"(":function(){var t=this.offset;if(this.input(),this.is_TABSPACE()&&this.consume_TABSPACE().input(),this.is_LABEL_START()){var e=this.yytext.length;this.consume_LABEL();var i=this.yytext.substring(e-1).toLowerCase(),r=this.castKeywords[i];if("number"==typeof r&&(this.input(),this.is_TABSPACE()&&this.consume_TABSPACE().input(),")"===this._input[this.offset-1]))return r}return this.unput(this.offset-t),"("},"=":function(){var t=this._input[this.offset];return">"===t?(this.input(),this.tok.T_DOUBLE_ARROW):"="===t?"="===this._input[this.offset+1]?(this.consume(2),this.tok.T_IS_IDENTICAL):(this.input(),this.tok.T_IS_EQUAL):"="},"+":function(){var t=this._input[this.offset];return"+"===t?(this.input(),this.tok.T_INC):"="===t?(this.input(),this.tok.T_PLUS_EQUAL):"+"},"!":function(){return"="===this._input[this.offset]?"="===this._input[this.offset+1]?(this.consume(2),this.tok.T_IS_NOT_IDENTICAL):(this.input(),this.tok.T_IS_NOT_EQUAL):"!"},"?":function(){return this.php7&&"?"===this._input[this.offset]?(this.input(),this.tok.T_COALESCE):"?"},"<":function(){var t=this._input[this.offset];return"<"===t?"="===(t=this._input[this.offset+1])?(this.consume(2),this.tok.T_SL_EQUAL):"<"===t&&this.is_HEREDOC()?this.tok.T_START_HEREDOC:(this.input(),this.tok.T_SL):"="===t?(this.input(),this.php7&&">"===this._input[this.offset]?(this.input(),this.tok.T_SPACESHIP):this.tok.T_IS_SMALLER_OR_EQUAL):">"===t?(this.input(),this.tok.T_IS_NOT_EQUAL):"<"},">":function(){var t=this._input[this.offset];return"="===t?(this.input(),this.tok.T_IS_GREATER_OR_EQUAL):">"===t?"="===(t=this._input[this.offset+1])?(this.consume(2),this.tok.T_SR_EQUAL):(this.input(),this.tok.T_SR):">"},"*":function(){var t=this._input[this.offset];return"="===t?(this.input(),this.tok.T_MUL_EQUAL):"*"===t?(this.input(),"="===this._input[this.offset]?(this.input(),this.tok.T_POW_EQUAL):this.tok.T_POW):"*"},".":function(){var t=this._input[this.offset];return"="===t?(this.input(),this.tok.T_CONCAT_EQUAL):"."===t&&"."===this._input[this.offset+1]?(this.consume(2),this.tok.T_ELLIPSIS):"."},"%":function(){return"="===this._input[this.offset]?(this.input(),this.tok.T_MOD_EQUAL):"%"},"&":function(){var t=this._input[this.offset];return"="===t?(this.input(),this.tok.T_AND_EQUAL):"&"===t?(this.input(),this.tok.T_BOOLEAN_AND):"&"},"|":function(){var t=this._input[this.offset];return"="===t?(this.input(),this.tok.T_OR_EQUAL):"|"===t?(this.input(),this.tok.T_BOOLEAN_OR):"|"},"^":function(){return"="===this._input[this.offset]?(this.input(),this.tok.T_XOR_EQUAL):"^"}}}},function(t,e,i){"use strict";t.exports={is_NUM:function(){var t=this._input.charCodeAt(this.offset-1);return 47<t&&t<58},is_LABEL:function(){var t=this._input.charCodeAt(this.offset-1);return 96<t&&t<123||64<t&&t<91||95===t||47<t&&t<58||126<t},is_LABEL_START:function(){var t=this._input.charCodeAt(this.offset-1);return 96<t&&t<123||64<t&&t<91||95===t||126<t},consume_LABEL:function(){for(;this.offset<this.size;){var t=this.input();if(!this.is_LABEL()){t&&this.unput(1);break}}return this},is_TOKEN:function(){var t=this._input[this.offset-1];return-1!==";:,.\\[]()|^&+-/*=%!~$<>?@".indexOf(t)},is_WHITESPACE:function(){var t=this._input[this.offset-1];return" "===t||"\t"===t||"\n"===t||"\r"===t},is_TABSPACE:function(){var t=this._input[this.offset-1];return" "===t||"\t"===t},consume_TABSPACE:function(){for(;this.offset<this.size;){var t=this.input();if(!this.is_TABSPACE()){t&&this.unput(1);break}}return this},is_HEX:function(){var t=this._input.charCodeAt(this.offset-1);return 47<t&&t<58||64<t&&t<71||96<t&&t<103}}},function(t,e,i){"use strict";function o(t){return"."!=t&&","!=t&&!isNaN(parseFloat(t))&&isFinite(t)}var r=function(t,e){this.lexer=t,this.ast=e,this.tok=t.tok,this.EOF=t.EOF,this.token=null,this.prev=null,this.debug=!1,this.php7=!0,this.extractDoc=!1,this.extractTokens=!1,this.suppressErrors=!1;var i=function(t){return[t,null]};this.entries={IDENTIFIER:new Map([this.tok.T_ABSTRACT,this.tok.T_ARRAY,this.tok.T_AS,this.tok.T_BREAK,this.tok.T_CALLABLE,this.tok.T_CASE,this.tok.T_CATCH,this.tok.T_CLASS,this.tok.T_CLASS_C,this.tok.T_CLONE,this.tok.T_CONST,this.tok.T_CONTINUE,this.tok.T_DECLARE,this.tok.T_DEFAULT,this.tok.T_DIR,this.tok.T_DO,this.tok.T_ECHO,this.tok.T_ELSE,this.tok.T_ELSEIF,this.tok.T_EMPTY,this.tok.T_ENDDECLARE,this.tok.T_ENDFOR,this.tok.T_ENDFOREACH,this.tok.T_ENDIF,this.tok.T_ENDSWITCH,this.tok.T_ENDWHILE,this.tok.T_EVAL,this.tok.T_EXIT,this.tok.T_EXTENDS,this.tok.T_FILE,this.tok.T_FINAL,this.tok.T_FINALLY,this.tok.T_FUNC_C,this.tok.T_FOR,this.tok.T_FOREACH,this.tok.T_FUNCTION,this.tok.T_GLOBAL,this.tok.T_GOTO,this.tok.T_IF,this.tok.T_IMPLEMENTS,this.tok.T_INCLUDE,this.tok.T_INCLUDE_ONCE,this.tok.T_INSTANCEOF,this.tok.T_INSTEADOF,this.tok.T_INTERFACE,this.tok.T_ISSET,this.tok.T_LINE,this.tok.T_LIST,this.tok.T_LOGICAL_AND,this.tok.T_LOGICAL_OR,this.tok.T_LOGICAL_XOR,this.tok.T_METHOD_C,this.tok.T_NAMESPACE,this.tok.T_NEW,this.tok.T_NS_C,this.tok.T_PRINT,this.tok.T_PRIVATE,this.tok.T_PROTECTED,this.tok.T_PUBLIC,this.tok.T_REQUIRE,this.tok.T_REQUIRE_ONCE,this.tok.T_RETURN,this.tok.T_STATIC,this.tok.T_SWITCH,this.tok.T_THROW,this.tok.T_TRAIT,this.tok.T_TRY,this.tok.T_UNSET,this.tok.T_USE,this.tok.T_VAR,this.tok.T_WHILE,this.tok.T_YIELD].map(i)),VARIABLE:new Map([this.tok.T_VARIABLE,"$","&",this.tok.T_NS_SEPARATOR,this.tok.T_STRING,this.tok.T_NAMESPACE,this.tok.T_STATIC].map(i)),SCALAR:new Map([this.tok.T_CONSTANT_ENCAPSED_STRING,this.tok.T_START_HEREDOC,this.tok.T_LNUMBER,this.tok.T_DNUMBER,this.tok.T_ARRAY,"[",this.tok.T_CLASS_C,this.tok.T_TRAIT_C,this.tok.T_FUNC_C,this.tok.T_METHOD_C,this.tok.T_LINE,this.tok.T_FILE,this.tok.T_DIR,this.tok.T_NS_C,'"','b"','B"',"-",this.tok.T_NS_SEPARATOR].map(i)),T_MAGIC_CONST:new Map([this.tok.T_CLASS_C,this.tok.T_TRAIT_C,this.tok.T_FUNC_C,this.tok.T_METHOD_C,this.tok.T_LINE,this.tok.T_FILE,this.tok.T_DIR,this.tok.T_NS_C].map(i)),T_MEMBER_FLAGS:new Map([this.tok.T_PUBLIC,this.tok.T_PRIVATE,this.tok.T_PROTECTED,this.tok.T_STATIC,this.tok.T_ABSTRACT,this.tok.T_FINAL].map(i)),EOS:new Map([";",this.EOF,this.tok.T_INLINE_HTML].map(i)),EXPR:new Map(["@","-","+","!","~","(","`",this.tok.T_LIST,this.tok.T_CLONE,this.tok.T_INC,this.tok.T_DEC,this.tok.T_NEW,this.tok.T_ISSET,this.tok.T_EMPTY,this.tok.T_INCLUDE,this.tok.T_INCLUDE_ONCE,this.tok.T_REQUIRE,this.tok.T_REQUIRE_ONCE,this.tok.T_EVAL,this.tok.T_INT_CAST,this.tok.T_DOUBLE_CAST,this.tok.T_STRING_CAST,this.tok.T_ARRAY_CAST,this.tok.T_OBJECT_CAST,this.tok.T_BOOL_CAST,this.tok.T_UNSET_CAST,this.tok.T_EXIT,this.tok.T_PRINT,this.tok.T_YIELD,this.tok.T_STATIC,this.tok.T_FUNCTION,this.tok.T_VARIABLE,"$",this.tok.T_NS_SEPARATOR,this.tok.T_STRING,this.tok.T_STRING,this.tok.T_CONSTANT_ENCAPSED_STRING,this.tok.T_START_HEREDOC,this.tok.T_LNUMBER,this.tok.T_DNUMBER,this.tok.T_ARRAY,"[",this.tok.T_CLASS_C,this.tok.T_TRAIT_C,this.tok.T_FUNC_C,this.tok.T_METHOD_C,this.tok.T_LINE,this.tok.T_FILE,this.tok.T_DIR,this.tok.T_NS_C].map(i))}};r.prototype.getTokenName=function(t){return o(t)?t==this.EOF?"the end of file (EOF)":this.lexer.engine.tokens.values[t]:"'"+t+"'"},r.prototype.parse=function(t,e){this._errors=[],this.filename=e||"eval",this.currentNamespace=[""],this.extractDoc?this._docs=[]:this._docs=null,this.extractTokens?this._tokens=[]:this._tokens=null,this._docIndex=0,this.lexer.setInput(t),this.lexer.all_tokens=this.extractTokens,this.lexer.comment_tokens=this.extractDoc,this.length=this.lexer._input.length,this.innerList=!1,this.innerListForm=!1;var i=this.node("program"),r=[];for(this.next();this.token!=this.EOF;){var n=this.read_start();null!=n&&(Array.isArray(n)?r=r.concat(n):r.push(n))}return this.prev=[this.lexer.yylloc.last_line,this.lexer.yylloc.last_column,this.lexer.offset],i(r,this._errors,this._docs,this._tokens)},r.prototype.raiseError=function(t,e,i,r){if(t+=" on line "+this.lexer.yylloc.first_line,!this.suppressErrors){var n=new SyntaxError(t,this.filename,this.lexer.yylloc.first_line);throw n.lineNumber=this.lexer.yylloc.first_line,n.fileName=this.filename,n.columnNumber=this.lexer.yylloc.first_column,n}var o=this.ast.prepare("error",null,this)(t,r,this.lexer.yylloc.first_line,i);return this._errors.push(o),o},r.prototype.error=function(t){var e="Parse Error : syntax error",i=this.getTokenName(this.token),r="";if(this.token!==this.EOF){if(o(this.token)){var n=this.text();10<n.length&&(n=n.substring(0,7)+"..."),i="'"+n+"' ("+i+")"}e+=", unexpected "+i}return t&&!Array.isArray(t)&&((o(t)||1===t.length)&&(r=", expecting "+this.getTokenName(t)),e+=r),this.raiseError(e,r,t,i)},r.prototype.node=function(t){if(this.extractDoc){var e=null;this._docIndex<this._docs.length&&(e=this._docs.slice(this._docIndex),this._docIndex=this._docs.length,this.debug&&(console.log(new Error("Append docs on "+t)),console.log(e)));var i=this.ast.prepare(t,e,this);return i.preBuild=function(){this._docIndex<this._docs.length&&(i.setTrailingComments(this._docs.slice(this._docIndex)),this._docIndex=this._docs.length)}.bind(this),i}return this.ast.prepare(t,null,this)},r.prototype.expectEndOfStatement=function(t){if(";"===this.token)t&&";"===this.lexer.yytext&&t.includeToken(this);else if(this.token!==this.tok.T_INLINE_HTML&&this.token!==this.EOF)return this.error(";"),!1;return this.next(),!0};var s=["parser.next","parser.node","parser.showlog"];r.prototype.showlog=function(){for(var t=(new Error).stack.split("\n"),e=void 0,i=2;i<t.length;i++){e=t[i].trim();for(var r=!1,n=0;n<s.length;n++)if(e.substring(3,3+s[n].length)===s[n]){r=!0;break}if(!r)break}return console.log("Line "+this.lexer.yylloc.first_line+" : "+this.getTokenName(this.token)+">"+this.lexer.yytext+"< @--\x3e"+e),this},r.prototype.expect=function(t){if(Array.isArray(t)){if(-1===t.indexOf(this.token))return this.error(t),!1}else if(this.token!=t)return this.error(t),!1;return!0},r.prototype.text=function(){return this.lexer.yytext},r.prototype.next=function(){if(";"===this.token&&";"!==this.lexer.yytext||(this.prev=[this.lexer.yylloc.last_line,this.lexer.yylloc.last_column,this.lexer.offset]),this.lex(),this.debug&&this.showlog(),this.extractDoc)for(;this.token===this.tok.T_COMMENT||this.token===this.tok.T_DOC_COMMENT;)this.token===this.tok.T_COMMENT?this._docs.push(this.read_comment()):this._docs.push(this.read_doc_comment());return this},r.prototype.lex=function(){if(this.extractTokens)do{if(this.token=this.lexer.lex()||this.EOF,this.token===this.EOF)return this;var t=this.lexer.yytext;if(t=this.lexer.engine.tokens.values.hasOwnProperty(this.token)?[this.lexer.engine.tokens.values[this.token],t,this.lexer.yylloc.first_line,this.lexer.yylloc.first_offset,this.lexer.offset]:[null,t,this.lexer.yylloc.first_line,this.lexer.yylloc.first_offset,this.lexer.offset],this._tokens.push(t),this.token===this.tok.T_CLOSE_TAG)return this.token=";",this;if(this.token===this.tok.T_OPEN_TAG_WITH_ECHO)return this.token=this.tok.T_ECHO,this}while(this.token===this.tok.T_WHITESPACE||!this.extractDoc&&(this.token===this.tok.T_COMMENT||this.token===this.tok.T_DOC_COMMENT)||this.token===this.tok.T_OPEN_TAG);else this.token=this.lexer.lex()||this.EOF;return this},r.prototype.is=function(t){return Array.isArray(t)?-1!==t.indexOf(this.token):this.entries[t].has(this.token)},[i(29),i(30),i(31),i(32),i(33),i(34),i(35),i(36),i(37),i(38),i(39),i(40),i(41),i(42),i(43)].forEach(function(t){for(var e in t)r.prototype[e]=t[e]}),t.exports=r},function(t,e,i){"use strict";t.exports={read_array:function(){var t=null,e=!1,i=this.node("array");t=this.token===this.tok.T_ARRAY?(this.next().expect("("),")"):(e=!0,"]");var r=[];return this.next().token!==t&&(r=this.read_array_pair_list(e)),this.expect(t),this.next(),i(e,r)},read_array_pair_list:function(t){var e=this;return this.read_list(function(){return e.read_array_pair(t)},",",!0)},read_array_pair:function(t){if(","===this.token||!t&&")"===this.token||t&&"]"===this.token)return null;if("&"===this.token)return this.next().read_variable(!0,!1,!0);var e=this.node("entry"),i=this.read_expr();return this.token===this.tok.T_DOUBLE_ARROW?"&"===this.next().token?e(i,this.next().read_variable(!0,!1,!0)):e(i,this.read_expr()):i},read_dim_offset:function(){return"]"!=this.token&&this.read_expr()}}},function(t,e,i){"use strict";t.exports={read_class:function(){var t=this.node("class"),e=this.read_class_scope();if(this.token!==this.tok.T_CLASS)return this.error(this.tok.T_CLASS),this.next(),null;this.next().expect(this.tok.T_STRING);var i=this.text(),r=null,n=null;return this.next().token==this.tok.T_EXTENDS&&(r=this.next().read_namespace_name()),this.token==this.tok.T_IMPLEMENTS&&(n=this.next().read_name_list()),this.expect("{"),t(i,r,n,this.next().read_class_body(),e)},read_class_scope:function(){var t=this.token;return t==this.tok.T_FINAL?(this.next(),[0,0,2]):t==this.tok.T_ABSTRACT?(this.next(),[0,0,1]):[0,0,0]},read_class_body:function(){for(var t=[];this.token!==this.EOF&&"}"!==this.token;)if(this.token!==this.tok.T_COMMENT)if(this.token!==this.tok.T_DOC_COMMENT)if(this.token!==this.tok.T_USE){var e=this.read_member_flags(!1);if(this.token!==this.tok.T_CONST)if(this.token===this.tok.T_VAR&&(this.next().expect(this.tok.T_VARIABLE),e[0]=null,e[1]=0),this.token===this.tok.T_VARIABLE){var i=this.read_variable_list(e);this.expect(";"),this.next(),t=t.concat(i)}else this.token===this.tok.T_FUNCTION?t.push(this.read_function(!1,e)):(this.error([this.tok.T_CONST,this.tok.T_VARIABLE,this.tok.T_FUNCTION]),this.next());else{var r=this.read_constant_list(e);this.expect(";")&&this.next(),t=t.concat(r)}}else t=t.concat(this.read_trait_use_statement());else t.push(this.read_doc_comment());else t.push(this.read_comment());return this.expect("}"),this.next(),t},read_variable_list:function(i){return this.read_list(function(){var t=this.node("property");this.expect(this.tok.T_VARIABLE);var e=this.text().substring(1);return this.next(),";"===this.token||","===this.token?t(e,null,i):"="===this.token?t(e,this.next().read_expr(),i):(this.expect([",",";","="]),t(e,null,i))},",")},read_constant_list:function(t){return this.expect(this.tok.T_CONST)&&this.next(),this.node("classconstant")(null,this.read_list(function(){var t=this.node("constant"),e=null,i=null;return this.token===this.tok.T_STRING||this.php7&&this.is("IDENTIFIER")?(e=this.text(),this.next()):this.expect("IDENTIFIER"),this.expect("=")&&(i=this.next().read_expr()),t(e,i)},","),t)},read_member_flags:function(t){var e=[-1,-1,-1];if(this.is("T_MEMBER_FLAGS")){var i=0,r=0;do{switch(this.token){case this.tok.T_PUBLIC:r=i=0;break;case this.tok.T_PROTECTED:i=0,r=1;break;case this.tok.T_PRIVATE:i=0,r=2;break;case this.tok.T_STATIC:r=i=1;break;case this.tok.T_ABSTRACT:i=2,r=1;break;case this.tok.T_FINAL:r=i=2}t&&(0==i&&2==r?(this.expect([this.tok.T_PUBLIC,this.tok.T_PROTECTED]),r=-1):2==i&&1==r&&(this.error(),r=-1)),-1!==e[i]?this.error():-1!==r&&(e[i]=r)}while(this.next().is("T_MEMBER_FLAGS"))}return-1==e[1]&&(e[1]=0),-1==e[2]&&(e[2]=0),e},read_interface:function(){var t=this.node("interface"),e=null,i=null,r=null;return this.expect(this.tok.T_INTERFACE)&&this.next(),this.expect(this.tok.T_STRING)&&(e=this.text(),this.next()),this.token===this.tok.T_EXTENDS&&(r=this.next().read_name_list()),this.expect("{")&&(i=this.next().read_interface_body()),t(e,r,i)},read_interface_body:function(){for(var t=[];this.token!==this.EOF&&"}"!==this.token;)if(this.token!==this.tok.T_COMMENT)if(this.token!==this.tok.T_DOC_COMMENT){var e=this.read_member_flags(!0);if(this.token==this.tok.T_CONST){var i=this.read_constant_list(e);this.expect(";")&&this.next(),t=t.concat(i)}else if(this.token===this.tok.T_FUNCTION){var r=this.read_function_declaration(2,e);r.parseFlags(e),t.push(r),this.expect(";")&&this.next()}else this.error([this.tok.T_CONST,this.tok.T_FUNCTION]),this.next()}else t.push(this.read_doc_comment());else t.push(this.read_comment());return this.expect("}")&&this.next(),t},read_trait:function(){var t=this.node("trait"),e=null,i=null,r=null,n=null;return this.expect(this.tok.T_TRAIT)&&this.next(),this.expect(this.tok.T_STRING)&&(e=this.text()),this.next().token==this.tok.T_EXTENDS&&(i=this.next().read_namespace_name()),this.token==this.tok.T_IMPLEMENTS&&(r=this.next().read_name_list()),this.expect("{")&&(n=this.next().read_class_body()),t(e,i,r,n)},read_trait_use_statement:function(){var t=this.node("traituse");this.expect(this.tok.T_USE)&&this.next();for(var e=[this.read_namespace_name()],i=null;","===this.token;)e.push(this.next().read_namespace_name());if("{"===this.token){for(i=[];this.next().token!==this.EOF&&"}"!==this.token;)i.push(this.read_trait_use_alias()),this.expect(";");this.expect("}")&&this.next()}else this.expect(";")&&this.next();return t(e,i)},read_trait_use_alias:function(){var t=this.node(),e=null,i=void 0;if(this.is("IDENTIFIER")?(i=this.text(),this.next()):(i=this.read_namespace_name(),this.token===this.tok.T_DOUBLE_COLON?(this.next(),this.token===this.tok.T_STRING||this.php7&&this.is("IDENTIFIER")?(e=i,i=this.text(),this.next()):this.expect(this.tok.T_STRING)):i=i.name),this.token===this.tok.T_INSTEADOF)return t("traitprecedence",e,i,this.next().read_name_list());if(this.token!==this.tok.T_AS)return this.expect([this.tok.T_AS,this.tok.T_INSTEADOF]),t("traitalias",e,i,null,null);var r=null,n=null;return this.next().is("T_MEMBER_FLAGS")&&(r=this.read_member_flags()),this.token===this.tok.T_STRING||this.php7&&this.is("IDENTIFIER")?(n=this.text(),this.next()):!1===r&&this.expect(this.tok.T_STRING),t("traitalias",e,i,n,r)}}},function(t,e,i){"use strict";t.exports={read_comment:function(){var t=this.text(),e=this.ast.prepare("/*"===t.substring(0,2)?"commentblock":"commentline",null,this),i=this.prev;return this.prev=[this.lexer.yylloc.last_line,this.lexer.yylloc.last_column,this.lexer.offset],this.lex(),e=e(t),this.prev=i,e},read_doc_comment:function(){var t=this.ast.prepare("commentblock",null,this),e=this.text(),i=this.prev;return this.prev=[this.lexer.yylloc.last_line,this.lexer.yylloc.last_column,this.lexer.offset],this.lex(),t=t(e),this.prev=i,t}}},function(t,e,i){"use strict";t.exports={read_expr:function(t){var e=this.node();if(t||(t=this.read_expr_item()),"|"===this.token)return e("bin","|",t,this.next().read_expr());if("&"===this.token)return e("bin","&",t,this.next().read_expr());if("^"===this.token)return e("bin","^",t,this.next().read_expr());if("."===this.token)return e("bin",".",t,this.next().read_expr());if("+"===this.token)return e("bin","+",t,this.next().read_expr());if("-"===this.token)return e("bin","-",t,this.next().read_expr());if("*"===this.token)return e("bin","*",t,this.next().read_expr());if("/"===this.token)return e("bin","/",t,this.next().read_expr());if("%"===this.token)return e("bin","%",t,this.next().read_expr());if(this.token===this.tok.T_POW)return e("bin","**",t,this.next().read_expr());if(this.token===this.tok.T_SL)return e("bin","<<",t,this.next().read_expr());if(this.token===this.tok.T_SR)return e("bin",">>",t,this.next().read_expr());if(this.token===this.tok.T_BOOLEAN_OR)return e("bin","||",t,this.next().read_expr());if(this.token===this.tok.T_LOGICAL_OR)return e("bin","or",t,this.next().read_expr());if(this.token===this.tok.T_BOOLEAN_AND)return e("bin","&&",t,this.next().read_expr());if(this.token===this.tok.T_LOGICAL_AND)return e("bin","and",t,this.next().read_expr());if(this.token===this.tok.T_LOGICAL_XOR)return e("bin","xor",t,this.next().read_expr());if(this.token===this.tok.T_IS_IDENTICAL)return e("bin","===",t,this.next().read_expr());if(this.token===this.tok.T_IS_NOT_IDENTICAL)return e("bin","!==",t,this.next().read_expr());if(this.token===this.tok.T_IS_EQUAL)return e("bin","==",t,this.next().read_expr());if(this.token===this.tok.T_IS_NOT_EQUAL)return e("bin","!=",t,this.next().read_expr());if("<"===this.token)return e("bin","<",t,this.next().read_expr());if(">"===this.token)return e("bin",">",t,this.next().read_expr());if(this.token===this.tok.T_IS_SMALLER_OR_EQUAL)return e("bin","<=",t,this.next().read_expr());if(this.token===this.tok.T_IS_GREATER_OR_EQUAL)return e("bin",">=",t,this.next().read_expr());if(this.token===this.tok.T_SPACESHIP)return e("bin","<=>",t,this.next().read_expr());if(this.token===this.tok.T_INSTANCEOF&&(t=e("bin","instanceof",t,this.next().read_class_name_reference()),";"!==this.token&&this.token!==this.tok.T_INLINE_HTML&&this.token!==this.EOF&&(t=this.read_expr(t))),this.token===this.tok.T_COALESCE)return e("bin","??",t,this.next().read_expr());if("?"!==this.token)return e.destroy(t),t;var i=null;return":"!==this.next().token&&(i=this.read_expr()),this.expect(":")&&this.next(),e("retif",t,i,this.read_expr())},read_expr_cast:function(t){return this.node("cast")(t,this.text(),this.next().read_expr())},read_expr_item:function(){var t=void 0,e=void 0;if("@"===this.token)return this.node("silent")(this.next().read_expr());if("+"===this.token)return this.node("unary")("+",this.next().read_expr());if("-"===this.token)return this.node("unary")("-",this.next().read_expr());if("!"===this.token)return this.node("unary")("!",this.next().read_expr());if("~"===this.token)return this.node("unary")("~",this.next().read_expr());if("("===this.token)return(e=this.next().read_expr()).parenthesizedExpression=!0,this.expect(")")&&this.next(),this.handleDereferencable(e);if("`"===this.token)return this.read_encapsed_string("`");if(this.token===this.tok.T_LIST){var i=null,r=this.innerList;t=this.node("list"),r||(i=this.node("assign")),this.next().expect("(")&&this.next(),this.innerList||(this.innerList=!0);var n=this.read_array_pair_list(!1);this.expect(")")&&this.next();for(var o=!1,s=0;s<n.length;s++)if(null!==n[s]){o=!0;break}return o||this.raiseError("Fatal Error : Cannot use empty list on line "+this.lexer.yylloc.first_line),r?t(n,!1):(this.innerList=!1,this.expect("=")?i(t(n,!1),this.next().read_expr(),"="):t(n,!1))}if(this.token===this.tok.T_CLONE)return this.node("clone")(this.next().read_expr());switch(this.token){case this.tok.T_INC:return this.node("pre")("+",this.next().read_variable(!1,!1,!1));case this.tok.T_DEC:return this.node("pre")("-",this.next().read_variable(!1,!1,!1));case this.tok.T_NEW:return this.read_new_expr();case this.tok.T_ISSET:t=this.node("isset"),this.next().expect("(")&&this.next();var a=this.read_list(this.read_expr,",");return this.expect(")")&&this.next(),t(a);case this.tok.T_EMPTY:t=this.node("empty"),this.next().expect("(")&&this.next();var l=this.read_expr();return this.expect(")")&&this.next(),t(l);case this.tok.T_INCLUDE:return this.node("include")(!1,!1,this.next().read_expr());case this.tok.T_INCLUDE_ONCE:return this.node("include")(!0,!1,this.next().read_expr());case this.tok.T_REQUIRE:return this.node("include")(!1,!0,this.next().read_expr());case this.tok.T_REQUIRE_ONCE:return this.node("include")(!0,!0,this.next().read_expr());case this.tok.T_EVAL:return t=this.node("eval"),this.next().expect("(")&&this.next(),e=this.read_expr(),this.expect(")")&&this.next(),t(e);case this.tok.T_INT_CAST:return this.read_expr_cast("int");case this.tok.T_DOUBLE_CAST:return this.read_expr_cast("float");case this.tok.T_STRING_CAST:return this.read_expr_cast(-1!==this.text().indexOf("binary")?"binary":"string");case this.tok.T_ARRAY_CAST:return this.read_expr_cast("array");case this.tok.T_OBJECT_CAST:return this.read_expr_cast("object");case this.tok.T_BOOL_CAST:return this.read_expr_cast("bool");case this.tok.T_UNSET_CAST:return this.read_expr_cast("unset");case this.tok.T_EXIT:var c="die"===this.lexer.yytext.toLowerCase();t=this.node("exit");var h=null;return"("===this.next().token&&(")"!==this.next().token?(h=this.read_expr(),this.expect(")")&&this.next()):this.next()),t(h,c);case this.tok.T_PRINT:return this.node("print")(this.next().read_expr());case this.tok.T_YIELD:var u=null,f=null;return t=this.node("yield"),this.next().is("EXPR")&&(u=this.read_expr(),this.token===this.tok.T_DOUBLE_ARROW&&(f=u,u=this.next().read_expr())),t(u,f);case this.tok.T_YIELD_FROM:return(t=this.node("yieldfrom"))(e=this.next().read_expr());case this.tok.T_FUNCTION:return this.read_function(!0);case this.tok.T_STATIC:var d=[this.token,this.lexer.getState()];if(this.next().token===this.tok.T_FUNCTION)return this.read_function(!0,[0,1,0]);this.lexer.tokens.push(d),this.next()}if(this.is("VARIABLE")){t=this.node();var p="identifier"===(e=this.read_variable(!1,!1,!1)).kind||"staticlookup"===e.kind&&"identifier"===e.offset.kind;switch(this.token){case"=":p&&this.error("VARIABLE");return t("assign",e,"&"==this.next().token?this.next().token===this.tok.T_NEW?this.read_new_expr():this.read_variable(!1,!1,!0):this.read_expr(),"=");case this.tok.T_PLUS_EQUAL:return p&&this.error("VARIABLE"),t("assign",e,this.next().read_expr(),"+=");case this.tok.T_MINUS_EQUAL:return p&&this.error("VARIABLE"),t("assign",e,this.next().read_expr(),"-=");case this.tok.T_MUL_EQUAL:return p&&this.error("VARIABLE"),t("assign",e,this.next().read_expr(),"*=");case this.tok.T_POW_EQUAL:return p&&this.error("VARIABLE"),t("assign",e,this.next().read_expr(),"**=");case this.tok.T_DIV_EQUAL:return p&&this.error("VARIABLE"),t("assign",e,this.next().read_expr(),"/=");case this.tok.T_CONCAT_EQUAL:return p&&this.error("VARIABLE"),t("assign",e,this.next().read_expr(),".=");case this.tok.T_MOD_EQUAL:return p&&this.error("VARIABLE"),t("assign",e,this.next().read_expr(),"%=");case this.tok.T_AND_EQUAL:return p&&this.error("VARIABLE"),t("assign",e,this.next().read_expr(),"&=");case this.tok.T_OR_EQUAL:return p&&this.error("VARIABLE"),t("assign",e,this.next().read_expr(),"|=");case this.tok.T_XOR_EQUAL:return p&&this.error("VARIABLE"),t("assign",e,this.next().read_expr(),"^=");case this.tok.T_SL_EQUAL:return p&&this.error("VARIABLE"),t("assign",e,this.next().read_expr(),"<<=");case this.tok.T_SR_EQUAL:return p&&this.error("VARIABLE"),t("assign",e,this.next().read_expr(),">>=");case this.tok.T_INC:return p&&this.error("VARIABLE"),this.next(),t("post","+",e);case this.tok.T_DEC:return p&&this.error("VARIABLE"),this.next(),t("post","-",e);default:t.destroy(e)}}else{if(this.is("SCALAR")){if(t=this.node(),"array"===(e=this.read_scalar()).kind&&e.shortForm&&"="===this.token){var m=this.node("list")(e.items,!0);return e.loc&&(m.loc=e.loc),t("assign",m,this.next().read_expr(),"=")}return t.destroy(e),this.handleDereferencable(e)}this.error("EXPR"),this.next()}return e},read_new_expr:function(){var t=this.node("new");this.expect(this.tok.T_NEW)&&this.next();var e=[];if(this.token===this.tok.T_CLASS){var i=this.node("class"),r=null,n=null,o=null;return"("===this.next().token&&(e=this.read_function_argument_list()),this.token==this.tok.T_EXTENDS&&(r=this.next().read_namespace_name()),this.token==this.tok.T_IMPLEMENTS&&(n=this.next().read_name_list()),this.expect("{")&&(o=this.next().read_class_body()),t(i(null,r,n,o,[0,0,0]),e)}var s=this.read_class_name_reference();return"("===this.token&&(e=this.read_function_argument_list()),t(s,e)},read_class_name_reference:function(){if(this.token===this.tok.T_NS_SEPARATOR||this.token===this.tok.T_STRING||this.token===this.tok.T_NAMESPACE){var t=this.read_namespace_name();return this.token===this.tok.T_DOUBLE_COLON&&(t=this.read_static_getter(t)),t}if(this.is("VARIABLE"))return this.read_variable(!0,!1,!1);this.expect([this.tok.T_STRING,"VARIABLE"])},handleDereferencable:function(t){for(;this.token!==this.EOF;)if(this.token===this.tok.T_OBJECT_OPERATOR||this.token===this.tok.T_DOUBLE_COLON)t=this.recursive_variable_chain_scan(t,!1,!1,!0);else if(this.token===this.tok.T_CURLY_OPEN||"["===this.token)t=this.read_dereferencable(t);else{if("("!==this.token)return t;t=this.node("call")(t,this.read_function_argument_list())}return t}}},function(t,e,i){"use strict";t.exports={is_reference:function(){return"&"==this.token&&(this.next(),!0)},is_variadic:function(){return this.token===this.tok.T_ELLIPSIS&&(this.next(),!0)},read_function:function(t,e){var i=this.read_function_declaration(t?1:e?2:0,e&&1===e[1]);return e&&1==e[2]?(i.parseFlags(e),this.expect(";")&&this.next()):(this.expect("{")&&(i.body=this.read_code_block(!1),i.loc&&i.body.loc&&(i.loc.end=i.body.loc.end)),!t&&e&&i.parseFlags(e)),i},read_function_declaration:function(t,e){var i="function";1===t?i="closure":2===t&&(i="method");var r=this.node(i);this.expect(this.tok.T_FUNCTION)&&this.next();var n=this.is_reference(),o=!1,s=[],a=null,l=!1;if(1!==t){var c=this.node("identifier");2===t?this.token===this.tok.T_STRING||this.php7&&this.is("IDENTIFIER")?(o=this.text(),this.next()):this.error("IDENTIFIER"):(this.expect(this.tok.T_STRING)&&(o=this.text()),this.next()),o=c(o)}this.expect("(")&&this.next();var h=this.read_parameter_list();return this.expect(")")&&this.next(),1===t&&this.token===this.tok.T_USE&&(this.next().expect("(")&&this.next(),s=this.read_list(this.read_lexical_var,","),this.expect(")")&&this.next()),":"===this.token&&("?"===this.next().token&&(l=!0,this.next()),a=this.read_type()),1===t?r(h,n,s,a,l,e):r(o,h,n,a,l)},read_lexical_var:function(){var t=this.node("variable"),e=!1;"&"===this.token&&(e=!0,this.next()),this.expect(this.tok.T_VARIABLE);var i=this.text().substring(1);return this.next(),t(i,e,!1)},read_parameter_list:function(){var t=[];if(")"!=this.token)for(;this.token!=this.EOF;){if(t.push(this.read_parameter()),","!=this.token){if(")"==this.token)break;this.error([",",")"]);break}this.next()}return t},read_parameter:function(){var t,e=this.node("parameter"),i=null,r=null,n=!1;"?"===this.token&&(this.next(),n=!0),t=this.read_type(),n&&!t&&this.raiseError("Expecting a type definition combined with nullable operator");var o=this.is_reference(),s=this.is_variadic();return this.expect(this.tok.T_VARIABLE)&&(i=this.text().substring(1),this.next()),"="==this.token&&(r=this.next().read_expr()),e(i,t,r,o,s,n)},read_function_argument_list:function(){var t=[],e=!1;if(this.expect("(")&&this.next(),")"!==this.token)for(;this.token!=this.EOF;){var i=this.read_argument_list();if(i&&(t.push(i),"variadic"===i.kind?e=!0:e&&this.raiseError("Unexpected argument after a variadic argument")),","!==this.token)break;this.next()}return this.expect(")")&&this.next(),t},read_argument_list:function(){return this.token===this.tok.T_ELLIPSIS?this.node("variadic")(this.next().read_expr()):this.read_expr()},read_type:function(){var t=this.node();if(this.token===this.tok.T_ARRAY||this.token===this.tok.T_CALLABLE){var e=this.text();return this.next(),t("typereference",e.toLowerCase(),e)}if(this.token!==this.tok.T_STRING)return this.token===this.tok.T_NAMESPACE||this.token===this.tok.T_NS_SEPARATOR?this.read_namespace_name():null;var i=this.text(),r=[this.token,this.lexer.getState()];return this.next(),this.token!==this.tok.T_NS_SEPARATOR&&-1<this.ast.typereference.types.indexOf(i.toLowerCase())?t("typereference",i.toLowerCase(),i):(this.lexer.tokens.push(r),this.next(),this.read_namespace_name())}}},function(t,e,i){"use strict";t.exports={read_if:function(){var t,e=this.node("if"),i=null,r=null,n=!1;if(t=this.next().read_if_expr(),":"===this.token){n=!0,this.next(),i=this.node("block");for(var o=[];this.token!==this.EOF&&this.token!==this.tok.T_ENDIF;){if(this.token===this.tok.T_ELSEIF){r=this.read_elseif_short();break}if(this.token===this.tok.T_ELSE){r=this.read_else_short();break}o.push(this.read_inner_statement())}i=i(null,o),this.expect(this.tok.T_ENDIF)&&this.next(),this.expectEndOfStatement()}else i=this.read_statement(),this.token===this.tok.T_ELSEIF?r=this.read_if():this.token===this.tok.T_ELSE&&(r=this.next().read_statement());return e(t,i,r,n)},read_if_expr:function(){this.expect("(")&&this.next();var t=this.read_expr();return this.expect(")")&&this.next(),t},read_elseif_short:function(){var t,e=this.node("if"),i=null,r=null,n=[];for(t=this.next().read_if_expr(),this.expect(":")&&this.next(),r=this.node("block");this.token!=this.EOF&&this.token!==this.tok.T_ENDIF;){if(this.token===this.tok.T_ELSEIF){i=this.read_elseif_short();break}if(this.token===this.tok.T_ELSE){i=this.read_else_short();break}n.push(this.read_inner_statement())}return e(t,r=r(null,n),i,!0)},read_else_short:function(){var t=this.node("block");this.next().expect(":")&&this.next();for(var e=[];this.token!=this.EOF&&this.token!==this.tok.T_ENDIF;)e.push(this.read_inner_statement());return t(null,e)}}},function(t,e,i){"use strict";t.exports={read_while:function(){var t=this.node("while");this.expect(this.tok.T_WHILE)&&this.next();var e,i=!1;return this.expect("(")&&this.next(),e=this.read_expr(),this.expect(")")&&this.next(),t(e,":"===this.token?(i=!0,this.read_short_form(this.tok.T_ENDWHILE)):this.read_statement(),i)},read_do:function(){var t=this.node("do");this.expect(this.tok.T_DO)&&this.next();var e,i=null;return e=this.read_statement(),this.expect(this.tok.T_WHILE)&&(this.next().expect("(")&&this.next(),i=this.read_expr(),this.expect(")")&&this.next(),this.expect(";")&&this.next()),t(i,e)},read_for:function(){var t=this.node("for");this.expect(this.tok.T_FOR)&&this.next();var e=[],i=[],r=[],n=!1;return this.expect("(")&&this.next(),";"!==this.token?(e=this.read_list(this.read_expr,","),this.expect(";")&&this.next()):this.next(),";"!==this.token?(i=this.read_list(this.read_expr,","),this.expect(";")&&this.next()):this.next(),")"!==this.token?(r=this.read_list(this.read_expr,","),this.expect(")")&&this.next()):this.next(),t(e,i,r,":"===this.token?(n=!0,this.read_short_form(this.tok.T_ENDFOR)):this.read_statement(),n)},read_foreach:function(){var t=this.node("foreach");this.expect(this.tok.T_FOREACH)&&this.next();var e,i=null,r=null,n=!1;return this.expect("(")&&this.next(),e=this.read_expr(),this.expect(this.tok.T_AS)&&(this.next(),r=this.read_foreach_variable(),this.token===this.tok.T_DOUBLE_ARROW&&(i=r,r=this.next().read_foreach_variable())),i&&"list"===i.kind&&this.raiseError("Fatal Error : Cannot use list as key element"),this.expect(")")&&this.next(),t(e,i,r,":"===this.token?(n=!0,this.read_short_form(this.tok.T_ENDFOREACH)):this.read_statement(),n)},read_foreach_variable:function(){if(this.token!==this.tok.T_LIST&&"["!==this.token)return this.read_variable(!1,!1,!1);var t="["===this.token,e=this.node("list");this.next(),!t&&this.expect("(")&&this.next();var i=this.read_array_pair_list(t);return this.expect(t?"]":")")&&this.next(),e(i,t)}}},function(t,e,i){"use strict";t.exports={read_start:function(){return this.token==this.tok.T_NAMESPACE?this.read_namespace():this.read_top_statement()}}},function(t,e,i){"use strict";t.exports={read_namespace:function(){var t=this.node("namespace"),e=void 0;if(this.expect(this.tok.T_NAMESPACE)&&this.next(),"{"==this.token)return this.currentNamespace=[""],e=this.next().read_top_statements(),this.expect("}")&&this.next(),t([""],e,!0);var i=this.read_namespace_name();return";"==this.token?(this.currentNamespace=i,e=this.next().read_top_statements(),this.expect(this.EOF),t(i.name,e,!1)):"{"==this.token?(this.currentNamespace=i,e=this.next().read_top_statements(),this.expect("}")&&this.next(),t(i.name,e,!0)):"("===this.token?(i.resolution=this.ast.reference.RELATIVE_NAME,i.name=i.name.substring(1),this.node("call")(i,this.read_function_argument_list())):(this.error(["{",";"]),this.currentNamespace=i,e=this.read_top_statements(),this.expect(this.EOF),t(i,e,!1))},read_namespace_name:function(){var t=this.node(),e=!1;this.token===this.tok.T_NAMESPACE&&(this.next().expect(this.tok.T_NS_SEPARATOR)&&this.next(),e=!0);var i=this.read_list(this.tok.T_STRING,this.tok.T_NS_SEPARATOR,!0);if(!e&&1===i.length){if("parent"===i[0].toLowerCase())return t("parentreference",i[0]);if("self"===i[0].toLowerCase())return t("selfreference",i[0])}return t("classreference",i,e)},read_use_statement:function(){var t=this.node("usegroup"),e=[],i=null;this.expect(this.tok.T_USE)&&this.next();var r=this.read_use_type();return e.push(this.read_use_declaration(!1)),","===this.token?e=e.concat(this.next().read_use_declarations(!1)):"{"===this.token&&(i=e[0].name,e=this.next().read_use_declarations(null===r),this.expect("}")&&this.next()),t=t(i,r,e),this.expect(";")&&this.next(),t},read_class_name_reference:function(){return this.read_variable(!0,!1,!1)},read_use_declaration:function(t){var e=this.node("useitem"),i=null;t&&(i=this.read_use_type());var r=this.read_namespace_name(),n=this.read_use_alias();return e(r.name,n,i)},read_use_declarations:function(t){for(var e=[this.read_use_declaration(t)];","===this.token;){if(this.next(),t){if(this.token!==this.tok.T_FUNCTION&&this.token!==this.tok.T_CONST&&this.token!==this.tok.T_STRING)break}else if(this.token!==this.tok.T_STRING)break;e.push(this.read_use_declaration(t))}return e},read_use_alias:function(){var t=null;return this.token===this.tok.T_AS&&this.next().expect(this.tok.T_STRING)&&(t=this.text(),this.next()),t},read_use_type:function(){return this.token===this.tok.T_FUNCTION?(this.next(),this.ast.useitem.TYPE_FUNCTION):this.token===this.tok.T_CONST?(this.next(),this.ast.useitem.TYPE_CONST):null}}},function(t,e,i){"use strict";var r={"\\r":"\r","\\n":"\n","\\t":"\t","\\v":String.fromCharCode(11),"\\e":String.fromCharCode(27),"\\f":String.fromCharCode(12),"\\\\":"\\","\\$":"$",'\\"':'"',"\\'":"'"};t.exports={resolve_special_chars:function(t,e){return e?t.replace(/\\[rntvef"'\\$]/g,function(t){return r[t]}):t.replace(/\\['\\]/g,function(t){return r[t]})},read_scalar:function(){if(this.is("T_MAGIC_CONST"))return this.get_magic_constant();var t=void 0,e=void 0;switch(this.token){case this.tok.T_CONSTANT_ENCAPSED_STRING:t=this.node("string");var i=this.text(),r=0;"b"!==i[0]&&"B"!==i[0]||(r=1);var n='"'===i[r];return this.next(),t=t(n,this.resolve_special_chars(i.substring(r+1,i.length-1),n),1===r,i),this.token===this.tok.T_DOUBLE_COLON?this.read_static_getter(t):t;case this.tok.T_START_HEREDOC:if("ST_NOWDOC"!==this.lexer.curCondition)return this.read_encapsed_string(this.tok.T_END_HEREDOC);var o=this.lexer.yylloc.first_offset;e=this.node("nowdoc");var s=(t=this.next().text())[t.length-1];"\n"===s?t="\r"===t[t.length-2]?t.substring(0,t.length-2):t.substring(0,t.length-1):"\r"===s&&(t=t.substring(0,t.length-1)),this.expect(this.tok.T_ENCAPSED_AND_WHITESPACE)&&this.next();var a=this.lexer._input.substring(o,this.lexer.yylloc.last_offset);return this.expect(this.tok.T_END_HEREDOC)&&this.next(),e=e(t,a,this.lexer.heredoc_label,'"'===a[3]||"'"===a[3]);case'"':return this.read_encapsed_string('"');case'b"':case'B"':return this.read_encapsed_string('"',!0);case this.tok.T_LNUMBER:case this.tok.T_DNUMBER:var l=this.node("number");return t=this.text(),this.next(),l(t,null);case this.tok.T_ARRAY:case"[":return this.read_array();default:var c=this.error("SCALAR");return this.next(),c}},read_dereferencable:function(t){var e=void 0,i=void 0,r=this.node("offsetlookup");return"["===this.token?(i=this.next().read_expr(),this.expect("]")&&this.next(),e=r(t,i)):this.token===this.tok.T_DOLLAR_OPEN_CURLY_BRACES&&(e=r(t,i=this.read_encapsed_string_item(!1))),e},read_encapsed_string_item:function(t){var e=this.node("encapsedpart"),i=!1,r=this.node(),n=void 0,o=void 0,s=void 0;if(this.token===this.tok.T_ENCAPSED_AND_WHITESPACE){var a=this.text();this.next(),r=r("string",!1,this.resolve_special_chars(a,t),!1,a)}else if(this.token===this.tok.T_DOLLAR_OPEN_CURLY_BRACES){if(s=null,this.next().token===this.tok.T_STRING_VARNAME){s=this.node("variable");var l=this.text();this.next(),s="["===this.token?(s=s(l,!1),o=this.node("offsetlookup"),n=this.next().read_expr(),this.expect("]")&&this.next(),o(s,n)):l}else s=this.read_expr();this.expect("}")&&this.next(),r=r("variable",s,!1,!0)}else if(this.token===this.tok.T_CURLY_OPEN)i=!0,r.destroy(),r=this.next().read_variable(!1,!1,!1),this.expect("}")&&this.next();else if(this.token===this.tok.T_VARIABLE){if(r.destroy(),r=this.read_simple_variable(!1),"["===this.token&&(o=this.node("offsetlookup"),n=this.next().read_encaps_var_offset(),this.expect("]")&&this.next(),r=o(r,n)),this.token===this.tok.T_OBJECT_OPERATOR){o=this.node("propertylookup"),this.next().expect(this.tok.T_STRING);var c=this.node("identifier");s=this.text(),this.next(),r=o(r,c(s))}}else{this.expect(this.tok.T_ENCAPSED_AND_WHITESPACE);var h=this.text();this.next(),r.destroy(),r=r("string",!1,h,!1,h)}return e(r,i)},read_encapsed_string:function(t){var e=1<arguments.length&&void 0!==arguments[1]&&arguments[1],i=this.node("encapsed");this.next();var r=this.lexer.yylloc.prev_offset-(e?1:0),n=[],o=null;for(o="`"===t?this.ast.encapsed.TYPE_SHELL:'"'===t?this.ast.encapsed.TYPE_STRING:this.ast.encapsed.TYPE_HEREDOC;this.token!==t&&this.token!==this.EOF;)n.push(this.read_encapsed_string_item(!0));return this.expect(t)&&this.next(),i=i(n,this.lexer._input.substring(r-1,this.lexer.yylloc.first_offset),o),t===this.tok.T_END_HEREDOC&&(i.label=this.lexer.heredoc_label),i},get_magic_constant:function(){var t=this.node("magic"),e=this.text();return this.next(),t(e.toUpperCase(),e)}}},function(t,e,i){"use strict";t.exports={read_top_statements:function(){for(var t=[];this.token!==this.EOF&&"}"!==this.token;){var e=this.read_top_statement();e&&(Array.isArray(e)?t=t.concat(e):t.push(e))}return t},read_top_statement:function(){switch(this.token){case this.tok.T_FUNCTION:return this.read_function(!1,!1);case this.tok.T_ABSTRACT:case this.tok.T_FINAL:case this.tok.T_CLASS:return this.read_class();case this.tok.T_INTERFACE:return this.read_interface();case this.tok.T_TRAIT:return this.read_trait();case this.tok.T_USE:return this.read_use_statement();case this.tok.T_CONST:var t=this.node("constantstatement"),e=this.next().read_const_list();return this.expectEndOfStatement(),t(null,e);case this.tok.T_NAMESPACE:return this.read_namespace();case this.tok.T_HALT_COMPILER:var i=this.node("halt");return this.next().expect("(")&&this.next(),this.expect(")")&&this.next(),this.expect(";"),this.lexer.done=!0,i(this.lexer._input.substring(this.lexer.offset));default:return this.read_statement()}},read_inner_statements:function(){for(var t=[];this.token!=this.EOF&&"}"!==this.token;){var e=this.read_inner_statement();e&&(Array.isArray(e)?t=t.concat(e):t.push(e))}return t},read_const_list:function(){return this.read_list(function(){this.expect(this.tok.T_STRING);var t=this.node("constant"),e=this.text();return this.next().expect("=")?t(e,this.next().read_expr()):t(e,null)},",",!1)},read_declare_list:function(){for(var t={};this.token!=this.EOF&&")"!==this.token;){this.expect(this.tok.T_STRING);var e=this.text().toLowerCase();if(this.next().expect("=")?t[e]=this.next().read_expr():t[e]=null,","!==this.token)break;this.next()}return t},read_inner_statement:function(){switch(this.token){case this.tok.T_FUNCTION:return this.read_function(!1,!1);case this.tok.T_ABSTRACT:case this.tok.T_FINAL:case this.tok.T_CLASS:return this.read_class();case this.tok.T_INTERFACE:return this.read_interface();case this.tok.T_TRAIT:return this.read_trait();case this.tok.T_HALT_COMPILER:this.raiseError("__HALT_COMPILER() can only be used from the outermost scope");var t=this.node("halt");return this.next().expect("(")&&this.next(),this.expect(")")&&this.next(),t=t(this.lexer._input.substring(this.lexer.offset)),this.expect(";")&&this.next(),t;default:return this.read_statement()}},read_statement:function(){switch(this.token){case"{":return this.read_code_block(!1);case this.tok.T_IF:return this.read_if();case this.tok.T_SWITCH:return this.read_switch();case this.tok.T_FOR:return this.read_for();case this.tok.T_FOREACH:return this.read_foreach();case this.tok.T_WHILE:return this.read_while();case this.tok.T_DO:return this.read_do();case this.tok.T_COMMENT:return this.read_comment();case this.tok.T_DOC_COMMENT:return this.read_doc_comment();case this.tok.T_RETURN:var t=this.node("return"),e=null;return this.next().is("EOS")||(e=this.read_expr()),this.expectEndOfStatement(),t(e);case this.tok.T_BREAK:case this.tok.T_CONTINUE:var i=this.node(this.token===this.tok.T_CONTINUE?"continue":"break"),r=null;return this.next(),";"!==this.token&&(r=this.read_expr()),this.expectEndOfStatement(),i(r);case this.tok.T_GLOBAL:var n=this.node("global"),o=this.next().read_list(this.read_simple_variable,",");return this.expectEndOfStatement(),n(o);case this.tok.T_STATIC:var s=[this.token,this.lexer.getState()],a=this.node();if(this.next().token===this.tok.T_DOUBLE_COLON){this.lexer.tokens.push(s);var l=this.next().read_expr();return this.expectEndOfStatement(l),a("expressionstatement",l)}if(this.token===this.tok.T_FUNCTION)return this.read_function(!0,[0,1,0]);var c=this.read_variable_declarations();return this.expectEndOfStatement(),a("static",c);case this.tok.T_ECHO:var h=this.node("echo"),u=this.text(),f="<?="===u||"<%="===u,d=this.next().read_list(this.read_expr,",");return this.expectEndOfStatement(),h(d,f);case this.tok.T_INLINE_HTML:var p=this.text(),m=0<this.lexer.yylloc.first_offset?this.lexer._input[this.lexer.yylloc.first_offset-1]:null,g="\r"===m||"\n"===m;g&&"\n"===m&&1<this.lexer.yylloc.first_offset&&"\r"===this.lexer._input[this.lexer.yylloc.first_offset-2]&&(m="\r\n");var _=this.node("inline");return this.next(),_(p,g?m+p:p);case this.tok.T_UNSET:var v=this.node("unset");this.next().expect("(")&&this.next();var y=this.read_list(this.read_variable,",");return this.expect(")")&&this.next(),this.expect(";")&&this.next(),v(y);case this.tok.T_DECLARE:var x=this.node("declare"),T=[],k=void 0;this.next().expect("(")&&this.next();var b=this.read_declare_list();if(this.expect(")")&&this.next(),":"===this.token){for(this.next();this.token!=this.EOF&&this.token!==this.tok.T_ENDDECLARE;)T.push(this.read_top_statement());this.expect(this.tok.T_ENDDECLARE)&&this.next(),this.expectEndOfStatement(),k=this.ast.declare.MODE_SHORT}else if("{"===this.token){for(this.next();this.token!=this.EOF&&"}"!==this.token;)T.push(this.read_top_statement());this.expect("}")&&this.next(),k=this.ast.declare.MODE_BLOCK}else this.expect(";")&&this.next(),k=this.ast.declare.MODE_NONE;return x(b,T,k);case this.tok.T_TRY:return this.read_try();case this.tok.T_THROW:var w=this.node("throw"),E=this.next().read_expr();return this.expectEndOfStatement(),w(E);case";":return this.next(),null;case this.tok.T_STRING:var C=this.node(),S=[this.token,this.lexer.getState()],A=this.text();if(":"===this.next().token)return this.next(),C("label",A);this.lexer.tokens.push(S);var L=this.next().read_expr();return this.expectEndOfStatement(),L;case this.tok.T_GOTO:var N=this.node("goto"),O=null;return this.next().expect(this.tok.T_STRING)&&(O=this.text(),this.next().expectEndOfStatement()),N(O);default:var I=this.node("expressionstatement"),R=this.read_expr();return this.expectEndOfStatement(R),I(R)}},read_code_block:function(t){var e=this.node("block");this.expect("{")&&this.next();var i=t?this.read_top_statements():this.read_inner_statements();return this.expect("}")&&this.next(),e(null,i)}}},function(t,e,i){"use strict";t.exports={read_switch:function(){var t=this.node("switch");this.expect(this.tok.T_SWITCH)&&this.next(),this.expect("(")&&this.next();var e=this.read_expr();this.expect(")")&&this.next();var i=":"===this.token;return t(e,this.read_switch_case_list(),i)},read_switch_case_list:function(){var t=null,e=this.node("block"),i=[];for("{"===this.token?t="}":":"===this.token?t=this.tok.T_ENDSWITCH:this.expect(["{",":"]),";"===this.next().token&&this.next();this.token!==this.EOF&&this.token!==t;)i.push(this.read_case_list(t));return this.expect(t)&&this.next(),t===this.tok.T_ENDSWITCH&&this.expectEndOfStatement(),e(null,i)},read_case_list:function(t){var e=this.node("case"),i=null,r=null,n=[];for(this.token===this.tok.T_CASE?i=this.next().read_expr():this.token===this.tok.T_DEFAULT?this.next():this.expect([this.tok.T_CASE,this.tok.T_DEFAULT]),this.expect([":",";"])&&this.next(),r=this.node("block");this.token!=this.EOF&&this.token!==t&&this.token!==this.tok.T_CASE&&this.token!==this.tok.T_DEFAULT;)n.push(this.read_inner_statement());return e(i,0<n.length?r(null,n):null)}}},function(t,e,i){"use strict";t.exports={read_try:function(){this.expect(this.tok.T_TRY);for(var t=this.node("try"),e=null,i=[],r=this.next().read_statement();this.token===this.tok.T_CATCH;){var n=this.node("catch");this.next().expect("(")&&this.next();var o=this.read_list(this.read_namespace_name,"|",!1),s=this.read_variable(!0,!1,!1);this.expect(")"),i.push(n(this.next().read_statement(),o,s))}return this.token===this.tok.T_FINALLY&&(e=this.next().read_statement()),t(r,i,e)}}},function(t,e,i){"use strict";t.exports={read_short_form:function(t){var e=this.node("block"),i=[];for(this.expect(":")&&this.next();this.token!=this.EOF&&this.token!==t;)i.push(this.read_inner_statement());return this.expect(t)&&this.next(),this.expectEndOfStatement(),e(null,i)},read_list:function(t,e,i){var r=[];if(this.token==e&&(i&&r.push(null),this.next()),"function"==typeof t){do{if(r.push(t.apply(this,[])),this.token!=e)break}while(this.next().token!=this.EOF)}else{if(!this.expect(t))return[];for(r.push(this.text());this.next().token!=this.EOF&&this.token==e&&this.next().token==t;)r.push(this.text())}return r},read_name_list:function(){return this.read_list(this.read_namespace_name,",",!1)},read_variable_declarations:function(){return this.read_list(function(){var t=this.node("assign"),e=this.node("variable");if(this.expect(this.tok.T_VARIABLE)){var i=this.text().substring(1);this.next(),e=e(i,!1,!1)}else e=e("#ERR",!1,!1);return"="===this.token?t(e,this.next().read_expr()):e},",")}}},function(t,e,i){"use strict";t.exports={read_variable:function(t,e,i){var r=void 0;if(i||"&"!==this.token||(i=!0,this.next()),this.is([this.tok.T_VARIABLE,"$"]))r=this.read_reference_variable(e,i);else if(this.is([this.tok.T_NS_SEPARATOR,this.tok.T_STRING,this.tok.T_NAMESPACE])){r=this.node();var n=this.read_namespace_name();if(this.token!=this.tok.T_DOUBLE_COLON&&"("!=this.token&&-1===["parentreference","selfreference"].indexOf(n.kind)){var o=n.name.toLowerCase();r="true"===o?r("boolean",!0,n.name):"false"===o?r("boolean",!1,n.name):r("identifier",n)}else r=n}else if(this.token===this.tok.T_STATIC){r=this.node("staticreference");var s=this.text();this.next(),r=r(s)}else this.expect("VARIABLE");return this.token===this.tok.T_DOUBLE_COLON&&(r=this.read_static_getter(r,e)),this.recursive_variable_chain_scan(r,t,e)},read_static_getter:function(t,e){var i=this.node("staticlookup"),r=void 0,n=void 0;return this.next().is([this.tok.T_VARIABLE,"$"])?r=this.read_reference_variable(e,!1):this.token===this.tok.T_STRING||this.token===this.tok.T_CLASS||this.php7&&this.is("IDENTIFIER")?(r=this.node("identifier"),n=this.text(),this.next(),r=r(n)):"{"===this.token?(r=this.next().read_expr(),this.expect("}")&&this.next(),this.expect("(")):(this.error([this.tok.T_VARIABLE,this.tok.T_STRING]),r=this.node("identifier"),n=this.text(),this.next(),r=r(n)),i(t,r)},read_what:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],e=null,i=null;switch(this.next().token){case this.tok.T_STRING:if(e=this.node("identifier"),i=this.text(),this.next(),e=e(i),t&&this.token===this.tok.T_OBJECT_OPERATOR&&this.error(),this.token===this.tok.T_VARIABLE){var r=this.node("variable");i=this.text().substring(1),this.next(),(e=this.node("encapsed")([e,r(i,!1,!1)],null,"offset")).loc&&e.value[0].loc&&(e.loc.start=e.value[0].loc.start)}else if("{"===this.token){var n=this.next().read_expr();this.expect("}")&&this.next(),(e=this.node("encapsed")([e,n],null,"offset")).loc&&e.value[0].loc&&(e.loc.start=e.value[0].loc.start)}break;case this.tok.T_VARIABLE:e=this.node("variable"),i=this.text().substring(1),this.next(),e=e(i,!1,!1);break;case"$":this.next().expect(["{",this.tok.T_VARIABLE]),"{"===this.token?(e=this.next().read_expr(),this.expect("}")&&this.next()):e=this.read_expr();break;case"{":e=this.next().read_expr(),this.expect("}")&&this.next();break;default:this.error([this.tok.T_STRING,this.tok.T_VARIABLE,"$","{"]),e=this.node("identifier"),i=this.text(),this.next(),e=e(i)}return e},recursive_variable_chain_scan:function(t,e,i,r){var n=void 0,o=void 0;t:for(;this.token!=this.EOF;)switch(this.token){case"(":if(e)return t;t=this.node("call")(t,this.read_function_argument_list());break;case"[":n=this.node("offsetlookup"),this.next(),o=!1,i?(o=this.read_encaps_var_offset(),this.expect("]")&&this.next()):"]"!==this.token?(o=this.read_expr(),this.expect("]")&&this.next()):this.next(),t=n(t,o);break;case this.tok.T_DOUBLE_COLON:"staticlookup"===t.kind&&"identifier"===t.offset.kind&&this.error(),t=(n=this.node("staticlookup"))(t,this.read_what(!0)),r&&"("!==this.token&&this.error("(");break;case this.tok.T_OBJECT_OPERATOR:t=(n=this.node("propertylookup"))(t,this.read_what());break;default:break t}return t},read_encaps_var_offset:function(){var t=this.node();if(this.token===this.tok.T_STRING){var e=this.text();this.next(),t=t("identifier",e)}else if(this.token===this.tok.T_NUM_STRING){var i=this.text();this.next(),t=t("number",i,null)}else if(this.token===this.tok.T_VARIABLE){var r=this.text().substring(1);this.next(),t=t("variable",r,!1,!1)}else{this.expect([this.tok.T_STRING,this.tok.T_NUM_STRING,this.tok.T_VARIABLE]);var n=this.text();this.next(),t=t("identifier",n)}return t},read_reference_variable:function(t,e){for(var i=this.read_simple_variable(e),r=void 0;this.token!=this.EOF;){var n=this.node();if("["==this.token)r=null,r=t?this.next().read_encaps_var_offset():"]"===this.next().token?null:this.read_dim_offset(),this.expect("]")&&this.next(),i=n("offsetlookup",i,r);else{if("{"!=this.token||t){n.destroy();break}r=this.next().read_expr(),this.expect("}")&&this.next(),i=n("offsetlookup",i,r)}}return i},read_simple_variable:function(t){var e=this.node("variable"),i=void 0;if(this.expect([this.tok.T_VARIABLE,"$"])&&this.token===this.tok.T_VARIABLE)i=this.text().substring(1),this.next(),e=e(i,t,!1);else switch("$"===this.token&&this.next(),this.token){case"{":var r=this.next().read_expr();this.expect("}")&&this.next(),e=e(r,t,!0);break;case"$":e=e(this.read_simple_variable(!1),t);break;case this.tok.T_VARIABLE:i=this.text().substring(1);var n=this.node("variable");this.next(),e=e(n(i,!1,!1),t,!1);break;default:this.error(["{","$",this.tok.T_VARIABLE]),i=this.text(),this.next(),e=e(i,t,!1)}return e}}},function(t,e,i){"use strict";t.exports={values:{101:"T_HALT_COMPILER",102:"T_USE",103:"T_ENCAPSED_AND_WHITESPACE",104:"T_OBJECT_OPERATOR",105:"T_STRING",106:"T_DOLLAR_OPEN_CURLY_BRACES",107:"T_STRING_VARNAME",108:"T_CURLY_OPEN",109:"T_NUM_STRING",110:"T_ISSET",111:"T_EMPTY",112:"T_INCLUDE",113:"T_INCLUDE_ONCE",114:"T_EVAL",115:"T_REQUIRE",116:"T_REQUIRE_ONCE",117:"T_NAMESPACE",118:"T_NS_SEPARATOR",119:"T_AS",120:"T_IF",121:"T_ENDIF",122:"T_WHILE",123:"T_DO",124:"T_FOR",125:"T_SWITCH",126:"T_BREAK",127:"T_CONTINUE",128:"T_RETURN",129:"T_GLOBAL",130:"T_STATIC",131:"T_ECHO",132:"T_INLINE_HTML",133:"T_UNSET",134:"T_FOREACH",135:"T_DECLARE",136:"T_TRY",137:"T_THROW",138:"T_GOTO",139:"T_FINALLY",140:"T_CATCH",141:"T_ENDDECLARE",142:"T_LIST",143:"T_CLONE",144:"T_PLUS_EQUAL",145:"T_MINUS_EQUAL",146:"T_MUL_EQUAL",147:"T_DIV_EQUAL",148:"T_CONCAT_EQUAL",149:"T_MOD_EQUAL",150:"T_AND_EQUAL",151:"T_OR_EQUAL",152:"T_XOR_EQUAL",153:"T_SL_EQUAL",154:"T_SR_EQUAL",155:"T_INC",156:"T_DEC",157:"T_BOOLEAN_OR",158:"T_BOOLEAN_AND",159:"T_LOGICAL_OR",160:"T_LOGICAL_AND",161:"T_LOGICAL_XOR",162:"T_SL",163:"T_SR",164:"T_IS_IDENTICAL",165:"T_IS_NOT_IDENTICAL",166:"T_IS_EQUAL",167:"T_IS_NOT_EQUAL",168:"T_IS_SMALLER_OR_EQUAL",169:"T_IS_GREATER_OR_EQUAL",170:"T_INSTANCEOF",171:"T_INT_CAST",172:"T_DOUBLE_CAST",173:"T_STRING_CAST",174:"T_ARRAY_CAST",175:"T_OBJECT_CAST",176:"T_BOOL_CAST",177:"T_UNSET_CAST",178:"T_EXIT",179:"T_PRINT",180:"T_YIELD",181:"T_YIELD_FROM",182:"T_FUNCTION",183:"T_DOUBLE_ARROW",184:"T_DOUBLE_COLON",185:"T_ARRAY",186:"T_CALLABLE",187:"T_CLASS",188:"T_ABSTRACT",189:"T_TRAIT",190:"T_FINAL",191:"T_EXTENDS",192:"T_INTERFACE",193:"T_IMPLEMENTS",194:"T_VAR",195:"T_PUBLIC",196:"T_PROTECTED",197:"T_PRIVATE",198:"T_CONST",199:"T_NEW",200:"T_INSTEADOF",201:"T_ELSEIF",202:"T_ELSE",203:"T_ENDSWITCH",204:"T_CASE",205:"T_DEFAULT",206:"T_ENDFOR",207:"T_ENDFOREACH",208:"T_ENDWHILE",209:"T_CONSTANT_ENCAPSED_STRING",210:"T_LNUMBER",211:"T_DNUMBER",212:"T_LINE",213:"T_FILE",214:"T_DIR",215:"T_TRAIT_C",216:"T_METHOD_C",217:"T_FUNC_C",218:"T_NS_C",219:"T_START_HEREDOC",220:"T_END_HEREDOC",221:"T_CLASS_C",222:"T_VARIABLE",223:"T_OPEN_TAG",224:"T_OPEN_TAG_WITH_ECHO",225:"T_CLOSE_TAG",226:"T_WHITESPACE",227:"T_COMMENT",228:"T_DOC_COMMENT",229:"T_ELLIPSIS",230:"T_COALESCE",231:"T_POW",232:"T_POW_EQUAL",233:"T_SPACESHIP"},names:{T_HALT_COMPILER:101,T_USE:102,T_ENCAPSED_AND_WHITESPACE:103,T_OBJECT_OPERATOR:104,T_STRING:105,T_DOLLAR_OPEN_CURLY_BRACES:106,T_STRING_VARNAME:107,T_CURLY_OPEN:108,T_NUM_STRING:109,T_ISSET:110,T_EMPTY:111,T_INCLUDE:112,T_INCLUDE_ONCE:113,T_EVAL:114,T_REQUIRE:115,T_REQUIRE_ONCE:116,T_NAMESPACE:117,T_NS_SEPARATOR:118,T_AS:119,T_IF:120,T_ENDIF:121,T_WHILE:122,T_DO:123,T_FOR:124,T_SWITCH:125,T_BREAK:126,T_CONTINUE:127,T_RETURN:128,T_GLOBAL:129,T_STATIC:130,T_ECHO:131,T_INLINE_HTML:132,T_UNSET:133,T_FOREACH:134,T_DECLARE:135,T_TRY:136,T_THROW:137,T_GOTO:138,T_FINALLY:139,T_CATCH:140,T_ENDDECLARE:141,T_LIST:142,T_CLONE:143,T_PLUS_EQUAL:144,T_MINUS_EQUAL:145,T_MUL_EQUAL:146,T_DIV_EQUAL:147,T_CONCAT_EQUAL:148,T_MOD_EQUAL:149,T_AND_EQUAL:150,T_OR_EQUAL:151,T_XOR_EQUAL:152,T_SL_EQUAL:153,T_SR_EQUAL:154,T_INC:155,T_DEC:156,T_BOOLEAN_OR:157,T_BOOLEAN_AND:158,T_LOGICAL_OR:159,T_LOGICAL_AND:160,T_LOGICAL_XOR:161,T_SL:162,T_SR:163,T_IS_IDENTICAL:164,T_IS_NOT_IDENTICAL:165,T_IS_EQUAL:166,T_IS_NOT_EQUAL:167,T_IS_SMALLER_OR_EQUAL:168,T_IS_GREATER_OR_EQUAL:169,T_INSTANCEOF:170,T_INT_CAST:171,T_DOUBLE_CAST:172,T_STRING_CAST:173,T_ARRAY_CAST:174,T_OBJECT_CAST:175,T_BOOL_CAST:176,T_UNSET_CAST:177,T_EXIT:178,T_PRINT:179,T_YIELD:180,T_YIELD_FROM:181,T_FUNCTION:182,T_DOUBLE_ARROW:183,T_DOUBLE_COLON:184,T_ARRAY:185,T_CALLABLE:186,T_CLASS:187,T_ABSTRACT:188,T_TRAIT:189,T_FINAL:190,T_EXTENDS:191,T_INTERFACE:192,T_IMPLEMENTS:193,T_VAR:194,T_PUBLIC:195,T_PROTECTED:196,T_PRIVATE:197,T_CONST:198,T_NEW:199,T_INSTEADOF:200,T_ELSEIF:201,T_ELSE:202,T_ENDSWITCH:203,T_CASE:204,T_DEFAULT:205,T_ENDFOR:206,T_ENDFOREACH:207,T_ENDWHILE:208,T_CONSTANT_ENCAPSED_STRING:209,T_LNUMBER:210,T_DNUMBER:211,T_LINE:212,T_FILE:213,T_DIR:214,T_TRAIT_C:215,T_METHOD_C:216,T_FUNC_C:217,T_NS_C:218,T_START_HEREDOC:219,T_END_HEREDOC:220,T_CLASS_C:221,T_VARIABLE:222,T_OPEN_TAG:223,T_OPEN_TAG_WITH_ECHO:224,T_CLOSE_TAG:225,T_WHITESPACE:226,T_COMMENT:227,T_DOC_COMMENT:228,T_ELLIPSIS:229,T_COALESCE:230,T_POW:231,T_POW_EQUAL:232,T_SPACESHIP:233}}},function(t,e,i){"use strict";var u=i(46),f=i(47),n=function(t,e){this.withPositions=t,this.withSource=e};n.prototype.position=function(t){return new f(t.lexer.yylloc.first_line,t.lexer.yylloc.first_column,t.lexer.yylloc.first_offset)},n.precedence={},[["or"],["xor"],["and"],["="],["?"],["??"],["||"],["&&"],["|"],["^"],["&"],["==","!=","===","!==","<=>"],["<","<=",">",">="],["<<",">>"],["+","-","."],["*","/","%"],["!"],["instanceof"]].forEach(function(t,e){t.forEach(function(t){n.precedence[t]=e+1})}),n.prototype.resolvePrecedence=function(t){var e=void 0,i=void 0,r=void 0;return"bin"===t.kind?t.right&&!t.right.parenthesizedExpression&&("bin"===t.right.kind?(i=n.precedence[t.type],r=n.precedence[t.right.type],i&&r&&r<=i&&(e=t.right,t.right=t.right.left,e.left=this.resolvePrecedence(t),t=e)):"retif"===t.right.kind&&(i=n.precedence[t.type],r=n.precedence["?"],i&&r&&r<=i&&(e=t.right,t.right=t.right.test,e.test=this.resolvePrecedence(t),t=e))):"unary"===t.kind?t.what&&!t.what.parenthesizedExpression&&("bin"===t.what.kind?(e=t.what,t.what=t.what.left,e.left=this.resolvePrecedence(t),t=e):"retif"===t.what.kind&&(e=t.what,t.what=t.what.test,e.test=this.resolvePrecedence(t),t=e)):"retif"===t.kind?t.falseExpr&&"retif"===t.falseExpr.kind&&!t.falseExpr.parenthesizedExpression&&(e=t.falseExpr,t.falseExpr=e.test,e.test=this.resolvePrecedence(t),t=e):"assign"===t.kind&&t.right&&"bin"===t.right.kind&&!t.right.parenthesizedExpression&&(i=n.precedence["="],r=n.precedence[t.right.type],i&&r&&r<i&&(e=t.right,t.right=t.right.left,e.left=t,t=e)),t},n.prototype.prepare=function(s,a,l){var c=null;(this.withPositions||this.withSource)&&(c=this.position(l));var h=this,e=function t(){var e=null,i=Array.prototype.slice.call(arguments);if(i.push(a),"function"==typeof t.preBuild&&t.preBuild(arguments),h.withPositions||h.withSource){var r=null;h.withSource&&(r=l.lexer._input.substring(c.offset,l.prev[2])),e=h.withPositions?new u(r,c,new f(l.prev[0],l.prev[1],l.prev[2])):new u(r,null,null),i.push(e)}s||(s=i.shift());var n=h[s];if("function"!=typeof n)throw new Error('Undefined node "'+s+'"');var o=Object.create(n.prototype);return n.apply(o,i),t.instance=o,t.trailingComments&&(o.trailingComments=t.trailingComments),h.resolvePrecedence(o)};return e.setKind=function(t){s=t},e.setTrailingComments=function(t){e.instance?e.instance.setTrailingComments(t):e.trailingComments=t},e.destroy=function(t){a&&(t?t.leadingComments?t.leadingComments=a.concat(t.leadingComments):t.leadingComments=a:l._docIndex=l._docs.length-a.length)},e},[i(48),i(49),i(50),i(7),i(51),i(52),i(53),i(54),i(55),i(56),i(57),i(58),i(59),i(60),i(61),i(9),i(62),i(63),i(64),i(10),i(65),i(4),i(66),i(67),i(68),i(69),i(70),i(71),i(72),i(73),i(74),i(75),i(1),i(76),i(77),i(78),i(11),i(79),i(80),i(81),i(82),i(83),i(84),i(85),i(86),i(87),i(88),i(89),i(3),i(8),i(90),i(91),i(92),i(93),i(2),i(94),i(95),i(96),i(5),i(97),i(98),i(99),i(100),i(101),i(102),i(103),i(104),i(6),i(105),i(106),i(107),i(108),i(0),i(109),i(110),i(111),i(112),i(113),i(114),i(115),i(116),i(117),i(118),i(119),i(120),i(121),i(122),i(123),i(124),i(125),i(126),i(127),i(128),i(129)].forEach(function(t){n.prototype[t.kind]=t}),t.exports=n},function(t,e,i){"use strict";t.exports=function(t,e,i){this.source=t,this.start=e,this.end=i}},function(t,e,i){"use strict";t.exports=function(t,e,i){this.line=t,this.column=e,this.offset=i}},function(t,e,i){"use strict";var n=i(1);t.exports=n.extends("array",function(t,e,i,r){n.apply(this,["array",i,r]),this.items=e,this.shortForm=t})},function(t,e,i){"use strict";var o=i(1);t.exports=o.extends("assign",function(t,e,i,r,n){o.apply(this,["assign",r,n]),this.operator=i,this.left=t,this.right=e})},function(t,e,i){"use strict";var o=i(5);t.exports=o.extends("bin",function(t,e,i,r,n){o.apply(this,["bin",r,n]),this.type=t,this.left=e,this.right=i})},function(t,e,i){"use strict";var n=i(3);t.exports=n.extends("boolean",function(t,e,i,r){n.apply(this,["boolean",t,e,i,r])})},function(t,e,i){"use strict";var r=i(0);t.exports=r.extends("break",function(t,e,i){r.apply(this,["break",e,i]),this.level=t})},function(t,e,i){"use strict";var n=i(1);t.exports=n.extends("call",function(t,e,i,r){n.apply(this,["call",i,r]),this.what=t,this.arguments=e})},function(t,e,i){"use strict";var n=i(0);t.exports=n.extends("case",function(t,e,i,r){n.apply(this,["case",i,r]),this.test=t,this.body=e})},function(t,e,i){"use strict";var o=i(5);t.exports=o.extends("cast",function(t,e,i,r,n){o.apply(this,["cast",r,n]),this.type=t,this.raw=e,this.what=i})},function(t,e,i){"use strict";var o=i(0);t.exports=o.extends("catch",function(t,e,i,r,n){o.apply(this,["catch",r,n]),this.body=t,this.what=e,this.variable=i})},function(t,e,i){"use strict";var a=i(4);t.exports=a.extends("class",function(t,e,i,r,n,o,s){a.apply(this,["class",t,o,s]),this.isAnonymous=!t,this.extends=e,this.implements=i,this.body=r,this.parseFlags(n)})},function(t,e,i){"use strict";var o=i(10),s="classconstant",r=o.extends(s,function(t,e,i,r,n){o.apply(this,[t||s,e,r,n]),this.parseFlags(i)});r.prototype.parseFlags=function(t){-1===t[0]?this.visibility="":null===t[0]?this.visibility=null:0===t[0]?this.visibility="public":1===t[0]?this.visibility="protected":2===t[0]&&(this.visibility="private")},t.exports=r},function(t,e,i){"use strict";var o=i(6),s="classreference",r=o.extends(s,function t(e,i,r,n){o.apply(this,[s,r,n]),i?this.resolution=t.RELATIVE_NAME:1===e.length?this.resolution=t.UNQUALIFIED_NAME:""===e[0]?this.resolution=t.FULL_QUALIFIED_NAME:this.resolution=t.QUALIFIED_NAME,this.name=e.join("\\")});r.UNQUALIFIED_NAME="uqn",r.QUALIFIED_NAME="qn",r.FULL_QUALIFIED_NAME="fqn",r.RELATIVE_NAME="rn",t.exports=r},function(t,e,i){"use strict";var r=i(1);t.exports=r.extends("clone",function(t,e,i){r.apply(this,["clone",e,i]),this.what=t})},function(t,e,i){"use strict";var l=i(0);t.exports=l.extends("closure",function(t,e,i,r,n,o,s,a){l.apply(this,["closure",s,a]),this.uses=i,this.arguments=t,this.byref=e,this.type=r,this.nullable=n,this.isStatic=o||!1,this.body=null})},function(t,e,i){"use strict";var r=i(9),n="commentblock";t.exports=r.extends(n,function(t,e,i){r.apply(this,[n,t,e,i])})},function(t,e,i){"use strict";var r=i(9),n="commentline";t.exports=r.extends(n,function(t,e,i){r.apply(this,[n,t,e,i])})},function(t,e,i){"use strict";var n=i(2);t.exports=n.extends("constant",function(t,e,i,r){n.apply(this,["constant",i,r]),this.name=t,this.value=e})},function(t,e,i){"use strict";var r=i(0);t.exports=r.extends("continue",function(t,e,i){r.apply(this,["continue",e,i]),this.level=t})},function(t,e,i){"use strict";var o=i(7),r=o.extends("declare",function(t,e,i,r,n){o.apply(this,["declare",e,r,n]),this.what=t,this.mode=i});r.MODE_SHORT="short",r.MODE_BLOCK="block",r.MODE_NONE="none",t.exports=r},function(t,e,i){"use strict";var n=i(0);t.exports=n.extends("do",function(t,e,i,r){n.apply(this,["do",i,r]),this.test=t,this.body=e})},function(t,e,i){"use strict";var n=i(0);t.exports=n.extends("echo",function(t,e,i,r){n.apply(this,["echo",i,r]),this.shortForm=e,this.expressions=t})},function(t,e,i){"use strict";var r=i(1);t.exports=r.extends("empty",function(t,e,i){r.apply(this,["empty",e,i]),this.expression=t})},function(t,e,i){"use strict";var o=i(3),r=o.extends("encapsed",function(t,e,i,r,n){o.apply(this,["encapsed",t,e,r,n]),this.type=i});r.TYPE_STRING="string",r.TYPE_SHELL="shell",r.TYPE_HEREDOC="heredoc",r.TYPE_OFFSET="offset",t.exports=r},function(t,e,i){"use strict";var n=i(1),o="encapsedpart";t.exports=n.extends(o,function(t,e,i,r){n.apply(this,[o,i,r]),this.expression=t,this.curly=e})},function(t,e,i){"use strict";var n=i(2);t.exports=n.extends("entry",function(t,e,i,r){n.apply(this,["entry",i,r]),this.key=t,this.value=e})},function(t,e,i){"use strict";var s=i(2);t.exports=s.extends("error",function(t,e,i,r,n,o){s.apply(this,["error",n,o]),this.message=t,this.token=e,this.line=i,this.expected=r})},function(t,e,i){"use strict";var r=i(1);t.exports=r.extends("eval",function(t,e,i){r.apply(this,["eval",e,i]),this.source=t})},function(t,e,i){"use strict";var n=i(1);t.exports=n.extends("exit",function(t,e,i,r){n.apply(this,["exit",i,r]),this.status=t,this.useDie=e})},function(t,e,i){"use strict";var r=i(0),n="expressionstatement";t.exports=r.extends(n,function(t,e,i){r.apply(this,[n,e,i]),this.expression=t})},function(t,e,i){"use strict";var a=i(0);t.exports=a.extends("for",function(t,e,i,r,n,o,s){a.apply(this,["for",o,s]),this.init=t,this.test=e,this.increment=i,this.shortForm=n,this.body=r})},function(t,e,i){"use strict";var a=i(0);t.exports=a.extends("foreach",function(t,e,i,r,n,o,s){a.apply(this,["foreach",o,s]),this.source=t,this.key=e,this.value=i,this.shortForm=n,this.body=r})},function(t,e,i){"use strict";var r=i(0);t.exports=r.extends("global",function(t,e,i){r.apply(this,["global",e,i]),this.items=t})},function(t,e,i){"use strict";var r=i(0);t.exports=r.extends("goto",function(t,e,i){r.apply(this,["goto",e,i]),this.label=t})},function(t,e,i){"use strict";var r=i(0);t.exports=r.extends("halt",function(t,e,i){r.apply(this,["halt",e,i]),this.after=t})},function(t,e,i){"use strict";var r=i(2),n="identifier",o=r.extends(n,function(t,e,i){r.apply(this,[n,e,i]),this.name=t});t.exports=o},function(t,e,i){"use strict";var s=i(0);t.exports=s.extends("if",function(t,e,i,r,n,o){s.apply(this,["if",n,o]),this.test=t,this.body=e,this.alternate=i,this.shortForm=r})},function(t,e,i){"use strict";var o=i(1);t.exports=o.extends("include",function(t,e,i,r,n){o.apply(this,["include",r,n]),this.once=t,this.require=e,this.target=i})},function(t,e,i){"use strict";var n=i(3);t.exports=n.extends("inline",function(t,e,i,r){n.apply(this,["inline",t,e,i,r])})},function(t,e,i){"use strict";var o=i(4);t.exports=o.extends("interface",function(t,e,i,r,n){o.apply(this,["interface",t,r,n]),this.extends=e,this.body=i})},function(t,e,i){"use strict";var r=i(1);t.exports=r.extends("isset",function(t,e,i){r.apply(this,["isset",e,i]),this.variables=t})},function(t,e,i){"use strict";var r=i(0);t.exports=r.extends("label",function(t,e,i){r.apply(this,["label",e,i]),this.name=t})},function(t,e,i){"use strict";var n=i(1);t.exports=n.extends("list",function(t,e,i,r){n.apply(this,["list",i,r]),this.items=t,this.shortForm=e})},function(t,e,i){"use strict";var n=i(3);t.exports=n.extends("magic",function(t,e,i,r){n.apply(this,["magic",t,e,i,r])})},function(t,e,i){"use strict";var r=i(11);t.exports=r.extends("method",function(){r.apply(this,arguments),this.kind="method"})},function(t,e,i){"use strict";var o=i(7);t.exports=o.extends("namespace",function(t,e,i,r,n){o.apply(this,["namespace",e,r,n]),this.name=t,this.withBrackets=i||!1})},function(t,e,i){"use strict";var n=i(1);t.exports=n.extends("new",function(t,e,i,r){n.apply(this,["new",i,r]),this.what=t,this.arguments=e})},function(t,e,i){"use strict";var s=i(3);t.exports=s.extends("nowdoc",function(t,e,i,r,n,o){s.apply(this,["nowdoc",t,e,n,o]),this.label=i,this.quote=r})},function(t,e,i){"use strict";var n=i(3);t.exports=n.extends("number",function(t,e,i,r){n.apply(this,["number",t,e,i,r])})},function(t,e,i){"use strict";var n=i(8),o="offsetlookup";t.exports=n.extends(o,function(t,e,i,r){n.apply(this,[o,t,e,i,r])})},function(t,e,i){"use strict";var l=i(4);t.exports=l.extends("parameter",function(t,e,i,r,n,o,s,a){l.apply(this,["parameter",t,s,a]),this.value=i,this.type=e,this.byref=r,this.variadic=n,this.nullable=o})},function(t,e,i){"use strict";var r=i(6),n="parentreference",o=r.extends(n,function(t,e,i){r.apply(this,[n,e,i]),this.raw=t});t.exports=o},function(t,e,i){"use strict";var n=i(5);t.exports=n.extends("post",function(t,e,i,r){n.apply(this,["post",i,r]),this.type=t,this.what=e})},function(t,e,i){"use strict";var n=i(5);t.exports=n.extends("pre",function(t,e,i,r){n.apply(this,["pre",i,r]),this.type=t,this.what=e})},function(t,e,i){"use strict";var r=i(1);t.exports=r.extends("print",function(t,e,i){r.apply(this,["print",e,i]),this.expression=t})},function(t,e,i){"use strict";var s=i(7);t.exports=s.extends("program",function(t,e,i,r,n,o){s.apply(this,["program",t,n,o]),this.errors=e,i&&(this.comments=i),r&&(this.tokens=r)})},function(t,e,i){"use strict";var o=i(4);t.exports=o.extends("property",function(t,e,i,r,n){o.apply(this,["property",t,r,n]),this.value=e,this.parseFlags(i)})},function(t,e,i){"use strict";var n=i(8),o="propertylookup";t.exports=n.extends(o,function(t,e,i,r){n.apply(this,[o,t,e,i,r])})},function(t,e,i){"use strict";var o=i(1);t.exports=o.extends("retif",function(t,e,i,r,n){o.apply(this,["retif",r,n]),this.test=t,this.trueExpr=e,this.falseExpr=i})},function(t,e,i){"use strict";var r=i(0);t.exports=r.extends("return",function(t,e,i){r.apply(this,["return",e,i]),this.expr=t})},function(t,e,i){"use strict";var r=i(6),n="selfreference",o=r.extends(n,function(t,e,i){r.apply(this,[n,e,i]),this.raw=t});t.exports=o},function(t,e,i){"use strict";var r=i(1);t.exports=r.extends("silent",function(t,e,i){r.apply(this,["silent",e,i]),this.expr=t})},function(t,e,i){"use strict";var r=i(0);t.exports=r.extends("static",function(t,e,i){r.apply(this,["static",e,i]),this.items=t})},function(t,e,i){"use strict";var n=i(8),o="staticlookup";t.exports=n.extends(o,function(t,e,i,r){n.apply(this,[o,t,e,i,r])})},function(t,e,i){"use strict";var r=i(6),n="staticreference",o=r.extends(n,function(t,e,i){r.apply(this,[n,e,i]),this.raw=t});t.exports=o},function(t,e,i){"use strict";var s=i(3);t.exports=s.extends("string",function(t,e,i,r,n,o){s.apply(this,["string",e,r,n,o]),this.unicode=i,this.isDoubleQuote=t})},function(t,e,i){"use strict";var o=i(0);t.exports=o.extends("switch",function(t,e,i,r,n){o.apply(this,["switch",r,n]),this.test=t,this.body=e,this.shortForm=i})},function(t,e,i){"use strict";var r=i(0);t.exports=r.extends("throw",function(t,e,i){r.apply(this,["throw",e,i]),this.what=t})},function(t,e,i){"use strict";var s=i(4);t.exports=s.extends("trait",function(t,e,i,r,n,o){s.apply(this,["trait",t,n,o]),this.extends=e,this.implements=i,this.body=r})},function(t,e,i){"use strict";var s=i(2),a="traitalias";t.exports=s.extends(a,function(t,e,i,r,n,o){s.apply(this,[a,n,o]),this.trait=t,this.method=e,this.as=i,this.visibility="",r&&(0===r[0]?this.visibility="public":1===r[0]?this.visibility="protected":2===r[0]&&(this.visibility="private"))})},function(t,e,i){"use strict";var o=i(2),s="traitprecedence";t.exports=o.extends(s,function(t,e,i,r,n){o.apply(this,[s,r,n]),this.trait=t,this.method=e,this.instead=i})},function(t,e,i){"use strict";var n=i(2);t.exports=n.extends("traituse",function(t,e,i,r){n.apply(this,["traituse",i,r]),this.traits=t,this.adaptations=e})},function(t,e,i){"use strict";var o=i(0);t.exports=o.extends("try",function(t,e,i,r,n){o.apply(this,["try",r,n]),this.body=t,this.catches=e,this.always=i})},function(t,e,i){"use strict";var n=i(6),o="typereference",r=n.extends(o,function(t,e,i,r){n.apply(this,[o,i,r]),this.name=t,this.raw=e});r.types=["int","float","string","bool","object","array","callable","iterable","void"],t.exports=r},function(t,e,i){"use strict";var n=i(5);t.exports=n.extends("unary",function(t,e,i,r){n.apply(this,["unary",i,r]),this.type=t,this.what=e})},function(t,e,i){"use strict";var r=i(0);t.exports=r.extends("unset",function(t,e,i){r.apply(this,["unset",e,i]),this.variables=t})},function(t,e,i){"use strict";var o=i(0);t.exports=o.extends("usegroup",function(t,e,i,r,n){o.apply(this,["usegroup",r,n]),this.name=t,this.type=e,this.items=i})},function(t,e,i){"use strict";var o=i(0),r=o.extends("useitem",function(t,e,i,r,n){o.apply(this,["useitem",r,n]),this.name=t,this.alias=e,this.type=i});r.TYPE_CONST="const",r.TYPE_FUNCTION="function",t.exports=r},function(t,e,i){"use strict";var o=i(1);t.exports=o.extends("variable",function(t,e,i,r,n){o.apply(this,["variable",r,n]),this.name=t,this.byref=e||!1,this.curly=i||!1})},function(t,e,i){"use strict";var r=i(1);t.exports=r.extends("variadic",function(t,e,i){r.apply(this,["variadic",e,i]),this.what=t})},function(t,e,i){"use strict";var o=i(0);t.exports=o.extends("while",function(t,e,i,r,n){o.apply(this,["while",r,n]),this.test=t,this.body=e,this.shortForm=i})},function(t,e,i){"use strict";var n=i(1);t.exports=n.extends("yield",function(t,e,i,r){n.apply(this,["yield",i,r]),this.value=t,this.key=e})},function(t,e,i){"use strict";var r=i(1);t.exports=r.extends("yieldfrom",function(t,e,i){r.apply(this,["yieldfrom",e,i]),this.value=t})}]).default},"object"==typeof PIa&&"object"==typeof OIa?OIa.exports=SIa():"function"==typeof define&&define.amd?define([],SIa):"object"==typeof PIa?PIa.PhpParser=SIa():RIa.PhpParser=SIa()},{}]},{},[1]);
admin/assets/js/codemirror.js DELETED
@@ -1 +0,0 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.CodeMirror=t()}(this,function(){"use strict";var e=navigator.userAgent,t=navigator.platform,r=/gecko\/\d/i.test(e),n=/MSIE \d/.test(e),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),o=/Edge\/(\d+)/.exec(e),l=n||i||o,s=l&&(n?document.documentMode||6:+(o||i)[1]),a=!o&&/WebKit\//.test(e),c=a&&/Qt\/\d+\.\d+/.test(e),u=!o&&/Chrome\//.test(e),f=/Opera\//.test(e),h=/Apple Computer/.test(navigator.vendor),d=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),p=/PhantomJS/.test(e),g=!o&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),m=/Android/.test(e),v=g||m||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),y=g||/Mac/.test(t),b=/\bCrOS\b/.test(e),_=/win/i.test(t),x=f&&e.match(/Version\/(\d*\.\d*)/);x&&(x=Number(x[1])),x&&x>=15&&(f=!1,a=!0);var w=y&&(c||f&&(null==x||x<12.11)),k=r||l&&s>=9;function C(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var S=function(e,t){var r=e.className,n=C(t).exec(r);if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}};function L(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function T(e,t){return L(e).appendChild(t)}function M(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function N(e,t,r,n){var i=M(e,t,r,n);return i.setAttribute("role","presentation"),i}var A;A=document.createRange?function(e,t,r,n){var i=document.createRange();return i.setEnd(n||e,r),i.setStart(e,t),i}:function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(e){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};function O(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if(11==t.nodeType&&(t=t.host),t==e)return!0}while(t=t.parentNode)}function D(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function W(e,t){var r=e.className;C(t).test(r)||(e.className+=(r?" ":"")+t)}function P(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!C(r[n]).test(t)&&(t+=" "+r[n]);return t}var z=function(e){e.select()};g?z=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:l&&(z=function(e){try{e.select()}catch(e){}});function q(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function F(e,t,r){t||(t={});for(var n in e)!e.hasOwnProperty(n)||!1===r&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function E(e,t,r,n,i){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var o=n||0,l=i||0;;){var s=e.indexOf("\t",o);if(s<0||s>=t)return l+(t-o);l+=s-o,l+=r-l%r,o=s+1}}var H=function(){this.id=null};H.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};function I(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}var R=30,B={toString:function(){return"CodeMirror.Pass"}},j={scroll:!1},U={origin:"*mouse"},G={origin:"+move"};function K(e,t,r){for(var n=0,i=0;;){var o=e.indexOf("\t",n);-1==o&&(o=e.length);var l=o-n;if(o==e.length||i+l>=t)return n+Math.min(l,t-i);if(i+=o-n,n=o+1,(i+=r-i%r)>=t)return n}}var V=[""];function $(e){for(;V.length<=e;)V.push(X(V)+" ");return V[e]}function X(e){return e[e.length-1]}function Y(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function Z(){}function Q(e,t){var r;return Object.create?r=Object.create(e):(Z.prototype=e,r=new Z),t&&F(t,r),r}var J=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ee(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||J.test(e))}function te(e,t){return t?!!(t.source.indexOf("\\w")>-1&&ee(e))||t.test(e):ee(e)}function re(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ne=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ie(e){return e.charCodeAt(0)>=768&&ne.test(e)}function oe(e,t,r){for(;(r<0?t>0:t<e.length)&&ie(e.charAt(t));)t+=r;return t}function le(e,t,r){for(var n=t>r?-1:1;;){if(t==r)return t;var i=(t+r)/2,o=n<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:r;e(o)?r=o:t=o+n}}function se(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(t<o){r=i;break}t-=o}return r.lines[t]}function ae(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i}),n}function ce(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function ue(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function fe(e){if(null==e.parent)return null;for(var t=e.parent,r=I(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function he(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height;if(t<o){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var l=0;l<e.lines.length;++l){var s=e.lines[l].height;if(t<s)break;t-=s}return r+l}function de(e,t){return t>=e.first&&t<e.first+e.size}function pe(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function ge(e,t,r){if(void 0===r&&(r=null),!(this instanceof ge))return new ge(e,t,r);this.line=e,this.ch=t,this.sticky=r}function me(e,t){return e.line-t.line||e.ch-t.ch}function ve(e,t){return e.sticky==t.sticky&&0==me(e,t)}function ye(e){return ge(e.line,e.ch)}function be(e,t){return me(e,t)<0?t:e}function _e(e,t){return me(e,t)<0?e:t}function xe(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function we(e,t){if(t.line<e.first)return ge(e.first,0);var r=e.first+e.size-1;return t.line>r?ge(r,se(e,r).text.length):function(e,t){var r=e.ch;return null==r||r>t?ge(e.line,t):r<0?ge(e.line,0):e}(t,se(e,t.line).text.length)}function ke(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=we(e,t[n]);return r}var Ce=!1,Se=!1;function Le(e,t,r){this.marker=e,this.from=t,this.to=r}function Te(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function Me(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function Ne(e,t){if(t.full)return null;var r=de(e,t.from.line)&&se(e,t.from.line).markedSpans,n=de(e,t.to.line)&&se(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,l=0==me(t.from,t.to),s=function(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker;if(null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t)||o.from==t&&"bookmark"==l.type&&(!r||!o.marker.insertLeft)){var s=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new Le(l,o.from,s?null:o.to))}}return n}(r,i,l),a=function(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker;if(null==o.to||(l.inclusiveRight?o.to>=t:o.to>t)||o.from==t&&"bookmark"==l.type&&(!r||o.marker.insertLeft)){var s=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new Le(l,s?null:o.from-t,null==o.to?null:o.to-t))}}return n}(n,o,l),c=1==t.text.length,u=X(t.text).length+(c?i:0);if(s)for(var f=0;f<s.length;++f){var h=s[f];if(null==h.to){var d=Te(a,h.marker);d?c&&(h.to=null==d.to?null:d.to+u):h.to=i}}if(a)for(var p=0;p<a.length;++p){var g=a[p];if(null!=g.to&&(g.to+=u),null==g.from){Te(s,g.marker)||(g.from=u,c&&(s||(s=[])).push(g))}else g.from+=u,c&&(s||(s=[])).push(g)}s&&(s=Ae(s)),a&&a!=s&&(a=Ae(a));var m=[s];if(!c){var v,y=t.text.length-2;if(y>0&&s)for(var b=0;b<s.length;++b)null==s[b].to&&(v||(v=[])).push(new Le(s[b].marker,null,null));for(var _=0;_<y;++_)m.push(v);m.push(a)}return m}function Ae(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&!1!==r.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function Oe(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function De(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function We(e){return e.inclusiveLeft?-1:0}function Pe(e){return e.inclusiveRight?1:0}function ze(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=me(n.from,i.from)||We(e)-We(t);if(o)return-o;var l=me(n.to,i.to)||Pe(e)-Pe(t);return l||t.id-e.id}function qe(e,t){var r,n=Se&&e.markedSpans;if(n)for(var i=void 0,o=0;o<n.length;++o)(i=n[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!r||ze(r,i.marker)<0)&&(r=i.marker);return r}function Fe(e){return qe(e,!0)}function Ee(e){return qe(e,!1)}function He(e,t,r,n,i){var o=se(e,t),l=Se&&o.markedSpans;if(l)for(var s=0;s<l.length;++s){var a=l[s];if(a.marker.collapsed){var c=a.marker.find(0),u=me(c.from,r)||We(a.marker)-We(i),f=me(c.to,n)||Pe(a.marker)-Pe(i);if(!(u>=0&&f<=0||u<=0&&f>=0)&&(u<=0&&(a.marker.inclusiveRight&&i.inclusiveLeft?me(c.to,r)>=0:me(c.to,r)>0)||u>=0&&(a.marker.inclusiveRight&&i.inclusiveLeft?me(c.from,n)<=0:me(c.from,n)<0)))return!0}}}function Ie(e){for(var t;t=Fe(e);)e=t.find(-1,!0).line;return e}function Re(e,t){var r=se(e,t),n=Ie(r);return r==n?t:fe(n)}function Be(e,t){if(t>e.lastLine())return t;var r,n=se(e,t);if(!je(e,n))return t;for(;r=Ee(n);)n=r.find(1,!0).line;return fe(n)+1}function je(e,t){var r=Se&&t.markedSpans;if(r)for(var n=void 0,i=0;i<r.length;++i)if((n=r[i]).marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&Ue(e,t,n))return!0}}function Ue(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return Ue(e,n.line,Te(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if((i=t.markedSpans[o]).marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&Ue(e,t,i))return!0}function Ge(e){for(var t=0,r=(e=Ie(e)).parent,n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var o=r.parent;o;r=o,o=r.parent)for(var l=0;l<o.children.length;++l){var s=o.children[l];if(s==r)break;t+=s.height}return t}function Ke(e){if(0==e.height)return 0;for(var t,r=e.text.length,n=e;t=Fe(n);){var i=t.find(0,!0);n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=Ee(n);){var o=t.find(0,!0);r-=n.text.length-o.from.ch,r+=(n=o.to.line).text.length-o.to.ch}return r}function Ve(e){var t=e.display,r=e.doc;t.maxLine=se(r,r.first),t.maxLineLength=Ke(t.maxLine),t.maxLineChanged=!0,r.iter(function(e){var r=Ke(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}var $e=null;function Xe(e,t,r){var n;$e=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&"before"==r?n=i:$e=i),o.from==t&&(o.from!=o.to&&"before"!=r?n=i:$e=i)}return null!=n?n:$e}var Ye=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,i=/[LRr]/,o=/[Lb1n]/,l=/[1n]/;function s(e,t,r){this.level=e,this.from=t,this.to=r}return function(a,c){var u="ltr"==c?"L":"R";if(0==a.length||"ltr"==c&&!r.test(a))return!1;for(var f=a.length,h=[],d=0;d<f;++d)h.push((p=a.charCodeAt(d))<=247?e.charAt(p):1424<=p&&p<=1524?"R":1536<=p&&p<=1785?t.charAt(p-1536):1774<=p&&p<=2220?"r":8192<=p&&p<=8203?"w":8204==p?"b":"L");for(var p,g=0,m=u;g<f;++g){var v=h[g];"m"==v?h[g]=m:m=v}for(var y=0,b=u;y<f;++y){var _=h[y];"1"==_&&"r"==b?h[y]="n":i.test(_)&&(b=_,"r"==_&&(h[y]="R"))}for(var x=1,w=h[0];x<f-1;++x){var k=h[x];"+"==k&&"1"==w&&"1"==h[x+1]?h[x]="1":","!=k||w!=h[x+1]||"1"!=w&&"n"!=w||(h[x]=w),w=k}for(var C=0;C<f;++C){var S=h[C];if(","==S)h[C]="N";else if("%"==S){var L=void 0;for(L=C+1;L<f&&"%"==h[L];++L);for(var T=C&&"!"==h[C-1]||L<f&&"1"==h[L]?"1":"N",M=C;M<L;++M)h[M]=T;C=L-1}}for(var N=0,A=u;N<f;++N){var O=h[N];"L"==A&&"1"==O?h[N]="L":i.test(O)&&(A=O)}for(var D=0;D<f;++D)if(n.test(h[D])){var W=void 0;for(W=D+1;W<f&&n.test(h[W]);++W);for(var P="L"==(D?h[D-1]:u),z=P==("L"==(W<f?h[W]:u))?P?"L":"R":u,q=D;q<W;++q)h[q]=z;D=W-1}for(var F,E=[],H=0;H<f;)if(o.test(h[H])){var I=H;for(++H;H<f&&o.test(h[H]);++H);E.push(new s(0,I,H))}else{var R=H,B=E.length;for(++H;H<f&&"L"!=h[H];++H);for(var j=R;j<H;)if(l.test(h[j])){R<j&&E.splice(B,0,new s(1,R,j));var U=j;for(++j;j<H&&l.test(h[j]);++j);E.splice(B,0,new s(2,U,j)),R=j}else++j;R<H&&E.splice(B,0,new s(1,R,H))}return"ltr"==c&&(1==E[0].level&&(F=a.match(/^\s+/))&&(E[0].from=F[0].length,E.unshift(new s(0,0,F[0].length))),1==X(E).level&&(F=a.match(/\s+$/))&&(X(E).to-=F[0].length,E.push(new s(0,f-F[0].length,f)))),"rtl"==c?E.reverse():E}}();function Ze(e,t){var r=e.order;return null==r&&(r=e.order=Ye(e.text,t)),r}var Qe=[],Je=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={});n[t]=(n[t]||Qe).concat(r)}};function et(e,t){return e._handlers&&e._handlers[t]||Qe}function tt(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers,i=n&&n[t];if(i){var o=I(i,r);o>-1&&(n[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function rt(e,t){var r=et(e,t);if(r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)}function nt(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),rt(e,r||t.type,e,t),ct(t)||t.codemirrorIgnore}function it(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)-1==I(r,t[n])&&r.push(t[n])}function ot(e,t){return et(e,t).length>0}function lt(e){e.prototype.on=function(e,t){Je(this,e,t)},e.prototype.off=function(e,t){tt(this,e,t)}}function st(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function at(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ct(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function ut(e){st(e),at(e)}function ft(e){return e.target||e.srcElement}function ht(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),y&&e.ctrlKey&&1==t&&(t=3),t}var dt,pt=function(){if(l&&s<9)return!1;var e=M("div");return"draggable"in e||"dragDrop"in e}();function gt(e){if(null==dt){var t=M("span","​");T(e,M("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(dt=t.offsetWidth<=1&&t.offsetHeight>2&&!(l&&s<8))}var r=dt?M("span","​"):M("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var mt;function vt(e){if(null!=mt)return mt;var t=T(e,document.createTextNode("AخA")),r=A(t,0,1).getBoundingClientRect(),n=A(t,1,2).getBoundingClientRect();return L(e),!(!r||r.left==r.right)&&(mt=n.right-r.right<3)}var yt=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;t<=n;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),l=o.indexOf("\r");-1!=l?(r.push(o.slice(0,l)),t+=l+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},bt=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},_t=function(){var e=M("div");return"oncopy"in e||(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),xt=null;var wt={},kt={};function Ct(e){if("string"==typeof e&&kt.hasOwnProperty(e))e=kt[e];else if(e&&"string"==typeof e.name&&kt.hasOwnProperty(e.name)){var t=kt[e.name];"string"==typeof t&&(t={name:t}),(e=Q(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ct("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ct("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function St(e,t){t=Ct(t);var r=wt[t.name];if(!r)return St(e,"text/plain");var n=r(e,t);if(Lt.hasOwnProperty(t.name)){var i=Lt[t.name];for(var o in i)i.hasOwnProperty(o)&&(n.hasOwnProperty(o)&&(n["_"+o]=n[o]),n[o]=i[o])}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var l in t.modeProps)n[l]=t.modeProps[l];return n}var Lt={};function Tt(e,t){F(t,Lt.hasOwnProperty(e)?Lt[e]:Lt[e]={})}function Mt(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function Nt(e,t){for(var r;e.innerMode&&(r=e.innerMode(t))&&r.mode!=e;)t=r.state,e=r.mode;return r||{mode:e,state:t}}function At(e,t,r){return!e.startState||e.startState(t,r)}var Ot=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};Ot.prototype.eol=function(){return this.pos>=this.string.length},Ot.prototype.sol=function(){return this.pos==this.lineStart},Ot.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ot.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ot.prototype.eat=function(e){var t=this.string.charAt(this.pos);if("string"==typeof e?t==e:t&&(e.test?e.test(t):e(t)))return++this.pos,t},Ot.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ot.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ot.prototype.skipToEnd=function(){this.pos=this.string.length},Ot.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ot.prototype.backUp=function(e){this.pos-=e},Ot.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=E(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?E(this.string,this.lineStart,this.tabSize):0)},Ot.prototype.indentation=function(){return E(this.string,null,this.tabSize)-(this.lineStart?E(this.string,this.lineStart,this.tabSize):0)},Ot.prototype.match=function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&!1!==t&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e};if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},Ot.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ot.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ot.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ot.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var Dt=function(e,t){this.state=e,this.lookAhead=t},Wt=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};Wt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},Wt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Wt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Wt.fromSaved=function(e,t,r){return t instanceof Dt?new Wt(e,Mt(e.mode,t.state),r,t.lookAhead):new Wt(e,Mt(e.mode,t),r)},Wt.prototype.save=function(e){var t=!1!==e?Mt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Dt(t,this.maxLookAhead):t};function Pt(e,t,r,n){var i=[e.state.modeGen],o={};jt(e,t.text,e.doc.mode,r,function(e,t){return i.push(e,t)},o,n);for(var l=r.state,s=function(n){r.baseTokens=i;var s=e.state.overlays[n],a=1,c=0;r.state=!0,jt(e,t.text,s.mode,r,function(e,t){for(var r=a;c<e;){var n=i[a];n>e&&i.splice(a,1,e,i[a+1],n),a+=2,c=Math.min(e,n)}if(t)if(s.opaque)i.splice(r,a-r,e,"overlay "+t),a=r+2;else for(;r<a;r+=2){var o=i[r+1];i[r+1]=(o?o+" ":"")+"overlay "+t}},o),r.state=l,r.baseTokens=null,r.baseTokenPos=1},a=0;a<e.state.overlays.length;++a)s(a);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function zt(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=qt(e,fe(t)),i=t.text.length>e.options.maxHighlightLength&&Mt(e.doc.mode,n.state),o=Pt(e,t,n);i&&(n.state=i),t.stateAfter=n.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function qt(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return new Wt(n,!0,t);var o=function(e,t,r){for(var n,i,o=e.doc,l=r?-1:t-(e.doc.mode.innerMode?1e3:100),s=t;s>l;--s){if(s<=o.first)return o.first;var a=se(o,s-1),c=a.stateAfter;if(c&&(!r||s+(c instanceof Dt?c.lookAhead:0)<=o.modeFrontier))return s;var u=E(a.text,null,e.options.tabSize);(null==i||n>u)&&(i=s-1,n=u)}return i}(e,t,r),l=o>n.first&&se(n,o-1).stateAfter,s=l?Wt.fromSaved(n,l,o):new Wt(n,At(n.mode),o);return n.iter(o,t,function(r){Ft(e,r.text,s);var n=s.line;r.stateAfter=n==t-1||n%5==0||n>=i.viewFrom&&n<i.viewTo?s.save():null,s.nextLine()}),r&&(n.modeFrontier=s.line),s}function Ft(e,t,r,n){var i=e.doc.mode,o=new Ot(t,e.options.tabSize,r);for(o.start=o.pos=n||0,""==t&&Et(i,r.state);!o.eol();)Ht(i,o,r.state),o.start=o.pos}function Et(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var r=Nt(e,t);return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function Ht(e,t,r,n){for(var i=0;i<10;i++){n&&(n[0]=Nt(e,r).mode);var o=e.token(t,r);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}var It=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function Rt(e,t,r,n){var i,o,l=e.doc,s=l.mode,a=se(l,(t=we(l,t)).line),c=qt(e,t.line,r),u=new Ot(a.text,e.options.tabSize,c);for(n&&(o=[]);(n||u.pos<t.ch)&&!u.eol();)u.start=u.pos,i=Ht(s,u,c.state),n&&o.push(new It(u,i,Mt(l.mode,c.state)));return n?o:new It(u,i,c.state)}function Bt(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(t[n])||(t[n]+=" "+r[2])}return e}function jt(e,t,r,n,i,o,l){var s=r.flattenSpans;null==s&&(s=e.options.flattenSpans);var a,c=0,u=null,f=new Ot(t,e.options.tabSize,n),h=e.options.addModeClass&&[null];for(""==t&&Bt(Et(r,n.state),o);!f.eol();){if(f.pos>e.options.maxHighlightLength?(s=!1,l&&Ft(e,t,n,f.pos),f.pos=t.length,a=null):a=Bt(Ht(r,f,n.state,h),o),h){var d=h[0].name;d&&(a="m-"+(a?d+" "+a:d))}if(!s||u!=a){for(;c<f.start;)i(c=Math.min(f.start,c+5e3),u);u=a}f.start=f.pos}for(;c<f.pos;){var p=Math.min(f.pos,c+5e3);i(p,u),c=p}}var Ut=function(e,t,r){this.text=e,De(this,t),this.height=r?r(this):1};Ut.prototype.lineNo=function(){return fe(this)},lt(Ut);var Gt={},Kt={};function Vt(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Kt:Gt;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function $t(e,t){var r=N("span",null,null,a?"padding-right: .1px":null),n={pre:N("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:(l||a)&&e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,s=void 0;n.pos=0,n.addToken=Yt,vt(e.display.measure)&&(s=Ze(o,e.doc.direction))&&(n.addToken=Zt(n.addToken,s)),n.map=[];Jt(o,n,zt(e,o,t!=e.display.externalMeasured&&fe(o))),o.styleClasses&&(o.styleClasses.bgClass&&(n.bgClass=P(o.styleClasses.bgClass,n.bgClass||"")),o.styleClasses.textClass&&(n.textClass=P(o.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(gt(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(a){var c=n.content.lastChild;(/\bcm-tab\b/.test(c.className)||c.querySelector&&c.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return rt(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=P(n.pre.className,n.textClass||"")),n}function Xt(e){var t=M("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Yt(e,t,r,n,i,o,a){if(t){var c,u=e.splitSpaces?function(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!r||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),n+=o,r=" "==o}return n}(t,e.trailingSpace):t,f=e.cm.state.specialChars,h=!1;if(f.test(t)){c=document.createDocumentFragment();for(var d=0;;){f.lastIndex=d;var p=f.exec(t),g=p?p.index-d:t.length-d;if(g){var m=document.createTextNode(u.slice(d,d+g));l&&s<9?c.appendChild(M("span",[m])):c.appendChild(m),e.map.push(e.pos,e.pos+g,m),e.col+=g,e.pos+=g}if(!p)break;d+=g+1;var v=void 0;if("\t"==p[0]){var y=e.cm.options.tabSize,b=y-e.col%y;(v=c.appendChild(M("span",$(b),"cm-tab"))).setAttribute("role","presentation"),v.setAttribute("cm-text","\t"),e.col+=b}else"\r"==p[0]||"\n"==p[0]?((v=c.appendChild(M("span","\r"==p[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",p[0]),e.col+=1):((v=e.cm.options.specialCharPlaceholder(p[0])).setAttribute("cm-text",p[0]),l&&s<9?c.appendChild(M("span",[v])):c.appendChild(v),e.col+=1);e.map.push(e.pos,e.pos+1,v),e.pos++}}else e.col+=t.length,c=document.createTextNode(u),e.map.push(e.pos,e.pos+t.length,c),l&&s<9&&(h=!0),e.pos+=t.length;if(e.trailingSpace=32==u.charCodeAt(t.length-1),r||n||i||h||a){var _=r||"";n&&(_+=n),i&&(_+=i);var x=M("span",[c],_,a);return o&&(x.title=o),e.content.appendChild(x)}e.content.appendChild(c)}}function Zt(e,t){return function(r,n,i,o,l,s,a){i=i?i+" cm-force-border":"cm-force-border";for(var c=r.pos,u=c+n.length;;){for(var f=void 0,h=0;h<t.length&&!((f=t[h]).to>c&&f.from<=c);h++);if(f.to>=u)return e(r,n,i,o,l,s,a);e(r,n.slice(0,f.to-c),i,o,null,s,a),o=null,n=n.slice(f.to-c),c=f.to}}}function Qt(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Jt(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var l,s,a,c,u,f,h,d=i.length,p=0,g=1,m="",v=0;;){if(v==p){a=c=u=f=s="",h=null,v=1/0;for(var y=[],b=void 0,_=0;_<n.length;++_){var x=n[_],w=x.marker;"bookmark"==w.type&&x.from==p&&w.widgetNode?y.push(w):x.from<=p&&(null==x.to||x.to>p||w.collapsed&&x.to==p&&x.from==p)?(null!=x.to&&x.to!=p&&v>x.to&&(v=x.to,c=""),w.className&&(a+=" "+w.className),w.css&&(s=(s?s+";":"")+w.css),w.startStyle&&x.from==p&&(u+=" "+w.startStyle),w.endStyle&&x.to==v&&(b||(b=[])).push(w.endStyle,x.to),w.title&&!f&&(f=w.title),w.collapsed&&(!h||ze(h.marker,w)<0)&&(h=x)):x.from>p&&v>x.from&&(v=x.from)}if(b)for(var k=0;k<b.length;k+=2)b[k+1]==v&&(c+=" "+b[k]);if(!h||h.from==p)for(var C=0;C<y.length;++C)Qt(t,0,y[C]);if(h&&(h.from||0)==p){if(Qt(t,(null==h.to?d+1:h.to)-p,h.marker,null==h.from),null==h.to)return;h.to==p&&(h=!1)}}if(p>=d)break;for(var S=Math.min(d,v);;){if(m){var L=p+m.length;if(!h){var T=L>S?m.slice(0,S-p):m;t.addToken(t,T,l?l+a:a,u,p+T.length==v?c:"",f,s)}if(L>=S){m=m.slice(S-p),p=S;break}p=L,u=""}m=i.slice(o,o=r[g++]),l=Vt(r[g++],t.cm.options)}}else for(var M=1;M<r.length;M+=2)t.addToken(t,i.slice(o,o=r[M]),Vt(r[M+1],t.cm.options))}function er(e,t,r){this.line=t,this.rest=function(e){for(var t,r;t=Ee(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}(t),this.size=this.rest?fe(X(this.rest))-r+1:1,this.node=this.text=null,this.hidden=je(e,t)}function tr(e,t,r){for(var n,i=[],o=t;o<r;o=n){var l=new er(e.doc,se(e.doc,o),o);n=o+l.size,i.push(l)}return i}var rr=null;var nr=null;function ir(e,t){var r=et(e,t);if(r.length){var n,i=Array.prototype.slice.call(arguments,2);rr?n=rr.delayedCallbacks:nr?n=nr:(n=nr=[],setTimeout(or,0));for(var o=function(e){n.push(function(){return r[e].apply(null,i)})},l=0;l<r.length;++l)o(l)}}function or(){var e=nr;nr=null;for(var t=0;t<e.length;++t)e[t]()}function lr(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?cr(e,t):"gutter"==o?fr(e,t,r,n):"class"==o?ur(e,t):"widget"==o&&hr(e,t,n)}t.changes=null}function sr(e){return e.node==e.text&&(e.node=M("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),l&&s<8&&(e.node.style.zIndex=2)),e.node}function ar(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):$t(e,t)}function cr(e,t){var r=t.text.className,n=ar(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,ur(e,t)):r&&(t.text.className=r)}function ur(e,t){!function(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),t.background)r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null);else if(r){var n=sr(t);t.background=n.insertBefore(M("div",null,r),n.firstChild),e.display.input.setUneditable(t.background)}}(e,t),t.line.wrapClass?sr(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function fr(e,t,r,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=sr(t);t.gutterBackground=M("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var l=sr(t),s=t.gutter=M("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(s),l.insertBefore(s,t.text),t.line.gutterClass&&(s.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=s.appendChild(M("div",pe(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var a=0;a<e.options.gutters.length;++a){var c=e.options.gutters[a],u=o.hasOwnProperty(c)&&o[c];u&&s.appendChild(M("div",[u],"CodeMirror-gutter-elt","left: "+n.gutterLeft[c]+"px; width: "+n.gutterWidth[c]+"px"))}}}function hr(e,t,r){t.alignable&&(t.alignable=null);for(var n=t.node.firstChild,i=void 0;n;n=i)i=n.nextSibling,"CodeMirror-linewidget"==n.className&&t.node.removeChild(n);pr(e,t,r)}function dr(e,t,r,n){var i=ar(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),ur(e,t),fr(e,t,r,n),pr(e,t,n),t.node}function pr(e,t,r){if(gr(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)gr(e,t.rest[n],t,r,!1)}function gr(e,t,r,n,i){if(t.widgets)for(var o=sr(r),l=0,s=t.widgets;l<s.length;++l){var a=s[l],c=M("div",[a.node],"CodeMirror-linewidget");a.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),mr(a,c,r,n),e.display.input.setUneditable(c),i&&a.above?o.insertBefore(c,r.gutter||r.text):o.appendChild(c),ir(a,"redraw")}}function mr(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function vr(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!O(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),T(t.display.measure,M("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function yr(e,t){for(var r=ft(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return!0}function br(e){return e.lineSpace.offsetTop}function _r(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function xr(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=T(e.measure,M("pre","x")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(n.left)||isNaN(n.right)||(e.cachedPaddingH=n),n}function wr(e){return R-e.display.nativeBarWidth}function kr(e){return e.display.scroller.clientWidth-wr(e)-e.display.barWidth}function Cr(e){return e.display.scroller.clientHeight-wr(e)-e.display.barHeight}function Sr(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var i=0;i<e.rest.length;i++)if(fe(e.rest[i])>r)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Lr(e,t,r,n){return Nr(e,Mr(e,t),r,n)}function Tr(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[on(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function Mr(e,t){var r=fe(t),n=Tr(e,r);n&&!n.text?n=null:n&&n.changes&&(lr(e,n,r,Jr(e)),e.curOp.forceUpdate=!0),n||(n=function(e,t){var r=fe(t=Ie(t)),n=e.display.externalMeasured=new er(e.doc,t,r);n.lineN=r;var i=n.built=$t(e,n);return n.text=i.pre,T(e.display.lineMeasure,i.pre),n}(e,t));var i=Sr(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Nr(e,t,r,n,i){t.before&&(r=-1);var o,a=r+(n||"");return t.cache.hasOwnProperty(a)?o=t.cache[a]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(!function(e,t,r){var n=e.options.lineWrapping,i=n&&kr(e);if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;for(var l=t.text.firstChild.getClientRects(),s=0;s<l.length-1;s++){var a=l[s],c=l[s+1];Math.abs(a.bottom-c.bottom)>2&&o.push((a.bottom+c.top)/2-r.top)}}o.push(r.bottom-r.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,r,n){var i,o=Or(t.map,r,n),a=o.node,c=o.start,u=o.end,f=o.collapse;if(3==a.nodeType){for(var h=0;h<4;h++){for(;c&&ie(t.line.text.charAt(o.coverStart+c));)--c;for(;o.coverStart+u<o.coverEnd&&ie(t.line.text.charAt(o.coverStart+u));)++u;if((i=l&&s<9&&0==c&&u==o.coverEnd-o.coverStart?a.parentNode.getBoundingClientRect():Dr(A(a,c,u).getClientRects(),n)).left||i.right||0==c)break;u=c,c-=1,f="right"}l&&s<11&&(i=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=xt)return xt;var t=T(e,M("span","x")),r=t.getBoundingClientRect(),n=A(t,0,1).getBoundingClientRect();return xt=Math.abs(r.left-n.left)>1}(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}(e.display.measure,i))}else{c>0&&(f=n="right");var d;i=e.options.lineWrapping&&(d=a.getClientRects()).length>1?d["right"==n?d.length-1:0]:a.getBoundingClientRect()}if(l&&s<9&&!c&&(!i||!i.left&&!i.right)){var p=a.parentNode.getClientRects()[0];i=p?{left:p.left,right:p.left+Qr(e.display),top:p.top,bottom:p.bottom}:Ar}for(var g=i.top-t.rect.top,m=i.bottom-t.rect.top,v=(g+m)/2,y=t.view.measure.heights,b=0;b<y.length-1&&!(v<y[b]);b++);var _=b?y[b-1]:0,x=y[b],w={left:("right"==f?i.right:i.left)-t.rect.left,right:("left"==f?i.left:i.right)-t.rect.left,top:_,bottom:x};i.left||i.right||(w.bogus=!0);e.options.singleCursorHeightPerLine||(w.rtop=g,w.rbottom=m);return w}(e,t,r,n)).bogus||(t.cache[a]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var Ar={left:0,right:0,top:0,bottom:0};function Or(e,t,r){for(var n,i,o,l,s,a,c=0;c<e.length;c+=3)if(s=e[c],a=e[c+1],t<s?(i=0,o=1,l="left"):t<a?o=(i=t-s)+1:(c==e.length-3||t==a&&e[c+3]>t)&&(i=(o=a-s)-1,t>=a&&(l="right")),null!=i){if(n=e[c+2],s==a&&r==(n.insertLeft?"left":"right")&&(l=r),"left"==r&&0==i)for(;c&&e[c-2]==e[c-3]&&e[c-1].insertLeft;)n=e[2+(c-=3)],l="left";if("right"==r&&i==a-s)for(;c<e.length-3&&e[c+3]==e[c+4]&&!e[c+5].insertLeft;)n=e[(c+=3)+2],l="right";break}return{node:n,start:i,end:o,collapse:l,coverStart:s,coverEnd:a}}function Dr(e,t){var r=Ar;if("left"==t)for(var n=0;n<e.length&&(r=e[n]).left==r.right;n++);else for(var i=e.length-1;i>=0&&(r=e[i]).left==r.right;i--);return r}function Wr(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function Pr(e){e.display.externalMeasure=null,L(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Wr(e.display.view[t])}function zr(e){Pr(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function qr(){return u&&m?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Fr(){return u&&m?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Er(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=vr(e.widgets[r]));return t}function Hr(e,t,r,n,i){if(!i){var o=Er(t);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var l=Ge(t);if("local"==n?l+=br(e.display):l-=e.display.viewOffset,"page"==n||"window"==n){var s=e.display.lineSpace.getBoundingClientRect();l+=s.top+("window"==n?0:Fr());var a=s.left+("window"==n?0:qr());r.left+=a,r.right+=a}return r.top+=l,r.bottom+=l,r}function Ir(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=qr(),i-=Fr();else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();n+=o.left,i+=o.top}var l=e.display.lineSpace.getBoundingClientRect();return{left:n-l.left,top:i-l.top}}function Rr(e,t,r,n,i){return n||(n=se(e.doc,t.line)),Hr(e,n,Lr(e,n,t.ch,i),r)}function Br(e,t,r,n,i,o){n=n||se(e.doc,t.line),i||(i=Mr(e,n));function l(t,l){var s=Nr(e,i,t,l?"right":"left",o);return l?s.left=s.right:s.right=s.left,Hr(e,n,s,r)}var s=Ze(n,e.doc.direction),a=t.ch,c=t.sticky;if(a>=n.text.length?(a=n.text.length,c="before"):a<=0&&(a=0,c="after"),!s)return l("before"==c?a-1:a,"before"==c);function u(e,t,r){var n=1==s[t].level;return l(r?e-1:e,n!=r)}var f=Xe(s,a,c),h=$e,d=u(a,f,"before"==c);return null!=h&&(d.other=u(a,h,"before"!=c)),d}function jr(e,t){var r=0;t=we(e.doc,t),e.options.lineWrapping||(r=Qr(e.display)*t.ch);var n=se(e.doc,t.line),i=Ge(n)+br(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function Ur(e,t,r,n,i){var o=ge(e,t,r);return o.xRel=i,n&&(o.outside=!0),o}function Gr(e,t,r){var n=e.doc;if((r+=e.display.viewOffset)<0)return Ur(n.first,0,null,!0,-1);var i=he(n,r),o=n.first+n.size-1;if(i>o)return Ur(n.first+n.size-1,se(n,o).text.length,null,!0,1);t<0&&(t=0);for(var l=se(n,i);;){var s=Xr(e,l,i,t,r),a=Ee(l),c=a&&a.find(0,!0);if(!a||!(s.ch>c.from.ch||s.ch==c.from.ch&&s.xRel>0))return s;i=fe(l=c.to.line)}}function Kr(e,t,r,n){n-=Er(t);var i=t.text.length,o=le(function(t){return Nr(e,r,t-1).bottom<=n},i,0);return{begin:o,end:i=le(function(t){return Nr(e,r,t).top>n},o,i)}}function Vr(e,t,r,n){r||(r=Mr(e,t));return Kr(e,t,r,Hr(e,t,Nr(e,r,n),"line").top)}function $r(e,t,r,n){return!(e.bottom<=r)&&(e.top>r||(n?e.left:e.right)>t)}function Xr(e,t,r,n,i){i-=Ge(t);var o=Mr(e,t),l=Er(t),s=0,a=t.text.length,c=!0,u=Ze(t,e.doc.direction);if(u){var f=(e.options.lineWrapping?function(e,t,r,n,i,o,l){var s=Kr(e,t,n,l),a=s.begin,c=s.end;/\s/.test(t.text.charAt(c-1))&&c--;for(var u=null,f=null,h=0;h<i.length;h++){var d=i[h];if(!(d.from>=c||d.to<=a)){var p=1!=d.level,g=Nr(e,n,p?Math.min(c,d.to)-1:Math.max(a,d.from)).right,m=g<o?o-g+1e9:g-o;(!u||f>m)&&(u=d,f=m)}}u||(u=i[i.length-1]);u.from<a&&(u={from:a,to:u.to,level:u.level});u.to>c&&(u={from:u.from,to:c,level:u.level});return u}:function(e,t,r,n,i,o,l){var s=le(function(s){var a=i[s],c=1!=a.level;return $r(Br(e,ge(r,c?a.to:a.from,c?"before":"after"),"line",t,n),o,l,!0)},0,i.length-1),a=i[s];if(s>0){var c=1!=a.level,u=Br(e,ge(r,c?a.from:a.to,c?"after":"before"),"line",t,n);$r(u,o,l,!0)&&u.top>l&&(a=i[s-1])}return a})(e,t,r,o,u,n,i);s=(c=1!=f.level)?f.from:f.to-1,a=c?f.to:f.from-1}var h,d,p=null,g=null,m=le(function(t){var r=Nr(e,o,t);return r.top+=l,r.bottom+=l,!!$r(r,n,i,!1)&&(r.top<=i&&r.left<=n&&(p=t,g=r),!0)},s,a),v=!1;if(g){var y=n-g.left<g.right-n,b=y==c;m=p+(b?0:1),d=b?"after":"before",h=y?g.left:g.right}else{c||m!=a&&m!=s||m++,d=0==m?"after":m==t.text.length?"before":Nr(e,o,m-(c?1:0)).bottom+l<=i==c?"after":"before";var _=Br(e,ge(r,m,d),"line",t,o);h=_.left,v=i<_.top||i>=_.bottom}return Ur(r,m=oe(t.text,m,1),d,v,n-h)}var Yr;function Zr(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Yr){Yr=M("pre");for(var t=0;t<49;++t)Yr.appendChild(document.createTextNode("x")),Yr.appendChild(M("br"));Yr.appendChild(document.createTextNode("x"))}T(e.measure,Yr);var r=Yr.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),L(e.measure),r||1}function Qr(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=M("span","xxxxxxxxxx"),r=M("pre",[t]);T(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Jr(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l)r[e.options.gutters[l]]=o.offsetLeft+o.clientLeft+i,n[e.options.gutters[l]]=o.clientWidth;return{fixedPos:en(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function en(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function tn(e){var t=Zr(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/Qr(e.display)-3);return function(i){if(je(e.doc,i))return 0;var o=0;if(i.widgets)for(var l=0;l<i.widgets.length;l++)i.widgets[l].height&&(o+=i.widgets[l].height);return r?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function rn(e){var t=e.doc,r=tn(e);t.iter(function(e){var t=r(e);t!=e.height&&ue(e,t)})}function nn(e,t,r,n){var i=e.display;if(!r&&"true"==ft(t).getAttribute("cm-not-content"))return null;var o,l,s=i.lineSpace.getBoundingClientRect();try{o=t.clientX-s.left,l=t.clientY-s.top}catch(t){return null}var a,c=Gr(e,o,l);if(n&&1==c.xRel&&(a=se(e.doc,c.line).text).length==c.ch){var u=E(a,a.length,e.options.tabSize)-a.length;c=ge(c.line,Math.max(0,Math.round((o-xr(e.display).left)/Qr(e.display))-u))}return c}function on(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var r=e.display.view,n=0;n<r.length;n++)if((t-=r[n].size)<0)return n}function ln(e){e.display.input.showSelection(e.display.input.prepareSelection())}function sn(e,t){void 0===t&&(t=!0);for(var r=e.doc,n={},i=n.cursors=document.createDocumentFragment(),o=n.selection=document.createDocumentFragment(),l=0;l<r.sel.ranges.length;l++)if(t||l!=r.sel.primIndex){var s=r.sel.ranges[l];if(!(s.from().line>=e.display.viewTo||s.to().line<e.display.viewFrom)){var a=s.empty();(a||e.options.showCursorWhenSelecting)&&an(e,s.head,i),a||un(e,s,o)}}return n}function an(e,t,r){var n=Br(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild(M("div"," ","CodeMirror-cursor"));if(i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var o=r.appendChild(M("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=n.other.left+"px",o.style.top=n.other.top+"px",o.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function cn(e,t){return e.top-t.top||e.left-t.left}function un(e,t,r){var n=e.display,i=e.doc,o=document.createDocumentFragment(),l=xr(e.display),s=l.left,a=Math.max(n.sizerWidth,kr(e)-n.sizer.offsetLeft)-l.right,c="ltr"==i.direction;function u(e,t,r,n){t<0&&(t=0),t=Math.round(t),n=Math.round(n),o.appendChild(M("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==r?a-e:r)+"px;\n height: "+(n-t)+"px"))}function f(t,r,n){var o,l,f=se(i,t),h=f.text.length;function d(r,n){return Rr(e,ge(t,r),"div",f,n)}function p(t,r,n){var i=Vr(e,f,null,t),o="ltr"==r==("after"==n)?"left":"right";return d("after"==n?i.begin:i.end-(/\s/.test(f.text.charAt(i.end-1))?2:1),o)[o]}var g=Ze(f,i.direction);return function(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var l=e[o];(l.from<r&&l.to>t||t==r&&l.to==t)&&(n(Math.max(l.from,t),Math.min(l.to,r),1==l.level?"rtl":"ltr",o),i=!0)}i||n(t,r,"ltr")}(g,r||0,null==n?h:n,function(e,t,i,f){var m="ltr"==i,v=d(e,m?"left":"right"),y=d(t-1,m?"right":"left"),b=null==r&&0==e,_=null==n&&t==h,x=0==f,w=!g||f==g.length-1;if(y.top-v.top<=3){var k=(c?_:b)&&w,C=(c?b:_)&&x?s:(m?v:y).left,S=k?a:(m?y:v).right;u(C,v.top,S-C,v.bottom)}else{var L,T,M,N;m?(L=c&&b&&x?s:v.left,T=c?a:p(e,i,"before"),M=c?s:p(t,i,"after"),N=c&&_&&w?a:y.right):(L=c?p(e,i,"before"):s,T=!c&&b&&x?a:v.right,M=!c&&_&&w?s:y.left,N=c?p(t,i,"after"):a),u(L,v.top,T-L,v.bottom),v.bottom<y.top&&u(s,v.bottom,null,y.top),u(M,y.top,N-M,y.bottom)}(!o||cn(v,o)<0)&&(o=v),cn(y,o)<0&&(o=y),(!l||cn(v,l)<0)&&(l=v),cn(y,l)<0&&(l=y)}),{start:o,end:l}}var h=t.from(),d=t.to();if(h.line==d.line)f(h.line,h.ch,d.ch);else{var p=se(i,h.line),g=se(i,d.line),m=Ie(p)==Ie(g),v=f(h.line,h.ch,m?p.text.length+1:null).end,y=f(d.line,m?0:null,d.ch).start;m&&(v.top<y.top-2?(u(v.right,v.top,null,v.bottom),u(s,y.top,y.left,y.bottom)):u(v.right,v.top,y.left-v.right,v.bottom)),v.bottom<y.top&&u(s,v.bottom,null,y.top)}r.appendChild(o)}function fn(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function hn(e){e.state.focused||(e.display.input.focus(),pn(e))}function dn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,gn(e))},100)}function pn(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(rt(e,"focus",e,t),e.state.focused=!0,W(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),a&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),fn(e))}function gn(e,t){e.state.delayingBlurEvent||(e.state.focused&&(rt(e,"blur",e,t),e.state.focused=!1,S(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function mn(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var i=t.view[n],o=void 0;if(!i.hidden){if(l&&s<8){var a=i.node.offsetTop+i.node.offsetHeight;o=a-r,r=a}else{var c=i.node.getBoundingClientRect();o=c.bottom-c.top}var u=i.line.height-o;if(o<2&&(o=Zr(t)),(u>.005||u<-.005)&&(ue(i.line,o),vn(i.line),i.rest))for(var f=0;f<i.rest.length;f++)vn(i.rest[f])}}}function vn(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var r=e.widgets[t],n=r.node.parentNode;n&&(r.height=n.offsetHeight)}}function yn(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-br(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=he(t,n),l=he(t,i);if(r&&r.ensure){var s=r.ensure.from.line,a=r.ensure.to.line;s<o?(o=s,l=he(t,Ge(se(t,s))+e.wrapper.clientHeight)):Math.min(a,t.lastLine())>=l&&(o=he(t,Ge(se(t,a))-e.wrapper.clientHeight),l=a)}return{from:o,to:Math.max(l,o+1)}}function bn(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=en(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",l=0;l<r.length;l++)if(!r[l].hidden){e.options.fixedGutter&&(r[l].gutter&&(r[l].gutter.style.left=o),r[l].gutterBackground&&(r[l].gutterBackground.style.left=o));var s=r[l].alignable;if(s)for(var a=0;a<s.length;a++)s[a].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function _n(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=pe(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild(M("div",[M("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,l=i.offsetWidth-o;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-l)+1,n.lineNumWidth=n.lineNumInnerWidth+l,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",oi(e),!0}return!1}function xn(e,t){var r=e.display,n=Zr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:r.scroller.scrollTop,o=Cr(e),l={};t.bottom-t.top>o&&(t.bottom=t.top+o);var s=e.doc.height+_r(r),a=t.top<n,c=t.bottom>s-n;if(t.top<i)l.scrollTop=a?0:t.top;else if(t.bottom>i+o){var u=Math.min(t.top,(c?s:t.bottom)-o);u!=i&&(l.scrollTop=u)}var f=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:r.scroller.scrollLeft,h=kr(e)-(e.options.fixedGutter?r.gutters.offsetWidth:0),d=t.right-t.left>h;return d&&(t.right=t.left+h),t.left<10?l.scrollLeft=0:t.left<f?l.scrollLeft=Math.max(0,t.left-(d?0:10)):t.right>h+f-3&&(l.scrollLeft=t.right+(d?0:10)-h),l}function wn(e,t){null!=t&&(Sn(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function kn(e){Sn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Cn(e,t,r){null==t&&null==r||Sn(e),null!=t&&(e.curOp.scrollLeft=t),null!=r&&(e.curOp.scrollTop=r)}function Sn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;Ln(e,jr(e,t.from),jr(e,t.to),t.margin)}}function Ln(e,t,r,n){var i=xn(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});Cn(e,i.scrollLeft,i.scrollTop)}function Tn(e,t){Math.abs(e.doc.scrollTop-t)<2||(r||ii(e,{top:t}),Mn(e,t,!0),r&&ii(e),Jn(e,100))}function Mn(e,t,r){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),(e.display.scroller.scrollTop!=t||r)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Nn(e,t,r,n){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n||(e.doc.scrollLeft=t,bn(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function An(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+_r(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+wr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var On=function(e,t,r){this.cm=r;var n=this.vert=M("div",[M("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=M("div",[M("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(n),e(i),Je(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Je(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,l&&s<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};On.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},On.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},On.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},On.prototype.zeroWidthHack=function(){var e=y&&!d?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new H,this.disableVert=new H},On.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto";t.set(1e3,function n(){var i=e.getBoundingClientRect();("vert"==r?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1))!=e?e.style.pointerEvents="none":t.set(1e3,n)})},On.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Dn=function(){};Dn.prototype.update=function(){return{bottom:0,right:0}},Dn.prototype.setScrollLeft=function(){},Dn.prototype.setScrollTop=function(){},Dn.prototype.clear=function(){};function Wn(e,t){t||(t=An(e));var r=e.display.barWidth,n=e.display.barHeight;Pn(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&mn(e),Pn(e,An(e)),r=e.display.barWidth,n=e.display.barHeight}function Pn(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}var zn={native:On,null:Dn};function qn(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&S(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new zn[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Je(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,r){"horizontal"==r?Nn(e,t):Tn(e,t)},e),e.display.scrollbars.addClass&&W(e.display.wrapper,e.display.scrollbars.addClass)}var Fn=0;function En(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Fn},t=e.curOp,rr?rr.ops.push(t):t.ownsGroup=rr={ops:[t],delayedCallbacks:[]};var t}function Hn(e){!function(e,t){var r=e.ownsGroup;if(r)try{!function(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var i=e.ops[n];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(r<t.length)}(r)}finally{rr=null,t(r)}}(e.curOp,function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;!function(e){for(var t=e.ops,r=0;r<t.length;r++)In(t[r]);for(var n=0;n<t.length;n++)(i=t[n]).updatedDisplay=i.mustUpdate&&ri(i.cm,i.update);var i;for(var o=0;o<t.length;o++)Rn(t[o]);for(var l=0;l<t.length;l++)Bn(t[l]);for(var s=0;s<t.length;s++)jn(t[s])}(e)})}function In(e){var t=e.cm,r=t.display;!function(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=wr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=wr(e)+"px",t.scrollbarsClipped=!0)}(t),e.updateMaxLine&&Ve(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new ti(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Rn(e){var t=e.cm,r=t.display;e.updatedDisplay&&mn(t),e.barMeasure=An(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Lr(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+wr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-kr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function Bn(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Nn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==D();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Wn(t,e.barMeasure),e.updatedDisplay&&li(t,e.barMeasure),e.selectionChanged&&fn(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&hn(e.cm)}function jn(e){var t=e.cm,r=t.display,n=t.doc;if(e.updatedDisplay&&ni(t,e.update),null==r.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null!=e.scrollTop&&Mn(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&Nn(t,e.scrollLeft,!0,!0),e.scrollToPos){!function(e,t){if(!nt(e,"scrollCursorIntoView")){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!p){var o=M("div","​",null,"position: absolute;\n top: "+(t.top-r.viewOffset-br(e.display))+"px;\n height: "+(t.bottom-t.top+wr(e)+r.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}(t,function(e,t,r,n){null==n&&(n=0);var i;e.options.lineWrapping||t!=r||(r="before"==(t=t.ch?ge(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?ge(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var l=!1,s=Br(e,t),a=r&&r!=t?Br(e,r):s,c=xn(e,i={left:Math.min(s.left,a.left),top:Math.min(s.top,a.top)-n,right:Math.max(s.left,a.left),bottom:Math.max(s.bottom,a.bottom)+n}),u=e.doc.scrollTop,f=e.doc.scrollLeft;if(null!=c.scrollTop&&(Tn(e,c.scrollTop),Math.abs(e.doc.scrollTop-u)>1&&(l=!0)),null!=c.scrollLeft&&(Nn(e,c.scrollLeft),Math.abs(e.doc.scrollLeft-f)>1&&(l=!0)),!l)break}return i}(t,we(n,e.scrollToPos.from),we(n,e.scrollToPos.to),e.scrollToPos.margin))}var i=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(i)for(var l=0;l<i.length;++l)i[l].lines.length||rt(i[l],"hide");if(o)for(var s=0;s<o.length;++s)o[s].lines.length&&rt(o[s],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&rt(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Un(e,t){if(e.curOp)return t();En(e);try{return t()}finally{Hn(e)}}function Gn(e,t){return function(){if(e.curOp)return t.apply(e,arguments);En(e);try{return t.apply(e,arguments)}finally{Hn(e)}}}function Kn(e){return function(){if(this.curOp)return e.apply(this,arguments);En(this);try{return e.apply(this,arguments)}finally{Hn(this)}}}function Vn(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);En(t);try{return e.apply(this,arguments)}finally{Hn(t)}}}function $n(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&r<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Se&&Re(e.doc,t)<i.viewTo&&Yn(e);else if(r<=i.viewFrom)Se&&Be(e.doc,r+n)>i.viewFrom?Yn(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)Yn(e);else if(t<=i.viewFrom){var o=Zn(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):Yn(e)}else if(r>=i.viewTo){var l=Zn(e,t,t,-1);l?(i.view=i.view.slice(0,l.index),i.viewTo=l.lineN):Yn(e)}else{var s=Zn(e,t,t,-1),a=Zn(e,r,r+n,1);s&&a?(i.view=i.view.slice(0,s.index).concat(tr(e,s.lineN,a.lineN)).concat(i.view.slice(a.index)),i.viewTo+=n):Yn(e)}var c=i.externalMeasured;c&&(r<c.lineN?c.lineN+=n:t<c.lineN+c.size&&(i.externalMeasured=null))}function Xn(e,t,r){e.curOp.viewChanged=!0;var n=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var o=n.view[on(e,t)];if(null!=o.node){var l=o.changes||(o.changes=[]);-1==I(l,r)&&l.push(r)}}}function Yn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Zn(e,t,r,n){var i,o=on(e,t),l=e.display.view;if(!Se||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var s=e.display.viewFrom,a=0;a<o;a++)s+=l[a].size;if(s!=t){if(n>0){if(o==l.length-1)return null;i=s+l[o].size-t,o++}else i=s-t;t+=i,r+=i}for(;Re(e.doc,r)!=r;){if(o==(n<0?0:l.length-1))return null;r+=n*l[o-(n<0?1:0)].size,o+=n}return{index:o,lineN:r}}function Qn(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var i=t[n];i.hidden||i.node&&!i.changes||++r}return r}function Jn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,q(ei,e))}function ei(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var r=+new Date+e.options.workTime,n=qt(e,t.highlightFrontier),i=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(n.line>=e.display.viewFrom){var l=o.styles,s=o.text.length>e.options.maxHighlightLength?Mt(t.mode,n.state):null,a=Pt(e,o,n,!0);s&&(n.state=s),o.styles=a.styles;var c=o.styleClasses,u=a.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var f=!l||l.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),h=0;!f&&h<l.length;++h)f=l[h]!=o.styles[h];f&&i.push(n.line),o.stateAfter=n.save(),n.nextLine()}else o.text.length<=e.options.maxHighlightLength&&Ft(e,o.text,n),o.stateAfter=n.line%5==0?n.save():null,n.nextLine();if(+new Date>r)return Jn(e,e.options.workDelay),!0}),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),i.length&&Un(e,function(){for(var t=0;t<i.length;t++)Xn(e,i[t],"text")})}}var ti=function(e,t,r){var n=e.display;this.viewport=t,this.visible=yn(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=kr(e),this.force=r,this.dims=Jr(e),this.events=[]};ti.prototype.signal=function(e,t){ot(e,t)&&this.events.push(arguments)},ti.prototype.finish=function(){for(var e=0;e<this.events.length;e++)rt.apply(null,this.events[e])};function ri(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return Yn(e),!1;if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==Qn(e))return!1;_n(e)&&(Yn(e),t.dims=Jr(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),l=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFrom<o&&o-r.viewFrom<20&&(o=Math.max(n.first,r.viewFrom)),r.viewTo>l&&r.viewTo-l<20&&(l=Math.min(i,r.viewTo)),Se&&(o=Re(e.doc,o),l=Be(e.doc,l));var s=o!=r.viewFrom||l!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;!function(e,t,r){var n=e.display;0==n.view.length||t>=n.viewTo||r<=n.viewFrom?(n.view=tr(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=tr(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(on(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(tr(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,on(e,r)))),n.viewTo=r}(e,o,l),r.viewOffset=Ge(se(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var c=Qn(e);if(!s&&0==c&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var u=function(e){if(e.hasFocus())return null;var t=D();if(!t||!O(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&O(e.display.lineDiv,n.anchorNode)&&(r.anchorNode=n.anchorNode,r.anchorOffset=n.anchorOffset,r.focusNode=n.focusNode,r.focusOffset=n.focusOffset)}return r}(e);return c>4&&(r.lineDiv.style.display="none"),function(e,t,r){var n=e.display,i=e.options.lineNumbers,o=n.lineDiv,l=o.firstChild;function s(t){var r=t.nextSibling;return a&&y&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var c=n.view,u=n.viewFrom,f=0;f<c.length;f++){var h=c[f];if(h.hidden);else if(h.node&&h.node.parentNode==o){for(;l!=h.node;)l=s(l);var d=i&&null!=t&&t<=u&&h.lineNumber;h.changes&&(I(h.changes,"gutter")>-1&&(d=!1),lr(e,h,u,r)),d&&(L(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(pe(e.options,u)))),l=h.node.nextSibling}else{var p=dr(e,h,u,r);o.insertBefore(p,l)}u+=h.size}for(;l;)l=s(l)}(e,r.updateLineNumbers,t.dims),c>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,function(e){if(e&&e.activeElt&&e.activeElt!=D()&&(e.activeElt.focus(),e.anchorNode&&O(document.body,e.anchorNode)&&O(document.body,e.focusNode))){var t=window.getSelection(),r=document.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),t.removeAllRanges(),t.addRange(r),t.extend(e.focusNode,e.focusOffset)}}(u),L(r.cursorDiv),L(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,s&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Jn(e,400)),r.updateLineNumbers=null,!0}function ni(e,t){for(var r=t.viewport,n=!0;(n&&e.options.lineWrapping&&t.oldDisplayWidth!=kr(e)||(r&&null!=r.top&&(r={top:Math.min(e.doc.height+_r(e.display)-Cr(e),r.top)}),t.visible=yn(e.display,e.doc,r),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&ri(e,t);n=!1){mn(e);var i=An(e);ln(e),Wn(e,i),li(e,i),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function ii(e,t){var r=new ti(e,t);if(ri(e,r)){mn(e),ni(e,r);var n=An(e);ln(e),Wn(e,n),li(e,n),r.finish()}}function oi(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function li(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+wr(e)+"px"}function si(e){var t=e.display.gutters,r=e.options.gutters;L(t);for(var n=0;n<r.length;++n){var i=r[n],o=t.appendChild(M("div",null,"CodeMirror-gutter "+i));"CodeMirror-linenumbers"==i&&(e.display.lineGutter=o,o.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=n?"":"none",oi(e)}function ai(e){var t=I(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}var ci=0,ui=null;l?ui=-.53:r?ui=15:u?ui=-.7:h&&(ui=-1/3);function fi(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta),{x:t,y:r}}function hi(e){var t=fi(e);return t.x*=ui,t.y*=ui,t}function di(e,t){var n=fi(t),i=n.x,o=n.y,l=e.display,s=l.scroller,c=s.scrollWidth>s.clientWidth,u=s.scrollHeight>s.clientHeight;if(i&&c||o&&u){if(o&&y&&a)e:for(var h=t.target,d=l.view;h!=s;h=h.parentNode)for(var p=0;p<d.length;p++)if(d[p].node==h){e.display.currentWheelTarget=h;break e}if(i&&!r&&!f&&null!=ui)return o&&u&&Tn(e,Math.max(0,s.scrollTop+o*ui)),Nn(e,Math.max(0,s.scrollLeft+i*ui)),(!o||o&&u)&&st(t),void(l.wheelStartX=null);if(o&&null!=ui){var g=o*ui,m=e.doc.scrollTop,v=m+l.wrapper.clientHeight;g<0?m=Math.max(0,m+g-50):v=Math.min(e.doc.height,v+g+50),ii(e,{top:m,bottom:v})}ci<20&&(null==l.wheelStartX?(l.wheelStartX=s.scrollLeft,l.wheelStartY=s.scrollTop,l.wheelDX=i,l.wheelDY=o,setTimeout(function(){if(null!=l.wheelStartX){var e=s.scrollLeft-l.wheelStartX,t=s.scrollTop-l.wheelStartY,r=t&&l.wheelDY&&t/l.wheelDY||e&&l.wheelDX&&e/l.wheelDX;l.wheelStartX=l.wheelStartY=null,r&&(ui=(ui*ci+r)/(ci+1),++ci)}},200)):(l.wheelDX+=i,l.wheelDY+=o))}}var pi=function(e,t){this.ranges=e,this.primIndex=t};pi.prototype.primary=function(){return this.ranges[this.primIndex]},pi.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var r=this.ranges[t],n=e.ranges[t];if(!ve(r.anchor,n.anchor)||!ve(r.head,n.head))return!1}return!0},pi.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new gi(ye(this.ranges[t].anchor),ye(this.ranges[t].head));return new pi(e,this.primIndex)},pi.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},pi.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(me(t,n.from())>=0&&me(e,n.to())<=0)return r}return-1};var gi=function(e,t){this.anchor=e,this.head=t};gi.prototype.from=function(){return _e(this.anchor,this.head)},gi.prototype.to=function(){return be(this.anchor,this.head)},gi.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function mi(e,t){var r=e[t];e.sort(function(e,t){return me(e.from(),t.from())}),t=I(e,r);for(var n=1;n<e.length;n++){var i=e[n],o=e[n-1];if(me(o.to(),i.from())>=0){var l=_e(o.from(),i.from()),s=be(o.to(),i.to()),a=o.empty()?i.from()==i.head:o.from()==o.head;n<=t&&--t,e.splice(--n,2,new gi(a?s:l,a?l:s))}}return new pi(e,t)}function vi(e,t){return new pi([new gi(e,t||e)],0)}function yi(e){return e.text?ge(e.from.line+e.text.length-1,X(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function bi(e,t){if(me(e,t.from)<0)return e;if(me(e,t.to)<=0)return yi(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=yi(t).ch-t.to.ch),ge(r,n)}function _i(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new gi(bi(i.anchor,t),bi(i.head,t)))}return mi(r,e.sel.primIndex)}function xi(e,t,r){return e.line==t.line?ge(r.line,e.ch-t.ch+r.ch):ge(r.line+(e.line-t.line),e.ch)}function wi(e){e.doc.mode=St(e.options,e.doc.modeOption),ki(e)}function ki(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,Jn(e,100),e.state.modeGen++,e.curOp&&$n(e)}function Ci(e,t){return 0==t.from.ch&&0==t.to.ch&&""==X(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Si(e,t,r,n){function i(e){return r?r[e]:null}function o(e,r,i){!function(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Oe(e),De(e,r);var i=n?n(e):1;i!=e.height&&ue(e,i)}(e,r,i,n),ir(e,"change",e,t)}function l(e,t){for(var r=[],o=e;o<t;++o)r.push(new Ut(c[o],i(o),n));return r}var s=t.from,a=t.to,c=t.text,u=se(e,s.line),f=se(e,a.line),h=X(c),d=i(c.length-1),p=a.line-s.line;if(t.full)e.insert(0,l(0,c.length)),e.remove(c.length,e.size-c.length);else if(Ci(e,t)){var g=l(0,c.length-1);o(f,f.text,d),p&&e.remove(s.line,p),g.length&&e.insert(s.line,g)}else if(u==f)if(1==c.length)o(u,u.text.slice(0,s.ch)+h+u.text.slice(a.ch),d);else{var m=l(1,c.length-1);m.push(new Ut(h+u.text.slice(a.ch),d,n)),o(u,u.text.slice(0,s.ch)+c[0],i(0)),e.insert(s.line+1,m)}else if(1==c.length)o(u,u.text.slice(0,s.ch)+c[0]+f.text.slice(a.ch),i(0)),e.remove(s.line+1,p);else{o(u,u.text.slice(0,s.ch)+c[0],i(0)),o(f,h+f.text.slice(a.ch),d);var v=l(1,c.length-1);p>1&&e.remove(s.line+1,p-1),e.insert(s.line+1,v)}ir(e,"change",e,t)}function Li(e,t,r){!function e(n,i,o){if(n.linked)for(var l=0;l<n.linked.length;++l){var s=n.linked[l];if(s.doc!=i){var a=o&&s.sharedHist;r&&!a||(t(s.doc,a),e(s.doc,n,a))}}}(e,null,!0)}function Ti(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,rn(e),wi(e),Mi(e),e.options.lineWrapping||Ve(e),e.options.mode=t.modeOption,$n(e)}function Mi(e){("rtl"==e.doc.direction?W:S)(e.display.lineDiv,"CodeMirror-rtl")}function Ni(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ai(e,t){var r={from:ye(t.from),to:yi(t),text:ae(e,t.from,t.to)};return zi(e,r,t.from.line,t.to.line+1),Li(e,function(e){return zi(e,r,t.from.line,t.to.line+1)},!0),r}function Oi(e){for(;e.length;){if(!X(e).ranges)break;e.pop()}}function Di(e,t,r,n){var i=e.history;i.undone.length=0;var o,l,s=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>s-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(c=i,u=i.lastOp==n,o=u?(Oi(c.done),X(c.done)):c.done.length&&!X(c.done).ranges?X(c.done):c.done.length>1&&!c.done[c.done.length-2].ranges?(c.done.pop(),X(c.done)):void 0))l=X(o.changes),0==me(t.from,t.to)&&0==me(t.from,l.to)?l.to=yi(t):o.changes.push(Ai(e,t));else{var a=X(i.done);for(a&&a.ranges||Pi(e.sel,i.done),o={changes:[Ai(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}var c,u;i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=s,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,l||rt(e,"historyAdded")}function Wi(e,t,r,n){var i=e.history,o=n&&n.origin;r==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||function(e,t,r,n){var i=t.charAt(0);return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,o,X(i.done),t))?i.done[i.done.length-1]=t:Pi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r,n&&!1!==n.clearRedo&&Oi(i.undone)}function Pi(e,t){var r=X(t);r&&r.ranges&&r.equals(e)||t.push(e)}function zi(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o})}function qi(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function Fi(e,t){var r=function(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=[],i=0;i<t.text.length;++i)n.push(qi(r[i]));return n}(e,t),n=Ne(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],l=n[i];if(o&&l)e:for(var s=0;s<l.length;++s){for(var a=l[s],c=0;c<o.length;++c)if(o[c].marker==a.marker)continue e;o.push(a)}else l&&(r[i]=l)}return r}function Ei(e,t,r){for(var n=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)n.push(r?pi.prototype.deepCopy.call(o):o);else{var l=o.changes,s=[];n.push({changes:s});for(var a=0;a<l.length;++a){var c=l[a],u=void 0;if(s.push({from:c.from,to:c.to,text:c.text}),t)for(var f in c)(u=f.match(/^spans_(\d+)$/))&&I(t,Number(u[1]))>-1&&(X(s)[f]=c[f],delete c[f])}}}return n}function Hi(e,t,r,n){if(n){var i=e.anchor;if(r){var o=me(t,i)<0;o!=me(r,i)<0?(i=t,t=r):o!=me(t,r)<0&&(t=r)}return new gi(i,t)}return new gi(r||t,t)}function Ii(e,t,r,n,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Gi(e,new pi([Hi(e.sel.primary(),t,r,i)],0),n)}function Ri(e,t,r){for(var n=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)n[o]=Hi(e.sel.ranges[o],t[o],null,i);Gi(e,mi(n,e.sel.primIndex),r)}function Bi(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,Gi(e,mi(i,e.sel.primIndex),n)}function ji(e,t,r,n){Gi(e,vi(t,r),n)}function Ui(e,t,r){var n=e.history.done,i=X(n);i&&i.ranges?(n[n.length-1]=t,Ki(e,t,r)):Gi(e,t,r)}function Gi(e,t,r){Ki(e,t,r),Wi(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function Ki(e,t,r){(ot(e,"beforeSelectionChange")||e.cm&&ot(e.cm,"beforeSelectionChange"))&&(t=function(e,t,r){var n={ranges:t.ranges,update:function(t){this.ranges=[];for(var r=0;r<t.length;r++)this.ranges[r]=new gi(we(e,t[r].anchor),we(e,t[r].head))},origin:r&&r.origin};return rt(e,"beforeSelectionChange",e,n),e.cm&&rt(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?mi(n.ranges,n.ranges.length-1):t}(e,t,r));Vi(e,Xi(e,t,r&&r.bias||(me(t.primary().head,e.sel.primary().head)<0?-1:1),!0)),r&&!1===r.scroll||!e.cm||kn(e.cm)}function Vi(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,it(e.cm)),ir(e,"cursorActivity",e))}function $i(e){Vi(e,Xi(e,e.sel,null,!1))}function Xi(e,t,r,n){for(var i,o=0;o<t.ranges.length;o++){var l=t.ranges[o],s=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],a=Zi(e,l.anchor,s&&s.anchor,r,n),c=Zi(e,l.head,s&&s.head,r,n);(i||a!=l.anchor||c!=l.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new gi(a,c))}return i?mi(i,t.primIndex):t}function Yi(e,t,r,n,i){var o=se(e,t.line);if(o.markedSpans)for(var l=0;l<o.markedSpans.length;++l){var s=o.markedSpans[l],a=s.marker;if((null==s.from||(a.inclusiveLeft?s.from<=t.ch:s.from<t.ch))&&(null==s.to||(a.inclusiveRight?s.to>=t.ch:s.to>t.ch))){if(i&&(rt(a,"beforeCursorEnter"),a.explicitlyCleared)){if(o.markedSpans){--l;continue}break}if(!a.atomic)continue;if(r){var c=a.find(n<0?1:-1),u=void 0;if((n<0?a.inclusiveRight:a.inclusiveLeft)&&(c=Qi(e,c,-n,c&&c.line==t.line?o:null)),c&&c.line==t.line&&(u=me(c,r))&&(n<0?u<0:u>0))return Yi(e,c,t,n,i)}var f=a.find(n<0?-1:1);return(n<0?a.inclusiveLeft:a.inclusiveRight)&&(f=Qi(e,f,n,f.line==t.line?o:null)),f?Yi(e,f,t,n,i):null}}return t}function Zi(e,t,r,n,i){var o=n||1,l=Yi(e,t,r,o,i)||!i&&Yi(e,t,r,o,!0)||Yi(e,t,r,-o,i)||!i&&Yi(e,t,r,-o,!0);return l||(e.cantEdit=!0,ge(e.first,0))}function Qi(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?we(e,ge(t.line-1)):null:r>0&&t.ch==(n||se(e,t.line)).text.length?t.line<e.first+e.size-1?ge(t.line+1,0):null:new ge(t.line,t.ch+r)}function Ji(e){e.setSelection(ge(e.firstLine(),0),ge(e.lastLine()),j)}function eo(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return n.canceled=!0}};return r&&(n.update=function(t,r,i,o){t&&(n.from=we(e,t)),r&&(n.to=we(e,r)),i&&(n.text=i),void 0!==o&&(n.origin=o)}),rt(e,"beforeChange",e,n),e.cm&&rt(e.cm,"beforeChange",e.cm,n),n.canceled?null:{from:n.from,to:n.to,text:n.text,origin:n.origin}}function to(e,t,r){if(e.cm){if(!e.cm.curOp)return Gn(e.cm,to)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(ot(e,"beforeChange")||e.cm&&ot(e.cm,"beforeChange"))||(t=eo(e,t,!0))){var n=Ce&&!r&&function(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&-1!=I(n,r)||(n||(n=[])).push(r)}}),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var l=n[o],s=l.find(0),a=0;a<i.length;++a){var c=i[a];if(!(me(c.to,s.from)<0||me(c.from,s.to)>0)){var u=[a,1],f=me(c.from,s.from),h=me(c.to,s.to);(f<0||!l.inclusiveLeft&&!f)&&u.push({from:c.from,to:s.from}),(h>0||!l.inclusiveRight&&!h)&&u.push({from:s.to,to:c.to}),i.splice.apply(i,u),a+=u.length-3}}return i}(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)ro(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text,origin:t.origin});else ro(e,t)}}function ro(e,t){if(1!=t.text.length||""!=t.text[0]||0!=me(t.from,t.to)){var r=_i(e,t);Di(e,t,r,e.cm?e.cm.curOp.id:NaN),oo(e,t,r,Ne(e,t));var n=[];Li(e,function(e,r){r||-1!=I(n,e.history)||(co(e.history,t),n.push(e.history)),oo(e,t,null,Ne(e,t))})}}function no(e,t,r){if(!e.cm||!e.cm.state.suppressEdits||r){for(var n,i=e.history,o=e.sel,l="undo"==t?i.done:i.undone,s="undo"==t?i.undone:i.done,a=0;a<l.length&&(n=l[a],r?!n.ranges||n.equals(e.sel):n.ranges);a++);if(a!=l.length){for(i.lastOrigin=i.lastSelOrigin=null;(n=l.pop()).ranges;){if(Pi(n,s),r&&!n.equals(e.sel))return void Gi(e,n,{clearRedo:!1});o=n}var c=[];Pi(o,s),s.push({changes:c,generation:i.generation}),i.generation=n.generation||++i.maxGeneration;for(var u=ot(e,"beforeChange")||e.cm&&ot(e.cm,"beforeChange"),f=function(r){var i=n.changes[r];if(i.origin=t,u&&!eo(e,i,!1))return l.length=0,{};c.push(Ai(e,i));var o=r?_i(e,i):X(l);oo(e,i,o,Fi(e,i)),!r&&e.cm&&e.cm.scrollIntoView({from:i.from,to:yi(i)});var s=[];Li(e,function(e,t){t||-1!=I(s,e.history)||(co(e.history,i),s.push(e.history)),oo(e,i,null,Fi(e,i))})},h=n.changes.length-1;h>=0;--h){var d=f(h);if(d)return d.v}}}}function io(e,t){if(0!=t&&(e.first+=t,e.sel=new pi(Y(e.sel.ranges,function(e){return new gi(ge(e.anchor.line+t,e.anchor.ch),ge(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){$n(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)Xn(e.cm,n,"gutter")}}function oo(e,t,r,n){if(e.cm&&!e.cm.curOp)return Gn(e.cm,oo)(e,t,r,n);if(t.to.line<e.first)io(e,t.text.length-1-(t.to.line-t.from.line));else if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);io(e,i),t={from:ge(e.first,0),to:ge(t.to.line+i,t.to.ch),text:[X(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:ge(o,se(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=ae(e,t.from,t.to),r||(r=_i(e,t)),e.cm?function(e,t,r){var n=e.doc,i=e.display,o=t.from,l=t.to,s=!1,a=o.line;e.options.lineWrapping||(a=fe(Ie(se(n,o.line))),n.iter(a,l.line+1,function(e){if(e==i.maxLine)return s=!0,!0}));n.sel.contains(t.from,t.to)>-1&&it(e);Si(n,t,r,tn(e)),e.options.lineWrapping||(n.iter(a,o.line+t.text.length,function(e){var t=Ke(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0));(function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var r=e.first,n=t-1;n>r;n--){var i=se(e,n).stateAfter;if(i&&(!(i instanceof Dt)||n+i.lookAhead<t)){r=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}})(n,o.line),Jn(e,400);var c=t.text.length-(l.line-o.line)-1;t.full?$n(e):o.line!=l.line||1!=t.text.length||Ci(e.doc,t)?$n(e,o.line,l.line+1,c):Xn(e,o.line,"text");var u=ot(e,"changes"),f=ot(e,"change");if(f||u){var h={from:o,to:l,text:t.text,removed:t.removed,origin:t.origin};f&&ir(e,"change",e,h),u&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(h)}e.display.selForContextMenu=null}(e.cm,t,n):Si(e,t,n),Ki(e,r,j)}}function lo(e,t,r,n,i){if(n||(n=r),me(n,r)<0){var o;r=(o=[n,r])[0],n=o[1]}"string"==typeof t&&(t=e.splitLines(t)),to(e,{from:r,to:n,text:t,origin:i})}function so(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function ao(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],l=!0;if(o.ranges){o.copied||((o=e[i]=o.deepCopy()).copied=!0);for(var s=0;s<o.ranges.length;s++)so(o.ranges[s].anchor,t,r,n),so(o.ranges[s].head,t,r,n)}else{for(var a=0;a<o.changes.length;++a){var c=o.changes[a];if(r<c.from.line)c.from=ge(c.from.line+n,c.from.ch),c.to=ge(c.to.line+n,c.to.ch);else if(t<=c.to.line){l=!1;break}}l||(e.splice(0,i+1),i=0)}}}function co(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;ao(e.done,r,n,i),ao(e.undone,r,n,i)}function uo(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=se(e,xe(e,t)):i=fe(t),null==i?null:(n(o,i)&&e.cm&&Xn(e.cm,i,r),o)}function fo(e){this.lines=e,this.parent=null;for(var t=0,r=0;r<e.length;++r)e[r].parent=this,t+=e[r].height;this.height=t}fo.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,n=e+t;r<n;++r){var i=this.lines[r];this.height-=i.height,(o=i).parent=null,Oe(o),ir(i,"delete")}var o;this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;e<n;++e)if(r(this.lines[e]))return!0}};function ho(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var i=e[n];t+=i.chunkSize(),r+=i.height,i.parent=this}this.size=t,this.height=r,this.parent=null}ho.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],i=n.chunkSize();if(e<i){var o=Math.min(t,i-e),l=n.height;if(n.removeInner(e,o),this.height-=l-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof fo))){var s=[];this.collapse(s),this.children=[new fo(s)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<=o){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(var l=i.lines.length%25+25,s=l;s<i.lines.length;){var a=new fo(i.lines.slice(s,s+=25));i.height-=a.height,this.children.splice(++n,0,a),a.parent=this}i.lines=i.lines.slice(0,l),this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=new ho(e.children.splice(e.children.length-5,5));if(e.parent){e.size-=t.size,e.height-=t.height;var r=I(e.parent.children,e);e.parent.children.splice(r+1,0,t)}else{var n=new ho(e.children);n.parent=e,e.children=[n,t],e=n}t.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<o){var l=Math.min(t,o-e);if(i.iterN(e,l,r))return!0;if(0==(t-=l))break;e=0}else e-=o}}};var po=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t};po.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=fe(r);if(null!=n&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(r.widgets=null);var o=vr(this);ue(r,Math.max(0,r.height-o)),e&&(Un(e,function(){go(e,r,-o),Xn(e,n,"widget")}),ir(e,"lineWidgetCleared",e,this,n))}},po.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line;this.height=null;var i=vr(this)-t;i&&(ue(n,n.height+i),r&&Un(r,function(){r.curOp.forceUpdate=!0,go(r,n,i),ir(r,"lineWidgetChanged",r,e,fe(n))}))},lt(po);function go(e,t,r){Ge(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&wn(e,r)}var mo=0,vo=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++mo};vo.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&En(e),ot(this,"clear")){var r=this.find();r&&ir(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;o<this.lines.length;++o){var l=this.lines[o],s=Te(l.markedSpans,this);e&&!this.collapsed?Xn(e,fe(l),"text"):e&&(null!=s.to&&(i=fe(l)),null!=s.from&&(n=fe(l))),l.markedSpans=Me(l.markedSpans,s),null==s.from&&this.collapsed&&!je(this.doc,l)&&e&&ue(l,Zr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var a=0;a<this.lines.length;++a){var c=Ie(this.lines[a]),u=Ke(c);u>e.display.maxLineLength&&(e.display.maxLine=c,e.display.maxLineLength=u,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&$n(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&$i(e.doc)),e&&ir(e,"markerCleared",e,this,n,i),t&&Hn(e),this.parent&&this.parent.clear()}},vo.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var r,n,i=0;i<this.lines.length;++i){var o=this.lines[i],l=Te(o.markedSpans,this);if(null!=l.from&&(r=ge(t?o:fe(o),l.from),-1==e))return r;if(null!=l.to&&(n=ge(t?o:fe(o),l.to),1==e))return n}return r&&{from:r,to:n}},vo.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,n=this.doc.cm;t&&n&&Un(n,function(){var i=t.line,o=fe(t.line),l=Tr(n,o);if(l&&(Wr(l),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!je(r.doc,i)&&null!=r.height){var s=r.height;r.height=null;var a=vr(r)-s;a&&ue(i,i.height+a)}ir(n,"markerChanged",n,e)})},vo.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=I(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},vo.prototype.detachLine=function(e){if(this.lines.splice(I(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},lt(vo);function yo(e,t,r,n,i){if(n&&n.shared)return function(e,t,r,n,i){(n=F(n)).shared=!1;var o=[yo(e,t,r,n,i)],l=o[0],s=n.widgetNode;return Li(e,function(e){s&&(n.widgetNode=s.cloneNode(!0)),o.push(yo(e,we(e,t),we(e,r),n,i));for(var a=0;a<e.linked.length;++a)if(e.linked[a].isParent)return;l=X(o)}),new bo(o,l)}(e,t,r,n,i);if(e.cm&&!e.cm.curOp)return Gn(e.cm,yo)(e,t,r,n,i);var o=new vo(e,i),l=me(t,r);if(n&&F(n,o,!1),l>0||0==l&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=N("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(He(e,t.line,t,r,o)||t.line!=r.line&&He(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Se=!0}o.addToHistory&&Di(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var s,a=t.line,c=e.cm;if(e.iter(a,r.line+1,function(e){c&&o.collapsed&&!c.options.lineWrapping&&Ie(e)==c.display.maxLine&&(s=!0),o.collapsed&&a!=t.line&&ue(e,0),n=e,i=new Le(o,a==t.line?t.ch:null,a==r.line?r.ch:null),n.markedSpans=n.markedSpans?n.markedSpans.concat([i]):[i],i.marker.attachLine(n);var n,i;++a}),o.collapsed&&e.iter(t.line,r.line+1,function(t){je(e,t)&&ue(t,0)}),o.clearOnEnter&&Je(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(Ce=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++mo,o.atomic=!0),c){if(s&&(c.curOp.updateMaxLine=!0),o.collapsed)$n(c,t.line,r.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var u=t.line;u<=r.line;u++)Xn(c,u,"text");o.atomic&&$i(c.doc),ir(c,"markerAdded",c,o)}return o}var bo=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};bo.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();ir(this,"clear")}},bo.prototype.find=function(e,t){return this.primary.find(e,t)},lt(bo);function _o(e){return e.findMarks(ge(e.first,0),e.clipPos(ge(e.lastLine())),function(e){return e.parent})}function xo(e){for(var t=function(t){var r=e[t],n=[r.primary.doc];Li(r.primary.doc,function(e){return n.push(e)});for(var i=0;i<r.markers.length;i++){var o=r.markers[i];-1==I(n,o.doc)&&(o.parent=null,r.markers.splice(i--,1))}},r=0;r<e.length;r++)t(r)}var wo=0,ko=function(e,t,r,n,i){if(!(this instanceof ko))return new ko(e,t,r,n,i);null==r&&(r=0),ho.call(this,[new fo([new Ut("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var o=ge(r,0);this.sel=vi(o),this.history=new Ni(null),this.id=++wo,this.modeOption=t,this.lineSep=n,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),Si(this,{from:o,to:o,text:e}),Gi(this,vi(o),j)};ko.prototype=Q(ho.prototype,{constructor:ko,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=ce(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:Vn(function(e){var t=ge(this.first,0),r=this.first+this.size-1;to(this,{from:t,to:ge(r,se(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Cn(this.cm,0,0),Gi(this,vi(t),j)}),replaceRange:function(e,t,r,n){lo(this,e,t=we(this,t),r=r?we(this,r):t,n)},getRange:function(e,t,r){var n=ae(this,we(this,e),we(this,t));return!1===r?n:n.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(de(this,e))return se(this,e)},getLineNumber:function(e){return fe(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=se(this,e)),Ie(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return we(this,e)},getCursor:function(e){var t=this.sel.primary();return null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Vn(function(e,t,r){ji(this,we(this,"number"==typeof e?ge(e,t||0):e),null,r)}),setSelection:Vn(function(e,t,r){ji(this,we(this,e),we(this,t||e),r)}),extendSelection:Vn(function(e,t,r){Ii(this,we(this,e),t&&we(this,t),r)}),extendSelections:Vn(function(e,t){Ri(this,ke(this,e),t)}),extendSelectionsBy:Vn(function(e,t){Ri(this,ke(this,Y(this.sel.ranges,e)),t)}),setSelections:Vn(function(e,t,r){if(e.length){for(var n=[],i=0;i<e.length;i++)n[i]=new gi(we(this,e[i].anchor),we(this,e[i].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Gi(this,mi(n,t),r)}}),addSelection:Vn(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new gi(we(this,e),we(this,t||e))),Gi(this,mi(n,n.length-1),r)}),getSelection:function(e){for(var t,r=this.sel.ranges,n=0;n<r.length;n++){var i=ae(this,r[n].from(),r[n].to());t=t?t.concat(i):i}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var i=ae(this,r[n].from(),r[n].to());!1!==e&&(i=i.join(e||this.lineSeparator())),t[n]=i}return t},replaceSelection:function(e,t,r){for(var n=[],i=0;i<this.sel.ranges.length;i++)n[i]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:Vn(function(e,t,r){for(var n=[],i=this.sel,o=0;o<i.ranges.length;o++){var l=i.ranges[o];n[o]={from:l.from(),to:l.to(),text:this.splitLines(e[o]),origin:r}}for(var s=t&&"end"!=t&&function(e,t,r){for(var n=[],i=ge(e.first,0),o=i,l=0;l<t.length;l++){var s=t[l],a=xi(s.from,i,o),c=xi(yi(s),i,o);if(i=s.to,o=c,"around"==r){var u=e.sel.ranges[l],f=me(u.head,u.anchor)<0;n[l]=new gi(f?c:a,f?a:c)}else n[l]=new gi(a,a)}return new pi(n,e.sel.primIndex)}(this,n,t),a=n.length-1;a>=0;a--)to(this,n[a]);s?Ui(this,s):this.cm&&kn(this.cm)}),undo:Vn(function(){no(this,"undo")}),redo:Vn(function(){no(this,"redo")}),undoSelection:Vn(function(){no(this,"undo",!0)}),redoSelection:Vn(function(){no(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){this.history=new Ni(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Ei(this.history.done),undone:Ei(this.history.undone)}},setHistory:function(e){var t=this.history=new Ni(this.history.maxGeneration);t.done=Ei(e.done.slice(0),null,!0),t.undone=Ei(e.undone.slice(0),null,!0)},setGutterMarker:Vn(function(e,t,r){return uo(this,e,"gutter",function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&re(n)&&(e.gutterMarkers=null),!0})}),clearGutter:Vn(function(e){var t=this;this.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&uo(t,r,"gutter",function(){return r.gutterMarkers[e]=null,re(r.gutterMarkers)&&(r.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!de(this,e))return null;if(t=e,!(e=se(this,e)))return null}else if(null==(t=fe(e)))return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:Vn(function(e,t,r){return uo(this,e,"gutter"==t?"gutter":"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[n]){if(C(r).test(e[n]))return!1;e[n]+=" "+r}else e[n]=r;return!0})}),removeLineClass:Vn(function(e,t,r){return uo(this,e,"gutter"==t?"gutter":"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",i=e[n];if(!i)return!1;if(null==r)e[n]=null;else{var o=i.match(C(r));if(!o)return!1;var l=o.index+o[0].length;e[n]=i.slice(0,o.index)+(o.index&&l!=i.length?" ":"")+i.slice(l)||null}return!0})}),addLineWidget:Vn(function(e,t,r){return function(e,t,r,n){var i=new po(e,r,n),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),uo(e,t,"widget",function(t){var r=t.widgets||(t.widgets=[]);if(null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!je(e,t)){var n=Ge(t)<e.scrollTop;ue(t,t.height+vr(i)),n&&wn(o,i.height),o.curOp.forceUpdate=!0}return!0}),ir(o,"lineWidgetAdded",o,i,"number"==typeof t?t:fe(t)),i}(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return yo(this,we(this,e),we(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return yo(this,e=we(this,e),e,r,"bookmark")},findMarksAt:function(e){var t=[],r=se(this,(e=we(this,e)).line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=we(this,e),t=we(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var l=o.markedSpans;if(l)for(var s=0;s<l.length;s++){var a=l[s];null!=a.to&&i==e.line&&e.ch>=a.to||null==a.from&&i!=e.line||null!=a.from&&i==t.line&&a.from>=t.ch||r&&!r(a.marker)||n.push(a.marker.parent||a.marker)}++i}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)null!=r[n].from&&e.push(r[n].marker)}),e},posFromIndex:function(e){var t,r=this.first,n=this.lineSeparator().length;return this.iter(function(i){var o=i.text.length+n;if(o>e)return t=e,!0;e-=o,++r}),we(this,ge(r,t))},indexFromPos:function(e){var t=(e=we(this,e)).ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,function(e){t+=e.text.length+r}),t},copy:function(e){var t=new ko(ce(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<r&&(r=e.to);var n=new ko(ce(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),o=e.clipPos(i.from),l=e.clipPos(i.to);if(me(o,l)){var s=yo(e,o,l,n.primary,n.primary.type);n.markers.push(s),s.parent=n}}}(n,_o(this)),n},unlinkDoc:function(e){if(e instanceof _l&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){if(this.linked[t].doc==e){this.linked.splice(t,1),e.unlinkDoc(this),xo(_o(this));break}}if(e.history==this.history){var r=[e.id];Li(e,function(e){return r.push(e.id)},!0),e.history=new Ni(null),e.history.done=Ei(this.history.done,r),e.history.undone=Ei(this.history.undone,r)}},iterLinkedDocs:function(e){Li(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):yt(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:Vn(function(e){if("rtl"!=e&&(e="ltr"),e!=this.direction){this.direction=e,this.iter(function(e){return e.order=null}),this.cm&&Un(t=this.cm,function(){Mi(t),$n(t)});var t}})}),ko.prototype.eachLine=ko.prototype.iter;var Co=0;function So(e){var t=this;if(Lo(t),!nt(t,e)&&!yr(t.display,e)){st(e),l&&(Co=+new Date);var r=nn(t,e,!0),n=e.dataTransfer.files;if(r&&!t.isReadOnly())if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),s=0,a=function(e,n){if(!t.options.allowDropFileTypes||-1!=I(t.options.allowDropFileTypes,e.type)){var l=new FileReader;l.onload=Gn(t,function(){var e=l.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[n]=e,++s==i){var a={from:r=we(t.doc,r),to:r,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"};to(t.doc,a),Ui(t.doc,vi(r,yi(a)))}}),l.readAsText(e)}},c=0;c<i;++c)a(n[c],c);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout(function(){return t.display.input.focus()},20);try{var u=e.dataTransfer.getData("Text");if(u){var f;if(t.state.draggingText&&!t.state.draggingText.copy&&(f=t.listSelections()),Ki(t.doc,vi(r,r)),f)for(var h=0;h<f.length;++h)lo(t.doc,"",f[h].anchor,f[h].head,"drag");t.replaceSelection(u,"around","paste"),t.display.input.focus()}}catch(e){}}}}function Lo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function To(e){if(document.getElementsByClassName)for(var t=document.getElementsByClassName("CodeMirror"),r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&e(n)}}var Mo=!1;function No(){Mo||(!function(){var e;Je(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,To(Ao)},100))}),Je(window,"blur",function(){return To(gn)})}(),Mo=!0)}function Ao(e){var t=e.display;t.lastWrapHeight==t.wrapper.clientHeight&&t.lastWrapWidth==t.wrapper.clientWidth||(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize())}for(var Oo={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Do=0;Do<10;Do++)Oo[Do+48]=Oo[Do+96]=String(Do);for(var Wo=65;Wo<=90;Wo++)Oo[Wo]=String.fromCharCode(Wo);for(var Po=1;Po<=12;Po++)Oo[Po+111]=Oo[Po+63235]="F"+Po;var zo={};zo.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},zo.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},zo.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},zo.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},zo.default=y?zo.macDefault:zo.pcDefault;function qo(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var r,n,i,o,l=0;l<t.length-1;l++){var s=t[l];if(/^(cmd|meta|m)$/i.test(s))o=!0;else if(/^a(lt)?$/i.test(s))r=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else{if(!/^s(hift)?$/i.test(s))throw new Error("Unrecognized modifier name: "+s);i=!0}}return r&&(e="Alt-"+e),n&&(e="Ctrl-"+e),o&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Fo(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if("..."==n){delete e[r];continue}for(var i=Y(r.split(" "),qo),o=0;o<i.length;o++){var l=void 0,s=void 0;o==i.length-1?(s=i.join(" "),l=n):(s=i.slice(0,o+1).join(" "),l="...");var a=t[s];if(a){if(a!=l)throw new Error("Inconsistent bindings for "+s)}else t[s]=l}delete e[r]}for(var c in t)e[c]=t[c];return e}function Eo(e,t,r,n){var i=(t=Bo(t)).call?t.call(e,n):t[e];if(!1===i)return"nothing";if("..."===i)return"multi";if(null!=i&&r(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return Eo(e,t.fallthrough,r,n);for(var o=0;o<t.fallthrough.length;o++){var l=Eo(e,t.fallthrough[o],r,n);if(l)return l}}}function Ho(e){var t="string"==typeof e?e:Oo[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function Io(e,t,r){var n=e;return t.altKey&&"Alt"!=n&&(e="Alt-"+e),(w?t.metaKey:t.ctrlKey)&&"Ctrl"!=n&&(e="Ctrl-"+e),(w?t.ctrlKey:t.metaKey)&&"Cmd"!=n&&(e="Cmd-"+e),!r&&t.shiftKey&&"Shift"!=n&&(e="Shift-"+e),e}function Ro(e,t){if(f&&34==e.keyCode&&e.char)return!1;var r=Oo[e.keyCode];return null!=r&&!e.altGraphKey&&Io(r,e,t)}function Bo(e){return"string"==typeof e?zo[e]:e}function jo(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=t(r[i]);n.length&&me(o.from,X(n).to)<=0;){var l=n.pop();if(me(l.from,o.from)<0){o.from=l.from;break}}n.push(o)}Un(e,function(){for(var t=n.length-1;t>=0;t--)lo(e.doc,"",n[t].from,n[t].to,"+delete");kn(e)})}function Uo(e,t,r){var n=oe(e.text,t+r,r);return n<0||n>e.text.length?null:n}function Go(e,t,r){var n=Uo(e,t.ch,r);return null==n?null:new ge(t.line,n,r<0?"after":"before")}function Ko(e,t,r,n,i){if(e){var o=Ze(r,t.doc.direction);if(o){var l,s=i<0?X(o):o[0],a=i<0==(1==s.level)?"after":"before";if(s.level>0||"rtl"==t.doc.direction){var c=Mr(t,r);l=i<0?r.text.length-1:0;var u=Nr(t,c,l).top;l=le(function(e){return Nr(t,c,e).top==u},i<0==(1==s.level)?s.from:s.to-1,l),"before"==a&&(l=Uo(r,l,1))}else l=i<0?s.to:s.from;return new ge(n,l,a)}}return new ge(n,i<0?r.text.length:0,i<0?"before":"after")}var Vo={selectAll:Ji,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),j)},killLine:function(e){return jo(e,function(t){if(t.empty()){var r=se(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:ge(t.head.line+1,0)}:{from:t.head,to:ge(t.head.line,r)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){return jo(e,function(t){return{from:ge(t.from().line,0),to:we(e.doc,ge(t.to().line+1,0))}})},delLineLeft:function(e){return jo(e,function(e){return{from:ge(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){return jo(e,function(t){var r=e.charCoords(t.head,"div").top+5;return{from:e.coordsChar({left:0,top:r},"div"),to:t.from()}})},delWrappedLineRight:function(e){return jo(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:n}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(ge(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(ge(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return $o(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return Xo(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return function(e,t){var r=se(e.doc,t),n=function(e){for(var t;t=Ee(e);)e=t.find(1,!0).line;return e}(r);n!=r&&(t=fe(n));return Ko(!0,e,r,t,-1)}(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")},G)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},G)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return n.ch<e.getLine(n.line).search(/\S/)?Xo(e,t.head):n},G)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"char")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,i=0;i<r.length;i++){var o=r[i].from(),l=E(e.getLine(o.line),o.ch,n);t.push($(n-l%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Un(e,function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++)if(t[n].empty()){var i=t[n].head,o=se(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new ge(i.line,i.ch-1)),i.ch>0)i=new ge(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),ge(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var l=se(e.doc,i.line-1).text;l&&(i=new ge(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+l.charAt(l.length-1),ge(i.line-1,l.length-1),i,"+transpose"))}r.push(new gi(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){return Un(e,function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var n=0;n<t.length;n++)e.indentLine(t[n].from().line,null,!0);kn(e)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function $o(e,t){var r=se(e.doc,t),n=Ie(r);return n!=r&&(t=fe(n)),Ko(!0,e,n,t,1)}function Xo(e,t){var r=$o(e,t.line),n=se(e.doc,r.line),i=Ze(n,e.doc.direction);if(!i||0==i[0].level){var o=Math.max(0,n.text.search(/\S/)),l=t.line==r.line&&t.ch<=o&&t.ch;return ge(r.line,l?0:o,r.sticky)}return r}function Yo(e,t,r){if("string"==typeof t&&!(t=Vo[t]))return!1;e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=B}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}var Zo=new H;function Qo(e,t,r,n){var i=e.state.keySeq;if(i){if(Ho(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Zo.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),Jo(e,i+" "+t,r,n))return!0}return Jo(e,t,r,n)}function Jo(e,t,r,n){var i=function(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=Eo(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&Eo(t,e.options.extraKeys,r,e)||Eo(t,e.options.keyMap,r,e)}(e,t,n);return"multi"==i&&(e.state.keySeq=t),"handled"==i&&ir(e,"keyHandled",e,t,r),"handled"!=i&&"multi"!=i||(st(r),fn(e)),!!i}function el(e,t){var r=Ro(t,!0);return!!r&&(t.shiftKey&&!e.state.keySeq?Qo(e,"Shift-"+r,t,function(t){return Yo(e,t,!0)})||Qo(e,r,t,function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return Yo(e,t)}):Qo(e,r,t,function(t){return Yo(e,t)}))}var tl=null;function rl(e){if(this.curOp.focus=D(),!nt(this,e)){l&&s<11&&27==e.keyCode&&(e.returnValue=!1);var t=e.keyCode;this.display.shift=16==t||e.shiftKey;var r=el(this,e);f&&(tl=r?t:null,!r&&88==t&&!_t&&(y?e.metaKey:e.ctrlKey)&&this.replaceSelection("",null,"cut")),18!=t||/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)||function(e){var t=e.display.lineDiv;W(t,"CodeMirror-crosshair");function r(e){18!=e.keyCode&&e.altKey||(S(t,"CodeMirror-crosshair"),tt(document,"keyup",r),tt(document,"mouseover",r))}Je(document,"keyup",r),Je(document,"mouseover",r)}(this)}}function nl(e){16==e.keyCode&&(this.doc.sel.shift=!1),nt(this,e)}function il(e){if(!(yr(this.display,e)||nt(this,e)||e.ctrlKey&&!e.altKey||y&&e.metaKey)){var t=e.keyCode,r=e.charCode;if(f&&t==tl)return tl=null,void st(e);if(!f||e.which&&!(e.which<10)||!el(this,e)){var n=String.fromCharCode(null==r?t:r);if("\b"!=n&&!Qo(i=this,"'"+n+"'",e,function(e){return Yo(i,e,!0)})){var i;this.display.input.onKeyPress(e)}}}}var ol=function(e,t,r){this.time=e,this.pos=t,this.button=r};ol.prototype.compare=function(e,t,r){return this.time+400>e&&0==me(t,this.pos)&&r==this.button};var ll,sl;function al(e){var t=this.display;if(!(nt(this,e)||t.activeTouch&&t.input.supportsTouch()))if(t.input.ensurePolled(),t.shift=e.shiftKey,yr(t,e))a||(t.scroller.draggable=!1,setTimeout(function(){return t.scroller.draggable=!0},100));else if(!fl(this,e)){var r=nn(this,e),n=ht(e),i=r?function(e,t){var r=+new Date;return sl&&sl.compare(r,e,t)?(ll=sl=null,"triple"):ll&&ll.compare(r,e,t)?(sl=new ol(r,e,t),ll=null,"double"):(ll=new ol(r,e,t),sl=null,"single")}(r,n):"single";window.focus(),1==n&&this.state.selectingText&&this.state.selectingText(e),r&&function(e,t,r,n,i){var o="Click";"double"==n?o="Double"+o:"triple"==n&&(o="Triple"+o);return Qo(e,Io(o=(1==t?"Left":2==t?"Middle":"Right")+o,i),i,function(t){if("string"==typeof t&&(t=Vo[t]),!t)return!1;var n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n=t(e,r)!=B}finally{e.state.suppressEdits=!1}return n})}(this,n,r,i,e)||(1==n?r?function(e,t,r,n){l?setTimeout(q(hn,e),0):e.curOp.focus=D();var i,o=function(e,t,r){var n=e.getOption("configureMouse"),i=n?n(e,t,r):{};if(null==i.unit){var o=b?r.shiftKey&&r.metaKey:r.altKey;i.unit=o?"rectangle":"single"==t?"char":"double"==t?"word":"line"}(null==i.extend||e.doc.extend)&&(i.extend=e.doc.extend||r.shiftKey);null==i.addNew&&(i.addNew=y?r.metaKey:r.ctrlKey);null==i.moveOnDrag&&(i.moveOnDrag=!(y?r.altKey:r.ctrlKey));return i}(e,r,n),c=e.doc.sel;e.options.dragDrop&&pt&&!e.isReadOnly()&&"single"==r&&(i=c.contains(t))>-1&&(me((i=c.ranges[i]).from(),t)<0||t.xRel>0)&&(me(i.to(),t)>0||t.xRel<0)?function(e,t,r,n){var i=e.display,o=!1,c=Gn(e,function(t){a&&(i.scroller.draggable=!1),e.state.draggingText=!1,tt(document,"mouseup",c),tt(document,"mousemove",u),tt(i.scroller,"dragstart",f),tt(i.scroller,"drop",c),o||(st(t),n.addNew||Ii(e.doc,r,null,null,n.extend),a||l&&9==s?setTimeout(function(){document.body.focus(),i.input.focus()},20):i.input.focus())}),u=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},f=function(){return o=!0};a&&(i.scroller.draggable=!0);e.state.draggingText=c,c.copy=!n.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop();Je(document,"mouseup",c),Je(document,"mousemove",u),Je(i.scroller,"dragstart",f),Je(i.scroller,"drop",c),dn(e),setTimeout(function(){return i.input.focus()},20)}(e,n,t,o):function(e,t,r,n){var i=e.display,o=e.doc;st(t);var l,s,a=o.sel,c=a.ranges;n.addNew&&!n.extend?(s=o.sel.contains(r),l=s>-1?c[s]:new gi(r,r)):(l=o.sel.primary(),s=o.sel.primIndex);if("rectangle"==n.unit)n.addNew||(l=new gi(r,r)),r=nn(e,t,!0,!0),s=-1;else{var u=cl(e,r,n.unit);l=n.extend?Hi(l,u.anchor,u.head,n.extend):u}n.addNew?-1==s?(s=c.length,Gi(o,mi(c.concat([l]),s),{scroll:!1,origin:"*mouse"})):c.length>1&&c[s].empty()&&"char"==n.unit&&!n.extend?(Gi(o,mi(c.slice(0,s).concat(c.slice(s+1)),0),{scroll:!1,origin:"*mouse"}),a=o.sel):Bi(o,s,l,U):(s=0,Gi(o,new pi([l],0),U),a=o.sel);var f=r;function h(t){if(0!=me(f,t))if(f=t,"rectangle"==n.unit){for(var i=[],c=e.options.tabSize,u=E(se(o,r.line).text,r.ch,c),h=E(se(o,t.line).text,t.ch,c),d=Math.min(u,h),p=Math.max(u,h),g=Math.min(r.line,t.line),m=Math.min(e.lastLine(),Math.max(r.line,t.line));g<=m;g++){var v=se(o,g).text,y=K(v,d,c);d==p?i.push(new gi(ge(g,y),ge(g,y))):v.length>y&&i.push(new gi(ge(g,y),ge(g,K(v,p,c))))}i.length||i.push(new gi(r,r)),Gi(o,mi(a.ranges.slice(0,s).concat(i),s),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b,_=l,x=cl(e,t,n.unit),w=_.anchor;me(x.anchor,w)>0?(b=x.head,w=_e(_.from(),x.anchor)):(b=x.anchor,w=be(_.to(),x.head));var k=a.ranges.slice(0);k[s]=function(e,t){var r=t.anchor,n=t.head,i=se(e.doc,r.line);if(0==me(r,n)&&r.sticky==n.sticky)return t;var o=Ze(i);if(!o)return t;var l=Xe(o,r.ch,r.sticky),s=o[l];if(s.from!=r.ch&&s.to!=r.ch)return t;var a=l+(s.from==r.ch==(1!=s.level)?0:1);if(0==a||a==o.length)return t;var c;if(n.line!=r.line)c=(n.line-r.line)*("ltr"==e.doc.direction?1:-1)>0;else{var u=Xe(o,n.ch,n.sticky),f=u-l||(n.ch-r.ch)*(1==s.level?-1:1);c=u==a-1||u==a?f<0:f>0}var h=o[a+(c?-1:0)],d=c==(1==h.level),p=d?h.from:h.to,g=d?"after":"before";return r.ch==p&&r.sticky==g?t:new gi(new ge(r.line,p,g),n)}(e,new gi(we(o,w),b)),Gi(o,mi(k,s),U)}}var d=i.wrapper.getBoundingClientRect(),p=0;function g(t){e.state.selectingText=!1,p=1/0,st(t),i.input.focus(),tt(document,"mousemove",m),tt(document,"mouseup",v),o.history.lastSelOrigin=null}var m=Gn(e,function(t){ht(t)?function t(r){var l=++p;var s=nn(e,r,!0,"rectangle"==n.unit);if(!s)return;if(0!=me(s,f)){e.curOp.focus=D(),h(s);var a=yn(i,o);(s.line>=a.to||s.line<a.from)&&setTimeout(Gn(e,function(){p==l&&t(r)}),150)}else{var c=r.clientY<d.top?-20:r.clientY>d.bottom?20:0;c&&setTimeout(Gn(e,function(){p==l&&(i.scroller.scrollTop+=c,t(r))}),50)}}(t):g(t)}),v=Gn(e,g);e.state.selectingText=v,Je(document,"mousemove",m),Je(document,"mouseup",v)}(e,n,t,o)}(this,r,i,e):ft(e)==t.scroller&&st(e):2==n?(r&&Ii(this.doc,r),setTimeout(function(){return t.input.focus()},20)):3==n&&(k?hl(this,e):dn(this)))}}function cl(e,t,r){if("char"==r)return new gi(t,t);if("word"==r)return e.findWordAt(t);if("line"==r)return new gi(ge(t.line,0),we(e.doc,ge(t.line+1,0)));var n=r(e,t);return new gi(n.from,n.to)}function ul(e,t,r,n){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&st(t);var l=e.display,s=l.lineDiv.getBoundingClientRect();if(o>s.bottom||!ot(e,r))return ct(t);o-=s.top-l.viewOffset;for(var a=0;a<e.options.gutters.length;++a){var c=l.gutters.childNodes[a];if(c&&c.getBoundingClientRect().right>=i){return rt(e,r,e,he(e.doc,o),e.options.gutters[a],t),ct(t)}}}function fl(e,t){return ul(e,t,"gutterClick",!0)}function hl(e,t){yr(e.display,t)||function(e,t){if(!ot(e,"gutterContextMenu"))return!1;return ul(e,t,"gutterContextMenu",!1)}(e,t)||nt(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function dl(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),zr(e)}var pl={toString:function(){return"CodeMirror.Init"}},gl={},ml={};function vl(e){si(e),$n(e),bn(e)}function yl(e,t,r){if(!t!=!(r&&r!=pl)){var n=e.display.dragFunctions,i=t?Je:tt;i(e.display.scroller,"dragstart",n.start),i(e.display.scroller,"dragenter",n.enter),i(e.display.scroller,"dragover",n.over),i(e.display.scroller,"dragleave",n.leave),i(e.display.scroller,"drop",n.drop)}}function bl(e){e.options.lineWrapping?(W(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(S(e.display.wrapper,"CodeMirror-wrap"),Ve(e)),rn(e),$n(e),zr(e),setTimeout(function(){return Wn(e)},100)}function _l(e,t){var n=this;if(!(this instanceof _l))return new _l(e,t);this.options=t=t?F(t):{},F(gl,t,!1),ai(t);var i=t.value;"string"==typeof i&&(i=new ko(i,t.mode,null,t.lineSeparator,t.direction)),this.doc=i;var o=new _l.inputStyles[t.inputStyle](this),c=this.display=new function(e,t,n){this.input=n,this.scrollbarFiller=M("div",null,"CodeMirror-scrollbar-filler"),this.scrollbarFiller.setAttribute("cm-not-content","true"),this.gutterFiller=M("div",null,"CodeMirror-gutter-filler"),this.gutterFiller.setAttribute("cm-not-content","true"),this.lineDiv=N("div",null,"CodeMirror-code"),this.selectionDiv=M("div",null,null,"position: relative; z-index: 1"),this.cursorDiv=M("div",null,"CodeMirror-cursors"),this.measure=M("div",null,"CodeMirror-measure"),this.lineMeasure=M("div",null,"CodeMirror-measure"),this.lineSpace=N("div",[this.measure,this.lineMeasure,this.selectionDiv,this.cursorDiv,this.lineDiv],null,"position: relative; outline: none");var i=N("div",[this.lineSpace],"CodeMirror-lines");this.mover=M("div",[i],null,"position: relative"),this.sizer=M("div",[this.mover],"CodeMirror-sizer"),this.sizerWidth=null,this.heightForcer=M("div",null,null,"position: absolute; height: "+R+"px; width: 1px;"),this.gutters=M("div",null,"CodeMirror-gutters"),this.lineGutter=null,this.scroller=M("div",[this.sizer,this.heightForcer,this.gutters],"CodeMirror-scroll"),this.scroller.setAttribute("tabIndex","-1"),this.wrapper=M("div",[this.scrollbarFiller,this.gutterFiller,this.scroller],"CodeMirror"),l&&s<8&&(this.gutters.style.zIndex=-1,this.scroller.style.paddingRight=0),a||r&&v||(this.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(this.wrapper):e(this.wrapper)),this.viewFrom=this.viewTo=t.first,this.reportedViewFrom=this.reportedViewTo=t.first,this.view=[],this.renderedView=null,this.externalMeasured=null,this.viewOffset=0,this.lastWrapHeight=this.lastWrapWidth=0,this.updateLineNumbers=null,this.nativeBarWidth=this.barHeight=this.barWidth=0,this.scrollbarsClipped=!1,this.lineNumWidth=this.lineNumInnerWidth=this.lineNumChars=null,this.alignWidgets=!1,this.cachedCharWidth=this.cachedTextHeight=this.cachedPaddingH=null,this.maxLine=null,this.maxLineLength=0,this.maxLineChanged=!1,this.wheelDX=this.wheelDY=this.wheelStartX=this.wheelStartY=null,this.shift=!1,this.selForContextMenu=null,this.activeTouch=null,n.init(this)}(e,i,o);c.wrapper.CodeMirror=this,si(this),dl(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),qn(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new H,keySeq:null,specialChars:null},t.autofocus&&!v&&c.input.focus(),l&&s<11&&setTimeout(function(){return n.display.input.reset(!0)},20),function(e){var t=e.display;Je(t.scroller,"mousedown",Gn(e,al)),Je(t.scroller,"dblclick",l&&s<11?Gn(e,function(t){if(!nt(e,t)){var r=nn(e,t);if(r&&!fl(e,t)&&!yr(e.display,t)){st(t);var n=e.findWordAt(r);Ii(e.doc,n.anchor,n.head)}}}):function(t){return nt(e,t)||st(t)});k||Je(t.scroller,"contextmenu",function(t){return hl(e,t)});var r,n={end:0};function i(){t.activeTouch&&(r=setTimeout(function(){return t.activeTouch=null},1e3),(n=t.activeTouch).end=+new Date)}function o(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return r*r+n*n>400}Je(t.scroller,"touchstart",function(i){if(!nt(e,i)&&!function(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(i)&&!fl(e,i)){t.input.ensurePolled(),clearTimeout(r);var o=+new Date;t.activeTouch={start:o,moved:!1,prev:o-n.end<=300?n:null},1==i.touches.length&&(t.activeTouch.left=i.touches[0].pageX,t.activeTouch.top=i.touches[0].pageY)}}),Je(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Je(t.scroller,"touchend",function(r){var n=t.activeTouch;if(n&&!yr(t,r)&&null!=n.left&&!n.moved&&new Date-n.start<300){var l,s=e.coordsChar(t.activeTouch,"page");l=!n.prev||o(n,n.prev)?new gi(s,s):!n.prev.prev||o(n,n.prev.prev)?e.findWordAt(s):new gi(ge(s.line,0),we(e.doc,ge(s.line+1,0))),e.setSelection(l.anchor,l.head),e.focus(),st(r)}i()}),Je(t.scroller,"touchcancel",i),Je(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Tn(e,t.scroller.scrollTop),Nn(e,t.scroller.scrollLeft,!0),rt(e,"scroll",e))}),Je(t.scroller,"mousewheel",function(t){return di(e,t)}),Je(t.scroller,"DOMMouseScroll",function(t){return di(e,t)}),Je(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(t){nt(e,t)||ut(t)},over:function(t){nt(e,t)||(!function(e,t){var r=nn(e,t);if(r){var n=document.createDocumentFragment();an(e,r,n),e.display.dragCursor||(e.display.dragCursor=M("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),T(e.display.dragCursor,n)}}(e,t),ut(t))},start:function(t){return function(e,t){if(l&&(!e.state.draggingText||+new Date-Co<100))ut(t);else if(!nt(e,t)&&!yr(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!h)){var r=M("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",f&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),f&&r.parentNode.removeChild(r)}}(e,t)},drop:Gn(e,So),leave:function(t){nt(e,t)||Lo(e)}};var a=t.input.getField();Je(a,"keyup",function(t){return nl.call(e,t)}),Je(a,"keydown",Gn(e,rl)),Je(a,"keypress",Gn(e,il)),Je(a,"focus",function(t){return pn(e,t)}),Je(a,"blur",function(t){return gn(e,t)})}(this),No(),En(this),this.curOp.forceUpdate=!0,Ti(this,i),t.autofocus&&!v||this.hasFocus()?setTimeout(q(pn,this),20):gn(this);for(var u in ml)ml.hasOwnProperty(u)&&ml[u](n,t[u],pl);_n(this),t.finishInit&&t.finishInit(this);for(var d=0;d<xl.length;++d)xl[d](n);Hn(this),a&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(c.lineDiv).textRendering&&(c.lineDiv.style.textRendering="auto")}_l.defaults=gl,_l.optionHandlers=ml;var xl=[];_l.defineInitHook=function(e){return xl.push(e)};function wl(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=qt(e,t).state:r="prev");var l=e.options.tabSize,s=se(o,t),a=E(s.text,null,l);s.stateAfter&&(s.stateAfter=null);var c,u=s.text.match(/^\s*/)[0];if(n||/\S/.test(s.text)){if("smart"==r&&((c=o.mode.indent(i,s.text.slice(u.length),s.text))==B||c>150)){if(!n)return;r="prev"}}else c=0,r="not";"prev"==r?c=t>o.first?E(se(o,t-1).text,null,l):0:"add"==r?c=a+e.options.indentUnit:"subtract"==r?c=a-e.options.indentUnit:"number"==typeof r&&(c=a+r),c=Math.max(0,c);var f="",h=0;if(e.options.indentWithTabs)for(var d=Math.floor(c/l);d;--d)h+=l,f+="\t";if(h<c&&(f+=$(c-h)),f!=u)return lo(o,f,ge(t,0),ge(t,u.length),"+input"),s.stateAfter=null,!0;for(var p=0;p<o.sel.ranges.length;p++){var g=o.sel.ranges[p];if(g.head.line==t&&g.head.ch<u.length){var m=ge(t,u.length);Bi(o,p,new gi(m,m));break}}}var kl=null;function Cl(e){kl=e}function Sl(e,t,r,n,i){var o=e.doc;e.display.shift=!1,n||(n=o.sel);var l=e.state.pasteIncoming||"paste"==i,s=yt(t),a=null;if(l&&n.ranges.length>1)if(kl&&kl.text.join("\n")==t){if(n.ranges.length%kl.text.length==0){a=[];for(var c=0;c<kl.text.length;c++)a.push(o.splitLines(kl.text[c]))}}else s.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(a=Y(s,function(e){return[e]}));for(var u,f=n.ranges.length-1;f>=0;f--){var h=n.ranges[f],d=h.from(),p=h.to();h.empty()&&(r&&r>0?d=ge(d.line,d.ch-r):e.state.overwrite&&!l?p=ge(p.line,Math.min(se(o,p.line).text.length,p.ch+X(s).length)):kl&&kl.lineWise&&kl.text.join("\n")==t&&(d=p=ge(d.line,0))),u=e.curOp.updateInput;var g={from:d,to:p,text:a?a[f%a.length]:s,origin:i||(l?"paste":e.state.cutIncoming?"cut":"+input")};to(e.doc,g),ir(e,"inputRead",e,g)}t&&!l&&Tl(e,t),kn(e),e.curOp.updateInput=u,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function Ll(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Un(t,function(){return Sl(t,r,0,null,"paste")}),!0}function Tl(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n];if(!(i.head.ch>100||n&&r.ranges[n-1].head.line==i.head.line)){var o=e.getModeAt(i.head),l=!1;if(o.electricChars){for(var s=0;s<o.electricChars.length;s++)if(t.indexOf(o.electricChars.charAt(s))>-1){l=wl(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(se(e.doc,i.head.line).text.slice(0,i.head.ch))&&(l=wl(e,i.head.line,"smart"));l&&ir(e,"electricInput",e,i.head.line)}}}function Ml(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var i=e.doc.sel.ranges[n].head.line,o={anchor:ge(i,0),head:ge(i+1,0)};r.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:r}}function Nl(e,t){e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck",!!t)}function Al(){var e=M("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=M("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return a?e.style.width="1000px":e.setAttribute("wrap","off"),g&&(e.style.border="1px solid black"),Nl(e),t}function Ol(e,t,r,n,i){var o=t,l=r,s=se(e,t.line);function a(n){var o;if(null==(o=i?function(e,t,r,n){var i=Ze(t,e.doc.direction);if(!i)return Go(t,r,n);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var o=Xe(i,r.ch,r.sticky),l=i[o];if("ltr"==e.doc.direction&&l.level%2==0&&(n>0?l.to>r.ch:l.from<r.ch))return Go(t,r,n);var s,a=function(e,r){return Uo(t,e instanceof ge?e.ch:e,r)},c=function(r){return e.options.lineWrapping?(s=s||Mr(e,t),Vr(e,t,s,r)):{begin:0,end:t.text.length}},u=c("before"==r.sticky?a(r,-1):r.ch);if("rtl"==e.doc.direction||1==l.level){var f=1==l.level==n<0,h=a(r,f?1:-1);if(null!=h&&(f?h<=l.to&&h<=u.end:h>=l.from&&h>=u.begin)){var d=f?"before":"after";return new ge(r.line,h,d)}}var p=function(e,t,n){for(var o=function(e,t){return t?new ge(r.line,a(e,1),"before"):new ge(r.line,e,"after")};e>=0&&e<i.length;e+=t){var l=i[e],s=t>0==(1!=l.level),c=s?n.begin:a(n.end,-1);if(l.from<=c&&c<l.to)return o(c,s);if(c=s?l.from:a(l.to,-1),n.begin<=c&&c<n.end)return o(c,s)}},g=p(o+n,n,u);if(g)return g;var m=n>0?u.end:a(u.begin,-1);return null==m||n>0&&m==t.text.length||!(g=p(n>0?0:i.length-1,n,c(m)))?null:g}(e.cm,s,t,r):Go(s,t,r))){if(n||!function(){var n=t.line+r;return!(n<e.first||n>=e.first+e.size)&&(t=new ge(n,t.ch,t.sticky),s=se(e,n))}())return!1;t=Ko(i,e.cm,s,t.line,r)}else t=o;return!0}if("char"==n)a();else if("column"==n)a(!0);else if("word"==n||"group"==n)for(var c=null,u="group"==n,f=e.cm&&e.cm.getHelper(t,"wordChars"),h=!0;!(r<0)||a(!h);h=!1){var d=s.text.charAt(t.ch)||"\n",p=te(d,f)?"w":u&&"\n"==d?"n":!u||/\s/.test(d)?null:"p";if(!u||h||p||(p="s"),c&&c!=p){r<0&&(r=1,a(),t.sticky="after");break}if(p&&(c=p),r>0&&!a(!h))break}var g=Zi(e,t,o,l,!0);return ve(o,g)&&(g.hitSide=!0),g}function Dl(e,t,r,n){var i,o=e.doc,l=t.left;if("page"==n){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),a=Math.max(s-.5*Zr(e.display),3);i=(r>0?t.bottom:t.top)+r*a}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(var c;(c=Gr(e,l,i)).outside;){if(r<0?i<=0:i>=o.height){c.hitSide=!0;break}i+=5*r}return c}var Wl=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new H,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Wl.prototype.init=function(e){var t=this,r=this,n=r.cm,i=r.div=e.lineDiv;Nl(i,n.options.spellcheck),Je(i,"paste",function(e){nt(n,e)||Ll(e,n)||s<=11&&setTimeout(Gn(n,function(){return t.updateFromDOM()}),20)}),Je(i,"compositionstart",function(e){t.composing={data:e.data,done:!1}}),Je(i,"compositionupdate",function(e){t.composing||(t.composing={data:e.data,done:!1})}),Je(i,"compositionend",function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Je(i,"touchstart",function(){return r.forceCompositionEnd()}),Je(i,"input",function(){t.composing||t.readFromDOMSoon()});function o(e){if(!nt(n,e)){if(n.somethingSelected())Cl({lineWise:!1,text:n.getSelections()}),"cut"==e.type&&n.replaceSelection("",null,"cut");else{if(!n.options.lineWiseCopyCut)return;var t=Ml(n);Cl({lineWise:!0,text:t.text}),"cut"==e.type&&n.operation(function(){n.setSelections(t.ranges,0,j),n.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var o=kl.text.join("\n");if(e.clipboardData.setData("Text",o),e.clipboardData.getData("Text")==o)return void e.preventDefault()}var l=Al(),s=l.firstChild;n.display.lineSpace.insertBefore(l,n.display.lineSpace.firstChild),s.value=kl.text.join("\n");var a=document.activeElement;z(s),setTimeout(function(){n.display.lineSpace.removeChild(l),a.focus(),a==i&&r.showPrimarySelection()},50)}}Je(i,"copy",o),Je(i,"cut",o)},Wl.prototype.prepareSelection=function(){var e=sn(this.cm,!1);return e.focus=this.cm.state.focused,e},Wl.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Wl.prototype.showPrimarySelection=function(){var e=window.getSelection(),t=this.cm,n=t.doc.sel.primary(),i=n.from(),o=n.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||o.line<t.display.viewFrom)e.removeAllRanges();else{var l=ql(t,e.anchorNode,e.anchorOffset),s=ql(t,e.focusNode,e.focusOffset);if(!l||l.bad||!s||s.bad||0!=me(_e(l,s),i)||0!=me(be(l,s),o)){var a=t.display.view,c=i.line>=t.display.viewFrom&&Pl(t,i)||{node:a[0].measure.map[2],offset:0},u=o.line<t.display.viewTo&&Pl(t,o);if(!u){var f=a[a.length-1].measure,h=f.maps?f.maps[f.maps.length-1]:f.map;u={node:h[h.length-1],offset:h[h.length-2]-h[h.length-3]}}if(c&&u){var d,p=e.rangeCount&&e.getRangeAt(0);try{d=A(c.node,c.offset,u.offset,u.node)}catch(e){}d&&(!r&&t.state.focused?(e.collapse(c.node,c.offset),d.collapsed||(e.removeAllRanges(),e.addRange(d))):(e.removeAllRanges(),e.addRange(d)),p&&null==e.anchorNode?e.addRange(p):r&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},Wl.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},Wl.prototype.showMultipleSelections=function(e){T(this.cm.display.cursorDiv,e.cursors),T(this.cm.display.selectionDiv,e.selection)},Wl.prototype.rememberSelection=function(){var e=window.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Wl.prototype.selectionInEditor=function(){var e=window.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return O(this.div,t)},Wl.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())},Wl.prototype.blur=function(){this.div.blur()},Wl.prototype.getField=function(){return this.div},Wl.prototype.supportsTouch=function(){return!0},Wl.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Un(this.cm,function(){return e.cm.curOp.selectionChanged=!0});this.polling.set(this.cm.options.pollInterval,function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))})},Wl.prototype.selectionChanged=function(){var e=window.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Wl.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=window.getSelection(),t=this.cm;if(m&&u&&this.cm.options.gutters.length&&function(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}(e.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var r=ql(t,e.anchorNode,e.anchorOffset),n=ql(t,e.focusNode,e.focusOffset);r&&n&&Un(t,function(){Gi(t.doc,vi(r,n),j),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})}}},Wl.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,r=e.doc.sel.primary(),n=r.from(),i=r.to();if(0==n.ch&&n.line>e.firstLine()&&(n=ge(n.line-1,se(e.doc,n.line-1).length)),i.ch==se(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=ge(i.line+1,0)),n.line<t.viewFrom||i.line>t.viewTo-1)return!1;var o,l,s;n.line==t.viewFrom||0==(o=on(e,n.line))?(l=fe(t.view[0].line),s=t.view[0].node):(l=fe(t.view[o].line),s=t.view[o-1].node.nextSibling);var a,c,u=on(e,i.line);if(u==t.view.length-1?(a=t.viewTo-1,c=t.lineDiv.lastChild):(a=fe(t.view[u+1].line)-1,c=t.view[u+1].node.previousSibling),!s)return!1;for(var f=e.doc.splitLines(function(e,t,r,n,i){var o="",l=!1,s=e.doc.lineSeparator();function a(){l&&(o+=s,l=!1)}function c(e){e&&(a(),o+=e)}function u(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(null!=r)return void c(r||t.textContent.replace(/\u200b/g,""));var o,f=t.getAttribute("cm-marker");if(f){var h=e.findMarks(ge(n,0),ge(i+1,0),(g=+f,function(e){return e.id==g}));return void(h.length&&(o=h[0].find(0))&&c(ae(e.doc,o.from,o.to).join(s)))}if("false"==t.getAttribute("contenteditable"))return;var d=/^(pre|div|p)$/i.test(t.nodeName);d&&a();for(var p=0;p<t.childNodes.length;p++)u(t.childNodes[p]);d&&(l=!0)}else 3==t.nodeType&&c(t.nodeValue);var g}for(;u(t),t!=r;)t=t.nextSibling;return o}(e,s,c,l,a)),h=ae(e.doc,ge(l,0),ge(a,se(e.doc,a).text.length));f.length>1&&h.length>1;)if(X(f)==X(h))f.pop(),h.pop(),a--;else{if(f[0]!=h[0])break;f.shift(),h.shift(),l++}for(var d=0,p=0,g=f[0],m=h[0],v=Math.min(g.length,m.length);d<v&&g.charCodeAt(d)==m.charCodeAt(d);)++d;for(var y=X(f),b=X(h),_=Math.min(y.length-(1==f.length?d:0),b.length-(1==h.length?d:0));p<_&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p;if(1==f.length&&1==h.length&&l==n.line)for(;d&&d>n.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)d--,p++;f[f.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),f[0]=f[0].slice(d).replace(/\u200b+$/,"");var x=ge(l,d),w=ge(a,h.length?X(h).length-p:0);return f.length>1||f[0]||me(x,w)?(lo(e.doc,f,x,w,"+input"),!0):void 0},Wl.prototype.ensurePolled=function(){this.forceCompositionEnd()},Wl.prototype.reset=function(){this.forceCompositionEnd()},Wl.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Wl.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()},80))},Wl.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Un(this.cm,function(){return $n(e.cm)})},Wl.prototype.setUneditable=function(e){e.contentEditable="false"},Wl.prototype.onKeyPress=function(e){0!=e.charCode&&(e.preventDefault(),this.cm.isReadOnly()||Gn(this.cm,Sl)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Wl.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Wl.prototype.onContextMenu=function(){},Wl.prototype.resetPosition=function(){},Wl.prototype.needsContentAttribute=!0;function Pl(e,t){var r=Tr(e,t.line);if(!r||r.hidden)return null;var n=se(e.doc,t.line),i=Sr(r,n,t.line),o=Ze(n,e.doc.direction),l="left";if(o){l=Xe(o,t.ch)%2?"right":"left"}var s=Or(i.map,t.ch,l);return s.offset="right"==s.collapse?s.end:s.start,s}function zl(e,t){return t&&(e.bad=!0),e}function ql(e,t,r){var n;if(t==e.display.lineDiv){if(!(n=e.display.lineDiv.childNodes[r]))return zl(e.clipPos(ge(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==n)return Fl(o,t,r)}}function Fl(e,t,r){var n=e.text.firstChild,i=!1;if(!t||!O(n,t))return zl(ge(fe(e.line),0),!0);if(t==n&&(i=!0,t=n.childNodes[r],r=0,!t)){var o=e.rest?X(e.rest):e.line;return zl(ge(fe(o),o.text.length),i)}var l=3==t.nodeType?t:null,s=t;for(l||1!=t.childNodes.length||3!=t.firstChild.nodeType||(l=t.firstChild,r&&(r=l.nodeValue.length));s.parentNode!=n;)s=s.parentNode;var a=e.measure,c=a.maps;function u(t,r,n){for(var i=-1;i<(c?c.length:0);i++)for(var o=i<0?a.map:c[i],l=0;l<o.length;l+=3){var s=o[l+2];if(s==t||s==r){var u=fe(i<0?e.line:e.rest[i]),f=o[l]+n;return(n<0||s!=t)&&(f=o[l+(n?1:0)]),ge(u,f)}}}var f=u(l,s,r);if(f)return zl(f,i);for(var h=s.nextSibling,d=l?l.nodeValue.length-r:0;h;h=h.nextSibling){if(f=u(h,h.firstChild,0))return zl(ge(f.line,f.ch-d),i);d+=h.textContent.length}for(var p=s.previousSibling,g=r;p;p=p.previousSibling){if(f=u(p,p.firstChild,-1))return zl(ge(f.line,f.ch+g),i);g+=p.textContent.length}}var El=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new H,this.hasSelection=!1,this.composing=null};El.prototype.init=function(e){var t=this,r=this,n=this.cm,i=this.wrapper=Al(),o=this.textarea=i.firstChild;e.wrapper.insertBefore(i,e.wrapper.firstChild),g&&(o.style.width="0px"),Je(o,"input",function(){l&&s>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),Je(o,"paste",function(e){nt(n,e)||Ll(e,n)||(n.state.pasteIncoming=!0,r.fastPoll())});function a(e){if(!nt(n,e)){if(n.somethingSelected())Cl({lineWise:!1,text:n.getSelections()});else{if(!n.options.lineWiseCopyCut)return;var t=Ml(n);Cl({lineWise:!0,text:t.text}),"cut"==e.type?n.setSelections(t.ranges,null,j):(r.prevInput="",o.value=t.text.join("\n"),z(o))}"cut"==e.type&&(n.state.cutIncoming=!0)}}Je(o,"cut",a),Je(o,"copy",a),Je(e.scroller,"paste",function(t){yr(e,t)||nt(n,t)||(n.state.pasteIncoming=!0,r.focus())}),Je(e.lineSpace,"selectstart",function(t){yr(e,t)||st(t)}),Je(o,"compositionstart",function(){var e=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}}),Je(o,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},El.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=sn(e);if(e.options.moveInputWithCursor){var i=Br(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+l.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+l.left-o.left))}return n},El.prototype.showSelection=function(e){var t=this.cm.display;T(t.cursorDiv,e.cursors),T(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},El.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&z(this.textarea),l&&s>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",l&&s>=9&&(this.hasSelection=null))}},El.prototype.getField=function(){return this.textarea},El.prototype.supportsTouch=function(){return!1},El.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!v||D()!=this.textarea))try{this.textarea.focus()}catch(e){}},El.prototype.blur=function(){this.textarea.blur()},El.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},El.prototype.receivedFocus=function(){this.slowPoll()},El.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},El.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;t.polling.set(20,function r(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,r))})},El.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||bt(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=r.value;if(i==n&&!t.somethingSelected())return!1;if(l&&s>=9&&this.hasSelection===i||y&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||n||(n="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var a=0,c=Math.min(n.length,i.length);a<c&&n.charCodeAt(a)==i.charCodeAt(a);)++a;return Un(t,function(){Sl(t,i.slice(a),n.length-a,null,e.composing?"*compose":null),i.length>1e3||i.indexOf("\n")>-1?r.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},El.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},El.prototype.onKeyPress=function(){l&&s>=9&&(this.hasSelection=null),this.fastPoll()},El.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,i=t.textarea,o=nn(r,e),c=n.scroller.scrollTop;if(o&&!f){r.options.resetSelectionOnContextMenu&&-1==r.doc.sel.contains(o)&&Gn(r,Gi)(r.doc,vi(o),j);var u=i.style.cssText,h=t.wrapper.style.cssText;t.wrapper.style.cssText="position: absolute";var d=t.wrapper.getBoundingClientRect();i.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-d.top-5)+"px; left: "+(e.clientX-d.left-5)+"px;\n z-index: 1000; background: "+(l?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";var p;if(a&&(p=window.scrollY),n.input.focus(),a&&window.scrollTo(null,p),n.input.reset(),r.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=!0,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll),l&&s>=9&&m(),k){ut(e);var g=function(){tt(window,"mouseup",g),setTimeout(v,20)};Je(window,"mouseup",g)}else setTimeout(v,50)}function m(){if(null!=i.selectionStart){var e=r.somethingSelected(),o="​"+(e?i.value:"");i.value="⇚",i.value=o,t.prevInput=e?"":"​",i.selectionStart=1,i.selectionEnd=o.length,n.selForContextMenu=r.doc.sel}}function v(){if(t.contextMenuPending=!1,t.wrapper.style.cssText=h,i.style.cssText=u,l&&s<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=c),null!=i.selectionStart){(!l||l&&s<9)&&m();var e=0,o=function(){n.selForContextMenu==r.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&"​"==t.prevInput?Gn(r,Ji)(r):e++<10?n.detectingSelectAll=setTimeout(o,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(o,200)}}},El.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},El.prototype.setUneditable=function(){},El.prototype.needsContentAttribute=!1;!function(e){var t=e.optionHandlers;function r(r,n,i,o){e.defaults[r]=n,i&&(t[r]=o?function(e,t,r){r!=pl&&i(e,t,r)}:i)}e.defineOption=r,e.Init=pl,r("value","",function(e,t){return e.setValue(t)},!0),r("mode",null,function(e,t){e.doc.modeOption=t,wi(e)},!0),r("indentUnit",2,wi,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(e){ki(e),zr(e),$n(e)},!0),r("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var r=[],n=e.doc.first;e.doc.iter(function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,r.push(ge(n,o))}n++});for(var i=r.length-1;i>=0;i--)lo(e.doc,t,r[i],ge(r[i].line,r[i].ch+t.length))}}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t,r){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),r!=pl&&e.refresh()}),r("specialCharPlaceholder",Xt,function(e){return e.refresh()},!0),r("electricChars",!0),r("inputStyle",v?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),r("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),r("rtlMoveVisually",!_),r("wholeLineUpdateBefore",!0),r("theme","default",function(e){dl(e),vl(e)},!0),r("keyMap","default",function(e,t,r){var n=Bo(t),i=r!=pl&&Bo(r);i&&i.detach&&i.detach(e,n),n.attach&&n.attach(e,i||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,bl,!0),r("gutters",[],function(e){ai(e.options),vl(e)},!0),r("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?en(e.display)+"px":"0",e.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(e){return Wn(e)},!0),r("scrollbarStyle","native",function(e){qn(e),Wn(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),r("lineNumbers",!1,function(e){ai(e.options),vl(e)},!0),r("firstLineNumber",1,vl,!0),r("lineNumberFormatter",function(e){return e},vl,!0),r("showCursorWhenSelecting",!1,ln,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("readOnly",!1,function(e,t){"nocursor"==t&&(gn(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),r("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),r("dragDrop",!0,yl),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,ln,!0),r("singleCursorHeightPerLine",!0,ln,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,ki,!0),r("addModeClass",!1,ki,!0),r("pollInterval",100),r("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),r("historyEventDelay",1250),r("viewportMargin",10,function(e){return e.refresh()},!0),r("maxHighlightLength",1e4,ki,!0),r("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),r("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),r("autofocus",null),r("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0)}(_l),function(e){var t=e.optionHandlers,r=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,r){var n=this.options,i=n[e];n[e]==r&&"mode"!=e||(n[e]=r,t.hasOwnProperty(e)&&Gn(this,t[e])(this,r,i),rt(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Bo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;r<t.length;++r)if(t[r]==e||t[r].name==e)return t.splice(r,1),!0},addOverlay:Kn(function(t,r){var n=t.token?t:e.getMode(this.options,t);if(n.startState)throw new Error("Overlays may not be stateful.");!function(e,t,r){for(var n=0,i=r(t);n<e.length&&r(e[n])<=i;)n++;e.splice(n,0,t)}(this.state.overlays,{mode:n,modeSpec:t,opaque:r&&r.opaque,priority:r&&r.priority||0},function(e){return e.priority}),this.state.modeGen++,$n(this)}),removeOverlay:Kn(function(e){for(var t=this.state.overlays,r=0;r<t.length;++r){var n=t[r].modeSpec;if(n==e||"string"==typeof e&&n.name==e)return t.splice(r,1),this.state.modeGen++,void $n(this)}}),indentLine:Kn(function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),de(this.doc,e)&&wl(this,e,t,r)}),indentSelection:Kn(function(e){for(var t=this.doc.sel.ranges,r=-1,n=0;n<t.length;n++){var i=t[n];if(i.empty())i.head.line>r&&(wl(this,i.head.line,e,!0),r=i.head.line,n==this.doc.sel.primIndex&&kn(this));else{var o=i.from(),l=i.to(),s=Math.max(r,o.line);r=Math.min(this.lastLine(),l.line-(l.ch?0:1))+1;for(var a=s;a<r;++a)wl(this,a,e);var c=this.doc.sel.ranges;0==o.ch&&t.length==c.length&&c[n].from().ch>0&&Bi(this.doc,n,new gi(o,c[n].to()),j)}}}),getTokenAt:function(e,t){return Rt(this,e,t)},getLineTokens:function(e,t){return Rt(this,ge(e),t,!0)},getTokenTypeAt:function(e){e=we(this.doc,e);var t,r=zt(this,se(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var l=n+i>>1;if((l?r[2*l-1]:0)>=o)i=l;else{if(!(r[2*l+1]<o)){t=r[2*l+2];break}n=l+1}}var s=t?t.indexOf("overlay "):-1;return s<0?t:0==s?null:t.slice(0,s-1)},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var n=[];if(!r.hasOwnProperty(t))return n;var i=r[t],o=this.getModeAt(e);if("string"==typeof o[t])i[o[t]]&&n.push(i[o[t]]);else if(o[t])for(var l=0;l<o[t].length;l++){var s=i[o[t][l]];s&&n.push(s)}else o.helperType&&i[o.helperType]?n.push(i[o.helperType]):i[o.name]&&n.push(i[o.name]);for(var a=0;a<i._global.length;a++){var c=i._global[a];c.pred(o,this)&&-1==I(n,c.val)&&n.push(c.val)}return n},getStateAfter:function(e,t){var r=this.doc;return qt(this,(e=xe(r,null==e?r.first+r.size-1:e))+1,t).state},cursorCoords:function(e,t){var r=this.doc.sel.primary();return Br(this,null==e?r.head:"object"==typeof e?we(this.doc,e):e?r.from():r.to(),t||"page")},charCoords:function(e,t){return Rr(this,we(this.doc,e),t||"page")},coordsChar:function(e,t){return Gr(this,(e=Ir(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=Ir(this,{top:e,left:0},t||"page").top,he(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,r){var n,i=!1;if("number"==typeof e){var o=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>o&&(e=o,i=!0),n=se(this.doc,e)}else n=e;return Hr(this,n,{top:0,left:0},t||"page",r||i).top+(i?this.doc.height-Ge(n):0)},defaultTextHeight:function(){return Zr(this.display)},defaultCharWidth:function(){return Qr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o=this.display,l=(e=Br(this,we(this.doc,e))).bottom,s=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==n)l=e.top;else if("above"==n||"near"==n){var a=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>a)&&e.top>t.offsetHeight?l=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=a&&(l=e.bottom),s+t.offsetWidth>c&&(s=c-t.offsetWidth)}t.style.top=l+"px",t.style.left=t.style.right="","right"==i?(s=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?s=0:"middle"==i&&(s=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=s+"px"),r&&function(e,t){var r=xn(e,t);null!=r.scrollTop&&Tn(e,r.scrollTop),null!=r.scrollLeft&&Nn(e,r.scrollLeft)}(this,{left:s,top:l,right:s+t.offsetWidth,bottom:l+t.offsetHeight})},triggerOnKeyDown:Kn(rl),triggerOnKeyPress:Kn(il),triggerOnKeyUp:nl,triggerOnMouseDown:Kn(al),execCommand:function(e){if(Vo.hasOwnProperty(e))return Vo[e].call(null,this)},triggerElectric:Kn(function(e){Tl(this,e)}),findPosH:function(e,t,r,n){var i=1;t<0&&(i=-1,t=-t);for(var o=we(this.doc,e),l=0;l<t&&!(o=Ol(this.doc,o,i,r,n)).hitSide;++l);return o},moveH:Kn(function(e,t){var r=this;this.extendSelectionsBy(function(n){return r.display.shift||r.doc.extend||n.empty()?Ol(r.doc,n.head,e,t,r.options.rtlMoveVisually):e<0?n.from():n.to()},G)}),deleteH:Kn(function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):jo(this,function(r){var i=Ol(n,r.head,e,t,!1);return e<0?{from:i,to:r.head}:{from:r.head,to:i}})}),findPosV:function(e,t,r,n){var i=1,o=n;t<0&&(i=-1,t=-t);for(var l=we(this.doc,e),s=0;s<t;++s){var a=Br(this,l,"div");if(null==o?o=a.left:a.left=o,(l=Dl(this,a,i,r)).hitSide)break}return l},moveV:Kn(function(e,t){var r=this,n=this.doc,i=[],o=!this.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy(function(l){if(o)return e<0?l.from():l.to();var s=Br(r,l.head,"div");null!=l.goalColumn&&(s.left=l.goalColumn),i.push(s.left);var a=Dl(r,s,e,t);return"page"==t&&l==n.sel.primary()&&wn(r,Rr(r,a,"div").top-s.top),a},G),i.length)for(var l=0;l<n.sel.ranges.length;l++)n.sel.ranges[l].goalColumn=i[l]}),findWordAt:function(e){var t=se(this.doc,e.line).text,r=e.ch,n=e.ch;if(t){var i=this.getHelper(e,"wordChars");"before"!=e.sticky&&n!=t.length||!r?++n:--r;for(var o=t.charAt(r),l=te(o,i)?function(e){return te(e,i)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!te(e)};r>0&&l(t.charAt(r-1));)--r;for(;n<t.length&&l(t.charAt(n));)++n}return new gi(ge(e.line,r),ge(e.line,n))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?W(this.display.cursorDiv,"CodeMirror-overwrite"):S(this.display.cursorDiv,"CodeMirror-overwrite"),rt(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==D()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:Kn(function(e,t){Cn(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-wr(this)-this.display.barHeight,width:e.scrollWidth-wr(this)-this.display.barWidth,clientHeight:Cr(this),clientWidth:kr(this)}},scrollIntoView:Kn(function(e,t){null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:ge(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line?(n=e,Sn(r=this),r.curOp.scrollToPos=n):Ln(this,e.from,e.to,e.margin);var r,n}),setSize:Kn(function(e,t){var r=this,n=function(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e};null!=e&&(this.display.wrapper.style.width=n(e)),null!=t&&(this.display.wrapper.style.height=n(t)),this.options.lineWrapping&&Pr(this);var i=this.display.viewFrom;this.doc.iter(i,this.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){Xn(r,i,"widget");break}++i}),this.curOp.forceUpdate=!0,rt(this,"refresh",this)}),operation:function(e){return Un(this,e)},startOperation:function(){return En(this)},endOperation:function(){return Hn(this)},refresh:Kn(function(){var e=this.display.cachedTextHeight;$n(this),this.curOp.forceUpdate=!0,zr(this),Cn(this,this.doc.scrollLeft,this.doc.scrollTop),oi(this),(null==e||Math.abs(e-Zr(this.display))>.5)&&rn(this),rt(this,"refresh",this)}),swapDoc:Kn(function(e){var t=this.doc;return t.cm=null,Ti(this,e),zr(this),this.display.input.reset(),Cn(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,ir(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},lt(e),e.registerHelper=function(t,n,i){r.hasOwnProperty(t)||(r[t]=e[t]={_global:[]}),r[t][n]=i},e.registerGlobalHelper=function(t,n,i,o){e.registerHelper(t,n,o),r[t]._global.push({pred:i,val:o})}}(_l);var Hl="iter insert remove copy getEditor constructor".split(" ");for(var Il in ko.prototype)ko.prototype.hasOwnProperty(Il)&&I(Hl,Il)<0&&(_l.prototype[Il]=function(e){return function(){return e.apply(this.doc,arguments)}}(ko.prototype[Il]));lt(ko),_l.inputStyles={textarea:El,contenteditable:Wl},_l.defineMode=function(e){_l.defaults.mode||"null"==e||(_l.defaults.mode=e),function(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),wt[e]=t}.apply(this,arguments)},_l.defineMIME=function(e,t){kt[e]=t},_l.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),_l.defineMIME("text/plain","null"),_l.defineExtension=function(e,t){_l.prototype[e]=t},_l.defineDocExtension=function(e,t){ko.prototype[e]=t},_l.fromTextArea=function(e,t){if((t=t?F(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var r=D();t.autofocus=r==e||null!=e.getAttribute("autofocus")&&r==document.body}function n(){e.value=s.getValue()}var i;if(e.form&&(Je(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var l=o.submit=function(){n(),o.submit=i,o.submit(),o.submit=l}}catch(e){}}t.finishInit=function(t){t.save=n,t.getTextArea=function(){return e},t.toTextArea=function(){t.toTextArea=isNaN,n(),e.parentNode.removeChild(t.getWrapperElement()),e.style.display="",e.form&&(tt(e.form,"submit",n),"function"==typeof e.form.submit&&(e.form.submit=i))}},e.style.display="none";var s=_l(function(t){return e.parentNode.insertBefore(t,e.nextSibling)},t);return s},(Rl=_l).off=tt,Rl.on=Je,Rl.wheelEventPixels=hi,Rl.Doc=ko,Rl.splitLines=yt,Rl.countColumn=E,Rl.findColumn=K,Rl.isWordChar=ee,Rl.Pass=B,Rl.signal=rt,Rl.Line=Ut,Rl.changeEnd=yi,Rl.scrollbarModel=zn,Rl.Pos=ge,Rl.cmpPos=me,Rl.modes=wt,Rl.mimeModes=kt,Rl.resolveMode=Ct,Rl.getMode=St,Rl.modeExtensions=Lt,Rl.extendMode=Tt,Rl.copyState=Mt,Rl.startState=At,Rl.innerMode=Nt,Rl.commands=Vo,Rl.keyMap=zo,Rl.keyName=Ro,Rl.isModifierKey=Ho,Rl.lookupKey=Eo,Rl.normalizeKeyMap=Fo,Rl.StringStream=Ot,Rl.SharedTextMarker=bo,Rl.TextMarker=vo,Rl.LineWidget=po,Rl.e_preventDefault=st,Rl.e_stopPropagation=at,Rl.e_stop=ut,Rl.addClass=W,Rl.contains=O,Rl.rmClass=S,Rl.keyNames=Oo;var Rl;return _l.version="5.33.0",_l}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.info=n,this.align=i,this.prev=o}function r(e,r,n,i){var o=e.indented;return e.context&&"statement"==e.context.type&&"statement"!=n&&(o=e.context.indented),e.context=new t(o,r,n,i,null,e.context)}function n(e){var t=e.context.type;return")"!=t&&"]"!=t&&"}"!=t||(e.indented=e.context.indented),e.context=e.context.prev}function i(e,t,r){return"variable"==t.prevToken||"type"==t.prevToken||(!!/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(e.string.slice(0,r))||(!(!t.typeAtEndOfLine||e.column()!=e.indentation())||void 0))}function o(e){for(;;){if(!e||"top"==e.type)return!0;if("}"==e.type&&"namespace"!=e.prev.info)return!1;e=e.prev}}e.defineMode("clike",function(l,a){var c,u,f=l.indentUnit,h=a.statementIndentUnit||f,d=a.dontAlignCalls,p=a.keywords||{},g=a.types||{},m=a.builtin||{},v=a.blockKeywords||{},y=a.defKeywords||{},b=a.atoms||{},_=a.hooks||{},x=a.multiLineStrings,w=!1!==a.indentStatements,k=!1!==a.indentSwitch,C=a.namespaceSeparator,S=a.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,L=a.numberStart||/[\d\.]/,T=a.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,M=a.isOperatorChar||/[+\-*&%=<>!?|\/]/,N=a.isIdentifierChar||/[\w\$_\xa1-\uffff]/;function A(e,t){var r=e.next();if(_[r]){var n=_[r](e,t);if(!1!==n)return n}if('"'==r||"'"==r)return t.tokenize=(i=r,function(e,t){for(var r,n=!1,o=!1;null!=(r=e.next());){if(r==i&&!n){o=!0;break}n=!n&&"\\"==r}return(o||!n&&!x)&&(t.tokenize=null),"string"}),t.tokenize(e,t);var i;if(S.test(r))return c=r,null;if(L.test(r)){if(e.backUp(1),e.match(T))return"number";e.next()}if("/"==r){if(e.eat("*"))return t.tokenize=O,O(e,t);if(e.eat("/"))return e.skipToEnd(),"comment"}if(M.test(r)){for(;!e.match(/^\/[\/*]/,!1)&&e.eat(M););return"operator"}if(e.eatWhile(N),C)for(;e.match(C);)e.eatWhile(N);var o=e.current();return s(p,o)?(s(v,o)&&(c="newstatement"),s(y,o)&&(u=!0),"keyword"):s(g,o)?"type":s(m,o)?(s(v,o)&&(c="newstatement"),"builtin"):s(b,o)?"atom":"variable"}function O(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=null;break}n="*"==r}return"comment"}function D(e,t){a.typeFirstDefinitions&&e.eol()&&o(t.context)&&(t.typeAtEndOfLine=i(e,t,e.pos))}return{startState:function(e){return{tokenize:null,context:new t((e||0)-f,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(e,t){var l=t.context;if(e.sol()&&(null==l.align&&(l.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return D(e,t),null;c=u=null;var s=(t.tokenize||A)(e,t);if("comment"==s||"meta"==s)return s;if(null==l.align&&(l.align=!0),";"==c||":"==c||","==c&&e.match(/^\s*(?:\/\/.*)?$/,!1))for(;"statement"==t.context.type;)n(t);else if("{"==c)r(t,e.column(),"}");else if("["==c)r(t,e.column(),"]");else if("("==c)r(t,e.column(),")");else if("}"==c){for(;"statement"==l.type;)l=n(t);for("}"==l.type&&(l=n(t));"statement"==l.type;)l=n(t)}else c==l.type?n(t):w&&(("}"==l.type||"top"==l.type)&&";"!=c||"statement"==l.type&&"newstatement"==c)&&r(t,e.column(),"statement",e.current());if("variable"==s&&("def"==t.prevToken||a.typeFirstDefinitions&&i(e,t,e.start)&&o(t.context)&&e.match(/^\s*\(/,!1))&&(s="def"),_.token){var f=_.token(e,t,s);void 0!==f&&(s=f)}return"def"==s&&!1===a.styleDefs&&(s="variable"),t.startOfLine=!1,t.prevToken=u?"def":s||c,D(e,t),s},indent:function(t,r){if(t.tokenize!=A&&null!=t.tokenize||t.typeAtEndOfLine)return e.Pass;var n=t.context,i=r&&r.charAt(0);if("statement"==n.type&&"}"==i&&(n=n.prev),a.dontIndentStatements)for(;"statement"==n.type&&a.dontIndentStatements.test(n.info);)n=n.prev;if(_.indent){var o=_.indent(t,n,r);if("number"==typeof o)return o}var l=i==n.type,s=n.prev&&"switch"==n.prev.info;if(a.allmanIndentation&&/[{(]/.test(i)){for(;"top"!=n.type&&"}"!=n.type;)n=n.prev;return n.indented}return"statement"==n.type?n.indented+("{"==i?0:h):!n.align||d&&")"==n.type?")"!=n.type||l?n.indented+(l?0:f)+(l||!s||/^(?:case|default)\b/.test(r)?0:f):n.indented+h:n.column+(l?0:1)},electricInput:k?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:"//",fold:"brace"}});function l(e){for(var t={},r=e.split(" "),n=0;n<r.length;++n)t[r[n]]=!0;return t}function s(e,t){return"function"==typeof e?e(t):e.propertyIsEnumerable(t)}var a="auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile",c="int long char short double float unsigned signed void size_t ptrdiff_t";function u(e,t){if(!t.startOfLine)return!1;for(var r,n=null;r=e.peek();){if("\\"==r&&e.match(/^.$/)){n=u;break}if("/"==r&&e.match(/^\/[\/\*]/,!1))break;e.next()}return t.tokenize=n,"meta"}function f(e,t){return"type"==t.prevToken&&"type"}function h(e){return e.eatWhile(/[\w\.']/),"number"}function d(e,t){if(e.backUp(1),e.match(/(R|u8R|uR|UR|LR)/)){var r=e.match(/"([^\s\\()]{0,16})\(/);return!!r&&(t.cpp11RawStringDelim=r[1],t.tokenize=g,g(e,t))}return e.match(/(u8|u|U|L)/)?!!e.match(/["']/,!1)&&"string":(e.next(),!1)}function p(e,t){for(var r;null!=(r=e.next());)if('"'==r&&!e.eat('"')){t.tokenize=null;break}return"string"}function g(e,t){var r=t.cpp11RawStringDelim.replace(/[^\w\s]/g,"\\$&");return e.match(new RegExp(".*?\\)"+r+'"'))?t.tokenize=null:e.skipToEnd(),"string"}function m(t,r){"string"==typeof t&&(t=[t]);var n=[];function i(e){if(e)for(var t in e)e.hasOwnProperty(t)&&n.push(t)}i(r.keywords),i(r.types),i(r.builtin),i(r.atoms),n.length&&(r.helperType=t[0],e.registerHelper("hintWords",t[0],n));for(var o=0;o<t.length;++o)e.defineMIME(t[o],r)}m(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:l(a),types:l(c+" bool _Complex _Bool float_t double_t intptr_t intmax_t int8_t int16_t int32_t int64_t uintptr_t uintmax_t uint8_t uint16_t uint32_t uint64_t"),blockKeywords:l("case do else for if switch while struct"),defKeywords:l("struct"),typeFirstDefinitions:!0,atoms:l("null true false"),hooks:{"#":u,"*":f},modeProps:{fold:["brace","include"]}}),m(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:l(a+" asm dynamic_cast namespace reinterpret_cast try explicit new static_cast typeid catch operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected alignas alignof constexpr decltype nullptr noexcept thread_local final static_assert override"),types:l(c+" bool wchar_t"),blockKeywords:l("catch class do else finally for if struct switch try while"),defKeywords:l("class namespace struct enum union"),typeFirstDefinitions:!0,atoms:l("true false null"),dontIndentStatements:/^template$/,isIdentifierChar:/[\w\$_~\xa1-\uffff]/,hooks:{"#":u,"*":f,u:d,U:d,L:d,R:d,0:h,1:h,2:h,3:h,4:h,5:h,6:h,7:h,8:h,9:h,token:function(e,t,r){if("variable"==r&&"("==e.peek()&&(";"==t.prevToken||null==t.prevToken||"}"==t.prevToken)&&function(e){var t=/(\w+)::~?(\w+)$/.exec(e);return t&&t[1]==t[2]}(e.current()))return"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),m("text/x-java",{name:"clike",keywords:l("abstract assert break case catch class const continue default do else enum extends final finally float for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while @interface"),types:l("byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:l("catch class do else finally for if switch try while"),defKeywords:l("class interface enum @interface"),typeFirstDefinitions:!0,atoms:l("true false null"),number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,hooks:{"@":function(e){return!e.match("interface",!1)&&(e.eatWhile(/[\w\$_]/),"meta")}},modeProps:{fold:["brace","import"]}}),m("text/x-csharp",{name:"clike",keywords:l("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:l("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:l("catch class do else finally for foreach if struct switch try while"),defKeywords:l("class interface namespace struct var"),typeFirstDefinitions:!0,atoms:l("true false null"),hooks:{"@":function(e,t){return e.eat('"')?(t.tokenize=p,p(e,t)):(e.eatWhile(/[\w\$_]/),"meta")}}});function v(e,t){for(var r=!1;!e.eol();){if(!r&&e.match('"""')){t.tokenize=null;break}r="\\"==e.next()&&!r}return"string"}m("text/x-scala",{name:"clike",keywords:l("abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble"),types:l("AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:l("catch class enum do else finally for forSome if match switch try while"),defKeywords:l("class enum def object package trait type val var"),atoms:l("true false null"),indentStatements:!1,indentSwitch:!1,isOperatorChar:/[+\-*&%=<>!?|\/#:@]/,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return!!e.match('""')&&(t.tokenize=v,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},"=":function(e,r){var n=r.context;return!("}"!=n.type||!n.align||!e.eat(">"))&&(r.context=new t(n.indented,n.column,n.type,n.info,null,n.prev),"operator")},"/":function(e,t){return!!e.eat("*")&&(t.tokenize=function e(t){return function(r,n){for(var i;i=r.next();){if("*"==i&&r.eat("/")){if(1==t){n.tokenize=null;break}return n.tokenize=e(t-1),n.tokenize(r,n)}if("/"==i&&r.eat("*"))return n.tokenize=e(t+1),n.tokenize(r,n)}return"comment"}}(1),t.tokenize(e,t))}},modeProps:{closeBrackets:{triples:'"'}}});m("text/x-kotlin",{name:"clike",keywords:l("package as typealias class interface this super val var fun for is in This throw return break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix suspend actual expect"),types:l("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),intendSwitch:!1,indentStatements:!1,multiLineStrings:!0,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,blockKeywords:l("catch class do else finally for if where try while enum"),defKeywords:l("class val var object interface fun"),atoms:l("true false null this"),hooks:{'"':function(e,t){t.tokenize=(r=e.match('""'),function(e,t){for(var n,i=!1,o=!1;!e.eol();){if(!r&&!i&&e.match('"')){o=!0;break}if(r&&e.match('"""')){o=!0;break}n=e.next(),!i&&"$"==n&&e.match("{")&&e.skipTo("}"),i=!i&&"\\"==n&&!r}return!o&&r||(t.tokenize=null),"string"});var r;return t.tokenize(e,t)}},modeProps:{closeBrackets:{triples:'"'}}}),m(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:l("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:l("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:l("for while do if else struct"),builtin:l("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:l("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":u},modeProps:{fold:["brace","include"]}}),m("text/x-nesc",{name:"clike",keywords:l(a+"as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:l(c),blockKeywords:l("case do else for if switch while struct"),atoms:l("null true false"),hooks:{"#":u},modeProps:{fold:["brace","include"]}}),m("text/x-objectivec",{name:"clike",keywords:l(a+"inline restrict _Bool _Complex _Imaginary BOOL Class bycopy byref id IMP in inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),types:l(c),atoms:l("YES NO NULL NILL ON OFF true false"),hooks:{"@":function(e){return e.eatWhile(/[\w\$]/),"keyword"},"#":u,indent:function(e,t,r){if("statement"==t.type&&/^@\w/.test(r))return t.indented}},modeProps:{fold:"brace"}}),m("text/x-squirrel",{name:"clike",keywords:l("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:l(c),blockKeywords:l("case catch class else for foreach if switch try while"),defKeywords:l("function local class"),typeFirstDefinitions:!0,atoms:l("true false null"),hooks:{"#":u},modeProps:{fold:["brace","include"]}});var y=null;m("text/x-ceylon",{name:"clike",keywords:l("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(e){var t=e.charAt(0);return t===t.toUpperCase()&&t!==t.toLowerCase()},blockKeywords:l("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:l("class dynamic function interface module object package value"),builtin:l("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:l("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return t.tokenize=function e(t){return function(r,n){for(var i,o=!1,l=!1;!r.eol();){if(!o&&r.match('"')&&("single"==t||r.match('""'))){l=!0;break}if(!o&&r.match("``")){y=e(t),l=!0;break}i=r.next(),o="single"==t&&!o&&"\\"==i}return l&&(n.tokenize=null),"string"}}(e.match('""')?"triple":"single"),t.tokenize(e,t)},"`":function(e,t){return!(!y||!e.match("`"))&&(t.tokenize=y,y=null,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(e,t,r){if(("variable"==r||"type"==r)&&"."==t.prevToken)return"variable-2"}},modeProps:{fold:["brace","import"],closeBrackets:{triples:'"'}}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../clike/clike")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../clike/clike"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},r=e.split(" "),n=0;n<r.length;++n)t[r[n]]=!0;return t}function r(e,t,i){return 0==e.length?n(t):function(o,l){for(var s=e[0],a=0;a<s.length;a++)if(o.match(s[a][0]))return l.tokenize=r(e.slice(1),t),s[a][1];return l.tokenize=n(t,i),"string"}}function n(e,t){return function(n,i){return function(e,t,n,i){if(!1!==i&&e.match("${",!1)||e.match("{$",!1))return t.tokenize=null,"string";if(!1!==i&&e.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/))return e.match("[",!1)&&(t.tokenize=r([[["[",null]],[[/\d[\w\.]*/,"number"],[/\$[a-zA-Z_][a-zA-Z0-9_]*/,"variable-2"],[/[\w\$]+/,"variable"]],[["]",null]]],n,i)),e.match(/\-\>\w/,!1)&&(t.tokenize=r([[["->",null]],[[/[\w]+/,"variable"]]],n,i)),"variable-2";var o=!1;for(;!e.eol()&&(o||!1===i||!e.match("{$",!1)&&!e.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/,!1));){if(!o&&e.match(n)){t.tokenize=null,t.tokStack.pop(),t.tokStack.pop();break}o="\\"==e.next()&&!o}return"string"}(n,i,e,t)}}var i="abstract and array as break case catch class clone const continue declare default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach function global goto if implements interface instanceof namespace new or private protected public static switch throw trait try use var while xor die echo empty exit eval include include_once isset list require require_once return print unset __halt_compiler self static parent yield insteadof finally",o="true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__",l="func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents file_put_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists array_intersect_key array_combine array_column pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count";e.registerHelper("hintWords","php",[i,o,l].join(" ").split(" ")),e.registerHelper("wordChars","php",/[\w$]/);var s={name:"clike",helperType:"php",keywords:t(i),blockKeywords:t("catch do else elseif for foreach if switch try while finally"),defKeywords:t("class function interface namespace trait"),atoms:t(o),builtin:t(l),multiLineStrings:!0,hooks:{$:function(e){return e.eatWhile(/[\w\$_]/),"variable-2"},"<":function(e,t){var r;if(r=e.match(/<<\s*/)){var i=e.eat(/['"]/);e.eatWhile(/[\w\.]/);var o=e.current().slice(r[0].length+(i?2:1));if(i&&e.eat(i),o)return(t.tokStack||(t.tokStack=[])).push(o,0),t.tokenize=n(o,"'"!=i),"string"}return!1},"#":function(e){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"},"/":function(e){if(e.eat("/")){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"}return!1},'"':function(e,t){return(t.tokStack||(t.tokStack=[])).push('"',0),t.tokenize=n('"'),"string"},"{":function(e,t){return t.tokStack&&t.tokStack.length&&t.tokStack[t.tokStack.length-1]++,!1},"}":function(e,t){return t.tokStack&&t.tokStack.length>0&&!--t.tokStack[t.tokStack.length-1]&&(t.tokenize=n(t.tokStack[t.tokStack.length-2])),!1}}};e.defineMode("php",function(t,r){var n=e.getMode(t,r&&r.htmlMode||"text/html"),i=e.getMode(t,s);return{startState:function(){var t=e.startState(n),o=r.startOpen?e.startState(i):null;return{html:t,php:o,curMode:r.startOpen?i:n,curState:r.startOpen?o:t,pending:null}},copyState:function(t){var r,o=t.html,l=e.copyState(n,o),s=t.php,a=s&&e.copyState(i,s);return r=t.curMode==n?l:a,{html:l,php:a,curMode:t.curMode,curState:r,pending:t.pending}},token:function(t,r){var o=r.curMode==i;if(t.sol()&&r.pending&&'"'!=r.pending&&"'"!=r.pending&&(r.pending=null),o)return o&&null==r.php.tokenize&&t.match("?>")?(r.curMode=n,r.curState=r.html,r.php.context.prev||(r.php=null),"meta"):i.token(t,r.curState);if(t.match(/^<\?\w*/))return r.curMode=i,r.php||(r.php=e.startState(i,n.indent(r.html,""))),r.curState=r.php,"meta";if('"'==r.pending||"'"==r.pending){for(;!t.eol()&&t.next()!=r.pending;);var l="string"}else r.pending&&t.pos<r.pending.end?(t.pos=r.pending.end,l=r.pending.style):l=n.token(t,r.curState);r.pending&&(r.pending=null);var s,a=t.current(),c=a.search(/<\?/);return-1!=c&&("string"==l&&(s=a.match(/[\'\"]$/))&&!/\?>/.test(a)?r.pending=s[0]:r.pending={end:t.pos,style:l},t.backUp(a.length-c)),l},indent:function(e,t){return e.curMode!=i&&/^\s*<\//.test(t)||e.curMode==i&&/^\?>/.test(t)?n.indent(e.html,t):e.curMode.indent(e.curState,t)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",innerMode:function(e){return{state:e.curState,mode:e.curMode}}}},"htmlmixed","clike"),e.defineMIME("application/x-httpd-php","php"),e.defineMIME("application/x-httpd-php-open",{name:"php",startOpen:!0}),e.defineMIME("text/x-php",s)}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){var t=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),r=e.Pos,n={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"};function i(e,t,i){var l=e.getLineHandle(t.line),s=t.ch-1,a=i&&i.afterCursor;null==a&&(a=/(^| )cm-fat-cursor($| )/.test(e.getWrapperElement().className));var c=!a&&s>=0&&n[l.text.charAt(s)]||n[l.text.charAt(++s)];if(!c)return null;var u=">"==c.charAt(1)?1:-1;if(i&&i.strict&&u>0!=(s==t.ch))return null;var f=e.getTokenTypeAt(r(t.line,s+1)),h=o(e,r(t.line,s+(u>0?1:0)),u,f||null,i);return null==h?null:{from:r(t.line,s),to:h&&h.pos,match:h&&h.ch==c.charAt(0),forward:u>0}}function o(e,t,i,o,l){for(var s=l&&l.maxScanLineLength||1e4,a=l&&l.maxScanLines||1e3,c=[],u=l&&l.bracketRegex?l.bracketRegex:/[(){}[\]]/,f=i>0?Math.min(t.line+a,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-a),h=t.line;h!=f;h+=i){var d=e.getLine(h);if(d){var p=i>0?0:d.length-1,g=i>0?d.length:-1;if(!(d.length>s))for(h==t.line&&(p=t.ch-(i<0?1:0));p!=g;p+=i){var m=d.charAt(p);if(u.test(m)&&(void 0===o||e.getTokenTypeAt(r(h,p+1))==o)){if(">"==n[m].charAt(1)==i>0)c.push(m);else{if(!c.length)return{pos:r(h,p),ch:m};c.pop()}}}}}return h-i!=(i>0?e.lastLine():e.firstLine())&&null}function l(e,n,o){for(var l=e.state.matchBrackets.maxHighlightLineLength||1e3,s=[],a=e.listSelections(),c=0;c<a.length;c++){var u=a[c].empty()&&i(e,a[c].head,o);if(u&&e.getLine(u.from.line).length<=l){var f=u.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";s.push(e.markText(u.from,r(u.from.line,u.from.ch+1),{className:f})),u.to&&e.getLine(u.to.line).length<=l&&s.push(e.markText(u.to,r(u.to.line,u.to.ch+1),{className:f}))}}if(s.length){t&&e.state.focused&&e.focus();var h=function(){e.operation(function(){for(var e=0;e<s.length;e++)s[e].clear()})};if(!n)return h;setTimeout(h,800)}}var s=null;function a(e){e.operation(function(){s&&(s(),s=null),s=l(e,!1,e.state.matchBrackets)})}e.defineOption("matchBrackets",!1,function(t,r,n){n&&n!=e.Init&&(t.off("cursorActivity",a),s&&(s(),s=null)),r&&(t.state.matchBrackets="object"==typeof r?r:{},t.on("cursorActivity",a))}),e.defineExtension("matchBrackets",function(){l(this,!0)}),e.defineExtension("findMatchingBracket",function(e,t,r){return(r||"boolean"==typeof t)&&(r?(r.strict=t,t=r):t=t?{strict:!0}:null),i(this,e,t)}),e.defineExtension("scanForBracket",function(e,t,r,n){return o(this,e,t,r,n)})});
 
admin/assets/js/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
admin/assets/js/scripts.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($){
2
+ $(document).on( 'click', '.winp-enable-php-btn', function(e) {
3
+ e.preventDefault();
4
+ var icon = $(this).children('i'),
5
+ label = $(this).children('.winp-btn-title'),
6
+ input = $(this).children('.winp-with-php');
7
+
8
+ $(this).toggleClass('winp-active');
9
+
10
+ if( $(this).hasClass('winp-active') ) {
11
+ icon.attr( 'class', 'dashicons dashicons-edit' );
12
+ label.text( $(this).data( 'disable-text' ) );
13
+ input.val('enabled');
14
+ $('body').addClass( 'winp-snippet-enabled' );
15
+ } else {
16
+ icon.attr( 'class', 'dashicons dashicons-editor-code' );
17
+ label.text( $(this).data( 'enable-text' ) );
18
+ input.val('');
19
+ $('body').removeClass( 'winp-snippet-enabled' );
20
+ }
21
+ });
22
+
23
+ })(jQuery);
admin/assets/js/tinymce4.4.js CHANGED
@@ -19,7 +19,39 @@
19
  text: item.title,
20
  value: item.id,
21
  onclick: function() {
22
- editor.selection.setContent('[wbcr_php_snippet id="' + item.id + '" title="' + item.title + '"]');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  }
24
  });
25
  });
19
  text: item.title,
20
  value: item.id,
21
  onclick: function() {
22
+ var content = "";
23
+ var snippet_type = "php";
24
+ var snippet_name = "wbcr_php_snippet";
25
+ var selected_content = editor.selection.getContent();
26
+
27
+ for( var tag in item ) {
28
+ if( !item.hasOwnProperty(tag) ) {
29
+ continue;
30
+ }
31
+
32
+ if( 'type' === tag ) {
33
+ snippet_type = item[tag];
34
+ } else if( tag.indexOf('snippet_tags') === -1 ) {
35
+ if( !('' !== selected_content && 'content' === tag) ) {
36
+ content += ' ' + tag + '="' + item[tag] + '"';
37
+ }
38
+ }
39
+ }
40
+
41
+ if( 'text' === snippet_type ) {
42
+ snippet_name = "wbcr_text_snippet";
43
+ } else if( 'universal' === snippet_type ) {
44
+ snippet_name = "wbcr_snippet";
45
+ }
46
+
47
+ if( '' === selected_content ) {
48
+ editor.selection.setContent('[' + snippet_name + content + ']');
49
+ } else {
50
+ editor.selection.setContent(
51
+ '[' + snippet_name + content + ']' +
52
+ selected_content +
53
+ '[/' + snippet_name + ']');
54
+ }
55
  }
56
  });
57
  });
admin/assets/js/view-opt.js ADDED
@@ -0,0 +1,1103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ if( !window.winp ) {
2
+ window.winp = {};
3
+ }
4
+
5
+ (function($) {
6
+
7
+ /**
8
+ * Condition Editor
9
+ */
10
+ $.widget("winp.winpConditionEditor", {
11
+
12
+ options: {
13
+ filters: null
14
+ },
15
+
16
+ _create: function() {
17
+ var self = this;
18
+
19
+ this._counter = 0;
20
+
21
+ this._$editor = this.element;
22
+ this._$editor.data('winp-api', this);
23
+
24
+ this._$filters = this._$editor.find(".winp-filters");
25
+ this._$tmplFilter = this._$editor.find(".winp-filter.winp-template").clone().removeClass("winp-template");
26
+
27
+ this._$btnAdd = this._$editor.find(".winp-add-filter");
28
+
29
+ this._$btnAdd.click(function() {
30
+ self.addFilter();
31
+ return false;
32
+ });
33
+
34
+ this._$editor.on('winp.filters-changed', function() {
35
+ self._checkIsEmpty();
36
+ self._checkIsDeleted();
37
+ });
38
+
39
+ this._load();
40
+
41
+ this._checkIsEmpty();
42
+ },
43
+
44
+ _load: function() {
45
+
46
+ if( this.options.filters ) {
47
+ for( var index in this.options.filters ) {
48
+ this.addFilter(this.options.filters[index]);
49
+ }
50
+ }
51
+ },
52
+
53
+ _checkIsEmpty: function() {
54
+
55
+ if( this.getCount() === 0 ) {
56
+ this._$editor.addClass('winp-empty');
57
+ } else {
58
+ this._$editor.removeClass('winp-empty');
59
+ }
60
+ },
61
+
62
+ _checkIsDeleted: function() {
63
+
64
+ if( this.getCount() === 0 ) {
65
+ this.markChangeFilters();
66
+ }
67
+ },
68
+
69
+ markChangeFilters: function() {
70
+ this._$editor.find("#winp_changed_filters").val(1);
71
+ },
72
+
73
+ addFilter: function(data) {
74
+ if( !data ) {
75
+ data = {type: 'showif'};
76
+ }
77
+
78
+ var self = this;
79
+
80
+ var $filter = this._$tmplFilter.clone();
81
+ this._$filters.append($filter);
82
+
83
+ $filter.data('winp-editor', this._$editor);
84
+
85
+ this._counter = this._counter + 1;
86
+
87
+ $filter.winpConditionFilter({
88
+ index: self._counter,
89
+ type: data.type,
90
+ conditions: data.conditions
91
+ });
92
+
93
+ self._$editor.trigger('winp.filters-changed');
94
+ return $filter;
95
+ },
96
+
97
+ getData: function() {
98
+ var filters = [];
99
+
100
+ this._$filters.find(".winp-filter").each(function() {
101
+ var definition = $(this).winpConditionFilter('getData');
102
+ filters.push(definition);
103
+ });
104
+
105
+ return filters;
106
+ },
107
+
108
+ getCount: function() {
109
+ return this._$editor.find('.winp-filter:not(.winp-template)').length;
110
+ }
111
+ });
112
+
113
+ /**
114
+ * Condition Filter
115
+ */
116
+ $.widget("winp.winpConditionFilter", {
117
+
118
+ options: {
119
+ type: 'showif',
120
+ conditions: null,
121
+ index: null
122
+ },
123
+
124
+ _create: function() {
125
+ var self = this;
126
+
127
+ this._counter = 0;
128
+ this._index = this.options.index;
129
+
130
+ this._$filter = this.element;
131
+ this._$filter.data('winp-api', this);
132
+
133
+ this._$editor = this._$filter.data('winp-editor');
134
+ this._$conditions = this._$filter.find(".winp-conditions");
135
+
136
+ this._$tmplCondition = this._$editor.find(".winp-condition.winp-template").clone().removeClass("winp-template");
137
+ this._$tmplScope = this._$editor.find(".winp-scope.winp-template").clone().removeClass("winp-template");
138
+
139
+ this._load();
140
+
141
+ this._$filter.find(".winp-link-add").click(function() {
142
+ self.addCondition();
143
+ return false;
144
+ });
145
+
146
+ this._$filter.find(".btn-remove-filter").click(function() {
147
+ self._$filter.remove();
148
+ self._$editor.trigger('winp.filters-changed');
149
+ return false;
150
+ });
151
+
152
+ this._$filter.find(".winp-btn-apply-template").click(function() {
153
+ var templateName = $(".winp-select-template").val();
154
+
155
+ if( templateName ) {
156
+ var data = self.getTemplateData(templateName);
157
+ if( data ) {
158
+ self.setFilterData(data);
159
+ }
160
+ }
161
+
162
+ return false;
163
+ });
164
+
165
+ this._$filter.on('winp.conditions-changed', function() {
166
+ self._checkIsEmpty();
167
+ });
168
+ },
169
+
170
+ _load: function() {
171
+
172
+ if( !this.options.conditions ) {
173
+ this.addCondition();
174
+ } else {
175
+ this.setFilterData(this.options);
176
+ }
177
+ },
178
+
179
+ setFilterData: function(data) {
180
+
181
+ this._$filter.find('.winp-condition').remove();
182
+
183
+ if( data.conditions ) {
184
+ for( var index in data.conditions ) {
185
+ this.addCondition(data.conditions[index]);
186
+ }
187
+ }
188
+
189
+ this._$filter.find(".winp-filter-type").val(data.type);
190
+ this._checkIsEmpty();
191
+ },
192
+
193
+ _checkIsEmpty: function() {
194
+
195
+ if( this.getCount() === 0 ) {
196
+ this._$filter.addClass('winp-empty');
197
+ } else {
198
+ this._$filter.removeClass('winp-empty');
199
+ }
200
+
201
+ this._$conditions.find('.winp-scope').each(function() {
202
+ var count = $(this).find('.winp-condition').length;
203
+ if( count === 0 ) {
204
+ $(this).remove();
205
+ }
206
+ });
207
+ },
208
+
209
+ addCondition: function(data, $scope) {
210
+ if( !data ) {
211
+ data = {type: 'condition'};
212
+ }
213
+
214
+ if( data.type === 'scope' ) {
215
+ this.addScope(data);
216
+ } else if( data.type === 'condition' && !$scope ) {
217
+ var $scope = this.addScope();
218
+ this.addCondition(data, $scope);
219
+ } else {
220
+
221
+ var $condition = this._$tmplCondition.clone();
222
+ $scope.append($condition);
223
+
224
+ $condition.data('winp-scope', $scope);
225
+ $condition.data('winp-editor', this._$editor);
226
+ $condition.data('winp-filter', this._$filter);
227
+
228
+ this._counter = this._counter + 1;
229
+ data.index = this._index + '_' + this._counter;
230
+
231
+ $condition.winpCondition(data);
232
+ this._$filter.trigger('winp.conditions-changed');
233
+ }
234
+ },
235
+
236
+ addScope: function(data) {
237
+ if( !data ) {
238
+ data = {};
239
+ }
240
+
241
+ var $scope = this._$tmplScope.clone();
242
+ this._$conditions.append($scope);
243
+
244
+ if( data && data.conditions ) {
245
+ for( var index in data.conditions ) {
246
+ this.addCondition(data.conditions[index], $scope);
247
+ }
248
+ }
249
+
250
+ return $scope;
251
+ },
252
+
253
+ getData: function() {
254
+ var scopes = [];
255
+
256
+ this._$conditions.find('.winp-scope').each(function() {
257
+
258
+ var scope = {
259
+ type: 'scope',
260
+ conditions: []
261
+ };
262
+
263
+ scopes.push(scope);
264
+
265
+ $(this).find('.winp-condition').each(function() {
266
+ var condition = $(this).winpCondition('getData');
267
+ scope.conditions.push(condition);
268
+ });
269
+ });
270
+
271
+ var filterType = this._$filter.find(".winp-filter-type").val();
272
+
273
+ return {
274
+ conditions: scopes,
275
+ type: filterType
276
+ };
277
+ },
278
+
279
+ getCount: function() {
280
+ return this._$filter.find('.winp-condition').length;
281
+ },
282
+
283
+ getTemplateData: function(paramName) {
284
+ if( !window.winp ) {
285
+ return;
286
+ }
287
+ if( !window.winp.templates ) {
288
+ return;
289
+ }
290
+
291
+ for( var index in window.winp.templates ) {
292
+ var data = window.winp.templates[index];
293
+ if( data['id'] === paramName ) {
294
+ return data['filter'];
295
+ }
296
+ }
297
+
298
+ return false;
299
+ }
300
+ });
301
+
302
+ /**
303
+ * Condition
304
+ */
305
+ $.widget("winp.winpCondition", {
306
+
307
+ options: {
308
+ index: null
309
+ },
310
+
311
+ _create: function() {
312
+ this._index = this.options.index;
313
+
314
+ this._$condition = this.element;
315
+ this._$condition.data('winp-condition', this);
316
+
317
+ this._$editor = this._$condition.data('winp-editor');
318
+ this._$filter = this._$condition.data('winp-filter');
319
+ this._$scope = this._$condition.data('winp-scope');
320
+
321
+ this._editor = this._$editor.data('winp-api');
322
+ this._filter = this._$filter.data('winp-api');
323
+
324
+ this._$hint = this.element.find(".winp-hint");
325
+ this._$hintContent = this.element.find(".winp-hint-content");
326
+
327
+ this._$tmplDateControl = this._$editor.find(".winp-date-control.winp-template").clone().removeClass("winp-template");
328
+ },
329
+
330
+ _init: function() {
331
+ var self = this;
332
+
333
+ this._$condition.find(".winp-param-select").change(function() {
334
+ self.prepareFields();
335
+ });
336
+ self.prepareFields(true);
337
+
338
+ // buttons
339
+
340
+ this._$condition.find(".winp-btn-remove").click(function() {
341
+ self._editor.markChangeFilters();
342
+ self.remove();
343
+ return false;
344
+ });
345
+
346
+ this._$condition.find(".winp-btn-or").click(function() {
347
+ self._editor.markChangeFilters();
348
+ self._filter.addCondition(null, self._$scope);
349
+ return false;
350
+ });
351
+
352
+ this._$condition.find(".winp-btn-and").click(function() {
353
+ self._editor.markChangeFilters();
354
+ self._filter.addCondition();
355
+ return false;
356
+ });
357
+ },
358
+
359
+ remove: function() {
360
+ this._$condition.remove();
361
+ this._$filter.trigger('winp.conditions-changed');
362
+ },
363
+
364
+ getData: function() {
365
+
366
+ var currentParam = this._$condition.find(".winp-param-select").val();
367
+ var paramOptions = this.getParamOptions(currentParam);
368
+
369
+ var $operator = this._$condition.find(".winp-operator-select");
370
+ var currentOperator = $operator.val();
371
+
372
+ var value = null;
373
+
374
+ if( 'select' === paramOptions['type'] ) {
375
+ value = this.getSelectValue(paramOptions);
376
+ } else if( 'date' === paramOptions['type'] ) {
377
+ value = this.getDateValue(paramOptions);
378
+ } else if( 'integer' === paramOptions['type'] ) {
379
+ value = this.getIntegerValue(paramOptions);
380
+ } else {
381
+ value = this.getTextValue(paramOptions);
382
+ }
383
+
384
+ return {
385
+ param: currentParam,
386
+ operator: currentOperator,
387
+ type: paramOptions['type'],
388
+ value: value
389
+ };
390
+ },
391
+
392
+ prepareFields: function(isInit) {
393
+ var self = this;
394
+
395
+ if( isInit && this.options.param ) {
396
+ this.selectParam(this.options.param);
397
+ }
398
+
399
+ var currentParam = this._$condition.find(".winp-param-select").val();
400
+ var paramOptions = this.getParamOptions(currentParam);
401
+
402
+ this.setParamHint(paramOptions.description);
403
+
404
+ var operators = [];
405
+
406
+ if( 'select' === paramOptions['type'] || paramOptions['onlyEquals'] ) {
407
+ operators = ['equals', 'notequal'];
408
+ } else if( 'date' === paramOptions['type'] ) {
409
+ operators = ['equals', 'notequal', 'younger', 'older', 'between'];
410
+ } else if( 'integer' === paramOptions['type'] ) {
411
+ operators = ['equals', 'notequal', 'less', 'greater', 'between'];
412
+ } else {
413
+ operators = ['equals', 'notequal', 'contains', 'notcontain'];
414
+ }
415
+
416
+ this.setOperators(operators);
417
+
418
+ if( isInit && this.options.operator ) {
419
+ this.selectOperator(this.options.operator);
420
+ }
421
+
422
+ this.createValueControl(paramOptions, isInit);
423
+ },
424
+
425
+ /**
426
+ * Displays and configures the param hint.
427
+ */
428
+ setParamHint: function(description) {
429
+
430
+ if( description ) {
431
+ this._$hintContent.html(description);
432
+ this._$hint.show();
433
+ } else {
434
+ this._$hint.hide();
435
+ }
436
+ },
437
+
438
+ /**
439
+ * Creates control to specify value.
440
+ */
441
+ createValueControl: function(paramOptions, isInit) {
442
+
443
+ if( 'select' === paramOptions['type'] ) {
444
+ this.createValueAsSelect(paramOptions, isInit);
445
+ } else if( 'date' === paramOptions['type'] ) {
446
+ this.createValueAsDate(paramOptions, isInit);
447
+ } else if( 'integer' === paramOptions['type'] ) {
448
+ this.createValueAsInteger(paramOptions, isInit);
449
+ } else {
450
+ this.createValueAsText(paramOptions, isInit);
451
+ }
452
+ },
453
+
454
+ // -------------------
455
+ // Select Control
456
+ // -------------------
457
+
458
+ /**
459
+ * Creates the Select control.
460
+ */
461
+ createValueAsSelect: function(paramOptions, isInit) {
462
+ var self = this;
463
+
464
+ var createSelect = function(values) {
465
+ var $select = self.createSelect(values);
466
+ self.insertValueControl($select);
467
+ if( isInit && self.options.value ) {
468
+ self.setSelectValue(self.options.value);
469
+ }
470
+ self._$condition.find(".winp-value").trigger("insert.select");
471
+ };
472
+
473
+ if( !paramOptions['values'] ) {
474
+ return;
475
+ }
476
+ if( 'ajax' === paramOptions['values']['type'] ) {
477
+
478
+ var $fakeSelect = self.createSelect([
479
+ {
480
+ value: null,
481
+ title: '- loading -'
482
+ }
483
+ ]);
484
+ self.insertValueControl($fakeSelect);
485
+
486
+ $fakeSelect.attr('disabled', 'disabled');
487
+ $fakeSelect.addClass('winp-fake-select');
488
+
489
+ if( isInit && this.options.value ) {
490
+ $fakeSelect.data('value', this.options.value);
491
+ }
492
+
493
+ var req = $.ajax({
494
+ url: window.ajaxurl,
495
+ data: {
496
+ action: paramOptions['values']['action']
497
+ },
498
+ dataType: 'json',
499
+ success: function(data) {
500
+
501
+ if( data.error ) {
502
+ self.advancedOptions.showError(data.error);
503
+ return;
504
+ } else if( !data.values ) {
505
+ self.advancedOptions.showError(req.responseText);
506
+ return;
507
+ }
508
+
509
+ createSelect(data.values);
510
+ },
511
+ error: function() {
512
+ self.advancedOptions.showError('Unexpected error during the ajax request.');
513
+ },
514
+ complete: function() {
515
+ if( $fakeSelect ) {
516
+ $fakeSelect.remove();
517
+ }
518
+ $fakeSelect = null;
519
+ }
520
+ });
521
+ } else {
522
+ createSelect(paramOptions['values']);
523
+ }
524
+ },
525
+
526
+ /**
527
+ * Returns a value for the select control.
528
+ */
529
+ getSelectValue: function() {
530
+ var $select = this._$condition.find(".winp-value select");
531
+
532
+ var value = $select.val();
533
+ if( !value ) {
534
+ value = $select.data('value');
535
+ }
536
+ return value;
537
+ },
538
+
539
+ /**
540
+ * Sets a select value.
541
+ */
542
+ setSelectValue: function(value) {
543
+ var $select = this._$condition.find(".winp-value select");
544
+
545
+ if( $select.hasClass('.winp-fake-select') ) {
546
+ $select.data('value', value);
547
+ } else {
548
+ $select.val(value);
549
+ }
550
+ },
551
+
552
+ // -------------------
553
+ // Date Control
554
+ // -------------------
555
+
556
+ /**
557
+ * Creates a control for the input linked with the date.
558
+ */
559
+ createValueAsDate: function(paramOptions, isInit) {
560
+
561
+ var $operator = this._$condition.find(".winp-operator-select");
562
+ var $control = this._$tmplDateControl.clone();
563
+
564
+ $operator.change(function() {
565
+ var currentOperator = $operator.val();
566
+
567
+ if( 'between' === currentOperator ) {
568
+ $control.addClass('winp-between');
569
+ $control.removeClass('winp-solo');
570
+ } else {
571
+ $control.addClass('winp-solo');
572
+ $control.removeClass('winp-between');
573
+ }
574
+
575
+ });
576
+
577
+ $operator.change();
578
+
579
+ var $radioes = $control.find(".winp-switcher input")
580
+ .attr('name', 'winp_switcher_' + this._index)
581
+ .click(function() {
582
+ var value = $control.find(".winp-switcher input:checked").val();
583
+ if( 'relative' === value ) {
584
+ $control.addClass('winp-relative');
585
+ $control.removeClass('winp-absolute');
586
+ } else {
587
+ $control.addClass('winp-absolute');
588
+ $control.removeClass('winp-relative');
589
+ }
590
+ });
591
+
592
+ $control.find(".winp-absolute-date input[type='text']").datepicker({
593
+ format: 'dd.mm.yyyy',
594
+ todayHighlight: true,
595
+ autoclose: true
596
+ });
597
+
598
+ this.insertValueControl($control);
599
+ if( isInit && this.options.value ) {
600
+ this.setDateValue(this.options.value);
601
+ }
602
+ },
603
+
604
+ /**
605
+ * Returns a value for the Date control.
606
+ * @returns {undefined}
607
+ */
608
+ getDateValue: function() {
609
+ var value = {};
610
+
611
+ var $operator = this._$condition.find(".winp-operator-select");
612
+ var currentOperator = $operator.val();
613
+
614
+ var $control = this._$condition.find(".winp-value > .winp-date-control");
615
+ var $holder = this._$condition.find(".winp-value > .winp-date-control");
616
+
617
+ if( 'between' === currentOperator ) {
618
+ $holder = $holder.find(".winp-between-date");
619
+ value.range = true;
620
+
621
+ value.start = {};
622
+ value.end = {};
623
+
624
+ if( $control.hasClass('winp-relative') ) {
625
+ $holder = $holder.find(".winp-relative-date");
626
+
627
+ value.start.unitsCount = $holder.find(".winp-date-value-start").val();
628
+ value.end.unitsCount = $holder.find(".winp-date-value-end").val();
629
+
630
+ value.start.units = $holder.find(".winp-date-start-units").val();
631
+ value.end.units = $holder.find(".winp-date-end-units").val();
632
+
633
+ value.start.type = 'relative';
634
+ value.end.type = 'relative';
635
+
636
+ } else {
637
+ $holder = $holder.find(".winp-absolute-date");
638
+
639
+ value.start = $holder.find(".winp-date-value-start").datepicker('getUTCDate').getTime();
640
+ value.end = $holder.find(".winp-date-value-end").datepicker('getUTCDate').getTime();
641
+ value.end = value.end + ( ( ( 23 * 60 * 60 ) + ( 59 * 60 ) + 59 ) * 1000 ) + 999;
642
+ }
643
+
644
+ } else {
645
+ $holder = $holder.find(".winp-solo-date");
646
+ value.range = false;
647
+
648
+ if( $control.hasClass('winp-relative') ) {
649
+ $holder = $holder.find(".winp-relative-date");
650
+
651
+ value.type = 'relative';
652
+ value.unitsCount = $holder.find(".winp-date-value").val();
653
+ value.units = $holder.find(".winp-date-value-units").val();
654
+
655
+ } else {
656
+ $holder = $holder.find(".winp-absolute-date");
657
+ value = $holder.find("input[type='text']").datepicker('getUTCDate').getTime();
658
+
659
+ if( 'older' === currentOperator ) {
660
+ value = value + ( ( ( 23 * 60 * 60 ) + ( 59 * 60 ) + 59 ) * 1000 ) + 999;
661
+ }
662
+ }
663
+ }
664
+
665
+ return value;
666
+ },
667
+
668
+ /**
669
+ * Sets a select value.
670
+ */
671
+ setDateValue: function(value) {
672
+ if( !value ) {
673
+ value = {};
674
+ }
675
+
676
+ var $holder = this._$condition.find(".winp-value > .winp-date-control");
677
+ var $control = this._$condition.find(".winp-value > .winp-date-control");
678
+
679
+ if( value.range ) {
680
+
681
+ if( 'relative' === value.start.type ) {
682
+ $holder = $holder.find(".winp-relative-date");
683
+
684
+ $holder.find(".winp-date-value-start").val(value.start.unitsCount);
685
+ $holder.find(".winp-date-value-end").val(value.end.unitsCount);
686
+ $holder.find(".winp-date-start-units").val(value.start.units);
687
+ $holder.find(".winp-date-end-units").val(value.end.units);
688
+
689
+ } else {
690
+ $holder = $holder.find(".winp-absolute-date");
691
+
692
+ var start = new Date(value.start);
693
+ var end = new Date(value.end);
694
+
695
+ $holder.find(".winp-date-value-start").datepicker('setUTCDate', start);
696
+ $holder.find(".winp-date-value-end").datepicker('setUTCDate', end);
697
+ }
698
+
699
+ } else {
700
+
701
+ if( 'relative' === value.type ) {
702
+ $holder = $holder.find(".winp-relative-date");
703
+
704
+ $holder.find(".winp-date-value").val(value.unitsCount);
705
+ $holder.find(".winp-date-value-units").val(value.units);
706
+
707
+ } else {
708
+ $holder = $holder.find(".winp-absolute-date");
709
+
710
+ var date = new Date(value);
711
+ $holder.find(".winp-date-value").datepicker('setUTCDate', date);
712
+ }
713
+ }
714
+
715
+ var $relative = $control.find(".winp-switcher input[value=relative]");
716
+ var $absolute = $control.find(".winp-switcher input[value=absolute]");
717
+
718
+ if( 'relative' === value.type || ( value.start && 'relative' === value.start.type ) ) {
719
+ $relative.attr('checked', 'checked');
720
+ $relative.click();
721
+ } else {
722
+ $absolute.attr('checked', 'checked');
723
+ $absolute.click();
724
+ }
725
+ },
726
+
727
+ // -------------------
728
+ // Integer Control
729
+ // -------------------
730
+
731
+ /**
732
+ * Creates a control for the input linked with the integer.
733
+ */
734
+ createValueAsInteger: function(paramOptions, isInit) {
735
+ var self = this;
736
+
737
+ var $operator = this._$condition.find(".winp-operator-select");
738
+
739
+ $operator.on('change', function() {
740
+ var currentOperator = $operator.val();
741
+
742
+ var $control;
743
+ if( 'between' === currentOperator ) {
744
+ $control = $("<span><input type='text' class='winp-integer bp-integer-start' /> and <input type='text' class='winp-integer bp-integer-end' /></span>");
745
+ } else {
746
+ $control = $("<input type='text' class='winp-integer bp-integer-solo' /></span>");
747
+ }
748
+
749
+ self.insertValueControl($control);
750
+ });
751
+
752
+ $operator.change();
753
+ if( isInit && this.options.value ) {
754
+ this.setIntegerValue(this.options.value);
755
+ }
756
+ },
757
+
758
+ /**
759
+ * Returns a value for the Integer control.
760
+ */
761
+ getIntegerValue: function() {
762
+ var value = {};
763
+
764
+ var $operator = this._$condition.find(".winp-operator-select");
765
+ var currentOperator = $operator.val();
766
+
767
+ if( 'between' === currentOperator ) {
768
+ value.range = true;
769
+ value.start = this._$condition.find(".winp-integer-start").val();
770
+ value.end = this._$condition.find(".winp-integer-end").val();
771
+
772
+ } else {
773
+ value = this._$condition.find(".winp-integer-solo").val();
774
+ }
775
+
776
+ return value;
777
+ },
778
+
779
+ /**
780
+ * Sets a value for the Integer control.
781
+ */
782
+ setIntegerValue: function(value) {
783
+ if( !value ) {
784
+ value = {};
785
+ }
786
+
787
+ if( value.range ) {
788
+ this._$condition.find(".winp-integer-start").val(value.start);
789
+ this._$condition.find(".winp-integer-end").val(value.end);
790
+ } else {
791
+ this._$condition.find(".winp-integer-solo").val(value);
792
+ }
793
+ },
794
+
795
+ // -------------------
796
+ // Text Control
797
+ // -------------------
798
+
799
+ /**
800
+ * Creates a control for the input linked with the integer.
801
+ */
802
+ createValueAsText: function(paramOptions, isInit) {
803
+
804
+ var $control = $("<input type='text' class='winp-text' /></span>");
805
+ this.insertValueControl($control);
806
+ if( isInit && this.options.value ) {
807
+ this.setTextValue(this.options.value);
808
+ }
809
+ },
810
+
811
+ /**
812
+ * Returns a value for the Text control.
813
+ * @returns {undefined}
814
+ */
815
+ getTextValue: function() {
816
+ return this._$condition.find(".winp-text").val();
817
+ },
818
+
819
+ /**
820
+ * Sets a value for the Text control.
821
+ */
822
+ setTextValue: function(value) {
823
+ this._$condition.find(".winp-text").val(value);
824
+ },
825
+
826
+ // -------------------
827
+ // Helper Methods
828
+ // -------------------
829
+
830
+ selectParam: function(value) {
831
+ this._$condition.find(".winp-param-select").val(value);
832
+ },
833
+
834
+ selectOperator: function(value) {
835
+ this._$condition.find(".winp-operator-select").val(value);
836
+ },
837
+
838
+ setOperators: function(values) {
839
+ var $operator = this._$condition.find(".winp-operator-select");
840
+ $operator.off('change');
841
+
842
+ $operator.find("option").hide();
843
+ for( var index in values ) {
844
+ $operator.find("option[value='" + values[index] + "']").show();
845
+ }
846
+ },
847
+
848
+ insertValueControl: function($control) {
849
+ this._$condition.find(".winp-value").html("").append($control);
850
+
851
+ },
852
+
853
+ getParamOptions: function(paramName) {
854
+ if( !window.winp ) {
855
+ return;
856
+ }
857
+ if( !window.winp.filtersParams ) {
858
+ return;
859
+ }
860
+
861
+ for( var index in window.winp.filtersParams ) {
862
+ var paramOptions = window.winp.filtersParams[index];
863
+ if( paramOptions['id'] === paramName ) {
864
+ return paramOptions;
865
+ }
866
+ }
867
+
868
+ return false;
869
+ },
870
+
871
+ createSelect: function(values, attrs) {
872
+
873
+ var $select = $("<select></select>");
874
+ if( attrs ) {
875
+ $select.attr(attrs);
876
+ }
877
+
878
+ for( var index in values ) {
879
+ var item = values[index];
880
+ var $option = '';
881
+
882
+ if (typeof index === "string" && isNaN(index) === true) {
883
+ var $optgroup = $("<optgroup></optgroup>").
884
+ attr('label', index);
885
+
886
+ for( var subindex in item ) {
887
+ var subvalue = item[subindex];
888
+ $option = $("<option></option>").
889
+ attr('value', subvalue['value']).
890
+ text(subvalue['title']);
891
+ $optgroup.append($option);
892
+ }
893
+ $select.append($optgroup);
894
+ } else {
895
+ $option = $("<option></option>").
896
+ attr('value', item['value']).
897
+ text(item['title']);
898
+ $select.append($option);
899
+ }
900
+ }
901
+
902
+ return $select;
903
+ },
904
+
905
+ createDataPircker: function() {
906
+
907
+ var $control = $('<div class="winp-date-control" data-date="today"></div>');
908
+ var $input = $('<input size="16" type="text" readonly="readonly" />');
909
+ var $icon = $('<i class="fa fa-calendar"></i>');
910
+
911
+ $control.append($input);
912
+ $control.append($icon);
913
+
914
+ var $datepicker = $input.datepicker({
915
+ autoclose: true,
916
+ format: 'dd/mm/yyyy'
917
+ });
918
+
919
+ $control.data('winp-datepicker', $datepicker);
920
+
921
+ $icon.click(function() {
922
+ $input.datepicker('show');
923
+ });
924
+
925
+ $control.on('changeDate', function(ev) {
926
+ $input.datepicker('hide');
927
+ });
928
+
929
+ return $control;
930
+ }
931
+ });
932
+
933
+ /**
934
+ * Visability Options.
935
+ */
936
+ window.visibilityOptions = {
937
+
938
+ init: function() {
939
+ this.initSwitcher();
940
+ this.initSimpleOptions();
941
+ this.initAdvancedOptions();
942
+ this.initDefaultAction();
943
+ },
944
+
945
+ initSwitcher: function() {
946
+ var $buttons = $(".winp-options-switcher .btn");
947
+
948
+ var selectOptions = function(value) {
949
+ if( !value ) {
950
+ value = $("#winp_visibility_mode").val();
951
+ }
952
+
953
+ $buttons.removeClass('active');
954
+
955
+ if( 'simple' === value ) {
956
+ $(".winp-options-switcher .btn-btn-simple").addClass('active');
957
+ $("#winp-advanced-visibility-options").hide();
958
+ $("#winp-simple-visibility-options").fadeIn(300);
959
+ } else {
960
+ $(".winp-options-switcher .btn-btn-advanced").addClass('active');
961
+ $("#winp-simple-visibility-options").hide();
962
+ $("#winp-advanced-visibility-options").fadeIn(300);
963
+ }
964
+
965
+ $("#winp_visibility_mode").val(value);
966
+ };
967
+
968
+ $buttons = $(".winp-options-switcher .btn").click(function() {
969
+ var value = $(this).data('value');
970
+ selectOptions(value);
971
+ return false;
972
+ });
973
+
974
+ selectOptions();
975
+ },
976
+
977
+ initSimpleOptions: function() {
978
+ $("#winp_relock").change(function() {
979
+ if( $(this).is(":checked") ) {
980
+ $("#onp-sl-relock-options").hide().removeClass('hide').fadeIn();
981
+ } else {
982
+ $("#onp-sl-relock-options").hide();
983
+ }
984
+ });
985
+ },
986
+
987
+ initAdvancedOptions: function() {
988
+ var $formPost = $("form#post");
989
+ var $hidden = $("#winp_visibility_filters");
990
+ var $editor = $("#winp-advanced-visability-options");
991
+
992
+ // creating an editor
993
+ var json_data = $.parseJSON($hidden.val());
994
+ $editor.winpConditionEditor({
995
+ filters: typeof json_data[0] === 'undefined' ? [] : json_data[0]
996
+ });
997
+
998
+ // saves conditions on clicking the button Save
999
+ $formPost.submit(function() {
1000
+ var data = $editor.winpConditionEditor("getData");
1001
+ //console.log(data);
1002
+
1003
+ var json = JSON.stringify(data);
1004
+ $hidden.val(json);
1005
+
1006
+ return true;
1007
+ });
1008
+ },
1009
+
1010
+ // По выбранному параметру "Insertion location" определяем параметры условия
1011
+ changeConditionValue: function() {
1012
+ var $editor = $("#winp-advanced-visability-options");
1013
+ var $condition = $editor.find('.winp-condition').eq(0);
1014
+ switch ($("#wbcr_inp_snippet_location").val()) {
1015
+ case 'before_post':
1016
+ case 'before_content':
1017
+ case 'before_paragraph':
1018
+ case 'after_paragraph':
1019
+ case 'after_content':
1020
+ case 'after_post':
1021
+ $condition.find(".winp-value>select").val('base_sing');
1022
+ break;
1023
+ case 'before_excerpt':
1024
+ case 'after_excerpt':
1025
+ case 'between_posts':
1026
+ case 'before_posts':
1027
+ case 'after_posts':
1028
+ $condition.find(".winp-value>select").val('base_arch');
1029
+ break;
1030
+ default:
1031
+ $condition.find(".winp-value>select").val('base_web');
1032
+ }
1033
+ },
1034
+
1035
+ // "Вешаем" события на три select'a. Если юзер их меняет,
1036
+ // то запоминаем это и больше автоматом параметры не меняем
1037
+ bindTrigger: function() {
1038
+ var $editor = $("#winp-advanced-visability-options");
1039
+ var $filter = $editor.find('.winp-filter').eq(0);
1040
+ $filter.find('select').change(function() {
1041
+ $editor.find("#winp_changed_filters").val(1);
1042
+ });
1043
+ },
1044
+
1045
+ // Устанавливаем первое условие и "навешиваем" события на элементы
1046
+ initDefaultAction: function() {
1047
+ var $editor = $("#winp-advanced-visability-options");
1048
+ var $condition = null;
1049
+ var $select = null;
1050
+ var self = this;
1051
+
1052
+ // Если ни одного условия ещё нет, то создаем его
1053
+ if ($editor.find("#winp_changed_filters").val() == 0) {
1054
+ if ($(".winp-filter:not(.winp-template)").length == 0) {
1055
+ // Генерируем событие нажатия кнопки Add new condition
1056
+ $("a.winp-add-filter").trigger('click');
1057
+ } else {
1058
+ $select = $("select.winp-param-select").eq(0);
1059
+ }
1060
+
1061
+ // "Вешаем" событие на последний select, который грузится по ajax'у
1062
+ $condition = $editor.find('.winp-condition').eq(0);
1063
+ $condition.find(".winp-value").on("insert.select", function() {
1064
+ if ($editor.find("#winp_changed_filters").val() == 0) {
1065
+ if ($select == null) {
1066
+ $select = $("select.winp-param-select").eq(0);
1067
+ $select.val('location-some-page').trigger('change');
1068
+ }
1069
+
1070
+ self.bindTrigger();
1071
+ self.changeConditionValue();
1072
+ }
1073
+ });
1074
+ }
1075
+
1076
+ // Если изменили один из двух параметров,
1077
+ // то при необходимости параметры условия устанавливаем автоматом
1078
+ $("#wbcr_inp_snippet_scope, #wbcr_inp_snippet_location").change(function() {
1079
+ if ($editor.find("#winp_changed_filters").val() == 0 && $select != null) {
1080
+ // Если первый параметр условия уже установлен
1081
+ if ('location-some-page' == $select.val()) {
1082
+ if ('auto' == $("#wbcr_inp_snippet_scope").val()) {
1083
+ self.changeConditionValue();
1084
+ } else {
1085
+ $condition.find(".winp-value>select").val('base_web');
1086
+ }
1087
+ } else {
1088
+ $select.val('location-some-page').trigger('change');
1089
+ }
1090
+ }
1091
+ });
1092
+
1093
+ $editor.find("select.winp-filter-type").change(function() {
1094
+ $editor.find("#winp_changed_filters").val(1);
1095
+ });
1096
+ }
1097
+ };
1098
+
1099
+ $(function() {
1100
+ window.visibilityOptions.init();
1101
+ });
1102
+
1103
+ })(jQuery);
admin/boot.php CHANGED
@@ -1,210 +1,245 @@
1
  <?php
2
- /**
3
- * Admin boot
4
- * @author Alex Kovalev <alex.kovalevv@gmail.com>
5
- * @copyright Alex Kovalev 05.06.2018
6
- * @version 1.0
7
- */
8
-
9
- /**
10
- * Admin warning notices
11
- */
12
- function wbcr_inp_admin_conflict_notices_error($notices, $plugin_name)
13
- {
14
- if( $plugin_name != WINP_Plugin::app()->getPluginName() ) {
15
- return $notices;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  }
17
-
18
- if( isset($_COOKIE['wbcr-php-snippets-safe-mode']) ) {
19
- $disable_safe_mode_url = add_query_arg(array('wbcr-php-snippets-disable-safe-mode' => 1));
20
-
21
- $safe_mode_notice = WINP_Plugin::app()
22
- ->getPluginTitle() . ': ' . __('Running in safe mode. This mode your snippets will not be started.', 'insert-php');
23
- $safe_mode_notice .= ' <a href="' . $disable_safe_mode_url . '" class="button button-default">Disable Safe Mode</a>';
24
-
25
- $notices[] = array(
26
- 'id' => 'inp_safe_mode',
27
- 'type' => 'success',
28
- 'dismissible' => false,
29
- 'dismiss_expires' => 0,
30
- 'text' => '<p>' . $safe_mode_notice . '</p>'
31
- );
32
  }
33
-
34
- $create_notice_url = admin_url('edit.php?post_type=' . WINP_SNIPPETS_POST_TYPE);
35
-
36
- $upgrade_plugin_notice = '<b>' . WINP_Plugin::app()
37
- ->getPluginTitle() . '</b>: ' . __('Attention! This new 2.0 plugin version, we added the ability to insert php code using snippets. This is a more convenient and secure way than using shortcodes [insert_php] code execute [/ insert_php]. However, for compatibility reasons, we left support for [insert_php] shortcodes, but we will depreciate them in the next versions of the plugin.', 'insert-php');
38
-
39
- $upgrade_plugin_notice .= '<br><br>' . __('We strongly recommend you to transfer your php code to snippets and call them in your posts/pages and widgets using [wbcr_php_snippet id = "000"] shortcodes.', 'insert-php');
40
-
41
- //$upgrade_plugin_notice .= '<br><br><span style="color:red">' . __('If you have updated from version 1.3 of the plugin (Insert php). Please deactivate and activate the plugin to update the settings.', 'insert-php') . '</span>';
42
-
43
- $upgrade_plugin_notice .= '<br><br><a href="' . $create_notice_url . '" class="button button-default">' . __('Create new php snippet', 'insert-php') . '</a> ';
44
-
45
- $upgrade_plugin_notice .= '<a href="https://downloads.wordpress.org/plugin/insert-php.1.3.zip" class="button button-default">' . __('Download old version', 'insert-php') . '</a><br><br>';
46
- $upgrade_plugin_notice .= sprintf(__('If you have issues with the plugin new version or any suggestions, please contact us on <a href="%s" target="_blank">our forum</a>.', 'insert-php'), 'https://wordpress.org/support/plugin/insert-php');
47
- $upgrade_plugin_notice .= '<br>' . sprintf(__('We tried to make the plugin better and more convenient. If you like the new version, feel free to <a href="%s" target="_blank">leave your feedback</a>. It will give us motivation for further improvements.', 'insert-php'), 'https://wordpress.org/support/plugin/insert-php/reviews/#new-post');
48
-
49
- $notices[] = array(
50
- 'id' => 'inp_upgrade_plugin',
51
- 'type' => 'warning',
52
- 'dismissible' => true,
53
- 'dismiss_expires' => 0,
54
- 'text' => '<p>' . $upgrade_plugin_notice . '</p>'
55
- );
56
-
57
- /**
58
- * Show error notification after saving snippet. We can also show this message when the snippet is activated.
59
- * We must warn the user that we can not perform the spippet due to an error.
60
- */
61
- if( isset($_GET['wbcr_inp_save_snippet_result']) && $_GET['wbcr_inp_save_snippet_result'] == 'code-error' ) {
62
-
63
- $post_id = isset($_GET['post'])
64
- ? intval($_GET['post'])
65
- : null;
66
-
67
- if( $post_id && $error = WINP_Plugin::app()->getSnippetError($post_id) ) {
68
-
69
- $error_message = sprintf('<p>%s</p><p><strong>%s</strong></p>', sprintf(__('The snippet has been deactivated due to an error on line %d:', 'insert-php'), $error['line']), $error['message']);
70
-
71
- $notices[] = array(
72
- 'id' => 'inp_result_error',
73
- 'where' => array('post', 'post-new', 'edit'),
74
- 'type' => 'error',
75
- 'dismissible' => false,
76
- 'dismiss_expires' => 0,
77
- 'text' => $error_message
78
- );
79
- }
80
  }
81
-
82
- return $notices;
83
  }
84
-
85
- add_filter('wbcr_factory_admin_notices', 'wbcr_inp_admin_conflict_notices_error', 10, 2);
86
-
87
- function wbcr_inp_admin_init()
88
- {
89
- $plugin = WINP_Plugin::app();
90
-
91
- // Disable safe mode
92
-
93
- if( isset($_COOKIE['wbcr-php-snippets-safe-mode']) && isset($_REQUEST['wbcr-php-snippets-disable-safe-mode']) && $plugin->currentUserCan() ) {
94
- unset($_COOKIE['wbcr-php-snippets-safe-mode']);
95
- setcookie('wbcr-php-snippets-safe-mode', null, -1);
96
- wp_safe_redirect(remove_query_arg(array('wbcr-php-snippets-disable-safe-mode')));
97
- exit;
98
- }
99
-
100
- // Register metaboxes
101
-
102
- require_once(WINP_PLUGIN_DIR . '/admin/metaboxes/base-options.php');
103
- Wbcr_FactoryMetaboxes403::registerFor(new WINP_BaseOptionsMetaBox($plugin), WINP_SNIPPETS_POST_TYPE, $plugin);
104
-
105
- require_once(WINP_PLUGIN_DIR . '/admin/metaboxes/info.php');
106
- Wbcr_FactoryMetaboxes403::registerFor(new WINP_InfoMetaBox($plugin), WINP_SNIPPETS_POST_TYPE, $plugin);
107
-
108
- // Upgrade up to new version
109
- if( !$plugin->getOption('upgrade_up_to_201', false) ) {
110
- $role = get_role('administrator');
111
- if( !$role ) {
112
- return;
113
  }
114
-
115
- $role->add_cap('edit_' . WINP_SNIPPETS_POST_TYPE);
116
- $role->add_cap('read_' . WINP_SNIPPETS_POST_TYPE);
117
- $role->add_cap('delete_' . WINP_SNIPPETS_POST_TYPE);
118
- $role->add_cap('edit_' . WINP_SNIPPETS_POST_TYPE . 's');
119
- $role->add_cap('edit_others_' . WINP_SNIPPETS_POST_TYPE . 's');
120
- $role->add_cap('publish_' . WINP_SNIPPETS_POST_TYPE . 's');
121
- $role->add_cap('read_private_' . WINP_SNIPPETS_POST_TYPE . 's');
122
-
123
- $plugin->updateOption('upgrade_up_to_201', 1);
124
  }
125
- }
126
-
127
- add_action('admin_init', 'wbcr_inp_admin_init');
128
-
129
- // ---
130
- // Editor
131
- //
132
-
133
- /**
134
- * Asset scripts for the tinymce editor
135
- *
136
- * @param string $hook
137
- */
138
- function wbcr_inp_enqueue_tinymce_assets($hook)
139
- {
140
- $pages = array(
141
- 'post.php',
142
- 'post-new.php',
143
- 'widgets.php'
144
- );
145
-
146
- if( !in_array($hook, $pages) || !current_user_can('manage_options') ) {
147
- return;
148
  }
149
-
150
- wp_enqueue_script('wbcr-inp-tinymce-button-widget', WINP_PLUGIN_URL . '/admin/assets/js/tinymce4.4.js', array('jquery'), WINP_Plugin::app()
151
- ->getPluginVersion(), true);
152
  }
153
-
154
- add_action('admin_enqueue_scripts', 'wbcr_inp_enqueue_tinymce_assets');
155
-
156
- /**
157
- * Adds js variable required for shortcodes.
158
- *
159
- * @see before_wp_tiny_mce
160
- * @since 1.1.0
161
- */
162
- function wbcr_inp_tinymce_data($hook)
163
- {
164
- if( !current_user_can('manage_options') ) {
165
- return;
166
- }
167
-
168
- // styles for the plugin shorcodes
169
- $shortcode_icon = WINP_PLUGIN_URL . '/admin/assets/img/shortcode-icon.png';
170
- $shortcode_title = __('PHP snippets', 'insert-php');
171
-
172
- $snippets = get_posts(array(
173
- 'post_type' => WINP_SNIPPETS_POST_TYPE,
174
- 'meta_key' => WINP_Plugin::app()->getPrefix() . 'snippet_scope',
175
- 'meta_value' => 'shortcode',
176
- 'post_status' => 'publish',
177
- 'numberposts' => -1
178
- ));
179
-
180
- $result = array();
181
- foreach((array)$snippets as $snippet) {
182
- $result[] = array(
183
- 'id' => $snippet->ID,
184
- 'title' => empty($snippet->post_title)
185
- ? '(no titled, ID=' . $snippet->ID . ')'
186
- : $snippet->post_title
187
- );
188
- }
189
-
190
- $shortcode_snippets_json = json_encode($result);
191
-
192
- ?>
193
- <!-- <?= WINP_Plugin::app()->getPluginTitle() ?> for tinymce -->
194
- <style>
195
- i.wbcr-inp-shortcode-icon {
196
- background: url("<?php echo $shortcode_icon ?>") center no-repeat;
197
- }
198
- </style>
199
- <script>
200
- var wbcr_inp_tinymce_snippets_button_title = '<?php echo $shortcode_title ?>';
201
- var wbcr_inp_post_tinymce_nonce = '<?php echo wp_create_nonce('wbcr_inp_tinymce_post_nonce') ?>';
202
- var wbcr_inp_shortcode_snippets = <?= $shortcode_snippets_json ?>;
203
- </script>
204
- <!-- /end <?= WINP_Plugin::app()->getPluginTitle() ?> for tinymce -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
205
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
  }
207
-
208
- add_action('admin_print_scripts-post.php', 'wbcr_inp_tinymce_data');
209
- add_action('admin_print_scripts-post-new.php', 'wbcr_inp_tinymce_data');
210
- add_action('admin_print_scripts-widgets.php', 'wbcr_inp_tinymce_data');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+ /**
3
+ * Admin boot
4
+ * @author Alex Kovalev <alex.kovalevv@gmail.com>
5
+ * @copyright Alex Kovalev 05.06.2018
6
+ * @version 1.0
7
+ */
8
+
9
+ /**
10
+ * Enables/Disable safe mode, in which the php code will not be executed.
11
+ */
12
+ function wbcr_inp_safe_mode() {
13
+ if ( isset( $_GET['wbcr-php-snippets-safe-mode'] ) ) {
14
+ WINP_Helper::enable_safe_mode();
15
+ }
16
+ if ( isset( $_GET['wbcr-php-snippets-disable-safe-mode'] ) ) {
17
+ WINP_Helper::disable_safe_mode();
18
+ }
19
+ }
20
+
21
+ add_action( 'plugins_loaded', 'wbcr_inp_safe_mode', - 1 );
22
+
23
+ function wbcr_inp_admin_init() {
24
+
25
+ $plugin = WINP_Plugin::app();
26
+
27
+ // Register metaboxes
28
+ require_once( WINP_PLUGIN_DIR . '/admin/metaboxes/base-options.php' );
29
+ Wbcr_FactoryMetaboxes404::registerFor( new WINP_BaseOptionsMetaBox( $plugin ), WINP_SNIPPETS_POST_TYPE, $plugin );
30
+
31
+ if ( current_user_can( 'install_plugins' ) && ! is_plugin_active( 'robin-image-optimizer/robin-image-optimizer.php' ) ) {
32
+ require_once( WINP_PLUGIN_DIR . '/admin/metaboxes/info.php' );
33
+ Wbcr_FactoryMetaboxes404::registerFor( new WINP_InfoMetaBox( $plugin ), WINP_SNIPPETS_POST_TYPE, $plugin );
34
+ }
35
+
36
+ $snippet_type = WINP_Helper::get_snippet_type();
37
+
38
+ if ( $snippet_type !== WINP_SNIPPET_TYPE_PHP ) {
39
+ require_once( WINP_PLUGIN_DIR . '/admin/metaboxes/view-options.php' );
40
+ Wbcr_FactoryMetaboxes404::registerFor( new WINP_ViewOptionsMetaBox( $plugin ), WINP_SNIPPETS_POST_TYPE, $plugin );
41
+ }
42
+
43
+ // Upgrade up to new version
44
+ $first_activation = get_option( $plugin->getOptionName( 'first_activation' ) );
45
+ $is_upgraded = get_option( $plugin->getOptionName( 'upgrade_up_to_201' ) );
46
+
47
+ if ( ! $first_activation && ! $is_upgraded ) {
48
+ $role = get_role( 'administrator' );
49
+
50
+ if ( ! $role ) {
51
+ return;
52
  }
53
+
54
+ $role->add_cap( 'edit_' . WINP_SNIPPETS_POST_TYPE );
55
+ $role->add_cap( 'read_' . WINP_SNIPPETS_POST_TYPE );
56
+ $role->add_cap( 'delete_' . WINP_SNIPPETS_POST_TYPE );
57
+ $role->add_cap( 'edit_' . WINP_SNIPPETS_POST_TYPE . 's' );
58
+ $role->add_cap( 'edit_others_' . WINP_SNIPPETS_POST_TYPE . 's' );
59
+ $role->add_cap( 'publish_' . WINP_SNIPPETS_POST_TYPE . 's' );
60
+ $role->add_cap( 'read_private_' . WINP_SNIPPETS_POST_TYPE . 's' );
61
+
62
+ update_option( $plugin->getOptionName( 'upgrade_up_to_201' ), 1 );
63
+ update_option( $plugin->getOptionName( 'what_new_210' ), 1 );
64
+
65
+ // Create a demo snippets with examples of use
66
+ if ( ! get_option( $plugin->getOptionName( 'demo_snippets_created' ) ) ) {
67
+ WINP_Helper::create_demo_snippets();
68
  }
69
+
70
+ // Write information about the first activation of plugin
71
+ if ( ! $first_activation ) {
72
+ update_option( $plugin->getOptionName( 'first_activation' ), array(
73
+ 'version' => $plugin->getPluginVersion(),
74
+ 'timestamp' => time()
75
+ ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  }
 
 
77
  }
78
+
79
+ // If the user has updated the plugin or activated it for the first time,
80
+ // you need to show the page "What's new?"
81
+
82
+ if ( ! isset( $_GET['wbcr_inp_about_page_viewed'] ) ) {
83
+ if ( WINP_Helper::is_need_show_about_page() ) {
84
+ try {
85
+ $redirect_url = WINP_Plugin::app()->getPluginPageUrl( 'about', array( 'wbcr_inp_about_page_viewed' => 1 ) );
86
+ wp_safe_redirect( $redirect_url );
87
+ die();
88
+ } catch( Exception $e ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  }
 
 
 
 
 
 
 
 
 
 
90
  }
91
+ } else {
92
+ if ( WINP_Helper::is_need_show_about_page() ) {
93
+ delete_option( $plugin->getOptionName( 'what_new_210' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  }
 
 
 
95
  }
96
+ }
97
+
98
+ add_action( 'admin_init', 'wbcr_inp_admin_init' );
99
+
100
+ // ---
101
+ // Editor
102
+ //
103
+
104
+ /**
105
+ * Enqueue scripts
106
+ */
107
+ function wbcr_inp_enqueue_scripts() {
108
+ global $pagenow;
109
+
110
+ $screen = get_current_screen();
111
+
112
+ if ( ( 'post-new.php' == $pagenow || 'post.php' == $pagenow ) && WINP_SNIPPETS_POST_TYPE == $screen->post_type ) {
113
+ wp_enqueue_script( 'wbcr-inp-admin-scripts', WINP_PLUGIN_URL . '/admin/assets/js/scripts.js', array(
114
+ 'jquery',
115
+ 'jquery-ui-tooltip'
116
+ ), WINP_Plugin::app()->getPluginVersion() );
117
+ }
118
+ }
119
+
120
+ /**
121
+ * Asset scripts for the tinymce editor
122
+ *
123
+ * @param string $hook
124
+ */
125
+ function wbcr_inp_enqueue_tinymce_assets( $hook ) {
126
+ $pages = array(
127
+ 'post.php',
128
+ 'post-new.php',
129
+ 'widgets.php'
130
+ );
131
+
132
+ if ( ! in_array( $hook, $pages ) || ! current_user_can( 'manage_options' ) ) {
133
+ return;
134
+ }
135
+
136
+ wp_enqueue_script( 'wbcr-inp-tinymce-button-widget', WINP_PLUGIN_URL . '/admin/assets/js/tinymce4.4.js', array( 'jquery' ), WINP_Plugin::app()->getPluginVersion(), true );
137
+ }
138
+
139
+ add_action( 'admin_enqueue_scripts', 'wbcr_inp_enqueue_tinymce_assets' );
140
+ add_action( 'admin_enqueue_scripts', 'wbcr_inp_enqueue_scripts' );
141
+
142
+ /**
143
+ * Adds js variable required for shortcodes.
144
+ *
145
+ * @see before_wp_tiny_mce
146
+ * @since 1.1.0
147
+ */
148
+ function wbcr_inp_tinymce_data( $hook ) {
149
+ if ( ! current_user_can( 'manage_options' ) ) {
150
+ return;
151
+ }
152
+
153
+ // styles for the plugin shorcodes
154
+ $shortcode_icon = WINP_PLUGIN_URL . '/admin/assets/img/shortcode-icon5.png';
155
+ $shortcode_title = __( 'Woody ad snippets', 'insert-php' );
156
+
157
+ $result = WINP_Helper::get_shortcode_data();
158
+ $shortcode_snippets_json = json_encode( $result );
159
+
160
+ ?>
161
+ <!-- <?= WINP_Plugin::app()->getPluginTitle() ?> for tinymce -->
162
+ <style>
163
+ i.wbcr-inp-shortcode-icon {
164
+ background: url("<?php echo $shortcode_icon ?>") center no-repeat;
165
+ }
166
+ </style>
167
+ <script>
168
+ var wbcr_inp_tinymce_snippets_button_title = '<?php echo $shortcode_title ?>';
169
+ var wbcr_inp_post_tinymce_nonce = '<?php echo wp_create_nonce( 'wbcr_inp_tinymce_post_nonce' ) ?>';
170
+ var wbcr_inp_shortcode_snippets = <?= $shortcode_snippets_json ?>;
171
+ </script>
172
+ <!-- /end <?= WINP_Plugin::app()->getPluginTitle() ?> for tinymce -->
173
  <?php
174
+ }
175
+
176
+ add_action( 'admin_print_scripts-post.php', 'wbcr_inp_tinymce_data' );
177
+ add_action( 'admin_print_scripts-post-new.php', 'wbcr_inp_tinymce_data' );
178
+ add_action( 'admin_print_scripts-widgets.php', 'wbcr_inp_tinymce_data' );
179
+
180
+ /**
181
+ * Deactivate snippet on trashed
182
+ *
183
+ * @param $post_id
184
+ *
185
+ * @since 2.0.6
186
+ */
187
+ function wbcr_inp_trash_post( $post_id ) {
188
+ $post_type = get_post_type( $post_id );
189
+ if ( $post_type == WINP_SNIPPETS_POST_TYPE ) {
190
+ WINP_Helper::updateMetaOption( $post_id, 'snippet_activate', 0 );
191
  }
192
+ }
193
+
194
+ add_action( 'wp_trash_post', 'wbcr_inp_trash_post' );
195
+
196
+ /**
197
+ * Removes the default 'new item' from the admin menu to add own page 'new item' later.
198
+ *
199
+ * @see menu_order
200
+ *
201
+ * @param $menu
202
+ *
203
+ * @return mixed
204
+ */
205
+ function wbcr_inp_remove_new_item( $menu ) {
206
+ global $submenu;
207
+
208
+ if ( ! isset( $submenu[ 'edit.php?post_type=' . WINP_SNIPPETS_POST_TYPE ] ) ) {
209
+ return $menu;
210
+ }
211
+ unset( $submenu[ 'edit.php?post_type=' . WINP_SNIPPETS_POST_TYPE ][10] );
212
+
213
+ return $menu;
214
+ }
215
+
216
+ add_filter( 'custom_menu_order', '__return_true' );
217
+ add_filter( 'menu_order', 'wbcr_inp_remove_new_item' );
218
+
219
+ /**
220
+ * If the user tried to get access to the default 'new item',
221
+ * redirects forcibly to our page 'new item'.
222
+ *
223
+ * @see current_screen
224
+ */
225
+ function wbcr_inp_redirect_to_new_item() {
226
+ $screen = get_current_screen();
227
+
228
+ if ( empty( $screen ) ) {
229
+ return;
230
+ }
231
+ if ( 'add' !== $screen->action || 'post' !== $screen->base || WINP_SNIPPETS_POST_TYPE !== $screen->post_type ) {
232
+ return;
233
+ }
234
+ if ( isset( $_GET['winp_item'] ) ) {
235
+ return;
236
+ }
237
+
238
+ $url = admin_url( 'edit.php?post_type=' . WINP_SNIPPETS_POST_TYPE . '&page=new-item-' . WINP_Plugin::app()->getPluginName() );
239
+
240
+ wp_safe_redirect( $url );
241
+
242
+ exit;
243
+ }
244
+
245
+ add_action( 'current_screen', 'wbcr_inp_redirect_to_new_item' );
admin/includes/class.export.snippet.php ADDED
@@ -0,0 +1,288 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Export snippet
5
+ * @author Webcraftic <wordpress.webraftic@gmail.com>
6
+ * @copyright (c) 16.11.2018, Webcraftic
7
+ * @version 1.0
8
+ */
9
+ class WINP_Export_Snippet {
10
+
11
+ /**
12
+ * WINP_Export_Snippet constructor.
13
+ */
14
+ public function __construct() {
15
+ $this->registerHooks();
16
+ }
17
+
18
+ /**
19
+ * Register hooks
20
+ */
21
+ public function registerHooks() {
22
+ add_filter( 'post_row_actions', array( $this, 'postRowActions' ), 10, 2 );
23
+ add_filter( 'bulk_actions-edit-' . WINP_SNIPPETS_POST_TYPE, array( $this, 'actionBulkEditPost' ) );
24
+ add_filter( 'handle_bulk_actions-edit-' . WINP_SNIPPETS_POST_TYPE, array(
25
+ $this,
26
+ 'handleActionBulkEditPost',
27
+ ), 10, 3 );
28
+
29
+ add_action( 'post_submitbox_start', array( $this, 'postSubmitboxStart' ) );
30
+ add_action( 'admin_init', array( $this, 'adminInit' ) );
31
+ }
32
+
33
+ /**
34
+ * Get export url
35
+ *
36
+ * @param $post_id
37
+ *
38
+ * @return string
39
+ */
40
+ private function getExportUrl( $post_id ) {
41
+ $url = admin_url( 'post.php?post=' . $post_id );
42
+
43
+ return add_query_arg( array( 'action' => 'export' ), $url );
44
+ }
45
+
46
+ /**
47
+ * postRowActions
48
+ *
49
+ * @param $actions
50
+ * @param $post
51
+ *
52
+ * @return mixed
53
+ */
54
+ public function postRowActions( $actions, $post ) {
55
+ if ( $post->post_type == WINP_SNIPPETS_POST_TYPE ) {
56
+ $export_link = $this->getExportUrl( $post->ID );
57
+
58
+ if ( isset( $actions['trash'] ) ) {
59
+ $trash = $actions['trash'];
60
+ unset( $actions['trash'] );
61
+ }
62
+
63
+ $actions['export'] = sprintf( '<a href="%1$s">%2$s</a>', esc_url( $export_link ), esc_html( __( 'Export', 'insert-php' ) ) );
64
+
65
+ if ( isset( $trash ) ) {
66
+ $actions['trash'] = $trash;
67
+ }
68
+ }
69
+
70
+ return $actions;
71
+ }
72
+
73
+ /**
74
+ * actionBulkEditPost
75
+ *
76
+ * @param $bulk_actions
77
+ *
78
+ * @return mixed
79
+ */
80
+ public function actionBulkEditPost( $bulk_actions ) {
81
+ $bulk_actions['export'] = __( 'Export', 'insert-php' );
82
+ $bulk_actions['deletesnp'] = __( 'Delete', 'insert-php' );
83
+ $bulk_actions['deactivate'] = __( 'Deactivate', 'insert-php' );
84
+ $bulk_actions['activate'] = __( 'Activate', 'insert-php' );
85
+
86
+ return $bulk_actions;
87
+ }
88
+
89
+ /**
90
+ * handleActionBulkEditPost
91
+ *
92
+ * @param $redirect_to
93
+ * @param $doaction
94
+ * @param $post_ids
95
+ *
96
+ * @return mixed
97
+ */
98
+ public function handleActionBulkEditPost( $redirect_to, $doaction, $post_ids ) {
99
+ $actions = array(
100
+ 'export' => 1,
101
+ 'deletesnp' => 1,
102
+ 'deactivate' => 1,
103
+ 'activate' => 1
104
+ );
105
+
106
+ if ( ! isset( $actions[ $doaction ] ) ) {
107
+ return $redirect_to;
108
+ }
109
+
110
+ if ( count( $post_ids ) ) {
111
+ switch ( $doaction ) {
112
+ case 'export':
113
+ $this->exportSnippets( $post_ids );
114
+ break;
115
+ case 'deletesnp':
116
+ $this->deleteSnippets( $post_ids );
117
+ break;
118
+ case 'deactivate':
119
+ $this->deactivateSnippets( $post_ids );
120
+ break;
121
+ case 'activate':
122
+ $this->activateSnippets( $post_ids );
123
+ break;
124
+ }
125
+ }
126
+
127
+ return $redirect_to;
128
+ }
129
+
130
+ /**
131
+ * postSubmitboxStart
132
+ */
133
+ public function postSubmitboxStart() {
134
+ global $post;
135
+
136
+ if ( $post && $post->post_type == WINP_SNIPPETS_POST_TYPE ) {
137
+ $export_link = $this->getExportUrl( $post->ID );
138
+ echo "<div id='winp-export-action'>" . sprintf( '<a href="%1$s">%2$s</a>', esc_url( $export_link ), esc_html( __( 'Export', 'insert-php' ) ) ) . "</div>";
139
+ }
140
+ }
141
+
142
+ /**
143
+ * Get post meta
144
+ *
145
+ * @param $post_id
146
+ * @param $meta_name
147
+ *
148
+ * @return mixed
149
+ */
150
+ private function getMeta( $post_id, $meta_name ) {
151
+ return get_post_meta( $post_id, WINP_Plugin::app()->getPrefix() . $meta_name, true );
152
+ }
153
+
154
+ /**
155
+ * Set up the current page to act like a downloadable file instead of being shown in the browser
156
+ *
157
+ * @param string $format
158
+ * @param array $ids
159
+ * @param string $mime_type
160
+ *
161
+ * @return array
162
+ */
163
+ public function prepareExport( $format, $ids, $mime_type = '' ) {
164
+ $snippets = array();
165
+
166
+ if ( count( $ids ) ) {
167
+ foreach ( $ids as $id ) {
168
+ $post = get_post( $id );
169
+ $snippets[] = array(
170
+ 'name' => $post->post_name,
171
+ 'title' => $post->post_title,
172
+ 'content' => $post->post_content,
173
+ 'location' => $this->getMeta( $id, 'snippet_location' ),
174
+ 'type' => $this->getMeta( $id, 'snippet_type' ),
175
+ 'code' => $this->getMeta( $id, 'snippet_code' ),
176
+ 'filters' => $this->getMeta( $id, 'snippet_filters' ),
177
+ 'changed_filters' => $this->getMeta( $id, 'changed_filters' ),
178
+ 'scope' => $this->getMeta( $id, 'snippet_scope' ),
179
+ 'description' => $this->getMeta( $id, 'snippet_description' ),
180
+ 'tags' => $this->getMeta( $id, 'snippet_tags' )
181
+ );
182
+ }
183
+ }
184
+
185
+ /* Build the export filename */
186
+ if ( 1 == count( $ids ) ) {
187
+ $name = $snippets[0]['title'];
188
+ $title = strtolower( $name );
189
+ } else {
190
+ /* Otherwise, use the site name as set in Settings > General */
191
+ $title = strtolower( get_bloginfo( 'name' ) );
192
+ }
193
+
194
+ $filename = "{$title}.php-code-snippets.{$format}";
195
+
196
+ /* Set HTTP headers */
197
+ header( 'Content-Disposition: attachment; filename=' . sanitize_file_name( $filename ) );
198
+
199
+ if ( '' !== $mime_type ) {
200
+ header( "Content-Type: $mime_type; charset=" . get_bloginfo( 'charset' ) );
201
+ }
202
+
203
+ return $snippets;
204
+ }
205
+
206
+ /**
207
+ * Export snippets in JSON format
208
+ *
209
+ * @param array $ids
210
+ */
211
+ public function exportSnippets( $ids ) {
212
+ $snippets = $this->prepareExport( 'json', $ids, 'application/json' );
213
+
214
+ $data = array(
215
+ 'generator' => 'PHP Code Snippets v' . WINP_PLUGIN_VERSION,
216
+ 'date_created' => date( 'Y-m-d H:i' ),
217
+ 'snippets' => $snippets,
218
+ );
219
+
220
+ echo wp_json_encode( $data, 0 );
221
+ exit;
222
+ }
223
+
224
+ /**
225
+ * Delete snippets
226
+ *
227
+ * @param $ids
228
+ */
229
+ private function deleteSnippets( $ids ) {
230
+ if ( count( $ids ) ) {
231
+ foreach ( $ids as $id ) {
232
+ wp_trash_post( $id );
233
+ }
234
+ }
235
+ }
236
+
237
+ /**
238
+ * Deactivate snippets
239
+ *
240
+ * @param $ids
241
+ */
242
+ private function deactivateSnippets( $ids ) {
243
+ if ( count( $ids ) ) {
244
+ foreach ( $ids as $id ) {
245
+ update_post_meta( $id, WINP_Plugin::app()->getPrefix() . 'snippet_activate', 0 );
246
+ }
247
+ }
248
+ }
249
+
250
+ /**
251
+ * Activate snippets
252
+ *
253
+ * @param $ids
254
+ */
255
+ private function activateSnippets( $ids ) {
256
+ if ( count( $ids ) ) {
257
+ foreach ( $ids as $id ) {
258
+ $is_activate = (int) WINP_Helper::getMetaOption( $id, 'snippet_activate', 0 );
259
+ $snippet_scope = WINP_Helper::getMetaOption( $id, 'snippet_scope' );
260
+ $snippet_type = WINP_Helper::get_snippet_type( $id );
261
+
262
+ if ( ( $snippet_scope == 'evrywhere' || $snippet_scope == 'auto' ) && ! $is_activate && $snippet_type != WINP_SNIPPET_TYPE_TEXT && WINP_Plugin::app()->getExecuteObject()->getSnippetError( $id ) ) {
263
+ continue;
264
+ }
265
+
266
+ update_post_meta( $id, WINP_Plugin::app()->getPrefix() . 'snippet_activate', 1 );
267
+ }
268
+ }
269
+ }
270
+
271
+ /**
272
+ * adminInit
273
+ */
274
+ public function adminInit() {
275
+ if ( isset( $_GET['action'], $_GET['post'] ) ) {
276
+ $ids = is_array( $_GET['post'] ) ? $_GET['post'] : array( absint( $_GET['post'] ) );
277
+
278
+ switch ( sanitize_key( $_GET['action'] ) ) {
279
+ case 'export':
280
+ $this->exportSnippets( $ids );
281
+ break;
282
+ default:
283
+ return;
284
+ }
285
+ }
286
+ }
287
+
288
+ }
admin/includes/class.filter.snippet.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Filter for snippet list
4
+ * @author Webcraftic <wordpress.webraftic@gmail.com>
5
+ * @copyright (c) 16.11.2018, Webcraftic
6
+ * @version 1.0
7
+ */
8
+ class WINP_Filter_List {
9
+
10
+ /**
11
+ * WINP_Filter_List constructor.
12
+ */
13
+ public function __construct()
14
+ {
15
+ add_action( 'restrict_manage_posts', array( $this, 'restrictManagePosts' ) );
16
+ add_filter( 'parse_query', array( $this, 'parseQuery' ) );
17
+ }
18
+
19
+ /**
20
+ * Create the dropdown
21
+ */
22
+ function restrictManagePosts()
23
+ {
24
+ $type = WINP_Plugin::app()->request->get('post_type', 'post');
25
+
26
+ $terms = get_terms( array(
27
+ 'taxonomy' => WINP_SNIPPETS_TAXONOMY,
28
+ 'hide_empty' => true,
29
+ ) );
30
+
31
+ if ( WINP_SNIPPETS_POST_TYPE == $type && ! empty( $terms ) ) { ?>
32
+ <select name="winp_filter_tag">
33
+ <option value=""><?php _e( 'Filter by tag:', 'insert-php' ); ?></option>
34
+ <?php
35
+ $current_filter = WINP_Plugin::app()->request->get( 'winp_filter_tag', '' );
36
+ foreach ( $terms as $term ) {
37
+ if (is_object($term) && isset($term->slug)) {
38
+ printf
39
+ (
40
+ '<option value="%s"%s>%s</option>',
41
+ $term->slug,
42
+ $term->slug == $current_filter ? ' selected="selected"' : '',
43
+ $term->name
44
+ );
45
+ }
46
+ } ?>
47
+ </select>
48
+ <?php
49
+ }
50
+ }
51
+
52
+ /**
53
+ * If submitted filter by tag
54
+ *
55
+ * @param $query
56
+ */
57
+ function parseQuery( $query )
58
+ {
59
+ global $pagenow;
60
+
61
+ $type = WINP_Plugin::app()->request->get('post_type', 'post');
62
+
63
+ if (
64
+ WINP_SNIPPETS_POST_TYPE == $type
65
+ && is_admin()
66
+ && $pagenow == 'edit.php'
67
+ && WINP_Plugin::app()->request->get( 'winp_filter_tag', '' )
68
+ ) {
69
+ $taxquery = array(
70
+ array(
71
+ 'taxonomy' => WINP_SNIPPETS_TAXONOMY,
72
+ 'field' => 'slug',
73
+ 'terms' => array(WINP_Plugin::app()->request->get( 'winp_filter_tag', '' )),
74
+ 'operator'=> 'IN'
75
+ )
76
+ );
77
+ $query->set( 'tax_query', $taxquery );
78
+ }
79
+ }
80
+ }
admin/includes/class.gutenberg.snippet.php ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Snippet block for Gutenberg editor
5
+ *
6
+ * @author Webcraftic <wordpress.webraftic@gmail.com>
7
+ * @copyright (c) 11.12.2018, Webcraftic
8
+ * @version 1.0
9
+ */
10
+ class WINP_Gutenberg_Snippet {
11
+
12
+ /**
13
+ * @var array
14
+ */
15
+ protected $shortcode_data;
16
+
17
+ /**
18
+ * WINP_Gutenberg_Snippet constructor.
19
+ */
20
+ public function __construct() {
21
+ $this->registerHooks();
22
+ }
23
+
24
+ private function registerHooks() {
25
+ add_action( 'init', array( $this, 'init' ) );
26
+ }
27
+
28
+ public function init() {
29
+ $this->shortcode_data = WINP_Helper::get_shortcode_data();
30
+
31
+ if ( empty( $this->shortcode_data ) ) {
32
+ return;
33
+ }
34
+
35
+ if ( function_exists( 'register_block_type' ) ) {
36
+ wp_register_script( 'wp-plugin-insert-php', WINP_PLUGIN_URL . '/admin/assets/gutenberg/build/index.build.js', array(
37
+ 'wp-editor',
38
+ 'wp-blocks',
39
+ 'wp-element',
40
+ 'wp-i18n'
41
+ ), WINP_PLugin::app()->getPluginVersion() );
42
+
43
+ wp_register_style( 'wp-plugin-insert-php', WINP_PLUGIN_URL . '/admin/assets/css/snippet-block.css', array() );
44
+
45
+ /**
46
+ * Register snippets object, so it can be accessible within Gutenberg.
47
+ */
48
+ wp_localize_script( 'wp-plugin-insert-php', 'winp_snippets', array(
49
+ 'data' => $this->prepared_snippets_data()
50
+ ) );
51
+
52
+ register_block_type( 'wp-plugin-insert-php/winp-snippet', array(
53
+ 'editor_script' => 'wp-plugin-insert-php',
54
+ 'editor_style' => 'wp-plugin-insert-php',
55
+ 'render_callback' => array( $this, 'render_snippet_content' )
56
+ ) );
57
+ }
58
+ }
59
+
60
+ /**
61
+ * Prepare snippets data.
62
+ *
63
+ * @return array
64
+ */
65
+ public function prepared_snippets_data() {
66
+ $prepared_object = array();
67
+
68
+ foreach ( (array) $this->shortcode_data as $item ) {
69
+
70
+ if ( ! isset( $item['id'] ) ) {
71
+ continue;
72
+ }
73
+
74
+ $tags = isset( $item['snippet_tags'] ) ? $item['snippet_tags'] : array();
75
+
76
+ $tags = array_values( array_filter( $tags, array( $this, 'snippet_tags_filter' ) ) );
77
+
78
+ $prepared_object[ $item['id'] ] = array(
79
+ 'id' => $item['id'],
80
+ 'title' => $item['title'],
81
+ 'type' => isset( $item['type'] ) ? $item['type'] : '',
82
+ 'tags' => $tags
83
+ );
84
+ }
85
+
86
+ return $prepared_object;
87
+ }
88
+
89
+ public function snippet_tags_filter( $tag ) {
90
+ return $tag !== 'id';
91
+ }
92
+
93
+ /**
94
+ * Renders snippets content which comes from Gutenber's render_callback.
95
+ *
96
+ * @param array $attributes Array list of attributes passed.
97
+ * @param string|null $content Block content.
98
+ *
99
+ * @return string
100
+ */
101
+ public function render_snippet_content( $attributes, $content ) {
102
+
103
+ $snipped_id = isset( $attributes['id'] ) ? $attributes['id'] : null;
104
+
105
+ if ( ! is_numeric( $snipped_id ) ) {
106
+ return '';
107
+ }
108
+
109
+ unset( $attributes['id'] );
110
+
111
+ $snippets = $this->prepared_snippets_data();
112
+ $current_snippet = isset( $snippets[ $snipped_id ] ) ? $snippets[ $snipped_id ] : null;
113
+
114
+ if ( empty( $current_snippet ) ) {
115
+ return '';
116
+ }
117
+
118
+ $snippet_attrs = $current_snippet['tags'];
119
+ $type = $current_snippet['type'];
120
+
121
+ $shortcode_attributes = ' id="' . $snipped_id . '" ';
122
+
123
+ $attr_values = isset( $attributes['attrValues'] ) ? $attributes['attrValues'] : null;
124
+ if ( ! empty( $attr_values ) ) {
125
+ if ( empty( $snippet_attrs ) ) {
126
+ return '';
127
+ }
128
+
129
+ if ( count( $snippet_attrs ) !== count( $attr_values ) ) {
130
+ return '';
131
+ }
132
+
133
+ foreach ( $attr_values as $key => $value ) {
134
+ $snippet_attr = $snippet_attrs[ $key ];
135
+ $value = esc_attr( $value );
136
+
137
+ if ( empty( $value ) ) {
138
+ continue;
139
+ }
140
+ $shortcode_attributes .= " {$snippet_attr}=\"{$value}\"";
141
+ }
142
+
143
+ $shortcode_attributes = trim( $shortcode_attributes );
144
+ }
145
+
146
+ $shortcode_name = sprintf( "wbcr%s_snippet", ( $type === WINP_SNIPPET_TYPE_UNIVERSAL ? '' : '_' . $type ) );
147
+
148
+ $shortcode = "[{$shortcode_name} {$shortcode_attributes}]";
149
+
150
+ if ( ! empty( $content ) ) {
151
+ $shortcode .= "{$content}[/{$shortcode_name}]";
152
+ }
153
+
154
+ return do_shortcode( $shortcode );
155
+ }
156
+
157
+ function renderShippet( $attributes ) {
158
+ if ( empty( $attributes ) ) {
159
+ return;
160
+ }
161
+ ob_start();
162
+ ?>
163
+ <div style="background:red; color:white; padding:1em;"><?php echo $attributes['content']; ?></div>
164
+ <?php
165
+ return ob_get_clean();
166
+ }
167
+ }
admin/includes/class.import.snippet.php ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Import snippet
4
+ * @author Webcraftic <wordpress.webraftic@gmail.com>
5
+ * @copyright (c) 16.11.2018, Webcraftic
6
+ * @version 1.0
7
+ */
8
+ class WINP_Import_Snippet {
9
+
10
+ /**
11
+ * WINP_Export_Snippet constructor.
12
+ */
13
+ public function __construct() {
14
+ $this->registerHooks();
15
+ }
16
+
17
+ /**
18
+ * Register hooks
19
+ */
20
+ public function registerHooks()
21
+ {
22
+ add_action( 'admin_init', array( $this, 'adminInit' ) );
23
+ }
24
+
25
+ /**
26
+ * Update post meta
27
+ *
28
+ * @param $post_id
29
+ * @param $meta_name
30
+ * @param $meta_value
31
+ */
32
+ private function updateMeta( $post_id, $meta_name, $meta_value )
33
+ {
34
+ update_post_meta( $post_id, WINP_Plugin::app()->getPrefix() . $meta_name, $meta_value );
35
+ }
36
+
37
+ /**
38
+ * adminInit
39
+ */
40
+ public function adminInit()
41
+ {
42
+ $this->processImportFiles();
43
+ }
44
+
45
+ /**
46
+ * Save snippet
47
+ *
48
+ * @param $snippet
49
+ *
50
+ * @return int
51
+ */
52
+ private function saveSnippet( $snippet )
53
+ {
54
+ $data = array(
55
+ 'post_title' => $snippet['title'],
56
+ 'post_content' => $snippet['content'],
57
+ 'post_status' => 'publish',
58
+ 'post_type' => WINP_SNIPPETS_POST_TYPE
59
+ );
60
+
61
+ if ( isset( $snippet['id'] ) && 0 != $snippet['id'] ) {
62
+ $data['ID'] = $snippet['id'];
63
+ }
64
+
65
+ $snippet['id'] = wp_insert_post( $data );
66
+
67
+ $this->updateMeta( $snippet['id'], 'snippet_location', $snippet['location'] );
68
+ $this->updateMeta( $snippet['id'], 'snippet_type', $snippet['type'] );
69
+ $this->updateMeta( $snippet['id'], 'snippet_code', $snippet['code'] );
70
+ $this->updateMeta( $snippet['id'], 'snippet_filters', $snippet['filters'] );
71
+ $this->updateMeta( $snippet['id'], 'changed_filters', $snippet['changed_filters'] );
72
+ $this->updateMeta( $snippet['id'], 'snippet_scope', $snippet['scope'] );
73
+ $this->updateMeta( $snippet['id'], 'snippet_description', $snippet['description'] );
74
+ $this->updateMeta( $snippet['id'], 'snippet_tags', $snippet['tags'] );
75
+ $this->updateMeta( $snippet['id'], 'snippet_activate', 0 );
76
+
77
+ return $snippet['id'];
78
+ }
79
+
80
+ /**
81
+ * Save imported snippets
82
+ *
83
+ * @param $snippets
84
+ * @param $dup_action
85
+ *
86
+ * @return array
87
+ */
88
+ private function saveImportedSnippets( $snippets, $dup_action )
89
+ {
90
+ $existing_snippets = array();
91
+ if ( 'replace' === $dup_action || 'skip' === $dup_action ) {
92
+ $all_snippets = get_posts( array( 'post_type' => WINP_SNIPPETS_POST_TYPE ) );
93
+ foreach ( $all_snippets as $snippet ) {
94
+ $existing_snippets[ $snippet->post_name ] = $snippet->ID;
95
+ }
96
+ }
97
+
98
+ $imported = array();
99
+
100
+ foreach ( $snippets as $snippet ) {
101
+ if ( 'ignore' !== $dup_action && isset( $existing_snippets[ $snippet['name'] ] ) ) {
102
+ if ( 'replace' === $dup_action ) {
103
+ $snippet['id'] = $existing_snippets[ $snippet['name'] ];
104
+ } elseif ( 'skip' === $dup_action ) {
105
+ continue;
106
+ }
107
+ }
108
+
109
+ if ( $snippet_id = $this->saveSnippet( $snippet ) ) {
110
+ $imported[] = $snippet_id;
111
+ }
112
+ }
113
+
114
+ return $imported;
115
+ }
116
+
117
+ /**
118
+ * Import snippets
119
+ *
120
+ * @param $file
121
+ * @param $dup_action
122
+ *
123
+ * @return int|bool|array
124
+ */
125
+ private function importSnippet( $file, $dup_action )
126
+ {
127
+ if ( ! file_exists( $file ) || ! is_file( $file ) ) {
128
+ return false;
129
+ }
130
+
131
+ $raw_data = file_get_contents( $file );
132
+ $data = json_decode( $raw_data, true );
133
+ $snippets = isset( $data['snippets'] ) ? $data['snippets'] : array();
134
+
135
+ $imported = $this->saveImportedSnippets( $snippets, $dup_action );
136
+
137
+ return $imported;
138
+ }
139
+
140
+ /**
141
+ * Process the uploaded import files
142
+ *
143
+ * @uses import_snippets() to process the import file
144
+ * @uses wp_redirect() to pass the import results to the page
145
+ * @uses add_query_arg() to append the results to the current URI
146
+ */
147
+ private function processImportFiles()
148
+ {
149
+ if (
150
+ ! isset( $_FILES['wbcr_inp_import_files'] )
151
+ || ! count( $_FILES['wbcr_inp_import_files'] )
152
+ || ! isset( $_FILES['wbcr_inp_import_files']['tmp_name'][0] )
153
+ || empty( $_FILES['wbcr_inp_import_files']['tmp_name'][0] )
154
+ ) {
155
+ return;
156
+ }
157
+
158
+ $count = 0;
159
+ $uploads = $_FILES['wbcr_inp_import_files'];
160
+ $dup_action = isset( $_POST['duplicate_action'] ) ? $_POST['duplicate_action'] : 'ignore';
161
+ $error = false;
162
+
163
+ foreach ( $uploads['tmp_name'] as $i => $import_file ) {
164
+ $ext = pathinfo( $uploads['name'][ $i ] );
165
+ $ext = $ext['extension'];
166
+ $mime_type = $uploads['type'][ $i ];
167
+
168
+ if ( 'json' === $ext || 'application/json' === $mime_type ) {
169
+ $result = $this->importSnippet( $import_file, $dup_action );
170
+ } else {
171
+ $result = false;
172
+ }
173
+
174
+ if ( false === $result || -1 === $result ) {
175
+ $error = true;
176
+ } else {
177
+ $count += count( $result );
178
+ }
179
+ }
180
+
181
+ $url = remove_query_arg(
182
+ array( 'wbcr_inp_error', 'wbcr_inp_imported' )
183
+ );
184
+ $url = add_query_arg( $error ? array( 'wbcr_inp_error' => true ) : array( 'wbcr_inp_imported' => $count ), $url );
185
+ wp_redirect( esc_url_raw( $url ) );
186
+ exit;
187
+ }
188
+
189
+ }
admin/includes/class.notices.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Warning notices
5
+ *
6
+ * @author Webcraftic <wordpress.webraftic@gmail.com>
7
+ * @copyright (c) 11.12.2018, Webcraftic
8
+ * @version 1.0
9
+ */
10
+ class WINP_WarningNotices {
11
+
12
+ /**
13
+ * @var string
14
+ */
15
+ private $prefix = 'inp_';
16
+
17
+ /**
18
+ * @var array
19
+ */
20
+ private $notices = array();
21
+
22
+ public function __construct() {
23
+ add_filter( 'wbcr_factory_notices_408_list', array( $this, 'register_notices' ), 10, 2 );
24
+ }
25
+
26
+
27
+ public function register_notices( $notices ) {
28
+
29
+ $this->add_notice( 'upgrade_plugin2', $this->get_upgrade_notice(), 'warning' );
30
+ $this->add_notice( 'safe_mode', $this->get_safe_mode_notice(), 'success', false );
31
+ $this->add_notice( 'result_error', $this->get_throw_php_error_notice(), 'error', false, 0, array(
32
+ 'post',
33
+ 'post-new',
34
+ 'edit'
35
+ ) );
36
+ $this->add_notice( 'leave_feedback', $this->get_leave_feedback_notice(), 'success', true, time() + 3600 * 60, array(
37
+ 'post',
38
+ 'post-new',
39
+ 'edit'
40
+ ) );
41
+
42
+ return array_merge( $notices, $this->notices );
43
+ }
44
+
45
+ /**
46
+ * A small line that asks for feedback from user
47
+ *
48
+ * @return string
49
+ */
50
+ public function get_leave_feedback_notice() {
51
+ if ( isset( $_GET['post_type'] ) && WINP_SNIPPETS_POST_TYPE == $_GET['post_type'] ) {
52
+ return '<strong>' . __( 'Have feedback on Woody ad Snippets?', 'insert-php' ) . '</strong> ' . __( 'Please take the time to answer a short survey on how you use this plugin and what you\'d like to see changed or added in the future.', 'insert-php' ) . '
53
+ <a href="http://bit.ly/2MpVokA" class="button secondary" target="_blank" style="margin: auto .5em;">' . __( 'Take the survey now', 'insert-php' ) . '</a>';
54
+ }
55
+ }
56
+
57
+ /**
58
+ * Show error notification after saving snippet. We can also show this message when the snippet is activated.
59
+ * We must warn the user that we can not perform the spippet due to an error.
60
+ *
61
+ * @return string|null
62
+ */
63
+ public function get_throw_php_error_notice() {
64
+
65
+ if ( isset( $_GET['wbcr_inp_save_snippet_result'] ) && $_GET['wbcr_inp_save_snippet_result'] == 'code-error' ) {
66
+ $post_id = isset( $_GET['post'] ) ? intval( $_GET['post'] ) : null;
67
+
68
+ if ( $post_id ) {
69
+ $error = WINP_Plugin::app()->getExecuteObject()->getSnippetError( $post_id );
70
+
71
+ if ( false !== $error ) {
72
+ return sprintf( '<p>%s</p><p><strong>%s</strong></p>', sprintf( __( 'The snippet has been deactivated due to an error on line %d:', 'insert-php' ), $error['line'] ), $error['message'] );
73
+ }
74
+ }
75
+ }
76
+
77
+ return null;
78
+ }
79
+
80
+ /**
81
+ * This warning is for users of the old version 1.3.0. The plugin has changed the way it works
82
+ * and requires user actions to continue working with plugin.
83
+ *
84
+ * @return string
85
+ */
86
+ public function get_upgrade_notice() {
87
+ $create_notice_url = admin_url( 'edit.php?post_type=' . WINP_SNIPPETS_POST_TYPE );
88
+
89
+ $notice = '<b>' . WINP_Plugin::app()->getPluginTitle() . '</b>: ' . sprintf( __( 'Attention! If you have previously used version 1.3.0 of plugin Insert php. This new %s plugin version, we added the ability to insert php code using snippets. This is a more convenient and secure way than using shortcodes [insert_php] code execute [/ insert_php]. However, for compatibility reasons, we left support for [insert_php] shortcodes until March 2019, after that we will stop supporting shortcodes [insert_php].', 'insert-php' ), WINP_Plugin::app()->getPluginVersion() );
90
+
91
+ $notice .= '<br><br>' . __( 'We strongly recommend you to porting your php code to snippets and call them in your posts/pages and widgets using [wbcr_php_snippet id = "000"] shortcodes.', 'insert-php' );
92
+ $notice .= ' ' . sprintf( __( 'For more information on porting code and using snippets, see our plugin <a href="%s" target="_blank">documentation</a>', 'insert-php' ), 'http://woody-ad-snippets.webcraftic.com/getting-started-with-woody-ad-snippets/' );
93
+
94
+ $notice .= '<br><br><a href="' . $create_notice_url . '" class="button button-default">' . __( 'Create new php snippet', 'insert-php' ) . '</a> ';
95
+
96
+ $notice .= '<a href="https://downloads.wordpress.org/plugin/insert-php.1.3.zip" class="button button-default">' . __( 'Download old version', 'insert-php' ) . '</a><br><br>';
97
+ $notice .= sprintf( __( 'If you have issues with the plugin new version or any suggestions, please contact us on <a href="%s" target="_blank">our forum</a>.', 'insert-php' ), 'http://forum.webcraftic.com' );
98
+
99
+ return $notice;
100
+ }
101
+
102
+ /**
103
+ * When the safe mode of the plugin is enabled, this notification will remind
104
+ * the user to exit safe mode so that the user's snippets are available publicly.
105
+ *
106
+ * @return string
107
+ */
108
+ public function get_safe_mode_notice() {
109
+ if ( ! WINP_Helper::is_safe_mode() ) {
110
+ return null;
111
+ }
112
+
113
+ $disable_safe_mode_url = add_query_arg( array( 'wbcr-php-snippets-disable-safe-mode' => 1 ) );
114
+
115
+ $notice = WINP_Plugin::app()->getPluginTitle() . ': ' . __( 'Running in safe mode. This mode your snippets will not be started.', 'insert-php' );
116
+ $notice .= ' <a href="' . $disable_safe_mode_url . '" class="button button-default">' . __( 'Disable Safe Mode', 'insert-php' ) . '</a>';
117
+
118
+ return $notice;
119
+ }
120
+
121
+ protected function add_notice( $id, $message, $type = 'warning', $dismissible = true, $dismiss_expires = 0, $where = array() ) {
122
+ if ( is_null( $message ) ) {
123
+ return;
124
+ }
125
+
126
+ $this->notices[] = array(
127
+ 'id' => $this->prefix . $id,
128
+ 'type' => $type,
129
+ 'dismissible' => (bool) $dismissible,
130
+ 'dismiss_expires' => (int) $dismiss_expires,
131
+ 'where' => $where,
132
+ 'text' => '<p>' . $message . '</p>'
133
+ );
134
+ }
135
+ }
admin/includes/class.snippets.viewtable.php CHANGED
@@ -1,131 +1,186 @@
1
  <?php
2
 
3
- class WINP_SnippetsViewTable extends Wbcr_FactoryViewtables403_Viewtable {
4
-
5
- public function configure()
6
- {
7
- /**
8
- * Columns
9
- */
10
- $this->columns->clear();
11
- $this->columns->add('title', __('Snippet title', 'insert-php'));
12
- $this->columns->add('where_use', __('Where use?', 'insert-php'));
13
- $this->columns->add('description', __('Description', 'insert-php'));
14
- $this->columns->add('taxonomy-' . WINP_SNIPPETS_TAXONOMY, __('Tags', 'insert-php'));
15
- $this->columns->add('status', __('Status', 'insert-php'));
16
- $this->columns->add('actions', __('Actions', 'insert-php'));
17
-
18
- /**
19
- * Scripts & styles
20
- */
21
- $this->styles->add(WINP_PLUGIN_URL . '/admin/assets/css/list-table.css');
22
- $this->runActions();
23
- }
24
-
25
  /**
26
- * Column 'Title'
27
  */
28
- public function columnTitle($post)
29
- {
30
- echo $post->post_title;
31
- }
32
-
33
- public function columnDescription($post)
34
- {
35
- echo WINP_Helper::getMetaOption($post->ID, 'snippet_description');
36
- }
37
-
38
  /**
39
- * Column 'Where_use'
40
  */
41
- public function columnWhere_use($post)
42
- {
43
- $snippet_scope = WINP_Helper::getMetaOption($post->ID, 'snippet_scope');
44
-
45
- if( $snippet_scope == 'evrywhere' ) {
46
- echo __('Run everywhere', 'insert-php');
47
- } else {
48
- echo '[wbcr_php_snippet id="' . $post->ID . '"]';
49
- }
50
- }
51
-
52
- /**
53
- * Column 'Status'
54
- */
55
- public function columnStatus($post)
56
- {
57
- $is_activate = (int)WINP_Helper::getMetaOption($post->ID, 'snippet_activate', 0);
58
- $status_class = "wbcr-inp-status-green";
59
-
60
- if( !$is_activate ) {
61
- $status_class = "wbcr-inp-status-grey";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  }
63
- echo '<div class="wbcr-inp-status-marker ' . $status_class . '"></div>';
 
 
 
 
64
  }
65
-
66
- /**
67
- * Column 'Actions'
68
- */
69
- public function columnActions($post)
70
- {
71
- $is_activate = (int)WINP_Helper::getMetaOption($post->ID, 'snippet_activate', 0);
72
-
73
- $button_text = __('Activate', 'insert-php');
74
-
75
- if( $is_activate ) {
76
- $button_text = __('Deactivate', 'insert-php');
77
- }
78
-
79
- echo '<a href="' . wp_nonce_url(admin_url('edit.php?post_type=' . WINP_SNIPPETS_POST_TYPE . '&amp;post=' . $post->ID . '&amp;action=wbcr_inp_activate_snippet'), 'wbcr_inp_snippert_' . $post->ID . '_action_nonce') . '" class="button"><i class="icon ion-play"></i>' . $button_text . '</a>';
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  }
81
-
82
- /*
83
- * Activate/Deactivate snippet
84
- */
85
- protected function runActions()
86
- {
87
- if( isset($_GET['post_type']) && $_GET['post_type'] == WINP_SNIPPETS_POST_TYPE ) {
88
-
89
- if( isset($_GET['action']) && isset($_GET['post']) && $_GET['action'] == 'wbcr_inp_activate_snippet' ) {
90
-
91
- $post_id = (int)$_GET['post'];
92
-
93
- if( (isset($_GET['_wpnonce']) && !wp_verify_nonce($_GET['_wpnonce'], 'wbcr_inp_snippert_' . $post_id . '_action_nonce')) || !current_user_can('manage_options') ) {
94
- wp_die('Permission error. You can not edit this page.');
95
- }
96
-
97
- $is_activate = (int)WINP_Helper::getMetaOption($post_id, 'snippet_activate', 0);
98
- $snippet_scope = WINP_Helper::getMetaOption($post_id, 'snippet_scope');
99
-
100
- /**
101
- * Prevent activation of the snippet if it contains an error. This will not allow the user to break his site.
102
- * @since 2.0.5
103
- */
104
-
105
- if( $snippet_scope == 'evrywhere' && !$is_activate ) {
106
- if( WINP_Plugin::app()->getSnippetError($post_id) ) {
107
- wp_safe_redirect(add_query_arg(array(
108
- 'action' => 'edit',
109
- 'post' => $post_id,
110
- 'wbcr_inp_save_snippet_result' => 'code-error'
111
- ), admin_url('post.php')));
112
- exit;
113
- }
114
  }
115
-
116
- $status = !$is_activate;
117
-
118
- update_post_meta($post_id, $this->plugin->getPrefix() . 'snippet_activate', $status);
119
-
120
- $redirect_url = add_query_arg(array(
121
- 'post_type' => WINP_SNIPPETS_POST_TYPE,
122
- 'wbcr_inp_snippet_updated' => 1
123
- ), admin_url('edit.php'));
124
-
125
- wp_safe_redirect($redirect_url);
126
- exit;
127
  }
 
 
 
 
 
 
 
 
 
 
 
 
128
  }
129
  }
130
  }
131
-
1
  <?php
2
 
3
+ class WINP_SnippetsViewTable extends Wbcr_FactoryViewtables405_Viewtable {
4
+
5
+ public function configure() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  /**
7
+ * Columns
8
  */
9
+ $this->columns->clear();
10
+ //$this->columns->add('status', __('Status', 'insert-php'));
11
+ $this->columns->add( 'title', __( 'Snippet title', 'insert-php' ) );
12
+ $this->columns->add( 'description', __( 'Description', 'insert-php' ) );
13
+ $this->columns->add( 'actions', __( 'Status', 'insert-php' ) );
14
+ $this->columns->add( 'where_use', __( 'Where use?', 'insert-php' ) );
15
+ $this->columns->add( 'taxonomy-' . WINP_SNIPPETS_TAXONOMY, __( 'Tags', 'insert-php' ) );
16
+ $this->columns->add( 'snippet_type', '' );
17
+
 
18
  /**
19
+ * Scripts & styles
20
  */
21
+ $this->styles->add( WINP_PLUGIN_URL . '/admin/assets/css/list-table.css' );
22
+ $this->runActions();
23
+ }
24
+
25
+ /**
26
+ * Column 'Title'
27
+ *
28
+ * @param $post
29
+ */
30
+ public function columnTitle( $post ) {
31
+ echo $post->post_title;
32
+ }
33
+
34
+ /**
35
+ * Column 'Type'
36
+ *
37
+ * @param $post
38
+ */
39
+ public function columnSnippet_type( $post ) {
40
+ $type = WINP_Helper::getMetaOption( $post->ID, 'snippet_type', WINP_SNIPPET_TYPE_PHP );
41
+ $class = 'wbcr-inp-type-' . esc_attr( $type );
42
+ $type = $type == 'universal' ? 'uni' : $type;
43
+
44
+ echo '<div class="wbcr-inp-snippet-type-label ' . $class . '">' . esc_attr( $type ) . '</div>';
45
+ }
46
+
47
+ public function columnDescription( $post ) {
48
+ echo WINP_Helper::getMetaOption( $post->ID, 'snippet_description' );
49
+ }
50
+
51
+ /**
52
+ * Column 'Where_use'
53
+ *
54
+ * @param $post
55
+ */
56
+ public function columnWhere_use( $post ) {
57
+ $snippet_scope = WINP_Helper::getMetaOption( $post->ID, 'snippet_scope' );
58
+
59
+ if ( $snippet_scope == 'evrywhere' ) {
60
+ echo __( 'Run everywhere', 'insert-php' );
61
+ } elseif ( $snippet_scope == 'auto' ) {
62
+ $items = array(
63
+ WINP_SNIPPET_AUTO_HEADER => __( 'Header', 'insert-php' ),
64
+ WINP_SNIPPET_AUTO_FOOTER => __( 'Footer', 'insert-php' ),
65
+ WINP_SNIPPET_AUTO_BEFORE_POST => __( 'Insert Before Post', 'insert-php' ),
66
+ WINP_SNIPPET_AUTO_BEFORE_CONTENT => __( 'Insert Before Content', 'insert-php' ),
67
+ WINP_SNIPPET_AUTO_BEFORE_PARAGRAPH => __( 'Insert Before Paragraph', 'insert-php' ),
68
+ WINP_SNIPPET_AUTO_AFTER_PARAGRAPH => __( 'Insert After Paragraph', 'insert-php' ),
69
+ WINP_SNIPPET_AUTO_AFTER_CONTENT => __( 'Insert After Content', 'insert-php' ),
70
+ WINP_SNIPPET_AUTO_AFTER_POST => __( 'Insert After Post', 'insert-php' ),
71
+ WINP_SNIPPET_AUTO_BEFORE_EXCERPT => __( 'Insert Before Excerpt', 'insert-php' ),
72
+ WINP_SNIPPET_AUTO_AFTER_EXCERPT => __( 'Insert After Excerpt', 'insert-php' ),
73
+ WINP_SNIPPET_AUTO_BETWEEN_POSTS => __( 'Between Posts', 'insert-php' ),
74
+ WINP_SNIPPET_AUTO_BEFORE_POSTS => __( 'Before post', 'insert-php' ),
75
+ WINP_SNIPPET_AUTO_AFTER_POSTS => __( 'After post', 'insert-php' ),
76
+ );
77
+ $snippet_location = WINP_Helper::getMetaOption( $post->ID, 'snippet_location', '' );
78
+ switch ( $snippet_location ) {
79
+ case WINP_SNIPPET_AUTO_HEADER:
80
+ case WINP_SNIPPET_AUTO_FOOTER:
81
+ $text = __( 'Everywhere', 'insert-php' ) . '[' . $items[ $snippet_location ] . ']';
82
+ break;
83
+ case WINP_SNIPPET_AUTO_BEFORE_POST:
84
+ case WINP_SNIPPET_AUTO_BEFORE_CONTENT:
85
+ case WINP_SNIPPET_AUTO_BEFORE_PARAGRAPH:
86
+ case WINP_SNIPPET_AUTO_AFTER_PARAGRAPH:
87
+ case WINP_SNIPPET_AUTO_AFTER_CONTENT:
88
+ case WINP_SNIPPET_AUTO_AFTER_POST:
89
+ $text = __( 'Posts, Pages, Custom post types', 'insert-php' ) . '[' . $items[ $snippet_location ] . ']';
90
+ break;
91
+ case WINP_SNIPPET_AUTO_BEFORE_EXCERPT:
92
+ case WINP_SNIPPET_AUTO_AFTER_EXCERPT:
93
+ case WINP_SNIPPET_AUTO_BETWEEN_POSTS:
94
+ case WINP_SNIPPET_AUTO_BEFORE_POSTS:
95
+ case WINP_SNIPPET_AUTO_AFTER_POSTS:
96
+ $text = __( 'Categories, Archives, Tags, Taxonomies', 'insert-php' ) . '[' . $items[ $snippet_location ] . ']';
97
+ break;
98
+ default:
99
+ $text = __( 'Everywhere', 'insert-php' );
100
  }
101
+ echo __( 'Automatic insertion', 'insert-php' ) . ': ' . $text;
102
+ } else {
103
+ $snippet_type = WINP_Helper::getMetaOption( $post->ID, 'snippet_type', WINP_SNIPPET_TYPE_PHP );
104
+ $snippet_type = ( $snippet_type == WINP_SNIPPET_TYPE_UNIVERSAL ? '' : $snippet_type . '_' );
105
+ echo '[wbcr_' . $snippet_type . 'snippet id="' . $post->ID . '"]';
106
  }
107
+ }
108
+
109
+ /**
110
+ * Column 'Status'
111
+ *
112
+ * @param $post
113
+ */
114
+ /*public function columnStatus($post)
115
+ {
116
+
117
+ }*/
118
+
119
+ /**
120
+ * Column 'Actions'
121
+ *
122
+ * @param $post
123
+ */
124
+ public function columnActions( $post ) {
125
+ $is_activate = (int) WINP_Helper::getMetaOption( $post->ID, 'snippet_activate', 0 );
126
+
127
+ //$button_text = __( 'Activate', 'insert-php' );
128
+ //$status_class = "wbcr-inp-status-grey";
129
+ $icon = 'dashicons-controls-play';
130
+
131
+ if ( $is_activate ) {
132
+ //$button_text = __( 'Deactivate', 'insert-php' );
133
+ //$status_class = "wbcr-inp-status-green";
134
+ $icon = 'dashicons-controls-pause';
135
  }
136
+
137
+ echo '<a class="wbcr-inp-enable-snippet-button button" href="' . wp_nonce_url( admin_url( 'edit.php?post_type=' . WINP_SNIPPETS_POST_TYPE . '&amp;post=' . $post->ID . '&amp;action=wbcr_inp_activate_snippet' ), 'wbcr_inp_snippert_' . $post->ID . '_action_nonce' ) . '"><span class="dashicons ' . esc_attr( $icon ) . '"></span></a>';
138
+ }
139
+
140
+ /*
141
+ * Activate/Deactivate snippet
142
+ */
143
+ protected function runActions() {
144
+ if ( isset( $_GET['post_type'] ) && $_GET['post_type'] == WINP_SNIPPETS_POST_TYPE ) {
145
+
146
+ if ( isset( $_GET['action'] ) && isset( $_GET['post'] ) && $_GET['action'] == 'wbcr_inp_activate_snippet' ) {
147
+ $post_id = (int) $_GET['post'];
148
+
149
+ if ( ( isset( $_GET['_wpnonce'] ) && ! wp_verify_nonce( $_GET['_wpnonce'], 'wbcr_inp_snippert_' . $post_id . '_action_nonce' ) ) || ! current_user_can( 'manage_options' ) ) {
150
+ wp_die( 'Permission error. You can not edit this page.' );
151
+ }
152
+
153
+ $is_activate = (int) WINP_Helper::getMetaOption( $post_id, 'snippet_activate', 0 );
154
+ $snippet_scope = WINP_Helper::getMetaOption( $post_id, 'snippet_scope' );
155
+ $snippet_type = WINP_Helper::get_snippet_type( $post_id );
156
+
157
+ /**
158
+ * Prevent activation of the snippet if it contains an error. This will not allow the user to break his site.
159
+ * @since 2.0.5
160
+ */
161
+ if ( ( $snippet_scope == 'evrywhere' || $snippet_scope == 'auto' ) && $snippet_type != WINP_SNIPPET_TYPE_TEXT && ! $is_activate ) {
162
+ if ( WINP_Plugin::app()->getExecuteObject()->getSnippetError( $post_id ) ) {
163
+ wp_safe_redirect( add_query_arg( array(
164
+ 'action' => 'edit',
165
+ 'post' => $post_id,
166
+ 'wbcr_inp_save_snippet_result' => 'code-error'
167
+ ), admin_url( 'post.php' ) ) );
168
+ exit;
169
  }
 
 
 
 
 
 
 
 
 
 
 
 
170
  }
171
+
172
+ $status = ! $is_activate;
173
+
174
+ update_post_meta( $post_id, $this->plugin->getPrefix() . 'snippet_activate', $status );
175
+
176
+ $redirect_url = add_query_arg( array(
177
+ 'post_type' => WINP_SNIPPETS_POST_TYPE,
178
+ 'wbcr_inp_snippet_updated' => 1
179
+ ), admin_url( 'edit.php' ) );
180
+
181
+ wp_safe_redirect( $redirect_url );
182
+ exit;
183
  }
184
  }
185
  }
186
+ }
admin/includes/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
admin/index.php CHANGED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
admin/metaboxes/base-options.php CHANGED
@@ -1,321 +1,658 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
- class WINP_BaseOptionsMetaBox extends Wbcr_FactoryMetaboxes403_FormMetabox {
4
-
5
- /**
6
- * A visible title of the metabox.
7
- *
8
- * Inherited from the class FactoryMetabox.
9
- * @link http://codex.wordpress.org/Function_Reference/add_meta_box
10
- *
11
- * @since 1.0.0
12
- * @var string
13
- */
14
- public $title;
15
 
16
-
17
- /**
18
- * The priority within the context where the boxes should show ('high', 'core', 'default' or 'low').
19
- *
20
- * @link http://codex.wordpress.org/Function_Reference/add_meta_box
21
- * Inherited from the class FactoryMetabox.
22
- *
23
- * @since 1.0.0
24
- * @var string
25
- */
26
- public $priority = 'core';
27
-
28
- public $css_class = 'factory-bootstrap-404 factory-fontawesome-000';
29
-
30
- protected $errors = array();
31
- protected $source_channel;
32
- protected $facebook_group_id;
33
- protected $paginate_url;
34
-
35
- public function __construct($plugin)
36
- {
37
- parent::__construct($plugin);
38
-
39
- $this->title = __('Base options', 'insert-php');
40
-
41
- add_action('admin_head', array($this, 'removeMediaButton'));
42
- add_action('admin_enqueue_scripts', array($this, 'deregisterDefaultEditorResourses'));
43
-
44
- add_action('admin_footer-post.php', array($this, 'printCodeEditorScripts'), 99);
45
- add_action('admin_footer-post-new.php', array($this, 'printCodeEditorScripts'), 99);
46
  }
47
-
48
-
49
- /**
50
- * Configures a metabox.
51
- *
52
- * @since 1.0.0
53
- * @param Factory404_ScriptList $scripts A set of scripts to include.
54
- * @param Factory404_StyleList $styles A set of style to include.
55
- * @return void
56
- */
57
- public function configure($scripts, $styles)
58
- {
59
- //method must be overriden in the derived classed.
60
- $styles->add(WINP_PLUGIN_URL . '/admin/assets/css/general.css');
61
-
62
- $this->styles->add(WINP_PLUGIN_URL . '/admin/assets/css/codemirror.css');
63
-
64
- $code_editor_theme = $this->plugin->getOption('code_editor_theme');
65
-
66
- if( !empty($code_editor_theme) && $code_editor_theme != 'default' ) {
67
- $this->styles->add(WINP_PLUGIN_URL . '/admin/assets/css/cmthemes/' . $code_editor_theme . '.css');
68
- }
69
-
70
- $this->scripts->addToHeader(WINP_PLUGIN_URL . '/admin/assets/js/codemirror.js');
71
  }
72
-
73
- /**
74
- * Remove media button
75
- */
76
- public function removeMediaButton()
77
- {
78
- global $post;
79
-
80
- if( empty($post) || $post->post_type !== WINP_SNIPPETS_POST_TYPE ) {
81
- return;
82
- }
83
- remove_action('media_buttons', 'media_buttons');
 
 
84
  }
85
-
86
- /**
87
- * Deregister other CodeMirror styles
88
- */
89
- public function deregisterDefaultEditorResourses()
90
- {
91
- global $post;
92
-
93
- if( empty($post) || $post->post_type !== WINP_SNIPPETS_POST_TYPE ) {
94
- return;
95
- }
96
-
97
- /* Remove other CodeMirror styles */
98
- wp_deregister_style('codemirror');
99
  }
100
-
101
- public function printCodeEditorScripts()
102
- {
103
- global $post;
104
-
105
- if( empty($post) || $post->post_type !== WINP_SNIPPETS_POST_TYPE ) {
106
- return;
107
- }
108
-
109
- $code_editor_theme = $this->plugin->getOption('code_editor_theme');
110
-
111
- ?>
112
- <script>
113
- /* Loads CodeMirror on the snippet editor */
114
- (function() {
115
-
116
- var atts = [];
117
-
118
- atts['mode'] = 'text/x-php';
119
- atts['matchBrackets'] = true;
120
- atts['viewportMargin'] = Infinity;
121
-
122
- atts['extraKeys'] = {
123
- 'Ctrl-Enter': function(cm) {
124
- document.getElementById('<?= $this->plugin->getPrefix() ?>snippet_code').submit();
125
- }
126
- };
127
-
128
- atts['indentWithTabs'] = <?php $this->printBool($this->plugin->getOption('code_editor_indent_with_tabs', false)) ?>;
129
- atts['tabSize'] = <?= (int)$this->plugin->getOption('code_editor_tab_size', 4) ?>;
130
- atts['indentUnit'] = <?= (int)$this->plugin->getOption('code_editor_indent_unit', 2) ?>;
131
- atts['lineNumbers'] = <?php $this->printBool($this->plugin->getOption('code_editor_line_numbers', false)) ?>;
132
- atts['lineWrapping'] = <?php $this->printBool($this->plugin->getOption('code_editor_wrap_lines', false)) ?>;
133
- atts['autoCloseBrackets'] = <?php $this->printBool($this->plugin->getOption('code_editor_auto_close_brackets', false)) ?>;
134
- atts['highlightSelectionMatches'] = <?php $this->printBool($this->plugin->getOption('code_editor_highlight_selection_matches', false)) ?>;
135
-
136
- <?php if(!empty($code_editor_theme) && $code_editor_theme != 'default'): ?>
137
- atts['theme'] = '<?= esc_attr($code_editor_theme) ?>';
138
- <?php endif; ?>
139
-
140
- CodeMirror.fromTextArea(document.getElementById('<?= $this->plugin->getPrefix() ?>snippet_code'), atts);
141
- })();
142
-
143
- jQuery(document).ready(function($) {
144
- $('.wp-editor-tabs').remove();
145
- });
146
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  }
149
-
150
- /**
151
- * @param bool $bool_val
152
- */
153
- protected function printBool($bool_val)
154
- {
155
- echo $bool_val
156
- ? 'true'
157
- : 'false';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
  }
159
-
160
- /**
161
- * Configures a form that will be inside the metabox.
162
- *
163
- * @see Wbcr_FactoryMetaboxes403_FormMetabox
164
- * @since 1.0.0
165
- *
166
- * @param FactoryForms405_Form $form A form object to configure.
167
- * @return void
168
- */
169
- public function form($form)
170
- {
171
- $items[] = array(
172
- 'type' => 'textarea',
173
- 'name' => 'snippet_code',
174
- 'title' => __('Enter the code for your snippet', 'insert-php'),
175
- 'hint' => __('Enter the PHP code, without opening and closing tags.<br>-If you want to put the html code in the snippet, put the closing php tag before the html code. Example: <b>?&gt;&lt;div&gt;my html code&lt;/div&gt;</b><br>-You can get the values of the variables from the shortcode attributes. For example, if you set the <b>my_type</b> attribute for the shortcode [wbcr_php_snippet id="2864" <b>my_type="button"</b>], you can get the value of the my_type attribute in the snippet by calling <b>$my_type</b> var.', 'insert-php'),
176
- 'filter_value' => array($this, 'codeSnippetFilterValue')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  );
178
-
179
- $items[] = array(
180
- 'type' => 'dropdown',
181
- 'way' => 'buttons',
182
- 'name' => 'snippet_scope',
183
- 'data' => array(
184
- array('evrywhere', __('Run everywhere', 'insert-php')),
185
- array('shortcode', __('Where there is a shortcode', 'insert-php'))
186
-
187
- ),
188
- 'title' => __('Where to execute the code?', 'insert-php'),
189
- 'hint' => __('If you select the "Run everywhere" option, after activating the widget, the php code will be launched on all pages of your site. Another option works only where you have set a shortcode snippet (widgets, post).', 'insert-php'),
190
- 'default' => 'shortcode'
191
  );
192
-
193
- $items[] = array(
194
- 'type' => 'textarea',
195
- 'name' => 'snippet_description',
196
- 'title' => __('Description', 'insert-php'),
197
- 'hint' => __('You can write a short note so that you can always remember why this code or your colleague was able to apply this code in his works.', 'bizpanda'),
198
- 'tinymce' => array(
199
- 'height' => 150,
200
- 'plugins' => ''
201
  ),
202
- 'default' => ''
 
 
203
  );
204
-
205
- $form->add($items);
206
  }
207
-
208
- /**
209
- * Validate the snippet code before saving to database
210
- *
211
- * @param Code_Snippet $snippet
212
- *
213
- * @return bool true if code produces errors
214
- */
215
- private function validateCode($snippet_code)
216
- {
217
- global $post;
218
-
219
- $snippet_code = stripslashes($snippet_code);
220
-
221
- if( empty($snippet_code) ) {
222
- return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
223
  }
224
-
225
- ob_start(array($this, 'codeErrorCallback'));
226
-
227
- $result = eval($snippet_code);
228
-
229
- ob_end_clean();
230
-
231
- do_action('wbcr_inp_after_execute_snippet', $post->ID, $snippet_code, $result);
232
-
233
- return !(false === $result);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
  }
235
-
236
- private function codeErrorCallback($out)
237
- {
238
- $error = error_get_last();
239
-
240
- if( is_null($error) ) {
241
- return $out;
 
 
 
 
 
 
 
 
 
 
242
  }
243
-
244
- $m = '<h3>' . __("Don't Panic", 'code-snippets') . '</h3>';
245
- $m .= '<p>' . sprintf(__('The code snippet you are trying to save produced a fatal error on line %d:', 'code_snippets'), $error['line']) . '</p>';
246
- $m .= '<strong>' . $error['message'] . '</strong>';
247
- $m .= '<p>' . __('The previous version of the snippet is unchanged, and the rest of this site should be functioning normally as before.', 'code-snippets') . '</p>';
248
- $m .= '<p>' . __('Please use the back button in your browser to return to the previous page and try to fix the code error.', 'code-snippets');
249
- $m .= ' ' . __('If you prefer, you can close this page and discard the changes you just made. No changes will be made to this site.', 'code-snippets') . '</p>';
250
-
251
- return $m;
252
  }
253
-
254
- /**
255
- * @param string $value
256
- * @param string $raw_value
257
- * @return mixed
258
- */
259
- public function codeSnippetFilterValue($value, $raw_value)
260
- {
261
- return $this->prepareCode($raw_value);
 
 
 
 
 
 
 
 
 
 
262
  }
263
-
264
- /**
265
- * Prepare the code by removing php tags from beginning and end
266
- * @param string $code
267
- * @return string
268
- */
269
- private function prepareCode($code)
270
- {
271
- /* Remove <?php and <? from beginning of snippet */
272
- $code = preg_replace('|^[\s]*<\?(php)?|', '', $code);
273
-
274
- /* Remove ?> from end of snippet */
275
- $code = preg_replace('|\?>[\s]*$|', '', $code);
276
-
277
- return $code;
 
 
 
 
 
 
 
 
 
 
 
 
278
  }
279
-
280
- public function afterSavingForm($postId)
281
- {
282
- global $post;
283
-
284
- if( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) {
285
- return;
286
- }
287
-
288
- $is_default_activate = WINP_Plugin::app()->getOption('activate_by_default', true);
289
-
290
- $snippet_code = isset($_POST[WINP_Plugin::app()->getPrefix() . 'snippet_code'])
291
- ? $this->prepareCode($_POST[WINP_Plugin::app()->getPrefix() . 'snippet_code'])
292
- : '';
293
-
294
- $snippet_type = isset($_POST[WINP_Plugin::app()->getPrefix() . 'snippet_scope'])
295
- ? sanitize_text_field($_POST[WINP_Plugin::app()->getPrefix() . 'snippet_scope'])
296
- : null;
297
-
298
- WINP_Helper::updateMetaOption($post->ID, 'snippet_activate', false);
299
-
300
- $validate = true;
301
-
302
- if( $snippet_type == 'evrywhere' ) {
303
- $validate = $this->validateCode($snippet_code);
 
 
 
 
 
 
 
 
 
304
  }
305
-
306
- if( $validate && $is_default_activate && WINP_Plugin::app()->currentUserCan() ) {
307
- WINP_Helper::updateMetaOption($post->ID, 'snippet_activate', true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
  } else {
309
-
310
- /* Display message if a parse error occurred */
311
-
312
- wp_redirect(add_query_arg(array(
313
- 'action' => 'edit',
314
- 'post' => $post->ID,
315
- 'wbcr_inp_save_snippet_result' => 'code-error'
316
- ), admin_url('post.php')));
317
-
318
- exit;
319
  }
320
  }
321
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+
3
+ class WINP_BaseOptionsMetaBox extends Wbcr_FactoryMetaboxes404_FormMetabox {
4
+
5
+ /**
6
+ * A visible title of the metabox.
7
+ *
8
+ * Inherited from the class FactoryMetabox.
9
+ * @link http://codex.wordpress.org/Function_Reference/add_meta_box
10
+ *
11
+ * @since 1.0.0
12
+ * @var string
13
+ */
14
+ public $title;
15
+
16
+ /**
17
+ * The priority within the context where the boxes should show ('high', 'core', 'default' or 'low').
18
+ *
19
+ * @link http://codex.wordpress.org/Function_Reference/add_meta_box
20
+ * Inherited from the class FactoryMetabox.
21
+ *
22
+ * @since 1.0.0
23
+ * @var string
24
+ */
25
+ public $priority = 'core';
26
 
27
+ public $css_class = 'factory-bootstrap-410 factory-fontawesome-000';
28
+
29
+ protected $errors = array();
30
+ protected $source_channel;
31
+ protected $facebook_group_id;
32
+ protected $paginate_url;
33
+
34
+ public function __construct( $plugin ) {
35
+ parent::__construct( $plugin );
 
 
 
36
 
37
+ $this->title = __( 'Base options', 'insert-php' );
38
+
39
+ add_action( 'admin_head', array( $this, 'removeMediaButton' ) );
40
+ add_action( 'admin_enqueue_scripts', array( $this, 'deregisterDefaultEditorResourses' ) );
41
+
42
+ $snippet_type = WINP_Helper::get_snippet_type();
43
+
44
+ if ( $snippet_type !== WINP_SNIPPET_TYPE_TEXT ) {
45
+ add_action( 'admin_footer-post.php', array( $this, 'printCodeEditorScripts' ), 99 );
46
+ add_action( 'admin_footer-post-new.php', array( $this, 'printCodeEditorScripts' ), 99 );
47
+ add_action( 'edit_form_after_editor', array( $this, 'phpEditorMarkup' ), 10, 1 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  }
49
+
50
+ add_action( 'admin_body_class', array( $this, 'admin_body_class' ) );
51
+ add_action( 'edit_form_top', array( $this, 'editFormTop' ) );
52
+ }
53
+
54
+
55
+ /**
56
+ * Configures a metabox.
57
+ *
58
+ * @since 1.0.0
59
+ *
60
+ * @param Wbcr_Factory410_ScriptList $scripts A set of scripts to include.
61
+ * @param Wbcr_Factory410_StyleList $styles A set of style to include.
62
+ *
63
+ * @return void
64
+ */
65
+ public function configure( $scripts, $styles ) {
66
+ //method must be overriden in the derived classed.
67
+ $styles->add( WINP_PLUGIN_URL . '/admin/assets/css/general.css' );
68
+
69
+ $code_editor_theme = $this->plugin->getPopulateOption( 'code_editor_theme' );
70
+
71
+ if ( ! empty( $code_editor_theme ) && $code_editor_theme != 'default' ) {
72
+ $this->styles->add( WINP_PLUGIN_URL . '/admin/assets/css/cmthemes/' . $code_editor_theme . '.css' );
73
  }
74
+
75
+ $this->styles->add( WINP_PLUGIN_URL . '/admin/assets/css/code-editor.min.css' );
76
+ $this->scripts->addToHeader( WINP_PLUGIN_URL . '/admin/assets/js/code-editor.min.js' );
77
+ }
78
+
79
+
80
+ /**
81
+ * Remove media button
82
+ */
83
+ public function removeMediaButton() {
84
+ global $post;
85
+
86
+ if ( empty( $post ) || $post->post_type !== WINP_SNIPPETS_POST_TYPE ) {
87
+ return;
88
  }
89
+ remove_action( 'media_buttons', 'media_buttons' );
90
+ }
91
+
92
+ /**
93
+ * Deregister other CodeMirror styles
94
+ */
95
+ public function deregisterDefaultEditorResourses() {
96
+ global $post;
97
+
98
+ if ( empty( $post ) || $post->post_type !== WINP_SNIPPETS_POST_TYPE ) {
99
+ return;
 
 
 
100
  }
101
+
102
+ /* Remove other CodeMirror styles */
103
+ wp_deregister_style( 'codemirror' );
104
+ }
105
+
106
+ public function printCodeEditorScripts() {
107
+ global $post;
108
+
109
+ if ( empty( $post ) || $post->post_type !== WINP_SNIPPETS_POST_TYPE ) {
110
+ return;
111
+ }
112
+
113
+ $snippet_type = WINP_Helper::get_snippet_type();
114
+ $code_editor_mode = $snippet_type == WINP_SNIPPET_TYPE_PHP ? 'text/x-php' : 'application/x-httpd-php';
115
+ $code_editor_theme = $this->plugin->getPopulateOption( 'code_editor_theme' );
116
+
117
+ ?>
118
+ <script>
119
+ /* Loads CodeMirror on the snippet editor */
120
+ (function() {
121
+
122
+ var atts = [];
123
+
124
+ atts['mode'] = '<?= $code_editor_mode ?>';
125
+
126
+ atts['matchBrackets'] = true;
127
+ atts['styleActiveLine'] = true;
128
+ atts['continueComments'] = true;
129
+ atts['autoCloseTags'] = true;
130
+ atts['viewportMargin'] = Infinity;
131
+
132
+ atts['inputStyle'] = 'contenteditable';
133
+ atts['direction'] = 'ltr';
134
+ atts['lint'] = true;
135
+ atts['gutters'] = ["CodeMirror-lint-markers"];
136
+
137
+ atts['matchTags'] = {
138
+ 'bothTags': true
139
+ };
140
+
141
+ atts['extraKeys'] = {
142
+ 'Ctrl-Enter': function(cm) {
143
+ document.getElementById('<?= $this->plugin->getPrefix() ?>snippet_code').submit();
144
+ },
145
+ 'Ctrl-Space': 'autocomplete',
146
+ 'Ctrl-/': 'toggleComment',
147
+ 'Cmd-/': 'toggleComment',
148
+ 'Alt-F': 'findPersistent',
149
+ 'Ctrl-F': 'findPersistent',
150
+ 'Cmd-F': 'findPersistent'
151
+ };
152
+
153
+ atts['indentWithTabs'] = <?php $this->printBool( $this->plugin->getPopulateOption( 'code_editor_indent_with_tabs', true ) ) ?>;
154
+ atts['tabSize'] = <?= (int) $this->plugin->getPopulateOption( 'code_editor_tab_size', 4 ) ?>;
155
+ atts['indentUnit'] = <?= (int) $this->plugin->getPopulateOption( 'code_editor_indent_unit', 4 ) ?>;
156
+ atts['lineNumbers'] = <?php $this->printBool( $this->plugin->getPopulateOption( 'code_editor_line_numbers', true ) ) ?>;
157
+ atts['lineWrapping'] = <?php $this->printBool( $this->plugin->getPopulateOption( 'code_editor_wrap_lines', true ) ) ?>;
158
+ atts['autoCloseBrackets'] = <?php $this->printBool( $this->plugin->getPopulateOption( 'code_editor_auto_close_brackets', true ) ) ?>;
159
+ <?php if ($this->plugin->getPopulateOption( 'code_editor_highlight_selection_matches', true )) { ?>
160
+ atts['highlightSelectionMatches'] = {
161
+ showToken: true,
162
+ style: 'winp-matchhighlight'
163
+ };
164
+ <?php } else { ?>
165
+ atts['highlightSelectionMatches'] = false;
166
+ <?php } ?>
167
+
168
+ <?php if(! empty( $code_editor_theme ) && $code_editor_theme != 'default'): ?>
169
+ atts['theme'] = '<?= esc_attr( $code_editor_theme ) ?>';
170
+ <?php endif; ?>
171
+
172
+ Woody_CodeMirror.fromTextArea(document.getElementById('<?= $this->plugin->getPrefix() ?>snippet_code'), atts);
173
+ })();
174
+
175
+ jQuery(document).ready(function($) {
176
+ $('.wp-editor-tabs').remove();
177
+ });
178
+ </script>
179
  <?php
180
+ }
181
+
182
+ /**
183
+ * Markup PHP snippet editor.
184
+ *
185
+ * @param object $post Post Object.
186
+ */
187
+ function phpEditorMarkup( $post ) {
188
+ // Get all posts.
189
+ $post_type = get_post_type();
190
+
191
+ if ( WINP_SNIPPETS_POST_TYPE == $post_type ) {
192
+ wp_nonce_field( basename( __FILE__ ), WINP_SNIPPETS_POST_TYPE );
193
+ $content = WINP_Helper::getMetaOption( $post->ID, 'snippet_code' );
194
+ ?>
195
+ <div class="wp-editor-container winp-editor-container">
196
+ <textarea id="<?= $this->plugin->getPrefix() ?>snippet_code" name="<?= $this->plugin->getPrefix() ?>snippet_code" class="wp-editor-area winp-php-content"><?php echo esc_html( $content ); ?></textarea>
197
+ </div>
198
+ <?php
199
  }
200
+ }
201
+
202
+ /**
203
+ * Adds one or more classes to the body tag in the dashboard.
204
+ *
205
+ * @param string $classes Current body classes.
206
+ *
207
+ * @return string Altered body classes.
208
+ */
209
+ public function admin_body_class( $classes ) {
210
+
211
+ global $post;
212
+
213
+ if ( ! empty( $post ) && $post->post_type == WINP_SNIPPETS_POST_TYPE ) {
214
+ $snippet_type = WINP_Helper::get_snippet_type();
215
+
216
+ $new_classes = "wbcr-inp-snippet-type-" . $snippet_type;
217
+
218
+ if ( $snippet_type !== WINP_SNIPPET_TYPE_TEXT ) {
219
+ $new_classes .= " winp-snippet-enabled";
220
+ }
221
+
222
+ return $classes . $new_classes;
223
  }
224
+
225
+ return $classes;
226
+ }
227
+
228
+ /**
229
+ * Add hidden tag to edit post form
230
+ *
231
+ * @param $post
232
+ */
233
+ public function editFormTop( $post ) {
234
+ if ( empty( $post ) || $post->post_type !== WINP_SNIPPETS_POST_TYPE ) {
235
+ return;
236
+ }
237
+
238
+ $snippet_type = isset( $_GET['winp_item'] ) ? sanitize_text_field( $_GET['winp_item'] ) : WINP_SNIPPET_TYPE_PHP;
239
+ $snippet_type = WINP_Helper::getMetaOption( $post->ID, 'snippet_type', $snippet_type );
240
+ echo '<input type="hidden" id="wbcr_inp_snippet_type" name="wbcr_inp_snippet_type" value="' . $snippet_type . '">';
241
+ }
242
+
243
+ /**
244
+ * @param bool $bool_val
245
+ */
246
+ protected function printBool( $bool_val ) {
247
+ echo $bool_val ? 'true' : 'false';
248
+ }
249
+
250
+ /**
251
+ * Configures a form that will be inside the metabox.
252
+ *
253
+ * @see Wbcr_FactoryMetaboxes404_FormMetabox
254
+ * @since 1.0.0
255
+ *
256
+ * @param Wbcr_FactoryForms411_Form $form A form object to configure.
257
+ *
258
+ * @return void
259
+ */
260
+ public function form( $form ) {
261
+ $snippet_type = WINP_Helper::get_snippet_type();
262
+ $events = array();
263
+
264
+ if ( $snippet_type === WINP_SNIPPET_TYPE_PHP ) {
265
+ $option_name = 'Run everywhere';
266
+ $data = array(
267
+ array( 'evrywhere', __( $option_name, 'insert-php' ) ),
268
+ array( 'shortcode', __( 'Where there is a shortcode', 'insert-php' ) )
269
  );
270
+ } else {
271
+ if ( $snippet_type === WINP_SNIPPET_TYPE_TEXT ) {
272
+ $hint = __( 'If you want to place some content into your snippet from the shortcode just wrap it inside [wbcr_text_snippet id="xxx"]content[/wbcr_text_snippet]. To use this content inside the snippet use {{SNIPPET_CONTENT}} variable.', 'insert-php' );
273
+ } else if ( $snippet_type === WINP_SNIPPET_TYPE_PHP ) {
274
+ $hint = __( 'If you want to place some content into your snippet from the shortcode just wrap it inside [wbcr_php_snippet id="xxx"]content[/wbcr_php_snippet]. To use this content inside the snippet use $content variable.', 'insert-php' );
275
+ } else if ( $snippet_type === WINP_SNIPPET_TYPE_UNIVERSAL ) {
276
+ $hint = __( 'If you want to place some content into your snippet from the shortcode just wrap it inside [wbcr_snippet id="xxx"]content[/wbcr_snippet]. To use this content inside the snippet use $content variable.', 'insert-php' );
277
+ }
278
+
279
+ $option_name = 'Automatic insertion';
280
+ $data = array(
281
+ array( 'auto', __( $option_name, 'insert-php' ) ),
282
+ array( 'shortcode', __( 'Where there is a shortcode', 'insert-php' ), $hint )
283
  );
284
+ $events = array(
285
+ 'auto' => array(
286
+ 'show' => '.factory-control-snippet_location'
 
 
 
 
 
 
287
  ),
288
+ 'shortcode' => array(
289
+ 'hide' => '.factory-control-snippet_location,.factory-control-snippet_p_number'
290
+ )
291
  );
 
 
292
  }
293
+
294
+ $items[] = array(
295
+ 'type' => 'dropdown',
296
+ 'way' => 'buttons',
297
+ 'name' => 'snippet_scope',
298
+ 'data' => $data,
299
+ 'title' => __( 'Where to execute the code?', 'insert-php' ),
300
+ 'hint' => __( 'If you select the "' . $option_name . '" option, after activating the widget, the php code will be launched on all pages of your site. Another option works only where you have set a shortcode snippet (widgets, post).', 'insert-php' ),
301
+ 'default' => 'shortcode',
302
+ 'events' => $events
303
+ );
304
+
305
+ if ( $snippet_type !== WINP_SNIPPET_TYPE_PHP ) {
306
+ $data = array(
307
+ array(
308
+ 'title' => __( 'Everywhere', 'insert-php' ),
309
+ 'type' => 'group',
310
+ 'items' => array(
311
+ array(
312
+ WINP_SNIPPET_AUTO_HEADER,
313
+ __( 'Head', 'insert-php' ),
314
+ __( 'Snippet will be placed in the source code before </head>.', 'insert-php' )
315
+ ),
316
+ array(
317
+ WINP_SNIPPET_AUTO_FOOTER,
318
+ __( 'Footer', 'insert-php' ),
319
+ __( 'Snippet will be placed in the source code before </body>.', 'insert-php' )
320
+ )
321
+ )
322
+ ),
323
+ array(
324
+ 'title' => __( 'Posts, Pages, Custom post types', 'insert-php' ),
325
+ 'type' => 'group',
326
+ 'items' => array(
327
+ array(
328
+ WINP_SNIPPET_AUTO_BEFORE_POST,
329
+ __( 'Insert Before Post', 'insert-php' ),
330
+ __( 'Snippet will be placed before the title of the post/page.', 'insert-php' )
331
+ ),
332
+ array(
333
+ WINP_SNIPPET_AUTO_BEFORE_CONTENT,
334
+ __( 'Insert Before Content', 'insert-php' ),
335
+ __( 'Snippet will be placed before the content of the post/page.', 'insert-php' )
336
+ ),
337
+ array(
338
+ WINP_SNIPPET_AUTO_BEFORE_PARAGRAPH,
339
+ __( 'Insert Before Paragraph', 'insert-php' ),
340
+ __( 'Snippet will be placed before the paragraph, which number you can specify in the Location number field.', 'insert-php' )
341
+ ),
342
+ array(
343
+ WINP_SNIPPET_AUTO_AFTER_PARAGRAPH,
344
+ __( 'Insert After Paragraph', 'insert-php' ),
345
+ __( 'Snippet will be placed after the paragraph, which number you can specify in the Location number field.', 'insert-php' )
346
+ ),
347
+ array(
348
+ WINP_SNIPPET_AUTO_AFTER_CONTENT,
349
+ __( 'Insert After Content', 'insert-php' ),
350
+ __( 'Snippet will be placed after the content of the post/page.', 'insert-php' )
351
+ ),
352
+ array(
353
+ WINP_SNIPPET_AUTO_AFTER_POST,
354
+ __( 'Insert After Post', 'insert-php' ),
355
+ __( 'Snippet will be placed in the very end of the post/page.', 'insert-php' )
356
+ )
357
+ )
358
+ ),
359
+ array(
360
+ 'title' => __( 'Categories, Archives, Tags, Taxonomies', 'insert-php' ),
361
+ 'type' => 'group',
362
+ 'items' => array(
363
+ array(
364
+ WINP_SNIPPET_AUTO_BEFORE_EXCERPT,
365
+ __( 'Insert Before Excerpt', 'insert-php' ),
366
+ __( 'Snippet will be placed before the excerpt of the post/page.', 'insert-php' )
367
+ ),
368
+ array(
369
+ WINP_SNIPPET_AUTO_AFTER_EXCERPT,
370
+ __( 'Insert After Excerpt', 'insert-php' ),
371
+ __( 'Snippet will be placed after the excerpt of the post/page.', 'insert-php' )
372
+ ),
373
+ array(
374
+ WINP_SNIPPET_AUTO_BETWEEN_POSTS,
375
+ __( 'Between Posts', 'insert-php' ),
376
+ __( 'Snippet will be placed between each post.', 'insert-php' )
377
+ ),
378
+ array(
379
+ WINP_SNIPPET_AUTO_BEFORE_POSTS,
380
+ __( 'Before post', 'insert-php' ),
381
+ __( 'Snippet will be placed before the post, which number you can specify in the Location number field.', 'insert-php' )
382
+ ),
383
+ array(
384
+ WINP_SNIPPET_AUTO_AFTER_POSTS,
385
+ __( 'After post', 'insert-php' ),
386
+ __( 'Snippet will be placed after the post, which number you can specify in the Location number field.', 'insert-php' )
387
+ )
388
+ )
389
+ )
390
+ );
391
+
392
+ if ( $snippet_type === WINP_SNIPPET_TYPE_TEXT ) {
393
+ unset( $data[0] );
394
+ $data = array_values( $data );
395
  }
396
+
397
+ $items[] = array(
398
+ 'type' => 'dropdown',
399
+ 'name' => 'snippet_location',
400
+ 'data' => $data,
401
+ 'title' => __( 'Insertion location', 'insert-php' ),
402
+ 'hint' => __( 'Select the location for you snippet.', 'insert-php' ),
403
+ 'default' => WINP_SNIPPET_AUTO_HEADER,
404
+ 'events' => array(
405
+ WINP_SNIPPET_AUTO_HEADER => array(
406
+ 'hide' => '.factory-control-snippet_p_number'
407
+ ),
408
+ WINP_SNIPPET_AUTO_FOOTER => array(
409
+ 'hide' => '.factory-control-snippet_p_number'
410
+ ),
411
+ WINP_SNIPPET_AUTO_BEFORE_POST => array(
412
+ 'hide' => '.factory-control-snippet_p_number'
413
+ ),
414
+ WINP_SNIPPET_AUTO_BEFORE_CONTENT => array(
415
+ 'hide' => '.factory-control-snippet_p_number'
416
+ ),
417
+ WINP_SNIPPET_AUTO_AFTER_CONTENT => array(
418
+ 'hide' => '.factory-control-snippet_p_number'
419
+ ),
420
+ WINP_SNIPPET_AUTO_AFTER_POST => array(
421
+ 'hide' => '.factory-control-snippet_p_number'
422
+ ),
423
+ WINP_SNIPPET_AUTO_BEFORE_EXCERPT => array(
424
+ 'hide' => '.factory-control-snippet_p_number'
425
+ ),
426
+ WINP_SNIPPET_AUTO_AFTER_EXCERPT => array(
427
+ 'hide' => '.factory-control-snippet_p_number'
428
+ ),
429
+ WINP_SNIPPET_AUTO_BETWEEN_POSTS => array(
430
+ 'hide' => '.factory-control-snippet_p_number'
431
+ ),
432
+ WINP_SNIPPET_AUTO_BEFORE_PARAGRAPH => array(
433
+ 'show' => '.factory-control-snippet_p_number'
434
+ ),
435
+ WINP_SNIPPET_AUTO_AFTER_PARAGRAPH => array(
436
+ 'show' => '.factory-control-snippet_p_number'
437
+ ),
438
+ WINP_SNIPPET_AUTO_BEFORE_POSTS => array(
439
+ 'show' => '.factory-control-snippet_p_number'
440
+ ),
441
+ WINP_SNIPPET_AUTO_AFTER_POSTS => array(
442
+ 'show' => '.factory-control-snippet_p_number'
443
+ )
444
+ )
445
+ );
446
+
447
+ $items[] = array(
448
+ 'type' => 'textbox',
449
+ 'name' => 'snippet_p_number',
450
+ 'title' => __( 'Location number', 'insert-php' ),
451
+ 'hint' => __( 'Paragraph / Post number', 'insert-php' ),
452
+ 'default' => 0
453
+ );
454
  }
455
+
456
+ $items[] = array(
457
+ 'type' => 'textarea',
458
+ 'name' => 'snippet_description',
459
+ 'title' => __( 'Description', 'insert-php' ),
460
+ 'hint' => __( 'You can write a short note so that you can always remember why this code or your colleague was able to apply this code in his works.', 'insert-php' ),
461
+ 'tinymce' => array(
462
+ 'height' => 150,
463
+ 'plugins' => ''
464
+ ),
465
+ 'default' => ''
466
+ );
467
+
468
+ if ( $snippet_type !== WINP_SNIPPET_TYPE_TEXT ) {
469
+ $shorcode_name = 'wbcr_php_snippet';
470
+ if ( $snippet_type === WINP_SNIPPET_TYPE_UNIVERSAL ) {
471
+ $shorcode_name = 'wbcr_snippet';
472
  }
473
+ $items[] = array(
474
+ 'type' => 'textbox',
475
+ 'name' => 'snippet_tags',
476
+ 'title' => __( 'Available attributes', 'insert-php' ),
477
+ 'hint' => __( "Available attributes for shortcode via comma. Only numbers, letters and underscore characters are allowed. Attribute id is always available. With this option you can set additional attributes for the shortcode. Example: start_date attribute to [$shorcode_name id='xxx' start_date='2018/01/15'] shortcode. Now we can get attribute value in the snippet with th \$start_date variable. It's convenient if you want to print out different results depending on this attributes.", "insert-php" ),
478
+ 'placeholder' => 'title, pass_attr1, pass_attr2'
479
+ //'default' => ''
480
+ );
 
481
  }
482
+
483
+ $form->add( $items );
484
+ }
485
+
486
+ /**
487
+ * Validate the snippet code before saving to database
488
+ *
489
+ * @param $snippet_code
490
+ * @param $snippet_type
491
+ *
492
+ * @return bool true if code produces errors
493
+ */
494
+ private function validateCode( $snippet_code, $snippet_type ) {
495
+ global $post;
496
+
497
+ $snippet_code = stripslashes( $snippet_code );
498
+
499
+ if ( empty( $snippet_code ) ) {
500
+ return true;
501
  }
502
+
503
+ ob_start( array( $this, 'codeErrorCallback' ) );
504
+
505
+ $result = $snippet_type == WINP_SNIPPET_TYPE_UNIVERSAL ? eval( "?> " . $snippet_code . " <?php " ) : eval( $snippet_code );
506
+
507
+ // elimination of errors 500 in eval() functions, with the directive display_errors = off;
508
+ header( 'HTTP/1.0 200 OK' );
509
+
510
+ ob_end_clean();
511
+
512
+ do_action( 'wbcr_inp_after_execute_snippet', $post->ID, $snippet_code, $result );
513
+
514
+ return false !== $result;
515
+ }
516
+
517
+ /**
518
+ * This friendly notice will be shown to the user in case of php errors.
519
+ *
520
+ * @param $out
521
+ *
522
+ * @return string
523
+ */
524
+ private function codeErrorCallback( $out ) {
525
+ $error = error_get_last();
526
+
527
+ if ( is_null( $error ) ) {
528
+ return $out;
529
  }
530
+
531
+ $m = '<h3>' . __( "Don't Panic", 'code-snippets' ) . '</h3>';
532
+ $m .= '<p>' . sprintf( __( 'The code snippet you are trying to save produced a fatal error on line %d:', 'code_snippets' ), $error['line'] ) . '</p>';
533
+ $m .= '<strong>' . $error['message'] . '</strong>';
534
+ $m .= '<p>' . __( 'The previous version of the snippet is unchanged, and the rest of this site should be functioning normally as before.', 'code-snippets' ) . '</p>';
535
+ $m .= '<p>' . __( 'Please use the back button in your browser to return to the previous page and try to fix the code error.', 'code-snippets' );
536
+ $m .= ' ' . __( 'If you prefer, you can close this page and discard the changes you just made. No changes will be made to this site.', 'code-snippets' ) . '</p>';
537
+
538
+ return $m;
539
+ }
540
+
541
+ /**
542
+ * Filter the code by removing close php tag from beginning and adding open php tag to beginning (if not)
543
+ *
544
+ * @param $code
545
+ * @param $snippet_type
546
+ *
547
+ * @return mixed|string
548
+ */
549
+ private function filterCode( $code, $snippet_type ) {
550
+ if ( $snippet_type != WINP_SNIPPET_TYPE_PHP ) {
551
+ /* Remove ?> from beginning of snippet */
552
+ $code = preg_replace( '|^[\s]*\?>|', '', $code );
553
+
554
+ /* Если количество закрывающих тегов не равно количеству открывающих, то добавим лишний */
555
+ $start_count = substr_count( $code, '<?' );
556
+ $end_count = substr_count( $code, '?>' );
557
+
558
+ if ( $start_count !== $end_count ) {
559
+ if ( $start_count > $end_count ) {
560
+ $code = $code . '?>';
561
+ } else {
562
+ $code = '<?php ' . $code;
563
+ }
564
  }
565
+ }
566
+
567
+ return $code;
568
+ }
569
+
570
+ /**
571
+ * On saving form
572
+ *
573
+ * @param $postId
574
+ */
575
+ public function onSavingForm( $postId ) {
576
+ global $post;
577
+
578
+ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
579
+ return;
580
+ }
581
+
582
+ $snippet_location = isset( $_POST[ WINP_Plugin::app()->getPrefix() . 'snippet_location' ] ) ? sanitize_text_field( $_POST[ WINP_Plugin::app()->getPrefix() . 'snippet_location' ] ) : WINP_SNIPPET_AUTO_HEADER;
583
+ WINP_Helper::updateMetaOption( $post->ID, 'snippet_location', $snippet_location );
584
+
585
+ $snippet_type = isset( $_POST[ WINP_Plugin::app()->getPrefix() . 'snippet_type' ] ) ? sanitize_text_field( $_POST[ WINP_Plugin::app()->getPrefix() . 'snippet_type' ] ) : WINP_SNIPPET_TYPE_PHP;
586
+ WINP_Helper::updateMetaOption( $post->ID, 'snippet_type', $snippet_type );
587
+
588
+ $snippet_code = isset( $_POST[ WINP_Plugin::app()->getPrefix() . 'snippet_code' ] ) ? $this->filterCode( $_POST[ WINP_Plugin::app()->getPrefix() . 'snippet_code' ], $snippet_type ) : '';
589
+ WINP_Helper::updateMetaOption( $post->ID, 'snippet_code', $snippet_code );
590
+
591
+ // Save Conditional execution logic for the snippet
592
+ $snippet_filters = isset( $_POST[ WINP_Plugin::app()->getPrefix() . 'snippet_filters' ] ) ? json_decode( stripslashes( $_POST[ WINP_Plugin::app()->getPrefix() . 'snippet_filters' ] ) ) : '';
593
+ WINP_Helper::updateMetaOption( $post->ID, 'snippet_filters', $snippet_filters );
594
+
595
+ $changed_filters = isset( $_POST[ WINP_Plugin::app()->getPrefix() . 'changed_filters' ] ) ? intval( $_POST[ WINP_Plugin::app()->getPrefix() . 'changed_filters' ] ) : 0;
596
+ WINP_Helper::updateMetaOption( $post->ID, 'changed_filters', $changed_filters );
597
+ }
598
+
599
+ /**
600
+ * After saving form
601
+ *
602
+ * @param $postId
603
+ */
604
+ public function afterSavingForm( $postId ) {
605
+ global $post;
606
+
607
+ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
608
+ return;
609
+ }
610
+
611
+ $is_default_activate = WINP_Plugin::app()->getPopulateOption( 'activate_by_default', true );
612
+
613
+ $snippet_type = WINP_Helper::get_snippet_type( $post->ID );
614
+ if ( $snippet_type != WINP_SNIPPET_TYPE_TEXT ) {
615
+ $snippet_content = isset( $_POST[ WINP_Plugin::app()->getPrefix() . 'snippet_code' ] ) ? WINP_Plugin::app()->getExecuteObject()->prepareCode( $_POST[ WINP_Plugin::app()->getPrefix() . 'snippet_code' ], $post->ID ) : '';
616
+ } else {
617
+ $snippet_content = $post->post_content;
618
+ }
619
+
620
+ $snippet_scope = isset( $_POST[ WINP_Plugin::app()->getPrefix() . 'snippet_scope' ] ) ? sanitize_text_field( $_POST[ WINP_Plugin::app()->getPrefix() . 'snippet_scope' ] ) : null;
621
+
622
+ WINP_Helper::updateMetaOption( $post->ID, 'snippet_activate', false );
623
+
624
+ $validate = true;
625
+
626
+ if ( $snippet_scope == 'evrywhere' || $snippet_scope == 'auto' ) {
627
+ if ( $snippet_type != WINP_SNIPPET_TYPE_TEXT ) {
628
+ $validate = $this->validateCode( $snippet_content, $snippet_type );
629
  } else {
630
+ $validate = ! empty( $snippet_content );
 
 
 
 
 
 
 
 
 
631
  }
632
  }
633
+
634
+ if ( $validate && $is_default_activate && WINP_Plugin::app()->currentUserCan() ) {
635
+ WINP_Helper::updateMetaOption( $post->ID, 'snippet_activate', true );
636
+ } else {
637
+ /* Display message if a parse error occurred */
638
+ wp_redirect( add_query_arg( array(
639
+ 'action' => 'edit',
640
+ 'post' => $post->ID,
641
+ 'wbcr_inp_save_snippet_result' => 'code-error'
642
+ ), admin_url( 'post.php' ) ) );
643
+
644
+ exit;
645
+ }
646
+ }
647
+
648
+ /**
649
+ * Codemirror is used in Wordpress 4.9.0, if the Wordpress version is smaller,
650
+ * Wordpress does not have codemirror support.
651
+ *
652
+ * @return bool
653
+ */
654
+ private function isCodemirrorSupport() {
655
+ return version_compare( get_bloginfo( 'version' ), '4.9.0', '<' );
656
+ }
657
+
658
+ }
admin/metaboxes/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
admin/metaboxes/info.php CHANGED
@@ -1,86 +1,79 @@
1
  <?php
2
-
3
- class WINP_InfoMetaBox extends Wbcr_FactoryMetaboxes403_Metabox {
4
-
5
- /**
6
- * A visible title of the metabox.
7
- *
8
- * Inherited from the class FactoryMetabox.
9
- * @link http://codex.wordpress.org/Function_Reference/add_meta_box
10
- *
11
- * @since 1.0.0
12
- * @var string
13
- */
14
- public $title;
15
-
16
- /**
17
- * The part of the page where the edit screen
18
- * section should be shown ('normal', 'advanced', or 'side').
19
- *
20
- * @since 1.0.0
21
- * @var string
22
- */
23
- public $context = 'side';
24
-
25
-
26
- /**
27
- * The priority within the context where the boxes should show ('high', 'core', 'default' or 'low').
28
- *
29
- * @link http://codex.wordpress.org/Function_Reference/add_meta_box
30
- * Inherited from the class FactoryMetabox.
31
- *
32
- * @since 1.0.0
33
- * @var string
34
- */
35
- public $priority = 'core';
36
-
37
- public $css_class = 'factory-bootstrap-404 factory-fontawesome-000';
38
-
39
- protected $errors = array();
40
- protected $source_channel;
41
- protected $facebook_group_id;
42
- protected $paginate_url;
43
-
44
- public function __construct($plugin)
45
- {
46
- parent::__construct($plugin);
47
-
48
- $this->title = __('Meet with Clearfy plugin!', 'insert-php');
49
- }
50
-
51
-
52
- /**
53
- * Configures a metabox.
54
- *
55
- * @since 1.0.0
56
- * @param Wbcr_Factory404_ScriptList $scripts A set of scripts to include.
57
- * @param Wbcr_Factory404_StyleList $styles A set of style to include.
58
- * @return void
59
- */
60
- public function configure($scripts, $styles)
61
- {
62
- }
63
-
64
- public function html()
65
- {
66
- ?>
67
- <div class="wbcr-inp-metabox-banner">
68
- <strong class="wbcr-inp-big-text"><?php _e('Do you use snippets to disable unused WordPress features?', 'insert-php'); ?></strong>
69
 
70
- <p><?php _e('We can offer you a simpler and more reliable solution - our popular plugin for WordPress optimization
71
- Clearfy.', 'insert-php'); ?></p>
72
-
73
- <p><?php _e('Just click toggles to turn on or off unused WordPress functions.', 'insert-php'); ?></p>
74
- <ul>
75
- <li class="wbcr-inp-big-text">- <?php _e('No snippets', 'insert-php'); ?></li>
76
- <li class="wbcr-inp-big-text">- <?php _e('Do not waste time', 'insert-php'); ?></li>
77
- <li class="wbcr-inp-big-text">- <?php _e('Do not worry about security', 'insert-php'); ?></li>
78
- <li class="wbcr-inp-big-text">- <?php _e('It\'s free', 'insert-php'); ?></li>
79
- </ul>
80
- <a href="https://clearfy.pro/?utm_source=wordpress.org&utm_campaign=wbcr_php_snippets" class="wbcr-inp-button" target="_blank">
81
- <?php _e('Download for free', 'insert-php'); ?>
82
- </a>
83
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  <?php
85
- }
86
- }
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
+ class WINP_InfoMetaBox extends Wbcr_FactoryMetaboxes404_Metabox {
4
+
5
+ /**
6
+ * A visible title of the metabox.
7
+ *
8
+ * Inherited from the class FactoryMetabox.
9
+ * @link http://codex.wordpress.org/Function_Reference/add_meta_box
10
+ *
11
+ * @since 1.0.0
12
+ * @var string
13
+ */
14
+ public $title;
15
+
16
+ /**
17
+ * The part of the page where the edit screen
18
+ * section should be shown ('normal', 'advanced', or 'side').
19
+ *
20
+ * @since 1.0.0
21
+ * @var string
22
+ */
23
+ public $context = 'side';
24
+
25
+
26
+ /**
27
+ * The priority within the context where the boxes should show ('high', 'core', 'default' or 'low').
28
+ *
29
+ * @link http://codex.wordpress.org/Function_Reference/add_meta_box
30
+ * Inherited from the class FactoryMetabox.
31
+ *
32
+ * @since 1.0.0
33
+ * @var string
34
+ */
35
+ public $priority = 'core';
36
+
37
+ public $css_class = 'factory-bootstrap-410 factory-fontawesome-000';
38
+
39
+ protected $errors = array();
40
+ protected $source_channel;
41
+ protected $facebook_group_id;
42
+ protected $paginate_url;
43
+
44
+ public function __construct( $plugin ) {
45
+ parent::__construct( $plugin );
46
+
47
+ $this->title = __( 'Robin image optimizer: notice', 'insert-php' );
48
+ }
49
+
50
+
51
+ /**
52
+ * Configures a metabox.
53
+ *
54
+ * @since 1.0.0
55
+ *
56
+ * @param Wbcr_Factory410_ScriptList $scripts A set of scripts to include.
57
+ * @param Wbcr_Factory410_StyleList $styles A set of style to include.
58
+ *
59
+ * @return void
60
+ */
61
+ public function configure( $scripts, $styles ) {
62
+ }
63
+
64
+ public function html() {
65
+ $install_plugin_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=robin-image-optimizer' ), 'install-plugin_robin-image-optimizer' );
66
+ ?>
67
+ <div class="wbcr-inp-metabox-banner">
68
+ <h3 class="wbcr-inp-title">YOU HAVE 83% UNOPTIMIZED<br><span>&lt;IMAGES&gt;</span></h3>
69
+ <div class="wbcr-inp-image">
70
+ <img src="<?= WINP_PLUGIN_URL ?>/admin/assets/img/rio-banner.png" alt="">
71
+ </div>
72
+ <strong class="wbcr-inp-big-text"><?php _e( 'Install plugin Robin Image Optimizer to speed up your site!', 'insert-php' ); ?></strong>
73
+ <a href="<?= $install_plugin_url ?>" class="wbcr-inp-button" target="_blank">
74
+ <span class="dashicons dashicons-dashboard"></span> <?php _e( 'Optimize now for free', 'insert-php' ); ?>
75
+ </a>
76
+ </div>
77
  <?php
78
+ }
79
+ }
admin/metaboxes/view-options.php ADDED
@@ -0,0 +1,443 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WINP_ViewOptionsMetaBox extends Wbcr_FactoryMetaboxes404_Metabox {
4
+
5
+ /**
6
+ * A visible title of the metabox.
7
+ *
8
+ * Inherited from the class FactoryMetabox.
9
+ * @link http://codex.wordpress.org/Function_Reference/add_meta_box
10
+ *
11
+ * @since 1.0.0
12
+ * @var string
13
+ */
14
+ public $title;
15
+
16
+ /**
17
+ * The priority within the context where the boxes should show ('high', 'core', 'default' or 'low').
18
+ *
19
+ * @link http://codex.wordpress.org/Function_Reference/add_meta_box
20
+ * Inherited from the class FactoryMetabox.
21
+ *
22
+ * @since 1.0.0
23
+ * @var string
24
+ */
25
+ public $priority = 'core';
26
+
27
+ public $css_class = 'factory-bootstrap-410 factory-fontawesome-000';
28
+
29
+ protected $errors = array();
30
+ protected $source_channel;
31
+ protected $facebook_group_id;
32
+ protected $paginate_url;
33
+
34
+ public function __construct($plugin)
35
+ {
36
+ parent::__construct($plugin);
37
+
38
+ $this->title = __('Conditional execution logic for the snippet', 'insert-php');
39
+ }
40
+
41
+ /**
42
+ * Configures a metabox.
43
+ *
44
+ * @since 1.0.0
45
+ * @param Wbcr_Factory410_ScriptList $scripts A set of scripts to include.
46
+ * @param Wbcr_Factory410_StyleList $styles A set of style to include.
47
+ * @return void
48
+ */
49
+ public function configure($scripts, $styles)
50
+ {
51
+ $styles->add(WINP_PLUGIN_URL . '/admin/assets/css/view-opt.css');
52
+
53
+ $scripts->add(WINP_PLUGIN_URL . '/admin/assets/js/view-opt.js');
54
+ }
55
+
56
+ /**
57
+ * Prints visibility conditions
58
+ */
59
+ function printVisibilityConditions()
60
+ {
61
+ // filter parameters
62
+ $groupedFilterParams = array(
63
+ array(
64
+ 'id' => 'user',
65
+ 'title' => __('User', 'insert-php'),
66
+ 'items' => array(
67
+ array(
68
+ 'id' => 'user-role',
69
+ 'title' => __('Role', 'insert-php'),
70
+ 'type' => 'select',
71
+ 'values' => array(
72
+ 'type' => 'ajax',
73
+ 'action' => 'wbcr_inp_ajax_get_user_roles'
74
+ ),
75
+ 'description' => __('A role of the user who views your website. The role "guest" is applied to unregistered users.', 'insert-php')
76
+ ),
77
+ array(
78
+ 'id' => 'user-registered',
79
+ 'title' => __('Registration Date', 'insert-php'),
80
+ 'type' => 'date',
81
+ 'description' => __('The date when the user who views your website was registered. For unregistered users this date always equals to 1 Jan 1970.', 'insert-php')
82
+ ),
83
+ array(
84
+ 'id' => 'user-mobile',
85
+ 'title' => __('Mobile Device', 'insert-php'),
86
+ 'type' => 'select',
87
+ 'values' => array(
88
+ array('value' => 'yes', 'title' => __('Yes', 'insert-php')),
89
+ array('value' => 'no', 'title' => __('No', 'insert-php'))
90
+ ),
91
+ 'description' => __('Determines whether the user views your website from mobile device or not.', 'insert-php')
92
+ ),
93
+ array(
94
+ 'id' => 'user-cookie-name',
95
+ 'title' => __('Cookie Name', 'insert-php'),
96
+ 'type' => 'text',
97
+ 'onlyEquals' => true,
98
+ 'description' => __('Determines whether the user\'s browser has a cookie with a given name.', 'insert-php')
99
+ )
100
+ )
101
+ ),
102
+ /*array(
103
+ 'id' => 'session',
104
+ 'title' => __('Session', 'insert-php'),
105
+ 'items' => array(
106
+ array(
107
+ 'id' => 'session-pageviews',
108
+ 'title' => __('Total Pageviews', 'insert-php'),
109
+ 'type' => 'integer',
110
+ 'description' => sprintf(__('The total count of pageviews made by the user within one\'s current session on your website. You can specify a duration of the sessions <a href="%s" target="_blank">here</a>.', 'insert-php'), admin_url('edit.php?post_type=' . WINP_SNIPPETS_POST_TYPE))
111
+ ),
112
+ array(
113
+ 'id' => 'session-locker-pageviews',
114
+ 'title' => __('Locker Pageviews', 'insert-php'),
115
+ 'type' => 'integer',
116
+ 'description' => sprintf(__('The count of views of pages where lockers located, made by the user within one\'s current session on your website. You can specify a duration of the sessions <a href="%s" target="_blank">here</a>.', 'insert-php'), admin_url('edit.php?post_type=' . WINP_SNIPPETS_POST_TYPE))
117
+ ),
118
+ array(
119
+ 'id' => 'session-landing-page',
120
+ 'title' => __('Landing Page', 'insert-php'),
121
+ 'type' => 'text',
122
+ 'description' => sprintf(__('A page of your website from which the user starts one\'s current session. You can specify a duration of the sessions <a href="%s" target="_blank">here</a>.', 'insert-php'), admin_url('edit.php?post_type=' . WINP_SNIPPETS_POST_TYPE))
123
+ ),
124
+ array(
125
+ 'id' => 'session-referrer',
126
+ 'title' => __('Referrer', 'insert-php'),
127
+ 'type' => 'text',
128
+ 'description' => sprintf(__('A referrer URL which has brought the user to your website within the user\'s current session. You can specify a duration of the sessions <a href="%s" target="_blank">here</a>.', 'insert-php'), admin_url('edit.php?post_type=' . WINP_SNIPPETS_POST_TYPE))
129
+ )
130
+ )
131
+ ),*/
132
+ array(
133
+ 'id' => 'location',
134
+ 'title' => __('Location', 'insert-php'),
135
+ 'items' => array(
136
+ array(
137
+ 'id' => 'location-page',
138
+ 'title' => __('Current Page', 'insert-php'),
139
+ 'type' => 'text',
140
+ 'description' => __('An URL of the current page where a user who views your website is located.', 'insert-php')
141
+ ),
142
+ array(
143
+ 'id' => 'location-referrer',
144
+ 'title' => __('Current Referrer', 'insert-php'),
145
+ 'type' => 'text',
146
+ 'description' => __('A referrer URL which has brought a user to the current page.', 'insert-php')
147
+ ),
148
+ array(
149
+ 'id' => 'location-post-type',
150
+ 'title' => __('Post type', 'insert-php'),
151
+ 'type' => 'select',
152
+ 'values' => array(
153
+ 'type' => 'ajax',
154
+ 'action' => 'wbcr_inp_ajax_get_post_types'
155
+ ),
156
+ 'description' => __('A post type of the current page.', 'insert-php')
157
+ ),
158
+ array(
159
+ 'id' => 'location-taxonomy',
160
+ 'title' => __('Taxonomy', 'insert-php'),
161
+ 'type' => 'select',
162
+ 'values' => array(
163
+ 'type' => 'ajax',
164
+ 'action' => 'wbcr_inp_ajax_get_taxonomies'
165
+ ),
166
+ 'description' => __('A taxonomy of the current page.', 'insert-php')
167
+ ),
168
+ array(
169
+ 'id' => 'location-some-page',
170
+ 'title' => __('Page', 'insert-php'),
171
+ 'type' => 'select',
172
+ 'values' => array(
173
+ 'type' => 'ajax',
174
+ 'action' => 'wbcr_inp_ajax_get_page_list'
175
+ ),
176
+ 'description' => __('List of specific pages.', 'insert-php')
177
+ )
178
+ )
179
+ ),
180
+ /*array(
181
+ 'id' => 'post',
182
+ 'title' => __('Post', 'insert-php'),
183
+ 'items' => array(
184
+ array(
185
+ 'id' => 'post-published',
186
+ 'title' => __('Publication Date', 'insert-php'),
187
+ 'type' => 'date',
188
+ 'description' => __('The publication date of a post where a user who views your website is located currently.', 'insert-php')
189
+ )
190
+ )
191
+ ),*/
192
+ );
193
+
194
+ $groupedFilterParams = apply_filters('wbcr/inp/visibility/filter_params', $groupedFilterParams);
195
+
196
+ $filterParams = array();
197
+ foreach($groupedFilterParams as $filterGroup) {
198
+ $filterParams = array_merge($filterParams, $filterGroup['items']);
199
+ }
200
+
201
+ // templates
202
+ $templates = array(
203
+ array(
204
+ 'id' => 'hide_for_members',
205
+ 'title' => __('[Hide For Members]: Show the locker only for guests', 'insert-php'),
206
+ 'filter' => array(
207
+ 'type' => 'showif',
208
+ 'conditions' => array(
209
+ array(
210
+ 'type' => 'condition',
211
+ 'param' => 'user-role',
212
+ 'operator' => 'equals',
213
+ 'value' => 'guest'
214
+ )
215
+ )
216
+ )
217
+ ),
218
+ array(
219
+ 'id' => 'mobile',
220
+ 'title' => __('[Hide On Mobile]: Hide the locker on mobile devices', 'insert-php'),
221
+ 'filter' => array(
222
+ 'type' => 'hideif',
223
+ 'conditions' => array(
224
+ array(
225
+ 'type' => 'condition',
226
+ 'param' => 'user-mobile',
227
+ 'operator' => 'equals',
228
+ 'value' => 'yes'
229
+ )
230
+ )
231
+ )
232
+ ),
233
+ array(
234
+ 'id' => 'delayed_lock',
235
+ 'title' => __('[Delayed Lock]: Show the locker only in posts older than 5 days', 'insert-php'),
236
+ 'filter' => array(
237
+ 'type' => 'showif',
238
+ 'conditions' => array(
239
+ array(
240
+ 'type' => 'condition',
241
+ 'param' => 'post-published',
242
+ 'operator' => 'older',
243
+ 'value' => array(
244
+ 'type' => 'relative',
245
+ 'unitsCount' => 5,
246
+ 'units' => 'days'
247
+ )
248
+ )
249
+ )
250
+ )
251
+ )
252
+ );
253
+
254
+ $templates = apply_filters('wbcr/inp/visibility/filter_templates', $templates);
255
+ ?>
256
+ <div class="factory-fontawesome-000 winp-advanded-options">
257
+ <div class="winp-empty" id="winp-advanced-visability-options">
258
+ <script>
259
+ window.winp = window.winp || {};
260
+ window.winp.filtersParams = <?php echo json_encode( $filterParams ) ?>;
261
+ window.winp.templates = <?php echo json_encode( $templates ) ?>;
262
+ </script>
263
+ <div class="winp-editor-wrap">
264
+ <div class="winp-when-empty">
265
+ <?php _e('No filters specified. <a href="#" class="winp-add-filter">Click here</a> to add one.', 'insert-php') ?>
266
+ </div>
267
+ <div class="winp-filters"></div>
268
+ </div>
269
+ <div class="winp-filter winp-template">
270
+ <div class="winp-point"></div>
271
+ <div class="winp-head">
272
+ <div class="winp-left">
273
+ <span style="margin-left: 0;">
274
+ <strong><?php _e('Show IF', 'insert-php') ?>:</strong>
275
+ </span>
276
+ <select class="winp-filter-type">
277
+ <option value="showif"><?php _e('Display On IF', 'insert-php'); ?></option>
278
+ <option value="hideif"><?php _e('Do Not Display IF', 'insert-php'); ?></option>
279
+ </select>
280
+ <span><?php _e('or', 'insert-php') ?></span>
281
+ <a href="#" class="button btn-remove-filter">x</a>
282
+ </div>
283
+ <?php /*
284
+ <div class="winp-templates winp-right">
285
+ <span><strong><?php _e('Template', 'insert-php') ?></strong></span>
286
+ <select class="winp-select-template">
287
+ <option><?php _e('- select a template -', 'insert-php') ?></option>
288
+ <?php foreach($templates as $template) { ?>
289
+ <option value="<?php echo $template['id'] ?>"><?php echo $template['title'] ?></option>
290
+ <?php } ?>
291
+ </select>
292
+ <a href="#" class="button winp-btn-apply-template"><?php _e('Apply', 'insert-php') ?></a>
293
+ </div>
294
+ */ ?>
295
+ </div>
296
+ <div class="winp-box">
297
+ <div class="winp-when-empty">
298
+ <?php _e('No conditions specified. <a href="#" class="winp-link-add">Click here</a> to add one.', 'insert-php') ?>
299
+ </div>
300
+ <div class="winp-conditions"></div>
301
+ </div>
302
+ </div>
303
+ <div class="winp-scope winp-template">
304
+ <div class="winp-and"><span><?php _e('and', 'insert-php') ?></span></div>
305
+ </div>
306
+ <div class="winp-condition winp-template">
307
+ <div class="winp-or"><?php _e('or', 'insert-php') ?></div>
308
+ <span class="winp-params">
309
+ <select class="winp-param-select">
310
+ <?php foreach($groupedFilterParams as $filterParam) { ?>
311
+ <optgroup label="<?php echo $filterParam['title'] ?>">
312
+ <?php foreach($filterParam['items'] as $param) { ?>
313
+ <option value="<?php echo $param['id'] ?>">
314
+ <?php echo $param['title'] ?>
315
+ </option>
316
+ <?php } ?>
317
+ </optgroup>
318
+ <?php } ?>
319
+ </select>
320
+ <i class="winp-hint">
321
+ <span class="winp-hint-icon"></span>
322
+ <span class="winp-hint-content"></span>
323
+ </i>
324
+ </span>
325
+
326
+ <span class="winp-operators">
327
+ <select class="winp-operator-select">
328
+ <option value="equals"><?php _e('Equals', 'insert-php') ?></option>
329
+ <option value="notequal"><?php _e('Doesn\'t Equal', 'insert-php') ?></option>
330
+ <option value="greater"><?php _e('Greater Than', 'insert-php') ?></option>
331
+ <option value="less"><?php _e('Less Than', 'insert-php') ?></option>
332
+ <option value="older"><?php _e('Older Than', 'insert-php') ?></option>
333
+ <option value="younger"><?php _e('Younger Than', 'insert-php') ?></option>
334
+ <option value="contains"><?php _e('Contains', 'insert-php') ?></option>
335
+ <option value="notcontain"><?php _e('Doesn\'t Сontain', 'insert-php') ?></option>
336
+ <option value="between"><?php _e('Between', 'insert-php') ?></option>
337
+ </select>
338
+ </span>
339
+ <span class="winp-value"></span>
340
+
341
+ <span class="winp-controls">
342
+ <div class="button-group">
343
+ <a href="#" class="button button-sm button-default winp-btn-remove">-</a>
344
+ <a href="#" class="button button-sm button-default winp-btn-or"><?php _e('OR', 'insert-php') ?></a>
345
+ <a href="#" class="button button-sm button-default winp-btn-and"><?php _e('AND', 'insert-php') ?></a>
346
+ </div>
347
+ </span>
348
+ </div>
349
+ <div class="winp-date-control winp-relative winp-template">
350
+ <div class="winp-inputs">
351
+ <div class="winp-between-date">
352
+ <div class="winp-absolute-date">
353
+ <span class="winp-label"> <?php _e('from', 'insert-php') ?> </span>
354
+
355
+ <div class="winp-date-control winp-date-start" data-date="today">
356
+ <input size="16" type="text" readonly="readonly" class="winp-date-value-start" data-date="today"/>
357
+ <i class="fa fa-calendar"></i>
358
+ </div>
359
+ <span class="winp-label"> <?php _e('to', 'insert-php') ?> </span>
360
+
361
+ <div class="winp-date-control winp-date-end" data-date="today">
362
+ <input size="16" type="text" readonly="readonly" class="winp-date-value-end" data-date="today"/>
363
+ <i class="fa fa-calendar"></i>
364
+ </div>
365
+ </div>
366
+ <div class="winp-relative-date">
367
+ <span class="winp-label"> <?php _e('older than', 'insert-php') ?> </span>
368
+ <input type="text" class="winp-date-value winp-date-value-start" value="1"/>
369
+ <select class="winp-date-start-units">
370
+ <option value="seconds"><?php _e('Second(s)', 'insert-php') ?></option>
371
+ <option value="minutes"><?php _e('Minutes(s)', 'insert-php') ?></option>
372
+ <option value="hours"><?php _e('Hours(s)', 'insert-php') ?></option>
373
+ <option value="days"><?php _e('Day(s)', 'insert-php') ?></option>
374
+ <option value="weeks"><?php _e('Week(s)', 'insert-php') ?></option>
375
+ <option value="months"><?php _e('Month(s)', 'insert-php') ?></option>
376
+ <option value="years"><?php _e('Year(s)', 'insert-php') ?></option>
377
+ </select>
378
+ <span class="winp-label"> <?php _e(', younger than', 'insert-php') ?> </span>
379
+ <input type="text" class="winp-date-value winp-date-value-end" value="2"/>
380
+ <select class="winp-date-end-units">
381
+ <option value="seconds"><?php _e('Second(s)', 'insert-php') ?></option>
382
+ <option value="minutes"><?php _e('Minutes(s)', 'insert-php') ?></option>
383
+ <option value="hours"><?php _e('Hours(s)', 'insert-php') ?></option>
384
+ <option value="days"><?php _e('Day(s)', 'insert-php') ?></option>
385
+ <option value="weeks"><?php _e('Week(s)', 'insert-php') ?></option>
386
+ <option value="months"><?php _e('Month(s)', 'insert-php') ?></option>
387
+ <option value="years"><?php _e('Year(s)', 'insert-php') ?></option>
388
+ </select>
389
+ </div>
390
+ </div>
391
+ <div class="winp-solo-date">
392
+ <div class="winp-absolute-date">
393
+ <div class="winp-date-control" data-date="today">
394
+ <input size="16" type="text" class="winp-date-value" readonly="readonly" data-date="today"/>
395
+ <i class="fa fa-calendar"></i>
396
+ </div>
397
+ </div>
398
+ <div class="winp-relative-date">
399
+ <input type="text" class="winp-date-value" value="1"/>
400
+ <select class="winp-date-value-units">
401
+ <option value="seconds"><?php _e('Second(s)', 'insert-php') ?></option>
402
+ <option value="minutes"><?php _e('Minutes(s)', 'insert-php') ?></option>
403
+ <option value="hours"><?php _e('Hours(s)', 'insert-php') ?></option>
404
+ <option value="days"><?php _e('Day(s)', 'insert-php') ?></option>
405
+ <option value="weeks"><?php _e('Week(s)', 'insert-php') ?></option>
406
+ <option value="months"><?php _e('Month(s)', 'insert-php') ?></option>
407
+ <option value="years"><?php _e('Year(s)', 'insert-php') ?></option>
408
+ </select>
409
+ </div>
410
+ </div>
411
+ </div>
412
+ <div class="winp-switcher">
413
+ <label><input type="radio" checked="checked" value="relative"/>
414
+ <span><?php _e('relative', 'insert-php') ?></span></label>
415
+ <label><input type="radio" value="absolute"/>
416
+ <span><?php _e('absolute', 'insert-php') ?></span>
417
+ </label>
418
+ </div>
419
+ </div>
420
+ <!--div class="wrap">
421
+ <button type="button" class="button button-default winp-add-filter winp-btn-left">
422
+ <?php //_e('Add new condition', 'insert-php') ?>
423
+ </button>
424
+ </div-->
425
+ <?php $changed_filters = get_post_meta( get_the_ID(), WINP_Plugin::app()->getPrefix() . 'changed_filters', true ); ?>
426
+ <input id="winp_changed_filters" name="wbcr_inp_changed_filters" value="<?php echo empty( $changed_filters ) ? 0 : 1 ?>" type="hidden" />
427
+ <input id="winp_visibility_filters" name="wbcr_inp_snippet_filters"
428
+ value='<?php echo json_encode( get_post_meta( get_the_ID(), WINP_Plugin::app()->getPrefix() . 'snippet_filters' ) ) ?>'
429
+ type="hidden" />
430
+ </div>
431
+ </div>
432
+ <?php
433
+ }
434
+
435
+ /**
436
+ * html
437
+ */
438
+ public function html()
439
+ {
440
+ $this->printVisibilityConditions();
441
+ }
442
+
443
+ }
admin/pages/about.php ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The file contains a short help info.
4
+ *
5
+ * @author Alex Kovalev <alex.kovalevv@gmail.com>
6
+ * @copyright (c) 2018, OnePress Ltd
7
+ *
8
+ * @package core
9
+ * @since 1.0.0
10
+ */
11
+
12
+ // Exit if accessed directly
13
+ if ( ! defined( 'ABSPATH' ) ) {
14
+ exit;
15
+ }
16
+
17
+ /**
18
+ * Common Settings
19
+ */
20
+ class WINP_AboutPage extends Wbcr_FactoryPages411_AdminPage {
21
+
22
+ /**
23
+ * @param Wbcr_Factory410_Plugin $plugin
24
+ */
25
+ public function __construct( Wbcr_Factory410_Plugin $plugin ) {
26
+ $this->menu_post_type = WINP_SNIPPETS_POST_TYPE;
27
+
28
+ $this->id = "about";
29
+ $this->menu_title = __( 'About', 'insert-php' );
30
+
31
+ parent::__construct( $plugin );
32
+
33
+ $this->plugin = $plugin;
34
+ }
35
+
36
+ public function indexAction() {
37
+ ?>
38
+ <div class="wrap about-wrap" id="wbcr-inp-about">
39
+ <!-- News Title !-->
40
+ <h1>Welcome to Woody ad snippets <?php echo $this->plugin->getPluginVersion() ?></h1>
41
+ <!-- News Subtext !-->
42
+ <div class="about-text">
43
+ Thanks for upgrading! Many new features and improvements are available that you will enjoy.
44
+ </div>
45
+ <!-- Settings Tabs -->
46
+ <h2 class="nav-tab-wrapper" id="wbcr-inp-tab-nav">
47
+ <a href="<?= $this->getActionUrl( 'index' ); ?>" class="nav-tab"><?php _e( 'What&#8217;s New', 'insert-php' ); ?></a>
48
+ <a href="http://woody-ad-snippets.webcraftic.com/getting-started-with-woody-ad-snippets/" target="_blank" class="nav-tab"><?php _e( 'Documentation', 'insert-php' ); ?></a>
49
+ </h2>
50
+ <!-- Latest News !-->
51
+ <div id="wbcr-inp-news-tab">
52
+ <div class="headline">
53
+ <h3 class="headline-title">PHP snippets (Insert php) Evolution to Woody ad snippets</h3>
54
+ <div class="featured-image">
55
+ <img src="http://woody-ad-snippets.webcraftic.com/images/about/change-plugin-name.jpg" alt="">
56
+ </div>
57
+ <p class="introduction">If you are a long-term user of the <code>Insert php 1.3.0</code> plugin, you may
58
+ be confused
59
+ about the new plugin’s name and branding. We will try to clear this out for you.</p>
60
+ <p>The way how WordPress editor handled PHP code from <code>Insert php</code> before was incorrect and
61
+ unsafe. We
62
+ wanted to find a solution that will be suitable for both old and new <code>Insert php</code> users.
63
+ And we wanted
64
+ to give them a useful tool to work with snippets (pieces of code) and plain text. </p>
65
+ <p>Storing PHP in individual snippets was a more elegant solution because only administrators were able
66
+ to modify the snippets. The plugin evolution to a snippet format has solved several important
67
+ problems:</p>
68
+ <ul>
69
+ <li>- Security improvements. Snippets can be modified by administrators only. Your PHP code is not
70
+ available to other users.
71
+ </li>
72
+ <li>- No code duplication. You can use 1 snippet on 100 pages instead of copying the code to each
73
+ one of them
74
+ </li>
75
+ <li>- Edit snippet in one place. All changes will be applied to the snippet on all pages.</li>
76
+ <li>- You can place snippets automatically.</li>
77
+ <li>- The code editor highlights syntax of the snippet and checks PHP code for errors. Your website
78
+ is safe now.
79
+ </li>
80
+ </ul>
81
+ <p>We considered all of the above when decided to update the <code>Insert php</code> plugin. Now our
82
+ plugin supports
83
+ not only a PHP code but HTML. JS, CSS code and text as well. Obviously, the name <code>Php snippets
84
+ (Insert php)</code> no longer suited the plugin. </p>
85
+ <p>So we’ve created a new name – Woody ad snippets. We are hoping that the new name didn’t cause you any
86
+ pain. We won’t change the plugin name anymore, as we’ve scheduled a solid roadmap of the plugin
87
+ development and plan to stick to it!</p>
88
+ </div>
89
+ <div class="feature-section one-col">
90
+ <div class="col">
91
+ <h2>Gutenberg Editor Support</h2>
92
+ </div>
93
+ </div>
94
+ <div style="text-align:center;">
95
+ <picture>
96
+ <img src="http://woody-ad-snippets.webcraftic.com/images/about/gutenberg.gif" alt="" style="max-width:800px;box-shadow: 0 0 15px rgba(0,0,0,0.3);">
97
+ </picture>
98
+ </div>
99
+ <div class="feature-section one-col">
100
+ <div class="col">
101
+ <p>Hello Gutenberg! Creating the content becomes more simple and easy. You can forget about
102
+ shortcodes to locate snippet and switch to the user-friendly blocks instead. Just create a
103
+ snippet with the location scope through the shortcode, go to Gutenberg Editor and add a new
104
+ Woody ad snippet block. Super easy!</p>
105
+ </div>
106
+ </div>
107
+ <hr/>
108
+ <div class="feature-section one-col">
109
+ <div class="col">
110
+ <h2>New Snippet types</h2>
111
+ </div>
112
+ </div>
113
+ <div class="under-the-hood feature-section three-col">
114
+ <div class="col" style="text-align: center">
115
+ <picture>
116
+ <img src="http://woody-ad-snippets.webcraftic.com/images/about/php-snippet.jpg" alt="" style="width:80%;box-shadow: 0 0 10px rgba(0,0,0,0.3);">
117
+ </picture>
118
+ <h3>PHP Snippets</h3>
119
+ <p>This is a simple snippet type. It executes PHP code. Use this type to register functions,
120
+ classes, and global variables. You can create false scenarios and use shortcodes to print them
121
+ on pages.</p>
122
+ </div>
123
+ <div class="col" style="text-align: center">
124
+ <picture>
125
+ <img src="http://woody-ad-snippets.webcraftic.com/images/about/text-snippet.jpg" alt="" style="width:80%;box-shadow: 0 0 10px rgba(0,0,0,0.3);">
126
+ </picture>
127
+ <h3>Text Snippets</h3>
128
+ <p>This is the easiest snippet type. Here you can use text and HTML code only. It works as a classic
129
+ editor TinyMCE. Use this type to create text blocks, media content, links, quotes, and inserts.
130
+ You can locate this snippet type automatically or via shortcodes.</p>
131
+ </div>
132
+ <div class="col" style="text-align: center">
133
+ <picture>
134
+ <img src="http://woody-ad-snippets.webcraftic.com/images/about/universal-snippet.jpg" alt="" style="width:80%;box-shadow: 0 0 10px rgba(0,0,0,0.3);">
135
+ </picture>
136
+ <h3>Universal Snippets</h3>
137
+ <p>This is a complex snippet type where you can combine PHP, HTML, JavaScript, and CSS. We’ve
138
+ created this type to insert ad codes, external widgets, complex HTML forms, Google analytics,
139
+ Facebook pixels and so on. You can locate these snippets automatically or by shortcodes.</p>
140
+ </div>
141
+ </div>
142
+ <hr/>
143
+ <div class="feature-section one-col">
144
+ <div class="col">
145
+ <h2>Snippet Auto placement</h2>
146
+ </div>
147
+ </div>
148
+ <div class="feature-section one-col">
149
+ <div class="col">
150
+ <p>This is a new feature. It will save you many hours of hard work. Now you can locate a snippet on
151
+ all or certain pages in a few clicks.
152
+ </p>
153
+ <p>We’ve added a new way of snippet placement. Just set up the location spot and placement
154
+ condition. The plugin will automatically install the snippet on the necessary pages. You can
155
+ also remove snippet in a few clicks.</p>
156
+ </div>
157
+ </div>
158
+ <hr/>
159
+ <div class="feature-section one-col">
160
+ <div class="col">
161
+ <h2>Snippet Conditional Logic</h2>
162
+ </div>
163
+ </div>
164
+ <div style="text-align:center;">
165
+ <picture>
166
+ <img src="http://woody-ad-snippets.webcraftic.com/images/about/conditions.gif" alt="" style="max-width:800px;box-shadow: 0 0 15px rgba(0,0,0,0.3);">
167
+ </picture>
168
+ </div>
169
+ <div class="feature-section one-col">
170
+ <div class="col">
171
+ <p>With the new auto location options the conditional logic features have been released. They allow
172
+ you to hide or show snippets depend on conditions. For example, you can show a snippet to
173
+ registered users only. Or, show it just to mobile users. Conditional logic helps you to filter
174
+ pages where the snippet shouldn’t be used.</p>
175
+ </div>
176
+ </div>
177
+ <hr/>
178
+ <div class="feature-section one-col">
179
+ <div class="col">
180
+ <h2>Snippet Export/Import</h2>
181
+ </div>
182
+ </div>
183
+ <div class="full-width">
184
+ <picture>
185
+ <img src="http://woody-ad-snippets.webcraftic.com/images/about/import-export2.png" alt="" style="box-shadow: 0 0 10px rgba(0,0,0,0.3);">
186
+ </picture>
187
+ </div>
188
+ <div class="feature-section one-col">
189
+ <div class="col">
190
+ <p>Snippet Export/Import is more user-friendly now. You don’t need to install additional plugins
191
+ anymore. Just export all the necessary plugins or import them on another website. Additional
192
+ import features prevent snippet duplication in case your website has already had this
193
+ snippet.</p>
194
+ </div>
195
+ </div>
196
+ </div>
197
+ <?php
198
+ }
199
+ }
admin/pages/export.php DELETED
@@ -1,76 +0,0 @@
1
- <?php
2
- /**
3
- * This class is implemented page: import, export in the admin panel.
4
- *
5
- * @author Alex Kovalev <alex.kovalevv@gmail.com>
6
- * @copyright (c) 2018, OnePress Ltd
7
- *s
8
- * @package core
9
- * @since 1.0.0
10
- */
11
-
12
- // Exit if accessed directly
13
- if( !defined('ABSPATH') ) {
14
- exit;
15
- }
16
-
17
- /**
18
- * Common Settings
19
- */
20
- class WINP_ExportPage extends Wbcr_FactoryPages405_AdminPage {
21
-
22
- /**
23
- * @param Wbcr_Factory404_Plugin $plugin
24
- */
25
- public function __construct(Wbcr_Factory404_Plugin $plugin)
26
- {
27
- $this->menu_post_type = WINP_SNIPPETS_POST_TYPE;
28
-
29
- $this->id = "export";
30
- $this->menu_title = __('Import/Export', 'insert-php');
31
-
32
- parent::__construct($plugin);
33
-
34
- $this->plugin = $plugin;
35
- }
36
-
37
- /**
38
- * Prints the contents of the page.
39
- */
40
- public function indexAction()
41
- {
42
- ?>
43
- <div class="wrap ">
44
- <div class="factory-bootstrap-404 factory-fontawesome-000">
45
- <h3><?php _e('Import/Export', 'insert-php') ?></h3>
46
-
47
- <p><?php _e('To export or migrate your snippets, you can use native WordPress functional or any other import/export plugin for custom post types.', 'insert-php'); ?></p>
48
-
49
- <p><?php _e('Let\'s have a look how you can export your snippets:', 'insert-php'); ?></p>
50
-
51
- <h3><?php _e('Export with WordPress', 'insert-php'); ?></h3>
52
- <ul>
53
- <li>1. <?php _e('Go to Tools -> Export', 'insert-php'); ?></li>
54
- <li>2. <?php _e('Select "PHP snippets" custom post', 'insert-php'); ?></li>
55
- <li>3. <?php _e('Press "Download Export File" button', 'insert-php'); ?></li>
56
- </ul>
57
- <img src="<?= WINP_PLUGIN_URL ?>/admin/assets/img/79018c6892.png" width="800" alt=""/>
58
-
59
- <h3><?php _e('Import using other plugin', 'insert-php'); ?></h3>
60
- <ul>
61
- <li>1. <?php _e('Go to Tools -> Import', 'insert-php'); ?></li>
62
- <li>2. <?php _e('Install WordPress import plugin', 'insert-php'); ?></li>
63
- <li>3. <?php _e('Run Importer after installation', 'insert-php'); ?></li>
64
- </ul>
65
- <img src="<?= WINP_PLUGIN_URL ?>/admin/assets/img/b2347551e4.png" width="800" alt=""/>
66
- <ul>
67
- <li>1. <?php _e('Make sure you are on the import page', 'insert-php'); ?></li>
68
- <li>2. <?php _e('Select the export file that you downloaded at the export stage', 'insert-php'); ?></li>
69
- <li>3. <?php _e('Press "Upload file and import" button', 'insert-php'); ?></li>
70
- </ul>
71
- <img src="<?= WINP_PLUGIN_URL ?>/admin/assets/img/43d2351a21.png" width="800" alt=""/>
72
- </div>
73
- </div>
74
- <?php
75
- }
76
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/pages/import.php ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This class is implemented page: import in the admin panel.
4
+ *
5
+ * @author Alex Kovalev <alex.kovalevv@gmail.com>
6
+ * @copyright (c) 2018, OnePress Ltd
7
+ *s
8
+ * @package core
9
+ * @since 1.0.0
10
+ */
11
+
12
+ // Exit if accessed directly
13
+ if ( ! defined( 'ABSPATH' ) ) {
14
+ exit;
15
+ }
16
+
17
+ /**
18
+ * Common Settings
19
+ */
20
+ class WINP_ImportPage extends Wbcr_FactoryPages411_AdminPage {
21
+
22
+ /**
23
+ * @param Wbcr_Factory410_Plugin $plugin
24
+ */
25
+ public function __construct( Wbcr_Factory410_Plugin $plugin ) {
26
+ $this->menu_post_type = WINP_SNIPPETS_POST_TYPE;
27
+
28
+ $this->id = "import";
29
+ $this->menu_title = __( 'Import', 'insert-php' );
30
+
31
+ parent::__construct( $plugin );
32
+
33
+ $this->plugin = $plugin;
34
+ }
35
+
36
+ public function assets( $scripts, $styles ) {
37
+ $this->scripts->request( 'jquery' );
38
+
39
+ $this->scripts->request( array(
40
+ 'control.checkbox',
41
+ 'control.dropdown'
42
+ ), 'bootstrap' );
43
+
44
+ $this->styles->request( array(
45
+ 'bootstrap.core',
46
+ 'bootstrap.form-group',
47
+ 'bootstrap.separator',
48
+ 'control.dropdown',
49
+ 'control.checkbox',
50
+ ), 'bootstrap' );
51
+ }
52
+
53
+ private function getMessage() {
54
+ if ( isset( $_REQUEST['wbcr_inp_error'] ) && $_REQUEST['wbcr_inp_error'] ) { ?>
55
+ <div id="message" class="alert alert-danger">
56
+ <p><?php _e( 'An error occurred when processing the import files.', 'insert-php' ) ?></p>
57
+ </div>
58
+ <?php } else if ( isset( $_REQUEST['wbcr_inp_imported'] ) && intval( $_REQUEST['wbcr_inp_imported'] ) >= 0 ) {
59
+ $imported = intval( $_REQUEST['wbcr_inp_imported'] );
60
+ if ( 0 === $imported ) {
61
+ $message = __( 'No snippets were imported.', 'insert-php' );
62
+ } else {
63
+ $message = sprintf( _n( 'Successfully imported <strong>%1$d</strong> snippet.', 'Successfully imported <strong>%1$d</strong> snippets.', $imported, 'insert-php' ), $imported );
64
+ } ?>
65
+ <div id="message" class="alert alert-success">
66
+ <p><?php echo $message ?></p>
67
+ </div>
68
+ <?php
69
+ } else if ( isset( $_POST[ $this->plugin->getPrefix() . 'saved' ] ) ) { ?>
70
+ <div id="message" class="alert alert-warning">
71
+ <p><?php _e( 'No files selected!', 'insert-php' ) ?></p>
72
+ </div>
73
+ <?php }
74
+ }
75
+
76
+ public function indexAction() {
77
+ if ( isset( $_POST[ $this->plugin->getPrefix() . 'saved' ] ) ) {
78
+ if ( ! wp_verify_nonce( $_POST[ $this->plugin->getPrefix() . 'nonce' ], $this->plugin->getPrefix() . 'import_form' ) ) {
79
+ wp_die( 'Permission error. You can not edit this page.' );
80
+ }
81
+ }
82
+
83
+ $max_size_bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() );
84
+
85
+ ?>
86
+ <div class="wrap ">
87
+ <div class="factory-bootstrap-410 factory-fontawesome-000">
88
+ <form method="post" class="form-horizontal" enctype="multipart/form-data">
89
+ <?php $this->getMessage() ?>
90
+ <h3><?php _e( 'Import Snippets', 'insert-php' ) ?></h3>
91
+ <p style="padding-bottom: 15px"><?php _e( 'Upload one or more Php Snippets export files and the snippets will be imported.', 'insert-php' ); ?></p>
92
+ <h4><?php _e( 'Duplicate Snippets', 'insert-php' ); ?></h4>
93
+ <p class="description">
94
+ <?php esc_html_e( 'What should happen if an existing snippet is found with an identical name to an imported snippet?', 'insert-php' ); ?>
95
+ </p>
96
+ <div style="padding-top: 10px;" class="winp-import-radio-container">
97
+ <fieldset>
98
+ <p>
99
+ <label style="font-weight: normal;">
100
+ <input type="radio" name="duplicate_action" value="ignore" checked="checked">
101
+ <?php _e( 'Ignore any duplicate snippets: import all snippets from the file regardless and leave all existing snippets unchanged.', 'insert-php' ); ?>
102
+ </label>
103
+ </p>
104
+ <p>
105
+ <label style="font-weight: normal;">
106
+ <input type="radio" name="duplicate_action" value="replace">
107
+ <?php _e( 'Replace any existing snippets with a newly imported snippet of the same name.', 'insert-php' ); ?>
108
+ </label>
109
+ </p>
110
+ <p>
111
+ <label style="font-weight: normal;">
112
+ <input type="radio" name="duplicate_action" value="skip">
113
+ <?php _e( 'Do not import any duplicate snippets; leave all existing snippets unchanged.', 'insert-php' ); ?>
114
+ </label>
115
+ </p>
116
+ </fieldset>
117
+ </div>
118
+ <h3><?php _e( 'Upload Files', 'insert-php' ); ?></h3>
119
+ <p class="description">
120
+ <?php _e( 'Choose one or more Php Snippets (.json) files to upload, then click "Upload files and import".', 'insert-php' ); ?>
121
+ </p>
122
+ <fieldset>
123
+ <p>
124
+ <label for="upload" style="font-weight: normal;">
125
+ <?php _e( 'Choose files from your computer:', 'insert-php' ); ?>
126
+ </label>
127
+ <?php printf( /* translators: %s: size in bytes */
128
+ esc_html__( '(Maximum size: %s)', 'insert-php' ), size_format( $max_size_bytes ) ); ?>
129
+ <input type="file" id="upload" name="wbcr_inp_import_files[]" size="25" accept="application/json,.json,text/xml" multiple="multiple">
130
+ <input type="hidden" name="action" value="save">
131
+ <input type="hidden" name="max_file_size" value="<?php echo esc_attr( $max_size_bytes ); ?>">
132
+ </p>
133
+ </fieldset>
134
+ <div class="form-group form-horizontal">
135
+ <div class="control-group controls col-sm-12">
136
+ <?php wp_nonce_field( $this->plugin->getPrefix() . 'import_form', $this->plugin->getPrefix() . 'nonce' ); ?>
137
+ <input name="<?= $this->plugin->getPrefix() . 'saved' ?>" class="btn btn-primary" type="submit" value="<?php _e( 'Upload files and import', 'insert-php' ) ?>"/>
138
+ </div>
139
+ </div>
140
+ </form>
141
+ </div>
142
+ </div>
143
+ <?php
144
+ }
145
+ }
admin/pages/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
admin/pages/new-item.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This class is implemented page: import, export in the admin panel.
4
+ *
5
+ * @author Alex Kovalev <alex.kovalevv@gmail.com>
6
+ * @copyright (c) 2018, OnePress Ltd
7
+ *s
8
+ * @package core
9
+ * @since 1.0.0
10
+ */
11
+
12
+ // Exit if accessed directly
13
+ if ( ! defined( 'ABSPATH' ) ) {
14
+ exit;
15
+ }
16
+
17
+ /**
18
+ * Common Settings
19
+ */
20
+ class WINP_NewItemPage extends Wbcr_FactoryPages411_AdminPage {
21
+
22
+ /**
23
+ * @param Wbcr_Factory410_Plugin $plugin
24
+ */
25
+ public function __construct( Wbcr_Factory410_Plugin $plugin ) {
26
+ $this->menu_post_type = WINP_SNIPPETS_POST_TYPE;
27
+
28
+ $this->menu_position = 1;
29
+ $this->id = "new-item";
30
+ $this->menu_title = __( '+ Add snippet', 'insert-php' );
31
+
32
+ parent::__construct( $plugin );
33
+
34
+ $this->plugin = $plugin;
35
+ }
36
+
37
+ public function assets( $scripts, $styles ) {
38
+ $this->scripts->request( 'jquery' );
39
+
40
+ $this->styles->request( array(
41
+ 'bootstrap.core'
42
+ ), 'bootstrap' );
43
+
44
+ //$this->scripts->add( WINP_PLUGIN_URL . '/admin/assets/js/new-item.js' );
45
+ $this->styles->add( WINP_PLUGIN_URL . '/admin/assets/css/new-item.css' );
46
+ }
47
+
48
+ /**
49
+ * Prints the contents of the page.
50
+ */
51
+ public function indexAction() {
52
+ $types = array(
53
+ WINP_SNIPPET_TYPE_PHP => array(
54
+ 'title' => __( 'PHP snippet', 'insert-php' ),
55
+ 'help' => 'http://woody-ad-snippets.webcraftic.com/getting-started-with-woody-ad-snippets/#Creating_a_PHP_snippet',
56
+ 'description' => '<p>' . __( 'Used for inserting php code. Can be used for registering functions, hooks, global variables, printing text. Virtual functions.php', 'insert-php' ) . '</p>'
57
+ ),
58
+ WINP_SNIPPET_TYPE_TEXT => array(
59
+ 'title' => __( 'Text snippet', 'insert-php' ),
60
+ 'help' => 'http://woody-ad-snippets.webcraftic.com/getting-started-with-woody-ad-snippets/#Creating_a_Text_Snippet',
61
+ 'description' => '<p>' . __( 'Used for inserting formatted text. Can be used for inserting quotes, paragraphs, shortcodes from other plugins, tables, media files.', 'insert-php' ) . '</p>'
62
+ ),
63
+ WINP_SNIPPET_TYPE_UNIVERSAL => array(
64
+ 'title' => __( 'Universal snippet', 'insert-php' ),
65
+ 'help' => 'http://woody-ad-snippets.webcraftic.com/getting-started-with-woody-ad-snippets/#Creating_a_Universal_Snippet',
66
+ 'description' => '<p>' . __( 'Used for inserting php, html, js & css code. Can be used for inserting ads, analytics, embeds & other complex scenarios.', 'insert-php' ) . '</p>'
67
+ ),
68
+ ); ?>
69
+ <div class="wrap factory-fontawesome-000">
70
+ <div class="wbcr-inp-items">
71
+ <h2><?php _e( 'Creating New Snippet', 'insert-php' ) ?></h2>
72
+ <p style="margin-top: 0;"><?php _e( 'Choose which snippet you would like to create.', 'insert-php' ) ?></p>
73
+ <?php foreach ( $types as $name => $type ) { ?>
74
+ <div class="postbox wbcr-inp-item">
75
+ <h4 class="wbcr-inp-title">
76
+ <?php echo $type['title'] ?>
77
+ </h4>
78
+ <div class="wbcr-inp-description">
79
+ <?php echo $type['description'] ?>
80
+ </div>
81
+ <div class="wbcr-inp-buttons">
82
+ <a href="<?php echo admin_url( 'post-new.php?post_type=' . WINP_SNIPPETS_POST_TYPE . '&winp_item=' . $name ); ?>"
83
+ class="button button-large wbcr-inp-create">
84
+ <span class="dashicons dashicons-plus"></span><span><?php _e( 'Create Item', 'insert-php' ) ?></span>
85
+ </a>
86
+ <?php if ( isset( $type['help'] ) ) { ?>
87
+ <a href="<?php echo $type['help'] ?>" class="button button-large wbcr-inp-hint-button" target="_blank" rel="noopener" title="<?php _e( 'Click here to learn more', 'insert-php' ) ?>">
88
+ <span class="dashicons dashicons-editor-help"></span>
89
+ </a>
90
+ <?php } ?>
91
+ </div>
92
+ </div>
93
+ <?php } ?>
94
+ </div>
95
+ </div>
96
+ <?php
97
+ }
98
+ }
admin/pages/settings.php CHANGED
@@ -1,246 +1,248 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /**
3
- * The file contains a short help info.
4
- *
5
- * @author Alex Kovalev <alex.kovalevv@gmail.com>
6
- * @copyright (c) 2018, OnePress Ltd
7
- *s
8
- * @package core
9
- * @since 1.0.0
10
  */
11
-
12
- // Exit if accessed directly
13
- if( !defined('ABSPATH') ) {
14
- exit;
 
 
 
 
 
 
 
 
 
15
  }
16
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  /**
18
- * Common Settings
 
 
 
19
  */
20
- class WINP_SettingsPage extends Wbcr_FactoryPages405_AdminPage {
21
-
22
- /**
23
- * @param Wbcr_Factory404_Plugin $plugin
24
- */
25
- public function __construct(Wbcr_Factory404_Plugin $plugin)
26
- {
27
- $this->menu_post_type = WINP_SNIPPETS_POST_TYPE;
28
-
29
- /*if( !current_user_can('administrator') ) {
30
- $this->capabilitiy = "read_wbcr-scrapes";
31
- }*/
32
-
33
- $this->id = "scrapes_settings";
34
- $this->menu_title = __('Settings', 'insert-php');
35
-
36
- parent::__construct($plugin);
37
-
38
- $this->plugin = $plugin;
39
- }
40
-
41
- public function assets($scripts, $styles)
42
- {
43
- $this->scripts->request('jquery');
44
-
45
- $this->scripts->request(array(
46
- 'control.checkbox',
47
- 'control.dropdown'
48
- ), 'bootstrap');
49
-
50
- $this->styles->request(array(
51
- 'bootstrap.core',
52
- 'bootstrap.form-group',
53
- 'bootstrap.separator',
54
- 'control.dropdown',
55
- 'control.checkbox',
56
- ), 'bootstrap');
57
- }
58
-
59
- /**
60
- * Returns options for the Basic Settings screen.
61
- *
62
- * @since 1.0.0
63
- * @return array
64
- */
65
- public function getOptions()
66
- {
67
-
68
- $options = array();
69
-
70
- $options[] = array(
71
- 'type' => 'separator'
72
- );
73
-
74
- $options[] = array(
75
- 'type' => 'checkbox',
76
- 'way' => 'buttons',
77
- 'name' => 'activate_by_default',
78
- 'title' => __('Activate by Default', 'insert-php'),
79
- 'default' => true,
80
- 'hint' => __('When creating a new snippet or updating an old one, make the code snippets active by default.', 'insert-php')
81
- );
82
-
83
- $options[] = array(
84
- 'type' => 'html',
85
- 'html' => '<h3 style="margin-left:0px">Code Editor</h3>'
86
- );
87
-
88
- $options[] = array(
89
- 'type' => 'separator'
90
- );
91
-
92
- $options[] = array(
93
- 'type' => 'dropdown',
94
- 'name' => 'code_editor_theme',
95
- 'title' => __('Code style', 'insert-php'),
96
- 'data' => $this->getAvailableThemes(),
97
- 'default' => 'default',
98
- 'hint' => __('Select theme for the code editor.', 'insert-php')
99
- );
100
-
101
- $options[] = array(
102
- 'type' => 'checkbox',
103
- 'way' => 'buttons',
104
- 'name' => 'code_editor_indent_with_tabs',
105
- 'title' => __('Indent With Tabs', 'insert-php'),
106
- 'default' => true,
107
- 'hint' => __('Use hard tabs (not spaces) for indentation.', 'insert-php')
108
- );
109
-
110
- $options[] = array(
111
- 'type' => 'integer',
112
- 'way' => 'buttons',
113
- 'name' => 'code_editor_tab_size',
114
- 'title' => __('Tab Size', 'insert-php'),
115
- 'default' => 4,
116
- 'hint' => __('The width of a tab character.', 'insert-php')
117
- );
118
-
119
- $options[] = array(
120
- 'type' => 'integer',
121
- 'way' => 'buttons',
122
- 'name' => 'code_editor_indent_unit',
123
- 'title' => __('Indent Unit', 'insert-php'),
124
- 'default' => 2,
125
- 'hint' => __('How many spaces a block should be indented.', 'insert-php')
126
- );
127
-
128
- $options[] = array(
129
- 'type' => 'checkbox',
130
- 'way' => 'buttons',
131
- 'name' => 'code_editor_wrap_lines',
132
- 'title' => __('Wrap Lines', 'insert-php'),
133
- 'default' => true,
134
- 'hint' => __('Whether the editor should scroll or wrap for long lines.', 'insert-php')
135
- );
136
-
137
- $options[] = array(
138
- 'type' => 'checkbox',
139
- 'way' => 'buttons',
140
- 'name' => 'code_editor_line_numbers',
141
- 'title' => __('Line Numbers', 'insert-php'),
142
- 'default' => true,
143
- 'hint' => __('Show line numbers to the left of the editor.', 'insert-php')
144
- );
145
-
146
- $options[] = array(
147
- 'type' => 'checkbox',
148
- 'way' => 'buttons',
149
- 'name' => 'code_editor_auto_close_brackets',
150
- 'title' => __('Auto Close Brackets', 'insert-php'),
151
- 'default' => true,
152
- 'hint' => __('Auto-close brackets and quotes when typed.', 'insert-php')
153
- );
154
-
155
- $options[] = array(
156
- 'type' => 'checkbox',
157
- 'way' => 'buttons',
158
- 'name' => 'code_editor_highlight_selection_matches',
159
- 'title' => __('Highlight Selection Matches', 'insert-php'),
160
- 'default' => true,
161
- 'hint' => __('Highlight all instances of a currently selected word.', 'insert-php')
162
- );
163
-
164
- $options[] = array(
165
- 'type' => 'separator'
166
- );
167
-
168
- return $options;
169
- }
170
-
171
-
172
- public function indexAction()
173
- {
174
-
175
- // creating a form
176
- $form = new Wbcr_FactoryForms405_Form(array(
177
- 'scope' => substr($this->plugin->getPrefix(), 0, -1),
178
- 'name' => 'setting'
179
- ), $this->plugin);
180
-
181
- $form->setProvider(new Wbcr_FactoryForms405_OptionsValueProvider($this->plugin));
182
-
183
- $form->add($this->getOptions());
184
-
185
- if( isset($_POST[$this->plugin->getPrefix() . 'saved']) ) {
186
- if( !wp_verify_nonce($_POST[$this->plugin->getPrefix() . 'nonce'], $this->plugin->getPrefix() . 'settings_form') ) {
187
- wp_die('Permission error. You can not edit this page.');
188
- }
189
- $form->save();
190
  }
191
-
192
- ?>
193
- <div class="wrap ">
194
- <div class="factory-bootstrap-404 factory-fontawesome-000">
195
- <h3><?php _e('Settings', 'insert-php') ?></h3>
196
-
197
- <form method="post" class="form-horizontal">
198
- <?php if( isset($_POST[$this->plugin->getPrefix() . 'saved']) ) { ?>
199
- <div id="message" class="alert alert-success">
200
- <p><?php _e('The settings have been updated successfully!', 'insert-php') ?></p>
201
- </div>
202
- <?php } ?>
203
- <div style="padding-top: 10px;">
204
- <?php $form->html(); ?>
205
- </div>
206
- <div class="form-group form-horizontal">
207
- <label class="col-sm-2 control-label"> </label>
208
-
209
- <div class="control-group controls col-sm-10">
210
- <?php wp_nonce_field($this->plugin->getPrefix() . 'settings_form', $this->plugin->getPrefix() . 'nonce'); ?>
211
- <input name="<?= $this->plugin->getPrefix() . 'saved' ?>" class="btn btn-primary" type="submit" value="<?php _e('Save settings', 'insert-php') ?>"/>
212
- </div>
213
- </div>
214
- </form>
215
- </div>
216
- </div>
217
- <?php
218
  }
219
-
220
- /**
221
- * Retrieve a list of the available CodeMirror themes
222
- * @return array the available themes
223
- */
224
- public function getAvailableThemes()
225
- {
226
- static $themes = null;
227
-
228
- if( !is_null($themes) ) {
229
- return $themes;
230
- }
231
-
232
- $themes = array();
233
- $themes_dir = WINP_PLUGIN_DIR . '/admin/assets/css/cmthemes/';
234
- $theme_files = glob($themes_dir . '*.css');
235
-
236
- foreach($theme_files as $i => $theme) {
237
- $theme = str_replace($themes_dir, '', $theme);
238
- $theme = str_replace('.css', '', $theme);
239
- $themes[] = array($theme, $theme);
240
- }
241
-
242
- array_unshift($themes, array('default', 'default'));
243
-
 
 
 
 
 
 
 
 
 
 
244
  return $themes;
245
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
  }
 
1
  <?php
2
+ /**
3
+ * The file contains a short help info.
4
+ *
5
+ * @author Alex Kovalev <alex.kovalevv@gmail.com>
6
+ * @copyright (c) 2018, OnePress Ltd
7
+ *s
8
+ * @package core
9
+ * @since 1.0.0
10
+ */
11
+
12
+ // Exit if accessed directly
13
+ if ( ! defined( 'ABSPATH' ) ) {
14
+ exit;
15
+ }
16
+
17
+ /**
18
+ * Common Settings
19
+ */
20
+ class WINP_SettingsPage extends Wbcr_FactoryPages411_AdminPage {
21
+
22
  /**
23
+ * @param Wbcr_Factory410_Plugin $plugin
 
 
 
 
 
 
24
  */
25
+ public function __construct( Wbcr_Factory410_Plugin $plugin ) {
26
+ $this->menu_post_type = WINP_SNIPPETS_POST_TYPE;
27
+
28
+ /*if( !current_user_can('administrator') ) {
29
+ $this->capabilitiy = "read_wbcr-scrapes";
30
+ }*/
31
+
32
+ $this->id = "settings";
33
+ $this->menu_title = __( 'Settings', 'insert-php' );
34
+
35
+ parent::__construct( $plugin );
36
+
37
+ $this->plugin = $plugin;
38
  }
39
+
40
+ public function assets( $scripts, $styles ) {
41
+ $this->scripts->request( 'jquery' );
42
+
43
+ $this->scripts->request( array(
44
+ 'control.checkbox',
45
+ 'control.dropdown'
46
+ ), 'bootstrap' );
47
+
48
+ $this->styles->request( array(
49
+ 'bootstrap.core',
50
+ 'bootstrap.form-group',
51
+ 'bootstrap.separator',
52
+ 'control.dropdown',
53
+ 'control.checkbox',
54
+ ), 'bootstrap' );
55
+ }
56
+
57
  /**
58
+ * Returns options for the Basic Settings screen.
59
+ *
60
+ * @since 1.0.0
61
+ * @return array
62
  */
63
+ public function getOptions() {
64
+
65
+ $options = array();
66
+
67
+ $options[] = array(
68
+ 'type' => 'separator'
69
+ );
70
+
71
+ $options[] = array(
72
+ 'type' => 'checkbox',
73
+ 'way' => 'buttons',
74
+ 'name' => 'activate_by_default',
75
+ 'title' => __( 'Activate by Default', 'insert-php' ),
76
+ 'default' => true,
77
+ 'hint' => __( 'When creating a new snippet or updating an old one, make the code snippets active by default.', 'insert-php' )
78
+ );
79
+
80
+ $options[] = array(
81
+ 'type' => 'checkbox',
82
+ 'way' => 'buttons',
83
+ 'name' => 'complete_uninstall',
84
+ 'title' => __( 'Complete Uninstall', 'insert-php' ),
85
+ 'default' => false,
86
+ 'hint' => __( 'When the plugin is deleted from the Plugins menu, also delete all snippets and plugin settings.', 'insert-php' )
87
+ );
88
+
89
+ $options[] = array(
90
+ 'type' => 'html',
91
+ 'html' => '<h3 style="margin-left:0">Code Editor</h3>'
92
+ );
93
+
94
+ $options[] = array(
95
+ 'type' => 'separator'
96
+ );
97
+
98
+ $options[] = array(
99
+ 'type' => 'dropdown',
100
+ 'name' => 'code_editor_theme',
101
+ 'title' => __( 'Code style', 'insert-php' ),
102
+ 'data' => $this->getAvailableThemes(),
103
+ 'default' => 'default',
104
+ 'hint' => __( 'The optional feature. You can customize the code style in the snippet editor. The "Default" style is applied by default.', 'insert-php' )
105
+ );
106
+
107
+ $options[] = array(
108
+ 'type' => 'checkbox',
109
+ 'way' => 'buttons',
110
+ 'name' => 'code_editor_indent_with_tabs',
111
+ 'title' => __( 'Indent With Tabs', 'insert-php' ),
112
+ 'default' => false,
113
+ 'hint' => __( 'The optional feature. Whether, when indenting, the first N*tabSize spaces should be replaced by N tabs. The default is false.', 'insert-php' )
114
+ );
115
+
116
+ $options[] = array(
117
+ 'type' => 'integer',
118
+ 'way' => 'buttons',
119
+ 'name' => 'code_editor_tab_size',
120
+ 'title' => __( 'Tab Size', 'insert-php' ),
121
+ 'default' => 4,
122
+ 'hint' => __( 'The optional feature. Pressing Tab in the code editor increases left indent to N spaces. N is a number pre-defined by you.', 'insert-php' )
123
+ );
124
+
125
+ $options[] = array(
126
+ 'type' => 'integer',
127
+ 'way' => 'buttons',
128
+ 'name' => 'code_editor_indent_unit',
129
+ 'title' => __( 'Indent Unit', 'insert-php' ),
130
+ 'default' => 4,
131
+ 'hint' => __( 'The optional feature. The indent for code lines (units). Example: select a snippet, press Tab. The left indent in the selected code increases to N spaces. N is a number pre-defined by you.', 'insert-php' )
132
+ );
133
+
134
+ $options[] = array(
135
+ 'type' => 'checkbox',
136
+ 'way' => 'buttons',
137
+ 'name' => 'code_editor_wrap_lines',
138
+ 'title' => __( 'Wrap Lines', 'insert-php' ),
139
+ 'default' => true,
140
+ 'hint' => __( 'The optional feature. If ON, the editor will wrap long lines. Otherwise, it will create a horizontal scroll.', 'insert-php' )
141
+ );
142
+
143
+ $options[] = array(
144
+ 'type' => 'checkbox',
145
+ 'way' => 'buttons',
146
+ 'name' => 'code_editor_line_numbers',
147
+ 'title' => __( 'Line Numbers', 'insert-php' ),
148
+ 'default' => true,
149
+ 'hint' => __( 'The optional feature. If ON, all lines in the editor will be numbered.', 'insert-php' )
150
+ );
151
+
152
+ $options[] = array(
153
+ 'type' => 'checkbox',
154
+ 'way' => 'buttons',
155
+ 'name' => 'code_editor_auto_close_brackets',
156
+ 'title' => __( 'Auto Close Brackets', 'insert-php' ),
157
+ 'default' => true,
158
+ 'hint' => __( 'The optional feature. If ON, the editor will automatically close opened quotes or brackets. Sometimes, it speeds up coding.', 'insert-php' )
159
+ );
160
+
161
+ $options[] = array(
162
+ 'type' => 'checkbox',
163
+ 'way' => 'buttons',
164
+ 'name' => 'code_editor_highlight_selection_matches',
165
+ 'title' => __( 'Highlight Selection Matches', 'insert-php' ),
166
+ 'default' => false,
167
+ 'hint' => __( 'The optional feature. If ON, it searches for matches for the selected variable/function name. Highlight matches with green. Improves readability.', 'insert-php' )
168
+ );
169
+
170
+ $options[] = array(
171
+ 'type' => 'separator'
172
+ );
173
+
174
+ return $options;
175
+ }
176
+
177
+
178
+ public function indexAction() {
179
+
180
+ // creating a form
181
+ $form = new Wbcr_FactoryForms411_Form( array(
182
+ 'scope' => substr( $this->plugin->getPrefix(), 0, - 1 ),
183
+ 'name' => 'setting'
184
+ ), $this->plugin );
185
+
186
+ $form->setProvider( new Wbcr_FactoryForms411_OptionsValueProvider( $this->plugin ) );
187
+
188
+ $form->add( $this->getOptions() );
189
+
190
+ if ( isset( $_POST[ $this->plugin->getPrefix() . 'saved' ] ) ) {
191
+ if ( ! wp_verify_nonce( $_POST[ $this->plugin->getPrefix() . 'nonce' ], $this->plugin->getPrefix() . 'settings_form' ) ) {
192
+ wp_die( 'Permission error. You can not edit this page.' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  }
194
+ $form->save();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
  }
196
+
197
+ ?>
198
+ <div class="wrap ">
199
+ <div class="factory-bootstrap-410 factory-fontawesome-000">
200
+ <h3><?php _e( 'Settings', 'insert-php' ) ?></h3>
201
+ <form method="post" class="form-horizontal">
202
+ <?php if ( isset( $_POST[ $this->plugin->getPrefix() . 'saved' ] ) ) { ?>
203
+ <div id="message" class="alert alert-success">
204
+ <p><?php _e( 'The settings have been updated successfully!', 'insert-php' ) ?></p>
205
+ </div>
206
+ <?php } ?>
207
+ <div style="padding-top: 10px;">
208
+ <?php $form->html(); ?>
209
+ </div>
210
+ <div class="form-group form-horizontal">
211
+ <label class="col-sm-2 control-label"> </label>
212
+ <div class="control-group controls col-sm-10">
213
+ <?php wp_nonce_field( $this->plugin->getPrefix() . 'settings_form', $this->plugin->getPrefix() . 'nonce' ); ?>
214
+ <input name="<?= $this->plugin->getPrefix() . 'saved' ?>" class="btn btn-primary" type="submit" value="<?php _e( 'Save settings', 'insert-php' ) ?>"/>
215
+ </div>
216
+ </div>
217
+ </form>
218
+ </div>
219
+ </div>
220
+ <?php
221
+ }
222
+
223
+ /**
224
+ * Retrieve a list of the available CodeMirror themes
225
+ * @return array the available themes
226
+ */
227
+ public function getAvailableThemes() {
228
+ static $themes = null;
229
+
230
+ if ( ! is_null( $themes ) ) {
231
  return $themes;
232
  }
233
+
234
+ $themes = array();
235
+ $themes_dir = WINP_PLUGIN_DIR . '/admin/assets/css/cmthemes/';
236
+ $theme_files = glob( $themes_dir . '*.css' );
237
+
238
+ foreach ( $theme_files as $i => $theme ) {
239
+ $theme = str_replace( $themes_dir, '', $theme );
240
+ $theme = str_replace( '.css', '', $theme );
241
+ $themes[] = array( $theme, $theme );
242
+ }
243
+
244
+ array_unshift( $themes, array( 'default', 'default' ) );
245
+
246
+ return $themes;
247
  }
248
+ }
admin/types/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
admin/types/snippets-post-types.php CHANGED
@@ -1,105 +1,129 @@
1
  <?php
2
 
 
 
 
 
 
 
 
3
  /**
4
- * Php Snippets Type
5
- * Declaration for custom post type of Php code snippets
6
- * @link http://codex.wordpress.org/Post_Types
7
  */
8
- class WSC_TasksItemType extends Wbcr_FactoryTypes404_Type {
9
-
10
- /**
11
- * Custom post name.
12
- * @var string
13
- */
14
- //public $name = 'wbcr-scrapes';
15
-
16
- /**
17
- * Template that defines a set of type options.
18
- * Allowed values: public, private, internal.
19
- * @var string
20
- */
21
- public $template = 'private';
22
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  /**
24
- * Capabilities for roles that have access to manage the type.
25
- * @link http://codex.wordpress.org/Roles_and_Capabilities
26
- * @var array
27
  */
28
- public $capabilities = array('administrator');
29
-
 
30
  /**
31
- * @param Wbcr_Factory404_Plugin $plugin
32
  */
33
- function __construct(Wbcr_Factory404_Plugin $plugin)
34
- {
35
- $this->name = WINP_SNIPPETS_POST_TYPE;
36
- $this->plural_title = __('PHP snippets', 'insert-php');
37
- $this->singular_title = __('PHP snippets', 'insert-php');
38
-
39
- parent::__construct($plugin);
40
- }
41
-
42
  /**
43
- * Type configurator.
44
  */
45
- public function configure()
46
- {
47
-
48
- $plural_name = $this->plural_title;
49
- $singular_name = $this->singular_title;
50
-
51
- $labels = array(
52
- 'singular_name' => $this->singular_title,
53
- 'name' => $this->plural_title,
54
- 'all_items' => sprintf(__('Snippets', 'insert-php'), $plural_name),
55
- 'add_new' => sprintf(__('+ Add snippet', 'insert-php'), $singular_name),
56
- 'add_new_item' => sprintf(__('Add new', 'insert-php'), $singular_name),
57
- 'edit' => sprintf(__('Edit', 'insert-php')),
58
- 'edit_item' => sprintf(__('Edit snippet', 'insert-php'), $singular_name),
59
- 'new_item' => sprintf(__('New snippet', 'insert-php'), $singular_name),
60
- 'view' => sprintf(__('View', 'factory')),
61
- 'view_item' => sprintf(__('View snippet', 'insert-php'), $singular_name),
62
- 'search_items' => sprintf(__('Search snippets', 'insert-php'), $plural_name),
63
- 'not_found' => sprintf(__('Snippet is not found', 'insert-php'), $plural_name),
64
- 'not_found_in_trash' => sprintf(__('Snippt is not found in trash', 'insert-php'), $plural_name),
65
- 'parent' => sprintf(__('Parent snippet', 'insert-php'), $plural_name)
66
- );
67
-
68
- $this->options['labels'] = apply_filters('wbcr_inp_items_lables', $labels);
69
-
70
- /**
71
- * Menu
72
- */
73
-
74
- $this->menu->icon = WINP_PLUGIN_URL . '/admin/assets/img/menu-icon.png';
75
-
76
- /**
77
- * View table
78
- */
79
-
80
- $this->view_table = 'WINP_SnippetsViewTable';
81
-
82
- /**
83
- * Scripts & styles
84
- */
85
-
86
- $this->scripts->request(array('jquery', 'jquery-effects-highlight', 'jquery-effects-slide'));
87
-
88
- $this->scripts->request(array(
89
- 'control.checkbox',
90
- 'control.dropdown',
91
- 'control.list',
92
- ), 'bootstrap');
93
-
94
- $this->styles->request(array(
95
- 'bootstrap.core',
96
- 'bootstrap.form-group',
97
- 'bootstrap.form-metabox',
98
- 'bootstrap.wp-editor',
99
- 'bootstrap.separator',
100
- 'control.checkbox',
101
- 'control.dropdown',
102
- 'control.list',
103
- ), 'bootstrap');
104
- }
105
- }
1
  <?php
2
 
3
+ /**
4
+ * Php Snippets Type
5
+ * Declaration for custom post type of Php code snippets
6
+ * @link http://codex.wordpress.org/Post_Types
7
+ */
8
+ class WSC_TasksItemType extends Wbcr_FactoryTypes405_Type {
9
+
10
  /**
11
+ * Custom post name.
12
+ * @var string
 
13
  */
14
+ //public $name = 'wbcr-scrapes';
15
+
16
+ /**
17
+ * Template that defines a set of type options.
18
+ * Allowed values: public, private, internal.
19
+ * @var string
20
+ */
21
+ public $template = 'private';
22
+
23
+ /**
24
+ * Capabilities for roles that have access to manage the type.
25
+ * @link http://codex.wordpress.org/Roles_and_Capabilities
26
+ * @var array
27
+ */
28
+ public $capabilities = array( 'administrator' );
29
+
30
+ /**
31
+ * @param Wbcr_Factory410_Plugin $plugin
32
+ */
33
+ function __construct( Wbcr_Factory410_Plugin $plugin ) {
34
+ $this->name = WINP_SNIPPETS_POST_TYPE;
35
+ $this->plural_title = __( 'Woody snippets', 'insert-php' );
36
+ $this->singular_title = __( 'Woody snippets', 'insert-php' );
37
+
38
+ parent::__construct( $plugin );
39
+
40
+ add_action( 'admin_head', array( $this, 'print_left_menu_styles' ) );
41
+ }
42
+
43
+ /**
44
+ * Prints styles for Woody add snippets menu
45
+ */
46
+ public function print_left_menu_styles() {
47
+ ?>
48
+ <!-- Woody ad snippets -->
49
+ <style>
50
+ #menu-posts-wbcr-snippets .wp-menu-open .wp-menu-name {
51
+ background: #242525;
52
+ }
53
+ </style>
54
+ <!-- /Woody ad snippets -->
55
+ <?php
56
+ }
57
+
58
+ /**
59
+ * Type configurator.
60
+ */
61
+ public function configure() {
62
+ $plural_name = $this->plural_title;
63
+ $singular_name = $this->singular_title;
64
+
65
+ $labels = array(
66
+ 'singular_name' => $this->singular_title,
67
+ 'name' => $this->plural_title,
68
+ 'all_items' => sprintf( __( 'Snippets', 'insert-php' ), $plural_name ),
69
+ 'add_new' => sprintf( __( '+ Add snippet', 'insert-php' ), $singular_name ),
70
+ 'add_new_item' => sprintf( __( 'Add new', 'insert-php' ), $singular_name ),
71
+ 'edit' => sprintf( __( 'Edit', 'insert-php' ) ),
72
+ 'edit_item' => sprintf( __( 'Edit snippet', 'insert-php' ), $singular_name ),
73
+ 'new_item' => sprintf( __( 'New snippet', 'insert-php' ), $singular_name ),
74
+ 'view' => sprintf( __( 'View', 'factory' ) ),
75
+ 'view_item' => sprintf( __( 'View snippet', 'insert-php' ), $singular_name ),
76
+ 'search_items' => sprintf( __( 'Search snippets', 'insert-php' ), $plural_name ),
77
+ 'not_found' => sprintf( __( 'Snippet is not found', 'insert-php' ), $plural_name ),
78
+ 'not_found_in_trash' => sprintf( __( 'Snippt is not found in trash', 'insert-php' ), $plural_name ),
79
+ 'parent' => sprintf( __( 'Parent snippet', 'insert-php' ), $plural_name )
80
+ );
81
+
82
+ $this->options['labels'] = apply_filters( 'wbcr_inp_items_lables', $labels );
83
+
84
+ $parameters = array( 'title' );
85
+ $snippet_type = WINP_Helper::get_snippet_type();
86
+ if ( $snippet_type === WINP_SNIPPET_TYPE_TEXT ) {
87
+ $parameters[] = 'editor';
88
+ }
89
+ $this->options['supports'] = apply_filters( 'wbcr_inp_items_supports', $parameters );
90
+
91
  /**
92
+ * Menu
 
 
93
  */
94
+
95
+ $this->menu->icon = WINP_PLUGIN_URL . '/admin/assets/img/menu-icon-4.png';
96
+
97
  /**
98
+ * View table
99
  */
100
+
101
+ $this->view_table = 'WINP_SnippetsViewTable';
102
+
 
 
 
 
 
 
103
  /**
104
+ * Scripts & styles
105
  */
106
+
107
+ $this->scripts->request( array( 'jquery', 'jquery-effects-highlight', 'jquery-effects-slide' ) );
108
+
109
+ $this->scripts->request( array(
110
+ 'bootstrap.datepicker',
111
+ 'control.checkbox',
112
+ 'control.dropdown',
113
+ 'control.list',
114
+ 'bootstrap.tooltip',
115
+ ), 'bootstrap' );
116
+
117
+ $this->styles->request( array(
118
+ 'bootstrap.core',
119
+ 'bootstrap.datepicker',
120
+ 'bootstrap.form-group',
121
+ 'bootstrap.form-metabox',
122
+ 'bootstrap.wp-editor',
123
+ 'bootstrap.separator',
124
+ 'control.checkbox',
125
+ 'control.dropdown',
126
+ 'control.list',
127
+ ), 'bootstrap' );
128
+ }
129
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/types/snippets-taxonomy.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- class WINP_SnippetsTaxonomy extends Wbcr_FactoryTaxonomies324_Taxonomy {
4
 
5
  /**
6
  * Custom post name.
@@ -23,7 +23,6 @@
23
  */
24
  public $capabilities = array('administrator');
25
 
26
-
27
  function __construct($plugin)
28
  {
29
  $this->plural_title = __('Tags', 'insert-php');
@@ -32,7 +31,7 @@
32
  $this->options['hierarchical'] = false;
33
  $this->options['show_admin_column'] = true;
34
  $this->options['show_in_nav_menus'] = true;
35
- $this->options['update_count_callback'] = true;
36
  $this->options['show_in_quick_edit'] = true;
37
 
38
  parent::__construct($plugin);
1
  <?php
2
 
3
+ class WINP_SnippetsTaxonomy extends Wbcr_FactoryTaxonomies325_Taxonomy {
4
 
5
  /**
6
  * Custom post name.
23
  */
24
  public $capabilities = array('administrator');
25
 
 
26
  function __construct($plugin)
27
  {
28
  $this->plural_title = __('Tags', 'insert-php');
31
  $this->options['hierarchical'] = false;
32
  $this->options['show_admin_column'] = true;
33
  $this->options['show_in_nav_menus'] = true;
34
+ $this->options['update_count_callback'] = ""; // use default handler
35
  $this->options['show_in_quick_edit'] = true;
36
 
37
  parent::__construct($plugin);
includes/class.execute.snippet.php ADDED
@@ -0,0 +1,862 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Execute snippet
5
+ * @author Webcraftic <wordpress.webraftic@gmail.com>
6
+ * @copyright (c) 16.11.2018, Webcraftic
7
+ * @version 1.0
8
+ */
9
+ class WINP_Execute_Snippet {
10
+
11
+ /**
12
+ * WINP_Execute_Snippet constructor.
13
+ */
14
+ public function __construct() {
15
+ }
16
+
17
+ /**
18
+ * Register hooks
19
+ */
20
+ public function registerHooks() {
21
+ add_action( 'plugins_loaded', array( $this, 'executeEverywhereSnippets' ), 1 );
22
+
23
+ if ( ! is_admin() ) { #issue PCS-45 fix bug with WPBPage Builder Frontend Editor
24
+ add_action( 'wp_head', array( $this, 'executeHeaderSnippets' ) );
25
+ add_action( 'wp_footer', array( $this, 'executeFooterSnippets' ) );
26
+ add_filter( 'the_post', array( $this, 'executePostSnippets' ), 10, 2 );
27
+ add_filter( 'the_content', array( $this, 'executeContentSnippets' ) );
28
+ add_filter( 'the_excerpt', array( $this, 'executeExcerptSnippets' ) );
29
+ add_filter( 'wp_list_comments_args', array( $this, 'executeListCommentsSnippets' ) );
30
+ }
31
+ }
32
+
33
+ /**
34
+ * Execute the evrywhere snippets once the plugins are loaded
35
+ */
36
+ public function executeEverywhereSnippets() {
37
+ echo $this->executeActiveSnippets( 'evrywhere' );
38
+ }
39
+
40
+ /**
41
+ * Execute the snippets in header of page once the plugins are loaded
42
+ */
43
+ public function executeHeaderSnippets() {
44
+ echo $this->executeActiveSnippets( 'auto', WINP_SNIPPET_AUTO_HEADER );
45
+ }
46
+
47
+ /**
48
+ * Execute the snippets in footer of page once the plugins are loaded
49
+ */
50
+ public function executeFooterSnippets() {
51
+ echo $this->executeActiveSnippets( 'auto', WINP_SNIPPET_AUTO_FOOTER );
52
+ }
53
+
54
+ /**
55
+ * Execute the snippets before post
56
+ *
57
+ * @param $data
58
+ * @param $query
59
+ */
60
+ public function executePostSnippets( $data, $query ) {
61
+ global $post;
62
+
63
+ $content = '';
64
+
65
+ $post_type = ! empty( $post ) ? $post->post_type : get_post( $data->ID )->post_type;
66
+ if ( is_singular( array( $post_type ) ) && $post->ID == $data->ID ) {
67
+ if ( did_action( 'get_header' ) ) {
68
+ // Перед заголовком
69
+ $content = $this->executeActiveSnippets( 'auto', WINP_SNIPPET_AUTO_BEFORE_POST );
70
+ }
71
+ } else {
72
+ if ( $query->post_count > 0 ) {
73
+ if ( $query->post_count > 1 && $query->current_post > 0 && $query->post_count > $query->current_post ) {
74
+ // Между записями
75
+ $content = $this->executeActiveSnippets( 'auto', WINP_SNIPPET_AUTO_BETWEEN_POSTS );
76
+ }
77
+ // Перед записью
78
+ $content .= $this->executeActiveSnippets( 'auto', WINP_SNIPPET_AUTO_BEFORE_POSTS, '', $query );
79
+
80
+ // После записи
81
+ $content .= $this->executeActiveSnippets( 'auto', WINP_SNIPPET_AUTO_AFTER_POSTS, '', $query );
82
+ }
83
+ }
84
+
85
+ echo $content;
86
+ }
87
+
88
+ /**
89
+ * Handle paragraph content
90
+ *
91
+ * @param $content
92
+ * @param $snippet_content
93
+ * @param $paragraph_number
94
+ * @param $type
95
+ *
96
+ * @return mixed
97
+ */
98
+ private function handleParagraphContent( $content, $snippet_content, $paragraph_number, $type = 'before' ) {
99
+ if ( 'before' == $type ) {
100
+ preg_match_all( "/<p(.*?)>/", $content, $matches );
101
+ } else {
102
+ preg_match_all( "/<\/p>/", $content, $matches );
103
+ }
104
+ $paragraphs = $matches[0];
105
+
106
+ if ( $paragraph_number == 0 ) {
107
+ $paragraph_number = 1;
108
+ }
109
+
110
+ if ( $content && $snippet_content && $paragraphs && $paragraph_number <= count( $paragraphs ) ) {
111
+ $offset = 0;
112
+ foreach ( $paragraphs as $paragraph_key => $paragraph ) {
113
+ $position = strpos( $content, $paragraph, $offset ); // Позиция тега параграфа
114
+ // Если указанный номер параграфа совпадает с текущим
115
+ if ( $paragraph_key + 1 == $paragraph_number ) {
116
+ if ( 'before' == $type ) {
117
+ $content = substr( $content, 0, $position ) . $snippet_content . substr( $content, $position );
118
+ } else {
119
+ $content = substr( $content, 0, $position + 4 ) . $snippet_content . substr( $content, $position + 4 );
120
+ }
121
+ break;
122
+ } else {
123
+ $offset = $position + 1;
124
+ }
125
+ }
126
+ }
127
+
128
+ return $content;
129
+ }
130
+
131
+ /**
132
+ * Handle posts content
133
+ *
134
+ * @param string $content
135
+ * @param string $snippet_content
136
+ * @param integer $post_number
137
+ * @param string $type
138
+ * @param object $query
139
+ *
140
+ * @return mixed
141
+ */
142
+ private function handlePostsContent( $content, $snippet_content, $post_number, $type, $query ) {
143
+ global $winp_after_post_content;
144
+ if ( $query->post_count > 0 ) {
145
+ if ( $post_number == 0 ) {
146
+ $post_number = 1;
147
+ }
148
+
149
+ if ( 'before' == $type && $query->current_post + 1 == $post_number ) {
150
+ return $snippet_content;
151
+ } else if ( 'after' == $type ) {
152
+ // Номер поста совпадает
153
+ if ( $query->current_post == $post_number ) {
154
+ return $snippet_content;
155
+ // Если это последний пост и указанный номер поста больше общего количества постов,
156
+ // то нужно сохранить контент сниппета для вывода в конце данного поста
157
+ } elseif ( $query->current_post + 1 == $query->post_count && $post_number >= $query->post_count ) {
158
+ $winp_after_post_content[ $query->post->ID ] = $snippet_content;
159
+ }
160
+ }
161
+ }
162
+
163
+ return $content;
164
+ }
165
+
166
+ /**
167
+ * Execute the snippets page content
168
+ *
169
+ * @param $content
170
+ *
171
+ * @return mixed
172
+ */
173
+ public function executeContentSnippets( $content ) {
174
+ global $post, $winp_after_post_content;
175
+
176
+ $post_type = ! empty( $post ) ? $post->post_type : false;
177
+
178
+ if ( is_category() || is_archive() || is_tag() || is_tax() || is_search() ) {
179
+ // Перед коротким описанием
180
+ $content = $this->executeActiveSnippets( 'auto', WINP_SNIPPET_AUTO_BEFORE_EXCERPT ) . $content;
181
+
182
+ // После короткого описания
183
+ $content .= $this->executeActiveSnippets( 'auto', WINP_SNIPPET_AUTO_AFTER_EXCERPT );
184
+ }
185
+
186
+ if ( is_singular( array( $post_type ) ) ) {
187
+ // Перед параграфом
188
+ $content = $this->executeActiveSnippets( 'auto', WINP_SNIPPET_AUTO_BEFORE_PARAGRAPH, $content );
189
+
190
+ // После параграфа
191
+ $content = $this->executeActiveSnippets( 'auto', WINP_SNIPPET_AUTO_AFTER_PARAGRAPH, $content );
192
+
193
+ // После заголовка
194
+ $content = $this->executeActiveSnippets( 'auto', WINP_SNIPPET_AUTO_BEFORE_CONTENT ) . $content;
195
+
196
+ // После текста
197
+ $content .= $this->executeActiveSnippets( 'auto', WINP_SNIPPET_AUTO_AFTER_CONTENT );
198
+
199
+ // После поста
200
+ $content .= $this->executeActiveSnippets( 'auto', WINP_SNIPPET_AUTO_AFTER_POST );
201
+
202
+ if ( ! comments_open( $post->ID ) && ! get_comments_number( $post->ID ) ) {
203
+ remove_filter( 'wp_list_comments_args', array( $this, 'executeListCommentsSnippets' ) );
204
+ }
205
+ } else if ( isset( $winp_after_post_content[ $post->ID ] ) ) {
206
+ // После последнего поста в списке
207
+ $content .= $winp_after_post_content[ $post->ID ];
208
+ unset( $winp_after_post_content[ $post->ID ] );
209
+ }
210
+
211
+ return $content;
212
+ }
213
+
214
+ /**
215
+ * Execute the snippets page excerpt
216
+ *
217
+ * @param $excerpt
218
+ *
219
+ * @return mixed
220
+ */
221
+ public function executeExcerptSnippets( $excerpt ) {
222
+ if ( is_category() || is_archive() || is_tag() || is_tax() || is_search() ) {
223
+ // Перед коротким описанием
224
+ $excerpt = $this->executeActiveSnippets( 'auto', WINP_SNIPPET_AUTO_BEFORE_EXCERPT ) . $excerpt;
225
+
226
+ // После короткого описания
227
+ $excerpt .= $this->executeActiveSnippets( 'auto', WINP_SNIPPET_AUTO_AFTER_EXCERPT );
228
+ }
229
+
230
+ return $excerpt;
231
+ }
232
+
233
+ /**
234
+ * Execute the list comments filter
235
+ *
236
+ * @param $args
237
+ *
238
+ * @return mixed
239
+ */
240
+ public function executeListCommentsSnippets( $args ) {
241
+ global $winp_wp_data;
242
+
243
+ $winp_wp_data['winp_comments_saved_end_callback'] = $args['end-callback'];
244
+ $args['end-callback'] = array( $this, 'executeCommentsSnippets' );
245
+
246
+ return $args;
247
+ }
248
+
249
+ /**
250
+ * Execute the snippets after page comments
251
+ *
252
+ * @param $comment
253
+ * @param $args
254
+ * @param $depth
255
+ */
256
+ public function executeCommentsSnippets( $comment, $args, $depth ) {
257
+ global $winp_wp_data, $post;
258
+
259
+ if ( ! empty ( $winp_wp_data['winp_comments_saved_end_callback'] ) ) {
260
+ echo call_user_func( $winp_wp_data['winp_comments_saved_end_callback'], $comment, $args, $depth );
261
+ }
262
+
263
+ $content = '';
264
+
265
+ $post_type = ! empty( $post ) ? $post->post_type : false;
266
+ if ( is_singular( array( $post_type ) ) ) {
267
+ // После комментариев
268
+ $content = $this->executeActiveSnippets( 'auto', WINP_SNIPPET_AUTO_AFTER_POST );
269
+ }
270
+
271
+ echo $content;
272
+ }
273
+
274
+ /**
275
+ * Execute the snippets once the plugins are loaded
276
+ *
277
+ * @param string $scope
278
+ * @param string $auto
279
+ * @param string $content
280
+ * @param array $custom_params
281
+ *
282
+ * @return string
283
+ */
284
+ public function executeActiveSnippets( $scope = 'evrywhere', $auto = '', $content = '', $custom_params = array() ) {
285
+ global $wpdb;
286
+
287
+ $snippets = $wpdb->get_results( "SELECT {$wpdb->posts}.ID, {$wpdb->posts}.post_content
288
+ FROM {$wpdb->posts}
289
+ INNER JOIN {$wpdb->postmeta} ON ( {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id )
290
+ WHERE ( ( {$wpdb->postmeta}.meta_key = '" . WINP_Plugin::app()->getPrefix() . "snippet_scope' AND {$wpdb->postmeta}.meta_value = '{$scope}' ) ) AND {$wpdb->posts}.post_type = '" . WINP_SNIPPETS_POST_TYPE . "' AND ( ({$wpdb->posts}.post_status = 'publish') )" );
291
+
292
+ if ( empty( $snippets ) ) {
293
+ return $content;
294
+ }
295
+
296
+ foreach ( (array) $snippets as $snippet ) {
297
+ $id = (int) $snippet->ID;
298
+
299
+ $is_active = (int) WINP_Helper::getMetaOption( $id, 'snippet_activate', 0 );
300
+ // Если это сниппет с автовставкой и выбранное место подходит под активный action
301
+ $avail_place = ( 'auto' == $scope ? $auto == WINP_Helper::getMetaOption( $id, 'snippet_location', '' ) : true );
302
+ // Если условие отображения сниппена выполняется
303
+ $snippet_type = WINP_Helper::getMetaOption( $id, 'snippet_type', WINP_SNIPPET_TYPE_PHP );
304
+ $is_condition = $snippet_type != WINP_SNIPPET_TYPE_PHP ? $this->checkCondition( $id ) : true;
305
+
306
+ if ( $is_active && $avail_place && $is_condition ) {
307
+ if ( isset( $_POST['wbcr_inp_snippet_scope'] ) && isset( $_POST['post_ID'] ) && (int) $_POST['post_ID'] === $id && WINP_Plugin::app()->currentUserCan() ) {
308
+ return $content;
309
+ }
310
+
311
+ if ( WINP_Helper::is_safe_mode() ) {
312
+ return $content;
313
+ }
314
+
315
+ if ( $snippet_type === WINP_SNIPPET_TYPE_TEXT ) {
316
+ $snippet_content = '<div class="winp-text-snippet-contanier">' . $snippet->post_content . '</div>';
317
+ } else {
318
+ $code = WINP_Helper::getMetaOption( $id, 'snippet_code' );
319
+ $code = $this->prepareCode( $code, $id );
320
+ ob_start();
321
+ $this->executeSnippet( $code, $id, false );
322
+ $snippet_content = ob_get_contents();
323
+ ob_end_clean();
324
+ }
325
+
326
+ if ( 'auto' == $scope ) {
327
+ switch ( $auto ) {
328
+ case WINP_SNIPPET_AUTO_BEFORE_PARAGRAPH: // Перед параграфом
329
+ $location_number = WINP_Helper::getMetaOption( $id, 'snippet_p_number', 0 );
330
+ $content = $this->handleParagraphContent( $content, $snippet_content, $location_number );
331
+ break;
332
+ case WINP_SNIPPET_AUTO_AFTER_PARAGRAPH: // После параграфа
333
+ $location_number = WINP_Helper::getMetaOption( $id, 'snippet_p_number', 0 );
334
+ $content = $this->handleParagraphContent( $content, $snippet_content, $location_number, 'after' );
335
+ break;
336
+ case WINP_SNIPPET_AUTO_BEFORE_POSTS: // Перед записью
337
+ $location_number = WINP_Helper::getMetaOption( $id, 'snippet_p_number', 0 );
338
+ $content = $this->handlePostsContent( $content, $snippet_content, $location_number, 'before', $custom_params );
339
+ break;
340
+ case WINP_SNIPPET_AUTO_AFTER_POSTS: // После записи
341
+ $location_number = WINP_Helper::getMetaOption( $id, 'snippet_p_number', 0 );
342
+ $content = $this->handlePostsContent( $content, $snippet_content, $location_number, 'after', $custom_params );
343
+ break;
344
+ default:
345
+ $content = $snippet_content . $content;
346
+ }
347
+ } else {
348
+ $content = $snippet_content . $content;
349
+ }
350
+ }
351
+ }
352
+
353
+ return $content;
354
+ }
355
+
356
+ /**
357
+ * Execute a snippet
358
+ *
359
+ * Code must NOT be escaped, as
360
+ * it will be executed directly
361
+ *
362
+ * @param string $code The snippet code to execute
363
+ * @param int $id The snippet ID
364
+ * @param bool $catch_output Whether to attempt to suppress the output of execution using buffers
365
+ *
366
+ * @return mixed The result of the code execution
367
+ */
368
+ public function executeSnippet( $code, $id = 0, $catch_output = true ) {
369
+ $id = (int) $id;
370
+
371
+ if ( ! $id || empty( $code ) ) {
372
+ return false;
373
+ }
374
+
375
+ if ( $catch_output ) {
376
+ ob_start();
377
+ }
378
+
379
+ $snippet = get_post( $id );
380
+
381
+ if ( empty( $snippet ) || $snippet->post_type !== WINP_SNIPPETS_POST_TYPE ) {
382
+ return false;
383
+ }
384
+
385
+ $snippet_type = WINP_Helper::getMetaOption( $id, 'snippet_type', true );
386
+
387
+ if ( $snippet_type == WINP_SNIPPET_TYPE_UNIVERSAL ) {
388
+ $result = eval( "?> " . $code . " <?php " );
389
+ } elseif ( $snippet_type == WINP_SNIPPET_TYPE_PHP ) {
390
+ $result = eval( $code );
391
+ } else {
392
+ $result = ! empty( $code );
393
+ }
394
+
395
+ if ( $catch_output ) {
396
+ ob_end_clean();
397
+ }
398
+
399
+ return $result;
400
+ }
401
+
402
+ /**
403
+ * Get property value
404
+ *
405
+ * @param $value
406
+ * @param $property
407
+ *
408
+ * @return null
409
+ */
410
+ private function getPropertyValue( $value, $property ) {
411
+ if ( is_object( $value ) ) {
412
+ return $value->$property;
413
+ } else if ( isset( $value[ $property ] ) ) {
414
+ return $value[ $property ];
415
+ }
416
+
417
+ return null;
418
+ }
419
+
420
+ /**
421
+ * Check conditional execution logic for the snippet
422
+ *
423
+ * @param $snippet_id
424
+ *
425
+ * @return bool
426
+ */
427
+ public function checkCondition( $snippet_id ) {
428
+ // Итоговый результат условий
429
+ $result = true;
430
+ // Получаем сохранённые параметры условий
431
+ $filters = get_post_meta( $snippet_id, WINP_Plugin::app()->getPrefix() . 'snippet_filters' );
432
+ // Если условия указаны
433
+ if ( ! ( empty( $filters ) || isset( $filters[0] ) && empty( $filters[0] ) ) ) {
434
+ foreach ( $filters[0] as $filter ) {
435
+ $conditions = $this->getPropertyValue( $filter, 'conditions' );
436
+ // Если условия пусты, то пропускаем цикл
437
+ if ( empty( $conditions ) ) {
438
+ continue;
439
+ }
440
+ // Промежуточный результат AND условий
441
+ $and_conditions = null;
442
+ // Проходим по AND условиям
443
+ foreach ( $conditions as $scope ) {
444
+ $scope_conditions = $this->getPropertyValue( $scope, 'conditions' );
445
+ // Если условия пусты, то пропускаем цикл
446
+ if ( empty( $scope_conditions ) ) {
447
+ continue;
448
+ }
449
+ // Промежуточный результат OR условий
450
+ $or_conditions = null;
451
+ // Проходим по OR условиям
452
+ foreach ( $scope_conditions as $condition ) {
453
+ $method_name = str_replace( '-', '_', $this->getPropertyValue( $condition, 'param' ) );
454
+ // Получаем результат OR условий
455
+ $or_conditions = is_null( $or_conditions ) ? $this->$method_name( $this->getPropertyValue( $condition, 'operator' ), $this->getPropertyValue( $condition, 'value' ) ) : $or_conditions || $this->$method_name( $this->getPropertyValue( $condition, 'operator' ), $this->getPropertyValue( $condition, 'value' ) );
456
+ }
457
+ // Получаем результат AND условий
458
+ $and_conditions = is_null( $and_conditions ) ? $or_conditions : $and_conditions && $or_conditions;
459
+ }
460
+ // Получаем результат блока условий
461
+ $result = $this->getPropertyValue( $filter, 'type' ) == 'showif' ? $and_conditions : ! $and_conditions;
462
+ }
463
+ }
464
+
465
+ return $result;
466
+ }
467
+
468
+ /**
469
+ * Retrieve the first error in a snippet's code
470
+ *
471
+ * @param int $snippet_id
472
+ *
473
+ * @return array|bool
474
+ */
475
+ public function getSnippetError( $snippet_id ) {
476
+ if ( ! intval( $snippet_id ) ) {
477
+ return false;
478
+ }
479
+
480
+ $snippet_code = WINP_Helper::getMetaOption( $snippet_id, 'snippet_code' );
481
+ $snippet_code = $this->prepareCode( $snippet_code, $snippet_id );
482
+
483
+ $result = $this->executeSnippet( $snippet_code, $snippet_id );
484
+
485
+ if ( false !== $result ) {
486
+ return false;
487
+ }
488
+
489
+ $error = error_get_last();
490
+
491
+ if ( is_null( $error ) ) {
492
+ return false;
493
+ }
494
+
495
+ return $error;
496
+ }
497
+
498
+ /**
499
+ * Prepare the code by removing php tags from beginning and end
500
+ *
501
+ * @param string $code
502
+ * @param integer $snippet_id
503
+ *
504
+ * @return string
505
+ */
506
+ public function prepareCode( $code, $snippet_id ) {
507
+ $snippet_type = WINP_Helper::get_snippet_type( $snippet_id );
508
+ if ( $snippet_type != WINP_SNIPPET_TYPE_UNIVERSAL ) {
509
+ /* Remove <?php and <? from beginning of snippet */
510
+ $code = preg_replace( '|^[\s]*<\?(php)?|', '', $code );
511
+
512
+ /* Remove ?> from end of snippet */
513
+ $code = preg_replace( '|\?>[\s]*$|', '', $code );
514
+ }
515
+
516
+ return $code;
517
+ }
518
+
519
+ /**
520
+ * Get current URL
521
+ *
522
+ * @return string
523
+ */
524
+ private function getCurrentUrl() {
525
+ $out = "";
526
+ $url = explode( '?', $_SERVER['REQUEST_URI'], 2 );
527
+ if ( isset( $url[0] ) ) {
528
+ $out = trim( $url[0], '/' );
529
+ }
530
+
531
+ return $out ? urldecode( $out ) : $out;
532
+ }
533
+
534
+ /**
535
+ * Get referer URL
536
+ *
537
+ * @return string
538
+ */
539
+ private function getRefererUrl() {
540
+ $out = "";
541
+ $url = explode( '?', str_replace( site_url(), '', $_SERVER['HTTP_REFERER'] ), 2 );
542
+ if ( isset( $url[0] ) ) {
543
+ $out = trim( $url[0], '/' );
544
+ }
545
+
546
+ return $out ? urldecode( $out ) : $out;
547
+ }
548
+
549
+ /**
550
+ * Check by operator
551
+ *
552
+ * @param $operation
553
+ * @param $first
554
+ * @param $second
555
+ * @param $third
556
+ *
557
+ * @return bool
558
+ */
559
+ private function checkByOperator( $operation, $first, $second, $third = false ) {
560
+ switch ( $operation ) {
561
+ case 'equals':
562
+ return $first === $second;
563
+ case 'notequal':
564
+ return $first !== $second;
565
+ case 'greater':
566
+ case 'older':
567
+ return $first > $second;
568
+ case 'less':
569
+ case 'younger':
570
+ return $first < $second;
571
+ case 'contains':
572
+ return strpos( $first, $second ) !== false;
573
+ case 'notcontain':
574
+ return strpos( $first, $second ) === false;
575
+ case 'between':
576
+ return $first < $second && $second < $third;
577
+
578
+ default:
579
+ return $first === $second;
580
+ }
581
+ }
582
+
583
+ /**
584
+ * A role of the user who views your website. The role "guest" is applied for unregistered users.
585
+ *
586
+ * @param string $operator
587
+ * @param string $value
588
+ *
589
+ * @return boolean
590
+ */
591
+ private function user_role( $operator, $value ) {
592
+ if ( ! is_user_logged_in() ) {
593
+ return $this->checkByOperator( $operator, $value, 'guest' );
594
+ } else {
595
+ $current_user = wp_get_current_user();
596
+ if ( ! ( $current_user instanceof WP_User ) ) {
597
+ return false;
598
+ }
599
+
600
+ return $this->checkByOperator( $operator, $value, $current_user->roles[0] );
601
+ }
602
+ }
603
+
604
+ /**
605
+ * Get timestamp
606
+ *
607
+ * @param $units
608
+ * @param $count
609
+ *
610
+ * @return integer
611
+ */
612
+ private function getTimestamp( $units, $count ) {
613
+ switch ( $units ) {
614
+ case 'seconds':
615
+ return $count;
616
+ case 'minutes':
617
+ return $count * MINUTE_IN_SECONDS;
618
+ case 'hours':
619
+ return $count * HOUR_IN_SECONDS;
620
+ case 'days':
621
+ return $count * DAY_IN_SECONDS;
622
+ case 'weeks':
623
+ return $count * WEEK_IN_SECONDS;
624
+ case 'months':
625
+ return $count * MONTH_IN_SECONDS;
626
+ case 'years':
627
+ return $count * YEAR_IN_SECONDS;
628
+
629
+ default:
630
+ return $count;
631
+ }
632
+ }
633
+
634
+ /**
635
+ * Get date timestamp
636
+ *
637
+ * @param $value
638
+ *
639
+ * @return integer
640
+ */
641
+ private function getDateTimestamp( $value ) {
642
+ if ( is_object( $value ) ) {
643
+ return ( current_time( 'timestamp' ) - $this->getTimestamp( $value->units, $value->unitsCount ) ) * 1000;
644
+ } else {
645
+ return $value;
646
+ }
647
+ }
648
+
649
+ /**
650
+ * The date when the user who views your website was registered.
651
+ * For unregistered users this date always equals to 1 Jan 1970.
652
+ *
653
+ * @param string $operator
654
+ * @param string $value
655
+ *
656
+ * @return boolean
657
+ */
658
+ private function user_registered( $operator, $value ) {
659
+ if ( ! is_user_logged_in() ) {
660
+ return false;
661
+ } else {
662
+ $user = wp_get_current_user();
663
+ $registered = strtotime( $user->data->user_registered ) * 1000;
664
+
665
+ if ( $operator == 'equals' || $operator == 'notequal' ) {
666
+ $registered = $registered / 1000;
667
+ $timestamp = round( $this->getDateTimestamp( $value ) / 1000 );
668
+
669
+ return $this->checkByOperator( $operator, date( "Y-m-d", $timestamp ), date( "Y-m-d", $registered ) );
670
+ } elseif ( $operator == 'between' ) {
671
+ $start_timestamp = $this->getDateTimestamp( $value->start );
672
+ $end_timestamp = $this->getDateTimestamp( $value->end );
673
+
674
+ return $this->checkByOperator( $operator, $start_timestamp, $registered, $end_timestamp );
675
+ } else {
676
+ $timestamp = $this->getDateTimestamp( $value );
677
+
678
+ return $this->checkByOperator( $operator, $timestamp, $registered );
679
+ }
680
+ }
681
+ }
682
+
683
+ /**
684
+ * Check the user views your website from mobile device or not
685
+ *
686
+ * @param string $operator
687
+ * @param string $value
688
+ *
689
+ * @return boolean
690
+ *
691
+ * @link https://stackoverflow.com/a/4117597
692
+ */
693
+ private function user_mobile( $operator, $value ) {
694
+ $useragent = $_SERVER['HTTP_USER_AGENT'];
695
+
696
+ if ( preg_match( '/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i', $useragent ) || preg_match( '/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i', substr( $useragent, 0, 4 ) ) ) {
697
+ return $operator === 'equals' && $value === 'yes' || $operator === 'notequal' && $value === 'no';
698
+ } else {
699
+ return $operator === 'notequal' && $value === 'yes' || $operator === 'equals' && $value === 'no';
700
+ }
701
+ }
702
+
703
+ /**
704
+ * Determines whether the user's browser has a cookie with a given name
705
+ *
706
+ * @param $operator
707
+ * @param $value
708
+ *
709
+ * @return boolean
710
+ */
711
+ private function user_cookie_name( $operator, $value ) {
712
+ if ( isset( $_COOKIE[ $value ] ) ) {
713
+ return $operator === 'equals';
714
+ } else {
715
+ return $operator === 'notequal';
716
+ }
717
+ }
718
+
719
+ /**
720
+ * A some selected page
721
+ *
722
+ * @param $operator
723
+ * @param $value
724
+ *
725
+ * @return boolean
726
+ */
727
+ private function location_some_page( $operator, $value ) {
728
+ $post_id = ( ! is_404() && ! is_search() && ! is_archive() && ! is_home() ) ? get_the_ID() : false;
729
+
730
+ switch ( $value ) {
731
+ case 'base_web': // Basic - Entire Website
732
+ $result = true;
733
+ break;
734
+ case 'base_sing': // Basic - All Singulars
735
+ $result = is_singular();
736
+ break;
737
+ case 'base_arch': // Basic - All Archives
738
+ $result = is_archive();
739
+ break;
740
+ case 'spec_404': // Special Pages - 404 Page
741
+ $result = is_404();
742
+ break;
743
+ case 'spec_search': // Special Pages - Search Page
744
+ $result = is_search();
745
+ break;
746
+ case 'spec_blog': // Special Pages - Blog / Posts Page
747
+ $result = is_home();
748
+ break;
749
+ case 'spec_front': // Special Pages - Front Page
750
+ $result = is_front_page();
751
+ break;
752
+ case 'spec_date': // Special Pages - Date Archive
753
+ $result = is_date();
754
+ break;
755
+ case 'spec_auth': // Special Pages - Author Archive
756
+ $result = is_author();
757
+ break;
758
+ case 'post_all': // Posts - All Posts
759
+ case 'page_all': // Pages - All Pages
760
+ $result = false;
761
+ if ( false !== $post_id ) {
762
+ $post_type = 'post_all' == $value ? 'post' : 'page';
763
+ $result = $post_type == get_post_type( $post_id );
764
+ }
765
+ break;
766
+ case 'post_arch': // Posts - All Posts Archive
767
+ case 'page_arch': // Pages - All Pages Archive
768
+ $result = false;
769
+ if ( is_archive() ) {
770
+ $post_type = 'post_arch' == $value ? 'post' : 'page';
771
+ $result = $post_type == get_post_type();
772
+ }
773
+ break;
774
+ case 'post_cat': // Posts - All Categories Archive
775
+ case 'post_tag': // Posts - All Tags Archive
776
+ $result = false;
777
+ if ( is_archive() && 'post' == get_post_type() ) {
778
+ $taxonomy = 'post_tag' == $value ? 'post_tag' : 'category';
779
+ $obj = get_queried_object();
780
+
781
+ $current_taxonomy = '';
782
+ if ( '' !== $obj && null !== $obj ) {
783
+ $current_taxonomy = $obj->taxonomy;
784
+ }
785
+
786
+ if ( $current_taxonomy == $taxonomy ) {
787
+ $result = true;
788
+ }
789
+ }
790
+ break;
791
+
792
+ default:
793
+ $result = true;
794
+ }
795
+
796
+ return $this->checkByOperator( $operator, $result, true );
797
+ }
798
+
799
+ /**
800
+ * An URL of the current page where a user who views your website is located
801
+ *
802
+ * @param $operator
803
+ * @param $value
804
+ *
805
+ * @return boolean
806
+ */
807
+ private function location_page( $operator, $value ) {
808
+ $url = $this->getCurrentUrl();
809
+
810
+ return $url ? $this->checkByOperator( $operator, $url, $value ) : false;
811
+ }
812
+
813
+ /**
814
+ * A referrer URL which has brought a user to the current page
815
+ *
816
+ * @param $operator
817
+ * @param $value
818
+ *
819
+ * @return boolean
820
+ */
821
+ private function location_referrer( $operator, $value ) {
822
+ $url = $this->getRefererUrl();
823
+
824
+ return $url ? $this->checkByOperator( $operator, $url, $value ) : false;
825
+ }
826
+
827
+ /**
828
+ * A post type of the current page
829
+ *
830
+ * @param $operator
831
+ * @param $value
832
+ *
833
+ * @return boolean
834
+ */
835
+ private function location_post_type( $operator, $value ) {
836
+ if ( is_singular() ) {
837
+ return $this->checkByOperator( $operator, $value, get_post_type() );
838
+ }
839
+
840
+ return false;
841
+ }
842
+
843
+ /**
844
+ * A taxonomy of the current page
845
+ *
846
+ * @param $operator
847
+ * @param $value
848
+ *
849
+ * @return boolean
850
+ */
851
+ private function location_taxonomy( $operator, $value ) {
852
+ global $post;
853
+
854
+ $post_cat = get_the_category( $post->ID );
855
+ if ( isset( $post_cat[0] ) ) {
856
+ return $this->checkByOperator( $operator, intval( $value ), $post_cat[0]->term_id );
857
+ }
858
+
859
+ return false;
860
+ }
861
+
862
+ }
includes/class.helpers.php CHANGED
@@ -1,66 +1,465 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
2
 
3
  /**
4
- * Helpers tools
5
- * @author Webcraftic <wordpress.webraftic@gmail.com>
6
- * @copyright (c) 09.11.2017, Webcraftic
7
- * @version 1.0
8
  */
9
- class WINP_Helper {
10
-
11
- private static $meta_options = array();
12
-
13
- /**
14
- * Get meta option
15
- *
16
- * @param int $post_id
17
- * @param string $option_name
18
- * @param mixed $default
19
- * @return bool|int
20
- */
21
- public static function getMetaOption($post_id, $option_name, $default = null)
22
- {
23
- $post_id = (int)$post_id;
24
-
25
- if( !isset(self::$meta_options[$post_id]) || empty(self::$meta_options[$post_id]) ) {
26
- $meta_vals = get_post_meta($post_id, '', true);
27
-
28
- foreach($meta_vals as $name => $val) {
29
- self::$meta_options[$post_id][$name] = $val[0];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  }
32
-
33
- return isset(self::$meta_options[$post_id][WINP_Plugin::app()->getPrefix() . $option_name])
34
- ? self::$meta_options[$post_id][WINP_Plugin::app()->getPrefix() . $option_name]
35
- : $default;
36
  }
37
-
38
- /**
39
- * Udpdate meta option
40
- *
41
- * @param int $post_id
42
- * @param string $option_name
43
- * @param mixed $option_value
44
- * @return bool|int
45
- */
46
- public static function updateMetaOption($post_id, $option_name, $option_value)
47
- {
48
- $post_id = (int)$post_id;
49
-
50
- return update_post_meta($post_id, WINP_Plugin::app()->getPrefix() . $option_name, $option_value);
 
 
 
 
 
 
51
  }
52
-
53
- /**
54
- * Remove meta option
55
- *
56
- * @param int $post_id
57
- * @param string $option_name
58
- * @return bool|int
59
- */
60
- public static function removeMetaOption($post_id, $option_name)
61
- {
62
- $post_id = (int)$post_id;
63
-
64
- return delete_post_meta($post_id, WINP_Plugin::app()->getPrefix() . $option_name);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  }
66
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+
3
+ /**
4
+ * Helpers tools
5
+ * @author Webcraftic <wordpress.webraftic@gmail.com>
6
+ * @copyright (c) 09.11.2017, Webcraftic
7
+ * @version 1.0
8
+ */
9
+ class WINP_Helper {
10
+
11
+ private static $meta_options = array();
12
 
13
  /**
14
+ * @return bool
 
 
 
15
  */
16
+ public static function is_safe_mode() {
17
+ global $wbcr_inp_safe_mode;
18
+
19
+ if ( ! WINP_Plugin::app()->currentUserCan() ) {
20
+ return false;
21
+ }
22
+
23
+ if ( $wbcr_inp_safe_mode || isset( $_COOKIE['wbcr-php-snippets-safe-mode'] ) ) {
24
+ return true;
25
+ }
26
+
27
+ return false;
28
+ }
29
+
30
+ /**
31
+ * Enables safe mode, in which the php code will not be executed.
32
+ */
33
+ public static function enable_safe_mode() {
34
+ global $wbcr_inp_safe_mode;
35
+
36
+ if ( ! WINP_Plugin::app()->currentUserCan() ) {
37
+ return false;
38
+ }
39
+
40
+ if ( ( ! $wbcr_inp_safe_mode || ! isset( $_COOKIE['wbcr-php-snippets-safe-mode'] ) ) ) {
41
+ $wbcr_inp_safe_mode = true;
42
+ setcookie( "wbcr-php-snippets-safe-mode", 1, time() + 3600, '/' );
43
+
44
+ return true;
45
+ }
46
+
47
+ return false;
48
+ }
49
+
50
+ /**
51
+ * Disable safe mode, in which the php code will not be executed.
52
+ */
53
+ public static function disable_safe_mode() {
54
+ global $wbcr_inp_safe_mode;
55
+
56
+ if ( ! WINP_Plugin::app()->currentUserCan() ) {
57
+ return;
58
+ }
59
+
60
+ if ( ( $wbcr_inp_safe_mode || isset( $_COOKIE['wbcr-php-snippets-safe-mode'] ) ) ) {
61
+ $wbcr_inp_safe_mode = false;
62
+ unset( $_COOKIE['wbcr-php-snippets-safe-mode'] );
63
+ setcookie( 'wbcr-php-snippets-safe-mode', null, - 1, '/' );
64
+
65
+ wp_safe_redirect( remove_query_arg( array( 'wbcr-php-snippets-disable-safe-mode' ) ) );
66
+ die();
67
+ }
68
+ }
69
+
70
+ /**
71
+ * Should show a page about the plugin or not.
72
+ *
73
+ * @return bool
74
+ */
75
+ public static function is_need_show_about_page() {
76
+ $need_show_about = (int)get_option(WINP_Plugin::app()->getOptionName( 'what_new_210' ));
77
+
78
+ $is_ajax = WINP_Helper::doing_ajax();
79
+ $is_cron = WINP_Helper::doing_cron();
80
+ $is_rest = WINP_Helper::doing_rest_api();
81
+
82
+ if ( $need_show_about && ! $is_ajax && ! $is_cron && ! $is_rest ) {
83
+ return true;
84
+ }
85
+
86
+ return false;
87
+ }
88
+
89
+ /**
90
+ * Gets and verified available attributes for snippets shortcodes.
91
+ *
92
+ * @return array
93
+ */
94
+ public static function get_shortcode_data() {
95
+
96
+ $snippets = get_posts( array(
97
+ 'post_type' => WINP_SNIPPETS_POST_TYPE,
98
+ 'meta_query' => array(
99
+ 'relation' => 'AND',
100
+ array(
101
+ 'key' => WINP_Plugin::app()->getPrefix() . 'snippet_scope',
102
+ 'value' => 'shortcode'
103
+ ),
104
+ array(
105
+ 'key' => WINP_Plugin::app()->getPrefix() . 'snippet_activate',
106
+ 'value' => 1
107
+ )
108
+ ),
109
+ 'post_status' => 'publish',
110
+ 'numberposts' => - 1
111
+ ) );
112
+
113
+ $result = array();
114
+
115
+ if ( ! empty( $snippets ) ) {
116
+ foreach ( (array) $snippets as $snippet ) {
117
+ $tag_names = array( 'id' );
118
+ $snippet_type = WINP_Helper::get_snippet_type( $snippet->ID );
119
+
120
+ $available_tags = WINP_Helper::getMetaOption( $snippet->ID, 'snippet_tags' );
121
+ $available_tags = trim( rtrim( $available_tags ) );
122
+
123
+ if ( ! empty( $available_tags ) ) {
124
+ $available_tags = array_map( 'trim', explode( ',', $available_tags ) );
125
+ $available_tags = array_unique( $available_tags );
126
+ } else {
127
+ if ( $snippet_type !== 'text' ) {
128
+ $available_tags = array( 'id', 'title' );
129
+ } else {
130
+ $available_tags = array( 'id' );
131
+ }
132
  }
133
+
134
+ $tags = array(
135
+ 'id' => $snippet->ID,
136
+ 'type' => $snippet_type,
137
+ 'title' => empty( $snippet->post_title ) ? '(no titled, ID=' . $snippet->ID . ')' : $snippet->post_title
138
+ );
139
+
140
+ if ( ! empty( $available_tags ) ) {
141
+ foreach ( (array) $available_tags as $tag ) {
142
+ if ( '' != $tag ) {
143
+ if ( 'title' == $tag ) {
144
+ $tags['title'] = empty( $snippet->post_title ) ? '(no titled, ID=' . $snippet->ID . ')' : $snippet->post_title;
145
+ $tag_names[] = 'title';
146
+ } else if ( 'id' != $tag ) {
147
+ $tag = preg_replace( '/[^a-zA-Z0-9_\x7f-\xff]/', '', $tag );
148
+ $tags[ $tag ] = "";
149
+ $tag_names[] = $tag;
150
+ }
151
+ }
152
+ }
153
+ }
154
+
155
+ $tags['snippet_tags'] = $tag_names;
156
+
157
+ $result[] = $tags;
158
  }
 
 
 
 
159
  }
160
+
161
+ return $result;
162
+ }
163
+
164
+ /**
165
+ * Get snippet type
166
+ *
167
+ * @param null $post_id
168
+ *
169
+ * @return array|mixed|string
170
+ */
171
+ public static function get_snippet_type( $post_id = null ) {
172
+ global $post;
173
+
174
+ $_post = $post;
175
+
176
+ $snippet_type = isset( $_GET['winp_item'] ) ? sanitize_text_field( $_GET['winp_item'] ) : WINP_SNIPPET_TYPE_PHP;
177
+
178
+ if ( empty( $post_id ) && isset( $_GET['post'] ) && ! is_array( $_GET['post'] ) ) {
179
+ $post_id = esc_attr( $_GET['post'] );
180
  }
181
+
182
+ if ( ! empty( $post_id ) ) {
183
+ $_post = get_post( $post_id );
184
+ }
185
+
186
+ if ( ! empty( $_post ) && $_post->post_type === WINP_SNIPPETS_POST_TYPE ) {
187
+ $_snippet_type = get_post_meta( $_post->ID, WINP_Plugin::app()->getPrefix() . 'snippet_type', true );
188
+ $snippet_type = $_snippet_type ? $_snippet_type : $snippet_type;
189
+ }
190
+
191
+ return $snippet_type;
192
+ }
193
+
194
+ /**
195
+ * Checks if the current request is a WP REST API request.
196
+ *
197
+ * Case #1: After WP_REST_Request initialisation
198
+ * Case #2: Support "plain" permalink settings
199
+ * Case #3: URL Path begins with wp-json/ (your REST prefix)
200
+ * Also supports WP installations in subfolders
201
+ *
202
+ * @since 2.1.0
203
+ * @return boolean
204
+ * @author matzeeable https://wordpress.stackexchange.com/questions/221202/does-something-like-is-rest-exist
205
+ */
206
+ public static function doing_rest_api() {
207
+ $prefix = rest_get_url_prefix();
208
+ if ( defined( 'REST_REQUEST' ) && REST_REQUEST // (#1)
209
+ || isset( $_GET['rest_route'] ) // (#2)
210
+ && strpos( trim( $_GET['rest_route'], '\\/' ), $prefix, 0 ) === 0 ) {
211
+ return true;
212
  }
213
+
214
+ // (#3)
215
+ $rest_url = wp_parse_url( site_url( $prefix ) );
216
+ $current_url = wp_parse_url( add_query_arg( array() ) );
217
+
218
+ return strpos( $current_url['path'], $rest_url['path'], 0 ) === 0;
219
+ }
220
+
221
+ /**
222
+ * @since 2.1.0
223
+ * @return bool
224
+ */
225
+ public static function doing_ajax() {
226
+ if ( function_exists( 'wp_doing_ajax' ) ) {
227
+ return wp_doing_ajax();
228
+ }
229
+
230
+ return defined( 'DOING_AJAX' ) && DOING_AJAX;
231
+ }
232
+
233
+ /**
234
+ * @since 2.1.0
235
+ * @return bool
236
+ */
237
+ public static function doing_cron() {
238
+ if ( function_exists( 'wp_doing_cron' ) ) {
239
+ return wp_doing_cron();
240
+ }
241
+
242
+ return defined( 'DOING_CRON' ) && DOING_CRON;
243
+ }
244
+
245
+ /**
246
+ * Get meta option
247
+ *
248
+ * @param int $post_id
249
+ * @param string $option_name
250
+ * @param mixed $default
251
+ *
252
+ * @return mixed|array
253
+ */
254
+ public static function getMetaOption( $post_id, $option_name, $default = null ) {
255
+ $post_id = (int) $post_id;
256
+
257
+ if ( ! isset( self::$meta_options[ $post_id ] ) || empty( self::$meta_options[ $post_id ] ) ) {
258
+ $meta_vals = get_post_meta( $post_id, '', true );
259
+
260
+ foreach ( $meta_vals as $name => $val ) {
261
+ self::$meta_options[ $post_id ][ $name ] = $val[0];
262
+ }
263
+ }
264
+
265
+ return isset( self::$meta_options[ $post_id ][ WINP_Plugin::app()->getPrefix() . $option_name ] ) ? self::$meta_options[ $post_id ][ WINP_Plugin::app()->getPrefix() . $option_name ] : $default;
266
+ }
267
+
268
+ /**
269
+ * Udpdate meta option
270
+ *
271
+ * @param int $post_id
272
+ * @param string $option_name
273
+ * @param mixed $option_value
274
+ *
275
+ * @return bool|int
276
+ */
277
+ public static function updateMetaOption( $post_id, $option_name, $option_value ) {
278
+ $post_id = (int) $post_id;
279
+
280
+ return update_post_meta( $post_id, WINP_Plugin::app()->getPrefix() . $option_name, $option_value );
281
+ }
282
+
283
+ /**
284
+ * Remove meta option
285
+ *
286
+ * @param int $post_id
287
+ * @param string $option_name
288
+ *
289
+ * @return bool|int
290
+ */
291
+ public static function removeMetaOption( $post_id, $option_name ) {
292
+ $post_id = (int) $post_id;
293
+
294
+ return delete_post_meta( $post_id, WINP_Plugin::app()->getPrefix() . $option_name );
295
+ }
296
+
297
+ /**
298
+ * Create a demo snippets with examples of use
299
+ */
300
+ public static function create_demo_snippets() {
301
+
302
+ WINP_Plugin::app()->updatePopulateOption( 'activate_by_default', 1 );
303
+ WINP_Plugin::app()->updatePopulateOption( 'complete_uninstall', 0 );
304
+ WINP_Plugin::app()->updatePopulateOption( 'code_editor_theme', 'default' );
305
+ WINP_Plugin::app()->updatePopulateOption( 'code_editor_indent_with_tabs', 1 );
306
+ WINP_Plugin::app()->updatePopulateOption( 'code_editor_tab_size', 4 );
307
+ WINP_Plugin::app()->updatePopulateOption( 'code_editor_indent_unit', 4 );
308
+ WINP_Plugin::app()->updatePopulateOption( 'code_editor_wrap_lines', 1 );
309
+ WINP_Plugin::app()->updatePopulateOption( 'code_editor_line_numbers', 1 );
310
+ WINP_Plugin::app()->updatePopulateOption( 'code_editor_auto_close_brackets', 1 );
311
+ WINP_Plugin::app()->updatePopulateOption( 'code_editor_highlight_selection_matches', 0 );
312
+
313
+ $posts = array(
314
+ array(
315
+ 'post_title' => __( 'Simple php snippet: Disable emojis', 'insert-php' ),
316
+ 'post_name' => 'simple-php-snippet',
317
+ 'post_content' => '',
318
+ 'meta' => array(
319
+ 'type' => WINP_SNIPPET_TYPE_PHP,
320
+ 'code' => self::get_simple_php_snippet(),
321
+ 'description' => __( 'Emojis are little icons used to express ideas or emotions. While these icons are fun and all, are they really necessary for your WordPress site? This snippet to disable emojis on your site to make it faster.', 'insert-php' ),
322
+ 'tags' => array( 'php', 'disable features' )
323
+ )
324
+ ),
325
+ array(
326
+ 'post_title' => __( 'Simple text snippet: What is Lorem Ipsum?', 'insert-php' ),
327
+ 'post_name' => 'simple-text-snippet',
328
+ 'post_content' => self::get_simple_text_snippet(),
329
+ 'meta' => array(
330
+ 'type' => WINP_SNIPPET_TYPE_TEXT,
331
+ 'description' => __( 'This ordinary maintenance text. With this snippet, you can fill your pages with meaningless English text.', 'insert-php' ),
332
+ 'filters' => 'a:1:{i:0;O:8:"stdClass":2:{s:10:"conditions";a:2:{i:0;O:8:"stdClass":2:{s:4:"type";s:5:"scope";s:10:"conditions";a:1:{i:0;O:8:"stdClass":4:{s:5:"param";s:18:"location-some-page";s:8:"operator";s:6:"equals";s:4:"type";s:6:"select";s:5:"value";s:9:"base_sing";}}}i:1;O:8:"stdClass":2:{s:4:"type";s:5:"scope";s:10:"conditions";a:2:{i:0;O:8:"stdClass":4:{s:5:"param";s:18:"location-post-type";s:8:"operator";s:6:"equals";s:4:"type";s:6:"select";s:5:"value";s:4:"post";}i:1;O:8:"stdClass":4:{s:5:"param";s:18:"location-post-type";s:8:"operator";s:6:"equals";s:4:"type";s:6:"select";s:5:"value";s:4:"page";}}}}s:4:"type";s:6:"showif";}}',
333
+ 'tags' => array( 'text', 'lorem ipsum' )
334
+ )
335
+ ),
336
+ array(
337
+ 'post_title' => __( 'Simple universal snippet: Google analytics tracking', 'insert-php' ),
338
+ 'post_name' => 'simple-universal-snippet',
339
+ 'post_content' => '',
340
+ 'meta' => array(
341
+ 'type' => WINP_SNIPPET_TYPE_UNIVERSAL,
342
+ 'description' => __( 'Google analytics tracking code will be added to all pages before the &lt;/head&gt; tag. Please remember to set the Tracking ID before activating the snippet.' ),
343
+ 'code' => self::get_simple_universal_snippet(),
344
+ 'filters' => 'a:1:{i:0;O:8:"stdClass":2:{s:10:"conditions";a:1:{i:0;O:8:"stdClass":2:{s:4:"type";s:5:"scope";s:10:"conditions";a:1:{i:0;O:8:"stdClass":4:{s:5:"param";s:18:"location-some-page";s:8:"operator";s:6:"equals";s:4:"type";s:6:"select";s:5:"value";s:8:"base_web";}}}}s:4:"type";s:6:"showif";}}',
345
+ 'tags' => array( 'universal', 'tracking' )
346
+ )
347
+ )
348
+ );
349
+
350
+ foreach ( $posts as $post ) {
351
+ // '@' here is to hide unexpected output while plugin activation
352
+ $post_id = @wp_insert_post( array(
353
+ 'post_content' => $post['post_content'],
354
+ 'post_title' => $post['post_title'],
355
+ 'post_status' => 'publish',
356
+ 'post_type' => WINP_SNIPPETS_POST_TYPE
357
+ ) );
358
+
359
+ if ( ! is_wp_error( $post_id ) ) {
360
+ if ( isset( $post['meta']['code'] ) ) {
361
+ WINP_Helper::updateMetaOption( $post_id, 'snippet_code', $post['meta']['code'] );
362
+ }
363
+
364
+ if ( isset( $post['meta']['type'] ) ) {
365
+ WINP_Helper::updateMetaOption( $post_id, 'snippet_type', $post['meta']['type'] );
366
+
367
+ if ( $post['meta']['type'] == WINP_SNIPPET_TYPE_PHP ) {
368
+ WINP_Helper::updateMetaOption( $post_id, 'snippet_scope', 'evrywhere' );
369
+ }
370
+ if ( $post['meta']['type'] == WINP_SNIPPET_TYPE_TEXT ) {
371
+ WINP_Helper::updateMetaOption( $post_id, 'snippet_scope', 'shortcode' );
372
+ }
373
+ if ( $post['meta']['type'] == WINP_SNIPPET_TYPE_UNIVERSAL ) {
374
+ WINP_Helper::updateMetaOption( $post_id, 'snippet_scope', 'auto' );
375
+ WINP_Helper::updateMetaOption( $post_id, 'snippet_location', 'header' );
376
+ }
377
+ }
378
+
379
+ if ( isset( $post['meta']['description'] ) ) {
380
+ WINP_Helper::updateMetaOption( $post_id, 'snippet_description', $post['meta']['description'] );
381
+ }
382
+
383
+ if ( isset( $post['meta']['filters'] ) && is_serialized( $post['meta']['filters'] ) ) {
384
+ $unserialized_filters = unserialize( $post['meta']['filters'] );
385
+ WINP_Helper::updateMetaOption( $post_id, 'snippet_filters', $unserialized_filters );
386
+ WINP_Helper::updateMetaOption( $post_id, 'changed_filters', 1 );
387
+ }
388
+
389
+ if ( isset( $post['meta']['tags'] ) && ! empty( $post['meta']['tags'] ) ) {
390
+ if ( ! taxonomy_exists( WINP_SNIPPETS_TAXONOMY ) ) {
391
+ register_taxonomy( WINP_SNIPPETS_TAXONOMY, WINP_SNIPPETS_POST_TYPE, array() );
392
+ }
393
+
394
+ wp_set_post_terms( $post_id, $post['meta']['tags'], WINP_SNIPPETS_TAXONOMY, true );
395
+ }
396
+ }
397
+ }
398
+ WINP_Plugin::app()->updatePopulateOption( 'demo_snippets_created', 1 );
399
+ }
400
+
401
+ /**
402
+ * Returns an example php snippet content
403
+ *
404
+ * @return string
405
+ */
406
+ protected static function get_simple_php_snippet() {
407
+ $output = "/**" . PHP_EOL;
408
+ $output .= "* Disable WP 4.2 emoji" . PHP_EOL;
409
+ $output .= "*/" . PHP_EOL;
410
+ $output .= "function ace_remove_emoji() {" . PHP_EOL;
411
+ $output .= "\tadd_filter( 'emoji_svg_url', '__return_false' );" . PHP_EOL;
412
+ $output .= "\tremove_action( 'admin_print_styles', 'print_emoji_styles' );" . PHP_EOL;
413
+ $output .= "\tremove_action( 'wp_head', 'print_emoji_detection_script', 7 );" . PHP_EOL;
414
+ $output .= "\tremove_action( 'admin_print_scripts', 'print_emoji_detection_script' );" . PHP_EOL;
415
+ $output .= "\tremove_action( 'wp_print_styles', 'print_emoji_styles' );" . PHP_EOL;
416
+ $output .= "\tremove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );" . PHP_EOL;
417
+ $output .= "\tremove_filter( 'the_content_feed', 'wp_staticize_emoji' );" . PHP_EOL;
418
+ $output .= "\tremove_filter( 'comment_text_rss', 'wp_staticize_emoji' );" . PHP_EOL;
419
+ $output .= "\t// filter to remove TinyMCE emojis" . PHP_EOL;
420
+ $output .= "\tadd_filter( 'tiny_mce_plugins', 'ace_disable_emoji_tinymce' );" . PHP_EOL;
421
+ $output .= "}" . PHP_EOL;
422
+ $output .= "add_action( 'init', 'ace_remove_emoji' );" . PHP_EOL;
423
+ $output .= "/**" . PHP_EOL;
424
+ $output .= "* Remove tinyMCE emoji" . PHP_EOL;
425
+ $output .= "*/" . PHP_EOL;
426
+ $output .= "function ace_disable_emoji_tinymce( \$plugins ) {" . PHP_EOL;
427
+ $output .= "\tunset( \$plugins['wpemoji'] );" . PHP_EOL;
428
+ $output .= "\treturn \$plugins;" . PHP_EOL;
429
+ $output .= "}" . PHP_EOL;
430
+
431
+ return $output;
432
+ }
433
+
434
+ /**
435
+ * Returns an example of the content of a text snippet.
436
+ *
437
+ * @return string
438
+ */
439
+ protected static function get_simple_text_snippet() {
440
+ $output = '<h3>What is Lorem Ipsum?</h3>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.';
441
+ $output .= PHP_EOL . "{{SNIPPET_CONTENT}}" . PHP_EOL;
442
+
443
+ return $output;
444
+ }
445
+
446
+ /**
447
+ * Returns an example of the content of a universal snippet.
448
+ *
449
+ * @return string
450
+ */
451
+ protected static function get_simple_universal_snippet() {
452
+ $output = "<!-- Global Site Tag (gtag.js) - Google Analytics -->" . PHP_EOL;
453
+ $output .= "<script async src=\"https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID\"></script>" . PHP_EOL;
454
+ $output .= "<script>" . PHP_EOL;
455
+ $output .= "\twindow.dataLayer = window.dataLayer || [];" . PHP_EOL;
456
+ $output .= "\tfunction gtag(){dataLayer.push(arguments);}" . PHP_EOL;
457
+ $output .= "\tgtag('js', new Date());" . PHP_EOL;
458
+ $output .= "\tgtag('config', 'GA_TRACKING_ID');" . PHP_EOL;
459
+ $output .= "</script>" . PHP_EOL;
460
+ $output .= "<!-- End global Site Tag (gtag.js) - Google Analytics -->" . PHP_EOL;
461
+
462
+ return $output;
463
+ }
464
+
465
+ }
includes/class.plugin.php CHANGED
@@ -1,223 +1,158 @@
1
  <?php
2
- /**
3
- * PHP snippets plugin base
4
- * @author Webcraftic <wordpress.webraftic@gmail.com>
5
- * @copyright (c) 19.02.2018, Webcraftic
6
- * @version 1.0
7
- */
8
-
9
- // Exit if accessed directly
10
- if( !defined('ABSPATH') ) {
11
- exit;
12
- }
13
-
14
- if( !class_exists('WINP_Plugin') ) {
15
-
16
- class WINP_Plugin extends Wbcr_Factory404_Plugin {
17
-
18
- /**
19
- * @var Wbcr_Factory404_Plugin
20
- */
21
- private static $app;
22
-
23
- /**
24
- * @param string $plugin_path
25
- * @param array $data
26
- * @throws Exception
27
- */
28
- public function __construct($plugin_path, $data)
29
- {
30
- parent::__construct($plugin_path, $data);
31
-
32
- self::$app = $this;
33
-
34
- $this->setTextDomain();
35
- $this->setModules();
36
-
37
- $this->globalScripts();
38
-
39
- if( is_admin() ) {
40
- $this->adminScripts();
41
- }
42
- }
43
-
44
- /**
45
- * @return WINP_Plugin
46
- */
47
- public static function app()
48
- {
49
- return self::$app;
50
- }
51
-
52
- /**
53
- * @return bool
54
- */
55
- public function currentUserCan()
56
- {
57
- return current_user_can('manage_options');
58
- }
59
-
60
- protected function setTextDomain()
61
- {
62
-
63
- load_plugin_textdomain('insert-php', false, dirname(WINP_PLUGIN_BASE) . '/languages/');
64
- }
65
 
66
- protected function setModules()
67
- {
68
-
69
- $this->load(array(
70
- array('libs/factory/bootstrap', 'factory_bootstrap_404', 'admin'),
71
- array('libs/factory/forms', 'factory_forms_405', 'admin'),
72
- array('libs/factory/pages', 'factory_pages_405', 'admin'),
73
- array('libs/factory/types', 'factory_types_404'),
74
- array('libs/factory/taxonomies', 'factory_taxonomies_324'),
75
- array('libs/factory/metaboxes', 'factory_metaboxes_403', 'admin'),
76
- array('libs/factory/viewtables', 'factory_viewtables_403', 'admin'),
77
- array('libs/factory/shortcodes', 'factory_shortcodes_324', 'all'),
78
- array('libs/factory/notices', 'factory_notices_403', 'admin'),
79
-
80
- ));
81
- }
82
-
83
- private function registerPages()
84
- {
85
- $this->registerPage('WINP_ExportPage', WINP_PLUGIN_DIR . '/admin/pages/export.php');
86
- $this->registerPage('WINP_SettingsPage', WINP_PLUGIN_DIR . '/admin/pages/settings.php');
87
- }
88
-
89
- private function registerTypes()
90
- {
91
- $this->registerType('WSC_TasksItemType', WINP_PLUGIN_DIR . '/admin/types/snippets-post-types.php');
92
-
93
- require_once(WINP_PLUGIN_DIR . '/admin/types/snippets-taxonomy.php');
94
- Wbcr_FactoryTaxonomies324::register('WINP_SnippetsTaxonomy', $this);
95
- }
96
-
97
- private function registerShortcodes()
98
- {
99
- require_once(WINP_PLUGIN_DIR . '/includes/shortcodes.php');
100
- Wbcr_FactoryShortcodes324::register('WINP_SnippetShortcode', $this);
101
- }
102
-
103
- private function adminScripts()
104
- {
105
- require_once(WINP_PLUGIN_DIR . '/admin/includes/class.snippets.viewtable.php');
106
- require_once(WINP_PLUGIN_DIR . '/admin/boot.php');
107
-
108
- $this->registerTypes();
109
- $this->registerPages();
110
- }
111
 
112
- private function globalScripts()
113
- {
114
- $this->registerShortcodes();
115
-
116
- add_action('plugins_loaded', array($this, 'executeActiveSnippets'), 1);
117
- }
118
-
119
- /**
120
- * Execute the snippets once the plugins are loaded
121
- */
122
- public function executeActiveSnippets()
123
- {
124
- global $wpdb;
125
-
126
- $save_mode = false;
127
-
128
- if( isset($_REQUEST['wbcr-php-snippets-safe-mode']) && !isset($_COOKIE['wbcr-php-snippets-safe-mode']) && $this->currentUserCan() ) {
129
- $save_mode = true;
130
- setcookie("wbcr-php-snippets-safe-mode", 1, time() + 3600);
131
- }
132
-
133
- $snippets = $wpdb->get_results("SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$wpdb->postmeta} ON ( {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id ) WHERE (
134
- ( {$wpdb->postmeta}.meta_key = '" . $this->getPrefix() . "snippet_scope' AND {$wpdb->postmeta}.meta_value = 'evrywhere' )
135
- ) AND {$wpdb->posts}.post_type = '" . WINP_SNIPPETS_POST_TYPE . "' AND (({$wpdb->posts}.post_status = 'publish'))");
136
-
137
- if( empty($snippets) ) {
138
- return;
139
- }
140
-
141
- foreach((array)$snippets as $snippet) {
142
- $id = (int)$snippet->ID;
143
-
144
- $is_active = (int)WINP_Helper::getMetaOption($id, 'snippet_activate', 0);
145
- $code = WINP_Helper::getMetaOption($id, 'snippet_code');
146
-
147
- if( $is_active ) {
148
- if( isset($_POST['wbcr_inp_snippet_scope']) && isset($_POST['post_ID']) && (int)$_POST['post_ID'] === $id && $this->currentUserCan() ) {
149
- return;
150
- }
151
-
152
- if( ($save_mode || isset($_COOKIE['wbcr-php-snippets-safe-mode'])) && $this->currentUserCan() ) {
153
- return;
154
- }
155
-
156
- $this->executeSnippet($code, $id);
157
- }
158
- }
159
- }
160
-
161
- /**
162
- * Execute a snippet
163
- *
164
- * Code must NOT be escaped, as
165
- * it will be executed directly
166
- *
167
- * @param string $code The snippet code to execute
168
- * @param int $id The snippet ID
169
- * @param bool $catch_output Whether to attempt to suppress the output of execution using buffers
170
- *
171
- * @return mixed The result of the code execution
172
- */
173
- public function executeSnippet($code, $id = 0, $catch_output = true)
174
- {
175
-
176
- if( empty($code) ) {
177
- return false;
178
- }
179
-
180
- if( $catch_output ) {
181
- ob_start();
182
- }
183
-
184
- $result = eval($code);
185
-
186
- if( $catch_output ) {
187
- ob_end_clean();
188
  }
189
-
190
- return $result;
191
  }
192
-
193
- /**
194
- * Retrieve the first error in a snippet's code
195
- *
196
- * @param int $snippet_id
197
- *
198
- * @return array|bool
199
- */
200
- public function getSnippetError($snippet_id)
201
- {
202
- if( !intval($snippet_id) ) {
203
- return false;
204
- }
205
-
206
- $snippet_code = WINP_Helper::getMetaOption($snippet_id, 'snippet_code');
207
-
208
- $result = $this->executeSnippet($snippet_code, $snippet_id);
209
-
210
- if( false !== $result ) {
211
- return false;
212
- }
213
-
214
- $error = error_get_last();
215
-
216
- if( is_null($error) ) {
217
- return false;
218
- }
219
-
220
- return $error;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  }
222
  }
223
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+ /**
3
+ * PHP snippets plugin base
4
+ * @author Webcraftic <wordpress.webraftic@gmail.com>
5
+ * @copyright (c) 19.02.2018, Webcraftic
6
+ * @version 1.0
7
+ */
8
+
9
+ // Exit if accessed directly
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit;
12
+ }
13
+
14
+ if ( ! class_exists( 'WINP_Plugin' ) ) {
15
+
16
+ class WINP_Plugin extends Wbcr_Factory410_Plugin {
17
+
18
+ /**
19
+ * @var Wbcr_Factory410_Plugin
20
+ */
21
+ private static $app;
22
+
23
+ /**
24
+ * @param string $plugin_path
25
+ * @param array $data
26
+ *
27
+ * @throws Exception
28
+ */
29
+ public function __construct( $plugin_path, $data ) {
30
+ parent::__construct( $plugin_path, $data );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
+ self::$app = $this;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
+ self::app()->setTextDomain( 'insert-php', WINP_PLUGIN_DIR );
35
+ $this->setModules();
36
+
37
+ $this->globalScripts();
38
+
39
+ if ( is_admin() ) {
40
+ $this->initActivation();
41
+ $this->adminScripts();
42
+
43
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
44
+ require( WINP_PLUGIN_DIR . '/admin/ajax/ajax.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  }
 
 
46
  }
47
+ }
48
+
49
+ /**
50
+ * @return WINP_Plugin
51
+ */
52
+ public static function app() {
53
+ return self::$app;
54
+ }
55
+
56
+ /**
57
+ * @return bool
58
+ */
59
+ public function currentUserCan() {
60
+ return current_user_can( 'manage_options' );
61
+ }
62
+
63
+
64
+ /**
65
+ * Get Execute_Snippet object
66
+ *
67
+ * @return WINP_Execute_Snippet
68
+ */
69
+ public function getExecuteObject() {
70
+ require_once( WINP_PLUGIN_DIR . '/includes/class.execute.snippet.php' );
71
+
72
+ return new WINP_Execute_Snippet();
73
+ }
74
+
75
+ protected function setModules() {
76
+ $this->load( array(
77
+ array( 'libs/factory/bootstrap', 'factory_bootstrap_410', 'admin' ),
78
+ array( 'libs/factory/forms', 'factory_forms_411', 'admin' ),
79
+ array( 'libs/factory/pages', 'factory_pages_411', 'admin' ),
80
+ array( 'libs/factory/types', 'factory_types_405' ),
81
+ array( 'libs/factory/taxonomies', 'factory_taxonomies_325' ),
82
+ array( 'libs/factory/metaboxes', 'factory_metaboxes_404', 'admin' ),
83
+ array( 'libs/factory/viewtables', 'factory_viewtables_405', 'admin' ),
84
+ array( 'libs/factory/shortcodes', 'factory_shortcodes_325', 'all' ),
85
+ array( 'libs/factory/notices', 'factory_notices_408', 'admin' )
86
+ ) );
87
+ }
88
+
89
+ protected function initActivation() {
90
+ include_once( WINP_PLUGIN_DIR . '/admin/activation.php' );
91
+ $this->registerActivation( 'WINP_Activation' );
92
+ }
93
+
94
+ private function registerPages() {
95
+ $this->registerPage( 'WINP_NewItemPage', WINP_PLUGIN_DIR . '/admin/pages/new-item.php' );
96
+ $this->registerPage( 'WINP_ImportPage', WINP_PLUGIN_DIR . '/admin/pages/import.php' );
97
+ $this->registerPage( 'WINP_SettingsPage', WINP_PLUGIN_DIR . '/admin/pages/settings.php' );
98
+ $this->registerPage( 'WINP_AboutPage', WINP_PLUGIN_DIR . '/admin/pages/about.php' );
99
+ }
100
+
101
+ private function registerTypes() {
102
+ $this->registerType( 'WSC_TasksItemType', WINP_PLUGIN_DIR . '/admin/types/snippets-post-types.php' );
103
+
104
+ require_once( WINP_PLUGIN_DIR . '/admin/types/snippets-taxonomy.php' );
105
+ Wbcr_FactoryTaxonomies325::register( 'WINP_SnippetsTaxonomy', $this );
106
+ }
107
+
108
+ private function register_shortcodes() {
109
+ $is_cron = WINP_Helper::doing_cron();
110
+ $is_rest = WINP_Helper::doing_rest_api();
111
+
112
+ if ( ! ( isset( $_GET['action'] ) && $_GET['action'] == 'edit' && is_admin() ) && ! $is_cron && ! $is_rest ) {
113
+ require_once( WINP_PLUGIN_DIR . '/includes/shortcodes/shortcodes.php' );
114
+ require_once( WINP_PLUGIN_DIR . '/includes/shortcodes/shortcode-php.php' );
115
+ require_once( WINP_PLUGIN_DIR . '/includes/shortcodes/shortcode-text.php' );
116
+ require_once( WINP_PLUGIN_DIR . '/includes/shortcodes/shortcode-universal.php' );
117
+
118
+ Wbcr_FactoryShortcodes325::register( 'WINP_SnippetShortcodePhp', $this );
119
+ Wbcr_FactoryShortcodes325::register( 'WINP_SnippetShortcodeText', $this );
120
+ Wbcr_FactoryShortcodes325::register( 'WINP_SnippetShortcodeUniversal', $this );
121
  }
122
  }
123
+
124
+
125
+ private function globalScripts() {
126
+ $this->registerGutenberg();
127
+ $this->getExecuteObject()->registerHooks();
128
+ $this->register_shortcodes();
129
+
130
+ require_once( WINP_PLUGIN_DIR . '/admin/boot.php' );
131
+ }
132
+
133
+ private function adminScripts() {
134
+ require_once( WINP_PLUGIN_DIR . '/admin/includes/class.snippets.viewtable.php' );
135
+ require_once( WINP_PLUGIN_DIR . '/admin/includes/class.filter.snippet.php' );
136
+ require_once( WINP_PLUGIN_DIR . '/admin/includes/class.export.snippet.php' );
137
+ require_once( WINP_PLUGIN_DIR . '/admin/includes/class.import.snippet.php' );
138
+ require_once( WINP_PLUGIN_DIR . '/admin/includes/class.notices.php' );
139
+
140
+ $this->registerTypes();
141
+ $this->registerPages();
142
+
143
+ new WINP_Filter_List();
144
+ new WINP_Export_Snippet();
145
+ new WINP_Import_Snippet();
146
+ new WINP_WarningNotices();
147
+ }
148
+
149
+ /**
150
+ * Register Gutenberg related scripts.
151
+ */
152
+ private function registerGutenberg() {
153
+ require_once( WINP_PLUGIN_DIR . '/admin/includes/class.gutenberg.snippet.php' );
154
+
155
+ new WINP_Gutenberg_Snippet();
156
+ }
157
+ }
158
+ }
includes/index.php CHANGED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
includes/shortcodes.php DELETED
@@ -1,68 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * A base shortcode for all lockers
5
- *
6
- * @since 1.0.0
7
- */
8
- class WINP_SnippetShortcode extends Wbcr_FactoryShortcodes324_Shortcode {
9
-
10
- public $shortcode_name = 'wbcr_php_snippet';
11
-
12
- /**
13
- * Includes assets
14
- * @var bool
15
- */
16
- public $assets_in_header = true;
17
-
18
- /**
19
- * Content render
20
- *
21
- * @param array $attr
22
- * @param string $content
23
- */
24
- public function html($attr, $content)
25
- {
26
- if( isset($attr['title']) ) {
27
- unset($attr['title']);
28
- }
29
-
30
- $attr = array_map('sanitize_title', $attr);
31
-
32
- // Let users pass arbitrary variables, through shortcode attributes.
33
- // @since 2.0.5
34
- extract($attr, EXTR_SKIP);
35
-
36
- $id = isset($attr['id'])
37
- ? (int)$attr['id']
38
- : null;
39
-
40
- if( !$id ) {
41
- echo '<span style="color:red">' . __('[wbcr_php_snippet]: PHP snippets error (not passed the snippet ID)', 'insert-php') . '</span>';
42
-
43
- return;
44
- }
45
-
46
- $snippet_meta = get_post_meta($id, '');
47
-
48
- if( empty($snippet_meta) ) {
49
- return;
50
- }
51
-
52
- $is_activate = isset($snippet_meta[$this->plugin->getPrefix() . 'snippet_activate']) && $snippet_meta[$this->plugin->getPrefix() . 'snippet_activate'][0];
53
-
54
- $snippet_code = isset($snippet_meta[$this->plugin->getPrefix() . 'snippet_code'])
55
- ? $snippet_meta[$this->plugin->getPrefix() . 'snippet_code']
56
- : null;
57
-
58
- $snippet_scope = isset($snippet_meta[$this->plugin->getPrefix() . 'snippet_scope'])
59
- ? $snippet_meta[$this->plugin->getPrefix() . 'snippet_scope'][0]
60
- : null;
61
-
62
- if( !$is_activate || empty($snippet_code) || $snippet_scope != 'shortcode' ) {
63
- return;
64
- }
65
-
66
- eval($snippet_code[0]);
67
- }
68
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/shortcodes/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
includes/shortcodes/shortcode-php.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Php Shortcode
5
+ */
6
+ class WINP_SnippetShortcodePhp extends WINP_SnippetShortcode {
7
+
8
+ public $shortcode_name = 'wbcr_php_snippet';
9
+
10
+ /**
11
+ * Content render
12
+ *
13
+ * @param array $attr
14
+ * @param string $content
15
+ */
16
+ public function html( $attr, $content ) {
17
+ $id = $this->getSnippetId( $attr, WINP_SNIPPET_TYPE_PHP );
18
+
19
+ if ( ! $id ) {
20
+ echo '<span style="color:red">' . __( '[wbcr_php_snippet]: PHP snippets error (not passed the snippet ID)', 'insert-php' ) . '</span>';
21
+
22
+ return;
23
+ }
24
+
25
+ $snippet_meta = get_post_meta( $id, '' );
26
+
27
+ if ( empty( $snippet_meta ) ) {
28
+ return;
29
+ }
30
+
31
+ $attr = $this->filterAttributes( $attr, $id );
32
+
33
+ // Let users pass arbitrary variables, through shortcode attributes.
34
+ // @since 2.0.5
35
+ extract( $attr, EXTR_SKIP );
36
+
37
+ $is_activate = $this->getSnippetActivate( $snippet_meta );
38
+ $snippet_scope = $this->getSnippetScope( $snippet_meta );
39
+ $snippet_content = $this->getSnippetContent( $snippet_meta, $id );
40
+
41
+ if ( ! $is_activate || empty( $snippet_content ) || $snippet_scope != 'shortcode' || WINP_Helper::is_safe_mode() ) {
42
+ return;
43
+ }
44
+
45
+ eval( $snippet_content );
46
+ }
47
+
48
+ }
includes/shortcodes/shortcode-text.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Text Shortcode
5
+ */
6
+ class WINP_SnippetShortcodeText extends WINP_SnippetShortcode {
7
+
8
+ public $shortcode_name = 'wbcr_text_snippet';
9
+
10
+ /**
11
+ * Content render
12
+ *
13
+ * @param array $attr
14
+ * @param string $content
15
+ */
16
+ public function html($attr, $content)
17
+ {
18
+ $id = $this->getSnippetId( $attr, WINP_SNIPPET_TYPE_TEXT );
19
+
20
+ if( !$id ) {
21
+ echo '<span style="color:red">' . __('[wbcr_text_snippet]: PHP snippets error (not passed the snippet ID)', 'insert-php') . '</span>';
22
+
23
+ return;
24
+ }
25
+
26
+ $snippet_meta = get_post_meta($id, '');
27
+ if( empty($snippet_meta) ) {
28
+ return;
29
+ }
30
+
31
+ $is_activate = $this->getSnippetActivate( $snippet_meta );
32
+ $snippet_content = get_post($id)->post_content;
33
+ $snippet_scope = $this->getSnippetScope( $snippet_meta );
34
+ $is_condition = WINP_Plugin::app()->getExecuteObject()->checkCondition($id);
35
+
36
+ if( !$is_activate || empty($snippet_content) || $snippet_scope != 'shortcode' || !$is_condition ) {
37
+ return;
38
+ }
39
+
40
+ $code = do_shortcode($snippet_content);
41
+ $code = str_replace( '{{SNIPPET_CONTENT}}', $content, $code );
42
+ echo( $code );
43
+ }
44
+
45
+ }
includes/shortcodes/shortcode-universal.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Universal Shortcode
5
+ */
6
+ class WINP_SnippetShortcodeUniversal extends WINP_SnippetShortcode {
7
+
8
+ public $shortcode_name = 'wbcr_snippet';
9
+
10
+ /**
11
+ * Content render
12
+ *
13
+ * @param array $attr
14
+ * @param string $content
15
+ */
16
+ public function html( $attr, $content ) {
17
+ $id = $this->getSnippetId( $attr, WINP_SNIPPET_TYPE_UNIVERSAL );
18
+
19
+ if ( ! $id ) {
20
+ echo '<span style="color:red">' . __( '[wbcr_snippet]: PHP snippets error (not passed the snippet ID)', 'insert-php' ) . '</span>';
21
+
22
+ return;
23
+ }
24
+
25
+ $snippet_meta = get_post_meta( $id, '' );
26
+ if ( empty( $snippet_meta ) ) {
27
+ return;
28
+ }
29
+
30
+ $attr = $this->filterAttributes( $attr, $id );
31
+
32
+ // Let users pass arbitrary variables, through shortcode attributes.
33
+ // @since 2.0.5
34
+ extract( $attr, EXTR_SKIP );
35
+
36
+ $is_activate = $this->getSnippetActivate( $snippet_meta );
37
+ $snippet_content = $this->getSnippetContent( $snippet_meta, $id );
38
+ $snippet_scope = $this->getSnippetScope( $snippet_meta );
39
+ $is_condition = WINP_Plugin::app()->getExecuteObject()->checkCondition( $id );
40
+
41
+ if ( ! $is_activate || empty( $snippet_content ) || $snippet_scope != 'shortcode' || ! $is_condition || WINP_Helper::is_safe_mode() ) {
42
+ return;
43
+ }
44
+
45
+ eval( "?> " . $snippet_content . " <?php " );
46
+ }
47
+
48
+ }
includes/shortcodes/shortcodes.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * A base shortcode for all lockers
5
+ *
6
+ * @since 1.0.0
7
+ */
8
+ class WINP_SnippetShortcode extends Wbcr_FactoryShortcodes325_Shortcode {
9
+
10
+ public $shortcode_name = 'wbcr_php_snippet';
11
+
12
+ /**
13
+ * Includes assets
14
+ * @var bool
15
+ */
16
+ public $assets_in_header = true;
17
+
18
+ /**
19
+ * Filter attributes
20
+ *
21
+ * @param $attr
22
+ * @param $post_id
23
+ *
24
+ * @return mixed
25
+ */
26
+ public function filterAttributes( $attr, $post_id ) {
27
+ if ( ! empty( $attr ) ) {
28
+ $available_tags = WINP_Helper::getMetaOption( $post_id, 'snippet_tags', null );
29
+
30
+ if ( ! empty( $available_tags ) ) {
31
+ $available_tags = explode( ',', $available_tags );
32
+ $available_tags = array_map( 'trim', $available_tags );
33
+ }
34
+
35
+ foreach ( $attr as $name => $value ) {
36
+ $is_allow_attr = in_array( $name, array( 'id', 'title' ) );
37
+ $validate_name = preg_match( '/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/', $name );
38
+
39
+ if ( ! $is_allow_attr && ( ( ! empty( $available_tags ) && ! in_array( $name, $available_tags ) ) || ! $validate_name ) ) {
40
+ unset( $attr[ $name ] );
41
+ } else {
42
+ // issue PCS-1
43
+ // before sending the value to the shortcode, using encodeURIComponent(val).replace(/\./g, ‘%2E’); fixes the issue. Will the next update stop this from working?
44
+ $value = urldecode( $value );
45
+
46
+ // Remove script tag
47
+ $value = preg_replace( '#<script(.*?)>(.*?)</script>#is', '', $value );
48
+
49
+ // Remove any attribute starting with "on" or xmlns
50
+ $value = preg_replace( '#(<[^>]+?[\x00-\x20"\'])(?:on|xmlns)[^>]*+>#iu', '$1>', $value );
51
+
52
+ // Remove javascript: and vbscript: protocols
53
+ $value = preg_replace( '#([a-z]*)[\x00-\x20]*=[\x00-\x20]*([`\'"]*)[\x00-\x20]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iu', '$1=$2nojavascript...', $value );
54
+ $value = preg_replace( '#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iu', '$1=$2novbscript...', $value );
55
+ $value = preg_replace( '#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*-moz-binding[\x00-\x20]*:#u', '$1=$2nomozbinding...', $value );
56
+
57
+ // Filter value
58
+ $value = filter_var( $value, FILTER_SANITIZE_SPECIAL_CHARS );
59
+ $attr[ $name ] = filter_var( $value, FILTER_SANITIZE_MAGIC_QUOTES );
60
+ }
61
+ }
62
+ }
63
+
64
+ return $attr;
65
+ }
66
+
67
+ /**
68
+ * Get snippet id
69
+ *
70
+ * @param $attr
71
+ * @param $type
72
+ *
73
+ * @return int|null
74
+ */
75
+ public function getSnippetId( $attr, $type ) {
76
+ $id = isset( $attr['id'] ) ? (int) $attr['id'] : null;
77
+ if ( $id && $type != WINP_Helper::get_snippet_type( $id ) ) {
78
+ $id = 0;
79
+ }
80
+
81
+ return $id;
82
+ }
83
+
84
+ /**
85
+ * Get snippet activate
86
+ *
87
+ * @param $snippet_meta
88
+ *
89
+ * @return bool
90
+ */
91
+ public function getSnippetActivate( $snippet_meta ) {
92
+ return isset( $snippet_meta[ $this->plugin->getPrefix() . 'snippet_activate' ] ) && $snippet_meta[ $this->plugin->getPrefix() . 'snippet_activate' ][0];
93
+ }
94
+
95
+ /**
96
+ * Get snippet scope
97
+ *
98
+ * @param $snippet_meta
99
+ *
100
+ * @return null
101
+ */
102
+ public function getSnippetScope( $snippet_meta ) {
103
+ return isset( $snippet_meta[ $this->plugin->getPrefix() . 'snippet_scope' ] ) ? $snippet_meta[ $this->plugin->getPrefix() . 'snippet_scope' ][0] : null;
104
+ }
105
+
106
+ /**
107
+ * Get snippet content
108
+ *
109
+ * @param $snippet_meta
110
+ * @param $id
111
+ *
112
+ * @return null|string
113
+ */
114
+ public function getSnippetContent( $snippet_meta, $id ) {
115
+ return isset( $snippet_meta[ $this->plugin->getPrefix() . 'snippet_code' ] ) ? WINP_Plugin::app()->getExecuteObject()->prepareCode( $snippet_meta[ $this->plugin->getPrefix() . 'snippet_code' ][0], $id ) : null;
116
+ }
117
+
118
+ /**
119
+ * Content render
120
+ *
121
+ * @param array $attr
122
+ * @param string $content
123
+ */
124
+ public function html( $attr, $content ) {
125
+
126
+ }
127
+
128
+ }
index.php CHANGED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
insert_php.php CHANGED
@@ -1,100 +1,137 @@
1
  <?php
2
- /**
3
- * Plugin Name: PHP code snippets (Insert PHP)
4
- * Plugin URI: https://wordpress.org/plugins/insert-php/
5
- * Description: Run PHP code inserted into WordPress posts and pages. An easy, clean and easy way to add code snippets to your site. You do not need to edit the functions.php file of your theme again!
6
- * Author: Will Bontrager Software, LLC <will@willmaster.com>, Webcraftic <wordpress.webraftic@gmail.com>
7
- * Version: 2.0.6
8
- * Text Domain: insert-php
9
- * Domain Path: /languages/
10
- * Author URI: http://www.willmaster.com/contact.php
11
- */
12
-
13
- // Exit if accessed directly
14
- if( !defined('ABSPATH') ) {
15
- exit;
16
- }
17
-
18
- if( defined('WINP_PLUGIN_ACTIVE') ) {
19
- return;
20
- }
21
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  // Set the constant that the plugin is activated
23
- define('WINP_PLUGIN_ACTIVE', true);
24
-
 
 
25
  // Root directory of the plugin
26
- define('WINP_PLUGIN_DIR', dirname(__FILE__));
27
 
28
  // Absolute url of the root directory of the plugin
29
- define('WINP_PLUGIN_URL', plugins_url(null, __FILE__));
30
-
31
  // Relative url of the plugin
32
- define('WINP_PLUGIN_BASE', plugin_basename(__FILE__));
33
 
34
  // The type of posts used for snippets types
35
- define('WINP_SNIPPETS_POST_TYPE', 'wbcr-snippets');
36
-
37
  // The taxonomy used for snippets types
38
- define('WINP_SNIPPETS_TAXONOMY', 'wbcr-snippet-tags');
39
-
40
 
41
-
42
- global $wp_version;
43
-
44
- // Troubleshoot old versions of WordPress
45
- if( version_compare($wp_version, '4.2.0', '>') ) {
46
-
47
- require_once(WINP_PLUGIN_DIR . '/libs/factory/core/boot.php');
48
-
49
- require_once(WINP_PLUGIN_DIR . '/includes/class.helpers.php');
50
- require_once(WINP_PLUGIN_DIR . '/includes/class.plugin.php');
51
-
52
- new WINP_Plugin(__FILE__, array(
53
- 'prefix' => 'wbcr_inp_',
54
- 'plugin_name' => 'wbcr_insert_php',
55
- 'plugin_title' => __('PHP code snippets (Insert PHP)', 'insert-php'),
56
- 'plugin_version' => '2.0.6',
57
- 'required_php_version' => '5.2',
58
- 'required_wp_version' => '4.2',
59
- 'plugin_build' => 'free',
60
- //'updates' => WINP_PLUGIN_DIR . '/updates/'
61
- ));
62
- } else {
63
- // Notification about the old version of Wordpress
64
- add_action('admin_notices', function () {
65
- echo '<div class="notice notice-error"><p>' . __('You are using the old version of Wordpress, for the <b>PHP code snippets (Insert PHP)</b> plugin you need Wordpress 4.2 and higher versions!', 'insert-php') . '</p></div>';
66
- });
 
 
 
 
67
  }
 
68
 
69
- /*
70
- Note: This plugin requires WordPress version 3.3.1 or higher.
71
-
72
- Information about the Insert PHP plugin can be found here:
73
- http://www.willmaster.com/software/WPplugins/go/iphphome_iphplugin
74
 
75
- Instructions and examples can be found here:
76
- http://www.willmaster.com/software/WPplugins/go/iphpinstructions_iphplugin
77
- */
78
 
79
- // todo: This is the code of the old version of the plugin, left unchanged for compatibility. Delete in the new major version of the plugin
80
- if( !function_exists('will_bontrager_insert_php') ) {
 
81
 
82
- function will_bontrager_insert_php($content)
83
- {
84
- $will_bontrager_content = $content;
85
- preg_match_all('!\[insert_php[^\]]*\](.*?)\[/insert_php[^\]]*\]!is', $will_bontrager_content, $will_bontrager_matches);
86
- $will_bontrager_nummatches = count($will_bontrager_matches[0]);
87
- for($will_bontrager_i = 0; $will_bontrager_i < $will_bontrager_nummatches; $will_bontrager_i++) {
88
- ob_start();
89
- eval($will_bontrager_matches[1][$will_bontrager_i]);
90
- $will_bontrager_replacement = ob_get_contents();
91
- ob_clean();
92
- ob_end_flush();
93
- $will_bontrager_content = preg_replace('/' . preg_quote($will_bontrager_matches[0][$will_bontrager_i], '/') . '/', $will_bontrager_replacement, $will_bontrager_content, 1);
94
- }
95
-
96
- return $will_bontrager_content;
97
- } # function will_bontrager_insert_php()
 
 
 
 
 
 
 
 
 
 
98
 
99
- add_filter('the_content', 'will_bontrager_insert_php', 9);
100
- } # if( ! function_exists('will_bontrager_insert_php') )
1
  <?php
2
+ /**
3
+ * Plugin Name: Woody ad snippets (PHP snippets | Insert PHP)
4
+ * Plugin URI: http://woody-ad-snippets.webcraftic.com/
5
+ * Description: Executes PHP code, uses conditional logic to insert ads, text, media content and external service’s code. Ensures no content duplication.
6
+ * Author: Will Bontrager Software, LLC <will@willmaster.com>, Webcraftic <wordpress.webraftic@gmail.com>
7
+ * Version: 2.1.91
8
+ * Text Domain: insert-php
9
+ * Domain Path: /languages/
10
+ * Author URI: http://woody-ad-snippets.webcraftic.com/
11
+ */
12
+
13
+ // Exit if accessed directly
14
+ if ( ! defined( 'ABSPATH' ) ) {
15
+ exit;
16
+ }
17
+
18
+
19
+
20
+ require_once( dirname( __FILE__ ) . '/libs/factory/core/includes/class.requirements.php' );
21
+
22
+ $wbcr_inp_plugin_info = array(
23
+ 'prefix' => 'wbcr_inp_',
24
+ 'plugin_name' => 'wbcr_insert_php',
25
+ 'plugin_title' => __( 'Woody ad snippets', 'insert-php' ),
26
+ 'plugin_build' => 'free',
27
+ 'updates' => dirname( __FILE__ ) . '/migrations/'
28
+ );
29
+
30
+ /**
31
+ * Checks compatibility with Wordpress, php and other plugins.
32
+ */
33
+ $wbcr_inp_plugin_requirements = new Wbcr_Factory410_Requirements( __FILE__, array_merge( $wbcr_inp_plugin_info, array(
34
+ 'plugin_last_version' => '2.0.6',
35
+ 'plugin_already_activate' => defined( 'WINP_PLUGIN_ACTIVE' ),
36
+ 'required_php_version' => '5.2',
37
+ 'required_wp_version' => '4.2.0'
38
+ ) ) );
39
+
40
+ /**
41
+ * If the plugin is compatible, it will continue its work, otherwise it will be stopped and the user will receive a warning.
42
+ */
43
+ if ( $wbcr_inp_plugin_requirements->check() ) {
44
+ global $wbcr_inp_safe_mode;
45
+
46
+ $wbcr_inp_safe_mode = false;
47
+
48
  // Set the constant that the plugin is activated
49
+ define( 'WINP_PLUGIN_ACTIVE', true );
50
+
51
+ define( 'WINP_PLUGIN_VERSION', $wbcr_inp_plugin_requirements->getPluginVersion() );
52
+
53
  // Root directory of the plugin
54
+ define( 'WINP_PLUGIN_DIR', dirname( __FILE__ ) );
55
 
56
  // Absolute url of the root directory of the plugin
57
+ define( 'WINP_PLUGIN_URL', plugins_url( null, __FILE__ ) );
58
+
59
  // Relative url of the plugin
60
+ define( 'WINP_PLUGIN_BASE', plugin_basename( __FILE__ ) );
61
 
62
  // The type of posts used for snippets types
63
+ define( 'WINP_SNIPPETS_POST_TYPE', 'wbcr-snippets' );
64
+
65
  // The taxonomy used for snippets types
66
+ define( 'WINP_SNIPPETS_TAXONOMY', 'wbcr-snippet-tags' );
 
67
 
68
+ // The snippets types
69
+ define( 'WINP_SNIPPET_TYPE_PHP', 'php' );
70
+ define( 'WINP_SNIPPET_TYPE_TEXT', 'text' );
71
+ define( 'WINP_SNIPPET_TYPE_UNIVERSAL', 'universal' );
72
+
73
+ // The snippet automatic insertion locations
74
+ define( 'WINP_SNIPPET_AUTO_HEADER', 'header' );
75
+ define( 'WINP_SNIPPET_AUTO_FOOTER', 'footer' );
76
+ define( 'WINP_SNIPPET_AUTO_BEFORE_POST', 'before_post' );
77
+ define( 'WINP_SNIPPET_AUTO_BEFORE_CONTENT', 'before_content' );
78
+ define( 'WINP_SNIPPET_AUTO_BEFORE_PARAGRAPH', 'before_paragraph' );
79
+ define( 'WINP_SNIPPET_AUTO_AFTER_PARAGRAPH', 'after_paragraph' );
80
+ define( 'WINP_SNIPPET_AUTO_AFTER_CONTENT', 'after_content' );
81
+ define( 'WINP_SNIPPET_AUTO_AFTER_POST', 'after_post' );
82
+ define( 'WINP_SNIPPET_AUTO_BEFORE_EXCERPT', 'before_excerpt' );
83
+ define( 'WINP_SNIPPET_AUTO_AFTER_EXCERPT', 'after_excerpt' );
84
+ define( 'WINP_SNIPPET_AUTO_BETWEEN_POSTS', 'between_posts' );
85
+ define( 'WINP_SNIPPET_AUTO_BEFORE_POSTS', 'before_posts' );
86
+ define( 'WINP_SNIPPET_AUTO_AFTER_POSTS', 'after_posts' );
87
+
88
+ require_once( WINP_PLUGIN_DIR . '/libs/factory/core/boot.php' );
89
+ require_once( WINP_PLUGIN_DIR . '/includes/class.helpers.php' );
90
+ require_once( WINP_PLUGIN_DIR . '/includes/class.plugin.php' );
91
+
92
+ try {
93
+ new WINP_Plugin( __FILE__, array_merge( $wbcr_inp_plugin_info, array(
94
+ 'plugin_version' => WINP_PLUGIN_VERSION
95
+ ) ) );
96
+ } catch( Exception $exception ) {
97
+ throw new Exception( $exception->getMessage() );
98
  }
99
+ }
100
 
101
+ /*
102
+ Note: This plugin requires WordPress version 3.3.1 or higher.
 
 
 
103
 
104
+ Information about the Insert PHP plugin can be found here:
105
+ http://www.willmaster.com/software/WPplugins/go/iphphome_iphplugin
 
106
 
107
+ Instructions and examples can be found here:
108
+ http://www.willmaster.com/software/WPplugins/go/iphpinstructions_iphplugin
109
+ */
110
 
111
+ // todo: This is the code of the old version of the plugin, left unchanged for compatibility. Delete in the new major version of the plugin
112
+ if ( ! function_exists( 'will_bontrager_insert_php' ) ) {
113
+
114
+ function will_bontrager_insert_php( $content ) {
115
+
116
+ if ( WINP_Helper::is_safe_mode() ) {
117
+ return $content;
118
+ }
119
+
120
+ $will_bontrager_content = $content;
121
+ preg_match_all( '!\[insert_php[^\]]*\](.*?)\[/insert_php[^\]]*\]!is', $will_bontrager_content, $will_bontrager_matches );
122
+ $will_bontrager_nummatches = count( $will_bontrager_matches[0] );
123
+ for ( $will_bontrager_i = 0; $will_bontrager_i < $will_bontrager_nummatches; $will_bontrager_i ++ ) {
124
+ ob_start();
125
+ eval( $will_bontrager_matches[1][ $will_bontrager_i ] );
126
+ $will_bontrager_replacement = ob_get_contents();
127
+ ob_clean();
128
+ ob_end_flush();
129
+ $will_bontrager_content = preg_replace( '/' . preg_quote( $will_bontrager_matches[0][ $will_bontrager_i ], '/' ) . '/', $will_bontrager_replacement, $will_bontrager_content, 1 );
130
+ }
131
+
132
+ return $will_bontrager_content;
133
+ } # function will_bontrager_insert_php()
134
+
135
+ add_filter( 'the_content', 'will_bontrager_insert_php', 9 );
136
+ } # if( ! function_exists('will_bontrager_insert_php') )
137
 
 
 
languages/index.php CHANGED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
libs/factory/bootstrap/assets/css-min/bootstrap.accordion.min.css CHANGED
@@ -8,4 +8,4 @@
8
  */
9
 
10
 
11
- .factory-bootstrap-404 .factory-accordion{margin:0 0 30px;border-top:1px solid #DDD;border-right:1px solid #DDD;border-left:1px solid #DDD;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.factory-bootstrap-404 .factory-accordion>h3{border-bottom:1px solid #DDD;cursor:pointer;padding:8px 15px;margin:0}.factory-bootstrap-404 .factory-accordion>div{display:none;margin:0;border-bottom:1px solid #DDD}.factory-bootstrap-404 .factory-accordion-item{display:none}.factory-bootstrap-404 .inner-factory-accordion-item{padding:10px 0}.factory-bootstrap-404 .factory-accordion>h3.active:hover{cursor:default}
8
  */
9
 
10
 
11
+ .factory-bootstrap-410 .factory-accordion{margin:0 0 30px;border-top:1px solid #DDD;border-right:1px solid #DDD;border-left:1px solid #DDD;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.factory-bootstrap-410 .factory-accordion>h3{border-bottom:1px solid #DDD;cursor:pointer;padding:8px 15px;margin:0}.factory-bootstrap-410 .factory-accordion>div{display:none;margin:0;border-bottom:1px solid #DDD}.factory-bootstrap-410 .factory-accordion-item{display:none}.factory-bootstrap-410 .inner-factory-accordion-item{padding:10px 0}.factory-bootstrap-410 .factory-accordion>h3.active:hover{cursor:default}
libs/factory/bootstrap/assets/css-min/bootstrap.blue.min.css CHANGED
@@ -8,4 +8,4 @@
8
  */
9
 
10
 
11
- .factory-bootstrap-404 .btn-primary{background:#e1a948;border-color:#d39323;color:#fff;-webkit-box-shadow:inset 0 1px 0 #ecc88a,0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 #ecc88a,0 1px 0 rgba(0,0,0,.15)}.factory-bootstrap-404 .btn-primary:focus,.factory-bootstrap-404 .btn-primary:hover{background:#db9825;border-color:#bd831f;color:#fff;-webkit-box-shadow:inset 0 1px 0 #e8be74,0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 #e8be74,0 1px 0 rgba(0,0,0,.15)}.factory-bootstrap-404 .btn-primary:active{background:#db9825;border-color:#bd831f;color:#fff;-webkit-box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.5);box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.5)}.factory-bootstrap-404 .btn-primary:disabled,.factory-bootstrap-404 .btn-primary[disabled]{color:#d1cdc7!important;background:#db9825!important;border-color:#bd831f!important;text-shadow:none!important}.factory-bootstrap-404 .btn-group .btn.active.value{background-color:#e1a948;-webkit-box-shadow:inset 0 1px 2px #d39323;box-shadow:inset 0 1px 2px #d39323;border-top:1px solid #d39323;border-bottom:1px solid #d39323;border-left:1px solid #d39323}.factory-bootstrap-404 .pagination>.active>a,.factory-bootstrap-404 .pagination>.active>a:focus,.factory-bootstrap-404 .pagination>.active>a:hover,.factory-bootstrap-404 .pagination>.active>span,.factory-bootstrap-404 .pagination>.active>span:focus,.factory-bootstrap-404 .pagination>.active>span:hover{background-color:#e1a948;border-color:#d39323}
8
  */
9
 
10
 
11
+ .factory-bootstrap-410 .btn-primary{background:#e1a948;border-color:#d39323;color:#fff;-webkit-box-shadow:inset 0 1px 0 #ecc88a,0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 #ecc88a,0 1px 0 rgba(0,0,0,.15)}.factory-bootstrap-410 .btn-primary:focus,.factory-bootstrap-410 .btn-primary:hover{background:#db9825;border-color:#bd831f;color:#fff;-webkit-box-shadow:inset 0 1px 0 #e8be74,0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 #e8be74,0 1px 0 rgba(0,0,0,.15)}.factory-bootstrap-410 .btn-primary:active{background:#db9825;border-color:#bd831f;color:#fff;-webkit-box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.5);box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.5)}.factory-bootstrap-410 .btn-primary:disabled,.factory-bootstrap-410 .btn-primary[disabled]{color:#d1cdc7!important;background:#db9825!important;border-color:#bd831f!important;text-shadow:none!important}.factory-bootstrap-410 .btn-group .btn.active.value{background-color:#e1a948;-webkit-box-shadow:inset 0 1px 2px #d39323;box-shadow:inset 0 1px 2px #d39323;border-top:1px solid #d39323;border-bottom:1px solid #d39323;border-left:1px solid #d39323}.factory-bootstrap-410 .pagination>.active>a,.factory-bootstrap-410 .pagination>.active>a:focus,.factory-bootstrap-410 .pagination>.active>a:hover,.factory-bootstrap-410 .pagination>.active>span,.factory-bootstrap-410 .pagination>.active>span:focus,.factory-bootstrap-410 .pagination>.active>span:hover{background-color:#e1a948;border-color:#d39323}
libs/factory/bootstrap/assets/css-min/bootstrap.coffee.min.css CHANGED
@@ -8,4 +8,4 @@
8
  */
9
 
10
 
11
- .factory-bootstrap-404 .btn-primary{background:#c7a589;border-color:#b78a66;color:#fff;-webkit-box-shadow:inset 0 1px 0 #e0cdbd,0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 #e0cdbd,0 1px 0 rgba(0,0,0,.15)}.factory-bootstrap-404 .btn-primary:focus,.factory-bootstrap-404 .btn-primary:hover{background:#ba906d;border-color:#ae7d55;color:#fff;-webkit-box-shadow:inset 0 1px 0 #d7bfac,0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 #d7bfac,0 1px 0 rgba(0,0,0,.15)}.factory-bootstrap-404 .btn-primary:active{background:#ba906d;border-color:#ae7d55;color:#fff;-webkit-box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.5);box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.5)}.factory-bootstrap-404 .btn-primary:disabled,.factory-bootstrap-404 .btn-primary[disabled]{color:#d1cbc7!important;background:#ba906d!important;border-color:#ae7d55!important;text-shadow:none!important}.factory-bootstrap-404 .btn-group .btn.active.value{background-color:#c7a589;-webkit-box-shadow:inset 0 1px 2px #b78a66;box-shadow:inset 0 1px 2px #b78a66;border-top:1px solid #b78a66;border-bottom:1px solid #b78a66;border-left:1px solid #b78a66}.factory-bootstrap-404 .pagination>.active>a,.factory-bootstrap-404 .pagination>.active>a:focus,.factory-bootstrap-404 .pagination>.active>a:hover,.factory-bootstrap-404 .pagination>.active>span,.factory-bootstrap-404 .pagination>.active>span:focus,.factory-bootstrap-404 .pagination>.active>span:hover{background-color:#c7a589;border-color:#b78a66}
8
  */
9
 
10
 
11
+ .factory-bootstrap-410 .btn-primary{background:#c7a589;border-color:#b78a66;color:#fff;-webkit-box-shadow:inset 0 1px 0 #e0cdbd,0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 #e0cdbd,0 1px 0 rgba(0,0,0,.15)}.factory-bootstrap-410 .btn-primary:focus,.factory-bootstrap-410 .btn-primary:hover{background:#ba906d;border-color:#ae7d55;color:#fff;-webkit-box-shadow:inset 0 1px 0 #d7bfac,0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 #d7bfac,0 1px 0 rgba(0,0,0,.15)}.factory-bootstrap-410 .btn-primary:active{background:#ba906d;border-color:#ae7d55;color:#fff;-webkit-box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.5);box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.5)}.factory-bootstrap-410 .btn-primary:disabled,.factory-bootstrap-410 .btn-primary[disabled]{color:#d1cbc7!important;background:#ba906d!important;border-color:#ae7d55!important;text-shadow:none!important}.factory-bootstrap-410 .btn-group .btn.active.value{background-color:#c7a589;-webkit-box-shadow:inset 0 1px 2px #b78a66;box-shadow:inset 0 1px 2px #b78a66;border-top:1px solid #b78a66;border-bottom:1px solid #b78a66;border-left:1px solid #b78a66}.factory-bootstrap-410 .pagination>.active>a,.factory-bootstrap-410 .pagination>.active>a:focus,.factory-bootstrap-410 .pagination>.active>a:hover,.factory-bootstrap-410 .pagination>.active>span,.factory-bootstrap-410 .pagination>.active>span:focus,.factory-bootstrap-410 .pagination>.active>span:hover{background-color:#c7a589;border-color:#b78a66}
libs/factory/bootstrap/assets/css-min/bootstrap.core.min.css CHANGED
@@ -8,7 +8,7 @@
8
  */
9
 
10
 
11
- .factory-bootstrap-404 article,.factory-bootstrap-404 aside,.factory-bootstrap-404 details,.factory-bootstrap-404 figcaption,.factory-bootstrap-404 figure,.factory-bootstrap-404 footer,.factory-bootstrap-404 header,.factory-bootstrap-404 hgroup,.factory-bootstrap-404 main,.factory-bootstrap-404 nav,.factory-bootstrap-404 section,.factory-bootstrap-404 summary{display:block}.factory-bootstrap-404 audio,.factory-bootstrap-404 canvas,.factory-bootstrap-404 video{display:inline-block}.factory-bootstrap-404 audio:not([controls]){display:none;height:0}.factory-bootstrap-404 [hidden],.factory-bootstrap-404 template{display:none}.factory-bootstrap-404 body{margin:0}.factory-bootstrap-404 a{background:0 0}.factory-bootstrap-404 a:focus{outline:thin dotted}.factory-bootstrap-404 a:active,.factory-bootstrap-404 a:hover{outline:0}.factory-bootstrap-404 h1{margin:.67em 0}.factory-bootstrap-404 b,.factory-bootstrap-404 strong{font-weight:700}.factory-bootstrap-404 dfn{font-style:italic}.factory-bootstrap-404 hr{height:0;-moz-box-sizing:content-box;box-sizing:content-box}.factory-bootstrap-404 mark{color:#000;background:#ff0}.factory-bootstrap-404 code,.factory-bootstrap-404 kbd,.factory-bootstrap-404 pre,.factory-bootstrap-404 samp{font-size:1em}.factory-bootstrap-404 pre{white-space:pre-wrap}.factory-bootstrap-404 q{quotes:"\201C" "\201D" "\2018" "\2019"}.factory-bootstrap-404 sub,.factory-bootstrap-404 sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}.factory-bootstrap-404 sup{top:-.5em}.factory-bootstrap-404 sub{bottom:-.25em}.factory-bootstrap-404 img{border:0}.factory-bootstrap-404 svg:not(:root){overflow:hidden}.factory-bootstrap-404 figure{margin:0}.factory-bootstrap-404 button,.factory-bootstrap-404 input,.factory-bootstrap-404 select,.factory-bootstrap-404 textarea{margin:0}.factory-bootstrap-404 button,.factory-bootstrap-404 select{text-transform:none}.factory-bootstrap-404 select{padding-right:4px!important}.factory-bootstrap-404 button,.factory-bootstrap-404 input[type=reset],.factory-bootstrap-404 input[type=submit],html .factory-bootstrap-404 input[type=button]{cursor:pointer;-webkit-appearance:button}.factory-bootstrap-404 button[disabled],html .factory-bootstrap-404 input[disabled]{cursor:default}.factory-bootstrap-404 input[type=checkbox],.factory-bootstrap-404 input[type=radio]{padding:0;box-sizing:border-box}.factory-bootstrap-404 input[type=search]{-webkit-appearance:textfield}.factory-bootstrap-404 input[type=search]::-webkit-search-cancel-button,.factory-bootstrap-404 input[type=search]::-webkit-search-decoration{-webkit-appearance:none}.factory-bootstrap-404 button::-moz-focus-inner,.factory-bootstrap-404 input::-moz-focus-inner{padding:0;border:0}.factory-bootstrap-404 textarea{overflow:auto;vertical-align:top}.factory-bootstrap-404 table{border-collapse:collapse;border-spacing:0}@media print{.factory-bootstrap-404 *{color:#000!important;text-shadow:none!important;background:transparent!important;box-shadow:none!important}.factory-bootstrap-404 a,.factory-bootstrap-404 a:visited{text-decoration:underline}.factory-bootstrap-404 a[href]:after{content:" (" attr(href) ")"}.factory-bootstrap-404 abbr[title]:after{content:" (" attr(title) ")"}.factory-bootstrap-404 a[href^="javascript:"]:after,.factory-bootstrap-404 a[href^="#"]:after{content:""}.factory-bootstrap-404 blockquote,.factory-bootstrap-404 pre{border:1px solid #999;page-break-inside:avoid}.factory-bootstrap-404 thead{display:table-header-group}.factory-bootstrap-404 img,.factory-bootstrap-404 tr{page-break-inside:avoid}.factory-bootstrap-404 img{max-width:100%!important}@page{margin:2cm .5cm}.factory-bootstrap-404 h2,.factory-bootstrap-404 h3,.factory-bootstrap-404 p{orphans:3;widows:3}.factory-bootstrap-404 h2,.factory-bootstrap-404 h3{page-break-after:avoid}.factory-bootstrap-404 select{background:#fff!important}.factory-bootstrap-404 .navbar{display:none}.factory-bootstrap-404 .table td,.factory-bootstrap-404 .table th{background-color:#fff!important}.factory-bootstrap-404 .btn>.caret,.factory-bootstrap-404 .dropup>.btn>.caret{border-top-color:#000!important}.factory-bootstrap-404 .label{border:1px solid #000}.factory-bootstrap-404 .table{border-collapse:collapse!important}.factory-bootstrap-404 .table-bordered td,.factory-bootstrap-404 .table-bordered th{border:1px solid #ddd!important}}.factory-bootstrap-404 *,.factory-bootstrap-404 :after,.factory-bootstrap-404 :before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html .factory-bootstrap-404{-webkit-tap-highlight-color:rgba(0,0,0,0)}.factory-bootstrap-404 body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.428571429;color:#333;background-color:#fff}.factory-bootstrap-404 button,.factory-bootstrap-404 input,.factory-bootstrap-404 select,.factory-bootstrap-404 textarea{font-family:inherit;font-size:inherit;line-height:inherit}.factory-bootstrap-404 img{vertical-align:middle}.factory-bootstrap-404 .img-responsive{display:block;height:auto;max-width:100%}.factory-bootstrap-404 .img-rounded{border-radius:6px}.factory-bootstrap-404 .img-thumbnail{display:inline-block;height:auto;max-width:100%;padding:4px;line-height:1.428571429;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.factory-bootstrap-404 .img-circle{border-radius:50%}.factory-bootstrap-404 hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.factory-bootstrap-404 .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.factory-bootstrap-404 .h1,.factory-bootstrap-404 .h2,.factory-bootstrap-404 .h3,.factory-bootstrap-404 .h4,.factory-bootstrap-404 .h5,.factory-bootstrap-404 .h6,.factory-bootstrap-404 h1,.factory-bootstrap-404 h2,.factory-bootstrap-404 h3,.factory-bootstrap-404 h4,.factory-bootstrap-404 h5,.factory-bootstrap-404 h6{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:500;line-height:1.1;color:inherit}.factory-bootstrap-404 .h1 .small,.factory-bootstrap-404 .h1 small,.factory-bootstrap-404 .h2 .small,.factory-bootstrap-404 .h2 small,.factory-bootstrap-404 .h3 .small,.factory-bootstrap-404 .h3 small,.factory-bootstrap-404 .h4 .small,.factory-bootstrap-404 .h4 small,.factory-bootstrap-404 .h5 .small,.factory-bootstrap-404 .h5 small,.factory-bootstrap-404 .h6 .small,.factory-bootstrap-404 .h6 small,.factory-bootstrap-404 h1 .small,.factory-bootstrap-404 h1 small,.factory-bootstrap-404 h2 .small,.factory-bootstrap-404 h2 small,.factory-bootstrap-404 h3 .small,.factory-bootstrap-404 h3 small,.factory-bootstrap-404 h4 .small,.factory-bootstrap-404 h4 small,.factory-bootstrap-404 h5 .small,.factory-bootstrap-404 h5 small,.factory-bootstrap-404 h6 .small,.factory-bootstrap-404 h6 small{font-weight:400;line-height:1;color:#999}.factory-bootstrap-404 h1,.factory-bootstrap-404 h2,.factory-bootstrap-404 h3{margin-top:20px;margin-bottom:10px}.factory-bootstrap-404 h1 .small,.factory-bootstrap-404 h1 small,.factory-bootstrap-404 h2 .small,.factory-bootstrap-404 h2 small,.factory-bootstrap-404 h3 .small,.factory-bootstrap-404 h3 small{font-size:65%}.factory-bootstrap-404 h4,.factory-bootstrap-404 h5,.factory-bootstrap-404 h6{margin-top:10px;margin-bottom:10px}.factory-bootstrap-404 h4 .small,.factory-bootstrap-404 h4 small,.factory-bootstrap-404 h5 .small,.factory-bootstrap-404 h5 small,.factory-bootstrap-404 h6 .small,.factory-bootstrap-404 h6 small{font-size:75%}.factory-bootstrap-404 .h1,.factory-bootstrap-404 h1{font-size:36px}.factory-bootstrap-404 .h2,.factory-bootstrap-404 h2{font-size:30px}.factory-bootstrap-404 .h3,.factory-bootstrap-404 h3{font-size:24px}.factory-bootstrap-404 .h4,.factory-bootstrap-404 h4{font-size:18px}.factory-bootstrap-404 .h5,.factory-bootstrap-404 h5{font-size:14px}.factory-bootstrap-404 .h6,.factory-bootstrap-404 h6{font-size:12px}.factory-bootstrap-404 p{margin:0 0 10px}.factory-bootstrap-404 .lead{margin-bottom:20px;font-size:16px;font-weight:200;line-height:1.4}@media (min-width:768px){.lead{font-size:21px}}.factory-bootstrap-404 .small,.factory-bootstrap-404 small{font-size:85%}.factory-bootstrap-404 cite{font-style:normal}.factory-bootstrap-404 .text-muted{color:#999}.factory-bootstrap-404 .text-primary{color:#428bca}.factory-bootstrap-404 .text-primary:hover{color:#3071a9}.factory-bootstrap-404 .text-warning{color:#8a6d3b}.factory-bootstrap-404 .text-warning:hover{color:#66512c}.factory-bootstrap-404 .text-danger{color:#a94442}.factory-bootstrap-404 .text-danger:hover{color:#843534}.factory-bootstrap-404 .text-success{color:#3c763d}.factory-bootstrap-404 .text-success:hover{color:#2b542c}.factory-bootstrap-404 .text-info{color:#31708f}.factory-bootstrap-404 .text-info:hover{color:#245269}.factory-bootstrap-404 .text-left{text-align:left}.factory-bootstrap-404 .text-right{text-align:right}.factory-bootstrap-404 .text-center{text-align:center}.factory-bootstrap-404 .page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}.factory-bootstrap-404 ol,.factory-bootstrap-404 ul{margin-top:0;margin-bottom:10px}.factory-bootstrap-404 ol ol,.factory-bootstrap-404 ol ul,.factory-bootstrap-404 ul ol,.factory-bootstrap-404 ul ul{margin-bottom:0}.factory-bootstrap-404 .list-inline,.factory-bootstrap-404 .list-unstyled{padding-left:0;list-style:none}.factory-bootstrap-404 .list-inline>li{display:inline-block;padding-right:5px;padding-left:5px}.factory-bootstrap-404 .list-inline>li:first-child{padding-left:0}.factory-bootstrap-404 dl{margin-top:0;margin-bottom:20px}.factory-bootstrap-404 dd,.factory-bootstrap-404 dt{line-height:1.428571429}.factory-bootstrap-404 dt{font-weight:700}.factory-bootstrap-404 dd{margin-left:0}@media (min-width:768px){.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}.dl-horizontal dd:after,.dl-horizontal dd:before{display:table;content:" "}.dl-horizontal dd:after{clear:both}}.factory-bootstrap-404 abbr[data-original-title],.factory-bootstrap-404 abbr[title]{cursor:help;border-bottom:1px dotted #999}.factory-bootstrap-404 .initialism{font-size:90%;text-transform:uppercase}.factory-bootstrap-404 blockquote{padding:10px 20px;margin:0 0 20px;border-left:5px solid #eee}.factory-bootstrap-404 blockquote p{font-size:17.5px;font-weight:300;line-height:1.25}.factory-bootstrap-404 blockquote p:last-child{margin-bottom:0}.factory-bootstrap-404 blockquote .small,.factory-bootstrap-404 blockquote small{display:block;line-height:1.428571429;color:#999}.factory-bootstrap-404 blockquote .small:before,.factory-bootstrap-404 blockquote small:before{content:'\2014 \00A0'}.factory-bootstrap-404 blockquote.pull-right{padding-right:15px;padding-left:0;border-right:5px solid #eee;border-left:0}.factory-bootstrap-404 blockquote.pull-right .small,.factory-bootstrap-404 blockquote.pull-right p,.factory-bootstrap-404 blockquote.pull-right small{text-align:right}.factory-bootstrap-404 blockquote.pull-right .small:before,.factory-bootstrap-404 blockquote.pull-right small:before{content:''}.factory-bootstrap-404 blockquote.pull-right .small:after,.factory-bootstrap-404 blockquote.pull-right small:after{content:'\00A0 \2014'}.factory-bootstrap-404 blockquote:after,.factory-bootstrap-404 blockquote:before{content:""}.factory-bootstrap-404 address{margin-bottom:20px;font-style:normal;line-height:1.428571429}.factory-bootstrap-404 code,.factory-bootstrap-404 kbd,.factory-bootstrap-404 pre,.factory-bootstrap-404 samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}.factory-bootstrap-404 code{padding:2px 4px;font-size:90%;color:#c7254e;white-space:nowrap;background-color:#f9f2f4;border-radius:4px}.factory-bootstrap-404 pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.428571429;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}.factory-bootstrap-404 pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.factory-bootstrap-404 .pre-scrollable{max-height:340px;overflow-y:scroll}.factory-bootstrap-404 .container{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.factory-bootstrap-404 .container:after,.factory-bootstrap-404 .container:before{display:table;content:" "}.factory-bootstrap-404 .container:after{clear:both}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}.factory-bootstrap-404 .row{margin-right:-15px;margin-left:-15px}.factory-bootstrap-404 .row:after,.factory-bootstrap-404 .row:before{display:table;content:" "}.factory-bootstrap-404 .row:after{clear:both}.factory-bootstrap-404 .col-lg-1,.factory-bootstrap-404 .col-lg-10,.factory-bootstrap-404 .col-lg-11,.factory-bootstrap-404 .col-lg-12,.factory-bootstrap-404 .col-lg-2,.factory-bootstrap-404 .col-lg-3,.factory-bootstrap-404 .col-lg-4,.factory-bootstrap-404 .col-lg-5,.factory-bootstrap-404 .col-lg-6,.factory-bootstrap-404 .col-lg-7,.factory-bootstrap-404 .col-lg-8,.factory-bootstrap-404 .col-lg-9,.factory-bootstrap-404 .col-md-1,.factory-bootstrap-404 .col-md-10,.factory-bootstrap-404 .col-md-11,.factory-bootstrap-404 .col-md-12,.factory-bootstrap-404 .col-md-2,.factory-bootstrap-404 .col-md-3,.factory-bootstrap-404 .col-md-4,.factory-bootstrap-404 .col-md-5,.factory-bootstrap-404 .col-md-6,.factory-bootstrap-404 .col-md-7,.factory-bootstrap-404 .col-md-8,.factory-bootstrap-404 .col-md-9,.factory-bootstrap-404 .col-sm-1,.factory-bootstrap-404 .col-sm-10,.factory-bootstrap-404 .col-sm-11,.factory-bootstrap-404 .col-sm-12,.factory-bootstrap-404 .col-sm-2,.factory-bootstrap-404 .col-sm-3,.factory-bootstrap-404 .col-sm-4,.factory-bootstrap-404 .col-sm-5,.factory-bootstrap-404 .col-sm-6,.factory-bootstrap-404 .col-sm-7,.factory-bootstrap-404 .col-sm-8,.factory-bootstrap-404 .col-sm-9,.factory-bootstrap-404 .col-xs-1,.factory-bootstrap-404 .col-xs-10,.factory-bootstrap-404 .col-xs-11,.factory-bootstrap-404 .col-xs-12,.factory-bootstrap-404 .col-xs-2,.factory-bootstrap-404 .col-xs-3,.factory-bootstrap-404 .col-xs-4,.factory-bootstrap-404 .col-xs-5,.factory-bootstrap-404 .col-xs-6,.factory-bootstrap-404 .col-xs-7,.factory-bootstrap-404 .col-xs-8,.factory-bootstrap-404 .col-xs-9{position:relative;min-height:1px;padding-right:15px;padding-left:15px}.factory-bootstrap-404 .col-xs-1,.factory-bootstrap-404 .col-xs-10,.factory-bootstrap-404 .col-xs-11,.factory-bootstrap-404 .col-xs-12,.factory-bootstrap-404 .col-xs-2,.factory-bootstrap-404 .col-xs-3,.factory-bootstrap-404 .col-xs-4,.factory-bootstrap-404 .col-xs-5,.factory-bootstrap-404 .col-xs-6,.factory-bootstrap-404 .col-xs-7,.factory-bootstrap-404 .col-xs-8,.factory-bootstrap-404 .col-xs-9{float:left}.factory-bootstrap-404 .col-xs-12{width:100%}.factory-bootstrap-404 .col-xs-11{width:91.66666666666666%}.factory-bootstrap-404 .col-xs-10{width:83.33333333333334%}.factory-bootstrap-404 .col-xs-9{width:75%}.factory-bootstrap-404 .col-xs-8{width:66.66666666666666%}.factory-bootstrap-404 .col-xs-7{width:58.333333333333336%}.factory-bootstrap-404 .col-xs-6{width:50%}.factory-bootstrap-404 .col-xs-5{width:41.66666666666667%}.factory-bootstrap-404 .col-xs-4{width:33.33333333333333%}.factory-bootstrap-404 .col-xs-3{width:25%}.factory-bootstrap-404 .col-xs-2{width:16.666666666666664%}.factory-bootstrap-404 .col-xs-1{width:8.333333333333332%}.factory-bootstrap-404 .col-xs-pull-12{right:100%}.factory-bootstrap-404 .col-xs-pull-11{right:91.66666666666666%}.factory-bootstrap-404 .col-xs-pull-10{right:83.33333333333334%}.factory-bootstrap-404 .col-xs-pull-9{right:75%}.factory-bootstrap-404 .col-xs-pull-8{right:66.66666666666666%}.factory-bootstrap-404 .col-xs-pull-7{right:58.333333333333336%}.factory-bootstrap-404 .col-xs-pull-6{right:50%}.factory-bootstrap-404 .col-xs-pull-5{right:41.66666666666667%}.factory-bootstrap-404 .col-xs-pull-4{right:33.33333333333333%}.factory-bootstrap-404 .col-xs-pull-3{right:25%}.factory-bootstrap-404 .col-xs-pull-2{right:16.666666666666664%}.factory-bootstrap-404 .col-xs-pull-1{right:8.333333333333332%}.factory-bootstrap-404 .col-xs-pull-0{right:0}.factory-bootstrap-404 .col-xs-push-12{left:100%}.factory-bootstrap-404 .col-xs-push-11{left:91.66666666666666%}.factory-bootstrap-404 .col-xs-push-10{left:83.33333333333334%}.factory-bootstrap-404 .col-xs-push-9{left:75%}.factory-bootstrap-404 .col-xs-push-8{left:66.66666666666666%}.factory-bootstrap-404 .col-xs-push-7{left:58.333333333333336%}.factory-bootstrap-404 .col-xs-push-6{left:50%}.factory-bootstrap-404 .col-xs-push-5{left:41.66666666666667%}.factory-bootstrap-404 .col-xs-push-4{left:33.33333333333333%}.factory-bootstrap-404 .col-xs-push-3{left:25%}.factory-bootstrap-404 .col-xs-push-2{left:16.666666666666664%}.factory-bootstrap-404 .col-xs-push-1{left:8.333333333333332%}.factory-bootstrap-404 .col-xs-push-0{left:0}.factory-bootstrap-404 .col-xs-offset-12{margin-left:100%}.factory-bootstrap-404 .col-xs-offset-11{margin-left:91.66666666666666%}.factory-bootstrap-404 .col-xs-offset-10{margin-left:83.33333333333334%}.factory-bootstrap-404 .col-xs-offset-9{margin-left:75%}.factory-bootstrap-404 .col-xs-offset-8{margin-left:66.66666666666666%}.factory-bootstrap-404 .col-xs-offset-7{margin-left:58.333333333333336%}.factory-bootstrap-404 .col-xs-offset-6{margin-left:50%}.factory-bootstrap-404 .col-xs-offset-5{margin-left:41.66666666666667%}.factory-bootstrap-404 .col-xs-offset-4{margin-left:33.33333333333333%}.factory-bootstrap-404 .col-xs-offset-3{margin-left:25%}.factory-bootstrap-404 .col-xs-offset-2{margin-left:16.666666666666664%}.factory-bootstrap-404 .col-xs-offset-1{margin-left:8.333333333333332%}.factory-bootstrap-404 .col-xs-offset-0{margin-left:0}@media (min-width:768px){.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666666666666%}.col-sm-10{width:83.33333333333334%}.col-sm-9{width:75%}.col-sm-8{width:66.66666666666666%}.col-sm-7{width:58.333333333333336%}.col-sm-6{width:50%}.col-sm-5{width:41.66666666666667%}.col-sm-4{width:33.33333333333333%}.col-sm-3{width:25%}.col-sm-2{width:16.666666666666664%}.col-sm-1{width:8.333333333333332%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666666666666%}.col-sm-pull-10{right:83.33333333333334%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666666666666%}.col-sm-pull-7{right:58.333333333333336%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666666666667%}.col-sm-pull-4{right:33.33333333333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.666666666666664%}.col-sm-pull-1{right:8.333333333333332%}.col-sm-pull-0{right:0}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666666666666%}.col-sm-push-10{left:83.33333333333334%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666666666666%}.col-sm-push-7{left:58.333333333333336%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666666666667%}.col-sm-push-4{left:33.33333333333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.666666666666664%}.col-sm-push-1{left:8.333333333333332%}.col-sm-push-0{left:0}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666666666666%}.col-sm-offset-10{margin-left:83.33333333333334%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666666666666%}.col-sm-offset-7{margin-left:58.333333333333336%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666666666667%}.col-sm-offset-4{margin-left:33.33333333333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.666666666666664%}.col-sm-offset-1{margin-left:8.333333333333332%}.col-sm-offset-0{margin-left:0}}@media (min-width:992px){.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666666666666%}.col-md-10{width:83.33333333333334%}.col-md-9{width:75%}.col-md-8{width:66.66666666666666%}.col-md-7{width:58.333333333333336%}.col-md-6{width:50%}.col-md-5{width:41.66666666666667%}.col-md-4{width:33.33333333333333%}.col-md-3{width:25%}.col-md-2{width:16.666666666666664%}.col-md-1{width:8.333333333333332%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666666666666%}.col-md-pull-10{right:83.33333333333334%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666666666666%}.col-md-pull-7{right:58.333333333333336%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666666666667%}.col-md-pull-4{right:33.33333333333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.666666666666664%}.col-md-pull-1{right:8.333333333333332%}.col-md-pull-0{right:0}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666666666666%}.col-md-push-10{left:83.33333333333334%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666666666666%}.col-md-push-7{left:58.333333333333336%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666666666667%}.col-md-push-4{left:33.33333333333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.666666666666664%}.col-md-push-1{left:8.333333333333332%}.col-md-push-0{left:0}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666666666666%}.col-md-offset-10{margin-left:83.33333333333334%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666666666666%}.col-md-offset-7{margin-left:58.333333333333336%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666666666667%}.col-md-offset-4{margin-left:33.33333333333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.666666666666664%}.col-md-offset-1{margin-left:8.333333333333332%}.col-md-offset-0{margin-left:0}}@media (min-width:1200px){.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666666666666%}.col-lg-10{width:83.33333333333334%}.col-lg-9{width:75%}.col-lg-8{width:66.66666666666666%}.col-lg-7{width:58.333333333333336%}.col-lg-6{width:50%}.col-lg-5{width:41.66666666666667%}.col-lg-4{width:33.33333333333333%}.col-lg-3{width:25%}.col-lg-2{width:16.666666666666664%}.col-lg-1{width:8.333333333333332%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666666666666%}.col-lg-pull-10{right:83.33333333333334%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666666666666%}.col-lg-pull-7{right:58.333333333333336%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666666666667%}.col-lg-pull-4{right:33.33333333333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.666666666666664%}.col-lg-pull-1{right:8.333333333333332%}.col-lg-pull-0{right:0}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666666666666%}.col-lg-push-10{left:83.33333333333334%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666666666666%}.col-lg-push-7{left:58.333333333333336%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666666666667%}.col-lg-push-4{left:33.33333333333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.666666666666664%}.col-lg-push-1{left:8.333333333333332%}.col-lg-push-0{left:0}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666666666666%}.col-lg-offset-10{margin-left:83.33333333333334%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666666666666%}.col-lg-offset-7{margin-left:58.333333333333336%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666666666667%}.col-lg-offset-4{margin-left:33.33333333333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.666666666666664%}.col-lg-offset-1{margin-left:8.333333333333332%}.col-lg-offset-0{margin-left:0}}.factory-bootstrap-404 table{max-width:100%;background-color:transparent}.factory-bootstrap-404 th{text-align:left}.factory-bootstrap-404 .table{width:100%;margin-bottom:20px}.factory-bootstrap-404 .table>tbody>tr>td,.factory-bootstrap-404 .table>tbody>tr>th,.factory-bootstrap-404 .table>tfoot>tr>td,.factory-bootstrap-404 .table>tfoot>tr>th,.factory-bootstrap-404 .table>thead>tr>td,.factory-bootstrap-404 .table>thead>tr>th{padding:8px;line-height:1.428571429;vertical-align:top;border-top:1px solid #ddd}.factory-bootstrap-404 .table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.factory-bootstrap-404 .table>caption+thead>tr:first-child>td,.factory-bootstrap-404 .table>caption+thead>tr:first-child>th,.factory-bootstrap-404 .table>colgroup+thead>tr:first-child>td,.factory-bootstrap-404 .table>colgroup+thead>tr:first-child>th,.factory-bootstrap-404 .table>thead:first-child>tr:first-child>td,.factory-bootstrap-404 .table>thead:first-child>tr:first-child>th{border-top:0}.factory-bootstrap-404 .table>tbody+tbody{border-top:2px solid #ddd}.factory-bootstrap-404 .table .table{background-color:#fff}.factory-bootstrap-404 .table-condensed>tbody>tr>td,.factory-bootstrap-404 .table-condensed>tbody>tr>th,.factory-bootstrap-404 .table-condensed>tfoot>tr>td,.factory-bootstrap-404 .table-condensed>tfoot>tr>th,.factory-bootstrap-404 .table-condensed>thead>tr>td,.factory-bootstrap-404 .table-condensed>thead>tr>th{padding:5px}.factory-bootstrap-404 .table-bordered,.factory-bootstrap-404 .table-bordered>tbody>tr>td,.factory-bootstrap-404 .table-bordered>tbody>tr>th,.factory-bootstrap-404 .table-bordered>tfoot>tr>td,.factory-bootstrap-404 .table-bordered>tfoot>tr>th,.factory-bootstrap-404 .table-bordered>thead>tr>td,.factory-bootstrap-404 .table-bordered>thead>tr>th{border:1px solid #ddd}.factory-bootstrap-404 .table-bordered>thead>tr>td,.factory-bootstrap-404 .table-bordered>thead>tr>th{border-bottom-width:2px}.factory-bootstrap-404 .table-striped>tbody>tr:nth-child(odd)>td,.factory-bootstrap-404 .table-striped>tbody>tr:nth-child(odd)>th{background-color:#f9f9f9}.factory-bootstrap-404 .table-hover>tbody>tr:hover>td,.factory-bootstrap-404 .table-hover>tbody>tr:hover>th{background-color:#f5f5f5}.factory-bootstrap-404 table col[class*=col-]{position:static;display:table-column;float:none}.factory-bootstrap-404 table td[class*=col-],.factory-bootstrap-404 table th[class*=col-]{display:table-cell;float:none}.factory-bootstrap-404 .table>tbody>.active>td,.factory-bootstrap-404 .table>tbody>.active>th,.factory-bootstrap-404 .table>tbody>tr>.active,.factory-bootstrap-404 .table>tfoot>.active>td,.factory-bootstrap-404 .table>tfoot>.active>th,.factory-bootstrap-404 .table>tfoot>tr>.active,.factory-bootstrap-404 .table>thead>.active>td,.factory-bootstrap-404 .table>thead>.active>th,.factory-bootstrap-404 .table>thead>tr>.active{background-color:#f5f5f5}.factory-bootstrap-404 .table-hover>tbody>.active:hover>td,.factory-bootstrap-404 .table-hover>tbody>.active:hover>th,.factory-bootstrap-404 .table-hover>tbody>tr>.active:hover{background-color:#e8e8e8}.factory-bootstrap-404 .table>tbody>.success>td,.factory-bootstrap-404 .table>tbody>.success>th,.factory-bootstrap-404 .table>tbody>tr>.success,.factory-bootstrap-404 .table>tfoot>.success>td,.factory-bootstrap-404 .table>tfoot>.success>th,.factory-bootstrap-404 .table>tfoot>tr>.success,.factory-bootstrap-404 .table>thead>.success>td,.factory-bootstrap-404 .table>thead>.success>th,.factory-bootstrap-404 .table>thead>tr>.success{background-color:#dff0d8}.factory-bootstrap-404 .table-hover>tbody>.success:hover>td,.factory-bootstrap-404 .table-hover>tbody>.success:hover>th,.factory-bootstrap-404 .table-hover>tbody>tr>.success:hover{background-color:#d0e9c6}.factory-bootstrap-404 .table>tbody>.danger>td,.factory-bootstrap-404 .table>tbody>.danger>th,.factory-bootstrap-404 .table>tbody>tr>.danger,.factory-bootstrap-404 .table>tfoot>.danger>td,.factory-bootstrap-404 .table>tfoot>.danger>th,.factory-bootstrap-404 .table>tfoot>tr>.danger,.factory-bootstrap-404 .table>thead>.danger>td,.factory-bootstrap-404 .table>thead>.danger>th,.factory-bootstrap-404 .table>thead>tr>.danger{background-color:#f2dede}.factory-bootstrap-404 .table-hover>tbody>.danger:hover>td,.factory-bootstrap-404 .table-hover>tbody>.danger:hover>th,.factory-bootstrap-404 .table-hover>tbody>tr>.danger:hover{background-color:#ebcccc}.factory-bootstrap-404 .table>tbody>.warning>td,.factory-bootstrap-404 .table>tbody>.warning>th,.factory-bootstrap-404 .table>tbody>tr>.warning,.factory-bootstrap-404 .table>tfoot>.warning>td,.factory-bootstrap-404 .table>tfoot>.warning>th,.factory-bootstrap-404 .table>tfoot>tr>.warning,.factory-bootstrap-404 .table>thead>.warning>td,.factory-bootstrap-404 .table>thead>.warning>th,.factory-bootstrap-404 .table>thead>tr>.warning{background-color:#fcf8e3}.factory-bootstrap-404 .table-hover>tbody>.warning:hover>td,.factory-bootstrap-404 .table-hover>tbody>.warning:hover>th,.factory-bootstrap-404 .table-hover>tbody>tr>.warning:hover{background-color:#faf2cc}@media (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-x:scroll;overflow-y:hidden;border:1px solid #ddd;-ms-overflow-style:-ms-autohiding-scrollbar;-webkit-overflow-scrolling:touch}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>td,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>thead>tr>th{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}}.factory-bootstrap-404 fieldset{padding:0;margin:0;border:0}.factory-bootstrap-404 legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5;-moz-box-sizing:content-box;box-sizing:content-box}.factory-bootstrap-404 label{display:inline-block;margin-bottom:5px;font-weight:700}.factory-bootstrap-404 input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.factory-bootstrap-404 input[type=checkbox],.factory-bootstrap-404 input[type=radio]{margin:4px 0 0;margin-top:1px \9;line-height:normal}.factory-bootstrap-404 input[type=file]{display:block}.factory-bootstrap-404 select[multiple],.factory-bootstrap-404 select[size]{height:auto}.factory-bootstrap-404 select optgroup{font-family:inherit;font-size:inherit;font-style:inherit}.factory-bootstrap-404 input[type=checkbox]:focus,.factory-bootstrap-404 input[type=file]:focus,.factory-bootstrap-404 input[type=radio]:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.factory-bootstrap-404 input[type=number]::-webkit-inner-spin-button,.factory-bootstrap-404 input[type=number]::-webkit-outer-spin-button{height:auto}.factory-bootstrap-404 output{display:block;padding-top:7px;font-size:14px;line-height:1.428571429;color:#555;vertical-align:middle}.factory-bootstrap-404 .form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.428571429;color:#555;vertical-align:middle;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:3px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.factory-bootstrap-404 .form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.factory-bootstrap-404 .form-control:-moz-placeholder{color:#999}.factory-bootstrap-404 .form-control::-moz-placeholder{color:#999;opacity:1}.factory-bootstrap-404 .form-control:-ms-input-placeholder{color:#999}.factory-bootstrap-404 .form-control::-webkit-input-placeholder{color:#999}.factory-bootstrap-404 .form-control[disabled],.factory-bootstrap-404 .form-control[readonly],.factory-bootstrap-404 fieldset[disabled] .form-control{cursor:not-allowed;background-color:#eee}.factory-bootstrap-404 textarea.form-control{height:auto}.factory-bootstrap-404 .form-group{margin-bottom:15px}.factory-bootstrap-404 .checkbox,.factory-bootstrap-404 .radio{display:block;min-height:20px;padding-left:20px;margin-top:10px;margin-bottom:10px;vertical-align:middle}.factory-bootstrap-404 .checkbox label,.factory-bootstrap-404 .radio label{display:inline;margin-bottom:0;font-weight:400;cursor:pointer}.factory-bootstrap-404 .checkbox input[type=checkbox],.factory-bootstrap-404 .checkbox-inline input[type=checkbox],.factory-bootstrap-404 .radio input[type=radio],.factory-bootstrap-404 .radio-inline input[type=radio]{float:left;margin-left:-20px}.factory-bootstrap-404 .checkbox+.checkbox,.factory-bootstrap-404 .radio+.radio{margin-top:-5px}.factory-bootstrap-404 .checkbox-inline,.factory-bootstrap-404 .radio-inline{display:inline-block;padding-left:20px;margin-bottom:0;font-weight:400;vertical-align:middle;cursor:pointer}.factory-bootstrap-404 .checkbox-inline+.checkbox-inline,.factory-bootstrap-404 .radio-inline+.radio-inline{margin-top:0;margin-left:10px}.factory-bootstrap-404 .checkbox-inline[disabled],.factory-bootstrap-404 .checkbox[disabled],.factory-bootstrap-404 .radio-inline[disabled],.factory-bootstrap-404 .radio[disabled],.factory-bootstrap-404 fieldset[disabled] .checkbox,.factory-bootstrap-404 fieldset[disabled] .checkbox-inline,.factory-bootstrap-404 fieldset[disabled] .radio,.factory-bootstrap-404 fieldset[disabled] .radio-inline,.factory-bootstrap-404 fieldset[disabled] input[type=checkbox],.factory-bootstrap-404 fieldset[disabled] input[type=radio],.factory-bootstrap-404 input[type=checkbox][disabled],.factory-bootstrap-404 input[type=radio][disabled]{cursor:not-allowed}.factory-bootstrap-404 .input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.factory-bootstrap-404 select.input-sm{height:30px;line-height:30px}.factory-bootstrap-404 textarea.input-sm{height:auto}.factory-bootstrap-404 .input-lg{height:46px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.factory-bootstrap-404 select.input-lg{height:46px;line-height:46px}.factory-bootstrap-404 textarea.input-lg{height:auto}.factory-bootstrap-404 .has-warning .checkbox,.factory-bootstrap-404 .has-warning .checkbox-inline,.factory-bootstrap-404 .has-warning .control-label,.factory-bootstrap-404 .has-warning .help-block,.factory-bootstrap-404 .has-warning .radio,.factory-bootstrap-404 .has-warning .radio-inline{color:#8a6d3b}.factory-bootstrap-404 .has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.factory-bootstrap-404 .has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.factory-bootstrap-404 .has-warning .input-group-addon{color:#8a6d3b;background-color:#fcf8e3;border-color:#8a6d3b}.factory-bootstrap-404 .has-error .checkbox,.factory-bootstrap-404 .has-error .checkbox-inline,.factory-bootstrap-404 .has-error .control-label,.factory-bootstrap-404 .has-error .help-block,.factory-bootstrap-404 .has-error .radio,.factory-bootstrap-404 .has-error .radio-inline{color:#a94442}.factory-bootstrap-404 .controls{display:block}.factory-bootstrap-404 .has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.factory-bootstrap-404 .has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.factory-bootstrap-404 .has-error .input-group-addon{color:#a94442;background-color:#f2dede;border-color:#a94442}.factory-bootstrap-404 .has-success .checkbox,.factory-bootstrap-404 .has-success .checkbox-inline,.factory-bootstrap-404 .has-success .control-label,.factory-bootstrap-404 .has-success .help-block,.factory-bootstrap-404 .has-success .radio,.factory-bootstrap-404 .has-success .radio-inline{color:#3c763d}.factory-bootstrap-404 .has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.factory-bootstrap-404 .has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.factory-bootstrap-404 .has-success .input-group-addon{color:#3c763d;background-color:#dff0d8;border-color:#3c763d}.factory-bootstrap-404 .form-control-static{margin-bottom:0}.factory-bootstrap-404 .help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373;font-weight:400}@media (min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block}.form-inline select.form-control{width:auto}.form-inline .checkbox,.form-inline .radio{display:inline-block;padding-left:0;margin-top:0;margin-bottom:0}.form-inline .checkbox input[type=checkbox],.form-inline .radio input[type=radio]{float:none;margin-left:0}}.factory-bootstrap-404 .form-horizontal .checkbox,.factory-bootstrap-404 .form-horizontal .checkbox-inline,.factory-bootstrap-404 .form-horizontal .control-label,.factory-bootstrap-404 .form-horizontal .radio,.factory-bootstrap-404 .form-horizontal .radio-inline{position:relative;padding-top:7px;margin-top:0;margin-bottom:0}.factory-bootstrap-404 .form-horizontal .control-label{max-width:200px}.factory-bootstrap-404 .form-horizontal .checkbox,.factory-bootstrap-404 .form-horizontal .radio{min-height:27px}.factory-bootstrap-404 .form-horizontal .form-group{margin-right:-15px;margin-left:-15px}.factory-bootstrap-404 .form-horizontal .form-group:after,.factory-bootstrap-404 .form-horizontal .form-group:before{display:table;content:" "}.factory-bootstrap-404 .form-horizontal .form-group:after{clear:both}.factory-bootstrap-404 .form-horizontal .form-control-static{padding-top:7px}@media (min-width:768px){.form-horizontal .control-label{text-align:right}}.factory-bootstrap-404 .btn{display:inline-block;padding:5px 12px;margin-bottom:0;font-size:13px;font-weight:400;line-height:1.428571429;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;background-image:none;border:1px solid transparent;border-radius:3px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.factory-bootstrap-404 .btn:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.factory-bootstrap-404 .btn{text-decoration:none}.factory-bootstrap-404 .btn:focus,.factory-bootstrap-404 .btn:hover{color:#333;text-decoration:none}.factory-bootstrap-404 .btn.disabled,.factory-bootstrap-404 .btn[disabled],.factory-bootstrap-404 fieldset[disabled] .btn{pointer-events:none;cursor:not-allowed;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none}.factory-bootstrap-404 .btn-default.active,.factory-bootstrap-404 .btn-default:active,.factory-bootstrap-404 .btn-default:focus,.factory-bootstrap-404 .btn-default:hover,.factory-bootstrap-404 .open .dropdown-toggle.btn-default{background:#fafafa;border-color:#999;color:#222}.factory-bootstrap-404 .btn-default.active,.factory-bootstrap-404 .btn-default:active,.factory-bootstrap-404 .open .dropdown-toggle.btn-default{background-image:none}.factory-bootstrap-404 .btn-default.disabled,.factory-bootstrap-404 .btn-default.disabled.active,.factory-bootstrap-404 .btn-default.disabled:active,.factory-bootstrap-404 .btn-default.disabled:focus,.factory-bootstrap-404 .btn-default.disabled:hover,.factory-bootstrap-404 .btn-default[disabled],.factory-bootstrap-404 .btn-default[disabled].active,.factory-bootstrap-404 .btn-default[disabled]:active,.factory-bootstrap-404 .btn-default[disabled]:focus,.factory-bootstrap-404 .btn-default[disabled]:hover,.factory-bootstrap-404 fieldset[disabled] .btn-default,.factory-bootstrap-404 fieldset[disabled] .btn-default.active,.factory-bootstrap-404 fieldset[disabled] .btn-default:active,.factory-bootstrap-404 fieldset[disabled] .btn-default:focus,.factory-bootstrap-404 fieldset[disabled] .btn-default:hover{background-color:#fff;border-color:#ccc}.factory-bootstrap-404 .btn-default .badge{color:#fff;background-color:#fff}.factory-bootstrap-404 .btn-primary.active,.factory-bootstrap-404 .btn-primary:active,.factory-bootstrap-404 .btn-primary:focus,.factory-bootstrap-404 .btn-primary:hover,.factory-bootstrap-404 .open .dropdown-toggle.btn-primary{color:#fff;background-color:#3276b1;border-color:#285e8e}.factory-bootstrap-404 .btn-primary.active,.factory-bootstrap-404 .btn-primary:active,.factory-bootstrap-404 .open .dropdown-toggle.btn-primary{background-image:none}.factory-bootstrap-404 .btn-primary.disabled,.factory-bootstrap-404 .btn-primary.disabled.active,.factory-bootstrap-404 .btn-primary.disabled:active,.factory-bootstrap-404 .btn-primary.disabled:focus,.factory-bootstrap-404 .btn-primary.disabled:hover,.factory-bootstrap-404 .btn-primary[disabled],.factory-bootstrap-404 .btn-primary[disabled].active,.factory-bootstrap-404 .btn-primary[disabled]:active,.factory-bootstrap-404 .btn-primary[disabled]:focus,.factory-bootstrap-404 .btn-primary[disabled]:hover,.factory-bootstrap-404 fieldset[disabled] .btn-primary,.factory-bootstrap-404 fieldset[disabled] .btn-primary.active,.factory-bootstrap-404 fieldset[disabled] .btn-primary:active,.factory-bootstrap-404 fieldset[disabled] .btn-primary:focus,.factory-bootstrap-404 fieldset[disabled] .btn-primary:hover{background-color:#428bca;border-color:#357ebd}.factory-bootstrap-404 .btn-primary .badge{color:#428bca;background-color:#fff}.factory-bootstrap-404 .btn-warning{color:#fff;background-color:#f0ad4e}.factory-bootstrap-404 .btn-warning.active,.factory-bootstrap-404 .btn-warning:active,.factory-bootstrap-404 .btn-warning:focus,.factory-bootstrap-404 .btn-warning:hover,.factory-bootstrap-404 .open .dropdown-toggle.btn-warning{color:#fff;background-color:#ed9c28;border-color:#d58512}.factory-bootstrap-404 .btn-warning.active,.factory-bootstrap-404 .btn-warning:active,.factory-bootstrap-404 .open .dropdown-toggle.btn-warning{background-image:none}.factory-bootstrap-404 .btn-warning.disabled,.factory-bootstrap-404 .btn-warning.disabled.active,.factory-bootstrap-404 .btn-warning.disabled:active,.factory-bootstrap-404 .btn-warning.disabled:focus,.factory-bootstrap-404 .btn-warning.disabled:hover,.factory-bootstrap-404 .btn-warning[disabled],.factory-bootstrap-404 .btn-warning[disabled].active,.factory-bootstrap-404 .btn-warning[disabled]:active,.factory-bootstrap-404 .btn-warning[disabled]:focus,.factory-bootstrap-404 .btn-warning[disabled]:hover,.factory-bootstrap-404 fieldset[disabled] .btn-warning,.factory-bootstrap-404 fieldset[disabled] .btn-warning.active,.factory-bootstrap-404 fieldset[disabled] .btn-warning:active,.factory-bootstrap-404 fieldset[disabled] .btn-warning:focus,.factory-bootstrap-404 fieldset[disabled] .btn-warning:hover{background-color:#f0ad4e;border-color:#eea236}.factory-bootstrap-404 .btn-warning .badge{color:#f0ad4e;background-color:#fff}.factory-bootstrap-404 .btn-success{color:#fff;background-color:#5cb85c}.factory-bootstrap-404 .btn-success.active,.factory-bootstrap-404 .btn-success:active,.factory-bootstrap-404 .btn-success:focus,.factory-bootstrap-404 .btn-success:hover,.factory-bootstrap-404 .open .dropdown-toggle.btn-success{color:#fff;background-color:#47a447;border-color:#398439}.factory-bootstrap-404 .btn-success.active,.factory-bootstrap-404 .btn-success:active,.factory-bootstrap-404 .open .dropdown-toggle.btn-success{background-image:none}.factory-bootstrap-404 .btn-success.disabled,.factory-bootstrap-404 .btn-success.disabled.active,.factory-bootstrap-404 .btn-success.disabled:active,.factory-bootstrap-404 .btn-success.disabled:focus,.factory-bootstrap-404 .btn-success.disabled:hover,.factory-bootstrap-404 .btn-success[disabled],.factory-bootstrap-404 .btn-success[disabled].active,.factory-bootstrap-404 .btn-success[disabled]:active,.factory-bootstrap-404 .btn-success[disabled]:focus,.factory-bootstrap-404 .btn-success[disabled]:hover,.factory-bootstrap-404 fieldset[disabled] .btn-success,.factory-bootstrap-404 fieldset[disabled] .btn-success.active,.factory-bootstrap-404 fieldset[disabled] .btn-success:active,.factory-bootstrap-404 fieldset[disabled] .btn-success:focus,.factory-bootstrap-404 fieldset[disabled] .btn-success:hover{background-color:#5cb85c;border-color:#4cae4c}.factory-bootstrap-404 .btn-success .badge{color:#5cb85c;background-color:#fff}.factory-bootstrap-404 .btn-info{color:#fff;background-color:#5bc0de}.factory-bootstrap-404 .btn-info.active,.factory-bootstrap-404 .btn-info:active,.factory-bootstrap-404 .btn-info:focus,.factory-bootstrap-404 .btn-info:hover,.factory-bootstrap-404 .open .dropdown-toggle.btn-info{color:#fff;background-color:#39b3d7;border-color:#269abc}.factory-bootstrap-404 .btn-info.active,.factory-bootstrap-404 .btn-info:active,.factory-bootstrap-404 .open .dropdown-toggle.btn-info{background-image:none}.factory-bootstrap-404 .btn-info.disabled,.factory-bootstrap-404 .btn-info.disabled.active,.factory-bootstrap-404 .btn-info.disabled:active,.factory-bootstrap-404 .btn-info.disabled:focus,.factory-bootstrap-404 .btn-info.disabled:hover,.factory-bootstrap-404 .btn-info[disabled],.factory-bootstrap-404 .btn-info[disabled].active,.factory-bootstrap-404 .btn-info[disabled]:active,.factory-bootstrap-404 .btn-info[disabled]:focus,.factory-bootstrap-404 .btn-info[disabled]:hover,.factory-bootstrap-404 fieldset[disabled] .btn-info,.factory-bootstrap-404 fieldset[disabled] .btn-info.active,.factory-bootstrap-404 fieldset[disabled] .btn-info:active,.factory-bootstrap-404 fieldset[disabled] .btn-info:focus,.factory-bootstrap-404 fieldset[disabled] .btn-info:hover{background-color:#5bc0de;border-color:#46b8da}.factory-bootstrap-404 .btn-info .badge{color:#5bc0de;background-color:#fff}.factory-bootstrap-404 .btn-link{font-weight:400;color:#428bca;cursor:pointer;border-radius:0}.factory-bootstrap-404 .btn-link,.factory-bootstrap-404 .btn-link:active,.factory-bootstrap-404 .btn-link[disabled],.factory-bootstrap-404 fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.factory-bootstrap-404 .btn-link,.factory-bootstrap-404 .btn-link:active,.factory-bootstrap-404 .btn-link:focus,.factory-bootstrap-404 .btn-link:hover{border-color:transparent}.factory-bootstrap-404 .btn-link:focus,.factory-bootstrap-404 .btn-link:hover{color:#2a6496;text-decoration:underline;background-color:transparent}.factory-bootstrap-404 .btn-link[disabled]:focus,.factory-bootstrap-404 .btn-link[disabled]:hover,.factory-bootstrap-404 fieldset[disabled] .btn-link:focus,.factory-bootstrap-404 fieldset[disabled] .btn-link:hover{color:#999;text-decoration:none}.factory-bootstrap-404 .btn-lg{padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.factory-bootstrap-404 .btn-sm{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.factory-bootstrap-404 .btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.factory-bootstrap-404 .btn-block{display:block;width:100%;padding-right:0;padding-left:0}.factory-bootstrap-404 .btn-block+.btn-block{margin-top:5px}.factory-bootstrap-404 input[type=button].btn-block,.factory-bootstrap-404 input[type=reset].btn-block,.factory-bootstrap-404 input[type=submit].btn-block{width:100%}.factory-bootstrap-404 .fade{opacity:0;-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.factory-bootstrap-404 .fade.in{opacity:1}.factory-bootstrap-404 .collapse{display:none}.factory-bootstrap-404 .collapse.in{display:block}.factory-bootstrap-404 .collapsing{position:relative;height:0;overflow:hidden;-webkit-transition:height .35s ease;transition:height .35s ease}@font-face{font-family:'Glyphicons Halflings';src:url(../fonts/glyphicons-halflings-regular.eot);src:url(../fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),url(../fonts/glyphicons-halflings-regular.woff) format('woff'),url(../fonts/glyphicons-halflings-regular.ttf) format('truetype'),url(../fonts/glyphicons-halflings-regular.svg#glyphicons-halflingsregular) format('svg')}.factory-bootstrap-404 .glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';-webkit-font-smoothing:antialiased;font-style:normal;font-weight:400;line-height:1;-moz-osx-font-smoothing:grayscale}.factory-bootstrap-404 .glyphicon:empty{width:1em}.factory-bootstrap-404 .glyphicon-asterisk:before{content:"\2a"}.factory-bootstrap-404 .glyphicon-plus:before{content:"\2b"}.factory-bootstrap-404 .glyphicon-euro:before{content:"\20ac"}.factory-bootstrap-404 .glyphicon-minus:before{content:"\2212"}.factory-bootstrap-404 .glyphicon-cloud:before{content:"\2601"}.factory-bootstrap-404 .glyphicon-envelope:before{content:"\2709"}.factory-bootstrap-404 .glyphicon-pencil:before{content:"\270f"}.factory-bootstrap-404 .glyphicon-glass:before{content:"\e001"}.factory-bootstrap-404 .glyphicon-music:before{content:"\e002"}.factory-bootstrap-404 .glyphicon-search:before{content:"\e003"}.factory-bootstrap-404 .glyphicon-heart:before{content:"\e005"}.factory-bootstrap-404 .glyphicon-star:before{content:"\e006"}.factory-bootstrap-404 .glyphicon-star-empty:before{content:"\e007"}.factory-bootstrap-404 .glyphicon-user:before{content:"\e008"}.factory-bootstrap-404 .glyphicon-film:before{content:"\e009"}.factory-bootstrap-404 .glyphicon-th-large:before{content:"\e010"}.factory-bootstrap-404 .glyphicon-th:before{content:"\e011"}.factory-bootstrap-404 .glyphicon-th-list:before{content:"\e012"}.factory-bootstrap-404 .glyphicon-ok:before{content:"\e013"}.factory-bootstrap-404 .glyphicon-remove:before{content:"\e014"}.factory-bootstrap-404 .glyphicon-zoom-in:before{content:"\e015"}.factory-bootstrap-404 .glyphicon-zoom-out:before{content:"\e016"}.factory-bootstrap-404 .glyphicon-off:before{content:"\e017"}.factory-bootstrap-404 .glyphicon-signal:before{content:"\e018"}.factory-bootstrap-404 .glyphicon-cog:before{content:"\e019"}.factory-bootstrap-404 .glyphicon-trash:before{content:"\e020"}.factory-bootstrap-404 .glyphicon-home:before{content:"\e021"}.factory-bootstrap-404 .glyphicon-file:before{content:"\e022"}.factory-bootstrap-404 .glyphicon-time:before{content:"\e023"}.factory-bootstrap-404 .glyphicon-road:before{content:"\e024"}.factory-bootstrap-404 .glyphicon-download-alt:before{content:"\e025"}.factory-bootstrap-404 .glyphicon-download:before{content:"\e026"}.factory-bootstrap-404 .glyphicon-upload:before{content:"\e027"}.factory-bootstrap-404 .glyphicon-inbox:before{content:"\e028"}.factory-bootstrap-404 .glyphicon-play-circle:before{content:"\e029"}.factory-bootstrap-404 .glyphicon-repeat:before{content:"\e030"}.factory-bootstrap-404 .glyphicon-refresh:before{content:"\e031"}.factory-bootstrap-404 .glyphicon-list-alt:before{content:"\e032"}.factory-bootstrap-404 .glyphicon-lock:before{content:"\e033"}.factory-bootstrap-404 .glyphicon-flag:before{content:"\e034"}.factory-bootstrap-404 .glyphicon-headphones:before{content:"\e035"}.factory-bootstrap-404 .glyphicon-volume-off:before{content:"\e036"}.factory-bootstrap-404 .glyphicon-volume-down:before{content:"\e037"}.factory-bootstrap-404 .glyphicon-volume-up:before{content:"\e038"}.factory-bootstrap-404 .glyphicon-qrcode:before{content:"\e039"}.factory-bootstrap-404 .glyphicon-barcode:before{content:"\e040"}.factory-bootstrap-404 .glyphicon-tag:before{content:"\e041"}.factory-bootstrap-404 .glyphicon-tags:before{content:"\e042"}.factory-bootstrap-404 .glyphicon-book:before{content:"\e043"}.factory-bootstrap-404 .glyphicon-bookmark:before{content:"\e044"}.factory-bootstrap-404 .glyphicon-print:before{content:"\e045"}.factory-bootstrap-404 .glyphicon-camera:before{content:"\e046"}.factory-bootstrap-404 .glyphicon-font:before{content:"\e047"}.factory-bootstrap-404 .glyphicon-bold:before{content:"\e048"}.factory-bootstrap-404 .glyphicon-italic:before{content:"\e049"}.factory-bootstrap-404 .glyphicon-text-height:before{content:"\e050"}.factory-bootstrap-404 .glyphicon-text-width:before{content:"\e051"}.factory-bootstrap-404 .glyphicon-align-left:before{content:"\e052"}.factory-bootstrap-404 .glyphicon-align-center:before{content:"\e053"}.factory-bootstrap-404 .glyphicon-align-right:before{content:"\e054"}.factory-bootstrap-404 .glyphicon-align-justify:before{content:"\e055"}.factory-bootstrap-404 .glyphicon-list:before{content:"\e056"}.factory-bootstrap-404 .glyphicon-indent-left:before{content:"\e057"}.factory-bootstrap-404 .glyphicon-indent-right:before{content:"\e058"}.factory-bootstrap-404 .glyphicon-facetime-video:before{content:"\e059"}.factory-bootstrap-404 .glyphicon-picture:before{content:"\e060"}.factory-bootstrap-404 .glyphicon-map-marker:before{content:"\e062"}.factory-bootstrap-404 .glyphicon-adjust:before{content:"\e063"}.factory-bootstrap-404 .glyphicon-tint:before{content:"\e064"}.factory-bootstrap-404 .glyphicon-edit:before{content:"\e065"}.factory-bootstrap-404 .glyphicon-share:before{content:"\e066"}.factory-bootstrap-404 .glyphicon-check:before{content:"\e067"}.factory-bootstrap-404 .glyphicon-move:before{content:"\e068"}.factory-bootstrap-404 .glyphicon-step-backward:before{content:"\e069"}.factory-bootstrap-404 .glyphicon-fast-backward:before{content:"\e070"}.factory-bootstrap-404 .glyphicon-backward:before{content:"\e071"}.factory-bootstrap-404 .glyphicon-play:before{content:"\e072"}.factory-bootstrap-404 .glyphicon-pause:before{content:"\e073"}.factory-bootstrap-404 .glyphicon-stop:before{content:"\e074"}.factory-bootstrap-404 .glyphicon-forward:before{content:"\e075"}.factory-bootstrap-404 .glyphicon-fast-forward:before{content:"\e076"}.factory-bootstrap-404 .glyphicon-step-forward:before{content:"\e077"}.factory-bootstrap-404 .glyphicon-eject:before{content:"\e078"}.factory-bootstrap-404 .glyphicon-chevron-left:before{content:"\e079"}.factory-bootstrap-404 .glyphicon-chevron-right:before{content:"\e080"}.factory-bootstrap-404 .glyphicon-plus-sign:before{content:"\e081"}.factory-bootstrap-404 .glyphicon-minus-sign:before{content:"\e082"}.factory-bootstrap-404 .glyphicon-remove-sign:before{content:"\e083"}.factory-bootstrap-404 .glyphicon-ok-sign:before{content:"\e084"}.factory-bootstrap-404 .glyphicon-question-sign:before{content:"\e085"}.factory-bootstrap-404 .glyphicon-info-sign:before{content:"\e086"}.factory-bootstrap-404 .glyphicon-screenshot:before{content:"\e087"}.factory-bootstrap-404 .glyphicon-remove-circle:before{content:"\e088"}.factory-bootstrap-404 .glyphicon-ok-circle:before{content:"\e089"}.factory-bootstrap-404 .glyphicon-ban-circle:before{content:"\e090"}.factory-bootstrap-404 .glyphicon-arrow-left:before{content:"\e091"}.factory-bootstrap-404 .glyphicon-arrow-right:before{content:"\e092"}.factory-bootstrap-404 .glyphicon-arrow-up:before{content:"\e093"}.factory-bootstrap-404 .glyphicon-arrow-down:before{content:"\e094"}.factory-bootstrap-404 .glyphicon-share-alt:before{content:"\e095"}.factory-bootstrap-404 .glyphicon-resize-full:before{content:"\e096"}.factory-bootstrap-404 .glyphicon-resize-small:before{content:"\e097"}.factory-bootstrap-404 .glyphicon-exclamation-sign:before{content:"\e101"}.factory-bootstrap-404 .glyphicon-gift:before{content:"\e102"}.factory-bootstrap-404 .glyphicon-leaf:before{content:"\e103"}.factory-bootstrap-404 .glyphicon-fire:before{content:"\e104"}.factory-bootstrap-404 .glyphicon-eye-open:before{content:"\e105"}.factory-bootstrap-404 .glyphicon-eye-close:before{content:"\e106"}.factory-bootstrap-404 .glyphicon-warning-sign:before{content:"\e107"}.factory-bootstrap-404 .glyphicon-plane:before{content:"\e108"}.factory-bootstrap-404 .glyphicon-calendar:before{content:"\e109"}.factory-bootstrap-404 .glyphicon-random:before{content:"\e110"}.factory-bootstrap-404 .glyphicon-comment:before{content:"\e111"}.factory-bootstrap-404 .glyphicon-magnet:before{content:"\e112"}.factory-bootstrap-404 .glyphicon-chevron-up:before{content:"\e113"}.factory-bootstrap-404 .glyphicon-chevron-down:before{content:"\e114"}.factory-bootstrap-404 .glyphicon-retweet:before{content:"\e115"}.factory-bootstrap-404 .glyphicon-shopping-cart:before{content:"\e116"}.factory-bootstrap-404 .glyphicon-folder-close:before{content:"\e117"}.factory-bootstrap-404 .glyphicon-folder-open:before{content:"\e118"}.factory-bootstrap-404 .glyphicon-resize-vertical:before{content:"\e119"}.factory-bootstrap-404 .glyphicon-resize-horizontal:before{content:"\e120"}.factory-bootstrap-404 .glyphicon-hdd:before{content:"\e121"}.factory-bootstrap-404 .glyphicon-bullhorn:before{content:"\e122"}.factory-bootstrap-404 .glyphicon-bell:before{content:"\e123"}.factory-bootstrap-404 .glyphicon-certificate:before{content:"\e124"}.factory-bootstrap-404 .glyphicon-thumbs-up:before{content:"\e125"}.factory-bootstrap-404 .glyphicon-thumbs-down:before{content:"\e126"}.factory-bootstrap-404 .glyphicon-hand-right:before{content:"\e127"}.factory-bootstrap-404 .glyphicon-hand-left:before{content:"\e128"}.factory-bootstrap-404 .glyphicon-hand-up:before{content:"\e129"}.factory-bootstrap-404 .glyphicon-hand-down:before{content:"\e130"}.factory-bootstrap-404 .glyphicon-circle-arrow-right:before{content:"\e131"}.factory-bootstrap-404 .glyphicon-circle-arrow-left:before{content:"\e132"}.factory-bootstrap-404 .glyphicon-circle-arrow-up:before{content:"\e133"}.factory-bootstrap-404 .glyphicon-circle-arrow-down:before{content:"\e134"}.factory-bootstrap-404 .glyphicon-globe:before{content:"\e135"}.factory-bootstrap-404 .glyphicon-wrench:before{content:"\e136"}.factory-bootstrap-404 .glyphicon-tasks:before{content:"\e137"}.factory-bootstrap-404 .glyphicon-filter:before{content:"\e138"}.factory-bootstrap-404 .glyphicon-briefcase:before{content:"\e139"}.factory-bootstrap-404 .glyphicon-fullscreen:before{content:"\e140"}.factory-bootstrap-404 .glyphicon-dashboard:before{content:"\e141"}.factory-bootstrap-404 .glyphicon-paperclip:before{content:"\e142"}.factory-bootstrap-404 .glyphicon-heart-empty:before{content:"\e143"}.factory-bootstrap-404 .glyphicon-link:before{content:"\e144"}.factory-bootstrap-404 .glyphicon-phone:before{content:"\e145"}.factory-bootstrap-404 .glyphicon-pushpin:before{content:"\e146"}.factory-bootstrap-404 .glyphicon-usd:before{content:"\e148"}.factory-bootstrap-404 .glyphicon-gbp:before{content:"\e149"}.factory-bootstrap-404 .glyphicon-sort:before{content:"\e150"}.factory-bootstrap-404 .glyphicon-sort-by-alphabet:before{content:"\e151"}.factory-bootstrap-404 .glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.factory-bootstrap-404 .glyphicon-sort-by-order:before{content:"\e153"}.factory-bootstrap-404 .glyphicon-sort-by-order-alt:before{content:"\e154"}.factory-bootstrap-404 .glyphicon-sort-by-attributes:before{content:"\e155"}.factory-bootstrap-404 .glyphicon-sort-by-attributes-alt:before{content:"\e156"}.factory-bootstrap-404 .glyphicon-unchecked:before{content:"\e157"}.factory-bootstrap-404 .glyphicon-expand:before{content:"\e158"}.factory-bootstrap-404 .glyphicon-collapse-down:before{content:"\e159"}.factory-bootstrap-404 .glyphicon-collapse-up:before{content:"\e160"}.factory-bootstrap-404 .glyphicon-log-in:before{content:"\e161"}.factory-bootstrap-404 .glyphicon-flash:before{content:"\e162"}.factory-bootstrap-404 .glyphicon-log-out:before{content:"\e163"}.factory-bootstrap-404 .glyphicon-new-window:before{content:"\e164"}.factory-bootstrap-404 .glyphicon-record:before{content:"\e165"}.factory-bootstrap-404 .glyphicon-save:before{content:"\e166"}.factory-bootstrap-404 .glyphicon-open:before{content:"\e167"}.factory-bootstrap-404 .glyphicon-saved:before{content:"\e168"}.factory-bootstrap-404 .glyphicon-import:before{content:"\e169"}.factory-bootstrap-404 .glyphicon-export:before{content:"\e170"}.factory-bootstrap-404 .glyphicon-send:before{content:"\e171"}.factory-bootstrap-404 .glyphicon-floppy-disk:before{content:"\e172"}.factory-bootstrap-404 .glyphicon-floppy-saved:before{content:"\e173"}.factory-bootstrap-404 .glyphicon-floppy-remove:before{content:"\e174"}.factory-bootstrap-404 .glyphicon-floppy-save:before{content:"\e175"}.factory-bootstrap-404 .glyphicon-floppy-open:before{content:"\e176"}.factory-bootstrap-404 .glyphicon-credit-card:before{content:"\e177"}.factory-bootstrap-404 .glyphicon-transfer:before{content:"\e178"}.factory-bootstrap-404 .glyphicon-cutlery:before{content:"\e179"}.factory-bootstrap-404 .glyphicon-header:before{content:"\e180"}.factory-bootstrap-404 .glyphicon-compressed:before{content:"\e181"}.factory-bootstrap-404 .glyphicon-earphone:before{content:"\e182"}.factory-bootstrap-404 .glyphicon-phone-alt:before{content:"\e183"}.factory-bootstrap-404 .glyphicon-tower:before{content:"\e184"}.factory-bootstrap-404 .glyphicon-stats:before{content:"\e185"}.factory-bootstrap-404 .glyphicon-sd-video:before{content:"\e186"}.factory-bootstrap-404 .glyphicon-hd-video:before{content:"\e187"}.factory-bootstrap-404 .glyphicon-subtitles:before{content:"\e188"}.factory-bootstrap-404 .glyphicon-sound-stereo:before{content:"\e189"}.factory-bootstrap-404 .glyphicon-sound-dolby:before{content:"\e190"}.factory-bootstrap-404 .glyphicon-sound-5-1:before{content:"\e191"}.factory-bootstrap-404 .glyphicon-sound-6-1:before{content:"\e192"}.factory-bootstrap-404 .glyphicon-sound-7-1:before{content:"\e193"}.factory-bootstrap-404 .glyphicon-copyright-mark:before{content:"\e194"}.factory-bootstrap-404 .glyphicon-registration-mark:before{content:"\e195"}.factory-bootstrap-404 .glyphicon-cloud-download:before{content:"\e197"}.factory-bootstrap-404 .glyphicon-cloud-upload:before{content:"\e198"}.factory-bootstrap-404 .glyphicon-tree-conifer:before{content:"\e199"}.factory-bootstrap-404 .glyphicon-tree-deciduous:before{content:"\e200"}.factory-bootstrap-404 .caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px solid;border-right:4px solid transparent;border-left:4px solid transparent}.factory-bootstrap-404 .dropdown{position:relative}.factory-bootstrap-404 .dropdown-toggle:focus{outline:0}.factory-bootstrap-404 .dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;font-size:14px;list-style:none;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175);background-clip:padding-box}.factory-bootstrap-404 .dropdown-menu.pull-right{right:0;left:auto}.factory-bootstrap-404 .dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.factory-bootstrap-404 .dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.428571429;color:#333;white-space:nowrap}.factory-bootstrap-404 .dropdown-menu>li>a:focus,.factory-bootstrap-404 .dropdown-menu>li>a:hover{color:#262626;text-decoration:none}.factory-bootstrap-404 .dropdown-menu>.active>a,.factory-bootstrap-404 .dropdown-menu>.active>a:focus,.factory-bootstrap-404 .dropdown-menu>.active>a:hover{color:#fff;text-decoration:none;outline:0}.factory-bootstrap-404 .dropdown-menu>.disabled>a,.factory-bootstrap-404 .dropdown-menu>.disabled>a:focus,.factory-bootstrap-404 .dropdown-menu>.disabled>a:hover{color:#999}.factory-bootstrap-404 .dropdown-menu>.disabled>a:focus,.factory-bootstrap-404 .dropdown-menu>.disabled>a:hover{text-decoration:none;cursor:not-allowed;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.factory-bootstrap-404 .open>.dropdown-menu{display:block}.factory-bootstrap-404 .open>a{outline:0}.factory-bootstrap-404 .dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.428571429;color:#999}.factory-bootstrap-404 .dropdown-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:990}.factory-bootstrap-404 .pull-right>.dropdown-menu{right:0;left:auto}.factory-bootstrap-404 .dropup .caret,.factory-bootstrap-404 .navbar-fixed-bottom .dropdown .caret{border-top:0;border-bottom:4px solid;content:""}.factory-bootstrap-404 .dropup .dropdown-menu,.factory-bootstrap-404 .navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px}@media (min-width:768px){.navbar-right .dropdown-menu{right:0;left:auto}}.factory-bootstrap-404 .btn-group,.factory-bootstrap-404 .btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.factory-bootstrap-404 .btn-group-vertical>.btn,.factory-bootstrap-404 .btn-group>.btn{position:relative;float:left}.factory-bootstrap-404 .btn-group-vertical>.btn.active,.factory-bootstrap-404 .btn-group-vertical>.btn:active,.factory-bootstrap-404 .btn-group-vertical>.btn:focus,.factory-bootstrap-404 .btn-group-vertical>.btn:hover,.factory-bootstrap-404 .btn-group>.btn.active,.factory-bootstrap-404 .btn-group>.btn:active,.factory-bootstrap-404 .btn-group>.btn:focus,.factory-bootstrap-404 .btn-group>.btn:hover{z-index:2}.factory-bootstrap-404 .btn-group-vertical>.btn:focus,.factory-bootstrap-404 .btn-group>.btn:focus{outline:0}.factory-bootstrap-404 .btn-group .btn+.btn,.factory-bootstrap-404 .btn-group .btn+.btn-group,.factory-bootstrap-404 .btn-group .btn-group+.btn,.factory-bootstrap-404 .btn-group .btn-group+.btn-group{margin-left:-1px}.factory-bootstrap-404 .btn-toolbar:after,.factory-bootstrap-404 .btn-toolbar:before{display:table;content:" "}.factory-bootstrap-404 .btn-toolbar:after{clear:both}.factory-bootstrap-404 .btn-toolbar .btn-group{float:left}.factory-bootstrap-404 .btn-toolbar>.btn+.btn,.factory-bootstrap-404 .btn-toolbar>.btn+.btn-group,.factory-bootstrap-404 .btn-toolbar>.btn-group+.btn,.factory-bootstrap-404 .btn-toolbar>.btn-group+.btn-group{margin-left:5px}.factory-bootstrap-404 .btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.factory-bootstrap-404 .btn-group>.btn:first-child{margin-left:0}.factory-bootstrap-404 .btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.factory-bootstrap-404 .btn-group>.btn:last-child:not(:first-child),.factory-bootstrap-404 .btn-group>.dropdown-toggle:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.factory-bootstrap-404 .btn-group>.btn-group{float:left}.factory-bootstrap-404 .btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.factory-bootstrap-404 .btn-group>.btn-group:first-child>.btn:last-child,.factory-bootstrap-404 .btn-group>.btn-group:first-child>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.factory-bootstrap-404 .btn-group>.btn-group:last-child>.btn:first-child{border-bottom-left-radius:0;border-top-left-radius:0}.factory-bootstrap-404 .btn-group .dropdown-toggle:active,.factory-bootstrap-404 .btn-group.open .dropdown-toggle{outline:0}.factory-bootstrap-404 .btn-group-xs>.btn{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.factory-bootstrap-404 .btn-group-sm>.btn{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.factory-bootstrap-404 .btn-group-lg>.btn{padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.factory-bootstrap-404 .btn-group>.btn+.dropdown-toggle{padding-right:8px;padding-left:8px}.factory-bootstrap-404 .btn-group>.btn-lg+.dropdown-toggle{padding-right:12px;padding-left:12px}.factory-bootstrap-404 .btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.factory-bootstrap-404 .btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.factory-bootstrap-404 .btn-group{border:4px solid #f9f9f9;border-radius:4px}.factory-bootstrap-404 .btn-group .btn.active.value{text-shadow:none;color:#fff;background-color:#33aad5;-webkit-box-shadow:inset 0 1px 1px #0074a2;box-shadow:inset 0 1px 3px #0074a2;border-top:1px solid #0074a2;border-bottom:1px solid #0074a2;border-left:1px solid #0074a2}.factory-bootstrap-404 .btn .caret{margin-left:0}.factory-bootstrap-404 .btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.factory-bootstrap-404 .dropup .btn-lg .caret{border-width:0 5px 5px}.factory-bootstrap-404 .btn-group-vertical>.btn,.factory-bootstrap-404 .btn-group-vertical>.btn-group,.factory-bootstrap-404 .btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.factory-bootstrap-404 .btn-group-vertical>.btn-group:after,.factory-bootstrap-404 .btn-group-vertical>.btn-group:before{display:table;content:" "}.factory-bootstrap-404 .btn-group-vertical>.btn-group:after{clear:both}.factory-bootstrap-404 .btn-group-vertical>.btn-group>.btn{float:none}.factory-bootstrap-404 .btn-group-vertical>.btn+.btn,.factory-bootstrap-404 .btn-group-vertical>.btn+.btn-group,.factory-bootstrap-404 .btn-group-vertical>.btn-group+.btn,.factory-bootstrap-404 .btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.factory-bootstrap-404 .btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.factory-bootstrap-404 .btn-group-vertical>.btn:first-child:not(:last-child){border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.factory-bootstrap-404 .btn-group-vertical>.btn:last-child:not(:first-child){border-top-right-radius:0;border-bottom-left-radius:4px;border-top-left-radius:0}.factory-bootstrap-404 .btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.factory-bootstrap-404 .btn-group-vertical>.btn-group:first-child>.btn:last-child,.factory-bootstrap-404 .btn-group-vertical>.btn-group:first-child>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.factory-bootstrap-404 .btn-group-vertical>.btn-group:last-child>.btn:first-child{border-top-right-radius:0;border-top-left-radius:0}.factory-bootstrap-404 .btn-group-justified{display:table;width:100%;border-collapse:separate;table-layout:fixed}.factory-bootstrap-404 .btn-group-justified>.btn,.factory-bootstrap-404 .btn-group-justified>.btn-group{display:table-cell;float:none;width:1%}.factory-bootstrap-404 .btn-group-justified>.btn-group .btn{width:100%}[data-toggle=buttons]>.btn>input[type=checkbox],[data-toggle=buttons]>.btn>input[type=radio]{display:none}.factory-bootstrap-404 .input-group{position:relative;display:table;border-collapse:separate}.factory-bootstrap-404 .input-group[class*=col-]{float:none;padding-right:0;padding-left:0}.factory-bootstrap-404 .input-group .form-control{width:100%;margin-bottom:0}.factory-bootstrap-404 .input-group-lg>.form-control,.factory-bootstrap-404 .input-group-lg>.input-group-addon,.factory-bootstrap-404 .input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.factory-bootstrap-404 select.input-group-lg>.form-control,.factory-bootstrap-404 select.input-group-lg>.input-group-addon,.factory-bootstrap-404 select.input-group-lg>.input-group-btn>.btn{height:46px;line-height:46px}.factory-bootstrap-404 textarea.input-group-lg>.form-control,.factory-bootstrap-404 textarea.input-group-lg>.input-group-addon,.factory-bootstrap-404 textarea.input-group-lg>.input-group-btn>.btn{height:auto}.factory-bootstrap-404 .input-group-sm>.form-control,.factory-bootstrap-404 .input-group-sm>.input-group-addon,.factory-bootstrap-404 .input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.factory-bootstrap-404 select.input-group-sm>.form-control,.factory-bootstrap-404 select.input-group-sm>.input-group-addon,.factory-bootstrap-404 select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}.factory-bootstrap-404 textarea.input-group-sm>.form-control,.factory-bootstrap-404 textarea.input-group-sm>.input-group-addon,.factory-bootstrap-404 textarea.input-group-sm>.input-group-btn>.btn{height:auto}.factory-bootstrap-404 .input-group .form-control,.factory-bootstrap-404 .input-group-addon,.factory-bootstrap-404 .input-group-btn{display:table-cell}.fa
8
  */
9
 
10