Scripts n Styles - Version 3.2

Version Description

  • Add AJAX to Shortcode Tab
  • Add "Chosen" for selects
  • General UI Improvements
  • Add CoffeeScript Support
  • Add Hoops Widget
  • Add Global Hoops Shortcodes
  • Add Markdown mode to code editor
  • Add (fix) code editor themes
  • Theme Support (Beta Feature)
Download this release

Release Info

Developer WraithKenny
Plugin Icon wp plugin Scripts n Styles
Version 3.2
Comparing to
See all releases

Code changes from version 3.1.1 to 3.2

Files changed (63) hide show
  1. README.txt +24 -6
  2. css/code-editor.css +4 -1
  3. css/less.css +0 -24
  4. css/meta-box-styles.css +0 -128
  5. css/meta-box.css +295 -0
  6. css/options-styles.css +156 -1
  7. includes/{class.SnS_Admin.php → class-sns-admin.php} +18 -9
  8. includes/{class.SnS_AJAX.php → class-sns-ajax.php} +133 -6
  9. includes/class-sns-code-editor.php +31 -0
  10. includes/{class.SnS_Form.php → class-sns-form.php} +20 -4
  11. includes/{class.SnS_Global_Page.php → class-sns-global-page.php} +64 -31
  12. includes/class-sns-hoops-page.php +194 -0
  13. includes/{class.SnS_List_Usage.php → class-sns-list-usage.php} +0 -0
  14. includes/{class.SnS_Admin_Meta_Box.php → class-sns-meta-box.php} +55 -47
  15. includes/{class.SnS_Settings_Page.php → class-sns-settings-page.php} +31 -27
  16. includes/class-sns-theme-page.php +171 -0
  17. includes/{class.SnS_Usage_Page.php → class-sns-usage-page.php} +6 -3
  18. includes/class.SnS_Admin_Code_Editor.php +0 -90
  19. js/code-editor.js +27 -15
  20. js/global-page.js +47 -7
  21. js/hoops-page.js +105 -0
  22. js/{meta-box-scripts.js → meta-box.js} +153 -10
  23. js/theme-page.js +264 -0
  24. libraries/CodeMirror2/mode/clike/index.html +0 -101
  25. libraries/CodeMirror2/mode/css/index.html +0 -55
  26. libraries/CodeMirror2/mode/htmlmixed/index.html +0 -51
  27. libraries/CodeMirror2/mode/javascript/index.html +0 -77
  28. libraries/CodeMirror2/mode/php/index.html +0 -48
  29. libraries/CodeMirror2/mode/xml/index.html +0 -44
  30. libraries/less/LICENSE +0 -179
  31. libraries/less/dist/less-1.3.0.js +0 -3478
  32. scripts-n-styles.php +202 -28
  33. {libraries → vendor}/CodeMirror2/LICENSE +0 -0
  34. {libraries → vendor}/CodeMirror2/lib/codemirror.css +0 -0
  35. {libraries → vendor}/CodeMirror2/lib/codemirror.js +31 -19
  36. {libraries → vendor}/CodeMirror2/mode/clike/clike.js +0 -0
  37. vendor/CodeMirror2/mode/coffeescript/LICENSE +22 -0
  38. vendor/CodeMirror2/mode/coffeescript/coffeescript.js +347 -0
  39. {libraries → vendor}/CodeMirror2/mode/css/css.js +0 -0
  40. vendor/CodeMirror2/mode/gfm/gfm.js +108 -0
  41. {libraries → vendor}/CodeMirror2/mode/htmlmixed/htmlmixed.js +0 -0
  42. {libraries → vendor}/CodeMirror2/mode/javascript/javascript.js +0 -0
  43. {libraries → vendor}/CodeMirror2/mode/less/less.js +0 -0
  44. vendor/CodeMirror2/mode/markdown/markdown.js +245 -0
  45. {libraries → vendor}/CodeMirror2/mode/php/php.js +0 -0
  46. {libraries → vendor}/CodeMirror2/mode/xml/xml.js +0 -0
  47. {libraries → vendor}/CodeMirror2/theme/ambiance.css +0 -0
  48. {libraries → vendor}/CodeMirror2/theme/blackboard.css +0 -0
  49. {libraries → vendor}/CodeMirror2/theme/cobalt.css +0 -0
  50. {libraries → vendor}/CodeMirror2/theme/eclipse.css +0 -0
  51. {libraries → vendor}/CodeMirror2/theme/elegant.css +0 -0
  52. vendor/CodeMirror2/theme/erlang-dark.css +21 -0
  53. {libraries → vendor}/CodeMirror2/theme/lesser-dark.css +0 -0
  54. {libraries → vendor}/CodeMirror2/theme/monokai.css +0 -0
  55. {libraries → vendor}/CodeMirror2/theme/neat.css +0 -0
  56. {libraries → vendor}/CodeMirror2/theme/night.css +0 -0
  57. {libraries → vendor}/CodeMirror2/theme/rubyblue.css +0 -0
  58. {libraries → vendor}/CodeMirror2/theme/xq-dark.css +0 -0
  59. vendor/chosen/chosen-sprite.png +0 -0
  60. vendor/chosen/chosen.css +392 -0
  61. vendor/chosen/chosen.jquery.min.js +10 -0
  62. vendor/coffee-script.js +8 -0
  63. libraries/less/dist/less-1.3.0.min.js → vendor/less.js +0 -0
README.txt CHANGED
@@ -1,10 +1,11 @@
1
  === Scripts n Styles ===
2
  Contributors: WraithKenny, CaptainN
3
  Tags: admin, CSS, javascript, code, custom, Style
4
- Requires at least: 3.3
5
- Tested up to: 3.4-beta3
6
- Stable tag: 3.1.1
7
  License: GPLv3 or later
 
8
 
9
  This plugin allows Admin users to individually add custom CSS, Classes and JavaScript directly to Post, Pages or any other custom post types.
10
 
@@ -16,14 +17,17 @@ Admin's can also add classes to the TinyMCE "Formats" dropdown which users can u
16
 
17
  Because only well trusted users should ever be allowed to insert JavaScript directly into the pages of your site, this plugin restricts usage to admin type users. Admin's have access to even more sensitive areas by definition, so that should be relatively safe ;)
18
 
19
- ### Notes
20
-
21
- About the implementation:
22
 
23
  * Admin users, or more specifically, *any user with the `manage_options` and `unfiltered_html` capabilities* (which by default is *only* the admin type user) can use this plugin's functionality. Some plugins extend user rolls, and so this plugin would naturally extend include rolls that have the appropriate capability.
24
  * CSS Styles are embeded, not linked, at the bottom of the `head` element with `style` tags by using `wp-head`. If your theme doesn't have this hook, this plugin (as well as most others) won't work.
25
  * JavaScript is embeded, not linked, at the bottom of the `body` (or `head`) element with `script` tags by using `wp-footer` (or `wp-head`). If your theme doesn't have this hook, this plugin (as well as most others) won't work.
26
  * **There is no input validation.** This plugin puts exactly what you type in the meta box directly into the `html` with no error checking. You are an Admin, and we trust you to be carefull. Try not to break anything.
 
 
 
 
 
27
 
28
  == Installation ==
29
 
@@ -54,6 +58,17 @@ Sure, if you are an Admin, just go to the plugin editor and wipe out the uninsta
54
 
55
  == Changelog ==
56
 
 
 
 
 
 
 
 
 
 
 
 
57
  = 3.1.1 =
58
  * Add (fix) CodeMirror Themes
59
 
@@ -112,6 +127,9 @@ Sure, if you are an Admin, just go to the plugin editor and wipe out the uninsta
112
 
113
  == Upgrade Notice ==
114
 
 
 
 
115
  = 3.1.1 =
116
  Add (fix) CodeMirror Themes
117
 
1
  === Scripts n Styles ===
2
  Contributors: WraithKenny, CaptainN
3
  Tags: admin, CSS, javascript, code, custom, Style
4
+ Requires at least: 3.4
5
+ Tested up to: 3.4
6
+ Stable tag: 3.2
7
  License: GPLv3 or later
8
+ License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
10
  This plugin allows Admin users to individually add custom CSS, Classes and JavaScript directly to Post, Pages or any other custom post types.
11
 
17
 
18
  Because only well trusted users should ever be allowed to insert JavaScript directly into the pages of your site, this plugin restricts usage to admin type users. Admin's have access to even more sensitive areas by definition, so that should be relatively safe ;)
19
 
20
+ = Notes about the implementation: =
 
 
21
 
22
  * Admin users, or more specifically, *any user with the `manage_options` and `unfiltered_html` capabilities* (which by default is *only* the admin type user) can use this plugin's functionality. Some plugins extend user rolls, and so this plugin would naturally extend include rolls that have the appropriate capability.
23
  * CSS Styles are embeded, not linked, at the bottom of the `head` element with `style` tags by using `wp-head`. If your theme doesn't have this hook, this plugin (as well as most others) won't work.
24
  * JavaScript is embeded, not linked, at the bottom of the `body` (or `head`) element with `script` tags by using `wp-footer` (or `wp-head`). If your theme doesn't have this hook, this plugin (as well as most others) won't work.
25
  * **There is no input validation.** This plugin puts exactly what you type in the meta box directly into the `html` with no error checking. You are an Admin, and we trust you to be carefull. Try not to break anything.
26
+ * Do to the licensing of the libraries used, this plugin is released "GPL 3.0 or later" if you care about those things.
27
+
28
+ = Contact: =
29
+
30
+ You'll have better luck contacting the other if you try me on [Twitter](http://twitter.com/WraithKenny) and [Github](https://github.com/unFocus/Scripts-n-Styles/issues). If that fails, I have an [open thread](http://wordpress.org/support/topic/contacting-scripts-n-styles-author "Contacting Scripts n Styles' author") on the support forums that will trigger an email.
31
 
32
  == Installation ==
33
 
58
 
59
  == Changelog ==
60
 
61
+ = 3.2 =
62
+ * Add AJAX to Shortcode Tab
63
+ * Add "Chosen" for selects
64
+ * General UI Improvements
65
+ * Add CoffeeScript Support
66
+ * Add Hoops Widget
67
+ * Add Global Hoops Shortcodes
68
+ * Add Markdown mode to code editor
69
+ * Add (fix) code editor themes
70
+ * Theme Support (Beta Feature)
71
+
72
  = 3.1.1 =
73
  * Add (fix) CodeMirror Themes
74
 
127
 
128
  == Upgrade Notice ==
129
 
130
+ = 3.2 =
131
+ New Major Features
132
+
133
  = 3.1.1 =
134
  Add (fix) CodeMirror Themes
135
 
css/code-editor.css CHANGED
@@ -15,6 +15,9 @@ body .CodeMirror-scroll {
15
  height: auto;
16
  overflow: auto;
17
  }
 
 
 
18
  #template .CodeMirror div {
19
  margin-right: 0;
20
- }
15
  height: auto;
16
  overflow: auto;
17
  }
18
+ #template .CodeMirror {
19
+ margin-right: 30px;
20
+ }
21
  #template .CodeMirror div {
22
  margin-right: 0;
23
+ }
css/less.css DELETED
@@ -1,24 +0,0 @@
1
- /* Loosely based on the Midlesscss Textmate theme */
2
-
3
- .cm-s-lesscss { background: #262626; color: #f8f8f8; }
4
- .cm-s-lesscss span.CodeMirror-selected { background: #a8f !important; }
5
- .cm-s-lesscss .CodeMirror-gutter { background: #0a001f; border-right: 1px solid #aaa; }
6
- .cm-s-lesscss .CodeMirror-gutter-text { color: #f8f8f8; }
7
- .cm-s-lesscss .CodeMirror-cursor { border-left: 1px solid white !important; }
8
-
9
- .cm-s-lesscss span.cm-variable { color: #D9BF8C; }
10
- .cm-s-lesscss span.cm-comment { color: #666; }
11
- .cm-s-lesscss span.cm-atom { color: #C2B470; /*#845dc4;*/ }
12
- .cm-s-lesscss span.cm-number,
13
- .cm-s-lesscss span.cm-attribute { color: #B35E4D; }
14
- .cm-s-lesscss span.cm-keyword { color: #599eff; }
15
- .cm-s-lesscss span.cm-string { color: #BCD279; }
16
- .cm-s-lesscss span.cm-meta { color: #738C73; }
17
- .cm-s-lesscss span.cm-variable-2,
18
- .cm-s-lesscss span.cm-tag { color: #669199; }
19
- .cm-s-lesscss span.cm-variable-3,
20
- .cm-s-lesscss span.cm-def { color: white; }
21
- .cm-s-lesscss span.cm-error { color: #9d1e15; }
22
- .cm-s-lesscss span.cm-bracket { color: #EBEFE7; }
23
- .cm-s-lesscss span.cm-builtin,
24
- .cm-s-lesscss span.cm-special { color: #ff9e59; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
css/meta-box-styles.css DELETED
@@ -1,128 +0,0 @@
1
- /* MetaBox.css */
2
-
3
-
4
- .wp-tab-bar {
5
- display: none;
6
- }
7
- body.js .wp-tab-bar {
8
- display: block;
9
- }
10
- #SnS_meta_box .title {
11
- margin-top: 1.5em;
12
- }
13
- body.js #SnS_meta_box .title,
14
- body.js .wp-tab-panel {
15
- display: none;
16
- }
17
- body.js .wp-tabs-panel-active {
18
- display: block;
19
- }
20
-
21
- .CodeMirror {
22
- border: 1px solid #DFDFDF;
23
- background-color: white;
24
- border-radius: 3px;
25
- margin: 8px 0;
26
- -moz-background-clip: padding;
27
- -webkit-background-clip: padding-box;
28
- background-clip: padding-box;
29
- overflow: hidden;
30
- }
31
- .CodeMirror, #editorcontainer #content {
32
- font-family: "Courier New", Courier, monospace;
33
- }
34
- .CodeMirror-scroll {
35
- height: auto;
36
- min-height: 50px;
37
- max-height: 300px;
38
- overflow: auto;
39
- }
40
-
41
- /* temp fix border-bottom rounding error problem.
42
- #side-sortables .wp-tab-bar {
43
- margin-bottom: 0px;
44
- min-height: 19px;
45
- }*/
46
-
47
- /* core styles */
48
- #post-body .wp-tab-bar a {
49
- text-decoration: underline;
50
- }
51
- #post-body .wp-tab-bar {
52
- float: left;
53
- margin: 0 -120px 0 5px;
54
- padding: 0;
55
- text-align: right;
56
- width: 120px;
57
- }
58
- #post-body .wp-tab-bar li {
59
- padding: 8px;
60
- display: list-item;
61
- }
62
- #post-body .wp-tab-active {
63
- border-radius: 3px 0 0 3px;
64
- border-style: solid none solid solid;
65
- border-width: 1px 0 1px 1px;
66
- margin-right: -1px;
67
- }
68
- #post-body .wp-tab-active a {
69
- font-weight: bold;
70
- text-decoration: none;
71
- }
72
- #post-body .wp-tab-panel {
73
- margin: 0 5px 0 125px;
74
- border-style: solid;
75
- border-width: 1px;
76
- height: 200px;
77
- overflow: auto;
78
- padding: 0.5em 0.9em;
79
- }
80
- /* end core styles */
81
-
82
- #post-body #SnS_meta_box .wp-tab-bar li {
83
- padding: 0px;
84
- }
85
- #post-body #SnS_meta_box .wp-tab-bar a {
86
- padding: 8px;
87
- display: block;
88
- }
89
- #SnS_meta_box .wp-tab-panel {
90
- height: auto;
91
- min-height: 200px;
92
- }
93
-
94
- #add-mce-dropdown-names label {
95
- width: 50px;
96
- display: inline-block
97
- }
98
- .sns-ajax-loading {
99
- vertical-align: middle;
100
- }
101
- .sns-ajax-wrap {
102
- height: 23px;
103
- }
104
- #sns-classes {
105
- overflow: hidden;
106
- width: 100%;
107
- }
108
- #SnS_classes_mce_wrapper {
109
- margin: 6px 0;
110
- }
111
- #mce-dropdown-names {
112
- display: none;
113
- }
114
- body.js #mce-dropdown-names {
115
- display: block;
116
- }
117
- #delete-mce-dropdown-names .sns-ajax-delete {
118
- cursor: pointer;
119
- display: inline-block;
120
- height: 10px;
121
- overflow: hidden;
122
- text-indent: -9999px;
123
- width: 10px;
124
- background: url("/wp-admin/images/xit.gif") no-repeat scroll 0 0 transparent;
125
- }
126
- #delete-mce-dropdown-names .sns-ajax-delete:hover {
127
- background: url("/wp-admin/images/xit.gif") no-repeat scroll -10px 0 transparent;
128
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
css/meta-box.css ADDED
@@ -0,0 +1,295 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* MetaBox.css */
2
+ .CodeMirror {
3
+ border: 1px solid #DFDFDF;
4
+ background-color: white;
5
+ border-radius: 3px;
6
+ margin: 8px 0;
7
+ -moz-background-clip: padding;
8
+ -webkit-background-clip: padding-box;
9
+ background-clip: padding-box;
10
+ overflow: hidden;
11
+ }
12
+
13
+ /* Code Decorations */
14
+ .style > .CodeMirror:before,
15
+ .style > .CodeMirror:after {
16
+ display: block;
17
+ padding: .5em;
18
+ background-color: #f5f5f5;
19
+ }
20
+ .style > .CodeMirror:before {
21
+ border-bottom: 1px solid #dfdfdf;
22
+ }
23
+ .style > .CodeMirror:after {
24
+ border-top: 1px solid #dfdfdf;
25
+ }
26
+ .style > .CodeMirror:before {
27
+ content: '<style type="text/css">';
28
+ }
29
+ .style > .CodeMirror:after {
30
+ content: '</style>';
31
+ }
32
+ .script > .CodeMirror:before,
33
+ .script > .CodeMirror:after {
34
+ display: block;
35
+ padding: .5em;
36
+ background-color: #f5f5f5;
37
+ }
38
+ .script > .CodeMirror:before {
39
+ border-bottom: 1px solid #dfdfdf;
40
+ }
41
+ .script > .CodeMirror:after {
42
+ border-top: 1px solid #dfdfdf;
43
+ }
44
+ .script > .CodeMirror:before {
45
+ content: '<script type="text/javascript">';
46
+ }
47
+ .script > .CodeMirror:after {
48
+ content: '</script>';
49
+ }
50
+ .less > .CodeMirror:before,
51
+ .less > .CodeMirror:after {
52
+ display: block;
53
+ padding: .5em;
54
+ background-color: #f5f5f5;
55
+ }
56
+ .less > .CodeMirror:before {
57
+ border-bottom: 1px solid #dfdfdf;
58
+ }
59
+ .less > .CodeMirror:after {
60
+ border-top: 1px solid #dfdfdf;
61
+ }
62
+ .less > .CodeMirror:before {
63
+ content: '<style type="text/less">';
64
+ }
65
+ .less > .CodeMirror:after {
66
+ content: '</style>';
67
+ }
68
+ .coffee > .CodeMirror:before,
69
+ .coffee > .CodeMirror:after {
70
+ display: block;
71
+ padding: .5em;
72
+ background-color: #f5f5f5;
73
+ }
74
+ .coffee > .CodeMirror:before {
75
+ border-bottom: 1px solid #dfdfdf;
76
+ }
77
+ .coffee > .CodeMirror:after {
78
+ border-top: 1px solid #dfdfdf;
79
+ }
80
+ .coffee > .CodeMirror:before {
81
+ content: '<script type="text/coffeescript">';
82
+ }
83
+ .coffee > .CodeMirror:after {
84
+ content: '</script>';
85
+ }
86
+ /* end Code Decorations */
87
+
88
+
89
+ .CodeMirror,
90
+ #editorcontainer #content {
91
+ font-family: "Courier New", Courier, monospace;
92
+ }
93
+ .CodeMirror-scroll {
94
+ height: auto;
95
+ min-height: 50px;
96
+ max-height: 300px;
97
+ overflow: auto;
98
+ }
99
+ .sns-shortcode p {
100
+ margin: 0;
101
+ }
102
+ .sns-collapsed-shortcode {
103
+ overflow: hidden;
104
+ }
105
+ .sns-collapsed-shortcode .sns-collapsed-shortcode-btn {
106
+ background-position: 1px -107px;
107
+ }
108
+ .sns-collapsed-shortcode-btn {
109
+ cursor: pointer;
110
+ float: left;
111
+ height: 1.4em;
112
+ width: 1.4em;
113
+ background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%0F%00%00%00%7B%08%06%00%00%00%ABe%DA%9D%00%00%00%19tEXtSoftware%00Adobe%20ImageReadyq%C9e%3C%00%00%01%90IDATx%DA%EC%991N%C3%40%10E%D7%40%1D%A4(G%A0%A2%A0%E2%06Q%90%DB%5C%02%09%AA%F4%A1%8C%7BW%20%E5%10P%DA%22%E2%06%AERP%E5%08%08)%F4%D6%F2G%FA%C5j%E5%F5%AEM%81%10%B3%D2%D7%EC%3A~%1E%7Bci%BE%C6%99%B5%D6%8C%1D'%E6%07%E3%8F%C2g%FE%81%BA%AE%1B%84%0B.'%D0%17%E7%87%3C%CF%AFc%99%0B%E8%9C%CA%9Cy%E1%9F%98u%FDU%C8%FE%8A%B0p%0E%ED%90%F5%26%F5%99WP%CBy%CBu%DA%86!%CB%3B%C2%96%CB-%D7%83v%FB%01%B2%8C%DDC%9E9%A4%AA%AA%E6%7D%BFg%FAn%2B%AC%B0%C2%0A%2B%FC%CB0%EA%F4%BC%EF%F7%60%AD%028E%F8%80f(%B1%9FC3oh%2B6%832%23%EB%25%C2%1E%3A%A53%B8%EA*%F0%A1%CC%25A%C3X%26%DD6%B2.%3D3%23c%C1%E3%D1%CCk%E8HYg%BEN%DEm%7D%B7%15VXa%85%15V8v%82%D4e%B6%3F%E2%7D%12%CFZ%94%2C%F4%C7%D4%26%CB%94%26%E6%D6%B1%16%F1%0E%0D%7D%D7%8E.%C8%1D%93%E83%C3%F1%BC%89%EF%82%9E%9C%3E%89qZ%3C%FD%1B%26%86%0D%BA%17%FB%C4%BB0%A3Z%1Dlw%2C%A1F%5B%1D%0A%2B%AC%B0%C2%0A%2B%CC%22%DFt%F5%08R3%CB%B7%9Bg%F9%92Bo2%EA%B6%C5%CC%ECq%81Gz%95%24%D8%F5%20bj%EE%A4%D5%E3%F7%8AB%B0%EBAZz%94%19%3DK%DC%87q%88'Y%85%BE%DD%84%E0%03T%00z%E9%BB%F2%7F%F4%24%DF%02%0C%00%C9H%D9%18%7B.%E6%93%00%00%00%00IEND%AEB%60%82");
114
+ background-attachment: scroll;
115
+ background-repeat: no-repeat;
116
+ background-position: 1px 1px;
117
+ margin-right: .5em;
118
+ }
119
+ .sns-collapsed-shortcode .CodeMirror,
120
+ .sns-collapsed-shortcode .sns-ajax-wrap {
121
+ visibility: hidden;
122
+ position: absolute;
123
+ }
124
+ #add-mce-dropdown-names label {
125
+ width: 50px;
126
+ display: inline-block;
127
+ }
128
+ .sns-ajax-loading {
129
+ vertical-align: middle;
130
+ }
131
+ .sns-ajax-wrap {
132
+ height: 23px;
133
+ }
134
+ #sns-classes {
135
+ overflow: hidden;
136
+ width: 100%;
137
+ }
138
+ #SnS_classes_mce_wrapper {
139
+ margin: 6px 0;
140
+ }
141
+ #mce-dropdown-names {
142
+ display: none;
143
+ }
144
+ body.js #mce-dropdown-names {
145
+ display: block;
146
+ }
147
+ #delete-mce-dropdown-names .sns-ajax-delete {
148
+ cursor: pointer;
149
+ display: inline-block;
150
+ height: 10px;
151
+ overflow: hidden;
152
+ text-indent: -9999px;
153
+ width: 10px;
154
+ background: url("/wp-admin/images/xit.gif") no-repeat scroll 0 0 transparent;
155
+ }
156
+ #delete-mce-dropdown-names .sns-ajax-delete:hover {
157
+ background: url("/wp-admin/images/xit.gif") no-repeat scroll -10px 0 transparent;
158
+ }
159
+ body.js #SnS_meta_box .title {
160
+ display: none;
161
+ }
162
+ #SnS_meta_box > .inside {
163
+ height: 300px;
164
+ overflow: auto;
165
+ padding: 6px 10px 8px;
166
+ margin: 0;
167
+ position: static;
168
+ }
169
+ body.no-js #side-sortables #SnS_meta_box > .inside {
170
+ margin-top: 33px;
171
+ padding-top: 0;
172
+ }
173
+ body.js #SnS_meta_box > .inside {
174
+ height: auto;
175
+ padding: 0 10px;
176
+ margin: 6px 0 8px;
177
+ }
178
+ body.no-js #SnS_meta_box .wp-tab-bar {
179
+ position: absolute;
180
+ top: 36px;
181
+ }
182
+ #SnS_meta_box .wp-tab-bar {
183
+ text-align: right;
184
+ overflow: auto;
185
+ width: 100%;
186
+ padding: 0;
187
+ margin-top: 3px;
188
+ margin-bottom: -1px;
189
+ }
190
+ #SnS_meta_box .wp-tab-bar li {
191
+ float: left;
192
+ background-color: inherit;
193
+ border: 0 none;
194
+ margin: 0;
195
+ padding: 0;
196
+ display: inline;
197
+ }
198
+ #SnS_meta_box .wp-tab-bar a {
199
+ display: block;
200
+ border-radius: 3px 3px 0 0;
201
+ border-style: none;
202
+ border-width: 1px 1px 0 1px;
203
+ padding: 3px 5px 5px;
204
+ margin-right: 3px;
205
+ text-decoration: none;
206
+ }
207
+ #SnS_meta_box .wp-tab-active a {
208
+ background-color: #FFFFFF;
209
+ border-color: #DFDFDF;
210
+ border-style: solid;
211
+ margin-bottom: -1px;
212
+ }
213
+ /*
214
+ * .wp-tab-panel rules
215
+ */
216
+ body.js #SnS_meta_box .wp-tab-panel {
217
+ display: none;
218
+ }
219
+ body.js #SnS_meta_box .wp-tabs-panel-active {
220
+ display: block;
221
+ }
222
+ body.no-js #SnS_meta_box .wp-tab-panel {
223
+ margin-bottom: 1em;
224
+ }
225
+ body.js #SnS_meta_box .wp-tab-panel {
226
+ margin-bottom: 0;
227
+ }
228
+ #SnS_meta_box .wp-tab-panel {
229
+ border-style: solid;
230
+ border-width: 1px;
231
+ overflow: auto;
232
+ padding: 0.5em 0.9em;
233
+ min-height: 200px;
234
+ height: auto;
235
+ }
236
+ /* See @media */
237
+ #normal-sortables #SnS_meta_box .wp-tab-bar,
238
+ #advanced-sortables #SnS_meta_box .wp-tab-bar {
239
+ float: left;
240
+ margin: 0 -1px 0 5px;
241
+ width: 121px;
242
+ overflow: visible;
243
+ }
244
+ #normal-sortables #SnS_meta_box .wp-tab-panel,
245
+ #advanced-sortables #SnS_meta_box .wp-tab-panel {
246
+ margin-left: 125px;
247
+ margin-right: 5px;
248
+ }
249
+ #normal-sortables #SnS_meta_box .wp-tab-bar a,
250
+ #advanced-sortables #SnS_meta_box .wp-tab-bar a {
251
+ padding: 8px;
252
+ width: 104px;
253
+ }
254
+ #normal-sortables #SnS_meta_box .wp-tab-active a,
255
+ #advanced-sortables #SnS_meta_box .wp-tab-active a {
256
+ border-radius: 3px 0 0 3px;
257
+ border-style: solid none solid solid;
258
+ border-width: 1px 0 1px 1px;
259
+ margin-right: -1px;
260
+ font-weight: bold;
261
+ }
262
+ @media only screen and (max-width: 1050px) {
263
+ body.no-js #SnS_meta_box > .inside {
264
+ margin-top: 33px;
265
+ padding-top: 0;
266
+ }
267
+ #normal-sortables #SnS_meta_box .wp-tab-bar,
268
+ #advanced-sortables #SnS_meta_box .wp-tab-bar {
269
+ float: none;
270
+ margin: 3px 0 -1px;
271
+ width: 100%;
272
+ overflow: hidden;
273
+ }
274
+ #normal-sortables #SnS_meta_box .wp-tab-panel,
275
+ #advanced-sortables #SnS_meta_box .wp-tab-panel {
276
+ margin: 0 0 1em;
277
+ }
278
+ body.js #normal-sortables #SnS_meta_box .wp-tab-panel,
279
+ body.js #advanced-sortables #SnS_meta_box .wp-tab-panel {
280
+ margin: 0;
281
+ }
282
+ #normal-sortables #SnS_meta_box .wp-tab-bar a,
283
+ #advanced-sortables #SnS_meta_box .wp-tab-bar a {
284
+ padding: 3px 5px 5px;
285
+ width: auto;
286
+ }
287
+ #normal-sortables #SnS_meta_box .wp-tab-active a,
288
+ #advanced-sortables #SnS_meta_box .wp-tab-active a {
289
+ border-radius: 3px 3px 0 0;
290
+ border-style: solid solid none solid;
291
+ border-width: 1px 1px 0 1px;
292
+ margin-right: 3px;
293
+ font-weight: normal;
294
+ }
295
+ }
css/options-styles.css CHANGED
@@ -7,18 +7,173 @@ textarea.code {
7
  border: 1px solid #DFDFDF;
8
  background-color: white;
9
  border-radius: 3px;
10
- margin: 8px 0;
11
  -moz-background-clip: padding;
12
  -webkit-background-clip: padding-box;
13
  background-clip: padding-box;
14
  overflow: hidden;
 
15
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  body .CodeMirror-scroll {
17
  height: auto;
18
  min-height: 50px;
19
  max-height: 300px;
20
  overflow: auto;
21
  }
 
 
 
22
  #icon-sns {
23
  background: no-repeat center url('../images/icon32.png');
24
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  border: 1px solid #DFDFDF;
8
  background-color: white;
9
  border-radius: 3px;
10
+ margin: 8px 0 6px;
11
  -moz-background-clip: padding;
12
  -webkit-background-clip: padding-box;
13
  background-clip: padding-box;
14
  overflow: hidden;
15
+ font-family: "Courier New", Courier, monospace;
16
  }
17
+
18
+ /* Code Decorations */
19
+ .style > .CodeMirror:before,
20
+ .style > .CodeMirror:after {
21
+ display: block;
22
+ padding: .5em;
23
+ background-color: #f5f5f5;
24
+ }
25
+ .style > .CodeMirror:before {
26
+ border-bottom: 1px solid #dfdfdf;
27
+ }
28
+ .style > .CodeMirror:after {
29
+ border-top: 1px solid #dfdfdf;
30
+ }
31
+ .style > .CodeMirror:before {
32
+ content: '<style type="text/css">';
33
+ }
34
+ .style > .CodeMirror:after {
35
+ content: '</style>';
36
+ }
37
+ .script > .CodeMirror:before,
38
+ .script > .CodeMirror:after {
39
+ display: block;
40
+ padding: .5em;
41
+ background-color: #f5f5f5;
42
+ }
43
+ .script > .CodeMirror:before {
44
+ border-bottom: 1px solid #dfdfdf;
45
+ }
46
+ .script > .CodeMirror:after {
47
+ border-top: 1px solid #dfdfdf;
48
+ }
49
+ .script > .CodeMirror:before {
50
+ content: '<script type="text/javascript">';
51
+ }
52
+ .script > .CodeMirror:after {
53
+ content: '</script>';
54
+ }
55
+ .less > .CodeMirror:before,
56
+ .less > .CodeMirror:after {
57
+ display: block;
58
+ padding: .5em;
59
+ background-color: #f5f5f5;
60
+ }
61
+ .less > .CodeMirror:before {
62
+ border-bottom: 1px solid #dfdfdf;
63
+ }
64
+ .less > .CodeMirror:after {
65
+ border-top: 1px solid #dfdfdf;
66
+ }
67
+ .less > .CodeMirror:before {
68
+ content: '<style type="text/less">';
69
+ }
70
+ .less > .CodeMirror:after {
71
+ content: '</style>';
72
+ }
73
+ .coffee > .CodeMirror:before,
74
+ .coffee > .CodeMirror:after {
75
+ display: block;
76
+ padding: .5em;
77
+ background-color: #f5f5f5;
78
+ }
79
+ .coffee > .CodeMirror:before {
80
+ border-bottom: 1px solid #dfdfdf;
81
+ }
82
+ .coffee > .CodeMirror:after {
83
+ border-top: 1px solid #dfdfdf;
84
+ }
85
+ .coffee > .CodeMirror:before {
86
+ content: '<script type="text/coffeescript">';
87
+ }
88
+ .coffee > .CodeMirror:after {
89
+ content: '</script>';
90
+ }
91
+ /* end Code Decorations */
92
+
93
+
94
  body .CodeMirror-scroll {
95
  height: auto;
96
  min-height: 50px;
97
  max-height: 300px;
98
  overflow: auto;
99
  }
100
+ .scripts-n-styles_page_sns_theme .CodeMirror-scroll {
101
+ max-height: none;
102
+ }
103
  #icon-sns {
104
  background: no-repeat center url('../images/icon32.png');
105
  }
106
+
107
+ .sns-less-ide .disabled {
108
+ cursor: default;
109
+ }
110
+ .sns-less-ide .inside {
111
+ margin: 6px 0;
112
+ padding: 0 10px;
113
+ line-height: 1.4em;
114
+ }
115
+ .sns-collapsed {
116
+ overflow: hidden;
117
+ }
118
+ .sns-collapsed .sns-collapsed-btn {
119
+ background-position: 1px -107px;
120
+ }
121
+ .sns-collapsed-btn + label,
122
+ .sns-collapsed-btn + p {
123
+ height: 1.4em;
124
+ display: block;
125
+ margin: 0;
126
+ }
127
+ .sns-collapsed-btn {
128
+ cursor: pointer;
129
+ float: left;
130
+ height: 1.4em;
131
+ width: 1.4em;
132
+ background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%0F%00%00%00%7B%08%06%00%00%00%ABe%DA%9D%00%00%00%19tEXtSoftware%00Adobe%20ImageReadyq%C9e%3C%00%00%01%90IDATx%DA%EC%991N%C3%40%10E%D7%40%1D%A4(G%A0%A2%A0%E2%06Q%90%DB%5C%02%09%AA%F4%A1%8C%7BW%20%E5%10P%DA%22%E2%06%AERP%E5%08%08)%F4%D6%F2G%FA%C5j%E5%F5%AEM%81%10%B3%D2%D7%EC%3A~%1E%7Bci%BE%C6%99%B5%D6%8C%1D'%E6%07%E3%8F%C2g%FE%81%BA%AE%1B%84%0B.'%D0%17%E7%87%3C%CF%AFc%99%0B%E8%9C%CA%9Cy%E1%9F%98u%FDU%C8%FE%8A%B0p%0E%ED%90%F5%26%F5%99WP%CBy%CBu%DA%86!%CB%3B%C2%96%CB-%D7%83v%FB%01%B2%8C%DDC%9E9%A4%AA%AA%E6%7D%BFg%FAn%2B%AC%B0%C2%0A%2B%FC%CB0%EA%F4%BC%EF%F7%60%AD%028E%F8%80f(%B1%9FC3oh%2B6%832%23%EB%25%C2%1E%3A%A53%B8%EA*%F0%A1%CC%25A%C3X%26%DD6%B2.%3D3%23c%C1%E3%D1%CCk%E8HYg%BEN%DEm%7D%B7%15VXa%85%15V8v%82%D4e%B6%3F%E2%7D%12%CFZ%94%2C%F4%C7%D4%26%CB%94%26%E6%D6%B1%16%F1%0E%0D%7D%D7%8E.%C8%1D%93%E83%C3%F1%BC%89%EF%82%9E%9C%3E%89qZ%3C%FD%1B%26%86%0D%BA%17%FB%C4%BB0%A3Z%1Dlw%2C%A1F%5B%1D%0A%2B%AC%B0%C2%0A%2B%CC%22%DFt%F5%08R3%CB%B7%9Bg%F9%92Bo2%EA%B6%C5%CC%ECq%81Gz%95%24%D8%F5%20bj%EE%A4%D5%E3%F7%8AB%B0%EBAZz%94%19%3DK%DC%87q%88'Y%85%BE%DD%84%E0%03T%00z%E9%BB%F2%7F%F4%24%DF%02%0C%00%C9H%D9%18%7B.%E6%93%00%00%00%00IEND%AEB%60%82");
133
+ background-attachment: scroll;
134
+ background-repeat: no-repeat;
135
+ background-position: 1px 1px;
136
+ margin-right: .5em;
137
+
138
+ }
139
+
140
+ .sns-collapsed .CodeMirror,
141
+ .sns-collapsed .code,
142
+ .sns-collapsed .sns-ajax-wrap,
143
+ .sns-collapsed textarea {
144
+ visibility: hidden;
145
+ position: absolute;
146
+ }
147
+
148
+ .sns-ajax-loading {
149
+ vertical-align: middle;
150
+ }
151
+ .sns-ajax-wrap {
152
+ height: 23px;
153
+ }
154
+ .sns-ajax-wrap .single-status {
155
+ display: inline-block;
156
+ vertical-align: middle
157
+ }
158
+ .sns-ajax-wrap .single-status .settings-error {
159
+ margin: 0;
160
+ }
161
+
162
+ .sns-shortcode {
163
+ background-color: #F5F5F5;
164
+ background-image: -moz-linear-gradient(center top , #F9F9F9, #F5F5F5);
165
+ border-color: #DFDFDF;
166
+ border-radius: 3px 3px 3px 3px;
167
+ box-shadow: 0 1px 0 #FFFFFF inset;
168
+ border-style: solid;
169
+ border-width: 1px;
170
+ line-height: 1;
171
+ margin-bottom: 20px;
172
+ padding: 0;
173
+ }
174
+ .sns-shortcode .inside {
175
+ margin: 6px 0 8px;
176
+ position: relative;
177
+ line-height: 1.4em;
178
+ padding: 0 10px;
179
+ }
includes/{class.SnS_Admin.php → class-sns-admin.php} RENAMED
@@ -7,13 +7,15 @@
7
  * post types.
8
  */
9
 
10
- require_once( 'class.SnS_Admin_Meta_Box.php' );
11
- require_once( 'class.SnS_Admin_Code_Editor.php' );
12
- require_once( 'class.SnS_Settings_Page.php' );
13
- require_once( 'class.SnS_Usage_Page.php' );
14
- require_once( 'class.SnS_Global_Page.php' );
15
- require_once( 'class.SnS_AJAX.php' );
16
- require_once( 'class.SnS_Form.php' );
 
 
17
 
18
  class SnS_Admin
19
  {
@@ -75,6 +77,9 @@ class SnS_Admin
75
  break;
76
  }
77
  SnS_Global_Page::init();
 
 
 
78
  SnS_Settings_Page::init();
79
  SnS_Usage_Page::init();
80
  }
@@ -91,9 +96,13 @@ class SnS_Admin
91
  <?php if ( ! isset( $options[ 'menu_position' ] ) || 'options-general.php' != $options[ 'menu_position' ] ) settings_errors(); ?>
92
  <?php screen_icon( 'none' ); ?>
93
  <h3 class="nav-tab-wrapper">
94
- <a class="nav-tab<?php echo ( self::MENU_SLUG == $page ) ? ' nav-tab-active': ''; ?>" href="<?php menu_page_url( self::MENU_SLUG ); ?>"><?php _e( 'Global', 'scripts-n-styles' ); ?></a>
 
 
 
 
95
  <a class="nav-tab<?php echo ( self::MENU_SLUG . '_settings' == $page ) ? ' nav-tab-active': ''; ?>" href="<?php menu_page_url( self::MENU_SLUG . '_settings' ); ?>"><?php _e( 'Settings', 'scripts-n-styles' ); ?></a>
96
- <a class="nav-tab<?php echo ( self::MENU_SLUG . '_usage' == $page ) ? ' nav-tab-active': ''; ?>" href="<?php menu_page_url( self::MENU_SLUG . '_usage' ); ?>"><?php _e( 'Usage', 'scripts-n-styles' ); ?></a>
97
  </h3>
98
  <?php
99
  }
7
  * post types.
8
  */
9
 
10
+ require_once( 'class-sns-meta-box.php' );
11
+ require_once( 'class-sns-code-editor.php' );
12
+ require_once( 'class-sns-settings-page.php' );
13
+ require_once( 'class-sns-usage-page.php' );
14
+ require_once( 'class-sns-global-page.php' );
15
+ require_once( 'class-sns-hoops-page.php' );
16
+ require_once( 'class-sns-theme-page.php' );
17
+ require_once( 'class-sns-ajax.php' );
18
+ require_once( 'class-sns-form.php' );
19
 
20
  class SnS_Admin
21
  {
77
  break;
78
  }
79
  SnS_Global_Page::init();
80
+ SnS_Hoops_Page::init();
81
+ if ( current_theme_supports( 'scripts-n-styles' ) )
82
+ SnS_Theme_Page::init();
83
  SnS_Settings_Page::init();
84
  SnS_Usage_Page::init();
85
  }
96
  <?php if ( ! isset( $options[ 'menu_position' ] ) || 'options-general.php' != $options[ 'menu_position' ] ) settings_errors(); ?>
97
  <?php screen_icon( 'none' ); ?>
98
  <h3 class="nav-tab-wrapper">
99
+ <a class="nav-tab<?php echo ( self::MENU_SLUG == $page ) ? ' nav-tab-active': ''; ?>" href="<?php menu_page_url( self::MENU_SLUG ); ?>"><?php _e( 'Global', 'scripts-n-styles' ); ?></a>
100
+ <a class="nav-tab<?php echo ( self::MENU_SLUG . '_hoops' == $page ) ? ' nav-tab-active': ''; ?>" href="<?php menu_page_url( self::MENU_SLUG . '_hoops' ); ?>"><?php _e( 'Hoops', 'scripts-n-styles' ); ?></a>
101
+ <?php if ( current_theme_supports( 'scripts-n-styles' ) ) { ?>
102
+ <a class="nav-tab<?php echo ( self::MENU_SLUG . '_theme' == $page ) ? ' nav-tab-active': ''; ?>" href="<?php menu_page_url( self::MENU_SLUG . '_theme' ); ?>"><?php _e( 'Theme', 'scripts-n-styles' ); ?></a>
103
+ <?php } ?>
104
  <a class="nav-tab<?php echo ( self::MENU_SLUG . '_settings' == $page ) ? ' nav-tab-active': ''; ?>" href="<?php menu_page_url( self::MENU_SLUG . '_settings' ); ?>"><?php _e( 'Settings', 'scripts-n-styles' ); ?></a>
105
+ <a class="nav-tab<?php echo ( self::MENU_SLUG . '_usage' == $page ) ? ' nav-tab-active': ''; ?>" href="<?php menu_page_url( self::MENU_SLUG . '_usage' ); ?>"><?php _e( 'Usage', 'scripts-n-styles' ); ?></a>
106
  </h3>
107
  <?php
108
  }
includes/{class.SnS_AJAX.php → class-sns-ajax.php} RENAMED
@@ -13,6 +13,27 @@ class SnS_AJAX
13
  add_action( 'wp_ajax_sns_styles', array( __CLASS__, 'styles' ) );
14
  add_action( 'wp_ajax_sns_dropdown', array( __CLASS__, 'dropdown' ) );
15
  add_action( 'wp_ajax_sns_delete_class', array( __CLASS__, 'delete_class' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  }
17
  function update_tab() {
18
  check_ajax_referer( Scripts_n_Styles::$file );
@@ -68,8 +89,8 @@ class SnS_AJAX
68
 
69
  header('Content-Type: application/json; charset=' . get_option('blog_charset'));
70
  echo json_encode( array(
71
- "classes_post" => $_REQUEST[ 'classes_post' ],
72
- "classes_body" => $_REQUEST[ 'classes_body' ]
73
  ) );
74
 
75
  exit();
@@ -98,8 +119,8 @@ class SnS_AJAX
98
 
99
  header('Content-Type: application/json; charset=' . get_option('blog_charset'));
100
  echo json_encode( array(
101
- "scripts" => $_REQUEST[ 'scripts' ],
102
- "scripts_in_head" => $_REQUEST[ 'scripts_in_head' ],
103
  ) );
104
 
105
  exit();
@@ -199,6 +220,109 @@ class SnS_AJAX
199
 
200
  exit();
201
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
 
203
  // Differs from SnS_Admin_Meta_Box::maybe_set() in that this needs no prefix.
204
  function maybe_set( $o, $i ) {
@@ -208,8 +332,11 @@ class SnS_AJAX
208
  return $o;
209
  }
210
  function maybe_update( $id, $name, $meta ) {
211
- if ( empty( $meta ) ) delete_post_meta( $id, $name );
212
- else update_post_meta( $id, $name, $meta );
 
 
 
213
  }
214
  }
215
  ?>
13
  add_action( 'wp_ajax_sns_styles', array( __CLASS__, 'styles' ) );
14
  add_action( 'wp_ajax_sns_dropdown', array( __CLASS__, 'dropdown' ) );
15
  add_action( 'wp_ajax_sns_delete_class', array( __CLASS__, 'delete_class' ) );
16
+ add_action( 'wp_ajax_sns_shortcodes', array( __CLASS__, 'shortcodes' ) );
17
+ add_action( 'wp_ajax_sns_open_theme_panels', array( __CLASS__, 'open_theme_panels' ) );
18
+ }
19
+ function open_theme_panels() {
20
+ check_ajax_referer( SnS_Admin::OPTION_GROUP . "-options" );
21
+
22
+ $name = isset( $_POST[ 'file-name' ] ) ? $_POST[ 'file-name' ] : '';
23
+ if ( empty( $name ) ) exit( 'empty name');
24
+
25
+ $collapsed = isset( $_POST[ 'collapsed' ] ) ? $_POST[ 'collapsed' ] : '';
26
+ if ( empty( $collapsed ) ) exit( 'empty value');
27
+
28
+ if ( ! $user = get_current_user_id() ) exit( 'Bad User' );
29
+
30
+ $open_theme_panels = json_decode( get_user_option( 'sns_open_theme_panels', $user ), true );
31
+ $open_theme_panels = is_array( $open_theme_panels ) ? $open_theme_panels : array();
32
+ $open_theme_panels[ $name ] = $collapsed;
33
+ $open_theme_panels = json_encode( $open_theme_panels );
34
+ update_user_option( $user, 'sns_open_theme_panels', $open_theme_panels );
35
+
36
+ exit();
37
  }
38
  function update_tab() {
39
  check_ajax_referer( Scripts_n_Styles::$file );
89
 
90
  header('Content-Type: application/json; charset=' . get_option('blog_charset'));
91
  echo json_encode( array(
92
+ "classes_post" => $_REQUEST[ 'classes_post' ]
93
+ , "classes_body" => $_REQUEST[ 'classes_body' ]
94
  ) );
95
 
96
  exit();
119
 
120
  header('Content-Type: application/json; charset=' . get_option('blog_charset'));
121
  echo json_encode( array(
122
+ "scripts" => $_REQUEST[ 'scripts' ]
123
+ , "scripts_in_head" => $_REQUEST[ 'scripts_in_head' ]
124
  ) );
125
 
126
  exit();
220
 
221
  exit();
222
  }
223
+ function shortcodes( $action ) {
224
+ check_ajax_referer( Scripts_n_Styles::$file );
225
+ if ( ! current_user_can( 'unfiltered_html' ) || ! current_user_can( 'edit_posts' ) ) exit( 'Insufficient Privileges.' );
226
+
227
+ if ( empty( $_REQUEST[ 'post_id' ] ) ) exit( 'Bad post ID.' );
228
+ if ( empty( $_REQUEST[ 'subaction' ] ) ) exit( 'missing directive' );
229
+
230
+ if ( in_array( $_REQUEST[ 'subaction' ], array( 'add', 'update', 'delete' ) ) )
231
+ $subaction = $_REQUEST[ 'subaction' ];
232
+ else
233
+ exit( 'unknown directive' );
234
+
235
+ $post_id = absint( $_REQUEST[ 'post_id' ] );
236
+ $SnS = get_post_meta( $post_id, '_SnS', true );
237
+ $shortcodes = isset( $SnS[ 'shortcodes' ] ) ? $SnS[ 'shortcodes' ]: array();
238
+ $message = '';
239
+ $code = 0;
240
+ $key = '';
241
+ $value = '';
242
+
243
+ if ( isset( $_REQUEST[ 'name' ] ) )
244
+ $key = $_REQUEST[ 'name' ];
245
+ else
246
+ exit( 'bad directive.' );
247
+
248
+ if ( '' == $key ) {
249
+ $key = count( $shortcodes );
250
+ while ( isset( $shortcodes[ $key ] ) )
251
+ $key++;
252
+ }
253
+
254
+ switch ( $subaction ) {
255
+ case 'add':
256
+ if ( empty( $_REQUEST[ 'shortcode' ] ) )
257
+ exit( 'empty value.' );
258
+ else
259
+ $value = $_REQUEST[ 'shortcode' ];
260
+
261
+ if ( isset( $shortcodes[ $key ] ) ) {
262
+ $countr = 1;
263
+ while ( isset( $shortcodes[ $key . '_' . $countr ] ) )
264
+ $countr++;
265
+ $key .= '_' . $countr;
266
+ }
267
+
268
+ $code = 1;
269
+ $shortcodes[ $key ] = $value;
270
+ break;
271
+
272
+ case 'update':
273
+ if ( empty( $_REQUEST[ 'shortcode' ] ) ) {
274
+ if ( isset( $shortcodes[ $key ] ) )
275
+ unset( $shortcodes[ $key ] );
276
+ $code = 3;
277
+ $message = $key;
278
+ } else {
279
+ $value = $_REQUEST[ 'shortcode' ];
280
+ if ( isset( $shortcodes[ $key ] ) )
281
+ $shortcodes[ $key ] = $value;
282
+ else
283
+ exit( 'wrong key.' );
284
+ $code = 2;
285
+ $message = 'updated ' . $key;
286
+ }
287
+ break;
288
+
289
+ case 'delete':
290
+ if ( isset( $shortcodes[ $key ] ) )
291
+ unset( $shortcodes[ $key ] );
292
+ else
293
+ exit( 'bad key.' );
294
+ $code = 3;
295
+ $message = $key;
296
+ break;
297
+ }
298
+
299
+ if ( empty( $shortcodes ) ) {
300
+ if ( isset( $SnS[ 'shortcodes' ] ) )
301
+ unset( $SnS[ 'shortcodes' ] );
302
+ } else {
303
+ $SnS[ 'shortcodes' ] = $shortcodes;
304
+ }
305
+ self::maybe_update( $post_id, '_SnS', $SnS );
306
+
307
+ if ( 1 < $code ) {
308
+ header('Content-Type: application/json; charset=' . get_option('blog_charset'));
309
+ echo json_encode( array(
310
+ "message" => $message
311
+ , "code" => $code
312
+ ) );
313
+ } else {
314
+ header('Content-Type: text/html; charset=' . get_option('blog_charset'));
315
+ ?><div class="sns-shortcode widget">
316
+ <div class="inside">
317
+ <p>[sns_shortcode name="<?php echo esc_attr( $key ) ?>"]</p>
318
+ <textarea style="width: 98%;" cols="40" rows="5" name="SnS_shortcodes[existing][<?php echo esc_attr( $key ) ?>]"
319
+ data-sns-shortcode-key="<?php echo esc_attr( $key ) ?>" class="codemirror-new htmlmixed"><?php echo esc_textarea( $value ) ?></textarea>
320
+ <div class="sns-ajax-wrap"><a href="#" class="sns-ajax-delete-shortcode button">Delete</a> &nbsp; <a href="#" class="sns-ajax-update-shortcode button">Update</a> <img src="/wp-admin/images/wpspin_light.gif" class="sns-ajax-loading" style="display: none;"></div>
321
+ </div>
322
+ </div><?php
323
+ }
324
+ exit();
325
+ }
326
 
327
  // Differs from SnS_Admin_Meta_Box::maybe_set() in that this needs no prefix.
328
  function maybe_set( $o, $i ) {
332
  return $o;
333
  }
334
  function maybe_update( $id, $name, $meta ) {
335
+ if ( empty( $meta ) ) {
336
+ delete_post_meta( $id, $name );
337
+ } else {
338
+ update_post_meta( $id, $name, $meta );
339
+ }
340
  }
341
  }
342
  ?>
includes/class-sns-code-editor.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SnS_Admin_Code_Editor
4
+ */
5
+
6
+ class SnS_Admin_Code_Editor
7
+ {
8
+ /**
9
+ * Initializing method.
10
+ */
11
+ function init() {
12
+ add_action( 'admin_head-theme-editor.php', array( __CLASS__, 'styles' ) );
13
+ add_action( 'admin_head-plugin-editor.php', array( __CLASS__, 'styles' ) );
14
+ add_filter( 'editable_extensions', array( __CLASS__, 'extend' ) );
15
+ }
16
+
17
+ function extend( $editable_extensions ) {
18
+ $editable_extensions[] = 'less';
19
+ $editable_extensions[] = 'coffee';
20
+ return $editable_extensions;
21
+ }
22
+
23
+ function styles() {
24
+ $options = get_option( 'SnS_options' );
25
+ $cm_theme = isset( $options[ 'cm_theme' ] ) ? $options[ 'cm_theme' ] : 'default';
26
+ wp_enqueue_style( 'sns-code-editor' );
27
+ wp_enqueue_script( 'sns-code-editor' );
28
+ wp_localize_script( 'sns-code-editor', 'codemirror_options', array( 'theme' => $cm_theme ) );
29
+ }
30
+ }
31
+ ?>
includes/{class.SnS_Form.php → class-sns-form.php} RENAMED
@@ -17,6 +17,7 @@ class SnS_Form
17
  extract( $args );
18
  $options = get_option( $setting );
19
  $value = isset( $options[ $label_for ] ) ? $options[ $label_for ] : '';
 
20
  $output = '<textarea';
21
  $output .= ( $style ) ? ' style="' . $style . '"': '';
22
  $output .= ( $class ) ? ' class="' . $class . '"': '';
@@ -25,6 +26,7 @@ class SnS_Form
25
  $output .= ' name="' . $setting . '[' . $label_for . ']"';
26
  $output .= ' id="' . $label_for . '">';
27
  $output .= esc_textarea( $value ) . '</textarea>';
 
28
  if ( $description ) {
29
  $output .= $description;
30
  }
@@ -44,7 +46,7 @@ class SnS_Form
44
  }
45
  $output .= '<p>';
46
  foreach ( $choices as $choice ) {
47
- $output .= '<label>';
48
  $output .= '<input type="radio"';
49
  $output .= checked( $value, $choice, false );
50
  $output .= ' value="' . $choice . '" name="' . $setting . '[' . $label_for . ']"> ' . $choice;
@@ -104,6 +106,7 @@ class SnS_Form
104
  if ( ! current_user_can( 'manage_options' ) || ! current_user_can( 'unfiltered_html' ) || ( is_multisite() && ! is_super_admin() ) )
105
  wp_die( __( 'Cheatin&#8217; uh?' ) );
106
 
 
107
  if ( isset( $_REQUEST[ 'message' ] ) && $_REQUEST[ 'message' ] )
108
  add_settings_error( $page, 'settings_updated', __( 'Settings saved.' ), 'updated' );
109
 
@@ -128,21 +131,34 @@ class SnS_Form
128
  $value = trim( $value );
129
 
130
  $value = array_merge( $old, stripslashes_deep( $value ) );
 
 
 
 
131
  update_option( $option, $value );
132
  }
133
 
134
  if ( ! count( get_settings_errors() ) )
135
  add_settings_error( $page, 'settings_updated', __( 'Settings saved.' ), 'updated' );
136
 
 
 
 
 
 
 
 
 
 
137
  if ( isset( $_POST[ $option ][ 'menu_position' ] ) && ( $value[ 'menu_position' ] != SnS_Admin::$parent_slug ) ) {
138
  switch( $value[ 'menu_position' ] ) {
139
  case 'menu':
140
  case 'object':
141
  case 'utility':
142
- wp_redirect( add_query_arg( 'message', 1, admin_url( 'admin.php?page=sns_settings' ) ) );
143
  break;
144
  default:
145
- wp_redirect( add_query_arg( 'message', 1, admin_url( $value[ 'menu_position' ].'?page=sns_settings' ) ) );
146
  break;
147
  }
148
  }
@@ -160,7 +176,7 @@ class SnS_Form
160
  <form action="" method="post" autocomplete="off">
161
  <?php settings_fields( SnS_Admin::OPTION_GROUP ); ?>
162
  <?php do_settings_sections( SnS_Admin::MENU_SLUG ); ?>
163
- <?php submit_button(); ?>
164
  </form>
165
  </div>
166
  <?php
17
  extract( $args );
18
  $options = get_option( $setting );
19
  $value = isset( $options[ $label_for ] ) ? $options[ $label_for ] : '';
20
+ if ( isset( $wrap_class ) ) echo '<div class="'. $wrap_class . '"';
21
  $output = '<textarea';
22
  $output .= ( $style ) ? ' style="' . $style . '"': '';
23
  $output .= ( $class ) ? ' class="' . $class . '"': '';
26
  $output .= ' name="' . $setting . '[' . $label_for . ']"';
27
  $output .= ' id="' . $label_for . '">';
28
  $output .= esc_textarea( $value ) . '</textarea>';
29
+ if ( isset( $wrap_class ) ) echo '</div>';
30
  if ( $description ) {
31
  $output .= $description;
32
  }
46
  }
47
  $output .= '<p>';
48
  foreach ( $choices as $choice ) {
49
+ $output .= '<label style="white-space: pre;">';
50
  $output .= '<input type="radio"';
51
  $output .= checked( $value, $choice, false );
52
  $output .= ' value="' . $choice . '" name="' . $setting . '[' . $label_for . ']"> ' . $choice;
106
  if ( ! current_user_can( 'manage_options' ) || ! current_user_can( 'unfiltered_html' ) || ( is_multisite() && ! is_super_admin() ) )
107
  wp_die( __( 'Cheatin&#8217; uh?' ) );
108
 
109
+ // Handle menu-redirected update message.
110
  if ( isset( $_REQUEST[ 'message' ] ) && $_REQUEST[ 'message' ] )
111
  add_settings_error( $page, 'settings_updated', __( 'Settings saved.' ), 'updated' );
112
 
131
  $value = trim( $value );
132
 
133
  $value = array_merge( $old, stripslashes_deep( $value ) );
134
+
135
+ // Allow modification of $value
136
+ $value = apply_filters( 'sns_options_pre_update_option', $value, $page, $action );
137
+
138
  update_option( $option, $value );
139
  }
140
 
141
  if ( ! count( get_settings_errors() ) )
142
  add_settings_error( $page, 'settings_updated', __( 'Settings saved.' ), 'updated' );
143
 
144
+ if ( isset( $_REQUEST[ 'ajaxsubmit' ] ) && $_REQUEST[ 'ajaxsubmit' ] ) {
145
+ ob_start();
146
+ settings_errors( $page );
147
+ $output = ob_get_contents();
148
+ ob_end_clean();
149
+ exit( $output );
150
+ }
151
+
152
+ // Redirect to new page if changed.
153
  if ( isset( $_POST[ $option ][ 'menu_position' ] ) && ( $value[ 'menu_position' ] != SnS_Admin::$parent_slug ) ) {
154
  switch( $value[ 'menu_position' ] ) {
155
  case 'menu':
156
  case 'object':
157
  case 'utility':
158
+ wp_redirect( add_query_arg( array( 'message' => 1, 'page' => 'sns_settings' ), admin_url( 'admin.php' ) ) );
159
  break;
160
  default:
161
+ wp_redirect( add_query_arg( array( 'message' => 1, 'page' => 'sns_settings' ), admin_url( $value[ 'menu_position' ] ) ) );
162
  break;
163
  }
164
  }
176
  <form action="" method="post" autocomplete="off">
177
  <?php settings_fields( SnS_Admin::OPTION_GROUP ); ?>
178
  <?php do_settings_sections( SnS_Admin::MENU_SLUG ); ?>
179
+ <?php if ( apply_filters( 'sns_show_submit_button', true ) ) submit_button(); ?>
180
  </form>
181
  </div>
182
  <?php
includes/{class.SnS_Global_Page.php → class-sns-global-page.php} RENAMED
@@ -21,31 +21,20 @@ class SnS_Global_Page
21
 
22
  add_action( "load-$hook_suffix", array( __CLASS__, 'admin_load' ) );
23
  add_action( "load-$hook_suffix", array( 'SnS_Admin', 'help' ) );
24
- add_action( "load-$hook_suffix", array( 'SnS_Form', 'take_action'), 49 );
25
  add_action( "admin_print_styles-$hook_suffix", array( __CLASS__, 'admin_enqueue_scripts' ) );
26
  }
27
 
28
  function admin_enqueue_scripts() {
29
  $options = get_option( 'SnS_options' );
30
  $cm_theme = isset( $options[ 'cm_theme' ] ) ? $options[ 'cm_theme' ] : 'default';
31
- $localize = array( 'theme' => $cm_theme );
32
- $cm_version = '2.4';
33
 
34
- wp_enqueue_style( 'sns-options-styles', plugins_url('css/options-styles.css', Scripts_n_Styles::$file), array( 'codemirror' ), Scripts_n_Styles::VERSION );
35
- wp_enqueue_style( 'codemirror', plugins_url( 'libraries/CodeMirror2/lib/codemirror.css', Scripts_n_Styles::$file), array(), $cm_version );
36
- if ( in_array( $cm_theme, SnS_Admin::$cm_themes ) && 'default' !== $cm_theme )
37
- wp_enqueue_style( "codemirror-$cm_theme", plugins_url( "libraries/CodeMirror2/theme/$cm_theme.css", Scripts_n_Styles::$file), array( 'codemirror' ), $cm_version );
38
 
39
- wp_enqueue_script( 'sns-global-page-scripts', plugins_url('js/global-page.js', Scripts_n_Styles::$file), array( 'jquery', 'codemirror-less', 'codemirror-css', 'codemirror-javascript', 'less.js' ), Scripts_n_Styles::VERSION, true );
40
- wp_localize_script( 'sns-global-page-scripts', '_SnS_options', $localize );
41
-
42
- wp_enqueue_script( 'less.js', plugins_url( 'libraries/less/dist/less-1.3.0.min.js', Scripts_n_Styles::$file), array(), '1.3.0' );
43
- wp_enqueue_script( 'codemirror', plugins_url( 'libraries/CodeMirror2/lib/codemirror.js', Scripts_n_Styles::$file), array(), $cm_version );
44
- wp_enqueue_script( 'codemirror-css', plugins_url( 'libraries/CodeMirror2/mode/css/css.js', Scripts_n_Styles::$file), array( 'codemirror' ), $cm_version );
45
- wp_enqueue_script( 'codemirror-javascript', plugins_url( 'libraries/CodeMirror2/mode/javascript/javascript.js', Scripts_n_Styles::$file), array( 'codemirror' ), $cm_version );
46
- wp_enqueue_script( 'codemirror-less', plugins_url( 'libraries/CodeMirror2/mode/less/less.js', Scripts_n_Styles::$file), array( 'codemirror-css' ), $cm_version ); // load css first so less doesn't overwrite mime.
47
- wp_enqueue_script( 'codemirror-htmlmixed', plugins_url( 'libraries/CodeMirror2/mode/php/php.js', Scripts_n_Styles::$file), array( 'codemirror-xml', 'codemirror-css', 'codemirror-javascript' ), $cm_version );
48
- wp_enqueue_script( 'codemirror-php', plugins_url( 'libraries/CodeMirror2/mode/php/php.js', Scripts_n_Styles::$file), array( 'codemirror-xml', 'codemirror-css', 'codemirror-javascript', 'codemirror-clike' ), $cm_version );
49
  }
50
  /**
51
  * Settings Page
@@ -58,9 +47,15 @@ class SnS_Global_Page
58
  'SnS_options' );
59
 
60
  add_settings_section(
61
- 'global',
62
- __( 'Global Scripts n Styles', 'scripts-n-styles' ),
63
- array( __CLASS__, 'global_section' ),
 
 
 
 
 
 
64
  SnS_Admin::MENU_SLUG );
65
 
66
  add_settings_field(
@@ -68,18 +63,26 @@ class SnS_Global_Page
68
  __( '<strong>LESS:</strong> ', 'scripts-n-styles' ),
69
  array( __CLASS__, 'less_fields' ),
70
  SnS_Admin::MENU_SLUG,
71
- 'global',
72
  array( 'label_for' => 'less' ) );
 
 
 
 
 
 
 
73
  add_settings_field(
74
  'styles',
75
- __( '<strong>Styles:</strong> ', 'scripts-n-styles' ),
76
  array( 'SnS_Form', 'textarea' ),
77
  SnS_Admin::MENU_SLUG,
78
- 'global',
79
  array(
80
  'label_for' => 'styles',
81
  'setting' => 'SnS_options',
82
  'class' => 'code css',
 
83
  'rows' => 5,
84
  'cols' => 40,
85
  'style' => 'min-width: 500px; width:97%;',
@@ -90,11 +93,12 @@ class SnS_Global_Page
90
  __( '<strong>Scripts</strong><br />(for the <code>head</code> element): ', 'scripts-n-styles' ),
91
  array( 'SnS_Form', 'textarea' ),
92
  SnS_Admin::MENU_SLUG,
93
- 'global',
94
  array(
95
  'label_for' => 'scripts_in_head',
96
  'setting' => 'SnS_options',
97
  'class' => 'code js',
 
98
  'rows' => 5,
99
  'cols' => 40,
100
  'style' => 'min-width: 500px; width:97%;',
@@ -102,14 +106,15 @@ class SnS_Global_Page
102
  ) );
103
  add_settings_field(
104
  'scripts',
105
- __( '<strong>Scripts:</strong> ', 'scripts-n-styles' ),
106
  array( 'SnS_Form', 'textarea' ),
107
  SnS_Admin::MENU_SLUG,
108
- 'global',
109
  array(
110
  'label_for' => 'scripts',
111
  'setting' => 'SnS_options',
112
  'class' => 'code js',
 
113
  'rows' => 5,
114
  'cols' => 40,
115
  'style' => 'min-width: 500px; width:97%;',
@@ -120,7 +125,7 @@ class SnS_Global_Page
120
  __( '<strong>Enqueue Scripts</strong>: ', 'scripts-n-styles' ),
121
  array( 'SnS_Form', 'select' ),
122
  SnS_Admin::MENU_SLUG,
123
- 'global',
124
  array(
125
  'label_for' => 'enqueue_scripts',
126
  'setting' => 'SnS_options',
@@ -138,25 +143,53 @@ class SnS_Global_Page
138
  $compiled = isset( $options[ 'compiled' ] ) ? $options[ 'compiled' ] : '';
139
  ?>
140
  <div style="overflow: hidden;">
141
- <div style="width: 49%; float: left; overflow: hidden; margin-right: 2%;">
142
  <textarea id="less" name="SnS_options[less]" style="min-width: 250px; width:47%; float: left" class="code less" rows="5" cols="40"><?php echo esc_textarea( $less ) ?></textarea>
143
  </div>
144
- <div style="width: 49%; float: left; overflow: hidden;">
145
  <textarea id="compiled" name="SnS_options[compiled]" style="min-width: 250px; width:47%;" class="code css" rows="5" cols="40"><?php echo esc_textarea( $compiled ) ?></textarea>
146
  <div id="compiled_error" style="display: none" class="error settings-error below-h2"></div>
147
  </div>
148
  </div>
149
  <?php
150
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
 
152
  /**
153
  * Settings Page
154
  * Outputs Description text for the Global Section.
155
  */
156
- function global_section() {
157
  ?>
158
  <div style="max-width: 55em;">
159
- <p><?php _e( 'Code entered here will be included in <em>every page (and post) of your site</em>, including the homepage and archives. The code will appear <strong>before</strong> Scripts and Styles registered individually.', 'scripts-n-styles' )?></p>
160
  </div>
161
  <?php
162
  }
21
 
22
  add_action( "load-$hook_suffix", array( __CLASS__, 'admin_load' ) );
23
  add_action( "load-$hook_suffix", array( 'SnS_Admin', 'help' ) );
24
+ add_action( "load-$hook_suffix", array( 'SnS_Form', 'take_action' ), 49 );
25
  add_action( "admin_print_styles-$hook_suffix", array( __CLASS__, 'admin_enqueue_scripts' ) );
26
  }
27
 
28
  function admin_enqueue_scripts() {
29
  $options = get_option( 'SnS_options' );
30
  $cm_theme = isset( $options[ 'cm_theme' ] ) ? $options[ 'cm_theme' ] : 'default';
 
 
31
 
32
+ wp_enqueue_style( 'chosen' );
33
+ wp_enqueue_style( 'sns-options' );
34
+ wp_enqueue_style( 'codemirror-theme' );
 
35
 
36
+ wp_enqueue_script( 'sns-global-page' );
37
+ wp_localize_script( 'sns-global-page', '_SnS_options', array( 'theme' => $cm_theme ) );
 
 
 
 
 
 
 
 
38
  }
39
  /**
40
  * Settings Page
47
  'SnS_options' );
48
 
49
  add_settings_section(
50
+ 'global_styles',
51
+ __( 'Blog Wide CSS Styles', 'scripts-n-styles' ),
52
+ array( __CLASS__, 'global_styles_section' ),
53
+ SnS_Admin::MENU_SLUG );
54
+
55
+ add_settings_section(
56
+ 'global_scripts',
57
+ __( 'Blog Wide JavaScript', 'scripts-n-styles' ),
58
+ array( __CLASS__, 'global_scripts_section' ),
59
  SnS_Admin::MENU_SLUG );
60
 
61
  add_settings_field(
63
  __( '<strong>LESS:</strong> ', 'scripts-n-styles' ),
64
  array( __CLASS__, 'less_fields' ),
65
  SnS_Admin::MENU_SLUG,
66
+ 'global_styles',
67
  array( 'label_for' => 'less' ) );
68
+ add_settings_field(
69
+ 'coffee',
70
+ __( '<strong>CoffeeScript:</strong> ', 'scripts-n-styles' ),
71
+ array( __CLASS__, 'coffee_fields' ),
72
+ SnS_Admin::MENU_SLUG,
73
+ 'global_scripts',
74
+ array( 'label_for' => 'coffee' ) );
75
  add_settings_field(
76
  'styles',
77
+ __( '<strong>CSS Styles:</strong> ', 'scripts-n-styles' ),
78
  array( 'SnS_Form', 'textarea' ),
79
  SnS_Admin::MENU_SLUG,
80
+ 'global_styles',
81
  array(
82
  'label_for' => 'styles',
83
  'setting' => 'SnS_options',
84
  'class' => 'code css',
85
+ 'wrap_class' => 'style',
86
  'rows' => 5,
87
  'cols' => 40,
88
  'style' => 'min-width: 500px; width:97%;',
93
  __( '<strong>Scripts</strong><br />(for the <code>head</code> element): ', 'scripts-n-styles' ),
94
  array( 'SnS_Form', 'textarea' ),
95
  SnS_Admin::MENU_SLUG,
96
+ 'global_scripts',
97
  array(
98
  'label_for' => 'scripts_in_head',
99
  'setting' => 'SnS_options',
100
  'class' => 'code js',
101
+ 'wrap_class' => 'script',
102
  'rows' => 5,
103
  'cols' => 40,
104
  'style' => 'min-width: 500px; width:97%;',
106
  ) );
107
  add_settings_field(
108
  'scripts',
109
+ __( '<strong>Scripts</strong><br />(end of the <code>body</code> tag):', 'scripts-n-styles' ),
110
  array( 'SnS_Form', 'textarea' ),
111
  SnS_Admin::MENU_SLUG,
112
+ 'global_scripts',
113
  array(
114
  'label_for' => 'scripts',
115
  'setting' => 'SnS_options',
116
  'class' => 'code js',
117
+ 'wrap_class' => 'script',
118
  'rows' => 5,
119
  'cols' => 40,
120
  'style' => 'min-width: 500px; width:97%;',
125
  __( '<strong>Enqueue Scripts</strong>: ', 'scripts-n-styles' ),
126
  array( 'SnS_Form', 'select' ),
127
  SnS_Admin::MENU_SLUG,
128
+ 'global_scripts',
129
  array(
130
  'label_for' => 'enqueue_scripts',
131
  'setting' => 'SnS_options',
143
  $compiled = isset( $options[ 'compiled' ] ) ? $options[ 'compiled' ] : '';
144
  ?>
145
  <div style="overflow: hidden;">
146
+ <div style="width: 49%; float: left; overflow: hidden; margin-right: 2%;" class="less">
147
  <textarea id="less" name="SnS_options[less]" style="min-width: 250px; width:47%; float: left" class="code less" rows="5" cols="40"><?php echo esc_textarea( $less ) ?></textarea>
148
  </div>
149
+ <div style="width: 49%; float: left; overflow: hidden;" class="style">
150
  <textarea id="compiled" name="SnS_options[compiled]" style="min-width: 250px; width:47%;" class="code css" rows="5" cols="40"><?php echo esc_textarea( $compiled ) ?></textarea>
151
  <div id="compiled_error" style="display: none" class="error settings-error below-h2"></div>
152
  </div>
153
  </div>
154
  <?php
155
  }
156
+ function coffee_fields() {
157
+ $options = get_option( 'SnS_options' );
158
+ $coffee = isset( $options[ 'coffee' ] ) ? $options[ 'coffee' ] : '';
159
+ $compiled = isset( $options[ 'coffee_compiled' ] ) ? $options[ 'coffee_compiled' ] : '';
160
+ ?>
161
+ <div style="overflow: hidden;">
162
+ <div style="width: 49%; float: left; overflow: hidden; margin-right: 2%;" class="coffee">
163
+ <textarea id="coffee" name="SnS_options[coffee]" style="min-width: 250px; width:47%; float: left" class="code coffee" rows="5" cols="40"><?php echo esc_textarea( $coffee ) ?></textarea>
164
+ </div>
165
+ <div style="width: 49%; float: left; overflow: hidden;" class="script">
166
+ <textarea id="coffee_compiled" name="SnS_options[coffee_compiled]" style="min-width: 250px; width:47%;" class="code js" rows="5" cols="40"><?php echo esc_textarea( $compiled ) ?></textarea>
167
+ <div id="coffee_compiled_error" style="display: none" class="error settings-error below-h2"></div>
168
+ </div>
169
+ </div>
170
+ <?php
171
+ }
172
+
173
+ /**
174
+ * Settings Page
175
+ * Outputs Description text for the Global Section.
176
+ */
177
+ function global_scripts_section() {
178
+ ?>
179
+ <div style="max-width: 55em;">
180
+ <p><?php _e( 'Code entered here will be included in <em>every page (and post) of your site</em>, including the homepage and archives. The code will appear <strong>before</strong> Scripts that were registered individually.', 'scripts-n-styles' )?></p>
181
+ </div>
182
+ <?php
183
+ }
184
 
185
  /**
186
  * Settings Page
187
  * Outputs Description text for the Global Section.
188
  */
189
+ function global_styles_section() {
190
  ?>
191
  <div style="max-width: 55em;">
192
+ <p><?php _e( 'Code entered here will be included in <em>every page (and post) of your site</em>, including the homepage and archives. The code will appear <strong>before</strong> Styles that were registered individually.', 'scripts-n-styles' )?></p>
193
  </div>
194
  <?php
195
  }
includes/class-sns-hoops-page.php ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SnS_Hoops_Page
4
+ *
5
+ * Allows WordPress admin users the ability to add custom CSS
6
+ * and JavaScript directly to individual Post, Pages or custom
7
+ * post types.
8
+ */
9
+
10
+ class SnS_Hoops_Page
11
+ {
12
+ /**
13
+ * Constants
14
+ */
15
+ const MENU_SLUG = 'sns_hoops';
16
+
17
+ /**
18
+ * Initializing method.
19
+ * @static
20
+ */
21
+ function init() {
22
+ $hook_suffix = add_submenu_page( SnS_Admin::$parent_slug, __( 'Scripts n Styles', 'scripts-n-styles' ), __( 'Hoops' ), 'unfiltered_html', self::MENU_SLUG, array( 'SnS_Form', 'page' ) );
23
+
24
+ add_action( "load-$hook_suffix", array( __CLASS__, 'admin_load' ) );
25
+ add_action( "load-$hook_suffix", array( 'SnS_Admin', 'help' ) );
26
+ add_action( "load-$hook_suffix", array( 'SnS_Form', 'take_action' ), 49 );
27
+ add_action( "admin_print_styles-$hook_suffix", array( __CLASS__, 'admin_enqueue_scripts' ) );
28
+
29
+ // Make the page into a tab.
30
+ if ( SnS_Admin::MENU_SLUG != SnS_Admin::$parent_slug ) {
31
+ remove_submenu_page( SnS_Admin::$parent_slug, self::MENU_SLUG );
32
+ add_filter( 'parent_file', array( __CLASS__, 'parent_file') );
33
+ }
34
+ }
35
+ static function parent_file( $parent_file ) {
36
+ global $plugin_page, $submenu_file;
37
+ if ( self::MENU_SLUG == $plugin_page ) $submenu_file = SnS_Admin::MENU_SLUG;
38
+ return $parent_file;
39
+ }
40
+
41
+ function admin_enqueue_scripts() {
42
+ $options = get_option( 'SnS_options' );
43
+ $cm_theme = isset( $options[ 'cm_theme' ] ) ? $options[ 'cm_theme' ] : 'default';
44
+
45
+ wp_enqueue_style( 'sns-options' );
46
+ wp_enqueue_style( 'codemirror-theme' );
47
+
48
+ wp_enqueue_script( 'sns-hoops-page' );
49
+ wp_localize_script( 'sns-hoops-page', '_SnS_options', array( 'theme' => $cm_theme ) );
50
+ }
51
+ /**
52
+ * Settings Page
53
+ * Adds Admin Menu Item via WordPress' "Administration Menus" API. Also hook actions to register options via WordPress' Settings API.
54
+ */
55
+ function admin_load() {
56
+ // added here to not effect other pages.
57
+ add_filter( 'sns_options_pre_update_option', array( __CLASS__, 'new_hoops') );
58
+
59
+ register_setting(
60
+ SnS_Admin::OPTION_GROUP,
61
+ 'SnS_options' );
62
+
63
+ add_settings_section(
64
+ 'hoops_section',
65
+ __( 'The Hoops Shortcodes', 'scripts-n-styles' ),
66
+ array( __CLASS__, 'hoops_section' ),
67
+ SnS_Admin::MENU_SLUG );
68
+ }
69
+ function new_hoops( $options ) {
70
+ // Get Hoops. (Shouldn't be empty.)
71
+ $hoops = $options[ 'hoops' ];
72
+
73
+ /*
74
+ add_settings_error( 'sns_hoops', 'settings_updated', '<pre>'
75
+ . '$hoops '
76
+ . print_r(
77
+ $hoops, true ) . '</pre>', 'updated' );
78
+ */
79
+
80
+ // take out new. (Also shouldn't be empty.)
81
+ $new = $hoops[ 'new' ];
82
+ unset( $hoops[ 'new' ] );
83
+
84
+ // Get Shortcodes. (Could be empty.)
85
+ $shortcodes = empty( $hoops[ 'shortcodes' ] ) ? array() : $hoops[ 'shortcodes' ];
86
+
87
+ // prune shortcodes with blank values.
88
+ foreach( $shortcodes as $key => $value ){
89
+ if ( empty( $value ) )
90
+ unset( $shortcodes[ $key ] );
91
+ }
92
+
93
+ // Add new (if not empty).
94
+ if ( ! empty( $new[ 'code' ] ) ) {
95
+ $name = empty( $new[ 'name' ] ) ? '' : $new[ 'name' ];
96
+
97
+ if ( '' == $name ) {
98
+ // If blank, find next index..
99
+ $name = 0;
100
+ while ( isset( $shortcodes[ $name ] ) )
101
+ $name++;
102
+ } else if ( isset( $shortcodes[ $name ] ) ) {
103
+ // To make sure not to overwrite.
104
+ $countr = 1;
105
+ while ( isset( $shortcodes[ $name . '_' . $countr ] ) )
106
+ $countr++;
107
+ $name .= '_' . $countr;
108
+ }
109
+
110
+ // Add new to shortcodes.
111
+ $shortcodes[ $name ] = $new[ 'code' ];
112
+ }
113
+
114
+ // Put in Shortcodes... if not empty.
115
+ if ( empty( $shortcodes ) ) {
116
+ if ( isset( $hoops[ 'shortcodes' ] ) )
117
+ unset( $hoops[ 'shortcodes' ] );
118
+ } else {
119
+ $hoops[ 'shortcodes' ] = $shortcodes;
120
+ }
121
+
122
+ // Put in Hoops... if not empty.
123
+ if ( empty( $hoops ) ) {
124
+ if ( isset( $options[ 'hoops' ] ) )
125
+ unset( $options[ 'hoops' ] );
126
+ } else {
127
+ $options[ 'hoops' ] = $hoops;
128
+ }
129
+
130
+ return $options; // Finish Filter.
131
+ }
132
+
133
+ /**
134
+ * Settings Page
135
+ * Outputs Description text for the Global Section.
136
+ */
137
+ function hoops_section() {
138
+ echo '<div style="max-width: 55em;">';
139
+ _e( '<p>"Hoops" are shortcodes invented to get around some limitations of vanilla WordPress.</p>'
140
+ . '<p> Normally, certain HTML is very problematic to use in the Post Editor, because it either gets '
141
+ . 'jumbled during Switching between HTML and Visual Tabs, stripped out by WPAutoP (rare) or stripped '
142
+ . 'out because the User doesn&#8217;t have the proper Permissions.</p>'
143
+ . '<p>With Hoops, an Admin user (who has `unfiltered_html` and `manage_options` capablilities) can '
144
+ . 'write and approve snippets of HTML for other user to use via Shortcodes.</p>', 'scripts-n-styles' );
145
+ echo '</div>';
146
+
147
+ $options = get_option( 'SnS_options' );
148
+
149
+ $meta_name = 'SnS_options[hoops]';
150
+ $hoops = isset( $options[ 'hoops' ] ) ? $options[ 'hoops' ] : array();
151
+ $shortcodes = isset( $hoops[ 'shortcodes' ] ) ? $hoops[ 'shortcodes' ] : array();
152
+ ?>
153
+ <strong class="title">Add New: </strong>
154
+ <div id="sns-shortcodes">
155
+ <div class="sns-less-ide" style="overflow: hidden">
156
+ <div class="widget"><div class="inside">
157
+ <label style="display:inline" for="<?php echo $meta_name; ?>">Name: </label>
158
+ <input id="<?php echo $meta_name; ?>" name="<?php echo $meta_name . '[new][name]'; ?>" type="text" />
159
+ <?php /** / ?>
160
+ <a class="button" href="#" id="sns-ajax-add-shortcode">Add New</a>
161
+ <?php /**/ ?>
162
+ <textarea id="<?php echo $meta_name; ?>_new" class="code htmlmixed" name="<?php echo $meta_name . '[new][code]'; ?>" rows="5" cols="40" style="width: 98%;"></textarea>
163
+ </div></div>
164
+ </div>
165
+
166
+ <?php if ( ! empty( $shortcodes ) ) { ?>
167
+ <h4>Existing Codes: </h4>
168
+ <div id="sns-shortcodes-wrap">
169
+ <?php if ( ! empty( $shortcodes ) ) { ?>
170
+ <?php foreach ( $shortcodes as $key => $value ) { ?>
171
+
172
+ <div class="sns-less-ide" style="overflow: hidden">
173
+ <div class="widget"><div class="sns-collapsed inside">
174
+ <span class="sns-collapsed-btn"></span>
175
+ <p style="margin-bottom: 0;">[hoops name="<?php echo $key ?>"]</p>
176
+ <textarea class="code htmlmixed" data-sns-shortcode-key="<?php echo $key ?>" name="<?php echo $meta_name . '[shortcodes][' . $key . ']'; ?>" rows="5" cols="40" style="width: 98%;"><?php echo esc_textarea( $value ); ?></textarea>
177
+ <?php /** / ?>
178
+ <div class="sns-ajax-wrap">
179
+ <a class="sns-ajax-delete-shortcode button" href="#">Delete</a> &nbsp;
180
+ <a class="sns-ajax-update-shortcode button" href="#">Update</a>
181
+ <img class="sns-ajax-loading" src="/wp-admin/images/wpspin_light.gif">
182
+ </div>
183
+ <?php /**/ ?>
184
+ </div></div>
185
+ </div>
186
+ <?php } ?>
187
+ <?php } ?>
188
+ </div>
189
+ <?php } ?>
190
+ </div>
191
+ <?php
192
+ }
193
+ }
194
+ ?>
includes/{class.SnS_List_Usage.php → class-sns-list-usage.php} RENAMED
File without changes
includes/{class.SnS_Admin_Meta_Box.php → class-sns-meta-box.php} RENAMED
@@ -123,7 +123,7 @@ class SnS_Admin_Meta_Box
123
  $scripts = isset( $SnS['scripts'] ) ? $SnS[ 'scripts' ]: array();
124
 
125
  $position = get_user_option( "current_sns_tab" );
126
- if ( ! in_array( $position, array( 's0', 's1', 's2', 's3', 's4' ) ) ) $position = 's0';
127
  wp_nonce_field( Scripts_n_Styles::$file, self::NONCE_NAME );
128
  ?>
129
  <ul class="wp-tab-bar">
@@ -132,21 +132,28 @@ class SnS_Admin_Meta_Box
132
  <li<?php echo ( 's2' == $position ) ? ' class="wp-tab-active"': ''; ?>><a href="#SnS_classes_body-tab"><?php _e( 'Classes', 'scripts-n-styles' ) ?></a></li>
133
  <li<?php echo ( 's3' == $position ) ? ' class="wp-tab-active"': ''; ?>><a href="#SnS_enqueue_scripts-tab"><?php _e( 'Include Scripts', 'scripts-n-styles' ) ?></a></li>
134
  <li<?php echo ( 's4' == $position ) ? ' class="wp-tab-active"': ''; ?>><a href="#SnS_shortcodes-tab"><?php _e( 'Shortcodes', 'scripts-n-styles' ) ?></a></li>
 
135
  </ul>
136
 
137
  <div class="wp-tab-panel" id="SnS_scripts-tab">
138
  <p><em><?php _e( "This code will be included <strong>verbatim</strong> in <code>&lt;script></code> tags at the end of your page's (or post's)", 'scripts-n-styles' ) ?> ...</em></p>
139
  <label for="SnS_scripts_in_head" class="title"><?php _e( '<strong>Scripts</strong> (for the <code>head</code> element):', 'scripts-n-styles' ) ?> </label>
 
140
  <textarea class="codemirror js" name="SnS_scripts_in_head" id="SnS_scripts_in_head" rows="5" cols="40" style="width: 98%;"><?php echo isset( $scripts[ 'scripts_in_head' ] ) ? esc_textarea( $scripts[ 'scripts_in_head' ] ) : ''; ?></textarea>
 
141
  <p><em>... <code>&lt;/head></code> <?php _e( 'tag', 'scripts-n-styles' ) ?>.</em></p>
142
  <label for="SnS_scripts" class="title"><strong>Scripts</strong>: </label>
 
143
  <textarea class="codemirror js" name="SnS_scripts" id="SnS_scripts" rows="5" cols="40" style="width: 98%;"><?php echo isset( $scripts[ 'scripts' ] ) ? esc_textarea( $scripts[ 'scripts' ] ) : ''; ?></textarea>
 
144
  <p><em>... <code>&lt;/body></code> <?php _e( 'tag', 'scripts-n-styles' ) ?>.</em></p>
145
  </div>
146
 
147
  <div class="wp-tab-panel" id="SnS_styles-tab">
148
  <label for="SnS_styles" class="title"><?php _e( '<strong>Styles</strong>:', 'scripts-n-styles' ) ?> </label>
 
149
  <textarea class="codemirror css" name="SnS_styles" id="SnS_styles" rows="5" cols="40" style="width: 98%;"><?php echo isset( $styles[ 'styles' ] ) ? esc_textarea( $styles[ 'styles' ] ) : ''; ?></textarea>
 
150
  <p><em><?php _e( 'This code will be included <strong>verbatim</strong> in <code>&lt;style></code> tags in the <code>&lt;head></code> tag of your page (or post).', 'scripts-n-styles' ) ?></em></p>
151
  </div>
152
 
@@ -157,23 +164,23 @@ class SnS_Admin_Meta_Box
157
  <label for="SnS_classes_body"><?php _e( '<strong>Body Classes</strong>:', 'scripts-n-styles' ) ?> </label>
158
  <input name="SnS_classes_body" id="SnS_classes_body" type="text" class="code" style="width: 99%;"
159
  value="<?php echo isset( $styles[ 'classes_body' ] ) ? esc_attr( $styles[ 'classes_body' ] ) : ''; ?>" />
160
- <small><?php _e( 'Standard:', 'scripts-n-styles' ) ?> <code><?php self::current_classes( 'body', $post->ID ); ?></code></small>
161
  </p>
162
  <p>
163
  <label for="SnS_classes_post"><strong>Post Classes</strong>: </label>
164
  <input name="SnS_classes_post" id="SnS_classes_post" type="text" class="code" style="width: 99%;"
165
  value="<?php echo isset( $styles[ 'classes_post' ] ) ? esc_attr( $styles[ 'classes_post' ] ) : ''; ?>" />
166
- <small><?php _e( 'Standard:', 'scripts-n-styles' ) ?> <code><?php self::current_classes( 'post', $post->ID ); ?></code></small>
167
  </p>
168
  <p><em><?php _e( 'These <strong>space separated</strong> class names will be added to the <code>body_class()</code> or <code>post_class()</code> function (provided your theme uses these functions).', 'scripts-n-styles' ) ?></em></p>
169
  </div>
170
-
171
  <?php
172
  /*
173
  * Note: Styles Dropdown section only makes sense when Javascript is enabled. (Otherwise, no TinyMCE.)
174
  */
175
  ?>
176
- <div id="mce-dropdown-names" style="display: none;">
 
 
177
  <h4><?php _e( 'The Styles Dropdown', 'scripts-n-styles' ) ?></h4>
178
  <div id="add-mce-dropdown-names">
179
  <p><?php _e( 'Add (or update) a class for the "Styles" drop-down:', 'scripts-n-styles' ) ?></p>
@@ -235,26 +242,30 @@ class SnS_Admin_Meta_Box
235
  </div>
236
 
237
  <div class="wp-tab-panel" id="SnS_shortcodes-tab">
238
- <?php
239
- $meta_name = 'SnS_shortcodes';
240
- $SnS = get_post_meta( $post->ID, '_SnS', true );
241
- $shortcodes = isset( $SnS['shortcodes'] ) ? $SnS[ 'shortcodes' ] : array();
242
- ?>
243
  <strong class="title">Shortcodes</strong>
244
- <h4>Add New</h4>
245
- <label for="<?php echo $meta_name; ?>">Name: </label>
246
- <input id="<?php echo $meta_name; ?>" name="<?php echo $meta_name . '[new][name]'; ?>" type="text" />
247
- <textarea class="codemirror htmlmixed" name="<?php echo $meta_name . '[new][value]'; ?>" rows="5" cols="40" style="width: 98%;"></textarea>
248
- <?php if ( ! empty( $shortcodes ) ) { ?>
249
- <h4>Existing</h4>
250
  <?php
251
- foreach ( $shortcodes as $key => $value ) {
252
- ?>
253
- <label for="<?php echo $meta_name . '[existing][' . $key . ']'; ?>">[sns_shortcode name="<?php echo $key ?>"]</label>
254
- <textarea class="codemirror htmlmixed" name="<?php echo $meta_name . '[existing][' . $key . ']'; ?>" rows="5" cols="40" style="width: 98%;"><?php echo esc_textarea( $value ); ?></textarea>
255
- <?php
256
- }
257
- } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
258
  </div>
259
  <?php
260
  }
@@ -285,13 +296,8 @@ class SnS_Admin_Meta_Box
285
  * Enqueues the CSS for admin styling of the Meta Box.
286
  */
287
  static function meta_box_styles() {
288
- $options = get_option( 'SnS_options' );
289
- $cm_theme = isset( $options[ 'cm_theme' ] ) ? $options[ 'cm_theme' ] : 'default';
290
- $cm_version = '2.4';
291
- wp_enqueue_style( 'codemirror', plugins_url( 'libraries/CodeMirror2/lib/codemirror.css', Scripts_n_Styles::$file), array(), $cm_version );
292
- if ( in_array( $cm_theme, SnS_Admin::$cm_themes ) && 'default' !== $cm_theme )
293
- wp_enqueue_style( "codemirror_$cm_theme", plugins_url( "libraries/CodeMirror2/theme/$cm_theme.css", Scripts_n_Styles::$file), array( 'codemirror' ), $cm_version );
294
- wp_enqueue_style( 'sns-meta-box-styles', plugins_url( 'css/meta-box-styles.css', Scripts_n_Styles::$file), array( 'codemirror' ), Scripts_n_Styles::VERSION );
295
  }
296
 
297
  /**
@@ -301,23 +307,9 @@ class SnS_Admin_Meta_Box
301
  static function meta_box_scripts() {
302
  $options = get_option( 'SnS_options' );
303
  $cm_theme = isset( $options[ 'cm_theme' ] ) ? $options[ 'cm_theme' ] : 'default';
304
- $cm_version = '2.4';
305
- $cm_dir = plugins_url( 'libraries/CodeMirror2/', Scripts_n_Styles::$file);
306
-
307
- wp_register_script( 'codemirror', $cm_dir . 'lib/codemirror.js', array(), $cm_version );
308
- wp_register_script( 'codemirror-css', $cm_dir . 'mode/css/css.js', array( 'codemirror' ), $cm_version );
309
- wp_register_script( 'codemirror-less', $cm_dir . 'mode/less/less.js', array( 'codemirror-css' ), $cm_version ); // load css first so less doesn't overwrite mime.
310
- wp_register_script( 'codemirror-javascript', $cm_dir . 'mode/javascript/javascript.js', array( 'codemirror' ), $cm_version );
311
- wp_register_script( 'codemirror-htmlmixed', $cm_dir . 'mode/htmlmixed/htmlmixed.js', array( 'codemirror-xml', 'codemirror-css', 'codemirror-javascript' ), $cm_version );
312
- wp_register_script( 'codemirror-clike', $cm_dir . 'mode/clike/clike.js', array( 'codemirror' ), $cm_version );
313
- wp_register_script( 'codemirror-xml', $cm_dir . 'mode/xml/xml.js', array( 'codemirror' ), $cm_version );
314
- wp_register_script( 'codemirror-php', $cm_dir . 'mode/php/php.js', array( 'codemirror-xml', 'codemirror-css', 'codemirror-javascript', 'codemirror-clike' ), $cm_version );
315
 
316
- wp_enqueue_script( 'sns-meta-box-scripts', plugins_url( 'js/meta-box-scripts.js', Scripts_n_Styles::$file), array( 'editor', 'jquery-ui-tabs', 'codemirror-less', 'codemirror-htmlmixed',
317
- //'codemirror-php',
318
- ), Scripts_n_Styles::VERSION, true );
319
-
320
- wp_localize_script( 'sns-meta-box-scripts', 'codemirror_options', array( 'theme' => $cm_theme ) );
321
  }
322
 
323
  /**
@@ -361,8 +353,24 @@ class SnS_Admin_Meta_Box
361
 
362
  $new_shortcode = isset( $SnS_shortcodes[ 'new' ] ) ? $SnS_shortcodes[ 'new' ]: array();
363
  if ( ! empty( $new_shortcode[ 'value' ] ) ) {
364
- $key = ( empty( $new_shortcode[ 'name' ] ) ) ? count( $shortcodes ): $new_shortcode[ 'name' ];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
365
  $shortcodes[ $key ] = $new_shortcode[ 'value' ];
 
366
  }
367
 
368
  // This one isn't posted, it's ajax only. Cleanup anyway.
123
  $scripts = isset( $SnS['scripts'] ) ? $SnS[ 'scripts' ]: array();
124
 
125
  $position = get_user_option( "current_sns_tab" );
126
+ if ( ! in_array( $position, array( 's0', 's1', 's2', 's3', 's4', 's5' ) ) ) $position = 's0';
127
  wp_nonce_field( Scripts_n_Styles::$file, self::NONCE_NAME );
128
  ?>
129
  <ul class="wp-tab-bar">
132
  <li<?php echo ( 's2' == $position ) ? ' class="wp-tab-active"': ''; ?>><a href="#SnS_classes_body-tab"><?php _e( 'Classes', 'scripts-n-styles' ) ?></a></li>
133
  <li<?php echo ( 's3' == $position ) ? ' class="wp-tab-active"': ''; ?>><a href="#SnS_enqueue_scripts-tab"><?php _e( 'Include Scripts', 'scripts-n-styles' ) ?></a></li>
134
  <li<?php echo ( 's4' == $position ) ? ' class="wp-tab-active"': ''; ?>><a href="#SnS_shortcodes-tab"><?php _e( 'Shortcodes', 'scripts-n-styles' ) ?></a></li>
135
+ <li<?php echo ( 's5' == $position ) ? ' class="wp-tab-active"': ''; ?> style="display:none"><a href="#SnS_post_styles-tab"><?php _e( 'Dropdown', 'scripts-n-styles' ) ?></a></li>
136
  </ul>
137
 
138
  <div class="wp-tab-panel" id="SnS_scripts-tab">
139
  <p><em><?php _e( "This code will be included <strong>verbatim</strong> in <code>&lt;script></code> tags at the end of your page's (or post's)", 'scripts-n-styles' ) ?> ...</em></p>
140
  <label for="SnS_scripts_in_head" class="title"><?php _e( '<strong>Scripts</strong> (for the <code>head</code> element):', 'scripts-n-styles' ) ?> </label>
141
+ <div class="script">
142
  <textarea class="codemirror js" name="SnS_scripts_in_head" id="SnS_scripts_in_head" rows="5" cols="40" style="width: 98%;"><?php echo isset( $scripts[ 'scripts_in_head' ] ) ? esc_textarea( $scripts[ 'scripts_in_head' ] ) : ''; ?></textarea>
143
+ </div>
144
  <p><em>... <code>&lt;/head></code> <?php _e( 'tag', 'scripts-n-styles' ) ?>.</em></p>
145
  <label for="SnS_scripts" class="title"><strong>Scripts</strong>: </label>
146
+ <div class="script">
147
  <textarea class="codemirror js" name="SnS_scripts" id="SnS_scripts" rows="5" cols="40" style="width: 98%;"><?php echo isset( $scripts[ 'scripts' ] ) ? esc_textarea( $scripts[ 'scripts' ] ) : ''; ?></textarea>
148
+ </div>
149
  <p><em>... <code>&lt;/body></code> <?php _e( 'tag', 'scripts-n-styles' ) ?>.</em></p>
150
  </div>
151
 
152
  <div class="wp-tab-panel" id="SnS_styles-tab">
153
  <label for="SnS_styles" class="title"><?php _e( '<strong>Styles</strong>:', 'scripts-n-styles' ) ?> </label>
154
+ <div class="style">
155
  <textarea class="codemirror css" name="SnS_styles" id="SnS_styles" rows="5" cols="40" style="width: 98%;"><?php echo isset( $styles[ 'styles' ] ) ? esc_textarea( $styles[ 'styles' ] ) : ''; ?></textarea>
156
+ </div>
157
  <p><em><?php _e( 'This code will be included <strong>verbatim</strong> in <code>&lt;style></code> tags in the <code>&lt;head></code> tag of your page (or post).', 'scripts-n-styles' ) ?></em></p>
158
  </div>
159
 
164
  <label for="SnS_classes_body"><?php _e( '<strong>Body Classes</strong>:', 'scripts-n-styles' ) ?> </label>
165
  <input name="SnS_classes_body" id="SnS_classes_body" type="text" class="code" style="width: 99%;"
166
  value="<?php echo isset( $styles[ 'classes_body' ] ) ? esc_attr( $styles[ 'classes_body' ] ) : ''; ?>" />
 
167
  </p>
168
  <p>
169
  <label for="SnS_classes_post"><strong>Post Classes</strong>: </label>
170
  <input name="SnS_classes_post" id="SnS_classes_post" type="text" class="code" style="width: 99%;"
171
  value="<?php echo isset( $styles[ 'classes_post' ] ) ? esc_attr( $styles[ 'classes_post' ] ) : ''; ?>" />
 
172
  </p>
173
  <p><em><?php _e( 'These <strong>space separated</strong> class names will be added to the <code>body_class()</code> or <code>post_class()</code> function (provided your theme uses these functions).', 'scripts-n-styles' ) ?></em></p>
174
  </div>
175
+ </div>
176
  <?php
177
  /*
178
  * Note: Styles Dropdown section only makes sense when Javascript is enabled. (Otherwise, no TinyMCE.)
179
  */
180
  ?>
181
+ <div class="wp-tab-panel" id="SnS_post_styles-tab" style="display: none;">
182
+ <strong class="title"><?php _e( 'Post Styles', 'scripts-n-styles' ) ?></strong>
183
+ <div id="mce-dropdown-names">
184
  <h4><?php _e( 'The Styles Dropdown', 'scripts-n-styles' ) ?></h4>
185
  <div id="add-mce-dropdown-names">
186
  <p><?php _e( 'Add (or update) a class for the "Styles" drop-down:', 'scripts-n-styles' ) ?></p>
242
  </div>
243
 
244
  <div class="wp-tab-panel" id="SnS_shortcodes-tab">
 
 
 
 
 
245
  <strong class="title">Shortcodes</strong>
246
+ <div id="sns-add-shortcode">
 
 
 
 
 
247
  <?php
248
+ $meta_name = 'SnS_shortcodes';
249
+ $SnS = get_post_meta( $post->ID, '_SnS', true );
250
+ $shortcodes = isset( $SnS['shortcodes'] ) ? $SnS[ 'shortcodes' ] : array();
251
+ ?>
252
+ <label for="<?php echo $meta_name; ?>">Name: </label>
253
+ <input id="<?php echo $meta_name; ?>" name="<?php echo $meta_name . '[new][name]'; ?>" type="text" />
254
+ <textarea id="<?php echo $meta_name; ?>_new" class="codemirror htmlmixed" name="<?php echo $meta_name . '[new][value]'; ?>" rows="5" cols="40" style="width: 98%;"></textarea>
255
+ </div>
256
+ <div id="sns-shortcodes">
257
+ <h4>Existing Codes: </h4>
258
+ <div id="sns-shortcodes-wrap">
259
+ <?php if ( ! empty( $shortcodes ) ) { ?>
260
+ <?php foreach ( $shortcodes as $key => $value ) { ?>
261
+ <div class="sns-shortcode widget"><div class="inside">
262
+ <p>[hoops name="<?php echo $key ?>"]</p>
263
+ <textarea class="codemirror htmlmixed" data-sns-shortcode-key="<?php echo $key ?>" name="<?php echo $meta_name . '[existing][' . $key . ']'; ?>" rows="5" cols="40" style="width: 98%;"><?php echo esc_textarea( $value ); ?></textarea>
264
+ </div></div>
265
+ <?php } ?>
266
+ <?php } ?>
267
+ </div>
268
+ </div>
269
  </div>
270
  <?php
271
  }
296
  * Enqueues the CSS for admin styling of the Meta Box.
297
  */
298
  static function meta_box_styles() {
299
+ wp_enqueue_style( 'chosen' );
300
+ wp_enqueue_style( 'sns-meta-box' );
 
 
 
 
 
301
  }
302
 
303
  /**
307
  static function meta_box_scripts() {
308
  $options = get_option( 'SnS_options' );
309
  $cm_theme = isset( $options[ 'cm_theme' ] ) ? $options[ 'cm_theme' ] : 'default';
 
 
 
 
 
 
 
 
 
 
 
310
 
311
+ wp_enqueue_script( 'sns-meta-box' );
312
+ wp_localize_script( 'sns-meta-box', 'codemirror_options', array( 'theme' => $cm_theme ) );
 
 
 
313
  }
314
 
315
  /**
353
 
354
  $new_shortcode = isset( $SnS_shortcodes[ 'new' ] ) ? $SnS_shortcodes[ 'new' ]: array();
355
  if ( ! empty( $new_shortcode[ 'value' ] ) ) {
356
+
357
+ $key = ( isset( $new_shortcode[ 'name' ] ) ) ? $new_shortcode[ 'name' ] : '';
358
+
359
+ if ( '' == $key ) {
360
+ $key = count( $shortcodes );
361
+ while ( isset( $shortcodes[ $key ] ) )
362
+ $key++;
363
+ }
364
+
365
+ if ( isset( $shortcodes[ $key ] ) ) {
366
+ $countr = 1;
367
+ while ( isset( $shortcodes[ $key . '_' . $countr ] ) )
368
+ $countr++;
369
+ $key .= '_' . $countr;
370
+ }
371
+
372
  $shortcodes[ $key ] = $new_shortcode[ 'value' ];
373
+
374
  }
375
 
376
  // This one isn't posted, it's ajax only. Cleanup anyway.
includes/{class.SnS_Settings_Page.php → class-sns-settings-page.php} RENAMED
@@ -32,43 +32,30 @@ class SnS_Settings_Page
32
  add_filter( 'parent_file', array( __CLASS__, 'parent_file') );
33
  }
34
  }
 
 
 
 
 
35
 
36
  function admin_enqueue_scripts() {
37
  $options = get_option( 'SnS_options' );
38
  $cm_theme = isset( $options[ 'cm_theme' ] ) ? $options[ 'cm_theme' ] : '';
39
- $cm_version = '2.4';
40
- wp_enqueue_style( 'sns-options-styles', plugins_url('css/options-styles.css', Scripts_n_Styles::$file), array( 'codemirror' ), Scripts_n_Styles::VERSION );
41
- wp_enqueue_style( 'codemirror', plugins_url( 'libraries/CodeMirror2/lib/codemirror.css', Scripts_n_Styles::$file), array(), $cm_version );
42
 
43
  foreach ( SnS_Admin::$cm_themes as $theme )
44
- if ( 'default' !== $theme ) wp_enqueue_style( "codemirror-$theme", plugins_url( "libraries/CodeMirror2/theme/$theme.css", Scripts_n_Styles::$file), array( 'codemirror' ), $cm_version );
45
 
46
- wp_enqueue_script( 'sns-settings-page-scripts', plugins_url('js/settings-page.js', Scripts_n_Styles::$file), array( 'jquery', 'codemirror-less', 'codemirror-css', 'codemirror-javascript' ), Scripts_n_Styles::VERSION, true );
47
- wp_localize_script( 'sns-settings-page-scripts', 'codemirror_options', array( 'theme' => $cm_theme ) );
48
- wp_enqueue_script( 'codemirror', plugins_url( 'libraries/CodeMirror2/lib/codemirror.js', Scripts_n_Styles::$file), array(), $cm_version );
49
- wp_enqueue_script( 'codemirror-css', plugins_url( 'libraries/CodeMirror2/mode/css/css.js', Scripts_n_Styles::$file), array( 'codemirror' ), $cm_version );
50
- wp_enqueue_script( 'codemirror-less', plugins_url( 'libraries/CodeMirror2/mode/less/less.js', Scripts_n_Styles::$file), array( 'codemirror-css' ), $cm_version ); // load css first so less doesn't overwrite mime.
51
- wp_enqueue_script( 'codemirror-javascript', plugins_url( 'libraries/CodeMirror2/mode/javascript/javascript.js', Scripts_n_Styles::$file), array( 'codemirror' ), $cm_version );
52
- wp_enqueue_script( 'codemirror-htmlmixed', plugins_url( 'libraries/CodeMirror2/mode/php/php.js', Scripts_n_Styles::$file), array( 'codemirror-xml', 'codemirror-css', 'codemirror-javascript' ), $cm_version );
53
-
54
- wp_enqueue_script( 'codemirror-xml', plugins_url( 'libraries/CodeMirror2/mode/xml/xml.js', Scripts_n_Styles::$file), array( 'codemirror' ), $cm_version );
55
- wp_enqueue_script( 'codemirror-clike', plugins_url( 'libraries/CodeMirror2/mode/clike/clike.js', Scripts_n_Styles::$file), array( 'codemirror' ), $cm_version );
56
- wp_enqueue_script( 'codemirror-php', plugins_url( 'libraries/CodeMirror2/mode/php/php.js', Scripts_n_Styles::$file), array( 'codemirror-xml', 'codemirror-css', 'codemirror-javascript', 'codemirror-clike' ), $cm_version );
57
- }
58
-
59
- static function parent_file( $parent_file ) {
60
- global $plugin_page, $submenu_file;
61
- if ( self::MENU_SLUG == $plugin_page ) $submenu_file = SnS_Admin::MENU_SLUG;
62
- return $parent_file;
63
  }
64
 
65
-
66
  /**
67
  * Settings Page
68
  * Adds Admin Menu Item via WordPress' "Administration Menus" API. Also hook actions to register options via WordPress' Settings API.
69
  */
70
  function admin_load() {
71
- wp_enqueue_style( 'sns-options-styles', plugins_url('css/options-styles.css', Scripts_n_Styles::$file), array(), Scripts_n_Styles::VERSION );
72
 
73
  register_setting(
74
  SnS_Admin::OPTION_GROUP,
@@ -99,15 +86,17 @@ class SnS_Settings_Page
99
  add_settings_field(
100
  'menu_position',
101
  __( '<strong>Menu Position</strong>: ', 'scripts-n-styles' ),
102
- array( 'SnS_Form', 'select' ),
103
  SnS_Admin::MENU_SLUG,
104
  'settings',
105
  array(
106
  'label_for' => 'menu_position',
107
  'setting' => 'SnS_options',
108
  'choices' => array( 'menu', 'object', 'utility', 'tools.php', 'options-general.php', 'themes.php' ),
109
- 'size' => 6,
110
- 'style' => 'height: auto;'
 
 
111
  ) );
112
 
113
  add_settings_section(
@@ -129,7 +118,22 @@ class SnS_Settings_Page
129
  'default' => 'default',
130
  'legend' => __( 'Theme', 'scripts-n-styles' ),
131
  'layout' => 'horizontal',
132
- 'description' => ''
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  ) );
134
  }
135
 
32
  add_filter( 'parent_file', array( __CLASS__, 'parent_file') );
33
  }
34
  }
35
+ static function parent_file( $parent_file ) {
36
+ global $plugin_page, $submenu_file;
37
+ if ( self::MENU_SLUG == $plugin_page ) $submenu_file = SnS_Admin::MENU_SLUG;
38
+ return $parent_file;
39
+ }
40
 
41
  function admin_enqueue_scripts() {
42
  $options = get_option( 'SnS_options' );
43
  $cm_theme = isset( $options[ 'cm_theme' ] ) ? $options[ 'cm_theme' ] : '';
44
+ wp_enqueue_style( 'sns-options' );
 
 
45
 
46
  foreach ( SnS_Admin::$cm_themes as $theme )
47
+ wp_enqueue_style( "codemirror-$theme" );
48
 
49
+ wp_enqueue_script( 'sns-settings-page' );
50
+ wp_localize_script( 'sns-settings-page', 'codemirror_options', array( 'theme' => $cm_theme ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  }
52
 
 
53
  /**
54
  * Settings Page
55
  * Adds Admin Menu Item via WordPress' "Administration Menus" API. Also hook actions to register options via WordPress' Settings API.
56
  */
57
  function admin_load() {
58
+ wp_enqueue_style( 'sns-options' );
59
 
60
  register_setting(
61
  SnS_Admin::OPTION_GROUP,
86
  add_settings_field(
87
  'menu_position',
88
  __( '<strong>Menu Position</strong>: ', 'scripts-n-styles' ),
89
+ array( 'SnS_Form', 'radio' ),
90
  SnS_Admin::MENU_SLUG,
91
  'settings',
92
  array(
93
  'label_for' => 'menu_position',
94
  'setting' => 'SnS_options',
95
  'choices' => array( 'menu', 'object', 'utility', 'tools.php', 'options-general.php', 'themes.php' ),
96
+ 'default' => 'tools.php',
97
+ 'legend' => __( 'Theme', 'scripts-n-styles' ),
98
+ 'layout' => 'vertical',
99
+ 'description' => __( '<span class="description" style="max-width: 500px; display: inline-block;">Some people are fussy about where the menu goes, so I made an option.</span>', 'scripts-n-styles' ),
100
  ) );
101
 
102
  add_settings_section(
118
  'default' => 'default',
119
  'legend' => __( 'Theme', 'scripts-n-styles' ),
120
  'layout' => 'horizontal',
121
+ 'description' => '',
122
+ ) );
123
+ add_settings_field(
124
+ 'hoops_widget',
125
+ __( '<strong>Hoops Widgets</strong>: ', 'scripts-n-styles' ),
126
+ array( 'SnS_Form', 'radio' ),
127
+ SnS_Admin::MENU_SLUG,
128
+ 'settings',
129
+ array(
130
+ 'label_for' => 'hoops_widget',
131
+ 'setting' => 'SnS_options',
132
+ 'choices' => array( 'yes', 'no' ),
133
+ 'layout' => 'horizontal',
134
+ 'default' => 'no',
135
+ 'legend' => __( 'Shortcode Widgets', 'scripts-n-styles' ),
136
+ 'description' => __( '<span class="description" style="max-width: 500px; display: inline-block;">This enables Hoops shortcodes to be used via a "Hoops" Text Widget.</span>', 'scripts-n-styles' )
137
  ) );
138
  }
139
 
includes/class-sns-theme-page.php ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SnS_Theme_Page
4
+ *
5
+ * Allows WordPress admin users the ability to edit theme CSS
6
+ * and LESS directly in the admin via CodeMirror.
7
+ *
8
+ * On the `wp_enqueue_scripts` action, use `wp_enqueue_style( 'theme_style', get_stylesheet_uri() );` to add your style.css instead of inline.
9
+ * On the `after_setup_theme` action, use `add_theme_support( 'scripts-n-styles', array( '/less/variables.less', '/less/mixins.less' ) );` but use the appropriate file locations.
10
+ *
11
+ */
12
+
13
+ class SnS_Theme_Page
14
+ {
15
+ /**
16
+ * Constants
17
+ */
18
+ const MENU_SLUG = 'sns_theme';
19
+
20
+ static $files = array();
21
+
22
+ /**
23
+ * Initializing method.
24
+ * @static
25
+ */
26
+ function init() {
27
+ $hook_suffix = add_submenu_page( SnS_Admin::$parent_slug, __( 'Scripts n Styles', 'scripts-n-styles' ), __( 'Theme' ), 'unfiltered_html', self::MENU_SLUG, array( 'SnS_Form', 'page' ) );
28
+
29
+ add_action( "load-$hook_suffix", array( __CLASS__, 'admin_load' ) );
30
+ add_action( "load-$hook_suffix", array( 'SnS_Admin', 'help' ) );
31
+ add_action( "load-$hook_suffix", array( 'SnS_Form', 'take_action' ), 49 );
32
+ add_action( "admin_print_styles-$hook_suffix", array( __CLASS__, 'admin_enqueue_scripts' ) );
33
+
34
+ // Make the page into a tab.
35
+ if ( SnS_Admin::MENU_SLUG != SnS_Admin::$parent_slug ) {
36
+ remove_submenu_page( SnS_Admin::$parent_slug, self::MENU_SLUG );
37
+ add_filter( 'parent_file', array( __CLASS__, 'parent_file') );
38
+ }
39
+ }
40
+ static function parent_file( $parent_file ) {
41
+ global $plugin_page, $submenu_file;
42
+ if ( self::MENU_SLUG == $plugin_page ) $submenu_file = SnS_Admin::MENU_SLUG;
43
+ return $parent_file;
44
+ }
45
+
46
+ function admin_enqueue_scripts() {
47
+ $options = get_option( 'SnS_options' );
48
+ $cm_theme = isset( $options[ 'cm_theme' ] ) ? $options[ 'cm_theme' ] : 'default';
49
+
50
+ wp_enqueue_style( 'sns-options' );
51
+ wp_enqueue_style( 'codemirror-theme' );
52
+
53
+ wp_enqueue_script( 'sns-theme-page' );
54
+ wp_localize_script( 'sns-theme-page', '_SnS_options', array( 'theme' => $cm_theme ) );
55
+ }
56
+ /**
57
+ * Settings Page
58
+ * Adds Admin Menu Item via WordPress' "Administration Menus" API. Also hook actions to register options via WordPress' Settings API.
59
+ */
60
+ function admin_load() {
61
+ // added here to not effect other pages. Theme page requires JavaScript (less.js) or it doesn't make sense to save.
62
+ add_filter( 'sns_show_submit_button', '__return_false' );
63
+
64
+ register_setting(
65
+ SnS_Admin::OPTION_GROUP,
66
+ 'SnS_options' );
67
+
68
+ add_settings_section(
69
+ 'theme',
70
+ __( 'Scripts n Styles Theme Files', 'scripts-n-styles' ),
71
+ array( __CLASS__, 'less_fields' ),
72
+ SnS_Admin::MENU_SLUG );
73
+ }
74
+
75
+ function less_fields() {
76
+ $files = array();
77
+ $support_files = get_theme_support( 'scripts-n-styles' );
78
+
79
+ if ( is_child_theme() )
80
+ $root = get_stylesheet_directory();
81
+ else
82
+ $root = get_template_directory();
83
+
84
+ foreach( $support_files[0] as $file ) {
85
+ if ( is_file( $root . $file ) )
86
+ $files[] = $root . $file;
87
+ }
88
+
89
+ $slug = get_stylesheet();
90
+ $options = get_option( 'SnS_options' );
91
+ // Stores data on a theme by theme basis.
92
+ $theme = isset( $options[ 'themes' ][ $slug ] ) ? $options[ 'themes' ][ $slug ] : array();
93
+ $stored = isset( $theme[ 'less' ] ) ? $theme[ 'less' ] : array(); // is an array of stored imported less file data
94
+ $compiled = isset( $theme[ 'compiled' ] ) ? $theme[ 'compiled' ] : ''; // the complete compiled down css
95
+ $slug = esc_attr( $slug );
96
+
97
+ $open_theme_panels = json_decode( get_user_option( 'sns_open_theme_panels', get_current_user_id() ), true );
98
+
99
+ ?>
100
+ <div style="overflow: hidden">
101
+ <div id="less_area" style="width: 49%; float: left; overflow: hidden; margin-right: 2%;">
102
+ <?php
103
+ foreach ( $files as $file ) {
104
+ $name = basename( $file );
105
+ $raw = file_get_contents( $file );
106
+ if ( isset( $stored[ $name ] ) ) {
107
+ $source = $stored[ $name ];
108
+ $less = isset( $source ) ? $source : '';
109
+ $compiled = isset( $compiled ) ? $compiled : '';
110
+ } else {
111
+ $less = $raw;
112
+ $compiled = '';
113
+ }
114
+ $name = esc_attr( $name );
115
+ $lead_break = 0 == strpos( $less, PHP_EOL ) ? PHP_EOL : '';
116
+ if ( isset( $open_theme_panels[ $name ] ) )
117
+ $collapse = $open_theme_panels[ $name ] == 'yes' ? 'sns-collapsed ' : '';
118
+ else
119
+ $collapse = $less == $raw ? 'sns-collapsed ': '';
120
+ ?>
121
+ <div class="sns-less-ide" style="overflow: hidden">
122
+ <div class="widget"><div class="<?php echo $collapse; ?>inside">
123
+ <span class="sns-collapsed-btn"></span>
124
+ <label style="margin-bottom: 0;"><?php echo $name ?></label>
125
+ <textarea data-file-name="<?php echo $name ?>" data-raw="<?php echo esc_attr( $raw ) ?>"
126
+ name="SnS_options[themes][<?php echo $slug ?>][less][<?php echo $name ?>]"
127
+ style="min-width: 250px; width:47%;"
128
+ class="code less" rows="5" cols="40"><?php echo $lead_break . esc_textarea( $less ) ?></textarea>
129
+ <div class="sns-ajax-wrap">
130
+ <a class="sns-ajax-load button" href="#">Load Source File</a>
131
+ <a class="sns-ajax-save button" href="#">Save All Changes</a>
132
+ <img class="sns-ajax-loading" src="/wp-admin/images/wpspin_light.gif" style="display: none;">
133
+ <div class="single-status"><div class="updated settings-error below-h2"></div></div>
134
+ </div>
135
+ </div></div>
136
+ </div>
137
+ <?php
138
+ }
139
+ ?>
140
+ </div>
141
+ <div id="css_area" class="sns-less-ide" style="width: 49%; float: left; overflow: hidden;">
142
+ <div id="compile_status" style="display: none" class="updated settings-error below-h2">
143
+ <p><img class="sns-ajax-loading" src="/wp-admin/images/wpspin_light.gif" />
144
+ <span class="status-text">Keystokes detected. 1 second delay, then compiling...</span></p>
145
+ </div>
146
+ <div class="widget"><div class="sns-collapsed inside">
147
+ <span class="sns-collapsed-btn"></span>
148
+ <label style="margin-bottom: 0;">Preview Window</label>
149
+ <textarea
150
+ name="SnS_options[themes][<?php echo $slug ?>][compiled]"
151
+ style="min-width: 250px; width:47%;"
152
+ class="code css" rows="5" cols="40"><?php echo esc_textarea( $compiled ) ?></textarea>
153
+ </div></div>
154
+ <div id="compiled_error" class="error settings-error below-h2"></div>
155
+ </div>
156
+ <?php
157
+ }
158
+
159
+ /**
160
+ * Settings Page
161
+ * Outputs Description text for the Global Section.
162
+ */
163
+ function global_section() {
164
+ ?>
165
+ <div style="max-width: 55em;">
166
+ <p><?php _e( 'Code entered here will be included in <em>every page (and post) of your site</em>, including the homepage and archives. The code will appear <strong>before</strong> Scripts and Styles registered individually.', 'scripts-n-styles' )?></p>
167
+ </div>
168
+ <?php
169
+ }
170
+ }
171
+ ?>
includes/{class.SnS_Usage_Page.php → class-sns-usage-page.php} RENAMED
@@ -29,20 +29,23 @@ class SnS_Usage_Page
29
  remove_submenu_page( SnS_Admin::$parent_slug, self::MENU_SLUG );
30
  add_filter( 'parent_file', array( __CLASS__, 'parent_file') );
31
  }
 
32
  }
33
-
34
  static function parent_file( $parent_file ) {
35
  global $plugin_page, $submenu_file;
36
  if ( self::MENU_SLUG == $plugin_page ) $submenu_file = SnS_Admin::MENU_SLUG;
37
  return $parent_file;
38
  }
39
 
 
 
 
 
40
  /**
41
  * Settings Page
42
  * Adds Admin Menu Item via WordPress' "Administration Menus" API. Also hook actions to register options via WordPress' Settings API.
43
  */
44
  function admin_load() {
45
- wp_enqueue_style( 'sns-options-styles', plugins_url('css/options-styles.css', Scripts_n_Styles::$file), array(), Scripts_n_Styles::VERSION );
46
 
47
  add_screen_option( 'per_page', array( 'label' => __( 'Per Page' ), 'default' => 20 ) );
48
  add_filter( 'set-screen-option', array( __CLASS__, 'set_screen_option' ), 10, 3 );
@@ -78,7 +81,7 @@ class SnS_Usage_Page
78
  <p><?php _e( 'The following table shows content that utilizes Scripts n Styles.', 'scripts-n-styles' ) ?></p>
79
  </div>
80
  <?php
81
- require_once( 'class.SnS_List_Usage.php' );
82
  $usageTable = new SnS_List_Usage();
83
  $usageTable->prepare_items();
84
  $usageTable->display();
29
  remove_submenu_page( SnS_Admin::$parent_slug, self::MENU_SLUG );
30
  add_filter( 'parent_file', array( __CLASS__, 'parent_file') );
31
  }
32
+ add_action( 'admin_enqueue_scripts', array( __CLASS__, 'admin_enqueue_scripts' ) );
33
  }
 
34
  static function parent_file( $parent_file ) {
35
  global $plugin_page, $submenu_file;
36
  if ( self::MENU_SLUG == $plugin_page ) $submenu_file = SnS_Admin::MENU_SLUG;
37
  return $parent_file;
38
  }
39
 
40
+ function admin_enqueue_scripts() {
41
+ wp_enqueue_style( 'sns-options' );
42
+ }
43
+
44
  /**
45
  * Settings Page
46
  * Adds Admin Menu Item via WordPress' "Administration Menus" API. Also hook actions to register options via WordPress' Settings API.
47
  */
48
  function admin_load() {
 
49
 
50
  add_screen_option( 'per_page', array( 'label' => __( 'Per Page' ), 'default' => 20 ) );
51
  add_filter( 'set-screen-option', array( __CLASS__, 'set_screen_option' ), 10, 3 );
81
  <p><?php _e( 'The following table shows content that utilizes Scripts n Styles.', 'scripts-n-styles' ) ?></p>
82
  </div>
83
  <?php
84
+ require_once( 'class-sns-list-usage.php' );
85
  $usageTable = new SnS_List_Usage();
86
  $usageTable->prepare_items();
87
  $usageTable->display();
includes/class.SnS_Admin_Code_Editor.php DELETED
@@ -1,90 +0,0 @@
1
- <?php
2
- /**
3
- * SnS_Admin_Code_Editor
4
- */
5
-
6
- class SnS_Admin_Code_Editor
7
- {
8
- /**
9
- * Initializing method.
10
- */
11
- function init() {
12
- add_action( 'admin_head-theme-editor.php', array( __CLASS__, 'styles' ) );
13
- add_action( 'admin_head-plugin-editor.php', array( __CLASS__, 'styles' ) );
14
-
15
- }
16
-
17
- function styles() {
18
- $options = get_option( 'SnS_options' );
19
- $cm_theme = isset( $options[ 'cm_theme' ] ) ? $options[ 'cm_theme' ] : 'default';
20
-
21
- wp_enqueue_style( 'codemirror', plugins_url( 'libraries/CodeMirror2/lib/codemirror.css', Scripts_n_Styles::$file), array(), '2.2' );
22
-
23
- if ( in_array( $cm_theme, array( 'cobalt', 'eclipse', 'elegant', 'monokai', 'neat', 'night', 'rubyblue' ) ) )
24
- wp_enqueue_style( "codemirror-$cm_theme", plugins_url( "libraries/CodeMirror2/theme/$cm_theme.css", Scripts_n_Styles::$file), array( 'codemirror' ), '2.2' );
25
-
26
- wp_enqueue_style( 'sns-code-editor', plugins_url( 'css/code-editor.css', Scripts_n_Styles::$file), array( 'codemirror' ), Scripts_n_Styles::VERSION );
27
-
28
- wp_enqueue_script(
29
- 'codemirror',
30
- plugins_url( 'libraries/CodeMirror2/lib/codemirror.js', Scripts_n_Styles::$file),
31
- array(),
32
- '2.2' );
33
- wp_enqueue_script(
34
- 'codemirror-css',
35
- plugins_url( 'libraries/CodeMirror2/mode/css/css.js', Scripts_n_Styles::$file),
36
- array( 'codemirror' ),
37
- '2.2' );
38
- wp_enqueue_script(
39
- 'codemirror-less',
40
- plugins_url( 'libraries/CodeMirror2/mode/less/less.js', Scripts_n_Styles::$file),
41
- array( 'codemirror' ),
42
- '2.2' );
43
- wp_enqueue_script(
44
- 'codemirror-javascript',
45
- plugins_url( 'libraries/CodeMirror2/mode/javascript/javascript.js', Scripts_n_Styles::$file),
46
- array( 'codemirror' ),
47
- '2.2' );
48
- wp_register_script(
49
- 'codemirror-xml',
50
- plugins_url( 'libraries/CodeMirror2/mode/xml/xml.js', Scripts_n_Styles::$file),
51
- array( 'codemirror' ),
52
- '2.2' );
53
- wp_register_script(
54
- 'codemirror-htmlmixed',
55
- plugins_url( 'libraries/CodeMirror2/mode/htmlmixed/htmlmixed.js', Scripts_n_Styles::$file),
56
- array( 'codemirror-xml',
57
- 'codemirror-css',
58
- 'codemirror-javascript'
59
- ),
60
- '2.2' );
61
- wp_register_script(
62
- 'codemirror-clike',
63
- plugins_url( 'libraries/CodeMirror2/mode/clike/clike.js', Scripts_n_Styles::$file),
64
- array( 'codemirror' ),
65
- '2.2' );
66
- wp_register_script(
67
- 'codemirror-php',
68
- plugins_url( 'libraries/CodeMirror2/mode/php/php.js', Scripts_n_Styles::$file),
69
- array( 'codemirror-xml',
70
- 'codemirror-css',
71
- 'codemirror-javascript',
72
- 'codemirror-clike'
73
- ),
74
- '2.2' );
75
- wp_enqueue_script(
76
- 'sns-code-editor',
77
- plugins_url( 'js/code-editor.js', Scripts_n_Styles::$file),
78
- array( 'editor',
79
- 'jquery-ui-tabs',
80
- 'codemirror-javascript',
81
- 'codemirror-css',
82
- 'codemirror-htmlmixed',
83
- 'codemirror-php'
84
- ),
85
- Scripts_n_Styles::VERSION, true );
86
-
87
- wp_localize_script( 'sns-code-editor', 'codemirror_options', array( 'theme' => $cm_theme ) );
88
- }
89
- }
90
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/code-editor.js CHANGED
@@ -4,7 +4,7 @@ jQuery( document ).ready( function( $ ) {
4
  var theme = codemirror_options.theme ? codemirror_options.theme: 'default';
5
  var file = $( 'input[name="file"]' ).val();
6
  var fileType = file.slice( file.lastIndexOf(".")+1 );
7
-
8
  var $submitWrap = $( '#submit' ).parent();
9
  var modHeight = $submitWrap.height()
10
  + parseInt( $submitWrap.css( 'marginTop' ) )
@@ -17,26 +17,38 @@ jQuery( document ).ready( function( $ ) {
17
  modHeight += $documentation.height() + parseInt( $documentation.css( 'marginTop' ) );
18
  }
19
 
20
- var height = $(window).height() - $( '#newcontent' ).offset().top - $( '#wpadminbar' ).height() - modHeight;
21
 
22
  var config = { lineNumbers: true, mode: "javascript", theme: theme };
23
 
24
- if ( "js" == fileType )
25
- config.mode = "javascript";
26
- else if ( "css" == fileType )
27
- config.mode = "css";
28
- else if ( "less" == fileType )
29
- config.mode = "less";
30
- else if ( "html" == fileType || "htm" == fileType )
31
- config.mode = "html";
32
- else if ( "php" == fileType )
33
- config.mode = "php";
34
- else
35
- config.mode = "txt";
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
  CodeMirror.commands.save = function (){ jQuery('#submit').click(); };
38
 
39
- CodeMirror.fromTextArea( $( '#newcontent' ).get(0), config );
40
 
41
  if ( height < $( '.CodeMirror-scroll ' ).height() ) $( '.CodeMirror-scroll ' ).height( height );
42
  });
4
  var theme = codemirror_options.theme ? codemirror_options.theme: 'default';
5
  var file = $( 'input[name="file"]' ).val();
6
  var fileType = file.slice( file.lastIndexOf(".")+1 );
7
+ var $new = $( '#newcontent' );
8
  var $submitWrap = $( '#submit' ).parent();
9
  var modHeight = $submitWrap.height()
10
  + parseInt( $submitWrap.css( 'marginTop' ) )
17
  modHeight += $documentation.height() + parseInt( $documentation.css( 'marginTop' ) );
18
  }
19
 
20
+ var height = $(window).height() - $new.offset().top - $( '#wpadminbar' ).height() - modHeight;
21
 
22
  var config = { lineNumbers: true, mode: "javascript", theme: theme };
23
 
24
+ switch ( fileType ) {
25
+ case "js":
26
+ config.mode = "javascript";
27
+ break;
28
+ case "css":
29
+ config.mode = "css";
30
+ break;
31
+ case "less":
32
+ config.mode = "less";
33
+ break;
34
+ case "coffee":
35
+ config.mode = "coffeescript";
36
+ break;
37
+ case "html":
38
+ case "htm":
39
+ config.mode = "html";
40
+ break;
41
+ case "php":
42
+ config.mode = "php";
43
+ break;
44
+ default:
45
+ config.mode = "markdown";
46
+ break;
47
+ }
48
 
49
  CodeMirror.commands.save = function (){ jQuery('#submit').click(); };
50
 
51
+ CodeMirror.fromTextArea( $new.get(0), config );
52
 
53
  if ( height < $( '.CodeMirror-scroll ' ).height() ) $( '.CodeMirror-scroll ' ).height( height );
54
  });
js/global-page.js CHANGED
@@ -1,14 +1,20 @@
1
  // Options JavaScript
2
 
3
  jQuery( document ).ready( function( $ ) {
 
4
  var theme = _SnS_options.theme ? _SnS_options.theme: 'default';
5
  var lessMirror, lessOutput, errorLine, errorText, errors, loaded,
6
- lessMirrorConfig = { lineNumbers: true, mode: "text/x-less", theme: theme, indentWithTabs: true };
 
 
7
 
8
- CodeMirror.commands.save = saveLessMirror;
9
- lessMirrorConfig.onChange = compile;
 
10
 
11
- $( "textarea.js" ).each( function() {
 
 
12
  CodeMirror.fromTextArea( this, { lineNumbers: true, mode: "javascript", theme: theme } );
13
  });
14
 
@@ -17,18 +23,26 @@ jQuery( document ).ready( function( $ ) {
17
  });
18
 
19
  lessOutput = CodeMirror.fromTextArea( $( '#compiled' ).get(0), { lineNumbers: true, mode: "css", theme: theme, readOnly: true } );
 
20
 
21
  $( "textarea.less" ).each( function() {
22
  lessMirror = CodeMirror.fromTextArea( this, lessMirrorConfig );
23
  });
24
-
 
 
 
 
25
  compile();
 
26
  loaded = true;
 
27
  $( "#less" ).closest('form').submit( compile );
 
28
 
29
- function saveLessMirror(){
30
  // Ajax Save.
31
- }
32
  function compile() {
33
  lessMirror.save();
34
  var parser = new( less.Parser );
@@ -50,6 +64,32 @@ jQuery( document ).ready( function( $ ) {
50
  }
51
  });
52
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  function doError( err ) {
54
  //console.dir( err );
55
  $( '#compiled' ).next( '.CodeMirror' ).hide();
1
  // Options JavaScript
2
 
3
  jQuery( document ).ready( function( $ ) {
4
+ var compiled, source;
5
  var theme = _SnS_options.theme ? _SnS_options.theme: 'default';
6
  var lessMirror, lessOutput, errorLine, errorText, errors, loaded,
7
+ coffeeMirror, coffeeOutput, coffee_errorLine, coffee_errorText, coffee_errors, coffee_loaded,
8
+ lessMirrorConfig = { lineNumbers: true, mode: "text/x-less", theme: theme, indentWithTabs: true, onChange: compile },
9
+ coffeeMirrorConfig = { lineNumbers: true, mode: "text/x-coffeescript", theme: theme, onChange: coffee_compile };
10
 
11
+ $("#enqueue_scripts").data( 'placeholder', 'Enqueue Registered Scripts...' ).width(350).chosen();
12
+ $(".chzn-container-multi .chzn-choices .search-field input").height('26px');
13
+ $(".chzn-container .chzn-results").css( 'max-height', '176px');
14
 
15
+ //CodeMirror.commands.save = saveLessMirror;
16
+
17
+ $( "textarea.js" ).not( '#coffee_compiled' ).each( function() {
18
  CodeMirror.fromTextArea( this, { lineNumbers: true, mode: "javascript", theme: theme } );
19
  });
20
 
23
  });
24
 
25
  lessOutput = CodeMirror.fromTextArea( $( '#compiled' ).get(0), { lineNumbers: true, mode: "css", theme: theme, readOnly: true } );
26
+ coffeeOutput = CodeMirror.fromTextArea( $( '#coffee_compiled' ).get(0), { lineNumbers: true, mode: "javascript", theme: theme, readOnly: true } );
27
 
28
  $( "textarea.less" ).each( function() {
29
  lessMirror = CodeMirror.fromTextArea( this, lessMirrorConfig );
30
  });
31
+ $( "textarea.coffee" ).each( function() {
32
+ coffeeMirror = CodeMirror.fromTextArea( this, coffeeMirrorConfig );
33
+ });
34
+ $('#coffee').parent().append('<label><input type="checkbox" id="coffee_spacing"> Double Spaced</label>');
35
+ $('#coffee_spacing').change( coffee_compile );
36
  compile();
37
+ coffee_compile();
38
  loaded = true;
39
+ coffee_loaded = true;
40
  $( "#less" ).closest('form').submit( compile );
41
+ $( "#coffee" ).closest('form').submit( coffee_compile );
42
 
43
+ //function saveLessMirror(){
44
  // Ajax Save.
45
+ //}
46
  function compile() {
47
  lessMirror.save();
48
  var parser = new( less.Parser );
64
  }
65
  });
66
  }
67
+ function coffee_compile() {
68
+ coffeeMirror.save();
69
+ try {
70
+ $( '#coffee_compiled_error' ).hide();
71
+ source = $('#coffee').val();
72
+ if ( '' == source || ' ' == source ) {
73
+ coffeeOutput.setValue( '' );
74
+ } else {
75
+ compiled = CoffeeScript.compile( source );
76
+ trimmed = $('#coffee_spacing').is(':checked') ? compiled : compiled.replace(/(\n\n)/gm,"\n");
77
+ coffeeOutput.setValue( trimmed );
78
+ }
79
+ coffeeOutput.save();
80
+
81
+ $( '#coffee_compiled' ).next( '.CodeMirror' ).show();
82
+ }
83
+ catch ( err ) {
84
+ $( '#coffee_compiled' ).next( '.CodeMirror' ).hide();
85
+ if ( coffee_loaded ) {
86
+ $( '#coffee_compiled_error' ).removeClass( 'error' ).addClass( 'updated' );
87
+ $( '#coffee_compiled_error' ).show().html( "<p><strong>Warning: &nbsp; </strong>" + err.message + "</p>" );
88
+ } else {
89
+ $( '#coffee_compiled_error' ).show().html( "<p><strong>Error: &nbsp; </strong>" + err.message + "</p>" );
90
+ }
91
+ }
92
+ }
93
  function doError( err ) {
94
  //console.dir( err );
95
  $( '#compiled' ).next( '.CodeMirror' ).hide();
js/hoops-page.js ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Options JavaScript
2
+
3
+ jQuery( document ).ready( function( $ ) { "use strict"
4
+ var collection = []
5
+ , context = "#sns-shortcodes"
6
+ , theme = _SnS_options.theme ? _SnS_options.theme: 'default'
7
+ , $form
8
+ , config;
9
+
10
+ config = {
11
+ mode: "text/html",
12
+ theme: theme,
13
+ lineNumbers: true,
14
+ tabMode: "shift",
15
+ indentUnit: 4,
16
+ indentWithTabs: true,
17
+ enterMode: "keep",
18
+ matchBrackets: true
19
+ };
20
+
21
+ CodeMirror.commands.save = function() {
22
+ $form.submit();
23
+ };
24
+
25
+ // Each "IDE"
26
+ $( ".sns-less-ide", context ).each( function() {
27
+ var $text = $('.code',this);
28
+ var ide = {
29
+ data : $text.val(),
30
+ name : $text.data('sns-shortcode-key'),
31
+ $text : $text,
32
+ cm : CodeMirror.fromTextArea( $text.get(0), config )
33
+ };
34
+ if ( $text.parent().hasClass( 'sns-collapsed' ) )
35
+ ide.cm.toTextArea();
36
+ collection.push( ide );
37
+ });
38
+
39
+ // Collapsable
40
+ $( context ).on( "click", '.sns-collapsed-btn, .sns-collapsed-btn + label', function( event ){
41
+ var $this = $( this )
42
+ , collapsed
43
+ , fileName
44
+ , thisIDE;
45
+ $this.parent().toggleClass( 'sns-collapsed' );
46
+ fileName = $this.siblings( '.code' ).data( 'sns-shortcode-key' );
47
+ collapsed = $this.parent().hasClass( 'sns-collapsed' );
48
+ $(collection).each(function(index, element) {
49
+ if ( element.name == fileName )
50
+ thisIDE = element;
51
+ });
52
+ if ( collapsed ) {
53
+ thisIDE.cm.toTextArea();
54
+ } else {
55
+ thisIDE.cm = CodeMirror.fromTextArea( thisIDE.$text.get(0), config );
56
+ }
57
+ });
58
+ $( '.sns-ajax-loading' ).hide();
59
+ /*
60
+ $form = $( context ).closest( 'form' );
61
+ $form.submit( function( event ){
62
+ event.preventDefault();
63
+ $.ajax({
64
+ type: "POST",
65
+ url: window.location,
66
+ data: $(this).serialize()+'&ajaxsubmit=1',
67
+ cache: false,
68
+ success: saved
69
+ });
70
+ });
71
+ // Save
72
+ $( context ).on( "click", ".sns-ajax-save", function( event ){
73
+ event.preventDefault();
74
+ $( this ).nextAll( '.sns-ajax-loading' ).show();
75
+ $form.submit();
76
+ });*/
77
+ /*
78
+ function saved( data ) {
79
+ $(data).insertAfter( '#icon-sns + h2' ).delay(3000).fadeOut();
80
+ $( '.sns-ajax-loading' ).hide();
81
+ }
82
+
83
+ * Expects return data.
84
+ $('#sns-ajax-add-shortcode').click(function( event ){
85
+ event.preventDefault();
86
+ $(this).next().show();
87
+ $(collection).each(function (){ this.save(); });
88
+
89
+ var args = { _ajax_nonce: nonce };
90
+
91
+ args.action = 'sns_hoops';
92
+ args.subaction = 'add';
93
+ args.name = $( '#SnS_shortcodes' ).val();
94
+ args.shortcode = $( '#SnS_shortcodes_new' ).val();
95
+
96
+ $.post( ajaxurl, args, function( data ) { refreshShortcodes( data ); } );
97
+ });
98
+ $('#SnS_shortcodes').keypress(function( event ) {
99
+ if ( event.which == 13 ) {
100
+ event.preventDefault();
101
+ $("#sns-ajax-add-shortcode").click();
102
+ }
103
+ });
104
+ */
105
+ });
js/{meta-box-scripts.js → meta-box.js} RENAMED
@@ -1,32 +1,35 @@
1
  jQuery( document ).ready( function( $ ) {
2
 
3
- // For compat: 3.3 || 3.2
4
- var initData = tinyMCEPreInit.mceInit["content"],
5
  context = '#SnS_meta_box',
6
  currentCodeMirror = [],
7
  mceBodyClass = getMCEBodyClasses(),
8
  nonce = $( '#scripts_n_styles_noncename' ).val(),
9
  theme = codemirror_options.theme ? codemirror_options.theme: 'default';
10
 
 
 
 
 
11
  //$('textarea', context).attr('autocomplete','off');
12
 
13
  // Refresh when panel becomes unhidden
14
- $( context + '-hide, '
15
- + context + ' .hndle, '
16
- + context + ' .handlediv ' )
17
- .live( 'click', refreshCodeMirrors );
18
 
19
  // add tab-switch handler
20
- $( '.wp-tab-bar a', context ).live( 'click', onTabSwitch );
21
 
22
  // activate first run
23
- $( '.wp-tab-active a', context ).trigger( 'click' );
24
 
25
  // must run before ajax click handlers are added.
26
  setupAjaxUI();
27
 
28
  refreshDeleteBtns();
29
 
 
30
 
31
  $('#sns-ajax-update-scripts').click(function( event ){
32
  event.preventDefault();
@@ -67,6 +70,12 @@ jQuery( document ).ready( function( $ ) {
67
 
68
  $.post( ajaxurl, args, function( data ) { refreshBodyClass( data ); } );
69
  });
 
 
 
 
 
 
70
 
71
  /*
72
  * Expects return data.
@@ -99,11 +108,17 @@ jQuery( document ).ready( function( $ ) {
99
 
100
  $.post( ajaxurl, args, function( data ) { refreshStyleFormats( data ); } );
101
  });
 
 
 
 
 
 
102
 
103
  /*
104
  * Expects return data.
105
  */
106
- $('#delete-mce-dropdown-names .sns-ajax-delete').live( "click", function( event ){
107
  event.preventDefault();
108
  $(this).next().show();
109
  var args = { _ajax_nonce: nonce, post_id: $( '#post_ID' ).val(), };
@@ -114,6 +129,60 @@ jQuery( document ).ready( function( $ ) {
114
  $.post( ajaxurl, args, function( data ) { refreshStyleFormats( data ); } );
115
  });
116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  /*
118
  * Returns the body_class of TinyMCE minus the Scripts n Styles values.
119
  */
@@ -175,6 +244,22 @@ jQuery( document ).ready( function( $ ) {
175
  + '<img class="sns-ajax-loading" src="/wp-admin/images/wpspin_light.gif">'
176
  + '</div>'
177
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
 
179
  $('.sns-ajax-loading').hide();
180
 
@@ -192,7 +277,7 @@ jQuery( document ).ready( function( $ ) {
192
  }
193
  });
194
 
195
- $( '#mce-dropdown-names', context ).show();
196
  }
197
 
198
  /*
@@ -397,6 +482,64 @@ jQuery( document ).ready( function( $ ) {
397
  refreshDeleteBtns();
398
  refreshMCE();
399
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
400
  function refreshMCE() {
401
  var ed = tinyMCE.editors["content"];
402
  // If Visual has been activated.
1
  jQuery( document ).ready( function( $ ) {
2
 
3
+ // For CPTs that don't have an editor, prevent "tinyMCEPreInit is 'undefined'"
4
+ var initData = ( typeof tinyMCEPreInit !== 'undefined' && tinyMCEPreInit.mceInit["content"] ) ? tinyMCEPreInit.mceInit["content"]: false,
5
  context = '#SnS_meta_box',
6
  currentCodeMirror = [],
7
  mceBodyClass = getMCEBodyClasses(),
8
  nonce = $( '#scripts_n_styles_noncename' ).val(),
9
  theme = codemirror_options.theme ? codemirror_options.theme: 'default';
10
 
11
+ $("#SnS_enqueue_scripts").data( 'placeholder', 'Enqueue Registered Scripts...' ).width(350).chosen();
12
+ $(".chzn-container-multi .chzn-choices .search-field input").height('26px');
13
+ $(".chzn-container .chzn-results").css( 'max-height', '176px');
14
+
15
  //$('textarea', context).attr('autocomplete','off');
16
 
17
  // Refresh when panel becomes unhidden
18
+ $( '#adv-settings' ).on( 'click', context + '-hide, ', refreshCodeMirrors );
19
+ $( context ).on( 'click', '.hndle, .handlediv', refreshCodeMirrors );
 
 
20
 
21
  // add tab-switch handler
22
+ $( context ).on( 'click', '.wp-tab-bar a', onTabSwitch );
23
 
24
  // activate first run
25
+ $( '.wp-tab-active a', context ).click();
26
 
27
  // must run before ajax click handlers are added.
28
  setupAjaxUI();
29
 
30
  refreshDeleteBtns();
31
 
32
+
33
 
34
  $('#sns-ajax-update-scripts').click(function( event ){
35
  event.preventDefault();
70
 
71
  $.post( ajaxurl, args, function( data ) { refreshBodyClass( data ); } );
72
  });
73
+ $('#SnS_classes_body, #SnS_classes_body').keypress(function( event ) {
74
+ if ( event.which == 13 ) {
75
+ event.preventDefault();
76
+ $("#sns-ajax-update-classes").click();
77
+ }
78
+ });
79
 
80
  /*
81
  * Expects return data.
108
 
109
  $.post( ajaxurl, args, function( data ) { refreshStyleFormats( data ); } );
110
  });
111
+ $('#SnS_classes_mce_classes, #SnS_classes_mce_element, #SnS_classes_mce_title').keypress(function( event ) {
112
+ if ( event.which == 13 ) {
113
+ event.preventDefault();
114
+ $("#sns-ajax-update-dropdown").click();
115
+ }
116
+ });
117
 
118
  /*
119
  * Expects return data.
120
  */
121
+ $('#delete-mce-dropdown-names').on( "click", ".sns-ajax-delete", function( event ){
122
  event.preventDefault();
123
  $(this).next().show();
124
  var args = { _ajax_nonce: nonce, post_id: $( '#post_ID' ).val(), };
129
  $.post( ajaxurl, args, function( data ) { refreshStyleFormats( data ); } );
130
  });
131
 
132
+
133
+
134
+ /*
135
+ * Expects return data.
136
+ */
137
+ $('#sns-ajax-add-shortcode').click(function( event ){
138
+ event.preventDefault();
139
+ $(this).next().show();
140
+ $(currentCodeMirror).each(function (){ this.save(); });
141
+
142
+ var args = { _ajax_nonce: nonce, post_id: $( '#post_ID' ).val(), };
143
+
144
+ args.action = 'sns_shortcodes';
145
+ args.subaction = 'add';
146
+ args.name = $( '#SnS_shortcodes' ).val();
147
+ args.shortcode = $( '#SnS_shortcodes_new' ).val();
148
+
149
+ $.post( ajaxurl, args, function( data ) { refreshShortcodes( data ); } );
150
+ });
151
+ $('#SnS_shortcodes').keypress(function( event ) {
152
+ if ( event.which == 13 ) {
153
+ event.preventDefault();
154
+ $("#sns-ajax-add-shortcode").click();
155
+ }
156
+ });
157
+
158
+ $('#sns-shortcodes').on( "click", ".sns-ajax-delete-shortcode", function( event ){
159
+ event.preventDefault();
160
+ if($(this).data('lock'))return;else $(this).data('lock',true);
161
+
162
+ $(this).next().show();
163
+ $(currentCodeMirror).each(function (){ this.save(); });
164
+ var args = { _ajax_nonce: nonce, post_id: $( '#post_ID' ).val(), };
165
+
166
+ args.action = 'sns_shortcodes';
167
+ args.subaction = 'delete';
168
+ args.name = $( this ).parent().siblings('textarea').attr( 'data-sns-shortcode-key' );
169
+
170
+ $.post( ajaxurl, args, function( data ) { refreshShortcodes( data ); } );
171
+ });
172
+ $('#sns-shortcodes').on( "click", ".sns-ajax-update-shortcode", function( event ){
173
+ event.preventDefault();
174
+ $(this).next().show();
175
+ $(currentCodeMirror).each(function (){ this.save(); });
176
+ var args = { _ajax_nonce: nonce, post_id: $( '#post_ID' ).val(), };
177
+
178
+ args.action = 'sns_shortcodes';
179
+ args.subaction = 'update';
180
+ args.name = $( this ).parent().siblings('textarea').attr( 'data-sns-shortcode-key' );
181
+ args.shortcode = $( this ).parent().siblings('textarea').val();
182
+
183
+ $.post( ajaxurl, args, function( data ) { refreshShortcodes( data ); } );
184
+ });
185
+
186
  /*
187
  * Returns the body_class of TinyMCE minus the Scripts n Styles values.
188
  */
244
  + '<img class="sns-ajax-loading" src="/wp-admin/images/wpspin_light.gif">'
245
  + '</div>'
246
  );
247
+
248
+ $('#SnS_shortcodes').after(
249
+ ' &nbsp; '
250
+ + '<a id="sns-ajax-add-shortcode" href="#" class="button">Add New</a>'
251
+ + ' '
252
+ + '<img class="sns-ajax-loading" src="/wp-admin/images/wpspin_light.gif">'
253
+ );
254
+ $('#sns-shortcodes .sns-shortcode .inside').append(
255
+ '<div class="sns-ajax-wrap">'
256
+ + '<a class="sns-ajax-delete-shortcode button" href="#">Delete</a>'
257
+ + ' &nbsp; '
258
+ + '<a class="sns-ajax-update-shortcode button" href="#">Update</a>'
259
+ + ' '
260
+ + '<img class="sns-ajax-loading" src="/wp-admin/images/wpspin_light.gif">'
261
+ + '</div>'
262
+ );
263
 
264
  $('.sns-ajax-loading').hide();
265
 
277
  }
278
  });
279
 
280
+ $( '.wp-tab-bar li', context ).show();
281
  }
282
 
283
  /*
482
  refreshDeleteBtns();
483
  refreshMCE();
484
  }
485
+ if ( 0 == $( '.sns-shortcode', '#sns-shortcodes' ).length )
486
+ $( 'h4', '#sns-shortcodes' ).hide();
487
+ function refreshShortcodes( data ) {
488
+ if ( data.code ) {
489
+ switch ( data.code ) {
490
+ case 2:
491
+ console.log( data.message );
492
+ break;
493
+ case 3:
494
+ $( 'textarea[data-sns-shortcode-key=' + data.message + ']', '#sns-shortcodes' ).closest('.sns-shortcode').slideUp(function(){
495
+ $(this).remove();
496
+ if ( 0 == $( '.sns-shortcode', '#sns-shortcodes' ).length )
497
+ $( 'h4', '#sns-shortcodes' ).slideUp();
498
+ });
499
+ break;
500
+ }
501
+ } else {
502
+ if ( 0 == data.indexOf( "<" ) ) {
503
+ $('#sns-shortcodes-wrap').prepend( data ).find( '.widget' ).hide().slideDown();
504
+ $( '.codemirror-new' ).parent().prepend( '<span class="sns-collapsed-shortcode-btn"></span>' );
505
+ var codemirrorNew = $( '.codemirror-new' ).removeClass('codemirror-new').addClass('codemirror').get(0);
506
+ currentCodeMirror.push( CodeMirror.fromTextArea( codemirrorNew, {
507
+ mode: "text/html",
508
+ theme: theme,
509
+ lineNumbers: true,
510
+ tabMode: "shift",
511
+ indentUnit: 4,
512
+ indentWithTabs: true,
513
+ enterMode: "keep",
514
+ matchBrackets: true
515
+ } ) );
516
+ if ( 0 == $( 'h4', '#sns-shortcodes' ).length )
517
+ $( '#sns-shortcodes' ).prepend('<h4>Existing Codes: </h4>');
518
+ if ( ! $( 'h4', '#sns-shortcodes' ).is( ":visible" ) )
519
+ $( 'h4', '#sns-shortcodes' ).slideDown();
520
+ clearCodeMirrors();
521
+ $('#SnS_shortcodes').val('');
522
+ $('#SnS_shortcodes_new').val('');
523
+ loadCodeMirrors();
524
+
525
+ } else if ( 0 == data.indexOf( "empty value." ) ) {
526
+ console.log('empty value');
527
+ } else if ( 0 == data.indexOf( "Use delete instead." ) ) {
528
+ console.log('Use delete instead');
529
+ } else {
530
+ alert( 'Scripts n Styles: ' + '\n\n' + 'Sorry, there was an AJAX error: (' + data + ')' + '\n\n' + 'Please use the post update button instead.' );
531
+ }
532
+ }
533
+ $('.sns-ajax-loading').hide();
534
+ }
535
+ addShortcodeBtns();
536
+ function addShortcodeBtns() {
537
+ $( '.sns-shortcode > .inside > p' ).before('<span class="sns-collapsed-shortcode-btn"></span>');
538
+ $('#sns-shortcodes-wrap').on("click",'.sns-collapsed-shortcode-btn', function(event){
539
+ $(this).parent().toggleClass('sns-collapsed-shortcode');
540
+ });
541
+ $('.sns-collapsed-shortcode-btn').click();
542
+ }
543
  function refreshMCE() {
544
  var ed = tinyMCE.editors["content"];
545
  // If Visual has been activated.
js/theme-page.js ADDED
@@ -0,0 +1,264 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Options JavaScript
2
+
3
+ jQuery( document ).ready( function( $ ) { "use strict"
4
+ var collection = []
5
+ , context = "#less_area"
6
+ , theme = _SnS_options.theme ? _SnS_options.theme: 'default'
7
+ , timeout = _SnS_options.timeout || 1000
8
+ , loaded = false
9
+ , preview = false
10
+ , compiled
11
+ , $codemirror, $error, $status, $form, $css
12
+ , onChange
13
+ , errorMarker, errorText, errorMirror
14
+ , config;
15
+
16
+ // Prevent keystoke compile buildup
17
+ onChange = function onChange( cm ){
18
+ $status.show();
19
+ cm.save();
20
+ if ( timeout ) {
21
+ clearTimeout( _SnS_options.theme_compiler_timer );
22
+ _SnS_options.theme_compiler_timer = setTimeout( _SnS_options.theme_compiler, timeout );
23
+ } else {
24
+ compile();
25
+ }
26
+ }
27
+ config = {
28
+ lineNumbers: true,
29
+ mode: "text/x-less",
30
+ theme: theme,
31
+ indentWithTabs: true,
32
+ onChange: onChange
33
+ };
34
+
35
+ CodeMirror.commands.save = function() {
36
+ $form.submit();
37
+ };
38
+
39
+ // Each "IDE"
40
+ $( ".sns-less-ide", context ).each( function() {
41
+ var $text = $('.code',this);
42
+ var ide = {
43
+ name : $text.data('file-name'),
44
+ raw : $text.data('raw'),
45
+ data : $text.val(),
46
+ $text : $text,
47
+ lines : 0,
48
+ startLine : 0,
49
+ endLine : 0,
50
+ errorLine : null,
51
+ errorText : null,
52
+ cm : CodeMirror.fromTextArea( $text.get(0), config )
53
+ };
54
+ if ( $text.parent().hasClass( 'sns-collapsed' ) )
55
+ ide.cm.toTextArea();
56
+ collection.push( ide );
57
+ });
58
+
59
+ // Collapsable
60
+ $( context ).on( "click", '.sns-collapsed-btn, .sns-collapsed-btn + label', function( event ){
61
+ var $this = $( this )
62
+ , collapsed
63
+ , fileName
64
+ , thisIDE;
65
+ $this.parent().toggleClass( 'sns-collapsed' );
66
+ fileName = $this.siblings( '.code' ).data( 'file-name' );
67
+ collapsed = $this.parent().hasClass( 'sns-collapsed' );
68
+ $(collection).each(function(index, element) {
69
+ if ( element.name == fileName )
70
+ thisIDE = element;
71
+ });
72
+ if ( collapsed ) {
73
+ thisIDE.cm.toTextArea();
74
+ } else {
75
+ thisIDE.cm = CodeMirror.fromTextArea( thisIDE.$text.get(0), config );
76
+ }
77
+ $.post( ajaxurl,
78
+ { action: 'sns_open_theme_panels'
79
+ , _ajax_nonce: $( '#_wpnonce' ).val()
80
+ , 'file-name': fileName
81
+ , 'collapsed': collapsed ? 'yes' : 'no'
82
+ }
83
+ );
84
+ });
85
+ $( '#css_area' ).on( "click", '.sns-collapsed-btn, .sns-collapsed-btn + label', function( event ){
86
+ var $this = $( this ).parent();
87
+ $this.toggleClass( 'sns-collapsed' );
88
+ preview = ! $this.hasClass( 'sns-collapsed' );
89
+ if ( preview )
90
+ compiled = createCSSEditor();
91
+ else
92
+ compiled.toTextArea();
93
+ });
94
+
95
+ $( '.single-status' ).hide();
96
+ $( '.sns-ajax-loading' ).hide();
97
+
98
+ // Load
99
+ $( context ).on( "click", ".sns-ajax-load", function( event ){
100
+ event.preventDefault();
101
+ $( this ).nextAll( '.sns-ajax-loading' ).show();
102
+ var name = $( this ).parent().prevAll( '.code' ).data( 'file-name' );
103
+ $( collection ).each( function( index, element ){
104
+ if ( element.name == name ) {
105
+ element.cm.setValue( element.raw );
106
+ return;
107
+ }
108
+ });
109
+ compile();
110
+ $( '.sns-ajax-loading' ).hide();
111
+ $( this ).nextAll( '.single-status' )
112
+ .show().delay(3000).fadeOut()
113
+ .children('.settings-error').text( 'Original Source File Loaded.' );
114
+ });
115
+
116
+ // Save
117
+ $( context ).on( "click", ".sns-ajax-save", function( event ){
118
+ event.preventDefault();
119
+ $( this ).nextAll( '.sns-ajax-loading' ).show();
120
+ $form.submit();
121
+ });
122
+ function saved( data ) {
123
+ $(data).insertAfter( '#icon-sns + h2' ).delay(3000).fadeOut();
124
+ $( '.sns-ajax-loading' ).hide();
125
+ }
126
+
127
+ // The CSS output side.
128
+ $css = $( '.css', "#css_area" );
129
+ if ( preview ) {
130
+ compiled = createCSSEditor();
131
+ }
132
+ $codemirror = $css.next( '.CodeMirror' );
133
+ $error = $( "#compiled_error" );
134
+ $status = $( "#compile_status" );
135
+
136
+ // Start.
137
+ compile();
138
+ loaded = true;
139
+
140
+ $form = $( "#less_area" ).closest( 'form' );
141
+ $form.submit( function( event ){
142
+ event.preventDefault();
143
+ compile();
144
+ $.ajax({
145
+ type: "POST",
146
+ url: window.location,
147
+ data: $(this).serialize()+'&ajaxsubmit=1',
148
+ cache: false,
149
+ success: saved
150
+ });
151
+ });
152
+ function createCSSEditor() {
153
+ return CodeMirror.fromTextArea(
154
+ $css.get(0),
155
+ { lineNumbers: true, mode: "css", theme: theme, readOnly: true }
156
+ );
157
+ }
158
+ function compile() {
159
+ var lessValue = '';
160
+ var totalLines = 0;
161
+ var compiledValue;
162
+ $( collection ).each(function(){
163
+ //this.cm.save();
164
+ lessValue += "\n" + this.$text.val();
165
+ this.lines = this.cm.lineCount();
166
+ this.startLine = totalLines;
167
+ totalLines += this.lines;
168
+ this.endLine = totalLines;
169
+ });
170
+ var parser = new( less.Parser );
171
+ parser.parse( lessValue, function ( err, tree ) {
172
+ if ( err ){
173
+ doError( err );
174
+ } else {
175
+ try {
176
+ $error.hide();
177
+ if ( preview ) {
178
+ compiledValue = tree.toCSS();
179
+ compiled.setValue( compiledValue );
180
+ compiled.save();
181
+ //$codemirror.show();
182
+ compiled.refresh();
183
+ clearCompileError();
184
+ } else {
185
+ compiledValue = tree.toCSS({ compress: true });
186
+ $css.val( compiledValue );
187
+ clearCompileError();
188
+ }
189
+ }
190
+ catch ( err ) {
191
+ doError( err );
192
+ }
193
+ }
194
+ });
195
+ clearTimeout( _SnS_options.theme_compiler_timer );
196
+ $status.hide();
197
+ }
198
+ function doError( err ) {
199
+ console.log( err );
200
+ var pos, token, start, end, errLine, fileName, errMessage;
201
+ errLine = err.line-1;
202
+
203
+ errorMirror = null;
204
+ $( collection ).each(function( i ){
205
+ if ( this.startLine <= errLine && errLine < this.endLine ) {
206
+ errorMirror = this.cm;
207
+ errLine = errLine - this.startLine -1;
208
+ fileName = this.name;
209
+ return;
210
+ }
211
+ });
212
+
213
+ //$codemirror.hide();
214
+
215
+ var errMessage = '';
216
+
217
+ if ( err.type == 'Parse' )
218
+ errMessage = " &nbsp; <em>LESS Parse Error</em> <br /> on line " + ( errLine + 1 ) + " of " + fileName + ".</p>";
219
+ else
220
+ errMessage = " &nbsp; <em>LESS " + err.type +" Error</em> on line " + ( errLine + 1 ) + " of " + fileName + ". <br />" + err.message + "</p>";
221
+
222
+ if ( loaded ) {
223
+ $error
224
+ .removeClass( 'error' )
225
+ .addClass( 'updated' )
226
+ .show()
227
+ .html( "<p><strong>Warning:</strong>" + errMessage + "</p>" );
228
+ } else {
229
+ $error
230
+ .show()
231
+ .html( "<p><strong>Error: &nbsp; </strong>" + errMessage + "</p>" );
232
+ }
233
+
234
+ clearCompileError();
235
+
236
+ if (!errorMirror) return;
237
+
238
+ errorMarker = errorMirror.setMarker( errLine, '<strong>*%N%</strong>', "cm-error" );
239
+
240
+ errorMirror.setLineClass( errorMarker, "cm-error" );
241
+
242
+ pos = errorMirror.posFromIndex( err.index + 1 );
243
+ token = errorMirror.getTokenAt( pos );
244
+ start = errorMirror.posFromIndex( err.index );
245
+ end = errorMirror.posFromIndex( err.index + token.string.length );
246
+
247
+ errorText = errorMirror.markText( start, end, "cm-error" );
248
+ if ( preview ) {
249
+ compiled.setValue( "" );
250
+ compiled.save();
251
+ compiled.refresh();
252
+ }
253
+ }
254
+ function clearCompileError() {
255
+ if ( errorMarker ) {
256
+ errorMirror.clearMarker( errorMarker );
257
+ errorMirror.setLineClass( errorMarker, null );
258
+ errorMarker = false;
259
+ }
260
+ if ( errorText ) errorText.clear();
261
+ errorText = false;
262
+ }
263
+ _SnS_options.theme_compiler = compile;
264
+ });
libraries/CodeMirror2/mode/clike/index.html DELETED
@@ -1,101 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>CodeMirror: C-like mode</title>
5
- <link rel="stylesheet" href="../../lib/codemirror.css">
6
- <script src="../../lib/codemirror.js"></script>
7
- <script src="clike.js"></script>
8
- <link rel="stylesheet" href="../../doc/docs.css">
9
- <style>.CodeMirror {border: 2px inset #dee;}</style>
10
- </head>
11
- <body>
12
- <h1>CodeMirror: C-like mode</h1>
13
-
14
- <form><textarea id="code" name="code">
15
- /* C demo code */
16
-
17
- #include <zmq.h>
18
- #include <pthread.h>
19
- #include <semaphore.h>
20
- #include <time.h>
21
- #include <stdio.h>
22
- #include <fcntl.h>
23
- #include <malloc.h>
24
-
25
- typedef struct {
26
- void* arg_socket;
27
- zmq_msg_t* arg_msg;
28
- char* arg_string;
29
- unsigned long arg_len;
30
- int arg_int, arg_command;
31
-
32
- int signal_fd;
33
- int pad;
34
- void* context;
35
- sem_t sem;
36
- } acl_zmq_context;
37
-
38
- #define p(X) (context->arg_##X)
39
-
40
- void* zmq_thread(void* context_pointer) {
41
- acl_zmq_context* context = (acl_zmq_context*)context_pointer;
42
- char ok = 'K', err = 'X';
43
- int res;
44
-
45
- while (1) {
46
- while ((res = sem_wait(&amp;context->sem)) == EINTR);
47
- if (res) {write(context->signal_fd, &amp;err, 1); goto cleanup;}
48
- switch(p(command)) {
49
- case 0: goto cleanup;
50
- case 1: p(socket) = zmq_socket(context->context, p(int)); break;
51
- case 2: p(int) = zmq_close(p(socket)); break;
52
- case 3: p(int) = zmq_bind(p(socket), p(string)); break;
53
- case 4: p(int) = zmq_connect(p(socket), p(string)); break;
54
- case 5: p(int) = zmq_getsockopt(p(socket), p(int), (void*)p(string), &amp;p(len)); break;
55
- case 6: p(int) = zmq_setsockopt(p(socket), p(int), (void*)p(string), p(len)); break;
56
- case 7: p(int) = zmq_send(p(socket), p(msg), p(int)); break;
57
- case 8: p(int) = zmq_recv(p(socket), p(msg), p(int)); break;
58
- case 9: p(int) = zmq_poll(p(socket), p(int), p(len)); break;
59
- }
60
- p(command) = errno;
61
- write(context->signal_fd, &amp;ok, 1);
62
- }
63
- cleanup:
64
- close(context->signal_fd);
65
- free(context_pointer);
66
- return 0;
67
- }
68
-
69
- void* zmq_thread_init(void* zmq_context, int signal_fd) {
70
- acl_zmq_context* context = malloc(sizeof(acl_zmq_context));
71
- pthread_t thread;
72
-
73
- context->context = zmq_context;
74
- context->signal_fd = signal_fd;
75
- sem_init(&amp;context->sem, 1, 0);
76
- pthread_create(&amp;thread, 0, &amp;zmq_thread, context);
77
- pthread_detach(thread);
78
- return context;
79
- }
80
- </textarea></form>
81
-
82
- <script>
83
- var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
84
- lineNumbers: true,
85
- matchBrackets: true,
86
- mode: "text/x-csrc"
87
- });
88
- </script>
89
-
90
- <p>Simple mode that tries to handle C-like languages as well as it
91
- can. Takes two configuration parameters: <code>keywords</code>, an
92
- object whose property names are the keywords in the language,
93
- and <code>useCPP</code>, which determines whether C preprocessor
94
- directives are recognized.</p>
95
-
96
- <p><strong>MIME types defined:</strong> <code>text/x-csrc</code>
97
- (C code), <code>text/x-c++src</code> (C++
98
- code), <code>text/x-java</code> (Java
99
- code), <code>text/x-csharp</code> (C#).</p>
100
- </body>
101
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
libraries/CodeMirror2/mode/css/index.html DELETED
@@ -1,55 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>CodeMirror: CSS mode</title>
5
- <link rel="stylesheet" href="../../lib/codemirror.css">
6
- <script src="../../lib/codemirror.js"></script>
7
- <script src="css.js"></script>
8
- <style>.CodeMirror {background: #f8f8f8;}</style>
9
- <link rel="stylesheet" href="../../doc/docs.css">
10
- </head>
11
- <body>
12
- <h1>CodeMirror: CSS mode</h1>
13
- <form><textarea id="code" name="code">
14
- /* Some example CSS */
15
-
16
- @import url("something.css");
17
-
18
- body {
19
- margin: 0;
20
- padding: 3em 6em;
21
- font-family: tahoma, arial, sans-serif;
22
- color: #000;
23
- }
24
-
25
- #navigation a {
26
- font-weight: bold;
27
- text-decoration: none !important;
28
- }
29
-
30
- h1 {
31
- font-size: 2.5em;
32
- }
33
-
34
- h2 {
35
- font-size: 1.7em;
36
- }
37
-
38
- h1:before, h2:before {
39
- content: "::";
40
- }
41
-
42
- code {
43
- font-family: courier, monospace;
44
- font-size: 80%;
45
- color: #418A8A;
46
- }
47
- </textarea></form>
48
- <script>
49
- var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
50
- </script>
51
-
52
- <p><strong>MIME types defined:</strong> <code>text/css</code>.</p>
53
-
54
- </body>
55
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
libraries/CodeMirror2/mode/htmlmixed/index.html DELETED
@@ -1,51 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>CodeMirror: HTML mixed mode</title>
5
- <link rel="stylesheet" href="../../lib/codemirror.css">
6
- <script src="../../lib/codemirror.js"></script>
7
- <script src="../xml/xml.js"></script>
8
- <script src="../javascript/javascript.js"></script>
9
- <script src="../css/css.js"></script>
10
- <script src="htmlmixed.js"></script>
11
- <link rel="stylesheet" href="../../doc/docs.css">
12
- <style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
13
- </head>
14
- <body>
15
- <h1>CodeMirror: HTML mixed mode</h1>
16
- <form><textarea id="code" name="code">
17
- <html style="color: green">
18
- <!-- this is a comment -->
19
- <head>
20
- <title>Mixed HTML Example</title>
21
- <style type="text/css">
22
- h1 {font-family: comic sans; color: #f0f;}
23
- div {background: yellow !important;}
24
- body {
25
- max-width: 50em;
26
- margin: 1em 2em 1em 5em;
27
- }
28
- </style>
29
- </head>
30
- <body>
31
- <h1>Mixed HTML Example</h1>
32
- <script>
33
- function jsFunc(arg1, arg2) {
34
- if (arg1 && arg2) document.body.innerHTML = "achoo";
35
- }
36
- </script>
37
- </body>
38
- </html>
39
- </textarea></form>
40
- <script>
41
- var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: "text/html", tabMode: "indent"});
42
- </script>
43
-
44
- <p>The HTML mixed mode depends on the XML, JavaScript, and CSS modes.</p>
45
-
46
- <p><strong>MIME types defined:</strong> <code>text/html</code>
47
- (redefined, only takes effect if you load this parser after the
48
- XML parser).</p>
49
-
50
- </body>
51
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
libraries/CodeMirror2/mode/javascript/index.html DELETED
@@ -1,77 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>CodeMirror: JavaScript mode</title>
5
- <link rel="stylesheet" href="../../lib/codemirror.css">
6
- <script src="../../lib/codemirror.js"></script>
7
- <script src="javascript.js"></script>
8
- <link rel="stylesheet" href="../../doc/docs.css">
9
- <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
10
- </head>
11
- <body>
12
- <h1>CodeMirror: JavaScript mode</h1>
13
-
14
- <div><textarea id="code" name="code">
15
- // Demo code (the actual new parser character stream implementation)
16
-
17
- function StringStream(string) {
18
- this.pos = 0;
19
- this.string = string;
20
- }
21
-
22
- StringStream.prototype = {
23
- done: function() {return this.pos >= this.string.length;},
24
- peek: function() {return this.string.charAt(this.pos);},
25
- next: function() {
26
- if (this.pos &lt; this.string.length)
27
- return this.string.charAt(this.pos++);
28
- },
29
- eat: function(match) {
30
- var ch = this.string.charAt(this.pos);
31
- if (typeof match == "string") var ok = ch == match;
32
- else var ok = ch &amp;&amp; match.test ? match.test(ch) : match(ch);
33
- if (ok) {this.pos++; return ch;}
34
- },
35
- eatWhile: function(match) {
36
- var start = this.pos;
37
- while (this.eat(match));
38
- if (this.pos > start) return this.string.slice(start, this.pos);
39
- },
40
- backUp: function(n) {this.pos -= n;},
41
- column: function() {return this.pos;},
42
- eatSpace: function() {
43
- var start = this.pos;
44
- while (/\s/.test(this.string.charAt(this.pos))) this.pos++;
45
- return this.pos - start;
46
- },
47
- match: function(pattern, consume, caseInsensitive) {
48
- if (typeof pattern == "string") {
49
- function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}
50
- if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
51
- if (consume !== false) this.pos += str.length;
52
- return true;
53
- }
54
- }
55
- else {
56
- var match = this.string.slice(this.pos).match(pattern);
57
- if (match &amp;&amp; consume !== false) this.pos += match[0].length;
58
- return match;
59
- }
60
- }
61
- };
62
- </textarea></div>
63
-
64
- <script>
65
- var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
66
- lineNumbers: true,
67
- matchBrackets: true
68
- });
69
- </script>
70
-
71
- <p>JavaScript mode supports a single configuration
72
- option, <code>json</code>, which will set the mode to expect JSON
73
- data rather than a JavaScript program.</p>
74
-
75
- <p><strong>MIME types defined:</strong> <code>text/javascript</code>, <code>application/json</code>.</p>
76
- </body>
77
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
libraries/CodeMirror2/mode/php/index.html DELETED
@@ -1,48 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>CodeMirror: PHP mode</title>
5
- <link rel="stylesheet" href="../../lib/codemirror.css">
6
- <script src="../../lib/codemirror.js"></script>
7
- <script src="../xml/xml.js"></script>
8
- <script src="../javascript/javascript.js"></script>
9
- <script src="../css/css.js"></script>
10
- <script src="../clike/clike.js"></script>
11
- <script src="php.js"></script>
12
- <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
13
- <link rel="stylesheet" href="../../doc/docs.css">
14
- </head>
15
- <body>
16
- <h1>CodeMirror: PHP mode</h1>
17
-
18
- <form><textarea id="code" name="code">
19
- <?php
20
- function hello($who) {
21
- return "Hello " . $who;
22
- }
23
- ?>
24
- <p>The program says <?= hello("World") ?>.</p>
25
- <script>
26
- alert("And here is some JS code"); // also colored
27
- </script>
28
- </textarea></form>
29
-
30
- <script>
31
- var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
32
- lineNumbers: true,
33
- matchBrackets: true,
34
- mode: "application/x-httpd-php",
35
- indentUnit: 4,
36
- indentWithTabs: true,
37
- enterMode: "keep",
38
- tabMode: "shift"
39
- });
40
- </script>
41
-
42
- <p>Simple HTML/PHP mode based on
43
- the <a href="../clike/">C-like</a> mode. Depends on XML,
44
- JavaScript, CSS, and C-like modes.</p>
45
-
46
- <p><strong>MIME types defined:</strong> <code>application/x-httpd-php</code> (HTML with PHP code), <code>text/x-php</code> (plain, non-wrapped PHP code).</p>
47
- </body>
48
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
libraries/CodeMirror2/mode/xml/index.html DELETED
@@ -1,44 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <title>CodeMirror: XML mode</title>
5
- <link rel="stylesheet" href="../../lib/codemirror.css">
6
- <script src="../../lib/codemirror.js"></script>
7
- <script src="xml.js"></script>
8
- <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
9
- <link rel="stylesheet" href="../../doc/docs.css">
10
- </head>
11
- <body>
12
- <h1>CodeMirror: XML mode</h1>
13
- <form><textarea id="code" name="code">
14
- &lt;html style="color: green"&gt;
15
- &lt;!-- this is a comment --&gt;
16
- &lt;head&gt;
17
- &lt;title&gt;HTML Example&lt;/title&gt;
18
- &lt;/head&gt;
19
- &lt;body&gt;
20
- The indentation tries to be &lt;em&gt;somewhat &amp;quot;do what
21
- I mean&amp;quot;&lt;/em&gt;... but might not match your style.
22
- &lt;/body&gt;
23
- &lt;/html&gt;
24
- </textarea></form>
25
- <script>
26
- var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
27
- mode: {name: "xml", alignCDATA: true},
28
- lineNumbers: true
29
- });
30
- </script>
31
- <p>The XML mode supports two configuration parameters:</p>
32
- <dl>
33
- <dt><code>htmlMode (boolean)</code></dt>
34
- <dd>This switches the mode to parse HTML instead of XML. This
35
- means attributes do not have to be quoted, and some elements
36
- (such as <code>br</code>) do not require a closing tag.</dd>
37
- <dt><code>alignCDATA (boolean)</code></dt>
38
- <dd>Setting this to true will force the opening tag of CDATA
39
- blocks to not be indented.</dd>
40
- </dl>
41
-
42
- <p><strong>MIME types defined:</strong> <code>application/xml</code>, <code>text/html</code>.</p>
43
- </body>
44
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
libraries/less/LICENSE DELETED
@@ -1,179 +0,0 @@
1
-
2
- Apache License
3
- Version 2.0, January 2004
4
- http://www.apache.org/licenses/
5
-
6
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
-
8
- 1. Definitions.
9
-
10
- "License" shall mean the terms and conditions for use, reproduction,
11
- and distribution as defined by Sections 1 through 9 of this document.
12
-
13
- "Licensor" shall mean the copyright owner or entity authorized by
14
- the copyright owner that is granting the License.
15
-
16
- "Legal Entity" shall mean the union of the acting entity and all
17
- other entities that control, are controlled by, or are under common
18
- control with that entity. For the purposes of this definition,
19
- "control" means (i) the power, direct or indirect, to cause the
20
- direction or management of such entity, whether by contract or
21
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
- outstanding shares, or (iii) beneficial ownership of such entity.
23
-
24
- "You" (or "Your") shall mean an individual or Legal Entity
25
- exercising permissions granted by this License.
26
-
27
- "Source" form shall mean the preferred form for making modifications,
28
- including but not limited to software source code, documentation
29
- source, and configuration files.
30
-
31
- "Object" form shall mean any form resulting from mechanical
32
- transformation or translation of a Source form, including but
33
- not limited to compiled object code, generated documentation,
34
- and conversions to other media types.
35
-
36
- "Work" shall mean the work of authorship, whether in Source or
37
- Object form, made available under the License, as indicated by a
38
- copyright notice that is included in or attached to the work
39
- (an example is provided in the Appendix below).
40
-
41
- "Derivative Works" shall mean any work, whether in Source or Object
42
- form, that is based on (or derived from) the Work and for which the
43
- editorial revisions, annotations, elaborations, or other modifications
44
- represent, as a whole, an original work of authorship. For the purposes
45
- of this License, Derivative Works shall not include works that remain
46
- separable from, or merely link (or bind by name) to the interfaces of,
47
- the Work and Derivative Works thereof.
48
-
49
- "Contribution" shall mean any work of authorship, including
50
- the original version of the Work and any modifications or additions
51
- to that Work or Derivative Works thereof, that is intentionally
52
- submitted to Licensor for inclusion in the Work by the copyright owner
53
- or by an individual or Legal Entity authorized to submit on behalf of
54
- the copyright owner. For the purposes of this definition, "submitted"
55
- means any form of electronic, verbal, or written communication sent
56
- to the Licensor or its representatives, including but not limited to
57
- communication on electronic mailing lists, source code control systems,
58
- and issue tracking systems that are managed by, or on behalf of, the
59
- Licensor for the purpose of discussing and improving the Work, but
60
- excluding communication that is conspicuously marked or otherwise
61
- designated in writing by the copyright owner as "Not a Contribution."
62
-
63
- "Contributor" shall mean Licensor and any individual or Legal Entity
64
- on behalf of whom a Contribution has been received by Licensor and
65
- subsequently incorporated within the Work.
66
-
67
- 2. Grant of Copyright License. Subject to the terms and conditions of
68
- this License, each Contributor hereby grants to You a perpetual,
69
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
- copyright license to reproduce, prepare Derivative Works of,
71
- publicly display, publicly perform, sublicense, and distribute the
72
- Work and such Derivative Works in Source or Object form.
73
-
74
- 3. Grant of Patent License. Subject to the terms and conditions of
75
- this License, each Contributor hereby grants to You a perpetual,
76
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
- (except as stated in this section) patent license to make, have made,
78
- use, offer to sell, sell, import, and otherwise transfer the Work,
79
- where such license applies only to those patent claims licensable
80
- by such Contributor that are necessarily infringed by their
81
- Contribution(s) alone or by combination of their Contribution(s)
82
- with the Work to which such Contribution(s) was submitted. If You
83
- institute patent litigation against any entity (including a
84
- cross-claim or counterclaim in a lawsuit) alleging that the Work
85
- or a Contribution incorporated within the Work constitutes direct
86
- or contributory patent infringement, then any patent licenses
87
- granted to You under this License for that Work shall terminate
88
- as of the date such litigation is filed.
89
-
90
- 4. Redistribution. You may reproduce and distribute copies of the
91
- Work or Derivative Works thereof in any medium, with or without
92
- modifications, and in Source or Object form, provided that You
93
- meet the following conditions:
94
-
95
- (a) You must give any other recipients of the Work or
96
- Derivative Works a copy of this License; and
97
-
98
- (b) You must cause any modified files to carry prominent notices
99
- stating that You changed the files; and
100
-
101
- (c) You must retain, in the Source form of any Derivative Works
102
- that You distribute, all copyright, patent, trademark, and
103
- attribution notices from the Source form of the Work,
104
- excluding those notices that do not pertain to any part of
105
- the Derivative Works; and
106
-
107
- (d) If the Work includes a "NOTICE" text file as part of its
108
- distribution, then any Derivative Works that You distribute must
109
- include a readable copy of the attribution notices contained
110
- within such NOTICE file, excluding those notices that do not
111
- pertain to any part of the Derivative Works, in at least one
112
- of the following places: within a NOTICE text file distributed
113
- as part of the Derivative Works; within the Source form or
114
- documentation, if provided along with the Derivative Works; or,
115
- within a display generated by the Derivative Works, if and
116
- wherever such third-party notices normally appear. The contents
117
- of the NOTICE file are for informational purposes only and
118
- do not modify the License. You may add Your own attribution
119
- notices within Derivative Works that You distribute, alongside
120
- or as an addendum to the NOTICE text from the Work, provided
121
- that such additional attribution notices cannot be construed
122
- as modifying the License.
123
-
124
- You may add Your own copyright statement to Your modifications and
125
- may provide additional or different license terms and conditions
126
- for use, reproduction, or distribution of Your modifications, or
127
- for any such Derivative Works as a whole, provided Your use,
128
- reproduction, and distribution of the Work otherwise complies with
129
- the conditions stated in this License.
130
-
131
- 5. Submission of Contributions. Unless You explicitly state otherwise,
132
- any Contribution intentionally submitted for inclusion in the Work
133
- by You to the Licensor shall be under the terms and conditions of
134
- this License, without any additional terms or conditions.
135
- Notwithstanding the above, nothing herein shall supersede or modify
136
- the terms of any separate license agreement you may have executed
137
- with Licensor regarding such Contributions.
138
-
139
- 6. Trademarks. This License does not grant permission to use the trade
140
- names, trademarks, service marks, or product names of the Licensor,
141
- except as required for reasonable and customary use in describing the
142
- origin of the Work and reproducing the content of the NOTICE file.
143
-
144
- 7. Disclaimer of Warranty. Unless required by applicable law or
145
- agreed to in writing, Licensor provides the Work (and each
146
- Contributor provides its Contributions) on an "AS IS" BASIS,
147
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
- implied, including, without limitation, any warranties or conditions
149
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
- PARTICULAR PURPOSE. You are solely responsible for determining the
151
- appropriateness of using or redistributing the Work and assume any
152
- risks associated with Your exercise of permissions under this License.
153
-
154
- 8. Limitation of Liability. In no event and under no legal theory,
155
- whether in tort (including negligence), contract, or otherwise,
156
- unless required by applicable law (such as deliberate and grossly
157
- negligent acts) or agreed to in writing, shall any Contributor be
158
- liable to You for damages, including any direct, indirect, special,
159
- incidental, or consequential damages of any character arising as a
160
- result of this License or out of the use or inability to use the
161
- Work (including but not limited to damages for loss of goodwill,
162
- work stoppage, computer failure or malfunction, or any and all
163
- other commercial damages or losses), even if such Contributor
164
- has been advised of the possibility of such damages.
165
-
166
- 9. Accepting Warranty or Additional Liability. While redistributing
167
- the Work or Derivative Works thereof, You may choose to offer,
168
- and charge a fee for, acceptance of support, warranty, indemnity,
169
- or other liability obligations and/or rights consistent with this
170
- License. However, in accepting such obligations, You may act only
171
- on Your own behalf and on Your sole responsibility, not on behalf
172
- of any other Contributor, and only if You agree to indemnify,
173
- defend, and hold each Contributor harmless for any liability
174
- incurred by, or claims asserted against, such Contributor by reason
175
- of your accepting any such warranty or additional liability.
176
-
177
- END OF TERMS AND CONDITIONS
178
-
179
- Copyright (c) 2009-2010 Alexis Sellier
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
libraries/less/dist/less-1.3.0.js DELETED
@@ -1,3478 +0,0 @@
1
- //
2
- // LESS - Leaner CSS v1.3.0
3
- // http://lesscss.org
4
- //
5
- // Copyright (c) 2009-2011, Alexis Sellier
6
- // Licensed under the Apache 2.0 License.
7
- //
8
- (function (window, undefined) {
9
- //
10
- // Stub out `require` in the browser
11
- //
12
- function require(arg) {
13
- return window.less[arg.split('/')[1]];
14
- };
15
-
16
- // amd.js
17
- //
18
- // Define Less as an AMD module.
19
- if (typeof define === "function" && define.amd) {
20
- define("less", [], function () { return less; } );
21
- }
22
-
23
- // ecma-5.js
24
- //
25
- // -- kriskowal Kris Kowal Copyright (C) 2009-2010 MIT License
26
- // -- tlrobinson Tom Robinson
27
- // dantman Daniel Friesen
28
-
29
- //
30
- // Array
31
- //
32
- if (!Array.isArray) {
33
- Array.isArray = function(obj) {
34
- return Object.prototype.toString.call(obj) === "[object Array]" ||
35
- (obj instanceof Array);
36
- };
37
- }
38
- if (!Array.prototype.forEach) {
39
- Array.prototype.forEach = function(block, thisObject) {
40
- var len = this.length >>> 0;
41
- for (var i = 0; i < len; i++) {
42
- if (i in this) {
43
- block.call(thisObject, this[i], i, this);
44
- }
45
- }
46
- };
47
- }
48
- if (!Array.prototype.map) {
49
- Array.prototype.map = function(fun /*, thisp*/) {
50
- var len = this.length >>> 0;
51
- var res = new Array(len);
52
- var thisp = arguments[1];
53
-
54
- for (var i = 0; i < len; i++) {
55
- if (i in this) {
56
- res[i] = fun.call(thisp, this[i], i, this);
57
- }
58
- }
59
- return res;
60
- };
61
- }
62
- if (!Array.prototype.filter) {
63
- Array.prototype.filter = function (block /*, thisp */) {
64
- var values = [];
65
- var thisp = arguments[1];
66
- for (var i = 0; i < this.length; i++) {
67
- if (block.call(thisp, this[i])) {
68
- values.push(this[i]);
69
- }
70
- }
71
- return values;
72
- };
73
- }
74
- if (!Array.prototype.reduce) {
75
- Array.prototype.reduce = function(fun /*, initial*/) {
76
- var len = this.length >>> 0;
77
- var i = 0;
78
-
79
- // no value to return if no initial value and an empty array
80
- if (len === 0 && arguments.length === 1) throw new TypeError();
81
-
82
- if (arguments.length >= 2) {
83
- var rv = arguments[1];
84
- } else {
85
- do {
86
- if (i in this) {
87
- rv = this[i++];
88
- break;
89
- }
90
- // if array contains no values, no initial value to return
91
- if (++i >= len) throw new TypeError();
92
- } while (true);
93
- }
94
- for (; i < len; i++) {
95
- if (i in this) {
96
- rv = fun.call(null, rv, this[i], i, this);
97
- }
98
- }
99
- return rv;
100
- };
101
- }
102
- if (!Array.prototype.indexOf) {
103
- Array.prototype.indexOf = function (value /*, fromIndex */ ) {
104
- var length = this.length;
105
- var i = arguments[1] || 0;
106
-
107
- if (!length) return -1;
108
- if (i >= length) return -1;
109
- if (i < 0) i += length;
110
-
111
- for (; i < length; i++) {
112
- if (!Object.prototype.hasOwnProperty.call(this, i)) { continue }
113
- if (value === this[i]) return i;
114
- }
115
- return -1;
116
- };
117
- }
118
-
119
- //
120
- // Object
121
- //
122
- if (!Object.keys) {
123
- Object.keys = function (object) {
124
- var keys = [];
125
- for (var name in object) {
126
- if (Object.prototype.hasOwnProperty.call(object, name)) {
127
- keys.push(name);
128
- }
129
- }
130
- return keys;
131
- };
132
- }
133
-
134
- //
135
- // String
136
- //
137
- if (!String.prototype.trim) {
138
- String.prototype.trim = function () {
139
- return String(this).replace(/^\s\s*/, '').replace(/\s\s*$/, '');
140
- };
141
- }
142
- var less, tree;
143
-
144
- if (typeof environment === "object" && ({}).toString.call(environment) === "[object Environment]") {
145
- // Rhino
146
- // Details on how to detect Rhino: https://github.com/ringo/ringojs/issues/88
147
- if (typeof(window) === 'undefined') { less = {} }
148
- else { less = window.less = {} }
149
- tree = less.tree = {};
150
- less.mode = 'rhino';
151
- } else if (typeof(window) === 'undefined') {
152
- // Node.js
153
- less = exports,
154
- tree = require('./tree');
155
- less.mode = 'node';
156
- } else {
157
- // Browser
158
- if (typeof(window.less) === 'undefined') { window.less = {} }
159
- less = window.less,
160
- tree = window.less.tree = {};
161
- less.mode = 'browser';
162
- }
163
- //
164
- // less.js - parser
165
- //
166
- // A relatively straight-forward predictive parser.
167
- // There is no tokenization/lexing stage, the input is parsed
168
- // in one sweep.
169
- //
170
- // To make the parser fast enough to run in the browser, several
171
- // optimization had to be made:
172
- //
173
- // - Matching and slicing on a huge input is often cause of slowdowns.
174
- // The solution is to chunkify the input into smaller strings.
175
- // The chunks are stored in the `chunks` var,
176
- // `j` holds the current chunk index, and `current` holds
177
- // the index of the current chunk in relation to `input`.
178
- // This gives us an almost 4x speed-up.
179
- //
180
- // - In many cases, we don't need to match individual tokens;
181
- // for example, if a value doesn't hold any variables, operations
182
- // or dynamic references, the parser can effectively 'skip' it,
183
- // treating it as a literal.
184
- // An example would be '1px solid #000' - which evaluates to itself,
185
- // we don't need to know what the individual components are.
186
- // The drawback, of course is that you don't get the benefits of
187
- // syntax-checking on the CSS. This gives us a 50% speed-up in the parser,
188
- // and a smaller speed-up in the code-gen.
189
- //
190
- //
191
- // Token matching is done with the `$` function, which either takes
192
- // a terminal string or regexp, or a non-terminal function to call.
193
- // It also takes care of moving all the indices forwards.
194
- //
195
- //
196
- less.Parser = function Parser(env) {
197
- var input, // LeSS input string
198
- i, // current index in `input`
199
- j, // current chunk
200
- temp, // temporarily holds a chunk's state, for backtracking
201
- memo, // temporarily holds `i`, when backtracking
202
- furthest, // furthest index the parser has gone to
203
- chunks, // chunkified input
204
- current, // index of current chunk, in `input`
205
- parser;
206
-
207
- var that = this;
208
-
209
- // This function is called after all files
210
- // have been imported through `@import`.
211
- var finish = function () {};
212
-
213
- var imports = this.imports = {
214
- paths: env && env.paths || [], // Search paths, when importing
215
- queue: [], // Files which haven't been imported yet
216
- files: {}, // Holds the imported parse trees
217
- contents: {}, // Holds the imported file contents
218
- mime: env && env.mime, // MIME type of .less files
219
- error: null, // Error in parsing/evaluating an import
220
- push: function (path, callback) {
221
- var that = this;
222
- this.queue.push(path);
223
-
224
- //
225
- // Import a file asynchronously
226
- //
227
- less.Parser.importer(path, this.paths, function (e, root, contents) {
228
- that.queue.splice(that.queue.indexOf(path), 1); // Remove the path from the queue
229
- that.files[path] = root; // Store the root
230
- that.contents[path] = contents;
231
-
232
- if (e && !that.error) { that.error = e }
233
- callback(e, root);
234
-
235
- if (that.queue.length === 0) { finish() } // Call `finish` if we're done importing
236
- }, env);
237
- }
238
- };
239
-
240
- function save() { temp = chunks[j], memo = i, current = i }
241
- function restore() { chunks[j] = temp, i = memo, current = i }
242
-
243
- function sync() {
244
- if (i > current) {
245
- chunks[j] = chunks[j].slice(i - current);
246
- current = i;
247
- }
248
- }
249
- //
250
- // Parse from a token, regexp or string, and move forward if match
251
- //
252
- function $(tok) {
253
- var match, args, length, c, index, endIndex, k, mem;
254
-
255
- //
256
- // Non-terminal
257
- //
258
- if (tok instanceof Function) {
259
- return tok.call(parser.parsers);
260
- //
261
- // Terminal
262
- //
263
- // Either match a single character in the input,
264
- // or match a regexp in the current chunk (chunk[j]).
265
- //
266
- } else if (typeof(tok) === 'string') {
267
- match = input.charAt(i) === tok ? tok : null;
268
- length = 1;
269
- sync ();
270
- } else {
271
- sync ();
272
-
273
- if (match = tok.exec(chunks[j])) {
274
- length = match[0].length;
275
- } else {
276
- return null;
277
- }
278
- }
279
-
280
- // The match is confirmed, add the match length to `i`,
281
- // and consume any extra white-space characters (' ' || '\n')
282
- // which come after that. The reason for this is that LeSS's
283
- // grammar is mostly white-space insensitive.
284
- //
285
- if (match) {
286
- mem = i += length;
287
- endIndex = i + chunks[j].length - length;
288
-
289
- while (i < endIndex) {
290
- c = input.charCodeAt(i);
291
- if (! (c === 32 || c === 10 || c === 9)) { break }
292
- i++;
293
- }
294
- chunks[j] = chunks[j].slice(length + (i - mem));
295
- current = i;
296
-
297
- if (chunks[j].length === 0 && j < chunks.length - 1) { j++ }
298
-
299
- if(typeof(match) === 'string') {
300
- return match;
301
- } else {
302
- return match.length === 1 ? match[0] : match;
303
- }
304
- }
305
- }
306
-
307
- function expect(arg, msg) {
308
- var result = $(arg);
309
- if (! result) {
310
- error(msg || (typeof(arg) === 'string' ? "expected '" + arg + "' got '" + input.charAt(i) + "'"
311
- : "unexpected token"));
312
- } else {
313
- return result;
314
- }
315
- }
316
-
317
- function error(msg, type) {
318
- throw { index: i, type: type || 'Syntax', message: msg };
319
- }
320
-
321
- // Same as $(), but don't change the state of the parser,
322
- // just return the match.
323
- function peek(tok) {
324
- if (typeof(tok) === 'string') {
325
- return input.charAt(i) === tok;
326
- } else {
327
- if (tok.test(chunks[j])) {
328
- return true;
329
- } else {
330
- return false;
331
- }
332
- }
333
- }
334
-
335
- function basename(pathname) {
336
- if (less.mode === 'node') {
337
- return require('path').basename(pathname);
338
- } else {
339
- return pathname.match(/[^\/]+$/)[0];
340
- }
341
- }
342
-
343
- function getInput(e, env) {
344
- if (e.filename && env.filename && (e.filename !== env.filename)) {
345
- return parser.imports.contents[basename(e.filename)];
346
- } else {
347
- return input;
348
- }
349
- }
350
-
351
- function getLocation(index, input) {
352
- for (var n = index, column = -1;
353
- n >= 0 && input.charAt(n) !== '\n';
354
- n--) { column++ }
355
-
356
- return { line: typeof(index) === 'number' ? (input.slice(0, index).match(/\n/g) || "").length : null,
357
- column: column };
358
- }
359
-
360
- function LessError(e, env) {
361
- var input = getInput(e, env),
362
- loc = getLocation(e.index, input),
363
- line = loc.line,
364
- col = loc.column,
365
- lines = input.split('\n');
366
-
367
- this.type = e.type || 'Syntax';
368
- this.message = e.message;
369
- this.filename = e.filename || env.filename;
370
- this.index = e.index;
371
- this.line = typeof(line) === 'number' ? line + 1 : null;
372
- this.callLine = e.call && (getLocation(e.call, input).line + 1);
373
- this.callExtract = lines[getLocation(e.call, input).line];
374
- this.stack = e.stack;
375
- this.column = col;
376
- this.extract = [
377
- lines[line - 1],
378
- lines[line],
379
- lines[line + 1]
380
- ];
381
- }
382
-
383
- this.env = env = env || {};
384
-
385
- // The optimization level dictates the thoroughness of the parser,
386
- // the lower the number, the less nodes it will create in the tree.
387
- // This could matter for debugging, or if you want to access
388
- // the individual nodes in the tree.
389
- this.optimization = ('optimization' in this.env) ? this.env.optimization : 1;
390
-
391
- this.env.filename = this.env.filename || null;
392
-
393
- //
394
- // The Parser
395
- //
396
- return parser = {
397
-
398
- imports: imports,
399
- //
400
- // Parse an input string into an abstract syntax tree,
401
- // call `callback` when done.
402
- //
403
- parse: function (str, callback) {
404
- var root, start, end, zone, line, lines, buff = [], c, error = null;
405
-
406
- i = j = current = furthest = 0;
407
- input = str.replace(/\r\n/g, '\n');
408
-
409
- // Split the input into chunks.
410
- chunks = (function (chunks) {
411
- var j = 0,
412
- skip = /[^"'`\{\}\/\(\)\\]+/g,
413
- comment = /\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,
414
- string = /"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`\\\r\n]|\\.)*)`/g,
415
- level = 0,
416
- match,
417
- chunk = chunks[0],
418
- inParam;
419
-
420
- for (var i = 0, c, cc; i < input.length; i++) {
421
- skip.lastIndex = i;
422
- if (match = skip.exec(input)) {
423
- if (match.index === i) {
424
- i += match[0].length;
425
- chunk.push(match[0]);
426
- }
427
- }
428
- c = input.charAt(i);
429
- comment.lastIndex = string.lastIndex = i;
430
-
431
- if (match = string.exec(input)) {
432
- if (match.index === i) {
433
- i += match[0].length;
434
- chunk.push(match[0]);
435
- c = input.charAt(i);
436
- }
437
- }
438
-
439
- if (!inParam && c === '/') {
440
- cc = input.charAt(i + 1);
441
- if (cc === '/' || cc === '*') {
442
- if (match = comment.exec(input)) {
443
- if (match.index === i) {
444
- i += match[0].length;
445
- chunk.push(match[0]);
446
- c = input.charAt(i);
447
- }
448
- }
449
- }
450
- }
451
-
452
- switch (c) {
453
- case '{': if (! inParam) { level ++; chunk.push(c); break }
454
- case '}': if (! inParam) { level --; chunk.push(c); chunks[++j] = chunk = []; break }
455
- case '(': if (! inParam) { inParam = true; chunk.push(c); break }
456
- case ')': if ( inParam) { inParam = false; chunk.push(c); break }
457
- default: chunk.push(c);
458
- }
459
- }
460
- if (level > 0) {
461
- error = new(LessError)({
462
- index: i,
463
- type: 'Parse',
464
- message: "missing closing `}`",
465
- filename: env.filename
466
- }, env);
467
- }
468
-
469
- return chunks.map(function (c) { return c.join('') });;
470
- })([[]]);
471
-
472
- if (error) {
473
- return callback(error);
474
- }
475
-
476
- // Start with the primary rule.
477
- // The whole syntax tree is held under a Ruleset node,
478
- // with the `root` property set to true, so no `{}` are
479
- // output. The callback is called when the input is parsed.
480
- try {
481
- root = new(tree.Ruleset)([], $(this.parsers.primary));
482
- root.root = true;
483
- } catch (e) {
484
- return callback(new(LessError)(e, env));
485
- }
486
-
487
- root.toCSS = (function (evaluate) {
488
- var line, lines, column;
489
-
490
- return function (options, variables) {
491
- var frames = [], importError;
492
-
493
- options = options || {};
494
- //
495
- // Allows setting variables with a hash, so:
496
- //
497
- // `{ color: new(tree.Color)('#f01') }` will become:
498
- //
499
- // new(tree.Rule)('@color',
500
- // new(tree.Value)([
501
- // new(tree.Expression)([
502
- // new(tree.Color)('#f01')
503
- // ])
504
- // ])
505
- // )
506
- //
507
- if (typeof(variables) === 'object' && !Array.isArray(variables)) {
508
- variables = Object.keys(variables).map(function (k) {
509
- var value = variables[k];
510
-
511
- if (! (value instanceof tree.Value)) {
512
- if (! (value instanceof tree.Expression)) {
513
- value = new(tree.Expression)([value]);
514
- }
515
- value = new(tree.Value)([value]);
516
- }
517
- return new(tree.Rule)('@' + k, value, false, 0);
518
- });
519
- frames = [new(tree.Ruleset)(null, variables)];
520
- }
521
-
522
- try {
523
- var css = evaluate.call(this, { frames: frames })
524
- .toCSS([], { compress: options.compress || false });
525
- } catch (e) {
526
- throw new(LessError)(e, env);
527
- }
528
-
529
- if ((importError = parser.imports.error)) { // Check if there was an error during importing
530
- if (importError instanceof LessError) throw importError;
531
- else throw new(LessError)(importError, env);
532
- }
533
-
534
- if (options.yuicompress && less.mode === 'node') {
535
- return require('./cssmin').compressor.cssmin(css);
536
- } else if (options.compress) {
537
- return css.replace(/(\s)+/g, "$1");
538
- } else {
539
- return css;
540
- }
541
- };
542
- })(root.eval);
543
-
544
- // If `i` is smaller than the `input.length - 1`,
545
- // it means the parser wasn't able to parse the whole
546
- // string, so we've got a parsing error.
547
- //
548
- // We try to extract a \n delimited string,
549
- // showing the line where the parse error occured.
550
- // We split it up into two parts (the part which parsed,
551
- // and the part which didn't), so we can color them differently.
552
- if (i < input.length - 1) {
553
- i = furthest;
554
- lines = input.split('\n');
555
- line = (input.slice(0, i).match(/\n/g) || "").length + 1;
556
-
557
- for (var n = i, column = -1; n >= 0 && input.charAt(n) !== '\n'; n--) { column++ }
558
-
559
- error = {
560
- type: "Parse",
561
- message: "Syntax Error on line " + line,
562
- index: i,
563
- filename: env.filename,
564
- line: line,
565
- column: column,
566
- extract: [
567
- lines[line - 2],
568
- lines[line - 1],
569
- lines[line]
570
- ]
571
- };
572
- }
573
-
574
- if (this.imports.queue.length > 0) {
575
- finish = function () { callback(error, root) };
576
- } else {
577
- callback(error, root);
578
- }
579
- },
580
-
581
- //
582
- // Here in, the parsing rules/functions
583
- //
584
- // The basic structure of the syntax tree generated is as follows:
585
- //
586
- // Ruleset -> Rule -> Value -> Expression -> Entity
587
- //
588
- // Here's some LESS code:
589
- //
590
- // .class {
591
- // color: #fff;
592
- // border: 1px solid #000;
593
- // width: @w + 4px;
594
- // > .child {...}
595
- // }
596
- //
597
- // And here's what the parse tree might look like:
598
- //
599
- // Ruleset (Selector '.class', [
600
- // Rule ("color", Value ([Expression [Color #fff]]))
601
- // Rule ("border", Value ([Expression [Dimension 1px][Keyword "solid"][Color #000]]))
602
- // Rule ("width", Value ([Expression [Operation "+" [Variable "@w"][Dimension 4px]]]))
603
- // Ruleset (Selector [Element '>', '.child'], [...])
604
- // ])
605
- //
606
- // In general, most rules will try to parse a token with the `$()` function, and if the return
607
- // value is truly, will return a new node, of the relevant type. Sometimes, we need to check
608
- // first, before parsing, that's when we use `peek()`.
609
- //
610
- parsers: {
611
- //
612
- // The `primary` rule is the *entry* and *exit* point of the parser.
613
- // The rules here can appear at any level of the parse tree.
614
- //
615
- // The recursive nature of the grammar is an interplay between the `block`
616
- // rule, which represents `{ ... }`, the `ruleset` rule, and this `primary` rule,
617
- // as represented by this simplified grammar:
618
- //
619
- // primary → (ruleset | rule)+
620
- // ruleset → selector+ block
621
- // block → '{' primary '}'
622
- //
623
- // Only at one point is the primary rule not called from the
624
- // block rule: at the root level.
625
- //
626
- primary: function () {
627
- var node, root = [];
628
-
629
- while ((node = $(this.mixin.definition) || $(this.rule) || $(this.ruleset) ||
630
- $(this.mixin.call) || $(this.comment) || $(this.directive))
631
- || $(/^[\s\n]+/)) {
632
- node && root.push(node);
633
- }
634
- return root;
635
- },
636
-
637
- // We create a Comment node for CSS comments `/* */`,
638
- // but keep the LeSS comments `//` silent, by just skipping
639
- // over them.
640
- comment: function () {
641
- var comment;
642
-
643
- if (input.charAt(i) !== '/') return;
644
-
645
- if (input.charAt(i + 1) === '/') {
646
- return new(tree.Comment)($(/^\/\/.*/), true);
647
- } else if (comment = $(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/)) {
648
- return new(tree.Comment)(comment);
649
- }
650
- },
651
-
652
- //
653
- // Entities are tokens which can be found inside an Expression
654
- //
655
- entities: {
656
- //
657
- // A string, which supports escaping " and '
658
- //
659
- // "milky way" 'he\'s the one!'
660
- //
661
- quoted: function () {
662
- var str, j = i, e;
663
-
664
- if (input.charAt(j) === '~') { j++, e = true } // Escaped strings
665
- if (input.charAt(j) !== '"' && input.charAt(j) !== "'") return;
666
-
667
- e && $('~');
668
-
669
- if (str = $(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/)) {
670
- return new(tree.Quoted)(str[0], str[1] || str[2], e);
671
- }
672
- },
673
-
674
- //
675
- // A catch-all word, such as:
676
- //
677
- // black border-collapse
678
- //
679
- keyword: function () {
680
- var k;
681
-
682
- if (k = $(/^[_A-Za-z-][_A-Za-z0-9-]*/)) {
683
- if (tree.colors.hasOwnProperty(k)) {
684
- // detect named color
685
- return new(tree.Color)(tree.colors[k].slice(1));
686
- } else {
687
- return new(tree.Keyword)(k);
688
- }
689
- }
690
- },
691
-
692
- //
693
- // A function call
694
- //
695
- // rgb(255, 0, 255)
696
- //
697
- // We also try to catch IE's `alpha()`, but let the `alpha` parser
698
- // deal with the details.
699
- //
700
- // The arguments are parsed with the `entities.arguments` parser.
701
- //
702
- call: function () {
703
- var name, args, index = i;
704
-
705
- if (! (name = /^([\w-]+|%|progid:[\w\.]+)\(/.exec(chunks[j]))) return;
706
-
707
- name = name[1].toLowerCase();
708
-
709
- if (name === 'url') { return null }
710
- else { i += name.length }
711
-
712
- if (name === 'alpha') { return $(this.alpha) }
713
-
714
- $('('); // Parse the '(' and consume whitespace.
715
-
716
- args = $(this.entities.arguments);
717
-
718
- if (! $(')')) return;
719
-
720
- if (name) { return new(tree.Call)(name, args, index, env.filename) }
721
- },
722
- arguments: function () {
723
- var args = [], arg;
724
-
725
- while (arg = $(this.entities.assignment) || $(this.expression)) {
726
- args.push(arg);
727
- if (! $(',')) { break }
728
- }
729
- return args;
730
- },
731
- literal: function () {
732
- return $(this.entities.dimension) ||
733
- $(this.entities.color) ||
734
- $(this.entities.quoted);
735
- },
736
-
737
- // Assignments are argument entities for calls.
738
- // They are present in ie filter properties as shown below.
739
- //
740
- // filter: progid:DXImageTransform.Microsoft.Alpha( *opacity=50* )
741
- //
742
-
743
- assignment: function () {
744
- var key, value;
745
- if ((key = $(/^\w+(?=\s?=)/i)) && $('=') && (value = $(this.entity))) {
746
- return new(tree.Assignment)(key, value);
747
- }
748
- },
749
-
750
- //
751
- // Parse url() tokens
752
- //
753
- // We use a specific rule for urls, because they don't really behave like
754
- // standard function calls. The difference is that the argument doesn't have
755
- // to be enclosed within a string, so it can't be parsed as an Expression.
756
- //
757
- url: function () {
758
- var value;
759
-
760
- if (input.charAt(i) !== 'u' || !$(/^url\(/)) return;
761
- value = $(this.entities.quoted) || $(this.entities.variable) ||
762
- $(this.entities.dataURI) || $(/^[-\w%@$\/.&=:;#+?~]+/) || "";
763
-
764
- expect(')');
765
-
766
- return new(tree.URL)((value.value || value.data || value instanceof tree.Variable)
767
- ? value : new(tree.Anonymous)(value), imports.paths);
768
- },
769
-
770
- dataURI: function () {
771
- var obj;
772
-
773
- if ($(/^data:/)) {
774
- obj = {};
775
- obj.mime = $(/^[^\/]+\/[^,;)]+/) || '';
776
- obj.charset = $(/^;\s*charset=[^,;)]+/) || '';
777
- obj.base64 = $(/^;\s*base64/) || '';
778
- obj.data = $(/^,\s*[^)]+/);
779
-
780
- if (obj.data) { return obj }
781
- }
782
- },
783
-
784
- //
785
- // A Variable entity, such as `@fink`, in
786
- //
787
- // width: @fink + 2px
788
- //
789
- // We use a different parser for variable definitions,
790
- // see `parsers.variable`.
791
- //
792
- variable: function () {
793
- var name, index = i;
794
-
795
- if (input.charAt(i) === '@' && (name = $(/^@@?[\w-]+/))) {
796
- return new(tree.Variable)(name, index, env.filename);
797
- }
798
- },
799
-
800
- //
801
- // A Hexadecimal color
802
- //
803
- // #4F3C2F
804
- //
805
- // `rgb` and `hsl` colors are parsed through the `entities.call` parser.
806
- //
807
- color: function () {
808
- var rgb;
809
-
810
- if (input.charAt(i) === '#' && (rgb = $(/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})/))) {
811
- return new(tree.Color)(rgb[1]);
812
- }
813
- },
814
-
815
- //
816
- // A Dimension, that is, a number and a unit
817
- //
818
- // 0.5em 95%
819
- //
820
- dimension: function () {
821
- var value, c = input.charCodeAt(i);
822
- if ((c > 57 || c < 45) || c === 47) return;
823
-
824
- if (value = $(/^(-?\d*\.?\d+)(px|%|em|rem|pc|ex|in|deg|s|ms|pt|cm|mm|rad|grad|turn)?/)) {
825
- return new(tree.Dimension)(value[1], value[2]);
826
- }
827
- },
828
-
829
- //
830
- // JavaScript code to be evaluated
831
- //
832
- // `window.location.href`
833
- //
834
- javascript: function () {
835
- var str, j = i, e;
836
-
837
- if (input.charAt(j) === '~') { j++, e = true } // Escaped strings
838
- if (input.charAt(j) !== '`') { return }
839
-
840
- e && $('~');
841
-
842
- if (str = $(/^`([^`]*)`/)) {
843
- return new(tree.JavaScript)(str[1], i, e);
844
- }
845
- }
846
- },
847
-
848
- //
849
- // The variable part of a variable definition. Used in the `rule` parser
850
- //
851
- // @fink:
852
- //
853
- variable: function () {
854
- var name;
855
-
856
- if (input.charAt(i) === '@' && (name = $(/^(@[\w-]+)\s*:/))) { return name[1] }
857
- },
858
-
859
- //
860
- // A font size/line-height shorthand
861
- //
862
- // small/12px
863
- //
864
- // We need to peek first, or we'll match on keywords and dimensions
865
- //
866
- shorthand: function () {
867
- var a, b;
868
-
869
- if (! peek(/^[@\w.%-]+\/[@\w.-]+/)) return;
870
-
871
- if ((a = $(this.entity)) && $('/') && (b = $(this.entity))) {
872
- return new(tree.Shorthand)(a, b);
873
- }
874
- },
875
-
876
- //
877
- // Mixins
878
- //
879
- mixin: {
880
- //
881
- // A Mixin call, with an optional argument list
882
- //
883
- // #mixins > .square(#fff);
884
- // .rounded(4px, black);
885
- // .button;
886
- //
887
- // The `while` loop is there because mixins can be
888
- // namespaced, but we only support the child and descendant
889
- // selector for now.
890
- //
891
- call: function () {
892
- var elements = [], e, c, args, index = i, s = input.charAt(i), important = false;
893
-
894
- if (s !== '.' && s !== '#') { return }
895
-
896
- while (e = $(/^[#.](?:[\w-]|\\(?:[a-fA-F0-9]{1,6} ?|[^a-fA-F0-9]))+/)) {
897
- elements.push(new(tree.Element)(c, e, i));
898
- c = $('>');
899
- }
900
- $('(') && (args = $(this.entities.arguments)) && $(')');
901
-
902
- if ($(this.important)) {
903
- important = true;
904
- }
905
-
906
- if (elements.length > 0 && ($(';') || peek('}'))) {
907
- return new(tree.mixin.Call)(elements, args || [], index, env.filename, important);
908
- }
909
- },
910
-
911
- //
912
- // A Mixin definition, with a list of parameters
913
- //
914
- // .rounded (@radius: 2px, @color) {
915
- // ...
916
- // }
917
- //
918
- // Until we have a finer grained state-machine, we have to
919
- // do a look-ahead, to make sure we don't have a mixin call.
920
- // See the `rule` function for more information.
921
- //
922
- // We start by matching `.rounded (`, and then proceed on to
923
- // the argument list, which has optional default values.
924
- // We store the parameters in `params`, with a `value` key,
925
- // if there is a value, such as in the case of `@radius`.
926
- //
927
- // Once we've got our params list, and a closing `)`, we parse
928
- // the `{...}` block.
929
- //
930
- definition: function () {
931
- var name, params = [], match, ruleset, param, value, cond, variadic = false;
932
- if ((input.charAt(i) !== '.' && input.charAt(i) !== '#') ||
933
- peek(/^[^{]*(;|})/)) return;
934
-
935
- save();
936
-
937
- if (match = $(/^([#.](?:[\w-]|\\(?:[a-fA-F0-9]{1,6} ?|[^a-fA-F0-9]))+)\s*\(/)) {
938
- name = match[1];
939
-
940
- do {
941
- if (input.charAt(i) === '.' && $(/^\.{3}/)) {
942
- variadic = true;
943
- break;
944
- } else if (param = $(this.entities.variable) || $(this.entities.literal)
945
- || $(this.entities.keyword)) {
946
- // Variable
947
- if (param instanceof tree.Variable) {
948
- if ($(':')) {
949
- value = expect(this.expression, 'expected expression');
950
- params.push({ name: param.name, value: value });
951
- } else if ($(/^\.{3}/)) {
952
- params.push({ name: param.name, variadic: true });
953
- variadic = true;
954
- break;
955
- } else {
956
- params.push({ name: param.name });
957
- }
958
- } else {
959
- params.push({ value: param });
960
- }
961
- } else {
962
- break;
963
- }
964
- } while ($(','))
965
-
966
- expect(')');
967
-
968
- if ($(/^when/)) { // Guard
969
- cond = expect(this.conditions, 'expected condition');
970
- }
971
-
972
- ruleset = $(this.block);
973
-
974
- if (ruleset) {
975
- return new(tree.mixin.Definition)(name, params, ruleset, cond, variadic);
976
- } else {
977
- restore();
978
- }
979
- }
980
- }
981
- },
982
-
983
- //
984
- // Entities are the smallest recognized token,
985
- // and can be found inside a rule's value.
986
- //
987
- entity: function () {
988
- return $(this.entities.literal) || $(this.entities.variable) || $(this.entities.url) ||
989
- $(this.entities.call) || $(this.entities.keyword) || $(this.entities.javascript) ||
990
- $(this.comment);
991
- },
992
-
993
- //
994
- // A Rule terminator. Note that we use `peek()` to check for '}',
995
- // because the `block` rule will be expecting it, but we still need to make sure
996
- // it's there, if ';' was ommitted.
997
- //
998
- end: function () {
999
- return $(';') || peek('}');
1000
- },
1001
-
1002
- //
1003
- // IE's alpha function
1004
- //
1005
- // alpha(opacity=88)
1006
- //
1007
- alpha: function () {
1008
- var value;
1009
-
1010
- if (! $(/^\(opacity=/i)) return;
1011
- if (value = $(/^\d+/) || $(this.entities.variable)) {
1012
- expect(')');
1013
- return new(tree.Alpha)(value);
1014
- }
1015
- },
1016
-
1017
- //
1018
- // A Selector Element
1019
- //
1020
- // div
1021
- // + h1
1022
- // #socks
1023
- // input[type="text"]
1024
- //
1025
- // Elements are the building blocks for Selectors,
1026
- // they are made out of a `Combinator` (see combinator rule),
1027
- // and an element name, such as a tag a class, or `*`.
1028
- //
1029
- element: function () {
1030
- var e, t, c, v;
1031
-
1032
- c = $(this.combinator);
1033
- e = $(/^(?:\d+\.\d+|\d+)%/) || $(/^(?:[.#]?|:*)(?:[\w-]|\\(?:[a-fA-F0-9]{1,6} ?|[^a-fA-F0-9]))+/) ||
1034
- $('*') || $(this.attribute) || $(/^\([^)@]+\)/);
1035
-
1036
- if (! e) {
1037
- $('(') && (v = $(this.entities.variable)) && $(')') && (e = new(tree.Paren)(v));
1038
- }
1039
-
1040
- if (e) { return new(tree.Element)(c, e, i) }
1041
-
1042
- if (c.value && c.value.charAt(0) === '&') {
1043
- return new(tree.Element)(c, null, i);
1044
- }
1045
- },
1046
-
1047
- //
1048
- // Combinators combine elements together, in a Selector.
1049
- //
1050
- // Because our parser isn't white-space sensitive, special care
1051
- // has to be taken, when parsing the descendant combinator, ` `,
1052
- // as it's an empty space. We have to check the previous character
1053
- // in the input, to see if it's a ` ` character. More info on how
1054
- // we deal with this in *combinator.js*.
1055
- //
1056
- combinator: function () {
1057
- var match, c = input.charAt(i);
1058
-
1059
- if (c === '>' || c === '+' || c === '~') {
1060
- i++;
1061
- while (input.charAt(i) === ' ') { i++ }
1062
- return new(tree.Combinator)(c);
1063
- } else if (c === '&') {
1064
- match = '&';
1065
- i++;
1066
- if(input.charAt(i) === ' ') {
1067
- match = '& ';
1068
- }
1069
- while (input.charAt(i) === ' ') { i++ }
1070
- return new(tree.Combinator)(match);
1071
- } else if (input.charAt(i - 1) === ' ') {
1072
- return new(tree.Combinator)(" ");
1073
- } else {
1074
- return new(tree.Combinator)(null);
1075
- }
1076
- },
1077
-
1078
- //
1079
- // A CSS Selector
1080
- //
1081
- // .class > div + h1
1082
- // li a:hover
1083
- //
1084
- // Selectors are made out of one or more Elements, see above.
1085
- //
1086
- selector: function () {
1087
- var sel, e, elements = [], c, match;
1088
-
1089
- if ($('(')) {
1090
- sel = $(this.entity);
1091
- expect(')');
1092
- return new(tree.Selector)([new(tree.Element)('', sel, i)]);
1093
- }
1094
-
1095
- while (e = $(this.element)) {
1096
- c = input.charAt(i);
1097
- elements.push(e)
1098
- if (c === '{' || c === '}' || c === ';' || c === ',') { break }
1099
- }
1100
-
1101
- if (elements.length > 0) { return new(tree.Selector)(elements) }
1102
- },
1103
- tag: function () {
1104
- return $(/^[a-zA-Z][a-zA-Z-]*[0-9]?/) || $('*');
1105
- },
1106
- attribute: function () {
1107
- var attr = '', key, val, op;
1108
-
1109
- if (! $('[')) return;
1110
-
1111
- if (key = $(/^[a-zA-Z-]+/) || $(this.entities.quoted)) {
1112
- if ((op = $(/^[|~*$^]?=/)) &&
1113
- (val = $(this.entities.quoted) || $(/^[\w-]+/))) {
1114
- attr = [key, op, val.toCSS ? val.toCSS() : val].join('');
1115
- } else { attr = key }
1116
- }
1117
-
1118
- if (! $(']')) return;
1119
-
1120
- if (attr) { return "[" + attr + "]" }
1121
- },
1122
-
1123
- //
1124
- // The `block` rule is used by `ruleset` and `mixin.definition`.
1125
- // It's a wrapper around the `primary` rule, with added `{}`.
1126
- //
1127
- block: function () {
1128
- var content;
1129
-
1130
- if ($('{') && (content = $(this.primary)) && $('}')) {
1131
- return content;
1132
- }
1133
- },
1134
-
1135
- //
1136
- // div, .class, body > p {...}
1137
- //
1138
- ruleset: function () {
1139
- var selectors = [], s, rules, match;
1140
- save();
1141
-
1142
- while (s = $(this.selector)) {
1143
- selectors.push(s);
1144
- $(this.comment);
1145
- if (! $(',')) { break }
1146
- $(this.comment);
1147
- }
1148
-
1149
- if (selectors.length > 0 && (rules = $(this.block))) {
1150
- return new(tree.Ruleset)(selectors, rules, env.strictImports);
1151
- } else {
1152
- // Backtrack
1153
- furthest = i;
1154
- restore();
1155
- }
1156
- },
1157
- rule: function () {
1158
- var name, value, c = input.charAt(i), important, match;
1159
- save();
1160
-
1161
- if (c === '.' || c === '#' || c === '&') { return }
1162
-
1163
- if (name = $(this.variable) || $(this.property)) {
1164
- if ((name.charAt(0) != '@') && (match = /^([^@+\/'"*`(;{}-]*);/.exec(chunks[j]))) {
1165
- i += match[0].length - 1;
1166
- value = new(tree.Anonymous)(match[1]);
1167
- } else if (name === "font") {
1168
- value = $(this.font);
1169
- } else {
1170
- value = $(this.value);
1171
- }
1172
- important = $(this.important);
1173
-
1174
- if (value && $(this.end)) {
1175
- return new(tree.Rule)(name, value, important, memo);
1176
- } else {
1177
- furthest = i;
1178
- restore();
1179
- }
1180
- }
1181
- },
1182
-
1183
- //
1184
- // An @import directive
1185
- //
1186
- // @import "lib";
1187
- //
1188
- // Depending on our environemnt, importing is done differently:
1189
- // In the browser, it's an XHR request, in Node, it would be a
1190
- // file-system operation. The function used for importing is
1191
- // stored in `import`, which we pass to the Import constructor.
1192
- //
1193
- "import": function () {
1194
- var path, features, index = i;
1195
- if ($(/^@import\s+/) &&
1196
- (path = $(this.entities.quoted) || $(this.entities.url))) {
1197
- features = $(this.mediaFeatures);
1198
- if ($(';')) {
1199
- return new(tree.Import)(path, imports, features, index);
1200
- }
1201
- }
1202
- },
1203
-
1204
- mediaFeature: function () {
1205
- var e, p, nodes = [];
1206
-
1207
- do {
1208
- if (e = $(this.entities.keyword)) {
1209
- nodes.push(e);
1210
- } else if ($('(')) {
1211
- p = $(this.property);
1212
- e = $(this.entity);
1213
- if ($(')')) {
1214
- if (p && e) {
1215
- nodes.push(new(tree.Paren)(new(tree.Rule)(p, e, null, i, true)));
1216
- } else if (e) {
1217
- nodes.push(new(tree.Paren)(e));
1218
- } else {
1219
- return null;
1220
- }
1221
- } else { return null }
1222
- }
1223
- } while (e);
1224
-
1225
- if (nodes.length > 0) {
1226
- return new(tree.Expression)(nodes);
1227
- }
1228
- },
1229
-
1230
- mediaFeatures: function () {
1231
- var e, features = [];
1232
-
1233
- do {
1234
- if (e = $(this.mediaFeature)) {
1235
- features.push(e);
1236
- if (! $(',')) { break }
1237
- } else if (e = $(this.entities.variable)) {
1238
- features.push(e);
1239
- if (! $(',')) { break }
1240
- }
1241
- } while (e);
1242
-
1243
- return features.length > 0 ? features : null;
1244
- },
1245
-
1246
- media: function () {
1247
- var features, rules;
1248
-
1249
- if ($(/^@media/)) {
1250
- features = $(this.mediaFeatures);
1251
-
1252
- if (rules = $(this.block)) {
1253
- return new(tree.Media)(rules, features);
1254
- }
1255
- }
1256
- },
1257
-
1258
- //
1259
- // A CSS Directive
1260
- //
1261
- // @charset "utf-8";
1262
- //
1263
- directive: function () {
1264
- var name, value, rules, types, e, nodes;
1265
-
1266
- if (input.charAt(i) !== '@') return;
1267
-
1268
- if (value = $(this['import']) || $(this.media)) {
1269
- return value;
1270
- } else if (name = $(/^@page|@keyframes/) || $(/^@(?:-webkit-|-moz-|-o-|-ms-)[a-z0-9-]+/)) {
1271
- types = ($(/^[^{]+/) || '').trim();
1272
- if (rules = $(this.block)) {
1273
- return new(tree.Directive)(name + " " + types, rules);
1274
- }
1275
- } else if (name = $(/^@[-a-z]+/)) {
1276
- if (name === '@font-face') {
1277
- if (rules = $(this.block)) {
1278
- return new(tree.Directive)(name, rules);
1279
- }
1280
- } else if ((value = $(this.entity)) && $(';')) {
1281
- return new(tree.Directive)(name, value);
1282
- }
1283
- }
1284
- },
1285
- font: function () {
1286
- var value = [], expression = [], weight, shorthand, font, e;
1287
-
1288
- while (e = $(this.shorthand) || $(this.entity)) {
1289
- expression.push(e);
1290
- }
1291
- value.push(new(tree.Expression)(expression));
1292
-
1293
- if ($(',')) {
1294
- while (e = $(this.expression)) {
1295
- value.push(e);
1296
- if (! $(',')) { break }
1297
- }
1298
- }
1299
- return new(tree.Value)(value);
1300
- },
1301
-
1302
- //
1303
- // A Value is a comma-delimited list of Expressions
1304
- //
1305
- // font-family: Baskerville, Georgia, serif;
1306
- //
1307
- // In a Rule, a Value represents everything after the `:`,
1308
- // and before the `;`.
1309
- //
1310
- value: function () {
1311
- var e, expressions = [], important;
1312
-
1313
- while (e = $(this.expression)) {
1314
- expressions.push(e);
1315
- if (! $(',')) { break }
1316
- }
1317
-
1318
- if (expressions.length > 0) {
1319
- return new(tree.Value)(expressions);
1320
- }
1321
- },
1322
- important: function () {
1323
- if (input.charAt(i) === '!') {
1324
- return $(/^! *important/);
1325
- }
1326
- },
1327
- sub: function () {
1328
- var e;
1329
-
1330
- if ($('(') && (e = $(this.expression)) && $(')')) {
1331
- return e;
1332
- }
1333
- },
1334
- multiplication: function () {
1335
- var m, a, op, operation;
1336
- if (m = $(this.operand)) {
1337
- while (!peek(/^\/\*/) && (op = ($('/') || $('*'))) && (a = $(this.operand))) {
1338
- operation = new(tree.Operation)(op, [operation || m, a]);
1339
- }
1340
- return operation || m;
1341
- }
1342
- },
1343
- addition: function () {
1344
- var m, a, op, operation;
1345
- if (m = $(this.multiplication)) {
1346
- while ((op = $(/^[-+]\s+/) || (input.charAt(i - 1) != ' ' && ($('+') || $('-')))) &&
1347
- (a = $(this.multiplication))) {
1348
- operation = new(tree.Operation)(op, [operation || m, a]);
1349
- }
1350
- return operation || m;
1351
- }
1352
- },
1353
- conditions: function () {
1354
- var a, b, index = i, condition;
1355
-
1356
- if (a = $(this.condition)) {
1357
- while ($(',') && (b = $(this.condition))) {
1358
- condition = new(tree.Condition)('or', condition || a, b, index);
1359
- }
1360
- return condition || a;
1361
- }
1362
- },
1363
- condition: function () {
1364
- var a, b, c, op, index = i, negate = false;
1365
-
1366
- if ($(/^not/)) { negate = true }
1367
- expect('(');
1368
- if (a = $(this.addition) || $(this.entities.keyword) || $(this.entities.quoted)) {
1369
- if (op = $(/^(?:>=|=<|[<=>])/)) {
1370
- if (b = $(this.addition) || $(this.entities.keyword) || $(this.entities.quoted)) {
1371
- c = new(tree.Condition)(op, a, b, index, negate);
1372
- } else {
1373
- error('expected expression');
1374
- }
1375
- } else {
1376
- c = new(tree.Condition)('=', a, new(tree.Keyword)('true'), index, negate);
1377
- }
1378
- expect(')');
1379
- return $(/^and/) ? new(tree.Condition)('and', c, $(this.condition)) : c;
1380
- }
1381
- },
1382
-
1383
- //
1384
- // An operand is anything that can be part of an operation,
1385
- // such as a Color, or a Variable
1386
- //
1387
- operand: function () {
1388
- var negate, p = input.charAt(i + 1);
1389
-
1390
- if (input.charAt(i) === '-' && (p === '@' || p === '(')) { negate = $('-') }
1391
- var o = $(this.sub) || $(this.entities.dimension) ||
1392
- $(this.entities.color) || $(this.entities.variable) ||
1393
- $(this.entities.call);
1394
- return negate ? new(tree.Operation)('*', [new(tree.Dimension)(-1), o])
1395
- : o;
1396
- },
1397
-
1398
- //
1399
- // Expressions either represent mathematical operations,
1400
- // or white-space delimited Entities.
1401
- //
1402
- // 1px solid black
1403
- // @var * 2
1404
- //
1405
- expression: function () {
1406
- var e, delim, entities = [], d;
1407
-
1408
- while (e = $(this.addition) || $(this.entity)) {
1409
- entities.push(e);
1410
- }
1411
- if (entities.length > 0) {
1412
- return new(tree.Expression)(entities);
1413
- }
1414
- },
1415
- property: function () {
1416
- var name;
1417
-
1418
- if (name = $(/^(\*?-?[-a-z_0-9]+)\s*:/)) {
1419
- return name[1];
1420
- }
1421
- }
1422
- }
1423
- };
1424
- };
1425
-
1426
- if (less.mode === 'browser' || less.mode === 'rhino') {
1427
- //
1428
- // Used by `@import` directives
1429
- //
1430
- less.Parser.importer = function (path, paths, callback, env) {
1431
- if (!/^([a-z]+:)?\//.test(path) && paths.length > 0) {
1432
- path = paths[0] + path;
1433
- }
1434
- // We pass `true` as 3rd argument, to force the reload of the import.
1435
- // This is so we can get the syntax tree as opposed to just the CSS output,
1436
- // as we need this to evaluate the current stylesheet.
1437
- loadStyleSheet({ href: path, title: path, type: env.mime }, function (e) {
1438
- if (e && typeof(env.errback) === "function") {
1439
- env.errback.call(null, path, paths, callback, env);
1440
- } else {
1441
- callback.apply(null, arguments);
1442
- }
1443
- }, true);
1444
- };
1445
- }
1446
-
1447
- (function (tree) {
1448
-
1449
- tree.functions = {
1450
- rgb: function (r, g, b) {
1451
- return this.rgba(r, g, b, 1.0);
1452
- },
1453
- rgba: function (r, g, b, a) {
1454
- var rgb = [r, g, b].map(function (c) { return number(c) }),
1455
- a = number(a);
1456
- return new(tree.Color)(rgb, a);
1457
- },
1458
- hsl: function (h, s, l) {
1459
- return this.hsla(h, s, l, 1.0);
1460
- },
1461
- hsla: function (h, s, l, a) {
1462
- h = (number(h) % 360) / 360;
1463
- s = number(s); l = number(l); a = number(a);
1464
-
1465
- var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;
1466
- var m1 = l * 2 - m2;
1467
-
1468
- return this.rgba(hue(h + 1/3) * 255,
1469
- hue(h) * 255,
1470
- hue(h - 1/3) * 255,
1471
- a);
1472
-
1473
- function hue(h) {
1474
- h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h);
1475
- if (h * 6 < 1) return m1 + (m2 - m1) * h * 6;
1476
- else if (h * 2 < 1) return m2;
1477
- else if (h * 3 < 2) return m1 + (m2 - m1) * (2/3 - h) * 6;
1478
- else return m1;
1479
- }
1480
- },
1481
- hue: function (color) {
1482
- return new(tree.Dimension)(Math.round(color.toHSL().h));
1483
- },
1484
- saturation: function (color) {
1485
- return new(tree.Dimension)(Math.round(color.toHSL().s * 100), '%');
1486
- },
1487
- lightness: function (color) {
1488
- return new(tree.Dimension)(Math.round(color.toHSL().l * 100), '%');
1489
- },
1490
- alpha: function (color) {
1491
- return new(tree.Dimension)(color.toHSL().a);
1492
- },
1493
- saturate: function (color, amount) {
1494
- var hsl = color.toHSL();
1495
-
1496
- hsl.s += amount.value / 100;
1497
- hsl.s = clamp(hsl.s);
1498
- return hsla(hsl);
1499
- },
1500
- desaturate: function (color, amount) {
1501
- var hsl = color.toHSL();
1502
-
1503
- hsl.s -= amount.value / 100;
1504
- hsl.s = clamp(hsl.s);
1505
- return hsla(hsl);
1506
- },
1507
- lighten: function (color, amount) {
1508
- var hsl = color.toHSL();
1509
-
1510
- hsl.l += amount.value / 100;
1511
- hsl.l = clamp(hsl.l);
1512
- return hsla(hsl);
1513
- },
1514
- darken: function (color, amount) {
1515
- var hsl = color.toHSL();
1516
-
1517
- hsl.l -= amount.value / 100;
1518
- hsl.l = clamp(hsl.l);
1519
- return hsla(hsl);
1520
- },
1521
- fadein: function (color, amount) {
1522
- var hsl = color.toHSL();
1523
-
1524
- hsl.a += amount.value / 100;
1525
- hsl.a = clamp(hsl.a);
1526
- return hsla(hsl);
1527
- },
1528
- fadeout: function (color, amount) {
1529
- var hsl = color.toHSL();
1530
-
1531
- hsl.a -= amount.value / 100;
1532
- hsl.a = clamp(hsl.a);
1533
- return hsla(hsl);
1534
- },
1535
- fade: function (color, amount) {
1536
- var hsl = color.toHSL();
1537
-
1538
- hsl.a = amount.value / 100;
1539
- hsl.a = clamp(hsl.a);
1540
- return hsla(hsl);
1541
- },
1542
- spin: function (color, amount) {
1543
- var hsl = color.toHSL();
1544
- var hue = (hsl.h + amount.value) % 360;
1545
-
1546
- hsl.h = hue < 0 ? 360 + hue : hue;
1547
-
1548
- return hsla(hsl);
1549
- },
1550
- //
1551
- // Copyright (c) 2006-2009 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein
1552
- // http://sass-lang.com
1553
- //
1554
- mix: function (color1, color2, weight) {
1555
- var p = weight.value / 100.0;
1556
- var w = p * 2 - 1;
1557
- var a = color1.toHSL().a - color2.toHSL().a;
1558
-
1559
- var w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
1560
- var w2 = 1 - w1;
1561
-
1562
- var rgb = [color1.rgb[0] * w1 + color2.rgb[0] * w2,
1563
- color1.rgb[1] * w1 + color2.rgb[1] * w2,
1564
- color1.rgb[2] * w1 + color2.rgb[2] * w2];
1565
-
1566
- var alpha = color1.alpha * p + color2.alpha * (1 - p);
1567
-
1568
- return new(tree.Color)(rgb, alpha);
1569
- },
1570
- greyscale: function (color) {
1571
- return this.desaturate(color, new(tree.Dimension)(100));
1572
- },
1573
- e: function (str) {
1574
- return new(tree.Anonymous)(str instanceof tree.JavaScript ? str.evaluated : str);
1575
- },
1576
- escape: function (str) {
1577
- return new(tree.Anonymous)(encodeURI(str.value).replace(/=/g, "%3D").replace(/:/g, "%3A").replace(/#/g, "%23").replace(/;/g, "%3B").replace(/\(/g, "%28").replace(/\)/g, "%29"));
1578
- },
1579
- '%': function (quoted /* arg, arg, ...*/) {
1580
- var args = Array.prototype.slice.call(arguments, 1),
1581
- str = quoted.value;
1582
-
1583
- for (var i = 0; i < args.length; i++) {
1584
- str = str.replace(/%[sda]/i, function(token) {
1585
- var value = token.match(/s/i) ? args[i].value : args[i].toCSS();
1586
- return token.match(/[A-Z]$/) ? encodeURIComponent(value) : value;
1587
- });
1588
- }
1589
- str = str.replace(/%%/g, '%');
1590
- return new(tree.Quoted)('"' + str + '"', str);
1591
- },
1592
- round: function (n) {
1593
- return this._math('round', n);
1594
- },
1595
- ceil: function (n) {
1596
- return this._math('ceil', n);
1597
- },
1598
- floor: function (n) {
1599
- return this._math('floor', n);
1600
- },
1601
- _math: function (fn, n) {
1602
- if (n instanceof tree.Dimension) {
1603
- return new(tree.Dimension)(Math[fn](number(n)), n.unit);
1604
- } else if (typeof(n) === 'number') {
1605
- return Math[fn](n);
1606
- } else {
1607
- throw { type: "Argument", message: "argument must be a number" };
1608
- }
1609
- },
1610
- argb: function (color) {
1611
- return new(tree.Anonymous)(color.toARGB());
1612
-
1613
- },
1614
- percentage: function (n) {
1615
- return new(tree.Dimension)(n.value * 100, '%');
1616
- },
1617
- color: function (n) {
1618
- if (n instanceof tree.Quoted) {
1619
- return new(tree.Color)(n.value.slice(1));
1620
- } else {
1621
- throw { type: "Argument", message: "argument must be a string" };
1622
- }
1623
- },
1624
- iscolor: function (n) {
1625
- return this._isa(n, tree.Color);
1626
- },
1627
- isnumber: function (n) {
1628
- return this._isa(n, tree.Dimension);
1629
- },
1630
- isstring: function (n) {
1631
- return this._isa(n, tree.Quoted);
1632
- },
1633
- iskeyword: function (n) {
1634
- return this._isa(n, tree.Keyword);
1635
- },
1636
- isurl: function (n) {
1637
- return this._isa(n, tree.URL);
1638
- },
1639
- ispixel: function (n) {
1640
- return (n instanceof tree.Dimension) && n.unit === 'px' ? tree.True : tree.False;
1641
- },
1642
- ispercentage: function (n) {
1643
- return (n instanceof tree.Dimension) && n.unit === '%' ? tree.True : tree.False;
1644
- },
1645
- isem: function (n) {
1646
- return (n instanceof tree.Dimension) && n.unit === 'em' ? tree.True : tree.False;
1647
- },
1648
- _isa: function (n, Type) {
1649
- return (n instanceof Type) ? tree.True : tree.False;
1650
- }
1651
- };
1652
-
1653
- function hsla(hsla) {
1654
- return tree.functions.hsla(hsla.h, hsla.s, hsla.l, hsla.a);
1655
- }
1656
-
1657
- function number(n) {
1658
- if (n instanceof tree.Dimension) {
1659
- return parseFloat(n.unit == '%' ? n.value / 100 : n.value);
1660
- } else if (typeof(n) === 'number') {
1661
- return n;
1662
- } else {
1663
- throw {
1664
- error: "RuntimeError",
1665
- message: "color functions take numbers as parameters"
1666
- };
1667
- }
1668
- }
1669
-
1670
- function clamp(val) {
1671
- return Math.min(1, Math.max(0, val));
1672
- }
1673
-
1674
- })(require('./tree'));
1675
- (function (tree) {
1676
- tree.colors = {
1677
- 'aliceblue':'#f0f8ff',
1678
- 'antiquewhite':'#faebd7',
1679
- 'aqua':'#00ffff',
1680
- 'aquamarine':'#7fffd4',
1681
- 'azure':'#f0ffff',
1682
- 'beige':'#f5f5dc',
1683
- 'bisque':'#ffe4c4',
1684
- 'black':'#000000',
1685
- 'blanchedalmond':'#ffebcd',
1686
- 'blue':'#0000ff',
1687
- 'blueviolet':'#8a2be2',
1688
- 'brown':'#a52a2a',
1689
- 'burlywood':'#deb887',
1690
- 'cadetblue':'#5f9ea0',
1691
- 'chartreuse':'#7fff00',
1692
- 'chocolate':'#d2691e',
1693
- 'coral':'#ff7f50',
1694
- 'cornflowerblue':'#6495ed',
1695
- 'cornsilk':'#fff8dc',
1696
- 'crimson':'#dc143c',
1697
- 'cyan':'#00ffff',
1698
- 'darkblue':'#00008b',
1699
- 'darkcyan':'#008b8b',
1700
- 'darkgoldenrod':'#b8860b',
1701
- 'darkgray':'#a9a9a9',
1702
- 'darkgrey':'#a9a9a9',
1703
- 'darkgreen':'#006400',
1704
- 'darkkhaki':'#bdb76b',
1705
- 'darkmagenta':'#8b008b',
1706
- 'darkolivegreen':'#556b2f',
1707
- 'darkorange':'#ff8c00',
1708
- 'darkorchid':'#9932cc',
1709
- 'darkred':'#8b0000',
1710
- 'darksalmon':'#e9967a',
1711
- 'darkseagreen':'#8fbc8f',
1712
- 'darkslateblue':'#483d8b',
1713
- 'darkslategray':'#2f4f4f',
1714
- 'darkslategrey':'#2f4f4f',
1715
- 'darkturquoise':'#00ced1',
1716
- 'darkviolet':'#9400d3',
1717
- 'deeppink':'#ff1493',
1718
- 'deepskyblue':'#00bfff',
1719
- 'dimgray':'#696969',
1720
- 'dimgrey':'#696969',
1721
- 'dodgerblue':'#1e90ff',
1722
- 'firebrick':'#b22222',
1723
- 'floralwhite':'#fffaf0',
1724
- 'forestgreen':'#228b22',
1725
- 'fuchsia':'#ff00ff',
1726
- 'gainsboro':'#dcdcdc',
1727
- 'ghostwhite':'#f8f8ff',
1728
- 'gold':'#ffd700',
1729
- 'goldenrod':'#daa520',
1730
- 'gray':'#808080',
1731
- 'grey':'#808080',
1732
- 'green':'#008000',
1733
- 'greenyellow':'#adff2f',
1734
- 'honeydew':'#f0fff0',
1735
- 'hotpink':'#ff69b4',
1736
- 'indianred':'#cd5c5c',
1737
- 'indigo':'#4b0082',
1738
- 'ivory':'#fffff0',
1739
- 'khaki':'#f0e68c',
1740
- 'lavender':'#e6e6fa',
1741
- 'lavenderblush':'#fff0f5',
1742
- 'lawngreen':'#7cfc00',
1743
- 'lemonchiffon':'#fffacd',
1744
- 'lightblue':'#add8e6',
1745
- 'lightcoral':'#f08080',
1746
- 'lightcyan':'#e0ffff',
1747
- 'lightgoldenrodyellow':'#fafad2',
1748
- 'lightgray':'#d3d3d3',
1749
- 'lightgrey':'#d3d3d3',
1750
- 'lightgreen':'#90ee90',
1751
- 'lightpink':'#ffb6c1',
1752
- 'lightsalmon':'#ffa07a',
1753
- 'lightseagreen':'#20b2aa',
1754
- 'lightskyblue':'#87cefa',
1755
- 'lightslategray':'#778899',
1756
- 'lightslategrey':'#778899',
1757
- 'lightsteelblue':'#b0c4de',
1758
- 'lightyellow':'#ffffe0',
1759
- 'lime':'#00ff00',
1760
- 'limegreen':'#32cd32',
1761
- 'linen':'#faf0e6',
1762
- 'magenta':'#ff00ff',
1763
- 'maroon':'#800000',
1764
- 'mediumaquamarine':'#66cdaa',
1765
- 'mediumblue':'#0000cd',
1766
- 'mediumorchid':'#ba55d3',
1767
- 'mediumpurple':'#9370d8',
1768
- 'mediumseagreen':'#3cb371',
1769
- 'mediumslateblue':'#7b68ee',
1770
- 'mediumspringgreen':'#00fa9a',
1771
- 'mediumturquoise':'#48d1cc',
1772
- 'mediumvioletred':'#c71585',
1773
- 'midnightblue':'#191970',
1774
- 'mintcream':'#f5fffa',
1775
- 'mistyrose':'#ffe4e1',
1776
- 'moccasin':'#ffe4b5',
1777
- 'navajowhite':'#ffdead',
1778
- 'navy':'#000080',
1779
- 'oldlace':'#fdf5e6',
1780
- 'olive':'#808000',
1781
- 'olivedrab':'#6b8e23',
1782
- 'orange':'#ffa500',
1783
- 'orangered':'#ff4500',
1784
- 'orchid':'#da70d6',
1785
- 'palegoldenrod':'#eee8aa',
1786
- 'palegreen':'#98fb98',
1787
- 'paleturquoise':'#afeeee',
1788
- 'palevioletred':'#d87093',
1789
- 'papayawhip':'#ffefd5',
1790
- 'peachpuff':'#ffdab9',
1791
- 'peru':'#cd853f',
1792
- 'pink':'#ffc0cb',
1793
- 'plum':'#dda0dd',
1794
- 'powderblue':'#b0e0e6',
1795
- 'purple':'#800080',
1796
- 'red':'#ff0000',
1797
- 'rosybrown':'#bc8f8f',
1798
- 'royalblue':'#4169e1',
1799
- 'saddlebrown':'#8b4513',
1800
- 'salmon':'#fa8072',
1801
- 'sandybrown':'#f4a460',
1802
- 'seagreen':'#2e8b57',
1803
- 'seashell':'#fff5ee',
1804
- 'sienna':'#a0522d',
1805
- 'silver':'#c0c0c0',
1806
- 'skyblue':'#87ceeb',
1807
- 'slateblue':'#6a5acd',
1808
- 'slategray':'#708090',
1809
- 'slategrey':'#708090',
1810
- 'snow':'#fffafa',
1811
- 'springgreen':'#00ff7f',
1812
- 'steelblue':'#4682b4',
1813
- 'tan':'#d2b48c',
1814
- 'teal':'#008080',
1815
- 'thistle':'#d8bfd8',
1816
- 'tomato':'#ff6347',
1817
- 'turquoise':'#40e0d0',
1818
- 'violet':'#ee82ee',
1819
- 'wheat':'#f5deb3',
1820
- 'white':'#ffffff',
1821
- 'whitesmoke':'#f5f5f5',
1822
- 'yellow':'#ffff00',
1823
- 'yellowgreen':'#9acd32'
1824
- };
1825
- })(require('./tree'));
1826
- (function (tree) {
1827
-
1828
- tree.Alpha = function (val) {
1829
- this.value = val;
1830
- };
1831
- tree.Alpha.prototype = {
1832
- toCSS: function () {
1833
- return "alpha(opacity=" +
1834
- (this.value.toCSS ? this.value.toCSS() : this.value) + ")";
1835
- },
1836
- eval: function (env) {
1837
- if (this.value.eval) { this.value = this.value.eval(env) }
1838
- return this;
1839
- }
1840
- };
1841
-
1842
- })(require('../tree'));
1843
- (function (tree) {
1844
-
1845
- tree.Anonymous = function (string) {
1846
- this.value = string.value || string;
1847
- };
1848
- tree.Anonymous.prototype = {
1849
- toCSS: function () {
1850
- return this.value;
1851
- },
1852
- eval: function () { return this }
1853
- };
1854
-
1855
- })(require('../tree'));
1856
- (function (tree) {
1857
-
1858
- tree.Assignment = function (key, val) {
1859
- this.key = key;
1860
- this.value = val;
1861
- };
1862
- tree.Assignment.prototype = {
1863
- toCSS: function () {
1864
- return this.key + '=' + (this.value.toCSS ? this.value.toCSS() : this.value);
1865
- },
1866
- eval: function (env) {
1867
- if (this.value.eval) { this.value = this.value.eval(env) }
1868
- return this;
1869
- }
1870
- };
1871
-
1872
- })(require('../tree'));(function (tree) {
1873
-
1874
- //
1875
- // A function call node.
1876
- //
1877
- tree.Call = function (name, args, index, filename) {
1878
- this.name = name;
1879
- this.args = args;
1880
- this.index = index;
1881
- this.filename = filename;
1882
- };
1883
- tree.Call.prototype = {
1884
- //
1885
- // When evaluating a function call,
1886
- // we either find the function in `tree.functions` [1],
1887
- // in which case we call it, passing the evaluated arguments,
1888
- // or we simply print it out as it appeared originally [2].
1889
- //
1890
- // The *functions.js* file contains the built-in functions.
1891
- //
1892
- // The reason why we evaluate the arguments, is in the case where
1893
- // we try to pass a variable to a function, like: `saturate(@color)`.
1894
- // The function should receive the value, not the variable.
1895
- //
1896
- eval: function (env) {
1897
- var args = this.args.map(function (a) { return a.eval(env) });
1898
-
1899
- if (this.name in tree.functions) { // 1.
1900
- try {
1901
- return tree.functions[this.name].apply(tree.functions, args);
1902
- } catch (e) {
1903
- throw { type: e.type || "Runtime",
1904
- message: "error evaluating function `" + this.name + "`" +
1905
- (e.message ? ': ' + e.message : ''),
1906
- index: this.index, filename: this.filename };
1907
- }
1908
- } else { // 2.
1909
- return new(tree.Anonymous)(this.name +
1910
- "(" + args.map(function (a) { return a.toCSS() }).join(', ') + ")");
1911
- }
1912
- },
1913
-
1914
- toCSS: function (env) {
1915
- return this.eval(env).toCSS();
1916
- }
1917
- };
1918
-
1919
- })(require('../tree'));
1920
- (function (tree) {
1921
- //
1922
- // RGB Colors - #ff0014, #eee
1923
- //
1924
- tree.Color = function (rgb, a) {
1925
- //
1926
- // The end goal here, is to parse the arguments
1927
- // into an integer triplet, such as `128, 255, 0`
1928
- //
1929
- // This facilitates operations and conversions.
1930
- //
1931
- if (Array.isArray(rgb)) {
1932
- this.rgb = rgb;
1933
- } else if (rgb.length == 6) {
1934
- this.rgb = rgb.match(/.{2}/g).map(function (c) {
1935
- return parseInt(c, 16);
1936
- });
1937
- } else {
1938
- this.rgb = rgb.split('').map(function (c) {
1939
- return parseInt(c + c, 16);
1940
- });
1941
- }
1942
- this.alpha = typeof(a) === 'number' ? a : 1;
1943
- };
1944
- tree.Color.prototype = {
1945
- eval: function () { return this },
1946
-
1947
- //
1948
- // If we have some transparency, the only way to represent it
1949
- // is via `rgba`. Otherwise, we use the hex representation,
1950
- // which has better compatibility with older browsers.
1951
- // Values are capped between `0` and `255`, rounded and zero-padded.
1952
- //
1953
- toCSS: function () {
1954
- if (this.alpha < 1.0) {
1955
- return "rgba(" + this.rgb.map(function (c) {
1956
- return Math.round(c);
1957
- }).concat(this.alpha).join(', ') + ")";
1958
- } else {
1959
- return '#' + this.rgb.map(function (i) {
1960
- i = Math.round(i);
1961
- i = (i > 255 ? 255 : (i < 0 ? 0 : i)).toString(16);
1962
- return i.length === 1 ? '0' + i : i;
1963
- }).join('');
1964
- }
1965
- },
1966
-
1967
- //
1968
- // Operations have to be done per-channel, if not,
1969
- // channels will spill onto each other. Once we have
1970
- // our result, in the form of an integer triplet,
1971
- // we create a new Color node to hold the result.
1972
- //
1973
- operate: function (op, other) {
1974
- var result = [];
1975
-
1976
- if (! (other instanceof tree.Color)) {
1977
- other = other.toColor();
1978
- }
1979
-
1980
- for (var c = 0; c < 3; c++) {
1981
- result[c] = tree.operate(op, this.rgb[c], other.rgb[c]);
1982
- }
1983
- return new(tree.Color)(result, this.alpha + other.alpha);
1984
- },
1985
-
1986
- toHSL: function () {
1987
- var r = this.rgb[0] / 255,
1988
- g = this.rgb[1] / 255,
1989
- b = this.rgb[2] / 255,
1990
- a = this.alpha;
1991
-
1992
- var max = Math.max(r, g, b), min = Math.min(r, g, b);
1993
- var h, s, l = (max + min) / 2, d = max - min;
1994
-
1995
- if (max === min) {
1996
- h = s = 0;
1997
- } else {
1998
- s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
1999
-
2000
- switch (max) {
2001
- case r: h = (g - b) / d + (g < b ? 6 : 0); break;
2002
- case g: h = (b - r) / d + 2; break;
2003
- case b: h = (r - g) / d + 4; break;
2004
- }
2005
- h /= 6;
2006
- }
2007
- return { h: h * 360, s: s, l: l, a: a };
2008
- },
2009
- toARGB: function () {
2010
- var argb = [Math.round(this.alpha * 255)].concat(this.rgb);
2011
- return '#' + argb.map(function (i) {
2012
- i = Math.round(i);
2013
- i = (i > 255 ? 255 : (i < 0 ? 0 : i)).toString(16);
2014
- return i.length === 1 ? '0' + i : i;
2015
- }).join('');
2016
- }
2017
- };
2018
-
2019
-
2020
- })(require('../tree'));
2021
- (function (tree) {
2022
-
2023
- tree.Comment = function (value, silent) {
2024
- this.value = value;
2025
- this.silent = !!silent;
2026
- };
2027
- tree.Comment.prototype = {
2028
- toCSS: function (env) {
2029
- return env.compress ? '' : this.value;
2030
- },
2031
- eval: function () { return this }
2032
- };
2033
-
2034
- })(require('../tree'));
2035
- (function (tree) {
2036
-
2037
- tree.Condition = function (op, l, r, i, negate) {
2038
- this.op = op.trim();
2039
- this.lvalue = l;
2040
- this.rvalue = r;
2041
- this.index = i;
2042
- this.negate = negate;
2043
- };
2044
- tree.Condition.prototype.eval = function (env) {
2045
- var a = this.lvalue.eval(env),
2046
- b = this.rvalue.eval(env);
2047
-
2048
- var i = this.index, result;
2049
-
2050
- var result = (function (op) {
2051
- switch (op) {
2052
- case 'and':
2053
- return a && b;
2054
- case 'or':
2055
- return a || b;
2056
- default:
2057
- if (a.compare) {
2058
- result = a.compare(b);
2059
- } else if (b.compare) {
2060
- result = b.compare(a);
2061
- } else {
2062
- throw { type: "Type",
2063
- message: "Unable to perform comparison",
2064
- index: i };
2065
- }
2066
- switch (result) {
2067
- case -1: return op === '<' || op === '=<';
2068
- case 0: return op === '=' || op === '>=' || op === '=<';
2069
- case 1: return op === '>' || op === '>=';
2070
- }
2071
- }
2072
- })(this.op);
2073
- return this.negate ? !result : result;
2074
- };
2075
-
2076
- })(require('../tree'));
2077
- (function (tree) {
2078
-
2079
- //
2080
- // A number with a unit
2081
- //
2082
- tree.Dimension = function (value, unit) {
2083
- this.value = parseFloat(value);
2084
- this.unit = unit || null;
2085
- };
2086
-
2087
- tree.Dimension.prototype = {
2088
- eval: function () { return this },
2089
- toColor: function () {
2090
- return new(tree.Color)([this.value, this.value, this.value]);
2091
- },
2092
- toCSS: function () {
2093
- var css = this.value + this.unit;
2094
- return css;
2095
- },
2096
-
2097
- // In an operation between two Dimensions,
2098
- // we default to the first Dimension's unit,
2099
- // so `1px + 2em` will yield `3px`.
2100
- // In the future, we could implement some unit
2101
- // conversions such that `100cm + 10mm` would yield
2102
- // `101cm`.
2103
- operate: function (op, other) {
2104
- return new(tree.Dimension)
2105
- (tree.operate(op, this.value, other.value),
2106
- this.unit || other.unit);
2107
- },
2108
-
2109
- // TODO: Perform unit conversion before comparing
2110
- compare: function (other) {
2111
- if (other instanceof tree.Dimension) {
2112
- if (other.value > this.value) {
2113
- return -1;
2114
- } else if (other.value < this.value) {
2115
- return 1;
2116
- } else {
2117
- return 0;
2118
- }
2119
- } else {
2120
- return -1;
2121
- }
2122
- }
2123
- };
2124
-
2125
- })(require('../tree'));
2126
- (function (tree) {
2127
-
2128
- tree.Directive = function (name, value, features) {
2129
- this.name = name;
2130
-
2131
- if (Array.isArray(value)) {
2132
- this.ruleset = new(tree.Ruleset)([], value);
2133
- this.ruleset.allowImports = true;
2134
- } else {
2135
- this.value = value;
2136
- }
2137
- };
2138
- tree.Directive.prototype = {
2139
- toCSS: function (ctx, env) {
2140
- if (this.ruleset) {
2141
- this.ruleset.root = true;
2142
- return this.name + (env.compress ? '{' : ' {\n ') +
2143
- this.ruleset.toCSS(ctx, env).trim().replace(/\n/g, '\n ') +
2144
- (env.compress ? '}': '\n}\n');
2145
- } else {
2146
- return this.name + ' ' + this.value.toCSS() + ';\n';
2147
- }
2148
- },
2149
- eval: function (env) {
2150
- env.frames.unshift(this);
2151
- this.ruleset = this.ruleset && this.ruleset.eval(env);
2152
- env.frames.shift();
2153
- return this;
2154
- },
2155
- variable: function (name) { return tree.Ruleset.prototype.variable.call(this.ruleset, name) },
2156
- find: function () { return tree.Ruleset.prototype.find.apply(this.ruleset, arguments) },
2157
- rulesets: function () { return tree.Ruleset.prototype.rulesets.apply(this.ruleset) }
2158
- };
2159
-
2160
- })(require('../tree'));
2161
- (function (tree) {
2162
-
2163
- tree.Element = function (combinator, value, index) {
2164
- this.combinator = combinator instanceof tree.Combinator ?
2165
- combinator : new(tree.Combinator)(combinator);
2166
-
2167
- if (typeof(value) === 'string') {
2168
- this.value = value.trim();
2169
- } else if (value) {
2170
- this.value = value;
2171
- } else {
2172
- this.value = "";
2173
- }
2174
- this.index = index;
2175
- };
2176
- tree.Element.prototype.eval = function (env) {
2177
- return new(tree.Element)(this.combinator,
2178
- this.value.eval ? this.value.eval(env) : this.value,
2179
- this.index);
2180
- };
2181
- tree.Element.prototype.toCSS = function (env) {
2182
- return this.combinator.toCSS(env || {}) + (this.value.toCSS ? this.value.toCSS(env) : this.value);
2183
- };
2184
-
2185
- tree.Combinator = function (value) {
2186
- if (value === ' ') {
2187
- this.value = ' ';
2188
- } else if (value === '& ') {
2189
- this.value = '& ';
2190
- } else {
2191
- this.value = value ? value.trim() : "";
2192
- }
2193
- };
2194
- tree.Combinator.prototype.toCSS = function (env) {
2195
- return {
2196
- '' : '',
2197
- ' ' : ' ',
2198
- '&' : '',
2199
- '& ' : ' ',
2200
- ':' : ' :',
2201
- '+' : env.compress ? '+' : ' + ',
2202
- '~' : env.compress ? '~' : ' ~ ',
2203
- '>' : env.compress ? '>' : ' > '
2204
- }[this.value];
2205
- };
2206
-
2207
- })(require('../tree'));
2208
- (function (tree) {
2209
-
2210
- tree.Expression = function (value) { this.value = value };
2211
- tree.Expression.prototype = {
2212
- eval: function (env) {
2213
- if (this.value.length > 1) {
2214
- return new(tree.Expression)(this.value.map(function (e) {
2215
- return e.eval(env);
2216
- }));
2217
- } else if (this.value.length === 1) {
2218
- return this.value[0].eval(env);
2219
- } else {
2220
- return this;
2221
- }
2222
- },
2223
- toCSS: function (env) {
2224
- return this.value.map(function (e) {
2225
- return e.toCSS ? e.toCSS(env) : '';
2226
- }).join(' ');
2227
- }
2228
- };
2229
-
2230
- })(require('../tree'));
2231
- (function (tree) {
2232
- //
2233
- // CSS @import node
2234
- //
2235
- // The general strategy here is that we don't want to wait
2236
- // for the parsing to be completed, before we start importing
2237
- // the file. That's because in the context of a browser,
2238
- // most of the time will be spent waiting for the server to respond.
2239
- //
2240
- // On creation, we push the import path to our import queue, though
2241
- // `import,push`, we also pass it a callback, which it'll call once
2242
- // the file has been fetched, and parsed.
2243
- //
2244
- tree.Import = function (path, imports, features, index) {
2245
- var that = this;
2246
-
2247
- this.index = index;
2248
- this._path = path;
2249
- this.features = features && new(tree.Value)(features);
2250
-
2251
- // The '.less' extension is optional
2252
- if (path instanceof tree.Quoted) {
2253
- this.path = /\.(le?|c)ss(\?.*)?$/.test(path.value) ? path.value : path.value + '.less';
2254
- } else {
2255
- this.path = path.value.value || path.value;
2256
- }
2257
-
2258
- this.css = /css(\?.*)?$/.test(this.path);
2259
-
2260
- // Only pre-compile .less files
2261
- if (! this.css) {
2262
- imports.push(this.path, function (e, root) {
2263
- if (e) { e.index = index }
2264
- that.root = root || new(tree.Ruleset)([], []);
2265
- });
2266
- }
2267
- };
2268
-
2269
- //
2270
- // The actual import node doesn't return anything, when converted to CSS.
2271
- // The reason is that it's used at the evaluation stage, so that the rules
2272
- // it imports can be treated like any other rules.
2273
- //
2274
- // In `eval`, we make sure all Import nodes get evaluated, recursively, so
2275
- // we end up with a flat structure, which can easily be imported in the parent
2276
- // ruleset.
2277
- //
2278
- tree.Import.prototype = {
2279
- toCSS: function (env) {
2280
- var features = this.features ? ' ' + this.features.toCSS(env) : '';
2281
-
2282
- if (this.css) {
2283
- return "@import " + this._path.toCSS() + features + ';\n';
2284
- } else {
2285
- return "";
2286
- }
2287
- },
2288
- eval: function (env) {
2289
- var ruleset, features = this.features && this.features.eval(env);
2290
-
2291
- if (this.css) {
2292
- return this;
2293
- } else {
2294
- ruleset = new(tree.Ruleset)([], this.root.rules.slice(0));
2295
-
2296
- for (var i = 0; i < ruleset.rules.length; i++) {
2297
- if (ruleset.rules[i] instanceof tree.Import) {
2298
- Array.prototype
2299
- .splice
2300
- .apply(ruleset.rules,
2301
- [i, 1].concat(ruleset.rules[i].eval(env)));
2302
- }
2303
- }
2304
- return this.features ? new(tree.Media)(ruleset.rules, this.features.value) : ruleset.rules;
2305
- }
2306
- }
2307
- };
2308
-
2309
- })(require('../tree'));
2310
- (function (tree) {
2311
-
2312
- tree.JavaScript = function (string, index, escaped) {
2313
- this.escaped = escaped;
2314
- this.expression = string;
2315
- this.index = index;
2316
- };
2317
- tree.JavaScript.prototype = {
2318
- eval: function (env) {
2319
- var result,
2320
- that = this,
2321
- context = {};
2322
-
2323
- var expression = this.expression.replace(/@\{([\w-]+)\}/g, function (_, name) {
2324
- return tree.jsify(new(tree.Variable)('@' + name, that.index).eval(env));
2325
- });
2326
-
2327
- try {
2328
- expression = new(Function)('return (' + expression + ')');
2329
- } catch (e) {
2330
- throw { message: "JavaScript evaluation error: `" + expression + "`" ,
2331
- index: this.index };
2332
- }
2333
-
2334
- for (var k in env.frames[0].variables()) {
2335
- context[k.slice(1)] = {
2336
- value: env.frames[0].variables()[k].value,
2337
- toJS: function () {
2338
- return this.value.eval(env).toCSS();
2339
- }
2340
- };
2341
- }
2342
-
2343
- try {
2344
- result = expression.call(context);
2345
- } catch (e) {
2346
- throw { message: "JavaScript evaluation error: '" + e.name + ': ' + e.message + "'" ,
2347
- index: this.index };
2348
- }
2349
- if (typeof(result) === 'string') {
2350
- return new(tree.Quoted)('"' + result + '"', result, this.escaped, this.index);
2351
- } else if (Array.isArray(result)) {
2352
- return new(tree.Anonymous)(result.join(', '));
2353
- } else {
2354
- return new(tree.Anonymous)(result);
2355
- }
2356
- }
2357
- };
2358
-
2359
- })(require('../tree'));
2360
-
2361
- (function (tree) {
2362
-
2363
- tree.Keyword = function (value) { this.value = value };
2364
- tree.Keyword.prototype = {
2365
- eval: function () { return this },
2366
- toCSS: function () { return this.value },
2367
- compare: function (other) {
2368
- if (other instanceof tree.Keyword) {
2369
- return other.value === this.value ? 0 : 1;
2370
- } else {
2371
- return -1;
2372
- }
2373
- }
2374
- };
2375
-
2376
- tree.True = new(tree.Keyword)('true');
2377
- tree.False = new(tree.Keyword)('false');
2378
-
2379
- })(require('../tree'));
2380
- (function (tree) {
2381
-
2382
- tree.Media = function (value, features) {
2383
- var el = new(tree.Element)('&', null, 0),
2384
- selectors = [new(tree.Selector)([el])];
2385
-
2386
- this.features = new(tree.Value)(features);
2387
- this.ruleset = new(tree.Ruleset)(selectors, value);
2388
- this.ruleset.allowImports = true;
2389
- };
2390
- tree.Media.prototype = {
2391
- toCSS: function (ctx, env) {
2392
- var features = this.features.toCSS(env);
2393
-
2394
- this.ruleset.root = (ctx.length === 0 || ctx[0].multiMedia);
2395
- return '@media ' + features + (env.compress ? '{' : ' {\n ') +
2396
- this.ruleset.toCSS(ctx, env).trim().replace(/\n/g, '\n ') +
2397
- (env.compress ? '}': '\n}\n');
2398
- },
2399
- eval: function (env) {
2400
- if (!env.mediaBlocks) {
2401
- env.mediaBlocks = [];
2402
- env.mediaPath = [];
2403
- }
2404
-
2405
- var blockIndex = env.mediaBlocks.length;
2406
- env.mediaPath.push(this);
2407
- env.mediaBlocks.push(this);
2408
-
2409
- var media = new(tree.Media)([], []);
2410
- media.features = this.features.eval(env);
2411
-
2412
- env.frames.unshift(this.ruleset);
2413
- media.ruleset = this.ruleset.eval(env);
2414
- env.frames.shift();
2415
-
2416
- env.mediaBlocks[blockIndex] = media;
2417
- env.mediaPath.pop();
2418
-
2419
- return env.mediaPath.length === 0 ? media.evalTop(env) :
2420
- media.evalNested(env)
2421
- },
2422
- variable: function (name) { return tree.Ruleset.prototype.variable.call(this.ruleset, name) },
2423
- find: function () { return tree.Ruleset.prototype.find.apply(this.ruleset, arguments) },
2424
- rulesets: function () { return tree.Ruleset.prototype.rulesets.apply(this.ruleset) },
2425
-
2426
- evalTop: function (env) {
2427
- var result = this;
2428
-
2429
- // Render all dependent Media blocks.
2430
- if (env.mediaBlocks.length > 1) {
2431
- var el = new(tree.Element)('&', null, 0);
2432
- var selectors = [new(tree.Selector)([el])];
2433
- result = new(tree.Ruleset)(selectors, env.mediaBlocks);
2434
- result.multiMedia = true;
2435
- }
2436
-
2437
- delete env.mediaBlocks;
2438
- delete env.mediaPath;
2439
-
2440
- return result;
2441
- },
2442
- evalNested: function (env) {
2443
- var i, value,
2444
- path = env.mediaPath.concat([this]);
2445
-
2446
- // Extract the media-query conditions separated with `,` (OR).
2447
- for (i = 0; i < path.length; i++) {
2448
- value = path[i].features instanceof tree.Value ?
2449
- path[i].features.value : path[i].features;
2450
- path[i] = Array.isArray(value) ? value : [value];
2451
- }
2452
-
2453
- // Trace all permutations to generate the resulting media-query.
2454
- //
2455
- // (a, b and c) with nested (d, e) ->
2456
- // a and d
2457
- // a and e
2458
- // b and c and d
2459
- // b and c and e
2460
- this.features = new(tree.Value)(this.permute(path).map(function (path) {
2461
- path = path.map(function (fragment) {
2462
- return fragment.toCSS ? fragment : new(tree.Anonymous)(fragment);
2463
- });
2464
-
2465
- for(i = path.length - 1; i > 0; i--) {
2466
- path.splice(i, 0, new(tree.Anonymous)("and"));
2467
- }
2468
-
2469
- return new(tree.Expression)(path);
2470
- }));
2471
-
2472
- // Fake a tree-node that doesn't output anything.
2473
- return new(tree.Ruleset)([], []);
2474
- },
2475
- permute: function (arr) {
2476
- if (arr.length === 0) {
2477
- return [];
2478
- } else if (arr.length === 1) {
2479
- return arr[0];
2480
- } else {
2481
- var result = [];
2482
- var rest = this.permute(arr.slice(1));
2483
- for (var i = 0; i < rest.length; i++) {
2484
- for (var j = 0; j < arr[0].length; j++) {
2485
- result.push([arr[0][j]].concat(rest[i]));
2486
- }
2487
- }
2488
- return result;
2489
- }
2490
- }
2491
- };
2492
-
2493
- })(require('../tree'));
2494
- (function (tree) {
2495
-
2496
- tree.mixin = {};
2497
- tree.mixin.Call = function (elements, args, index, filename, important) {
2498
- this.selector = new(tree.Selector)(elements);
2499
- this.arguments = args;
2500
- this.index = index;
2501
- this.filename = filename;
2502
- this.important = important;
2503
- };
2504
- tree.mixin.Call.prototype = {
2505
- eval: function (env) {
2506
- var mixins, args, rules = [], match = false;
2507
-
2508
- for (var i = 0; i < env.frames.length; i++) {
2509
- if ((mixins = env.frames[i].find(this.selector)).length > 0) {
2510
- args = this.arguments && this.arguments.map(function (a) { return a.eval(env) });
2511
- for (var m = 0; m < mixins.length; m++) {
2512
- if (mixins[m].match(args, env)) {
2513
- try {
2514
- Array.prototype.push.apply(
2515
- rules, mixins[m].eval(env, this.arguments, this.important).rules);
2516
- match = true;
2517
- } catch (e) {
2518
- throw { message: e.message, index: this.index, filename: this.filename, stack: e.stack };
2519
- }
2520
- }
2521
- }
2522
- if (match) {
2523
- return rules;
2524
- } else {
2525
- throw { type: 'Runtime',
2526
- message: 'No matching definition was found for `' +
2527
- this.selector.toCSS().trim() + '(' +
2528
- this.arguments.map(function (a) {
2529
- return a.toCSS();
2530
- }).join(', ') + ")`",
2531
- index: this.index, filename: this.filename };
2532
- }
2533
- }
2534
- }
2535
- throw { type: 'Name',
2536
- message: this.selector.toCSS().trim() + " is undefined",
2537
- index: this.index, filename: this.filename };
2538
- }
2539
- };
2540
-
2541
- tree.mixin.Definition = function (name, params, rules, condition, variadic) {
2542
- this.name = name;
2543
- this.selectors = [new(tree.Selector)([new(tree.Element)(null, name)])];
2544
- this.params = params;
2545
- this.condition = condition;
2546
- this.variadic = variadic;
2547
- this.arity = params.length;
2548
- this.rules = rules;
2549
- this._lookups = {};
2550
- this.required = params.reduce(function (count, p) {
2551
- if (!p.name || (p.name && !p.value)) { return count + 1 }
2552
- else { return count }
2553
- }, 0);
2554
- this.parent = tree.Ruleset.prototype;
2555
- this.frames = [];
2556
- };
2557
- tree.mixin.Definition.prototype = {
2558
- toCSS: function () { return "" },
2559
- variable: function (name) { return this.parent.variable.call(this, name) },
2560
- variables: function () { return this.parent.variables.call(this) },
2561
- find: function () { return this.parent.find.apply(this, arguments) },
2562
- rulesets: function () { return this.parent.rulesets.apply(this) },
2563
-
2564
- evalParams: function (env, args) {
2565
- var frame = new(tree.Ruleset)(null, []), varargs;
2566
-
2567
- for (var i = 0, val, name; i < this.params.length; i++) {
2568
- if (name = this.params[i].name) {
2569
- if (this.params[i].variadic && args) {
2570
- varargs = [];
2571
- for (var j = i; j < args.length; j++) {
2572
- varargs.push(args[j].eval(env));
2573
- }
2574
- frame.rules.unshift(new(tree.Rule)(name, new(tree.Expression)(varargs).eval(env)));
2575
- } else if (val = (args && args[i]) || this.params[i].value) {
2576
- frame.rules.unshift(new(tree.Rule)(name, val.eval(env)));
2577
- } else {
2578
- throw { type: 'Runtime', message: "wrong number of arguments for " + this.name +
2579
- ' (' + args.length + ' for ' + this.arity + ')' };
2580
- }
2581
- }
2582
- }
2583
- return frame;
2584
- },
2585
- eval: function (env, args, important) {
2586
- var frame = this.evalParams(env, args), context, _arguments = [], rules, start;
2587
-
2588
- for (var i = 0; i < Math.max(this.params.length, args && args.length); i++) {
2589
- _arguments.push(args[i] || this.params[i].value);
2590
- }
2591
- frame.rules.unshift(new(tree.Rule)('@arguments', new(tree.Expression)(_arguments).eval(env)));
2592
-
2593
- rules = important ?
2594
- this.rules.map(function (r) {
2595
- return new(tree.Rule)(r.name, r.value, '!important', r.index);
2596
- }) : this.rules.slice(0);
2597
-
2598
- return new(tree.Ruleset)(null, rules).eval({
2599
- frames: [this, frame].concat(this.frames, env.frames)
2600
- });
2601
- },
2602
- match: function (args, env) {
2603
- var argsLength = (args && args.length) || 0, len, frame;
2604
-
2605
- if (! this.variadic) {
2606
- if (argsLength < this.required) { return false }
2607
- if (argsLength > this.params.length) { return false }
2608
- if ((this.required > 0) && (argsLength > this.params.length)) { return false }
2609
- }
2610
-
2611
- if (this.condition && !this.condition.eval({
2612
- frames: [this.evalParams(env, args)].concat(env.frames)
2613
- })) { return false }
2614
-
2615
- len = Math.min(argsLength, this.arity);
2616
-
2617
- for (var i = 0; i < len; i++) {
2618
- if (!this.params[i].name) {
2619
- if (args[i].eval(env).toCSS() != this.params[i].value.eval(env).toCSS()) {
2620
- return false;
2621
- }
2622
- }
2623
- }
2624
- return true;
2625
- }
2626
- };
2627
-
2628
- })(require('../tree'));
2629
- (function (tree) {
2630
-
2631
- tree.Operation = function (op, operands) {
2632
- this.op = op.trim();
2633
- this.operands = operands;
2634
- };
2635
- tree.Operation.prototype.eval = function (env) {
2636
- var a = this.operands[0].eval(env),
2637
- b = this.operands[1].eval(env),
2638
- temp;
2639
-
2640
- if (a instanceof tree.Dimension && b instanceof tree.Color) {
2641
- if (this.op === '*' || this.op === '+') {
2642
- temp = b, b = a, a = temp;
2643
- } else {
2644
- throw { name: "OperationError",
2645
- message: "Can't substract or divide a color from a number" };
2646
- }
2647
- }
2648
- return a.operate(this.op, b);
2649
- };
2650
-
2651
- tree.operate = function (op, a, b) {
2652
- switch (op) {
2653
- case '+': return a + b;
2654
- case '-': return a - b;
2655
- case '*': return a * b;
2656
- case '/': return a / b;
2657
- }
2658
- };
2659
-
2660
- })(require('../tree'));
2661
-
2662
- (function (tree) {
2663
-
2664
- tree.Paren = function (node) {
2665
- this.value = node;
2666
- };
2667
- tree.Paren.prototype = {
2668
- toCSS: function (env) {
2669
- return '(' + this.value.toCSS(env) + ')';
2670
- },
2671
- eval: function (env) {
2672
- return new(tree.Paren)(this.value.eval(env));
2673
- }
2674
- };
2675
-
2676
- })(require('../tree'));
2677
- (function (tree) {
2678
-
2679
- tree.Quoted = function (str, content, escaped, i) {
2680
- this.escaped = escaped;
2681
- this.value = content || '';
2682
- this.quote = str.charAt(0);
2683
- this.index = i;
2684
- };
2685
- tree.Quoted.prototype = {
2686
- toCSS: function () {
2687
- if (this.escaped) {
2688
- return this.value;
2689
- } else {
2690
- return this.quote + this.value + this.quote;
2691
- }
2692
- },
2693
- eval: function (env) {
2694
- var that = this;
2695
- var value = this.value.replace(/`([^`]+)`/g, function (_, exp) {
2696
- return new(tree.JavaScript)(exp, that.index, true).eval(env).value;
2697
- }).replace(/@\{([\w-]+)\}/g, function (_, name) {
2698
- var v = new(tree.Variable)('@' + name, that.index).eval(env);
2699
- return ('value' in v) ? v.value : v.toCSS();
2700
- });
2701
- return new(tree.Quoted)(this.quote + value + this.quote, value, this.escaped, this.index);
2702
- }
2703
- };
2704
-
2705
- })(require('../tree'));
2706
- (function (tree) {
2707
-
2708
- tree.Rule = function (name, value, important, index, inline) {
2709
- this.name = name;
2710
- this.value = (value instanceof tree.Value) ? value : new(tree.Value)([value]);
2711
- this.important = important ? ' ' + important.trim() : '';
2712
- this.index = index;
2713
- this.inline = inline || false;
2714
-
2715
- if (name.charAt(0) === '@') {
2716
- this.variable = true;
2717
- } else { this.variable = false }
2718
- };
2719
- tree.Rule.prototype.toCSS = function (env) {
2720
- if (this.variable) { return "" }
2721
- else {
2722
- return this.name + (env.compress ? ':' : ': ') +
2723
- this.value.toCSS(env) +
2724
- this.important + (this.inline ? "" : ";");
2725
- }
2726
- };
2727
-
2728
- tree.Rule.prototype.eval = function (context) {
2729
- return new(tree.Rule)(this.name,
2730
- this.value.eval(context),
2731
- this.important,
2732
- this.index, this.inline);
2733
- };
2734
-
2735
- tree.Shorthand = function (a, b) {
2736
- this.a = a;
2737
- this.b = b;
2738
- };
2739
-
2740
- tree.Shorthand.prototype = {
2741
- toCSS: function (env) {
2742
- return this.a.toCSS(env) + "/" + this.b.toCSS(env);
2743
- },
2744
- eval: function () { return this }
2745
- };
2746
-
2747
- })(require('../tree'));
2748
- (function (tree) {
2749
-
2750
- tree.Ruleset = function (selectors, rules, strictImports) {
2751
- this.selectors = selectors;
2752
- this.rules = rules;
2753
- this._lookups = {};
2754
- this.strictImports = strictImports;
2755
- };
2756
- tree.Ruleset.prototype = {
2757
- eval: function (env) {
2758
- var selectors = this.selectors && this.selectors.map(function (s) { return s.eval(env) });
2759
- var ruleset = new(tree.Ruleset)(selectors, this.rules.slice(0), this.strictImports);
2760
-
2761
- ruleset.root = this.root;
2762
- ruleset.allowImports = this.allowImports;
2763
-
2764
- // push the current ruleset to the frames stack
2765
- env.frames.unshift(ruleset);
2766
-
2767
- // Evaluate imports
2768
- if (ruleset.root || ruleset.allowImports || !ruleset.strictImports) {
2769
- for (var i = 0; i < ruleset.rules.length; i++) {
2770
- if (ruleset.rules[i] instanceof tree.Import) {
2771
- Array.prototype.splice
2772
- .apply(ruleset.rules, [i, 1].concat(ruleset.rules[i].eval(env)));
2773
- }
2774
- }
2775
- }
2776
-
2777
- // Store the frames around mixin definitions,
2778
- // so they can be evaluated like closures when the time comes.
2779
- for (var i = 0; i < ruleset.rules.length; i++) {
2780
- if (ruleset.rules[i] instanceof tree.mixin.Definition) {
2781
- ruleset.rules[i].frames = env.frames.slice(0);
2782
- }
2783
- }
2784
-
2785
- // Evaluate mixin calls.
2786
- for (var i = 0; i < ruleset.rules.length; i++) {
2787
- if (ruleset.rules[i] instanceof tree.mixin.Call) {
2788
- Array.prototype.splice
2789
- .apply(ruleset.rules, [i, 1].concat(ruleset.rules[i].eval(env)));
2790
- }
2791
- }
2792
-
2793
- // Evaluate everything else
2794
- for (var i = 0, rule; i < ruleset.rules.length; i++) {
2795
- rule = ruleset.rules[i];
2796
-
2797
- if (! (rule instanceof tree.mixin.Definition)) {
2798
- ruleset.rules[i] = rule.eval ? rule.eval(env) : rule;
2799
- }
2800
- }
2801
-
2802
- // Pop the stack
2803
- env.frames.shift();
2804
-
2805
- return ruleset;
2806
- },
2807
- match: function (args) {
2808
- return !args || args.length === 0;
2809
- },
2810
- variables: function () {
2811
- if (this._variables) { return this._variables }
2812
- else {
2813
- return this._variables = this.rules.reduce(function (hash, r) {
2814
- if (r instanceof tree.Rule && r.variable === true) {
2815
- hash[r.name] = r;
2816
- }
2817
- return hash;
2818
- }, {});
2819
- }
2820
- },
2821
- variable: function (name) {
2822
- return this.variables()[name];
2823
- },
2824
- rulesets: function () {
2825
- if (this._rulesets) { return this._rulesets }
2826
- else {
2827
- return this._rulesets = this.rules.filter(function (r) {
2828
- return (r instanceof tree.Ruleset) || (r instanceof tree.mixin.Definition);
2829
- });
2830
- }
2831
- },
2832
- find: function (selector, self) {
2833
- self = self || this;
2834
- var rules = [], rule, match,
2835
- key = selector.toCSS();
2836
-
2837
- if (key in this._lookups) { return this._lookups[key] }
2838
-
2839
- this.rulesets().forEach(function (rule) {
2840
- if (rule !== self) {
2841
- for (var j = 0; j < rule.selectors.length; j++) {
2842
- if (match = selector.match(rule.selectors[j])) {
2843
- if (selector.elements.length > rule.selectors[j].elements.length) {
2844
- Array.prototype.push.apply(rules, rule.find(
2845
- new(tree.Selector)(selector.elements.slice(1)), self));
2846
- } else {
2847
- rules.push(rule);
2848
- }
2849
- break;
2850
- }
2851
- }
2852
- }
2853
- });
2854
- return this._lookups[key] = rules;
2855
- },
2856
- //
2857
- // Entry point for code generation
2858
- //
2859
- // `context` holds an array of arrays.
2860
- //
2861
- toCSS: function (context, env) {
2862
- var css = [], // The CSS output
2863
- rules = [], // node.Rule instances
2864
- rulesets = [], // node.Ruleset instances
2865
- paths = [], // Current selectors
2866
- selector, // The fully rendered selector
2867
- rule;
2868
-
2869
- if (! this.root) {
2870
- if (context.length === 0) {
2871
- paths = this.selectors.map(function (s) { return [s] });
2872
- } else {
2873
- this.joinSelectors(paths, context, this.selectors);
2874
- }
2875
- }
2876
-
2877
- // Compile rules and rulesets
2878
- for (var i = 0; i < this.rules.length; i++) {
2879
- rule = this.rules[i];
2880
-
2881
- if (rule.rules || (rule instanceof tree.Directive) || (rule instanceof tree.Media)) {
2882
- rulesets.push(rule.toCSS(paths, env));
2883
- } else if (rule instanceof tree.Comment) {
2884
- if (!rule.silent) {
2885
- if (this.root) {
2886
- rulesets.push(rule.toCSS(env));
2887
- } else {
2888
- rules.push(rule.toCSS(env));
2889
- }
2890
- }
2891
- } else {
2892
- if (rule.toCSS && !rule.variable) {
2893
- rules.push(rule.toCSS(env));
2894
- } else if (rule.value && !rule.variable) {
2895
- rules.push(rule.value.toString());
2896
- }
2897
- }
2898
- }
2899
-
2900
- rulesets = rulesets.join('');
2901
-
2902
- // If this is the root node, we don't render
2903
- // a selector, or {}.
2904
- // Otherwise, only output if this ruleset has rules.
2905
- if (this.root) {
2906
- css.push(rules.join(env.compress ? '' : '\n'));
2907
- } else {
2908
- if (rules.length > 0) {
2909
- selector = paths.map(function (p) {
2910
- return p.map(function (s) {
2911
- return s.toCSS(env);
2912
- }).join('').trim();
2913
- }).join( env.compress ? ',' : ',\n');
2914
-
2915
- css.push(selector,
2916
- (env.compress ? '{' : ' {\n ') +
2917
- rules.join(env.compress ? '' : '\n ') +
2918
- (env.compress ? '}' : '\n}\n'));
2919
- }
2920
- }
2921
- css.push(rulesets);
2922
-
2923
- return css.join('') + (env.compress ? '\n' : '');
2924
- },
2925
-
2926
- joinSelectors: function (paths, context, selectors) {
2927
- for (var s = 0; s < selectors.length; s++) {
2928
- this.joinSelector(paths, context, selectors[s]);
2929
- }
2930
- },
2931
-
2932
- joinSelector: function (paths, context, selector) {
2933
- var before = [], after = [], beforeElements = [],
2934
- afterElements = [], hasParentSelector = false, el;
2935
-
2936
- for (var i = 0; i < selector.elements.length; i++) {
2937
- el = selector.elements[i];
2938
- if (el.combinator.value.charAt(0) === '&') {
2939
- hasParentSelector = true;
2940
- }
2941
- if (hasParentSelector) afterElements.push(el);
2942
- else beforeElements.push(el);
2943
- }
2944
-
2945
- if (! hasParentSelector) {
2946
- afterElements = beforeElements;
2947
- beforeElements = [];
2948
- }
2949
-
2950
- if (beforeElements.length > 0) {
2951
- before.push(new(tree.Selector)(beforeElements));
2952
- }
2953
-
2954
- if (afterElements.length > 0) {
2955
- after.push(new(tree.Selector)(afterElements));
2956
- }
2957
-
2958
- for (var c = 0; c < context.length; c++) {
2959
- paths.push(before.concat(context[c]).concat(after));
2960
- }
2961
- }
2962
- };
2963
- })(require('../tree'));
2964
- (function (tree) {
2965
-
2966
- tree.Selector = function (elements) {
2967
- this.elements = elements;
2968
- if (this.elements[0].combinator.value === "") {
2969
- this.elements[0].combinator.value = ' ';
2970
- }
2971
- };
2972
- tree.Selector.prototype.match = function (other) {
2973
- var len = this.elements.length,
2974
- olen = other.elements.length,
2975
- max = Math.min(len, olen);
2976
-
2977
- if (len < olen) {
2978
- return false;
2979
- } else {
2980
- for (var i = 0; i < max; i++) {
2981
- if (this.elements[i].value !== other.elements[i].value) {
2982
- return false;
2983
- }
2984
- }
2985
- }
2986
- return true;
2987
- };
2988
- tree.Selector.prototype.eval = function (env) {
2989
- return new(tree.Selector)(this.elements.map(function (e) {
2990
- return e.eval(env);
2991
- }));
2992
- };
2993
- tree.Selector.prototype.toCSS = function (env) {
2994
- if (this._css) { return this._css }
2995
-
2996
- return this._css = this.elements.map(function (e) {
2997
- if (typeof(e) === 'string') {
2998
- return ' ' + e.trim();
2999
- } else {
3000
- return e.toCSS(env);
3001
- }
3002
- }).join('');
3003
- };
3004
-
3005
- })(require('../tree'));
3006
- (function (tree) {
3007
-
3008
- tree.URL = function (val, paths) {
3009
- if (val.data) {
3010
- this.attrs = val;
3011
- } else {
3012
- // Add the base path if the URL is relative and we are in the browser
3013
- if (typeof(window) !== 'undefined' && !/^(?:https?:\/\/|file:\/\/|data:|\/)/.test(val.value) && paths.length > 0) {
3014
- val.value = paths[0] + (val.value.charAt(0) === '/' ? val.value.slice(1) : val.value);
3015
- }
3016
- this.value = val;
3017
- this.paths = paths;
3018
- }
3019
- };
3020
- tree.URL.prototype = {
3021
- toCSS: function () {
3022
- return "url(" + (this.attrs ? 'data:' + this.attrs.mime + this.attrs.charset + this.attrs.base64 + this.attrs.data
3023
- : this.value.toCSS()) + ")";
3024
- },
3025
- eval: function (ctx) {
3026
- return this.attrs ? this : new(tree.URL)(this.value.eval(ctx), this.paths);
3027
- }
3028
- };
3029
-
3030
- })(require('../tree'));
3031
- (function (tree) {
3032
-
3033
- tree.Value = function (value) {
3034
- this.value = value;
3035
- this.is = 'value';
3036
- };
3037
- tree.Value.prototype = {
3038
- eval: function (env) {
3039
- if (this.value.length === 1) {
3040
- return this.value[0].eval(env);
3041
- } else {
3042
- return new(tree.Value)(this.value.map(function (v) {
3043
- return v.eval(env);
3044
- }));
3045
- }
3046
- },
3047
- toCSS: function (env) {
3048
- return this.value.map(function (e) {
3049
- return e.toCSS(env);
3050
- }).join(env.compress ? ',' : ', ');
3051
- }
3052
- };
3053
-
3054
- })(require('../tree'));
3055
- (function (tree) {
3056
-
3057
- tree.Variable = function (name, index, file) { this.name = name, this.index = index, this.file = file };
3058
- tree.Variable.prototype = {
3059
- eval: function (env) {
3060
- var variable, v, name = this.name;
3061
-
3062
- if (name.indexOf('@@') == 0) {
3063
- name = '@' + new(tree.Variable)(name.slice(1)).eval(env).value;
3064
- }
3065
-
3066
- if (variable = tree.find(env.frames, function (frame) {
3067
- if (v = frame.variable(name)) {
3068
- return v.value.eval(env);
3069
- }
3070
- })) { return variable }
3071
- else {
3072
- throw { type: 'Name',
3073
- message: "variable " + name + " is undefined",
3074
- filename: this.file,
3075
- index: this.index };
3076
- }
3077
- }
3078
- };
3079
-
3080
- })(require('../tree'));
3081
- (function (tree) {
3082
-
3083
- tree.find = function (obj, fun) {
3084
- for (var i = 0, r; i < obj.length; i++) {
3085
- if (r = fun.call(obj, obj[i])) { return r }
3086
- }
3087
- return null;
3088
- };
3089
- tree.jsify = function (obj) {
3090
- if (Array.isArray(obj.value) && (obj.value.length > 1)) {
3091
- return '[' + obj.value.map(function (v) { return v.toCSS(false) }).join(', ') + ']';
3092
- } else {
3093
- return obj.toCSS(false);
3094
- }
3095
- };
3096
-
3097
- })(require('./tree'));
3098
- //
3099
- // browser.js - client-side engine
3100
- //
3101
-
3102
- var isFileProtocol = (location.protocol === 'file:' ||
3103
- location.protocol === 'chrome:' ||
3104
- location.protocol === 'chrome-extension:' ||
3105
- location.protocol === 'resource:');
3106
-
3107
- less.env = less.env || (location.hostname == '127.0.0.1' ||
3108
- location.hostname == '0.0.0.0' ||
3109
- location.hostname == 'localhost' ||
3110
- location.port.length > 0 ||
3111
- isFileProtocol ? 'development'
3112
- : 'production');
3113
-
3114
- // Load styles asynchronously (default: false)
3115
- //
3116
- // This is set to `false` by default, so that the body
3117
- // doesn't start loading before the stylesheets are parsed.
3118
- // Setting this to `true` can result in flickering.
3119
- //
3120
- less.async = false;
3121
-
3122
- // Interval between watch polls
3123
- less.poll = less.poll || (isFileProtocol ? 1000 : 1500);
3124
-
3125
- //
3126
- // Watch mode
3127
- //
3128
- less.watch = function () { return this.watchMode = true };
3129
- less.unwatch = function () { return this.watchMode = false };
3130
-
3131
- if (less.env === 'development') {
3132
- less.optimization = 0;
3133
-
3134
- if (/!watch/.test(location.hash)) {
3135
- less.watch();
3136
- }
3137
- less.watchTimer = setInterval(function () {
3138
- if (less.watchMode) {
3139
- loadStyleSheets(function (e, root, _, sheet, env) {
3140
- if (root) {
3141
- createCSS(root.toCSS(), sheet, env.lastModified);
3142
- }
3143
- });
3144
- }
3145
- }, less.poll);
3146
- } else {
3147
- less.optimization = 3;
3148
- }
3149
-
3150
- var cache;
3151
-
3152
- try {
3153
- cache = (typeof(window.localStorage) === 'undefined') ? null : window.localStorage;
3154
- } catch (_) {
3155
- cache = null;
3156
- }
3157
-
3158
- //
3159
- // Get all <link> tags with the 'rel' attribute set to "stylesheet/less"
3160
- //
3161
- var links = document.getElementsByTagName('link');
3162
- var typePattern = /^text\/(x-)?less$/;
3163
-
3164
- less.sheets = [];
3165
-
3166
- for (var i = 0; i < links.length; i++) {
3167
- if (links[i].rel === 'stylesheet/less' || (links[i].rel.match(/stylesheet/) &&
3168
- (links[i].type.match(typePattern)))) {
3169
- less.sheets.push(links[i]);
3170
- }
3171
- }
3172
-
3173
-
3174
- less.refresh = function (reload) {
3175
- var startTime, endTime;
3176
- startTime = endTime = new(Date);
3177
-
3178
- loadStyleSheets(function (e, root, _, sheet, env) {
3179
- if (env.local) {
3180
- log("loading " + sheet.href + " from cache.");
3181
- } else {
3182
- log("parsed " + sheet.href + " successfully.");
3183
- createCSS(root.toCSS(), sheet, env.lastModified);
3184
- }
3185
- log("css for " + sheet.href + " generated in " + (new(Date) - endTime) + 'ms');
3186
- (env.remaining === 0) && log("css generated in " + (new(Date) - startTime) + 'ms');
3187
- endTime = new(Date);
3188
- }, reload);
3189
-
3190
- loadStyles();
3191
- };
3192
- less.refreshStyles = loadStyles;
3193
-
3194
- less.refresh(less.env === 'development');
3195
-
3196
- function loadStyles() {
3197
- var styles = document.getElementsByTagName('style');
3198
- for (var i = 0; i < styles.length; i++) {
3199
- if (styles[i].type.match(typePattern)) {
3200
- new(less.Parser)().parse(styles[i].innerHTML || '', function (e, tree) {
3201
- var css = tree.toCSS();
3202
- var style = styles[i];
3203
- style.type = 'text/css';
3204
- if (style.styleSheet) {
3205
- style.styleSheet.cssText = css;
3206
- } else {
3207
- style.innerHTML = css;
3208
- }
3209
- });
3210
- }
3211
- }
3212
- }
3213
-
3214
- function loadStyleSheets(callback, reload) {
3215
- for (var i = 0; i < less.sheets.length; i++) {
3216
- loadStyleSheet(less.sheets[i], callback, reload, less.sheets.length - (i + 1));
3217
- }
3218
- }
3219
-
3220
- function loadStyleSheet(sheet, callback, reload, remaining) {
3221
- var url = window.location.href.replace(/[#?].*$/, '');
3222
- var href = sheet.href.replace(/\?.*$/, '');
3223
- var css = cache && cache.getItem(href);
3224
- var timestamp = cache && cache.getItem(href + ':timestamp');
3225
- var styles = { css: css, timestamp: timestamp };
3226
-
3227
- // Stylesheets in IE don't always return the full path
3228
- if (! /^(https?|file):/.test(href)) {
3229
- if (href.charAt(0) == "/") {
3230
- href = window.location.protocol + "//" + window.location.host + href;
3231
- } else {
3232
- href = url.slice(0, url.lastIndexOf('/') + 1) + href;
3233
- }
3234
- }
3235
- var filename = href.match(/([^\/]+)$/)[1];
3236
-
3237
- xhr(sheet.href, sheet.type, function (data, lastModified) {
3238
- if (!reload && styles && lastModified &&
3239
- (new(Date)(lastModified).valueOf() ===
3240
- new(Date)(styles.timestamp).valueOf())) {
3241
- // Use local copy
3242
- createCSS(styles.css, sheet);
3243
- callback(null, null, data, sheet, { local: true, remaining: remaining });
3244
- } else {
3245
- // Use remote copy (re-parse)
3246
- try {
3247
- new(less.Parser)({
3248
- optimization: less.optimization,
3249
- paths: [href.replace(/[\w\.-]+$/, '')],
3250
- mime: sheet.type,
3251
- filename: filename
3252
- }).parse(data, function (e, root) {
3253
- if (e) { return error(e, href) }
3254
- try {
3255
- callback(e, root, data, sheet, { local: false, lastModified: lastModified, remaining: remaining });
3256
- removeNode(document.getElementById('less-error-message:' + extractId(href)));
3257
- } catch (e) {
3258
- error(e, href);
3259
- }
3260
- });
3261
- } catch (e) {
3262
- error(e, href);
3263
- }
3264
- }
3265
- }, function (status, url) {
3266
- throw new(Error)("Couldn't load " + url + " (" + status + ")");
3267
- });
3268
- }
3269
-
3270
- function extractId(href) {
3271
- return href.replace(/^[a-z]+:\/\/?[^\/]+/, '' ) // Remove protocol & domain
3272
- .replace(/^\//, '' ) // Remove root /
3273
- .replace(/\?.*$/, '' ) // Remove query
3274
- .replace(/\.[^\.\/]+$/, '' ) // Remove file extension
3275
- .replace(/[^\.\w-]+/g, '-') // Replace illegal characters
3276
- .replace(/\./g, ':'); // Replace dots with colons(for valid id)
3277
- }
3278
-
3279
- function createCSS(styles, sheet, lastModified) {
3280
- var css;
3281
-
3282
- // Strip the query-string
3283
- var href = sheet.href ? sheet.href.replace(/\?.*$/, '') : '';
3284
-
3285
- // If there is no title set, use the filename, minus the extension
3286
- var id = 'less:' + (sheet.title || extractId(href));
3287
-
3288
- // If the stylesheet doesn't exist, create a new node
3289
- if ((css = document.getElementById(id)) === null) {
3290
- css = document.createElement('style');
3291
- css.type = 'text/css';
3292
- css.media = sheet.media || 'screen';
3293
- css.id = id;
3294
- document.getElementsByTagName('head')[0].appendChild(css);
3295
- }
3296
-
3297
- if (css.styleSheet) { // IE
3298
- try {
3299
- css.styleSheet.cssText = styles;
3300
- } catch (e) {
3301
- throw new(Error)("Couldn't reassign styleSheet.cssText.");
3302
- }
3303
- } else {
3304
- (function (node) {
3305
- if (css.childNodes.length > 0) {
3306
- if (css.firstChild.nodeValue !== node.nodeValue) {
3307
- css.replaceChild(node, css.firstChild);
3308
- }
3309
- } else {
3310
- css.appendChild(node);
3311
- }
3312
- })(document.createTextNode(styles));
3313
- }
3314
-
3315
- // Don't update the local store if the file wasn't modified
3316
- if (lastModified && cache) {
3317
- log('saving ' + href + ' to cache.');
3318
- cache.setItem(href, styles);
3319
- cache.setItem(href + ':timestamp', lastModified);
3320
- }
3321
- }
3322
-
3323
- function xhr(url, type, callback, errback) {
3324
- var xhr = getXMLHttpRequest();
3325
- var async = isFileProtocol ? false : less.async;
3326
-
3327
- if (typeof(xhr.overrideMimeType) === 'function') {
3328
- xhr.overrideMimeType('text/css');
3329
- }
3330
- xhr.open('GET', url, async);
3331
- xhr.setRequestHeader('Accept', type || 'text/x-less, text/css; q=0.9, */*; q=0.5');
3332
- xhr.send(null);
3333
-
3334
- if (isFileProtocol) {
3335
- if (xhr.status === 0 || (xhr.status >= 200 && xhr.status < 300)) {
3336
- callback(xhr.responseText);
3337
- } else {
3338
- errback(xhr.status, url);
3339
- }
3340
- } else if (async) {
3341
- xhr.onreadystatechange = function () {
3342
- if (xhr.readyState == 4) {
3343
- handleResponse(xhr, callback, errback);
3344
- }
3345
- };
3346
- } else {
3347
- handleResponse(xhr, callback, errback);
3348
- }
3349
-
3350
- function handleResponse(xhr, callback, errback) {
3351
- if (xhr.status >= 200 && xhr.status < 300) {
3352
- callback(xhr.responseText,
3353
- xhr.getResponseHeader("Last-Modified"));
3354
- } else if (typeof(errback) === 'function') {
3355
- errback(xhr.status, url);
3356
- }
3357
- }
3358
- }
3359
-
3360
- function getXMLHttpRequest() {
3361
- if (window.XMLHttpRequest) {
3362
- return new(XMLHttpRequest);
3363
- } else {
3364
- try {
3365
- return new(ActiveXObject)("MSXML2.XMLHTTP.3.0");
3366
- } catch (e) {
3367
- log("browser doesn't support AJAX.");
3368
- return null;
3369
- }
3370
- }
3371
- }
3372
-
3373
- function removeNode(node) {
3374
- return node && node.parentNode.removeChild(node);
3375
- }
3376
-
3377
- function log(str) {
3378
- if (less.env == 'development' && typeof(console) !== "undefined") { console.log('less: ' + str) }
3379
- }
3380
-
3381
- function error(e, href) {
3382
- var id = 'less-error-message:' + extractId(href);
3383
- var template = '<li><label>{line}</label><pre class="{class}">{content}</pre></li>';
3384
- var elem = document.createElement('div'), timer, content, error = [];
3385
- var filename = e.filename || href;
3386
-
3387
- elem.id = id;
3388
- elem.className = "less-error-message";
3389
-
3390
- content = '<h3>' + (e.message || 'There is an error in your .less file') +
3391
- '</h3>' + '<p>in <a href="' + filename + '">' + filename + "</a> ";
3392
-
3393
- var errorline = function (e, i, classname) {
3394
- if (e.extract[i]) {
3395
- error.push(template.replace(/\{line\}/, parseInt(e.line) + (i - 1))
3396
- .replace(/\{class\}/, classname)
3397
- .replace(/\{content\}/, e.extract[i]));
3398
- }
3399
- };
3400
-
3401
- if (e.stack) {
3402
- content += '<br/>' + e.stack.split('\n').slice(1).join('<br/>');
3403
- } else if (e.extract) {
3404
- errorline(e, 0, '');
3405
- errorline(e, 1, 'line');
3406
- errorline(e, 2, '');
3407
- content += 'on line ' + e.line + ', column ' + (e.column + 1) + ':</p>' +
3408
- '<ul>' + error.join('') + '</ul>';
3409
- }
3410
- elem.innerHTML = content;
3411
-
3412
- // CSS for error messages
3413
- createCSS([
3414
- '.less-error-message ul, .less-error-message li {',
3415
- 'list-style-type: none;',
3416
- 'margin-right: 15px;',
3417
- 'padding: 4px 0;',
3418
- 'margin: 0;',
3419
- '}',
3420
- '.less-error-message label {',
3421
- 'font-size: 12px;',
3422
- 'margin-right: 15px;',
3423
- 'padding: 4px 0;',
3424
- 'color: #cc7777;',
3425
- '}',
3426
- '.less-error-message pre {',
3427
- 'color: #dd6666;',
3428
- 'padding: 4px 0;',
3429
- 'margin: 0;',
3430
- 'display: inline-block;',
3431
- '}',
3432
- '.less-error-message pre.line {',
3433
- 'color: #ff0000;',
3434
- '}',
3435
- '.less-error-message h3 {',
3436
- 'font-size: 20px;',
3437
- 'font-weight: bold;',
3438
- 'padding: 15px 0 5px 0;',
3439
- 'margin: 0;',
3440
- '}',
3441
- '.less-error-message a {',
3442
- 'color: #10a',
3443
- '}',
3444
- '.less-error-message .error {',
3445
- 'color: red;',
3446
- 'font-weight: bold;',
3447
- 'padding-bottom: 2px;',
3448
- 'border-bottom: 1px dashed red;',
3449
- '}'
3450
- ].join('\n'), { title: 'error-message' });
3451
-
3452
- elem.style.cssText = [
3453
- "font-family: Arial, sans-serif",
3454
- "border: 1px solid #e00",
3455
- "background-color: #eee",
3456
- "border-radius: 5px",
3457
- "-webkit-border-radius: 5px",
3458
- "-moz-border-radius: 5px",
3459
- "color: #e00",
3460
- "padding: 15px",
3461
- "margin-bottom: 15px"
3462
- ].join(';');
3463
-
3464
- if (less.env == 'development') {
3465
- timer = setInterval(function () {
3466
- if (document.body) {
3467
- if (document.getElementById(id)) {
3468
- document.body.replaceChild(elem, document.getElementById(id));
3469
- } else {
3470
- document.body.insertBefore(elem, document.body.firstChild);
3471
- }
3472
- clearInterval(timer);
3473
- }
3474
- }, 10);
3475
- }
3476
- }
3477
-
3478
- })(window);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
scripts-n-styles.php CHANGED
@@ -5,27 +5,29 @@ Plugin URI: http://www.unfocus.com/projects/scripts-n-styles/
5
  Description: Allows WordPress admin users the ability to add custom CSS and JavaScript directly to individual Post, Pages or custom post types.
6
  Author: unFocus Projects
7
  Author URI: http://www.unfocus.com/
8
- Version: 3.1.1
9
  License: GPLv3 or later
10
  Text Domain: scripts-n-styles
11
  Network: true
12
  */
13
 
14
- /* Copyright 2010-2012 Kenneth Newman www.unfocus.com
 
 
 
15
 
16
- This program is free software; you can redistribute it and/or
17
  modify it under the terms of the GNU General Public License
18
  as published by the Free Software Foundation; either version 3
19
  of the License, or (at your option) any later version.
20
 
21
- This program is distributed in the hope that it will be useful,
22
  but WITHOUT ANY WARRANTY; without even the implied warranty of
23
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
  GNU General Public License for more details.
25
 
26
  You should have received a copy of the GNU General Public License
27
- along with this program; if not, write to the Free Software
28
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29
 
30
  This file incorporates work covered by other licenses and permissions.
31
  */
@@ -49,24 +51,17 @@ Network: true
49
  * @link http://www.unfocus.com/projects/scripts-n-styles/ Plugin URI
50
  * @author unFocus Projects
51
  * @link http://www.unfocus.com/ Author URI
52
- * @version 3.1.1
53
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
54
  * @copyright Copyright (c) 2010 - 2012, Kenneth Newman
 
 
55
  *
56
- * @todo Add Post Type Selection on Options Page? Not sure that's useful.
57
- * @todo Add Conditional Tags support as alternative to Globally applying Scripts n Styles.
58
  * @todo Create ability to add and register scripts and styles for enqueueing (via Options page).
59
  * @todo Create selection on Option page of which to pick registered scripts to make available on edit screens.
60
- * @todo Create shortcode to embed html/javascript snippets. See http://scribu.net/wordpress/optimal-script-loading.html in which this is already figured out :-)
61
  * @todo Create shortcode registration on Options page to make those snippets available on edit screens.
62
- * @todo Create shortcode registration of html snippets on edit screens for single use.
63
  * @todo Add Error messaging.
64
- * @todo Replace Multi-Select element with something better.
65
- * @todo "Include Scripts" will be reintroduced when registering is finished.
66
  * @todo Clean up tiny_mce_before_init in SnS_Admin_Meta_Box.
67
- * @todo LESS.js support.
68
- * @todo LESS.js highlighting support to CodeMirror.
69
- * @todo Solarize theme to CodeMirror.
70
  */
71
 
72
  class Scripts_n_Styles
@@ -74,8 +69,9 @@ class Scripts_n_Styles
74
  /**#@+
75
  * @static
76
  */
77
- const VERSION = '3.1.1';
78
  static $file = __FILE__;
 
79
  /**#@-*/
80
 
81
  /**
@@ -88,7 +84,7 @@ class Scripts_n_Styles
88
  true in the wp-config.php would effectively disable this
89
  plugin's admin because no user would have the capability.
90
  */
91
- include_once( 'includes/class.SnS_Admin.php' );
92
  SnS_Admin::init();
93
  }
94
  add_action( 'plugins_loaded', array( __CLASS__, 'upgrade_check' ) );
@@ -101,24 +97,83 @@ class Scripts_n_Styles
101
  add_action( 'wp_head', array( __CLASS__, 'scripts_in_head' ), 11 );
102
  add_action( 'wp_footer', array( __CLASS__, 'scripts' ), 11 );
103
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  add_shortcode( 'sns_shortcode', array( __CLASS__, 'shortcode' ) );
 
105
  }
106
-
107
  function shortcode( $atts, $content = null, $tag ) {
108
- global $post;
109
-
110
- if ( isset( $post->ID ) ) $id = $post->ID;
111
- else $id = get_the_ID();
112
- if ( ! $id ) return '<pre>There was an error.</pre>';
113
 
114
  extract( shortcode_atts( array( 'name' => 0, ), $atts ) );
115
  $output = '';
116
 
117
- $SnS = get_post_meta( $post->ID, '_SnS', true );
 
 
 
118
  $shortcodes = isset( $SnS['shortcodes'] ) ? $SnS[ 'shortcodes' ]: array();
 
119
  if ( isset( $shortcodes[ $name ] ) )
120
  $output .= $shortcodes[ $name ];
121
- if ( isset( $content ) && empty( $output ) ) $output = $content;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  $output = do_shortcode( $output );
123
 
124
  return $output;
@@ -187,9 +242,62 @@ class Scripts_n_Styles
187
  'user-profile',
188
  'admin-bar',
189
  'wplink',
190
- 'wpdialogs-popup'
 
 
 
191
  );
192
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
 
194
  /**
195
  * Theme Action: 'wp_head()'
@@ -233,6 +341,11 @@ class Scripts_n_Styles
233
  echo $options[ 'scripts' ];
234
  ?></script><?php
235
  }
 
 
 
 
 
236
 
237
  if ( ! is_singular() ) return;
238
  // Individual
@@ -342,7 +455,7 @@ class Scripts_n_Styles
342
  static function upgrade_check() {
343
  $options = get_option( 'SnS_options' );
344
  if ( ! isset( $options[ 'version' ] ) || version_compare( self::VERSION, $options[ 'version' ], '>' ) ) {
345
- include_once( 'includes/class.SnS_Admin.php' );
346
  SnS_Admin::upgrade();
347
  }
348
  }
@@ -350,4 +463,65 @@ class Scripts_n_Styles
350
 
351
  Scripts_n_Styles::init();
352
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
353
  ?>
5
  Description: Allows WordPress admin users the ability to add custom CSS and JavaScript directly to individual Post, Pages or custom post types.
6
  Author: unFocus Projects
7
  Author URI: http://www.unfocus.com/
8
+ Version: 3.2
9
  License: GPLv3 or later
10
  Text Domain: scripts-n-styles
11
  Network: true
12
  */
13
 
14
+ /* The Scripts n Styles WordPress Plugin
15
+ Copyright (c) 2010-2012 Kenneth Newman <http://www.unfocus.com/>
16
+ Copyright (c) 2012 Kevin Newman <http://www.unfocus.com/>
17
+ Copyright (c) 2012 adcSTUDIO LLC <http://www.adcstudio.com/>
18
 
19
+ Scripts n Styles is free software; you can redistribute it and/or
20
  modify it under the terms of the GNU General Public License
21
  as published by the Free Software Foundation; either version 3
22
  of the License, or (at your option) any later version.
23
 
24
+ Scripts n Styles is distributed in the hope that it will be useful,
25
  but WITHOUT ANY WARRANTY; without even the implied warranty of
26
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27
  GNU General Public License for more details.
28
 
29
  You should have received a copy of the GNU General Public License
30
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
 
31
 
32
  This file incorporates work covered by other licenses and permissions.
33
  */
51
  * @link http://www.unfocus.com/projects/scripts-n-styles/ Plugin URI
52
  * @author unFocus Projects
53
  * @link http://www.unfocus.com/ Author URI
54
+ * @version 3.2
55
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
56
  * @copyright Copyright (c) 2010 - 2012, Kenneth Newman
57
+ * @copyright Copyright (c) 2012, Kevin Newman
58
+ * @copyright Copyright (c) 2012, adcSTUDIO LLC
59
  *
 
 
60
  * @todo Create ability to add and register scripts and styles for enqueueing (via Options page).
61
  * @todo Create selection on Option page of which to pick registered scripts to make available on edit screens.
 
62
  * @todo Create shortcode registration on Options page to make those snippets available on edit screens.
 
63
  * @todo Add Error messaging.
 
 
64
  * @todo Clean up tiny_mce_before_init in SnS_Admin_Meta_Box.
 
 
 
65
  */
66
 
67
  class Scripts_n_Styles
69
  /**#@+
70
  * @static
71
  */
72
+ const VERSION = '3.2';
73
  static $file = __FILE__;
74
+ static $cm_themes = array( 'default', 'ambiance', 'blackboard', 'cobalt', 'eclipse', 'elegant', 'lesser-dark', 'monokai', 'neat', 'night', 'rubyblue', 'xq-dark' );
75
  /**#@-*/
76
 
77
  /**
84
  true in the wp-config.php would effectively disable this
85
  plugin's admin because no user would have the capability.
86
  */
87
+ include_once( 'includes/class-sns-admin.php' );
88
  SnS_Admin::init();
89
  }
90
  add_action( 'plugins_loaded', array( __CLASS__, 'upgrade_check' ) );
97
  add_action( 'wp_head', array( __CLASS__, 'scripts_in_head' ), 11 );
98
  add_action( 'wp_footer', array( __CLASS__, 'scripts' ), 11 );
99
 
100
+ add_action( 'plugins_loaded', array( __CLASS__, 'add_shortcodes' ) );
101
+ add_action( 'widgets_init', array( __CLASS__, 'add_widget' ) );
102
+
103
+ add_action( 'wp_enqueue_scripts', array( __CLASS__, 'register' ) );
104
+ add_action( 'admin_enqueue_scripts', array( __CLASS__, 'register' ) );
105
+
106
+ add_action( 'wp_print_styles', array( __CLASS__, 'theme_style' ) );
107
+ add_action( 'wp_ajax_sns_theme_css', array( __CLASS__, 'theme_css' ) );
108
+ add_action( 'wp_ajax_nopriv_sns_theme_css', array( __CLASS__, 'theme_css' ) );
109
+ }
110
+ function theme_style() {
111
+ if ( current_theme_supports( 'scripts-n-styles' ) ) {
112
+ $options = get_option( 'SnS_options' );
113
+ $slug = get_stylesheet();
114
+
115
+ if ( ! empty( $options[ 'themes' ][ $slug ][ 'compiled' ] ) ) {
116
+ wp_deregister_style( 'theme_style' );
117
+ wp_enqueue_style( 'theme_style', add_query_arg( array( 'action' => 'sns_theme_css' ), admin_url( "admin-ajax.php" ) ) );
118
+ }
119
+ }
120
+ }
121
+ function theme_css() {
122
+ $options = get_option( 'SnS_options' );
123
+ $slug = get_stylesheet();
124
+ $compiled = $options[ 'themes' ][ $slug ][ 'compiled' ];
125
+ header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + 864000 ) . ' GMT');
126
+ header("Cache-Control: public, max-age=864000");
127
+ header('Content-Type: text/css; charset=UTF-8');
128
+ echo $compiled;
129
+ die();
130
+ }
131
+ function add_widget() {
132
+ $options = get_option( 'SnS_options' );
133
+ if ( isset( $options[ 'hoops_widget' ] ) && 'yes' == $options[ 'hoops_widget' ] )
134
+ register_widget( 'SnS_Widget' );
135
+ }
136
+ function add_shortcodes() {
137
  add_shortcode( 'sns_shortcode', array( __CLASS__, 'shortcode' ) );
138
+ add_shortcode( 'hoops', array( __CLASS__, 'shortcode' ) );
139
  }
 
140
  function shortcode( $atts, $content = null, $tag ) {
141
+ $id = get_the_ID();
 
 
 
 
142
 
143
  extract( shortcode_atts( array( 'name' => 0, ), $atts ) );
144
  $output = '';
145
 
146
+ $options = get_option( 'SnS_options' );
147
+ $hoops = isset( $options['hoops']['shortcodes'] ) ? $options['hoops']['shortcodes'] : array();
148
+
149
+ $SnS = get_post_meta( $id, '_SnS', true );
150
  $shortcodes = isset( $SnS['shortcodes'] ) ? $SnS[ 'shortcodes' ]: array();
151
+
152
  if ( isset( $shortcodes[ $name ] ) )
153
  $output .= $shortcodes[ $name ];
154
+ else if ( isset( $hoops[ $name ] ) )
155
+ $output .= $hoops[ $name ];
156
+
157
+ if ( ! empty( $content ) && empty( $output ) )
158
+ $output = $content;
159
+ $output = do_shortcode( $output );
160
+
161
+ return $output;
162
+ }
163
+ function hoops_widget( $atts, $content = null, $tag ) {
164
+ $options = get_option( 'SnS_options' );
165
+ $hoops = $options['hoops']['shortcodes'];
166
+
167
+ extract( shortcode_atts( array( 'name' => 0, ), $atts ) );
168
+ $output = '';
169
+
170
+ $shortcodes = isset( $SnS['shortcodes'] ) ? $SnS[ 'shortcodes' ]: array();
171
+
172
+ if ( isset( $hoops[ $name ] ) )
173
+ $output .= $hoops[ $name ];
174
+
175
+ if ( ! empty( $content ) && empty( $output ) )
176
+ $output = $content;
177
  $output = do_shortcode( $output );
178
 
179
  return $output;
242
  'user-profile',
243
  'admin-bar',
244
  'wplink',
245
+ 'wpdialogs-popup',
246
+ 'less.js',
247
+ 'coffeescript',
248
+ 'chosen',
249
  );
250
  }
251
+ function register() {
252
+ $dir = plugins_url( '/', __FILE__);
253
+ $js = $dir . 'js/';
254
+ $css = $dir . 'css/';
255
+ $cm_version = '2.25';
256
+ $chosen_version = '0.9.8';
257
+ $cm_dir = $dir . 'vendor/CodeMirror2/';
258
+ $less_dir = $dir . 'vendor/';
259
+ $coffee_dir = $dir . 'vendor/';
260
+ $chosen_dir = $dir . 'vendor/chosen/';
261
+ //$localize = array( 'theme' => $cm_theme );
262
+ $options = get_option( 'SnS_options' );
263
+ $cm_theme = isset( $options[ 'cm_theme' ] ) ? $options[ 'cm_theme' ] : 'default';
264
+
265
+ wp_register_script( 'less.js', $less_dir . 'less.js', array(), '1.3.0-min' );
266
+ wp_register_script( 'coffeescript', $coffee_dir . 'coffee-script.js', array(), '1.3.3-min' );
267
+ wp_register_script( 'chosen', $chosen_dir . 'chosen.jquery.min.js', array( 'jquery' ), $chosen_version, true );
268
+ wp_register_style( 'chosen', $chosen_dir . 'chosen.css', array(), $chosen_version );
269
+
270
+ wp_register_script( 'codemirror', $cm_dir . 'lib/codemirror.js', array(), $cm_version );
271
+ wp_register_script( 'codemirror-css', $cm_dir . 'mode/css/css.js', array( 'codemirror' ), $cm_version );
272
+ wp_register_script( 'codemirror-coffeescript', $cm_dir . 'mode/coffeescript/coffeescript.js', array( 'codemirror' ), $cm_version );
273
+ wp_register_script( 'codemirror-less', $cm_dir . 'mode/less/less.js', array( 'codemirror' ), $cm_version );
274
+ wp_register_script( 'codemirror-javascript', $cm_dir . 'mode/javascript/javascript.js', array( 'codemirror' ), $cm_version );
275
+ wp_register_script( 'codemirror-xml', $cm_dir . 'mode/xml/xml.js', array( 'codemirror' ), $cm_version );
276
+ wp_register_script( 'codemirror-clike', $cm_dir . 'mode/clike/clike.js', array( 'codemirror' ), $cm_version );
277
+ wp_register_script( 'codemirror-markdown', $cm_dir . 'mode/markdown/markdown.js', array( 'codemirror-xml' ), $cm_version );
278
+ wp_register_script( 'codemirror-gfm', $cm_dir . 'mode/gfm/gfm.js', array( 'codemirror-php', 'codemirror-htmlmixed' ), $cm_version );
279
+ wp_register_script( 'codemirror-htmlmixed', $cm_dir . 'mode/htmlmixed/htmlmixed.js', array( 'codemirror-xml', 'codemirror-css', 'codemirror-javascript' ), $cm_version );
280
+ wp_register_script( 'codemirror-php', $cm_dir . 'mode/php/php.js', array( 'codemirror-xml', 'codemirror-css', 'codemirror-javascript', 'codemirror-clike' ), $cm_version );
281
+
282
+ wp_register_style( 'codemirror-default', $cm_dir . 'lib/codemirror.css', array(), $cm_version );
283
+ foreach ( self::$cm_themes as $theme ) if ( 'default' !== $theme )
284
+ wp_register_style( "codemirror-$theme", $cm_dir . "theme/$theme.css", array( 'codemirror-default' ), $cm_version );
285
+
286
+ if ( 'default' == $cm_theme )
287
+ wp_register_style( 'codemirror-theme', $cm_dir . 'lib/codemirror.css', array(), $cm_version );
288
+ else
289
+ wp_register_style( 'codemirror-theme', $cm_dir . "theme/$cm_theme.css", array( 'codemirror-default' ), $cm_version );
290
+
291
+ wp_register_style( 'sns-options', $css . 'options-styles.css', array(), self::VERSION );
292
+ wp_register_script( 'sns-global-page', $js . 'global-page.js', array( 'jquery', 'codemirror-less', 'codemirror-coffeescript', 'codemirror-css', 'codemirror-javascript', 'less.js', 'coffeescript', 'chosen' ), self::VERSION, true );
293
+ wp_register_script( 'sns-theme-page', $js . 'theme-page.js', array( 'jquery', 'codemirror-css', 'codemirror-less', 'less.js', ), self::VERSION, true );
294
+ wp_register_script( 'sns-hoops-page', $js . 'hoops-page.js', array( 'jquery', 'codemirror-htmlmixed' ), self::VERSION, true );
295
+ wp_register_script( 'sns-settings-page', $js . 'settings-page.js', array( 'jquery', 'codemirror-php' ), self::VERSION, true );
296
+ wp_register_style( 'sns-meta-box', $css . 'meta-box.css', array( 'codemirror-theme' ), self::VERSION );
297
+ wp_register_script( 'sns-meta-box', $js . 'meta-box.js', array( 'editor', 'jquery-ui-tabs', 'codemirror-less', 'codemirror-htmlmixed', 'chosen' ), self::VERSION, true );
298
+ wp_register_style( 'sns-code-editor', $css . 'code-editor.css', array( 'codemirror-theme' ), self::VERSION );
299
+ wp_register_script( 'sns-code-editor', $js . 'code-editor.js', array( 'editor', 'jquery-ui-tabs', 'codemirror-less', 'codemirror-coffeescript', 'codemirror-htmlmixed', 'codemirror-php', 'codemirror-markdown' ), self::VERSION, true );
300
+ }
301
 
302
  /**
303
  * Theme Action: 'wp_head()'
341
  echo $options[ 'scripts' ];
342
  ?></script><?php
343
  }
344
+ if ( ! empty( $options ) && ! empty( $options[ 'coffee_compiled' ] ) ) {
345
+ ?><script type="text/javascript" id="sns_global_coffee_compiled"><?php
346
+ echo $options[ 'coffee_compiled' ];
347
+ ?></script><?php
348
+ }
349
 
350
  if ( ! is_singular() ) return;
351
  // Individual
455
  static function upgrade_check() {
456
  $options = get_option( 'SnS_options' );
457
  if ( ! isset( $options[ 'version' ] ) || version_compare( self::VERSION, $options[ 'version' ], '>' ) ) {
458
+ include_once( 'includes/class-sns-admin.php' );
459
  SnS_Admin::upgrade();
460
  }
461
  }
463
 
464
  Scripts_n_Styles::init();
465
 
466
+ class SnS_Widget extends WP_Widget
467
+ {
468
+ function __construct() {
469
+ $widget_ops = array( 'classname' => 'sns_widget_text', 'description' => __( 'Arbitrary text or HTML (including "hoops" shortcodes)', 'scripts-n-styles' ) );
470
+ $control_ops = array( 'width' => 400, 'height' => 350 );
471
+ parent::__construct( 'sns_hoops', __( 'Hoops', 'scripts-n-styles' ), $widget_ops, $control_ops );
472
+ }
473
+
474
+ function widget( $args, $instance ) {
475
+ global $shortcode_tags;
476
+
477
+ extract( $args );
478
+ $title = apply_filters( 'widget_title', empty( $instance[ 'title' ] ) ? '' : $instance[ 'title' ], $instance, $this->id_base );
479
+ $text = apply_filters( 'widget_text', empty( $instance[ 'text' ] ) ? '' : $instance[ 'text' ], $instance );
480
+
481
+ echo $before_widget;
482
+ if ( ! empty( $title ) )
483
+ echo $before_title . $title . $after_title;
484
+ echo '<div class="hoopstextwidget">';
485
+ $content = ! empty( $instance[ 'filter' ] ) ? wpautop( $text ) : $text;
486
+
487
+ $backup = $shortcode_tags;
488
+ remove_all_shortcodes();
489
+
490
+ add_shortcode( 'sns_shortcode', array( 'Scripts_n_Styles', 'hoops_widget' ) );
491
+ add_shortcode( 'hoops', array( 'Scripts_n_Styles', 'hoops_widget' ) );
492
+
493
+ $content = do_shortcode( $content );
494
+
495
+ $shortcode_tags = $backup;
496
+
497
+ echo $content;
498
+ echo '</div>';
499
+ echo $after_widget;
500
+ }
501
+
502
+ function update( $new_instance, $old_instance ) {
503
+ $instance = $old_instance;
504
+ $instance[ 'title' ] = strip_tags( $new_instance[ 'title' ] );
505
+ if ( current_user_can( 'unfiltered_html' ) )
506
+ $instance[ 'text' ] = $new_instance[ 'text' ];
507
+ else
508
+ $instance[ 'text' ] = stripslashes( wp_filter_post_kses( addslashes( $new_instance[ 'text' ] ) ) ); // wp_filter_post_kses() expects slashed
509
+ $instance[ 'filter' ] = isset( $new_instance[ 'filter' ] );
510
+ return $instance;
511
+ }
512
+
513
+ function form( $instance ) {
514
+ $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'text' => '' ) );
515
+ $title = strip_tags( $instance[ 'title' ] );
516
+ $text = esc_textarea( $instance[ 'text' ] );
517
+ ?>
518
+ <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
519
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></p>
520
+
521
+ <textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id( 'text' ); ?>" name="<?php echo $this->get_field_name( 'text' ); ?>"><?php echo $text; ?></textarea>
522
+
523
+ <p><input id="<?php echo $this->get_field_id( 'filter' ); ?>" name="<?php echo $this->get_field_name( 'filter' ); ?>" type="checkbox" <?php checked( isset( $instance[ 'filter' ] ) ? $instance[ 'filter' ] : 0 ); ?> />&nbsp;<label for="<?php echo $this->get_field_id( 'filter' ); ?>"><?php _e( 'Automatically add paragraphs' ); ?></label></p>
524
+ <?php
525
+ }
526
+ }
527
  ?>
{libraries → vendor}/CodeMirror2/LICENSE RENAMED
File without changes
{libraries → vendor}/CodeMirror2/lib/codemirror.css RENAMED
File without changes
{libraries → vendor}/CodeMirror2/lib/codemirror.js RENAMED
@@ -78,7 +78,7 @@ var CodeMirror = (function() {
78
  // Variables used by startOperation/endOperation to track what
79
  // happened during the operation.
80
  var updateInput, userSelChange, changes, textChanged, selectionChanged, leaveInputAlone,
81
- gutterDirty, callbacks;
82
  // Current visible range (may be bigger than the view window).
83
  var displayOffset = 0, showingFrom = 0, showingTo = 0, lastSizeC = 0;
84
  // bracketHighlighted is used to remember that a bracket has been
@@ -594,7 +594,7 @@ var CodeMirror = (function() {
594
  if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
595
  var keyCode = e_prop(e, "keyCode"), charCode = e_prop(e, "charCode");
596
  if (window.opera && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;}
597
- if (((window.opera && !e.which) || khtml) && handleKeyBinding(e)) return;
598
  var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
599
  if (options.electricChars && mode.electricChars && options.smartIndent && !options.readOnly) {
600
  if (mode.electricChars.indexOf(ch) > -1)
@@ -669,7 +669,7 @@ var CodeMirror = (function() {
669
  var recomputeMaxLength = false, maxLineLength = maxLine.length;
670
  if (!options.lineWrapping)
671
  doc.iter(from.line, to.line + 1, function(line) {
672
- if (line.text.length == maxLineLength) {recomputeMaxLength = true; return true;}
673
  });
674
  if (from.line != to.line || newText.length > 1) gutterDirty = true;
675
 
@@ -725,20 +725,12 @@ var CodeMirror = (function() {
725
  } else {
726
  doc.iter(from.line, from.line + newText.length, function(line) {
727
  var l = line.text;
728
- if (l.length > maxLineLength) {
729
  maxLine = l; maxLineLength = l.length; maxWidth = null;
730
  recomputeMaxLength = false;
731
  }
732
  });
733
- if (recomputeMaxLength) {
734
- maxLineLength = 0; maxLine = ""; maxWidth = null;
735
- doc.iter(0, doc.size, function(line) {
736
- var l = line.text;
737
- if (l.length > maxLineLength) {
738
- maxLineLength = l.length; maxLine = l;
739
- }
740
- });
741
- }
742
  }
743
 
744
  // Add these lines to the work array, so that they will be
@@ -770,6 +762,18 @@ var CodeMirror = (function() {
770
  if (scroller.clientHeight)
771
  code.style.height = (doc.height * textHeight() + 2 * paddingTop()) + "px";
772
  }
 
 
 
 
 
 
 
 
 
 
 
 
773
 
774
  function replaceRange(code, from, to) {
775
  from = clipPos(from);
@@ -857,7 +861,8 @@ var CodeMirror = (function() {
857
  else if (overwrite && posEq(sel.from, sel.to))
858
  sel.to = {line: sel.to.line, ch: Math.min(getLine(sel.to.line).text.length, sel.to.ch + (text.length - same))};
859
  replaceSelection(text.slice(same), "end");
860
- prevInput = text;
 
861
  return true;
862
  }
863
  function resetInput(user) {
@@ -1494,6 +1499,16 @@ var CodeMirror = (function() {
1494
  return changeLine(handle, function(line, no) {
1495
  if (line.hidden != hidden) {
1496
  line.hidden = hidden;
 
 
 
 
 
 
 
 
 
 
1497
  updateLineHeight(line, hidden ? 0 : 1);
1498
  var fline = sel.from.line, tline = sel.to.line;
1499
  if (hidden && (fline == no || tline == no)) {
@@ -1846,6 +1861,7 @@ var CodeMirror = (function() {
1846
  }
1847
  function endOperation() {
1848
  var reScroll = false, updated;
 
1849
  if (selectionChanged) reScroll = !scrollCursorIntoView();
1850
  if (changes.length) updated = updateDisplay(changes, true);
1851
  else {
@@ -2604,11 +2620,7 @@ var CodeMirror = (function() {
2604
  },
2605
  insertHeight: function(at, lines, height) {
2606
  this.height += height;
2607
- // The trick below is apparently too advanced for IE, which
2608
- // occasionally corrupts this.lines (duplicating elements) when
2609
- // it is used.
2610
- if (ie) this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));
2611
- else this.lines.splice.apply(this.lines, [at, 0].concat(lines));
2612
  for (var i = 0, e = lines.length; i < e; ++i) lines[i].parent = this;
2613
  },
2614
  iterN: function(at, n, op) {
78
  // Variables used by startOperation/endOperation to track what
79
  // happened during the operation.
80
  var updateInput, userSelChange, changes, textChanged, selectionChanged, leaveInputAlone,
81
+ gutterDirty, callbacks, maxLengthChanged;
82
  // Current visible range (may be bigger than the view window).
83
  var displayOffset = 0, showingFrom = 0, showingTo = 0, lastSizeC = 0;
84
  // bracketHighlighted is used to remember that a bracket has been
594
  if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
595
  var keyCode = e_prop(e, "keyCode"), charCode = e_prop(e, "charCode");
596
  if (window.opera && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;}
597
+ if (((window.opera && (!e.which || e.which < 10)) || khtml) && handleKeyBinding(e)) return;
598
  var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
599
  if (options.electricChars && mode.electricChars && options.smartIndent && !options.readOnly) {
600
  if (mode.electricChars.indexOf(ch) > -1)
669
  var recomputeMaxLength = false, maxLineLength = maxLine.length;
670
  if (!options.lineWrapping)
671
  doc.iter(from.line, to.line + 1, function(line) {
672
+ if (!line.hidden && line.text.length == maxLineLength) {recomputeMaxLength = true; return true;}
673
  });
674
  if (from.line != to.line || newText.length > 1) gutterDirty = true;
675
 
725
  } else {
726
  doc.iter(from.line, from.line + newText.length, function(line) {
727
  var l = line.text;
728
+ if (!line.hidden && l.length > maxLineLength) {
729
  maxLine = l; maxLineLength = l.length; maxWidth = null;
730
  recomputeMaxLength = false;
731
  }
732
  });
733
+ if (recomputeMaxLength) maxLengthChanged = true;
 
 
 
 
 
 
 
 
734
  }
735
 
736
  // Add these lines to the work array, so that they will be
762
  if (scroller.clientHeight)
763
  code.style.height = (doc.height * textHeight() + 2 * paddingTop()) + "px";
764
  }
765
+
766
+ function computeMaxLength() {
767
+ var maxLineLength = 0;
768
+ maxLine = ""; maxWidth = null;
769
+ doc.iter(0, doc.size, function(line) {
770
+ var l = line.text;
771
+ if (!line.hidden && l.length > maxLineLength) {
772
+ maxLineLength = l.length; maxLine = l;
773
+ }
774
+ });
775
+ maxLengthChanged = false;
776
+ }
777
 
778
  function replaceRange(code, from, to) {
779
  from = clipPos(from);
861
  else if (overwrite && posEq(sel.from, sel.to))
862
  sel.to = {line: sel.to.line, ch: Math.min(getLine(sel.to.line).text.length, sel.to.ch + (text.length - same))};
863
  replaceSelection(text.slice(same), "end");
864
+ if (text.length > 1000) { input.value = prevInput = ""; }
865
+ else prevInput = text;
866
  return true;
867
  }
868
  function resetInput(user) {
1499
  return changeLine(handle, function(line, no) {
1500
  if (line.hidden != hidden) {
1501
  line.hidden = hidden;
1502
+ if (!options.lineWrapping) {
1503
+ var l = line.text;
1504
+ if (hidden && l.length == maxLine.length) {
1505
+ maxLengthChanged = true;
1506
+ }
1507
+ else if (!hidden && l.length > maxLine.length) {
1508
+ maxLine = l; maxWidth = null;
1509
+ maxLengthChanged = false;
1510
+ }
1511
+ }
1512
  updateLineHeight(line, hidden ? 0 : 1);
1513
  var fline = sel.from.line, tline = sel.to.line;
1514
  if (hidden && (fline == no || tline == no)) {
1861
  }
1862
  function endOperation() {
1863
  var reScroll = false, updated;
1864
+ if (maxLengthChanged) computeMaxLength();
1865
  if (selectionChanged) reScroll = !scrollCursorIntoView();
1866
  if (changes.length) updated = updateDisplay(changes, true);
1867
  else {
2620
  },
2621
  insertHeight: function(at, lines, height) {
2622
  this.height += height;
2623
+ this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));
 
 
 
 
2624
  for (var i = 0, e = lines.length; i < e; ++i) lines[i].parent = this;
2625
  },
2626
  iterN: function(at, n, op) {
{libraries → vendor}/CodeMirror2/mode/clike/clike.js RENAMED
File without changes
vendor/CodeMirror2/mode/coffeescript/LICENSE ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The MIT License
2
+
3
+ Copyright (c) 2011 Jeff Pickhardt
4
+ Modified from the Python CodeMirror mode, Copyright (c) 2010 Timothy Farrell
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
vendor/CodeMirror2/mode/coffeescript/coffeescript.js ADDED
@@ -0,0 +1,347 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Link to the project's GitHub page:
3
+ * https://github.com/pickhardt/coffeescript-codemirror-mode
4
+ */
5
+ CodeMirror.defineMode('coffeescript', function(conf) {
6
+ var ERRORCLASS = 'error';
7
+
8
+ function wordRegexp(words) {
9
+ return new RegExp("^((" + words.join(")|(") + "))\\b");
10
+ }
11
+
12
+ var singleOperators = new RegExp("^[\\+\\-\\*/%&|\\^~<>!\?]");
13
+ var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]');
14
+ var doubleOperators = new RegExp("^((\->)|(\=>)|(\\+\\+)|(\\+\\=)|(\\-\\-)|(\\-\\=)|(\\*\\*)|(\\*\\=)|(\\/\\/)|(\\/\\=)|(==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//))");
15
+ var doubleDelimiters = new RegExp("^((\\.\\.)|(\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))");
16
+ var tripleDelimiters = new RegExp("^((\\.\\.\\.)|(//=)|(>>=)|(<<=)|(\\*\\*=))");
17
+ var identifiers = new RegExp("^[_A-Za-z$][_A-Za-z$0-9]*");
18
+
19
+ var wordOperators = wordRegexp(['and', 'or', 'not',
20
+ 'is', 'isnt', 'in',
21
+ 'instanceof', 'typeof']);
22
+ var indentKeywords = ['for', 'while', 'loop', 'if', 'unless', 'else',
23
+ 'switch', 'try', 'catch', 'finally', 'class'];
24
+ var commonKeywords = ['break', 'by', 'continue', 'debugger', 'delete',
25
+ 'do', 'in', 'of', 'new', 'return', 'then',
26
+ 'this', 'throw', 'when', 'until'];
27
+
28
+ var keywords = wordRegexp(indentKeywords.concat(commonKeywords));
29
+
30
+ indentKeywords = wordRegexp(indentKeywords);
31
+
32
+
33
+ var stringPrefixes = new RegExp("^('{3}|\"{3}|['\"])");
34
+ var regexPrefixes = new RegExp("^(/{3}|/)");
35
+ var commonConstants = ['Infinity', 'NaN', 'undefined', 'null', 'true', 'false', 'on', 'off', 'yes', 'no'];
36
+ var constants = wordRegexp(commonConstants);
37
+
38
+ // Tokenizers
39
+ function tokenBase(stream, state) {
40
+ // Handle scope changes
41
+ if (stream.sol()) {
42
+ var scopeOffset = state.scopes[0].offset;
43
+ if (stream.eatSpace()) {
44
+ var lineOffset = stream.indentation();
45
+ if (lineOffset > scopeOffset) {
46
+ return 'indent';
47
+ } else if (lineOffset < scopeOffset) {
48
+ return 'dedent';
49
+ }
50
+ return null;
51
+ } else {
52
+ if (scopeOffset > 0) {
53
+ dedent(stream, state);
54
+ }
55
+ }
56
+ }
57
+ if (stream.eatSpace()) {
58
+ return null;
59
+ }
60
+
61
+ var ch = stream.peek();
62
+
63
+ // Handle docco title comment (single line)
64
+ if (stream.match("####")) {
65
+ stream.skipToEnd();
66
+ return 'comment';
67
+ }
68
+
69
+ // Handle multi line comments
70
+ if (stream.match("###")) {
71
+ state.tokenize = longComment;
72
+ return state.tokenize(stream, state);
73
+ }
74
+
75
+ // Single line comment
76
+ if (ch === '#') {
77
+ stream.skipToEnd();
78
+ return 'comment';
79
+ }
80
+
81
+ // Handle number literals
82
+ if (stream.match(/^-?[0-9\.]/, false)) {
83
+ var floatLiteral = false;
84
+ // Floats
85
+ if (stream.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)) {
86
+ floatLiteral = true;
87
+ }
88
+ if (stream.match(/^-?\d+\.\d*/)) {
89
+ floatLiteral = true;
90
+ }
91
+ if (stream.match(/^-?\.\d+/)) {
92
+ floatLiteral = true;
93
+ }
94
+
95
+ if (floatLiteral) {
96
+ // prevent from getting extra . on 1..
97
+ if (stream.peek() == "."){
98
+ stream.backUp(1);
99
+ }
100
+ return 'number';
101
+ }
102
+ // Integers
103
+ var intLiteral = false;
104
+ // Hex
105
+ if (stream.match(/^-?0x[0-9a-f]+/i)) {
106
+ intLiteral = true;
107
+ }
108
+ // Decimal
109
+ if (stream.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)) {
110
+ intLiteral = true;
111
+ }
112
+ // Zero by itself with no other piece of number.
113
+ if (stream.match(/^-?0(?![\dx])/i)) {
114
+ intLiteral = true;
115
+ }
116
+ if (intLiteral) {
117
+ return 'number';
118
+ }
119
+ }
120
+
121
+ // Handle strings
122
+ if (stream.match(stringPrefixes)) {
123
+ state.tokenize = tokenFactory(stream.current(), 'string');
124
+ return state.tokenize(stream, state);
125
+ }
126
+ // Handle regex literals
127
+ if (stream.match(regexPrefixes)) {
128
+ if (stream.current() != '/' || stream.match(/^.*\//, false)) { // prevent highlight of division
129
+ state.tokenize = tokenFactory(stream.current(), 'string-2');
130
+ return state.tokenize(stream, state);
131
+ } else {
132
+ stream.backUp(1);
133
+ }
134
+ }
135
+
136
+ // Handle operators and delimiters
137
+ if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) {
138
+ return 'punctuation';
139
+ }
140
+ if (stream.match(doubleOperators)
141
+ || stream.match(singleOperators)
142
+ || stream.match(wordOperators)) {
143
+ return 'operator';
144
+ }
145
+ if (stream.match(singleDelimiters)) {
146
+ return 'punctuation';
147
+ }
148
+
149
+ if (stream.match(constants)) {
150
+ return 'atom';
151
+ }
152
+
153
+ if (stream.match(keywords)) {
154
+ return 'keyword';
155
+ }
156
+
157
+ if (stream.match(identifiers)) {
158
+ return 'variable';
159
+ }
160
+
161
+ // Handle non-detected items
162
+ stream.next();
163
+ return ERRORCLASS;
164
+ }
165
+
166
+ function tokenFactory(delimiter, outclass) {
167
+ var singleline = delimiter.length == 1;
168
+ return function tokenString(stream, state) {
169
+ while (!stream.eol()) {
170
+ stream.eatWhile(/[^'"\/\\]/);
171
+ if (stream.eat('\\')) {
172
+ stream.next();
173
+ if (singleline && stream.eol()) {
174
+ return outclass;
175
+ }
176
+ } else if (stream.match(delimiter)) {
177
+ state.tokenize = tokenBase;
178
+ return outclass;
179
+ } else {
180
+ stream.eat(/['"\/]/);
181
+ }
182
+ }
183
+ if (singleline) {
184
+ if (conf.mode.singleLineStringErrors) {
185
+ outclass = ERRORCLASS
186
+ } else {
187
+ state.tokenize = tokenBase;
188
+ }
189
+ }
190
+ return outclass;
191
+ };
192
+ }
193
+
194
+ function longComment(stream, state) {
195
+ while (!stream.eol()) {
196
+ stream.eatWhile(/[^#]/);
197
+ if (stream.match("###")) {
198
+ state.tokenize = tokenBase;
199
+ break;
200
+ }
201
+ stream.eatWhile("#");
202
+ }
203
+ return "comment"
204
+ }
205
+
206
+ function indent(stream, state, type) {
207
+ type = type || 'coffee';
208
+ var indentUnit = 0;
209
+ if (type === 'coffee') {
210
+ for (var i = 0; i < state.scopes.length; i++) {
211
+ if (state.scopes[i].type === 'coffee') {
212
+ indentUnit = state.scopes[i].offset + conf.indentUnit;
213
+ break;
214
+ }
215
+ }
216
+ } else {
217
+ indentUnit = stream.column() + stream.current().length;
218
+ }
219
+ state.scopes.unshift({
220
+ offset: indentUnit,
221
+ type: type
222
+ });
223
+ }
224
+
225
+ function dedent(stream, state) {
226
+ if (state.scopes.length == 1) return;
227
+ if (state.scopes[0].type === 'coffee') {
228
+ var _indent = stream.indentation();
229
+ var _indent_index = -1;
230
+ for (var i = 0; i < state.scopes.length; ++i) {
231
+ if (_indent === state.scopes[i].offset) {
232
+ _indent_index = i;
233
+ break;
234
+ }
235
+ }
236
+ if (_indent_index === -1) {
237
+ return true;
238
+ }
239
+ while (state.scopes[0].offset !== _indent) {
240
+ state.scopes.shift();
241
+ }
242
+ return false
243
+ } else {
244
+ state.scopes.shift();
245
+ return false;
246
+ }
247
+ }
248
+
249
+ function tokenLexer(stream, state) {
250
+ var style = state.tokenize(stream, state);
251
+ var current = stream.current();
252
+
253
+ // Handle '.' connected identifiers
254
+ if (current === '.') {
255
+ style = state.tokenize(stream, state);
256
+ current = stream.current();
257
+ if (style === 'variable') {
258
+ return 'variable';
259
+ } else {
260
+ return ERRORCLASS;
261
+ }
262
+ }
263
+
264
+ // Handle properties
265
+ if (current === '@') {
266
+ stream.eat('@');
267
+ return 'keyword';
268
+ }
269
+
270
+ // Handle scope changes.
271
+ if (current === 'return') {
272
+ state.dedent += 1;
273
+ }
274
+ if (((current === '->' || current === '=>') &&
275
+ !state.lambda &&
276
+ state.scopes[0].type == 'coffee' &&
277
+ stream.peek() === '')
278
+ || style === 'indent') {
279
+ indent(stream, state);
280
+ }
281
+ var delimiter_index = '[({'.indexOf(current);
282
+ if (delimiter_index !== -1) {
283
+ indent(stream, state, '])}'.slice(delimiter_index, delimiter_index+1));
284
+ }
285
+ if (indentKeywords.exec(current)){
286
+ indent(stream, state);
287
+ }
288
+ if (current == 'then'){
289
+ dedent(stream, state);
290
+ }
291
+
292
+
293
+ if (style === 'dedent') {
294
+ if (dedent(stream, state)) {
295
+ return ERRORCLASS;
296
+ }
297
+ }
298
+ delimiter_index = '])}'.indexOf(current);
299
+ if (delimiter_index !== -1) {
300
+ if (dedent(stream, state)) {
301
+ return ERRORCLASS;
302
+ }
303
+ }
304
+ if (state.dedent > 0 && stream.eol() && state.scopes[0].type == 'coffee') {
305
+ if (state.scopes.length > 1) state.scopes.shift();
306
+ state.dedent -= 1;
307
+ }
308
+
309
+ return style;
310
+ }
311
+
312
+ var external = {
313
+ startState: function(basecolumn) {
314
+ return {
315
+ tokenize: tokenBase,
316
+ scopes: [{offset:basecolumn || 0, type:'coffee'}],
317
+ lastToken: null,
318
+ lambda: false,
319
+ dedent: 0
320
+ };
321
+ },
322
+
323
+ token: function(stream, state) {
324
+ var style = tokenLexer(stream, state);
325
+
326
+ state.lastToken = {style:style, content: stream.current()};
327
+
328
+ if (stream.eol() && stream.lambda) {
329
+ state.lambda = false;
330
+ }
331
+
332
+ return style;
333
+ },
334
+
335
+ indent: function(state, textAfter) {
336
+ if (state.tokenize != tokenBase) {
337
+ return 0;
338
+ }
339
+
340
+ return state.scopes[0].offset;
341
+ }
342
+
343
+ };
344
+ return external;
345
+ });
346
+
347
+ CodeMirror.defineMIME('text/x-coffeescript', 'coffeescript');
{libraries → vendor}/CodeMirror2/mode/css/css.js RENAMED
File without changes
vendor/CodeMirror2/mode/gfm/gfm.js ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ CodeMirror.defineMode("gfm", function(config, parserConfig) {
2
+ var mdMode = CodeMirror.getMode(config, "markdown");
3
+ var aliases = {
4
+ html: "htmlmixed",
5
+ js: "javascript",
6
+ json: "application/json",
7
+ c: "text/x-csrc",
8
+ "c++": "text/x-c++src",
9
+ java: "text/x-java",
10
+ csharp: "text/x-csharp",
11
+ "c#": "text/x-csharp"
12
+ };
13
+
14
+ // make this lazy so that we don't need to load GFM last
15
+ var getMode = (function () {
16
+ var i, modes = {}, mimes = {}, mime;
17
+
18
+ var list = CodeMirror.listModes();
19
+ for (i = 0; i < list.length; i++) {
20
+ modes[list[i]] = list[i];
21
+ }
22
+ var mimesList = CodeMirror.listMIMEs();
23
+ for (i = 0; i < mimesList.length; i++) {
24
+ mime = mimesList[i].mime;
25
+ mimes[mime] = mimesList[i].mime;
26
+ }
27
+
28
+ for (var a in aliases) {
29
+ if (aliases[a] in modes || aliases[a] in mimes)
30
+ modes[a] = aliases[a];
31
+ }
32
+
33
+ return function (lang) {
34
+ return modes[lang] ? CodeMirror.getMode(config, modes[lang]) : null;
35
+ }
36
+ }());
37
+
38
+ function markdown(stream, state) {
39
+ // intercept fenced code blocks
40
+ if (stream.sol() && stream.match(/^```([\w+#]*)/)) {
41
+ // try switching mode
42
+ state.localMode = getMode(RegExp.$1)
43
+ if (state.localMode)
44
+ state.localState = state.localMode.startState();
45
+
46
+ state.token = local;
47
+ return 'code';
48
+ }
49
+
50
+ return mdMode.token(stream, state.mdState);
51
+ }
52
+
53
+ function local(stream, state) {
54
+ if (stream.sol() && stream.match(/^```/)) {
55
+ state.localMode = state.localState = null;
56
+ state.token = markdown;
57
+ return 'code';
58
+ }
59
+ else if (state.localMode) {
60
+ return state.localMode.token(stream, state.localState);
61
+ } else {
62
+ stream.skipToEnd();
63
+ return 'code';
64
+ }
65
+ }
66
+
67
+ // custom handleText to prevent emphasis in the middle of a word
68
+ // and add autolinking
69
+ function handleText(stream, mdState) {
70
+ var match;
71
+ if (stream.match(/^\w+:\/\/\S+/)) {
72
+ return 'linkhref';
73
+ }
74
+ if (stream.match(/^[^\[*\\<>` _][^\[*\\<>` ]*[^\[*\\<>` _]/)) {
75
+ return mdMode.getType(mdState);
76
+ }
77
+ if (match = stream.match(/^[^\[*\\<>` ]+/)) {
78
+ var word = match[0];
79
+ if (word[0] === '_' && word[word.length-1] === '_') {
80
+ stream.backUp(word.length);
81
+ return undefined;
82
+ }
83
+ return mdMode.getType(mdState);
84
+ }
85
+ if (stream.eatSpace()) {
86
+ return null;
87
+ }
88
+ }
89
+
90
+ return {
91
+ startState: function() {
92
+ var mdState = mdMode.startState();
93
+ mdState.text = handleText;
94
+ return {token: markdown, mode: "markdown", mdState: mdState,
95
+ localMode: null, localState: null};
96
+ },
97
+
98
+ copyState: function(state) {
99
+ return {token: state.token, mode: state.mode, mdState: CodeMirror.copyState(mdMode, state.mdState),
100
+ localMode: state.localMode,
101
+ localState: state.localMode ? CodeMirror.copyState(state.localMode, state.localState) : null};
102
+ },
103
+
104
+ token: function(stream, state) {
105
+ return state.token(stream, state);
106
+ }
107
+ }
108
+ }, "markdown");
{libraries → vendor}/CodeMirror2/mode/htmlmixed/htmlmixed.js RENAMED
File without changes
{libraries → vendor}/CodeMirror2/mode/javascript/javascript.js RENAMED
File without changes
{libraries → vendor}/CodeMirror2/mode/less/less.js RENAMED
File without changes
vendor/CodeMirror2/mode/markdown/markdown.js ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
2
+
3
+ var htmlMode = CodeMirror.getMode(cmCfg, { name: 'xml', htmlMode: true });
4
+
5
+ var header = 'header'
6
+ , code = 'comment'
7
+ , quote = 'quote'
8
+ , list = 'string'
9
+ , hr = 'hr'
10
+ , linktext = 'link'
11
+ , linkhref = 'string'
12
+ , em = 'em'
13
+ , strong = 'strong'
14
+ , emstrong = 'emstrong';
15
+
16
+ var hrRE = /^([*\-=_])(?:\s*\1){2,}\s*$/
17
+ , ulRE = /^[*\-+]\s+/
18
+ , olRE = /^[0-9]+\.\s+/
19
+ , headerRE = /^(?:\={3,}|-{3,})$/
20
+ , textRE = /^[^\[*_\\<>`]+/;
21
+
22
+ function switchInline(stream, state, f) {
23
+ state.f = state.inline = f;
24
+ return f(stream, state);
25
+ }
26
+
27
+ function switchBlock(stream, state, f) {
28
+ state.f = state.block = f;
29
+ return f(stream, state);
30
+ }
31
+
32
+
33
+ // Blocks
34
+
35
+ function blankLine(state) {
36
+ // Reset EM state
37
+ state.em = false;
38
+ // Reset STRONG state
39
+ state.strong = false;
40
+ return null;
41
+ }
42
+
43
+ function blockNormal(stream, state) {
44
+ var match;
45
+ if (state.indentationDiff >= 4) {
46
+ state.indentation -= state.indentationDiff;
47
+ stream.skipToEnd();
48
+ return code;
49
+ } else if (stream.eatSpace()) {
50
+ return null;
51
+ } else if (stream.peek() === '#' || stream.match(headerRE)) {
52
+ state.header = true;
53
+ } else if (stream.eat('>')) {
54
+ state.indentation++;
55
+ state.quote = true;
56
+ } else if (stream.peek() === '[') {
57
+ return switchInline(stream, state, footnoteLink);
58
+ } else if (stream.match(hrRE, true)) {
59
+ return hr;
60
+ } else if (match = stream.match(ulRE, true) || stream.match(olRE, true)) {
61
+ state.indentation += match[0].length;
62
+ return list;
63
+ }
64
+
65
+ return switchInline(stream, state, state.inline);
66
+ }
67
+
68
+ function htmlBlock(stream, state) {
69
+ var style = htmlMode.token(stream, state.htmlState);
70
+ if (style === 'tag' && state.htmlState.type !== 'openTag' && !state.htmlState.context) {
71
+ state.f = inlineNormal;
72
+ state.block = blockNormal;
73
+ }
74
+ return style;
75
+ }
76
+
77
+
78
+ // Inline
79
+ function getType(state) {
80
+ var styles = [];
81
+
82
+ if (state.strong) { styles.push(state.em ? emstrong : strong); }
83
+ else if (state.em) { styles.push(em); }
84
+
85
+ if (state.header) { styles.push(header); }
86
+ if (state.quote) { styles.push(quote); }
87
+
88
+ return styles.length ? styles.join(' ') : null;
89
+ }
90
+
91
+ function handleText(stream, state) {
92
+ if (stream.match(textRE, true)) {
93
+ return getType(state);
94
+ }
95
+ return undefined;
96
+ }
97
+
98
+ function inlineNormal(stream, state) {
99
+ var style = state.text(stream, state)
100
+ if (typeof style !== 'undefined')
101
+ return style;
102
+
103
+ var ch = stream.next();
104
+
105
+ if (ch === '\\') {
106
+ stream.next();
107
+ return getType(state);
108
+ }
109
+ if (ch === '`') {
110
+ return switchInline(stream, state, inlineElement(code, '`'));
111
+ }
112
+ if (ch === '[') {
113
+ return switchInline(stream, state, linkText);
114
+ }
115
+ if (ch === '<' && stream.match(/^\w/, false)) {
116
+ stream.backUp(1);
117
+ return switchBlock(stream, state, htmlBlock);
118
+ }
119
+
120
+ var t = getType(state);
121
+ if (ch === '*' || ch === '_') {
122
+ if (stream.eat(ch)) {
123
+ return (state.strong = !state.strong) ? getType(state) : t;
124
+ }
125
+ return (state.em = !state.em) ? getType(state) : t;
126
+ }
127
+
128
+ return getType(state);
129
+ }
130
+
131
+ function linkText(stream, state) {
132
+ while (!stream.eol()) {
133
+ var ch = stream.next();
134
+ if (ch === '\\') stream.next();
135
+ if (ch === ']') {
136
+ state.inline = state.f = linkHref;
137
+ return linktext;
138
+ }
139
+ }
140
+ return linktext;
141
+ }
142
+
143
+ function linkHref(stream, state) {
144
+ stream.eatSpace();
145
+ var ch = stream.next();
146
+ if (ch === '(' || ch === '[') {
147
+ return switchInline(stream, state, inlineElement(linkhref, ch === '(' ? ')' : ']'));
148
+ }
149
+ return 'error';
150
+ }
151
+
152
+ function footnoteLink(stream, state) {
153
+ if (stream.match(/^[^\]]*\]:/, true)) {
154
+ state.f = footnoteUrl;
155
+ return linktext;
156
+ }
157
+ return switchInline(stream, state, inlineNormal);
158
+ }
159
+
160
+ function footnoteUrl(stream, state) {
161
+ stream.eatSpace();
162
+ stream.match(/^[^\s]+/, true);
163
+ state.f = state.inline = inlineNormal;
164
+ return linkhref;
165
+ }
166
+
167
+ function inlineRE(endChar) {
168
+ if (!inlineRE[endChar]) {
169
+ // match any not-escaped-non-endChar and any escaped char
170
+ // then match endChar or eol
171
+ inlineRE[endChar] = new RegExp('^(?:[^\\\\\\' + endChar + ']|\\\\.)*(?:\\' + endChar + '|$)');
172
+ }
173
+ return inlineRE[endChar];
174
+ }
175
+
176
+ function inlineElement(type, endChar, next) {
177
+ next = next || inlineNormal;
178
+ return function(stream, state) {
179
+ stream.match(inlineRE(endChar));
180
+ state.inline = state.f = next;
181
+ return type;
182
+ };
183
+ }
184
+
185
+ return {
186
+ startState: function() {
187
+ return {
188
+ f: blockNormal,
189
+
190
+ block: blockNormal,
191
+ htmlState: htmlMode.startState(),
192
+ indentation: 0,
193
+
194
+ inline: inlineNormal,
195
+ text: handleText,
196
+ em: false,
197
+ strong: false,
198
+ header: false,
199
+ quote: false
200
+ };
201
+ },
202
+
203
+ copyState: function(s) {
204
+ return {
205
+ f: s.f,
206
+
207
+ block: s.block,
208
+ htmlState: CodeMirror.copyState(htmlMode, s.htmlState),
209
+ indentation: s.indentation,
210
+
211
+ inline: s.inline,
212
+ text: s.text,
213
+ em: s.em,
214
+ strong: s.strong,
215
+ header: s.header,
216
+ quote: s.quote
217
+ };
218
+ },
219
+
220
+ token: function(stream, state) {
221
+ if (stream.sol()) {
222
+ if (stream.match(/^\s*$/, true)) { return blankLine(state); }
223
+
224
+ // Reset state.header
225
+ state.header = false;
226
+ // Reset state.quote
227
+ state.quote = false;
228
+
229
+ state.f = state.block;
230
+ var indentation = stream.match(/^\s*/, true)[0].replace(/\t/g, ' ').length;
231
+ state.indentationDiff = indentation - state.indentation;
232
+ state.indentation = indentation;
233
+ if (indentation > 0) { return null; }
234
+ }
235
+ return state.f(stream, state);
236
+ },
237
+
238
+ blankLine: blankLine,
239
+
240
+ getType: getType
241
+ };
242
+
243
+ }, "xml");
244
+
245
+ CodeMirror.defineMIME("text/x-markdown", "markdown");
{libraries → vendor}/CodeMirror2/mode/php/php.js RENAMED
File without changes
{libraries → vendor}/CodeMirror2/mode/xml/xml.js RENAMED
File without changes
{libraries → vendor}/CodeMirror2/theme/ambiance.css RENAMED
File without changes
{libraries → vendor}/CodeMirror2/theme/blackboard.css RENAMED
File without changes
{libraries → vendor}/CodeMirror2/theme/cobalt.css RENAMED
File without changes
{libraries → vendor}/CodeMirror2/theme/eclipse.css RENAMED
File without changes
{libraries → vendor}/CodeMirror2/theme/elegant.css RENAMED
File without changes
vendor/CodeMirror2/theme/erlang-dark.css ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .cm-s-erlang-dark { background: #002240; color: white; }
2
+ .cm-s-erlang-dark div.CodeMirror-selected { background: #b36539 !important; }
3
+ .cm-s-erlang-dark .CodeMirror-gutter { background: #002240; border-right: 1px solid #aaa; }
4
+ .cm-s-erlang-dark .CodeMirror-gutter-text { color: #d0d0d0; }
5
+ .cm-s-erlang-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
6
+
7
+ .cm-s-erlang-dark span.cm-atom { color: #845dc4; }
8
+ .cm-s-erlang-dark span.cm-attribute { color: #ff80e1; }
9
+ .cm-s-erlang-dark span.cm-bracket { color: #ff9d00; }
10
+ .cm-s-erlang-dark span.cm-builtin { color: #eeaaaa; }
11
+ .cm-s-erlang-dark span.cm-comment { color: #7777ff; }
12
+ .cm-s-erlang-dark span.cm-def { color: #ee77aa; }
13
+ .cm-s-erlang-dark span.cm-error { color: #9d1e15; }
14
+ .cm-s-erlang-dark span.cm-keyword { color: #ffee80; }
15
+ .cm-s-erlang-dark span.cm-meta { color: #50fefe; }
16
+ .cm-s-erlang-dark span.cm-number { color: #ffd0d0; }
17
+ .cm-s-erlang-dark span.cm-operator { color: #dd1111; }
18
+ .cm-s-erlang-dark span.cm-string { color: #3ad900; }
19
+ .cm-s-erlang-dark span.cm-tag { color: #9effff; }
20
+ .cm-s-erlang-dark span.cm-variable { color: #50fe50; }
21
+ .cm-s-erlang-dark span.cm-variable-2 { color: #ee00ee; }
{libraries → vendor}/CodeMirror2/theme/lesser-dark.css RENAMED
File without changes
{libraries → vendor}/CodeMirror2/theme/monokai.css RENAMED
File without changes
{libraries → vendor}/CodeMirror2/theme/neat.css RENAMED
File without changes
{libraries → vendor}/CodeMirror2/theme/night.css RENAMED
File without changes
{libraries → vendor}/CodeMirror2/theme/rubyblue.css RENAMED
File without changes
{libraries → vendor}/CodeMirror2/theme/xq-dark.css RENAMED
File without changes
vendor/chosen/chosen-sprite.png ADDED
Binary file
vendor/chosen/chosen.css ADDED
@@ -0,0 +1,392 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* @group Base */
2
+ .chzn-container {
3
+ font-size: 13px;
4
+ position: relative;
5
+ display: inline-block;
6
+ zoom: 1;
7
+ *display: inline;
8
+ }
9
+ .chzn-container .chzn-drop {
10
+ background: #fff;
11
+ border: 1px solid #aaa;
12
+ border-top: 0;
13
+ position: absolute;
14
+ top: 29px;
15
+ left: 0;
16
+ -webkit-box-shadow: 0 4px 5px rgba(0,0,0,.15);
17
+ -moz-box-shadow : 0 4px 5px rgba(0,0,0,.15);
18
+ -o-box-shadow : 0 4px 5px rgba(0,0,0,.15);
19
+ box-shadow : 0 4px 5px rgba(0,0,0,.15);
20
+ z-index: 999;
21
+ }
22
+ /* @end */
23
+
24
+ /* @group Single Chosen */
25
+ .chzn-container-single .chzn-single {
26
+ background-color: #ffffff;
27
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0 );
28
+ background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4));
29
+ background-image: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
30
+ background-image: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
31
+ background-image: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
32
+ background-image: -ms-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
33
+ background-image: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
34
+ -webkit-border-radius: 5px;
35
+ -moz-border-radius : 5px;
36
+ border-radius : 5px;
37
+ -moz-background-clip : padding;
38
+ -webkit-background-clip: padding-box;
39
+ background-clip : padding-box;
40
+ border: 1px solid #aaaaaa;
41
+ -webkit-box-shadow: 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
42
+ -moz-box-shadow : 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
43
+ box-shadow : 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
44
+ display: block;
45
+ overflow: hidden;
46
+ white-space: nowrap;
47
+ position: relative;
48
+ height: 23px;
49
+ line-height: 24px;
50
+ padding: 0 0 0 8px;
51
+ color: #444444;
52
+ text-decoration: none;
53
+ }
54
+ .chzn-container-single .chzn-default {
55
+ color: #999;
56
+ }
57
+ .chzn-container-single .chzn-single span {
58
+ margin-right: 26px;
59
+ display: block;
60
+ overflow: hidden;
61
+ white-space: nowrap;
62
+ -o-text-overflow: ellipsis;
63
+ -ms-text-overflow: ellipsis;
64
+ text-overflow: ellipsis;
65
+ }
66
+ .chzn-container-single .chzn-single abbr {
67
+ display: block;
68
+ position: absolute;
69
+ right: 26px;
70
+ top: 6px;
71
+ width: 12px;
72
+ height: 13px;
73
+ font-size: 1px;
74
+ background: url(chosen-sprite.png) right top no-repeat;
75
+ }
76
+ .chzn-container-single .chzn-single abbr:hover {
77
+ background-position: right -11px;
78
+ }
79
+ .chzn-container-single .chzn-single div {
80
+ position: absolute;
81
+ right: 0;
82
+ top: 0;
83
+ display: block;
84
+ height: 100%;
85
+ width: 18px;
86
+ }
87
+ .chzn-container-single .chzn-single div b {
88
+ background: url('chosen-sprite.png') no-repeat 0 0;
89
+ display: block;
90
+ width: 100%;
91
+ height: 100%;
92
+ }
93
+ .chzn-container-single .chzn-search {
94
+ padding: 3px 4px;
95
+ position: relative;
96
+ margin: 0;
97
+ white-space: nowrap;
98
+ z-index: 1010;
99
+ }
100
+ .chzn-container-single .chzn-search input {
101
+ background: #fff url('chosen-sprite.png') no-repeat 100% -22px;
102
+ background: url('chosen-sprite.png') no-repeat 100% -22px, -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
103
+ background: url('chosen-sprite.png') no-repeat 100% -22px, -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
104
+ background: url('chosen-sprite.png') no-repeat 100% -22px, -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
105
+ background: url('chosen-sprite.png') no-repeat 100% -22px, -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
106
+ background: url('chosen-sprite.png') no-repeat 100% -22px, -ms-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
107
+ background: url('chosen-sprite.png') no-repeat 100% -22px, linear-gradient(top, #eeeeee 1%, #ffffff 15%);
108
+ margin: 1px 0;
109
+ padding: 4px 20px 4px 5px;
110
+ outline: 0;
111
+ border: 1px solid #aaa;
112
+ font-family: sans-serif;
113
+ font-size: 1em;
114
+ }
115
+ .chzn-container-single .chzn-drop {
116
+ -webkit-border-radius: 0 0 4px 4px;
117
+ -moz-border-radius : 0 0 4px 4px;
118
+ border-radius : 0 0 4px 4px;
119
+ -moz-background-clip : padding;
120
+ -webkit-background-clip: padding-box;
121
+ background-clip : padding-box;
122
+ }
123
+ /* @end */
124
+
125
+ .chzn-container-single-nosearch .chzn-search input {
126
+ position: absolute;
127
+ left: -9000px;
128
+ }
129
+
130
+ /* @group Multi Chosen */
131
+ .chzn-container-multi .chzn-choices {
132
+ background-color: #fff;
133
+ background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
134
+ background-image: -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
135
+ background-image: -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
136
+ background-image: -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
137
+ background-image: -ms-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
138
+ background-image: linear-gradient(top, #eeeeee 1%, #ffffff 15%);
139
+ border: 1px solid #aaa;
140
+ margin: 0;
141
+ padding: 0;
142
+ cursor: text;
143
+ overflow: hidden;
144
+ height: auto !important;
145
+ height: 1%;
146
+ position: relative;
147
+ }
148
+ .chzn-container-multi .chzn-choices li {
149
+ float: left;
150
+ list-style: none;
151
+ }
152
+ .chzn-container-multi .chzn-choices .search-field {
153
+ white-space: nowrap;
154
+ margin: 0;
155
+ padding: 0;
156
+ }
157
+ .chzn-container-multi .chzn-choices .search-field input {
158
+ color: #666;
159
+ background: transparent !important;
160
+ border: 0 !important;
161
+ font-family: sans-serif;
162
+ font-size: 100%;
163
+ height: 15px;
164
+ padding: 5px;
165
+ margin: 1px 0;
166
+ outline: 0;
167
+ -webkit-box-shadow: none;
168
+ -moz-box-shadow : none;
169
+ -o-box-shadow : none;
170
+ box-shadow : none;
171
+ }
172
+ .chzn-container-multi .chzn-choices .search-field .default {
173
+ color: #999;
174
+ }
175
+ .chzn-container-multi .chzn-choices .search-choice {
176
+ -webkit-border-radius: 3px;
177
+ -moz-border-radius : 3px;
178
+ border-radius : 3px;
179
+ -moz-background-clip : padding;
180
+ -webkit-background-clip: padding-box;
181
+ background-clip : padding-box;
182
+ background-color: #e4e4e4;
183
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f4f4', endColorstr='#eeeeee', GradientType=0 );
184
+ background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
185
+ background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
186
+ background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
187
+ background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
188
+ background-image: -ms-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
189
+ background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
190
+ -webkit-box-shadow: 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
191
+ -moz-box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
192
+ box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
193
+ color: #333;
194
+ border: 1px solid #aaaaaa;
195
+ line-height: 13px;
196
+ padding: 3px 20px 3px 5px;
197
+ margin: 3px 0 3px 5px;
198
+ position: relative;
199
+ cursor: default;
200
+ }
201
+ .chzn-container-multi .chzn-choices .search-choice-focus {
202
+ background: #d4d4d4;
203
+ }
204
+ .chzn-container-multi .chzn-choices .search-choice .search-choice-close {
205
+ display: block;
206
+ position: absolute;
207
+ right: 3px;
208
+ top: 4px;
209
+ width: 12px;
210
+ height: 13px;
211
+ font-size: 1px;
212
+ background: url(chosen-sprite.png) right top no-repeat;
213
+ }
214
+ .chzn-container-multi .chzn-choices .search-choice .search-choice-close:hover {
215
+ background-position: right -11px;
216
+ }
217
+ .chzn-container-multi .chzn-choices .search-choice-focus .search-choice-close {
218
+ background-position: right -11px;
219
+ }
220
+ /* @end */
221
+
222
+ /* @group Results */
223
+ .chzn-container .chzn-results {
224
+ margin: 0 4px 4px 0;
225
+ max-height: 240px;
226
+ padding: 0 0 0 4px;
227
+ position: relative;
228
+ overflow-x: hidden;
229
+ overflow-y: auto;
230
+ }
231
+ .chzn-container-multi .chzn-results {
232
+ margin: -1px 0 0;
233
+ padding: 0;
234
+ }
235
+ .chzn-container .chzn-results li {
236
+ display: none;
237
+ line-height: 15px;
238
+ padding: 5px 6px;
239
+ margin: 0;
240
+ list-style: none;
241
+ }
242
+ .chzn-container .chzn-results .active-result {
243
+ cursor: pointer;
244
+ display: list-item;
245
+ }
246
+ .chzn-container .chzn-results .highlighted {
247
+ background-color: #3875d7;
248
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3875d7', endColorstr='#2a62bc', GradientType=0 );
249
+ background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
250
+ background-image: -webkit-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
251
+ background-image: -moz-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
252
+ background-image: -o-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
253
+ background-image: -ms-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
254
+ background-image: linear-gradient(top, #3875d7 20%, #2a62bc 90%);
255
+ color: #fff;
256
+ }
257
+ .chzn-container .chzn-results li em {
258
+ background: #feffde;
259
+ font-style: normal;
260
+ }
261
+ .chzn-container .chzn-results .highlighted em {
262
+ background: transparent;
263
+ }
264
+ .chzn-container .chzn-results .no-results {
265
+ background: #f4f4f4;
266
+ display: list-item;
267
+ }
268
+ .chzn-container .chzn-results .group-result {
269
+ cursor: default;
270
+ color: #999;
271
+ font-weight: bold;
272
+ }
273
+ .chzn-container .chzn-results .group-option {
274
+ padding-left: 15px;
275
+ }
276
+ .chzn-container-multi .chzn-drop .result-selected {
277
+ display: none;
278
+ }
279
+ .chzn-container .chzn-results-scroll {
280
+ background: white;
281
+ margin: 0 4px;
282
+ position: absolute;
283
+ text-align: center;
284
+ width: 321px; /* This should by dynamic with js */
285
+ z-index: 1;
286
+ }
287
+ .chzn-container .chzn-results-scroll span {
288
+ display: inline-block;
289
+ height: 17px;
290
+ text-indent: -5000px;
291
+ width: 9px;
292
+ }
293
+ .chzn-container .chzn-results-scroll-down {
294
+ bottom: 0;
295
+ }
296
+ .chzn-container .chzn-results-scroll-down span {
297
+ background: url('chosen-sprite.png') no-repeat -4px -3px;
298
+ }
299
+ .chzn-container .chzn-results-scroll-up span {
300
+ background: url('chosen-sprite.png') no-repeat -22px -3px;
301
+ }
302
+ /* @end */
303
+
304
+ /* @group Active */
305
+ .chzn-container-active .chzn-single {
306
+ -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
307
+ -moz-box-shadow : 0 0 5px rgba(0,0,0,.3);
308
+ -o-box-shadow : 0 0 5px rgba(0,0,0,.3);
309
+ box-shadow : 0 0 5px rgba(0,0,0,.3);
310
+ border: 1px solid #5897fb;
311
+ }
312
+ .chzn-container-active .chzn-single-with-drop {
313
+ border: 1px solid #aaa;
314
+ -webkit-box-shadow: 0 1px 0 #fff inset;
315
+ -moz-box-shadow : 0 1px 0 #fff inset;
316
+ -o-box-shadow : 0 1px 0 #fff inset;
317
+ box-shadow : 0 1px 0 #fff inset;
318
+ background-color: #eee;
319
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0 );
320
+ background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff));
321
+ background-image: -webkit-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
322
+ background-image: -moz-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
323
+ background-image: -o-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
324
+ background-image: -ms-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
325
+ background-image: linear-gradient(top, #eeeeee 20%, #ffffff 80%);
326
+ -webkit-border-bottom-left-radius : 0;
327
+ -webkit-border-bottom-right-radius: 0;
328
+ -moz-border-radius-bottomleft : 0;
329
+ -moz-border-radius-bottomright: 0;
330
+ border-bottom-left-radius : 0;
331
+ border-bottom-right-radius: 0;
332
+ }
333
+ .chzn-container-active .chzn-single-with-drop div {
334
+ background: transparent;
335
+ border-left: none;
336
+ }
337
+ .chzn-container-active .chzn-single-with-drop div b {
338
+ background-position: -18px 1px;
339
+ }
340
+ .chzn-container-active .chzn-choices {
341
+ -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
342
+ -moz-box-shadow : 0 0 5px rgba(0,0,0,.3);
343
+ -o-box-shadow : 0 0 5px rgba(0,0,0,.3);
344
+ box-shadow : 0 0 5px rgba(0,0,0,.3);
345
+ border: 1px solid #5897fb;
346
+ }
347
+ .chzn-container-active .chzn-choices .search-field input {
348
+ color: #111 !important;
349
+ }
350
+ /* @end */
351
+
352
+ /* @group Disabled Support */
353
+ .chzn-disabled {
354
+ cursor: default;
355
+ opacity:0.5 !important;
356
+ }
357
+ .chzn-disabled .chzn-single {
358
+ cursor: default;
359
+ }
360
+ .chzn-disabled .chzn-choices .search-choice .search-choice-close {
361
+ cursor: default;
362
+ }
363
+
364
+ /* @group Right to Left */
365
+ .chzn-rtl { text-align: right; }
366
+ .chzn-rtl .chzn-single { padding: 0 8px 0 0; overflow: visible; }
367
+ .chzn-rtl .chzn-single span { margin-left: 26px; margin-right: 0; direction: rtl; }
368
+
369
+ .chzn-rtl .chzn-single div { left: 3px; right: auto; }
370
+ .chzn-rtl .chzn-single abbr {
371
+ left: 26px;
372
+ right: auto;
373
+ }
374
+ .chzn-rtl .chzn-choices .search-field input { direction: rtl; }
375
+ .chzn-rtl .chzn-choices li { float: right; }
376
+ .chzn-rtl .chzn-choices .search-choice { padding: 3px 5px 3px 19px; margin: 3px 5px 3px 0; }
377
+ .chzn-rtl .chzn-choices .search-choice .search-choice-close { left: 4px; right: auto; background-position: right top;}
378
+ .chzn-rtl.chzn-container-single .chzn-results { margin: 0 0 4px 4px; padding: 0 4px 0 0; }
379
+ .chzn-rtl .chzn-results .group-option { padding-left: 0; padding-right: 15px; }
380
+ .chzn-rtl.chzn-container-active .chzn-single-with-drop div { border-right: none; }
381
+ .chzn-rtl .chzn-search input {
382
+ background: #fff url('chosen-sprite.png') no-repeat -38px -22px;
383
+ background: url('chosen-sprite.png') no-repeat -38px -22px, -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
384
+ background: url('chosen-sprite.png') no-repeat -38px -22px, -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
385
+ background: url('chosen-sprite.png') no-repeat -38px -22px, -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
386
+ background: url('chosen-sprite.png') no-repeat -38px -22px, -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
387
+ background: url('chosen-sprite.png') no-repeat -38px -22px, -ms-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
388
+ background: url('chosen-sprite.png') no-repeat -38px -22px, linear-gradient(top, #eeeeee 1%, #ffffff 15%);
389
+ padding: 4px 5px 4px 20px;
390
+ direction: rtl;
391
+ }
392
+ /* @end */
vendor/chosen/chosen.jquery.min.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ // Chosen, a Select Box Enhancer for jQuery and Protoype
2
+ // by Patrick Filler for Harvest, http://getharvest.com
3
+ //
4
+ // Version 0.9.8
5
+ // Full source at https://github.com/harvesthq/chosen
6
+ // Copyright (c) 2011 Harvest http://getharvest.com
7
+
8
+ // MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
9
+ // This file is generated by `cake build`, do not edit it by hand.
10
+ ((function(){var a;a=function(){function a(){this.options_index=0,this.parsed=[]}return a.prototype.add_node=function(a){return a.nodeName==="OPTGROUP"?this.add_group(a):this.add_option(a)},a.prototype.add_group=function(a){var b,c,d,e,f,g;b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:a.label,children:0,disabled:a.disabled}),f=a.childNodes,g=[];for(d=0,e=f.length;d<e;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},a.prototype.add_option=function(a,b,c){if(a.nodeName==="OPTION")return a.text!==""?(b!=null&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},a}(),a.select_to_array=function(b){var c,d,e,f,g;d=new a,g=b.childNodes;for(e=0,f=g.length;e<f;e++)c=g[e],d.add_node(c);return d.parsed},this.SelectParser=a})).call(this),function(){var a,b;b=this,a=function(){function a(a,b){this.form_field=a,this.options=b!=null?b:{},this.set_default_values(),this.is_multiple=this.form_field.multiple,this.default_text_default=this.is_multiple?"Select Some Options":"Select an Option",this.setup(),this.set_up_html(),this.register_observers(),this.finish_setup()}return a.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null,this.allow_single_deselect=this.options.allow_single_deselect!=null&&this.form_field.options[0]!=null&&this.form_field.options[0].text===""?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.search_contains=this.options.search_contains||!1,this.choices=0,this.results_none_found=this.options.no_results_text||"No results match"},a.prototype.mouse_enter=function(){return this.mouse_on_container=!0},a.prototype.mouse_leave=function(){return this.mouse_on_container=!1},a.prototype.input_focus=function(a){var b=this;if(!this.active_field)return setTimeout(function(){return b.container_mousedown()},50)},a.prototype.input_blur=function(a){var b=this;if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(){return b.blur_test()},100)},a.prototype.result_add_option=function(a){var b,c;return a.disabled?"":(a.dom_id=this.container_id+"_o_"+a.array_index,b=a.selected&&this.is_multiple?[]:["active-result"],a.selected&&b.push("result-selected"),a.group_array_index!=null&&b.push("group-option"),a.classes!==""&&b.push(a.classes),c=a.style.cssText!==""?' style="'+a.style+'"':"",'<li id="'+a.dom_id+'" class="'+b.join(" ")+'"'+c+">"+a.html+"</li>")},a.prototype.results_update_field=function(){return this.result_clear_highlight(),this.result_single_selected=null,this.results_build()},a.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},a.prototype.results_search=function(a){return this.results_showing?this.winnow_results():this.results_show()},a.prototype.keyup_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale();switch(b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:a.preventDefault();if(this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},a.prototype.generate_field_id=function(){var a;return a=this.generate_random_id(),this.form_field.id=a,a},a.prototype.generate_random_char=function(){var a,b,c;return a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ",c=Math.floor(Math.random()*a.length),b=a.substring(c,c+1)},a}(),b.AbstractChosen=a}.call(this),function(){var a,b,c,d,e=Object.prototype.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};d=this,a=jQuery,a.fn.extend({chosen:function(c){return!a.browser.msie||a.browser.version!=="6.0"&&a.browser.version!=="7.0"?a(this).each(function(d){if(!a(this).hasClass("chzn-done"))return new b(this,c)}):this}}),b=function(b){function e(){e.__super__.constructor.apply(this,arguments)}return f(e,b),e.prototype.setup=function(){return this.form_field_jq=a(this.form_field),this.is_rtl=this.form_field_jq.hasClass("chzn-rtl")},e.prototype.finish_setup=function(){return this.form_field_jq.addClass("chzn-done")},e.prototype.set_up_html=function(){var b,d,e,f;return this.container_id=this.form_field.id.length?this.form_field.id.replace(/(:|\.)/g,"_"):this.generate_field_id(),this.container_id+="_chzn",this.f_width=this.form_field_jq.outerWidth(),this.default_text=this.form_field_jq.data("placeholder")?this.form_field_jq.data("placeholder"):this.default_text_default,b=a("<div />",{id:this.container_id,"class":"chzn-container"+(this.is_rtl?" chzn-rtl":""),style:"width: "+this.f_width+"px;"}),this.is_multiple?b.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'):b.html('<a href="javascript:void(0)" class="chzn-single chzn-default"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'),this.form_field_jq.hide().after(b),this.container=a("#"+this.container_id),this.container.addClass("chzn-container-"+(this.is_multiple?"multi":"single")),this.dropdown=this.container.find("div.chzn-drop").first(),d=this.container.height(),e=this.f_width-c(this.dropdown),this.dropdown.css({width:e+"px",top:d+"px"}),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chzn-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chzn-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chzn-search").first(),this.selected_item=this.container.find(".chzn-single").first(),f=e-c(this.search_container)-c(this.search_field),this.search_field.css({width:f+"px"})),this.results_build(),this.set_tab_index(),this.form_field_jq.trigger("liszt:ready",{chosen:this})},e.prototype.register_observers=function(){var a=this;return this.container.mousedown(function(b){return a.container_mousedown(b)}),this.container.mouseup(function(b){return a.container_mouseup(b)}),this.container.mouseenter(function(b){return a.mouse_enter(b)}),this.container.mouseleave(function(b){return a.mouse_leave(b)}),this.search_results.mouseup(function(b){return a.search_results_mouseup(b)}),this.search_results.mouseover(function(b){return a.search_results_mouseover(b)}),this.search_results.mouseout(function(b){return a.search_results_mouseout(b)}),this.form_field_jq.bind("liszt:updated",function(b){return a.results_update_field(b)}),this.search_field.blur(function(b){return a.input_blur(b)}),this.search_field.keyup(function(b){return a.keyup_checker(b)}),this.search_field.keydown(function(b){return a.keydown_checker(b)}),this.is_multiple?(this.search_choices.click(function(b){return a.choices_click(b)}),this.search_field.focus(function(b){return a.input_focus(b)})):this.container.click(function(a){return a.preventDefault()})},e.prototype.search_field_disabled=function(){this.is_disabled=this.form_field_jq[0].disabled;if(this.is_disabled)return this.container.addClass("chzn-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus",this.activate_action),this.close_field();this.container.removeClass("chzn-disabled"),this.search_field[0].disabled=!1;if(!this.is_multiple)return this.selected_item.bind("focus",this.activate_action)},e.prototype.container_mousedown=function(b){var c;if(!this.is_disabled)return c=b!=null?a(b.target).hasClass("search-choice-close"):!1,b&&b.type==="mousedown"&&!this.results_showing&&b.stopPropagation(),!this.pending_destroy_click&&!c?(this.active_field?!this.is_multiple&&b&&(a(b.target)[0]===this.selected_item[0]||a(b.target).parents("a.chzn-single").length)&&(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(document).click(this.click_test_action),this.results_show()),this.activate_field()):this.pending_destroy_click=!1},e.prototype.container_mouseup=function(a){if(a.target.nodeName==="ABBR")return this.results_reset(a)},e.prototype.blur_test=function(a){if(!this.active_field&&this.container.hasClass("chzn-container-active"))return this.close_field()},e.prototype.close_field=function(){return a(document).unbind("click",this.click_test_action),this.is_multiple||(this.selected_item.attr("tabindex",this.search_field.attr("tabindex")),this.search_field.attr("tabindex",-1)),this.active_field=!1,this.results_hide(),this.container.removeClass("chzn-container-active"),this.winnow_results_clear(),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},e.prototype.activate_field=function(){return!this.is_multiple&&!this.active_field&&(this.search_field.attr("tabindex",this.selected_item.attr("tabindex")),this.selected_item.attr("tabindex",-1)),this.container.addClass("chzn-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},e.prototype.test_active_click=function(b){return a(b.target).parents("#"+this.container_id).length?this.active_field=!0:this.close_field()},e.prototype.results_build=function(){var a,b,c,e,f;this.parsing=!0,this.results_data=d.SelectParser.select_to_array(this.form_field),this.is_multiple&&this.choices>0?(this.search_choices.find("li.search-choice").remove(),this.choices=0):this.is_multiple||(this.selected_item.find("span").text(this.default_text),this.form_field.options.length<=this.disable_search_threshold?this.container.addClass("chzn-container-single-nosearch"):this.container.removeClass("chzn-container-single-nosearch")),a="",f=this.results_data;for(c=0,e=f.length;c<e;c++)b=f[c],b.group?a+=this.result_add_group(b):b.empty||(a+=this.result_add_option(b),b.selected&&this.is_multiple?this.choice_build(b):b.selected&&!this.is_multiple&&(this.selected_item.removeClass("chzn-default").find("span").text(b.text),this.allow_single_deselect&&this.single_deselect_control_build()));return this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.search_results.html(a),this.parsing=!1},e.prototype.result_add_group=function(b){return b.disabled?"":(b.dom_id=this.container_id+"_g_"+b.array_index,'<li id="'+b.dom_id+'" class="group-result">'+a("<div />").text(b.label).html()+"</li>")},e.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight();if(b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(c<f)return this.search_results.scrollTop(c)}},e.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},e.prototype.results_show=function(){var a;return this.is_multiple||(this.selected_item.addClass("chzn-single-with-drop"),this.result_single_selected&&this.result_do_highlight(this.result_single_selected)),a=this.is_multiple?this.container.height():this.container.height()-1,this.dropdown.css({top:a+"px",left:0}),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results()},e.prototype.results_hide=function(){return this.is_multiple||this.selected_item.removeClass("chzn-single-with-drop"),this.result_clear_highlight(),this.dropdown.css({left:"-9000px"}),this.results_showing=!1},e.prototype.set_tab_index=function(a){var b;if(this.form_field_jq.attr("tabindex"))return b=this.form_field_jq.attr("tabindex"),this.form_field_jq.attr("tabindex",-1),this.is_multiple?this.search_field.attr("tabindex",b):(this.selected_item.attr("tabindex",b),this.search_field.attr("tabindex",-1))},e.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},e.prototype.search_results_mouseup=function(b){var c;c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first();if(c.length)return this.result_highlight=c,this.result_select(b)},e.prototype.search_results_mouseover=function(b){var c;c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first();if(c)return this.result_do_highlight(c)},e.prototype.search_results_mouseout=function(b){if(a(b.target).hasClass("active-result"))return this.result_clear_highlight()},e.prototype.choices_click=function(b){b.preventDefault();if(this.active_field&&!a(b.target).hasClass("search-choice")&&!this.results_showing)return this.results_show()},e.prototype.choice_build=function(b){var c,d,e=this;return c=this.container_id+"_c_"+b.array_index,this.choices+=1,this.search_container.before('<li class="search-choice" id="'+c+'"><span>'+b.html+'</span><a href="javascript:void(0)" class="search-choice-close" rel="'+b.array_index+'"></a></li>'),d=a("#"+c).find("a").first(),d.click(function(a){return e.choice_destroy_link_click(a)})},e.prototype.choice_destroy_link_click=function(b){return b.preventDefault(),this.is_disabled?b.stopPropagation:(this.pending_destroy_click=!0,this.choice_destroy(a(b.target)))},e.prototype.choice_destroy=function(a){return this.choices-=1,this.show_search_field_default(),this.is_multiple&&this.choices>0&&this.search_field.val().length<1&&this.results_hide(),this.result_deselect(a.attr("rel")),a.parents("li").first().remove()},e.prototype.results_reset=function(b){this.form_field.options[0].selected=!0,this.selected_item.find("span").text(this.default_text),this.is_multiple||this.selected_item.addClass("chzn-default"),this.show_search_field_default(),a(b.target).remove(),this.form_field_jq.trigger("change");if(this.active_field)return this.results_hide()},e.prototype.result_select=function(a){var b,c,d,e;if(this.result_highlight)return b=this.result_highlight,c=b.attr("id"),this.result_clear_highlight(),this.is_multiple?this.result_deactivate(b):(this.search_results.find(".result-selected").removeClass("result-selected"),this.result_single_selected=b,this.selected_item.removeClass("chzn-default")),b.addClass("result-selected"),e=c.substr(c.lastIndexOf("_")+1),d=this.results_data[e],d.selected=!0,this.form_field.options[d.options_index].selected=!0,this.is_multiple?this.choice_build(d):(this.selected_item.find("span").first().text(d.text),this.allow_single_deselect&&this.single_deselect_control_build()),(!a.metaKey||!this.is_multiple)&&this.results_hide(),this.search_field.val(""),this.form_field_jq.trigger("change"),this.search_field_scale()},e.prototype.result_activate=function(a){return a.addClass("active-result")},e.prototype.result_deactivate=function(a){return a.removeClass("active-result")},e.prototype.result_deselect=function(b){var c,d;return d=this.results_data[b],d.selected=!1,this.form_field.options[d.options_index].selected=!1,c=a("#"+this.container_id+"_o_"+b),c.removeClass("result-selected").addClass("active-result").show(),this.result_clear_highlight(),this.winnow_results(),this.form_field_jq.trigger("change"),this.search_field_scale()},e.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect&&this.selected_item.find("abbr").length<1)return this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>')},e.prototype.winnow_results=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;this.no_results_clear(),j=0,k=this.search_field.val()===this.default_text?"":a("<div/>").text(a.trim(this.search_field.val())).html(),g=this.search_contains?"":"^",f=new RegExp(g+k.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),n=new RegExp(k.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),s=this.results_data;for(o=0,q=s.length;o<q;o++){c=s[o];if(!c.disabled&&!c.empty)if(c.group)a("#"+c.dom_id).css("display","none");else if(!this.is_multiple||!c.selected){b=!1,i=c.dom_id,h=a("#"+i);if(f.test(c.html))b=!0,j+=1;else if(c.html.indexOf(" ")>=0||c.html.indexOf("[")===0){e=c.html.replace(/\[|\]/g,"").split(" ");if(e.length)for(p=0,r=e.length;p<r;p++)d=e[p],f.test(d)&&(b=!0,j+=1)}b?(k.length?(l=c.html.search(n),m=c.html.substr(0,l+k.length)+"</em>"+c.html.substr(l+k.length),m=m.substr(0,l)+"<em>"+m.substr(l)):m=c.html,h.html(m),this.result_activate(h),c.group_array_index!=null&&a("#"+this.results_data[c.group_array_index].dom_id).css("display","list-item")):(this.result_highlight&&i===this.result_highlight.attr("id")&&this.result_clear_highlight(),this.result_deactivate(h))}}return j<1&&k.length?this.no_results(k):this.winnow_results_set_highlight()},e.prototype.winnow_results_clear=function(){var b,c,d,e,f;this.search_field.val(""),c=this.search_results.find("li"),f=[];for(d=0,e=c.length;d<e;d++)b=c[d],b=a(b),b.hasClass("group-result")?f.push(b.css("display","auto")):!this.is_multiple||!b.hasClass("result-selected")?f.push(this.result_activate(b)):f.push(void 0);return f},e.prototype.winnow_results_set_highlight=function(){var a,b;if(!this.result_highlight){b=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),a=b.length?b.first():this.search_results.find(".active-result").first();if(a!=null)return this.result_do_highlight(a)}},e.prototype.no_results=function(b){var c;return c=a('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),c.find("span").first().html(b),this.search_results.append(c)},e.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},e.prototype.keydown_arrow=function(){var b,c;this.result_highlight?this.results_showing&&(c=this.result_highlight.nextAll("li.active-result").first(),c&&this.result_do_highlight(c)):(b=this.search_results.find("li.active-result").first(),b&&this.result_do_highlight(a(b)));if(!this.results_showing)return this.results_show()},e.prototype.keyup_arrow=function(){var a;if(!this.results_showing&&!this.is_multiple)return this.results_show();if(this.result_highlight)return a=this.result_highlight.prevAll("li.active-result"),a.length?this.result_do_highlight(a.first()):(this.choices>0&&this.results_hide(),this.result_clear_highlight())},e.prototype.keydown_backstroke=function(){return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(this.pending_backstroke=this.search_container.siblings("li.search-choice").last(),this.pending_backstroke.addClass("search-choice-focus"))},e.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},e.prototype.keydown_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale(),b!==8&&this.pending_backstroke&&this.clear_backstroke();switch(b){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:this.keydown_arrow()}},e.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i,j;if(this.is_multiple){d=0,h=0,f="position:absolute; left: -1000px; top: -1000px; display:none;",g=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(i=0,j=g.length;i<j;i++)e=g[i],f+=e+":"+this.search_field.css(e)+";";return c=a("<div />",{style:f}),c.text(this.search_field.val()),a("body").append(c),h=c.width()+25,c.remove(),h>this.f_width-10&&(h=this.f_width-10),this.search_field.css({width:h+"px"}),b=this.container.height(),this.dropdown.css({top:b+"px"})}},e.prototype.generate_random_id=function(){var b;b="sel"+this.generate_random_char()+this.generate_random_char()+this.generate_random_char();while(a("#"+b).length>0)b+=this.generate_random_char();return b},e}(AbstractChosen),c=function(a){var b;return b=a.outerWidth()-a.width()},d.get_side_border_padding=c}.call(this)
vendor/coffee-script.js ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ /**
2
+ * CoffeeScript Compiler v1.3.3
3
+ * http://coffeescript.org
4
+ *
5
+ * Copyright 2011, Jeremy Ashkenas
6
+ * Released under the MIT License
7
+ */
8
+ (function(root){var CoffeeScript=function(){function require(a){return require[a]}require["./helpers"]=new function(){var a=this;(function(){var b,c;a.starts=function(a,b,c){return b===a.substr(c,b.length)},a.ends=function(a,b,c){var d;d=b.length;return b===a.substr(a.length-d-(c||0),d)},a.compact=function(a){var b,c,d,e;e=[];for(c=0,d=a.length;c<d;c++)b=a[c],b&&e.push(b);return e},a.count=function(a,b){var c,d;c=d=0;if(!b.length)return 1/0;while(d=1+a.indexOf(b,d))c++;return c},a.merge=function(a,c){return b(b({},a),c)},b=a.extend=function(a,b){var c,d;for(c in b)d=b[c],a[c]=d;return a},a.flatten=c=function(a){var b,d,e,f;d=[];for(e=0,f=a.length;e<f;e++)b=a[e],b instanceof Array?d=d.concat(c(b)):d.push(b);return d},a.del=function(a,b){var c;c=a[b],delete a[b];return c},a.last=function(a,b){return a[a.length-(b||0)-1]}}).call(this)},require["./rewriter"]=new function(){var a=this;(function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1},u=[].slice;a.Rewriter=function(){function a(){}a.prototype.rewrite=function(a){this.tokens=a,this.removeLeadingNewlines(),this.removeMidExpressionNewlines(),this.closeOpenCalls(),this.closeOpenIndexes(),this.addImplicitIndentation(),this.tagPostfixConditionals(),this.addImplicitBraces(),this.addImplicitParentheses();return this.tokens},a.prototype.scanTokens=function(a){var b,c,d;d=this.tokens,b=0;while(c=d[b])b+=a.call(this,c,b,d);return!0},a.prototype.detectEnd=function(a,b,c){var f,g,h,i,j;h=this.tokens,f=0;while(g=h[a]){if(f===0&&b.call(this,g,a))return c.call(this,g,a);if(!g||f<0)return c.call(this,g,a-1);if(i=g[0],t.call(e,i)>=0)f+=1;else if(j=g[0],t.call(d,j)>=0)f-=1;a+=1}return a-1},a.prototype.removeLeadingNewlines=function(){var a,b,c,d,e;e=this.tokens;for(a=c=0,d=e.length;c<d;a=++c){b=e[a][0];if(b!=="TERMINATOR")break}if(a)return this.tokens.splice(0,a)},a.prototype.removeMidExpressionNewlines=function(){return this.scanTokens(function(a,b,d){var e;if(!(a[0]==="TERMINATOR"&&(e=this.tag(b+1),t.call(c,e)>=0)))return 1;d.splice(b,1);return 0})},a.prototype.closeOpenCalls=function(){var a,b;b=function(a,b){var c;return(c=a[0])===")"||c==="CALL_END"||a[0]==="OUTDENT"&&this.tag(b-1)===")"},a=function(a,b){return this.tokens[a[0]==="OUTDENT"?b-1:b][0]="CALL_END"};return this.scanTokens(function(c,d){c[0]==="CALL_START"&&this.detectEnd(d+1,b,a);return 1})},a.prototype.closeOpenIndexes=function(){var a,b;b=function(a,b){var c;return(c=a[0])==="]"||c==="INDEX_END"},a=function(a,b){return a[0]="INDEX_END"};return this.scanTokens(function(c,d){c[0]==="INDEX_START"&&this.detectEnd(d+1,b,a);return 1})},a.prototype.addImplicitBraces=function(){var a,b,c,f,g,i,j,k;f=[],g=null,k=null,c=!0,i=0,j=0,b=function(a,b){var d,e,f,g,i,m;i=this.tokens.slice(b+1,b+3+1||9e9),d=i[0],g=i[1],f=i[2];if("HERECOMMENT"===(d!=null?d[0]:void 0))return!1;e=a[0],t.call(l,e)>=0&&(c=!1);return(e==="TERMINATOR"||e==="OUTDENT"||t.call(h,e)>=0&&c&&b-j!==1)&&(!k&&this.tag(b-1)!==","||(g!=null?g[0]:void 0)!==":"&&((d!=null?d[0]:void 0)!=="@"||(f!=null?f[0]:void 0)!==":"))||e===","&&d&&(m=d[0])!=="IDENTIFIER"&&m!=="NUMBER"&&m!=="STRING"&&m!=="@"&&m!=="TERMINATOR"&&m!=="OUTDENT"},a=function(a,b){var c;c=this.generate("}","}",a[2]);return this.tokens.splice(b,0,c)};return this.scanTokens(function(h,i,m){var n,o,p,q,r,s,u,v;if(u=q=h[0],t.call(e,u)>=0){f.push([q==="INDENT"&&this.tag(i-1)==="{"?"{":q,i]);return 1}if(t.call(d,q)>=0){g=f.pop();return 1}if(q!==":"||(n=this.tag(i-2))!==":"&&((v=f[f.length-1])!=null?v[0]:void 0)==="{")return 1;c=!0,j=i+1,f.push(["{"]),o=n==="@"?i-2:i-1;while(this.tag(o-2)==="HERECOMMENT")o-=2;p=this.tag(o-1),k=!p||t.call(l,p)>=0,s=new String("{"),s.generated=!0,r=this.generate("{",s,h[2]),m.splice(o,0,r),this.detectEnd(i+2,b,a);return 2})},a.prototype.addImplicitParentheses=function(){var a,b,c,d,e;c=e=d=!1,b=function(a,b){var c,g,i,j;g=a[0];if(!e&&a.fromThen)return!0;if(g==="IF"||g==="ELSE"||g==="CATCH"||g==="->"||g==="=>"||g==="CLASS")e=!0;if(g==="IF"||g==="ELSE"||g==="SWITCH"||g==="TRY"||g==="=")d=!0;if((g==="."||g==="?."||g==="::")&&this.tag(b-1)==="OUTDENT")return!0;return!a.generated&&this.tag(b-1)!==","&&(t.call(h,g)>=0||g==="INDENT"&&!d)&&(g!=="INDENT"||(i=this.tag(b-2))!=="CLASS"&&i!=="EXTENDS"&&(j=this.tag(b-1),t.call(f,j)<0)&&(!(c=this.tokens[b+1])||!c.generated||c[0]!=="{"))},a=function(a,b){return this.tokens.splice(b,0,this.generate("CALL_END",")",a[2]))};return this.scanTokens(function(f,h,k){var m,n,o,p,q,r,s,u;q=f[0];if(q==="CLASS"||q==="IF"||q==="FOR"||q==="WHILE")c=!0;r=k.slice(h-1,h+1+1||9e9),p=r[0],n=r[1],o=r[2],m=!c&&q==="INDENT"&&o&&o.generated&&o[0]==="{"&&p&&(s=p[0],t.call(i,s)>=0),e=!1,d=!1,t.call(l,q)>=0&&(c=!1),p&&!p.spaced&&q==="?"&&(f.call=!0);if(f.fromThen)return 1;if(!(m||(p!=null?p.spaced:void 0)&&(p.call||(u=p[0],t.call(i,u)>=0))&&(t.call(g,q)>=0||!f.spaced&&!f.newLine&&t.call(j,q)>=0)))return 1;k.splice(h,0,this.generate("CALL_START","(",f[2])),this.detectEnd(h+1,b,a),p[0]==="?"&&(p[0]="FUNC_EXIST");return 2})},a.prototype.addImplicitIndentation=function(){var a,b,c,d,e;e=c=d=null,b=function(a,b){var c;return a[1]!==";"&&(c=a[0],t.call(m,c)>=0)&&(a[0]!=="ELSE"||e==="IF"||e==="THEN")},a=function(a,b){return this.tokens.splice(this.tag(b-1)===","?b-1:b,0,d)};return this.scanTokens(function(f,g,h){var i,j,k;i=f[0];if(i==="TERMINATOR"&&this.tag(g+1)==="THEN"){h.splice(g,1);return 0}if(i==="ELSE"&&this.tag(g-1)!=="OUTDENT"){h.splice.apply(h,[g,0].concat(u.call(this.indentation(f))));return 2}if(i==="CATCH"&&((j=this.tag(g+2))==="OUTDENT"||j==="TERMINATOR"||j==="FINALLY")){h.splice.apply(h,[g+2,0].concat(u.call(this.indentation(f))));return 4}if(t.call(n,i)>=0&&this.tag(g+1)!=="INDENT"&&(i!=="ELSE"||this.tag(g+1)!=="IF")){e=i,k=this.indentation(f,!0),c=k[0],d=k[1],e==="THEN"&&(c.fromThen=!0),h.splice(g+1,0,c),this.detectEnd(g+2,b,a),i==="THEN"&&h.splice(g,1);return 1}return 1})},a.prototype.tagPostfixConditionals=function(){var a,b,c;c=null,b=function(a,b){var c;return(c=a[0])==="TERMINATOR"||c==="INDENT"},a=function(a,b){if(a[0]!=="INDENT"||a.generated&&!a.fromThen)return c[0]="POST_"+c[0]};return this.scanTokens(function(d,e){if(d[0]!=="IF")return 1;c=d,this.detectEnd(e+1,b,a);return 1})},a.prototype.indentation=function(a,b){var c,d;b==null&&(b=!1),c=["INDENT",2,a[2]],d=["OUTDENT",2,a[2]],b&&(c.generated=d.generated=!0);return[c,d]},a.prototype.generate=function(a,b,c){var d;d=[a,b,c],d.generated=!0;return d},a.prototype.tag=function(a){var b;return(b=this.tokens[a])!=null?b[0]:void 0};return a}(),b=[["(",")"],["[","]"],["{","}"],["INDENT","OUTDENT"],["CALL_START","CALL_END"],["PARAM_START","PARAM_END"],["INDEX_START","INDEX_END"]],a.INVERSES=k={},e=[],d=[];for(q=0,r=b.length;q<r;q++)s=b[q],o=s[0],p=s[1],e.push(k[p]=o),d.push(k[o]=p);c=["CATCH","WHEN","ELSE","FINALLY"].concat(d),i=["IDENTIFIER","SUPER",")","CALL_END","]","INDEX_END","@","THIS"],g=["IDENTIFIER","NUMBER","STRING","JS","REGEX","NEW","PARAM_START","CLASS","IF","TRY","SWITCH","THIS","BOOL","NULL","UNDEFINED","UNARY","SUPER","@","->","=>","[","(","{","--","++"],j=["+","-"],f=["->","=>","{","[",","],h=["POST_IF","FOR","WHILE","UNTIL","WHEN","BY","LOOP","TERMINATOR"],n=["ELSE","->","=>","TRY","FINALLY","THEN"],m=["TERMINATOR","CATCH","FINALLY","ELSE","OUTDENT","LEADING_WHEN"],l=["TERMINATOR","INDENT","OUTDENT"]}).call(this)},require["./lexer"]=new function(){var a=this;(function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1};V=require("./rewriter"),J=V.Rewriter,r=V.INVERSES,W=require("./helpers"),R=W.count,U=W.starts,Q=W.compact,T=W.last,a.Lexer=y=function(){function a(){}a.prototype.tokenize=function(a,b){var c,d;b==null&&(b={}),P.test(a)&&(a="\n"+a),a=a.replace(/\r/g,"").replace(N,""),this.code=a,this.line=b.line||0,this.indent=0,this.indebt=0,this.outdebt=0,this.indents=[],this.ends=[],this.tokens=[],c=0;while(this.chunk=a.slice(c))c+=this.identifierToken()||this.commentToken()||this.whitespaceToken()||this.lineToken()||this.heredocToken()||this.stringToken()||this.numberToken()||this.regexToken()||this.jsToken()||this.literalToken();this.closeIndentation(),(d=this.ends.pop())&&this.error("missing "+d);if(b.rewrite===!1)return this.tokens;return(new J).rewrite(this.tokens)},a.prototype.identifierToken=function(){var a,b,c,d,h,i,j,k,l;if(!(h=p.exec(this.chunk)))return 0;d=h[0],c=h[1],a=h[2];if(c==="own"&&this.tag()==="FOR"){this.token("OWN",c);return c.length}b=a||(i=T(this.tokens))&&((k=i[0])==="."||k==="?."||k==="::"||!i.spaced&&i[0]==="@"),j="IDENTIFIER",!b&&(X.call(u,c)>=0||X.call(g,c)>=0)&&(j=c.toUpperCase(),j==="WHEN"&&(l=this.tag(),X.call(v,l)>=0)?j="LEADING_WHEN":j==="FOR"?this.seenFor=!0:j==="UNLESS"?j="IF":X.call(O,j)>=0?j="UNARY":X.call(H,j)>=0&&(j!=="INSTANCEOF"&&this.seenFor?(j="FOR"+j,this.seenFor=!1):(j="RELATION",this.value()==="!"&&(this.tokens.pop(),c="!"+c)))),X.call(t,c)>=0&&(b?(j="IDENTIFIER",c=new String(c),c.reserved=!0):X.call(I,c)>=0&&this.error('reserved word "'+c+'"')),b||(X.call(e,c)>=0&&(c=f[c]),j=function(){switch(c){case"!":return"UNARY";case"==":case"!=":return"COMPARE";case"&&":case"||":return"LOGIC";case"true":case"false":return"BOOL";case"break":case"continue":return"STATEMENT";default:return j}}()),this.token(j,c),a&&this.token(":",":");return d.length},a.prototype.numberToken=function(){var a,b,c,d,e;if(!(c=E.exec(this.chunk)))return 0;d=c[0],/^0[BOX]/.test(d)?this.error("radix prefix '"+d+"' must be lowercase"):/E/.test(d)&&!/^0x/.test(d)?this.error("exponential notation '"+d+"' must be indicated with a lowercase 'e'"):/^0\d*[89]/.test(d)?this.error("decimal literal '"+d+"' must not be prefixed with '0'"):/^0\d+/.test(d)&&this.error("octal literal '"+d+"' must be prefixed with '0o'"),b=d.length;if(e=/^0o([0-7]+)/.exec(d))d="0x"+parseInt(e[1],8).toString(16);if(a=/^0b([01]+)/.exec(d))d="0x"+parseInt(a[1],2).toString(16);this.token("NUMBER",d);return b},a.prototype.stringToken=function(){var a,b,c;switch(this.chunk.charAt(0)){case"'":if(!(a=L.exec(this.chunk)))return 0;this.token("STRING",(c=a[0]).replace(A,"\\\n"));break;case'"':if(!(c=this.balancedString(this.chunk,'"')))return 0;0<c.indexOf("#{",1)?this.interpolateString(c.slice(1,-1)):this.token("STRING",this.escapeLines(c));break;default:return 0}(b=/^(?:\\.|[^\\])*\\(?:0[0-7]|[1-7])/.test(c))&&this.error("octal escape sequences "+c+" are not allowed"),this.line+=R(c,"\n");return c.length},a.prototype.heredocToken=function(){var a,b,c,d;if(!(c=k.exec(this.chunk)))return 0;b=c[0],d=b.charAt(0),a=this.sanitizeHeredoc(c[2],{quote:d,indent:null}),d==='"'&&0<=a.indexOf("#{")?this.interpolateString(a,{heredoc:!0}):this.token("STRING",this.makeString(a,d,!0)),this.line+=R(b,"\n");return b.length},a.prototype.commentToken=function(){var a,b,c;if(!(c=this.chunk.match(h)))return 0;a=c[0],b=c[1],b&&this.token("HERECOMMENT",this.sanitizeHeredoc(b,{herecomment:!0,indent:Array(this.indent+1).join(" ")})),this.line+=R(a,"\n");return a.length},a.prototype.jsToken=function(){var a,b;if(this.chunk.charAt(0)!=="`"||!(a=s.exec(this.chunk)))return 0;this.token("JS",(b=a[0]).slice(1,-1));return b.length},a.prototype.regexToken=function(){var a,b,c,d,e,f,g;if(this.chunk.charAt(0)!=="/")return 0;if(c=n.exec(this.chunk)){b=this.heregexToken(c),this.line+=R(c[0],"\n");return b}d=T(this.tokens);if(d&&(f=d[0],X.call(d.spaced?C:D,f)>=0))return 0;if(!(c=G.exec(this.chunk)))return 0;g=c,c=g[0],e=g[1],a=g[2],e.slice(0,2)==="/*"&&this.error("regular expressions cannot begin with `*`"),e==="//"&&(e="/(?:)/"),this.token("REGEX",""+e+a);return c.length},a.prototype.heregexToken=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n;d=a[0],b=a[1],c=a[2];if(0>b.indexOf("#{")){e=b.replace(o,"").replace(/\//g,"\\/"),e.match(/^\*/)&&this.error("regular expressions cannot begin with `*`"),this.token("REGEX","/"+(e||"(?:)")+"/"+c);return d.length}this.token("IDENTIFIER","RegExp"),this.tokens.push(["CALL_START","("]),g=[],k=this.interpolateString(b,{regex:!0});for(i=0,j=k.length;i<j;i++){l=k[i],f=l[0],h=l[1];if(f==="TOKENS")g.push.apply(g,h);else{if(!(h=h.replace(o,"")))continue;h=h.replace(/\\/g,"\\\\"),g.push(["STRING",this.makeString(h,'"',!0)])}g.push(["+","+"])}g.pop(),((m=g[0])!=null?m[0]:void 0)!=="STRING"&&this.tokens.push(["STRING",'""'],["+","+"]),(n=this.tokens).push.apply(n,g),c&&this.tokens.push([",",","],["STRING",'"'+c+'"']),this.token(")",")");return d.length},a.prototype.lineToken=function(){var a,b,c,d,e,f;if(!(c=B.exec(this.chunk)))return 0;b=c[0],this.line+=R(b,"\n"),this.seenFor=!1,e=T(this.tokens,1),f=b.length-1-b.lastIndexOf("\n"),d=this.unfinished();if(f-this.indebt===this.indent){d?this.suppressNewlines():this.newlineToken();return b.length}if(f>this.indent){if(d){this.indebt=f-this.indent,this.suppressNewlines();return b.length}a=f-this.indent+this.outdebt,this.token("INDENT",a),this.indents.push(a),this.ends.push("OUTDENT"),this.outdebt=this.indebt=0}else this.indebt=0,this.outdentToken(this.indent-f,d);this.indent=f;return b.length},a.prototype.outdentToken=function(a,b){var c,d;while(a>0)d=this.indents.length-1,this.indents[d]===void 0?a=0:this.indents[d]===this.outdebt?(a-=this.outdebt,this.outdebt=0):this.indents[d]<this.outdebt?(this.outdebt-=this.indents[d],a-=this.indents[d]):(c=this.indents.pop()-this.outdebt,a-=c,this.outdebt=0,this.pair("OUTDENT"),this.token("OUTDENT",c));c&&(this.outdebt-=a);while(this.value()===";")this.tokens.pop();this.tag()!=="TERMINATOR"&&!b&&this.token("TERMINATOR","\n");return this},a.prototype.whitespaceToken=function(){var a,b,c;if(!(a=P.exec(this.chunk))&&!(b=this.chunk.charAt(0)==="\n"))return 0;c=T(this.tokens),c&&(c[a?"spaced":"newLine"]=!0);return a?a[0].length:0},a.prototype.newlineToken=function(){while(this.value()===";")this.tokens.pop();this.tag()!=="TERMINATOR"&&this.token("TERMINATOR","\n");return this},a.prototype.suppressNewlines=function(){this.value()==="\\"&&this.tokens.pop();return this},a.prototype.literalToken=function(){var a,b,e,f,g,h,k,l;(a=F.exec(this.chunk))?(f=a[0],d.test(f)&&this.tagParameters()):f=this.chunk.charAt(0),e=f,b=T(this.tokens);if(f==="="&&b){!b[1].reserved&&(g=b[1],X.call(t,g)>=0)&&this.error('reserved word "'+this.value()+"\" can't be assigned");if((h=b[1])==="||"||h==="&&"){b[0]="COMPOUND_ASSIGN",b[1]+="=";return f.length}}if(f===";")this.seenFor=!1,e="TERMINATOR";else if(X.call(z,f)>=0)e="MATH";else if(X.call(i,f)>=0)e="COMPARE";else if(X.call(j,f)>=0)e="COMPOUND_ASSIGN";else if(X.call(O,f)>=0)e="UNARY";else if(X.call(K,f)>=0)e="SHIFT";else if(X.call(x,f)>=0||f==="?"&&(b!=null?b.spaced:void 0))e="LOGIC";else if(b&&!b.spaced)if(f==="("&&(k=b[0],X.call(c,k)>=0))b[0]==="?"&&(b[0]="FUNC_EXIST"),e="CALL_START";else if(f==="["&&(l=b[0],X.call(q,l)>=0)){e="INDEX_START";switch(b[0]){case"?":b[0]="INDEX_SOAK"}}switch(f){case"(":case"{":case"[":this.ends.push(r[f]);break;case")":case"}":case"]":this.pair(f)}this.token(e,f);return f.length},a.prototype.sanitizeHeredoc=function(a,b){var c,d,e,f,g;e=b.indent,d=b.herecomment;if(d){l.test(a)&&this.error('block comment cannot contain "*/", starting');if(a.indexOf("\n")<=0)return a}else while(f=m.exec(a)){c=f[1];if(e===null||0<(g=c.length)&&g<e.length)e=c}e&&(a=a.replace(RegExp("\\n"+e,"g"),"\n")),d||(a=a.replace(/^\n/,""));return a},a.prototype.tagParameters=function(){var a,b,c,d;if(this.tag()!==")")return this;b=[],d=this.tokens,a=d.length,d[--a][0]="PARAM_END";while(c=d[--a])switch(c[0]){case")":b.push(c);break;case"(":case"CALL_START":if(b.length)b.pop();else{if(c[0]==="("){c[0]="PARAM_START";return this}return this}}return this},a.prototype.closeIndentation=function(){return this.outdentToken(this.indent)},a.prototype.balancedString=function(a,b){var c,d,e,f,g,h,i,j;c=0,h=[b];for(d=i=1,j=a.length;1<=j?i<j:i>j;d=1<=j?++i:--i){if(c){--c;continue}switch(e=a.charAt(d)){case"\\":++c;continue;case b:h.pop();if(!h.length)return a.slice(0,d+1||9e9);b=h[h.length-1];continue}b!=="}"||e!=='"'&&e!=="'"?b==="}"&&e==="/"&&(f=n.exec(a.slice(d))||G.exec(a.slice(d)))?c+=f[0].length-1:b==="}"&&e==="{"?h.push(b="}"):b==='"'&&g==="#"&&e==="{"&&h.push(b="}"):h.push(b=e),g=e}return this.error("missing "+h.pop()+", starting")},a.prototype.interpolateString=function(b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;c==null&&(c={}),e=c.heredoc,m=c.regex,o=[],l=0,f=-1;while(j=b.charAt(f+=1)){if(j==="\\"){f+=1;continue}if(j!=="#"||b.charAt(f+1)!=="{"||!(d=this.balancedString(b.slice(f+1),"}")))continue;l<f&&o.push(["NEOSTRING",b.slice(l,f)]),g=d.slice(1,-1);if(g.length){k=(new a).tokenize(g,{line:this.line,rewrite:!1}),k.pop(),((s=k[0])!=null?s[0]:void 0)==="TERMINATOR"&&k.shift();if(i=k.length)i>1&&(k.unshift(["(","(",this.line]),k.push([")",")",this.line])),o.push(["TOKENS",k])}f+=d.length,l=f+1}f>l&&l<b.length&&o.push(["NEOSTRING",b.slice(l)]);if(m)return o;if(!o.length)return this.token("STRING",'""');o[0][0]!=="NEOSTRING"&&o.unshift(["",""]),(h=o.length>1)&&this.token("(","(");for(f=q=0,r=o.length;q<r;f=++q)t=o[f],n=t[0],p=t[1],f&&this.token("+","+"),n==="TOKENS"?(u=this.tokens).push.apply(u,p):this.token("STRING",this.makeString(p,'"',e));h&&this.token(")",")");return o},a.prototype.pair=function(a){var b,c;if(a!==(c=T(this.ends))){"OUTDENT"!==c&&this.error("unmatched "+a),this.indent-=b=T(this.indents),this.outdentToken(b,!0);return this.pair(a)}return this.ends.pop()},a.prototype.token=function(a,b){return this.tokens.push([a,b,this.line])},a.prototype.tag=function(a,b){var c;return(c=T(this.tokens,a))&&(b?c[0]=b:c[0])},a.prototype.value=function(a,b){var c;return(c=T(this.tokens,a))&&(b?c[1]=b:c[1])},a.prototype.unfinished=function(){var a;return w.test(this.chunk)||(a=this.tag())==="\\"||a==="."||a==="?."||a==="UNARY"||a==="MATH"||a==="+"||a==="-"||a==="SHIFT"||a==="RELATION"||a==="COMPARE"||a==="LOGIC"||a==="THROW"||a==="EXTENDS"},a.prototype.escapeLines=function(a,b){return a.replace(A,b?"\\n":"")},a.prototype.makeString=function(a,b,c){if(!a)return b+b;a=a.replace(/\\([\s\S])/g,function(a,c){return c==="\n"||c===b?c:a}),a=a.replace(RegExp(""+b,"g"),"\\$&");return b+this.escapeLines(a,c)+b},a.prototype.error=function(a){throw SyntaxError(""+a+" on line "+(this.line+1))};return a}(),u=["true","false","null","this","new","delete","typeof","in","instanceof","return","throw","break","continue","debugger","if","else","switch","for","while","do","try","catch","finally","class","extends","super"],g=["undefined","then","unless","until","loop","of","by","when"],f={and:"&&",or:"||",is:"==",isnt:"!=",not:"!",yes:"true",no:"false",on:"true",off:"false"},e=function(){var a;a=[];for(S in f)a.push(S);return a}(),g=g.concat(e),I=["case","default","function","var","void","with","const","let","enum","export","import","native","__hasProp","__extends","__slice","__bind","__indexOf","implements","interface","let","package","private","protected","public","static","yield"],M=["arguments","eval"],t=u.concat(I).concat(M),a.RESERVED=I.concat(u).concat(g).concat(M),a.STRICT_PROSCRIBED=M,p=/^([$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)([^\n\S]*:(?!:))?/,E=/^0b[01]+|^0o[0-7]+|^0x[\da-f]+|^\d*\.?\d+(?:e[+-]?\d+)?/i,k=/^("""|''')([\s\S]*?)(?:\n[^\n\S]*)?\1/,F=/^(?:[-=]>|[-+*\/%<>&|^!?=]=|>>>=?|([-+:])\1|([&|<>])\2=?|\?\.|\.{2,3})/,P=/^[^\n\S]+/,h=/^###([^#][\s\S]*?)(?:###[^\n\S]*|(?:###)?$)|^(?:\s*#(?!##[^#]).*)+/,d=/^[-=]>/,B=/^(?:\n[^\n\S]*)+/,L=/^'[^\\']*(?:\\.[^\\']*)*'/,s=/^`[^\\`]*(?:\\.[^\\`]*)*`/,G=/^(\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)([imgy]{0,4})(?!\w)/,n=/^\/{3}([\s\S]+?)\/{3}([imgy]{0,4})(?!\w)/,o=/\s+(?:#.*)?/g,A=/\n/g,m=/\n+([^\n\S]*)/g,l=/\*\//,w=/^\s*(?:,|\??\.(?![.\d])|::)/,N=/\s+$/,j=["-=","+=","/=","*=","%=","||=","&&=","?=","<<=",">>=",">>>=","&=","^=","|="],O=["!","~","NEW","TYPEOF","DELETE","DO"],x=["&&","||","&","|","^"],K=["<<",">>",">>>"],i=["==","!=","<",">","<=",">="],z=["*","/","%"],H=["IN","OF","INSTANCEOF"],b=["TRUE","FALSE"],C=["NUMBER","REGEX","BOOL","NULL","UNDEFINED","++","--","]"],D=C.concat(")","}","THIS","IDENTIFIER","STRING"),c=["IDENTIFIER","STRING","REGEX",")","]","}","?","::","@","THIS","SUPER"],q=c.concat("NUMBER","BOOL","NULL","UNDEFINED"),v=["INDENT","OUTDENT","TERMINATOR"]}).call(this)},require["./parser"]=new function(){var a=this,b=function(){var a={trace:function(){},yy:{},symbols_:{error:2,Root:3,Body:4,Block:5,TERMINATOR:6,Line:7,Expression:8,Statement:9,Return:10,Comment:11,STATEMENT:12,Value:13,Invocation:14,Code:15,Operation:16,Assign:17,If:18,Try:19,While:20,For:21,Switch:22,Class:23,Throw:24,INDENT:25,OUTDENT:26,Identifier:27,IDENTIFIER:28,AlphaNumeric:29,NUMBER:30,STRING:31,Literal:32,JS:33,REGEX:34,DEBUGGER:35,UNDEFINED:36,NULL:37,BOOL:38,Assignable:39,"=":40,AssignObj:41,ObjAssignable:42,":":43,ThisProperty:44,RETURN:45,HERECOMMENT:46,PARAM_START:47,ParamList:48,PARAM_END:49,FuncGlyph:50,"->":51,"=>":52,OptComma:53,",":54,Param:55,ParamVar:56,"...":57,Array:58,Object:59,Splat:60,SimpleAssignable:61,Accessor:62,Parenthetical:63,Range:64,This:65,".":66,"?.":67,"::":68,Index:69,INDEX_START:70,IndexValue:71,INDEX_END:72,INDEX_SOAK:73,Slice:74,"{":75,AssignList:76,"}":77,CLASS:78,EXTENDS:79,OptFuncExist:80,Arguments:81,SUPER:82,FUNC_EXIST:83,CALL_START:84,CALL_END:85,ArgList:86,THIS:87,"@":88,"[":89,"]":90,RangeDots:91,"..":92,Arg:93,SimpleArgs:94,TRY:95,Catch:96,FINALLY:97,CATCH:98,THROW:99,"(":100,")":101,WhileSource:102,WHILE:103,WHEN:104,UNTIL:105,Loop:106,LOOP:107,ForBody:108,FOR:109,ForStart:110,ForSource:111,ForVariables:112,OWN:113,ForValue:114,FORIN:115,FOROF:116,BY:117,SWITCH:118,Whens:119,ELSE:120,When:121,LEADING_WHEN:122,IfBlock:123,IF:124,POST_IF:125,UNARY:126,"-":127,"+":128,"--":129,"++":130,"?":131,MATH:132,SHIFT:133,COMPARE:134,LOGIC:135,RELATION:136,COMPOUND_ASSIGN:137,$accept:0,$end:1},terminals_:{2:"error",6:"TERMINATOR",12:"STATEMENT",25:"INDENT",26:"OUTDENT",28:"IDENTIFIER",30:"NUMBER",31:"STRING",33:"JS",34:"REGEX",35:"DEBUGGER",36:"UNDEFINED",37:"NULL",38:"BOOL",40:"=",43:":",45:"RETURN",46:"HERECOMMENT",47:"PARAM_START",49:"PARAM_END",51:"->",52:"=>",54:",",57:"...",66:".",67:"?.",68:"::",70:"INDEX_START",72:"INDEX_END",73:"INDEX_SOAK",75:"{",77:"}",78:"CLASS",79:"EXTENDS",82:"SUPER",83:"FUNC_EXIST",84:"CALL_START",85:"CALL_END",87:"THIS",88:"@",89:"[",90:"]",92:"..",95:"TRY",97:"FINALLY",98:"CATCH",99:"THROW",100:"(",101:")",103:"WHILE",104:"WHEN",105:"UNTIL",107:"LOOP",109:"FOR",113:"OWN",115:"FORIN",116:"FOROF",117:"BY",118:"SWITCH",120:"ELSE",122:"LEADING_WHEN",124:"IF",125:"POST_IF",126:"UNARY",127:"-",128:"+",129:"--",130:"++",131:"?",132:"MATH",133:"SHIFT",134:"COMPARE",135:"LOGIC",136:"RELATION",137:"COMPOUND_ASSIGN"},productions_:[0,[3,0],[3,1],[3,2],[4,1],[4,3],[4,2],[7,1],[7,1],[9,1],[9,1],[9,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[5,2],[5,3],[27,1],[29,1],[29,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[17,3],[17,4],[17,5],[41,1],[41,3],[41,5],[41,1],[42,1],[42,1],[42,1],[10,2],[10,1],[11,1],[15,5],[15,2],[50,1],[50,1],[53,0],[53,1],[48,0],[48,1],[48,3],[48,4],[48,6],[55,1],[55,2],[55,3],[56,1],[56,1],[56,1],[56,1],[60,2],[61,1],[61,2],[61,2],[61,1],[39,1],[39,1],[39,1],[13,1],[13,1],[13,1],[13,1],[13,1],[62,2],[62,2],[62,2],[62,1],[62,1],[69,3],[69,2],[71,1],[71,1],[59,4],[76,0],[76,1],[76,3],[76,4],[76,6],[23,1],[23,2],[23,3],[23,4],[23,2],[23,3],[23,4],[23,5],[14,3],[14,3],[14,1],[14,2],[80,0],[80,1],[81,2],[81,4],[65,1],[65,1],[44,2],[58,2],[58,4],[91,1],[91,1],[64,5],[74,3],[74,2],[74,2],[74,1],[86,1],[86,3],[86,4],[86,4],[86,6],[93,1],[93,1],[94,1],[94,3],[19,2],[19,3],[19,4],[19,5],[96,3],[24,2],[63,3],[63,5],[102,2],[102,4],[102,2],[102,4],[20,2],[20,2],[20,2],[20,1],[106,2],[106,2],[21,2],[21,2],[21,2],[108,2],[108,2],[110,2],[110,3],[114,1],[114,1],[114,1],[114,1],[112,1],[112,3],[111,2],[111,2],[111,4],[111,4],[111,4],[111,6],[111,6],[22,5],[22,7],[22,4],[22,6],[119,1],[119,2],[121,3],[121,4],[123,3],[123,5],[18,1],[18,3],[18,3],[18,3],[16,2],[16,2],[16,2],[16,2],[16,2],[16,2],[16,2],[16,2],[16,3],[16,3],[16,3],[16,3],[16,3],[16,3],[16,3],[16,3],[16,5],[16,3]],performAction:function(a,b,c,d,e,f,g){var h=f.length-1;switch(e){case 1:return this.$=new d.Block;case 2:return this.$=f[h];case 3:return this.$=f[h-1];case 4:this.$=d.Block.wrap([f[h]]);break;case 5:this.$=f[h-2].push(f[h]);break;case 6:this.$=f[h-1];break;case 7:this.$=f[h];break;case 8:this.$=f[h];break;case 9:this.$=f[h];break;case 10:this.$=f[h];break;case 11:this.$=new d.Literal(f[h]);break;case 12:this.$=f[h];break;case 13:this.$=f[h];break;case 14:this.$=f[h];break;case 15:this.$=f[h];break;case 16:this.$=f[h];break;case 17:this.$=f[h];break;case 18:this.$=f[h];break;case 19:this.$=f[h];break;case 20:this.$=f[h];break;case 21:this.$=f[h];break;case 22:this.$=f[h];break;case 23:this.$=f[h];break;case 24:this.$=new d.Block;break;case 25:this.$=f[h-1];break;case 26:this.$=new d.Literal(f[h]);break;case 27:this.$=new d.Literal(f[h]);break;case 28:this.$=new d.Literal(f[h]);break;case 29:this.$=f[h];break;case 30:this.$=new d.Literal(f[h]);break;case 31:this.$=new d.Literal(f[h]);break;case 32:this.$=new d.Literal(f[h]);break;case 33:this.$=new d.Undefined;break;case 34:this.$=new d.Null;break;case 35:this.$=new d.Bool(f[h]);break;case 36:this.$=new d.Assign(f[h-2],f[h]);break;case 37:this.$=new d.Assign(f[h-3],f[h]);break;case 38:this.$=new d.Assign(f[h-4],f[h-1]);break;case 39:this.$=new d.Value(f[h]);break;case 40:this.$=new d.Assign(new d.Value(f[h-2]),f[h],"object");break;case 41:this.$=new d.Assign(new d.Value(f[h-4]),f[h-1],"object");break;case 42:this.$=f[h];break;case 43:this.$=f[h];break;case 44:this.$=f[h];break;case 45:this.$=f[h];break;case 46:this.$=new d.Return(f[h]);break;case 47:this.$=new d.Return;break;case 48:this.$=new d.Comment(f[h]);break;case 49:this.$=new d.Code(f[h-3],f[h],f[h-1]);break;case 50:this.$=new d.Code([],f[h],f[h-1]);break;case 51:this.$="func";break;case 52:this.$="boundfunc";break;case 53:this.$=f[h];break;case 54:this.$=f[h];break;case 55:this.$=[];break;case 56:this.$=[f[h]];break;case 57:this.$=f[h-2].concat(f[h]);break;case 58:this.$=f[h-3].concat(f[h]);break;case 59:this.$=f[h-5].concat(f[h-2]);break;case 60:this.$=new d.Param(f[h]);break;case 61:this.$=new d.Param(f[h-1],null,!0);break;case 62:this.$=new d.Param(f[h-2],f[h]);break;case 63:this.$=f[h];break;case 64:this.$=f[h];break;case 65:this.$=f[h];break;case 66:this.$=f[h];break;case 67:this.$=new d.Splat(f[h-1]);break;case 68:this.$=new d.Value(f[h]);break;case 69:this.$=f[h-1].add(f[h]);break;case 70:this.$=new d.Value(f[h-1],[].concat(f[h]));break;case 71:this.$=f[h];break;case 72:this.$=f[h];break;case 73:this.$=new d.Value(f[h]);break;case 74:this.$=new d.Value(f[h]);break;case 75:this.$=f[h];break;case 76:this.$=new d.Value(f[h]);break;case 77:this.$=new d.Value(f[h]);break;case 78:this.$=new d.Value(f[h]);break;case 79:this.$=f[h];break;case 80:this.$=new d.Access(f[h]);break;case 81:this.$=new d.Access(f[h],"soak");break;case 82:this.$=[new d.Access(new d.Literal("prototype")),new d.Access(f[h])];break;case 83:this.$=new d.Access(new d.Literal("prototype"));break;case 84:this.$=f[h];break;case 85:this.$=f[h-1];break;case 86:this.$=d.extend(f[h],{soak:!0});break;case 87:this.$=new d.Index(f[h]);break;case 88:this.$=new d.Slice(f[h]);break;case 89:this.$=new d.Obj(f[h-2],f[h-3].generated);break;case 90:this.$=[];break;case 91:this.$=[f[h]];break;case 92:this.$=f[h-2].concat(f[h]);break;case 93:this.$=f[h-3].concat(f[h]);break;case 94:this.$=f[h-5].concat(f[h-2]);break;case 95:this.$=new d.Class;break;case 96:this.$=new d.Class(null,null,f[h]);break;case 97:this.$=new d.Class(null,f[h]);break;case 98:this.$=new d.Class(null,f[h-1],f[h]);break;case 99:this.$=new d.Class(f[h]);break;case 100:this.$=new d.Class(f[h-1],null,f[h]);break;case 101:this.$=new d.Class(f[h-2],f[h]);break;case 102:this.$=new d.Class(f[h-3],f[h-1],f[h]);break;case 103:this.$=new d.Call(f[h-2],f[h],f[h-1]);break;case 104:this.$=new d.Call(f[h-2],f[h],f[h-1]);break;case 105:this.$=new d.Call("super",[new d.Splat(new d.Literal("arguments"))]);break;case 106:this.$=new d.Call("super",f[h]);break;case 107:this.$=!1;break;case 108:this.$=!0;break;case 109:this.$=[];break;case 110:this.$=f[h-2];break;case 111:this.$=new d.Value(new d.Literal("this"));break;case 112:this.$=new d.Value(new d.Literal("this"));break;case 113:this.$=new d.Value(new d.Literal("this"),[new d.Access(f[h])],"this");break;case 114:this.$=new d.Arr([]);break;case 115:this.$=new d.Arr(f[h-2]);break;case 116:this.$="inclusive";break;case 117:this.$="exclusive";break;case 118:this.$=new d.Range(f[h-3],f[h-1],f[h-2]);break;case 119:this.$=new d.Range(f[h-2],f[h],f[h-1]);break;case 120:this.$=new d.Range(f[h-1],null,f[h]);break;case 121:this.$=new d.Range(null,f[h],f[h-1]);break;case 122:this.$=new d.Range(null,null,f[h]);break;case 123:this.$=[f[h]];break;case 124:this.$=f[h-2].concat(f[h]);break;case 125:this.$=f[h-3].concat(f[h]);break;case 126:this.$=f[h-2];break;case 127:this.$=f[h-5].concat(f[h-2]);break;case 128:this.$=f[h];break;case 129:this.$=f[h];break;case 130:this.$=f[h];break;case 131:this.$=[].concat(f[h-2],f[h]);break;case 132:this.$=new d.Try(f[h]);break;case 133:this.$=new d.Try(f[h-1],f[h][0],f[h][1]);break;case 134:this.$=new d.Try(f[h-2],null,null,f[h]);break;case 135:this.$=new d.Try(f[h-3],f[h-2][0],f[h-2][1],f[h]);break;case 136:this.$=[f[h-1],f[h]];break;case 137:this.$=new d.Throw(f[h]);break;case 138:this.$=new d.Parens(f[h-1]);break;case 139:this.$=new d.Parens(f[h-2]);break;case 140:this.$=new d.While(f[h]);break;case 141:this.$=new d.While(f[h-2],{guard:f[h]});break;case 142:this.$=new d.While(f[h],{invert:!0});break;case 143:this.$=new d.While(f[h-2],{invert:!0,guard:f[h]});break;case 144:this.$=f[h-1].addBody(f[h]);break;case 145:this.$=f[h].addBody(d.Block.wrap([f[h-1]]));break;case 146:this.$=f[h].addBody(d.Block.wrap([f[h-1]]));break;case 147:this.$=f[h];break;case 148:this.$=(new d.While(new d.Literal("true"))).addBody(f[h]);break;case 149:this.$=(new d.While(new d.Literal("true"))).addBody(d.Block.wrap([f[h]]));break;case 150:this.$=new d.For(f[h-1],f[h]);break;case 151:this.$=new d.For(f[h-1],f[h]);break;case 152:this.$=new d.For(f[h],f[h-1]);break;case 153:this.$={source:new d.Value(f[h])};break;case 154:this.$=function(){f[h].own=f[h-1].own,f[h].name=f[h-1][0],f[h].index=f[h-1][1];return f[h]}();break;case 155:this.$=f[h];break;case 156:this.$=function(){f[h].own=!0;return f[h]}();break;case 157:this.$=f[h];break;case 158:this.$=f[h];break;case 159:this.$=new d.Value(f[h]);break;case 160:this.$=new d.Value(f[h]);break;case 161:this.$=[f[h]];break;case 162:this.$=[f[h-2],f[h]];break;case 163:this.$={source:f[h]};break;case 164:this.$={source:f[h],object:!0};break;case 165:this.$={source:f[h-2],guard:f[h]};break;case 166:this.$={source:f[h-2],guard:f[h],object:!0};break;case 167:this.$={source:f[h-2],step:f[h]};break;case 168:this.$={source:f[h-4],guard:f[h-2],step:f[h]};break;case 169:this.$={source:f[h-4],step:f[h-2],guard:f[h]};break;case 170:this.$=new d.Switch(f[h-3],f[h-1]);break;case 171:this.$=new d.Switch(f[h-5],f[h-3],f[h-1]);break;case 172:this.$=new d.Switch(null,f[h-1]);break;case 173:this.$=new d.Switch(null,f[h-3],f[h-1]);break;case 174:this.$=f[h];break;case 175:this.$=f[h-1].concat(f[h]);break;case 176:this.$=[[f[h-1],f[h]]];break;case 177:this.$=[[f[h-2],f[h-1]]];break;case 178:this.$=new d.If(f[h-1],f[h],{type:f[h-2]});break;case 179:this.$=f[h-4].addElse(new d.If(f[h-1],f[h],{type:f[h-2]}));break;case 180:this.$=f[h];break;case 181:this.$=f[h-2].addElse(f[h]);break;case 182:this.$=new d.If(f[h],d.Block.wrap([f[h-2]]),{type:f[h-1],statement:!0});break;case 183:this.$=new d.If(f[h],d.Block.wrap([f[h-2]]),{type:f[h-1],statement:!0});break;case 184:this.$=new d.Op(f[h-1],f[h]);break;case 185:this.$=new d.Op("-",f[h]);break;case 186:this.$=new d.Op("+",f[h]);break;case 187:this.$=new d.Op("--",f[h]);break;case 188:this.$=new d.Op("++",f[h]);break;case 189:this.$=new d.Op("--",f[h-1],null,!0);break;case 190:this.$=new d.Op("++",f[h-1],null,!0);break;case 191:this.$=new d.Existence(f[h-1]);break;case 192:this.$=new d.Op("+",f[h-2],f[h]);break;case 193:this.$=new d.Op("-",f[h-2],f[h]);break;case 194:this.$=new d.Op(f[h-1],f[h-2],f[h]);break;case 195:this.$=new d.Op(f[h-1],f[h-2],f[h]);break;case 196:this.$=new d.Op(f[h-1],f[h-2],f[h]);break;case 197:this.$=new d.Op(f[h-1],f[h-2],f[h]);break;case 198:this.$=function(){return f[h-1].charAt(0)==="!"?(new d.Op(f[h-1].slice(1),f[h-2],f[h])).invert():new d.Op(f[h-1],f[h-2],f[h])}();break;case 199:this.$=new d.Assign(f[h-2],f[h],f[h-1]);break;case 200:this.$=new d.Assign(f[h-4],f[h-1],f[h-3]);break;case 201:this.$=new d.Extends(f[h-2],f[h])}},table:[{1:[2,1],3:1,4:2,5:3,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,5],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[3]},{1:[2,2],6:[1,74]},{6:[1,75]},{1:[2,4],6:[2,4],26:[2,4],101:[2,4]},{4:77,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,26:[1,76],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,7],6:[2,7],26:[2,7],101:[2,7],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,8],6:[2,8],26:[2,8],101:[2,8],102:90,103:[1,65],105:[1,66],108:91,109:[1,68],110:69,125:[1,89]},{1:[2,12],6:[2,12],25:[2,12],26:[2,12],49:[2,12],54:[2,12],57:[2,12],62:93,66:[1,95],67:[1,96],68:[1,97],69:98,70:[1,99],72:[2,12],73:[1,100],77:[2,12],80:92,83:[1,94],84:[2,107],85:[2,12],90:[2,12],92:[2,12],101:[2,12],103:[2,12],104:[2,12],105:[2,12],109:[2,12],117:[2,12],125:[2,12],127:[2,12],128:[2,12],131:[2,12],132:[2,12],133:[2,12],134:[2,12],135:[2,12],136:[2,12]},{1:[2,13],6:[2,13],25:[2,13],26:[2,13],49:[2,13],54:[2,13],57:[2,13],62:102,66:[1,95],67:[1,96],68:[1,97],69:98,70:[1,99],72:[2,13],73:[1,100],77:[2,13],80:101,83:[1,94],84:[2,107],85:[2,13],90:[2,13],92:[2,13],101:[2,13],103:[2,13],104:[2,13],105:[2,13],109:[2,13],117:[2,13],125:[2,13],127:[2,13],128:[2,13],131:[2,13],132:[2,13],133:[2,13],134:[2,13],135:[2,13],136:[2,13]},{1:[2,14],6:[2,14],25:[2,14],26:[2,14],49:[2,14],54:[2,14],57:[2,14],72:[2,14],77:[2,14],85:[2,14],90:[2,14],92:[2,14],101:[2,14],103:[2,14],104:[2,14],105:[2,14],109:[2,14],117:[2,14],125:[2,14],127:[2,14],128:[2,14],131:[2,14],132:[2,14],133:[2,14],134:[2,14],135:[2,14],136:[2,14]},{1:[2,15],6:[2,15],25:[2,15],26:[2,15],49:[2,15],54:[2,15],57:[2,15],72:[2,15],77:[2,15],85:[2,15],90:[2,15],92:[2,15],101:[2,15],103:[2,15],104:[2,15],105:[2,15],109:[2,15],117:[2,15],125:[2,15],127:[2,15],128:[2,15],131:[2,15],132:[2,15],133:[2,15],134:[2,15],135:[2,15],136:[2,15]},{1:[2,16],6:[2,16],25:[2,16],26:[2,16],49:[2,16],54:[2,16],57:[2,16],72:[2,16],77:[2,16],85:[2,16],90:[2,16],92:[2,16],101:[2,16],103:[2,16],104:[2,16],105:[2,16],109:[2,16],117:[2,16],125:[2,16],127:[2,16],128:[2,16],131:[2,16],132:[2,16],133:[2,16],134:[2,16],135:[2,16],136:[2,16]},{1:[2,17],6:[2,17],25:[2,17],26:[2,17],49:[2,17],54:[2,17],57:[2,17],72:[2,17],77:[2,17],85:[2,17],90:[2,17],92:[2,17],101:[2,17],103:[2,17],104:[2,17],105:[2,17],109:[2,17],117:[2,17],125:[2,17],127:[2,17],128:[2,17],131:[2,17],132:[2,17],133:[2,17],134:[2,17],135:[2,17],136:[2,17]},{1:[2,18],6:[2,18],25:[2,18],26:[2,18],49:[2,18],54:[2,18],57:[2,18],72:[2,18],77:[2,18],85:[2,18],90:[2,18],92:[2,18],101:[2,18],103:[2,18],104:[2,18],105:[2,18],109:[2,18],117:[2,18],125:[2,18],127:[2,18],128:[2,18],131:[2,18],132:[2,18],133:[2,18],134:[2,18],135:[2,18],136:[2,18]},{1:[2,19],6:[2,19],25:[2,19],26:[2,19],49:[2,19],54:[2,19],57:[2,19],72:[2,19],77:[2,19],85:[2,19],90:[2,19],92:[2,19],101:[2,19],103:[2,19],104:[2,19],105:[2,19],109:[2,19],117:[2,19],125:[2,19],127:[2,19],128:[2,19],131:[2,19],132:[2,19],133:[2,19],134:[2,19],135:[2,19],136:[2,19]},{1:[2,20],6:[2,20],25:[2,20],26:[2,20],49:[2,20],54:[2,20],57:[2,20],72:[2,20],77:[2,20],85:[2,20],90:[2,20],92:[2,20],101:[2,20],103:[2,20],104:[2,20],105:[2,20],109:[2,20],117:[2,20],125:[2,20],127:[2,20],128:[2,20],131:[2,20],132:[2,20],133:[2,20],134:[2,20],135:[2,20],136:[2,20]},{1:[2,21],6:[2,21],25:[2,21],26:[2,21],49:[2,21],54:[2,21],57:[2,21],72:[2,21],77:[2,21],85:[2,21],90:[2,21],92:[2,21],101:[2,21],103:[2,21],104:[2,21],105:[2,21],109:[2,21],117:[2,21],125:[2,21],127:[2,21],128:[2,21],131:[2,21],132:[2,21],133:[2,21],134:[2,21],135:[2,21],136:[2,21]},{1:[2,22],6:[2,22],25:[2,22],26:[2,22],49:[2,22],54:[2,22],57:[2,22],72:[2,22],77:[2,22],85:[2,22],90:[2,22],92:[2,22],101:[2,22],103:[2,22],104:[2,22],105:[2,22],109:[2,22],117:[2,22],125:[2,22],127:[2,22],128:[2,22],131:[2,22],132:[2,22],133:[2,22],134:[2,22],135:[2,22],136:[2,22]},{1:[2,23],6:[2,23],25:[2,23],26:[2,23],49:[2,23],54:[2,23],57:[2,23],72:[2,23],77:[2,23],85:[2,23],90:[2,23],92:[2,23],101:[2,23],103:[2,23],104:[2,23],105:[2,23],109:[2,23],117:[2,23],125:[2,23],127:[2,23],128:[2,23],131:[2,23],132:[2,23],133:[2,23],134:[2,23],135:[2,23],136:[2,23]},{1:[2,9],6:[2,9],26:[2,9],101:[2,9],103:[2,9],105:[2,9],109:[2,9],125:[2,9]},{1:[2,10],6:[2,10],26:[2,10],101:[2,10],103:[2,10],105:[2,10],109:[2,10],125:[2,10]},{1:[2,11],6:[2,11],26:[2,11],101:[2,11],103:[2,11],105:[2,11],109:[2,11],125:[2,11]},{1:[2,75],6:[2,75],25:[2,75],26:[2,75],40:[1,103],49:[2,75],54:[2,75],57:[2,75],66:[2,75],67:[2,75],68:[2,75],70:[2,75],72:[2,75],73:[2,75],77:[2,75],83:[2,75],84:[2,75],85:[2,75],90:[2,75],92:[2,75],101:[2,75],103:[2,75],104:[2,75],105:[2,75],109:[2,75],117:[2,75],125:[2,75],127:[2,75],128:[2,75],131:[2,75],132:[2,75],133:[2,75],134:[2,75],135:[2,75],136:[2,75]},{1:[2,76],6:[2,76],25:[2,76],26:[2,76],49:[2,76],54:[2,76],57:[2,76],66:[2,76],67:[2,76],68:[2,76],70:[2,76],72:[2,76],73:[2,76],77:[2,76],83:[2,76],84:[2,76],85:[2,76],90:[2,76],92:[2,76],101:[2,76],103:[2,76],104:[2,76],105:[2,76],109:[2,76],117:[2,76],125:[2,76],127:[2,76],128:[2,76],131:[2,76],132:[2,76],133:[2,76],134:[2,76],135:[2,76],136:[2,76]},{1:[2,77],6:[2,77],25:[2,77],26:[2,77],49:[2,77],54:[2,77],57:[2,77],66:[2,77],67:[2,77],68:[2,77],70:[2,77],72:[2,77],73:[2,77],77:[2,77],83:[2,77],84:[2,77],85:[2,77],90:[2,77],92:[2,77],101:[2,77],103:[2,77],104:[2,77],105:[2,77],109:[2,77],117:[2,77],125:[2,77],127:[2,77],128:[2,77],131:[2,77],132:[2,77],133:[2,77],134:[2,77],135:[2,77],136:[2,77]},{1:[2,78],6:[2,78],25:[2,78],26:[2,78],49:[2,78],54:[2,78],57:[2,78],66:[2,78],67:[2,78],68:[2,78],70:[2,78],72:[2,78],73:[2,78],77:[2,78],83:[2,78],84:[2,78],85:[2,78],90:[2,78],92:[2,78],101:[2,78],103:[2,78],104:[2,78],105:[2,78],109:[2,78],117:[2,78],125:[2,78],127:[2,78],128:[2,78],131:[2,78],132:[2,78],133:[2,78],134:[2,78],135:[2,78],136:[2,78]},{1:[2,79],6:[2,79],25:[2,79],26:[2,79],49:[2,79],54:[2,79],57:[2,79],66:[2,79],67:[2,79],68:[2,79],70:[2,79],72:[2,79],73:[2,79],77:[2,79],83:[2,79],84:[2,79],85:[2,79],90:[2,79],92:[2,79],101:[2,79],103:[2,79],104:[2,79],105:[2,79],109:[2,79],117:[2,79],125:[2,79],127:[2,79],128:[2,79],131:[2,79],132:[2,79],133:[2,79],134:[2,79],135:[2,79],136:[2,79]},{1:[2,105],6:[2,105],25:[2,105],26:[2,105],49:[2,105],54:[2,105],57:[2,105],66:[2,105],67:[2,105],68:[2,105],70:[2,105],72:[2,105],73:[2,105],77:[2,105],81:104,83:[2,105],84:[1,105],85:[2,105],90:[2,105],92:[2,105],101:[2,105],103:[2,105],104:[2,105],105:[2,105],109:[2,105],117:[2,105],125:[2,105],127:[2,105],128:[2,105],131:[2,105],132:[2,105],133:[2,105],134:[2,105],135:[2,105],136:[2,105]},{6:[2,55],25:[2,55],27:109,28:[1,73],44:110,48:106,49:[2,55],54:[2,55],55:107,56:108,58:111,59:112,75:[1,70],88:[1,113],89:[1,114]},{5:115,25:[1,5]},{8:116,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:118,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:119,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{13:121,14:122,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:123,44:63,58:47,59:48,61:120,63:25,64:26,65:27,75:[1,70],82:[1,28],87:[1,58],88:[1,59],89:[1,57],100:[1,56]},{13:121,14:122,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:123,44:63,58:47,59:48,61:124,63:25,64:26,65:27,75:[1,70],82:[1,28],87:[1,58],88:[1,59],89:[1,57],100:[1,56]},{1:[2,72],6:[2,72],25:[2,72],26:[2,72],40:[2,72],49:[2,72],54:[2,72],57:[2,72],66:[2,72],67:[2,72],68:[2,72],70:[2,72],72:[2,72],73:[2,72],77:[2,72],79:[1,128],83:[2,72],84:[2,72],85:[2,72],90:[2,72],92:[2,72],101:[2,72],103:[2,72],104:[2,72],105:[2,72],109:[2,72],117:[2,72],125:[2,72],127:[2,72],128:[2,72],129:[1,125],130:[1,126],131:[2,72],132:[2,72],133:[2,72],134:[2,72],135:[2,72],136:[2,72],137:[1,127]},{1:[2,180],6:[2,180],25:[2,180],26:[2,180],49:[2,180],54:[2,180],57:[2,180],72:[2,180],77:[2,180],85:[2,180],90:[2,180],92:[2,180],101:[2,180],103:[2,180],104:[2,180],105:[2,180],109:[2,180],117:[2,180],120:[1,129],125:[2,180],127:[2,180],128:[2,180],131:[2,180],132:[2,180],133:[2,180],134:[2,180],135:[2,180],136:[2,180]},{5:130,25:[1,5]},{5:131,25:[1,5]},{1:[2,147],6:[2,147],25:[2,147],26:[2,147],49:[2,147],54:[2,147],57:[2,147],72:[2,147],77:[2,147],85:[2,147],90:[2,147],92:[2,147],101:[2,147],103:[2,147],104:[2,147],105:[2,147],109:[2,147],117:[2,147],125:[2,147],127:[2,147],128:[2,147],131:[2,147],132:[2,147],133:[2,147],134:[2,147],135:[2,147],136:[2,147]},{5:132,25:[1,5]},{8:133,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,134],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,95],5:135,6:[2,95],13:121,14:122,25:[1,5],26:[2,95],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:123,44:63,49:[2,95],54:[2,95],57:[2,95],58:47,59:48,61:137,63:25,64:26,65:27,72:[2,95],75:[1,70],77:[2,95],79:[1,136],82:[1,28],85:[2,95],87:[1,58],88:[1,59],89:[1,57],90:[2,95],92:[2,95],100:[1,56],101:[2,95],103:[2,95],104:[2,95],105:[2,95],109:[2,95],117:[2,95],125:[2,95],127:[2,95],128:[2,95],131:[2,95],132:[2,95],133:[2,95],134:[2,95],135:[2,95],136:[2,95]},{8:138,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,47],6:[2,47],8:139,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,26:[2,47],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],101:[2,47],102:39,103:[2,47],105:[2,47],106:40,107:[1,67],108:41,109:[2,47],110:69,118:[1,42],123:37,124:[1,64],125:[2,47],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,48],6:[2,48],25:[2,48],26:[2,48],54:[2,48],77:[2,48],101:[2,48],103:[2,48],105:[2,48],109:[2,48],125:[2,48]},{1:[2,73],6:[2,73],25:[2,73],26:[2,73],40:[2,73],49:[2,73],54:[2,73],57:[2,73],66:[2,73],67:[2,73],68:[2,73],70:[2,73],72:[2,73],73:[2,73],77:[2,73],83:[2,73],84:[2,73],85:[2,73],90:[2,73],92:[2,73],101:[2,73],103:[2,73],104:[2,73],105:[2,73],109:[2,73],117:[2,73],125:[2,73],127:[2,73],128:[2,73],131:[2,73],132:[2,73],133:[2,73],134:[2,73],135:[2,73],136:[2,73]},{1:[2,74],6:[2,74],25:[2,74],26:[2,74],40:[2,74],49:[2,74],54:[2,74],57:[2,74],66:[2,74],67:[2,74],68:[2,74],70:[2,74],72:[2,74],73:[2,74],77:[2,74],83:[2,74],84:[2,74],85:[2,74],90:[2,74],92:[2,74],101:[2,74],103:[2,74],104:[2,74],105:[2,74],109:[2,74],117:[2,74],125:[2,74],127:[2,74],128:[2,74],131:[2,74],132:[2,74],133:[2,74],134:[2,74],135:[2,74],136:[2,74]},{1:[2,29],6:[2,29],25:[2,29],26:[2,29],49:[2,29],54:[2,29],57:[2,29],66:[2,29],67:[2,29],68:[2,29],70:[2,29],72:[2,29],73:[2,29],77:[2,29],83:[2,29],84:[2,29],85:[2,29],90:[2,29],92:[2,29],101:[2,29],103:[2,29],104:[2,29],105:[2,29],109:[2,29],117:[2,29],125:[2,29],127:[2,29],128:[2,29],131:[2,29],132:[2,29],133:[2,29],134:[2,29],135:[2,29],136:[2,29]},{1:[2,30],6:[2,30],25:[2,30],26:[2,30],49:[2,30],54:[2,30],57:[2,30],66:[2,30],67:[2,30],68:[2,30],70:[2,30],72:[2,30],73:[2,30],77:[2,30],83:[2,30],84:[2,30],85:[2,30],90:[2,30],92:[2,30],101:[2,30],103:[2,30],104:[2,30],105:[2,30],109:[2,30],117:[2,30],125:[2,30],127:[2,30],128:[2,30],131:[2,30],132:[2,30],133:[2,30],134:[2,30],135:[2,30],136:[2,30]},{1:[2,31],6:[2,31],25:[2,31],26:[2,31],49:[2,31],54:[2,31],57:[2,31],66:[2,31],67:[2,31],68:[2,31],70:[2,31],72:[2,31],73:[2,31],77:[2,31],83:[2,31],84:[2,31],85:[2,31],90:[2,31],92:[2,31],101:[2,31],103:[2,31],104:[2,31],105:[2,31],109:[2,31],117:[2,31],125:[2,31],127:[2,31],128:[2,31],131:[2,31],132:[2,31],133:[2,31],134:[2,31],135:[2,31],136:[2,31]},{1:[2,32],6:[2,32],25:[2,32],26:[2,32],49:[2,32],54:[2,32],57:[2,32],66:[2,32],67:[2,32],68:[2,32],70:[2,32],72:[2,32],73:[2,32],77:[2,32],83:[2,32],84:[2,32],85:[2,32],90:[2,32],92:[2,32],101:[2,32],103:[2,32],104:[2,32],105:[2,32],109:[2,32],117:[2,32],125:[2,32],127:[2,32],128:[2,32],131:[2,32],132:[2,32],133:[2,32],134:[2,32],135:[2,32],136:[2,32]},{1:[2,33],6:[2,33],25:[2,33],26:[2,33],49:[2,33],54:[2,33],57:[2,33],66:[2,33],67:[2,33],68:[2,33],70:[2,33],72:[2,33],73:[2,33],77:[2,33],83:[2,33],84:[2,33],85:[2,33],90:[2,33],92:[2,33],101:[2,33],103:[2,33],104:[2,33],105:[2,33],109:[2,33],117:[2,33],125:[2,33],127:[2,33],128:[2,33],131:[2,33],132:[2,33],133:[2,33],134:[2,33],135:[2,33],136:[2,33]},{1:[2,34],6:[2,34],25:[2,34],26:[2,34],49:[2,34],54:[2,34],57:[2,34],66:[2,34],67:[2,34],68:[2,34],70:[2,34],72:[2,34],73:[2,34],77:[2,34],83:[2,34],84:[2,34],85:[2,34],90:[2,34],92:[2,34],101:[2,34],103:[2,34],104:[2,34],105:[2,34],109:[2,34],117:[2,34],125:[2,34],127:[2,34],128:[2,34],131:[2,34],132:[2,34],133:[2,34],134:[2,34],135:[2,34],136:[2,34]},{1:[2,35],6:[2,35],25:[2,35],26:[2,35],49:[2,35],54:[2,35],57:[2,35],66:[2,35],67:[2,35],68:[2,35],70:[2,35],72:[2,35],73:[2,35],77:[2,35],83:[2,35],84:[2,35],85:[2,35],90:[2,35],92:[2,35],101:[2,35],103:[2,35],104:[2,35],105:[2,35],109:[2,35],117:[2,35],125:[2,35],127:[2,35],128:[2,35],131:[2,35],132:[2,35],133:[2,35],134:[2,35],135:[2,35],136:[2,35]},{4:140,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,141],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:142,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,146],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],86:144,87:[1,58],88:[1,59],89:[1,57],90:[1,143],93:145,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,111],6:[2,111],25:[2,111],26:[2,111],49:[2,111],54:[2,111],57:[2,111],66:[2,111],67:[2,111],68:[2,111],70:[2,111],72:[2,111],73:[2,111],77:[2,111],83:[2,111],84:[2,111],85:[2,111],90:[2,111],92:[2,111],101:[2,111],103:[2,111],104:[2,111],105:[2,111],109:[2,111],117:[2,111],125:[2,111],127:[2,111],128:[2,111],131:[2,111],132:[2,111],133:[2,111],134:[2,111],135:[2,111],136:[2,111]},{1:[2,112],6:[2,112],25:[2,112],26:[2,112],27:148,28:[1,73],49:[2,112],54:[2,112],57:[2,112],66:[2,112],67:[2,112],68:[2,112],70:[2,112],72:[2,112],73:[2,112],77:[2,112],83:[2,112],84:[2,112],85:[2,112],90:[2,112],92:[2,112],101:[2,112],103:[2,112],104:[2,112],105:[2,112],109:[2,112],117:[2,112],125:[2,112],127:[2,112],128:[2,112],131:[2,112],132:[2,112],133:[2,112],134:[2,112],135:[2,112],136:[2,112]},{25:[2,51]},{25:[2,52]},{1:[2,68],6:[2,68],25:[2,68],26:[2,68],40:[2,68],49:[2,68],54:[2,68],57:[2,68],66:[2,68],67:[2,68],68:[2,68],70:[2,68],72:[2,68],73:[2,68],77:[2,68],79:[2,68],83:[2,68],84:[2,68],85:[2,68],90:[2,68],92:[2,68],101:[2,68],103:[2,68],104:[2,68],105:[2,68],109:[2,68],117:[2,68],125:[2,68],127:[2,68],128:[2,68],129:[2,68],130:[2,68],131:[2,68],132:[2,68],133:[2,68],134:[2,68],135:[2,68],136:[2,68],137:[2,68]},{1:[2,71],6:[2,71],25:[2,71],26:[2,71],40:[2,71],49:[2,71],54:[2,71],57:[2,71],66:[2,71],67:[2,71],68:[2,71],70:[2,71],72:[2,71],73:[2,71],77:[2,71],79:[2,71],83:[2,71],84:[2,71],85:[2,71],90:[2,71],92:[2,71],101:[2,71],103:[2,71],104:[2,71],105:[2,71],109:[2,71],117:[2,71],125:[2,71],127:[2,71],128:[2,71],129:[2,71],130:[2,71],131:[2,71],132:[2,71],133:[2,71],134:[2,71],135:[2,71],136:[2,71],137:[2,71]},{8:149,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:150,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:151,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{5:152,8:153,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,5],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{27:158,28:[1,73],44:159,58:160,59:161,64:154,75:[1,70],88:[1,113],89:[1,57],112:155,113:[1,156],114:157},{111:162,115:[1,163],116:[1,164]},{6:[2,90],11:168,25:[2,90],27:169,28:[1,73],29:170,30:[1,71],31:[1,72],41:166,42:167,44:171,46:[1,46],54:[2,90],76:165,77:[2,90],88:[1,113]},{1:[2,27],6:[2,27],25:[2,27],26:[2,27],43:[2,27],49:[2,27],54:[2,27],57:[2,27],66:[2,27],67:[2,27],68:[2,27],70:[2,27],72:[2,27],73:[2,27],77:[2,27],83:[2,27],84:[2,27],85:[2,27],90:[2,27],92:[2,27],101:[2,27],103:[2,27],104:[2,27],105:[2,27],109:[2,27],117:[2,27],125:[2,27],127:[2,27],128:[2,27],131:[2,27],132:[2,27],133:[2,27],134:[2,27],135:[2,27],136:[2,27]},{1:[2,28],6:[2,28],25:[2,28],26:[2,28],43:[2,28],49:[2,28],54:[2,28],57:[2,28],66:[2,28],67:[2,28],68:[2,28],70:[2,28],72:[2,28],73:[2,28],77:[2,28],83:[2,28],84:[2,28],85:[2,28],90:[2,28],92:[2,28],101:[2,28],103:[2,28],104:[2,28],105:[2,28],109:[2,28],117:[2,28],125:[2,28],127:[2,28],128:[2,28],131:[2,28],132:[2,28],133:[2,28],134:[2,28],135:[2,28],136:[2,28]},{1:[2,26],6:[2,26],25:[2,26],26:[2,26],40:[2,26],43:[2,26],49:[2,26],54:[2,26],57:[2,26],66:[2,26],67:[2,26],68:[2,26],70:[2,26],72:[2,26],73:[2,26],77:[2,26],79:[2,26],83:[2,26],84:[2,26],85:[2,26],90:[2,26],92:[2,26],101:[2,26],103:[2,26],104:[2,26],105:[2,26],109:[2,26],115:[2,26],116:[2,26],117:[2,26],125:[2,26],127:[2,26],128:[2,26],129:[2,26],130:[2,26],131:[2,26],132:[2,26],133:[2,26],134:[2,26],135:[2,26],136:[2,26],137:[2,26]},{1:[2,6],6:[2,6],7:172,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,26:[2,6],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],101:[2,6],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,3]},{1:[2,24],6:[2,24],25:[2,24],26:[2,24],49:[2,24],54:[2,24],57:[2,24],72:[2,24],77:[2,24],85:[2,24],90:[2,24],92:[2,24],97:[2,24],98:[2,24],101:[2,24],103:[2,24],104:[2,24],105:[2,24],109:[2,24],117:[2,24],120:[2,24],122:[2,24],125:[2,24],127:[2,24],128:[2,24],131:[2,24],132:[2,24],133:[2,24],134:[2,24],135:[2,24],136:[2,24]},{6:[1,74],26:[1,173]},{1:[2,191],6:[2,191],25:[2,191],26:[2,191],49:[2,191],54:[2,191],57:[2,191],72:[2,191],77:[2,191],85:[2,191],90:[2,191],92:[2,191],101:[2,191],103:[2,191],104:[2,191],105:[2,191],109:[2,191],117:[2,191],125:[2,191],127:[2,191],128:[2,191],131:[2,191],132:[2,191],133:[2,191],134:[2,191],135:[2,191],136:[2,191]},{8:174,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:175,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:176,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:177,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:178,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:179,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:180,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:181,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,146],6:[2,146],25:[2,146],26:[2,146],49:[2,146],54:[2,146],57:[2,146],72:[2,146],77:[2,146],85:[2,146],90:[2,146],92:[2,146],101:[2,146],103:[2,146],104:[2,146],105:[2,146],109:[2,146],117:[2,146],125:[2,146],127:[2,146],128:[2,146],131:[2,146],132:[2,146],133:[2,146],134:[2,146],135:[2,146],136:[2,146]},{1:[2,151],6:[2,151],25:[2,151],26:[2,151],49:[2,151],54:[2,151],57:[2,151],72:[2,151],77:[2,151],85:[2,151],90:[2,151],92:[2,151],101:[2,151],103:[2,151],104:[2,151],105:[2,151],109:[2,151],117:[2,151],125:[2,151],127:[2,151],128:[2,151],131:[2,151],132:[2,151],133:[2,151],134:[2,151],135:[2,151],136:[2,151]},{8:182,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,145],6:[2,145],25:[2,145],26:[2,145],49:[2,145],54:[2,145],57:[2,145],72:[2,145],77:[2,145],85:[2,145],90:[2,145],92:[2,145],101:[2,145],103:[2,145],104:[2,145],105:[2,145],109:[2,145],117:[2,145],125:[2,145],127:[2,145],128:[2,145],131:[2,145],132:[2,145],133:[2,145],134:[2,145],135:[2,145],136:[2,145]},{1:[2,150],6:[2,150],25:[2,150],26:[2,150],49:[2,150],54:[2,150],57:[2,150],72:[2,150],77:[2,150],85:[2,150],90:[2,150],92:[2,150],101:[2,150],103:[2,150],104:[2,150],105:[2,150],109:[2,150],117:[2,150],125:[2,150],127:[2,150],128:[2,150],131:[2,150],132:[2,150],133:[2,150],134:[2,150],135:[2,150],136:[2,150]},{81:183,84:[1,105]},{1:[2,69],6:[2,69],25:[2,69],26:[2,69],40:[2,69],49:[2,69],54:[2,69],57:[2,69],66:[2,69],67:[2,69],68:[2,69],70:[2,69],72:[2,69],73:[2,69],77:[2,69],79:[2,69],83:[2,69],84:[2,69],85:[2,69],90:[2,69],92:[2,69],101:[2,69],103:[2,69],104:[2,69],105:[2,69],109:[2,69],117:[2,69],125:[2,69],127:[2,69],128:[2,69],129:[2,69],130:[2,69],131:[2,69],132:[2,69],133:[2,69],134:[2,69],135:[2,69],136:[2,69],137:[2,69]},{84:[2,108]},{27:184,28:[1,73]},{27:185,28:[1,73]},{1:[2,83],6:[2,83],25:[2,83],26:[2,83],27:186,28:[1,73],40:[2,83],49:[2,83],54:[2,83],57:[2,83],66:[2,83],67:[2,83],68:[2,83],70:[2,83],72:[2,83],73:[2,83],77:[2,83],79:[2,83],83:[2,83],84:[2,83],85:[2,83],90:[2,83],92:[2,83],101:[2,83],103:[2,83],104:[2,83],105:[2,83],109:[2,83],117:[2,83],125:[2,83],127:[2,83],128:[2,83],129:[2,83],130:[2,83],131:[2,83],132:[2,83],133:[2,83],134:[2,83],135:[2,83],136:[2,83],137:[2,83]},{1:[2,84],6:[2,84],25:[2,84],26:[2,84],40:[2,84],49:[2,84],54:[2,84],57:[2,84],66:[2,84],67:[2,84],68:[2,84],70:[2,84],72:[2,84],73:[2,84],77:[2,84],79:[2,84],83:[2,84],84:[2,84],85:[2,84],90:[2,84],92:[2,84],101:[2,84],103:[2,84],104:[2,84],105:[2,84],109:[2,84],117:[2,84],125:[2,84],127:[2,84],128:[2,84],129:[2,84],130:[2,84],131:[2,84],132:[2,84],133:[2,84],134:[2,84],135:[2,84],136:[2,84],137:[2,84]},{8:188,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],57:[1,192],58:47,59:48,61:36,63:25,64:26,65:27,71:187,74:189,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],91:190,92:[1,191],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{69:193,70:[1,99],73:[1,100]},{81:194,84:[1,105]},{1:[2,70],6:[2,70],25:[2,70],26:[2,70],40:[2,70],49:[2,70],54:[2,70],57:[2,70],66:[2,70],67:[2,70],68:[2,70],70:[2,70],72:[2,70],73:[2,70],77:[2,70],79:[2,70],83:[2,70],84:[2,70],85:[2,70],90:[2,70],92:[2,70],101:[2,70],103:[2,70],104:[2,70],105:[2,70],109:[2,70],117:[2,70],125:[2,70],127:[2,70],128:[2,70],129:[2,70],130:[2,70],131:[2,70],132:[2,70],133:[2,70],134:[2,70],135:[2,70],136:[2,70],137:[2,70]},{6:[1,196],8:195,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,197],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,106],6:[2,106],25:[2,106],26:[2,106],49:[2,106],54:[2,106],57:[2,106],66:[2,106],67:[2,106],68:[2,106],70:[2,106],72:[2,106],73:[2,106],77:[2,106],83:[2,106],84:[2,106],85:[2,106],90:[2,106],92:[2,106],101:[2,106],103:[2,106],104:[2,106],105:[2,106],109:[2,106],117:[2,106],125:[2,106],127:[2,106],128:[2,106],131:[2,106],132:[2,106],133:[2,106],134:[2,106],135:[2,106],136:[2,106]},{8:200,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,146],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],85:[1,198],86:199,87:[1,58],88:[1,59],89:[1,57],93:145,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,53],25:[2,53],49:[1,201],53:203,54:[1,202]},{6:[2,56],25:[2,56],26:[2,56],49:[2,56],54:[2,56]},{6:[2,60],25:[2,60],26:[2,60],40:[1,205],49:[2,60],54:[2,60],57:[1,204]},{6:[2,63],25:[2,63],26:[2,63],40:[2,63],49:[2,63],54:[2,63],57:[2,63]},{6:[2,64],25:[2,64],26:[2,64],40:[2,64],49:[2,64],54:[2,64],57:[2,64]},{6:[2,65],25:[2,65],26:[2,65],40:[2,65],49:[2,65],54:[2,65],57:[2,65]},{6:[2,66],25:[2,66],26:[2,66],40:[2,66],49:[2,66],54:[2,66],57:[2,66]},{27:148,28:[1,73]},{8:200,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,146],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],86:144,87:[1,58],88:[1,59],89:[1,57],90:[1,143],93:145,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,50],6:[2,50],25:[2,50],26:[2,50],49:[2,50],54:[2,50],57:[2,50],72:[2,50],77:[2,50],85:[2,50],90:[2,50],92:[2,50],101:[2,50],103:[2,50],104:[2,50],105:[2,50],109:[2,50],117:[2,50],125:[2,50],127:[2,50],128:[2,50],131:[2,50],132:[2,50],133:[2,50],134:[2,50],135:[2,50],136:[2,50]},{1:[2,184],6:[2,184],25:[2,184],26:[2,184],49:[2,184],54:[2,184],57:[2,184],72:[2,184],77:[2,184],85:[2,184],90:[2,184],92:[2,184],101:[2,184],102:87,103:[2,184],104:[2,184],105:[2,184],108:88,109:[2,184],110:69,117:[2,184],125:[2,184],127:[2,184],128:[2,184],131:[1,78],132:[2,184],133:[2,184],134:[2,184],135:[2,184],136:[2,184]},{102:90,103:[1,65],105:[1,66],108:91,109:[1,68],110:69,125:[1,89]},{1:[2,185],6:[2,185],25:[2,185],26:[2,185],49:[2,185],54:[2,185],57:[2,185],72:[2,185],77:[2,185],85:[2,185],90:[2,185],92:[2,185],101:[2,185],102:87,103:[2,185],104:[2,185],105:[2,185],108:88,109:[2,185],110:69,117:[2,185],125:[2,185],127:[2,185],128:[2,185],131:[1,78],132:[2,185],133:[2,185],134:[2,185],135:[2,185],136:[2,185]},{1:[2,186],6:[2,186],25:[2,186],26:[2,186],49:[2,186],54:[2,186],57:[2,186],72:[2,186],77:[2,186],85:[2,186],90:[2,186],92:[2,186],101:[2,186],102:87,103:[2,186],104:[2,186],105:[2,186],108:88,109:[2,186],110:69,117:[2,186],125:[2,186],127:[2,186],128:[2,186],131:[1,78],132:[2,186],133:[2,186],134:[2,186],135:[2,186],136:[2,186]},{1:[2,187],6:[2,187],25:[2,187],26:[2,187],49:[2,187],54:[2,187],57:[2,187],66:[2,72],67:[2,72],68:[2,72],70:[2,72],72:[2,187],73:[2,72],77:[2,187],83:[2,72],84:[2,72],85:[2,187],90:[2,187],92:[2,187],101:[2,187],103:[2,187],104:[2,187],105:[2,187],109:[2,187],117:[2,187],125:[2,187],127:[2,187],128:[2,187],131:[2,187],132:[2,187],133:[2,187],134:[2,187],135:[2,187],136:[2,187]},{62:93,66:[1,95],67:[1,96],68:[1,97],69:98,70:[1,99],73:[1,100],80:92,83:[1,94],84:[2,107]},{62:102,66:[1,95],67:[1,96],68:[1,97],69:98,70:[1,99],73:[1,100],80:101,83:[1,94],84:[2,107]},{66:[2,75],67:[2,75],68:[2,75],70:[2,75],73:[2,75],83:[2,75],84:[2,75]},{1:[2,188],6:[2,188],25:[2,188],26:[2,188],49:[2,188],54:[2,188],57:[2,188],66:[2,72],67:[2,72],68:[2,72],70:[2,72],72:[2,188],73:[2,72],77:[2,188],83:[2,72],84:[2,72],85:[2,188],90:[2,188],92:[2,188],101:[2,188],103:[2,188],104:[2,188],105:[2,188],109:[2,188],117:[2,188],125:[2,188],127:[2,188],128:[2,188],131:[2,188],132:[2,188],133:[2,188],134:[2,188],135:[2,188],136:[2,188]},{1:[2,189],6:[2,189],25:[2,189],26:[2,189],49:[2,189],54:[2,189],57:[2,189],72:[2,189],77:[2,189],85:[2,189],90:[2,189],92:[2,189],101:[2,189],103:[2,189],104:[2,189],105:[2,189],109:[2,189],117:[2,189],125:[2,189],127:[2,189],128:[2,189],131:[2,189],132:[2,189],133:[2,189],134:[2,189],135:[2,189],136:[2,189]},{1:[2,190],6:[2,190],25:[2,190],26:[2,190],49:[2,190],54:[2,190],57:[2,190],72:[2,190],77:[2,190],85:[2,190],90:[2,190],92:[2,190],101:[2,190],103:[2,190],104:[2,190],105:[2,190],109:[2,190],117:[2,190],125:[2,190],127:[2,190],128:[2,190],131:[2,190],132:[2,190],133:[2,190],134:[2,190],135:[2,190],136:[2,190]},{8:206,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,207],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:208,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{5:209,25:[1,5],124:[1,210]},{1:[2,132],6:[2,132],25:[2,132],26:[2,132],49:[2,132],54:[2,132],57:[2,132],72:[2,132],77:[2,132],85:[2,132],90:[2,132],92:[2,132],96:211,97:[1,212],98:[1,213],101:[2,132],103:[2,132],104:[2,132],105:[2,132],109:[2,132],117:[2,132],125:[2,132],127:[2,132],128:[2,132],131:[2,132],132:[2,132],133:[2,132],134:[2,132],135:[2,132],136:[2,132]},{1:[2,144],6:[2,144],25:[2,144],26:[2,144],49:[2,144],54:[2,144],57:[2,144],72:[2,144],77:[2,144],85:[2,144],90:[2,144],92:[2,144],101:[2,144],103:[2,144],104:[2,144],105:[2,144],109:[2,144],117:[2,144],125:[2,144],127:[2,144],128:[2,144],131:[2,144],132:[2,144],133:[2,144],134:[2,144],135:[2,144],136:[2,144]},{1:[2,152],6:[2,152],25:[2,152],26:[2,152],49:[2,152],54:[2,152],57:[2,152],72:[2,152],77:[2,152],85:[2,152],90:[2,152],92:[2,152],101:[2,152],103:[2,152],104:[2,152],105:[2,152],109:[2,152],117:[2,152],125:[2,152],127:[2,152],128:[2,152],131:[2,152],132:[2,152],133:[2,152],134:[2,152],135:[2,152],136:[2,152]},{25:[1,214],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{119:215,121:216,122:[1,217]},{1:[2,96],6:[2,96],25:[2,96],26:[2,96],49:[2,96],54:[2,96],57:[2,96],72:[2,96],77:[2,96],85:[2,96],90:[2,96],92:[2,96],101:[2,96],103:[2,96],104:[2,96],105:[2,96],109:[2,96],117:[2,96],125:[2,96],127:[2,96],128:[2,96],131:[2,96],132:[2,96],133:[2,96],134:[2,96],135:[2,96],136:[2,96]},{8:218,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,99],5:219,6:[2,99],25:[1,5],26:[2,99],49:[2,99],54:[2,99],57:[2,99],66:[2,72],67:[2,72],68:[2,72],70:[2,72],72:[2,99],73:[2,72],77:[2,99],79:[1,220],83:[2,72],84:[2,72],85:[2,99],90:[2,99],92:[2,99],101:[2,99],103:[2,99],104:[2,99],105:[2,99],109:[2,99],117:[2,99],125:[2,99],127:[2,99],128:[2,99],131:[2,99],132:[2,99],133:[2,99],134:[2,99],135:[2,99],136:[2,99]},{1:[2,137],6:[2,137],25:[2,137],26:[2,137],49:[2,137],54:[2,137],57:[2,137],72:[2,137],77:[2,137],85:[2,137],90:[2,137],92:[2,137],101:[2,137],102:87,103:[2,137],104:[2,137],105:[2,137],108:88,109:[2,137],110:69,117:[2,137],125:[2,137],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,46],6:[2,46],26:[2,46],101:[2,46],102:87,103:[2,46],105:[2,46],108:88,109:[2,46],110:69,125:[2,46],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[1,74],101:[1,221]},{4:222,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,128],25:[2,128],54:[2,128],57:[1,224],90:[2,128],91:223,92:[1,191],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,114],6:[2,114],25:[2,114],26:[2,114],40:[2,114],49:[2,114],54:[2,114],57:[2,114],66:[2,114],67:[2,114],68:[2,114],70:[2,114],72:[2,114],73:[2,114],77:[2,114],83:[2,114],84:[2,114],85:[2,114],90:[2,114],92:[2,114],101:[2,114],103:[2,114],104:[2,114],105:[2,114],109:[2,114],115:[2,114],116:[2,114],117:[2,114],125:[2,114],127:[2,114],128:[2,114],131:[2,114],132:[2,114],133:[2,114],134:[2,114],135:[2,114],136:[2,114]},{6:[2,53],25:[2,53],53:225,54:[1,226],90:[2,53]},{6:[2,123],25:[2,123],26:[2,123],54:[2,123],85:[2,123],90:[2,123]},{8:200,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,146],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],86:227,87:[1,58],88:[1,59],89:[1,57],93:145,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,129],25:[2,129],26:[2,129],54:[2,129],85:[2,129],90:[2,129]},{1:[2,113],6:[2,113],25:[2,113],26:[2,113],40:[2,113],43:[2,113],49:[2,113],54:[2,113],57:[2,113],66:[2,113],67:[2,113],68:[2,113],70:[2,113],72:[2,113],73:[2,113],77:[2,113],79:[2,113],83:[2,113],84:[2,113],85:[2,113],90:[2,113],92:[2,113],101:[2,113],103:[2,113],104:[2,113],105:[2,113],109:[2,113],115:[2,113],116:[2,113],117:[2,113],125:[2,113],127:[2,113],128:[2,113],129:[2,113],130:[2,113],131:[2,113],132:[2,113],133:[2,113],134:[2,113],135:[2,113],136:[2,113],137:[2,113]},{5:228,25:[1,5],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,140],6:[2,140],25:[2,140],26:[2,140],49:[2,140],54:[2,140],57:[2,140],72:[2,140],77:[2,140],85:[2,140],90:[2,140],92:[2,140],101:[2,140],102:87,103:[1,65],104:[1,229],105:[1,66],108:88,109:[1,68],110:69,117:[2,140],125:[2,140],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,142],6:[2,142],25:[2,142],26:[2,142],49:[2,142],54:[2,142],57:[2,142],72:[2,142],77:[2,142],85:[2,142],90:[2,142],92:[2,142],101:[2,142],102:87,103:[1,65],104:[1,230],105:[1,66],108:88,109:[1,68],110:69,117:[2,142],125:[2,142],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,148],6:[2,148],25:[2,148],26:[2,148],49:[2,148],54:[2,148],57:[2,148],72:[2,148],77:[2,148],85:[2,148],90:[2,148],92:[2,148],101:[2,148],103:[2,148],104:[2,148],105:[2,148],109:[2,148],117:[2,148],125:[2,148],127:[2,148],128:[2,148],131:[2,148],132:[2,148],133:[2,148],134:[2,148],135:[2,148],136:[2,148]},{1:[2,149],6:[2,149],25:[2,149],26:[2,149],49:[2,149],54:[2,149],57:[2,149],72:[2,149],77:[2,149],85:[2,149],90:[2,149],92:[2,149],101:[2,149],102:87,103:[1,65],104:[2,149],105:[1,66],108:88,109:[1,68],110:69,117:[2,149],125:[2,149],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,153],6:[2,153],25:[2,153],26:[2,153],49:[2,153],54:[2,153],57:[2,153],72:[2,153],77:[2,153],85:[2,153],90:[2,153],92:[2,153],101:[2,153],103:[2,153],104:[2,153],105:[2,153],109:[2,153],117:[2,153],125:[2,153],127:[2,153],128:[2,153],131:[2,153],132:[2,153],133:[2,153],134:[2,153],135:[2,153],136:[2,153]},{115:[2,155],116:[2,155]},{27:158,28:[1,73],44:159,58:160,59:161,75:[1,70],88:[1,113],89:[1,114],112:231,114:157},{54:[1,232],115:[2,161],116:[2,161]},{54:[2,157],115:[2,157],116:[2,157]},{54:[2,158],115:[2,158],116:[2,158]},{54:[2,159],115:[2,159],116:[2,159]},{54:[2,160],115:[2,160],116:[2,160]},{1:[2,154],6:[2,154],25:[2,154],26:[2,154],49:[2,154],54:[2,154],57:[2,154],72:[2,154],77:[2,154],85:[2,154],90:[2,154],92:[2,154],101:[2,154],103:[2,154],104:[2,154],105:[2,154],109:[2,154],117:[2,154],125:[2,154],127:[2,154],128:[2,154],131:[2,154],132:[2,154],133:[2,154],134:[2,154],135:[2,154],136:[2,154]},{8:233,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:234,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,53],25:[2,53],53:235,54:[1,236],77:[2,53]},{6:[2,91],25:[2,91],26:[2,91],54:[2,91],77:[2,91]},{6:[2,39],25:[2,39],26:[2,39],43:[1,237],54:[2,39],77:[2,39]},{6:[2,42],25:[2,42],26:[2,42],54:[2,42],77:[2,42]},{6:[2,43],25:[2,43],26:[2,43],43:[2,43],54:[2,43],77:[2,43]},{6:[2,44],25:[2,44],26:[2,44],43:[2,44],54:[2,44],77:[2,44]},{6:[2,45],25:[2,45],26:[2,45],43:[2,45],54:[2,45],77:[2,45]},{1:[2,5],6:[2,5],26:[2,5],101:[2,5]},{1:[2,25],6:[2,25],25:[2,25],26:[2,25],49:[2,25],54:[2,25],57:[2,25],72:[2,25],77:[2,25],85:[2,25],90:[2,25],92:[2,25],97:[2,25],98:[2,25],101:[2,25],103:[2,25],104:[2,25],105:[2,25],109:[2,25],117:[2,25],120:[2,25],122:[2,25],125:[2,25],127:[2,25],128:[2,25],131:[2,25],132:[2,25],133:[2,25],134:[2,25],135:[2,25],136:[2,25]},{1:[2,192],6:[2,192],25:[2,192],26:[2,192],49:[2,192],54:[2,192],57:[2,192],72:[2,192],77:[2,192],85:[2,192],90:[2,192],92:[2,192],101:[2,192],102:87,103:[2,192],104:[2,192],105:[2,192],108:88,109:[2,192],110:69,117:[2,192],125:[2,192],127:[2,192],128:[2,192],131:[1,78],132:[1,81],133:[2,192],134:[2,192],135:[2,192],136:[2,192]},{1:[2,193],6:[2,193],25:[2,193],26:[2,193],49:[2,193],54:[2,193],57:[2,193],72:[2,193],77:[2,193],85:[2,193],90:[2,193],92:[2,193],101:[2,193],102:87,103:[2,193],104:[2,193],105:[2,193],108:88,109:[2,193],110:69,117:[2,193],125:[2,193],127:[2,193],128:[2,193],131:[1,78],132:[1,81],133:[2,193],134:[2,193],135:[2,193],136:[2,193]},{1:[2,194],6:[2,194],25:[2,194],26:[2,194],49:[2,194],54:[2,194],57:[2,194],72:[2,194],77:[2,194],85:[2,194],90:[2,194],92:[2,194],101:[2,194],102:87,103:[2,194],104:[2,194],105:[2,194],108:88,109:[2,194],110:69,117:[2,194],125:[2,194],127:[2,194],128:[2,194],131:[1,78],132:[2,194],133:[2,194],134:[2,194],135:[2,194],136:[2,194]},{1:[2,195],6:[2,195],25:[2,195],26:[2,195],49:[2,195],54:[2,195],57:[2,195],72:[2,195],77:[2,195],85:[2,195],90:[2,195],92:[2,195],101:[2,195],102:87,103:[2,195],104:[2,195],105:[2,195],108:88,109:[2,195],110:69,117:[2,195],125:[2,195],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[2,195],134:[2,195],135:[2,195],136:[2,195]},{1:[2,196],6:[2,196],25:[2,196],26:[2,196],49:[2,196],54:[2,196],57:[2,196],72:[2,196],77:[2,196],85:[2,196],90:[2,196],92:[2,196],101:[2,196],102:87,103:[2,196],104:[2,196],105:[2,196],108:88,109:[2,196],110:69,117:[2,196],125:[2,196],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[2,196],135:[2,196],136:[1,85]},{1:[2,197],6:[2,197],25:[2,197],26:[2,197],49:[2,197],54:[2,197],57:[2,197],72:[2,197],77:[2,197],85:[2,197],90:[2,197],92:[2,197],101:[2,197],102:87,103:[2,197],104:[2,197],105:[2,197],108:88,109:[2,197],110:69,117:[2,197],125:[2,197],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[2,197],136:[1,85]},{1:[2,198],6:[2,198],25:[2,198],26:[2,198],49:[2,198],54:[2,198],57:[2,198],72:[2,198],77:[2,198],85:[2,198],90:[2,198],92:[2,198],101:[2,198],102:87,103:[2,198],104:[2,198],105:[2,198],108:88,109:[2,198],110:69,117:[2,198],125:[2,198],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[2,198],135:[2,198],136:[2,198]},{1:[2,183],6:[2,183],25:[2,183],26:[2,183],49:[2,183],54:[2,183],57:[2,183],72:[2,183],77:[2,183],85:[2,183],90:[2,183],92:[2,183],101:[2,183],102:87,103:[1,65],104:[2,183],105:[1,66],108:88,109:[1,68],110:69,117:[2,183],125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,182],6:[2,182],25:[2,182],26:[2,182],49:[2,182],54:[2,182],57:[2,182],72:[2,182],77:[2,182],85:[2,182],90:[2,182],92:[2,182],101:[2,182],102:87,103:[1,65],104:[2,182],105:[1,66],108:88,109:[1,68],110:69,117:[2,182],125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,103],6:[2,103],25:[2,103],26:[2,103],49:[2,103],54:[2,103],57:[2,103],66:[2,103],67:[2,103],68:[2,103],70:[2,103],72:[2,103],73:[2,103],77:[2,103],83:[2,103],84:[2,103],85:[2,103],90:[2,103],92:[2,103],101:[2,103],103:[2,103],104:[2,103],105:[2,103],109:[2,103],117:[2,103],125:[2,103],127:[2,103],128:[2,103],131:[2,103],132:[2,103],133:[2,103],134:[2,103],135:[2,103],136:[2,103]},{1:[2,80],6:[2,80],25:[2,80],26:[2,80],40:[2,80],49:[2,80],54:[2,80],57:[2,80],66:[2,80],67:[2,80],68:[2,80],70:[2,80],72:[2,80],73:[2,80],77:[2,80],79:[2,80],83:[2,80],84:[2,80],85:[2,80],90:[2,80],92:[2,80],101:[2,80],103:[2,80],104:[2,80],105:[2,80],109:[2,80],117:[2,80],125:[2,80],127:[2,80],128:[2,80],129:[2,80],130:[2,80],131:[2,80],132:[2,80],133:[2,80],134:[2,80],135:[2,80],136:[2,80],137:[2,80]},{1:[2,81],6:[2,81],25:[2,81],26:[2,81],40:[2,81],49:[2,81],54:[2,81],57:[2,81],66:[2,81],67:[2,81],68:[2,81],70:[2,81],72:[2,81],73:[2,81],77:[2,81],79:[2,81],83:[2,81],84:[2,81],85:[2,81],90:[2,81],92:[2,81],101:[2,81],103:[2,81],104:[2,81],105:[2,81],109:[2,81],117:[2,81],125:[2,81],127:[2,81],128:[2,81],129:[2,81],130:[2,81],131:[2,81],132:[2,81],133:[2,81],134:[2,81],135:[2,81],136:[2,81],137:[2,81]},{1:[2,82],6:[2,82],25:[2,82],26:[2,82],40:[2,82],49:[2,82],54:[2,82],57:[2,82],66:[2,82],67:[2,82],68:[2,82],70:[2,82],72:[2,82],73:[2,82],77:[2,82],79:[2,82],83:[2,82],84:[2,82],85:[2,82],90:[2,82],92:[2,82],101:[2,82],103:[2,82],104:[2,82],105:[2,82],109:[2,82],117:[2,82],125:[2,82],127:[2,82],128:[2,82],129:[2,82],130:[2,82],131:[2,82],132:[2,82],133:[2,82],134:[2,82],135:[2,82],136:[2,82],137:[2,82]},{72:[1,238]},{57:[1,192],72:[2,87],91:239,92:[1,191],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{72:[2,88]},{8:240,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,72:[2,122],75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{12:[2,116],28:[2,116],30:[2,116],31:[2,116],33:[2,116],34:[2,116],35:[2,116],36:[2,116],37:[2,116],38:[2,116],45:[2,116],46:[2,116],47:[2,116],51:[2,116],52:[2,116],72:[2,116],75:[2,116],78:[2,116],82:[2,116],87:[2,116],88:[2,116],89:[2,116],95:[2,116],99:[2,116],100:[2,116],103:[2,116],105:[2,116],107:[2,116],109:[2,116],118:[2,116],124:[2,116],126:[2,116],127:[2,116],128:[2,116],129:[2,116],130:[2,116]},{12:[2,117],28:[2,117],30:[2,117],31:[2,117],33:[2,117],34:[2,117],35:[2,117],36:[2,117],37:[2,117],38:[2,117],45:[2,117],46:[2,117],47:[2,117],51:[2,117],52:[2,117],72:[2,117],75:[2,117],78:[2,117],82:[2,117],87:[2,117],88:[2,117],89:[2,117],95:[2,117],99:[2,117],100:[2,117],103:[2,117],105:[2,117],107:[2,117],109:[2,117],118:[2,117],124:[2,117],126:[2,117],127:[2,117],128:[2,117],129:[2,117],130:[2,117]},{1:[2,86],6:[2,86],25:[2,86],26:[2,86],40:[2,86],49:[2,86],54:[2,86],57:[2,86],66:[2,86],67:[2,86],68:[2,86],70:[2,86],72:[2,86],73:[2,86],77:[2,86],79:[2,86],83:[2,86],84:[2,86],85:[2,86],90:[2,86],92:[2,86],101:[2,86],103:[2,86],104:[2,86],105:[2,86],109:[2,86],117:[2,86],125:[2,86],127:[2,86],128:[2,86],129:[2,86],130:[2,86],131:[2,86],132:[2,86],133:[2,86],134:[2,86],135:[2,86],136:[2,86],137:[2,86]},{1:[2,104],6:[2,104],25:[2,104],26:[2,104],49:[2,104],54:[2,104],57:[2,104],66:[2,104],67:[2,104],68:[2,104],70:[2,104],72:[2,104],73:[2,104],77:[2,104],83:[2,104],84:[2,104],85:[2,104],90:[2,104],92:[2,104],101:[2,104],103:[2,104],104:[2,104],105:[2,104],109:[2,104],117:[2,104],125:[2,104],127:[2,104],128:[2,104],131:[2,104],132:[2,104],133:[2,104],134:[2,104],135:[2,104],136:[2,104]},{1:[2,36],6:[2,36],25:[2,36],26:[2,36],49:[2,36],54:[2,36],57:[2,36],72:[2,36],77:[2,36],85:[2,36],90:[2,36],92:[2,36],101:[2,36],102:87,103:[2,36],104:[2,36],105:[2,36],108:88,109:[2,36],110:69,117:[2,36],125:[2,36],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{8:241,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:242,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,109],6:[2,109],25:[2,109],26:[2,109],49:[2,109],54:[2,109],57:[2,109],66:[2,109],67:[2,109],68:[2,109],70:[2,109],72:[2,109],73:[2,109],77:[2,109],83:[2,109],84:[2,109],85:[2,109],90:[2,109],92:[2,109],101:[2,109],103:[2,109],104:[2,109],105:[2,109],109:[2,109],117:[2,109],125:[2,109],127:[2,109],128:[2,109],131:[2,109],132:[2,109],133:[2,109],134:[2,109],135:[2,109],136:[2,109]},{6:[2,53],25:[2,53],53:243,54:[1,226],85:[2,53]},{6:[2,128],25:[2,128],26:[2,128],54:[2,128],57:[1,244],85:[2,128],90:[2,128],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{50:245,51:[1,60],52:[1,61]},{6:[2,54],25:[2,54],26:[2,54],27:109,28:[1,73],44:110,55:246,56:108,58:111,59:112,75:[1,70],88:[1,113],89:[1,114]},{6:[1,247],25:[1,248]},{6:[2,61],25:[2,61],26:[2,61],49:[2,61],54:[2,61]},{8:249,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,199],6:[2,199],25:[2,199],26:[2,199],49:[2,199],54:[2,199],57:[2,199],72:[2,199],77:[2,199],85:[2,199],90:[2,199],92:[2,199],101:[2,199],102:87,103:[2,199],104:[2,199],105:[2,199],108:88,109:[2,199],110:69,117:[2,199],125:[2,199],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{8:250,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,201],6:[2,201],25:[2,201],26:[2,201],49:[2,201],54:[2,201],57:[2,201],72:[2,201],77:[2,201],85:[2,201],90:[2,201],92:[2,201],101:[2,201],102:87,103:[2,201],104:[2,201],105:[2,201],108:88,109:[2,201],110:69,117:[2,201],125:[2,201],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,181],6:[2,181],25:[2,181],26:[2,181],49:[2,181],54:[2,181],57:[2,181],72:[2,181],77:[2,181],85:[2,181],90:[2,181],92:[2,181],101:[2,181],103:[2,181],104:[2,181],105:[2,181],109:[2,181],117:[2,181],125:[2,181],127:[2,181],128:[2,181],131:[2,181],132:[2,181],133:[2,181],134:[2,181],135:[2,181],136:[2,181]},{8:251,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,133],6:[2,133],25:[2,133],26:[2,133],49:[2,133],54:[2,133],57:[2,133],72:[2,133],77:[2,133],85:[2,133],90:[2,133],92:[2,133],97:[1,252],101:[2,133],103:[2,133],104:[2,133],105:[2,133],109:[2,133],117:[2,133],125:[2,133],127:[2,133],128:[2,133],131:[2,133],132:[2,133],133:[2,133],134:[2,133],135:[2,133],136:[2,133]},{5:253,25:[1,5]},{27:254,28:[1,73]},{119:255,121:216,122:[1,217]},{26:[1,256],120:[1,257],121:258,122:[1,217]},{26:[2,174],120:[2,174],122:[2,174]},{8:260,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],94:259,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,97],5:261,6:[2,97],25:[1,5],26:[2,97],49:[2,97],54:[2,97],57:[2,97],72:[2,97],77:[2,97],85:[2,97],90:[2,97],92:[2,97],101:[2,97],102:87,103:[1,65],104:[2,97],105:[1,66],108:88,109:[1,68],110:69,117:[2,97],125:[2,97],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,100],6:[2,100],25:[2,100],26:[2,100],49:[2,100],54:[2,100],57:[2,100],72:[2,100],77:[2,100],85:[2,100],90:[2,100],92:[2,100],101:[2,100],103:[2,100],104:[2,100],105:[2,100],109:[2,100],117:[2,100],125:[2,100],127:[2,100],128:[2,100],131:[2,100],132:[2,100],133:[2,100],134:[2,100],135:[2,100],136:[2,100]},{8:262,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,138],6:[2,138],25:[2,138],26:[2,138],49:[2,138],54:[2,138],57:[2,138],66:[2,138],67:[2,138],68:[2,138],70:[2,138],72:[2,138],73:[2,138],77:[2,138],83:[2,138],84:[2,138],85:[2,138],90:[2,138],92:[2,138],101:[2,138],103:[2,138],104:[2,138],105:[2,138],109:[2,138],117:[2,138],125:[2,138],127:[2,138],128:[2,138],131:[2,138],132:[2,138],133:[2,138],134:[2,138],135:[2,138],136:[2,138]},{6:[1,74],26:[1,263]},{8:264,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,67],12:[2,117],25:[2,67],28:[2,117],30:[2,117],31:[2,117],33:[2,117],34:[2,117],35:[2,117],36:[2,117],37:[2,117],38:[2,117],45:[2,117],46:[2,117],47:[2,117],51:[2,117],52:[2,117],54:[2,67],75:[2,117],78:[2,117],82:[2,117],87:[2,117],88:[2,117],89:[2,117],90:[2,67],95:[2,117],99:[2,117],100:[2,117],103:[2,117],105:[2,117],107:[2,117],109:[2,117],118:[2,117],124:[2,117],126:[2,117],127:[2,117],128:[2,117],129:[2,117],130:[2,117]},{6:[1,266],25:[1,267],90:[1,265]},{6:[2,54],8:200,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[2,54],26:[2,54],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],85:[2,54],87:[1,58],88:[1,59],89:[1,57],90:[2,54],93:268,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,53],25:[2,53],26:[2,53],53:269,54:[1,226]},{1:[2,178],6:[2,178],25:[2,178],26:[2,178],49:[2,178],54:[2,178],57:[2,178],72:[2,178],77:[2,178],85:[2,178],90:[2,178],92:[2,178],101:[2,178],103:[2,178],104:[2,178],105:[2,178],109:[2,178],117:[2,178],120:[2,178],125:[2,178],127:[2,178],128:[2,178],131:[2,178],132:[2,178],133:[2,178],134:[2,178],135:[2,178],136:[2,178]},{8:270,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:271,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{115:[2,156],116:[2,156]},{27:158,28:[1,73],44:159,58:160,59:161,75:[1,70],88:[1,113],89:[1,114],114:272},{1:[2,163],6:[2,163],25:[2,163],26:[2,163],49:[2,163],54:[2,163],57:[2,163],72:[2,163],77:[2,163],85:[2,163],90:[2,163],92:[2,163],101:[2,163],102:87,103:[2,163],104:[1,273],105:[2,163],108:88,109:[2,163],110:69,117:[1,274],125:[2,163],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,164],6:[2,164],25:[2,164],26:[2,164],49:[2,164],54:[2,164],57:[2,164],72:[2,164],77:[2,164],85:[2,164],90:[2,164],92:[2,164],101:[2,164],102:87,103:[2,164],104:[1,275],105:[2,164],108:88,109:[2,164],110:69,117:[2,164],125:[2,164],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[1,277],25:[1,278],77:[1,276]},{6:[2,54],11:168,25:[2,54],26:[2,54],27:169,28:[1,73],29:170,30:[1,71],31:[1,72],41:279,42:167,44:171,46:[1,46],77:[2,54],88:[1,113]},{8:280,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,281],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,85],6:[2,85],25:[2,85],26:[2,85],40:[2,85],49:[2,85],54:[2,85],57:[2,85],66:[2,85],67:[2,85],68:[2,85],70:[2,85],72:[2,85],73:[2,85],77:[2,85],79:[2,85],83:[2,85],84:[2,85],85:[2,85],90:[2,85],92:[2,85],101:[2,85],103:[2,85],104:[2,85],105:[2,85],109:[2,85],117:[2,85],125:[2,85],127:[2,85],128:[2,85],129:[2,85],130:[2,85],131:[2,85],132:[2,85],133:[2,85],134:[2,85],135:[2,85],136:[2,85],137:[2,85]},{8:282,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,72:[2,120],75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{72:[2,121],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,37],6:[2,37],25:[2,37],26:[2,37],49:[2,37],54:[2,37],57:[2,37],72:[2,37],77:[2,37],85:[2,37],90:[2,37],92:[2,37],101:[2,37],102:87,103:[2,37],104:[2,37],105:[2,37],108:88,109:[2,37],110:69,117:[2,37],125:[2,37],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{26:[1,283],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[1,266],25:[1,267],85:[1,284]},{6:[2,67],25:[2,67],26:[2,67],54:[2,67],85:[2,67],90:[2,67]},{5:285,25:[1,5]},{6:[2,57],25:[2,57],26:[2,57],49:[2,57],54:[2,57]},{27:109,28:[1,73],44:110,55:286,56:108,58:111,59:112,75:[1,70],88:[1,113],89:[1,114]},{6:[2,55],25:[2,55],26:[2,55],27:109,28:[1,73],44:110,48:287,54:[2,55],55:107,56:108,58:111,59:112,75:[1,70],88:[1,113],89:[1,114]},{6:[2,62],25:[2,62],26:[2,62],49:[2,62],54:[2,62],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{26:[1,288],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{5:289,25:[1,5],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{5:290,25:[1,5]},{1:[2,134],6:[2,134],25:[2,134],26:[2,134],49:[2,134],54:[2,134],57:[2,134],72:[2,134],77:[2,134],85:[2,134],90:[2,134],92:[2,134],101:[2,134],103:[2,134],104:[2,134],105:[2,134],109:[2,134],117:[2,134],125:[2,134],127:[2,134],128:[2,134],131:[2,134],132:[2,134],133:[2,134],134:[2,134],135:[2,134],136:[2,134]},{5:291,25:[1,5]},{26:[1,292],120:[1,293],121:258,122:[1,217]},{1:[2,172],6:[2,172],25:[2,172],26:[2,172],49:[2,172],54:[2,172],57:[2,172],72:[2,172],77:[2,172],85:[2,172],90:[2,172],92:[2,172],101:[2,172],103:[2,172],104:[2,172],105:[2,172],109:[2,172],117:[2,172],125:[2,172],127:[2,172],128:[2,172],131:[2,172],132:[2,172],133:[2,172],134:[2,172],135:[2,172],136:[2,172]},{5:294,25:[1,5]},{26:[2,175],120:[2,175],122:[2,175]},{5:295,25:[1,5],54:[1,296]},{25:[2,130],54:[2,130],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,98],6:[2,98],25:[2,98],26:[2,98],49:[2,98],54:[2,98],57:[2,98],72:[2,98],77:[2,98],85:[2,98],90:[2,98],92:[2,98],101:[2,98],103:[2,98],104:[2,98],105:[2,98],109:[2,98],117:[2,98],125:[2,98],127:[2,98],128:[2,98],131:[2,98],132:[2,98],133:[2,98],134:[2,98],135:[2,98],136:[2,98]},{1:[2,101],5:297,6:[2,101],25:[1,5],26:[2,101],49:[2,101],54:[2,101],57:[2,101],72:[2,101],77:[2,101],85:[2,101],90:[2,101],92:[2,101],101:[2,101],102:87,103:[1,65],104:[2,101],105:[1,66],108:88,109:[1,68],110:69,117:[2,101],125:[2,101],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{101:[1,298]},{90:[1,299],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,115],6:[2,115],25:[2,115],26:[2,115],40:[2,115],49:[2,115],54:[2,115],57:[2,115],66:[2,115],67:[2,115],68:[2,115],70:[2,115],72:[2,115],73:[2,115],77:[2,115],83:[2,115],84:[2,115],85:[2,115],90:[2,115],92:[2,115],101:[2,115],103:[2,115],104:[2,115],105:[2,115],109:[2,115],115:[2,115],116:[2,115],117:[2,115],125:[2,115],127:[2,115],128:[2,115],131:[2,115],132:[2,115],133:[2,115],134:[2,115],135:[2,115],136:[2,115]},{8:200,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],93:300,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:200,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,146],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],86:301,87:[1,58],88:[1,59],89:[1,57],93:145,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,124],25:[2,124],26:[2,124],54:[2,124],85:[2,124],90:[2,124]},{6:[1,266],25:[1,267],26:[1,302]},{1:[2,141],6:[2,141],25:[2,141],26:[2,141],49:[2,141],54:[2,141],57:[2,141],72:[2,141],77:[2,141],85:[2,141],90:[2,141],92:[2,141],101:[2,141],102:87,103:[1,65],104:[2,141],105:[1,66],108:88,109:[1,68],110:69,117:[2,141],125:[2,141],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,143],6:[2,143],25:[2,143],26:[2,143],49:[2,143],54:[2,143],57:[2,143],72:[2,143],77:[2,143],85:[2,143],90:[2,143],92:[2,143],101:[2,143],102:87,103:[1,65],104:[2,143],105:[1,66],108:88,109:[1,68],110:69,117:[2,143],125:[2,143],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{115:[2,162],116:[2,162]},{8:303,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:304,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:305,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,89],6:[2,89],25:[2,89],26:[2,89],40:[2,89],49:[2,89],54:[2,89],57:[2,89],66:[2,89],67:[2,89],68:[2,89],70:[2,89],72:[2,89],73:[2,89],77:[2,89],83:[2,89],84:[2,89],85:[2,89],90:[2,89],92:[2,89],101:[2,89],103:[2,89],104:[2,89],105:[2,89],109:[2,89],115:[2,89],116:[2,89],117:[2,89],125:[2,89],127:[2,89],128:[2,89],131:[2,89],132:[2,89],133:[2,89],134:[2,89],135:[2,89],136:[2,89]},{11:168,27:169,28:[1,73],29:170,30:[1,71],31:[1,72],41:306,42:167,44:171,46:[1,46],88:[1,113]},{6:[2,90],11:168,25:[2,90],26:[2,90],27:169,28:[1,73],29:170,30:[1,71],31:[1,72],41:166,42:167,44:171,46:[1,46],54:[2,90],76:307,88:[1,113]},{6:[2,92],25:[2,92],26:[2,92],54:[2,92],77:[2,92]},{6:[2,40],25:[2,40],26:[2,40],54:[2,40],77:[2,40],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{8:308,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{72:[2,119],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,38],6:[2,38],25:[2,38],26:[2,38],49:[2,38],54:[2,38],57:[2,38],72:[2,38],77:[2,38],85:[2,38],90:[2,38],92:[2,38],101:[2,38],103:[2,38],104:[2,38],105:[2,38],109:[2,38],117:[2,38],125:[2,38],127:[2,38],128:[2,38],131:[2,38],132:[2,38],133:[2,38],134:[2,38],135:[2,38],136:[2,38]},{1:[2,110],6:[2,110],25:[2,110],26:[2,110],49:[2,110],54:[2,110],57:[2,110],66:[2,110],67:[2,110],68:[2,110],70:[2,110],72:[2,110],73:[2,110],77:[2,110],83:[2,110],84:[2,110],85:[2,110],90:[2,110],92:[2,110],101:[2,110],103:[2,110],104:[2,110],105:[2,110],109:[2,110],117:[2,110],125:[2,110],127:[2,110],128:[2,110],131:[2,110],132:[2,110],133:[2,110],134:[2,110],135:[2,110],136:[2,110]},{1:[2,49],6:[2,49],25:[2,49],26:[2,49],49:[2,49],54:[2,49],57:[2,49],72:[2,49],77:[2,49],85:[2,49],90:[2,49],92:[2,49],101:[2,49],103:[2,49],104:[2,49],105:[2,49],109:[2,49],117:[2,49],125:[2,49],127:[2,49],128:[2,49],131:[2,49],132:[2,49],133:[2,49],134:[2,49],135:[2,49],136:[2,49]},{6:[2,58],25:[2,58],26:[2,58],49:[2,58],54:[2,58]},{6:[2,53],25:[2,53],26:[2,53],53:309,54:[1,202]},{1:[2,200],6:[2,200],25:[2,200],26:[2,200],49:[2,200],54:[2,200],57:[2,200],72:[2,200],77:[2,200],85:[2,200],90:[2,200],92:[2,200],101:[2,200],103:[2,200],104:[2,200],105:[2,200],109:[2,200],117:[2,200],125:[2,200],127:[2,200],128:[2,200],131:[2,200],132:[2,200],133:[2,200],134:[2,200],135:[2,200],136:[2,200]},{1:[2,179],6:[2,179],25:[2,179],26:[2,179],49:[2,179],54:[2,179],57:[2,179],72:[2,179],77:[2,179],85:[2,179],90:[2,179],92:[2,179],101:[2,179],103:[2,179],104:[2,179],105:[2,179],109:[2,179],117:[2,179],120:[2,179],125:[2,179],127:[2,179],128:[2,179],131:[2,179],132:[2,179],133:[2,179],134:[2,179],135:[2,179],136:[2,179]},{1:[2,135],6:[2,135],25:[2,135],26:[2,135],49:[2,135],54:[2,135],57:[2,135],72:[2,135],77:[2,135],85:[2,135],90:[2,135],92:[2,135],101:[2,135],103:[2,135],104:[2,135],105:[2,135],109:[2,135],117:[2,135],125:[2,135],127:[2,135],128:[2,135],131:[2,135],132:[2,135],133:[2,135],134:[2,135],135:[2,135],136:[2,135]},{1:[2,136],6:[2,136],25:[2,136],26:[2,136],49:[2,136],54:[2,136],57:[2,136],72:[2,136],77:[2,136],85:[2,136],90:[2,136],92:[2,136],97:[2,136],101:[2,136],103:[2,136],104:[2,136],105:[2,136],109:[2,136],117:[2,136],125:[2,136],127:[2,136],128:[2,136],131:[2,136],132:[2,136],133:[2,136],134:[2,136],135:[2,136],136:[2,136]},{1:[2,170],6:[2,170],25:[2,170],26:[2,170],49:[2,170],54:[2,170],57:[2,170],72:[2,170],77:[2,170],85:[2,170],90:[2,170],92:[2,170],101:[2,170],103:[2,170],104:[2,170],105:[2,170],109:[2,170],117:[2,170],125:[2,170],127:[2,170],128:[2,170],131:[2,170],132:[2,170],133:[2,170],134:[2,170],135:[2,170],136:[2,170]},{5:310,25:[1,5]},{26:[1,311]},{6:[1,312],26:[2,176],120:[2,176],122:[2,176]},{8:313,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,102],6:[2,102],25:[2,102],26:[2,102],49:[2,102],54:[2,102],57:[2,102],72:[2,102],77:[2,102],85:[2,102],90:[2,102],92:[2,102],101:[2,102],103:[2,102],104:[2,102],105:[2,102],109:[2,102],117:[2,102],125:[2,102],127:[2,102],128:[2,102],131:[2,102],132:[2,102],133:[2,102],134:[2,102],135:[2,102],136:[2,102]},{1:[2,139],6:[2,139],25:[2,139],26:[2,139],49:[2,139],54:[2,139],57:[2,139],66:[2,139],67:[2,139],68:[2,139],70:[2,139],72:[2,139],73:[2,139],77:[2,139],83:[2,139],84:[2,139],85:[2,139],90:[2,139],92:[2,139],101:[2,139],103:[2,139],104:[2,139],105:[2,139],109:[2,139],117:[2,139],125:[2,139],127:[2,139],128:[2,139],131:[2,139],132:[2,139],133:[2,139],134:[2,139],135:[2,139],136:[2,139]},{1:[2,118],6:[2,118],25:[2,118],26:[2,118],49:[2,118],54:[2,118],57:[2,118],66:[2,118],67:[2,118],68:[2,118],70:[2,118],72:[2,118],73:[2,118],77:[2,118],83:[2,118],84:[2,118],85:[2,118],90:[2,118],92:[2,118],101:[2,118],103:[2,118],104:[2,118],105:[2,118],109:[2,118],117:[2,118],125:[2,118],127:[2,118],128:[2,118],131:[2,118],132:[2,118],133:[2,118],134:[2,118],135:[2,118],136:[2,118]},{6:[2,125],25:[2,125],26:[2,125],54:[2,125],85:[2,125],90:[2,125]},{6:[2,53],25:[2,53],26:[2,53],53:314,54:[1,226]},{6:[2,126],25:[2,126],26:[2,126],54:[2,126],85:[2,126],90:[2,126]},{1:[2,165],6:[2,165],25:[2,165],26:[2,165],49:[2,165],54:[2,165],57:[2,165],72:[2,165],77:[2,165],85:[2,165],90:[2,165],92:[2,165],101:[2,165],102:87,103:[2,165],104:[2,165],105:[2,165],108:88,109:[2,165],110:69,117:[1,315],125:[2,165],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,167],6:[2,167],25:[2,167],26:[2,167],49:[2,167],54:[2,167],57:[2,167],72:[2,167],77:[2,167],85:[2,167],90:[2,167],92:[2,167],101:[2,167],102:87,103:[2,167],104:[1,316],105:[2,167],108:88,109:[2,167],110:69,117:[2,167],125:[2,167],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,166],6:[2,166],25:[2,166],26:[2,166],49:[2,166],54:[2,166],57:[2,166],72:[2,166],77:[2,166],85:[2,166],90:[2,166],92:[2,166],101:[2,166],102:87,103:[2,166],104:[2,166],105:[2,166],108:88,109:[2,166],110:69,117:[2,166],125:[2,166],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[2,93],25:[2,93],26:[2,93],54:[2,93],77:[2,93]},{6:[2,53],25:[2,53],26:[2,53],53:317,54:[1,236]},{26:[1,318],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[1,247],25:[1,248],26:[1,319]},{26:[1,320]},{1:[2,173],6:[2,173],25:[2,173],26:[2,173],49:[2,173],54:[2,173],57:[2,173],72:[2,173],77:[2,173],85:[2,173],90:[2,173],92:[2,173],101:[2,173],103:[2,173],104:[2,173],105:[2,173],109:[2,173],117:[2,173],125:[2,173],127:[2,173],128:[2,173],131:[2,173],132:[2,173],133:[2,173],134:[2,173],135:[2,173],136:[2,173]},{26:[2,177],120:[2,177],122:[2,177]},{25:[2,131],54:[2,131],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[1,266],25:[1,267],26:[1,321]},{8:322,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:323,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[1,277],25:[1,278],26:[1,324]},{6:[2,41],25:[2,41],26:[2,41],54:[2,41],77:[2,41]},{6:[2,59],25:[2,59],26:[2,59],49:[2,59],54:[2,59]},{1:[2,171],6:[2,171],25:[2,171],26:[2,171],49:[2,171],54:[2,171],57:[2,171],72:[2,171],77:[2,171],85:[2,171],90:[2,171],92:[2,171],101:[2,171],103:[2,171],104:[2,171],105:[2,171],109:[2,171],117:[2,171],125:[2,171],127:[2,171],128:[2,171],131:[2,171],132:[2,171],133:[2,171],134:[2,171],135:[2,171],136:[2,171]},{6:[2,127],25:[2,127],26:[2,127],54:[2,127],85:[2,127],90:[2,127]},{1:[2,168],6:[2,168],25:[2,168],26:[2,168],49:[2,168],54:[2,168],57:[2,168],72:[2,168],77:[2,168],85:[2,168],90:[2,168],92:[2,168],101:[2,168],102:87,103:[2,168],104:[2,168],105:[2,168],108:88,109:[2,168],110:69,117:[2,168],125:[2,168],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,169],6:[2,169],25:[2,169],26:[2,169],49:[2,169],54:[2,169],57:[2,169],72:[2,169],77:[2,169],85:[2,169],90:[2,169],92:[2,169],101:[2,169],102:87,103:[2,169],104:[2,169],105:[2,169],108:88,109:[2,169],110:69,117:[2,169],125:[2,169],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[2,94],25:[2,94],26:[2,94],54:[2,94],77:[2,94]}],defaultActions:{60:[2,51],61:[2,52],75:[2,3],94:[2,108],189:[2,88]},parseError:function(a,b){throw new Error(a)},parse:function(a){function o(){var a;a=b.lexer.lex()||1,typeof a!="number"&&(a=b.symbols_[a]||a);return a}function n(a){c.length=c.length-2*a,d.length=d.length-a,e.length=e.length-a}var b=this,c=[0],d=[null],e=[],f=this.table,g="",h=0,i=0,j=0,k=2,l=1;this.lexer.setInput(a),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,typeof this.lexer.yylloc=="undefined"&&(this.lexer.yylloc={});var m=this.lexer.yylloc;e.push(m),typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError);var p,q,r,s,t,u,v={},w,x,y,z;for(;;){r=c[c.length-1],this.defaultActions[r]?s=this.defaultActions[r]:(p==null&&(p=o()),s=f[r]&&f[r][p]);_handle_error:if(typeof s=="undefined"||!s.length||!s[0]){if(!j){z=[];for(w in f[r])this.terminals_[w]&&w>2&&z.push("'"+this.terminals_[w]+"'");var A="";this.lexer.showPosition?A="Parse error on line "+(h+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+z.join(", ")+", got '"+this.terminals_[p]+"'":A="Parse error on line "+(h+1)+": Unexpected "+(p==1?"end of input":"'"+(this.terminals_[p]||p)+"'"),this.parseError(A,{text:this.lexer.match,token:this.terminals_[p]||p,line:this.lexer.yylineno,loc:m,expected:z})}if(j==3){if(p==l)throw new Error(A||"Parsing halted.");i=this.lexer.yyleng,g=this.lexer.yytext,h=this.lexer.yylineno,m=this.lexer.yylloc,p=o()}for(;;){if(k.toString()in f[r])break;if(r==0)throw new Error(A||"Parsing halted.");n(1),r=c[c.length-1]}q=p,p=k,r=c[c.length-1],s=f[r]&&f[r][k],j=3}if(s[0]instanceof Array&&s.length>1)throw new Error("Parse Error: multiple actions possible at state: "+r+", token: "+p);switch(s[0]){case 1:c.push(p),d.push(this.lexer.yytext),e.push(this.lexer.yylloc),c.push(s[1]),p=null,q?(p=q,q=null):(i=this.lexer.yyleng,g=this.lexer.yytext,h=this.lexer.yylineno,m=this.lexer.yylloc,j>0&&j--);break;case 2:x=this.productions_[s[1]][1],v.$=d[d.length-x],v._$={first_line:e[e.length-(x||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(x||1)].first_column,last_column:e[e.length-1].last_column},u=this.performAction.call(v,g,i,h,this.yy,s[1],d,e);if(typeof u!="undefined")return u;x&&(c=c.slice(0,-1*x*2),d=d.slice(0,-1*x),e=e.slice(0,-1*x)),c.push(this.productions_[s[1]][0]),d.push(v.$),e.push(v._$),y=f[c[c.length-2]][c[c.length-1]],c.push(y);break;case 3:return!0}}return!0}};undefined;return a}();typeof require!="undefined"&&typeof a!="undefined"&&(a.parser=b,a.parse=function(){return b.parse.apply(b,arguments)},a.main=function(b){if(!b[1])throw new Error("Usage: "+b[0]+" FILE");if(typeof process!="undefined")var c=require("fs").readFileSync(require("path").join(process.cwd(),b[1]),"utf8");else var d=require("file").path(require("file").cwd()),c=d.join(b[1]).read({charset:"utf-8"});return a.parser.parse(c)},typeof module!="undefined"&&require.main===module&&a.main(typeof process!="undefined"?process.argv.slice(1):require("system").args))},require["./scope"]=new function(){var a=this;(function(){var b,c,d,e;e=require("./helpers"),c=e.extend,d=e.last,a.Scope=b=function(){function a(b,c,d){this.parent=b,this.expressions=c,this.method=d,this.variables=[{name:"arguments",type:"arguments"}],this.positions={},this.parent||(a.root=this)}a.root=null,a.prototype.add=function(a,b,c){if(this.shared&&!c)return this.parent.add(a,b,c);return Object.prototype.hasOwnProperty.call(this.positions,a)?this.variables[this.positions[a]].type=b:this.positions[a]=this.variables.push({name:a,type:b})-1},a.prototype.namedMethod=function(){if(this.method.name||!this.parent)return this.method;return this.parent.namedMethod()},a.prototype.find=function(a){if(this.check(a))return!0;this.add(a,"var");return!1},a.prototype.parameter=function(a){if(!this.shared||!this.parent.check(a,!0))return this.add(a,"param")},a.prototype.check=function(a){var b;return!!(this.type(a)||((b=this.parent)!=null?b.check(a):void 0))},a.prototype.temporary=function(a,b){return a.length>1?"_"+a+(b>1?b-1:""):"_"+(b+parseInt(a,36)).toString(36).replace(/\d/g,"a")},a.prototype.type=function(a){var b,c,d,e;e=this.variables;for(c=0,d=e.length;c<d;c++){b=e[c];if(b.name===a)return b.type}return null},a.prototype.freeVariable=function(a,b){var c,d;b==null&&(b=!0),c=0;while(this.check(d=this.temporary(a,c)))c++;b&&this.add(d,"var",!0);return d},a.prototype.assign=function(a,b){this.add(a,{value:b,assigned:!0},!0);return this.hasAssignments=!0},a.prototype.hasDeclarations=function(){return!!this.declaredVariables().length},a.prototype.declaredVariables=function(){var a,b,c,d,e,f;a=[],b=[],f=this.variables;for(d=0,e=f.length;d<e;d++)c=f[d],c.type==="var"&&(c.name.charAt(0)==="_"?b:a).push(c.name);return a.sort().concat(b.sort())},a.prototype.assignedVariables=function(){var a,b,c,d,e;d=this.variables,e=[];for(b=0,c=d.length;b<c;b++)a=d[b],a.type.assigned&&e.push(""+a.name+" = "+a.type.value);return e};return a}()}).call(this)},require["./nodes"]=new function(){var a=this;(function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_,ba,bb,bc,bd,be,bf,bg,bh,bi,bj,bk=({}).hasOwnProperty,bl=function(a,b){function d(){this.constructor=a}for(var c in b)bk.call(b,c)&&(a[c]=b[c]);d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype;return a},bm=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1};N=require("./scope").Scope,bi=require("./lexer"),I=bi.RESERVED,M=bi.STRICT_PROSCRIBED,bj=require("./helpers"),Z=bj.compact,bb=bj.flatten,ba=bj.extend,bd=bj.merge,$=bj.del,bf=bj.starts,_=bj.ends,bc=bj.last,a.extend=ba,Y=function(){return!0},D=function(){return!1},S=function(){return this},C=function(){this.negated=!this.negated;return this},a.Base=e=function(){function a(){}a.prototype.compile=function(a,b){var c;a=ba({},a),b&&(a.level=b),c=this.unfoldSoak(a)||this,c.tab=a.indent;return a.level===z||!c.isStatement(a)?c.compileNode(a):c.compileClosure(a)},a.prototype.compileClosure=function(a){if(this.jumps())throw SyntaxError("cannot use a pure statement in an expression.");a.sharedScope=!0;return i.wrap(this).compileNode(a)},a.prototype.cache=function(a,b,c){var e,f;if(!this.isComplex()){e=b?this.compile(a,b):this;return[e,e]}e=new A(c||a.scope.freeVariable("ref")),f=new d(e,this);return b?[f.compile(a,b),e.value]:[f,e]},a.prototype.compileLoopReference=function(a,b){var c,d;c=d=this.compile(a,w),-Infinity<+c&&+c<Infinity||o.test(c)&&a.scope.check(c,!0)||(c=""+(d=a.scope.freeVariable(b))+" = "+c);return[c,d]},a.prototype.makeReturn=function(a){var b;b=this.unwrapAll();return a?new g(new A(""+a+".push"),[b]):new K(b)},a.prototype.contains=function(a){var b;b=!1,this.traverseChildren(!1,function(c){if(a(c)){b=!0;return!1}});return b},a.prototype.containsType=function(a){return this instanceof a||this.contains(function(b){return b instanceof a})},a.prototype.lastNonComment=function(a){var b;b=a.length;while(b--)if(!(a[b]instanceof k))return a[b];return null},a.prototype.toString=function(a,b){var c;a==null&&(a=""),b==null&&(b=this.constructor.name),c="\n"+a+b,this.soak&&(c+="?"),this.eachChild(function(b){return c+=b.toString(a+R)});return c},a.prototype.eachChild=function(a){var b,c,d,e,f,g,h,i;if(!this.children)return this;h=this.children;for(d=0,f=h.length;d<f;d++){b=h[d];if(this[b]){i=bb([this[b]]);for(e=0,g=i.length;e<g;e++){c=i[e];if(a(c)===!1)return this}}}return this},a.prototype.traverseChildren=function(a,b){return this.eachChild(function(c){if(b(c)===!1)return!1;return c.traverseChildren(a,b)})},a.prototype.invert=function(){return new F("!",this)},a.prototype.unwrapAll=function(){var a;a=this;while(a!==(a=a.unwrap()))continue;return a},a.prototype.children=[],a.prototype.isStatement=D,a.prototype.jumps=D,a.prototype.isComplex=Y,a.prototype.isChainable=D,a.prototype.isAssignable=D,a.prototype.unwrap=S,a.prototype.unfoldSoak=D,a.prototype.assigns=D;return a}(),a.Block=f=function(a){function b(a){this.expressions=Z(bb(a||[]))}bl(b,a),b.prototype.children=["expressions"],b.prototype.push=function(a){this.expressions.push(a);return this},b.prototype.pop=function(){return this.expressions.pop()},b.prototype.unshift=function(a){this.expressions.unshift(a);return this},b.prototype.unwrap=function(){return this.expressions.length===1?this.expressions[0]:this},b.prototype.isEmpty=function(){return!this.expressions.length},b.prototype.isStatement=function(a){var b,c,d,e;e=this.expressions;for(c=0,d=e.length;c<d;c++){b=e[c];if(b.isStatement(a))return!0}return!1},b.prototype.jumps=function(a){var b,c,d,e;e=this.expressions;for(c=0,d=e.length;c<d;c++){b=e[c];if(b.jumps(a))return b}},b.prototype.makeReturn=function(a){var b,c;c=this.expressions.length;while(c--){b=this.expressions[c];if(!(b instanceof k)){this.expressions[c]=b.makeReturn(a),b instanceof K&&!b.expression&&this.expressions.splice(c,1);break}}return this},b.prototype.compile=function(a,c){a==null&&(a={});return a.scope?b.__super__.compile.call(this,a,c):this.compileRoot(a)},b.prototype.compileNode=function(a){var c,d,e,f,g,h,i;this.tab=a.indent,f=a.level===z,d=[],i=this.expressions;for(g=0,h=i.length;g<h;g++)e=i[g],e=e.unwrapAll(),e=e.unfoldSoak(a)||e,e instanceof b?d.push(e.compileNode(a)):f?(e.front=!0,c=e.compile(a),e.isStatement(a)||(c=""+this.tab+c+";",e instanceof A&&(c=""+c+"\n")),d.push(c)):d.push(e.compile(a,w));if(f)return this.spaced?"\n"+d.join("\n\n")+"\n":d.join("\n");c=d.join(", ")||"void 0";return d.length>1&&a.level>=w?"("+c+")":c},b.prototype.compileRoot=function(a){var b,c,d,e,f,g;a.indent=a.bare?"":R,a.scope=new N(null,this,null),a.level=z,this.spaced=!0,e="",a.bare||(f=function(){var a,b,e,f;e=this.expressions,f=[];for(d=a=0,b=e.length;a<b;d=++a){c=e[d];if(!(c.unwrap()instanceof k))break;f.push(c)}return f}.call(this),g=this.expressions.slice(f.length),this.expressions=f,f.length&&(e=""+this.compileNode(bd(a,{indent:""}))+"\n"),this.expressions=g),b=this.compileWithDeclarations(a);if(a.bare)return b;return""+e+"(function() {\n"+b+"\n}).call(this);\n"},b.prototype.compileWithDeclarations=function(a){var b,c,d,e,f,g,h,i,j,l,m,n,o,p;c=g="",n=this.expressions;for(f=l=0,m=n.length;l<m;f=++l){e=n[f],e=e.unwrap();if(!(e instanceof k||e instanceof A))break}a=bd(a,{level:z}),f&&(h=this.expressions.splice(f,9e9),o=[this.spaced,!1],j=o[0],this.spaced=o[1],p=[this.compileNode(a),j],c=p[0],this.spaced=p[1],this.expressions=h),g=this.compileNode(a),i=a.scope;if(i.expressions===this){d=a.scope.hasDeclarations(),b=i.hasAssignments;if(d||b)f&&(c+="\n"),c+=""+this.tab+"var ",d&&(c+=i.declaredVariables().join(", ")),b&&(d&&(c+=",\n"+(this.tab+R)),c+=i.assignedVariables().join(",\n"+(this.tab+R))),c+=";\n"}return c+g},b.wrap=function(a){if(a.length===1&&a[0]instanceof b)return a[0];return new b(a)};return b}(e),a.Literal=A=function(a){function b(a){this.value=a}bl(b,a),b.prototype.makeReturn=function(){return this.isStatement()?this:b.__super__.makeReturn.apply(this,arguments)},b.prototype.isAssignable=function(){return o.test(this.value)},b.prototype.isStatement=function(){var a;return(a=this.value)==="break"||a==="continue"||a==="debugger"},b.prototype.isComplex=D,b.prototype.assigns=function(a){return a===this.value},b.prototype.jumps=function(a){if(this.value==="break"&&!((a!=null?a.loop:void 0)||(a!=null?a.block:void 0)))return this;if(this.value==="continue"&&(a!=null?!a.loop:!void 0))return this},b.prototype.compileNode=function(a){var b,c;b=this.value==="this"?((c=a.scope.method)!=null?c.bound:void 0)?a.scope.method.context:this.value:this.value.reserved?'"'+this.value+'"':this.value;return this.isStatement()?""+this.tab+b+";":b},b.prototype.toString=function(){return' "'+this.value+'"'};return b}(e),a.Undefined=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}bl(b,a),b.prototype.isAssignable=D,b.prototype.isComplex=D,b.prototype.compileNode=function(a){return a.level>=u?"(void 0)":"void 0"};return b}(e),a.Null=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}bl(b,a),b.prototype.isAssignable=D,b.prototype.isComplex=D,b.prototype.compileNode=function(){return"null"};return b}(e),a.Bool=function(a){function b(a){this.val=a}bl(b,a),b.prototype.isAssignable=D,b.prototype.isComplex=D,b.prototype.compileNode=function(){return this.val};return b}(e),a.Return=K=function(a){function b(a){a&&!a.unwrap().isUndefined&&(this.expression=a)}bl(b,a),b.prototype.children=["expression"],b.prototype.isStatement=Y,b.prototype.makeReturn=S,b.prototype.jumps=S,b.prototype.compile=function(a,c){var d,e;d=(e=this.expression)!=null?e.makeReturn():void 0;return!d||d instanceof b?b.__super__.compile.call(this,a,c):d.compile(a,c)},b.prototype.compileNode=function(a){return this.tab+("return"+[this.expression?" "+this.expression.compile(a,y):void 0]+";")};return b}(e),a.Value=W=function(a){function b(a,c,d){if(!c&&a instanceof b)return a;this.base=a,this.properties=c||[],d&&(this[d]=!0);return this}bl(b,a),b.prototype.children=["base","properties"],b.prototype.add=function(a){this.properties=this.properties.concat(a);return this},b.prototype.hasProperties=function(){return!!this.properties.length},b.prototype.isArray=function(){return!this.properties.length&&this.base instanceof c},b.prototype.isComplex=function(){return this.hasProperties()||this.base.isComplex()},b.prototype.isAssignable=function(){return this.hasProperties()||this.base.isAssignable()},b.prototype.isSimpleNumber=function(){return this.base instanceof A&&L.test(this.base.value)},b.prototype.isString=function(){return this.base instanceof A&&q.test(this.base.value)},b.prototype.isAtomic=function(){var a,b,c,d;d=this.properties.concat(this.base);for(b=0,c=d.length;b<c;b++){a=d[b];if(a.soak||a instanceof g)return!1}return!0},b.prototype.isStatement=function(a){return!this.properties.length&&this.base.isStatement(a)},b.prototype.assigns=function(a){return!this.properties.length&&this.base.assigns(a)},b.prototype.jumps=function(a){return!this.properties.length&&this.base.jumps(a)},b.prototype.isObject=function(a){if(this.properties.length)return!1;return this.base instanceof E&&(!a||this.base.generated)},b.prototype.isSplice=function(){return bc(this.properties)instanceof O},b.prototype.unwrap=function(){return this.properties.length?this:this.base},b.prototype.cacheReference=function(a){var c,e,f,g;f=bc(this.properties);if(this.properties.length<2&&!this.base.isComplex()&&(f!=null?!f.isComplex():!void 0))return[this,this];c=new b(this.base,this.properties.slice(0,-1)),c.isComplex()&&(e=new A(a.scope.freeVariable("base")),c=new b(new H(new d(e,c))));if(!f)return[c,e];f.isComplex()&&(g=new A(a.scope.freeVariable("name")),f=new t(new d(g,f.index)),g=new t(g));return[c.add(f),new b(e||c.base,[g||f])]},b.prototype.compileNode=function(a){var b,c,d,e,f;this.base.front=this.front,d=this.properties,b=this.base.compile(a,d.length?u:null),(this.base instanceof H||d.length)&&L.test(b)&&(b=""+b+".");for(e=0,f=d.length;e<f;e++)c=d[e],b+=c.compile(a);return b},b.prototype.unfoldSoak=function(a){var c,e=this;if(this.unfoldedSoak!=null)return this.unfoldedSoak;c=function(){var c,f,g,h,i,j,k,m,n;if(g=e.base.unfoldSoak(a)){Array.prototype.push.apply(g.body.properties,e.properties);return g}n=e.properties;for(f=k=0,m=n.length;k<m;f=++k){h=n[f];if(!h.soak)continue;h.soak=!1,c=new b(e.base,e.properties.slice(0,f)),j=new b(e.base,e.properties.slice(f)),c.isComplex()&&(i=new A(a.scope.freeVariable("ref")),c=new H(new d(i,c)),j.base=i);return new r(new l(c),j,{soak:!0})}return null}();return this.unfoldedSoak=c||!1};return b}(e),a.Comment=k=function(a){function b(a){this.comment=a}bl(b,a),b.prototype.isStatement=Y,b.prototype.makeReturn=S,b.prototype.compileNode=function(a,b){var c;c="/*"+be(this.comment,this.tab)+("\n"+this.tab+"*/\n"),(b||a.level)===z&&(c=a.indent+c);return c};return b}(e),a.Call=g=function(a){function c(a,b,c){this.args=b!=null?b:[],this.soak=c,this.isNew=!1,this.isSuper=a==="super",this.variable=this.isSuper?null:a}bl(c,a),c.prototype.children=["variable","args"],c.prototype.newInstance=function(){var a,b;a=((b=this.variable)!=null?b.base:void 0)||this.variable,a instanceof c&&!a.isNew?a.newInstance():this.isNew=!0;return this},c.prototype.superReference=function(a){var c,d,e;d=a.scope.namedMethod();if(!d)throw SyntaxError("cannot call super outside of a function.");e=d.name;if(e==null)throw SyntaxError("cannot call super on an anonymous function.");if(d.klass){c=[new b(new A("__super__"))],d["static"]&&c.push(new b(new A("constructor"))),c.push(new b(new A(e)));return(new W(new A(d.klass),c)).compile(a)}return""+e+".__super__.constructor"},c.prototype.superThis=function(a){var b;b=a.scope.method;return b&&!b.klass&&b.context||"this"},c.prototype.unfoldSoak=function(a){var b,d,e,f,g,h,i,j,k;if(this.soak){if(this.variable){if(d=bg(a,this,"variable"))return d;j=(new W(this.variable)).cacheReference(a),e=j[0],g=j[1]}else e=new A(this.superReference(a)),g=new W(e);g=new c(g,this.args),g.isNew=this.isNew,e=new A("typeof "+e.compile(a)+' === "function"');return new r(e,new W(g),{soak:!0})}b=this,f=[];for(;;){if(b.variable instanceof c){f.push(b),b=b.variable;continue}if(!(b.variable instanceof W))break;f.push(b);if(!((b=b.variable.base)instanceof c))break}k=f.reverse();for(h=0,i=k.length;h<i;h++)b=k[h],d&&(b.variable instanceof c?b.variable=d:b.variable.base=d),d=bg(a,b,"variable");return d},c.prototype.filterImplicitObjects=function(a){var b,c,e,f,g,h,i,j,l,m;c=[];for(h=0,j=a.length;h<j;h++){b=a[h];if(!((typeof b.isObject=="function"?b.isObject():void 0)&&b.base.generated)){c.push(b);continue}e=null,m=b.base.properties;for(i=0,l=m.length;i<l;i++)f=m[i],f instanceof d||f instanceof k?(e||c.push(e=new E(g=[],!0)),g.push(f)):(c.push(f),e=null)}return c},c.prototype.compileNode=function(a){var b,c,d,e;(e=this.variable)!=null&&(e.front=this.front);if(d=P.compileSplattedArray(a,this.args,!0))return this.compileSplat(a,d);c=this.filterImplicitObjects(this.args),c=function(){var d,e,f;f=[];for(d=0,e=c.length;d<e;d++)b=c[d],f.push(b.compile(a,w));return f}().join(", ");return this.isSuper?this.superReference(a)+(".call("+this.superThis(a)+(c&&", "+c)+")"):(this.isNew?"new ":"")+this.variable.compile(a,u)+("("+c+")")},c.prototype.compileSuper=function(a,b){return""+this.superReference(b)+".call("+this.superThis(b)+(a.length?", ":"")+a+")"},c.prototype.compileSplat=function(a,b){var c,d,e,f,g;if(this.isSuper)return""+this.superReference(a)+".apply("+this.superThis(a)+", "+b+")";if(this.isNew){e=this.tab+R;return"(function(func, args, ctor) {\n"+e+"ctor.prototype = func.prototype;\n"+e+"var child = new ctor, result = func.apply(child, args), t = typeof result;\n"+e+'return t == "object" || t == "function" ? result || child : child;\n'+this.tab+"})("+this.variable.compile(a,w)+", "+b+", function(){})"}c=new W(this.variable),(f=c.properties.pop())&&c.isComplex()?(g=a.scope.freeVariable("ref"),d="("+g+" = "+c.compile(a,w)+")"+f.compile(a)):(d=c.compile(a,u),L.test(d)&&(d="("+d+")"),f?(g=d,d+=f.compile(a)):g="null");return""+d+".apply("+g+", "+b+")"};return c}(e),a.Extends=m=function(a){function b(a,b){this.child=a,this.parent=b}bl(b,a),b.prototype.children=["child","parent"],b.prototype.compile=function(a){return(new g(new W(new A(bh("extends"))),[this.child,this.parent])).compile(a)};return b}(e),a.Access=b=function(a){function b(a,b){this.name=a,this.name.asKey=!0,this.soak=b==="soak"}bl(b,a),b.prototype.children=["name"],b.prototype.compile=function(a){var b;b=this.name.compile(a);return o.test(b)?"."+b:"["+b+"]"},b.prototype.isComplex=D;return b}(e),a.Index=t=function(a){function b(a){this.index=a}bl(b,a),b.prototype.children=["index"],b.prototype.compile=function(a){return"["+this.index.compile(a,y)+"]"},b.prototype.isComplex=function(){return this.index.isComplex()};return b}(e),a.Range=J=function(a){function b(a,b,c){this.from=a,this.to=b,this.exclusive=c==="exclusive",this.equals=this.exclusive?"":"="}bl(b,a),b.prototype.children=["from","to"],b.prototype.compileVariables=function(a){var b,c,d,e,f;a=bd(a,{top:!0}),c=this.from.cache(a,w),this.fromC=c[0],this.fromVar=c[1],d=this.to.cache(a,w),this.toC=d[0],this.toVar=d[1];if(b=$(a,"step"))e=b.cache(a,w),this.step=e[0],this.stepVar=e[1];f=[this.fromVar.match(L),this.toVar.match(L)],this.fromNum=f[0],this.toNum=f[1];if(this.stepVar)return this.stepNum=this.stepVar.match(L)},b.prototype.compileNode=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o;this.fromVar||this.compileVariables(a);if(!a.index)return this.compileArray(a);h=this.fromNum&&this.toNum,f=$(a,"index"),g=$(a,"name"),j=g&&g!==f,m=""+f+" = "+this.fromC,this.toC!==this.toVar&&(m+=", "+this.toC),this.step!==this.stepVar&&(m+=", "+this.step),n=[""+f+" <"+this.equals,""+f+" >"+this.equals],i=n[0],e=n[1],c=this.stepNum?+this.stepNum>0?""+i+" "+this.toVar:""+e+" "+this.toVar:h?(o=[+this.fromNum,+this.toNum],d=o[0],l=o[1],o,d<=l?""+i+" "+l:""+e+" "+l):(b=""+this.fromVar+" <= "+this.toVar,""+b+" ? "+i+" "+this.toVar+" : "+e+" "+this.toVar),k=this.stepVar?""+f+" += "+this.stepVar:h?j?d<=l?"++"+f:"--"+f:d<=l?""+f+"++":""+f+"--":j?""+b+" ? ++"+f+" : --"+f:""+b+" ? "+f+"++ : "+f+"--",j&&(m=""+g+" = "+m),j&&(k=""+g+" = "+k);return""+m+"; "+c+"; "+k},b.prototype.compileArray=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p;if(this.fromNum&&this.toNum&&Math.abs(this.fromNum-this.toNum)<=20){j=function(){p=[];for(var a=n=+this.fromNum,b=+this.toNum;n<=b?a<=b:a>=b;n<=b?a++:a--)p.push(a);return p}.apply(this),this.exclusive&&j.pop();return"["+j.join(", ")+"]"}g=this.tab+R,f=a.scope.freeVariable("i"),k=a.scope.freeVariable("results"),i="\n"+g+k+" = [];",this.fromNum&&this.toNum?(a.index=f,c=this.compileNode(a)):(l=""+f+" = "+this.fromC+(this.toC!==this.toVar?", "+this.toC:""),d=""+this.fromVar+" <= "+this.toVar,c="var "+l+"; "+d+" ? "+f+" <"+this.equals+" "+this.toVar+" : "+f+" >"+this.equals+" "+this.toVar+"; "+d+" ? "+f+"++ : "+f+"--"),h="{ "+k+".push("+f+"); }\n"+g+"return "+k+";\n"+a.indent,e=function(a){return a!=null?a.contains(function(a){return a instanceof A&&a.value==="arguments"&&!a.asKey}):void 0};if(e(this.from)||e(this.to))b=", arguments";return"(function() {"+i+"\n"+g+"for ("+c+")"+h+"}).apply(this"+(b!=null?b:"")+")"};return b}(e),a.Slice=O=function(a){function b(a){this.range=a,b.__super__.constructor.call(this)}bl(b,a),b.prototype.children=["range"],b.prototype.compileNode=function(a){var b,c,d,e,f,g;g=this.range,e=g.to,c=g.from,d=c&&c.compile(a,y)||"0",b=e&&e.compile(a,y),e&&(!!this.range.exclusive||+b!==-1)&&(f=", "+(this.range.exclusive?b:L.test(b)?""+(+b+1):(b=e.compile(a,u),""+b+" + 1 || 9e9")));return".slice("+d+(f||"")+")"};return b}(e),a.Obj=E=function(a){function b(a,b){this.generated=b!=null?b:!1,this.objects=this.properties=a||[]}bl(b,a),b.prototype.children=["properties"],b.prototype.compileNode=function(a){var b,c,e,f,g,h,i,j,l,m,n,o,p,q,r,s;n=this.properties,m=[],s=this.properties;for(o=0,q=s.length;o<q;o++){j=s[o],j.isComplex()&&(j=j.variable);if(j!=null){l=j.unwrapAll().value.toString();if(bm.call(m,l)>=0)throw SyntaxError('multiple object literal properties named "'+l+'"');m.push(l)}}if(!n.length)return this.front?"({})":"{}";if(this.generated)for(p=0,r=n.length;p<r;p++){h=n[p];if(h instanceof W)throw new Error("cannot have an implicit value in an implicit object")}c=a.indent+=R,g=this.lastNonComment(this.properties),n=function(){var h,i,l;l=[];for(b=h=0,i=n.length;h<i;b=++h)j=n[b],f=b===n.length-1?"":j===g||j instanceof k?"\n":",\n",e=j instanceof k?"":c,j instanceof W&&j["this"]&&(j=new d(j.properties[0].name,j,"object")),j instanceof k||(j instanceof d||(j=new d(j,j,"object")),(j.variable.base||j.variable).asKey=!0),l.push(e+j.compile(a,z)+f);return l}(),n=n.join(""),i="{"+(n&&"\n"+n+"\n"+this.tab)+"}";return this.front?"("+i+")":i},b.prototype.assigns=function(a){var b,c,d,e;e=this.properties;for(c=0,d=e.length;c<d;c++){b=e[c];if(b.assigns(a))return!0}return!1};return b}(e),a.Arr=c=function(a){function b(a){this.objects=a||[]}bl(b,a),b.prototype.children=["objects"],b.prototype.filterImplicitObjects=g.prototype.filterImplicitObjects,b.prototype.compileNode=function(a){var b,c,d;if(!this.objects.length)return"[]";a.indent+=R,d=this.filterImplicitObjects(this.objects);if(b=P.compileSplattedArray(a,d))return b;b=function(){var b,e,f;f=[];for(b=0,e=d.length;b<e;b++)c=d[b],f.push(c.compile(a,w));return f}().join(", ");return b.indexOf("\n")>=0?"[\n"+a.indent+b+"\n"+this.tab+"]":"["+b+"]"},b.prototype.assigns=function(a){var b,c,d,e;e=this.objects;for(c=0,d=e.length;c<d;c++){b=e[c];if(b.assigns(a))return!0}return!1};return b}(e),a.Class=h=function(a){function c(a,b,c){this.variable=a,this.parent=b,this.body=c!=null?c:new f,this.boundFuncs=[],this.body.classBody=!0}bl(c,a),c.prototype.children=["variable","parent","body"],c.prototype.determineName=function(){var a,c;if(!this.variable)return null;a=(c=bc(this.variable.properties))?c instanceof b&&c.name.value:this.variable.base.value;if(bm.call(M,a)>=0)throw SyntaxError("variable name may not be "+a);return a&&(a=o.test(a)&&a)},c.prototype.setContext=function(a){return this.body.traverseChildren(!1,function(b){if(b.classBody)return!1;if(b instanceof A&&b.value==="this")return b.value=a;if(b instanceof j){b.klass=a;if(b.bound)return b.context=a}})},c.prototype.addBoundFunctions=function(a){var c,d,e,f,g,h;if(this.boundFuncs.length){g=this.boundFuncs,h=[];for(e=0,f=g.length;e<f;e++)c=g[e],d=(new W(new A("this"),[new b(c)])).compile(a),h.push(this.ctor.body.unshift(new A(""+d+" = "+bh("bind")+"("+d+", this)")));return h}},c.prototype.addProperties=function(a,c,e){var f,g,h,i,k;k=a.base.properties.slice(0),h=function(){var a;a=[];while(f=k.shift()){if(f instanceof d){g=f.variable.base,delete f.context,i=f.value;if(g.value==="constructor"){if(this.ctor)throw new Error("cannot define more than one constructor in a class");if(i.bound)throw new Error("cannot define a constructor as a bound function");i instanceof j?f=this.ctor=i:(this.externalCtor=e.scope.freeVariable("class"),f=new d(new A(this.externalCtor),i))}else f.variable["this"]?(i["static"]=!0,i.bound&&(i.context=c)):(f.variable=new W(new A(c),[new b(new A("prototype")),new b(g)]),i instanceof j&&i.bound&&(this.boundFuncs.push(g),i.bound=!1))}a.push(f)}return a}.call(this);return Z(h)},c.prototype.walkBody=function(a,b){var d=this;return this.traverseChildren(!1,function(e){var g,h,i,j,k,l;if(e instanceof c)return!1;if(e instanceof f){l=g=e.expressions;for(h=j=0,k=l.length;j<k;h=++j)i=l[h],i instanceof W&&i.isObject(!0)&&(g[h]=d.addProperties(i,a,b));return e.expressions=g=bb(g)}})},c.prototype.hoistDirectivePrologue=function(){var a,b,c;b=0,a=this.body.expressions;while((c=a[b])&&c instanceof k||c instanceof W&&c.isString())++b;return this.directives=a.splice(0,b)},c.prototype.ensureConstructor=function(a){this.ctor||(this.ctor=new j,this.parent&&this.ctor.body.push(new A(""+a+".__super__.constructor.apply(this, arguments)")),this.externalCtor&&this.ctor.body.push(new A(""+this.externalCtor+".apply(this, arguments)")),this.ctor.body.makeReturn(),this.body.expressions.unshift(this.ctor)),this.ctor.ctor=this.ctor.name=a,this.ctor.klass=null;return this.ctor.noReturn=!0},c.prototype.compileNode=function(a){var b,c,e,f,g,h,k;c=this.determineName(),g=c||"_Class",g.reserved&&(g="_"+g),f=new A(g),this.hoistDirectivePrologue(),this.setContext(g),this.walkBody(g,a),this.ensureConstructor(g),this.body.spaced=!0,this.ctor instanceof j||this.body.expressions.unshift(this.ctor),this.body.expressions.push(f),(k=this.body.expressions).unshift.apply(k,this.directives),this.addBoundFunctions(a),b=i.wrap(this.body),this.parent&&(this.superClass=new A(a.scope.freeVariable("super",!1)),this.body.expressions.unshift(new m(f,this.superClass)),b.args.push(this.parent),h=b.variable.params||b.variable.base.params,h.push(new G(this.superClass))),e=new H(b,!0),this.variable&&(e=new d(this.variable,e));return e.compile(a)};return c}(e),a.Assign=d=function(a){function c(a,b,c,d){var e,f,g;this.variable=a,this.value=b,this.context=c,this.param=d&&d.param,this.subpattern=d&&d.subpattern,e=(g=f=this.variable.unwrapAll().value,bm.call(M,g)>=0);if(e&&this.context!=="object")throw SyntaxError('variable name may not be "'+f+'"')}bl(c,a),c.prototype.children=["variable","value"],c.prototype.isStatement=function(a){return(a!=null?a.level:void 0)===z&&this.context!=null&&bm.call(this.context,"?")>=0},c.prototype.assigns=function(a){return this[this.context==="object"?"value":"variable"].assigns(a)},c.prototype.unfoldSoak=function(a){return bg(a,this,"variable")},c.prototype.compileNode=function(a){var b,c,d,e,f,g,h,i,k;if(b=this.variable instanceof W){if(this.variable.isArray()||this.variable.isObject())return this.compilePatternMatch(a);if(this.variable.isSplice())return this.compileSplice(a);if((g=this.context)==="||="||g==="&&="||g==="?=")return this.compileConditional(a)}d=this.variable.compile(a,w);if(!this.context){if(!(f=this.variable.unwrapAll()).isAssignable())throw SyntaxError('"'+this.variable.compile(a)+'" cannot be assigned.');if(typeof f.hasProperties=="function"?!f.hasProperties():!void 0)this.param?a.scope.add(d,"var"):a.scope.find(d)}this.value instanceof j&&(c=B.exec(d))&&(c[1]&&(this.value.klass=c[1]),this.value.name=(h=(i=(k=c[2])!=null?k:c[3])!=null?i:c[4])!=null?h:c[5]),e=this.value.compile(a,w);if(this.context==="object")return""+d+": "+e;e=d+(" "+(this.context||"=")+" ")+e;return a.level<=w?e:"("+e+")"},c.prototype.compilePatternMatch=function(a){var d,e,f,g,h,i,j,k,l,m,n,p,q,r,s,u,v,y,B,C,D,E,F,G,J,K,L;s=a.level===z,v=this.value,m=this.variable.base.objects;if(!(n=m.length)){f=v.compile(a);return a.level>=x?"("+f+")":f}i=this.variable.isObject();if(s&&n===1&&!((l=m[0])instanceof P)){l instanceof c?(D=l,E=D.variable,h=E.base,l=D.value):l.base instanceof H?(F=(new W(l.unwrapAll())).cacheReference(a),l=F[0],h=F[1]):h=i?l["this"]?l.properties[0].name:l:new A(0),d=o.test(h.unwrap().value||0),v=new W(v),v.properties.push(new(d?b:t)(h));if(G=l.unwrap().value,bm.call(I,G)>=0)throw new SyntaxError("assignment to a reserved word: "+l.compile(a)+" = "+v.compile(a));return(new c(l,v,null,{param:this.param})).compile(a,z)}y=v.compile(a,w),e=[],r=!1;if(!o.test(y)||this.variable.assigns(y))e.push(""+(p=a.scope.freeVariable("ref"))+" = "+y),y=p;for(g=B=0,C=m.length;B<C;g=++B){l=m[g],h=g,i&&(l instanceof c?(J=l,K=J.variable,h=K.base,l=J.value):l.base instanceof H?(L=(new W(l.unwrapAll())).cacheReference(a),l=L[0],h=L[1]):h=l["this"]?l.properties[0].name:l);if(!r&&l instanceof P)k=l.name.unwrap().value,l=l.unwrap(),u=""+n+" <= "+y+".length ? "+bh("slice")+".call("+y+", "+g,(q=n-g-1)?(j=a.scope.freeVariable("i"),u+=", "+j+" = "+y+".length - "+q+") : ("+j+" = "+g+", [])"):u+=") : []",u=new A(u),r=""+j+"++";else{k=l.unwrap().value;if(l instanceof P){l=l.name.compile(a);throw new SyntaxError("multiple splats are disallowed in an assignment: "+l+"...")}typeof h=="number"?(h=new A(r||h),d=!1):d=i&&o.test(h.unwrap().value||0),u=new W(new A(y),[new(d?b:t)(h)])}if(k!=null&&bm.call(I,k)>=0)throw new SyntaxError("assignment to a reserved word: "+l.compile(a)+" = "+u.compile(a));e.push((new c(l,u,null,{param:this.param,subpattern:!0})).compile(a,w))}!s&&!this.subpattern&&e.push(y),f=e.join(", ");return a.level<w?f:"("+f+")"},c.prototype.compileConditional=function(a){var b,d,e;e=this.variable.cacheReference(a),b=e[0],d=e[1];if(!b.properties.length&&b.base instanceof A&&b.base.value!=="this"&&!a.scope.check(b.base.value))throw new Error('the variable "'+b.base.value+"\" can't be assigned with "+this.context+" because it has not been defined.");bm.call(this.context,"?")>=0&&(a.isExistentialEquals=!0);return(new F(this.context.slice(0,-1),b,new c(d,this.value,"="))).compile(a)},c.prototype.compileSplice=function(a){var b,c,d,e,f,g,h,i,j,k,l,m;k=this.variable.properties.pop().range,d=k.from,h=k.to,c=k.exclusive,g=this.variable.compile(a),l=(d!=null?d.cache(a,x):void 0)||["0","0"],e=l[0],f=l[1],h?(d!=null?d.isSimpleNumber():void 0)&&h.isSimpleNumber()?(h=+h.compile(a)- +f,c||(h+=1)):(h=h.compile(a,u)+" - "+f,c||(h+=" + 1")):h="9e9",m=this.value.cache(a,w),i=m[0],j=m[1],b="[].splice.apply("+g+", ["+e+", "+h+"].concat("+i+")), "+j;return a.level>z?"("+b+")":b};return c}(e),a.Code=j=function(a){function b(a,b,c){this.params=a||[],this.body=b||new f,this.bound=c==="boundfunc",this.bound&&(this.context="_this")}bl(b,a),b.prototype.children=["params","body"],b.prototype.isStatement=function(){return!!this.ctor},b.prototype.jumps=D,b.prototype.compileNode=function(a){var b,e,f,g,h,i,j,k,l,m,n,o,p,q,s,t,v,w,x,y,z,B,C,D,E,G,H,I,J,K,L,M,O;a.scope=new N(a.scope,this.body,this),a.scope.shared=$(a,"sharedScope"),a.indent+=R,delete a.bare,delete a.isExistentialEquals,l=[],e=[],H=this.paramNames();for(s=0,x=H.length;s<x;s++)i=H[s],a.scope.check(i)||a.scope.parameter(i);I=this.params;for(t=0,y=I.length;t<y;t++){k=I[t];if(!k.splat)continue;J=this.params;for(v=0,z=J.length;v<z;v++)j=J[v].name,j["this"]&&(j=j.properties[0].name),j.value&&a.scope.add(j.value,"var",!0);n=new d(new W(new c(function(){var b,c,d,e;d=this.params,e=[];for(b=0,c=d.length;b<c;b++)j=d[b],e.push(j.asReference(a));return e}.call(this))),new W(new A("arguments")));break}K=this.params;for(w=0,B=K.length;w<B;w++)k=K[w],k.isComplex()?(p=m=k.asReference(a),k.value&&(p=new F("?",m,k.value)),e.push(new d(new W(k.name),p,"=",{param:!0}))):(m=k,k.value&&(h=new A(m.name.value+" == null"),p=new d(new W(k.name),k.value,"="),e.push(new r(h,p)))),n||l.push(m);q=this.body.isEmpty(),n&&e.unshift(n),e.length&&(L=this.body.expressions).unshift.apply(L,e);for(f=E=0,C=l.length;E<C;f=++E)j=l[f],a.scope.parameter(l[f]=j.compile(a));o=[],M=this.paramNames();for(G=0,D=M.length;G<D;G++){i=M[G];if(bm.call(o,i)>=0)throw SyntaxError("multiple parameters named '"+i+"'");o.push(i)}!q&&!this.noReturn&&this.body.makeReturn(),this.bound&&(((O=a.scope.parent.method)!=null?O.bound:void 0)?this.bound=this.context=a.scope.parent.method.context:this["static"]||a.scope.parent.assign("_this","this")),g=a.indent,b="function",this.ctor&&(b+=" "+this.name),b+="("+l.join(", ")+") {",this.body.isEmpty()||(b+="\n"+this.body.compileWithDeclarations(a)+"\n"+this.tab),b+="}";if(this.ctor)return this.tab+b;return this.front||a.level>=u?"("+b+")":b},b.prototype.paramNames=function(){var a,b,c,d,e;a=[],e=this.params;for(c=0,d=e.length;c<d;c++)b=e[c],a.push.apply(a,b.names());return a},b.prototype.traverseChildren=function(a,c){if(a)return b.__super__.traverseChildren.call(this,a,c)};return b}(e),a.Param=G=function(a){function b(a,b,c){var d;this.name=a,this.value=b,this.splat=c;if(d=a=this.name.unwrapAll().value,bm.call(M,d)>=0)throw SyntaxError('parameter name "'+a+'" is not allowed')}bl(b,a),b.prototype.children=["name","value"],b.prototype.compile=function(a){return this.name.compile(a,w)},b.prototype.asReference=function(a){var b;if(this.reference)return this.reference;b=this.name,b["this"]?(b=b.properties[0].name,b.value.reserved&&(b=new A(a.scope.freeVariable(b.value)))):b.isComplex()&&(b=new A(a.scope.freeVariable("arg"))),b=new W(b),this.splat&&(b=new P(b));return this.reference=b},b.prototype.isComplex=function(){return this.name.isComplex()},b.prototype.names=function(a){var b,c,e,f,g,h;a==null&&(a=this.name),b=function(a){var b;b=a.properties[0].name.value;return b.reserved?[]:[b]};if(a instanceof A)return[a.value];if(a instanceof W)return b(a);c=[],h=a.objects;for(f=0,g=h.length;f<g;f++){e=h[f];if(e instanceof d)c.push(e.value.unwrap().value);else if(e instanceof P)c.push(e.name.unwrap().value);else if(e instanceof W)e.isArray()||e.isObject()?c.push.apply(c,this.names(e.base)):e["this"]?c.push.apply(c,b(e)):c.push(e.base.value);else throw SyntaxError("illegal parameter "+e.compile())}return c};return b}(e),a.Splat=P=function(a){function b(a){this.name=a.compile?a:new A(a)}bl(b,a),b.prototype.children=["name"],b.prototype.isAssignable=Y,b.prototype.assigns=function(a){return this.name.assigns(a)},b.prototype.compile=function(a){return this.index!=null?this.compileParam(a):this.name.compile(a)},b.prototype.unwrap=function(){return this.name},b.compileSplattedArray=function(a,c,d){var e,f,g,h,i,j,k,l;i=-1;while((j=c[++i])&&!(j instanceof b))continue;if(i>=c.length)return"";if(c.length===1){g=c[0].compile(a,w);if(d)return g;return""+bh("slice")+".call("+g+")"}e=c.slice(i);for(h=k=0,l=e.length;k<l;h=++k)j=e[h],g=j.compile(a,w),e[h]=j instanceof b?""+bh("slice")+".call("+g+")":"["+g+"]";if(i===0)return e[0]+(".concat("+e.slice(1).join(", ")+")");f=function(){var b,d,e,f;e=c.slice(0,i),f=[];for(b=0,d=e.length;b<d;b++)j=e[b],f.push(j.compile(a,w));return f}();return"["+f.join(", ")+"].concat("+e.join(", ")+")"};return b}(e),a.While=X=function(a){function b(a,b){this.condition=(b!=null?b.invert:void 0)?a.invert():a,this.guard=b!=null?b.guard:void 0}bl(b,a),b.prototype.children=["condition","guard","body"],b.prototype.isStatement=Y,b.prototype.makeReturn=function(a){if(a)return b.__super__.makeReturn.apply(this,arguments);this.returns=!this.jumps({loop:!0});return this},b.prototype.addBody=function(a){this.body=a;return this},b.prototype.jumps=function(){var a,b,c,d;a=this.body.expressions;if(!a.length)return!1;for(c=0,d=a.length;c<d;c++){b=a[c];if(b.jumps({loop:!0}))return b}return!1},b.prototype.compileNode=function(a){var b,c,d,e;a.indent+=R,e="",b=this.body,b.isEmpty()?b="":(this.returns&&(b.makeReturn(d=a.scope.freeVariable("results")),e=""+this.tab+d+" = [];\n"),this.guard&&(b.expressions.length>1?b.expressions.unshift(new r((new H(this.guard)).invert(),new A("continue"))):this.guard&&(b=f.wrap([new r(this.guard,b)]))),b="\n"+b.compile(a,z)+"\n"+this.tab),c=e+this.tab+("while ("+this.condition.compile(a,y)+") {"+b+"}"),this.returns&&(c+="\n"+this.tab+"return "+d+";");return c};return b}(e),a.Op=F=function(a){function e(a,c,d,e){if(a==="in")return new s(c,d);if(a==="do")return this.generateDo(c);if(a==="new"){if(c instanceof g&&!c["do"]&&!c.isNew)return c.newInstance();if(c instanceof j&&c.bound||c["do"])c=new H(c)}this.operator=b[a]||a,this.first=c,this.second=d,this.flip=!!e;return this}var b,c;bl(e,a),b={"==":"===","!=":"!==",of:"in"},c={"!==":"===","===":"!=="},e.prototype.children=["first","second"],e.prototype.isSimpleNumber=D,e.prototype.isUnary=function(){return!this.second},e.prototype.isComplex=function(){var a;return!this.isUnary()||(a=this.operator)!=="+"&&a!=="-"||this.first.isComplex()},e.prototype.isChainable=function(){var a;return(a=this.operator)==="<"||a===">"||a===">="||a==="<="||a==="==="||a==="!=="},e.prototype.invert=function(){var a,b,d,f,g;if(this.isChainable()&&this.first.isChainable()){a=!0,b=this;while(b&&b.operator)a&&(a=b.operator in c),b=b.first;if(!a)return(new H(this)).invert();b=this;while(b&&b.operator)b.invert=!b.invert,b.operator=c[b.operator],b=b.first;return this}if(f=c[this.operator]){this.operator=f,this.first.unwrap()instanceof e&&this.first.invert();return this}return this.second?(new H(this)).invert():this.operator==="!"&&(d=this.first.unwrap())instanceof e&&((g=d.operator)==="!"||g==="in"||g==="instanceof")?d:new e("!",this)},e.prototype.unfoldSoak=function(a){var b;return((b=this.operator)==="++"||b==="--"||b==="delete")&&bg(a,this,"first")},e.prototype.generateDo=function(a){var b,c,e,f,h,i,k,l;f=[],c=a instanceof d&&(h=a.value.unwrap())instanceof j?h:a,l=c.params||[];for(i=0,k=l.length;i<k;i++)e=l[i],e.value?(f.push(e.value),delete e.value):f.push(e);b=new g(a,f),b["do"]=!0;return b},e.prototype.compileNode=function(a){var b,c,d,e;c=this.isChainable()&&this.first.isChainable(),c||(this.first.front=this.front);if(this.operator==="delete"&&a.scope.check(this.first.unwrapAll().value))throw SyntaxError("delete operand may not be argument or var");if(((d=this.operator)==="--"||d==="++")&&(e=this.first.unwrapAll().value,bm.call(M,e)>=0))throw SyntaxError("prefix increment/decrement may not have eval or arguments operand");if(this.isUnary())return this.compileUnary(a);if(c)return this.compileChain(a);if(this.operator==="?")return this.compileExistence(a);b=this.first.compile(a,x)+" "+this.operator+" "+this.second.compile(a,x);return a.level<=x?b:"("+b+")"},e.prototype.compileChain=function(a){var b,c,d,e;e=this.first.second.cache(a),this.first.second=e[0],d=e[1],c=this.first.compile(a,x),b=""+c+" "+(this.invert?"&&":"||")+" "+d.compile(a)+" "+this.operator+" "+this.second.compile(a,x);return"("+b+")"},e.prototype.compileExistence=function(a){var b,c;this.first.isComplex()?(c=new A(a.scope.freeVariable("ref")),b=new H(new d(c,this.first))):(b=this.first,c=b);return(new r(new l(b),c,{type:"if"})).addElse(this.second).compile(a)},e.prototype.compileUnary=function(a){var b,c,d;if(a.level>=u)return(new H(this)).compile(a);c=[b=this.operator],d=b==="+"||b==="-",(b==="new"||b==="typeof"||b==="delete"||d&&this.first instanceof e&&this.first.operator===b)&&c.push(" ");if(d&&this.first instanceof e||b==="new"&&this.first.isStatement(a))this.first=new H(this.first);c.push(this.first.compile(a,x)),this.flip&&c.reverse();return c.join("")},e.prototype.toString=function(a){return e.__super__.toString.call(this,a,this.constructor.name+" "+this.operator)};return e}(e),a.In=s=function(a){function b(a,b){this.object=a,this.array=b}bl(b,a),b.prototype.children=["object","array"],b.prototype.invert=C,b.prototype.compileNode=function(a){var b,c,d,e,f;if(this.array instanceof W&&this.array.isArray()){f=this.array.base.objects;for(d=0,e=f.length;d<e;d++){c=f[d];if(!(c instanceof P))continue;b=!0;break}if(!b)return this.compileOrTest(a)}return this.compileLoopTest(a)},b.prototype.compileOrTest=function(a){var b,c,d,e,f,g,h,i,j;if(this.array.base.objects.length===0)return""+!!this.negated;i=this.object.cache(a,x),g=i[0],f=i[1],j=this.negated?[" !== "," && "]:[" === "," || "],b=j[0],c=j[1],h=function(){var c,h,i,j;i=this.array.base.objects,j=[];for(d=c=0,h=i.length;c<h;d=++c)e=i[d],j.push((d?f:g)+b+e.compile(a,u));return j}.call(this),h=h.join(c);return a.level<x?h:"("+h+")"},b.prototype.compileLoopTest=function(a){var b,c,d,e;e=this.object.cache(a,w),d=e[0],c=e[1],b=bh("indexOf")+(".call("+this.array.compile(a,w)+", "+c+") ")+(this.negated?"< 0":">= 0");if(d===c)return b;b=d+", "+b;return a.level<w?b:"("+b+")"},b.prototype.toString=function(a){return b.__super__.toString.call(this,a,this.constructor.name+(this.negated?"!":""))};return b}(e),a.Try=U=function(a){function b(a,b,c,d){this.attempt=a,this.error=b,this.recovery=c,this.ensure=d}bl(b,a),b.prototype.children=["attempt","recovery","ensure"],b.prototype.isStatement=Y,b.prototype.jumps=function(a){var b;return this.attempt.jumps(a)||((b=this.recovery)!=null?b.jumps(a):void 0)},b.prototype.makeReturn=function(a){this.attempt&&(this.attempt=this.attempt.makeReturn(a)),this.recovery&&(this.recovery=this.recovery.makeReturn(a));return this},b.prototype.compileNode=function(a){var b,c,d,e;a.indent+=R,d=this.error?" ("+this.error.compile(a)+") ":" ",e=this.attempt.compile(a,z),b=function(){var b;if(this.recovery){if(b=this.error.value,bm.call(M,b)>=0)throw SyntaxError('catch variable may not be "'+this.error.value+'"');a.scope.check(this.error.value)||a.scope.add(this.error.value,"param");return" catch"+d+"{\n"+this.recovery.compile(a,z)+"\n"+this.tab+"}"}if(!this.ensure&&!this.recovery)return" catch (_error) {}"}.call(this),c=this.ensure?" finally {\n"+this.ensure.compile(a,z)+"\n"+this.tab+"}":"";return""+this.tab+"try {\n"+e+"\n"+this.tab+"}"+(b||"")+c};return b}(e),a.Throw=T=function(a){function b(a){this.expression=a}bl(b,a),b.prototype.children=["expression"],b.prototype.isStatement=Y,b.prototype.jumps=D,b.prototype.makeReturn=S,b.prototype.compileNode=function(a){return this.tab+("throw "+this.expression.compile(a)+";")};return b}(e),a.Existence=l=function(a){function b(a){this.expression=a}bl(b,a),b.prototype.children=["expression"],b.prototype.invert=C,b.prototype.compileNode=function(a){var b,c,d,e;this.expression.front=this.front,d=this.expression.compile(a,x),o.test(d)&&!a.scope.check(d)?(e=this.negated?["===","||"]:["!==","&&"],b=e[0],c=e[1],d="typeof "+d+" "+b+' "undefined" '+c+" "+d+" "+b+" null"):d=""+d+" "+(this.negated?"==":"!=")+" null";return a.level<=v?d:"("+d+")"};return b}(e),a.Parens=H=function(a){function b(a){this.body=a}bl(b,a),b.prototype.children=["body"],b.prototype.unwrap=function(){return this.body},b.prototype.isComplex=function(){return this.body.isComplex()},b.prototype.compileNode=function(a){var b,c,d;d=this.body.unwrap();if(d instanceof W&&d.isAtomic()){d.front=this.front;return d.compile(a)}c=d.compile(a,y),b=a.level<x&&(d instanceof F||d instanceof g||d instanceof n&&d.returns);return b?c:"("+c+")"};return b}(e),a.For=n=function(a){function b(a,b){var c;this.source=b.source,this.guard=b.guard,this.step=b.step,this.name=b.name,this.index=b.index,this.body=f.wrap([a]),this.own=!!b.own,this.object=!!b.object,this.object&&(c=[this.index,this.name],this.name=c[0],this.index=c[1]);if(this.index instanceof W)throw SyntaxError("index cannot be a pattern matching expression");this.range=this.source instanceof W&&this.source.base instanceof J&&!this.source.properties.length,this.pattern=this.name instanceof W;if(this.range&&this.index)throw SyntaxError("indexes do not apply to range loops");if(this.range&&this.pattern)throw SyntaxError("cannot pattern match over range loops");this.returns=!1}bl(b,a),b.prototype.children=["body","source","guard","step"],b.prototype.compileNode=function(a){var b,c,e,g,h,i,j,k,l,m,n,p,q,s,t,u,v,y,B,C,D,E,F,G,I;b=f.wrap([this.body]),n=(I=bc(b.expressions))!=null?I.jumps():void 0,n&&n instanceof K&&(this.returns=!1),C=this.range?this.source.base:this.source,B=a.scope,q=this.name&&this.name.compile(a,w),j=this.index&&this.index.compile(a,w),q&&!this.pattern&&B.find(q),j&&B.find(j),this.returns&&(y=B.freeVariable("results")),k=this.object&&j||B.freeVariable("i"),l=this.range&&q||j||k,m=l!==k?""+l+" = ":"",this.step&&!this.range&&(E=B.freeVariable("step")),this.pattern&&(q=k),G="",h="",c="",i=this.tab+R,this.range?e=C.compile(bd(a,{index:k,name:q,step:this.step})):(F=this.source.compile(a,w),(q||this.own)&&!o.test(F)&&(c=""+this.tab+(t=B.freeVariable("ref"))+" = "+F+";\n",F=t),q&&!this.pattern&&(s=""+q+" = "+F+"["+l+"]"),this.object||(p=B.freeVariable("len"),g=""+m+k+" = 0, "+p+" = "+F+".length",this.step&&(g+=", "+E+" = "+this.step.compile(a,x)),D=""+m+(this.step?""+k+" += "+E:l!==k?"++"+k:""+k+"++"),e=""+g+"; "+k+" < "+p+"; "+D)),this.returns&&(u=""+this.tab+y+" = [];\n",v="\n"+this.tab+"return "+y+";",b.makeReturn(y)),this.guard&&(b.expressions.length>1?b.expressions.unshift(new r((new H(this.guard)).invert(),new A("continue"))):this.guard&&(b=f.wrap([new r(this.guard,b)]))),this.pattern&&b.expressions.unshift(new d(this.name,new A(""+F+"["+l+"]"))),c+=this.pluckDirectCall(a,b),s&&(G="\n"+i+s+";"),this.object&&(e=""+l+" in "+F,this.own&&(h="\n"+i+"if (!"+bh("hasProp")+".call("+F+", "+l+")) continue;")),b=b.compile(bd(a,{indent:i}),z),b&&(b="\n"+b+"\n");return""+c+(u||"")+this.tab+"for ("+e+") {"+h+G+b+this.tab+"}"+(v||"")},b.prototype.pluckDirectCall=function(a,b){var c,e,f,h,i,k,l,m,n,o,p,q,r,s,t;e="",o=b.expressions;for(i=m=0,n=o.length;m<n;i=++m){f=o[i],f=f.unwrapAll();if(!(f instanceof g))continue;l=f.variable.unwrapAll();if(!(l instanceof j||l instanceof W&&((p=l.base)!=null?p.unwrapAll():void 0)instanceof j&&l.properties.length===1&&((q=(r=l.properties[0].name)!=null?r.value:void 0)==="call"||q==="apply")))continue;h=((s=l.base)!=null?s.unwrapAll():void 0)||l,k=new A(a.scope.freeVariable("fn")),c=new W(k),l.base&&(t=[c,l],l.base=t[0],c=t[1]),b.expressions[i]=new g(c,f.args),e+=this.tab+(new d(k,h)).compile(a,z)+";\n"}return e};return b}(X),a.Switch=Q=function(a){function b(a,b,c){this.subject=a,this.cases=b,this.otherwise=c}bl(b,a),b.prototype.children=["subject","cases","otherwise"],b.prototype.isStatement=Y,b.prototype.jumps=function(a){var b,c,d,e,f,g,h;a==null&&(a={block:!0}),f=this.cases;for(d=0,e=f.length;d<e;d++){g=f[d],c=g[0],b=g[1];if(b.jumps(a))return b}return(h=this.otherwise)!=null?h.jumps(a):void 0},b.prototype.makeReturn=function(a){var b,c,d,e,g;e=this.cases;for(c=0,d=e.length;c<d;c++)b=e[c],b[1].makeReturn(a);a&&(this.otherwise||(this.otherwise=new f([new A("void 0")]))),(g=this.otherwise)!=null&&g.makeReturn(a);return this},b.prototype.compileNode=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;i=a.indent+R,j=a.indent=i+R,d=this.tab+("switch ("+(((o=this.subject)!=null?o.compile(a,y):void 0)||!1)+") {\n"),p=this.cases;for(h=k=0,m=p.length;k<m;h=++k){q=p[h],f=q[0],b=q[1],r=bb([f]);for(l=0,n=r.length;l<n;l++)e=r[l],this.subject||(e=e.invert()),d+=i+("case "+e.compile(a,y)+":\n");if(c=b.compile(a,z))d+=c+"\n";if(h===this.cases.length-1&&!this.otherwise)break;g=this.lastNonComment(b.expressions);if(g instanceof K||g instanceof A&&g.jumps()&&g.value!=="debugger")continue;d+=j+"break;\n"}this.otherwise&&this.otherwise.expressions.length&&(d+=i+("default:\n"+this.otherwise.compile(a,z)+"\n"));return d+this.tab+"}"};return b}(e),a.If=r=function(a){function b(a,b,c){this.body=b,c==null&&(c={}),this.condition=c.type==="unless"?a.invert():a,this.elseBody=null,this.isChain=!1,this.soak=c.soak}bl(b,a),b.prototype.children=["condition","body","elseBody"],b.prototype.bodyNode=function(){var a;return(a=this.body)!=null?a.unwrap():void 0},b.prototype.elseBodyNode=function(){var a;return(a=this.elseBody)!=null?a.unwrap():void 0},b.prototype.addElse=function(a){this.isChain?this.elseBodyNode().addElse(a):(this.isChain=a instanceof b,this.elseBody=this.ensureBlock(a));return this},b.prototype.isStatement=function(a){var b;return(a!=null?a.level:void 0)===z||this.bodyNode().isStatement(a)||((b=this.elseBodyNode())!=null?b.isStatement(a):void 0)},b.prototype.jumps=function(a){var b;return this.body.jumps(a)||((b=this.elseBody)!=null?b.jumps(a):void 0)},b.prototype.compileNode=function(a){return this.isStatement(a)?this.compileStatement(a):this.compileExpression(a)},b.prototype.makeReturn=function(a){a&&(this.elseBody||(this.elseBody=new f([new A("void 0")]))),this.body&&(this.body=new f([this.body.makeReturn(a)])),this.elseBody&&(this.elseBody=new f([this.elseBody.makeReturn(a)]));return this},b.prototype.ensureBlock=function(a){return a instanceof f?a:new f([a])},b.prototype.compileStatement=function(a){var c,d,e,f,g;d=$(a,"chainChild"),f=$(a,"isExistentialEquals");if(f)return(new b(this.condition.invert(),this.elseBodyNode(),{type:"if"})).compile(a);e=this.condition.compile(a,y),a.indent+=R,c=this.ensureBlock(this.body),g="if ("+e+") {\n"+c.compile(a)+"\n"+this.tab+"}",d||(g=this.tab+g);if(!this.elseBody)return g;return g+" else "+(this.isChain?(a.indent=this.tab,a.chainChild=!0,this.elseBody.unwrap().compile(a,z)):"{\n"+this.elseBody.compile(a,z)+"\n"+this.tab+"}")},b.prototype.compileExpression=function(a){var b,c,d,e;e=this.condition.compile(a,v),c=this.bodyNode().compile(a,w),b=this.elseBodyNode()?this.elseBodyNode().compile(a,w):"void 0",d=""+e+" ? "+c+" : "+b;return a.level>=v?"("+d+")":d},b.prototype.unfoldSoak=function(){return this.soak&&this};return b}(e),i={wrap:function(a,c,d){var e,h,i,k,l;if(a.jumps())return a;i=new j([],f.wrap([a])),e=[];if((k=a.contains(this.literalArgs))||a.contains(this.literalThis))l=new A(k?"apply":"call"),e=[new A("this")],k&&e.push(new A("arguments")),i=new W(i,[new b(l)]);i.noReturn=d,h=new g(i,e);return c?f.wrap([h]):h},literalArgs:function(a){return a instanceof A&&a.value==="arguments"&&!a.asKey},literalThis:function(a){return a instanceof A&&a.value==="this"&&!a.asKey||a instanceof j&&a.bound||a instanceof g&&a.isSuper}},bg=function(a,b,c){var d;if(!!(d=b[c].unfoldSoak(a))){b[c]=d.body,d.body=new W(b);return d}},V={"extends":function(){return"function(child, parent) { for (var key in parent) { if ("+bh("hasProp")+".call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }"},bind:function(){return"function(fn, me){ return function(){ return fn.apply(me, arguments); }; }"},indexOf:function(){return"[].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }"},hasProp:function(){return"{}.hasOwnProperty"},slice:function(){return"[].slice"}},z=1,y=2,w=3,v=4,x=5,u=6,R=" ",p="[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*",o=RegExp("^"+p+"$"),L=/^[+-]?\d+$/,B=RegExp("^(?:("+p+")\\.prototype(?:\\.("+p+")|\\[(\"(?:[^\\\\\"\\r\\n]|\\\\.)*\"|'(?:[^\\\\'\\r\\n]|\\\\.)*')\\]|\\[(0x[\\da-fA-F]+|\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\]))|("+p+")$"),q=/^['"]/,bh=function(a){var b;b="__"+a,N.root.assign(b,V[a]());return b},be=function(a,b){a=a.replace(/\n/g,"$&"+b);return a.replace(/\s+$/,"")}}).call(this)},require["./coffee-script"]=new function(){var a=this;(function(){var b,c,d,e,f,g,h,i,j,k=({}).hasOwnProperty;e=require("fs"),h=require("path"),j=require("./lexer"),b=j.Lexer,c=j.RESERVED,g=require("./parser").parser,i=require("vm"),require.extensions?require.extensions[".coffee"]=function(a,b){var c;c=d(e.readFileSync(b,"utf8"),{filename:b});return a._compile(c,b)}:require.registerExtension&&require.registerExtension(".coffee",function(a){return d(a)}),a.VERSION="1.3.3",a.RESERVED=c,a.helpers=require("./helpers"),a.compile=d=function(b,c){var d,e,h;c==null&&(c={}),h=a.helpers.merge;try{e=g.parse(f.tokenize(b)).compile(c);if(!c.header)return e}catch(i){c.filename&&(i.message="In "+c.filename+", "+i.message);throw i}d="Generated by CoffeeScript "+this.VERSION;return"// "+d+"\n"+e},a.tokens=function(a,b){return f.tokenize(a,b)},a.nodes=function(a,b){return typeof a=="string"?g.parse(f.tokenize(a,b)):g.parse(a)},a.run=function(a,b){var c;b==null&&(b={}),c=require.main,c.filename=process.argv[1]=b.filename?e.realpathSync(b.filename):".",c.moduleCache&&(c.moduleCache={}),c.paths=require("module")._nodeModulePaths(h.dirname(e.realpathSync(b.filename)));return h.extname(c.filename)!==".coffee"||require.extensions?c._compile(d(a,b),c.filename):c._compile(a,c.filename)},a.eval=function(a,b){var c,e,f,g,j,l,m,n,o,p,q,r,s,t;b==null&&(b={});if(!!(a=a.trim())){e=i.Script;if(e){if(b.sandbox!=null){if(b.sandbox instanceof e.createContext().constructor)m=b.sandbox;else{m=e.createContext(),r=b.sandbox;for(g in r){if(!k.call(r,g))continue;n=r[g],m[g]=n}}m.global=m.root=m.GLOBAL=m}else m=global;m.__filename=b.filename||"eval",m.__dirname=h.dirname(m.__filename);if(m===global&&!m.module&&!m.require){c=require("module"),m.module=q=new c(b.modulename||"eval"),m.require=t=function(a){return c._load(a,q,!0)},q.filename=m.__filename,s=Object.getOwnPropertyNames(require);for(o=0,p=s.length;o<p;o++)l=s[o],l!=="paths"&&(t[l]=require[l]);t.paths=q.paths=c._nodeModulePaths(process.cwd()),t.resolve=function(a){return c._resolveFilename(a,q)}}}j={};for(g in b){if(!k.call(b,g))continue;n=b[g],j[g]=n}j.bare=!0,f=d(a,j);return m===global?i.runInThisContext(f):i.runInContext(f,m)}},f=new b,g.lexer={lex:function(){var a,b;b=this.tokens[this.pos++]||[""],a=b[0],this.yytext=b[1],this.yylineno=b[2];return a},setInput:function(a){this.tokens=a;return this.pos=0},upcomingInput:function(){return""}},g.yy=require("./nodes")}).call(this)},require["./browser"]=new function(){var exports=this;(function(){var CoffeeScript,runScripts;CoffeeScript=require("./coffee-script"),CoffeeScript.require=require,CoffeeScript.eval=function(code,options){var _ref;options==null&&(options={}),(_ref=options.bare)==null&&(options.bare=!0);return eval(CoffeeScript.compile(code,options))},CoffeeScript.run=function(a,b){b==null&&(b={}),b.bare=!0;return Function(CoffeeScript.compile(a,b))()};typeof window!="undefined"&&window!==null&&(CoffeeScript.load=function(a,b){var c;c=new(window.ActiveXObject||XMLHttpRequest)("Microsoft.XMLHTTP"),c.open("GET",a,!0),"overrideMimeType"in c&&c.overrideMimeType("text/plain"),c.onreadystatechange=function(){var d;if(c.readyState===4){if((d=c.status)===0||d===200)CoffeeScript.run(c.responseText);else throw new Error("Could not load "+a);if(b)return b()}};return c.send(null)},runScripts=function(){var a,b,c,d,e,f;f=document.getElementsByTagName("script"),a=function(){var a,b,c;c=[];for(a=0,b=f.length;a<b;a++)e=f[a],e.type==="text/coffeescript"&&c.push(e);return c}(),c=0,d=a.length,(b=function(){var d;d=a[c++];if((d!=null?d.type:void 0)==="text/coffeescript"){if(d.src)return CoffeeScript.load(d.src,b);CoffeeScript.run(d.innerHTML);return b()}})();return null},window.addEventListener?addEventListener("DOMContentLoaded",runScripts,!1):attachEvent("onload",runScripts))}).call(this)};return require["./coffee-script"]}();typeof define=="function"&&define.amd?define(function(){return CoffeeScript}):root.CoffeeScript=CoffeeScript})(this)
libraries/less/dist/less-1.3.0.min.js → vendor/less.js RENAMED
File without changes