OoohBoi Steroids for Elementor - Version 1.7.3

Version Description

  • New feature added, LOCOMOTION - Locomotive Scroll for Elementor
  • New Options panel for the plugin
  • Include/exclude JS libraries (Locomotive Scroll, GSAP, ScrollTrigger) from the plugin Options
  • COMMENTZ - added option to hide the "Website" input field
  • Fixed JSON.parse JS error (deprecated functions replaced)
  • Fixed Scheme_Typography deprecated function warning for Butter Button and Commentz extensions
  • Extended support for the Optimized DOM Output Experiment (elementor-image and elementor-text-editor)
Download this release

Release Info

Developer ooohboi
Plugin Icon 128x128 OoohBoi Steroids for Elementor
Version 1.7.3
Comparing to
See all releases

Code changes from version 1.7.2 to 1.7.3

Files changed (38) hide show
  1. assets/css/admin.css +156 -264
  2. assets/css/editor.css +4 -2
  3. assets/css/main.css +137 -1
  4. assets/js/ooohboi-libs-locomotion.js +101 -0
  5. assets/js/ooohboi-steroids-min.js +1 -1
  6. assets/js/ooohboi-steroids.js +20 -5
  7. controls/ooohboi-breaking-bad.php +6 -5
  8. controls/ooohboi-butter-button.php +2 -2
  9. controls/ooohboi-commentz.php +29 -8
  10. controls/ooohboi-harakiri.php +5 -5
  11. controls/ooohboi-locomotion.php +112 -0
  12. controls/ooohboi-photogiraffe.php +2 -2
  13. controls/ooohboi-teleporter.php +1 -1
  14. inc/common-functions.php +273 -156
  15. inc/exopite-simple-options/assets/ace-loader.min.js +2 -0
  16. inc/exopite-simple-options/assets/chosen-sprite.png +0 -0
  17. inc/exopite-simple-options/assets/chosen-sprite@2x.png +0 -0
  18. inc/exopite-simple-options/assets/chosen.jquery.min.js +2 -0
  19. inc/exopite-simple-options/assets/chosen.min.css +11 -0
  20. inc/exopite-simple-options/assets/dev/ace-loader.js +76 -0
  21. inc/exopite-simple-options/assets/dev/chosen.jquery.js +1359 -0
  22. inc/exopite-simple-options/assets/dev/jquery.finderSelect.js +578 -0
  23. inc/exopite-simple-options/assets/dev/jquery.fine-uploader.js +7713 -0
  24. inc/exopite-simple-options/assets/dev/jquery.interdependencies.js +617 -0
  25. inc/exopite-simple-options/assets/dev/jquery.minicolors.css +432 -0
  26. inc/exopite-simple-options/assets/dev/jquery.minicolors.js +1127 -0
  27. inc/exopite-simple-options/assets/dev/loader-color-picker.js +95 -0
  28. inc/exopite-simple-options/assets/dev/loader-datepicker.js +80 -0
  29. inc/exopite-simple-options/assets/dev/loader-fine-uploader.js +104 -0
  30. inc/exopite-simple-options/assets/dev/loader-jquery-chosen.js +16 -0
  31. inc/exopite-simple-options/assets/dev/loader-jquery-finderselect.js +124 -0
  32. inc/exopite-simple-options/assets/dev/loader-jquery-trumbowyg.js +86 -0
  33. inc/exopite-simple-options/assets/dev/loader-minicolors.js +114 -0
  34. inc/exopite-simple-options/assets/dev/scripts.js +2106 -0
  35. inc/exopite-simple-options/assets/dev/styles.css +2970 -0
  36. inc/exopite-simple-options/assets/dev/sweetalert.min.js +1 -0
  37. inc/exopite-simple-options/assets/dev/wp-color-picker-alpha.js +496 -0
  38. inc/exopite-simple-options/assets/editors/ace/ace.js +1 -0
assets/css/admin.css CHANGED
@@ -1,451 +1,343 @@
1
  /* Steroids settings page */
2
 
3
- @import url('https://fonts.googleapis.com/css2?family=Sen:wght@400;700;800&display=swap');
4
 
5
- .ob-settings-page.wrap * {
6
- font-family: 'Sen', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
 
 
 
 
7
  }
8
 
9
- .steroids-for-elementor_page_settings .ob-settings-page.wrap h1:first-child {
10
- font-size: 40px;
11
- font-weight: 400;
12
- letter-spacing: -0.5px;
13
  }
14
 
15
- .steroids-for-elementor_page_settings .wrap.ob-settings-page {
16
- padding: 5%;
 
17
  }
18
 
19
- .steroids-for-elementor_page_settings .ob-settings-page form h2 {
20
- margin: 0;
21
  }
22
 
23
- .steroids-for-elementor_page_settings .ob-settings-page form h2 + p {
24
- font-size: 18px;
25
- line-height: 1.6;
26
- font-weight: 400;
 
27
  }
28
 
29
- .steroids-for-elementor_page_settings .ob-settings-page .form-table {
30
- padding: 32px;
31
  background-color: transparent;
32
  }
33
 
34
- .steroids-for-elementor_page_settings .ob-settings-page form p.submit {
35
- margin-top: 32px;
36
- margin-bottom: 0;
37
- padding-bottom: 0;
38
- text-align: right;
39
  }
40
 
41
- /* since 1.6.2 */
42
- .steroids-for-elementor_page_settings .ob-settings-page .form-table tbody {
43
- display: flex;
44
- flex-wrap: wrap;
45
- }
46
- .steroids-for-elementor_page_settings .ob-settings-page .form-table tbody tr {
47
- display: flex;
48
- width: 100%;
49
- min-height: 150px;
50
- height: auto;
51
- margin: 1%;
52
- background: #FFFFFF;
53
- box-shadow: 0px 0px 45px -35px rgba(0,0,0,0.5);
54
- border-radius: 0 0 16px 0;
55
- }
56
- .steroids-for-elementor_page_settings .ob-settings-page .form-table span.ob-option-desc {
57
- display: block;
58
- margin-top: 20px;
59
- }
60
- @media only screen and (min-width: 1600px) {
61
- .steroids-for-elementor_page_settings .ob-settings-page .form-table tbody tr {
62
- width: 47% !important;
63
- }
64
- }
65
- @media only screen and (min-width: 1140px) and (max-width: 1599px) {
66
- .steroids-for-elementor_page_settings .ob-settings-page .form-table tbody tr {
67
- width: 47% !important;
68
- }
69
  }
70
- @media only screen and (max-width: 1139px) {
71
- .steroids-for-elementor_page_settings .ob-settings-page .form-table th {
72
- padding: 20px 20px 0 20px !important;
73
- }
74
- .steroids-for-elementor_page_settings .ob-settings-page .form-table td {
75
- padding: 20px !important;
76
- }
77
- .steroids-for-elementor_page_settings .ob-settings-page .form-table tbody tr {
78
- width: 100%;
79
- min-height: 100px;
80
- }
81
  }
82
- /* ----------- */
83
 
84
- .steroids-for-elementor_page_settings .ob-settings-page .form-table th,
85
- .steroids-for-elementor_page_settings .ob-settings-page .form-table td {
86
- position: relative;
87
- padding: 20px;
88
- margin-bottom: 0;
89
  }
90
 
91
- .steroids-for-elementor_page_settings .ob-settings-page .form-table th {
92
- padding-right: 0;
93
- width: 150px;
94
- }
95
- .steroids-for-elementor_page_settings .ob-settings-page .form-table td {
96
- flex: 1;
97
  }
98
 
99
- .steroids-for-elementor_page_settings .ob-settings-page .form-table th:before {
100
- content: '';
101
- position: absolute;
102
- top: 0;
103
- left: 0;
104
- width: 16px;
105
- height: 16px;
106
- background-image: url( '../img/ooohboi-poopart-icon.png' );
107
- background-size: cover;
108
- background-position: top left;
109
- background-repeat: no-repeat;
110
  }
111
 
112
- .steroids-for-elementor_page_settings .ob-settings-page .form-table th label {
113
- font-size: 13px !important;
114
- font-weight: 600;
 
115
  }
116
 
117
- .steroids-for-elementor_page_settings .ob-settings-page .form-table td label {
118
- font-size: 13px !important;
 
 
119
  }
120
 
121
- @supports (-webkit-appearance: none) or (-moz-appearance: none) {
122
- .steroids-for-elementor_page_settings .wrap.ob-settings-page input[type='checkbox'],
123
- .steroids-for-elementor_page_settings .wrap.ob-settings-page input[type='radio'] {
124
- --active: #275EFE;
125
- --active-inner: #fff;
126
- --focus: 2px rgba(39, 94, 254, .3);
127
- --border: #BBC1E1;
128
- --border-hover: #275EFE;
129
- --background: #fff;
130
- --disabled: #F6F8FF;
131
- --disabled-inner: #E1E6F9;
132
- -webkit-appearance: none;
133
- -moz-appearance: none;
134
- height: 21px;
135
- outline: none;
136
- display: inline-block;
137
- vertical-align: top;
138
- position: relative;
139
- margin: 0;
140
- cursor: pointer;
141
- border: 1px solid var(--bc, var(--border));
142
- background: var(--b, var(--background));
143
- -webkit-transition: background .3s, border-color .3s, box-shadow .2s;
144
- transition: background .3s, border-color .3s, box-shadow .2s;
145
- }
146
- .steroids-for-elementor_page_settings .wrap.ob-settings-page input[type='checkbox']:after {
147
- content: '';
148
- display: block;
149
- left: 0;
150
- top: 0;
151
- position: absolute;
152
- -webkit-transition: opacity var(--d-o, 0.2s), -webkit-transform var(--d-t, 0.3s) var(--d-t-e, ease);
153
- transition: opacity var(--d-o, 0.2s), -webkit-transform var(--d-t, 0.3s) var(--d-t-e, ease);
154
- transition: transform var(--d-t, 0.3s) var(--d-t-e, ease), opacity var(--d-o, 0.2s);
155
- transition: transform var(--d-t, 0.3s) var(--d-t-e, ease), opacity var(--d-o, 0.2s), -webkit-transform var(--d-t, 0.3s) var(--d-t-e, ease);
156
- }
157
- .steroids-for-elementor_page_settings .wrap.ob-settings-page input[type='checkbox']:checked {
158
- --b: var(--active);
159
- --bc: var(--active);
160
- --d-o: .3s;
161
- --d-t: .6s;
162
- --d-t-e: cubic-bezier(.2, .85, .32, 1.2);
163
- }
164
- .steroids-for-elementor_page_settings .wrap.ob-settings-page input[type='checkbox']:disabled {
165
- --b: var(--disabled);
166
- cursor: not-allowed;
167
- opacity: .9;
168
- }
169
- .steroids-for-elementor_page_settings .wrap.ob-settings-page input[type='checkbox']:disabled:checked {
170
- --b: var(--disabled-inner);
171
- --bc: var(--border);
172
- }
173
- .steroids-for-elementor_page_settings .wrap.ob-settings-page input[type='checkbox']:disabled + label {
174
- cursor: not-allowed;
175
- }
176
- .steroids-for-elementor_page_settings .wrap.ob-settings-page input[type='checkbox']:hover:not(:checked):not(:disabled) {
177
- --bc: var(--border-hover);
178
- }
179
- .steroids-for-elementor_page_settings .wrap.ob-settings-page input[type='checkbox']:focus {
180
- box-shadow: 0 0 0 var(--focus);
181
- }
182
- .steroids-for-elementor_page_settings .wrap.ob-settings-page input[type='checkbox'] + label {
183
- font-size: 14px;
184
- line-height: 21px;
185
- display: inline-block;
186
- vertical-align: top;
187
- cursor: pointer;
188
- margin-left: 4px;
189
- }
190
- .steroids-for-elementor_page_settings .wrap.ob-settings-page input[type='checkbox'] {
191
- width: 38px;
192
- border-radius: 11px;
193
- }
194
- .steroids-for-elementor_page_settings .wrap.ob-settings-page input[type='checkbox']:after {
195
- left: 2px;
196
- top: 2px;
197
- border-radius: 50%;
198
- width: 15px;
199
- height: 15px;
200
- background: var(--ab, var(--border));
201
- -webkit-transform: translateX(var(--x, 0));
202
- transform: translateX(var(--x, 0));
203
- }
204
- .steroids-for-elementor_page_settings .wrap.ob-settings-page input[type='checkbox']:checked {
205
- --ab: var(--active-inner);
206
- --x: 17px;
207
- }
208
- .steroids-for-elementor_page_settings .wrap.ob-settings-page input[type='checkbox']:disabled:not(:checked):after {
209
- opacity: .6;
210
- }
211
-
212
- /* checkbox tick fix */
213
- .steroids-for-elementor_page_settings .wrap.ob-settings-page input[type="checkbox"]:checked::before {
214
- content: '';
215
- }
216
  }
217
 
218
- /* 1.7.0 */
219
- a.toplevel_page_steroids_for_elementor .wp-menu-image img {
220
- max-width: 16px;
221
- filter: grayscale(100%) invert(100%);
222
- }
223
- a.toplevel_page_steroids_for_elementor.wp-not-current-submenu .wp-menu-image img {
224
- filter: none;
225
  }
226
 
227
- .wrap.ob-settings-page {
228
- width: 1140px;
229
- max-width: 92%;
230
- background-color: #FFF;
231
- padding: 0;
232
- overflow: hidden;
233
- border-radius: 12px;
234
  }
235
- .wrap.ob-settings-page .sfe-header {
236
- padding: 28px 28px 0;
 
237
  }
238
- .wrap.ob-settings-page .sfe-content {
239
- padding: 5%;
 
 
240
  }
241
- .toplevel_page_steroids_for_elementor .wrap.ob-settings-page > .updated {
242
- display: none;
 
 
 
243
  }
244
 
245
- .wrap.ob-settings-page > h1, .wrap.ob-settings-page > form > h2:first-child {
246
- display: none;
 
247
  }
248
- .wrap.ob-settings-page > form {
 
 
 
249
  padding: 0;
250
  }
251
- .wrap.ob-settings-page > form h2 {
252
  font-size: 40px;
253
  letter-spacing: -1px;
254
  font-weight: 600;
255
  margin-bottom: 24px;
256
  }
257
- .wrap.ob-settings-page > form h3 {
258
  font-size: 24px;
259
  letter-spacing: -0.5px;
260
  font-weight: 600;
261
  }
262
- .wrap.ob-settings-page p,
263
- .wrap.ob-settings-page ul {
264
  font-size: 16px;
265
  line-height: 1.6;
266
  margin: 0 0 1.5em;
267
  font-weight: 400;
268
  color: #3c3c3c;
269
  }
270
- .wrap.ob-settings-page .small-text {
271
  position: relative;
272
  font-size: 12px;
273
  line-height: 1.4;
274
  }
275
- .wrap.ob-settings-page ul {
276
  list-style-type: square;
277
  list-style-position: outside;
278
  margin: 1.5em 0;
279
  padding: 0 0 0 20px;
280
  }
281
- .wrap.ob-settings-page ul li {
282
- color: #444;
283
- }
284
- .wrap.ob-settings-page img {
285
- width: 100%;
286
  height: auto;
287
  }
288
- .wrap.ob-settings-page img[alt="RemPro.nl"] {
289
  max-width: 200px;
290
  }
291
- .wrap.ob-settings-page img.pp {
292
  width: 50%;
293
  }
294
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
  /* ==== GRID SYSTEM ==== */
296
 
297
- .wrap.ob-settings-page .container {
298
  width: 100%;
299
  margin-left: auto;
300
  margin-right: auto;
301
  }
302
 
303
- .wrap.ob-settings-page .row {
304
  position: relative;
305
  width: 100%;
306
  }
307
 
308
- .wrap.ob-settings-page .row [class^="col"] {
309
  float: left;
310
  margin: 0.5rem 2%;
311
  min-height: 0.125rem;
312
  }
313
 
314
- .wrap.ob-settings-page .col-1,
315
- .wrap.ob-settings-page .col-2,
316
- .wrap.ob-settings-page .col-3,
317
- .wrap.ob-settings-page .col-4,
318
- .wrap.ob-settings-page .col-5,
319
- .wrap.ob-settings-page .col-6,
320
- .wrap.ob-settings-page .col-7,
321
- .wrap.ob-settings-page .col-8,
322
- .wrap.ob-settings-page .col-9,
323
- .wrap.ob-settings-page .col-10,
324
- .wrap.ob-settings-page .col-11,
325
- .wrap.ob-settings-page .col-12 {
326
  width: 96%;
327
  }
328
 
329
- .wrap.ob-settings-page .col-1-sm {
330
  width: 4.33%;
331
  }
332
 
333
- .wrap.ob-settings-page .col-2-sm {
334
  width: 12.66%;
335
  }
336
 
337
- .wrap.ob-settings-page .col-3-sm {
338
  width: 21%;
339
  }
340
 
341
- .wrap.ob-settings-page .col-4-sm {
342
  width: 29.33%;
343
  }
344
 
345
- .wrap.ob-settings-page .col-5-sm {
346
  width: 37.66%;
347
  }
348
 
349
- .wrap.ob-settings-page .col-6-sm {
350
  width: 46%;
351
  }
352
 
353
- .wrap.ob-settings-page .col-7-sm {
354
  width: 54.33%;
355
  }
356
 
357
- .wrap.ob-settings-page .col-8-sm {
358
  width: 62.66%;
359
  }
360
 
361
- .wrap.ob-settings-page .col-9-sm {
362
  width: 71%;
363
  }
364
 
365
- .wrap.ob-settings-page .col-10-sm {
366
  width: 79.33%;
367
  }
368
 
369
- .wrap.ob-settings-page .col-11-sm {
370
  width: 87.66%;
371
  }
372
 
373
- .wrap.ob-settings-page .col-12-sm {
374
  width: 96%;
375
  }
376
 
377
- .wrap.ob-settings-page .row::after {
378
  content: "";
379
  display: table;
380
  clear: both;
381
  }
382
 
383
- .wrap.ob-settings-page .hidden-sm {
384
  display: none;
385
  }
386
 
387
  @media only screen and (min-width: 33.75em) { /* 540px */
388
- .wrap.ob-settings-page .container {
389
  width: 100%;
390
  }
391
  }
392
 
393
  @media only screen and (min-width: 45em) { /* 720px */
394
- .wrap.ob-settings-page .col-1 {
395
  width: 4.33%;
396
  }
397
 
398
- .wrap.ob-settings-page .col-2 {
399
  width: 12.66%;
400
  }
401
 
402
- .wrap.ob-settings-page .col-3 {
403
  width: 21%;
404
  }
405
 
406
- .wrap.ob-settings-page .col-4 {
407
  width: 29.33%;
408
  }
409
 
410
- .wrap.ob-settings-page .col-5 {
411
  width: 37.66%;
412
  }
413
 
414
- .wrap.ob-settings-page .col-6 {
415
  width: 46%;
416
  }
417
 
418
- .wrap.ob-settings-page .col-7 {
419
  width: 54.33%;
420
  }
421
 
422
- .wrap.ob-settings-page .col-8 {
423
  width: 62.66%;
424
  }
425
 
426
- .wrap.ob-settings-page .col-9 {
427
  width: 71%;
428
  }
429
 
430
- .wrap.ob-settings-page .col-10 {
431
  width: 79.33%;
432
  }
433
 
434
- .wrap.ob-settings-page .col-11 {
435
  width: 87.66%;
436
  }
437
 
438
- .wrap.ob-settings-page .col-12 {
439
  width: 96%;
440
  }
441
 
442
- .wrap.ob-settings-page .hidden-sm {
443
  display: block;
444
  }
445
  }
446
 
447
  @media only screen and (min-width: 60em) { /* 960px */
448
- .wrap.ob-settings-page .container {
449
  width: 100%;
450
  }
451
  }
1
  /* Steroids settings page */
2
 
3
+ /* 1.7.0 */
4
 
5
+ a.toplevel_page_steroids_for_elementor .wp-menu-image img {
6
+ max-width: 16px;
7
+ filter: grayscale(100%) invert(100%);
8
+ }
9
+ a.toplevel_page_steroids_for_elementor.wp-not-current-submenu .wp-menu-image img {
10
+ filter: none;
11
  }
12
 
13
+ @import url('https://fonts.googleapis.com/css2?family=Sen:wght@400;700;800&display=swap');
14
+
15
+ .exopite-sof-wrapper.steroids_for_elementor-options * {
16
+ font-family: 'Sen', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
17
  }
18
 
19
+ .exopite-sof-wrapper.steroids_for_elementor-options img {
20
+ max-width: 100%;
21
+ height: auto;
22
  }
23
 
24
+ .exopite-sof-wrapper.steroids_for_elementor-options .sfe-intro p {
25
+ font-size: 20px;
26
  }
27
 
28
+ .exopite-sof-wrapper.steroids_for_elementor-options .exopite-sof-content-nav .exopite-sof-sections {
29
+ background-image: url( '../../inc/img/sfe-bg-pattern.png' );
30
+ background-position: top left;
31
+ background-size: 100%;
32
+ background-repeat: repeat-y;
33
  }
34
 
35
+ .exopite-sof-wrapper.steroids_for_elementor-options .exopite-sof-content .list__item {
 
36
  background-color: transparent;
37
  }
38
 
39
+ .exopite-sof-wrapper.steroids_for_elementor-options .exopite-sof-section > .exopite-sof-field {
40
+ padding: 32px;
41
+ margin-top: 24px;
 
 
42
  }
43
 
44
+ .exopite-sof-wrapper.steroids_for_elementor-options .exopite-sof-field .exopite-sof-title {
45
+ font-size: 16px;
46
+ position: relative;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  }
48
+ .exopite-sof-wrapper.steroids_for_elementor-options .exopite-sof-field .exopite-sof-title:after {
49
+ content: '';
50
+ position: absolute;
51
+ width: 20px;
52
+ height: 20px;
53
+ top: -1px;
54
+ left: -5px;
55
+ background-color: #ff0249;
56
+ opacity: 0.1;
57
+ border-radius: 0 0 20px 0;
 
58
  }
 
59
 
60
+ .exopite-sof-wrapper.steroids_for_elementor-options .exopite-sof-field .exopite-sof-description {
61
+ font-size: 14px;
62
+ font-weight: 400;
63
+ color: #444;
64
+ margin-top: 8px;
65
  }
66
 
67
+ .exopite-sof-wrapper.steroids_for_elementor-options .checkbox__switch {
68
+ width: 3.6em;
69
+ background-color: #ED2B5C;
70
+ border-radius: 50px;
71
+ height: 1.6em;
 
72
  }
73
 
74
+ .exopite-sof-wrapper.steroids_for_elementor-options .checkbox__input:checked + .checkbox__switch {
75
+ border-color: #454264;
76
+ background-color: #454264;
77
+ border-radius: 50px;
 
 
 
 
 
 
 
78
  }
79
 
80
+ .exopite-sof-wrapper.steroids_for_elementor-options .checkbox__switch::after {
81
+ border-radius: 50px;
82
+ height: 1.6em;
83
+ width: 1.6em;
84
  }
85
 
86
+ .exopite-sof-wrapper.steroids_for_elementor-options .checkbox__input:checked + .checkbox__switch::after {
87
+ left: 2em;
88
+ height: 1.6em;
89
+ width: 1.6em;
90
  }
91
 
92
+ .exopite-sof-wrapper.steroids_for_elementor-options .checkbox__input:checked + .checkbox__checkmark::before {
93
+ background: transparent;
94
+ border: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  }
96
 
97
+ .exopite-sof-wrapper.steroids_for_elementor-options .exopite-sof-content .list {
98
+ border: none;
99
+ font-size: 13px;
100
+ text-transform: uppercase;
101
+ font-weight: 600;
 
 
102
  }
103
 
104
+ .exopite-sof-wrapper.steroids_for_elementor-options .exopite-sof-content .list__item:active {
105
+ background: none;
 
 
 
 
 
106
  }
107
+
108
+ .exopite-sof-wrapper.steroids_for_elementor-options .exopite-sof-content .list__item__left {
109
+ padding-right: 8px;
110
  }
111
+
112
+ .exopite-sof-wrapper.steroids_for_elementor-options .list__item__center {
113
+ background-size: 0;
114
+ background: none;
115
  }
116
+
117
+ .exopite-sof-wrapper.steroids_for_elementor-options .checkbox__checkmark::before {
118
+ background-color: rgba( 0, 0, 0, 0.05 );
119
+ border-radius: 50px;
120
+ border: none;
121
  }
122
 
123
+ .exopite-sof-wrapper.steroids_for_elementor-options .checkbox--noborder__checkmark::after,
124
+ .exopite-sof-wrapper.steroids_for_elementor-options .checkbox__checkmark::after {
125
+ border-color: #ED2B5C;
126
  }
127
+
128
+ /* ------------ EXOPITE */
129
+
130
+ .exopite-sof-wrapper.steroids_for_elementor-options > form {
131
  padding: 0;
132
  }
133
+ .exopite-sof-wrapper.steroids_for_elementor-options > form h2 {
134
  font-size: 40px;
135
  letter-spacing: -1px;
136
  font-weight: 600;
137
  margin-bottom: 24px;
138
  }
139
+ .exopite-sof-wrapper.steroids_for_elementor-options > form h3 {
140
  font-size: 24px;
141
  letter-spacing: -0.5px;
142
  font-weight: 600;
143
  }
144
+ .exopite-sof-wrapper.steroids_for_elementor-options p,
145
+ .exopite-sof-wrapper.steroids_for_elementor-options ul:not(.exopite-sof-nav-list):not(.list) {
146
  font-size: 16px;
147
  line-height: 1.6;
148
  margin: 0 0 1.5em;
149
  font-weight: 400;
150
  color: #3c3c3c;
151
  }
152
+ .exopite-sof-wrapper.steroids_for_elementor-options .small-text {
153
  position: relative;
154
  font-size: 12px;
155
  line-height: 1.4;
156
  }
157
+ .exopite-sof-wrapper.steroids_for_elementor-options ul:not(.exopite-sof-nav-list):not(.list) {
158
  list-style-type: square;
159
  list-style-position: outside;
160
  margin: 1.5em 0;
161
  padding: 0 0 0 20px;
162
  }
163
+ .exopite-sof-wrapper.steroids_for_elementor-options img {
164
+ max-width: 100%;
 
 
 
165
  height: auto;
166
  }
167
+ .exopite-sof-wrapper.steroids_for_elementor-options img[alt="RemPro.nl"] {
168
  max-width: 200px;
169
  }
170
+ .exopite-sof-wrapper.steroids_for_elementor-options img.pp {
171
  width: 50%;
172
  }
173
 
174
+ .exopite-sof-wrapper.steroids_for_elementor-options .exopite-sof-header {
175
+ background: none;
176
+ background-color: #23282d;
177
+ box-shadow: none;
178
+ padding: 32px 20px;
179
+ }
180
+
181
+ .exopite-sof-wrapper.steroids_for_elementor-options .exopite-sof-header h1 {
182
+ font-size: 2.4em;
183
+ font-weight: 600;
184
+ letter-spacing: -1px;
185
+ }
186
+
187
  /* ==== GRID SYSTEM ==== */
188
 
189
+ .exopite-sof-wrapper.steroids_for_elementor-options .container {
190
  width: 100%;
191
  margin-left: auto;
192
  margin-right: auto;
193
  }
194
 
195
+ .exopite-sof-wrapper.steroids_for_elementor-options .row {
196
  position: relative;
197
  width: 100%;
198
  }
199
 
200
+ .exopite-sof-wrapper.steroids_for_elementor-options .row [class^="col"] {
201
  float: left;
202
  margin: 0.5rem 2%;
203
  min-height: 0.125rem;
204
  }
205
 
206
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-1,
207
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-2,
208
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-3,
209
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-4,
210
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-5,
211
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-6,
212
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-7,
213
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-8,
214
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-9,
215
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-10,
216
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-11,
217
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-12 {
218
  width: 96%;
219
  }
220
 
221
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-1-sm {
222
  width: 4.33%;
223
  }
224
 
225
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-2-sm {
226
  width: 12.66%;
227
  }
228
 
229
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-3-sm {
230
  width: 21%;
231
  }
232
 
233
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-4-sm {
234
  width: 29.33%;
235
  }
236
 
237
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-5-sm {
238
  width: 37.66%;
239
  }
240
 
241
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-6-sm {
242
  width: 46%;
243
  }
244
 
245
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-7-sm {
246
  width: 54.33%;
247
  }
248
 
249
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-8-sm {
250
  width: 62.66%;
251
  }
252
 
253
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-9-sm {
254
  width: 71%;
255
  }
256
 
257
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-10-sm {
258
  width: 79.33%;
259
  }
260
 
261
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-11-sm {
262
  width: 87.66%;
263
  }
264
 
265
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-12-sm {
266
  width: 96%;
267
  }
268
 
269
+ .exopite-sof-wrapper.steroids_for_elementor-options .row::after {
270
  content: "";
271
  display: table;
272
  clear: both;
273
  }
274
 
275
+ .exopite-sof-wrapper.steroids_for_elementor-options .hidden-sm {
276
  display: none;
277
  }
278
 
279
  @media only screen and (min-width: 33.75em) { /* 540px */
280
+ .exopite-sof-wrapper.steroids_for_elementor-options .container {
281
  width: 100%;
282
  }
283
  }
284
 
285
  @media only screen and (min-width: 45em) { /* 720px */
286
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-1 {
287
  width: 4.33%;
288
  }
289
 
290
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-2 {
291
  width: 12.66%;
292
  }
293
 
294
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-3 {
295
  width: 21%;
296
  }
297
 
298
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-4 {
299
  width: 29.33%;
300
  }
301
 
302
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-5 {
303
  width: 37.66%;
304
  }
305
 
306
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-6 {
307
  width: 46%;
308
  }
309
 
310
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-7 {
311
  width: 54.33%;
312
  }
313
 
314
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-8 {
315
  width: 62.66%;
316
  }
317
 
318
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-9 {
319
  width: 71%;
320
  }
321
 
322
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-10 {
323
  width: 79.33%;
324
  }
325
 
326
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-11 {
327
  width: 87.66%;
328
  }
329
 
330
+ .exopite-sof-wrapper.steroids_for_elementor-options .col-12 {
331
  width: 96%;
332
  }
333
 
334
+ .exopite-sof-wrapper.steroids_for_elementor-options .hidden-sm {
335
  display: block;
336
  }
337
  }
338
 
339
  @media only screen and (min-width: 60em) { /* 960px */
340
+ .exopite-sof-wrapper.steroids_for_elementor-options .container {
341
  width: 100%;
342
  }
343
  }
assets/css/editor.css CHANGED
@@ -25,7 +25,8 @@
25
  .elementor-control-_ob_hoveranimator_panel:after,
26
  .elementor-control-_ob_kontrolz:after,
27
  .elementor-control-_ob_widget_stalker:after,
28
- .elementor-control-_ob_pseudo_section_title:after {
 
29
  content: "";
30
  position: absolute;
31
  height: 20px;
@@ -84,7 +85,8 @@
84
  .rtl .elementor-control-_ob_hoveranimator_panel:after,
85
  .rtl .elementor-control-_ob_kontrolz:after,
86
  .rtl .elementor-control-_ob_widget_stalker:after,
87
- .rtl .elementor-control-_ob_pseudo_section_title:after {
 
88
  left: 20px;
89
  right: unset;
90
  }
25
  .elementor-control-_ob_hoveranimator_panel:after,
26
  .elementor-control-_ob_kontrolz:after,
27
  .elementor-control-_ob_widget_stalker:after,
28
+ .elementor-control-_ob_pseudo_section_title:after,
29
+ .elementor-control-_ob_loco_title_section:after {
30
  content: "";
31
  position: absolute;
32
  height: 20px;
85
  .rtl .elementor-control-_ob_hoveranimator_panel:after,
86
  .rtl .elementor-control-_ob_kontrolz:after,
87
  .rtl .elementor-control-_ob_widget_stalker:after,
88
+ .rtl .elementor-control-_ob_pseudo_section_title:after,
89
+ .rtl .elementor-control-_ob_loco_title_section:after {
90
  left: 20px;
91
  right: unset;
92
  }
assets/css/main.css CHANGED
@@ -301,4 +301,140 @@ html.elementor-html::before {
301
  content: '';
302
  position: absolute;
303
  pointer-events: none;
304
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
301
  content: '';
302
  position: absolute;
303
  pointer-events: none;
304
+ }
305
+ /* loco scrollbar */
306
+
307
+ /* animations related to locomotive scroll */
308
+ body:not(.elementor-editor-active) .c-scrollbar {
309
+ z-index: 99999;
310
+ }
311
+ /* FADe LEFT --------------- */
312
+ body:not(.elementor-editor-active) .fade-left .elementor-container,
313
+ body:not(.elementor-editor-active) .fade-left .elementor-background-overlay,
314
+ body:not(.elementor-editor-active) .fade-left .elementor-widget-container {
315
+ opacity: 0;
316
+ transition: all 1s cubic-bezier(.215, .61, .355, 1);
317
+ transform: translateX(-30%);
318
+ transition-delay: 0.35s;
319
+ }
320
+ body:not(.elementor-editor-active) .fade-left.is-inview .elementor-container,
321
+ body:not(.elementor-editor-active) .fade-left.is-inview .elementor-background-overlay,
322
+ body:not(.elementor-editor-active) .fade-left.is-inview .elementor-widget-container {
323
+ opacity: 1;
324
+ transform: translateX(0px);
325
+ }
326
+ /* -------------------------- */
327
+ /* FADE RigHT --------------- */
328
+ body:not(.elementor-editor-active) .fade-right .elementor-container,
329
+ body:not(.elementor-editor-active) .fade-right .elementor-background-overlay,
330
+ body:not(.elementor-editor-active) .fade-right .elementor-widget-container {
331
+ opacity: 0;
332
+ transition: all 1s cubic-bezier(.215, .61, .355, 1);
333
+ transform: translateX(30%);
334
+ transition-delay: 0.35s;
335
+ }
336
+ body:not(.elementor-editor-active) .fade-right.is-inview .elementor-container,
337
+ body:not(.elementor-editor-active) .fade-right.is-inview .elementor-background-overlay,
338
+ body:not(.elementor-editor-active) .fade-right.is-inview .elementor-widget-container {
339
+ opacity: 1;
340
+ transform: translateX(0px);
341
+ }
342
+ /* -------------------------- */
343
+ /* FADE UP --------------- */
344
+ body:not(.elementor-editor-active) .fade-up .elementor-container,
345
+ body:not(.elementor-editor-active) .fade-up .elementor-background-overlay,
346
+ body:not(.elementor-editor-active) .fade-up .elementor-widget-container {
347
+ opacity: 0;
348
+ transition: all 1s cubic-bezier(.215, .61, .355, 1);
349
+ transform: translateY(10%);
350
+ transition-delay: 0.35s;
351
+ }
352
+ body:not(.elementor-editor-active) .fade-up.is-inview .elementor-container,
353
+ body:not(.elementor-editor-active) .fade-up.is-inview .elementor-background-overlay,
354
+ body:not(.elementor-editor-active) .fade-up.is-inview .elementor-widget-container {
355
+ opacity: 1;
356
+ transform: translateY(0px);
357
+ }
358
+ /* -------------------------- */
359
+ /* FADE DOWN --------------- */
360
+ body:not(.elementor-editor-active) .fade-down .elementor-container,
361
+ body:not(.elementor-editor-active) .fade-down .elementor-background-overlay,
362
+ body:not(.elementor-editor-active) .fade-down .elementor-widget-container {
363
+ opacity: 0;
364
+ transition: all 1s cubic-bezier(.215, .61, .355, 1);
365
+ transform: translateY(-10%);
366
+ transition-delay: 0.35s;
367
+ }
368
+ body:not(.elementor-editor-active) .fade-down.is-inview .elementor-container,
369
+ body:not(.elementor-editor-active) .fade-down.is-inview .elementor-background-overlay,
370
+ body:not(.elementor-editor-active) .fade-down.is-inview .elementor-widget-container {
371
+ opacity: 1;
372
+ transform: translateY(0px);
373
+ }
374
+ /* -------------------------- */
375
+ /* FADE --------------- */
376
+ body:not(.elementor-editor-active) .fade .elementor-container,
377
+ body:not(.elementor-editor-active) .fade .elementor-background-overlay,
378
+ body:not(.elementor-editor-active) .fade .elementor-widget-container {
379
+ opacity: 0;
380
+ transition: all 1s cubic-bezier(.215, .61, .355, 1);
381
+ transition-delay: 0.35s;
382
+ }
383
+ body:not(.elementor-editor-active) .fade.is-inview .elementor-container,
384
+ body:not(.elementor-editor-active) .fade.is-inview .elementor-background-overlay,
385
+ body:not(.elementor-editor-active) .fade.is-inview .elementor-widget-container {
386
+ opacity: 1;
387
+ }
388
+ /* -------------------------- */
389
+ /* REVeAL TOP --------------- OFFICIALLY UNSUPPORTED !!! */
390
+ body:not(.elementor-editor-active) .reveal-top .elementor-widget-container {
391
+ height: 0;
392
+ overflow: hidden;
393
+ transition: all 1.52s cubic-bezier(.215, .61, .355, 1);
394
+ transition-delay: 0.35s;
395
+ }
396
+ body:not(.elementor-editor-active) .reveal-top.is-inview .elementor-widget-container {
397
+ height: 100%;
398
+ }
399
+ body:not(.elementor-editor-active) .reveal-top .elementor-widget-container img {
400
+ height: 40vh;
401
+ display: block;
402
+ margin: 0 auto;
403
+ object-fit: cover;
404
+ }
405
+ /* -------------------------- */
406
+ /* REVeAL LEFT --------------- */
407
+ body:not(.elementor-editor-active) .reveal-left .elementor-widget-container {
408
+ width: 0;
409
+ height: 100%;
410
+ transition: all 1.52s cubic-bezier(.215, .61, .355, 1);
411
+ transition-delay: 0.35s;
412
+ }
413
+ body:not(.elementor-editor-active) .reveal-left.is-inview .elementor-widget-container {
414
+ width: 100%;
415
+ }
416
+ body:not(.elementor-editor-active) .reveal-left .elementor-widget-container img {
417
+ height: 40vh;
418
+ display: block;
419
+ margin: 0 auto;
420
+ object-fit: cover;
421
+ }
422
+ /* -------------------------- */
423
+ /* ZOOM IN --------------- */
424
+ body:not(.elementor-editor-active) .zoom-in .elementor-widget-container {
425
+ opacity: 0;
426
+ transform: scale(1.2);
427
+ transition: all 1s cubic-bezier(.215, .61, .355, 1);
428
+ transition-delay: 0.35s;
429
+ }
430
+ body:not(.elementor-editor-active) .zoom-in.is-inview .elementor-widget-container {
431
+ opacity: 1;
432
+ transform: scale(1)
433
+ }
434
+ body:not(.elementor-editor-active) .zoom-in .elementor-widget-container img {
435
+ height: 40vh;
436
+ display: block;
437
+ margin: 0 auto;
438
+ object-fit: cover;
439
+ }
440
+ /* -------------------------- */
assets/js/ooohboi-libs-locomotion.js ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict';
2
+
3
+ ( function ( $, w, sfe_loco_scroll ) {
4
+
5
+ var $window = $( w );
6
+ var loco_multiplier = device_settings.scroll_multiplier; // validated via PHP
7
+ var loco_scroll_tablet = parseInt( device_settings.allow_tablet );
8
+ var loco_scroll_mobile = parseInt( device_settings.allow_mobile );
9
+ var loco_allow_refresh = parseInt( device_settings.allow_refresh );
10
+
11
+ $window.on( 'elementor/frontend/init', function() {
12
+ // reference to THIS / Elementor
13
+ var myself = this;
14
+ // default Elementor - there's no any kind of wrapper at all
15
+ var target_node = this.elementorFrontend.elements.$body[ 0 ];
16
+ // locomotive scroll wrapper
17
+ var loco_wrapper = target_node.firstElementChild;
18
+ // qualify BODY children to become scroll sections
19
+ var body_children = target_node.childNodes;
20
+ // take care about header, footer and blocks plugin
21
+ var is_header_footer_and_blocks = 0;
22
+ // traverse to figure out the wrapper
23
+ for( var i = 0; i < body_children.length; i ++ ) {
24
+ if( $( body_children[ i ] ).is( 'div#page' ) ) {
25
+ $( body_children[ i ] ).addClass( 'sfe-locomotive-scroll-wrapper' ).attr( 'data-scroll-container', '' );
26
+ is_header_footer_and_blocks = 1;
27
+ target_node = body_children[ i ]; // it's not default Elementor anymore
28
+ loco_wrapper = target_node.firstElementChild;
29
+ break;
30
+ }
31
+ }
32
+ // add required attributes
33
+ for( var i = 0; i < target_node.childNodes.length; i ++ ) {
34
+ if( ( $( target_node.childNodes[ i ] ).is( 'div' ) && $( target_node.childNodes[ i ] ).attr( 'data-elementor-type' ) )
35
+ || $( target_node.childNodes[ i ] ).is( 'header' )
36
+ || $( target_node.childNodes[ i ] ).is( 'main' )
37
+ || $( target_node.childNodes[ i ] ).is( 'footer' ) ) {
38
+ $( target_node.childNodes[ i ] ).attr( 'data-scroll-section', '' );
39
+ }
40
+ }
41
+ // wrap everything inside BODY if default Elementor
42
+ if( ! is_header_footer_and_blocks ) {
43
+ $( this.elementorFrontend.elements.$body[ 0 ] ).wrapInner( '<div class="sfe-locomotive-scroll-wrapper" data-scroll-container=""></div>' );
44
+ }
45
+ // init locomotive scroll
46
+ elementorFrontend.on( 'components:init', function() {
47
+ var class_list = myself.elementorFrontend.elements.$body[ 0 ].classList;
48
+ if( $.inArray( 'elementor-editor-active', class_list ) === -1 && $( loco_wrapper ).length ) {
49
+ w.sfe_loco_scroll = new LocomotiveScroll( {
50
+ el: document.querySelector( '[data-scroll-container]' ),
51
+ smooth: true,
52
+ multiplier: loco_multiplier,
53
+ tablet: { smooth: loco_scroll_tablet },
54
+ smartphone: { smooth: loco_scroll_mobile },
55
+ reloadOnContextChange: true,
56
+ } );
57
+ };
58
+ } );
59
+ } );
60
+ // handle scrollTo new way plus ... Locomotive Scroll tends to cutoff a chunk of footer, this is some sort of an ugly workaround
61
+ $window.load( function( $ ) {
62
+ var loco_scroll_loaded = setInterval( function() {
63
+ if( w.sfe_loco_scroll && Object.keys( w.sfe_loco_scroll ).length !== 0 ) {
64
+ // height fix deprecated in favour of resize listener
65
+ if( ! loco_allow_refresh ) w.dispatchEvent( new Event( 'resize' ) );
66
+ // anchor/hash
67
+ var all_data_scroll_to = document.querySelectorAll( '[data-jump-to]' ), i;
68
+ for( i = 0; i < all_data_scroll_to.length; ++ i ) {
69
+ all_data_scroll_to[ i ].addEventListener( 'click', event => {
70
+ event.preventDefault(); // esc defos
71
+ var ankor = event.currentTarget.getAttribute( 'data-jump-to' );
72
+ var regexp = /^[\w#-_]+$/;
73
+ if( ankor.search( regexp ) !== -1 ) {
74
+ w.sfe_loco_scroll.scrollTo( ankor, {
75
+ 'offset': 0,
76
+ 'duration': 5,
77
+ 'disableLerp': false
78
+ } );
79
+ }
80
+ } );
81
+ }
82
+ // get off the duty
83
+ clearInterval( loco_scroll_loaded );
84
+ }
85
+ }, 100 );
86
+ } );
87
+ // handle resize --- we have to refresh the page upon resize!
88
+ w.addEventListener( 'resize', debouncer( e => {
89
+ if( w.sfe_loco_scroll && Object.keys( w.sfe_loco_scroll ).length !== 0 && loco_allow_refresh ) {
90
+ w.location.reload();
91
+ }
92
+ }, true ) );
93
+ function debouncer( f ) {
94
+ var debounce_timer;
95
+ return function( e ) {
96
+ if( debounce_timer ) clearTimeout( debounce_timer );
97
+ debounce_timer = setTimeout( f, 500, e );
98
+ };
99
+ }
100
+
101
+ }( jQuery, window, window.sfe_loco_scroll = window.sfe_loco_scroll || {} ) );
assets/js/ooohboi-steroids-min.js CHANGED
@@ -1 +1 @@
1
- "use strict";!function(e,t){var o=e(t);o.on("elementor/frontend/init",(function(){var t=elementorModules.frontend.handlers.Base.extend({onInit:function(){elementorModules.frontend.handlers.Base.prototype.onInit.apply(this,arguments),this.initPoopArtPerspektiveHA(),this.initHoverAnimator()},initPoopArtPerspektiveHA:function(){this.isEdit&&(this.$element.addClass("ob-has-background-overlay"),"yes"===this.getElementSettings("_ob_perspektive_use")&&this.$element.addClass("ob-use-perspektive"),"yes"===this.getElementSettings("_ob_widget_stalker_use")&&this.$element.addClass("ob-got-stalker"))},initHoverAnimator:function(){this.routeHoverAnimator()},onElementChange:function(e){"_ob_perspektive_use"===e&&("yes"===this.getElementSettings("_ob_perspektive_use")?this.$element.addClass("ob-use-perspektive"):this.$element.removeClass("ob-use-perspektive")),"_ob_allow_hoveranimator"===e&&this.routeHoverAnimator(),-1!==["_ob_hoveranimator_opacity_hover","_ob_hoveranimator_y_hover","_ob_hoveranimator_y_hover_alt","_ob_hoveranimator_x_hover","_ob_hoveranimator_x_hover_alt","_ob_hoveranimator_rot_hover","_ob_hoveranimator_scalex_hover","_ob_hoveranimator_scaley_hover","_ob_hoveranimator_blur_hover"].indexOf(e)&&this.isHoverAnimator()&&this.doHoverAnimator(),"_ob_widget_stalker_use"===e&&this.routeWidgetStalkerWidget()},isWidgetStalkerWidget:function(){return this.$element.hasClass("ob-got-stalker")},routeWidgetStalkerWidget:function(){this.isWidgetStalkerWidget()||"yes"!==this.getElementSettings("_ob_widget_stalker_use")?this.$element.removeClass("ob-got-stalker"):this.$element.addClass("ob-got-stalker")},isPerspektive:function(){return this.$element.hasClass("ob-use-perspektive")},isHoverAnimator:function(){return this.$element.hasClass("ob-is-hoveranimal")},routeHoverAnimator:function(){this.isEdit?(this.isHoverAnimator()||"yes"!==this.getElementSettings("_ob_allow_hoveranimator")||(this.$element.addClass("ob-is-hoveranimal"),this.doHoverAnimator()),this.isHoverAnimator()&&"yes"!==this.getElementSettings("_ob_allow_hoveranimator")&&(this.$element.removeClass("ob-is-hoveranimal"),this.stopHoverAnimator())):!this.isEdit&&this.isHoverAnimator()&&this.doHoverAnimator()},doHoverAnimator:function(){var t=this.$element,o=t.parent().closest(".ob-is-hoveranimator");if(o.length){var s,i,n,r,l,a,d,h,m,_,p,b,c=o.data("id");this.isEdit?(s=this.getElementSettings("_ob_hoveranimator_opacity_hover"),i=this.getElementSettings("_ob_hoveranimator_y_hover"),n=this.getElementSettings("_ob_hoveranimator_y_hover_alt"),r=this.getElementSettings("_ob_hoveranimator_x_hover"),l=this.getElementSettings("_ob_hoveranimator_x_hover_alt"),a=this.getElementSettings("_ob_hoveranimator_rot_hover"),h=this.getElementSettings("_ob_hoveranimator_scalex_hover"),d=this.getElementSettings("_ob_hoveranimator_scaley_hover"),m=this.getElementSettings("_ob_hoveranimator_blur_hover")):this.isEdit||(s=(_=e.parseJSON(t.attr("data-settings")))._ob_hoveranimator_opacity_hover,i=_._ob_hoveranimator_y_hover,n=_._ob_hoveranimator_y_hover_alt,r=_._ob_hoveranimator_x_hover,l=_._ob_hoveranimator_x_hover_alt,a=_._ob_hoveranimator_rot_hover,h=_._ob_hoveranimator_scalex_hover,d=_._ob_hoveranimator_scaley_hover,m=_._ob_hoveranimator_blur_hover),b=""!=e.trim(l)&&void 0!==l?"calc("+l+")":r.size+r.unit,p=""!=e.trim(n)&&void 0!==n?"calc("+n+")":i.size+i.unit;var u={opacity:s.size,top:p,left:b,transform:"rotate("+a.size+"deg) scaleX("+h.size+") scaleY("+d.size+")",filter:"blur("+m.size+m.unit+")"};o.on("mouseenter."+c,(function(){t.css(u)})),o.on("mouseleave."+c,(function(){t.removeAttr("style")}))}},stopHoverAnimator:function(){var e=this.$element,t=this.$element.parent().closest(".ob-is-hoveranimator");if(t.length){var o=t.data("id"),s={opacity:"",top:"",left:"",transform:"",filter:""};t.on("mouseenter."+o,(function(){e.css(s)})),t.on("mouseleave."+o,(function(){e.removeAttr("style")}))}}}),i=elementorModules.frontend.handlers.Base.extend({onInit:function(){elementorModules.frontend.handlers.Base.prototype.onInit.apply(this,arguments),this.initHarakiri()},initHarakiri:function(){this.isEdit&&"inherit"!==this.getElementSettings("_ob_harakiri_writing_mode")&&this.$element.addClass("ob-harakiri")},onElementChange:function(e){"_ob_harakiri_writing_mode"===e&&("inherit"!==this.getElementSettings("_ob_harakiri_writing_mode")?this.$element.addClass("ob-harakiri"):this.$element.removeClass("ob-harakiri"))}}),n={widget:t,"heading.default":i,"text-editor.default":i,section:elementorModules.frontend.handlers.Base.extend({onInit:function(){elementorModules.frontend.handlers.Base.prototype.onInit.apply(this,arguments),this.initSectionExtends()},isBreakingBad:function(){return this.$element.hasClass("ob-is-breaking-bad")},isGlider:function(){return this.$element.hasClass("ob-is-glider")},isInnerSection:function(){return this.$element.hasClass("elementor-inner-section")},onElementChange:function(e){"_ob_bbad_use_it"===e&&("yes"===this.getElementSettings("_ob_bbad_use_it")?(this.$element.addClass("ob-is-breaking-bad"),this.isInnerSection()&&this.$element.addClass("ob-bb-inner")):(this.$element.removeClass("ob-is-breaking-bad"),this.isInnerSection()&&this.$element.removeClass("ob-bb-inner"))),"_ob_glider_is_slider"===e&&("yes"===this.getElementSettings("_ob_glider_is_slider")?(this.$element.addClass("ob-is-glider"),this.addClassesRouteGlider(".elementor-element-"+this.$element.attr("data-id"),"addClass"),this.initSwiperElements()):"yes"!=this.getElementSettings("_ob_glider_is_slider")&&(this.$element.removeClass("ob-is-glider"),this.addClassesRouteGlider(".elementor-element-"+this.$element.attr("data-id"),"removeClass"))),"_ob_bbad_sssic_use"===e&&this.isInnerSection()&&("yes"===this.getElementSettings("_ob_bbad_sssic_use")?this.$element.addClass("ob-is-sticky-inner-section"):this.$element.removeClass("ob-is-sticky-inner-section"))},addClassesRouteGlider:function(t,o){var s=e(t).children(".elementor-container").first();s.length&&s.addClass("swiper-container");var i=e(s).children(".elementor-row").first();i.length&&"addClass"==o?(i.addClass("swiper-wrapper"),e(i).children("div.elementor-column").addClass("swiper-slide")):i.length||"addClass"!=o||(e(s).children("div.elementor-column").wrapAll('<div class="swiper-wrapper" />'),e(s).children(".swiper-wrapper").first().children("div.elementor-column").addClass("swiper-slide")),i.length&&"removeClass"==o?(s.removeClass("swiper-container"),i.removeClass("swiper-wrapper"),e(i).children("div.elementor-column").removeClass("swiper-slide")):i.length||"removeClass"!=o||(s.removeClass("swiper-container"),e(s).children("div.swiper-wrapper").unwrap(),e(s).children("div.elementor-column").removeClass("swiper-slide"))},initSectionExtends:function(){if(this.isEdit?("yes"!==this.getElementSettings("_ob_bbad_use_it")||this.isBreakingBad()||(this.$element.addClass("ob-is-breaking-bad"),this.isInnerSection()&&this.$element.addClass("ob-bb-inner")),"yes"===this.getElementSettings("_ob_glider_is_slider")&&(this.$element.addClass("ob-is-glider"),this.addClassesRouteGlider(".elementor-element-"+this.$element.attr("data-id"),"addClass"),this.initSwiperElements())):"yes"===this.getElementSettings("_ob_glider_is_slider")&&(this.$element.addClass("ob-is-glider"),this.addClassesRouteGlider(".elementor-element-"+this.$element.attr("data-id"),"addClass"),this.initSwiperElements()),"yes"===this.getElementSettings("_ob_bbad_sssic_use")&&this.isInnerSection()){this.isEdit&&this.$element.addClass("ob-is-sticky-inner-section");var e=this.$element.closest(".elementor-widget-wrap");e.length&&e.addClass("ob-sssic-wrapper")}},initSwiperElements:function(){this.$element.children(".elementor-container").find(".swiper-button-next").first().length||this.$element.children(".elementor-container").first().append('<div class="swiper-button-next"><svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMin" viewBox="0 0 27 44"><path d="M27 22L5 44l-2.1-2.1L22.8 22 2.9 2.1 5 0l22 22z"></path></svg></div>'),this.$element.children(".elementor-container").find(".swiper-button-prev").first().length||this.$element.children(".elementor-container").first().append('<div class="swiper-button-prev"><svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMin" viewBox="0 0 27 44"><path d="M0 22L22 0l2.1 2.1L4.2 22l19.9 19.9L22 44 0 22z"></path></svg></div>'),this.$element.children(".elementor-container").find(".swiper-pagination").first().length||this.$element.children(".elementor-container").first().append('<div class="swiper-pagination"></div>');var e={};e.pagination_type=this.getElementSettings("_ob_glider_pagination_type"),e.allowTouchMove=this.getElementSettings("_ob_glider_allow_touch_move"),e.autoheight=this.getElementSettings("_ob_glider_auto_h"),e.effect=this.getElementSettings("_ob_glider_effect"),e.loop=this.getElementSettings("_ob_glider_loop"),e.direction=this.getElementSettings("_ob_glider_direction"),e.parallax=this.getElementSettings("_ob_glider_parallax"),e.speed=this.getElementSettings("_ob_glider_speed");var t=this.getElementSettings("_ob_glider_autoplay");e.autoplay=!!t&&{delay:this.getElementSettings("_ob_glider_autoplay_delay")},e.allowMultiSlides=this.getElementSettings("_ob_glider_allow_multi_slides");var o={},i=elementorFrontend.config.breakpoints;o[i.lg]={slidesPerView:this.getElementSettings("_ob_glider_slides_per_view"),slidesPerGroup:this.getElementSettings("_ob_glider_slides_to_scroll"),spaceBetween:+this.getElementSettings("_ob_glider_space_between")||0},o[i.md]={slidesPerView:this.getElementSettings("_ob_glider_slides_per_view_tablet"),slidesPerGroup:this.getElementSettings("_ob_glider_slides_to_scroll_tablet"),spaceBetween:+this.getElementSettings("_ob_glider_space_between_tablet")||0},o[0]={slidesPerView:this.getElementSettings("_ob_glider_slides_per_view_mobile"),slidesPerGroup:this.getElementSettings("_ob_glider_slides_to_scroll_mobile"),spaceBetween:+this.getElementSettings("_ob_glider_space_between_mobile")||0},e.breakpoints=o,s(this.$element.attr("data-id"),e,"glider_"+this.$element.attr("data-id"))}}),column:elementorModules.frontend.handlers.Base.extend({onInit:function(){elementorModules.frontend.handlers.Base.prototype.onInit.apply(this,arguments),this.$element.find(".elementor-column-wrap").first().length||this.$element.addClass("ob-is-e3");var e=navigator.userAgent.toLowerCase();e.indexOf("chrome")>-1&&this.teleporterChromeResize(),this.initColumnExtends()},teleporterChromeResize:function(){if(this.isTeleporter()){var e=this,t=this.$element.attr("data-id");o.on("resize",(function(){e.$element.closest(".ob-is-teleporter").addClass("ob-chrome-resize"),clearTimeout(t),t=setTimeout((function(){var t=parseInt(e.$element.closest(".ob-is-teleporter").css("height")),o=e.$element.find(".elementor-column-wrap").first();o.length?o.css({height:t}):e.$element.find(".elementor-widget-wrap").first().css({height:t}),e.$element.closest(".ob-is-teleporter").removeClass("ob-chrome-resize")}),500)})),o.trigger("resize")}},isTeleporter:function(){return this.$element.hasClass("ob-is-teleporter")},isHoverAnimatorCol:function(){return this.$element.hasClass("ob-is-hoveranimator")},isWidgetStalkerCol:function(){return this.$element.hasClass("ob-is-stalker")},isPseudoCol:function(){return this.$element.hasClass("ob-is-pseudo")},initColumnExtends:function(){if(!this.isEdit){var t=e.parseJSON(this.$element.attr("data-settings"));if(void 0!==t._ob_bbad_link){var o=t._ob_bbad_link;if(""===o.url)return;this.$element.off("click.bb"),this.$element.on("click.bb",(function(){o.is_external?window.open(o.url):location.href=o.url}))}}this.isEdit&&"use-teleporter"===this.getElementSettings("_ob_teleporter_use")&&(this.$element.addClass("ob-is-teleporter"),this.$element.find(".elementor-widget-wrap").first().addClass("ob-tele-midget"),this.doTeleporterEditor()),!this.isEdit&&this.isTeleporter()&&(this.$element.find(".elementor-widget-wrap").first().addClass("ob-tele-midget"),this.doTeleporter()),this.isEdit&&"yes"===this.getElementSettings("_ob_column_hoveranimator")&&this.$element.addClass("ob-is-hoveranimator"),this.isEdit&&"yes"===this.getElementSettings("_ob_bbad_is_stalker")&&this.$element.addClass("ob-is-stalker"),this.isEdit&&"yes"===this.getElementSettings("_ob_column_has_pseudo")&&this.$element.addClass("ob-is-pseudo")},onElementChange:function(e){"_ob_teleporter_overlay_color"===e?this.$element.find('div[class*="ob-teleporter-"] > .ob-tele-overlay').css("background-color",this.getElementSettings("_ob_teleporter_overlay_color")):"_ob_teleporter_no_pass_tablet"===e?"no-tablet"===this.getElementSettings("_ob_teleporter_no_pass_tablet")?this.$element.addClass("ob-tele-no-tablet"):this.$element.removeClass("ob-tele-no-tablet"):"_ob_teleporter_no_pass_mobile"===e&&("no-mobile"===this.getElementSettings("_ob_teleporter_no_pass_mobile")?this.$element.addClass("ob-tele-no-mobile"):this.$element.removeClass("ob-tele-no-mobile")),"_ob_column_hoveranimator"===e&&this.routeHoverAnimatorCol(),"_ob_bbad_is_stalker"===e&&this.routeWidgetStalkerCol(),"_ob_column_has_pseudo"===e&&this.routePseudoCol()},routeHoverAnimatorCol:function(){this.isHoverAnimatorCol()||"yes"!==this.getElementSettings("_ob_column_hoveranimator")?this.$element.removeClass("ob-is-hoveranimator"):this.$element.addClass("ob-is-hoveranimator")},routeWidgetStalkerCol:function(){this.isWidgetStalkerCol()||"yes"!==this.getElementSettings("_ob_bbad_is_stalker")?this.$element.removeClass("ob-is-stalker"):this.$element.addClass("ob-is-stalker")},routePseudoCol:function(){this.isPseudoCol()||"yes"!==this.getElementSettings("_ob_column_has_pseudo")?this.$element.removeClass("ob-is-pseudo"):this.$element.addClass("ob-is-pseudo")},doTeleporterEditor:function(){if("use-teleporter"===this.getElementSettings("_ob_teleporter_use")){var t=this.$element.find(".elementor-widget-wrap").first();if(t.length&&(t.wrapInner('<div class="widget-wrap-children" />'),t.find(".elementor-background-overlay").first().length&&t.find(".elementor-background-overlay").first().insertBefore(t.find(".elementor-background-overlay").first().parent())),"do-pass"===this.getElementSettings("_ob_teleporter_pass")){var o=this,s=this.$element,i=this.$element.attr("data-id");"no-tablet"===this.getElementSettings("_ob_teleporter_no_pass_tablet")&&this.$element.addClass("ob-tele-no-tablet"),"no-mobile"===this.getElementSettings("_ob_teleporter_no_pass_mobile")&&this.$element.addClass("ob-tele-no-mobile");var n="section"===this.getElementSettings("_ob_teleporter_pass_element")?this.$element.closest(".elementor-section"):this.$element.closest(".elementor-container");if(n.length){n.css("overflow","hidden");var r=this.getElementSettings("_ob_teleporter_pass_effect"),l='<div class="ob-teleporter-'+i+" ob-tele-eff-"+r+'" data-id-teleporter="'+i+'"><div class="ob-tele-overlay" style="background-color: '+this.getElementSettings("_ob_teleporter_overlay_color")+';"></div></div>';e(".ob-teleporter-"+i).length||this.$element.prepend(l),this.$element.off("mouseenter mouseleave"),this.$element.on("mouseenter mouseleave",(function(t){if("mouseenter"===t.type){if("no-tablet"===o.getElementSettings("_ob_teleporter_no_pass_tablet")&&"tablet"===elementorFrontend.getCurrentDeviceMode())return;if("no-mobile"===o.getElementSettings("_ob_teleporter_no_pass_mobile")&&"mobile"===elementorFrontend.getCurrentDeviceMode())return;if("do-pass"!==o.getElementSettings("_ob_teleporter_pass"))return;var r={"background-color":e(".ob-teleporter-"+i).css("background-color"),"background-image":e(".ob-teleporter-"+i).css("background-image"),"background-position":e(".ob-teleporter-"+i).css("background-position"),"background-size":e(".ob-teleporter-"+i).css("background-size"),"background-repeat":e(".ob-teleporter-"+i).css("background-repeat")};if("section"===o.getElementSettings("_ob_teleporter_pass_element")){var l=n.children().not(".elementor-container").detach();n.addClass("ob-tele-mom-hover").prepend(e(".ob-teleporter-"+i)),n.prepend(l)}else n.addClass("ob-tele-mom-hover").prepend(e(".ob-teleporter-"+i));e(".ob-teleporter-"+i).css(r).hide(),e(".ob-teleporter-"+i).addClass("ob-teleporter-hover").show()}else n.removeClass("ob-tele-mom-hover"),setTimeout((function(){e(".ob-teleporter-"+i).removeAttr("style").removeClass("ob-teleporter-hover"),s.prepend(e(".ob-teleporter-"+i))}),100)}))}}}},doTeleporter:function(){var t=e.parseJSON(this.$element.attr("data-settings"));if("use-teleporter"===t._ob_teleporter_use){var o=this.$element.find(".elementor-widget-wrap").first();o.length&&(o.wrapInner('<div class="widget-wrap-children" />'),o.find(".elementor-background-overlay").first().length&&o.find(".elementor-background-overlay").first().insertBefore(o.find(".elementor-background-overlay").first().parent()));var s=this.$element,i=this.$element.attr("data-id");if("no-tablet"===t._ob_teleporter_no_pass_tablet&&this.$element.addClass("ob-tele-no-tablet"),"no-mobile"===t._ob_teleporter_no_pass_mobile&&this.$element.addClass("ob-tele-no-mobile"),void 0!==t._ob_teleporter_link){var n=t._ob_teleporter_link;if(""===n.url)return;this.$element.off("click.obTeleporter"),this.$element.on("click.obTeleporter",(function(){n.is_external?window.open(n.url):location.href=n.url}))}if("do-pass"===t._ob_teleporter_pass){var r="section"===t._ob_teleporter_pass_element?this.$element.closest(".elementor-section"):this.$element.closest(".elementor-container");if(r.length){r.css("overflow","hidden");var l=t._ob_teleporter_pass_effect,a='<div class="ob-teleporter-'+i+" ob-tele-eff-"+l+'" data-id-teleporter="'+i+'"><div class="ob-tele-overlay" style="background-color: '+t._ob_teleporter_overlay_color+';"></div>';e(".ob-teleporter-"+i).length||this.$element.prepend(a),this.$element.off("mouseenter mouseleave"),this.$element.on("mouseenter",(function(){if(!("no-tablet"===t._ob_teleporter_no_pass_tablet&&"tablet"===elementorFrontend.getCurrentDeviceMode()||"no-mobile"===t._ob_teleporter_no_pass_mobile&&"mobile"===elementorFrontend.getCurrentDeviceMode())){var o={"background-color":e(".ob-teleporter-"+i).css("background-color"),"background-image":e(".ob-teleporter-"+i).css("background-image"),"background-position":e(".ob-teleporter-"+i).css("background-position"),"background-size":e(".ob-teleporter-"+i).css("background-size"),"background-repeat":e(".ob-teleporter-"+i).css("background-repeat")};if("section"===t._ob_teleporter_pass_element){var s=r.children().not(".elementor-container").detach();r.addClass("ob-tele-mom-hover").prepend(e(".ob-teleporter-"+i)),r.prepend(s)}else r.addClass("ob-tele-mom-hover").prepend(e(".ob-teleporter-"+i));e(".ob-teleporter-"+i).css(o).hide(),e(".ob-teleporter-"+i).show().addClass("ob-teleporter-hover")}})),this.$element.on("mouseleave",(function(){r.removeClass("ob-tele-mom-hover"),setTimeout((function(){e(".ob-teleporter-"+i).removeAttr("style").removeClass("ob-teleporter-hover"),s.prepend(e(".ob-teleporter-"+i))}),100)}))}}}}}),"search-form.default":elementorModules.frontend.handlers.Base.extend({onInit:function(){elementorModules.frontend.handlers.Base.prototype.onInit.apply(this,arguments),this.initSearchCop()},onElementChange:function(e){"_ob_searchcop_srch_options"===e&&this.routeSearchCop()},initSearchCop:function(){this.routeSearchCop()},routeSearchCop:function(){var e=this.getElementSettings("_ob_searchcop_srch_options");if("post"===e||"page"===e){var t=this.$element.find(".elementor-search-form__container");if(!t.length)return;var o='<input type="hidden" name="post_type" value="'+e+'" />';t.prepend(o)}}}),"button.default":elementorModules.frontend.handlers.Base.extend({onInit:function(){elementorModules.frontend.handlers.Base.prototype.onInit.apply(this,arguments),this.initButterButton()},isButterButton:function(){return this.$element.hasClass("ob-is-butterbutton")},onElementChange:function(e){"_ob_butterbutton_use_it"===e&&this.routeButterButton()},initButterButton:function(){this.isEdit&&"yes"===this.getElementSettings("_ob_butterbutton_use_it")&&this.$element.addClass("ob-is-butterbutton")},routeButterButton:function(){this.isButterButton()||"yes"!==this.getElementSettings("_ob_butterbutton_use_it")?this.$element.removeClass("ob-is-butterbutton"):this.$element.addClass("ob-is-butterbutton")}}),"image.default":elementorModules.frontend.handlers.Base.extend({onInit:function(){elementorModules.frontend.handlers.Base.prototype.onInit.apply(this,arguments),this.initPhotoMorph()},isPhotoMorph:function(){return this.$element.hasClass("ob-photomorph")},onElementChange:function(e){"_ob_photomorph_use"===e&&this.routePhotoMorph()},initPhotoMorph:function(){this.isEdit&&"yes"===this.getElementSettings("_ob_photomorph_use")&&this.$element.addClass("ob-photomorph")},routePhotoMorph:function(){this.isPhotoMorph()||"yes"!==this.getElementSettings("_ob_photomorph_use")?this.$element.removeClass("ob-photomorph"):this.$element.addClass("ob-photomorph")}}),"post-comments.theme_comments":elementorModules.frontend.handlers.Base.extend({onInit:function(){elementorModules.frontend.handlers.Base.prototype.onInit.apply(this,arguments),this.initCommentz()},isCommentz:function(){return this.$element.hasClass("ob-commentz")},onElementChange:function(e){"_ob_commentz_use"===e&&this.routeCommentz()},initCommentz:function(){this.isEdit&&"yes"===this.getElementSettings("_ob_commentz_use")&&this.$element.addClass("ob-commentz")},routeCommentz:function(){this.isCommentz()||"yes"!==this.getElementSettings("_ob_commentz_use")?this.$element.removeClass("ob-commentz"):this.$element.addClass("ob-commentz")}}),"spacer.default":elementorModules.frontend.handlers.Base.extend({onInit:function(){elementorModules.frontend.handlers.Base.prototype.onInit.apply(this,arguments),this.initSpaceRat()},isSpaceRat:function(){return this.$element.hasClass("ob-spacerat")},onElementChange:function(e){"_ob_spacerat_use"===e&&this.routeSpaceRat()},initSpaceRat:function(){if(this.isEdit&&"yes"===this.getElementSettings("_ob_spacerat_use")&&this.$element.addClass("ob-spacerat"),!this.isEdit&&"yes"===this.getElementSettings("_ob_spacerat_use")){var t=e.parseJSON(this.$element.attr("data-settings"));if(void 0!==t._ob_spacerat_link){var o=t._ob_spacerat_link;if(""===o.url)return;this.$element.off("click.obSpacerat"),this.$element.on("click.obSpacerat",(function(){o.is_external?window.open(o.url):location.href=o.url}))}}},routeSpaceRat:function(){this.isSpaceRat()||"yes"!==this.getElementSettings("_ob_spacerat_use")?this.$element.removeClass("ob-spacerat"):this.$element.addClass("ob-spacerat")}})};e.each(n,(function(e,t){elementorFrontend.hooks.addAction("frontend/element_ready/"+e,(function(e){elementorFrontend.elementsHandler.addHandler(t,{$element:e})}))}))}));var s=function(t,o){var s,i=e(".elementor-element-"+t),n=e(".elementor-element-"+t+" .swiper-container").first(),r=n.parent().parent().find("nav.glider-controller"),l={allowTouchMove:"yes"===o.allowTouchMove,autoHeight:"yes"===o.autoheight,effect:o.effect,loop:o.loop,direction:"fade"===o.effect?"horizontal":o.direction,parallax:"yes"===o.parallax,speed:o.speed,breakpoints:"yes"===o.allowMultiSlides&&o.breakpoints,navigation:{nextEl:".elementor-element-"+t+" .swiper-button-next",prevEl:".elementor-element-"+t+" .swiper-button-prev"},pagination:{el:".elementor-element-"+t+" .swiper-pagination",type:o.pagination_type,clickable:!0},autoplay:o.autoplay,watchOverflow:!0};if("undefined"==typeof Swiper){new(0,elementorFrontend.utils.swiper)(n,l).then((e=>{s=e}))}else s=new Swiper(n,l);n.find('[class*="glider-control"]').on("click",(function(t){if(void 0!==e(this).data("gotoslide"))s.slideTo(parseInt(e(this).data("gotoslide")));else{var o=parseInt(e(this).attr("class").match(/glider-control-(\d+)/)[1]);o>0&&s.slideTo(o)}t.preventDefault()})),r.find('[class*="glider-control"]').on("click",(function(t){if(void 0!==e(this).data("gotoslide"))s.slideTo(parseInt(e(this).data("gotoslide")));else{var o=parseInt(e(this).attr("class").match(/glider-control-(\d+)/)[1]);o>0&&s.slideTo(o)}t.preventDefault()})),i.css("visibility","visible")}}(jQuery,window);
1
+ "use strict";!function(e,t){var o=e(t);o.on("elementor/frontend/init",(function(){var t=elementorModules.frontend.handlers.Base.extend({onInit:function(){elementorModules.frontend.handlers.Base.prototype.onInit.apply(this,arguments),this.initPoopArtPerspektiveHA(),this.initHoverAnimator()},initPoopArtPerspektiveHA:function(){this.isEdit&&(this.$element.addClass("ob-has-background-overlay"),"yes"===this.getElementSettings("_ob_perspektive_use")&&this.$element.addClass("ob-use-perspektive"),"yes"===this.getElementSettings("_ob_widget_stalker_use")&&this.$element.addClass("ob-got-stalker"))},initHoverAnimator:function(){this.routeHoverAnimator()},onElementChange:function(e){"_ob_perspektive_use"===e&&("yes"===this.getElementSettings("_ob_perspektive_use")?this.$element.addClass("ob-use-perspektive"):this.$element.removeClass("ob-use-perspektive")),"_ob_allow_hoveranimator"===e&&this.routeHoverAnimator(),-1!==["_ob_hoveranimator_opacity_hover","_ob_hoveranimator_y_hover","_ob_hoveranimator_y_hover_alt","_ob_hoveranimator_x_hover","_ob_hoveranimator_x_hover_alt","_ob_hoveranimator_rot_hover","_ob_hoveranimator_scalex_hover","_ob_hoveranimator_scaley_hover","_ob_hoveranimator_blur_hover"].indexOf(e)&&this.isHoverAnimator()&&this.doHoverAnimator(),"_ob_widget_stalker_use"===e&&this.routeWidgetStalkerWidget()},isWidgetStalkerWidget:function(){return this.$element.hasClass("ob-got-stalker")},routeWidgetStalkerWidget:function(){this.isWidgetStalkerWidget()||"yes"!==this.getElementSettings("_ob_widget_stalker_use")?this.$element.removeClass("ob-got-stalker"):this.$element.addClass("ob-got-stalker")},isPerspektive:function(){return this.$element.hasClass("ob-use-perspektive")},isHoverAnimator:function(){return this.$element.hasClass("ob-is-hoveranimal")},routeHoverAnimator:function(){this.isEdit?(this.isHoverAnimator()||"yes"!==this.getElementSettings("_ob_allow_hoveranimator")||(this.$element.addClass("ob-is-hoveranimal"),this.doHoverAnimator()),this.isHoverAnimator()&&"yes"!==this.getElementSettings("_ob_allow_hoveranimator")&&(this.$element.removeClass("ob-is-hoveranimal"),this.stopHoverAnimator())):!this.isEdit&&this.isHoverAnimator()&&this.doHoverAnimator()},doHoverAnimator:function(){var t=this.$element,o=t.parent().closest(".ob-is-hoveranimator");if(o.length){var s,i,n,r,l,a,d,h,m,_,p,b,c=o.data("id");this.isEdit?(s=this.getElementSettings("_ob_hoveranimator_opacity_hover"),i=this.getElementSettings("_ob_hoveranimator_y_hover"),n=this.getElementSettings("_ob_hoveranimator_y_hover_alt"),r=this.getElementSettings("_ob_hoveranimator_x_hover"),l=this.getElementSettings("_ob_hoveranimator_x_hover_alt"),a=this.getElementSettings("_ob_hoveranimator_rot_hover"),h=this.getElementSettings("_ob_hoveranimator_scalex_hover"),d=this.getElementSettings("_ob_hoveranimator_scaley_hover"),m=this.getElementSettings("_ob_hoveranimator_blur_hover")):this.isEdit||(s=(_=e.parseJSON(t.attr("data-settings")))._ob_hoveranimator_opacity_hover,i=_._ob_hoveranimator_y_hover,n=_._ob_hoveranimator_y_hover_alt,r=_._ob_hoveranimator_x_hover,l=_._ob_hoveranimator_x_hover_alt,a=_._ob_hoveranimator_rot_hover,h=_._ob_hoveranimator_scalex_hover,d=_._ob_hoveranimator_scaley_hover,m=_._ob_hoveranimator_blur_hover),b=""!=e.trim(l)&&void 0!==l?"calc("+l+")":r.size+r.unit,p=""!=e.trim(n)&&void 0!==n?"calc("+n+")":i.size+i.unit;var u={opacity:s.size,top:p,left:b,transform:"rotate("+a.size+"deg) scaleX("+h.size+") scaleY("+d.size+")",filter:"blur("+m.size+m.unit+")"};o.on("mouseenter."+c,(function(){t.css(u)})),o.on("mouseleave."+c,(function(){t.removeAttr("style")}))}},stopHoverAnimator:function(){var e=this.$element,t=this.$element.parent().closest(".ob-is-hoveranimator");if(t.length){var o=t.data("id"),s={opacity:"",top:"",left:"",transform:"",filter:""};t.on("mouseenter."+o,(function(){e.css(s)})),t.on("mouseleave."+o,(function(){e.removeAttr("style")}))}}}),i=elementorModules.frontend.handlers.Base.extend({onInit:function(){elementorModules.frontend.handlers.Base.prototype.onInit.apply(this,arguments),this.initHarakiri()},initHarakiri:function(){this.isEdit&&"inherit"!==this.getElementSettings("_ob_harakiri_writing_mode")&&this.$element.addClass("ob-harakiri")},onElementChange:function(e){"_ob_harakiri_writing_mode"===e&&("inherit"!==this.getElementSettings("_ob_harakiri_writing_mode")?this.$element.addClass("ob-harakiri"):this.$element.removeClass("ob-harakiri"))}}),n={widget:t,"heading.default":i,"text-editor.default":i,section:elementorModules.frontend.handlers.Base.extend({onInit:function(){elementorModules.frontend.handlers.Base.prototype.onInit.apply(this,arguments),this.initSectionExtends()},isBreakingBad:function(){return this.$element.hasClass("ob-is-breaking-bad")},isGlider:function(){return this.$element.hasClass("ob-is-glider")},isInnerSection:function(){return this.$element.hasClass("elementor-inner-section")},onElementChange:function(e){"_ob_bbad_use_it"===e&&("yes"===this.getElementSettings("_ob_bbad_use_it")?(this.$element.addClass("ob-is-breaking-bad"),this.isInnerSection()&&this.$element.addClass("ob-bb-inner")):(this.$element.removeClass("ob-is-breaking-bad"),this.isInnerSection()&&this.$element.removeClass("ob-bb-inner"))),"_ob_glider_is_slider"===e&&("yes"===this.getElementSettings("_ob_glider_is_slider")?(this.$element.addClass("ob-is-glider"),this.addClassesRouteGlider(".elementor-element-"+this.$element.attr("data-id"),"addClass"),this.initSwiperElements()):"yes"!=this.getElementSettings("_ob_glider_is_slider")&&(this.$element.removeClass("ob-is-glider"),this.addClassesRouteGlider(".elementor-element-"+this.$element.attr("data-id"),"removeClass"))),"_ob_bbad_sssic_use"===e&&this.isInnerSection()&&("yes"===this.getElementSettings("_ob_bbad_sssic_use")?this.$element.addClass("ob-is-sticky-inner-section"):this.$element.removeClass("ob-is-sticky-inner-section"))},addClassesRouteGlider:function(t,o){var s=e(t).children(".elementor-container").first();s.length&&s.addClass("swiper-container");var i=e(s).children(".elementor-row").first();i.length&&"addClass"==o?(i.addClass("swiper-wrapper"),e(i).children("div.elementor-column").addClass("swiper-slide")):i.length||"addClass"!=o||(e(s).children("div.elementor-column").wrapAll('<div class="swiper-wrapper" />'),e(s).children(".swiper-wrapper").first().children("div.elementor-column").addClass("swiper-slide")),i.length&&"removeClass"==o?(s.removeClass("swiper-container"),i.removeClass("swiper-wrapper"),e(i).children("div.elementor-column").removeClass("swiper-slide")):i.length||"removeClass"!=o||(s.removeClass("swiper-container"),e(s).children("div.swiper-wrapper").unwrap(),e(s).children("div.elementor-column").removeClass("swiper-slide"))},initSectionExtends:function(){if(this.isEdit?("yes"!==this.getElementSettings("_ob_bbad_use_it")||this.isBreakingBad()||(this.$element.addClass("ob-is-breaking-bad"),this.isInnerSection()&&this.$element.addClass("ob-bb-inner")),"yes"===this.getElementSettings("_ob_glider_is_slider")&&(this.$element.addClass("ob-is-glider"),this.addClassesRouteGlider(".elementor-element-"+this.$element.attr("data-id"),"addClass"),this.initSwiperElements())):"yes"===this.getElementSettings("_ob_glider_is_slider")&&(this.$element.addClass("ob-is-glider"),this.addClassesRouteGlider(".elementor-element-"+this.$element.attr("data-id"),"addClass"),this.initSwiperElements()),"yes"===this.getElementSettings("_ob_bbad_sssic_use")&&this.isInnerSection()){this.isEdit&&this.$element.addClass("ob-is-sticky-inner-section");var e=this.$element.closest(".elementor-widget-wrap");e.length&&e.addClass("ob-sssic-wrapper")}},initSwiperElements:function(){this.$element.children(".elementor-container").find(".swiper-button-next").first().length||this.$element.children(".elementor-container").first().append('<div class="swiper-button-next"><svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMin" viewBox="0 0 27 44"><path d="M27 22L5 44l-2.1-2.1L22.8 22 2.9 2.1 5 0l22 22z"></path></svg></div>'),this.$element.children(".elementor-container").find(".swiper-button-prev").first().length||this.$element.children(".elementor-container").first().append('<div class="swiper-button-prev"><svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMin" viewBox="0 0 27 44"><path d="M0 22L22 0l2.1 2.1L4.2 22l19.9 19.9L22 44 0 22z"></path></svg></div>'),this.$element.children(".elementor-container").find(".swiper-pagination").first().length||this.$element.children(".elementor-container").first().append('<div class="swiper-pagination"></div>');var e={};e.pagination_type=this.getElementSettings("_ob_glider_pagination_type"),e.allowTouchMove=this.getElementSettings("_ob_glider_allow_touch_move"),e.autoheight=this.getElementSettings("_ob_glider_auto_h"),e.effect=this.getElementSettings("_ob_glider_effect"),e.loop=this.getElementSettings("_ob_glider_loop"),e.direction=this.getElementSettings("_ob_glider_direction"),e.parallax=this.getElementSettings("_ob_glider_parallax"),e.speed=this.getElementSettings("_ob_glider_speed");var t=this.getElementSettings("_ob_glider_autoplay");e.autoplay=!!t&&{delay:this.getElementSettings("_ob_glider_autoplay_delay")},e.allowMultiSlides=this.getElementSettings("_ob_glider_allow_multi_slides");var o={},i=elementorFrontend.config.breakpoints;o[i.lg]={slidesPerView:this.getElementSettings("_ob_glider_slides_per_view"),slidesPerGroup:this.getElementSettings("_ob_glider_slides_to_scroll"),spaceBetween:+this.getElementSettings("_ob_glider_space_between")||0},o[i.md]={slidesPerView:this.getElementSettings("_ob_glider_slides_per_view_tablet"),slidesPerGroup:this.getElementSettings("_ob_glider_slides_to_scroll_tablet"),spaceBetween:+this.getElementSettings("_ob_glider_space_between_tablet")||0},o[0]={slidesPerView:this.getElementSettings("_ob_glider_slides_per_view_mobile"),slidesPerGroup:this.getElementSettings("_ob_glider_slides_to_scroll_mobile"),spaceBetween:+this.getElementSettings("_ob_glider_space_between_mobile")||0},e.breakpoints=o,s(this.$element.attr("data-id"),e,"glider_"+this.$element.attr("data-id"))}}),column:elementorModules.frontend.handlers.Base.extend({onInit:function(){elementorModules.frontend.handlers.Base.prototype.onInit.apply(this,arguments),this.$element.find(".elementor-column-wrap").first().length||this.$element.addClass("ob-is-e3");var e=navigator.userAgent.toLowerCase();e.indexOf("chrome")>-1&&this.teleporterChromeResize(),this.initColumnExtends()},teleporterChromeResize:function(){if(this.isTeleporter()){var e=this,t=this.$element.attr("data-id");o.on("resize",(function(){e.$element.closest(".ob-is-teleporter").addClass("ob-chrome-resize"),clearTimeout(t),t=setTimeout((function(){var t=parseInt(e.$element.closest(".ob-is-teleporter").css("height")),o=e.$element.find(".elementor-column-wrap").first();o.length?o.css({height:t}):e.$element.find(".elementor-widget-wrap").first().css({height:t}),e.$element.closest(".ob-is-teleporter").removeClass("ob-chrome-resize")}),500)})),o.trigger("resize")}},isTeleporter:function(){return this.$element.hasClass("ob-is-teleporter")},isHoverAnimatorCol:function(){return this.$element.hasClass("ob-is-hoveranimator")},isWidgetStalkerCol:function(){return this.$element.hasClass("ob-is-stalker")},isPseudoCol:function(){return this.$element.hasClass("ob-is-pseudo")},initColumnExtends:function(){if(!this.isEdit){var e={};try{e=JSON.parse(this.$element.attr("data-settings"))}catch(e){return}if(void 0!==e._ob_bbad_link){var t=e._ob_bbad_link;if(""===t.url)return;this.$element.off("click.bb"),this.$element.on("click.bb",(function(){t.is_external?window.open(t.url):location.href=t.url}))}}this.isEdit&&"use-teleporter"===this.getElementSettings("_ob_teleporter_use")&&(this.$element.addClass("ob-is-teleporter"),this.$element.find(".elementor-widget-wrap").first().addClass("ob-tele-midget"),this.doTeleporterEditor()),!this.isEdit&&this.isTeleporter()&&(this.$element.find(".elementor-widget-wrap").first().addClass("ob-tele-midget"),this.doTeleporter()),this.isEdit&&"yes"===this.getElementSettings("_ob_column_hoveranimator")&&this.$element.addClass("ob-is-hoveranimator"),this.isEdit&&"yes"===this.getElementSettings("_ob_bbad_is_stalker")&&this.$element.addClass("ob-is-stalker"),this.isEdit&&"yes"===this.getElementSettings("_ob_column_has_pseudo")&&this.$element.addClass("ob-is-pseudo")},onElementChange:function(e){"_ob_teleporter_overlay_color"===e?this.$element.find('div[class*="ob-teleporter-"] > .ob-tele-overlay').css("background-color",this.getElementSettings("_ob_teleporter_overlay_color")):"_ob_teleporter_no_pass_tablet"===e?"no-tablet"===this.getElementSettings("_ob_teleporter_no_pass_tablet")?this.$element.addClass("ob-tele-no-tablet"):this.$element.removeClass("ob-tele-no-tablet"):"_ob_teleporter_no_pass_mobile"===e&&("no-mobile"===this.getElementSettings("_ob_teleporter_no_pass_mobile")?this.$element.addClass("ob-tele-no-mobile"):this.$element.removeClass("ob-tele-no-mobile")),"_ob_column_hoveranimator"===e&&this.routeHoverAnimatorCol(),"_ob_bbad_is_stalker"===e&&this.routeWidgetStalkerCol(),"_ob_column_has_pseudo"===e&&this.routePseudoCol()},routeHoverAnimatorCol:function(){this.isHoverAnimatorCol()||"yes"!==this.getElementSettings("_ob_column_hoveranimator")?this.$element.removeClass("ob-is-hoveranimator"):this.$element.addClass("ob-is-hoveranimator")},routeWidgetStalkerCol:function(){this.isWidgetStalkerCol()||"yes"!==this.getElementSettings("_ob_bbad_is_stalker")?this.$element.removeClass("ob-is-stalker"):this.$element.addClass("ob-is-stalker")},routePseudoCol:function(){this.isPseudoCol()||"yes"!==this.getElementSettings("_ob_column_has_pseudo")?this.$element.removeClass("ob-is-pseudo"):this.$element.addClass("ob-is-pseudo")},doTeleporterEditor:function(){if("use-teleporter"===this.getElementSettings("_ob_teleporter_use")){var t=this.$element.find(".elementor-widget-wrap").first();if(t.length&&(t.wrapInner('<div class="widget-wrap-children" />'),t.find(".elementor-background-overlay").first().length&&t.find(".elementor-background-overlay").first().insertBefore(t.find(".elementor-background-overlay").first().parent())),"do-pass"===this.getElementSettings("_ob_teleporter_pass")){var o=this,s=this.$element,i=this.$element.attr("data-id");"no-tablet"===this.getElementSettings("_ob_teleporter_no_pass_tablet")&&this.$element.addClass("ob-tele-no-tablet"),"no-mobile"===this.getElementSettings("_ob_teleporter_no_pass_mobile")&&this.$element.addClass("ob-tele-no-mobile");var n="section"===this.getElementSettings("_ob_teleporter_pass_element")?this.$element.closest(".elementor-section"):this.$element.closest(".elementor-container");if(n.length){n.css("overflow","hidden");var r=this.getElementSettings("_ob_teleporter_pass_effect"),l='<div class="ob-teleporter-'+i+" ob-tele-eff-"+r+'" data-id-teleporter="'+i+'"><div class="ob-tele-overlay" style="background-color: '+this.getElementSettings("_ob_teleporter_overlay_color")+';"></div></div>';e(".ob-teleporter-"+i).length||this.$element.prepend(l),this.$element.off("mouseenter mouseleave"),this.$element.on("mouseenter mouseleave",(function(t){if("mouseenter"===t.type){if("no-tablet"===o.getElementSettings("_ob_teleporter_no_pass_tablet")&&"tablet"===elementorFrontend.getCurrentDeviceMode())return;if("no-mobile"===o.getElementSettings("_ob_teleporter_no_pass_mobile")&&"mobile"===elementorFrontend.getCurrentDeviceMode())return;if("do-pass"!==o.getElementSettings("_ob_teleporter_pass"))return;var r={"background-color":e(".ob-teleporter-"+i).css("background-color"),"background-image":e(".ob-teleporter-"+i).css("background-image"),"background-position":e(".ob-teleporter-"+i).css("background-position"),"background-size":e(".ob-teleporter-"+i).css("background-size"),"background-repeat":e(".ob-teleporter-"+i).css("background-repeat")};if("section"===o.getElementSettings("_ob_teleporter_pass_element")){var l=n.children().not(".elementor-container").detach();n.addClass("ob-tele-mom-hover").prepend(e(".ob-teleporter-"+i)),n.prepend(l)}else n.addClass("ob-tele-mom-hover").prepend(e(".ob-teleporter-"+i));e(".ob-teleporter-"+i).css(r).hide(),e(".ob-teleporter-"+i).addClass("ob-teleporter-hover").show()}else n.removeClass("ob-tele-mom-hover"),setTimeout((function(){e(".ob-teleporter-"+i).removeAttr("style").removeClass("ob-teleporter-hover"),s.prepend(e(".ob-teleporter-"+i))}),100)}))}}}},doTeleporter:function(){var t={};try{t=JSON.parse(this.$element.attr("data-settings"))}catch(e){return}if("use-teleporter"===t._ob_teleporter_use){var o=this.$element.find(".elementor-widget-wrap").first();o.length&&(o.wrapInner('<div class="widget-wrap-children" />'),o.find(".elementor-background-overlay").first().length&&o.find(".elementor-background-overlay").first().insertBefore(o.find(".elementor-background-overlay").first().parent()));var s=this.$element,i=this.$element.attr("data-id");if("no-tablet"===t._ob_teleporter_no_pass_tablet&&this.$element.addClass("ob-tele-no-tablet"),"no-mobile"===t._ob_teleporter_no_pass_mobile&&this.$element.addClass("ob-tele-no-mobile"),void 0!==t._ob_teleporter_link){var n=t._ob_teleporter_link;if(""===n.url)return;this.$element.off("click.obTeleporter"),this.$element.on("click.obTeleporter",(function(){n.is_external?window.open(n.url):location.href=n.url}))}if("do-pass"===t._ob_teleporter_pass){var r="section"===t._ob_teleporter_pass_element?this.$element.closest(".elementor-section"):this.$element.closest(".elementor-container");if(r.length){r.css("overflow","hidden");var l=t._ob_teleporter_pass_effect,a='<div class="ob-teleporter-'+i+" ob-tele-eff-"+l+'" data-id-teleporter="'+i+'"><div class="ob-tele-overlay" style="background-color: '+t._ob_teleporter_overlay_color+';"></div>';e(".ob-teleporter-"+i).length||this.$element.prepend(a),this.$element.off("mouseenter mouseleave"),this.$element.on("mouseenter",(function(){if(!("no-tablet"===t._ob_teleporter_no_pass_tablet&&"tablet"===elementorFrontend.getCurrentDeviceMode()||"no-mobile"===t._ob_teleporter_no_pass_mobile&&"mobile"===elementorFrontend.getCurrentDeviceMode())){var o={"background-color":e(".ob-teleporter-"+i).css("background-color"),"background-image":e(".ob-teleporter-"+i).css("background-image"),"background-position":e(".ob-teleporter-"+i).css("background-position"),"background-size":e(".ob-teleporter-"+i).css("background-size"),"background-repeat":e(".ob-teleporter-"+i).css("background-repeat")};if("section"===t._ob_teleporter_pass_element){var s=r.children().not(".elementor-container").detach();r.addClass("ob-tele-mom-hover").prepend(e(".ob-teleporter-"+i)),r.prepend(s)}else r.addClass("ob-tele-mom-hover").prepend(e(".ob-teleporter-"+i));e(".ob-teleporter-"+i).css(o).hide(),e(".ob-teleporter-"+i).show().addClass("ob-teleporter-hover")}})),this.$element.on("mouseleave",(function(){r.removeClass("ob-tele-mom-hover"),setTimeout((function(){e(".ob-teleporter-"+i).removeAttr("style").removeClass("ob-teleporter-hover"),s.prepend(e(".ob-teleporter-"+i))}),100)}))}}}}}),"search-form.default":elementorModules.frontend.handlers.Base.extend({onInit:function(){elementorModules.frontend.handlers.Base.prototype.onInit.apply(this,arguments),this.initSearchCop()},onElementChange:function(e){"_ob_searchcop_srch_options"===e&&this.routeSearchCop()},initSearchCop:function(){this.routeSearchCop()},routeSearchCop:function(){var e=this.getElementSettings("_ob_searchcop_srch_options");if("post"===e||"page"===e){var t=this.$element.find(".elementor-search-form__container");if(!t.length)return;var o='<input type="hidden" name="post_type" value="'+e+'" />';t.prepend(o)}}}),"button.default":elementorModules.frontend.handlers.Base.extend({onInit:function(){elementorModules.frontend.handlers.Base.prototype.onInit.apply(this,arguments),this.initButterButton()},isButterButton:function(){return this.$element.hasClass("ob-is-butterbutton")},onElementChange:function(e){"_ob_butterbutton_use_it"===e&&this.routeButterButton()},initButterButton:function(){this.isEdit&&"yes"===this.getElementSettings("_ob_butterbutton_use_it")&&this.$element.addClass("ob-is-butterbutton")},routeButterButton:function(){this.isButterButton()||"yes"!==this.getElementSettings("_ob_butterbutton_use_it")?this.$element.removeClass("ob-is-butterbutton"):this.$element.addClass("ob-is-butterbutton")}}),"image.default":elementorModules.frontend.handlers.Base.extend({onInit:function(){elementorModules.frontend.handlers.Base.prototype.onInit.apply(this,arguments),this.initPhotoMorph()},isPhotoMorph:function(){return this.$element.hasClass("ob-photomorph")},onElementChange:function(e){"_ob_photomorph_use"===e&&this.routePhotoMorph()},initPhotoMorph:function(){this.isEdit&&"yes"===this.getElementSettings("_ob_photomorph_use")&&this.$element.addClass("ob-photomorph")},routePhotoMorph:function(){this.isPhotoMorph()||"yes"!==this.getElementSettings("_ob_photomorph_use")?this.$element.removeClass("ob-photomorph"):this.$element.addClass("ob-photomorph")}}),"post-comments.theme_comments":elementorModules.frontend.handlers.Base.extend({onInit:function(){elementorModules.frontend.handlers.Base.prototype.onInit.apply(this,arguments),this.initCommentz()},isCommentz:function(){return this.$element.hasClass("ob-commentz")},onElementChange:function(e){"_ob_commentz_use"===e&&this.routeCommentz()},initCommentz:function(){this.isEdit&&"yes"===this.getElementSettings("_ob_commentz_use")&&this.$element.addClass("ob-commentz")},routeCommentz:function(){this.isCommentz()||"yes"!==this.getElementSettings("_ob_commentz_use")?this.$element.removeClass("ob-commentz"):this.$element.addClass("ob-commentz")}}),"spacer.default":elementorModules.frontend.handlers.Base.extend({onInit:function(){elementorModules.frontend.handlers.Base.prototype.onInit.apply(this,arguments),this.initSpaceRat()},isSpaceRat:function(){return this.$element.hasClass("ob-spacerat")},onElementChange:function(e){"_ob_spacerat_use"===e&&this.routeSpaceRat()},initSpaceRat:function(){if(this.isEdit&&"yes"===this.getElementSettings("_ob_spacerat_use")&&this.$element.addClass("ob-spacerat"),!this.isEdit&&"yes"===this.getElementSettings("_ob_spacerat_use")){var e={};try{e=JSON.parse(this.$element.attr("data-settings"))}catch(e){return}if(void 0!==e._ob_spacerat_link){var t=e._ob_spacerat_link;if(""===t.url)return;this.$element.off("click.obSpacerat"),this.$element.on("click.obSpacerat",(function(){t.is_external?window.open(t.url):location.href=t.url}))}}},routeSpaceRat:function(){this.isSpaceRat()||"yes"!==this.getElementSettings("_ob_spacerat_use")?this.$element.removeClass("ob-spacerat"):this.$element.addClass("ob-spacerat")}})};e.each(n,(function(e,t){elementorFrontend.hooks.addAction("frontend/element_ready/"+e,(function(e){elementorFrontend.elementsHandler.addHandler(t,{$element:e})}))}))}));var s=function(t,o){var s,i=e(".elementor-element-"+t),n=e(".elementor-element-"+t+" .swiper-container").first(),r=n.parent().parent().find("nav.glider-controller"),l={allowTouchMove:"yes"===o.allowTouchMove,autoHeight:"yes"===o.autoheight,effect:o.effect,loop:o.loop,direction:"fade"===o.effect?"horizontal":o.direction,parallax:"yes"===o.parallax,speed:o.speed,breakpoints:"yes"===o.allowMultiSlides&&o.breakpoints,navigation:{nextEl:".elementor-element-"+t+" .swiper-button-next",prevEl:".elementor-element-"+t+" .swiper-button-prev"},pagination:{el:".elementor-element-"+t+" .swiper-pagination",type:o.pagination_type,clickable:!0},autoplay:o.autoplay,watchOverflow:!0};if("undefined"==typeof Swiper){new(0,elementorFrontend.utils.swiper)(n,l).then((e=>{s=e}))}else s=new Swiper(n,l);n.find('[class*="glider-control"]').on("click",(function(t){if(void 0!==e(this).data("gotoslide"))s.slideTo(parseInt(e(this).data("gotoslide")));else{var o=parseInt(e(this).attr("class").match(/glider-control-(\d+)/)[1]);o>0&&s.slideTo(o)}t.preventDefault()})),r.find('[class*="glider-control"]').on("click",(function(t){if(void 0!==e(this).data("gotoslide"))s.slideTo(parseInt(e(this).data("gotoslide")));else{var o=parseInt(e(this).attr("class").match(/glider-control-(\d+)/)[1]);o>0&&s.slideTo(o)}t.preventDefault()})),i.css("visibility","visible")}}(jQuery,window);
assets/js/ooohboi-steroids.js CHANGED
@@ -433,7 +433,12 @@
433
  initColumnExtends: function() {
434
  /* breaking bad */
435
  if( ! this.isEdit ) {
436
- var bb_settings = $.parseJSON( this.$element.attr( 'data-settings' ) );
 
 
 
 
 
437
  // handle links
438
  if( undefined !== bb_settings._ob_bbad_link ) {
439
 
@@ -599,7 +604,12 @@
599
  },
600
  doTeleporter: function() {
601
 
602
- var teleporter_settings = $.parseJSON( this.$element.attr( 'data-settings' ) );
 
 
 
 
 
603
 
604
  if( 'use-teleporter' !== teleporter_settings._ob_teleporter_use ) return; // bail
605
 
@@ -878,7 +888,12 @@
878
 
879
  if( ! this.isEdit && 'yes' === this.getElementSettings( '_ob_spacerat_use' ) ) {
880
 
881
- var spacerat_settings = $.parseJSON( this.$element.attr( 'data-settings' ) );
 
 
 
 
 
882
 
883
  if( undefined !== spacerat_settings._ob_spacerat_link ) {
884
 
@@ -983,7 +998,7 @@
983
  if( slide_num > 0 ) me_the_swiper.slideTo( slide_num );
984
  }
985
 
986
- e.preventDefault();
987
 
988
  } );
989
 
@@ -996,7 +1011,7 @@
996
  if( slide_num > 0 ) me_the_swiper.slideTo( slide_num );
997
  }
998
 
999
- e.preventDefault();
1000
 
1001
  } );
1002
 
433
  initColumnExtends: function() {
434
  /* breaking bad */
435
  if( ! this.isEdit ) {
436
+ var bb_settings = {};
437
+ try {
438
+ bb_settings = JSON.parse( this.$element.attr( 'data-settings' ) );
439
+ } catch ( error ) {
440
+ return;
441
+ }
442
  // handle links
443
  if( undefined !== bb_settings._ob_bbad_link ) {
444
 
604
  },
605
  doTeleporter: function() {
606
 
607
+ var teleporter_settings = {};
608
+ try {
609
+ teleporter_settings = JSON.parse( this.$element.attr( 'data-settings' ) );
610
+ } catch ( error ) {
611
+ return;
612
+ }
613
 
614
  if( 'use-teleporter' !== teleporter_settings._ob_teleporter_use ) return; // bail
615
 
888
 
889
  if( ! this.isEdit && 'yes' === this.getElementSettings( '_ob_spacerat_use' ) ) {
890
 
891
+ var spacerat_settings = {};
892
+ try {
893
+ spacerat_settings = JSON.parse( this.$element.attr( 'data-settings' ) );
894
+ } catch ( error ) {
895
+ return;
896
+ }
897
 
898
  if( undefined !== spacerat_settings._ob_spacerat_link ) {
899
 
998
  if( slide_num > 0 ) me_the_swiper.slideTo( slide_num );
999
  }
1000
 
1001
+ e.preventDefault(); // bail
1002
 
1003
  } );
1004
 
1011
  if( slide_num > 0 ) me_the_swiper.slideTo( slide_num );
1012
  }
1013
 
1014
+ e.preventDefault(); // bail
1015
 
1016
  } );
1017
 
controls/ooohboi-breaking-bad.php CHANGED
@@ -1,6 +1,8 @@
1
  <?php
2
  use Elementor\Controls_Manager;
3
  use Elementor\Controls_Stack;
 
 
4
 
5
  if ( ! defined( 'ABSPATH' ) ) {
6
  exit; // Exit if accessed directly.
@@ -27,11 +29,11 @@ class OoohBoi_Breaking_Bad {
27
  add_action( 'elementor/element/section/section_layout/before_section_end', [ __CLASS__, 'ooohboi_handle_section' ], 10, 2 );
28
  add_action( 'elementor/element/column/layout/before_section_end', [ __CLASS__, 'ooohboi_handle_columns' ], 10, 2 );
29
 
30
- add_action( 'elementor/frontend/section/before_render', function( \Elementor\Element_Base $element ) {
31
 
32
  $amInner = ( $element->get_data( 'isInner' ) ) ? ' ob-bb-inner' : '';
33
 
34
- if ( \Elementor\Plugin::instance()->editor->is_edit_mode() ) return;
35
  $settings = $element->get_settings_for_display();
36
 
37
  if ( isset( $settings[ '_ob_bbad_use_it' ] ) && 'yes' === $settings[ '_ob_bbad_use_it' ] ) {
@@ -51,9 +53,9 @@ class OoohBoi_Breaking_Bad {
51
 
52
  } );
53
 
54
- add_action( 'elementor/frontend/column/before_render', function( \Elementor\Element_Base $element ) {
55
 
56
- if ( \Elementor\Plugin::instance()->editor->is_edit_mode() ) return;
57
  $settings = $element->get_settings_for_display();
58
 
59
  if ( isset( $settings[ '_ob_bbad_is_stalker' ] ) && 'yes' === $settings[ '_ob_bbad_is_stalker' ] ) {
@@ -571,7 +573,6 @@ href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/O
571
  'column' => __( 'Column', 'ooohboi-steroids' ),
572
  ],
573
  'selectors' => [
574
- '_ob_bbad_is_stalker' => 'yes',
575
  '{{WRAPPER}}.elementor-column.ob-is-stalker .elementor-widget-wrap' => 'flex-direction: {{VALUE}};',
576
  ],
577
  'condition' => [
1
  <?php
2
  use Elementor\Controls_Manager;
3
  use Elementor\Controls_Stack;
4
+ use Elementor\Element_Base;
5
+ use Elementor\Plugin;
6
 
7
  if ( ! defined( 'ABSPATH' ) ) {
8
  exit; // Exit if accessed directly.
29
  add_action( 'elementor/element/section/section_layout/before_section_end', [ __CLASS__, 'ooohboi_handle_section' ], 10, 2 );
30
  add_action( 'elementor/element/column/layout/before_section_end', [ __CLASS__, 'ooohboi_handle_columns' ], 10, 2 );
31
 
32
+ add_action( 'elementor/frontend/section/before_render', function( Element_Base $element ) {
33
 
34
  $amInner = ( $element->get_data( 'isInner' ) ) ? ' ob-bb-inner' : '';
35
 
36
+ if ( Plugin::instance()->editor->is_edit_mode() ) return;
37
  $settings = $element->get_settings_for_display();
38
 
39
  if ( isset( $settings[ '_ob_bbad_use_it' ] ) && 'yes' === $settings[ '_ob_bbad_use_it' ] ) {
53
 
54
  } );
55
 
56
+ add_action( 'elementor/frontend/column/before_render', function( Element_Base $element ) {
57
 
58
+ if ( Plugin::instance()->editor->is_edit_mode() ) return;
59
  $settings = $element->get_settings_for_display();
60
 
61
  if ( isset( $settings[ '_ob_bbad_is_stalker' ] ) && 'yes' === $settings[ '_ob_bbad_is_stalker' ] ) {
573
  'column' => __( 'Column', 'ooohboi-steroids' ),
574
  ],
575
  'selectors' => [
 
576
  '{{WRAPPER}}.elementor-column.ob-is-stalker .elementor-widget-wrap' => 'flex-direction: {{VALUE}};',
577
  ],
578
  'condition' => [
controls/ooohboi-butter-button.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  use Elementor\Controls_Manager;
3
- use Elementor\Scheme_Typography;
4
  use Elementor\Group_Control_Background;
5
  use Elementor\Group_Control_Typography;
6
  use Elementor\Group_Control_Text_Shadow;
@@ -82,7 +82,7 @@ class OoohBoi_Butter_Button {
82
  [
83
  'name' => '_ob_butterbutton_typography',
84
  'label' => __( 'Typography', 'ooohboi-steroids' ),
85
- 'scheme' => Scheme_Typography::TYPOGRAPHY_3,
86
  'selector' => $selector,
87
  'condition' => [
88
  '_ob_butterbutton_use_it' => 'yes',
1
  <?php
2
  use Elementor\Controls_Manager;
3
+ use Elementor\Core\Schemes\Typography;
4
  use Elementor\Group_Control_Background;
5
  use Elementor\Group_Control_Typography;
6
  use Elementor\Group_Control_Text_Shadow;
82
  [
83
  'name' => '_ob_butterbutton_typography',
84
  'label' => __( 'Typography', 'ooohboi-steroids' ),
85
+ 'scheme' => Typography::TYPOGRAPHY_3,
86
  'selector' => $selector,
87
  'condition' => [
88
  '_ob_butterbutton_use_it' => 'yes',
controls/ooohboi-commentz.php CHANGED
@@ -5,7 +5,7 @@ use Elementor\Element_Base;
5
  use Elementor\Group_Control_Border;
6
  use Elementor\Group_Control_Typography;
7
  use Elementor\Scheme_Color;
8
- use Elementor\Scheme_Typography;
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
11
  exit; // Exit if accessed directly.
@@ -83,7 +83,7 @@ class OoohBoi_Commentz {
83
  [
84
  'name' => '_ob_commentz_title_typo',
85
  'label' => __( 'Heading', 'ooohboi-steroids' ),
86
- 'scheme' => Scheme_Typography::TYPOGRAPHY_3,
87
  'selector' => '{{WRAPPER}}.ob-commentz .title-comments',
88
  'condition' => [
89
  '_ob_commentz_use' => 'yes',
@@ -462,7 +462,7 @@ class OoohBoi_Commentz {
462
  [
463
  'name' => '_ob_meta_typo_user',
464
  'label' => __( 'Meta-data User', 'ooohboi-steroids' ),
465
- 'scheme' => Scheme_Typography::TYPOGRAPHY_3,
466
  'selector' => '{{WRAPPER}}.ob-commentz #comments .comment-author',
467
  'condition' => [
468
  '_ob_commentz_use' => 'yes',
@@ -474,7 +474,7 @@ class OoohBoi_Commentz {
474
  [
475
  'name' => '_ob_meta_typo_time',
476
  'label' => __( 'Meta-data Time', 'ooohboi-steroids' ),
477
- 'scheme' => Scheme_Typography::TYPOGRAPHY_3,
478
  'selector' => '{{WRAPPER}}.ob-commentz #comments .comment-metadata',
479
  'condition' => [
480
  '_ob_commentz_use' => 'yes',
@@ -546,7 +546,7 @@ class OoohBoi_Commentz {
546
  [
547
  'name' => '_ob_comment_text_typo',
548
  'label' => __( 'Comment text', 'ooohboi-steroids' ),
549
- 'scheme' => Scheme_Typography::TYPOGRAPHY_3,
550
  'selector' => '{{WRAPPER}}.ob-commentz #comments .comment-content',
551
  'condition' => [
552
  '_ob_commentz_use' => 'yes',
@@ -619,7 +619,7 @@ class OoohBoi_Commentz {
619
  [
620
  'name' => '_ob_reply_typo',
621
  'label' => __( 'Reply button', 'ooohboi-steroids' ),
622
- 'scheme' => Scheme_Typography::TYPOGRAPHY_3,
623
  'selector' => '{{WRAPPER}}.ob-commentz #comments .reply a.comment-reply-link',
624
  'condition' => [
625
  '_ob_commentz_use' => 'yes',
@@ -836,7 +836,7 @@ class OoohBoi_Commentz {
836
  [
837
  'name' => '_ob_comment_form_title_typo',
838
  'label' => __( 'Comment form heading', 'ooohboi-steroids' ),
839
- 'scheme' => Scheme_Typography::TYPOGRAPHY_3,
840
  'selector' => '{{WRAPPER}}.ob-commentz #comments #reply-title',
841
  'condition' => [
842
  '_ob_commentz_use' => 'yes',
@@ -1012,7 +1012,7 @@ class OoohBoi_Commentz {
1012
  [
1013
  'name' => '_ob_navig_typo',
1014
  'label' => __( 'Comments Nav', 'ooohboi-steroids' ),
1015
- 'scheme' => Scheme_Typography::TYPOGRAPHY_3,
1016
  'selector' => '{{WRAPPER}}.ob-commentz #comments .nav-links',
1017
  'condition' => [
1018
  '_ob_commentz_use' => 'yes',
@@ -1052,6 +1052,27 @@ class OoohBoi_Commentz {
1052
  );
1053
 
1054
  $element->end_popover(); // popover Comment form styles end
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1055
 
1056
  $element->end_controls_section();
1057
 
5
  use Elementor\Group_Control_Border;
6
  use Elementor\Group_Control_Typography;
7
  use Elementor\Scheme_Color;
8
+ use Elementor\Core\Schemes\Typography;
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
11
  exit; // Exit if accessed directly.
83
  [
84
  'name' => '_ob_commentz_title_typo',
85
  'label' => __( 'Heading', 'ooohboi-steroids' ),
86
+ 'scheme' => Typography::TYPOGRAPHY_3,
87
  'selector' => '{{WRAPPER}}.ob-commentz .title-comments',
88
  'condition' => [
89
  '_ob_commentz_use' => 'yes',
462
  [
463
  'name' => '_ob_meta_typo_user',
464
  'label' => __( 'Meta-data User', 'ooohboi-steroids' ),
465
+ 'scheme' => Typography::TYPOGRAPHY_3,
466
  'selector' => '{{WRAPPER}}.ob-commentz #comments .comment-author',
467
  'condition' => [
468
  '_ob_commentz_use' => 'yes',
474
  [
475
  'name' => '_ob_meta_typo_time',
476
  'label' => __( 'Meta-data Time', 'ooohboi-steroids' ),
477
+ 'scheme' => Typography::TYPOGRAPHY_3,
478
  'selector' => '{{WRAPPER}}.ob-commentz #comments .comment-metadata',
479
  'condition' => [
480
  '_ob_commentz_use' => 'yes',
546
  [
547
  'name' => '_ob_comment_text_typo',
548
  'label' => __( 'Comment text', 'ooohboi-steroids' ),
549
+ 'scheme' => Typography::TYPOGRAPHY_3,
550
  'selector' => '{{WRAPPER}}.ob-commentz #comments .comment-content',
551
  'condition' => [
552
  '_ob_commentz_use' => 'yes',
619
  [
620
  'name' => '_ob_reply_typo',
621
  'label' => __( 'Reply button', 'ooohboi-steroids' ),
622
+ 'scheme' => Typography::TYPOGRAPHY_3,
623
  'selector' => '{{WRAPPER}}.ob-commentz #comments .reply a.comment-reply-link',
624
  'condition' => [
625
  '_ob_commentz_use' => 'yes',
836
  [
837
  'name' => '_ob_comment_form_title_typo',
838
  'label' => __( 'Comment form heading', 'ooohboi-steroids' ),
839
+ 'scheme' => Typography::TYPOGRAPHY_3,
840
  'selector' => '{{WRAPPER}}.ob-commentz #comments #reply-title',
841
  'condition' => [
842
  '_ob_commentz_use' => 'yes',
1012
  [
1013
  'name' => '_ob_navig_typo',
1014
  'label' => __( 'Comments Nav', 'ooohboi-steroids' ),
1015
+ 'scheme' => Typography::TYPOGRAPHY_3,
1016
  'selector' => '{{WRAPPER}}.ob-commentz #comments .nav-links',
1017
  'condition' => [
1018
  '_ob_commentz_use' => 'yes',
1052
  );
1053
 
1054
  $element->end_popover(); // popover Comment form styles end
1055
+
1056
+ // ------------------------------------------------------------------------- CONTROL: Hide URL field, since 1.7.3
1057
+ $element->add_control(
1058
+ '_ob_commentz_hide_URL',
1059
+ [
1060
+ 'label' => __( 'Hide the Website input field?', 'ooohboi-steroids' ),
1061
+ 'description' => __( 'If you make it hidden, be sure it\'s not mandatory otherwise the comment can not be posted!', 'ooohboi-steroids' ),
1062
+ 'type' => Controls_Manager::SWITCHER,
1063
+ 'separator' => 'before',
1064
+ 'label_on' => __( 'Yes', 'ooohboi-steroids' ),
1065
+ 'label_off' => __( 'No', 'ooohboi-steroids' ),
1066
+ 'return_value' => 'none',
1067
+ 'default' => 'inherit',
1068
+ 'selectors' => [
1069
+ '{{WRAPPER}}.ob-commentz #commentform .comment-form-url' => 'display: {{VALUE}};',
1070
+ ],
1071
+ 'condition' => [
1072
+ '_ob_commentz_use' => 'yes',
1073
+ ],
1074
+ ]
1075
+ );
1076
 
1077
  $element->end_controls_section();
1078
 
controls/ooohboi-harakiri.php CHANGED
@@ -82,7 +82,7 @@ class OoohBoi_Harakiri {
82
  'selectors' => [
83
  '{{WRAPPER}}.ob-harakiri' => 'writing-mode: {{VALUE}};',
84
  '{{WRAPPER}}.ob-harakiri .elementor-heading-title' => 'writing-mode: {{VALUE}};',
85
- '{{WRAPPER}}.ob-harakiri .elementor-text-editor' => 'writing-mode: {{VALUE}};',
86
  ],
87
  ]
88
  );
@@ -101,13 +101,13 @@ class OoohBoi_Harakiri {
101
  ],
102
  'selectors' => [
103
  '{{WRAPPER}}.ob-harakiri .elementor-heading-title' => 'transform: rotate(180deg);',
104
- '{{WRAPPER}}.ob-harakiri .elementor-text-editor' => 'transform: rotate(180deg);',
105
  ],
106
  'device_args' => [
107
  Controls_Stack::RESPONSIVE_TABLET => [
108
  'selectors' => [
109
  '{{WRAPPER}}.ob-harakiri .elementor-heading-title' => 'transform: rotate(180deg);',
110
- '{{WRAPPER}}.ob-harakiri .elementor-text-editor' => 'transform: rotate(180deg);',
111
  ],
112
  'condition' => [
113
  '_ob_harakiri_writing_mode_tablet!' => 'inherit',
@@ -116,7 +116,7 @@ class OoohBoi_Harakiri {
116
  Controls_Stack::RESPONSIVE_MOBILE => [
117
  'selectors' => [
118
  '{{WRAPPER}}.ob-harakiri .elementor-heading-title' => 'transform: rotate(180deg);',
119
- '{{WRAPPER}}.ob-harakiri .elementor-text-editor' => 'transform: rotate(180deg);',
120
  ],
121
  'condition' => [
122
  '_ob_harakiri_writing_mode_mobile!' => 'inherit',
@@ -142,7 +142,7 @@ class OoohBoi_Harakiri {
142
  'selectors' => [
143
  '{{WRAPPER}}.ob-harakiri' => 'inline-size: {{VALUE}}; width: unset;',
144
  '{{WRAPPER}}.ob-harakiri .elementor-heading-title' => 'inline-size: {{VALUE}};',
145
- '{{WRAPPER}}.ob-harakiri .elementor-text-editor' => 'inline-size: {{VALUE}};',
146
  ],
147
  'condition' => [
148
  '_ob_harakiri_writing_mode!' => 'inherit',
82
  'selectors' => [
83
  '{{WRAPPER}}.ob-harakiri' => 'writing-mode: {{VALUE}};',
84
  '{{WRAPPER}}.ob-harakiri .elementor-heading-title' => 'writing-mode: {{VALUE}};',
85
+ '{{WRAPPER}}.ob-harakiri .elementor-widget-container > div' => 'writing-mode: {{VALUE}};',
86
  ],
87
  ]
88
  );
101
  ],
102
  'selectors' => [
103
  '{{WRAPPER}}.ob-harakiri .elementor-heading-title' => 'transform: rotate(180deg);',
104
+ '{{WRAPPER}}.ob-harakiri .elementor-widget-container > div' => 'transform: rotate(180deg);',
105
  ],
106
  'device_args' => [
107
  Controls_Stack::RESPONSIVE_TABLET => [
108
  'selectors' => [
109
  '{{WRAPPER}}.ob-harakiri .elementor-heading-title' => 'transform: rotate(180deg);',
110
+ '{{WRAPPER}}.ob-harakiri .elementor-widget-container > div' => 'transform: rotate(180deg);',
111
  ],
112
  'condition' => [
113
  '_ob_harakiri_writing_mode_tablet!' => 'inherit',
116
  Controls_Stack::RESPONSIVE_MOBILE => [
117
  'selectors' => [
118
  '{{WRAPPER}}.ob-harakiri .elementor-heading-title' => 'transform: rotate(180deg);',
119
+ '{{WRAPPER}}.ob-harakiri .elementor-widget-container > div' => 'transform: rotate(180deg);',
120
  ],
121
  'condition' => [
122
  '_ob_harakiri_writing_mode_mobile!' => 'inherit',
142
  'selectors' => [
143
  '{{WRAPPER}}.ob-harakiri' => 'inline-size: {{VALUE}}; width: unset;',
144
  '{{WRAPPER}}.ob-harakiri .elementor-heading-title' => 'inline-size: {{VALUE}};',
145
+ '{{WRAPPER}}.ob-harakiri .elementor-widget-container > div' => 'inline-size: {{VALUE}};',
146
  ],
147
  'condition' => [
148
  '_ob_harakiri_writing_mode!' => 'inherit',
controls/ooohboi-locomotion.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ use Elementor\Controls_Manager;
3
+ use Elementor\Element_Base;
4
+ use Elementor\Controls_Stack;
5
+ use Elementor\Plugin;
6
+
7
+ if ( ! defined( 'ABSPATH' ) ) exit;
8
+
9
+ /**
10
+ * Main OoohBoi Locomotion Class
11
+ *
12
+ * The main class that initiates and runs the plugin.
13
+ *
14
+ * @since 1.7.3
15
+ */
16
+ class OoohBoi_Locomotion {
17
+
18
+
19
+ public function __construct() {
20
+
21
+ add_action( 'elementor/element/common/_section_background/after_section_end', [ $this, 'ob_attributes_controls_section' ] );
22
+ add_action( 'elementor/element/section/section_advanced/after_section_end', [ $this, 'ob_attributes_controls_section' ] );
23
+ add_action( 'elementor/element/column/section_advanced/after_section_end', [ $this, 'ob_attributes_controls_section' ] );
24
+ add_action( 'elementor/frontend/before_render', [ $this, 'ob_render_attributes' ] );
25
+
26
+ }
27
+
28
+ public function ob_attributes_controls_section( Element_Base $element ) {
29
+
30
+ $element->start_controls_section(
31
+ '_ob_loco_title_section',
32
+ [
33
+ 'label' => 'L O C O M O T I O N',
34
+ 'tab' => Controls_Manager::TAB_ADVANCED,
35
+ ]
36
+ );
37
+
38
+ $element->add_control(
39
+ '_ob_loco_attributes',
40
+ [
41
+ 'label' => __( 'Custom Attributes', 'ooohboi-steroids' ),
42
+ 'type' => Controls_Manager::TEXTAREA,
43
+ 'dynamic' => [
44
+ 'active' => true,
45
+ ],
46
+ 'separator' => 'before',
47
+ 'render_type' => 'none',
48
+ 'classes' => 'elementor-control-direction-ltr',
49
+ 'placeholder' => __( 'key|value', 'ooohboi-steroids' ),
50
+ 'description' => sprintf( __( 'Set custom attributes for the current element/widget. Each attribute must be in a separate line! The attribute key and the value MUST be separated by the pipe character, i.e. data-scroll-offset%s100,50em', 'ooohboi-steroids' ), '<code>|</code>' ),
51
+ ]
52
+ );
53
+
54
+ $element->end_controls_section();
55
+
56
+ }
57
+
58
+ public function ob_render_attributes( $element ) {
59
+
60
+ $settings = $element->get_settings_for_display();
61
+
62
+ if( isset( $settings[ '_ob_loco_attributes' ] ) && ! empty( $settings[ '_ob_loco_attributes' ] ) ) {
63
+
64
+ $attributes = $this->parse_custom_attributes( $settings[ '_ob_loco_attributes' ], "\n" );
65
+ $black_list = $this->get_banned_attributes();
66
+
67
+ foreach( $attributes as $attribute => $value ) {
68
+ if( ! in_array( $attribute, $black_list, true ) ) {
69
+ $element->add_render_attribute( '_wrapper', $attribute, $value );
70
+ }
71
+ }
72
+
73
+ }
74
+
75
+ }
76
+
77
+ private function parse_custom_attributes( $attributes_string, $delimiter = ',' ) {
78
+
79
+ $attributes = explode( $delimiter, $attributes_string );
80
+ $result = [];
81
+
82
+ foreach( $attributes as $attribute ) {
83
+
84
+ $attr_key_value = explode( '|', $attribute );
85
+ $attr_key = mb_strtolower( $attr_key_value[ 0 ] );
86
+
87
+ preg_match( '/[-_a-z0-9]+/', $attr_key, $attr_key_matches );
88
+ if( empty( $attr_key_matches[ 0 ] ) ) continue;
89
+
90
+ $attr_key = $attr_key_matches[ 0 ];
91
+ if( 'href' === $attr_key || 'on' === substr( $attr_key, 0, 2 ) ) continue;
92
+
93
+ if( isset( $attr_key_value[ 1 ] ) ) $attr_value = trim( $attr_key_value[ 1 ] );
94
+ else $attr_value = '';
95
+
96
+ $result[ $attr_key ] = $attr_value;
97
+ }
98
+
99
+ return $result;
100
+
101
+ }
102
+
103
+ private function get_banned_attributes() {
104
+
105
+ static $banned = NULL;
106
+ if( NULL === $banned ) $banned = [ 'id', 'class', 'data-id', 'data-settings', 'data-element_type', 'data-widget_type', 'data-model-cid' ];
107
+
108
+ return $banned;
109
+
110
+ }
111
+
112
+ }
controls/ooohboi-photogiraffe.php CHANGED
@@ -49,8 +49,8 @@ class OoohBoi_PhotoGiraffe {
49
  'default' => false,
50
  'separator' => 'before',
51
  'selectors' => [
52
- '{{WRAPPER}}, {{WRAPPER}} .elementor-widget-container, {{WRAPPER}} .elementor-image, {{WRAPPER}} .elementor-image > a' => 'height: 100%;',
53
- '{{WRAPPER}} .elementor-image img' => 'object-fit: cover; object-position: 50% 50%; height: 100%;',
54
  ],
55
  ]
56
  );
49
  'default' => false,
50
  'separator' => 'before',
51
  'selectors' => [
52
+ '{{WRAPPER}}, {{WRAPPER}} .elementor-widget-container, {{WRAPPER}} .elementor-widget-container > a, {{WRAPPER}} .elementor-image, {{WRAPPER}} .elementor-image > a' => 'height: 100%;',
53
+ '{{WRAPPER}} .elementor-image > img, {{WRAPPER}} .elementor-widget-container > img' => 'object-fit: cover; object-position: 50% 50%; height: 100%;',
54
  ],
55
  ]
56
  );
controls/ooohboi-teleporter.php CHANGED
@@ -288,7 +288,7 @@ class OoohBoi_Teleporter {
288
  ]
289
  );
290
  // ------------------------------------------------------------------------- CONTROL: Overlay COLOR
291
- $element->add_responsive_control(
292
  '_ob_teleporter_overlay_color',
293
  [
294
  'label' => __( 'Overlay Color', 'ooohboi-steroids' ),
288
  ]
289
  );
290
  // ------------------------------------------------------------------------- CONTROL: Overlay COLOR
291
+ $element->add_control(
292
  '_ob_teleporter_overlay_color',
293
  [
294
  'label' => __( 'Overlay Color', 'ooohboi-steroids' ),
inc/common-functions.php CHANGED
@@ -6,163 +6,280 @@ if( ! defined( 'ABSPATH' ) ) exit;
6
  define( 'SFE_DIR_PATH', plugin_dir_path( __FILE__ ) );
7
  define( 'SFE_DIR_URL', plugin_dir_url( __FILE__ ) );
8
 
9
- $options_page = array(
10
- 'ob-landing-page' => array(
11
- 'page_title' => __( 'Steroids for Elementor', 'ooohboi-steroids' ),
12
- 'icon_url' => 'https://ooohboi.space/wp-content/plugins/ooohboi-steroids-for-elementor/assets/img/ooohboi-poopart-icon.png',
13
- 'subpages' => array(
14
- 'ob-settings-page' => array(
15
- 'page_title' => 'Settings',
16
- 'parent_slug' => 'ob_landing_page',
17
- 'sections' => array(
18
- 'section-ob-options' => array(
19
- 'title' => 'Settings',
20
- 'text' => __( '<p>The following extensions are currently available with Steroids for Elementor add-on.<br/>Enable or disable particular extension by switching it ON or OFF.</p>', 'ooohboi-steroids' ),
21
- 'fields' => array(
22
- 'ob_use_harakiri' => array(
23
- 'title' => 'HARAKIRI',
24
- 'type' => 'checkbox',
25
- 'text' => sprintf( __( '%sAllows you to change the writing mode of the Heading and Text Editor widgets%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
26
- 'checked' => 1,
27
- ),
28
- 'ob_use_poopart' => array(
29
- 'title' => 'POOPART',
30
- 'type' => 'checkbox',
31
- 'text' => sprintf( __( '%sAdd an overlay or underlay ghost-element to any Elementor Widget%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
32
- 'checked' => 1,
33
- ),
34
- 'ob_use_overlaiz' => array(
35
- 'title' => 'OVERLAIZ',
36
- 'type' => 'checkbox',
37
- 'text' => sprintf( __( '%sAn awesome set of options for the Background Overlay element manipulation%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
38
- 'checked' => 1,
39
- ),
40
- 'ob_use_paginini' => array(
41
- 'title' => 'PAGININI',
42
- 'type' => 'checkbox',
43
- 'text' => sprintf( __( '%sIt allows you to style up the posts pagination in Elementor%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
44
- 'checked' => 1,
45
- ),
46
- 'ob_use_breakingbad' => array(
47
- 'title' => 'BREAKING BAD',
48
- 'type' => 'checkbox',
49
- 'text' => sprintf( __( '%sA must to have extension for the Section and Columns%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
50
- 'checked' => 1,
51
- ),
52
- 'ob_use_glider' => array(
53
- 'title' => 'GLIDER',
54
- 'type' => 'checkbox',
55
- 'text' => sprintf( __( '%sThe content slider made out of Section and Columns (Swiper)%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
56
- 'checked' => 1,
57
- ),
58
- 'ob_use_photogiraffe' => array(
59
- 'title' => 'PHOTOGIRAFFE',
60
- 'type' => 'checkbox',
61
- 'text' => sprintf( __( '%sMake the Image widget full-height of the container%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
62
- 'checked' => 1,
63
- ),
64
- 'ob_use_teleporter' => array(
65
- 'title' => 'TELEPORTER',
66
- 'type' => 'checkbox',
67
- 'text' => sprintf( __( '%sThe Column hover controls for an exceptional effects%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
68
- 'checked' => 1,
69
- ),
70
- 'ob_use_searchcop' => array(
71
- 'title' => 'SEARCH COP',
72
- 'type' => 'checkbox',
73
- 'text' => sprintf( __( '%sDecide what to search for; posts only, pages only or everything%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
74
- 'checked' => 1,
75
- ),
76
- 'ob_use_videomasq' => array(
77
- 'title' => 'VIDEOMASQ',
78
- 'type' => 'checkbox',
79
- 'text' => sprintf( __( '%sAdd the SVG mask to the Section video background and let the video play inside any shape%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
80
- 'checked' => 1,
81
- ),
82
- 'ob_use_butterbutton' => array(
83
- 'title' => 'BUTTER BUTTON',
84
- 'type' => 'checkbox',
85
- 'text' => sprintf( __( '%sDesign awesome buttons in Elementor%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
86
- 'checked' => 1,
87
- ),
88
- 'ob_use_perspektive' => array(
89
- 'title' => 'PERSPEKTIVE',
90
- 'type' => 'checkbox',
91
- 'text' => sprintf( __( '%sA small set of options that allow you to move widgets in 3D space%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
92
- 'checked' => 1,
93
- ),
94
- 'ob_use_shadough' => array(
95
- 'title' => 'SHADOUGH',
96
- 'type' => 'checkbox',
97
- 'text' => sprintf( __( '%sCreate the shadow that conforms the shape%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
98
- 'checked' => 1,
99
- ),
100
- 'ob_use_photomorph' => array(
101
- 'title' => 'PHOTO MORPH',
102
- 'type' => 'checkbox',
103
- 'text' => sprintf( __( '%sAllows you to add the clip-path to the Image widget for Normal and Hover state%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
104
- 'checked' => 1,
105
- ),
106
- 'ob_use_commentz' => array(
107
- 'title' => 'COMMENTZ',
108
- 'type' => 'checkbox',
109
- 'text' => sprintf( __( '%sAllows you to style up the post comments.', 'ooohboi-steroids%s' ), '<span class="ob-option-desc">', '</span>' ),
110
- 'checked' => 1,
111
- ),
112
- 'ob_use_spacerat' => array(
113
- 'title' => 'SPACERAT',
114
- 'type' => 'checkbox',
115
- 'text' => sprintf( __( '%sAdds new shine to the Spacer widget.', 'ooohboi-steroids%s' ), '<span class="ob-option-desc">', '</span>' ),
116
- 'checked' => 1,
117
- ),
118
- 'ob_use_imbox' => array(
119
- 'title' => 'IMBOX',
120
- 'type' => 'checkbox',
121
- 'text' => sprintf( __( '%sImage Box widget extra controls', 'ooohboi-steroids%s' ), '<span class="ob-option-desc">', '</span>' ),
122
- 'checked' => 1,
123
- ),
124
- 'ob_use_icobox' => array(
125
- 'title' => 'ICOBOX',
126
- 'type' => 'checkbox',
127
- 'text' => sprintf( __( '%sIcon Box widget extra controls', 'ooohboi-steroids%s' ), '<span class="ob-option-desc">', '</span>' ),
128
- 'checked' => 1,
129
- ),
130
- 'ob_use_hoveranimator' => array(
131
- 'title' => 'HOVER ANIMATOR',
132
- 'type' => 'checkbox',
133
- 'text' => sprintf( __( '%sAnimate widgets on columns mouse-over event', 'ooohboi-steroids%s' ), '<span class="ob-option-desc">', '</span>' ),
134
- 'checked' => 1,
135
- ),
136
- 'ob_use_kontrolz' => array(
137
- 'title' => 'KONTROLZ',
138
- 'type' => 'checkbox',
139
- 'text' => sprintf( __( '%sAllows you to additionaly style Image Carousel and Media Carousel controls%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
140
- 'checked' => 1,
141
- ),
142
- 'ob_use_widget_stalker' => array(
143
- 'title' => 'WIDGET STALKER',
144
- 'type' => 'checkbox',
145
- 'text' => sprintf( __( '%sStack widgets like flex elements%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
146
- 'checked' => 1,
147
- ),
148
- 'ob_use_pseudo' => array(
149
- 'title' => 'PSEUDO',
150
- 'type' => 'checkbox',
151
- 'text' => sprintf( __( '%sTake control over the Column\'s pseudo elements%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
152
- 'checked' => 1,
153
- ),
154
- ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  ),
157
  ),
158
- ),
159
- 'sections' => array(
160
- 'section-one' => array(
161
- 'title' => ' ',
162
- 'text' => '',
163
- 'include' => SFE_DIR_PATH . 'info/ob-landing.php',
164
- ),
165
- ),
166
- ),
 
 
 
 
 
 
 
 
167
  );
168
- $option_page = new RationalOptionPages( $options_page );
 
6
  define( 'SFE_DIR_PATH', plugin_dir_path( __FILE__ ) );
7
  define( 'SFE_DIR_URL', plugin_dir_url( __FILE__ ) );
8
 
9
+ ob_start();
10
+ // news content
11
+ include( SFE_DIR_PATH . 'info/ob-landing.php' );
12
+ $news_content = ob_get_clean();
13
+
14
+ // --------------------------- E X O P I T ----- >
15
+ $config_submenu = array(
16
+
17
+ 'type' => 'menu', // Required, menu or metabox
18
+ 'title' => 'Steroids for Elementor v' . OoohBoi_Steroids::VERSION, // options panel title
19
+ 'menu_title' => 'Steroids for Elementor', // admin menu title
20
+ 'icon' => SFE_DIR_URL . 'img/ooohboi-poopart-icon.png',
21
+ 'id' => 'steroids_for_elementor', // Required, meta box id, unique per page, to save: get_option( id )
22
+ 'parent' => 'edit.php?post_type=steroids_for_elementor', // Parent page of plugin menu (default Settings [options-general.php])
23
+ 'submenu' => false,
24
+ 'search_box' => false,
25
+ 'capability' => 'manage_options',
26
+ 'plugin_basename' => plugin_basename( plugin_dir_path( __DIR__ ) . 'ooohboi-steroids-for-elementor.php' ),
27
+ 'tabbed' => true,
28
+ 'multilang' => false,
29
+
30
+ );
31
+
32
+ $fields[] = array(
33
+ 'name' => 'sfe_home',
34
+ 'title' => esc_attr__( 'What\'s New?', 'ooohboi-steroids' ),
35
+ 'icon' => 'dashicons-format-status',
36
+ 'fields' => array(
37
+ array(
38
+ 'id' => 'sfe_home_news',
39
+ 'type' => 'content',
40
+ 'content' => $news_content,
41
+ ),
42
+ ),
43
+ );
44
+
45
+ $fields[] = array(
46
+ 'name' => 'sfe_extensions',
47
+ 'title' => esc_attr__( 'Manage Extensions', 'ooohboi-steroids' ),
48
+ 'icon' => 'dashicons-admin-plugins',
49
+ 'fields' => array(
50
+ array(
51
+ 'id' => 'sfe_extensions_intro',
52
+ 'type' => 'content',
53
+ 'content' => sprintf( __( '%sThe following extensions are currently available with Steroids for Elementor add-on. Enable or disable particular extension by switching it ON or OFF.%s', 'ooohboi-steroids' ), '<p>', '</p>' ),
54
+ 'class' => 'sfe-intro',
55
+ ),
56
+ array(
57
+ 'id' => 'ob_use_harakiri',
58
+ 'title' => 'HARAKIRI',
59
+ 'type' => 'switcher',
60
+ 'description' => sprintf( __( '%sAllows you to change the writing mode of the Heading and Text Editor widgets%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
61
+ 'default' => 'yes',
62
+ ),
63
+ array(
64
+ 'id' => 'ob_use_poopart',
65
+ 'title' => 'POOPART',
66
+ 'type' => 'switcher',
67
+ 'description' => sprintf( __( '%sAdd an overlay or underlay ghost-element to any Elementor Widget%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
68
+ 'default' => 'yes',
69
+ ),
70
+ array(
71
+ 'id' => 'ob_use_overlaiz',
72
+ 'title' => 'OVERLAIZ',
73
+ 'type' => 'switcher',
74
+ 'description' => sprintf( __( '%sAn awesome set of options for the Background Overlay element manipulation%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
75
+ 'default' => 'yes',
76
+ ),
77
+ array(
78
+ 'id' => 'ob_use_paginini',
79
+ 'title' => 'PAGININI',
80
+ 'type' => 'switcher',
81
+ 'description' => sprintf( __( '%sIt allows you to style up the posts pagination in Elementor%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
82
+ 'default' => 'yes',
83
+ ),
84
+ array(
85
+ 'id' => 'ob_use_breakingbad',
86
+ 'title' => 'BREAKING BAD',
87
+ 'type' => 'switcher',
88
+ 'description' => sprintf( __( '%sA must to have extension for the Section and Columns%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
89
+ 'default' => 'yes',
90
+ ),
91
+ array(
92
+ 'id' => 'ob_use_glider',
93
+ 'title' => 'GLIDER',
94
+ 'type' => 'switcher',
95
+ 'description' => sprintf( __( '%sThe content slider made out of Section and Columns (Swiper)%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
96
+ 'default' => 'yes',
97
+ ),
98
+ array(
99
+ 'id' => 'ob_use_photogiraffe',
100
+ 'title' => 'PHOTOGIRAFFE',
101
+ 'type' => 'switcher',
102
+ 'description' => sprintf( __( '%sMake the Image widget full-height of the container%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
103
+ 'default' => 'yes',
104
+ ),
105
+ array(
106
+ 'id' => 'ob_use_teleporter',
107
+ 'title' => 'TELEPORTER',
108
+ 'type' => 'switcher',
109
+ 'description' => sprintf( __( '%sThe Column hover controls for an exceptional effects%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
110
+ 'default' => 'yes',
111
+ ),
112
+ array(
113
+ 'id' => 'ob_use_searchcop',
114
+ 'title' => 'SEARCH COP',
115
+ 'type' => 'switcher',
116
+ 'description' => sprintf( __( '%sDecide what to search for; posts only, pages only or everything%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
117
+ 'default' => 'yes',
118
+ ),
119
+ array(
120
+ 'id' => 'ob_use_videomasq',
121
+ 'title' => 'VIDEOMASQ',
122
+ 'type' => 'switcher',
123
+ 'description' => sprintf( __( '%sAdd the SVG mask to the Section video background and let the video play inside any shape%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
124
+ 'default' => 'yes',
125
+ ),
126
+ array(
127
+ 'id' => 'ob_use_butterbutton',
128
+ 'title' => 'BUTTER BUTTON',
129
+ 'type' => 'switcher',
130
+ 'description' => sprintf( __( '%sDesign awesome buttons in Elementor%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
131
+ 'default' => 'yes',
132
+ ),
133
+ array(
134
+ 'id' => 'ob_use_perspektive',
135
+ 'title' => 'PERSPEKTIVE',
136
+ 'type' => 'switcher',
137
+ 'description' => sprintf( __( '%sA small set of options that allow you to move widgets in 3D space%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
138
+ 'default' => 'yes',
139
+ ),
140
+ array(
141
+ 'id' => 'ob_use_shadough',
142
+ 'title' => 'SHADOUGH',
143
+ 'type' => 'switcher',
144
+ 'description' => sprintf( __( '%sCreate the shadow that conforms the shape%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
145
+ 'default' => 'yes',
146
+ ),
147
+ array(
148
+ 'id' => 'ob_use_photomorph',
149
+ 'title' => 'PHOTOMORPH',
150
+ 'type' => 'switcher',
151
+ 'description' => sprintf( __( '%sAllows you to add the clip-path to the Image widget for Normal and Hover state%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
152
+ 'default' => 'yes',
153
+ ),
154
+ array(
155
+ 'id' => 'ob_use_commentz',
156
+ 'title' => 'COMMENTZ',
157
+ 'type' => 'switcher',
158
+ 'description' => sprintf( __( '%sAllows you to style up the post comments.', 'ooohboi-steroids%s' ), '<span class="ob-option-desc">', '</span>' ),
159
+ 'default' => 'yes',
160
+ ),
161
+ array(
162
+ 'id' => 'ob_use_spacerat',
163
+ 'title' => 'SPACERAT',
164
+ 'type' => 'switcher',
165
+ 'description' => sprintf( __( '%sAdds new shine to the Spacer widget.', 'ooohboi-steroids%s' ), '<span class="ob-option-desc">', '</span>' ),
166
+ 'default' => 'yes',
167
+ ),
168
+ array(
169
+ 'id' => 'ob_use_imbox',
170
+ 'title' => 'IMBOX',
171
+ 'type' => 'switcher',
172
+ 'description' => sprintf( __( '%sImage Box widget extra controls', 'ooohboi-steroids%s' ), '<span class="ob-option-desc">', '</span>' ),
173
+ 'default' => 'yes',
174
+ ),
175
+ array(
176
+ 'id' => 'ob_use_icobox',
177
+ 'title' => 'ICOBOX',
178
+ 'type' => 'switcher',
179
+ 'description' => sprintf( __( '%sIcon Box widget extra controls', 'ooohboi-steroids%s' ), '<span class="ob-option-desc">', '</span>' ),
180
+ 'default' => 'yes',
181
+ ),
182
+ array(
183
+ 'id' => 'ob_use_hoveranimator',
184
+ 'title' => 'HOVERANIMATOR',
185
+ 'type' => 'switcher',
186
+ 'description' => sprintf( __( '%sAnimate widgets on columns mouse-over event', 'ooohboi-steroids%s' ), '<span class="ob-option-desc">', '</span>' ),
187
+ 'default' => 'yes',
188
+ ),
189
+ array(
190
+ 'id' => 'ob_use_kontrolz',
191
+ 'title' => 'KONTROLZ',
192
+ 'type' => 'switcher',
193
+ 'description' => sprintf( __( '%sAllows you to additionaly style Image Carousel and Media Carousel controls%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
194
+ 'default' => 'yes',
195
+ ),
196
+ array(
197
+ 'id' => 'ob_use_widgetstalker',
198
+ 'title' => 'WIDGET STALKER',
199
+ 'type' => 'switcher',
200
+ 'description' => sprintf( __( '%sStack widgets like flex elements%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
201
+ 'default' => 'yes',
202
+ ),
203
+ array(
204
+ 'id' => 'ob_use_pseudo',
205
+ 'title' => 'PSEUDO',
206
+ 'type' => 'switcher',
207
+ 'description' => sprintf( __( '%sTake control over the Column\'s pseudo elements%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
208
+ 'default' => 'yes',
209
+ ),
210
+ ),
211
+ );
212
+
213
+ $fields[] = array(
214
+ 'name' => 'sfe_libraries',
215
+ 'title' => esc_attr__( 'Manage JS Libraries', 'ooohboi-steroids' ),
216
+ 'icon' => 'dashicons-edit-page',
217
+ 'fields' => array(
218
+ array(
219
+ 'id' => 'sfe_libraries_intro',
220
+ 'type' => 'content',
221
+ 'content' => sprintf( __( '%sThe following libraries are currently available with Steroids for Elementor add-on. Enable or disable particular library by switching it ON or OFF.%s', 'ooohboi-steroids' ), '<p>', '</p>' ),
222
+ 'class' => 'sfe-intro',
223
+ ),
224
+ array(
225
+ 'type' => 'fieldset',
226
+ 'id' => 'fieldset_locomotive',
227
+ 'title' => esc_html__( 'LOCOMOTIVE SCROLL', 'ooohboi-steroids' ),
228
+ 'description' => sprintf( __( '%1$sDetection of elements in viewport and smooth scrolling with parallax.%3$s%4$sSOURCE%5$s%2$s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>', '<br />', '<a href="https://github.com/locomotivemtl/locomotive-scroll" title="Locomotive Scroll Github" target="_blank">', '</a>' ),
229
+ 'fields' => array(
230
+ array(
231
+ 'id' => 'ob_use_locomotive_scroll',
232
+ 'type' => 'switcher',
233
+ 'default' => 'no',
234
+ ),
235
+ array(
236
+ 'id' => 'ob_use_locomotive_devices',
237
+ 'type' => 'tap_list',
238
+ 'options' => array(
239
+ 'allow-tablet' => esc_html__( 'Enable for Tablets', 'ooohboi-steroids' ),
240
+ 'allow-mobile' => esc_html__( 'Enable for Mobiles', 'ooohboi-steroids' ),
241
  ),
242
+ 'default' => array(
243
+ 'allow-tablet',
244
+ 'allow-mobile'
245
+ ),
246
+ ),
247
+ array(
248
+ 'id' => 'ob_use_locomotive_multiplier',
249
+ 'title' => esc_html__( 'Multiplier', 'ooohboi-steroids' ),
250
+ 'description' => sprintf( __( '%sBoost/reduce scrolling speed. 1 is the default.%s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>' ),
251
+ 'type' => 'range',
252
+ 'default' => '1',
253
+ 'min' => '0.1',
254
+ 'max' => '10',
255
+ 'step' => '0.1',
256
+ ),
257
+ array(
258
+ 'id' => 'ob_allow_refresh',
259
+ 'title' => esc_html__( 'Refresh on resize?', 'ooohboi-steroids' ),
260
+ 'description' => esc_html__( 'Things get messy on resize. That will do the page refresh upon the window resize/orientationchange.', 'ooohboi-steroids' ),
261
+ 'type' => 'checkbox',
262
+ 'default' => 'no',
263
+ 'style' => 'fancy',
264
  ),
265
  ),
266
+ ),
267
+ array(
268
+ 'id' => 'ob_use_gsap',
269
+ 'title' => 'GSAP',
270
+ 'type' => 'switcher',
271
+ 'description' => sprintf( __( '%1$sGreenSock\'s GSAP JavaScript animation library (including Draggable).%3$s%4$sSOURCE%5$s%2$s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>', '<br />', '<a href="https://github.com/greensock/GSAP" title="GSAP Github" target="_blank">', '</a>' ),
272
+ 'default' => 'no',
273
+ ),
274
+ array(
275
+ 'id' => 'ob_use_scroll_trigger',
276
+ 'title' => 'SCROLL TRIGGER',
277
+ 'type' => 'switcher',
278
+ 'description' => sprintf( __( '%1$sLet your page react to scroll changes.%3$s%4$sSOURCE%5$s%2$s', 'ooohboi-steroids' ), '<span class="ob-option-desc">', '</span>', '<br />', '<a href="https://github.com/terwanerik/ScrollTrigger" title="Scroll Trigger Github" target="_blank">', '</a>' ),
279
+ 'default' => 'no',
280
+ ),
281
+
282
+ ),
283
  );
284
+
285
+ $options_panel = new Exopite_Simple_Options_Framework( $config_submenu, $fields );
inc/exopite-simple-options/assets/ace-loader.min.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ (function($,window,document,undefined){$.fn.exopiteSofFieldACEEditor=function(){return this.each(function(index){if(typeof ace!=='undefined'){var $this=$(this),$textarea=$this.find('.exopite-sof-ace-editor-textarea'),options=JSON.parse($this.find('.exopite-sof-ace-editor-options').val()),plugin=this,editor=ace.edit($this.find('.exopite-sof-ace-editor').attr('id'));editor.getSession().setValue($textarea.val());editor.setOptions(options);editor.on('change',function(e){$textarea.val(editor.getSession().getValue()).trigger('change')});$('.exopite-sof-group').on('exopite-sof-field-group-item-added-before',function(event,$cloned,$group){if($cloned.find('.exopite-sof-ace-editor').length!==0){plugin.musterID=$group.find('.exopite-sof-cloneable__muster .exopite-sof-ace-editor').first().attr('id')+'-';var count=parseInt($group.find('.exopite-sof-ace-editor').filter(function(){return($(this).parents().not('.exopite-sof-cloneable__muster'))}).length);$cloned.find('.exopite-sof-ace-editor').each(function(index,el){$(el).attr('id',plugin.musterID+(count+index))})}});$('.exopite-sof-group').on('exopite-sof-field-group-item-added-after',function(event,$cloned){$cloned.find('.exopite-sof-field-ace_editor').exopiteSofFieldACEEditor()})}})};$(document).ready(function(){if(typeof ace!=='undefined'){var musterID='';$('.exopite-sof-field-group').find('.exopite-sof-field-ace_editor').each(function(index,el){if(!$(this).parents('.exopite-sof-cloneable__muster').length){var $thisEditor=$(this).find('.exopite-sof-ace-editor');var thisId=$thisEditor.attr('id');$thisEditor.attr('id',thisId+'-'+index)}})}
2
+ $('.exopite-sof-field-ace_editor').exopiteSofFieldACEEditor()})})(jQuery,window,document)
inc/exopite-simple-options/assets/chosen-sprite.png ADDED
Binary file
inc/exopite-simple-options/assets/chosen-sprite@2x.png ADDED
Binary file
inc/exopite-simple-options/assets/chosen.jquery.min.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ /* Chosen v1.8.7 | (c) 2011-2018 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
2
+ (function(){var t,e,s,i,r=function(t,e){return function(){return t.apply(e,arguments)}},n={}.hasOwnProperty;(i=function(){function t(){this.options_index=0,this.parsed=[]}return t.prototype.add_node=function(t){return"OPTGROUP"===t.nodeName.toUpperCase()?this.add_group(t):this.add_option(t)},t.prototype.add_group=function(t){var e,s,i,r,n,o;for(e=this.parsed.length,this.parsed.push({array_index:e,group:!0,label:t.label,title:t.title?t.title:void 0,children:0,disabled:t.disabled,classes:t.className}),o=[],s=0,i=(n=t.childNodes).length;s<i;s++)r=n[s],o.push(this.add_option(r,e,t.disabled));return o},t.prototype.add_option=function(t,e,s){if("OPTION"===t.nodeName.toUpperCase())return""!==t.text?(null!=e&&(this.parsed[e].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:t.value,text:t.text,html:t.innerHTML,title:t.title?t.title:void 0,selected:t.selected,disabled:!0===s?s:t.disabled,group_array_index:e,group_label:null!=e?this.parsed[e].label:null,classes:t.className,style:t.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},t}()).select_to_array=function(t){var e,s,r,n,o;for(n=new i,s=0,r=(o=t.childNodes).length;s<r;s++)e=o[s],n.add_node(e);return n.parsed},e=function(){function t(e,s){this.form_field=e,this.options=null!=s?s:{},this.label_click_handler=r(this.label_click_handler,this),t.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return t.prototype.set_default_values=function(){var t;return this.click_test_action=(t=this,function(e){return t.test_active_click(e)}),this.activate_action=function(t){return function(e){return t.activate_field(e)}}(this),this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.is_rtl=this.options.rtl||/\bchosen-rtl\b/.test(this.form_field.className),this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text&&this.options.allow_single_deselect,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null==this.options.enable_split_word_search||this.options.enable_split_word_search,this.group_search=null==this.options.group_search||this.options.group_search,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null==this.options.single_backstroke_delete||this.options.single_backstroke_delete,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null==this.options.display_selected_options||this.options.display_selected_options,this.display_disabled_options=null==this.options.display_disabled_options||this.options.display_disabled_options,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1,this.max_shown_results=this.options.max_shown_results||Number.POSITIVE_INFINITY,this.case_sensitive_search=this.options.case_sensitive_search||!1,this.hide_results_on_select=null==this.options.hide_results_on_select||this.options.hide_results_on_select},t.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||t.default_multiple_text:this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||t.default_single_text,this.default_text=this.escape_html(this.default_text),this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||t.default_no_result_text},t.prototype.choice_label=function(t){return this.include_group_label_in_selected&&null!=t.group_label?"<b class='group-name'>"+this.escape_html(t.group_label)+"</b>"+t.html:t.html},t.prototype.mouse_enter=function(){return this.mouse_on_container=!0},t.prototype.mouse_leave=function(){return this.mouse_on_container=!1},t.prototype.input_focus=function(t){if(this.is_multiple){if(!this.active_field)return setTimeout((e=this,function(){return e.container_mousedown()}),50)}else if(!this.active_field)return this.activate_field();var e},t.prototype.input_blur=function(t){if(!this.mouse_on_container)return this.active_field=!1,setTimeout((e=this,function(){return e.blur_test()}),100);var e},t.prototype.label_click_handler=function(t){return this.is_multiple?this.container_mousedown(t):this.activate_field()},t.prototype.results_option_build=function(t){var e,s,i,r,n,o,h;for(e="",h=0,r=0,n=(o=this.results_data).length;r<n&&(i="",""!==(i=(s=o[r]).group?this.result_add_group(s):this.result_add_option(s))&&(h++,e+=i),(null!=t?t.first:void 0)&&(s.selected&&this.is_multiple?this.choice_build(s):s.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(s))),!(h>=this.max_shown_results));r++);return e},t.prototype.result_add_option=function(t){var e,s;return t.search_match&&this.include_option_in_results(t)?(e=[],t.disabled||t.selected&&this.is_multiple||e.push("active-result"),!t.disabled||t.selected&&this.is_multiple||e.push("disabled-result"),t.selected&&e.push("result-selected"),null!=t.group_array_index&&e.push("group-option"),""!==t.classes&&e.push(t.classes),(s=document.createElement("li")).className=e.join(" "),t.style&&(s.style.cssText=t.style),s.setAttribute("data-option-array-index",t.array_index),s.innerHTML=t.highlighted_html||t.html,t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.result_add_group=function(t){var e,s;return(t.search_match||t.group_match)&&t.active_options>0?((e=[]).push("group-result"),t.classes&&e.push(t.classes),(s=document.createElement("li")).className=e.join(" "),s.innerHTML=t.highlighted_html||this.escape_html(t.label),t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.results_update_field=function(){if(this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing)return this.winnow_results()},t.prototype.reset_single_select_options=function(){var t,e,s,i,r;for(r=[],t=0,e=(s=this.results_data).length;t<e;t++)(i=s[t]).selected?r.push(i.selected=!1):r.push(void 0);return r},t.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},t.prototype.results_search=function(t){return this.results_showing?this.winnow_results():this.results_show()},t.prototype.winnow_results=function(t){var e,s,i,r,n,o,h,l,c,_,a,u,d,p,f;for(this.no_results_clear(),_=0,e=(h=this.get_search_text()).replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),c=this.get_search_regex(e),i=0,r=(l=this.results_data).length;i<r;i++)(n=l[i]).search_match=!1,a=null,u=null,n.highlighted_html="",this.include_option_in_results(n)&&(n.group&&(n.group_match=!1,n.active_options=0),null!=n.group_array_index&&this.results_data[n.group_array_index]&&(0===(a=this.results_data[n.group_array_index]).active_options&&a.search_match&&(_+=1),a.active_options+=1),f=n.group?n.label:n.text,n.group&&!this.group_search||(u=this.search_string_match(f,c),n.search_match=null!=u,n.search_match&&!n.group&&(_+=1),n.search_match?(h.length&&(d=u.index,o=f.slice(0,d),s=f.slice(d,d+h.length),p=f.slice(d+h.length),n.highlighted_html=this.escape_html(o)+"<em>"+this.escape_html(s)+"</em>"+this.escape_html(p)),null!=a&&(a.group_match=!0)):null!=n.group_array_index&&this.results_data[n.group_array_index].search_match&&(n.search_match=!0)));return this.result_clear_highlight(),_<1&&h.length?(this.update_results_content(""),this.no_results(h)):(this.update_results_content(this.results_option_build()),(null!=t?t.skip_highlight:void 0)?void 0:this.winnow_results_set_highlight())},t.prototype.get_search_regex=function(t){var e,s;return s=this.search_contains?t:"(^|\\s|\\b)"+t+"[^\\s]*",this.enable_split_word_search||this.search_contains||(s="^"+s),e=this.case_sensitive_search?"":"i",new RegExp(s,e)},t.prototype.search_string_match=function(t,e){var s;return s=e.exec(t),!this.search_contains&&(null!=s?s[1]:void 0)&&(s.index+=1),s},t.prototype.choices_count=function(){var t,e,s;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,t=0,e=(s=this.form_field.options).length;t<e;t++)s[t].selected&&(this.selected_option_count+=1);return this.selected_option_count},t.prototype.choices_click=function(t){if(t.preventDefault(),this.activate_field(),!this.results_showing&&!this.is_disabled)return this.results_show()},t.prototype.keydown_checker=function(t){var e,s;switch(s=null!=(e=t.which)?e:t.keyCode,this.search_field_scale(),8!==s&&this.pending_backstroke&&this.clear_backstroke(),s){case 8:this.backstroke_length=this.get_search_field_value().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(t),this.mouse_on_container=!1;break;case 13:case 27:this.results_showing&&t.preventDefault();break;case 32:this.disable_search&&t.preventDefault();break;case 38:t.preventDefault(),this.keyup_arrow();break;case 40:t.preventDefault(),this.keydown_arrow()}},t.prototype.keyup_checker=function(t){var e,s;switch(s=null!=(e=t.which)?e:t.keyCode,this.search_field_scale(),s){case 8:this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0?this.keydown_backstroke():this.pending_backstroke||(this.result_clear_highlight(),this.results_search());break;case 13:t.preventDefault(),this.results_showing&&this.result_select(t);break;case 27:this.results_showing&&this.results_hide();break;case 9:case 16:case 17:case 18:case 38:case 40:case 91:break;default:this.results_search()}},t.prototype.clipboard_event_checker=function(t){var e;if(!this.is_disabled)return setTimeout((e=this,function(){return e.results_search()}),50)},t.prototype.container_width=function(){return null!=this.options.width?this.options.width:this.form_field.offsetWidth+"px"},t.prototype.include_option_in_results=function(t){return!(this.is_multiple&&!this.display_selected_options&&t.selected)&&(!(!this.display_disabled_options&&t.disabled)&&!t.empty)},t.prototype.search_results_touchstart=function(t){return this.touch_started=!0,this.search_results_mouseover(t)},t.prototype.search_results_touchmove=function(t){return this.touch_started=!1,this.search_results_mouseout(t)},t.prototype.search_results_touchend=function(t){if(this.touch_started)return this.search_results_mouseup(t)},t.prototype.outerHTML=function(t){var e;return t.outerHTML?t.outerHTML:((e=document.createElement("div")).appendChild(t),e.innerHTML)},t.prototype.get_single_html=function(){return'<a class="chosen-single chosen-default">\n <span>'+this.default_text+'</span>\n <div><b></b></div>\n</a>\n<div class="chosen-drop">\n <div class="chosen-search">\n <input class="chosen-search-input" type="text" autocomplete="off" />\n </div>\n <ul class="chosen-results"></ul>\n</div>'},t.prototype.get_multi_html=function(){return'<ul class="chosen-choices">\n <li class="search-field">\n <input class="chosen-search-input" type="text" autocomplete="off" value="'+this.default_text+'" />\n </li>\n</ul>\n<div class="chosen-drop">\n <ul class="chosen-results"></ul>\n</div>'},t.prototype.get_no_results_html=function(t){return'<li class="no-results">\n '+this.results_none_found+" <span>"+this.escape_html(t)+"</span>\n</li>"},t.browser_is_supported=function(){return"Microsoft Internet Explorer"!==window.navigator.appName||document.documentMode>=8},t.default_multiple_text="Select Some Options",t.default_single_text="Select an Option",t.default_no_result_text="No results match",t}(),(t=jQuery).fn.extend({chosen:function(i){return e.browser_is_supported()?this.each(function(e){var r,n;n=(r=t(this)).data("chosen"),"destroy"!==i?n instanceof s||r.data("chosen",new s(this,i)):n instanceof s&&n.destroy()}):this}}),s=function(s){function r(){return r.__super__.constructor.apply(this,arguments)}return function(t,e){for(var s in e)n.call(e,s)&&(t[s]=e[s]);function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype}(r,e),r.prototype.setup=function(){return this.form_field_jq=t(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex},r.prototype.set_up_html=function(){var e,s;return(e=["chosen-container"]).push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&e.push(this.form_field.className),this.is_rtl&&e.push("chosen-rtl"),s={class:e.join(" "),title:this.form_field.title},this.form_field.id.length&&(s.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=t("<div />",s),this.container.width(this.container_width()),this.is_multiple?this.container.html(this.get_multi_html()):this.container.html(this.get_single_html()),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-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.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},r.prototype.on_ready=function(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})},r.prototype.register_observers=function(){var t;return this.container.on("touchstart.chosen",(t=this,function(e){t.container_mousedown(e)})),this.container.on("touchend.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mousedown.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("mouseup.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mouseenter.chosen",function(t){return function(e){t.mouse_enter(e)}}(this)),this.container.on("mouseleave.chosen",function(t){return function(e){t.mouse_leave(e)}}(this)),this.search_results.on("mouseup.chosen",function(t){return function(e){t.search_results_mouseup(e)}}(this)),this.search_results.on("mouseover.chosen",function(t){return function(e){t.search_results_mouseover(e)}}(this)),this.search_results.on("mouseout.chosen",function(t){return function(e){t.search_results_mouseout(e)}}(this)),this.search_results.on("mousewheel.chosen DOMMouseScroll.chosen",function(t){return function(e){t.search_results_mousewheel(e)}}(this)),this.search_results.on("touchstart.chosen",function(t){return function(e){t.search_results_touchstart(e)}}(this)),this.search_results.on("touchmove.chosen",function(t){return function(e){t.search_results_touchmove(e)}}(this)),this.search_results.on("touchend.chosen",function(t){return function(e){t.search_results_touchend(e)}}(this)),this.form_field_jq.on("chosen:updated.chosen",function(t){return function(e){t.results_update_field(e)}}(this)),this.form_field_jq.on("chosen:activate.chosen",function(t){return function(e){t.activate_field(e)}}(this)),this.form_field_jq.on("chosen:open.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.form_field_jq.on("chosen:close.chosen",function(t){return function(e){t.close_field(e)}}(this)),this.search_field.on("blur.chosen",function(t){return function(e){t.input_blur(e)}}(this)),this.search_field.on("keyup.chosen",function(t){return function(e){t.keyup_checker(e)}}(this)),this.search_field.on("keydown.chosen",function(t){return function(e){t.keydown_checker(e)}}(this)),this.search_field.on("focus.chosen",function(t){return function(e){t.input_focus(e)}}(this)),this.search_field.on("cut.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.search_field.on("paste.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.is_multiple?this.search_choices.on("click.chosen",function(t){return function(e){t.choices_click(e)}}(this)):this.container.on("click.chosen",function(t){t.preventDefault()})},r.prototype.destroy=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.form_field_label.length>0&&this.form_field_label.off("click.chosen"),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},r.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field.disabled||this.form_field_jq.parents("fieldset").is(":disabled"),this.container.toggleClass("chosen-disabled",this.is_disabled),this.search_field[0].disabled=this.is_disabled,this.is_multiple||this.selected_item.off("focus.chosen",this.activate_field),this.is_disabled?this.close_field():this.is_multiple?void 0:this.selected_item.on("focus.chosen",this.activate_field)},r.prototype.container_mousedown=function(e){var s;if(!this.is_disabled)return!e||"mousedown"!==(s=e.type)&&"touchstart"!==s||this.results_showing||e.preventDefault(),null!=e&&t(e.target).hasClass("search-choice-close")?void 0:(this.active_field?this.is_multiple||!e||t(e.target)[0]!==this.selected_item[0]&&!t(e.target).parents("a.chosen-single").length||(e.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),t(this.container[0].ownerDocument).on("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},r.prototype.container_mouseup=function(t){if("ABBR"===t.target.nodeName&&!this.is_disabled)return this.results_reset(t)},r.prototype.search_results_mousewheel=function(t){var e;if(t.originalEvent&&(e=t.originalEvent.deltaY||-t.originalEvent.wheelDelta||t.originalEvent.detail),null!=e)return t.preventDefault(),"DOMMouseScroll"===t.type&&(e*=40),this.search_results.scrollTop(e+this.search_results.scrollTop())},r.prototype.blur_test=function(t){if(!this.active_field&&this.container.hasClass("chosen-container-active"))return this.close_field()},r.prototype.close_field=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale(),this.search_field.blur()},r.prototype.activate_field=function(){if(!this.is_disabled)return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},r.prototype.test_active_click=function(e){var s;return(s=t(e.target).closest(".chosen-container")).length&&this.container[0]===s[0]?this.active_field=!0:this.close_field()},r.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=i.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},r.prototype.result_do_highlight=function(t){var e,s,i,r,n;if(t.length){if(this.result_clear_highlight(),this.result_highlight=t,this.result_highlight.addClass("highlighted"),r=(i=parseInt(this.search_results.css("maxHeight"),10))+(n=this.search_results.scrollTop()),(e=(s=this.result_highlight.position().top+this.search_results.scrollTop())+this.result_highlight.outerHeight())>=r)return this.search_results.scrollTop(e-i>0?e-i:0);if(s<n)return this.search_results.scrollTop(s)}},r.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},r.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.get_search_field_value()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))},r.prototype.update_results_content=function(t){return this.search_results.html(t)},r.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},r.prototype.set_tab_index=function(t){var e;if(this.form_field.tabIndex)return e=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=e},r.prototype.set_label_behavior=function(){if(this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=t("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0)return this.form_field_label.on("click.chosen",this.label_click_handler)},r.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<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"))},r.prototype.search_results_mouseup=function(e){var s;if((s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first()).length)return this.result_highlight=s,this.result_select(e),this.search_field.focus()},r.prototype.search_results_mouseover=function(e){var s;if(s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first())return this.result_do_highlight(s)},r.prototype.search_results_mouseout=function(e){if(t(e.target).hasClass("active-result")||t(e.target).parents(".active-result").first())return this.result_clear_highlight()},r.prototype.choice_build=function(e){var s,i,r;return s=t("<li />",{class:"search-choice"}).html("<span>"+this.choice_label(e)+"</span>"),e.disabled?s.addClass("search-choice-disabled"):((i=t("<a />",{class:"search-choice-close","data-option-array-index":e.array_index})).on("click.chosen",(r=this,function(t){return r.choice_destroy_link_click(t)})),s.append(i)),this.search_container.before(s)},r.prototype.choice_destroy_link_click=function(e){if(e.preventDefault(),e.stopPropagation(),!this.is_disabled)return this.choice_destroy(t(e.target))},r.prototype.choice_destroy=function(t){if(this.result_deselect(t[0].getAttribute("data-option-array-index")))return this.active_field?this.search_field.focus():this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.get_search_field_value().length<1&&this.results_hide(),t.parents("li").first().remove(),this.search_field_scale()},r.prototype.results_reset=function(){if(this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.trigger_form_field_change(),this.active_field)return this.results_hide()},r.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},r.prototype.result_select=function(t){var e,s;if(this.result_highlight)return e=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?e.removeClass("active-result"):this.reset_single_select_options(),e.addClass("result-selected"),(s=this.results_data[e[0].getAttribute("data-option-array-index")]).selected=!0,this.form_field.options[s.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(s):this.single_set_selected_text(this.choice_label(s)),this.is_multiple&&(!this.hide_results_on_select||t.metaKey||t.ctrlKey)?t.metaKey||t.ctrlKey?this.winnow_results({skip_highlight:!0}):(this.search_field.val(""),this.winnow_results()):(this.results_hide(),this.show_search_field_default()),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.trigger_form_field_change({selected:this.form_field.options[s.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,t.preventDefault(),this.search_field_scale())},r.prototype.single_set_selected_text=function(t){return null==t&&(t=this.default_text),t===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(t)},r.prototype.result_deselect=function(t){var e;return e=this.results_data[t],!this.form_field.options[e.options_index].disabled&&(e.selected=!1,this.form_field.options[e.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.trigger_form_field_change({deselected:this.form_field.options[e.options_index].value}),this.search_field_scale(),!0)},r.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect)return this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")},r.prototype.get_search_field_value=function(){return this.search_field.val()},r.prototype.get_search_text=function(){return t.trim(this.get_search_field_value())},r.prototype.escape_html=function(e){return t("<div/>").text(e).html()},r.prototype.winnow_results_set_highlight=function(){var t,e;if(null!=(t=(e=this.is_multiple?[]:this.search_results.find(".result-selected.active-result")).length?e.first():this.search_results.find(".active-result").first()))return this.result_do_highlight(t)},r.prototype.no_results=function(t){var e;return e=this.get_no_results_html(t),this.search_results.append(e),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},r.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},r.prototype.keydown_arrow=function(){var t;return this.results_showing&&this.result_highlight?(t=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(t):void 0:this.results_show()},r.prototype.keyup_arrow=function(){var t;return this.results_showing||this.is_multiple?this.result_highlight?(t=this.result_highlight.prevAll("li.active-result")).length?this.result_do_highlight(t.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight()):void 0:this.results_show()},r.prototype.keydown_backstroke=function(){var t;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(t=this.search_container.siblings("li.search-choice").last()).length&&!t.hasClass("search-choice-disabled")?(this.pending_backstroke=t,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0},r.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},r.prototype.search_field_scale=function(){var e,s,i,r,n,o,h;if(this.is_multiple){for(n={position:"absolute",left:"-1000px",top:"-1000px",display:"none",whiteSpace:"pre"},s=0,i=(o=["fontSize","fontStyle","fontWeight","fontFamily","lineHeight","textTransform","letterSpacing"]).length;s<i;s++)n[r=o[s]]=this.search_field.css(r);return(e=t("<div />").css(n)).text(this.get_search_field_value()),t("body").append(e),h=e.width()+25,e.remove(),this.container.is(":visible")&&(h=Math.min(this.container.outerWidth()-10,h)),this.search_field.width(h)}},r.prototype.trigger_form_field_change=function(t){return this.form_field_jq.trigger("input",t),this.form_field_jq.trigger("change",t)},r}()}).call(this);
inc/exopite-simple-options/assets/chosen.min.css ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ Chosen, a Select Box Enhancer for jQuery and Prototype
3
+ by Patrick Filler for Harvest, http://getharvest.com
4
+
5
+ Version 1.8.2
6
+ Full source at https://github.com/harvesthq/chosen
7
+ Copyright (c) 2011-2017 Harvest http://getharvest.com
8
+
9
+ MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
10
+ This file is generated by `grunt build`, do not edit it by hand.
11
+ */.chosen-container{position:relative;display:inline-block;vertical-align:middle;font-size:13px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.chosen-container *{-webkit-box-sizing:border-box;box-sizing:border-box}.chosen-container .chosen-drop{position:absolute;top:100%;z-index:1010;width:100%;border:1px solid #aaa;border-top:0;background:#fff;-webkit-box-shadow:0 4px 5px rgba(0,0,0,.15);box-shadow:0 4px 5px rgba(0,0,0,.15);clip:rect(0,0,0,0)}.chosen-container.chosen-with-drop .chosen-drop{clip:auto}.chosen-container a{cursor:pointer}.chosen-container .chosen-single .group-name,.chosen-container .search-choice .group-name{margin-right:4px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-weight:400;color:#999}.chosen-container .chosen-single .group-name:after,.chosen-container .search-choice .group-name:after{content:":";padding-left:2px;vertical-align:top}.chosen-container-single .chosen-single{position:relative;display:block;overflow:hidden;padding:0 0 0 8px;height:25px;border:1px solid #aaa;border-radius:5px;background-color:#fff;background:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#fff),color-stop(50%,#f6f6f6),color-stop(52%,#eee),to(#f4f4f4));background:linear-gradient(#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background-clip:padding-box;-webkit-box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);color:#444;text-decoration:none;white-space:nowrap;line-height:24px}.chosen-container-single .chosen-default{color:#999}.chosen-container-single .chosen-single span{display:block;overflow:hidden;margin-right:26px;text-overflow:ellipsis;white-space:nowrap}.chosen-container-single .chosen-single-with-deselect span{margin-right:38px}.chosen-container-single .chosen-single abbr{position:absolute;top:6px;right:26px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-single .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single.chosen-disabled .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single .chosen-single div{position:absolute;top:0;right:0;display:block;width:18px;height:100%}.chosen-container-single .chosen-single div b{display:block;width:100%;height:100%;background:url(chosen-sprite.png) no-repeat 0 2px}.chosen-container-single .chosen-search{position:relative;z-index:1010;margin:0;padding:3px 4px;white-space:nowrap}.chosen-container-single .chosen-search input[type=text]{margin:1px 0;padding:4px 20px 4px 5px;width:100%;height:auto;outline:0;border:1px solid #aaa;background:url(chosen-sprite.png) no-repeat 100% -20px;font-size:1em;font-family:sans-serif;line-height:normal;border-radius:0}.chosen-container-single .chosen-drop{margin-top:-1px;border-radius:0 0 4px 4px;background-clip:padding-box}.chosen-container-single.chosen-container-single-nosearch .chosen-search{position:absolute;clip:rect(0,0,0,0)}.chosen-container .chosen-results{color:#444;position:relative;overflow-x:hidden;overflow-y:auto;margin:0 4px 4px 0;padding:0 0 0 4px;max-height:240px;-webkit-overflow-scrolling:touch}.chosen-container .chosen-results li{display:none;margin:0;padding:5px 6px;list-style:none;line-height:15px;word-wrap:break-word;-webkit-touch-callout:none}.chosen-container .chosen-results li.active-result{display:list-item;cursor:pointer}.chosen-container .chosen-results li.disabled-result{display:list-item;color:#ccc;cursor:default}.chosen-container .chosen-results li.highlighted{background-color:#3875d7;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#3875d7),color-stop(90%,#2a62bc));background-image:linear-gradient(#3875d7 20%,#2a62bc 90%);color:#fff}.chosen-container .chosen-results li.no-results{color:#777;display:list-item;background:#f4f4f4}.chosen-container .chosen-results li.group-result{display:list-item;font-weight:700;cursor:default}.chosen-container .chosen-results li.group-option{padding-left:15px}.chosen-container .chosen-results li em{font-style:normal;text-decoration:underline}.chosen-container-multi .chosen-choices{position:relative;overflow:hidden;margin:0;padding:0 5px;width:100%;height:auto;border:1px solid #aaa;background-color:#fff;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(1%,#eee),color-stop(15%,#fff));background-image:linear-gradient(#eee 1%,#fff 15%);cursor:text}.chosen-container-multi .chosen-choices li{float:left;list-style:none}.chosen-container-multi .chosen-choices li.search-field{margin:0;padding:0;white-space:nowrap}.chosen-container-multi .chosen-choices li.search-field input[type=text]{margin:1px 0;padding:0;height:25px;outline:0;border:0!important;background:0 0!important;-webkit-box-shadow:none;box-shadow:none;color:#999;font-size:100%;font-family:sans-serif;line-height:normal;border-radius:0;width:25px}.chosen-container-multi .chosen-choices li.search-choice{position:relative;margin:3px 5px 3px 0;padding:3px 20px 3px 5px;border:1px solid #aaa;max-width:100%;border-radius:3px;background-color:#eee;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),to(#eee));background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-size:100% 19px;background-repeat:repeat-x;background-clip:padding-box;-webkit-box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);color:#333;line-height:13px;cursor:default}.chosen-container-multi .chosen-choices li.search-choice span{word-wrap:break-word}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close{position:absolute;top:4px;right:3px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover{background-position:-42px -10px}.chosen-container-multi .chosen-choices li.search-choice-disabled{padding-right:5px;border:1px solid #ccc;background-color:#e4e4e4;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),to(#eee));background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);color:#666}.chosen-container-multi .chosen-choices li.search-choice-focus{background:#d4d4d4}.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close{background-position:-42px -10px}.chosen-container-multi .chosen-results{margin:0;padding:0}.chosen-container-multi .chosen-drop .result-selected{display:list-item;color:#ccc;cursor:default}.chosen-container-active .chosen-single{border:1px solid #5897fb;-webkit-box-shadow:0 0 5px rgba(0,0,0,.3);box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active.chosen-with-drop .chosen-single{border:1px solid #aaa;border-bottom-right-radius:0;border-bottom-left-radius:0;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#eee),color-stop(80%,#fff));background-image:linear-gradient(#eee 20%,#fff 80%);-webkit-box-shadow:0 1px 0 #fff inset;box-shadow:0 1px 0 #fff inset}.chosen-container-active.chosen-with-drop .chosen-single div{border-left:none;background:0 0}.chosen-container-active.chosen-with-drop .chosen-single div b{background-position:-18px 2px}.chosen-container-active .chosen-choices{border:1px solid #5897fb;-webkit-box-shadow:0 0 5px rgba(0,0,0,.3);box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active .chosen-choices li.search-field input[type=text]{color:#222!important}.chosen-disabled{opacity:.5!important;cursor:default}.chosen-disabled .chosen-single{cursor:default}.chosen-disabled .chosen-choices .search-choice .search-choice-close{cursor:default}.chosen-rtl{text-align:right}.chosen-rtl .chosen-single{overflow:visible;padding:0 8px 0 0}.chosen-rtl .chosen-single span{margin-right:0;margin-left:26px;direction:rtl}.chosen-rtl .chosen-single-with-deselect span{margin-left:38px}.chosen-rtl .chosen-single div{right:auto;left:3px}.chosen-rtl .chosen-single abbr{right:auto;left:26px}.chosen-rtl .chosen-choices li{float:right}.chosen-rtl .chosen-choices li.search-field input[type=text]{direction:rtl}.chosen-rtl .chosen-choices li.search-choice{margin:3px 5px 3px 0;padding:3px 5px 3px 19px}.chosen-rtl .chosen-choices li.search-choice .search-choice-close{right:auto;left:4px}.chosen-rtl.chosen-container-single .chosen-results{margin:0 0 4px 4px;padding:0 4px 0 0}.chosen-rtl .chosen-results li.group-option{padding-right:15px;padding-left:0}.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div{border-right:none}.chosen-rtl .chosen-search input[type=text]{padding:4px 5px 4px 20px;background:url(chosen-sprite.png) no-repeat -30px -20px;direction:rtl}.chosen-rtl.chosen-container-single .chosen-single div b{background-position:6px 2px}.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b{background-position:-12px 2px}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (min-resolution:144dpi),only screen and (min-resolution:1.5dppx){.chosen-container .chosen-results-scroll-down span,.chosen-container .chosen-results-scroll-up span,.chosen-container-multi .chosen-choices .search-choice .search-choice-close,.chosen-container-single .chosen-search input[type=text],.chosen-container-single .chosen-single abbr,.chosen-container-single .chosen-single div b,.chosen-rtl .chosen-search input[type=text]{background-image:url(chosen-sprite@2x.png)!important;background-size:52px 37px!important;background-repeat:no-repeat!important}}
inc/exopite-simple-options/assets/dev/ace-loader.js ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ;(function ( $, window, document, undefined ) {
2
+
3
+ $.fn.exopiteSofFieldACEEditor = function() {
4
+ return this.each(function(index) {
5
+
6
+ if( typeof ace !== 'undefined' ) {
7
+
8
+ var $this = $(this),
9
+ $textarea = $this.find('.exopite-sof-ace-editor-textarea'),
10
+ options = JSON.parse( $this.find( '.exopite-sof-ace-editor-options' ).val() ),
11
+ plugin = this,
12
+ editor = ace.edit($this.find('.exopite-sof-ace-editor').attr('id'));
13
+
14
+ // global settings of ace editor
15
+ editor.getSession().setValue($textarea.val());
16
+
17
+ editor.setOptions( options );
18
+
19
+ editor.on( 'change', function( e ) {
20
+ $textarea.val( editor.getSession().getValue() ).trigger('change');
21
+ });
22
+
23
+ $( '.exopite-sof-group' ).on('exopite-sof-field-group-item-added-before', function( event, $cloned, $group ) {
24
+
25
+ if( $cloned.find( '.exopite-sof-ace-editor' ).length !== 0 ) {
26
+
27
+ plugin.musterID = $group.find( '.exopite-sof-cloneable__muster .exopite-sof-ace-editor' ).first().attr( 'id' ) + '-';
28
+
29
+ var count = parseInt( $group.find( '.exopite-sof-ace-editor' ).filter(function () {
30
+ return ( $(this).parents().not( '.exopite-sof-cloneable__muster' ) );
31
+ }).length );
32
+
33
+ $cloned.find( '.exopite-sof-ace-editor' ).each(function(index, el) {
34
+ $( el ).attr( 'id', plugin.musterID + ( count + index ) );
35
+ });
36
+
37
+ }
38
+
39
+ });
40
+
41
+ $( '.exopite-sof-group' ).on('exopite-sof-field-group-item-added-after', function( event, $cloned ) {
42
+
43
+ $cloned.find( '.exopite-sof-field-ace_editor' ).exopiteSofFieldACEEditor();
44
+
45
+ });
46
+
47
+ }
48
+ });
49
+ };
50
+
51
+ $( document ).ready(function() {
52
+
53
+ if( typeof ace !== 'undefined' ) {
54
+
55
+ var musterID = '';
56
+
57
+ $( '.exopite-sof-field-group' ).find( '.exopite-sof-field-ace_editor' ).each(function(index, el) {
58
+
59
+ if ( ! $(this).parents( '.exopite-sof-cloneable__muster' ).length ) {
60
+
61
+ var $thisEditor = $(this).find('.exopite-sof-ace-editor');
62
+ var thisId = $thisEditor.attr('id');
63
+ $thisEditor.attr( 'id', thisId + '-' + index );
64
+
65
+ }
66
+
67
+ });
68
+ }
69
+
70
+ $( '.exopite-sof-field-ace_editor' ).exopiteSofFieldACEEditor();
71
+
72
+
73
+
74
+ });
75
+
76
+ })( jQuery, window, document );
inc/exopite-simple-options/assets/dev/chosen.jquery.js ADDED
@@ -0,0 +1,1359 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ Chosen, a Select Box Enhancer for jQuery and Prototype
3
+ by Patrick Filler for Harvest, http://getharvest.com
4
+
5
+ Version 1.8.7
6
+ Full source at https://github.com/harvesthq/chosen
7
+ Copyright (c) 2011-2017 Harvest http://getharvest.com
8
+
9
+ MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
10
+ This file is generated by `grunt build`, do not edit it by hand.
11
+ */
12
+ (function() {
13
+ var $, AbstractChosen, Chosen, SelectParser,
14
+ bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
15
+ extend = function(child, parent) { for (var key in parent) { if (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; },
16
+ hasProp = {}.hasOwnProperty;
17
+
18
+ SelectParser = (function() {
19
+ function SelectParser() {
20
+ this.options_index = 0;
21
+ this.parsed = [];
22
+ }
23
+
24
+ SelectParser.prototype.add_node = function(child) {
25
+ if (child.nodeName.toUpperCase() === "OPTGROUP") {
26
+ return this.add_group(child);
27
+ } else {
28
+ return this.add_option(child);
29
+ }
30
+ };
31
+
32
+ SelectParser.prototype.add_group = function(group) {
33
+ var group_position, i, len, option, ref, results1;
34
+ group_position = this.parsed.length;
35
+ this.parsed.push({
36
+ array_index: group_position,
37
+ group: true,
38
+ label: group.label,
39
+ title: group.title ? group.title : void 0,
40
+ children: 0,
41
+ disabled: group.disabled,
42
+ classes: group.className
43
+ });
44
+ ref = group.childNodes;
45
+ results1 = [];
46
+ for (i = 0, len = ref.length; i < len; i++) {
47
+ option = ref[i];
48
+ results1.push(this.add_option(option, group_position, group.disabled));
49
+ }
50
+ return results1;
51
+ };
52
+
53
+ SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
54
+ if (option.nodeName.toUpperCase() === "OPTION") {
55
+ if (option.text !== "") {
56
+ if (group_position != null) {
57
+ this.parsed[group_position].children += 1;
58
+ }
59
+ this.parsed.push({
60
+ array_index: this.parsed.length,
61
+ options_index: this.options_index,
62
+ value: option.value,
63
+ text: option.text,
64
+ html: option.innerHTML,
65
+ title: option.title ? option.title : void 0,
66
+ selected: option.selected,
67
+ disabled: group_disabled === true ? group_disabled : option.disabled,
68
+ group_array_index: group_position,
69
+ group_label: group_position != null ? this.parsed[group_position].label : null,
70
+ classes: option.className,
71
+ style: option.style.cssText
72
+ });
73
+ } else {
74
+ this.parsed.push({
75
+ array_index: this.parsed.length,
76
+ options_index: this.options_index,
77
+ empty: true
78
+ });
79
+ }
80
+ return this.options_index += 1;
81
+ }
82
+ };
83
+
84
+ return SelectParser;
85
+
86
+ })();
87
+
88
+ SelectParser.select_to_array = function(select) {
89
+ var child, i, len, parser, ref;
90
+ parser = new SelectParser();
91
+ ref = select.childNodes;
92
+ for (i = 0, len = ref.length; i < len; i++) {
93
+ child = ref[i];
94
+ parser.add_node(child);
95
+ }
96
+ return parser.parsed;
97
+ };
98
+
99
+ AbstractChosen = (function() {
100
+ function AbstractChosen(form_field, options1) {
101
+ this.form_field = form_field;
102
+ this.options = options1 != null ? options1 : {};
103
+ this.label_click_handler = bind(this.label_click_handler, this);
104
+ if (!AbstractChosen.browser_is_supported()) {
105
+ return;
106
+ }
107
+ this.is_multiple = this.form_field.multiple;
108
+ this.set_default_text();
109
+ this.set_default_values();
110
+ this.setup();
111
+ this.set_up_html();
112
+ this.register_observers();
113
+ this.on_ready();
114
+ }
115
+
116
+ AbstractChosen.prototype.set_default_values = function() {
117
+ this.click_test_action = (function(_this) {
118
+ return function(evt) {
119
+ return _this.test_active_click(evt);
120
+ };
121
+ })(this);
122
+ this.activate_action = (function(_this) {
123
+ return function(evt) {
124
+ return _this.activate_field(evt);
125
+ };
126
+ })(this);
127
+ this.active_field = false;
128
+ this.mouse_on_container = false;
129
+ this.results_showing = false;
130
+ this.result_highlighted = null;
131
+ this.is_rtl = this.options.rtl || /\bchosen-rtl\b/.test(this.form_field.className);
132
+ 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 : false;
133
+ this.disable_search_threshold = this.options.disable_search_threshold || 0;
134
+ this.disable_search = this.options.disable_search || false;
135
+ this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true;
136
+ this.group_search = this.options.group_search != null ? this.options.group_search : true;
137
+ this.search_contains = this.options.search_contains || false;
138
+ this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true;
139
+ this.max_selected_options = this.options.max_selected_options || Infinity;
140
+ this.inherit_select_classes = this.options.inherit_select_classes || false;
141
+ this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
142
+ this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
143
+ this.include_group_label_in_selected = this.options.include_group_label_in_selected || false;
144
+ this.max_shown_results = this.options.max_shown_results || Number.POSITIVE_INFINITY;
145
+ this.case_sensitive_search = this.options.case_sensitive_search || false;
146
+ return this.hide_results_on_select = this.options.hide_results_on_select != null ? this.options.hide_results_on_select : true;
147
+ };
148
+
149
+ AbstractChosen.prototype.set_default_text = function() {
150
+ if (this.form_field.getAttribute("data-placeholder")) {
151
+ this.default_text = this.form_field.getAttribute("data-placeholder");
152
+ } else if (this.is_multiple) {
153
+ this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text;
154
+ } else {
155
+ this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
156
+ }
157
+ this.default_text = this.escape_html(this.default_text);
158
+ return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
159
+ };
160
+
161
+ AbstractChosen.prototype.choice_label = function(item) {
162
+ if (this.include_group_label_in_selected && (item.group_label != null)) {
163
+ return "<b class='group-name'>" + (this.escape_html(item.group_label)) + "</b>" + item.html;
164
+ } else {
165
+ return item.html;
166
+ }
167
+ };
168
+
169
+ AbstractChosen.prototype.mouse_enter = function() {
170
+ return this.mouse_on_container = true;
171
+ };
172
+
173
+ AbstractChosen.prototype.mouse_leave = function() {
174
+ return this.mouse_on_container = false;
175
+ };
176
+
177
+ AbstractChosen.prototype.input_focus = function(evt) {
178
+ if (this.is_multiple) {
179
+ if (!this.active_field) {
180
+ return setTimeout(((function(_this) {
181
+ return function() {
182
+ return _this.container_mousedown();
183
+ };
184
+ })(this)), 50);
185
+ }
186
+ } else {
187
+ if (!this.active_field) {
188
+ return this.activate_field();
189
+ }
190
+ }
191
+ };
192
+
193
+ AbstractChosen.prototype.input_blur = function(evt) {
194
+ if (!this.mouse_on_container) {
195
+ this.active_field = false;
196
+ return setTimeout(((function(_this) {
197
+ return function() {
198
+ return _this.blur_test();
199
+ };
200
+ })(this)), 100);
201
+ }
202
+ };
203
+
204
+ AbstractChosen.prototype.label_click_handler = function(evt) {
205
+ if (this.is_multiple) {
206
+ return this.container_mousedown(evt);
207
+ } else {
208
+ return this.activate_field();
209
+ }
210
+ };
211
+
212
+ AbstractChosen.prototype.results_option_build = function(options) {
213
+ var content, data, data_content, i, len, ref, shown_results;
214
+ content = '';
215
+ shown_results = 0;
216
+ ref = this.results_data;
217
+ for (i = 0, len = ref.length; i < len; i++) {
218
+ data = ref[i];
219
+ data_content = '';
220
+ if (data.group) {
221
+ data_content = this.result_add_group(data);
222
+ } else {
223
+ data_content = this.result_add_option(data);
224
+ }
225
+ if (data_content !== '') {
226
+ shown_results++;
227
+ content += data_content;
228
+ }
229
+ if (options != null ? options.first : void 0) {
230
+ if (data.selected && this.is_multiple) {
231
+ this.choice_build(data);
232
+ } else if (data.selected && !this.is_multiple) {
233
+ this.single_set_selected_text(this.choice_label(data));
234
+ }
235
+ }
236
+ if (shown_results >= this.max_shown_results) {
237
+ break;
238
+ }
239
+ }
240
+ return content;
241
+ };
242
+
243
+ AbstractChosen.prototype.result_add_option = function(option) {
244
+ var classes, option_el;
245
+ if (!option.search_match) {
246
+ return '';
247
+ }
248
+ if (!this.include_option_in_results(option)) {
249
+ return '';
250
+ }
251
+ classes = [];
252
+ if (!option.disabled && !(option.selected && this.is_multiple)) {
253
+ classes.push("active-result");
254
+ }
255
+ if (option.disabled && !(option.selected && this.is_multiple)) {
256
+ classes.push("disabled-result");
257
+ }
258
+ if (option.selected) {
259
+ classes.push("result-selected");
260
+ }
261
+ if (option.group_array_index != null) {
262
+ classes.push("group-option");
263
+ }
264
+ if (option.classes !== "") {
265
+ classes.push(option.classes);
266
+ }
267
+ option_el = document.createElement("li");
268
+ option_el.className = classes.join(" ");
269
+ if (option.style) {
270
+ option_el.style.cssText = option.style;
271
+ }
272
+ option_el.setAttribute("data-option-array-index", option.array_index);
273
+ option_el.innerHTML = option.highlighted_html || option.html;
274
+ if (option.title) {
275
+ option_el.title = option.title;
276
+ }
277
+ return this.outerHTML(option_el);
278
+ };
279
+
280
+ AbstractChosen.prototype.result_add_group = function(group) {
281
+ var classes, group_el;
282
+ if (!(group.search_match || group.group_match)) {
283
+ return '';
284
+ }
285
+ if (!(group.active_options > 0)) {
286
+ return '';
287
+ }
288
+ classes = [];
289
+ classes.push("group-result");
290
+ if (group.classes) {
291
+ classes.push(group.classes);
292
+ }
293
+ group_el = document.createElement("li");
294
+ group_el.className = classes.join(" ");
295
+ group_el.innerHTML = group.highlighted_html || this.escape_html(group.label);
296
+ if (group.title) {
297
+ group_el.title = group.title;
298
+ }
299
+ return this.outerHTML(group_el);
300
+ };
301
+
302
+ AbstractChosen.prototype.results_update_field = function() {
303
+ this.set_default_text();
304
+ if (!this.is_multiple) {
305
+ this.results_reset_cleanup();
306
+ }
307
+ this.result_clear_highlight();
308
+ this.results_build();
309
+ if (this.results_showing) {
310
+ return this.winnow_results();
311
+ }
312
+ };
313
+
314
+ AbstractChosen.prototype.reset_single_select_options = function() {
315
+ var i, len, ref, result, results1;
316
+ ref = this.results_data;
317
+ results1 = [];
318
+ for (i = 0, len = ref.length; i < len; i++) {
319
+ result = ref[i];
320
+ if (result.selected) {
321
+ results1.push(result.selected = false);
322
+ } else {
323
+ results1.push(void 0);
324
+ }
325
+ }
326
+ return results1;
327
+ };
328
+
329
+ AbstractChosen.prototype.results_toggle = function() {
330
+ if (this.results_showing) {
331
+ return this.results_hide();
332
+ } else {
333
+ return this.results_show();
334
+ }
335
+ };
336
+
337
+ AbstractChosen.prototype.results_search = function(evt) {
338
+ if (this.results_showing) {
339
+ return this.winnow_results();
340
+ } else {
341
+ return this.results_show();
342
+ }
343
+ };
344
+
345
+ AbstractChosen.prototype.winnow_results = function(options) {
346
+ var escapedQuery, fix, i, len, option, prefix, query, ref, regex, results, results_group, search_match, startpos, suffix, text;
347
+ this.no_results_clear();
348
+ results = 0;
349
+ query = this.get_search_text();
350
+ escapedQuery = query.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
351
+ regex = this.get_search_regex(escapedQuery);
352
+ ref = this.results_data;
353
+ for (i = 0, len = ref.length; i < len; i++) {
354
+ option = ref[i];
355
+ option.search_match = false;
356
+ results_group = null;
357
+ search_match = null;
358
+ option.highlighted_html = '';
359
+ if (this.include_option_in_results(option)) {
360
+ if (option.group) {
361
+ option.group_match = false;
362
+ option.active_options = 0;
363
+ }
364
+ if ((option.group_array_index != null) && this.results_data[option.group_array_index]) {
365
+ results_group = this.results_data[option.group_array_index];
366
+ if (results_group.active_options === 0 && results_group.search_match) {
367
+ results += 1;
368
+ }
369
+ results_group.active_options += 1;
370
+ }
371
+ text = option.group ? option.label : option.text;
372
+ if (!(option.group && !this.group_search)) {
373
+ search_match = this.search_string_match(text, regex);
374
+ option.search_match = search_match != null;
375
+ if (option.search_match && !option.group) {
376
+ results += 1;
377
+ }
378
+ if (option.search_match) {
379
+ if (query.length) {
380
+ startpos = search_match.index;
381
+ prefix = text.slice(0, startpos);
382
+ fix = text.slice(startpos, startpos + query.length);
383
+ suffix = text.slice(startpos + query.length);
384
+ option.highlighted_html = (this.escape_html(prefix)) + "<em>" + (this.escape_html(fix)) + "</em>" + (this.escape_html(suffix));
385
+ }
386
+ if (results_group != null) {
387
+ results_group.group_match = true;
388
+ }
389
+ } else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) {
390
+ option.search_match = true;
391
+ }
392
+ }
393
+ }
394
+ }
395
+ this.result_clear_highlight();
396
+ if (results < 1 && query.length) {
397
+ this.update_results_content("");
398
+ return this.no_results(query);
399
+ } else {
400
+ this.update_results_content(this.results_option_build());
401
+ if (!(options != null ? options.skip_highlight : void 0)) {
402
+ return this.winnow_results_set_highlight();
403
+ }
404
+ }
405
+ };
406
+
407
+ AbstractChosen.prototype.get_search_regex = function(escaped_search_string) {
408
+ var regex_flag, regex_string;
409
+ regex_string = this.search_contains ? escaped_search_string : "(^|\\s|\\b)" + escaped_search_string + "[^\\s]*";
410
+ if (!(this.enable_split_word_search || this.search_contains)) {
411
+ regex_string = "^" + regex_string;
412
+ }
413
+ regex_flag = this.case_sensitive_search ? "" : "i";
414
+ return new RegExp(regex_string, regex_flag);
415
+ };
416
+
417
+ AbstractChosen.prototype.search_string_match = function(search_string, regex) {
418
+ var match;
419
+ match = regex.exec(search_string);
420
+ if (!this.search_contains && (match != null ? match[1] : void 0)) {
421
+ match.index += 1;
422
+ }
423
+ return match;
424
+ };
425
+
426
+ AbstractChosen.prototype.choices_count = function() {
427
+ var i, len, option, ref;
428
+ if (this.selected_option_count != null) {
429
+ return this.selected_option_count;
430
+ }
431
+ this.selected_option_count = 0;
432
+ ref = this.form_field.options;
433
+ for (i = 0, len = ref.length; i < len; i++) {
434
+ option = ref[i];
435
+ if (option.selected) {
436
+ this.selected_option_count += 1;
437
+ }
438
+ }
439
+ return this.selected_option_count;
440
+ };
441
+
442
+ AbstractChosen.prototype.choices_click = function(evt) {
443
+ evt.preventDefault();
444
+ this.activate_field();
445
+ if (!(this.results_showing || this.is_disabled)) {
446
+ return this.results_show();
447
+ }
448
+ };
449
+
450
+ AbstractChosen.prototype.keydown_checker = function(evt) {
451
+ var ref, stroke;
452
+ stroke = (ref = evt.which) != null ? ref : evt.keyCode;
453
+ this.search_field_scale();
454
+ if (stroke !== 8 && this.pending_backstroke) {
455
+ this.clear_backstroke();
456
+ }
457
+ switch (stroke) {
458
+ case 8:
459
+ this.backstroke_length = this.get_search_field_value().length;
460
+ break;
461
+ case 9:
462
+ if (this.results_showing && !this.is_multiple) {
463
+ this.result_select(evt);
464
+ }
465
+ this.mouse_on_container = false;
466
+ break;
467
+ case 13:
468
+ if (this.results_showing) {
469
+ evt.preventDefault();
470
+ }
471
+ break;
472
+ case 27:
473
+ if (this.results_showing) {
474
+ evt.preventDefault();
475
+ }
476
+ break;
477
+ case 32:
478
+ if (this.disable_search) {
479
+ evt.preventDefault();
480
+ }
481
+ break;
482
+ case 38:
483
+ evt.preventDefault();
484
+ this.keyup_arrow();
485
+ break;
486
+ case 40:
487
+ evt.preventDefault();
488
+ this.keydown_arrow();
489
+ break;
490
+ }
491
+ };
492
+
493
+ AbstractChosen.prototype.keyup_checker = function(evt) {
494
+ var ref, stroke;
495
+ stroke = (ref = evt.which) != null ? ref : evt.keyCode;
496
+ this.search_field_scale();
497
+ switch (stroke) {
498
+ case 8:
499
+ if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
500
+ this.keydown_backstroke();
501
+ } else if (!this.pending_backstroke) {
502
+ this.result_clear_highlight();
503
+ this.results_search();
504
+ }
505
+ break;
506
+ case 13:
507
+ evt.preventDefault();
508
+ if (this.results_showing) {
509
+ this.result_select(evt);
510
+ }
511
+ break;
512
+ case 27:
513
+ if (this.results_showing) {
514
+ this.results_hide();
515
+ }
516
+ break;
517
+ case 9:
518
+ case 16:
519
+ case 17:
520
+ case 18:
521
+ case 38:
522
+ case 40:
523
+ case 91:
524
+ break;
525
+ default:
526
+ this.results_search();
527
+ break;
528
+ }
529
+ };
530
+
531
+ AbstractChosen.prototype.clipboard_event_checker = function(evt) {
532
+ if (this.is_disabled) {
533
+ return;
534
+ }
535
+ return setTimeout(((function(_this) {
536
+ return function() {
537
+ return _this.results_search();
538
+ };
539
+ })(this)), 50);
540
+ };
541
+
542
+ AbstractChosen.prototype.container_width = function() {
543
+ if (this.options.width != null) {
544
+ return this.options.width;
545
+ } else {
546
+ return this.form_field.offsetWidth + "px";
547
+ }
548
+ };
549
+
550
+ AbstractChosen.prototype.include_option_in_results = function(option) {
551
+ if (this.is_multiple && (!this.display_selected_options && option.selected)) {
552
+ return false;
553
+ }
554
+ if (!this.display_disabled_options && option.disabled) {
555
+ return false;
556
+ }
557
+ if (option.empty) {
558
+ return false;
559
+ }
560
+ return true;
561
+ };
562
+
563
+ AbstractChosen.prototype.search_results_touchstart = function(evt) {
564
+ this.touch_started = true;
565
+ return this.search_results_mouseover(evt);
566
+ };
567
+
568
+ AbstractChosen.prototype.search_results_touchmove = function(evt) {
569
+ this.touch_started = false;
570
+ return this.search_results_mouseout(evt);
571
+ };
572
+
573
+ AbstractChosen.prototype.search_results_touchend = function(evt) {
574
+ if (this.touch_started) {
575
+ return this.search_results_mouseup(evt);
576
+ }
577
+ };
578
+
579
+ AbstractChosen.prototype.outerHTML = function(element) {
580
+ var tmp;
581
+ if (element.outerHTML) {
582
+ return element.outerHTML;
583
+ }
584
+ tmp = document.createElement("div");
585
+ tmp.appendChild(element);
586
+ return tmp.innerHTML;
587
+ };
588
+
589
+ AbstractChosen.prototype.get_single_html = function() {
590
+ return "<a class=\"chosen-single chosen-default\">\n <span>" + this.default_text + "</span>\n <div><b></b></div>\n</a>\n<div class=\"chosen-drop\">\n <div class=\"chosen-search\">\n <input class=\"chosen-search-input\" type=\"text\" autocomplete=\"off\" />\n </div>\n <ul class=\"chosen-results\"></ul>\n</div>";
591
+ };
592
+
593
+ AbstractChosen.prototype.get_multi_html = function() {
594
+ return "<ul class=\"chosen-choices\">\n <li class=\"search-field\">\n <input class=\"chosen-search-input\" type=\"text\" autocomplete=\"off\" value=\"" + this.default_text + "\" />\n </li>\n</ul>\n<div class=\"chosen-drop\">\n <ul class=\"chosen-results\"></ul>\n</div>";
595
+ };
596
+
597
+ AbstractChosen.prototype.get_no_results_html = function(terms) {
598
+ return "<li class=\"no-results\">\n " + this.results_none_found + " <span>" + (this.escape_html(terms)) + "</span>\n</li>";
599
+ };
600
+
601
+ AbstractChosen.browser_is_supported = function() {
602
+ if ("Microsoft Internet Explorer" === window.navigator.appName) {
603
+ return document.documentMode >= 8;
604
+ }
605
+ // if (/iP(od|hone)/i.test(window.navigator.userAgent) || /IEMobile/i.test(window.navigator.userAgent) || /Windows Phone/i.test(window.navigator.userAgent) || /BlackBerry/i.test(window.navigator.userAgent) || /BB10/i.test(window.navigator.userAgent) || /Android.*Mobile/i.test(window.navigator.userAgent)) {
606
+ // return false;
607
+ // }
608
+ return true;
609
+ };
610
+
611
+ AbstractChosen.default_multiple_text = "Select Some Options";
612
+
613
+ AbstractChosen.default_single_text = "Select an Option";
614
+
615
+ AbstractChosen.default_no_result_text = "No results match";
616
+
617
+ return AbstractChosen;
618
+
619
+ })();
620
+
621
+ $ = jQuery;
622
+
623
+ $.fn.extend({
624
+ chosen: function(options) {
625
+ if (!AbstractChosen.browser_is_supported()) {
626
+ return this;
627
+ }
628
+ return this.each(function(input_field) {
629
+ var $this, chosen;
630
+ $this = $(this);
631
+ chosen = $this.data('chosen');
632
+ if (options === 'destroy') {
633
+ if (chosen instanceof Chosen) {
634
+ chosen.destroy();
635
+ }
636
+ return;
637
+ }
638
+ if (!(chosen instanceof Chosen)) {
639
+ $this.data('chosen', new Chosen(this, options));
640
+ }
641
+ });
642
+ }
643
+ });
644
+
645
+ Chosen = (function(superClass) {
646
+ extend(Chosen, superClass);
647
+
648
+ function Chosen() {
649
+ return Chosen.__super__.constructor.apply(this, arguments);
650
+ }
651
+
652
+ Chosen.prototype.setup = function() {
653
+ this.form_field_jq = $(this.form_field);
654
+ return this.current_selectedIndex = this.form_field.selectedIndex;
655
+ };
656
+
657
+ Chosen.prototype.set_up_html = function() {
658
+ var container_classes, container_props;
659
+ container_classes = ["chosen-container"];
660
+ container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single"));
661
+ if (this.inherit_select_classes && this.form_field.className) {
662
+ container_classes.push(this.form_field.className);
663
+ }
664
+ if (this.is_rtl) {
665
+ container_classes.push("chosen-rtl");
666
+ }
667
+ container_props = {
668
+ 'class': container_classes.join(' '),
669
+ 'title': this.form_field.title
670
+ };
671
+ if (this.form_field.id.length) {
672
+ container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen";
673
+ }
674
+ this.container = $("<div />", container_props);
675
+ this.container.width(this.container_width());
676
+ if (this.is_multiple) {
677
+ this.container.html(this.get_multi_html());
678
+ } else {
679
+ this.container.html(this.get_single_html());
680
+ }
681
+ this.form_field_jq.hide().after(this.container);
682
+ this.dropdown = this.container.find('div.chosen-drop').first();
683
+ this.search_field = this.container.find('input').first();
684
+ this.search_results = this.container.find('ul.chosen-results').first();
685
+ this.search_field_scale();
686
+ this.search_no_results = this.container.find('li.no-results').first();
687
+ if (this.is_multiple) {
688
+ this.search_choices = this.container.find('ul.chosen-choices').first();
689
+ this.search_container = this.container.find('li.search-field').first();
690
+ } else {
691
+ this.search_container = this.container.find('div.chosen-search').first();
692
+ this.selected_item = this.container.find('.chosen-single').first();
693
+ }
694
+ this.results_build();
695
+ this.set_tab_index();
696
+ return this.set_label_behavior();
697
+ };
698
+
699
+ Chosen.prototype.on_ready = function() {
700
+ return this.form_field_jq.trigger("chosen:ready", {
701
+ chosen: this
702
+ });
703
+ };
704
+
705
+ Chosen.prototype.register_observers = function() {
706
+ this.container.on('touchstart.chosen', (function(_this) {
707
+ return function(evt) {
708
+ _this.container_mousedown(evt);
709
+ };
710
+ })(this));
711
+ this.container.on('touchend.chosen', (function(_this) {
712
+ return function(evt) {
713
+ _this.container_mouseup(evt);
714
+ };
715
+ })(this));
716
+ this.container.on('mousedown.chosen', (function(_this) {
717
+ return function(evt) {
718
+ _this.container_mousedown(evt);
719
+ };
720
+ })(this));
721
+ this.container.on('mouseup.chosen', (function(_this) {
722
+ return function(evt) {
723
+ _this.container_mouseup(evt);
724
+ };
725
+ })(this));
726
+ this.container.on('mouseenter.chosen', (function(_this) {
727
+ return function(evt) {
728
+ _this.mouse_enter(evt);
729
+ };
730
+ })(this));
731
+ this.container.on('mouseleave.chosen', (function(_this) {
732
+ return function(evt) {
733
+ _this.mouse_leave(evt);
734
+ };
735
+ })(this));
736
+ this.search_results.on('mouseup.chosen', (function(_this) {
737
+ return function(evt) {
738
+ _this.search_results_mouseup(evt);
739
+ };
740
+ })(this));
741
+ this.search_results.on('mouseover.chosen', (function(_this) {
742
+ return function(evt) {
743
+ _this.search_results_mouseover(evt);
744
+ };
745
+ })(this));
746
+ this.search_results.on('mouseout.chosen', (function(_this) {
747
+ return function(evt) {
748
+ _this.search_results_mouseout(evt);
749
+ };
750
+ })(this));
751
+ this.search_results.on('mousewheel.chosen DOMMouseScroll.chosen', (function(_this) {
752
+ return function(evt) {
753
+ _this.search_results_mousewheel(evt);
754
+ };
755
+ })(this));
756
+ this.search_results.on('touchstart.chosen', (function(_this) {
757
+ return function(evt) {
758
+ _this.search_results_touchstart(evt);
759
+ };
760
+ })(this));
761
+ this.search_results.on('touchmove.chosen', (function(_this) {
762
+ return function(evt) {
763
+ _this.search_results_touchmove(evt);
764
+ };
765
+ })(this));
766
+ this.search_results.on('touchend.chosen', (function(_this) {
767
+ return function(evt) {
768
+ _this.search_results_touchend(evt);
769
+ };
770
+ })(this));
771
+ this.form_field_jq.on("chosen:updated.chosen", (function(_this) {
772
+ return function(evt) {
773
+ _this.results_update_field(evt);
774
+ };
775
+ })(this));
776
+ this.form_field_jq.on("chosen:activate.chosen", (function(_this) {
777
+ return function(evt) {
778
+ _this.activate_field(evt);
779
+ };
780
+ })(this));
781
+ this.form_field_jq.on("chosen:open.chosen", (function(_this) {
782
+ return function(evt) {
783
+ _this.container_mousedown(evt);
784
+ };
785
+ })(this));
786
+ this.form_field_jq.on("chosen:close.chosen", (function(_this) {
787
+ return function(evt) {
788
+ _this.close_field(evt);
789
+ };
790
+ })(this));
791
+ this.search_field.on('blur.chosen', (function(_this) {
792
+ return function(evt) {
793
+ _this.input_blur(evt);
794
+ };
795
+ })(this));
796
+ this.search_field.on('keyup.chosen', (function(_this) {
797
+ return function(evt) {
798
+ _this.keyup_checker(evt);
799
+ };
800
+ })(this));
801
+ this.search_field.on('keydown.chosen', (function(_this) {
802
+ return function(evt) {
803
+ _this.keydown_checker(evt);
804
+ };
805
+ })(this));
806
+ this.search_field.on('focus.chosen', (function(_this) {
807
+ return function(evt) {
808
+ _this.input_focus(evt);
809
+ };
810
+ })(this));
811
+ this.search_field.on('cut.chosen', (function(_this) {
812
+ return function(evt) {
813
+ _this.clipboard_event_checker(evt);
814
+ };
815
+ })(this));
816
+ this.search_field.on('paste.chosen', (function(_this) {
817
+ return function(evt) {
818
+ _this.clipboard_event_checker(evt);
819
+ };
820
+ })(this));
821
+ if (this.is_multiple) {
822
+ return this.search_choices.on('click.chosen', (function(_this) {
823
+ return function(evt) {
824
+ _this.choices_click(evt);
825
+ };
826
+ })(this));
827
+ } else {
828
+ return this.container.on('click.chosen', function(evt) {
829
+ evt.preventDefault();
830
+ });
831
+ }
832
+ };
833
+
834
+ Chosen.prototype.destroy = function() {
835
+ $(this.container[0].ownerDocument).off('click.chosen', this.click_test_action);
836
+ if (this.form_field_label.length > 0) {
837
+ this.form_field_label.off('click.chosen');
838
+ }
839
+ if (this.search_field[0].tabIndex) {
840
+ this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex;
841
+ }
842
+ this.container.remove();
843
+ this.form_field_jq.removeData('chosen');
844
+ return this.form_field_jq.show();
845
+ };
846
+
847
+ Chosen.prototype.search_field_disabled = function() {
848
+ this.is_disabled = this.form_field.disabled || this.form_field_jq.parents('fieldset').is(':disabled');
849
+ this.container.toggleClass('chosen-disabled', this.is_disabled);
850
+ this.search_field[0].disabled = this.is_disabled;
851
+ if (!this.is_multiple) {
852
+ this.selected_item.off('focus.chosen', this.activate_field);
853
+ }
854
+ if (this.is_disabled) {
855
+ return this.close_field();
856
+ } else if (!this.is_multiple) {
857
+ return this.selected_item.on('focus.chosen', this.activate_field);
858
+ }
859
+ };
860
+
861
+ Chosen.prototype.container_mousedown = function(evt) {
862
+ var ref;
863
+ if (this.is_disabled) {
864
+ return;
865
+ }
866
+ if (evt && ((ref = evt.type) === 'mousedown' || ref === 'touchstart') && !this.results_showing) {
867
+ evt.preventDefault();
868
+ }
869
+ if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) {
870
+ if (!this.active_field) {
871
+ if (this.is_multiple) {
872
+ this.search_field.val("");
873
+ }
874
+ $(this.container[0].ownerDocument).on('click.chosen', this.click_test_action);
875
+ this.results_show();
876
+ } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chosen-single").length)) {
877
+ evt.preventDefault();
878
+ this.results_toggle();
879
+ }
880
+ return this.activate_field();
881
+ }
882
+ };
883
+
884
+ Chosen.prototype.container_mouseup = function(evt) {
885
+ if (evt.target.nodeName === "ABBR" && !this.is_disabled) {
886
+ return this.results_reset(evt);
887
+ }
888
+ };
889
+
890
+ Chosen.prototype.search_results_mousewheel = function(evt) {
891
+ var delta;
892
+ if (evt.originalEvent) {
893
+ delta = evt.originalEvent.deltaY || -evt.originalEvent.wheelDelta || evt.originalEvent.detail;
894
+ }
895
+ if (delta != null) {
896
+ evt.preventDefault();
897
+ if (evt.type === 'DOMMouseScroll') {
898
+ delta = delta * 40;
899
+ }
900
+ return this.search_results.scrollTop(delta + this.search_results.scrollTop());
901
+ }
902
+ };
903
+
904
+ Chosen.prototype.blur_test = function(evt) {
905
+ if (!this.active_field && this.container.hasClass("chosen-container-active")) {
906
+ return this.close_field();
907
+ }
908
+ };
909
+
910
+ Chosen.prototype.close_field = function() {
911
+ $(this.container[0].ownerDocument).off("click.chosen", this.click_test_action);
912
+ this.active_field = false;
913
+ this.results_hide();
914
+ this.container.removeClass("chosen-container-active");
915
+ this.clear_backstroke();
916
+ this.show_search_field_default();
917
+ this.search_field_scale();
918
+ return this.search_field.blur();
919
+ };
920
+
921
+ Chosen.prototype.activate_field = function() {
922
+ if (this.is_disabled) {
923
+ return;
924
+ }
925
+ this.container.addClass("chosen-container-active");
926
+ this.active_field = true;
927
+ this.search_field.val(this.search_field.val());
928
+ return this.search_field.focus();
929
+ };
930
+
931
+ Chosen.prototype.test_active_click = function(evt) {
932
+ var active_container;
933
+ active_container = $(evt.target).closest('.chosen-container');
934
+ if (active_container.length && this.container[0] === active_container[0]) {
935
+ return this.active_field = true;
936
+ } else {
937
+ return this.close_field();
938
+ }
939
+ };
940
+
941
+ Chosen.prototype.results_build = function() {
942
+ this.parsing = true;
943
+ this.selected_option_count = null;
944
+ this.results_data = SelectParser.select_to_array(this.form_field);
945
+ if (this.is_multiple) {
946
+ this.search_choices.find("li.search-choice").remove();
947
+ } else {
948
+ this.single_set_selected_text();
949
+ if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
950
+ this.search_field[0].readOnly = true;
951
+ this.container.addClass("chosen-container-single-nosearch");
952
+ } else {
953
+ this.search_field[0].readOnly = false;
954
+ this.container.removeClass("chosen-container-single-nosearch");
955
+ }
956
+ }
957
+ this.update_results_content(this.results_option_build({
958
+ first: true
959
+ }));
960
+ this.search_field_disabled();
961
+ this.show_search_field_default();
962
+ this.search_field_scale();
963
+ return this.parsing = false;
964
+ };
965
+
966
+ Chosen.prototype.result_do_highlight = function(el) {
967
+ var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
968
+ if (el.length) {
969
+ this.result_clear_highlight();
970
+ this.result_highlight = el;
971
+ this.result_highlight.addClass("highlighted");
972
+ maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
973
+ visible_top = this.search_results.scrollTop();
974
+ visible_bottom = maxHeight + visible_top;
975
+ high_top = this.result_highlight.position().top + this.search_results.scrollTop();
976
+ high_bottom = high_top + this.result_highlight.outerHeight();
977
+ if (high_bottom >= visible_bottom) {
978
+ return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
979
+ } else if (high_top < visible_top) {
980
+ return this.search_results.scrollTop(high_top);
981
+ }
982
+ }
983
+ };
984
+
985
+ Chosen.prototype.result_clear_highlight = function() {
986
+ if (this.result_highlight) {
987
+ this.result_highlight.removeClass("highlighted");
988
+ }
989
+ return this.result_highlight = null;
990
+ };
991
+
992
+ Chosen.prototype.results_show = function() {
993
+ if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
994
+ this.form_field_jq.trigger("chosen:maxselected", {
995
+ chosen: this
996
+ });
997
+ return false;
998
+ }
999
+ this.container.addClass("chosen-with-drop");
1000
+ this.results_showing = true;
1001
+ this.search_field.focus();
1002
+ this.search_field.val(this.get_search_field_value());
1003
+ this.winnow_results();
1004
+ return this.form_field_jq.trigger("chosen:showing_dropdown", {
1005
+ chosen: this
1006
+ });
1007
+ };
1008
+
1009
+ Chosen.prototype.update_results_content = function(content) {
1010
+ return this.search_results.html(content);
1011
+ };
1012
+
1013
+ Chosen.prototype.results_hide = function() {
1014
+ if (this.results_showing) {
1015
+ this.result_clear_highlight();
1016
+ this.container.removeClass("chosen-with-drop");
1017
+ this.form_field_jq.trigger("chosen:hiding_dropdown", {
1018
+ chosen: this
1019
+ });
1020
+ }
1021
+ return this.results_showing = false;
1022
+ };
1023
+
1024
+ Chosen.prototype.set_tab_index = function(el) {
1025
+ var ti;
1026
+ if (this.form_field.tabIndex) {
1027
+ ti = this.form_field.tabIndex;
1028
+ this.form_field.tabIndex = -1;
1029
+ return this.search_field[0].tabIndex = ti;
1030
+ }
1031
+ };
1032
+
1033
+ Chosen.prototype.set_label_behavior = function() {
1034
+ this.form_field_label = this.form_field_jq.parents("label");
1035
+ if (!this.form_field_label.length && this.form_field.id.length) {
1036
+ this.form_field_label = $("label[for='" + this.form_field.id + "']");
1037
+ }
1038
+ if (this.form_field_label.length > 0) {
1039
+ return this.form_field_label.on('click.chosen', this.label_click_handler);
1040
+ }
1041
+ };
1042
+
1043
+ Chosen.prototype.show_search_field_default = function() {
1044
+ if (this.is_multiple && this.choices_count() < 1 && !this.active_field) {
1045
+ this.search_field.val(this.default_text);
1046
+ return this.search_field.addClass("default");
1047
+ } else {
1048
+ this.search_field.val("");
1049
+ return this.search_field.removeClass("default");
1050
+ }
1051
+ };
1052
+
1053
+ Chosen.prototype.search_results_mouseup = function(evt) {
1054
+ var target;
1055
+ target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
1056
+ if (target.length) {
1057
+ this.result_highlight = target;
1058
+ this.result_select(evt);
1059
+ return this.search_field.focus();
1060
+ }
1061
+ };
1062
+
1063
+ Chosen.prototype.search_results_mouseover = function(evt) {
1064
+ var target;
1065
+ target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
1066
+ if (target) {
1067
+ return this.result_do_highlight(target);
1068
+ }
1069
+ };
1070
+
1071
+ Chosen.prototype.search_results_mouseout = function(evt) {
1072
+ if ($(evt.target).hasClass("active-result") || $(evt.target).parents('.active-result').first()) {
1073
+ return this.result_clear_highlight();
1074
+ }
1075
+ };
1076
+
1077
+ Chosen.prototype.choice_build = function(item) {
1078
+ var choice, close_link;
1079
+ choice = $('<li />', {
1080
+ "class": "search-choice"
1081
+ }).html("<span>" + (this.choice_label(item)) + "</span>");
1082
+ if (item.disabled) {
1083
+ choice.addClass('search-choice-disabled');
1084
+ } else {
1085
+ close_link = $('<a />', {
1086
+ "class": 'search-choice-close',
1087
+ 'data-option-array-index': item.array_index
1088
+ });
1089
+ close_link.on('click.chosen', (function(_this) {
1090
+ return function(evt) {
1091
+ return _this.choice_destroy_link_click(evt);
1092
+ };
1093
+ })(this));
1094
+ choice.append(close_link);
1095
+ }
1096
+ return this.search_container.before(choice);
1097
+ };
1098
+
1099
+ Chosen.prototype.choice_destroy_link_click = function(evt) {
1100
+ evt.preventDefault();
1101
+ evt.stopPropagation();
1102
+ if (!this.is_disabled) {
1103
+ return this.choice_destroy($(evt.target));
1104
+ }
1105
+ };
1106
+
1107
+ Chosen.prototype.choice_destroy = function(link) {
1108
+ if (this.result_deselect(link[0].getAttribute("data-option-array-index"))) {
1109
+ if (this.active_field) {
1110
+ this.search_field.focus();
1111
+ } else {
1112
+ this.show_search_field_default();
1113
+ }
1114
+ if (this.is_multiple && this.choices_count() > 0 && this.get_search_field_value().length < 1) {
1115
+ this.results_hide();
1116
+ }
1117
+ link.parents('li').first().remove();
1118
+ return this.search_field_scale();
1119
+ }
1120
+ };
1121
+
1122
+ Chosen.prototype.results_reset = function() {
1123
+ this.reset_single_select_options();
1124
+ this.form_field.options[0].selected = true;
1125
+ this.single_set_selected_text();
1126
+ this.show_search_field_default();
1127
+ this.results_reset_cleanup();
1128
+ this.trigger_form_field_change();
1129
+ if (this.active_field) {
1130
+ return this.results_hide();
1131
+ }
1132
+ };
1133
+
1134
+ Chosen.prototype.results_reset_cleanup = function() {
1135
+ this.current_selectedIndex = this.form_field.selectedIndex;
1136
+ return this.selected_item.find("abbr").remove();
1137
+ };
1138
+
1139
+ Chosen.prototype.result_select = function(evt) {
1140
+ var high, item;
1141
+ if (this.result_highlight) {
1142
+ high = this.result_highlight;
1143
+ this.result_clear_highlight();
1144
+ if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
1145
+ this.form_field_jq.trigger("chosen:maxselected", {
1146
+ chosen: this
1147
+ });
1148
+ return false;
1149
+ }
1150
+ if (this.is_multiple) {
1151
+ high.removeClass("active-result");
1152
+ } else {
1153
+ this.reset_single_select_options();
1154
+ }
1155
+ high.addClass("result-selected");
1156
+ item = this.results_data[high[0].getAttribute("data-option-array-index")];
1157
+ item.selected = true;
1158
+ this.form_field.options[item.options_index].selected = true;
1159
+ this.selected_option_count = null;
1160
+ if (this.is_multiple) {
1161
+ this.choice_build(item);
1162
+ } else {
1163
+ this.single_set_selected_text(this.choice_label(item));
1164
+ }
1165
+ if (this.is_multiple && (!this.hide_results_on_select || (evt.metaKey || evt.ctrlKey))) {
1166
+ if (evt.metaKey || evt.ctrlKey) {
1167
+ this.winnow_results({
1168
+ skip_highlight: true
1169
+ });
1170
+ } else {
1171
+ this.search_field.val("");
1172
+ this.winnow_results();
1173
+ }
1174
+ } else {
1175
+ this.results_hide();
1176
+ this.show_search_field_default();
1177
+ }
1178
+ if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) {
1179
+ this.trigger_form_field_change({
1180
+ selected: this.form_field.options[item.options_index].value
1181
+ });
1182
+ }
1183
+ this.current_selectedIndex = this.form_field.selectedIndex;
1184
+ evt.preventDefault();
1185
+ return this.search_field_scale();
1186
+ }
1187
+ };
1188
+
1189
+ Chosen.prototype.single_set_selected_text = function(text) {
1190
+ if (text == null) {
1191
+ text = this.default_text;
1192
+ }
1193
+ if (text === this.default_text) {
1194
+ this.selected_item.addClass("chosen-default");
1195
+ } else {
1196
+ this.single_deselect_control_build();
1197
+ this.selected_item.removeClass("chosen-default");
1198
+ }
1199
+ return this.selected_item.find("span").html(text);
1200
+ };
1201
+
1202
+ Chosen.prototype.result_deselect = function(pos) {
1203
+ var result_data;
1204
+ result_data = this.results_data[pos];
1205
+ if (!this.form_field.options[result_data.options_index].disabled) {
1206
+ result_data.selected = false;
1207
+ this.form_field.options[result_data.options_index].selected = false;
1208
+ this.selected_option_count = null;
1209
+ this.result_clear_highlight();
1210
+ if (this.results_showing) {
1211
+ this.winnow_results();
1212
+ }
1213
+ this.trigger_form_field_change({
1214
+ deselected: this.form_field.options[result_data.options_index].value
1215
+ });
1216
+ this.search_field_scale();
1217
+ return true;
1218
+ } else {
1219
+ return false;
1220
+ }
1221
+ };
1222
+
1223
+ Chosen.prototype.single_deselect_control_build = function() {
1224
+ if (!this.allow_single_deselect) {
1225
+ return;
1226
+ }
1227
+ if (!this.selected_item.find("abbr").length) {
1228
+ this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
1229
+ }
1230
+ return this.selected_item.addClass("chosen-single-with-deselect");
1231
+ };
1232
+
1233
+ Chosen.prototype.get_search_field_value = function() {
1234
+ return this.search_field.val();
1235
+ };
1236
+
1237
+ Chosen.prototype.get_search_text = function() {
1238
+ return $.trim(this.get_search_field_value());
1239
+ };
1240
+
1241
+ Chosen.prototype.escape_html = function(text) {
1242
+ return $('<div/>').text(text).html();
1243
+ };
1244
+
1245
+ Chosen.prototype.winnow_results_set_highlight = function() {
1246
+ var do_high, selected_results;
1247
+ selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
1248
+ do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
1249
+ if (do_high != null) {
1250
+ return this.result_do_highlight(do_high);
1251
+ }
1252
+ };
1253
+
1254
+ Chosen.prototype.no_results = function(terms) {
1255
+ var no_results_html;
1256
+ no_results_html = this.get_no_results_html(terms);
1257
+ this.search_results.append(no_results_html);
1258
+ return this.form_field_jq.trigger("chosen:no_results", {
1259
+ chosen: this
1260
+ });
1261
+ };
1262
+
1263
+ Chosen.prototype.no_results_clear = function() {
1264
+ return this.search_results.find(".no-results").remove();
1265
+ };
1266
+
1267
+ Chosen.prototype.keydown_arrow = function() {
1268
+ var next_sib;
1269
+ if (this.results_showing && this.result_highlight) {
1270
+ next_sib = this.result_highlight.nextAll("li.active-result").first();
1271
+ if (next_sib) {
1272
+ return this.result_do_highlight(next_sib);
1273
+ }
1274
+ } else {
1275
+ return this.results_show();
1276
+ }
1277
+ };
1278
+
1279
+ Chosen.prototype.keyup_arrow = function() {
1280
+ var prev_sibs;
1281
+ if (!this.results_showing && !this.is_multiple) {
1282
+ return this.results_show();
1283
+ } else if (this.result_highlight) {
1284
+ prev_sibs = this.result_highlight.prevAll("li.active-result");
1285
+ if (prev_sibs.length) {
1286
+ return this.result_do_highlight(prev_sibs.first());
1287
+ } else {
1288
+ if (this.choices_count() > 0) {
1289
+ this.results_hide();
1290
+ }
1291
+ return this.result_clear_highlight();
1292
+ }
1293
+ }
1294
+ };
1295
+
1296
+ Chosen.prototype.keydown_backstroke = function() {
1297
+ var next_available_destroy;
1298
+ if (this.pending_backstroke) {
1299
+ this.choice_destroy(this.pending_backstroke.find("a").first());
1300
+ return this.clear_backstroke();
1301
+ } else {
1302
+ next_available_destroy = this.search_container.siblings("li.search-choice").last();
1303
+ if (next_available_destroy.length && !next_available_destroy.hasClass("search-choice-disabled")) {
1304
+ this.pending_backstroke = next_available_destroy;
1305
+ if (this.single_backstroke_delete) {
1306
+ return this.keydown_backstroke();
1307
+ } else {
1308
+ return this.pending_backstroke.addClass("search-choice-focus");
1309
+ }
1310
+ }
1311
+ }
1312
+ };
1313
+
1314
+ Chosen.prototype.clear_backstroke = function() {
1315
+ if (this.pending_backstroke) {
1316
+ this.pending_backstroke.removeClass("search-choice-focus");
1317
+ }
1318
+ return this.pending_backstroke = null;
1319
+ };
1320
+
1321
+ Chosen.prototype.search_field_scale = function() {
1322
+ var div, i, len, style, style_block, styles, width;
1323
+ if (!this.is_multiple) {
1324
+ return;
1325
+ }
1326
+ style_block = {
1327
+ position: 'absolute',
1328
+ left: '-1000px',
1329
+ top: '-1000px',
1330
+ display: 'none',
1331
+ whiteSpace: 'pre'
1332
+ };
1333
+ styles = ['fontSize', 'fontStyle', 'fontWeight', 'fontFamily', 'lineHeight', 'textTransform', 'letterSpacing'];
1334
+ for (i = 0, len = styles.length; i < len; i++) {
1335
+ style = styles[i];
1336
+ style_block[style] = this.search_field.css(style);
1337
+ }
1338
+ div = $('<div />').css(style_block);
1339
+ div.text(this.get_search_field_value());
1340
+ $('body').append(div);
1341
+ width = div.width() + 25;
1342
+ div.remove();
1343
+ if (this.container.is(':visible')) {
1344
+ width = Math.min(this.container.outerWidth() - 10, width);
1345
+ }
1346
+ return this.search_field.width(width);
1347
+ };
1348
+
1349
+ Chosen.prototype.trigger_form_field_change = function(extra) {
1350
+ this.form_field_jq.trigger("input", extra);
1351
+ return this.form_field_jq.trigger("change", extra);
1352
+ };
1353
+
1354
+ return Chosen;
1355
+
1356
+ })(AbstractChosen);
1357
+
1358
+ }).call(this);
1359
+
inc/exopite-simple-options/assets/dev/jquery.finderSelect.js ADDED
@@ -0,0 +1,578 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // jQuery finderSelect: a jQuery plugin that activates selecting elements
2
+ // within a parent with Ctrl+Click, Command+Click and Shift+Click.
3
+ //
4
+ // Copyright 2013 Mike Angell
5
+ //
6
+ // Please see:
7
+ //
8
+ // https://github.com/evulse/finderselect
9
+ //
10
+ // For complete documentation.
11
+
12
+ (function( $ ) {
13
+
14
+ var d = $(document);
15
+ var b = $('body');
16
+
17
+ var commands = {
18
+ highlight: highlight,
19
+ unHighlight: unHighlight,
20
+ highlightAll: highlightAll,
21
+ unHighlightAll: unHighlightAll,
22
+ selected: selected,
23
+ children: children,
24
+ update: update,
25
+ addHook: addHook
26
+ };
27
+
28
+ var hooks = {};
29
+
30
+ var o = {};
31
+
32
+ var f = $.fn.finderSelect = function() {
33
+ if (typeof arguments[0] === 'string') {
34
+ var args = Array.prototype.slice.call(arguments);
35
+ args.splice(0, 1);
36
+ return commands[arguments[0]].apply(this, args);
37
+ }
38
+ else {
39
+ finderSelect.apply(this, arguments);
40
+ return this;
41
+ }
42
+
43
+ };
44
+
45
+ function finderSelect(opt) {
46
+
47
+ var p = $(this);
48
+ var options = {
49
+ selectClass: "selected",
50
+ unSelectClass: "un-selected",
51
+ currentClass: "selected-current",
52
+ lastClass: "selected-last",
53
+ shiftClass: "selected-shift",
54
+ ctrlClass: "selected-ctrl",
55
+ triggerUpdate: "finderSelectUpdate",
56
+ children: false,
57
+ event: "mousedown",
58
+ cursor: "pointer",
59
+ dragEvent: "mouseenter",
60
+ enableClickDrag: true,
61
+ enableShiftClick: true,
62
+ enableCtrlClick: true,
63
+ enableSingleClick: true,
64
+ enableSelectAll: true,
65
+ enableDisableSelection: true,
66
+ enableTouchCtrlDefault: true,
67
+ enableDesktopCtrlDefault: false,
68
+ totalSelector: false,
69
+ menuSelector: false,
70
+ menuXOffset: 0,
71
+ menuYOffset: 0
72
+
73
+ };
74
+
75
+ $.extend(options, opt);
76
+
77
+ o = options;
78
+
79
+ if(!o.children) {
80
+ o.children = f.detect.children(p);
81
+ }
82
+
83
+ f.h.off(f.get.siblings(p,o), o);
84
+
85
+ if(o.cursor) {
86
+ f.set.cursor(p,o);
87
+ }
88
+ if(o.enableDisableSelection) {
89
+ f.core.disableSelection(p,o);
90
+ }
91
+ if(o.enableClickDrag) {
92
+ f.core.clickDrag(p,o);
93
+ }
94
+ if(o.enableSelectAll) {
95
+ f.core.selectAll(p,o);
96
+ }
97
+ if(o.enableShiftClick || o.enableCtrlClick || o.enableSingleClick) {
98
+ f.core.click(p,o);
99
+ }
100
+ if(o.totalSelector) {
101
+ f.core.totalUpdate(p,o);
102
+ }
103
+ if(o.menuSelector) {
104
+ f.core.loadMenu(p,o);
105
+ }
106
+ };
107
+
108
+ function highlight(el) {
109
+ f.h.on(el, o);
110
+ return this;
111
+ }
112
+ function unHighlight(el) {
113
+ f.h.off(el, o);
114
+ return this;
115
+ }
116
+ function highlightAll() {
117
+ var p = $(this);
118
+ f.h.on(p.find(o.children), o);
119
+ return this;
120
+ }
121
+ function unHighlightAll() {
122
+ var p = $(this);
123
+ f.h.off(p.find(o.children), o);
124
+ return this;
125
+ }
126
+ function selected() {
127
+ var p = $(this);
128
+ return p.find(o.children+'.'+o.selectClass);
129
+ }
130
+ function children() {
131
+ var p = $(this);
132
+ return p.find(o.children);
133
+ }
134
+ function update() {
135
+ var p = $(this);
136
+ f.t.update(p, o);
137
+ return this;
138
+ }
139
+ function addHook(hookName, fn) {
140
+ if(typeof hookName == "object"){
141
+ var i;
142
+ for(i=0; i<hookName.length; i++){
143
+ var theHook = hookName[i];
144
+ if(!hooks[theHook]){
145
+ hooks[theHook] = [];
146
+ }
147
+ hooks[theHook].push(fn);
148
+ }
149
+ } else {
150
+ if(!hooks[hookName]){
151
+ hooks[hookName] = [];
152
+ }
153
+ hooks[hookName].push(fn);
154
+ }
155
+
156
+ return this;
157
+ }
158
+
159
+ f.core = {
160
+ clickDrag: function(p,o) {
161
+ f.set.mouseDown(false);
162
+ b.mousedown(function(e) {
163
+ if(f.detect.leftMouse(e)) { f.set.mouseDown(true);}
164
+ });
165
+ b.mouseup(function(e) {
166
+ if(f.detect.leftMouse(e)) { f.set.mouseDown(false);}
167
+ });
168
+ p.on(o.dragEvent, o.children, function(e){
169
+ var c = f.get.clicks(p,o,$(this));
170
+
171
+ if (f.get.mouseDown() && f.detect.ctrl(e)) {
172
+ f.t.deleteSelection(o);
173
+ f.t.toggleDrag(p,c,o);
174
+ }
175
+ });
176
+
177
+ return p;
178
+ },
179
+ click: function(p,o) {
180
+ p.on(o.event, o.children, function(e){
181
+ if(f.detect.leftMouse(e)) {
182
+ var c = f.get.clicks(p,o,$(this));
183
+
184
+ if (!(f.detect.ctrl(e) && o.enableCtrlClick) && (f.detect.shift(e) && o.enableShiftClick)) {
185
+ f.t.deleteSelection(o);
186
+ f.t.shiftClick(p,c,o);
187
+ }
188
+
189
+ if (((f.detect.ctrl(e) && o.enableCtrlClick) || (f.detect.touch() && o.enableTouchCtrlDefault) || o.enableDesktopCtrlDefault) && !(f.detect.shift(e) && o.enableShiftClick)) {
190
+ f.t.toggleClick(p,c,o);
191
+ }
192
+
193
+ if (!(f.detect.ctrl(e) && o.enableCtrlClick) && !(f.detect.shift(e) && o.enableShiftClick) && o.enableSingleClick && !o.enableDesktopCtrlDefault) {
194
+ f.t.singleClick(p,c,o);
195
+ }
196
+ }
197
+ });
198
+ },
199
+ selectAll: function(p,o) {
200
+ p.on('mouseover', function(){
201
+ d.on("keydown", turnOff);
202
+ });
203
+ p.on('mouseout', function(){
204
+ d.off("keydown", turnOff);
205
+ });
206
+
207
+ function turnOff(e) {
208
+ if (f.detect.ctrl(e)) {
209
+ if (e.keyCode == 65) {
210
+ e.preventDefault();
211
+ if(f.detect.alt(e)) {
212
+ f.t.unHAll(p, o);
213
+ } else {
214
+ f.t.hAll(p,o);
215
+ }
216
+ }
217
+ }
218
+ console.log(e.keyCode);
219
+ if (e.keyCode == 38) {
220
+ var last = f.get.click(p, o.shiftClass);
221
+ if(last.length == 0) {
222
+ last = f.get.click(p, o.lastClass);
223
+ }
224
+ var cur = f.get.prev(last,o);
225
+ if(last.length == 0) {
226
+ cur = p.find(o.children).last();
227
+ }
228
+ if(f.detect.alt(e)) {
229
+ cur = p.find(o.children).first();
230
+ }
231
+ e.preventDefault();
232
+ if(cur.length != 0) {
233
+
234
+ if(f.detect.shift(e) && o.enableShiftClick) {
235
+ var c = f.get.clicks(p,o,cur);
236
+ f.t.shiftClick(p,c,o);
237
+ } else {
238
+ var c = f.get.clicks(p,o,cur);
239
+ f.t.singleClick(p,c,o);
240
+ }
241
+ }
242
+ }
243
+ if (e.keyCode == 40) {
244
+ var last = f.get.click(p, o.shiftClass);
245
+ if(last.length == 0) {
246
+ last = f.get.click(p, o.lastClass);
247
+ }
248
+ var cur = f.get.next(last,o);
249
+ if(last.length == 0) {
250
+ cur = p.find(o.children).first();
251
+ }
252
+ if(f.detect.alt(e)) {
253
+ cur = p.find(o.children).last();
254
+ }
255
+ e.preventDefault();
256
+ if(cur.length != 0) {
257
+
258
+ if(f.detect.shift(e) && o.enableShiftClick) {
259
+ var c = f.get.clicks(p,o,cur);
260
+ f.t.shiftClick(p,c,o);
261
+ } else {
262
+ var c = f.get.clicks(p,o,cur);
263
+ f.t.singleClick(p,c,o);
264
+ }
265
+
266
+ }
267
+ }
268
+ }
269
+
270
+ },
271
+ totalUpdate: function(p,o) {
272
+ p.on(o.triggerUpdate, function(){
273
+ $(o.totalSelector).html($(this).find(o.children).filter('.'+o.selectClass).length)
274
+ });
275
+ },
276
+ loadMenu: function(p, o) {
277
+ p.bind("contextmenu",function(e){
278
+ $(o.menuSelector).css({left:(e.pageX+o.menuXOffset),top:(e.pageY+o.menuYOffset)}).show();
279
+ return false;
280
+ }).bind("mousedown",function(){
281
+ $(o.menuSelector).hide();
282
+ });
283
+ $(o.menuSelector).bind("click",function(){
284
+ $(this).hide();
285
+ });
286
+ },
287
+ disableSelection: function(p, o) {
288
+ d.on('keydown', function(){
289
+ p.on("selectstart", turnOffSelection);
290
+ }).on('keyup', function(){
291
+ p.off("selectstart", turnOffSelection);
292
+ });
293
+
294
+ function turnOffSelection(e) {
295
+ e.preventDefault();
296
+ }
297
+ }
298
+ };
299
+
300
+
301
+ f.h = {
302
+ on: function(el, o) {
303
+ f.get.hook('highlight:before', [el, o]);
304
+ el.removeClass(o.unSelectClass);
305
+ el.addClass(o.selectClass);
306
+ f.get.hook('highlight:after', [el, o]);
307
+ },
308
+ off: function(el,o) {
309
+ f.get.hook('unHighlight:before', [el, o]);
310
+ el.removeClass(o.selectClass);
311
+ el.addClass(o.unSelectClass);
312
+ f.get.hook('unHighlight:after', [el, o]);
313
+ },
314
+ tog: function(el,o) {
315
+
316
+ el.each(function () {
317
+ var child = $(this);
318
+ if(f.detect.h(child, o)) {
319
+ f.h.off(child, o);
320
+ } else {
321
+ f.h.on(child, o);
322
+ }
323
+ });
324
+ },
325
+ reset: function(el,o) {
326
+ el.each(function () {
327
+ var child = $(this);
328
+ if(f.detect.lastH(child, o)) {
329
+ f.h.on(child, o);
330
+ } else {
331
+ f.h.off(child, o);
332
+ }
333
+ });
334
+
335
+ },
336
+ state: function(el,o) {
337
+ el.each(function () {
338
+ var child = $(this);
339
+ if(f.detect.h(child, o)) {
340
+ child.removeClass('stateUnSelected');
341
+ child.addClass('stateSelected');
342
+ } else {
343
+ child.removeClass('stateSelected');
344
+ child.addClass('stateUnSelected');
345
+
346
+ }
347
+ });
348
+
349
+ }
350
+ };
351
+
352
+ f.detect = {
353
+ leftMouse: function(e) {
354
+ return (e.which == 1);
355
+ },
356
+ shift: function(e) {
357
+ return e.shiftKey;
358
+ },
359
+ alt: function(e) {
360
+ return e.altKey;
361
+ },
362
+ ctrl: function(e) {
363
+ return (e.ctrlKey || e.metaKey);
364
+ },
365
+ h: function(el,o) {
366
+ return el.hasClass(o.selectClass);
367
+ },
368
+ lastH: function(el,o) {
369
+ return el.hasClass('stateSelected');
370
+ },
371
+ touch: function() {
372
+ return !!('ontouchstart' in window) // works on most browsers
373
+ || !!('onmsgesturechange' in window); // works on ie10
374
+ },
375
+ children: function(el) {
376
+ return el.children().get(0).tagName;
377
+ }
378
+ };
379
+
380
+ f.set = {
381
+ clicks: function(curr, shif, ctrl, p, o) {
382
+ f.set.click(p, false, o.currentClass);
383
+ f.set.click(p, curr, o.lastClass);
384
+ f.set.click(p, shif,o.shiftClass);
385
+ f.set.click(p, ctrl,o.ctrlClass);
386
+ f.t.update(p, o);
387
+ },
388
+ click: function(p,el,c) {
389
+ f.get.click(p,c).removeClass(c);
390
+ if(el) { el.addClass(c); }
391
+ },
392
+ mouseDown: function(bool) {
393
+ return b.data('down', bool);
394
+ },
395
+ cursor: function(p,o) {
396
+ var s = f.get.siblings(p,o);
397
+ return s.css('cursor', o.cursor);
398
+ }
399
+ };
400
+
401
+ f.get = {
402
+ clicks: function(p, o, curr) {
403
+ var c = {};
404
+ f.set.click(p, curr, o.currentClass);
405
+ c.current = {v:curr,c: o.currentClass};
406
+ c.hard = {v:f.get.click(p, o.lastClass),c:o.lastClass};
407
+ c.shift = {v:f.get.click(p, o.shiftClass),c:o.shiftClass};
408
+ c.ctrl = {v:f.get.click(p, o.ctrlClass),c:o.ctrlClass};
409
+ return c;
410
+ },
411
+ click: function(p,c) {
412
+ return p.find('.'+c);
413
+ },
414
+ mouseDown: function() {
415
+ return b.data('down');
416
+ },
417
+ siblings: function(p, o) {
418
+ return p.find(o.children);
419
+ },
420
+ between: function(s,y, z) {
421
+ if(s.index(y.v) < s.index(z.v)) {
422
+
423
+ return f.get.elem(true, y.v, false, z.c);
424
+ } else {
425
+ return f.get.elem(false, y.v, false, z.c);
426
+ }
427
+ },
428
+ elem: function(d, el, s, u) {
429
+ var $els = [], $el = (d) ? el.next() : el.prev();
430
+ while( $el.length ) {
431
+ if(typeof u === 'undefined' || !u || !$el.hasClass(u)) {
432
+ if(typeof s === 'undefined' || !s || $el.hasClass(s)) {
433
+ $els.push($el[0]);
434
+ }
435
+ $el = (d) ? $el.next() : $el.prev();
436
+ } else {
437
+ $el = {};
438
+ }
439
+ }
440
+ return $($els)
441
+ },
442
+ next: function(p, o) {
443
+ return p.next(o.children);
444
+ },
445
+ prev: function(p, o) {
446
+ return p.prev(o.children);
447
+ },
448
+ hook: function(hookName, data){
449
+ var hooked = hooks[hookName]
450
+
451
+ if(hooked){
452
+ for(i=0; i<hooked.length; i++){
453
+ hooked[i].apply(undefined, data);
454
+ }
455
+ }
456
+ }
457
+
458
+ };
459
+
460
+ f.t = {
461
+ update: function(el, o) {
462
+ return el.trigger(o.triggerUpdate);
463
+ },
464
+ deleteSelection: function(o) {
465
+ if(o.enableDisableSelection) {
466
+ if(document.getSelection) {
467
+ var sel = document.getSelection();
468
+ if(sel.removeAllRanges) {
469
+ sel.removeAllRanges();
470
+ }
471
+ }
472
+ }
473
+ },
474
+ singleClick: function(p,c,o) {
475
+ var s = f.get.siblings(p,o);
476
+ f.h.off(s, o);
477
+ f.h.on(c.current.v, o);
478
+ f.set.clicks(c.current.v, null, null, p, o);
479
+ },
480
+ toggleClick: function(p,c,o) {
481
+ var s = f.get.siblings(p,o);
482
+ f.h.tog(c.current.v, o);
483
+ f.h.state(s,o);
484
+ f.set.clicks(c.current.v, null, null, p, o);
485
+ },
486
+ toggleClick: function(p,c,o) {
487
+ var s = f.get.siblings(p,o);
488
+ f.h.tog(c.current.v, o);
489
+ f.h.state(s,o);
490
+ f.set.clicks(c.current.v, null, null, p, o);
491
+ },
492
+ toggleDrag: function(p,c,o) {
493
+ var s = f.get.siblings(p,o);
494
+ f.h.reset(s,o);
495
+ if(s.index(c.current.v) != s.index(c.hard.v)) {
496
+ f.h.tog(f.get.between(s, c.current, c.hard), o);
497
+ f.h.tog(c.current.v, o);
498
+ }
499
+ f.set.clicks(c.hard.v, null, null, p, o);
500
+
501
+ },
502
+ shiftClick: function(p, c, o) {
503
+ var s = f.get.siblings(p,o);
504
+ var z = s.index(c.current.v);
505
+ var x = s.index(c.hard.v);
506
+ if(c.hard.v.length != 0 && !f.detect.h(c.hard.v, o)) {
507
+ var start = f.get.elem(true, c.hard.v, o.selectClass);
508
+ if(start.length > 0) {
509
+ c.hard.v = $(start[0]);
510
+ f.set.click(p, c.hard.v, o.lastClass);
511
+ } else {
512
+ var start = f.get.elem(z < x, c.hard.v, o.selectClass);
513
+ if(start.length > 0) {
514
+ start = (z > x ) ? $(start[0]) : $(start[start.length-1]);
515
+ c.hard.v = start;
516
+ f.set.click(p, c.hard.v, o.lastClass);
517
+ } else {
518
+ c.hard.v = s.first();
519
+ f.set.click(p, c.hard.v, o.lastClass);
520
+ f.t.singleClick(s,{current:{v:s.first()}},o);
521
+ }
522
+
523
+ }
524
+
525
+ }
526
+
527
+ var x = s.index(c.hard.v);
528
+ var y = s.index(c.shift.v);
529
+ var z = s.index(c.current.v);
530
+
531
+
532
+ if(c.hard.v.length == 0){
533
+ f.t.singleClick(s,{current:{v:s.first()}},o);
534
+ }
535
+
536
+ if(c.shift.v.length != 0) {
537
+ if((x < y && x < z && z < y) || (x > y && x > z && z > y)) {
538
+ f.h.off(f.get.between(s, c.shift, c.current), o);
539
+ }
540
+ if((x < y && x > z && z < y) || (x > y && x < z && z > y)) {
541
+ f.h.off(f.get.between(s, c.shift, c.hard), o);
542
+ f.h.on(f.get.between(s, c.current, c.hard), o);
543
+ }
544
+ if((x > y && x > z && z < y) || (x < y && x < z && z > y) || (x == y)) {
545
+ f.h.on(f.get.between(s, c.shift, c.current), o);
546
+ } else {
547
+ f.h.off(c.shift.v, o);
548
+ f.t.unHExist(z>y, c.shift.v,o);
549
+ }
550
+ } else {
551
+ f.t.unHExist(z>x,c.hard.v,o);
552
+ f.h.on(f.get.between(s, c.current, c.hard), o);
553
+ }
554
+
555
+ f.h.on(c.current.v, o);
556
+ f.set.clicks(c.hard.v, c.current.v, null, p, o);
557
+
558
+ },
559
+ unHAll: function(p,o) {
560
+ f.h.off(p.find(o.children), o);
561
+ f.t.update(p, o);
562
+ },
563
+ hAll: function(p,o) {
564
+ f.h.on(p.find(o.children), o);
565
+ f.t.update(p, o);
566
+ },
567
+ unHExist: function(bool,el,o) {
568
+ if(bool) {
569
+ f.h.off(f.get.elem(false, el, false, o.unSelectClass), o);
570
+ } else {
571
+
572
+ f.h.off(f.get.elem(true, el, false, o.unSelectClass), o);
573
+ }
574
+ }
575
+
576
+ };
577
+
578
+ })(window.jQuery || window.Zepto);
inc/exopite-simple-options/assets/dev/jquery.fine-uploader.js ADDED
@@ -0,0 +1,7713 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Fine Uploader 5.15.5 - MIT licensed. http://fineuploader.com
2
+ (function(global) {
3
+ (function($) {
4
+ "use strict";
5
+ var $el, pluginOptions = [ "uploaderType", "endpointType" ];
6
+ function init(options) {
7
+ var xformedOpts = transformVariables(options || {}), newUploaderInstance = getNewUploaderInstance(xformedOpts);
8
+ uploader(newUploaderInstance);
9
+ addCallbacks(xformedOpts, newUploaderInstance);
10
+ return $el;
11
+ }
12
+ function getNewUploaderInstance(params) {
13
+ var uploaderType = pluginOption("uploaderType"), namespace = pluginOption("endpointType");
14
+ if (uploaderType) {
15
+ uploaderType = uploaderType.charAt(0).toUpperCase() + uploaderType.slice(1).toLowerCase();
16
+ if (namespace) {
17
+ return new qq[namespace]["FineUploader" + uploaderType](params);
18
+ }
19
+ return new qq["FineUploader" + uploaderType](params);
20
+ } else {
21
+ if (namespace) {
22
+ return new qq[namespace].FineUploader(params);
23
+ }
24
+ return new qq.FineUploader(params);
25
+ }
26
+ }
27
+ function dataStore(key, val) {
28
+ var data = $el.data("fineuploader");
29
+ if (val) {
30
+ if (data === undefined) {
31
+ data = {};
32
+ }
33
+ data[key] = val;
34
+ $el.data("fineuploader", data);
35
+ } else {
36
+ if (data === undefined) {
37
+ return null;
38
+ }
39
+ return data[key];
40
+ }
41
+ }
42
+ function uploader(instanceToStore) {
43
+ return dataStore("uploader", instanceToStore);
44
+ }
45
+ function pluginOption(option, optionVal) {
46
+ return dataStore(option, optionVal);
47
+ }
48
+ function addCallbacks(transformedOpts, newUploaderInstance) {
49
+ var callbacks = transformedOpts.callbacks = {};
50
+ $.each(newUploaderInstance._options.callbacks, function(prop, nonJqueryCallback) {
51
+ var name, callbackEventTarget;
52
+ name = /^on(\w+)/.exec(prop)[1];
53
+ name = name.substring(0, 1).toLowerCase() + name.substring(1);
54
+ callbackEventTarget = $el;
55
+ callbacks[prop] = function() {
56
+ var originalArgs = Array.prototype.slice.call(arguments), transformedArgs = [], nonJqueryCallbackRetVal, jqueryEventCallbackRetVal;
57
+ $.each(originalArgs, function(idx, arg) {
58
+ transformedArgs.push(maybeWrapInJquery(arg));
59
+ });
60
+ nonJqueryCallbackRetVal = nonJqueryCallback.apply(this, originalArgs);
61
+ try {
62
+ jqueryEventCallbackRetVal = callbackEventTarget.triggerHandler(name, transformedArgs);
63
+ } catch (error) {
64
+ qq.log("Caught error in Fine Uploader jQuery event handler: " + error.message, "error");
65
+ }
66
+ if (nonJqueryCallbackRetVal != null) {
67
+ return nonJqueryCallbackRetVal;
68
+ }
69
+ return jqueryEventCallbackRetVal;
70
+ };
71
+ });
72
+ newUploaderInstance._options.callbacks = callbacks;
73
+ }
74
+ function transformVariables(source, dest) {
75
+ var xformed, arrayVals;
76
+ if (dest === undefined) {
77
+ if (source.uploaderType !== "basic") {
78
+ xformed = {
79
+ element: $el[0]
80
+ };
81
+ } else {
82
+ xformed = {};
83
+ }
84
+ } else {
85
+ xformed = dest;
86
+ }
87
+ $.each(source, function(prop, val) {
88
+ if ($.inArray(prop, pluginOptions) >= 0) {
89
+ pluginOption(prop, val);
90
+ } else if (val instanceof $) {
91
+ xformed[prop] = val[0];
92
+ } else if ($.isPlainObject(val)) {
93
+ xformed[prop] = {};
94
+ transformVariables(val, xformed[prop]);
95
+ } else if ($.isArray(val)) {
96
+ arrayVals = [];
97
+ $.each(val, function(idx, arrayVal) {
98
+ var arrayObjDest = {};
99
+ if (arrayVal instanceof $) {
100
+ $.merge(arrayVals, arrayVal);
101
+ } else if ($.isPlainObject(arrayVal)) {
102
+ transformVariables(arrayVal, arrayObjDest);
103
+ arrayVals.push(arrayObjDest);
104
+ } else {
105
+ arrayVals.push(arrayVal);
106
+ }
107
+ });
108
+ xformed[prop] = arrayVals;
109
+ } else {
110
+ xformed[prop] = val;
111
+ }
112
+ });
113
+ if (dest === undefined) {
114
+ return xformed;
115
+ }
116
+ }
117
+ function isValidCommand(command) {
118
+ return $.type(command) === "string" && !command.match(/^_/) && uploader()[command] !== undefined;
119
+ }
120
+ function delegateCommand(command) {
121
+ var xformedArgs = [], origArgs = Array.prototype.slice.call(arguments, 1), retVal;
122
+ transformVariables(origArgs, xformedArgs);
123
+ retVal = uploader()[command].apply(uploader(), xformedArgs);
124
+ return maybeWrapInJquery(retVal);
125
+ }
126
+ function maybeWrapInJquery(val) {
127
+ var transformedVal = val;
128
+ if (val != null && typeof val === "object" && (val.nodeType === 1 || val.nodeType === 9) && val.cloneNode) {
129
+ transformedVal = $(val);
130
+ }
131
+ return transformedVal;
132
+ }
133
+ $.fn.fineUploader = function(optionsOrCommand) {
134
+ var self = this, selfArgs = arguments, retVals = [];
135
+ this.each(function(index, el) {
136
+ $el = $(el);
137
+ if (uploader() && isValidCommand(optionsOrCommand)) {
138
+ retVals.push(delegateCommand.apply(self, selfArgs));
139
+ if (self.length === 1) {
140
+ return false;
141
+ }
142
+ } else if (typeof optionsOrCommand === "object" || !optionsOrCommand) {
143
+ init.apply(self, selfArgs);
144
+ } else {
145
+ $.error("Method " + optionsOrCommand + " does not exist on jQuery.fineUploader");
146
+ }
147
+ });
148
+ if (retVals.length === 1) {
149
+ return retVals[0];
150
+ } else if (retVals.length > 1) {
151
+ return retVals;
152
+ }
153
+ return this;
154
+ };
155
+ })(jQuery);
156
+ (function($) {
157
+ "use strict";
158
+ var rootDataKey = "fineUploaderDnd", $el;
159
+ function init(options) {
160
+ if (!options) {
161
+ options = {};
162
+ }
163
+ options.dropZoneElements = [ $el ];
164
+ var xformedOpts = transformVariables(options);
165
+ addCallbacks(xformedOpts);
166
+ dnd(new qq.DragAndDrop(xformedOpts));
167
+ return $el;
168
+ }
169
+ function dataStore(key, val) {
170
+ var data = $el.data(rootDataKey);
171
+ if (val) {
172
+ if (data === undefined) {
173
+ data = {};
174
+ }
175
+ data[key] = val;
176
+ $el.data(rootDataKey, data);
177
+ } else {
178
+ if (data === undefined) {
179
+ return null;
180
+ }
181
+ return data[key];
182
+ }
183
+ }
184
+ function dnd(instanceToStore) {
185
+ return dataStore("dndInstance", instanceToStore);
186
+ }
187
+ function addCallbacks(transformedOpts) {
188
+ var callbacks = transformedOpts.callbacks = {};
189
+ $.each(new qq.DragAndDrop.callbacks(), function(prop, func) {
190
+ var name = prop, $callbackEl;
191
+ $callbackEl = $el;
192
+ callbacks[prop] = function() {
193
+ var args = Array.prototype.slice.call(arguments), jqueryHandlerResult = $callbackEl.triggerHandler(name, args);
194
+ return jqueryHandlerResult;
195
+ };
196
+ });
197
+ }
198
+ function transformVariables(source, dest) {
199
+ var xformed, arrayVals;
200
+ if (dest === undefined) {
201
+ xformed = {};
202
+ } else {
203
+ xformed = dest;
204
+ }
205
+ $.each(source, function(prop, val) {
206
+ if (val instanceof $) {
207
+ xformed[prop] = val[0];
208
+ } else if ($.isPlainObject(val)) {
209
+ xformed[prop] = {};
210
+ transformVariables(val, xformed[prop]);
211
+ } else if ($.isArray(val)) {
212
+ arrayVals = [];
213
+ $.each(val, function(idx, arrayVal) {
214
+ if (arrayVal instanceof $) {
215
+ $.merge(arrayVals, arrayVal);
216
+ } else {
217
+ arrayVals.push(arrayVal);
218
+ }
219
+ });
220
+ xformed[prop] = arrayVals;
221
+ } else {
222
+ xformed[prop] = val;
223
+ }
224
+ });
225
+ if (dest === undefined) {
226
+ return xformed;
227
+ }
228
+ }
229
+ function isValidCommand(command) {
230
+ return $.type(command) === "string" && command === "dispose" && dnd()[command] !== undefined;
231
+ }
232
+ function delegateCommand(command) {
233
+ var xformedArgs = [], origArgs = Array.prototype.slice.call(arguments, 1);
234
+ transformVariables(origArgs, xformedArgs);
235
+ return dnd()[command].apply(dnd(), xformedArgs);
236
+ }
237
+ $.fn.fineUploaderDnd = function(optionsOrCommand) {
238
+ var self = this, selfArgs = arguments, retVals = [];
239
+ this.each(function(index, el) {
240
+ $el = $(el);
241
+ if (dnd() && isValidCommand(optionsOrCommand)) {
242
+ retVals.push(delegateCommand.apply(self, selfArgs));
243
+ if (self.length === 1) {
244
+ return false;
245
+ }
246
+ } else if (typeof optionsOrCommand === "object" || !optionsOrCommand) {
247
+ init.apply(self, selfArgs);
248
+ } else {
249
+ $.error("Method " + optionsOrCommand + " does not exist in Fine Uploader's DnD module.");
250
+ }
251
+ });
252
+ if (retVals.length === 1) {
253
+ return retVals[0];
254
+ } else if (retVals.length > 1) {
255
+ return retVals;
256
+ }
257
+ return this;
258
+ };
259
+ })(jQuery);
260
+ var qq = function(element) {
261
+ "use strict";
262
+ return {
263
+ hide: function() {
264
+ element.style.display = "none";
265
+ return this;
266
+ },
267
+ attach: function(type, fn) {
268
+ if (element.addEventListener) {
269
+ element.addEventListener(type, fn, false);
270
+ } else if (element.attachEvent) {
271
+ element.attachEvent("on" + type, fn);
272
+ }
273
+ return function() {
274
+ qq(element).detach(type, fn);
275
+ };
276
+ },
277
+ detach: function(type, fn) {
278
+ if (element.removeEventListener) {
279
+ element.removeEventListener(type, fn, false);
280
+ } else if (element.attachEvent) {
281
+ element.detachEvent("on" + type, fn);
282
+ }
283
+ return this;
284
+ },
285
+ contains: function(descendant) {
286
+ if (!descendant) {
287
+ return false;
288
+ }
289
+ if (element === descendant) {
290
+ return true;
291
+ }
292
+ if (element.contains) {
293
+ return element.contains(descendant);
294
+ } else {
295
+ return !!(descendant.compareDocumentPosition(element) & 8);
296
+ }
297
+ },
298
+ insertBefore: function(elementB) {
299
+ elementB.parentNode.insertBefore(element, elementB);
300
+ return this;
301
+ },
302
+ remove: function() {
303
+ element.parentNode.removeChild(element);
304
+ return this;
305
+ },
306
+ css: function(styles) {
307
+ if (element.style == null) {
308
+ throw new qq.Error("Can't apply style to node as it is not on the HTMLElement prototype chain!");
309
+ }
310
+ if (styles.opacity != null) {
311
+ if (typeof element.style.opacity !== "string" && typeof element.filters !== "undefined") {
312
+ styles.filter = "alpha(opacity=" + Math.round(100 * styles.opacity) + ")";
313
+ }
314
+ }
315
+ qq.extend(element.style, styles);
316
+ return this;
317
+ },
318
+ hasClass: function(name, considerParent) {
319
+ var re = new RegExp("(^| )" + name + "( |$)");
320
+ return re.test(element.className) || !!(considerParent && re.test(element.parentNode.className));
321
+ },
322
+ addClass: function(name) {
323
+ if (!qq(element).hasClass(name)) {
324
+ element.className += " " + name;
325
+ }
326
+ return this;
327
+ },
328
+ removeClass: function(name) {
329
+ var re = new RegExp("(^| )" + name + "( |$)");
330
+ element.className = element.className.replace(re, " ").replace(/^\s+|\s+$/g, "");
331
+ return this;
332
+ },
333
+ getByClass: function(className, first) {
334
+ var candidates, result = [];
335
+ if (first && element.querySelector) {
336
+ return element.querySelector("." + className);
337
+ } else if (element.querySelectorAll) {
338
+ return element.querySelectorAll("." + className);
339
+ }
340
+ candidates = element.getElementsByTagName("*");
341
+ qq.each(candidates, function(idx, val) {
342
+ if (qq(val).hasClass(className)) {
343
+ result.push(val);
344
+ }
345
+ });
346
+ return first ? result[0] : result;
347
+ },
348
+ getFirstByClass: function(className) {
349
+ return qq(element).getByClass(className, true);
350
+ },
351
+ children: function() {
352
+ var children = [], child = element.firstChild;
353
+ while (child) {
354
+ if (child.nodeType === 1) {
355
+ children.push(child);
356
+ }
357
+ child = child.nextSibling;
358
+ }
359
+ return children;
360
+ },
361
+ setText: function(text) {
362
+ element.innerText = text;
363
+ element.textContent = text;
364
+ return this;
365
+ },
366
+ clearText: function() {
367
+ return qq(element).setText("");
368
+ },
369
+ hasAttribute: function(attrName) {
370
+ var attrVal;
371
+ if (element.hasAttribute) {
372
+ if (!element.hasAttribute(attrName)) {
373
+ return false;
374
+ }
375
+ return /^false$/i.exec(element.getAttribute(attrName)) == null;
376
+ } else {
377
+ attrVal = element[attrName];
378
+ if (attrVal === undefined) {
379
+ return false;
380
+ }
381
+ return /^false$/i.exec(attrVal) == null;
382
+ }
383
+ }
384
+ };
385
+ };
386
+ (function() {
387
+ "use strict";
388
+ qq.canvasToBlob = function(canvas, mime, quality) {
389
+ return qq.dataUriToBlob(canvas.toDataURL(mime, quality));
390
+ };
391
+ qq.dataUriToBlob = function(dataUri) {
392
+ var arrayBuffer, byteString, createBlob = function(data, mime) {
393
+ var BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder, blobBuilder = BlobBuilder && new BlobBuilder();
394
+ if (blobBuilder) {
395
+ blobBuilder.append(data);
396
+ return blobBuilder.getBlob(mime);
397
+ } else {
398
+ return new Blob([ data ], {
399
+ type: mime
400
+ });
401
+ }
402
+ }, intArray, mimeString;
403
+ if (dataUri.split(",")[0].indexOf("base64") >= 0) {
404
+ byteString = atob(dataUri.split(",")[1]);
405
+ } else {
406
+ byteString = decodeURI(dataUri.split(",")[1]);
407
+ }
408
+ mimeString = dataUri.split(",")[0].split(":")[1].split(";")[0];
409
+ arrayBuffer = new ArrayBuffer(byteString.length);
410
+ intArray = new Uint8Array(arrayBuffer);
411
+ qq.each(byteString, function(idx, character) {
412
+ intArray[idx] = character.charCodeAt(0);
413
+ });
414
+ return createBlob(arrayBuffer, mimeString);
415
+ };
416
+ qq.log = function(message, level) {
417
+ if (window.console) {
418
+ if (!level || level === "info") {
419
+ window.console.log(message);
420
+ } else {
421
+ if (window.console[level]) {
422
+ window.console[level](message);
423
+ } else {
424
+ window.console.log("<" + level + "> " + message);
425
+ }
426
+ }
427
+ }
428
+ };
429
+ qq.isObject = function(variable) {
430
+ return variable && !variable.nodeType && Object.prototype.toString.call(variable) === "[object Object]";
431
+ };
432
+ qq.isFunction = function(variable) {
433
+ return typeof variable === "function";
434
+ };
435
+ qq.isArray = function(value) {
436
+ return Object.prototype.toString.call(value) === "[object Array]" || value && window.ArrayBuffer && value.buffer && value.buffer.constructor === ArrayBuffer;
437
+ };
438
+ qq.isItemList = function(maybeItemList) {
439
+ return Object.prototype.toString.call(maybeItemList) === "[object DataTransferItemList]";
440
+ };
441
+ qq.isNodeList = function(maybeNodeList) {
442
+ return Object.prototype.toString.call(maybeNodeList) === "[object NodeList]" || maybeNodeList.item && maybeNodeList.namedItem;
443
+ };
444
+ qq.isString = function(maybeString) {
445
+ return Object.prototype.toString.call(maybeString) === "[object String]";
446
+ };
447
+ qq.trimStr = function(string) {
448
+ if (String.prototype.trim) {
449
+ return string.trim();
450
+ }
451
+ return string.replace(/^\s+|\s+$/g, "");
452
+ };
453
+ qq.format = function(str) {
454
+ var args = Array.prototype.slice.call(arguments, 1), newStr = str, nextIdxToReplace = newStr.indexOf("{}");
455
+ qq.each(args, function(idx, val) {
456
+ var strBefore = newStr.substring(0, nextIdxToReplace), strAfter = newStr.substring(nextIdxToReplace + 2);
457
+ newStr = strBefore + val + strAfter;
458
+ nextIdxToReplace = newStr.indexOf("{}", nextIdxToReplace + val.length);
459
+ if (nextIdxToReplace < 0) {
460
+ return false;
461
+ }
462
+ });
463
+ return newStr;
464
+ };
465
+ qq.isFile = function(maybeFile) {
466
+ return window.File && Object.prototype.toString.call(maybeFile) === "[object File]";
467
+ };
468
+ qq.isFileList = function(maybeFileList) {
469
+ return window.FileList && Object.prototype.toString.call(maybeFileList) === "[object FileList]";
470
+ };
471
+ qq.isFileOrInput = function(maybeFileOrInput) {
472
+ return qq.isFile(maybeFileOrInput) || qq.isInput(maybeFileOrInput);
473
+ };
474
+ qq.isInput = function(maybeInput, notFile) {
475
+ var evaluateType = function(type) {
476
+ var normalizedType = type.toLowerCase();
477
+ if (notFile) {
478
+ return normalizedType !== "file";
479
+ }
480
+ return normalizedType === "file";
481
+ };
482
+ if (window.HTMLInputElement) {
483
+ if (Object.prototype.toString.call(maybeInput) === "[object HTMLInputElement]") {
484
+ if (maybeInput.type && evaluateType(maybeInput.type)) {
485
+ return true;
486
+ }
487
+ }
488
+ }
489
+ if (maybeInput.tagName) {
490
+ if (maybeInput.tagName.toLowerCase() === "input") {
491
+ if (maybeInput.type && evaluateType(maybeInput.type)) {
492
+ return true;
493
+ }
494
+ }
495
+ }
496
+ return false;
497
+ };
498
+ qq.isBlob = function(maybeBlob) {
499
+ if (window.Blob && Object.prototype.toString.call(maybeBlob) === "[object Blob]") {
500
+ return true;
501
+ }
502
+ };
503
+ qq.isXhrUploadSupported = function() {
504
+ var input = document.createElement("input");
505
+ input.type = "file";
506
+ return input.multiple !== undefined && typeof File !== "undefined" && typeof FormData !== "undefined" && typeof qq.createXhrInstance().upload !== "undefined";
507
+ };
508
+ qq.createXhrInstance = function() {
509
+ if (window.XMLHttpRequest) {
510
+ return new XMLHttpRequest();
511
+ }
512
+ try {
513
+ return new ActiveXObject("MSXML2.XMLHTTP.3.0");
514
+ } catch (error) {
515
+ qq.log("Neither XHR or ActiveX are supported!", "error");
516
+ return null;
517
+ }
518
+ };
519
+ qq.isFolderDropSupported = function(dataTransfer) {
520
+ return dataTransfer.items && dataTransfer.items.length > 0 && dataTransfer.items[0].webkitGetAsEntry;
521
+ };
522
+ qq.isFileChunkingSupported = function() {
523
+ return !qq.androidStock() && qq.isXhrUploadSupported() && (File.prototype.slice !== undefined || File.prototype.webkitSlice !== undefined || File.prototype.mozSlice !== undefined);
524
+ };
525
+ qq.sliceBlob = function(fileOrBlob, start, end) {
526
+ var slicer = fileOrBlob.slice || fileOrBlob.mozSlice || fileOrBlob.webkitSlice;
527
+ return slicer.call(fileOrBlob, start, end);
528
+ };
529
+ qq.arrayBufferToHex = function(buffer) {
530
+ var bytesAsHex = "", bytes = new Uint8Array(buffer);
531
+ qq.each(bytes, function(idx, byt) {
532
+ var byteAsHexStr = byt.toString(16);
533
+ if (byteAsHexStr.length < 2) {
534
+ byteAsHexStr = "0" + byteAsHexStr;
535
+ }
536
+ bytesAsHex += byteAsHexStr;
537
+ });
538
+ return bytesAsHex;
539
+ };
540
+ qq.readBlobToHex = function(blob, startOffset, length) {
541
+ var initialBlob = qq.sliceBlob(blob, startOffset, startOffset + length), fileReader = new FileReader(), promise = new qq.Promise();
542
+ fileReader.onload = function() {
543
+ promise.success(qq.arrayBufferToHex(fileReader.result));
544
+ };
545
+ fileReader.onerror = promise.failure;
546
+ fileReader.readAsArrayBuffer(initialBlob);
547
+ return promise;
548
+ };
549
+ qq.extend = function(first, second, extendNested) {
550
+ qq.each(second, function(prop, val) {
551
+ if (extendNested && qq.isObject(val)) {
552
+ if (first[prop] === undefined) {
553
+ first[prop] = {};
554
+ }
555
+ qq.extend(first[prop], val, true);
556
+ } else {
557
+ first[prop] = val;
558
+ }
559
+ });
560
+ return first;
561
+ };
562
+ qq.override = function(target, sourceFn) {
563
+ var super_ = {}, source = sourceFn(super_);
564
+ qq.each(source, function(srcPropName, srcPropVal) {
565
+ if (target[srcPropName] !== undefined) {
566
+ super_[srcPropName] = target[srcPropName];
567
+ }
568
+ target[srcPropName] = srcPropVal;
569
+ });
570
+ return target;
571
+ };
572
+ qq.indexOf = function(arr, elt, from) {
573
+ if (arr.indexOf) {
574
+ return arr.indexOf(elt, from);
575
+ }
576
+ from = from || 0;
577
+ var len = arr.length;
578
+ if (from < 0) {
579
+ from += len;
580
+ }
581
+ for (;from < len; from += 1) {
582
+ if (arr.hasOwnProperty(from) && arr[from] === elt) {
583
+ return from;
584
+ }
585
+ }
586
+ return -1;
587
+ };
588
+ qq.getUniqueId = function() {
589
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
590
+ var r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
591
+ return v.toString(16);
592
+ });
593
+ };
594
+ qq.ie = function() {
595
+ return navigator.userAgent.indexOf("MSIE") !== -1 || navigator.userAgent.indexOf("Trident") !== -1;
596
+ };
597
+ qq.ie7 = function() {
598
+ return navigator.userAgent.indexOf("MSIE 7") !== -1;
599
+ };
600
+ qq.ie8 = function() {
601
+ return navigator.userAgent.indexOf("MSIE 8") !== -1;
602
+ };
603
+ qq.ie10 = function() {
604
+ return navigator.userAgent.indexOf("MSIE 10") !== -1;
605
+ };
606
+ qq.ie11 = function() {
607
+ return qq.ie() && navigator.userAgent.indexOf("rv:11") !== -1;
608
+ };
609
+ qq.edge = function() {
610
+ return navigator.userAgent.indexOf("Edge") >= 0;
611
+ };
612
+ qq.safari = function() {
613
+ return navigator.vendor !== undefined && navigator.vendor.indexOf("Apple") !== -1;
614
+ };
615
+ qq.chrome = function() {
616
+ return navigator.vendor !== undefined && navigator.vendor.indexOf("Google") !== -1;
617
+ };
618
+ qq.opera = function() {
619
+ return navigator.vendor !== undefined && navigator.vendor.indexOf("Opera") !== -1;
620
+ };
621
+ qq.firefox = function() {
622
+ return !qq.edge() && !qq.ie11() && navigator.userAgent.indexOf("Mozilla") !== -1 && navigator.vendor !== undefined && navigator.vendor === "";
623
+ };
624
+ qq.windows = function() {
625
+ return navigator.platform === "Win32";
626
+ };
627
+ qq.android = function() {
628
+ return navigator.userAgent.toLowerCase().indexOf("android") !== -1;
629
+ };
630
+ qq.androidStock = function() {
631
+ return qq.android() && navigator.userAgent.toLowerCase().indexOf("chrome") < 0;
632
+ };
633
+ qq.ios6 = function() {
634
+ return qq.ios() && navigator.userAgent.indexOf(" OS 6_") !== -1;
635
+ };
636
+ qq.ios7 = function() {
637
+ return qq.ios() && navigator.userAgent.indexOf(" OS 7_") !== -1;
638
+ };
639
+ qq.ios8 = function() {
640
+ return qq.ios() && navigator.userAgent.indexOf(" OS 8_") !== -1;
641
+ };
642
+ qq.ios800 = function() {
643
+ return qq.ios() && navigator.userAgent.indexOf(" OS 8_0 ") !== -1;
644
+ };
645
+ qq.ios = function() {
646
+ return navigator.userAgent.indexOf("iPad") !== -1 || navigator.userAgent.indexOf("iPod") !== -1 || navigator.userAgent.indexOf("iPhone") !== -1;
647
+ };
648
+ qq.iosChrome = function() {
649
+ return qq.ios() && navigator.userAgent.indexOf("CriOS") !== -1;
650
+ };
651
+ qq.iosSafari = function() {
652
+ return qq.ios() && !qq.iosChrome() && navigator.userAgent.indexOf("Safari") !== -1;
653
+ };
654
+ qq.iosSafariWebView = function() {
655
+ return qq.ios() && !qq.iosChrome() && !qq.iosSafari();
656
+ };
657
+ qq.preventDefault = function(e) {
658
+ if (e.preventDefault) {
659
+ e.preventDefault();
660
+ } else {
661
+ e.returnValue = false;
662
+ }
663
+ };
664
+ qq.toElement = function() {
665
+ var div = document.createElement("div");
666
+ return function(html) {
667
+ div.innerHTML = html;
668
+ var element = div.firstChild;
669
+ div.removeChild(element);
670
+ return element;
671
+ };
672
+ }();
673
+ qq.each = function(iterableItem, callback) {
674
+ var keyOrIndex, retVal;
675
+ if (iterableItem) {
676
+ if (window.Storage && iterableItem.constructor === window.Storage) {
677
+ for (keyOrIndex = 0; keyOrIndex < iterableItem.length; keyOrIndex++) {
678
+ retVal = callback(iterableItem.key(keyOrIndex), iterableItem.getItem(iterableItem.key(keyOrIndex)));
679
+ if (retVal === false) {
680
+ break;
681
+ }
682
+ }
683
+ } else if (qq.isArray(iterableItem) || qq.isItemList(iterableItem) || qq.isNodeList(iterableItem)) {
684
+ for (keyOrIndex = 0; keyOrIndex < iterableItem.length; keyOrIndex++) {
685
+ retVal = callback(keyOrIndex, iterableItem[keyOrIndex]);
686
+ if (retVal === false) {
687
+ break;
688
+ }
689
+ }
690
+ } else if (qq.isString(iterableItem)) {
691
+ for (keyOrIndex = 0; keyOrIndex < iterableItem.length; keyOrIndex++) {
692
+ retVal = callback(keyOrIndex, iterableItem.charAt(keyOrIndex));
693
+ if (retVal === false) {
694
+ break;
695
+ }
696
+ }
697
+ } else {
698
+ for (keyOrIndex in iterableItem) {
699
+ if (Object.prototype.hasOwnProperty.call(iterableItem, keyOrIndex)) {
700
+ retVal = callback(keyOrIndex, iterableItem[keyOrIndex]);
701
+ if (retVal === false) {
702
+ break;
703
+ }
704
+ }
705
+ }
706
+ }
707
+ }
708
+ };
709
+ qq.bind = function(oldFunc, context) {
710
+ if (qq.isFunction(oldFunc)) {
711
+ var args = Array.prototype.slice.call(arguments, 2);
712
+ return function() {
713
+ var newArgs = qq.extend([], args);
714
+ if (arguments.length) {
715
+ newArgs = newArgs.concat(Array.prototype.slice.call(arguments));
716
+ }
717
+ return oldFunc.apply(context, newArgs);
718
+ };
719
+ }
720
+ throw new Error("first parameter must be a function!");
721
+ };
722
+ qq.obj2url = function(obj, temp, prefixDone) {
723
+ var uristrings = [], prefix = "&", add = function(nextObj, i) {
724
+ var nextTemp = temp ? /\[\]$/.test(temp) ? temp : temp + "[" + i + "]" : i;
725
+ if (nextTemp !== "undefined" && i !== "undefined") {
726
+ uristrings.push(typeof nextObj === "object" ? qq.obj2url(nextObj, nextTemp, true) : Object.prototype.toString.call(nextObj) === "[object Function]" ? encodeURIComponent(nextTemp) + "=" + encodeURIComponent(nextObj()) : encodeURIComponent(nextTemp) + "=" + encodeURIComponent(nextObj));
727
+ }
728
+ };
729
+ if (!prefixDone && temp) {
730
+ prefix = /\?/.test(temp) ? /\?$/.test(temp) ? "" : "&" : "?";
731
+ uristrings.push(temp);
732
+ uristrings.push(qq.obj2url(obj));
733
+ } else if (Object.prototype.toString.call(obj) === "[object Array]" && typeof obj !== "undefined") {
734
+ qq.each(obj, function(idx, val) {
735
+ add(val, idx);
736
+ });
737
+ } else if (typeof obj !== "undefined" && obj !== null && typeof obj === "object") {
738
+ qq.each(obj, function(prop, val) {
739
+ add(val, prop);
740
+ });
741
+ } else {
742
+ uristrings.push(encodeURIComponent(temp) + "=" + encodeURIComponent(obj));
743
+ }
744
+ if (temp) {
745
+ return uristrings.join(prefix);
746
+ } else {
747
+ return uristrings.join(prefix).replace(/^&/, "").replace(/%20/g, "+");
748
+ }
749
+ };
750
+ qq.obj2FormData = function(obj, formData, arrayKeyName) {
751
+ if (!formData) {
752
+ formData = new FormData();
753
+ }
754
+ qq.each(obj, function(key, val) {
755
+ key = arrayKeyName ? arrayKeyName + "[" + key + "]" : key;
756
+ if (qq.isObject(val)) {
757
+ qq.obj2FormData(val, formData, key);
758
+ } else if (qq.isFunction(val)) {
759
+ formData.append(key, val());
760
+ } else {
761
+ formData.append(key, val);
762
+ }
763
+ });
764
+ return formData;
765
+ };
766
+ qq.obj2Inputs = function(obj, form) {
767
+ var input;
768
+ if (!form) {
769
+ form = document.createElement("form");
770
+ }
771
+ qq.obj2FormData(obj, {
772
+ append: function(key, val) {
773
+ input = document.createElement("input");
774
+ input.setAttribute("name", key);
775
+ input.setAttribute("value", val);
776
+ form.appendChild(input);
777
+ }
778
+ });
779
+ return form;
780
+ };
781
+ qq.parseJson = function(json) {
782
+ if (window.JSON && qq.isFunction(JSON.parse)) {
783
+ return JSON.parse(json);
784
+ } else {
785
+ return eval("(" + json + ")");
786
+ }
787
+ };
788
+ qq.getExtension = function(filename) {
789
+ var extIdx = filename.lastIndexOf(".") + 1;
790
+ if (extIdx > 0) {
791
+ return filename.substr(extIdx, filename.length - extIdx);
792
+ }
793
+ };
794
+ qq.getFilename = function(blobOrFileInput) {
795
+ if (qq.isInput(blobOrFileInput)) {
796
+ return blobOrFileInput.value.replace(/.*(\/|\\)/, "");
797
+ } else if (qq.isFile(blobOrFileInput)) {
798
+ if (blobOrFileInput.fileName !== null && blobOrFileInput.fileName !== undefined) {
799
+ return blobOrFileInput.fileName;
800
+ }
801
+ }
802
+ return blobOrFileInput.name;
803
+ };
804
+ qq.DisposeSupport = function() {
805
+ var disposers = [];
806
+ return {
807
+ dispose: function() {
808
+ var disposer;
809
+ do {
810
+ disposer = disposers.shift();
811
+ if (disposer) {
812
+ disposer();
813
+ }
814
+ } while (disposer);
815
+ },
816
+ attach: function() {
817
+ var args = arguments;
818
+ this.addDisposer(qq(args[0]).attach.apply(this, Array.prototype.slice.call(arguments, 1)));
819
+ },
820
+ addDisposer: function(disposeFunction) {
821
+ disposers.push(disposeFunction);
822
+ }
823
+ };
824
+ };
825
+ })();
826
+ (function() {
827
+ "use strict";
828
+ if (typeof define === "function" && define.amd) {
829
+ define(function() {
830
+ return qq;
831
+ });
832
+ } else if (typeof module !== "undefined" && module.exports) {
833
+ module.exports = qq;
834
+ } else {
835
+ global.qq = qq;
836
+ }
837
+ })();
838
+ (function() {
839
+ "use strict";
840
+ qq.Error = function(message) {
841
+ this.message = "[Fine Uploader " + qq.version + "] " + message;
842
+ };
843
+ qq.Error.prototype = new Error();
844
+ })();
845
+ qq.version = "5.15.5";
846
+ qq.supportedFeatures = function() {
847
+ "use strict";
848
+ var supportsUploading, supportsUploadingBlobs, supportsFileDrop, supportsAjaxFileUploading, supportsFolderDrop, supportsChunking, supportsResume, supportsUploadViaPaste, supportsUploadCors, supportsDeleteFileXdr, supportsDeleteFileCorsXhr, supportsDeleteFileCors, supportsFolderSelection, supportsImagePreviews, supportsUploadProgress;
849
+ function testSupportsFileInputElement() {
850
+ var supported = true, tempInput;
851
+ try {
852
+ tempInput = document.createElement("input");
853
+ tempInput.type = "file";
854
+ qq(tempInput).hide();
855
+ if (tempInput.disabled) {
856
+ supported = false;
857
+ }
858
+ } catch (ex) {
859
+ supported = false;
860
+ }
861
+ return supported;
862
+ }
863
+ function isChrome21OrHigher() {
864
+ return (qq.chrome() || qq.opera()) && navigator.userAgent.match(/Chrome\/[2][1-9]|Chrome\/[3-9][0-9]/) !== undefined;
865
+ }
866
+ function isChrome14OrHigher() {
867
+ return (qq.chrome() || qq.opera()) && navigator.userAgent.match(/Chrome\/[1][4-9]|Chrome\/[2-9][0-9]/) !== undefined;
868
+ }
869
+ function isCrossOriginXhrSupported() {
870
+ if (window.XMLHttpRequest) {
871
+ var xhr = qq.createXhrInstance();
872
+ return xhr.withCredentials !== undefined;
873
+ }
874
+ return false;
875
+ }
876
+ function isXdrSupported() {
877
+ return window.XDomainRequest !== undefined;
878
+ }
879
+ function isCrossOriginAjaxSupported() {
880
+ if (isCrossOriginXhrSupported()) {
881
+ return true;
882
+ }
883
+ return isXdrSupported();
884
+ }
885
+ function isFolderSelectionSupported() {
886
+ return document.createElement("input").webkitdirectory !== undefined;
887
+ }
888
+ function isLocalStorageSupported() {
889
+ try {
890
+ return !!window.localStorage && qq.isFunction(window.localStorage.setItem);
891
+ } catch (error) {
892
+ return false;
893
+ }
894
+ }
895
+ function isDragAndDropSupported() {
896
+ var span = document.createElement("span");
897
+ return ("draggable" in span || "ondragstart" in span && "ondrop" in span) && !qq.android() && !qq.ios();
898
+ }
899
+ supportsUploading = testSupportsFileInputElement();
900
+ supportsAjaxFileUploading = supportsUploading && qq.isXhrUploadSupported();
901
+ supportsUploadingBlobs = supportsAjaxFileUploading && !qq.androidStock();
902
+ supportsFileDrop = supportsAjaxFileUploading && isDragAndDropSupported();
903
+ supportsFolderDrop = supportsFileDrop && isChrome21OrHigher();
904
+ supportsChunking = supportsAjaxFileUploading && qq.isFileChunkingSupported();
905
+ supportsResume = supportsAjaxFileUploading && supportsChunking && isLocalStorageSupported();
906
+ supportsUploadViaPaste = supportsAjaxFileUploading && isChrome14OrHigher();
907
+ supportsUploadCors = supportsUploading && (window.postMessage !== undefined || supportsAjaxFileUploading);
908
+ supportsDeleteFileCorsXhr = isCrossOriginXhrSupported();
909
+ supportsDeleteFileXdr = isXdrSupported();
910
+ supportsDeleteFileCors = isCrossOriginAjaxSupported();
911
+ supportsFolderSelection = isFolderSelectionSupported();
912
+ supportsImagePreviews = supportsAjaxFileUploading && window.FileReader !== undefined;
913
+ supportsUploadProgress = function() {
914
+ if (supportsAjaxFileUploading) {
915
+ return !qq.androidStock() && !qq.iosChrome();
916
+ }
917
+ return false;
918
+ }();
919
+ return {
920
+ ajaxUploading: supportsAjaxFileUploading,
921
+ blobUploading: supportsUploadingBlobs,
922
+ canDetermineSize: supportsAjaxFileUploading,
923
+ chunking: supportsChunking,
924
+ deleteFileCors: supportsDeleteFileCors,
925
+ deleteFileCorsXdr: supportsDeleteFileXdr,
926
+ deleteFileCorsXhr: supportsDeleteFileCorsXhr,
927
+ dialogElement: !!window.HTMLDialogElement,
928
+ fileDrop: supportsFileDrop,
929
+ folderDrop: supportsFolderDrop,
930
+ folderSelection: supportsFolderSelection,
931
+ imagePreviews: supportsImagePreviews,
932
+ imageValidation: supportsImagePreviews,
933
+ itemSizeValidation: supportsAjaxFileUploading,
934
+ pause: supportsChunking,
935
+ progressBar: supportsUploadProgress,
936
+ resume: supportsResume,
937
+ scaling: supportsImagePreviews && supportsUploadingBlobs,
938
+ tiffPreviews: qq.safari(),
939
+ unlimitedScaledImageSize: !qq.ios(),
940
+ uploading: supportsUploading,
941
+ uploadCors: supportsUploadCors,
942
+ uploadCustomHeaders: supportsAjaxFileUploading,
943
+ uploadNonMultipart: supportsAjaxFileUploading,
944
+ uploadViaPaste: supportsUploadViaPaste
945
+ };
946
+ }();
947
+ qq.isGenericPromise = function(maybePromise) {
948
+ "use strict";
949
+ return !!(maybePromise && maybePromise.then && qq.isFunction(maybePromise.then));
950
+ };
951
+ qq.Promise = function() {
952
+ "use strict";
953
+ var successArgs, failureArgs, successCallbacks = [], failureCallbacks = [], doneCallbacks = [], state = 0;
954
+ qq.extend(this, {
955
+ then: function(onSuccess, onFailure) {
956
+ if (state === 0) {
957
+ if (onSuccess) {
958
+ successCallbacks.push(onSuccess);
959
+ }
960
+ if (onFailure) {
961
+ failureCallbacks.push(onFailure);
962
+ }
963
+ } else if (state === -1) {
964
+ onFailure && onFailure.apply(null, failureArgs);
965
+ } else if (onSuccess) {
966
+ onSuccess.apply(null, successArgs);
967
+ }
968
+ return this;
969
+ },
970
+ done: function(callback) {
971
+ if (state === 0) {
972
+ doneCallbacks.push(callback);
973
+ } else {
974
+ callback.apply(null, failureArgs === undefined ? successArgs : failureArgs);
975
+ }
976
+ return this;
977
+ },
978
+ success: function() {
979
+ state = 1;
980
+ successArgs = arguments;
981
+ if (successCallbacks.length) {
982
+ qq.each(successCallbacks, function(idx, callback) {
983
+ callback.apply(null, successArgs);
984
+ });
985
+ }
986
+ if (doneCallbacks.length) {
987
+ qq.each(doneCallbacks, function(idx, callback) {
988
+ callback.apply(null, successArgs);
989
+ });
990
+ }
991
+ return this;
992
+ },
993
+ failure: function() {
994
+ state = -1;
995
+ failureArgs = arguments;
996
+ if (failureCallbacks.length) {
997
+ qq.each(failureCallbacks, function(idx, callback) {
998
+ callback.apply(null, failureArgs);
999
+ });
1000
+ }
1001
+ if (doneCallbacks.length) {
1002
+ qq.each(doneCallbacks, function(idx, callback) {
1003
+ callback.apply(null, failureArgs);
1004
+ });
1005
+ }
1006
+ return this;
1007
+ }
1008
+ });
1009
+ };
1010
+ qq.BlobProxy = function(referenceBlob, onCreate) {
1011
+ "use strict";
1012
+ qq.extend(this, {
1013
+ referenceBlob: referenceBlob,
1014
+ create: function() {
1015
+ return onCreate(referenceBlob);
1016
+ }
1017
+ });
1018
+ };
1019
+ qq.UploadButton = function(o) {
1020
+ "use strict";
1021
+ var self = this, disposeSupport = new qq.DisposeSupport(), options = {
1022
+ acceptFiles: null,
1023
+ element: null,
1024
+ focusClass: "qq-upload-button-focus",
1025
+ folders: false,
1026
+ hoverClass: "qq-upload-button-hover",
1027
+ ios8BrowserCrashWorkaround: false,
1028
+ multiple: false,
1029
+ name: "qqfile",
1030
+ onChange: function(input) {},
1031
+ title: null
1032
+ }, input, buttonId;
1033
+ qq.extend(options, o);
1034
+ buttonId = qq.getUniqueId();
1035
+ function createInput() {
1036
+ var input = document.createElement("input");
1037
+ input.setAttribute(qq.UploadButton.BUTTON_ID_ATTR_NAME, buttonId);
1038
+ input.setAttribute("title", options.title);
1039
+ self.setMultiple(options.multiple, input);
1040
+ if (options.folders && qq.supportedFeatures.folderSelection) {
1041
+ input.setAttribute("webkitdirectory", "");
1042
+ }
1043
+ if (options.acceptFiles) {
1044
+ input.setAttribute("accept", options.acceptFiles);
1045
+ }
1046
+ input.setAttribute("type", "file");
1047
+ input.setAttribute("name", options.name);
1048
+ qq(input).css({
1049
+ position: "absolute",
1050
+ right: 0,
1051
+ top: 0,
1052
+ fontFamily: "Arial",
1053
+ fontSize: qq.ie() && !qq.ie8() ? "3500px" : "118px",
1054
+ margin: 0,
1055
+ padding: 0,
1056
+ cursor: "pointer",
1057
+ opacity: 0
1058
+ });
1059
+ !qq.ie7() && qq(input).css({
1060
+ height: "100%"
1061
+ });
1062
+ options.element.appendChild(input);
1063
+ disposeSupport.attach(input, "change", function() {
1064
+ options.onChange(input);
1065
+ });
1066
+ disposeSupport.attach(input, "mouseover", function() {
1067
+ qq(options.element).addClass(options.hoverClass);
1068
+ });
1069
+ disposeSupport.attach(input, "mouseout", function() {
1070
+ qq(options.element).removeClass(options.hoverClass);
1071
+ });
1072
+ disposeSupport.attach(input, "focus", function() {
1073
+ qq(options.element).addClass(options.focusClass);
1074
+ });
1075
+ disposeSupport.attach(input, "blur", function() {
1076
+ qq(options.element).removeClass(options.focusClass);
1077
+ });
1078
+ return input;
1079
+ }
1080
+ qq(options.element).css({
1081
+ position: "relative",
1082
+ overflow: "hidden",
1083
+ direction: "ltr"
1084
+ });
1085
+ qq.extend(this, {
1086
+ getInput: function() {
1087
+ return input;
1088
+ },
1089
+ getButtonId: function() {
1090
+ return buttonId;
1091
+ },
1092
+ setMultiple: function(isMultiple, optInput) {
1093
+ var input = optInput || this.getInput();
1094
+ if (options.ios8BrowserCrashWorkaround && qq.ios8() && (qq.iosChrome() || qq.iosSafariWebView())) {
1095
+ input.setAttribute("multiple", "");
1096
+ } else {
1097
+ if (isMultiple) {
1098
+ input.setAttribute("multiple", "");
1099
+ } else {
1100
+ input.removeAttribute("multiple");
1101
+ }
1102
+ }
1103
+ },
1104
+ setAcceptFiles: function(acceptFiles) {
1105
+ if (acceptFiles !== options.acceptFiles) {
1106
+ input.setAttribute("accept", acceptFiles);
1107
+ }
1108
+ },
1109
+ reset: function() {
1110
+ if (input.parentNode) {
1111
+ qq(input).remove();
1112
+ }
1113
+ qq(options.element).removeClass(options.focusClass);
1114
+ input = null;
1115
+ input = createInput();
1116
+ }
1117
+ });
1118
+ input = createInput();
1119
+ };
1120
+ qq.UploadButton.BUTTON_ID_ATTR_NAME = "qq-button-id";
1121
+ qq.UploadData = function(uploaderProxy) {
1122
+ "use strict";
1123
+ var data = [], byUuid = {}, byStatus = {}, byProxyGroupId = {}, byBatchId = {};
1124
+ function getDataByIds(idOrIds) {
1125
+ if (qq.isArray(idOrIds)) {
1126
+ var entries = [];
1127
+ qq.each(idOrIds, function(idx, id) {
1128
+ entries.push(data[id]);
1129
+ });
1130
+ return entries;
1131
+ }
1132
+ return data[idOrIds];
1133
+ }
1134
+ function getDataByUuids(uuids) {
1135
+ if (qq.isArray(uuids)) {
1136
+ var entries = [];
1137
+ qq.each(uuids, function(idx, uuid) {
1138
+ entries.push(data[byUuid[uuid]]);
1139
+ });
1140
+ return entries;
1141
+ }
1142
+ return data[byUuid[uuids]];
1143
+ }
1144
+ function getDataByStatus(status) {
1145
+ var statusResults = [], statuses = [].concat(status);
1146
+ qq.each(statuses, function(index, statusEnum) {
1147
+ var statusResultIndexes = byStatus[statusEnum];
1148
+ if (statusResultIndexes !== undefined) {
1149
+ qq.each(statusResultIndexes, function(i, dataIndex) {
1150
+ statusResults.push(data[dataIndex]);
1151
+ });
1152
+ }
1153
+ });
1154
+ return statusResults;
1155
+ }
1156
+ qq.extend(this, {
1157
+ addFile: function(spec) {
1158
+ var status = spec.status || qq.status.SUBMITTING, id = data.push({
1159
+ name: spec.name,
1160
+ originalName: spec.name,
1161
+ uuid: spec.uuid,
1162
+ size: spec.size == null ? -1 : spec.size,
1163
+ status: status
1164
+ }) - 1;
1165
+ if (spec.batchId) {
1166
+ data[id].batchId = spec.batchId;
1167
+ if (byBatchId[spec.batchId] === undefined) {
1168
+ byBatchId[spec.batchId] = [];
1169
+ }
1170
+ byBatchId[spec.batchId].push(id);
1171
+ }
1172
+ if (spec.proxyGroupId) {
1173
+ data[id].proxyGroupId = spec.proxyGroupId;
1174
+ if (byProxyGroupId[spec.proxyGroupId] === undefined) {
1175
+ byProxyGroupId[spec.proxyGroupId] = [];
1176
+ }
1177
+ byProxyGroupId[spec.proxyGroupId].push(id);
1178
+ }
1179
+ data[id].id = id;
1180
+ byUuid[spec.uuid] = id;
1181
+ if (byStatus[status] === undefined) {
1182
+ byStatus[status] = [];
1183
+ }
1184
+ byStatus[status].push(id);
1185
+ spec.onBeforeStatusChange && spec.onBeforeStatusChange(id);
1186
+ uploaderProxy.onStatusChange(id, null, status);
1187
+ return id;
1188
+ },
1189
+ retrieve: function(optionalFilter) {
1190
+ if (qq.isObject(optionalFilter) && data.length) {
1191
+ if (optionalFilter.id !== undefined) {
1192
+ return getDataByIds(optionalFilter.id);
1193
+ } else if (optionalFilter.uuid !== undefined) {
1194
+ return getDataByUuids(optionalFilter.uuid);
1195
+ } else if (optionalFilter.status) {
1196
+ return getDataByStatus(optionalFilter.status);
1197
+ }
1198
+ } else {
1199
+ return qq.extend([], data, true);
1200
+ }
1201
+ },
1202
+ reset: function() {
1203
+ data = [];
1204
+ byUuid = {};
1205
+ byStatus = {};
1206
+ byBatchId = {};
1207
+ },
1208
+ setStatus: function(id, newStatus) {
1209
+ var oldStatus = data[id].status, byStatusOldStatusIndex = qq.indexOf(byStatus[oldStatus], id);
1210
+ byStatus[oldStatus].splice(byStatusOldStatusIndex, 1);
1211
+ data[id].status = newStatus;
1212
+ if (byStatus[newStatus] === undefined) {
1213
+ byStatus[newStatus] = [];
1214
+ }
1215
+ byStatus[newStatus].push(id);
1216
+ uploaderProxy.onStatusChange(id, oldStatus, newStatus);
1217
+ },
1218
+ uuidChanged: function(id, newUuid) {
1219
+ var oldUuid = data[id].uuid;
1220
+ data[id].uuid = newUuid;
1221
+ byUuid[newUuid] = id;
1222
+ delete byUuid[oldUuid];
1223
+ },
1224
+ updateName: function(id, newName) {
1225
+ data[id].name = newName;
1226
+ },
1227
+ updateSize: function(id, newSize) {
1228
+ data[id].size = newSize;
1229
+ },
1230
+ setParentId: function(targetId, parentId) {
1231
+ data[targetId].parentId = parentId;
1232
+ },
1233
+ getIdsInProxyGroup: function(id) {
1234
+ var proxyGroupId = data[id].proxyGroupId;
1235
+ if (proxyGroupId) {
1236
+ return byProxyGroupId[proxyGroupId];
1237
+ }
1238
+ return [];
1239
+ },
1240
+ getIdsInBatch: function(id) {
1241
+ var batchId = data[id].batchId;
1242
+ return byBatchId[batchId];
1243
+ }
1244
+ });
1245
+ };
1246
+ qq.status = {
1247
+ SUBMITTING: "submitting",
1248
+ SUBMITTED: "submitted",
1249
+ REJECTED: "rejected",
1250
+ QUEUED: "queued",
1251
+ CANCELED: "canceled",
1252
+ PAUSED: "paused",
1253
+ UPLOADING: "uploading",
1254
+ UPLOAD_RETRYING: "retrying upload",
1255
+ UPLOAD_SUCCESSFUL: "upload successful",
1256
+ UPLOAD_FAILED: "upload failed",
1257
+ DELETE_FAILED: "delete failed",
1258
+ DELETING: "deleting",
1259
+ DELETED: "deleted"
1260
+ };
1261
+ (function() {
1262
+ "use strict";
1263
+ qq.basePublicApi = {
1264
+ addBlobs: function(blobDataOrArray, params, endpoint) {
1265
+ this.addFiles(blobDataOrArray, params, endpoint);
1266
+ },
1267
+ addInitialFiles: function(cannedFileList) {
1268
+ var self = this;
1269
+ qq.each(cannedFileList, function(index, cannedFile) {
1270
+ self._addCannedFile(cannedFile);
1271
+ });
1272
+ },
1273
+ addFiles: function(data, params, endpoint) {
1274
+ this._maybeHandleIos8SafariWorkaround();
1275
+ var batchId = this._storedIds.length === 0 ? qq.getUniqueId() : this._currentBatchId, processBlob = qq.bind(function(blob) {
1276
+ this._handleNewFile({
1277
+ blob: blob,
1278
+ name: this._options.blobs.defaultName
1279
+ }, batchId, verifiedFiles);
1280
+ }, this), processBlobData = qq.bind(function(blobData) {
1281
+ this._handleNewFile(blobData, batchId, verifiedFiles);
1282
+ }, this), processCanvas = qq.bind(function(canvas) {
1283
+ var blob = qq.canvasToBlob(canvas);
1284
+ this._handleNewFile({
1285
+ blob: blob,
1286
+ name: this._options.blobs.defaultName + ".png"
1287
+ }, batchId, verifiedFiles);
1288
+ }, this), processCanvasData = qq.bind(function(canvasData) {
1289
+ var normalizedQuality = canvasData.quality && canvasData.quality / 100, blob = qq.canvasToBlob(canvasData.canvas, canvasData.type, normalizedQuality);
1290
+ this._handleNewFile({
1291
+ blob: blob,
1292
+ name: canvasData.name
1293
+ }, batchId, verifiedFiles);
1294
+ }, this), processFileOrInput = qq.bind(function(fileOrInput) {
1295
+ if (qq.isInput(fileOrInput) && qq.supportedFeatures.ajaxUploading) {
1296
+ var files = Array.prototype.slice.call(fileOrInput.files), self = this;
1297
+ qq.each(files, function(idx, file) {
1298
+ self._handleNewFile(file, batchId, verifiedFiles);
1299
+ });
1300
+ } else {
1301
+ this._handleNewFile(fileOrInput, batchId, verifiedFiles);
1302
+ }
1303
+ }, this), normalizeData = function() {
1304
+ if (qq.isFileList(data)) {
1305
+ data = Array.prototype.slice.call(data);
1306
+ }
1307
+ data = [].concat(data);
1308
+ }, self = this, verifiedFiles = [];
1309
+ this._currentBatchId = batchId;
1310
+ if (data) {
1311
+ normalizeData();
1312
+ qq.each(data, function(idx, fileContainer) {
1313
+ if (qq.isFileOrInput(fileContainer)) {
1314
+ processFileOrInput(fileContainer);
1315
+ } else if (qq.isBlob(fileContainer)) {
1316
+ processBlob(fileContainer);
1317
+ } else if (qq.isObject(fileContainer)) {
1318
+ if (fileContainer.blob && fileContainer.name) {
1319
+ processBlobData(fileContainer);
1320
+ } else if (fileContainer.canvas && fileContainer.name) {
1321
+ processCanvasData(fileContainer);
1322
+ }
1323
+ } else if (fileContainer.tagName && fileContainer.tagName.toLowerCase() === "canvas") {
1324
+ processCanvas(fileContainer);
1325
+ } else {
1326
+ self.log(fileContainer + " is not a valid file container! Ignoring!", "warn");
1327
+ }
1328
+ });
1329
+ this.log("Received " + verifiedFiles.length + " files.");
1330
+ this._prepareItemsForUpload(verifiedFiles, params, endpoint);
1331
+ }
1332
+ },
1333
+ cancel: function(id) {
1334
+ this._handler.cancel(id);
1335
+ },
1336
+ cancelAll: function() {
1337
+ var storedIdsCopy = [], self = this;
1338
+ qq.extend(storedIdsCopy, this._storedIds);
1339
+ qq.each(storedIdsCopy, function(idx, storedFileId) {
1340
+ self.cancel(storedFileId);
1341
+ });
1342
+ this._handler.cancelAll();
1343
+ },
1344
+ clearStoredFiles: function() {
1345
+ this._storedIds = [];
1346
+ },
1347
+ continueUpload: function(id) {
1348
+ var uploadData = this._uploadData.retrieve({
1349
+ id: id
1350
+ });
1351
+ if (!qq.supportedFeatures.pause || !this._options.chunking.enabled) {
1352
+ return false;
1353
+ }
1354
+ if (uploadData.status === qq.status.PAUSED) {
1355
+ this.log(qq.format("Paused file ID {} ({}) will be continued. Not paused.", id, this.getName(id)));
1356
+ this._uploadFile(id);
1357
+ return true;
1358
+ } else {
1359
+ this.log(qq.format("Ignoring continue for file ID {} ({}). Not paused.", id, this.getName(id)), "error");
1360
+ }
1361
+ return false;
1362
+ },
1363
+ deleteFile: function(id) {
1364
+ return this._onSubmitDelete(id);
1365
+ },
1366
+ doesExist: function(fileOrBlobId) {
1367
+ return this._handler.isValid(fileOrBlobId);
1368
+ },
1369
+ drawThumbnail: function(fileId, imgOrCanvas, maxSize, fromServer, customResizeFunction) {
1370
+ var promiseToReturn = new qq.Promise(), fileOrUrl, options;
1371
+ if (this._imageGenerator) {
1372
+ fileOrUrl = this._thumbnailUrls[fileId];
1373
+ options = {
1374
+ customResizeFunction: customResizeFunction,
1375
+ maxSize: maxSize > 0 ? maxSize : null,
1376
+ scale: maxSize > 0
1377
+ };
1378
+ if (!fromServer && qq.supportedFeatures.imagePreviews) {
1379
+ fileOrUrl = this.getFile(fileId);
1380
+ }
1381
+ if (fileOrUrl == null) {
1382
+ promiseToReturn.failure({
1383
+ container: imgOrCanvas,
1384
+ error: "File or URL not found."
1385
+ });
1386
+ } else {
1387
+ this._imageGenerator.generate(fileOrUrl, imgOrCanvas, options).then(function success(modifiedContainer) {
1388
+ promiseToReturn.success(modifiedContainer);
1389
+ }, function failure(container, reason) {
1390
+ promiseToReturn.failure({
1391
+ container: container,
1392
+ error: reason || "Problem generating thumbnail"
1393
+ });
1394
+ });
1395
+ }
1396
+ } else {
1397
+ promiseToReturn.failure({
1398
+ container: imgOrCanvas,
1399
+ error: "Missing image generator module"
1400
+ });
1401
+ }
1402
+ return promiseToReturn;
1403
+ },
1404
+ getButton: function(fileId) {
1405
+ return this._getButton(this._buttonIdsForFileIds[fileId]);
1406
+ },
1407
+ getEndpoint: function(fileId) {
1408
+ return this._endpointStore.get(fileId);
1409
+ },
1410
+ getFile: function(fileOrBlobId) {
1411
+ return this._handler.getFile(fileOrBlobId) || null;
1412
+ },
1413
+ getInProgress: function() {
1414
+ return this._uploadData.retrieve({
1415
+ status: [ qq.status.UPLOADING, qq.status.UPLOAD_RETRYING, qq.status.QUEUED ]
1416
+ }).length;
1417
+ },
1418
+ getName: function(id) {
1419
+ return this._uploadData.retrieve({
1420
+ id: id
1421
+ }).name;
1422
+ },
1423
+ getParentId: function(id) {
1424
+ var uploadDataEntry = this.getUploads({
1425
+ id: id
1426
+ }), parentId = null;
1427
+ if (uploadDataEntry) {
1428
+ if (uploadDataEntry.parentId !== undefined) {
1429
+ parentId = uploadDataEntry.parentId;
1430
+ }
1431
+ }
1432
+ return parentId;
1433
+ },
1434
+ getResumableFilesData: function() {
1435
+ return this._handler.getResumableFilesData();
1436
+ },
1437
+ getSize: function(id) {
1438
+ return this._uploadData.retrieve({
1439
+ id: id
1440
+ }).size;
1441
+ },
1442
+ getNetUploads: function() {
1443
+ return this._netUploaded;
1444
+ },
1445
+ getRemainingAllowedItems: function() {
1446
+ var allowedItems = this._currentItemLimit;
1447
+ if (allowedItems > 0) {
1448
+ return allowedItems - this._netUploadedOrQueued;
1449
+ }
1450
+ return null;
1451
+ },
1452
+ getUploads: function(optionalFilter) {
1453
+ return this._uploadData.retrieve(optionalFilter);
1454
+ },
1455
+ getUuid: function(id) {
1456
+ return this._uploadData.retrieve({
1457
+ id: id
1458
+ }).uuid;
1459
+ },
1460
+ log: function(str, level) {
1461
+ if (this._options.debug && (!level || level === "info")) {
1462
+ qq.log("[Fine Uploader " + qq.version + "] " + str);
1463
+ } else if (level && level !== "info") {
1464
+ qq.log("[Fine Uploader " + qq.version + "] " + str, level);
1465
+ }
1466
+ },
1467
+ pauseUpload: function(id) {
1468
+ var uploadData = this._uploadData.retrieve({
1469
+ id: id
1470
+ });
1471
+ if (!qq.supportedFeatures.pause || !this._options.chunking.enabled) {
1472
+ return false;
1473
+ }
1474
+ if (qq.indexOf([ qq.status.UPLOADING, qq.status.UPLOAD_RETRYING ], uploadData.status) >= 0) {
1475
+ if (this._handler.pause(id)) {
1476
+ this._uploadData.setStatus(id, qq.status.PAUSED);
1477
+ return true;
1478
+ } else {
1479
+ this.log(qq.format("Unable to pause file ID {} ({}).", id, this.getName(id)), "error");
1480
+ }
1481
+ } else {
1482
+ this.log(qq.format("Ignoring pause for file ID {} ({}). Not in progress.", id, this.getName(id)), "error");
1483
+ }
1484
+ return false;
1485
+ },
1486
+ removeFileRef: function(id) {
1487
+ this._handler.expunge(id);
1488
+ },
1489
+ reset: function() {
1490
+ this.log("Resetting uploader...");
1491
+ this._handler.reset();
1492
+ this._storedIds = [];
1493
+ this._autoRetries = [];
1494
+ this._retryTimeouts = [];
1495
+ this._preventRetries = [];
1496
+ this._thumbnailUrls = [];
1497
+ qq.each(this._buttons, function(idx, button) {
1498
+ button.reset();
1499
+ });
1500
+ this._paramsStore.reset();
1501
+ this._endpointStore.reset();
1502
+ this._netUploadedOrQueued = 0;
1503
+ this._netUploaded = 0;
1504
+ this._uploadData.reset();
1505
+ this._buttonIdsForFileIds = [];
1506
+ this._pasteHandler && this._pasteHandler.reset();
1507
+ this._options.session.refreshOnReset && this._refreshSessionData();
1508
+ this._succeededSinceLastAllComplete = [];
1509
+ this._failedSinceLastAllComplete = [];
1510
+ this._totalProgress && this._totalProgress.reset();
1511
+ },
1512
+ retry: function(id) {
1513
+ return this._manualRetry(id);
1514
+ },
1515
+ scaleImage: function(id, specs) {
1516
+ var self = this;
1517
+ return qq.Scaler.prototype.scaleImage(id, specs, {
1518
+ log: qq.bind(self.log, self),
1519
+ getFile: qq.bind(self.getFile, self),
1520
+ uploadData: self._uploadData
1521
+ });
1522
+ },
1523
+ setCustomHeaders: function(headers, id) {
1524
+ this._customHeadersStore.set(headers, id);
1525
+ },
1526
+ setDeleteFileCustomHeaders: function(headers, id) {
1527
+ this._deleteFileCustomHeadersStore.set(headers, id);
1528
+ },
1529
+ setDeleteFileEndpoint: function(endpoint, id) {
1530
+ this._deleteFileEndpointStore.set(endpoint, id);
1531
+ },
1532
+ setDeleteFileParams: function(params, id) {
1533
+ this._deleteFileParamsStore.set(params, id);
1534
+ },
1535
+ setEndpoint: function(endpoint, id) {
1536
+ this._endpointStore.set(endpoint, id);
1537
+ },
1538
+ setForm: function(elementOrId) {
1539
+ this._updateFormSupportAndParams(elementOrId);
1540
+ },
1541
+ setItemLimit: function(newItemLimit) {
1542
+ this._currentItemLimit = newItemLimit;
1543
+ },
1544
+ setName: function(id, newName) {
1545
+ this._uploadData.updateName(id, newName);
1546
+ },
1547
+ setParams: function(params, id) {
1548
+ this._paramsStore.set(params, id);
1549
+ },
1550
+ setUuid: function(id, newUuid) {
1551
+ return this._uploadData.uuidChanged(id, newUuid);
1552
+ },
1553
+ setStatus: function(id, newStatus) {
1554
+ var fileRecord = this.getUploads({
1555
+ id: id
1556
+ });
1557
+ if (!fileRecord) {
1558
+ throw new qq.Error(id + " is not a valid file ID.");
1559
+ }
1560
+ switch (newStatus) {
1561
+ case qq.status.DELETED:
1562
+ this._onDeleteComplete(id, null, false);
1563
+ break;
1564
+
1565
+ case qq.status.DELETE_FAILED:
1566
+ this._onDeleteComplete(id, null, true);
1567
+ break;
1568
+
1569
+ default:
1570
+ var errorMessage = "Method setStatus called on '" + name + "' not implemented yet for " + newStatus;
1571
+ this.log(errorMessage);
1572
+ throw new qq.Error(errorMessage);
1573
+ }
1574
+ },
1575
+ uploadStoredFiles: function() {
1576
+ if (this._storedIds.length === 0) {
1577
+ this._itemError("noFilesError");
1578
+ } else {
1579
+ this._uploadStoredFiles();
1580
+ }
1581
+ }
1582
+ };
1583
+ qq.basePrivateApi = {
1584
+ _addCannedFile: function(sessionData) {
1585
+ var self = this;
1586
+ return this._uploadData.addFile({
1587
+ uuid: sessionData.uuid,
1588
+ name: sessionData.name,
1589
+ size: sessionData.size,
1590
+ status: qq.status.UPLOAD_SUCCESSFUL,
1591
+ onBeforeStatusChange: function(id) {
1592
+ sessionData.deleteFileEndpoint && self.setDeleteFileEndpoint(sessionData.deleteFileEndpoint, id);
1593
+ sessionData.deleteFileParams && self.setDeleteFileParams(sessionData.deleteFileParams, id);
1594
+ if (sessionData.thumbnailUrl) {
1595
+ self._thumbnailUrls[id] = sessionData.thumbnailUrl;
1596
+ }
1597
+ self._netUploaded++;
1598
+ self._netUploadedOrQueued++;
1599
+ }
1600
+ });
1601
+ },
1602
+ _annotateWithButtonId: function(file, associatedInput) {
1603
+ if (qq.isFile(file)) {
1604
+ file.qqButtonId = this._getButtonId(associatedInput);
1605
+ }
1606
+ },
1607
+ _batchError: function(message) {
1608
+ this._options.callbacks.onError(null, null, message, undefined);
1609
+ },
1610
+ _createDeleteHandler: function() {
1611
+ var self = this;
1612
+ return new qq.DeleteFileAjaxRequester({
1613
+ method: this._options.deleteFile.method.toUpperCase(),
1614
+ maxConnections: this._options.maxConnections,
1615
+ uuidParamName: this._options.request.uuidName,
1616
+ customHeaders: this._deleteFileCustomHeadersStore,
1617
+ paramsStore: this._deleteFileParamsStore,
1618
+ endpointStore: this._deleteFileEndpointStore,
1619
+ cors: this._options.cors,
1620
+ log: qq.bind(self.log, self),
1621
+ onDelete: function(id) {
1622
+ self._onDelete(id);
1623
+ self._options.callbacks.onDelete(id);
1624
+ },
1625
+ onDeleteComplete: function(id, xhrOrXdr, isError) {
1626
+ self._onDeleteComplete(id, xhrOrXdr, isError);
1627
+ self._options.callbacks.onDeleteComplete(id, xhrOrXdr, isError);
1628
+ }
1629
+ });
1630
+ },
1631
+ _createPasteHandler: function() {
1632
+ var self = this;
1633
+ return new qq.PasteSupport({
1634
+ targetElement: this._options.paste.targetElement,
1635
+ callbacks: {
1636
+ log: qq.bind(self.log, self),
1637
+ pasteReceived: function(blob) {
1638
+ self._handleCheckedCallback({
1639
+ name: "onPasteReceived",
1640
+ callback: qq.bind(self._options.callbacks.onPasteReceived, self, blob),
1641
+ onSuccess: qq.bind(self._handlePasteSuccess, self, blob),
1642
+ identifier: "pasted image"
1643
+ });
1644
+ }
1645
+ }
1646
+ });
1647
+ },
1648
+ _createStore: function(initialValue, _readOnlyValues_) {
1649
+ var store = {}, catchall = initialValue, perIdReadOnlyValues = {}, readOnlyValues = _readOnlyValues_, copy = function(orig) {
1650
+ if (qq.isObject(orig)) {
1651
+ return qq.extend({}, orig);
1652
+ }
1653
+ return orig;
1654
+ }, getReadOnlyValues = function() {
1655
+ if (qq.isFunction(readOnlyValues)) {
1656
+ return readOnlyValues();
1657
+ }
1658
+ return readOnlyValues;
1659
+ }, includeReadOnlyValues = function(id, existing) {
1660
+ if (readOnlyValues && qq.isObject(existing)) {
1661
+ qq.extend(existing, getReadOnlyValues());
1662
+ }
1663
+ if (perIdReadOnlyValues[id]) {
1664
+ qq.extend(existing, perIdReadOnlyValues[id]);
1665
+ }
1666
+ };
1667
+ return {
1668
+ set: function(val, id) {
1669
+ if (id == null) {
1670
+ store = {};
1671
+ catchall = copy(val);
1672
+ } else {
1673
+ store[id] = copy(val);
1674
+ }
1675
+ },
1676
+ get: function(id) {
1677
+ var values;
1678
+ if (id != null && store[id]) {
1679
+ values = store[id];
1680
+ } else {
1681
+ values = copy(catchall);
1682
+ }
1683
+ includeReadOnlyValues(id, values);
1684
+ return copy(values);
1685
+ },
1686
+ addReadOnly: function(id, values) {
1687
+ if (qq.isObject(store)) {
1688
+ if (id === null) {
1689
+ if (qq.isFunction(values)) {
1690
+ readOnlyValues = values;
1691
+ } else {
1692
+ readOnlyValues = readOnlyValues || {};
1693
+ qq.extend(readOnlyValues, values);
1694
+ }
1695
+ } else {
1696
+ perIdReadOnlyValues[id] = perIdReadOnlyValues[id] || {};
1697
+ qq.extend(perIdReadOnlyValues[id], values);
1698
+ }
1699
+ }
1700
+ },
1701
+ remove: function(fileId) {
1702
+ return delete store[fileId];
1703
+ },
1704
+ reset: function() {
1705
+ store = {};
1706
+ perIdReadOnlyValues = {};
1707
+ catchall = initialValue;
1708
+ }
1709
+ };
1710
+ },
1711
+ _createUploadDataTracker: function() {
1712
+ var self = this;
1713
+ return new qq.UploadData({
1714
+ getName: function(id) {
1715
+ return self.getName(id);
1716
+ },
1717
+ getUuid: function(id) {
1718
+ return self.getUuid(id);
1719
+ },
1720
+ getSize: function(id) {
1721
+ return self.getSize(id);
1722
+ },
1723
+ onStatusChange: function(id, oldStatus, newStatus) {
1724
+ self._onUploadStatusChange(id, oldStatus, newStatus);
1725
+ self._options.callbacks.onStatusChange(id, oldStatus, newStatus);
1726
+ self._maybeAllComplete(id, newStatus);
1727
+ if (self._totalProgress) {
1728
+ setTimeout(function() {
1729
+ self._totalProgress.onStatusChange(id, oldStatus, newStatus);
1730
+ }, 0);
1731
+ }
1732
+ }
1733
+ });
1734
+ },
1735
+ _createUploadButton: function(spec) {
1736
+ var self = this, acceptFiles = spec.accept || this._options.validation.acceptFiles, allowedExtensions = spec.allowedExtensions || this._options.validation.allowedExtensions, button;
1737
+ function allowMultiple() {
1738
+ if (qq.supportedFeatures.ajaxUploading) {
1739
+ if (self._options.workarounds.iosEmptyVideos && qq.ios() && !qq.ios6() && self._isAllowedExtension(allowedExtensions, ".mov")) {
1740
+ return false;
1741
+ }
1742
+ if (spec.multiple === undefined) {
1743
+ return self._options.multiple;
1744
+ }
1745
+ return spec.multiple;
1746
+ }
1747
+ return false;
1748
+ }
1749
+ button = new qq.UploadButton({
1750
+ acceptFiles: acceptFiles,
1751
+ element: spec.element,
1752
+ focusClass: this._options.classes.buttonFocus,
1753
+ folders: spec.folders,
1754
+ hoverClass: this._options.classes.buttonHover,
1755
+ ios8BrowserCrashWorkaround: this._options.workarounds.ios8BrowserCrash,
1756
+ multiple: allowMultiple(),
1757
+ name: this._options.request.inputName,
1758
+ onChange: function(input) {
1759
+ self._onInputChange(input);
1760
+ },
1761
+ title: spec.title == null ? this._options.text.fileInputTitle : spec.title
1762
+ });
1763
+ this._disposeSupport.addDisposer(function() {
1764
+ button.dispose();
1765
+ });
1766
+ self._buttons.push(button);
1767
+ return button;
1768
+ },
1769
+ _createUploadHandler: function(additionalOptions, namespace) {
1770
+ var self = this, lastOnProgress = {}, options = {
1771
+ debug: this._options.debug,
1772
+ maxConnections: this._options.maxConnections,
1773
+ cors: this._options.cors,
1774
+ paramsStore: this._paramsStore,
1775
+ endpointStore: this._endpointStore,
1776
+ chunking: this._options.chunking,
1777
+ resume: this._options.resume,
1778
+ blobs: this._options.blobs,
1779
+ log: qq.bind(self.log, self),
1780
+ preventRetryParam: this._options.retry.preventRetryResponseProperty,
1781
+ onProgress: function(id, name, loaded, total) {
1782
+ if (loaded < 0 || total < 0) {
1783
+ return;
1784
+ }
1785
+ if (lastOnProgress[id]) {
1786
+ if (lastOnProgress[id].loaded !== loaded || lastOnProgress[id].total !== total) {
1787
+ self._onProgress(id, name, loaded, total);
1788
+ self._options.callbacks.onProgress(id, name, loaded, total);
1789
+ }
1790
+ } else {
1791
+ self._onProgress(id, name, loaded, total);
1792
+ self._options.callbacks.onProgress(id, name, loaded, total);
1793
+ }
1794
+ lastOnProgress[id] = {
1795
+ loaded: loaded,
1796
+ total: total
1797
+ };
1798
+ },
1799
+ onComplete: function(id, name, result, xhr) {
1800
+ delete lastOnProgress[id];
1801
+ var status = self.getUploads({
1802
+ id: id
1803
+ }).status, retVal;
1804
+ if (status === qq.status.UPLOAD_SUCCESSFUL || status === qq.status.UPLOAD_FAILED) {
1805
+ return;
1806
+ }
1807
+ retVal = self._onComplete(id, name, result, xhr);
1808
+ if (retVal instanceof qq.Promise) {
1809
+ retVal.done(function() {
1810
+ self._options.callbacks.onComplete(id, name, result, xhr);
1811
+ });
1812
+ } else {
1813
+ self._options.callbacks.onComplete(id, name, result, xhr);
1814
+ }
1815
+ },
1816
+ onCancel: function(id, name, cancelFinalizationEffort) {
1817
+ var promise = new qq.Promise();
1818
+ self._handleCheckedCallback({
1819
+ name: "onCancel",
1820
+ callback: qq.bind(self._options.callbacks.onCancel, self, id, name),
1821
+ onFailure: promise.failure,
1822
+ onSuccess: function() {
1823
+ cancelFinalizationEffort.then(function() {
1824
+ self._onCancel(id, name);
1825
+ });
1826
+ promise.success();
1827
+ },
1828
+ identifier: id
1829
+ });
1830
+ return promise;
1831
+ },
1832
+ onUploadPrep: qq.bind(this._onUploadPrep, this),
1833
+ onUpload: function(id, name) {
1834
+ self._onUpload(id, name);
1835
+ self._options.callbacks.onUpload(id, name);
1836
+ },
1837
+ onUploadChunk: function(id, name, chunkData) {
1838
+ self._onUploadChunk(id, chunkData);
1839
+ self._options.callbacks.onUploadChunk(id, name, chunkData);
1840
+ },
1841
+ onUploadChunkSuccess: function(id, chunkData, result, xhr) {
1842
+ self._options.callbacks.onUploadChunkSuccess.apply(self, arguments);
1843
+ },
1844
+ onResume: function(id, name, chunkData) {
1845
+ return self._options.callbacks.onResume(id, name, chunkData);
1846
+ },
1847
+ onAutoRetry: function(id, name, responseJSON, xhr) {
1848
+ return self._onAutoRetry.apply(self, arguments);
1849
+ },
1850
+ onUuidChanged: function(id, newUuid) {
1851
+ self.log("Server requested UUID change from '" + self.getUuid(id) + "' to '" + newUuid + "'");
1852
+ self.setUuid(id, newUuid);
1853
+ },
1854
+ getName: qq.bind(self.getName, self),
1855
+ getUuid: qq.bind(self.getUuid, self),
1856
+ getSize: qq.bind(self.getSize, self),
1857
+ setSize: qq.bind(self._setSize, self),
1858
+ getDataByUuid: function(uuid) {
1859
+ return self.getUploads({
1860
+ uuid: uuid
1861
+ });
1862
+ },
1863
+ isQueued: function(id) {
1864
+ var status = self.getUploads({
1865
+ id: id
1866
+ }).status;
1867
+ return status === qq.status.QUEUED || status === qq.status.SUBMITTED || status === qq.status.UPLOAD_RETRYING || status === qq.status.PAUSED;
1868
+ },
1869
+ getIdsInProxyGroup: self._uploadData.getIdsInProxyGroup,
1870
+ getIdsInBatch: self._uploadData.getIdsInBatch
1871
+ };
1872
+ qq.each(this._options.request, function(prop, val) {
1873
+ options[prop] = val;
1874
+ });
1875
+ options.customHeaders = this._customHeadersStore;
1876
+ if (additionalOptions) {
1877
+ qq.each(additionalOptions, function(key, val) {
1878
+ options[key] = val;
1879
+ });
1880
+ }
1881
+ return new qq.UploadHandlerController(options, namespace);
1882
+ },
1883
+ _fileOrBlobRejected: function(id) {
1884
+ this._netUploadedOrQueued--;
1885
+ this._uploadData.setStatus(id, qq.status.REJECTED);
1886
+ },
1887
+ _formatSize: function(bytes) {
1888
+ if (bytes === 0) {
1889
+ return bytes + this._options.text.sizeSymbols[0];
1890
+ }
1891
+ var i = -1;
1892
+ do {
1893
+ bytes = bytes / 1e3;
1894
+ i++;
1895
+ } while (bytes > 999);
1896
+ return Math.max(bytes, .1).toFixed(1) + this._options.text.sizeSymbols[i];
1897
+ },
1898
+ _generateExtraButtonSpecs: function() {
1899
+ var self = this;
1900
+ this._extraButtonSpecs = {};
1901
+ qq.each(this._options.extraButtons, function(idx, extraButtonOptionEntry) {
1902
+ var multiple = extraButtonOptionEntry.multiple, validation = qq.extend({}, self._options.validation, true), extraButtonSpec = qq.extend({}, extraButtonOptionEntry);
1903
+ if (multiple === undefined) {
1904
+ multiple = self._options.multiple;
1905
+ }
1906
+ if (extraButtonSpec.validation) {
1907
+ qq.extend(validation, extraButtonOptionEntry.validation, true);
1908
+ }
1909
+ qq.extend(extraButtonSpec, {
1910
+ multiple: multiple,
1911
+ validation: validation
1912
+ }, true);
1913
+ self._initExtraButton(extraButtonSpec);
1914
+ });
1915
+ },
1916
+ _getButton: function(buttonId) {
1917
+ var extraButtonsSpec = this._extraButtonSpecs[buttonId];
1918
+ if (extraButtonsSpec) {
1919
+ return extraButtonsSpec.element;
1920
+ } else if (buttonId === this._defaultButtonId) {
1921
+ return this._options.button;
1922
+ }
1923
+ },
1924
+ _getButtonId: function(buttonOrFileInputOrFile) {
1925
+ var inputs, fileInput, fileBlobOrInput = buttonOrFileInputOrFile;
1926
+ if (fileBlobOrInput instanceof qq.BlobProxy) {
1927
+ fileBlobOrInput = fileBlobOrInput.referenceBlob;
1928
+ }
1929
+ if (fileBlobOrInput && !qq.isBlob(fileBlobOrInput)) {
1930
+ if (qq.isFile(fileBlobOrInput)) {
1931
+ return fileBlobOrInput.qqButtonId;
1932
+ } else if (fileBlobOrInput.tagName.toLowerCase() === "input" && fileBlobOrInput.type.toLowerCase() === "file") {
1933
+ return fileBlobOrInput.getAttribute(qq.UploadButton.BUTTON_ID_ATTR_NAME);
1934
+ }
1935
+ inputs = fileBlobOrInput.getElementsByTagName("input");
1936
+ qq.each(inputs, function(idx, input) {
1937
+ if (input.getAttribute("type") === "file") {
1938
+ fileInput = input;
1939
+ return false;
1940
+ }
1941
+ });
1942
+ if (fileInput) {
1943
+ return fileInput.getAttribute(qq.UploadButton.BUTTON_ID_ATTR_NAME);
1944
+ }
1945
+ }
1946
+ },
1947
+ _getNotFinished: function() {
1948
+ return this._uploadData.retrieve({
1949
+ status: [ qq.status.UPLOADING, qq.status.UPLOAD_RETRYING, qq.status.QUEUED, qq.status.SUBMITTING, qq.status.SUBMITTED, qq.status.PAUSED ]
1950
+ }).length;
1951
+ },
1952
+ _getValidationBase: function(buttonId) {
1953
+ var extraButtonSpec = this._extraButtonSpecs[buttonId];
1954
+ return extraButtonSpec ? extraButtonSpec.validation : this._options.validation;
1955
+ },
1956
+ _getValidationDescriptor: function(fileWrapper) {
1957
+ if (fileWrapper.file instanceof qq.BlobProxy) {
1958
+ return {
1959
+ name: qq.getFilename(fileWrapper.file.referenceBlob),
1960
+ size: fileWrapper.file.referenceBlob.size
1961
+ };
1962
+ }
1963
+ return {
1964
+ name: this.getUploads({
1965
+ id: fileWrapper.id
1966
+ }).name,
1967
+ size: this.getUploads({
1968
+ id: fileWrapper.id
1969
+ }).size
1970
+ };
1971
+ },
1972
+ _getValidationDescriptors: function(fileWrappers) {
1973
+ var self = this, fileDescriptors = [];
1974
+ qq.each(fileWrappers, function(idx, fileWrapper) {
1975
+ fileDescriptors.push(self._getValidationDescriptor(fileWrapper));
1976
+ });
1977
+ return fileDescriptors;
1978
+ },
1979
+ _handleCameraAccess: function() {
1980
+ if (this._options.camera.ios && qq.ios()) {
1981
+ var acceptIosCamera = "image/*;capture=camera", button = this._options.camera.button, buttonId = button ? this._getButtonId(button) : this._defaultButtonId, optionRoot = this._options;
1982
+ if (buttonId && buttonId !== this._defaultButtonId) {
1983
+ optionRoot = this._extraButtonSpecs[buttonId];
1984
+ }
1985
+ optionRoot.multiple = false;
1986
+ if (optionRoot.validation.acceptFiles === null) {
1987
+ optionRoot.validation.acceptFiles = acceptIosCamera;
1988
+ } else {
1989
+ optionRoot.validation.acceptFiles += "," + acceptIosCamera;
1990
+ }
1991
+ qq.each(this._buttons, function(idx, button) {
1992
+ if (button.getButtonId() === buttonId) {
1993
+ button.setMultiple(optionRoot.multiple);
1994
+ button.setAcceptFiles(optionRoot.acceptFiles);
1995
+ return false;
1996
+ }
1997
+ });
1998
+ }
1999
+ },
2000
+ _handleCheckedCallback: function(details) {
2001
+ var self = this, callbackRetVal = details.callback();
2002
+ if (qq.isGenericPromise(callbackRetVal)) {
2003
+ this.log(details.name + " - waiting for " + details.name + " promise to be fulfilled for " + details.identifier);
2004
+ return callbackRetVal.then(function(successParam) {
2005
+ self.log(details.name + " promise success for " + details.identifier);
2006
+ details.onSuccess(successParam);
2007
+ }, function() {
2008
+ if (details.onFailure) {
2009
+ self.log(details.name + " promise failure for " + details.identifier);
2010
+ details.onFailure();
2011
+ } else {
2012
+ self.log(details.name + " promise failure for " + details.identifier);
2013
+ }
2014
+ });
2015
+ }
2016
+ if (callbackRetVal !== false) {
2017
+ details.onSuccess(callbackRetVal);
2018
+ } else {
2019
+ if (details.onFailure) {
2020
+ this.log(details.name + " - return value was 'false' for " + details.identifier + ". Invoking failure callback.");
2021
+ details.onFailure();
2022
+ } else {
2023
+ this.log(details.name + " - return value was 'false' for " + details.identifier + ". Will not proceed.");
2024
+ }
2025
+ }
2026
+ return callbackRetVal;
2027
+ },
2028
+ _handleNewFile: function(file, batchId, newFileWrapperList) {
2029
+ var self = this, uuid = qq.getUniqueId(), size = -1, name = qq.getFilename(file), actualFile = file.blob || file, handler = this._customNewFileHandler ? this._customNewFileHandler : qq.bind(self._handleNewFileGeneric, self);
2030
+ if (!qq.isInput(actualFile) && actualFile.size >= 0) {
2031
+ size = actualFile.size;
2032
+ }
2033
+ handler(actualFile, name, uuid, size, newFileWrapperList, batchId, this._options.request.uuidName, {
2034
+ uploadData: self._uploadData,
2035
+ paramsStore: self._paramsStore,
2036
+ addFileToHandler: function(id, file) {
2037
+ self._handler.add(id, file);
2038
+ self._netUploadedOrQueued++;
2039
+ self._trackButton(id);
2040
+ }
2041
+ });
2042
+ },
2043
+ _handleNewFileGeneric: function(file, name, uuid, size, fileList, batchId) {
2044
+ var id = this._uploadData.addFile({
2045
+ uuid: uuid,
2046
+ name: name,
2047
+ size: size,
2048
+ batchId: batchId
2049
+ });
2050
+ this._handler.add(id, file);
2051
+ this._trackButton(id);
2052
+ this._netUploadedOrQueued++;
2053
+ fileList.push({
2054
+ id: id,
2055
+ file: file
2056
+ });
2057
+ },
2058
+ _handlePasteSuccess: function(blob, extSuppliedName) {
2059
+ var extension = blob.type.split("/")[1], name = extSuppliedName;
2060
+ if (name == null) {
2061
+ name = this._options.paste.defaultName;
2062
+ }
2063
+ name += "." + extension;
2064
+ this.addFiles({
2065
+ name: name,
2066
+ blob: blob
2067
+ });
2068
+ },
2069
+ _handleDeleteSuccess: function(id) {
2070
+ if (this.getUploads({
2071
+ id: id
2072
+ }).status !== qq.status.DELETED) {
2073
+ var name = this.getName(id);
2074
+ this._netUploadedOrQueued--;
2075
+ this._netUploaded--;
2076
+ this._handler.expunge(id);
2077
+ this._uploadData.setStatus(id, qq.status.DELETED);
2078
+ this.log("Delete request for '" + name + "' has succeeded.");
2079
+ }
2080
+ },
2081
+ _handleDeleteFailed: function(id, xhrOrXdr) {
2082
+ var name = this.getName(id);
2083
+ this._uploadData.setStatus(id, qq.status.DELETE_FAILED);
2084
+ this.log("Delete request for '" + name + "' has failed.", "error");
2085
+ if (!xhrOrXdr || xhrOrXdr.withCredentials === undefined) {
2086
+ this._options.callbacks.onError(id, name, "Delete request failed", xhrOrXdr);
2087
+ } else {
2088
+ this._options.callbacks.onError(id, name, "Delete request failed with response code " + xhrOrXdr.status, xhrOrXdr);
2089
+ }
2090
+ },
2091
+ _initExtraButton: function(spec) {
2092
+ var button = this._createUploadButton({
2093
+ accept: spec.validation.acceptFiles,
2094
+ allowedExtensions: spec.validation.allowedExtensions,
2095
+ element: spec.element,
2096
+ folders: spec.folders,
2097
+ multiple: spec.multiple,
2098
+ title: spec.fileInputTitle
2099
+ });
2100
+ this._extraButtonSpecs[button.getButtonId()] = spec;
2101
+ },
2102
+ _initFormSupportAndParams: function() {
2103
+ this._formSupport = qq.FormSupport && new qq.FormSupport(this._options.form, qq.bind(this.uploadStoredFiles, this), qq.bind(this.log, this));
2104
+ if (this._formSupport && this._formSupport.attachedToForm) {
2105
+ this._paramsStore = this._createStore(this._options.request.params, this._formSupport.getFormInputsAsObject);
2106
+ this._options.autoUpload = this._formSupport.newAutoUpload;
2107
+ if (this._formSupport.newEndpoint) {
2108
+ this._options.request.endpoint = this._formSupport.newEndpoint;
2109
+ }
2110
+ } else {
2111
+ this._paramsStore = this._createStore(this._options.request.params);
2112
+ }
2113
+ },
2114
+ _isDeletePossible: function() {
2115
+ if (!qq.DeleteFileAjaxRequester || !this._options.deleteFile.enabled) {
2116
+ return false;
2117
+ }
2118
+ if (this._options.cors.expected) {
2119
+ if (qq.supportedFeatures.deleteFileCorsXhr) {
2120
+ return true;
2121
+ }
2122
+ if (qq.supportedFeatures.deleteFileCorsXdr && this._options.cors.allowXdr) {
2123
+ return true;
2124
+ }
2125
+ return false;
2126
+ }
2127
+ return true;
2128
+ },
2129
+ _isAllowedExtension: function(allowed, fileName) {
2130
+ var valid = false;
2131
+ if (!allowed.length) {
2132
+ return true;
2133
+ }
2134
+ qq.each(allowed, function(idx, allowedExt) {
2135
+ if (qq.isString(allowedExt)) {
2136
+ var extRegex = new RegExp("\\." + allowedExt + "$", "i");
2137
+ if (fileName.match(extRegex) != null) {
2138
+ valid = true;
2139
+ return false;
2140
+ }
2141
+ }
2142
+ });
2143
+ return valid;
2144
+ },
2145
+ _itemError: function(code, maybeNameOrNames, item) {
2146
+ var message = this._options.messages[code], allowedExtensions = [], names = [].concat(maybeNameOrNames), name = names[0], buttonId = this._getButtonId(item), validationBase = this._getValidationBase(buttonId), extensionsForMessage, placeholderMatch;
2147
+ function r(name, replacement) {
2148
+ message = message.replace(name, replacement);
2149
+ }
2150
+ qq.each(validationBase.allowedExtensions, function(idx, allowedExtension) {
2151
+ if (qq.isString(allowedExtension)) {
2152
+ allowedExtensions.push(allowedExtension);
2153
+ }
2154
+ });
2155
+ extensionsForMessage = allowedExtensions.join(", ").toLowerCase();
2156
+ r("{file}", this._options.formatFileName(name));
2157
+ r("{extensions}", extensionsForMessage);
2158
+ r("{sizeLimit}", this._formatSize(validationBase.sizeLimit));
2159
+ r("{minSizeLimit}", this._formatSize(validationBase.minSizeLimit));
2160
+ placeholderMatch = message.match(/(\{\w+\})/g);
2161
+ if (placeholderMatch !== null) {
2162
+ qq.each(placeholderMatch, function(idx, placeholder) {
2163
+ r(placeholder, names[idx]);
2164
+ });
2165
+ }
2166
+ this._options.callbacks.onError(null, name, message, undefined);
2167
+ return message;
2168
+ },
2169
+ _manualRetry: function(id, callback) {
2170
+ if (this._onBeforeManualRetry(id)) {
2171
+ this._netUploadedOrQueued++;
2172
+ this._uploadData.setStatus(id, qq.status.UPLOAD_RETRYING);
2173
+ if (callback) {
2174
+ callback(id);
2175
+ } else {
2176
+ this._handler.retry(id);
2177
+ }
2178
+ return true;
2179
+ }
2180
+ },
2181
+ _maybeAllComplete: function(id, status) {
2182
+ var self = this, notFinished = this._getNotFinished();
2183
+ if (status === qq.status.UPLOAD_SUCCESSFUL) {
2184
+ this._succeededSinceLastAllComplete.push(id);
2185
+ } else if (status === qq.status.UPLOAD_FAILED) {
2186
+ this._failedSinceLastAllComplete.push(id);
2187
+ }
2188
+ if (notFinished === 0 && (this._succeededSinceLastAllComplete.length || this._failedSinceLastAllComplete.length)) {
2189
+ setTimeout(function() {
2190
+ self._onAllComplete(self._succeededSinceLastAllComplete, self._failedSinceLastAllComplete);
2191
+ }, 0);
2192
+ }
2193
+ },
2194
+ _maybeHandleIos8SafariWorkaround: function() {
2195
+ var self = this;
2196
+ if (this._options.workarounds.ios8SafariUploads && qq.ios800() && qq.iosSafari()) {
2197
+ setTimeout(function() {
2198
+ window.alert(self._options.messages.unsupportedBrowserIos8Safari);
2199
+ }, 0);
2200
+ throw new qq.Error(this._options.messages.unsupportedBrowserIos8Safari);
2201
+ }
2202
+ },
2203
+ _maybeParseAndSendUploadError: function(id, name, response, xhr) {
2204
+ if (!response.success) {
2205
+ if (xhr && xhr.status !== 200 && !response.error) {
2206
+ this._options.callbacks.onError(id, name, "XHR returned response code " + xhr.status, xhr);
2207
+ } else {
2208
+ var errorReason = response.error ? response.error : this._options.text.defaultResponseError;
2209
+ this._options.callbacks.onError(id, name, errorReason, xhr);
2210
+ }
2211
+ }
2212
+ },
2213
+ _maybeProcessNextItemAfterOnValidateCallback: function(validItem, items, index, params, endpoint) {
2214
+ var self = this;
2215
+ if (items.length > index) {
2216
+ if (validItem || !this._options.validation.stopOnFirstInvalidFile) {
2217
+ setTimeout(function() {
2218
+ var validationDescriptor = self._getValidationDescriptor(items[index]), buttonId = self._getButtonId(items[index].file), button = self._getButton(buttonId);
2219
+ self._handleCheckedCallback({
2220
+ name: "onValidate",
2221
+ callback: qq.bind(self._options.callbacks.onValidate, self, validationDescriptor, button),
2222
+ onSuccess: qq.bind(self._onValidateCallbackSuccess, self, items, index, params, endpoint),
2223
+ onFailure: qq.bind(self._onValidateCallbackFailure, self, items, index, params, endpoint),
2224
+ identifier: "Item '" + validationDescriptor.name + "', size: " + validationDescriptor.size
2225
+ });
2226
+ }, 0);
2227
+ } else if (!validItem) {
2228
+ for (;index < items.length; index++) {
2229
+ self._fileOrBlobRejected(items[index].id);
2230
+ }
2231
+ }
2232
+ }
2233
+ },
2234
+ _onAllComplete: function(successful, failed) {
2235
+ this._totalProgress && this._totalProgress.onAllComplete(successful, failed, this._preventRetries);
2236
+ this._options.callbacks.onAllComplete(qq.extend([], successful), qq.extend([], failed));
2237
+ this._succeededSinceLastAllComplete = [];
2238
+ this._failedSinceLastAllComplete = [];
2239
+ },
2240
+ _onAutoRetry: function(id, name, responseJSON, xhr, callback) {
2241
+ var self = this;
2242
+ self._preventRetries[id] = responseJSON[self._options.retry.preventRetryResponseProperty];
2243
+ if (self._shouldAutoRetry(id, name, responseJSON)) {
2244
+ var retryWaitPeriod = self._options.retry.autoAttemptDelay * 1e3;
2245
+ self._maybeParseAndSendUploadError.apply(self, arguments);
2246
+ self._options.callbacks.onAutoRetry(id, name, self._autoRetries[id]);
2247
+ self._onBeforeAutoRetry(id, name);
2248
+ self._uploadData.setStatus(id, qq.status.UPLOAD_RETRYING);
2249
+ self._retryTimeouts[id] = setTimeout(function() {
2250
+ self.log("Starting retry for " + name + "...");
2251
+ if (callback) {
2252
+ callback(id);
2253
+ } else {
2254
+ self._handler.retry(id);
2255
+ }
2256
+ }, retryWaitPeriod);
2257
+ return true;
2258
+ }
2259
+ },
2260
+ _onBeforeAutoRetry: function(id, name) {
2261
+ this.log("Waiting " + this._options.retry.autoAttemptDelay + " seconds before retrying " + name + "...");
2262
+ },
2263
+ _onBeforeManualRetry: function(id) {
2264
+ var itemLimit = this._currentItemLimit, fileName;
2265
+ if (this._preventRetries[id]) {
2266
+ this.log("Retries are forbidden for id " + id, "warn");
2267
+ return false;
2268
+ } else if (this._handler.isValid(id)) {
2269
+ fileName = this.getName(id);
2270
+ if (this._options.callbacks.onManualRetry(id, fileName) === false) {
2271
+ return false;
2272
+ }
2273
+ if (itemLimit > 0 && this._netUploadedOrQueued + 1 > itemLimit) {
2274
+ this._itemError("retryFailTooManyItems");
2275
+ return false;
2276
+ }
2277
+ this.log("Retrying upload for '" + fileName + "' (id: " + id + ")...");
2278
+ return true;
2279
+ } else {
2280
+ this.log("'" + id + "' is not a valid file ID", "error");
2281
+ return false;
2282
+ }
2283
+ },
2284
+ _onCancel: function(id, name) {
2285
+ this._netUploadedOrQueued--;
2286
+ clearTimeout(this._retryTimeouts[id]);
2287
+ var storedItemIndex = qq.indexOf(this._storedIds, id);
2288
+ if (!this._options.autoUpload && storedItemIndex >= 0) {
2289
+ this._storedIds.splice(storedItemIndex, 1);
2290
+ }
2291
+ this._uploadData.setStatus(id, qq.status.CANCELED);
2292
+ },
2293
+ _onComplete: function(id, name, result, xhr) {
2294
+ if (!result.success) {
2295
+ this._netUploadedOrQueued--;
2296
+ this._uploadData.setStatus(id, qq.status.UPLOAD_FAILED);
2297
+ if (result[this._options.retry.preventRetryResponseProperty] === true) {
2298
+ this._preventRetries[id] = true;
2299
+ }
2300
+ } else {
2301
+ if (result.thumbnailUrl) {
2302
+ this._thumbnailUrls[id] = result.thumbnailUrl;
2303
+ }
2304
+ this._netUploaded++;
2305
+ this._uploadData.setStatus(id, qq.status.UPLOAD_SUCCESSFUL);
2306
+ }
2307
+ this._maybeParseAndSendUploadError(id, name, result, xhr);
2308
+ return result.success ? true : false;
2309
+ },
2310
+ _onDelete: function(id) {
2311
+ this._uploadData.setStatus(id, qq.status.DELETING);
2312
+ },
2313
+ _onDeleteComplete: function(id, xhrOrXdr, isError) {
2314
+ var name = this.getName(id);
2315
+ if (isError) {
2316
+ this._handleDeleteFailed(id, xhrOrXdr);
2317
+ } else {
2318
+ this._handleDeleteSuccess(id);
2319
+ }
2320
+ },
2321
+ _onInputChange: function(input) {
2322
+ var fileIndex;
2323
+ if (qq.supportedFeatures.ajaxUploading) {
2324
+ for (fileIndex = 0; fileIndex < input.files.length; fileIndex++) {
2325
+ this._annotateWithButtonId(input.files[fileIndex], input);
2326
+ }
2327
+ this.addFiles(input.files);
2328
+ } else if (input.value.length > 0) {
2329
+ this.addFiles(input);
2330
+ }
2331
+ qq.each(this._buttons, function(idx, button) {
2332
+ button.reset();
2333
+ });
2334
+ },
2335
+ _onProgress: function(id, name, loaded, total) {
2336
+ this._totalProgress && this._totalProgress.onIndividualProgress(id, loaded, total);
2337
+ },
2338
+ _onSubmit: function(id, name) {},
2339
+ _onSubmitCallbackSuccess: function(id, name) {
2340
+ this._onSubmit.apply(this, arguments);
2341
+ this._uploadData.setStatus(id, qq.status.SUBMITTED);
2342
+ this._onSubmitted.apply(this, arguments);
2343
+ if (this._options.autoUpload) {
2344
+ this._options.callbacks.onSubmitted.apply(this, arguments);
2345
+ this._uploadFile(id);
2346
+ } else {
2347
+ this._storeForLater(id);
2348
+ this._options.callbacks.onSubmitted.apply(this, arguments);
2349
+ }
2350
+ },
2351
+ _onSubmitDelete: function(id, onSuccessCallback, additionalMandatedParams) {
2352
+ var uuid = this.getUuid(id), adjustedOnSuccessCallback;
2353
+ if (onSuccessCallback) {
2354
+ adjustedOnSuccessCallback = qq.bind(onSuccessCallback, this, id, uuid, additionalMandatedParams);
2355
+ }
2356
+ if (this._isDeletePossible()) {
2357
+ this._handleCheckedCallback({
2358
+ name: "onSubmitDelete",
2359
+ callback: qq.bind(this._options.callbacks.onSubmitDelete, this, id),
2360
+ onSuccess: adjustedOnSuccessCallback || qq.bind(this._deleteHandler.sendDelete, this, id, uuid, additionalMandatedParams),
2361
+ identifier: id
2362
+ });
2363
+ return true;
2364
+ } else {
2365
+ this.log("Delete request ignored for ID " + id + ", delete feature is disabled or request not possible " + "due to CORS on a user agent that does not support pre-flighting.", "warn");
2366
+ return false;
2367
+ }
2368
+ },
2369
+ _onSubmitted: function(id) {},
2370
+ _onTotalProgress: function(loaded, total) {
2371
+ this._options.callbacks.onTotalProgress(loaded, total);
2372
+ },
2373
+ _onUploadPrep: function(id) {},
2374
+ _onUpload: function(id, name) {
2375
+ this._uploadData.setStatus(id, qq.status.UPLOADING);
2376
+ },
2377
+ _onUploadChunk: function(id, chunkData) {},
2378
+ _onUploadStatusChange: function(id, oldStatus, newStatus) {
2379
+ if (newStatus === qq.status.PAUSED) {
2380
+ clearTimeout(this._retryTimeouts[id]);
2381
+ }
2382
+ },
2383
+ _onValidateBatchCallbackFailure: function(fileWrappers) {
2384
+ var self = this;
2385
+ qq.each(fileWrappers, function(idx, fileWrapper) {
2386
+ self._fileOrBlobRejected(fileWrapper.id);
2387
+ });
2388
+ },
2389
+ _onValidateBatchCallbackSuccess: function(validationDescriptors, items, params, endpoint, button) {
2390
+ var errorMessage, itemLimit = this._currentItemLimit, proposedNetFilesUploadedOrQueued = this._netUploadedOrQueued;
2391
+ if (itemLimit === 0 || proposedNetFilesUploadedOrQueued <= itemLimit) {
2392
+ if (items.length > 0) {
2393
+ this._handleCheckedCallback({
2394
+ name: "onValidate",
2395
+ callback: qq.bind(this._options.callbacks.onValidate, this, validationDescriptors[0], button),
2396
+ onSuccess: qq.bind(this._onValidateCallbackSuccess, this, items, 0, params, endpoint),
2397
+ onFailure: qq.bind(this._onValidateCallbackFailure, this, items, 0, params, endpoint),
2398
+ identifier: "Item '" + items[0].file.name + "', size: " + items[0].file.size
2399
+ });
2400
+ } else {
2401
+ this._itemError("noFilesError");
2402
+ }
2403
+ } else {
2404
+ this._onValidateBatchCallbackFailure(items);
2405
+ errorMessage = this._options.messages.tooManyItemsError.replace(/\{netItems\}/g, proposedNetFilesUploadedOrQueued).replace(/\{itemLimit\}/g, itemLimit);
2406
+ this._batchError(errorMessage);
2407
+ }
2408
+ },
2409
+ _onValidateCallbackFailure: function(items, index, params, endpoint) {
2410
+ var nextIndex = index + 1;
2411
+ this._fileOrBlobRejected(items[index].id, items[index].file.name);
2412
+ this._maybeProcessNextItemAfterOnValidateCallback(false, items, nextIndex, params, endpoint);
2413
+ },
2414
+ _onValidateCallbackSuccess: function(items, index, params, endpoint) {
2415
+ var self = this, nextIndex = index + 1, validationDescriptor = this._getValidationDescriptor(items[index]);
2416
+ this._validateFileOrBlobData(items[index], validationDescriptor).then(function() {
2417
+ self._upload(items[index].id, params, endpoint);
2418
+ self._maybeProcessNextItemAfterOnValidateCallback(true, items, nextIndex, params, endpoint);
2419
+ }, function() {
2420
+ self._maybeProcessNextItemAfterOnValidateCallback(false, items, nextIndex, params, endpoint);
2421
+ });
2422
+ },
2423
+ _prepareItemsForUpload: function(items, params, endpoint) {
2424
+ if (items.length === 0) {
2425
+ this._itemError("noFilesError");
2426
+ return;
2427
+ }
2428
+ var validationDescriptors = this._getValidationDescriptors(items), buttonId = this._getButtonId(items[0].file), button = this._getButton(buttonId);
2429
+ this._handleCheckedCallback({
2430
+ name: "onValidateBatch",
2431
+ callback: qq.bind(this._options.callbacks.onValidateBatch, this, validationDescriptors, button),
2432
+ onSuccess: qq.bind(this._onValidateBatchCallbackSuccess, this, validationDescriptors, items, params, endpoint, button),
2433
+ onFailure: qq.bind(this._onValidateBatchCallbackFailure, this, items),
2434
+ identifier: "batch validation"
2435
+ });
2436
+ },
2437
+ _preventLeaveInProgress: function() {
2438
+ var self = this;
2439
+ this._disposeSupport.attach(window, "beforeunload", function(e) {
2440
+ if (self.getInProgress()) {
2441
+ e = e || window.event;
2442
+ e.returnValue = self._options.messages.onLeave;
2443
+ return self._options.messages.onLeave;
2444
+ }
2445
+ });
2446
+ },
2447
+ _refreshSessionData: function() {
2448
+ var self = this, options = this._options.session;
2449
+ if (qq.Session && this._options.session.endpoint != null) {
2450
+ if (!this._session) {
2451
+ qq.extend(options, {
2452
+ cors: this._options.cors
2453
+ });
2454
+ options.log = qq.bind(this.log, this);
2455
+ options.addFileRecord = qq.bind(this._addCannedFile, this);
2456
+ this._session = new qq.Session(options);
2457
+ }
2458
+ setTimeout(function() {
2459
+ self._session.refresh().then(function(response, xhrOrXdr) {
2460
+ self._sessionRequestComplete();
2461
+ self._options.callbacks.onSessionRequestComplete(response, true, xhrOrXdr);
2462
+ }, function(response, xhrOrXdr) {
2463
+ self._options.callbacks.onSessionRequestComplete(response, false, xhrOrXdr);
2464
+ });
2465
+ }, 0);
2466
+ }
2467
+ },
2468
+ _sessionRequestComplete: function() {},
2469
+ _setSize: function(id, newSize) {
2470
+ this._uploadData.updateSize(id, newSize);
2471
+ this._totalProgress && this._totalProgress.onNewSize(id);
2472
+ },
2473
+ _shouldAutoRetry: function(id, name, responseJSON) {
2474
+ var uploadData = this._uploadData.retrieve({
2475
+ id: id
2476
+ });
2477
+ if (!this._preventRetries[id] && this._options.retry.enableAuto && uploadData.status !== qq.status.PAUSED) {
2478
+ if (this._autoRetries[id] === undefined) {
2479
+ this._autoRetries[id] = 0;
2480
+ }
2481
+ if (this._autoRetries[id] < this._options.retry.maxAutoAttempts) {
2482
+ this._autoRetries[id] += 1;
2483
+ return true;
2484
+ }
2485
+ }
2486
+ return false;
2487
+ },
2488
+ _storeForLater: function(id) {
2489
+ this._storedIds.push(id);
2490
+ },
2491
+ _trackButton: function(id) {
2492
+ var buttonId;
2493
+ if (qq.supportedFeatures.ajaxUploading) {
2494
+ buttonId = this._handler.getFile(id).qqButtonId;
2495
+ } else {
2496
+ buttonId = this._getButtonId(this._handler.getInput(id));
2497
+ }
2498
+ if (buttonId) {
2499
+ this._buttonIdsForFileIds[id] = buttonId;
2500
+ }
2501
+ },
2502
+ _updateFormSupportAndParams: function(formElementOrId) {
2503
+ this._options.form.element = formElementOrId;
2504
+ this._formSupport = qq.FormSupport && new qq.FormSupport(this._options.form, qq.bind(this.uploadStoredFiles, this), qq.bind(this.log, this));
2505
+ if (this._formSupport && this._formSupport.attachedToForm) {
2506
+ this._paramsStore.addReadOnly(null, this._formSupport.getFormInputsAsObject);
2507
+ this._options.autoUpload = this._formSupport.newAutoUpload;
2508
+ if (this._formSupport.newEndpoint) {
2509
+ this.setEndpoint(this._formSupport.newEndpoint);
2510
+ }
2511
+ }
2512
+ },
2513
+ _upload: function(id, params, endpoint) {
2514
+ var name = this.getName(id);
2515
+ if (params) {
2516
+ this.setParams(params, id);
2517
+ }
2518
+ if (endpoint) {
2519
+ this.setEndpoint(endpoint, id);
2520
+ }
2521
+ this._handleCheckedCallback({
2522
+ name: "onSubmit",
2523
+ callback: qq.bind(this._options.callbacks.onSubmit, this, id, name),
2524
+ onSuccess: qq.bind(this._onSubmitCallbackSuccess, this, id, name),
2525
+ onFailure: qq.bind(this._fileOrBlobRejected, this, id, name),
2526
+ identifier: id
2527
+ });
2528
+ },
2529
+ _uploadFile: function(id) {
2530
+ if (!this._handler.upload(id)) {
2531
+ this._uploadData.setStatus(id, qq.status.QUEUED);
2532
+ }
2533
+ },
2534
+ _uploadStoredFiles: function() {
2535
+ var idToUpload, stillSubmitting, self = this;
2536
+ while (this._storedIds.length) {
2537
+ idToUpload = this._storedIds.shift();
2538
+ this._uploadFile(idToUpload);
2539
+ }
2540
+ stillSubmitting = this.getUploads({
2541
+ status: qq.status.SUBMITTING
2542
+ }).length;
2543
+ if (stillSubmitting) {
2544
+ qq.log("Still waiting for " + stillSubmitting + " files to clear submit queue. Will re-parse stored IDs array shortly.");
2545
+ setTimeout(function() {
2546
+ self._uploadStoredFiles();
2547
+ }, 1e3);
2548
+ }
2549
+ },
2550
+ _validateFileOrBlobData: function(fileWrapper, validationDescriptor) {
2551
+ var self = this, file = function() {
2552
+ if (fileWrapper.file instanceof qq.BlobProxy) {
2553
+ return fileWrapper.file.referenceBlob;
2554
+ }
2555
+ return fileWrapper.file;
2556
+ }(), name = validationDescriptor.name, size = validationDescriptor.size, buttonId = this._getButtonId(fileWrapper.file), validationBase = this._getValidationBase(buttonId), validityChecker = new qq.Promise();
2557
+ validityChecker.then(function() {}, function() {
2558
+ self._fileOrBlobRejected(fileWrapper.id, name);
2559
+ });
2560
+ if (qq.isFileOrInput(file) && !this._isAllowedExtension(validationBase.allowedExtensions, name)) {
2561
+ this._itemError("typeError", name, file);
2562
+ return validityChecker.failure();
2563
+ }
2564
+ if (!this._options.validation.allowEmpty && size === 0) {
2565
+ this._itemError("emptyError", name, file);
2566
+ return validityChecker.failure();
2567
+ }
2568
+ if (size > 0 && validationBase.sizeLimit && size > validationBase.sizeLimit) {
2569
+ this._itemError("sizeError", name, file);
2570
+ return validityChecker.failure();
2571
+ }
2572
+ if (size > 0 && size < validationBase.minSizeLimit) {
2573
+ this._itemError("minSizeError", name, file);
2574
+ return validityChecker.failure();
2575
+ }
2576
+ if (qq.ImageValidation && qq.supportedFeatures.imagePreviews && qq.isFile(file)) {
2577
+ new qq.ImageValidation(file, qq.bind(self.log, self)).validate(validationBase.image).then(validityChecker.success, function(errorCode) {
2578
+ self._itemError(errorCode + "ImageError", name, file);
2579
+ validityChecker.failure();
2580
+ });
2581
+ } else {
2582
+ validityChecker.success();
2583
+ }
2584
+ return validityChecker;
2585
+ },
2586
+ _wrapCallbacks: function() {
2587
+ var self, safeCallback, prop;
2588
+ self = this;
2589
+ safeCallback = function(name, callback, args) {
2590
+ var errorMsg;
2591
+ try {
2592
+ return callback.apply(self, args);
2593
+ } catch (exception) {
2594
+ errorMsg = exception.message || exception.toString();
2595
+ self.log("Caught exception in '" + name + "' callback - " + errorMsg, "error");
2596
+ }
2597
+ };
2598
+ for (prop in this._options.callbacks) {
2599
+ (function() {
2600
+ var callbackName, callbackFunc;
2601
+ callbackName = prop;
2602
+ callbackFunc = self._options.callbacks[callbackName];
2603
+ self._options.callbacks[callbackName] = function() {
2604
+ return safeCallback(callbackName, callbackFunc, arguments);
2605
+ };
2606
+ })();
2607
+ }
2608
+ }
2609
+ };
2610
+ })();
2611
+ (function() {
2612
+ "use strict";
2613
+ qq.FineUploaderBasic = function(o) {
2614
+ var self = this;
2615
+ this._options = {
2616
+ debug: false,
2617
+ button: null,
2618
+ multiple: true,
2619
+ maxConnections: 3,
2620
+ disableCancelForFormUploads: false,
2621
+ autoUpload: true,
2622
+ request: {
2623
+ customHeaders: {},
2624
+ endpoint: "/server/upload",
2625
+ filenameParam: "qqfilename",
2626
+ forceMultipart: true,
2627
+ inputName: "qqfile",
2628
+ method: "POST",
2629
+ params: {},
2630
+ paramsInBody: true,
2631
+ totalFileSizeName: "qqtotalfilesize",
2632
+ uuidName: "qquuid"
2633
+ },
2634
+ validation: {
2635
+ allowedExtensions: [],
2636
+ sizeLimit: 0,
2637
+ minSizeLimit: 0,
2638
+ itemLimit: 0,
2639
+ stopOnFirstInvalidFile: true,
2640
+ acceptFiles: null,
2641
+ image: {
2642
+ maxHeight: 0,
2643
+ maxWidth: 0,
2644
+ minHeight: 0,
2645
+ minWidth: 0
2646
+ },
2647
+ allowEmpty: false
2648
+ },
2649
+ callbacks: {
2650
+ onSubmit: function(id, name) {},
2651
+ onSubmitted: function(id, name) {},
2652
+ onComplete: function(id, name, responseJSON, maybeXhr) {},
2653
+ onAllComplete: function(successful, failed) {},
2654
+ onCancel: function(id, name) {},
2655
+ onUpload: function(id, name) {},
2656
+ onUploadChunk: function(id, name, chunkData) {},
2657
+ onUploadChunkSuccess: function(id, chunkData, responseJSON, xhr) {},
2658
+ onResume: function(id, fileName, chunkData) {},
2659
+ onProgress: function(id, name, loaded, total) {},
2660
+ onTotalProgress: function(loaded, total) {},
2661
+ onError: function(id, name, reason, maybeXhrOrXdr) {},
2662
+ onAutoRetry: function(id, name, attemptNumber) {},
2663
+ onManualRetry: function(id, name) {},
2664
+ onValidateBatch: function(fileOrBlobData) {},
2665
+ onValidate: function(fileOrBlobData) {},
2666
+ onSubmitDelete: function(id) {},
2667
+ onDelete: function(id) {},
2668
+ onDeleteComplete: function(id, xhrOrXdr, isError) {},
2669
+ onPasteReceived: function(blob) {},
2670
+ onStatusChange: function(id, oldStatus, newStatus) {},
2671
+ onSessionRequestComplete: function(response, success, xhrOrXdr) {}
2672
+ },
2673
+ messages: {
2674
+ typeError: "{file} has an invalid extension. Valid extension(s): {extensions}.",
2675
+ sizeError: "{file} is too large, maximum file size is {sizeLimit}.",
2676
+ minSizeError: "{file} is too small, minimum file size is {minSizeLimit}.",
2677
+ emptyError: "{file} is empty, please select files again without it.",
2678
+ noFilesError: "No files to upload.",
2679
+ tooManyItemsError: "Too many items ({netItems}) would be uploaded. Item limit is {itemLimit}.",
2680
+ maxHeightImageError: "Image is too tall.",
2681
+ maxWidthImageError: "Image is too wide.",
2682
+ minHeightImageError: "Image is not tall enough.",
2683
+ minWidthImageError: "Image is not wide enough.",
2684
+ retryFailTooManyItems: "Retry failed - you have reached your file limit.",
2685
+ onLeave: "The files are being uploaded, if you leave now the upload will be canceled.",
2686
+ unsupportedBrowserIos8Safari: "Unrecoverable error - this browser does not permit file uploading of any kind due to serious bugs in iOS8 Safari. Please use iOS8 Chrome until Apple fixes these issues."
2687
+ },
2688
+ retry: {
2689
+ enableAuto: false,
2690
+ maxAutoAttempts: 3,
2691
+ autoAttemptDelay: 5,
2692
+ preventRetryResponseProperty: "preventRetry"
2693
+ },
2694
+ classes: {
2695
+ buttonHover: "qq-upload-button-hover",
2696
+ buttonFocus: "qq-upload-button-focus"
2697
+ },
2698
+ chunking: {
2699
+ enabled: false,
2700
+ concurrent: {
2701
+ enabled: false
2702
+ },
2703
+ mandatory: false,
2704
+ paramNames: {
2705
+ partIndex: "qqpartindex",
2706
+ partByteOffset: "qqpartbyteoffset",
2707
+ chunkSize: "qqchunksize",
2708
+ totalFileSize: "qqtotalfilesize",
2709
+ totalParts: "qqtotalparts"
2710
+ },
2711
+ partSize: 2e6,
2712
+ success: {
2713
+ endpoint: null
2714
+ }
2715
+ },
2716
+ resume: {
2717
+ enabled: false,
2718
+ recordsExpireIn: 7,
2719
+ paramNames: {
2720
+ resuming: "qqresume"
2721
+ }
2722
+ },
2723
+ formatFileName: function(fileOrBlobName) {
2724
+ return fileOrBlobName;
2725
+ },
2726
+ text: {
2727
+ defaultResponseError: "Upload failure reason unknown",
2728
+ fileInputTitle: "file input",
2729
+ sizeSymbols: [ "kB", "MB", "GB", "TB", "PB", "EB" ]
2730
+ },
2731
+ deleteFile: {
2732
+ enabled: false,
2733
+ method: "DELETE",
2734
+ endpoint: "/server/upload",
2735
+ customHeaders: {},
2736
+ params: {}
2737
+ },
2738
+ cors: {
2739
+ expected: false,
2740
+ sendCredentials: false,
2741
+ allowXdr: false
2742
+ },
2743
+ blobs: {
2744
+ defaultName: "misc_data"
2745
+ },
2746
+ paste: {
2747
+ targetElement: null,
2748
+ defaultName: "pasted_image"
2749
+ },
2750
+ camera: {
2751
+ ios: false,
2752
+ button: null
2753
+ },
2754
+ extraButtons: [],
2755
+ session: {
2756
+ endpoint: null,
2757
+ params: {},
2758
+ customHeaders: {},
2759
+ refreshOnReset: true
2760
+ },
2761
+ form: {
2762
+ element: "qq-form",
2763
+ autoUpload: false,
2764
+ interceptSubmit: true
2765
+ },
2766
+ scaling: {
2767
+ customResizer: null,
2768
+ sendOriginal: true,
2769
+ orient: true,
2770
+ defaultType: null,
2771
+ defaultQuality: 80,
2772
+ failureText: "Failed to scale",
2773
+ includeExif: false,
2774
+ sizes: []
2775
+ },
2776
+ workarounds: {
2777
+ iosEmptyVideos: true,
2778
+ ios8SafariUploads: true,
2779
+ ios8BrowserCrash: false
2780
+ }
2781
+ };
2782
+ qq.extend(this._options, o, true);
2783
+ this._buttons = [];
2784
+ this._extraButtonSpecs = {};
2785
+ this._buttonIdsForFileIds = [];
2786
+ this._wrapCallbacks();
2787
+ this._disposeSupport = new qq.DisposeSupport();
2788
+ this._storedIds = [];
2789
+ this._autoRetries = [];
2790
+ this._retryTimeouts = [];
2791
+ this._preventRetries = [];
2792
+ this._thumbnailUrls = [];
2793
+ this._netUploadedOrQueued = 0;
2794
+ this._netUploaded = 0;
2795
+ this._uploadData = this._createUploadDataTracker();
2796
+ this._initFormSupportAndParams();
2797
+ this._customHeadersStore = this._createStore(this._options.request.customHeaders);
2798
+ this._deleteFileCustomHeadersStore = this._createStore(this._options.deleteFile.customHeaders);
2799
+ this._deleteFileParamsStore = this._createStore(this._options.deleteFile.params);
2800
+ this._endpointStore = this._createStore(this._options.request.endpoint);
2801
+ this._deleteFileEndpointStore = this._createStore(this._options.deleteFile.endpoint);
2802
+ this._handler = this._createUploadHandler();
2803
+ this._deleteHandler = qq.DeleteFileAjaxRequester && this._createDeleteHandler();
2804
+ if (this._options.button) {
2805
+ this._defaultButtonId = this._createUploadButton({
2806
+ element: this._options.button,
2807
+ title: this._options.text.fileInputTitle
2808
+ }).getButtonId();
2809
+ }
2810
+ this._generateExtraButtonSpecs();
2811
+ this._handleCameraAccess();
2812
+ if (this._options.paste.targetElement) {
2813
+ if (qq.PasteSupport) {
2814
+ this._pasteHandler = this._createPasteHandler();
2815
+ } else {
2816
+ this.log("Paste support module not found", "error");
2817
+ }
2818
+ }
2819
+ this._preventLeaveInProgress();
2820
+ this._imageGenerator = qq.ImageGenerator && new qq.ImageGenerator(qq.bind(this.log, this));
2821
+ this._refreshSessionData();
2822
+ this._succeededSinceLastAllComplete = [];
2823
+ this._failedSinceLastAllComplete = [];
2824
+ this._scaler = qq.Scaler && new qq.Scaler(this._options.scaling, qq.bind(this.log, this)) || {};
2825
+ if (this._scaler.enabled) {
2826
+ this._customNewFileHandler = qq.bind(this._scaler.handleNewFile, this._scaler);
2827
+ }
2828
+ if (qq.TotalProgress && qq.supportedFeatures.progressBar) {
2829
+ this._totalProgress = new qq.TotalProgress(qq.bind(this._onTotalProgress, this), function(id) {
2830
+ var entry = self._uploadData.retrieve({
2831
+ id: id
2832
+ });
2833
+ return entry && entry.size || 0;
2834
+ });
2835
+ }
2836
+ this._currentItemLimit = this._options.validation.itemLimit;
2837
+ };
2838
+ qq.FineUploaderBasic.prototype = qq.basePublicApi;
2839
+ qq.extend(qq.FineUploaderBasic.prototype, qq.basePrivateApi);
2840
+ })();
2841
+ qq.AjaxRequester = function(o) {
2842
+ "use strict";
2843
+ var log, shouldParamsBeInQueryString, queue = [], requestData = {}, options = {
2844
+ acceptHeader: null,
2845
+ validMethods: [ "PATCH", "POST", "PUT" ],
2846
+ method: "POST",
2847
+ contentType: "application/x-www-form-urlencoded",
2848
+ maxConnections: 3,
2849
+ customHeaders: {},
2850
+ endpointStore: {},
2851
+ paramsStore: {},
2852
+ mandatedParams: {},
2853
+ allowXRequestedWithAndCacheControl: true,
2854
+ successfulResponseCodes: {
2855
+ DELETE: [ 200, 202, 204 ],
2856
+ PATCH: [ 200, 201, 202, 203, 204 ],
2857
+ POST: [ 200, 201, 202, 203, 204 ],
2858
+ PUT: [ 200, 201, 202, 203, 204 ],
2859
+ GET: [ 200 ]
2860
+ },
2861
+ cors: {
2862
+ expected: false,
2863
+ sendCredentials: false
2864
+ },
2865
+ log: function(str, level) {},
2866
+ onSend: function(id) {},
2867
+ onComplete: function(id, xhrOrXdr, isError) {},
2868
+ onProgress: null
2869
+ };
2870
+ qq.extend(options, o);
2871
+ log = options.log;
2872
+ if (qq.indexOf(options.validMethods, options.method) < 0) {
2873
+ throw new Error("'" + options.method + "' is not a supported method for this type of request!");
2874
+ }
2875
+ function isSimpleMethod() {
2876
+ return qq.indexOf([ "GET", "POST", "HEAD" ], options.method) >= 0;
2877
+ }
2878
+ function containsNonSimpleHeaders(headers) {
2879
+ var containsNonSimple = false;
2880
+ qq.each(containsNonSimple, function(idx, header) {
2881
+ if (qq.indexOf([ "Accept", "Accept-Language", "Content-Language", "Content-Type" ], header) < 0) {
2882
+ containsNonSimple = true;
2883
+ return false;
2884
+ }
2885
+ });
2886
+ return containsNonSimple;
2887
+ }
2888
+ function isXdr(xhr) {
2889
+ return options.cors.expected && xhr.withCredentials === undefined;
2890
+ }
2891
+ function getCorsAjaxTransport() {
2892
+ var xhrOrXdr;
2893
+ if (window.XMLHttpRequest || window.ActiveXObject) {
2894
+ xhrOrXdr = qq.createXhrInstance();
2895
+ if (xhrOrXdr.withCredentials === undefined) {
2896
+ xhrOrXdr = new XDomainRequest();
2897
+ xhrOrXdr.onload = function() {};
2898
+ xhrOrXdr.onerror = function() {};
2899
+ xhrOrXdr.ontimeout = function() {};
2900
+ xhrOrXdr.onprogress = function() {};
2901
+ }
2902
+ }
2903
+ return xhrOrXdr;
2904
+ }
2905
+ function getXhrOrXdr(id, suppliedXhr) {
2906
+ var xhrOrXdr = requestData[id].xhr;
2907
+ if (!xhrOrXdr) {
2908
+ if (suppliedXhr) {
2909
+ xhrOrXdr = suppliedXhr;
2910
+ } else {
2911
+ if (options.cors.expected) {
2912
+ xhrOrXdr = getCorsAjaxTransport();
2913
+ } else {
2914
+ xhrOrXdr = qq.createXhrInstance();
2915
+ }
2916
+ }
2917
+ requestData[id].xhr = xhrOrXdr;
2918
+ }
2919
+ return xhrOrXdr;
2920
+ }
2921
+ function dequeue(id) {
2922
+ var i = qq.indexOf(queue, id), max = options.maxConnections, nextId;
2923
+ delete requestData[id];
2924
+ queue.splice(i, 1);
2925
+ if (queue.length >= max && i < max) {
2926
+ nextId = queue[max - 1];
2927
+ sendRequest(nextId);
2928
+ }
2929
+ }
2930
+ function onComplete(id, xdrError) {
2931
+ var xhr = getXhrOrXdr(id), method = options.method, isError = xdrError === true;
2932
+ dequeue(id);
2933
+ if (isError) {
2934
+ log(method + " request for " + id + " has failed", "error");
2935
+ } else if (!isXdr(xhr) && !isResponseSuccessful(xhr.status)) {
2936
+ isError = true;
2937
+ log(method + " request for " + id + " has failed - response code " + xhr.status, "error");
2938
+ }
2939
+ options.onComplete(id, xhr, isError);
2940
+ }
2941
+ function getParams(id) {
2942
+ var onDemandParams = requestData[id].additionalParams, mandatedParams = options.mandatedParams, params;
2943
+ if (options.paramsStore.get) {
2944
+ params = options.paramsStore.get(id);
2945
+ }
2946
+ if (onDemandParams) {
2947
+ qq.each(onDemandParams, function(name, val) {
2948
+ params = params || {};
2949
+ params[name] = val;
2950
+ });
2951
+ }
2952
+ if (mandatedParams) {
2953
+ qq.each(mandatedParams, function(name, val) {
2954
+ params = params || {};
2955
+ params[name] = val;
2956
+ });
2957
+ }
2958
+ return params;
2959
+ }
2960
+ function sendRequest(id, optXhr) {
2961
+ var xhr = getXhrOrXdr(id, optXhr), method = options.method, params = getParams(id), payload = requestData[id].payload, url;
2962
+ options.onSend(id);
2963
+ url = createUrl(id, params, requestData[id].additionalQueryParams);
2964
+ if (isXdr(xhr)) {
2965
+ xhr.onload = getXdrLoadHandler(id);
2966
+ xhr.onerror = getXdrErrorHandler(id);
2967
+ } else {
2968
+ xhr.onreadystatechange = getXhrReadyStateChangeHandler(id);
2969
+ }
2970
+ registerForUploadProgress(id);
2971
+ xhr.open(method, url, true);
2972
+ if (options.cors.expected && options.cors.sendCredentials && !isXdr(xhr)) {
2973
+ xhr.withCredentials = true;
2974
+ }
2975
+ setHeaders(id);
2976
+ log("Sending " + method + " request for " + id);
2977
+ if (payload) {
2978
+ xhr.send(payload);
2979
+ } else if (shouldParamsBeInQueryString || !params) {
2980
+ xhr.send();
2981
+ } else if (params && options.contentType && options.contentType.toLowerCase().indexOf("application/x-www-form-urlencoded") >= 0) {
2982
+ xhr.send(qq.obj2url(params, ""));
2983
+ } else if (params && options.contentType && options.contentType.toLowerCase().indexOf("application/json") >= 0) {
2984
+ xhr.send(JSON.stringify(params));
2985
+ } else {
2986
+ xhr.send(params);
2987
+ }
2988
+ return xhr;
2989
+ }
2990
+ function createUrl(id, params, additionalQueryParams) {
2991
+ var endpoint = options.endpointStore.get(id), addToPath = requestData[id].addToPath;
2992
+ if (addToPath != undefined) {
2993
+ endpoint += "/" + addToPath;
2994
+ }
2995
+ if (shouldParamsBeInQueryString && params) {
2996
+ endpoint = qq.obj2url(params, endpoint);
2997
+ }
2998
+ if (additionalQueryParams) {
2999
+ endpoint = qq.obj2url(additionalQueryParams, endpoint);
3000
+ }
3001
+ return endpoint;
3002
+ }
3003
+ function getXhrReadyStateChangeHandler(id) {
3004
+ return function() {
3005
+ if (getXhrOrXdr(id).readyState === 4) {
3006
+ onComplete(id);
3007
+ }
3008
+ };
3009
+ }
3010
+ function registerForUploadProgress(id) {
3011
+ var onProgress = options.onProgress;
3012
+ if (onProgress) {
3013
+ getXhrOrXdr(id).upload.onprogress = function(e) {
3014
+ if (e.lengthComputable) {
3015
+ onProgress(id, e.loaded, e.total);
3016
+ }
3017
+ };
3018
+ }
3019
+ }
3020
+ function getXdrLoadHandler(id) {
3021
+ return function() {
3022
+ onComplete(id);
3023
+ };
3024
+ }
3025
+ function getXdrErrorHandler(id) {
3026
+ return function() {
3027
+ onComplete(id, true);
3028
+ };
3029
+ }
3030
+ function setHeaders(id) {
3031
+ var xhr = getXhrOrXdr(id), customHeaders = options.customHeaders, onDemandHeaders = requestData[id].additionalHeaders || {}, method = options.method, allHeaders = {};
3032
+ if (!isXdr(xhr)) {
3033
+ options.acceptHeader && xhr.setRequestHeader("Accept", options.acceptHeader);
3034
+ if (options.allowXRequestedWithAndCacheControl) {
3035
+ if (!options.cors.expected || (!isSimpleMethod() || containsNonSimpleHeaders(customHeaders))) {
3036
+ xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
3037
+ xhr.setRequestHeader("Cache-Control", "no-cache");
3038
+ }
3039
+ }
3040
+ if (options.contentType && (method === "POST" || method === "PUT")) {
3041
+ xhr.setRequestHeader("Content-Type", options.contentType);
3042
+ }
3043
+ qq.extend(allHeaders, qq.isFunction(customHeaders) ? customHeaders(id) : customHeaders);
3044
+ qq.extend(allHeaders, onDemandHeaders);
3045
+ qq.each(allHeaders, function(name, val) {
3046
+ xhr.setRequestHeader(name, val);
3047
+ });
3048
+ }
3049
+ }
3050
+ function isResponseSuccessful(responseCode) {
3051
+ return qq.indexOf(options.successfulResponseCodes[options.method], responseCode) >= 0;
3052
+ }
3053
+ function prepareToSend(id, optXhr, addToPath, additionalParams, additionalQueryParams, additionalHeaders, payload) {
3054
+ requestData[id] = {
3055
+ addToPath: addToPath,
3056
+ additionalParams: additionalParams,
3057
+ additionalQueryParams: additionalQueryParams,
3058
+ additionalHeaders: additionalHeaders,
3059
+ payload: payload
3060
+ };
3061
+ var len = queue.push(id);
3062
+ if (len <= options.maxConnections) {
3063
+ return sendRequest(id, optXhr);
3064
+ }
3065
+ }
3066
+ shouldParamsBeInQueryString = options.method === "GET" || options.method === "DELETE";
3067
+ qq.extend(this, {
3068
+ initTransport: function(id) {
3069
+ var path, params, headers, payload, cacheBuster, additionalQueryParams;
3070
+ return {
3071
+ withPath: function(appendToPath) {
3072
+ path = appendToPath;
3073
+ return this;
3074
+ },
3075
+ withParams: function(additionalParams) {
3076
+ params = additionalParams;
3077
+ return this;
3078
+ },
3079
+ withQueryParams: function(_additionalQueryParams_) {
3080
+ additionalQueryParams = _additionalQueryParams_;
3081
+ return this;
3082
+ },
3083
+ withHeaders: function(additionalHeaders) {
3084
+ headers = additionalHeaders;
3085
+ return this;
3086
+ },
3087
+ withPayload: function(thePayload) {
3088
+ payload = thePayload;
3089
+ return this;
3090
+ },
3091
+ withCacheBuster: function() {
3092
+ cacheBuster = true;
3093
+ return this;
3094
+ },
3095
+ send: function(optXhr) {
3096
+ if (cacheBuster && qq.indexOf([ "GET", "DELETE" ], options.method) >= 0) {
3097
+ params.qqtimestamp = new Date().getTime();
3098
+ }
3099
+ return prepareToSend(id, optXhr, path, params, additionalQueryParams, headers, payload);
3100
+ }
3101
+ };
3102
+ },
3103
+ canceled: function(id) {
3104
+ dequeue(id);
3105
+ }
3106
+ });
3107
+ };
3108
+ qq.UploadHandler = function(spec) {
3109
+ "use strict";
3110
+ var proxy = spec.proxy, fileState = {}, onCancel = proxy.onCancel, getName = proxy.getName;
3111
+ qq.extend(this, {
3112
+ add: function(id, fileItem) {
3113
+ fileState[id] = fileItem;
3114
+ fileState[id].temp = {};
3115
+ },
3116
+ cancel: function(id) {
3117
+ var self = this, cancelFinalizationEffort = new qq.Promise(), onCancelRetVal = onCancel(id, getName(id), cancelFinalizationEffort);
3118
+ onCancelRetVal.then(function() {
3119
+ if (self.isValid(id)) {
3120
+ fileState[id].canceled = true;
3121
+ self.expunge(id);
3122
+ }
3123
+ cancelFinalizationEffort.success();
3124
+ });
3125
+ },
3126
+ expunge: function(id) {
3127
+ delete fileState[id];
3128
+ },
3129
+ getThirdPartyFileId: function(id) {
3130
+ return fileState[id].key;
3131
+ },
3132
+ isValid: function(id) {
3133
+ return fileState[id] !== undefined;
3134
+ },
3135
+ reset: function() {
3136
+ fileState = {};
3137
+ },
3138
+ _getFileState: function(id) {
3139
+ return fileState[id];
3140
+ },
3141
+ _setThirdPartyFileId: function(id, thirdPartyFileId) {
3142
+ fileState[id].key = thirdPartyFileId;
3143
+ },
3144
+ _wasCanceled: function(id) {
3145
+ return !!fileState[id].canceled;
3146
+ }
3147
+ });
3148
+ };
3149
+ qq.UploadHandlerController = function(o, namespace) {
3150
+ "use strict";
3151
+ var controller = this, chunkingPossible = false, concurrentChunkingPossible = false, chunking, preventRetryResponse, log, handler, options = {
3152
+ paramsStore: {},
3153
+ maxConnections: 3,
3154
+ chunking: {
3155
+ enabled: false,
3156
+ multiple: {
3157
+ enabled: false
3158
+ }
3159
+ },
3160
+ log: function(str, level) {},
3161
+ onProgress: function(id, fileName, loaded, total) {},
3162
+ onComplete: function(id, fileName, response, xhr) {},
3163
+ onCancel: function(id, fileName) {},
3164
+ onUploadPrep: function(id) {},
3165
+ onUpload: function(id, fileName) {},
3166
+ onUploadChunk: function(id, fileName, chunkData) {},
3167
+ onUploadChunkSuccess: function(id, chunkData, response, xhr) {},
3168
+ onAutoRetry: function(id, fileName, response, xhr) {},
3169
+ onResume: function(id, fileName, chunkData) {},
3170
+ onUuidChanged: function(id, newUuid) {},
3171
+ getName: function(id) {},
3172
+ setSize: function(id, newSize) {},
3173
+ isQueued: function(id) {},
3174
+ getIdsInProxyGroup: function(id) {},
3175
+ getIdsInBatch: function(id) {}
3176
+ }, chunked = {
3177
+ done: function(id, chunkIdx, response, xhr) {
3178
+ var chunkData = handler._getChunkData(id, chunkIdx);
3179
+ handler._getFileState(id).attemptingResume = false;
3180
+ delete handler._getFileState(id).temp.chunkProgress[chunkIdx];
3181
+ handler._getFileState(id).loaded += chunkData.size;
3182
+ options.onUploadChunkSuccess(id, handler._getChunkDataForCallback(chunkData), response, xhr);
3183
+ },
3184
+ finalize: function(id) {
3185
+ var size = options.getSize(id), name = options.getName(id);
3186
+ log("All chunks have been uploaded for " + id + " - finalizing....");
3187
+ handler.finalizeChunks(id).then(function(response, xhr) {
3188
+ log("Finalize successful for " + id);
3189
+ var normaizedResponse = upload.normalizeResponse(response, true);
3190
+ options.onProgress(id, name, size, size);
3191
+ handler._maybeDeletePersistedChunkData(id);
3192
+ upload.cleanup(id, normaizedResponse, xhr);
3193
+ }, function(response, xhr) {
3194
+ var normaizedResponse = upload.normalizeResponse(response, false);
3195
+ log("Problem finalizing chunks for file ID " + id + " - " + normaizedResponse.error, "error");
3196
+ if (normaizedResponse.reset) {
3197
+ chunked.reset(id);
3198
+ }
3199
+ if (!options.onAutoRetry(id, name, normaizedResponse, xhr)) {
3200
+ upload.cleanup(id, normaizedResponse, xhr);
3201
+ }
3202
+ });
3203
+ },
3204
+ handleFailure: function(chunkIdx, id, response, xhr) {
3205
+ var name = options.getName(id);
3206
+ log("Chunked upload request failed for " + id + ", chunk " + chunkIdx);
3207
+ handler.clearCachedChunk(id, chunkIdx);
3208
+ var responseToReport = upload.normalizeResponse(response, false), inProgressIdx;
3209
+ if (responseToReport.reset) {
3210
+ chunked.reset(id);
3211
+ } else {
3212
+ inProgressIdx = qq.indexOf(handler._getFileState(id).chunking.inProgress, chunkIdx);
3213
+ if (inProgressIdx >= 0) {
3214
+ handler._getFileState(id).chunking.inProgress.splice(inProgressIdx, 1);
3215
+ handler._getFileState(id).chunking.remaining.unshift(chunkIdx);
3216
+ }
3217
+ }
3218
+ if (!handler._getFileState(id).temp.ignoreFailure) {
3219
+ if (concurrentChunkingPossible) {
3220
+ handler._getFileState(id).temp.ignoreFailure = true;
3221
+ log(qq.format("Going to attempt to abort these chunks: {}. These are currently in-progress: {}.", JSON.stringify(Object.keys(handler._getXhrs(id))), JSON.stringify(handler._getFileState(id).chunking.inProgress)));
3222
+ qq.each(handler._getXhrs(id), function(ckid, ckXhr) {
3223
+ log(qq.format("Attempting to abort file {}.{}. XHR readyState {}. ", id, ckid, ckXhr.readyState));
3224
+ ckXhr.abort();
3225
+ ckXhr._cancelled = true;
3226
+ });
3227
+ handler.moveInProgressToRemaining(id);
3228
+ connectionManager.free(id, true);
3229
+ }
3230
+ if (!options.onAutoRetry(id, name, responseToReport, xhr)) {
3231
+ upload.cleanup(id, responseToReport, xhr);
3232
+ }
3233
+ }
3234
+ },
3235
+ hasMoreParts: function(id) {
3236
+ return !!handler._getFileState(id).chunking.remaining.length;
3237
+ },
3238
+ nextPart: function(id) {
3239
+ var nextIdx = handler._getFileState(id).chunking.remaining.shift();
3240
+ if (nextIdx >= handler._getTotalChunks(id)) {
3241
+ nextIdx = null;
3242
+ }
3243
+ return nextIdx;
3244
+ },
3245
+ reset: function(id) {
3246
+ log("Server or callback has ordered chunking effort to be restarted on next attempt for item ID " + id, "error");
3247
+ handler._maybeDeletePersistedChunkData(id);
3248
+ handler.reevaluateChunking(id);
3249
+ handler._getFileState(id).loaded = 0;
3250
+ },
3251
+ sendNext: function(id) {
3252
+ var size = options.getSize(id), name = options.getName(id), chunkIdx = chunked.nextPart(id), chunkData = handler._getChunkData(id, chunkIdx), resuming = handler._getFileState(id).attemptingResume, inProgressChunks = handler._getFileState(id).chunking.inProgress || [];
3253
+ if (handler._getFileState(id).loaded == null) {
3254
+ handler._getFileState(id).loaded = 0;
3255
+ }
3256
+ if (resuming && options.onResume(id, name, chunkData) === false) {
3257
+ chunked.reset(id);
3258
+ chunkIdx = chunked.nextPart(id);
3259
+ chunkData = handler._getChunkData(id, chunkIdx);
3260
+ resuming = false;
3261
+ }
3262
+ if (chunkIdx == null && inProgressChunks.length === 0) {
3263
+ chunked.finalize(id);
3264
+ } else {
3265
+ log(qq.format("Sending chunked upload request for item {}.{}, bytes {}-{} of {}.", id, chunkIdx, chunkData.start + 1, chunkData.end, size));
3266
+ options.onUploadChunk(id, name, handler._getChunkDataForCallback(chunkData));
3267
+ inProgressChunks.push(chunkIdx);
3268
+ handler._getFileState(id).chunking.inProgress = inProgressChunks;
3269
+ if (concurrentChunkingPossible) {
3270
+ connectionManager.open(id, chunkIdx);
3271
+ }
3272
+ if (concurrentChunkingPossible && connectionManager.available() && handler._getFileState(id).chunking.remaining.length) {
3273
+ chunked.sendNext(id);
3274
+ }
3275
+ if (chunkData.blob.size === 0) {
3276
+ log(qq.format("Chunk {} for file {} will not be uploaded, zero sized chunk.", chunkIdx, id), "error");
3277
+ chunked.handleFailure(chunkIdx, id, "File is no longer available", null);
3278
+ } else {
3279
+ handler.uploadChunk(id, chunkIdx, resuming).then(function success(response, xhr) {
3280
+ log("Chunked upload request succeeded for " + id + ", chunk " + chunkIdx);
3281
+ handler.clearCachedChunk(id, chunkIdx);
3282
+ var inProgressChunks = handler._getFileState(id).chunking.inProgress || [], responseToReport = upload.normalizeResponse(response, true), inProgressChunkIdx = qq.indexOf(inProgressChunks, chunkIdx);
3283
+ log(qq.format("Chunk {} for file {} uploaded successfully.", chunkIdx, id));
3284
+ chunked.done(id, chunkIdx, responseToReport, xhr);
3285
+ if (inProgressChunkIdx >= 0) {
3286
+ inProgressChunks.splice(inProgressChunkIdx, 1);
3287
+ }
3288
+ handler._maybePersistChunkedState(id);
3289
+ if (!chunked.hasMoreParts(id) && inProgressChunks.length === 0) {
3290
+ chunked.finalize(id);
3291
+ } else if (chunked.hasMoreParts(id)) {
3292
+ chunked.sendNext(id);
3293
+ } else {
3294
+ log(qq.format("File ID {} has no more chunks to send and these chunk indexes are still marked as in-progress: {}", id, JSON.stringify(inProgressChunks)));
3295
+ }
3296
+ }, function failure(response, xhr) {
3297
+ chunked.handleFailure(chunkIdx, id, response, xhr);
3298
+ }).done(function() {
3299
+ handler.clearXhr(id, chunkIdx);
3300
+ });
3301
+ }
3302
+ }
3303
+ }
3304
+ }, connectionManager = {
3305
+ _open: [],
3306
+ _openChunks: {},
3307
+ _waiting: [],
3308
+ available: function() {
3309
+ var max = options.maxConnections, openChunkEntriesCount = 0, openChunksCount = 0;
3310
+ qq.each(connectionManager._openChunks, function(fileId, openChunkIndexes) {
3311
+ openChunkEntriesCount++;
3312
+ openChunksCount += openChunkIndexes.length;
3313
+ });
3314
+ return max - (connectionManager._open.length - openChunkEntriesCount + openChunksCount);
3315
+ },
3316
+ free: function(id, dontAllowNext) {
3317
+ var allowNext = !dontAllowNext, waitingIndex = qq.indexOf(connectionManager._waiting, id), connectionsIndex = qq.indexOf(connectionManager._open, id), nextId;
3318
+ delete connectionManager._openChunks[id];
3319
+ if (upload.getProxyOrBlob(id) instanceof qq.BlobProxy) {
3320
+ log("Generated blob upload has ended for " + id + ", disposing generated blob.");
3321
+ delete handler._getFileState(id).file;
3322
+ }
3323
+ if (waitingIndex >= 0) {
3324
+ connectionManager._waiting.splice(waitingIndex, 1);
3325
+ } else if (allowNext && connectionsIndex >= 0) {
3326
+ connectionManager._open.splice(connectionsIndex, 1);
3327
+ nextId = connectionManager._waiting.shift();
3328
+ if (nextId >= 0) {
3329
+ connectionManager._open.push(nextId);
3330
+ upload.start(nextId);
3331
+ }
3332
+ }
3333
+ },
3334
+ getWaitingOrConnected: function() {
3335
+ var waitingOrConnected = [];
3336
+ qq.each(connectionManager._openChunks, function(fileId, chunks) {
3337
+ if (chunks && chunks.length) {
3338
+ waitingOrConnected.push(parseInt(fileId));
3339
+ }
3340
+ });
3341
+ qq.each(connectionManager._open, function(idx, fileId) {
3342
+ if (!connectionManager._openChunks[fileId]) {
3343
+ waitingOrConnected.push(parseInt(fileId));
3344
+ }
3345
+ });
3346
+ waitingOrConnected = waitingOrConnected.concat(connectionManager._waiting);
3347
+ return waitingOrConnected;
3348
+ },
3349
+ isUsingConnection: function(id) {
3350
+ return qq.indexOf(connectionManager._open, id) >= 0;
3351
+ },
3352
+ open: function(id, chunkIdx) {
3353
+ if (chunkIdx == null) {
3354
+ connectionManager._waiting.push(id);
3355
+ }
3356
+ if (connectionManager.available()) {
3357
+ if (chunkIdx == null) {
3358
+ connectionManager._waiting.pop();
3359
+ connectionManager._open.push(id);
3360
+ } else {
3361
+ (function() {
3362
+ var openChunksEntry = connectionManager._openChunks[id] || [];
3363
+ openChunksEntry.push(chunkIdx);
3364
+ connectionManager._openChunks[id] = openChunksEntry;
3365
+ })();
3366
+ }
3367
+ return true;
3368
+ }
3369
+ return false;
3370
+ },
3371
+ reset: function() {
3372
+ connectionManager._waiting = [];
3373
+ connectionManager._open = [];
3374
+ }
3375
+ }, simple = {
3376
+ send: function(id, name) {
3377
+ handler._getFileState(id).loaded = 0;
3378
+ log("Sending simple upload request for " + id);
3379
+ handler.uploadFile(id).then(function(response, optXhr) {
3380
+ log("Simple upload request succeeded for " + id);
3381
+ var responseToReport = upload.normalizeResponse(response, true), size = options.getSize(id);
3382
+ options.onProgress(id, name, size, size);
3383
+ upload.maybeNewUuid(id, responseToReport);
3384
+ upload.cleanup(id, responseToReport, optXhr);
3385
+ }, function(response, optXhr) {
3386
+ log("Simple upload request failed for " + id);
3387
+ var responseToReport = upload.normalizeResponse(response, false);
3388
+ if (!options.onAutoRetry(id, name, responseToReport, optXhr)) {
3389
+ upload.cleanup(id, responseToReport, optXhr);
3390
+ }
3391
+ });
3392
+ }
3393
+ }, upload = {
3394
+ cancel: function(id) {
3395
+ log("Cancelling " + id);
3396
+ options.paramsStore.remove(id);
3397
+ connectionManager.free(id);
3398
+ },
3399
+ cleanup: function(id, response, optXhr) {
3400
+ var name = options.getName(id);
3401
+ options.onComplete(id, name, response, optXhr);
3402
+ if (handler._getFileState(id)) {
3403
+ handler._clearXhrs && handler._clearXhrs(id);
3404
+ }
3405
+ connectionManager.free(id);
3406
+ },
3407
+ getProxyOrBlob: function(id) {
3408
+ return handler.getProxy && handler.getProxy(id) || handler.getFile && handler.getFile(id);
3409
+ },
3410
+ initHandler: function() {
3411
+ var handlerType = namespace ? qq[namespace] : qq.traditional, handlerModuleSubtype = qq.supportedFeatures.ajaxUploading ? "Xhr" : "Form";
3412
+ handler = new handlerType[handlerModuleSubtype + "UploadHandler"](options, {
3413
+ getDataByUuid: options.getDataByUuid,
3414
+ getName: options.getName,
3415
+ getSize: options.getSize,
3416
+ getUuid: options.getUuid,
3417
+ log: log,
3418
+ onCancel: options.onCancel,
3419
+ onProgress: options.onProgress,
3420
+ onUuidChanged: options.onUuidChanged
3421
+ });
3422
+ if (handler._removeExpiredChunkingRecords) {
3423
+ handler._removeExpiredChunkingRecords();
3424
+ }
3425
+ },
3426
+ isDeferredEligibleForUpload: function(id) {
3427
+ return options.isQueued(id);
3428
+ },
3429
+ maybeDefer: function(id, blob) {
3430
+ if (blob && !handler.getFile(id) && blob instanceof qq.BlobProxy) {
3431
+ options.onUploadPrep(id);
3432
+ log("Attempting to generate a blob on-demand for " + id);
3433
+ blob.create().then(function(generatedBlob) {
3434
+ log("Generated an on-demand blob for " + id);
3435
+ handler.updateBlob(id, generatedBlob);
3436
+ options.setSize(id, generatedBlob.size);
3437
+ handler.reevaluateChunking(id);
3438
+ upload.maybeSendDeferredFiles(id);
3439
+ }, function(errorMessage) {
3440
+ var errorResponse = {};
3441
+ if (errorMessage) {
3442
+ errorResponse.error = errorMessage;
3443
+ }
3444
+ log(qq.format("Failed to generate blob for ID {}. Error message: {}.", id, errorMessage), "error");
3445
+ options.onComplete(id, options.getName(id), qq.extend(errorResponse, preventRetryResponse), null);
3446
+ upload.maybeSendDeferredFiles(id);
3447
+ connectionManager.free(id);
3448
+ });
3449
+ } else {
3450
+ return upload.maybeSendDeferredFiles(id);
3451
+ }
3452
+ return false;
3453
+ },
3454
+ maybeSendDeferredFiles: function(id) {
3455
+ var idsInGroup = options.getIdsInProxyGroup(id), uploadedThisId = false;
3456
+ if (idsInGroup && idsInGroup.length) {
3457
+ log("Maybe ready to upload proxy group file " + id);
3458
+ qq.each(idsInGroup, function(idx, idInGroup) {
3459
+ if (upload.isDeferredEligibleForUpload(idInGroup) && !!handler.getFile(idInGroup)) {
3460
+ uploadedThisId = idInGroup === id;
3461
+ upload.now(idInGroup);
3462
+ } else if (upload.isDeferredEligibleForUpload(idInGroup)) {
3463
+ return false;
3464
+ }
3465
+ });
3466
+ } else {
3467
+ uploadedThisId = true;
3468
+ upload.now(id);
3469
+ }
3470
+ return uploadedThisId;
3471
+ },
3472
+ maybeNewUuid: function(id, response) {
3473
+ if (response.newUuid !== undefined) {
3474
+ options.onUuidChanged(id, response.newUuid);
3475
+ }
3476
+ },
3477
+ normalizeResponse: function(originalResponse, successful) {
3478
+ var response = originalResponse;
3479
+ if (!qq.isObject(originalResponse)) {
3480
+ response = {};
3481
+ if (qq.isString(originalResponse) && !successful) {
3482
+ response.error = originalResponse;
3483
+ }
3484
+ }
3485
+ response.success = successful;
3486
+ return response;
3487
+ },
3488
+ now: function(id) {
3489
+ var name = options.getName(id);
3490
+ if (!controller.isValid(id)) {
3491
+ throw new qq.Error(id + " is not a valid file ID to upload!");
3492
+ }
3493
+ options.onUpload(id, name);
3494
+ if (chunkingPossible && handler._shouldChunkThisFile(id)) {
3495
+ chunked.sendNext(id);
3496
+ } else {
3497
+ simple.send(id, name);
3498
+ }
3499
+ },
3500
+ start: function(id) {
3501
+ var blobToUpload = upload.getProxyOrBlob(id);
3502
+ if (blobToUpload) {
3503
+ return upload.maybeDefer(id, blobToUpload);
3504
+ } else {
3505
+ upload.now(id);
3506
+ return true;
3507
+ }
3508
+ }
3509
+ };
3510
+ qq.extend(this, {
3511
+ add: function(id, file) {
3512
+ handler.add.apply(this, arguments);
3513
+ },
3514
+ upload: function(id) {
3515
+ if (connectionManager.open(id)) {
3516
+ return upload.start(id);
3517
+ }
3518
+ return false;
3519
+ },
3520
+ retry: function(id) {
3521
+ if (concurrentChunkingPossible) {
3522
+ handler._getFileState(id).temp.ignoreFailure = false;
3523
+ }
3524
+ if (connectionManager.isUsingConnection(id)) {
3525
+ return upload.start(id);
3526
+ } else {
3527
+ return controller.upload(id);
3528
+ }
3529
+ },
3530
+ cancel: function(id) {
3531
+ var cancelRetVal = handler.cancel(id);
3532
+ if (qq.isGenericPromise(cancelRetVal)) {
3533
+ cancelRetVal.then(function() {
3534
+ upload.cancel(id);
3535
+ });
3536
+ } else if (cancelRetVal !== false) {
3537
+ upload.cancel(id);
3538
+ }
3539
+ },
3540
+ cancelAll: function() {
3541
+ var waitingOrConnected = connectionManager.getWaitingOrConnected(), i;
3542
+ if (waitingOrConnected.length) {
3543
+ for (i = waitingOrConnected.length - 1; i >= 0; i--) {
3544
+ controller.cancel(waitingOrConnected[i]);
3545
+ }
3546
+ }
3547
+ connectionManager.reset();
3548
+ },
3549
+ getFile: function(id) {
3550
+ if (handler.getProxy && handler.getProxy(id)) {
3551
+ return handler.getProxy(id).referenceBlob;
3552
+ }
3553
+ return handler.getFile && handler.getFile(id);
3554
+ },
3555
+ isProxied: function(id) {
3556
+ return !!(handler.getProxy && handler.getProxy(id));
3557
+ },
3558
+ getInput: function(id) {
3559
+ if (handler.getInput) {
3560
+ return handler.getInput(id);
3561
+ }
3562
+ },
3563
+ reset: function() {
3564
+ log("Resetting upload handler");
3565
+ controller.cancelAll();
3566
+ connectionManager.reset();
3567
+ handler.reset();
3568
+ },
3569
+ expunge: function(id) {
3570
+ if (controller.isValid(id)) {
3571
+ return handler.expunge(id);
3572
+ }
3573
+ },
3574
+ isValid: function(id) {
3575
+ return handler.isValid(id);
3576
+ },
3577
+ getResumableFilesData: function() {
3578
+ if (handler.getResumableFilesData) {
3579
+ return handler.getResumableFilesData();
3580
+ }
3581
+ return [];
3582
+ },
3583
+ getThirdPartyFileId: function(id) {
3584
+ if (controller.isValid(id)) {
3585
+ return handler.getThirdPartyFileId(id);
3586
+ }
3587
+ },
3588
+ pause: function(id) {
3589
+ if (controller.isResumable(id) && handler.pause && controller.isValid(id) && handler.pause(id)) {
3590
+ connectionManager.free(id);
3591
+ handler.moveInProgressToRemaining(id);
3592
+ return true;
3593
+ }
3594
+ return false;
3595
+ },
3596
+ isResumable: function(id) {
3597
+ return !!handler.isResumable && handler.isResumable(id);
3598
+ }
3599
+ });
3600
+ qq.extend(options, o);
3601
+ log = options.log;
3602
+ chunkingPossible = options.chunking.enabled && qq.supportedFeatures.chunking;
3603
+ concurrentChunkingPossible = chunkingPossible && options.chunking.concurrent.enabled;
3604
+ preventRetryResponse = function() {
3605
+ var response = {};
3606
+ response[options.preventRetryParam] = true;
3607
+ return response;
3608
+ }();
3609
+ upload.initHandler();
3610
+ };
3611
+ qq.WindowReceiveMessage = function(o) {
3612
+ "use strict";
3613
+ var options = {
3614
+ log: function(message, level) {}
3615
+ }, callbackWrapperDetachers = {};
3616
+ qq.extend(options, o);
3617
+ qq.extend(this, {
3618
+ receiveMessage: function(id, callback) {
3619
+ var onMessageCallbackWrapper = function(event) {
3620
+ callback(event.data);
3621
+ };
3622
+ if (window.postMessage) {
3623
+ callbackWrapperDetachers[id] = qq(window).attach("message", onMessageCallbackWrapper);
3624
+ } else {
3625
+ log("iframe message passing not supported in this browser!", "error");
3626
+ }
3627
+ },
3628
+ stopReceivingMessages: function(id) {
3629
+ if (window.postMessage) {
3630
+ var detacher = callbackWrapperDetachers[id];
3631
+ if (detacher) {
3632
+ detacher();
3633
+ }
3634
+ }
3635
+ }
3636
+ });
3637
+ };
3638
+ qq.FormUploadHandler = function(spec) {
3639
+ "use strict";
3640
+ var options = spec.options, handler = this, proxy = spec.proxy, formHandlerInstanceId = qq.getUniqueId(), onloadCallbacks = {}, detachLoadEvents = {}, postMessageCallbackTimers = {}, isCors = options.isCors, inputName = options.inputName, getUuid = proxy.getUuid, log = proxy.log, corsMessageReceiver = new qq.WindowReceiveMessage({
3641
+ log: log
3642
+ });
3643
+ function expungeFile(id) {
3644
+ delete detachLoadEvents[id];
3645
+ if (isCors) {
3646
+ clearTimeout(postMessageCallbackTimers[id]);
3647
+ delete postMessageCallbackTimers[id];
3648
+ corsMessageReceiver.stopReceivingMessages(id);
3649
+ }
3650
+ var iframe = document.getElementById(handler._getIframeName(id));
3651
+ if (iframe) {
3652
+ iframe.setAttribute("src", "javascript:false;");
3653
+ qq(iframe).remove();
3654
+ }
3655
+ }
3656
+ function getFileIdForIframeName(iframeName) {
3657
+ return iframeName.split("_")[0];
3658
+ }
3659
+ function initIframeForUpload(name) {
3660
+ var iframe = qq.toElement("<iframe src='javascript:false;' name='" + name + "' />");
3661
+ iframe.setAttribute("id", name);
3662
+ iframe.style.display = "none";
3663
+ document.body.appendChild(iframe);
3664
+ return iframe;
3665
+ }
3666
+ function registerPostMessageCallback(iframe, callback) {
3667
+ var iframeName = iframe.id, fileId = getFileIdForIframeName(iframeName), uuid = getUuid(fileId);
3668
+ onloadCallbacks[uuid] = callback;
3669
+ detachLoadEvents[fileId] = qq(iframe).attach("load", function() {
3670
+ if (handler.getInput(fileId)) {
3671
+ log("Received iframe load event for CORS upload request (iframe name " + iframeName + ")");
3672
+ postMessageCallbackTimers[iframeName] = setTimeout(function() {
3673
+ var errorMessage = "No valid message received from loaded iframe for iframe name " + iframeName;
3674
+ log(errorMessage, "error");
3675
+ callback({
3676
+ error: errorMessage
3677
+ });
3678
+ }, 1e3);
3679
+ }
3680
+ });
3681
+ corsMessageReceiver.receiveMessage(iframeName, function(message) {
3682
+ log("Received the following window message: '" + message + "'");
3683
+ var fileId = getFileIdForIframeName(iframeName), response = handler._parseJsonResponse(message), uuid = response.uuid, onloadCallback;
3684
+ if (uuid && onloadCallbacks[uuid]) {
3685
+ log("Handling response for iframe name " + iframeName);
3686
+ clearTimeout(postMessageCallbackTimers[iframeName]);
3687
+ delete postMessageCallbackTimers[iframeName];
3688
+ handler._detachLoadEvent(iframeName);
3689
+ onloadCallback = onloadCallbacks[uuid];
3690
+ delete onloadCallbacks[uuid];
3691
+ corsMessageReceiver.stopReceivingMessages(iframeName);
3692
+ onloadCallback(response);
3693
+ } else if (!uuid) {
3694
+ log("'" + message + "' does not contain a UUID - ignoring.");
3695
+ }
3696
+ });
3697
+ }
3698
+ qq.extend(this, new qq.UploadHandler(spec));
3699
+ qq.override(this, function(super_) {
3700
+ return {
3701
+ add: function(id, fileInput) {
3702
+ super_.add(id, {
3703
+ input: fileInput
3704
+ });
3705
+ fileInput.setAttribute("name", inputName);
3706
+ if (fileInput.parentNode) {
3707
+ qq(fileInput).remove();
3708
+ }
3709
+ },
3710
+ expunge: function(id) {
3711
+ expungeFile(id);
3712
+ super_.expunge(id);
3713
+ },
3714
+ isValid: function(id) {
3715
+ return super_.isValid(id) && handler._getFileState(id).input !== undefined;
3716
+ }
3717
+ };
3718
+ });
3719
+ qq.extend(this, {
3720
+ getInput: function(id) {
3721
+ return handler._getFileState(id).input;
3722
+ },
3723
+ _attachLoadEvent: function(iframe, callback) {
3724
+ var responseDescriptor;
3725
+ if (isCors) {
3726
+ registerPostMessageCallback(iframe, callback);
3727
+ } else {
3728
+ detachLoadEvents[iframe.id] = qq(iframe).attach("load", function() {
3729
+ log("Received response for " + iframe.id);
3730
+ if (!iframe.parentNode) {
3731
+ return;
3732
+ }
3733
+ try {
3734
+ if (iframe.contentDocument && iframe.contentDocument.body && iframe.contentDocument.body.innerHTML == "false") {
3735
+ return;
3736
+ }
3737
+ } catch (error) {
3738
+ log("Error when attempting to access iframe during handling of upload response (" + error.message + ")", "error");
3739
+ responseDescriptor = {
3740
+ success: false
3741
+ };
3742
+ }
3743
+ callback(responseDescriptor);
3744
+ });
3745
+ }
3746
+ },
3747
+ _createIframe: function(id) {
3748
+ var iframeName = handler._getIframeName(id);
3749
+ return initIframeForUpload(iframeName);
3750
+ },
3751
+ _detachLoadEvent: function(id) {
3752
+ if (detachLoadEvents[id] !== undefined) {
3753
+ detachLoadEvents[id]();
3754
+ delete detachLoadEvents[id];
3755
+ }
3756
+ },
3757
+ _getIframeName: function(fileId) {
3758
+ return fileId + "_" + formHandlerInstanceId;
3759
+ },
3760
+ _initFormForUpload: function(spec) {
3761
+ var method = spec.method, endpoint = spec.endpoint, params = spec.params, paramsInBody = spec.paramsInBody, targetName = spec.targetName, form = qq.toElement("<form method='" + method + "' enctype='multipart/form-data'></form>"), url = endpoint;
3762
+ if (paramsInBody) {
3763
+ qq.obj2Inputs(params, form);
3764
+ } else {
3765
+ url = qq.obj2url(params, endpoint);
3766
+ }
3767
+ form.setAttribute("action", url);
3768
+ form.setAttribute("target", targetName);
3769
+ form.style.display = "none";
3770
+ document.body.appendChild(form);
3771
+ return form;
3772
+ },
3773
+ _parseJsonResponse: function(innerHtmlOrMessage) {
3774
+ var response = {};
3775
+ try {
3776
+ response = qq.parseJson(innerHtmlOrMessage);
3777
+ } catch (error) {
3778
+ log("Error when attempting to parse iframe upload response (" + error.message + ")", "error");
3779
+ }
3780
+ return response;
3781
+ }
3782
+ });
3783
+ };
3784
+ qq.XhrUploadHandler = function(spec) {
3785
+ "use strict";
3786
+ var handler = this, namespace = spec.options.namespace, proxy = spec.proxy, chunking = spec.options.chunking, resume = spec.options.resume, chunkFiles = chunking && spec.options.chunking.enabled && qq.supportedFeatures.chunking, resumeEnabled = resume && spec.options.resume.enabled && chunkFiles && qq.supportedFeatures.resume, getName = proxy.getName, getSize = proxy.getSize, getUuid = proxy.getUuid, getEndpoint = proxy.getEndpoint, getDataByUuid = proxy.getDataByUuid, onUuidChanged = proxy.onUuidChanged, onProgress = proxy.onProgress, log = proxy.log;
3787
+ function abort(id) {
3788
+ qq.each(handler._getXhrs(id), function(xhrId, xhr) {
3789
+ var ajaxRequester = handler._getAjaxRequester(id, xhrId);
3790
+ xhr.onreadystatechange = null;
3791
+ xhr.upload.onprogress = null;
3792
+ xhr.abort();
3793
+ ajaxRequester && ajaxRequester.canceled && ajaxRequester.canceled(id);
3794
+ });
3795
+ }
3796
+ qq.extend(this, new qq.UploadHandler(spec));
3797
+ qq.override(this, function(super_) {
3798
+ return {
3799
+ add: function(id, blobOrProxy) {
3800
+ if (qq.isFile(blobOrProxy) || qq.isBlob(blobOrProxy)) {
3801
+ super_.add(id, {
3802
+ file: blobOrProxy
3803
+ });
3804
+ } else if (blobOrProxy instanceof qq.BlobProxy) {
3805
+ super_.add(id, {
3806
+ proxy: blobOrProxy
3807
+ });
3808
+ } else {
3809
+ throw new Error("Passed obj is not a File, Blob, or proxy");
3810
+ }
3811
+ handler._initTempState(id);
3812
+ resumeEnabled && handler._maybePrepareForResume(id);
3813
+ },
3814
+ expunge: function(id) {
3815
+ abort(id);
3816
+ handler._maybeDeletePersistedChunkData(id);
3817
+ handler._clearXhrs(id);
3818
+ super_.expunge(id);
3819
+ }
3820
+ };
3821
+ });
3822
+ qq.extend(this, {
3823
+ clearCachedChunk: function(id, chunkIdx) {
3824
+ delete handler._getFileState(id).temp.cachedChunks[chunkIdx];
3825
+ },
3826
+ clearXhr: function(id, chunkIdx) {
3827
+ var tempState = handler._getFileState(id).temp;
3828
+ if (tempState.xhrs) {
3829
+ delete tempState.xhrs[chunkIdx];
3830
+ }
3831
+ if (tempState.ajaxRequesters) {
3832
+ delete tempState.ajaxRequesters[chunkIdx];
3833
+ }
3834
+ },
3835
+ finalizeChunks: function(id, responseParser) {
3836
+ var lastChunkIdx = handler._getTotalChunks(id) - 1, xhr = handler._getXhr(id, lastChunkIdx);
3837
+ if (responseParser) {
3838
+ return new qq.Promise().success(responseParser(xhr), xhr);
3839
+ }
3840
+ return new qq.Promise().success({}, xhr);
3841
+ },
3842
+ getFile: function(id) {
3843
+ return handler.isValid(id) && handler._getFileState(id).file;
3844
+ },
3845
+ getProxy: function(id) {
3846
+ return handler.isValid(id) && handler._getFileState(id).proxy;
3847
+ },
3848
+ getResumableFilesData: function() {
3849
+ var resumableFilesData = [];
3850
+ handler._iterateResumeRecords(function(key, uploadData) {
3851
+ handler.moveInProgressToRemaining(null, uploadData.chunking.inProgress, uploadData.chunking.remaining);
3852
+ var data = {
3853
+ name: uploadData.name,
3854
+ remaining: uploadData.chunking.remaining,
3855
+ size: uploadData.size,
3856
+ uuid: uploadData.uuid
3857
+ };
3858
+ if (uploadData.key) {
3859
+ data.key = uploadData.key;
3860
+ }
3861
+ resumableFilesData.push(data);
3862
+ });
3863
+ return resumableFilesData;
3864
+ },
3865
+ isResumable: function(id) {
3866
+ return !!chunking && handler.isValid(id) && !handler._getFileState(id).notResumable;
3867
+ },
3868
+ moveInProgressToRemaining: function(id, optInProgress, optRemaining) {
3869
+ var inProgress = optInProgress || handler._getFileState(id).chunking.inProgress, remaining = optRemaining || handler._getFileState(id).chunking.remaining;
3870
+ if (inProgress) {
3871
+ log(qq.format("Moving these chunks from in-progress {}, to remaining.", JSON.stringify(inProgress)));
3872
+ inProgress.reverse();
3873
+ qq.each(inProgress, function(idx, chunkIdx) {
3874
+ remaining.unshift(chunkIdx);
3875
+ });
3876
+ inProgress.length = 0;
3877
+ }
3878
+ },
3879
+ pause: function(id) {
3880
+ if (handler.isValid(id)) {
3881
+ log(qq.format("Aborting XHR upload for {} '{}' due to pause instruction.", id, getName(id)));
3882
+ handler._getFileState(id).paused = true;
3883
+ abort(id);
3884
+ return true;
3885
+ }
3886
+ },
3887
+ reevaluateChunking: function(id) {
3888
+ if (chunking && handler.isValid(id)) {
3889
+ var state = handler._getFileState(id), totalChunks, i;
3890
+ delete state.chunking;
3891
+ state.chunking = {};
3892
+ totalChunks = handler._getTotalChunks(id);
3893
+ if (totalChunks > 1 || chunking.mandatory) {
3894
+ state.chunking.enabled = true;
3895
+ state.chunking.parts = totalChunks;
3896
+ state.chunking.remaining = [];
3897
+ for (i = 0; i < totalChunks; i++) {
3898
+ state.chunking.remaining.push(i);
3899
+ }
3900
+ handler._initTempState(id);
3901
+ } else {
3902
+ state.chunking.enabled = false;
3903
+ }
3904
+ }
3905
+ },
3906
+ updateBlob: function(id, newBlob) {
3907
+ if (handler.isValid(id)) {
3908
+ handler._getFileState(id).file = newBlob;
3909
+ }
3910
+ },
3911
+ _clearXhrs: function(id) {
3912
+ var tempState = handler._getFileState(id).temp;
3913
+ qq.each(tempState.ajaxRequesters, function(chunkId) {
3914
+ delete tempState.ajaxRequesters[chunkId];
3915
+ });
3916
+ qq.each(tempState.xhrs, function(chunkId) {
3917
+ delete tempState.xhrs[chunkId];
3918
+ });
3919
+ },
3920
+ _createXhr: function(id, optChunkIdx) {
3921
+ return handler._registerXhr(id, optChunkIdx, qq.createXhrInstance());
3922
+ },
3923
+ _getAjaxRequester: function(id, optChunkIdx) {
3924
+ var chunkIdx = optChunkIdx == null ? -1 : optChunkIdx;
3925
+ return handler._getFileState(id).temp.ajaxRequesters[chunkIdx];
3926
+ },
3927
+ _getChunkData: function(id, chunkIndex) {
3928
+ var chunkSize = chunking.partSize, fileSize = getSize(id), fileOrBlob = handler.getFile(id), startBytes = chunkSize * chunkIndex, endBytes = startBytes + chunkSize >= fileSize ? fileSize : startBytes + chunkSize, totalChunks = handler._getTotalChunks(id), cachedChunks = this._getFileState(id).temp.cachedChunks, blob = cachedChunks[chunkIndex] || qq.sliceBlob(fileOrBlob, startBytes, endBytes);
3929
+ cachedChunks[chunkIndex] = blob;
3930
+ return {
3931
+ part: chunkIndex,
3932
+ start: startBytes,
3933
+ end: endBytes,
3934
+ count: totalChunks,
3935
+ blob: blob,
3936
+ size: endBytes - startBytes
3937
+ };
3938
+ },
3939
+ _getChunkDataForCallback: function(chunkData) {
3940
+ return {
3941
+ partIndex: chunkData.part,
3942
+ startByte: chunkData.start + 1,
3943
+ endByte: chunkData.end,
3944
+ totalParts: chunkData.count
3945
+ };
3946
+ },
3947
+ _getLocalStorageId: function(id) {
3948
+ var formatVersion = "5.0", name = getName(id), size = getSize(id), chunkSize = chunking.partSize, endpoint = getEndpoint(id);
3949
+ return qq.format("qq{}resume{}-{}-{}-{}-{}", namespace, formatVersion, name, size, chunkSize, endpoint);
3950
+ },
3951
+ _getMimeType: function(id) {
3952
+ return handler.getFile(id).type;
3953
+ },
3954
+ _getPersistableData: function(id) {
3955
+ return handler._getFileState(id).chunking;
3956
+ },
3957
+ _getTotalChunks: function(id) {
3958
+ if (chunking) {
3959
+ var fileSize = getSize(id), chunkSize = chunking.partSize;
3960
+ return Math.ceil(fileSize / chunkSize);
3961
+ }
3962
+ },
3963
+ _getXhr: function(id, optChunkIdx) {
3964
+ var chunkIdx = optChunkIdx == null ? -1 : optChunkIdx;
3965
+ return handler._getFileState(id).temp.xhrs[chunkIdx];
3966
+ },
3967
+ _getXhrs: function(id) {
3968
+ return handler._getFileState(id).temp.xhrs;
3969
+ },
3970
+ _iterateResumeRecords: function(callback) {
3971
+ if (resumeEnabled) {
3972
+ qq.each(localStorage, function(key, item) {
3973
+ if (key.indexOf(qq.format("qq{}resume", namespace)) === 0) {
3974
+ var uploadData = JSON.parse(item);
3975
+ callback(key, uploadData);
3976
+ }
3977
+ });
3978
+ }
3979
+ },
3980
+ _initTempState: function(id) {
3981
+ handler._getFileState(id).temp = {
3982
+ ajaxRequesters: {},
3983
+ chunkProgress: {},
3984
+ xhrs: {},
3985
+ cachedChunks: {}
3986
+ };
3987
+ },
3988
+ _markNotResumable: function(id) {
3989
+ handler._getFileState(id).notResumable = true;
3990
+ },
3991
+ _maybeDeletePersistedChunkData: function(id) {
3992
+ var localStorageId;
3993
+ if (resumeEnabled && handler.isResumable(id)) {
3994
+ localStorageId = handler._getLocalStorageId(id);
3995
+ if (localStorageId && localStorage.getItem(localStorageId)) {
3996
+ localStorage.removeItem(localStorageId);
3997
+ return true;
3998
+ }
3999
+ }
4000
+ return false;
4001
+ },
4002
+ _maybePrepareForResume: function(id) {
4003
+ var state = handler._getFileState(id), localStorageId, persistedData;
4004
+ if (resumeEnabled && state.key === undefined) {
4005
+ localStorageId = handler._getLocalStorageId(id);
4006
+ persistedData = localStorage.getItem(localStorageId);
4007
+ if (persistedData) {
4008
+ persistedData = JSON.parse(persistedData);
4009
+ if (getDataByUuid(persistedData.uuid)) {
4010
+ handler._markNotResumable(id);
4011
+ } else {
4012
+ log(qq.format("Identified file with ID {} and name of {} as resumable.", id, getName(id)));
4013
+ onUuidChanged(id, persistedData.uuid);
4014
+ state.key = persistedData.key;
4015
+ state.chunking = persistedData.chunking;
4016
+ state.loaded = persistedData.loaded;
4017
+ state.attemptingResume = true;
4018
+ handler.moveInProgressToRemaining(id);
4019
+ }
4020
+ }
4021
+ }
4022
+ },
4023
+ _maybePersistChunkedState: function(id) {
4024
+ var state = handler._getFileState(id), localStorageId, persistedData;
4025
+ if (resumeEnabled && handler.isResumable(id)) {
4026
+ localStorageId = handler._getLocalStorageId(id);
4027
+ persistedData = {
4028
+ name: getName(id),
4029
+ size: getSize(id),
4030
+ uuid: getUuid(id),
4031
+ key: state.key,
4032
+ chunking: state.chunking,
4033
+ loaded: state.loaded,
4034
+ lastUpdated: Date.now()
4035
+ };
4036
+ try {
4037
+ localStorage.setItem(localStorageId, JSON.stringify(persistedData));
4038
+ } catch (error) {
4039
+ log(qq.format("Unable to save resume data for '{}' due to error: '{}'.", id, error.toString()), "warn");
4040
+ }
4041
+ }
4042
+ },
4043
+ _registerProgressHandler: function(id, chunkIdx, chunkSize) {
4044
+ var xhr = handler._getXhr(id, chunkIdx), name = getName(id), progressCalculator = {
4045
+ simple: function(loaded, total) {
4046
+ var fileSize = getSize(id);
4047
+ if (loaded === total) {
4048
+ onProgress(id, name, fileSize, fileSize);
4049
+ } else {
4050
+ onProgress(id, name, loaded >= fileSize ? fileSize - 1 : loaded, fileSize);
4051
+ }
4052
+ },
4053
+ chunked: function(loaded, total) {
4054
+ var chunkProgress = handler._getFileState(id).temp.chunkProgress, totalSuccessfullyLoadedForFile = handler._getFileState(id).loaded, loadedForRequest = loaded, totalForRequest = total, totalFileSize = getSize(id), estActualChunkLoaded = loadedForRequest - (totalForRequest - chunkSize), totalLoadedForFile = totalSuccessfullyLoadedForFile;
4055
+ chunkProgress[chunkIdx] = estActualChunkLoaded;
4056
+ qq.each(chunkProgress, function(chunkIdx, chunkLoaded) {
4057
+ totalLoadedForFile += chunkLoaded;
4058
+ });
4059
+ onProgress(id, name, totalLoadedForFile, totalFileSize);
4060
+ }
4061
+ };
4062
+ xhr.upload.onprogress = function(e) {
4063
+ if (e.lengthComputable) {
4064
+ var type = chunkSize == null ? "simple" : "chunked";
4065
+ progressCalculator[type](e.loaded, e.total);
4066
+ }
4067
+ };
4068
+ },
4069
+ _registerXhr: function(id, optChunkIdx, xhr, optAjaxRequester) {
4070
+ var xhrsId = optChunkIdx == null ? -1 : optChunkIdx, tempState = handler._getFileState(id).temp;
4071
+ tempState.xhrs = tempState.xhrs || {};
4072
+ tempState.ajaxRequesters = tempState.ajaxRequesters || {};
4073
+ tempState.xhrs[xhrsId] = xhr;
4074
+ if (optAjaxRequester) {
4075
+ tempState.ajaxRequesters[xhrsId] = optAjaxRequester;
4076
+ }
4077
+ return xhr;
4078
+ },
4079
+ _removeExpiredChunkingRecords: function() {
4080
+ var expirationDays = resume.recordsExpireIn;
4081
+ handler._iterateResumeRecords(function(key, uploadData) {
4082
+ var expirationDate = new Date(uploadData.lastUpdated);
4083
+ expirationDate.setDate(expirationDate.getDate() + expirationDays);
4084
+ if (expirationDate.getTime() <= Date.now()) {
4085
+ log("Removing expired resume record with key " + key);
4086
+ localStorage.removeItem(key);
4087
+ }
4088
+ });
4089
+ },
4090
+ _shouldChunkThisFile: function(id) {
4091
+ var state = handler._getFileState(id);
4092
+ if (!state.chunking) {
4093
+ handler.reevaluateChunking(id);
4094
+ }
4095
+ return state.chunking.enabled;
4096
+ }
4097
+ });
4098
+ };
4099
+ qq.DeleteFileAjaxRequester = function(o) {
4100
+ "use strict";
4101
+ var requester, options = {
4102
+ method: "DELETE",
4103
+ uuidParamName: "qquuid",
4104
+ endpointStore: {},
4105
+ maxConnections: 3,
4106
+ customHeaders: function(id) {
4107
+ return {};
4108
+ },
4109
+ paramsStore: {},
4110
+ cors: {
4111
+ expected: false,
4112
+ sendCredentials: false
4113
+ },
4114
+ log: function(str, level) {},
4115
+ onDelete: function(id) {},
4116
+ onDeleteComplete: function(id, xhrOrXdr, isError) {}
4117
+ };
4118
+ qq.extend(options, o);
4119
+ function getMandatedParams() {
4120
+ if (options.method.toUpperCase() === "POST") {
4121
+ return {
4122
+ _method: "DELETE"
4123
+ };
4124
+ }
4125
+ return {};
4126
+ }
4127
+ requester = qq.extend(this, new qq.AjaxRequester({
4128
+ acceptHeader: "application/json",
4129
+ validMethods: [ "POST", "DELETE" ],
4130
+ method: options.method,
4131
+ endpointStore: options.endpointStore,
4132
+ paramsStore: options.paramsStore,
4133
+ mandatedParams: getMandatedParams(),
4134
+ maxConnections: options.maxConnections,
4135
+ customHeaders: function(id) {
4136
+ return options.customHeaders.get(id);
4137
+ },
4138
+ log: options.log,
4139
+ onSend: options.onDelete,
4140
+ onComplete: options.onDeleteComplete,
4141
+ cors: options.cors
4142
+ }));
4143
+ qq.extend(this, {
4144
+ sendDelete: function(id, uuid, additionalMandatedParams) {
4145
+ var additionalOptions = additionalMandatedParams || {};
4146
+ options.log("Submitting delete file request for " + id);
4147
+ if (options.method === "DELETE") {
4148
+ requester.initTransport(id).withPath(uuid).withParams(additionalOptions).send();
4149
+ } else {
4150
+ additionalOptions[options.uuidParamName] = uuid;
4151
+ requester.initTransport(id).withParams(additionalOptions).send();
4152
+ }
4153
+ }
4154
+ });
4155
+ };
4156
+ (function() {
4157
+ function detectSubsampling(img) {
4158
+ var iw = img.naturalWidth, ih = img.naturalHeight, canvas = document.createElement("canvas"), ctx;
4159
+ if (iw * ih > 1024 * 1024) {
4160
+ canvas.width = canvas.height = 1;
4161
+ ctx = canvas.getContext("2d");
4162
+ ctx.drawImage(img, -iw + 1, 0);
4163
+ return ctx.getImageData(0, 0, 1, 1).data[3] === 0;
4164
+ } else {
4165
+ return false;
4166
+ }
4167
+ }
4168
+ function detectVerticalSquash(img, iw, ih) {
4169
+ var canvas = document.createElement("canvas"), sy = 0, ey = ih, py = ih, ctx, data, alpha, ratio;
4170
+ canvas.width = 1;
4171
+ canvas.height = ih;
4172
+ ctx = canvas.getContext("2d");
4173
+ ctx.drawImage(img, 0, 0);
4174
+ data = ctx.getImageData(0, 0, 1, ih).data;
4175
+ while (py > sy) {
4176
+ alpha = data[(py - 1) * 4 + 3];
4177
+ if (alpha === 0) {
4178
+ ey = py;
4179
+ } else {
4180
+ sy = py;
4181
+ }
4182
+ py = ey + sy >> 1;
4183
+ }
4184
+ ratio = py / ih;
4185
+ return ratio === 0 ? 1 : ratio;
4186
+ }
4187
+ function renderImageToDataURL(img, blob, options, doSquash) {
4188
+ var canvas = document.createElement("canvas"), mime = options.mime || "image/jpeg", promise = new qq.Promise();
4189
+ renderImageToCanvas(img, blob, canvas, options, doSquash).then(function() {
4190
+ promise.success(canvas.toDataURL(mime, options.quality || .8));
4191
+ });
4192
+ return promise;
4193
+ }
4194
+ function maybeCalculateDownsampledDimensions(spec) {
4195
+ var maxPixels = 5241e3;
4196
+ if (!qq.ios()) {
4197
+ throw new qq.Error("Downsampled dimensions can only be reliably calculated for iOS!");
4198
+ }
4199
+ if (spec.origHeight * spec.origWidth > maxPixels) {
4200
+ return {
4201
+ newHeight: Math.round(Math.sqrt(maxPixels * (spec.origHeight / spec.origWidth))),
4202
+ newWidth: Math.round(Math.sqrt(maxPixels * (spec.origWidth / spec.origHeight)))
4203
+ };
4204
+ }
4205
+ }
4206
+ function renderImageToCanvas(img, blob, canvas, options, doSquash) {
4207
+ var iw = img.naturalWidth, ih = img.naturalHeight, width = options.width, height = options.height, ctx = canvas.getContext("2d"), promise = new qq.Promise(), modifiedDimensions;
4208
+ ctx.save();
4209
+ if (options.resize) {
4210
+ return renderImageToCanvasWithCustomResizer({
4211
+ blob: blob,
4212
+ canvas: canvas,
4213
+ image: img,
4214
+ imageHeight: ih,
4215
+ imageWidth: iw,
4216
+ orientation: options.orientation,
4217
+ resize: options.resize,
4218
+ targetHeight: height,
4219
+ targetWidth: width
4220
+ });
4221
+ }
4222
+ if (!qq.supportedFeatures.unlimitedScaledImageSize) {
4223
+ modifiedDimensions = maybeCalculateDownsampledDimensions({
4224
+ origWidth: width,
4225
+ origHeight: height
4226
+ });
4227
+ if (modifiedDimensions) {
4228
+ qq.log(qq.format("Had to reduce dimensions due to device limitations from {}w / {}h to {}w / {}h", width, height, modifiedDimensions.newWidth, modifiedDimensions.newHeight), "warn");
4229
+ width = modifiedDimensions.newWidth;
4230
+ height = modifiedDimensions.newHeight;
4231
+ }
4232
+ }
4233
+ transformCoordinate(canvas, width, height, options.orientation);
4234
+ if (qq.ios()) {
4235
+ (function() {
4236
+ if (detectSubsampling(img)) {
4237
+ iw /= 2;
4238
+ ih /= 2;
4239
+ }
4240
+ var d = 1024, tmpCanvas = document.createElement("canvas"), vertSquashRatio = doSquash ? detectVerticalSquash(img, iw, ih) : 1, dw = Math.ceil(d * width / iw), dh = Math.ceil(d * height / ih / vertSquashRatio), sy = 0, dy = 0, tmpCtx, sx, dx;
4241
+ tmpCanvas.width = tmpCanvas.height = d;
4242
+ tmpCtx = tmpCanvas.getContext("2d");
4243
+ while (sy < ih) {
4244
+ sx = 0;
4245
+ dx = 0;
4246
+ while (sx < iw) {
4247
+ tmpCtx.clearRect(0, 0, d, d);
4248
+ tmpCtx.drawImage(img, -sx, -sy);
4249
+ ctx.drawImage(tmpCanvas, 0, 0, d, d, dx, dy, dw, dh);
4250
+ sx += d;
4251
+ dx += dw;
4252
+ }
4253
+ sy += d;
4254
+ dy += dh;
4255
+ }
4256
+ ctx.restore();
4257
+ tmpCanvas = tmpCtx = null;
4258
+ })();
4259
+ } else {
4260
+ ctx.drawImage(img, 0, 0, width, height);
4261
+ }
4262
+ canvas.qqImageRendered && canvas.qqImageRendered();
4263
+ promise.success();
4264
+ return promise;
4265
+ }
4266
+ function renderImageToCanvasWithCustomResizer(resizeInfo) {
4267
+ var blob = resizeInfo.blob, image = resizeInfo.image, imageHeight = resizeInfo.imageHeight, imageWidth = resizeInfo.imageWidth, orientation = resizeInfo.orientation, promise = new qq.Promise(), resize = resizeInfo.resize, sourceCanvas = document.createElement("canvas"), sourceCanvasContext = sourceCanvas.getContext("2d"), targetCanvas = resizeInfo.canvas, targetHeight = resizeInfo.targetHeight, targetWidth = resizeInfo.targetWidth;
4268
+ transformCoordinate(sourceCanvas, imageWidth, imageHeight, orientation);
4269
+ targetCanvas.height = targetHeight;
4270
+ targetCanvas.width = targetWidth;
4271
+ sourceCanvasContext.drawImage(image, 0, 0);
4272
+ resize({
4273
+ blob: blob,
4274
+ height: targetHeight,
4275
+ image: image,
4276
+ sourceCanvas: sourceCanvas,
4277
+ targetCanvas: targetCanvas,
4278
+ width: targetWidth
4279
+ }).then(function success() {
4280
+ targetCanvas.qqImageRendered && targetCanvas.qqImageRendered();
4281
+ promise.success();
4282
+ }, promise.failure);
4283
+ return promise;
4284
+ }
4285
+ function transformCoordinate(canvas, width, height, orientation) {
4286
+ switch (orientation) {
4287
+ case 5:
4288
+ case 6:
4289
+ case 7:
4290
+ case 8:
4291
+ canvas.width = height;
4292
+ canvas.height = width;
4293
+ break;
4294
+
4295
+ default:
4296
+ canvas.width = width;
4297
+ canvas.height = height;
4298
+ }
4299
+ var ctx = canvas.getContext("2d");
4300
+ switch (orientation) {
4301
+ case 2:
4302
+ ctx.translate(width, 0);
4303
+ ctx.scale(-1, 1);
4304
+ break;
4305
+
4306
+ case 3:
4307
+ ctx.translate(width, height);
4308
+ ctx.rotate(Math.PI);
4309
+ break;
4310
+
4311
+ case 4:
4312
+ ctx.translate(0, height);
4313
+ ctx.scale(1, -1);
4314
+ break;
4315
+
4316
+ case 5:
4317
+ ctx.rotate(.5 * Math.PI);
4318
+ ctx.scale(1, -1);
4319
+ break;
4320
+
4321
+ case 6:
4322
+ ctx.rotate(.5 * Math.PI);
4323
+ ctx.translate(0, -height);
4324
+ break;
4325
+
4326
+ case 7:
4327
+ ctx.rotate(.5 * Math.PI);
4328
+ ctx.translate(width, -height);
4329
+ ctx.scale(-1, 1);
4330
+ break;
4331
+
4332
+ case 8:
4333
+ ctx.rotate(-.5 * Math.PI);
4334
+ ctx.translate(-width, 0);
4335
+ break;
4336
+
4337
+ default:
4338
+ break;
4339
+ }
4340
+ }
4341
+ function MegaPixImage(srcImage, errorCallback) {
4342
+ var self = this;
4343
+ if (window.Blob && srcImage instanceof Blob) {
4344
+ (function() {
4345
+ var img = new Image(), URL = window.URL && window.URL.createObjectURL ? window.URL : window.webkitURL && window.webkitURL.createObjectURL ? window.webkitURL : null;
4346
+ if (!URL) {
4347
+ throw Error("No createObjectURL function found to create blob url");
4348
+ }
4349
+ img.src = URL.createObjectURL(srcImage);
4350
+ self.blob = srcImage;
4351
+ srcImage = img;
4352
+ })();
4353
+ }
4354
+ if (!srcImage.naturalWidth && !srcImage.naturalHeight) {
4355
+ srcImage.onload = function() {
4356
+ var listeners = self.imageLoadListeners;
4357
+ if (listeners) {
4358
+ self.imageLoadListeners = null;
4359
+ setTimeout(function() {
4360
+ for (var i = 0, len = listeners.length; i < len; i++) {
4361
+ listeners[i]();
4362
+ }
4363
+ }, 0);
4364
+ }
4365
+ };
4366
+ srcImage.onerror = errorCallback;
4367
+ this.imageLoadListeners = [];
4368
+ }
4369
+ this.srcImage = srcImage;
4370
+ }
4371
+ MegaPixImage.prototype.render = function(target, options) {
4372
+ options = options || {};
4373
+ var self = this, imgWidth = this.srcImage.naturalWidth, imgHeight = this.srcImage.naturalHeight, width = options.width, height = options.height, maxWidth = options.maxWidth, maxHeight = options.maxHeight, doSquash = !this.blob || this.blob.type === "image/jpeg", tagName = target.tagName.toLowerCase(), opt;
4374
+ if (this.imageLoadListeners) {
4375
+ this.imageLoadListeners.push(function() {
4376
+ self.render(target, options);
4377
+ });
4378
+ return;
4379
+ }
4380
+ if (width && !height) {
4381
+ height = imgHeight * width / imgWidth << 0;
4382
+ } else if (height && !width) {
4383
+ width = imgWidth * height / imgHeight << 0;
4384
+ } else {
4385
+ width = imgWidth;
4386
+ height = imgHeight;
4387
+ }
4388
+ if (maxWidth && width > maxWidth) {
4389
+ width = maxWidth;
4390
+ height = imgHeight * width / imgWidth << 0;
4391
+ }
4392
+ if (maxHeight && height > maxHeight) {
4393
+ height = maxHeight;
4394
+ width = imgWidth * height / imgHeight << 0;
4395
+ }
4396
+ opt = {
4397
+ width: width,
4398
+ height: height
4399
+ }, qq.each(options, function(optionsKey, optionsValue) {
4400
+ opt[optionsKey] = optionsValue;
4401
+ });
4402
+ if (tagName === "img") {
4403
+ (function() {
4404
+ var oldTargetSrc = target.src;
4405
+ renderImageToDataURL(self.srcImage, self.blob, opt, doSquash).then(function(dataUri) {
4406
+ target.src = dataUri;
4407
+ oldTargetSrc === target.src && target.onload();
4408
+ });
4409
+ })();
4410
+ } else if (tagName === "canvas") {
4411
+ renderImageToCanvas(this.srcImage, this.blob, target, opt, doSquash);
4412
+ }
4413
+ if (typeof this.onrender === "function") {
4414
+ this.onrender(target);
4415
+ }
4416
+ };
4417
+ qq.MegaPixImage = MegaPixImage;
4418
+ })();
4419
+ qq.ImageGenerator = function(log) {
4420
+ "use strict";
4421
+ function isImg(el) {
4422
+ return el.tagName.toLowerCase() === "img";
4423
+ }
4424
+ function isCanvas(el) {
4425
+ return el.tagName.toLowerCase() === "canvas";
4426
+ }
4427
+ function isImgCorsSupported() {
4428
+ return new Image().crossOrigin !== undefined;
4429
+ }
4430
+ function isCanvasSupported() {
4431
+ var canvas = document.createElement("canvas");
4432
+ return canvas.getContext && canvas.getContext("2d");
4433
+ }
4434
+ function determineMimeOfFileName(nameWithPath) {
4435
+ var pathSegments = nameWithPath.split("/"), name = pathSegments[pathSegments.length - 1].split("?")[0], extension = qq.getExtension(name);
4436
+ extension = extension && extension.toLowerCase();
4437
+ switch (extension) {
4438
+ case "jpeg":
4439
+ case "jpg":
4440
+ return "image/jpeg";
4441
+
4442
+ case "png":
4443
+ return "image/png";
4444
+
4445
+ case "bmp":
4446
+ return "image/bmp";
4447
+
4448
+ case "gif":
4449
+ return "image/gif";
4450
+
4451
+ case "tiff":
4452
+ case "tif":
4453
+ return "image/tiff";
4454
+ }
4455
+ }
4456
+ function isCrossOrigin(url) {
4457
+ var targetAnchor = document.createElement("a"), targetProtocol, targetHostname, targetPort;
4458
+ targetAnchor.href = url;
4459
+ targetProtocol = targetAnchor.protocol;
4460
+ targetPort = targetAnchor.port;
4461
+ targetHostname = targetAnchor.hostname;
4462
+ if (targetProtocol.toLowerCase() !== window.location.protocol.toLowerCase()) {
4463
+ return true;
4464
+ }
4465
+ if (targetHostname.toLowerCase() !== window.location.hostname.toLowerCase()) {
4466
+ return true;
4467
+ }
4468
+ if (targetPort !== window.location.port && !qq.ie()) {
4469
+ return true;
4470
+ }
4471
+ return false;
4472
+ }
4473
+ function registerImgLoadListeners(img, promise) {
4474
+ img.onload = function() {
4475
+ img.onload = null;
4476
+ img.onerror = null;
4477
+ promise.success(img);
4478
+ };
4479
+ img.onerror = function() {
4480
+ img.onload = null;
4481
+ img.onerror = null;
4482
+ log("Problem drawing thumbnail!", "error");
4483
+ promise.failure(img, "Problem drawing thumbnail!");
4484
+ };
4485
+ }
4486
+ function registerCanvasDrawImageListener(canvas, promise) {
4487
+ canvas.qqImageRendered = function() {
4488
+ promise.success(canvas);
4489
+ };
4490
+ }
4491
+ function registerThumbnailRenderedListener(imgOrCanvas, promise) {
4492
+ var registered = isImg(imgOrCanvas) || isCanvas(imgOrCanvas);
4493
+ if (isImg(imgOrCanvas)) {
4494
+ registerImgLoadListeners(imgOrCanvas, promise);
4495
+ } else if (isCanvas(imgOrCanvas)) {
4496
+ registerCanvasDrawImageListener(imgOrCanvas, promise);
4497
+ } else {
4498
+ promise.failure(imgOrCanvas);
4499
+ log(qq.format("Element container of type {} is not supported!", imgOrCanvas.tagName), "error");
4500
+ }
4501
+ return registered;
4502
+ }
4503
+ function draw(fileOrBlob, container, options) {
4504
+ var drawPreview = new qq.Promise(), identifier = new qq.Identify(fileOrBlob, log), maxSize = options.maxSize, orient = options.orient == null ? true : options.orient, megapixErrorHandler = function() {
4505
+ container.onerror = null;
4506
+ container.onload = null;
4507
+ log("Could not render preview, file may be too large!", "error");
4508
+ drawPreview.failure(container, "Browser cannot render image!");
4509
+ };
4510
+ identifier.isPreviewable().then(function(mime) {
4511
+ var dummyExif = {
4512
+ parse: function() {
4513
+ return new qq.Promise().success();
4514
+ }
4515
+ }, exif = orient ? new qq.Exif(fileOrBlob, log) : dummyExif, mpImg = new qq.MegaPixImage(fileOrBlob, megapixErrorHandler);
4516
+ if (registerThumbnailRenderedListener(container, drawPreview)) {
4517
+ exif.parse().then(function(exif) {
4518
+ var orientation = exif && exif.Orientation;
4519
+ mpImg.render(container, {
4520
+ maxWidth: maxSize,
4521
+ maxHeight: maxSize,
4522
+ orientation: orientation,
4523
+ mime: mime,
4524
+ resize: options.customResizeFunction
4525
+ });
4526
+ }, function(failureMsg) {
4527
+ log(qq.format("EXIF data could not be parsed ({}). Assuming orientation = 1.", failureMsg));
4528
+ mpImg.render(container, {
4529
+ maxWidth: maxSize,
4530
+ maxHeight: maxSize,
4531
+ mime: mime,
4532
+ resize: options.customResizeFunction
4533
+ });
4534
+ });
4535
+ }
4536
+ }, function() {
4537
+ log("Not previewable");
4538
+ drawPreview.failure(container, "Not previewable");
4539
+ });
4540
+ return drawPreview;
4541
+ }
4542
+ function drawOnCanvasOrImgFromUrl(url, canvasOrImg, draw, maxSize, customResizeFunction) {
4543
+ var tempImg = new Image(), tempImgRender = new qq.Promise();
4544
+ registerThumbnailRenderedListener(tempImg, tempImgRender);
4545
+ if (isCrossOrigin(url)) {
4546
+ tempImg.crossOrigin = "anonymous";
4547
+ }
4548
+ tempImg.src = url;
4549
+ tempImgRender.then(function rendered() {
4550
+ registerThumbnailRenderedListener(canvasOrImg, draw);
4551
+ var mpImg = new qq.MegaPixImage(tempImg);
4552
+ mpImg.render(canvasOrImg, {
4553
+ maxWidth: maxSize,
4554
+ maxHeight: maxSize,
4555
+ mime: determineMimeOfFileName(url),
4556
+ resize: customResizeFunction
4557
+ });
4558
+ }, draw.failure);
4559
+ }
4560
+ function drawOnImgFromUrlWithCssScaling(url, img, draw, maxSize) {
4561
+ registerThumbnailRenderedListener(img, draw);
4562
+ qq(img).css({
4563
+ maxWidth: maxSize + "px",
4564
+ maxHeight: maxSize + "px"
4565
+ });
4566
+ img.src = url;
4567
+ }
4568
+ function drawFromUrl(url, container, options) {
4569
+ var draw = new qq.Promise(), scale = options.scale, maxSize = scale ? options.maxSize : null;
4570
+ if (scale && isImg(container)) {
4571
+ if (isCanvasSupported()) {
4572
+ if (isCrossOrigin(url) && !isImgCorsSupported()) {
4573
+ drawOnImgFromUrlWithCssScaling(url, container, draw, maxSize);
4574
+ } else {
4575
+ drawOnCanvasOrImgFromUrl(url, container, draw, maxSize);
4576
+ }
4577
+ } else {
4578
+ drawOnImgFromUrlWithCssScaling(url, container, draw, maxSize);
4579
+ }
4580
+ } else if (isCanvas(container)) {
4581
+ drawOnCanvasOrImgFromUrl(url, container, draw, maxSize);
4582
+ } else if (registerThumbnailRenderedListener(container, draw)) {
4583
+ container.src = url;
4584
+ }
4585
+ return draw;
4586
+ }
4587
+ qq.extend(this, {
4588
+ generate: function(fileBlobOrUrl, container, options) {
4589
+ if (qq.isString(fileBlobOrUrl)) {
4590
+ log("Attempting to update thumbnail based on server response.");
4591
+ return drawFromUrl(fileBlobOrUrl, container, options || {});
4592
+ } else {
4593
+ log("Attempting to draw client-side image preview.");
4594
+ return draw(fileBlobOrUrl, container, options || {});
4595
+ }
4596
+ }
4597
+ });
4598
+ this._testing = {};
4599
+ this._testing.isImg = isImg;
4600
+ this._testing.isCanvas = isCanvas;
4601
+ this._testing.isCrossOrigin = isCrossOrigin;
4602
+ this._testing.determineMimeOfFileName = determineMimeOfFileName;
4603
+ };
4604
+ qq.Exif = function(fileOrBlob, log) {
4605
+ "use strict";
4606
+ var TAG_IDS = [ 274 ], TAG_INFO = {
4607
+ 274: {
4608
+ name: "Orientation",
4609
+ bytes: 2
4610
+ }
4611
+ };
4612
+ function parseLittleEndian(hex) {
4613
+ var result = 0, pow = 0;
4614
+ while (hex.length > 0) {
4615
+ result += parseInt(hex.substring(0, 2), 16) * Math.pow(2, pow);
4616
+ hex = hex.substring(2, hex.length);
4617
+ pow += 8;
4618
+ }
4619
+ return result;
4620
+ }
4621
+ function seekToApp1(offset, promise) {
4622
+ var theOffset = offset, thePromise = promise;
4623
+ if (theOffset === undefined) {
4624
+ theOffset = 2;
4625
+ thePromise = new qq.Promise();
4626
+ }
4627
+ qq.readBlobToHex(fileOrBlob, theOffset, 4).then(function(hex) {
4628
+ var match = /^ffe([0-9])/.exec(hex), segmentLength;
4629
+ if (match) {
4630
+ if (match[1] !== "1") {
4631
+ segmentLength = parseInt(hex.slice(4, 8), 16);
4632
+ seekToApp1(theOffset + segmentLength + 2, thePromise);
4633
+ } else {
4634
+ thePromise.success(theOffset);
4635
+ }
4636
+ } else {
4637
+ thePromise.failure("No EXIF header to be found!");
4638
+ }
4639
+ });
4640
+ return thePromise;
4641
+ }
4642
+ function getApp1Offset() {
4643
+ var promise = new qq.Promise();
4644
+ qq.readBlobToHex(fileOrBlob, 0, 6).then(function(hex) {
4645
+ if (hex.indexOf("ffd8") !== 0) {
4646
+ promise.failure("Not a valid JPEG!");
4647
+ } else {
4648
+ seekToApp1().then(function(offset) {
4649
+ promise.success(offset);
4650
+ }, function(error) {
4651
+ promise.failure(error);
4652
+ });
4653
+ }
4654
+ });
4655
+ return promise;
4656
+ }
4657
+ function isLittleEndian(app1Start) {
4658
+ var promise = new qq.Promise();
4659
+ qq.readBlobToHex(fileOrBlob, app1Start + 10, 2).then(function(hex) {
4660
+ promise.success(hex === "4949");
4661
+ });
4662
+ return promise;
4663
+ }
4664
+ function getDirEntryCount(app1Start, littleEndian) {
4665
+ var promise = new qq.Promise();
4666
+ qq.readBlobToHex(fileOrBlob, app1Start + 18, 2).then(function(hex) {
4667
+ if (littleEndian) {
4668
+ return promise.success(parseLittleEndian(hex));
4669
+ } else {
4670
+ promise.success(parseInt(hex, 16));
4671
+ }
4672
+ });
4673
+ return promise;
4674
+ }
4675
+ function getIfd(app1Start, dirEntries) {
4676
+ var offset = app1Start + 20, bytes = dirEntries * 12;
4677
+ return qq.readBlobToHex(fileOrBlob, offset, bytes);
4678
+ }
4679
+ function getDirEntries(ifdHex) {
4680
+ var entries = [], offset = 0;
4681
+ while (offset + 24 <= ifdHex.length) {
4682
+ entries.push(ifdHex.slice(offset, offset + 24));
4683
+ offset += 24;
4684
+ }
4685
+ return entries;
4686
+ }
4687
+ function getTagValues(littleEndian, dirEntries) {
4688
+ var TAG_VAL_OFFSET = 16, tagsToFind = qq.extend([], TAG_IDS), vals = {};
4689
+ qq.each(dirEntries, function(idx, entry) {
4690
+ var idHex = entry.slice(0, 4), id = littleEndian ? parseLittleEndian(idHex) : parseInt(idHex, 16), tagsToFindIdx = tagsToFind.indexOf(id), tagValHex, tagName, tagValLength;
4691
+ if (tagsToFindIdx >= 0) {
4692
+ tagName = TAG_INFO[id].name;
4693
+ tagValLength = TAG_INFO[id].bytes;
4694
+ tagValHex = entry.slice(TAG_VAL_OFFSET, TAG_VAL_OFFSET + tagValLength * 2);
4695
+ vals[tagName] = littleEndian ? parseLittleEndian(tagValHex) : parseInt(tagValHex, 16);
4696
+ tagsToFind.splice(tagsToFindIdx, 1);
4697
+ }
4698
+ if (tagsToFind.length === 0) {
4699
+ return false;
4700
+ }
4701
+ });
4702
+ return vals;
4703
+ }
4704
+ qq.extend(this, {
4705
+ parse: function() {
4706
+ var parser = new qq.Promise(), onParseFailure = function(message) {
4707
+ log(qq.format("EXIF header parse failed: '{}' ", message));
4708
+ parser.failure(message);
4709
+ };
4710
+ getApp1Offset().then(function(app1Offset) {
4711
+ log(qq.format("Moving forward with EXIF header parsing for '{}'", fileOrBlob.name === undefined ? "blob" : fileOrBlob.name));
4712
+ isLittleEndian(app1Offset).then(function(littleEndian) {
4713
+ log(qq.format("EXIF Byte order is {} endian", littleEndian ? "little" : "big"));
4714
+ getDirEntryCount(app1Offset, littleEndian).then(function(dirEntryCount) {
4715
+ log(qq.format("Found {} APP1 directory entries", dirEntryCount));
4716
+ getIfd(app1Offset, dirEntryCount).then(function(ifdHex) {
4717
+ var dirEntries = getDirEntries(ifdHex), tagValues = getTagValues(littleEndian, dirEntries);
4718
+ log("Successfully parsed some EXIF tags");
4719
+ parser.success(tagValues);
4720
+ }, onParseFailure);
4721
+ }, onParseFailure);
4722
+ }, onParseFailure);
4723
+ }, onParseFailure);
4724
+ return parser;
4725
+ }
4726
+ });
4727
+ this._testing = {};
4728
+ this._testing.parseLittleEndian = parseLittleEndian;
4729
+ };
4730
+ qq.Identify = function(fileOrBlob, log) {
4731
+ "use strict";
4732
+ function isIdentifiable(magicBytes, questionableBytes) {
4733
+ var identifiable = false, magicBytesEntries = [].concat(magicBytes);
4734
+ qq.each(magicBytesEntries, function(idx, magicBytesArrayEntry) {
4735
+ if (questionableBytes.indexOf(magicBytesArrayEntry) === 0) {
4736
+ identifiable = true;
4737
+ return false;
4738
+ }
4739
+ });
4740
+ return identifiable;
4741
+ }
4742
+ qq.extend(this, {
4743
+ isPreviewable: function() {
4744
+ var self = this, identifier = new qq.Promise(), previewable = false, name = fileOrBlob.name === undefined ? "blob" : fileOrBlob.name;
4745
+ log(qq.format("Attempting to determine if {} can be rendered in this browser", name));
4746
+ log("First pass: check type attribute of blob object.");
4747
+ if (this.isPreviewableSync()) {
4748
+ log("Second pass: check for magic bytes in file header.");
4749
+ qq.readBlobToHex(fileOrBlob, 0, 4).then(function(hex) {
4750
+ qq.each(self.PREVIEWABLE_MIME_TYPES, function(mime, bytes) {
4751
+ if (isIdentifiable(bytes, hex)) {
4752
+ if (mime !== "image/tiff" || qq.supportedFeatures.tiffPreviews) {
4753
+ previewable = true;
4754
+ identifier.success(mime);
4755
+ }
4756
+ return false;
4757
+ }
4758
+ });
4759
+ log(qq.format("'{}' is {} able to be rendered in this browser", name, previewable ? "" : "NOT"));
4760
+ if (!previewable) {
4761
+ identifier.failure();
4762
+ }
4763
+ }, function() {
4764
+ log("Error reading file w/ name '" + name + "'. Not able to be rendered in this browser.");
4765
+ identifier.failure();
4766
+ });
4767
+ } else {
4768
+ identifier.failure();
4769
+ }
4770
+ return identifier;
4771
+ },
4772
+ isPreviewableSync: function() {
4773
+ var fileMime = fileOrBlob.type, isRecognizedImage = qq.indexOf(Object.keys(this.PREVIEWABLE_MIME_TYPES), fileMime) >= 0, previewable = false, name = fileOrBlob.name === undefined ? "blob" : fileOrBlob.name;
4774
+ if (isRecognizedImage) {
4775
+ if (fileMime === "image/tiff") {
4776
+ previewable = qq.supportedFeatures.tiffPreviews;
4777
+ } else {
4778
+ previewable = true;
4779
+ }
4780
+ }
4781
+ !previewable && log(name + " is not previewable in this browser per the blob's type attr");
4782
+ return previewable;
4783
+ }
4784
+ });
4785
+ };
4786
+ qq.Identify.prototype.PREVIEWABLE_MIME_TYPES = {
4787
+ "image/jpeg": "ffd8ff",
4788
+ "image/gif": "474946",
4789
+ "image/png": "89504e",
4790
+ "image/bmp": "424d",
4791
+ "image/tiff": [ "49492a00", "4d4d002a" ]
4792
+ };
4793
+ qq.ImageValidation = function(blob, log) {
4794
+ "use strict";
4795
+ function hasNonZeroLimits(limits) {
4796
+ var atLeastOne = false;
4797
+ qq.each(limits, function(limit, value) {
4798
+ if (value > 0) {
4799
+ atLeastOne = true;
4800
+ return false;
4801
+ }
4802
+ });
4803
+ return atLeastOne;
4804
+ }
4805
+ function getWidthHeight() {
4806
+ var sizeDetermination = new qq.Promise();
4807
+ new qq.Identify(blob, log).isPreviewable().then(function() {
4808
+ var image = new Image(), url = window.URL && window.URL.createObjectURL ? window.URL : window.webkitURL && window.webkitURL.createObjectURL ? window.webkitURL : null;
4809
+ if (url) {
4810
+ image.onerror = function() {
4811
+ log("Cannot determine dimensions for image. May be too large.", "error");
4812
+ sizeDetermination.failure();
4813
+ };
4814
+ image.onload = function() {
4815
+ sizeDetermination.success({
4816
+ width: this.width,
4817
+ height: this.height
4818
+ });
4819
+ };
4820
+ image.src = url.createObjectURL(blob);
4821
+ } else {
4822
+ log("No createObjectURL function available to generate image URL!", "error");
4823
+ sizeDetermination.failure();
4824
+ }
4825
+ }, sizeDetermination.failure);
4826
+ return sizeDetermination;
4827
+ }
4828
+ function getFailingLimit(limits, dimensions) {
4829
+ var failingLimit;
4830
+ qq.each(limits, function(limitName, limitValue) {
4831
+ if (limitValue > 0) {
4832
+ var limitMatcher = /(max|min)(Width|Height)/.exec(limitName), dimensionPropName = limitMatcher[2].charAt(0).toLowerCase() + limitMatcher[2].slice(1), actualValue = dimensions[dimensionPropName];
4833
+ switch (limitMatcher[1]) {
4834
+ case "min":
4835
+ if (actualValue < limitValue) {
4836
+ failingLimit = limitName;
4837
+ return false;
4838
+ }
4839
+ break;
4840
+
4841
+ case "max":
4842
+ if (actualValue > limitValue) {
4843
+ failingLimit = limitName;
4844
+ return false;
4845
+ }
4846
+ break;
4847
+ }
4848
+ }
4849
+ });
4850
+ return failingLimit;
4851
+ }
4852
+ this.validate = function(limits) {
4853
+ var validationEffort = new qq.Promise();
4854
+ log("Attempting to validate image.");
4855
+ if (hasNonZeroLimits(limits)) {
4856
+ getWidthHeight().then(function(dimensions) {
4857
+ var failingLimit = getFailingLimit(limits, dimensions);
4858
+ if (failingLimit) {
4859
+ validationEffort.failure(failingLimit);
4860
+ } else {
4861
+ validationEffort.success();
4862
+ }
4863
+ }, validationEffort.success);
4864
+ } else {
4865
+ validationEffort.success();
4866
+ }
4867
+ return validationEffort;
4868
+ };
4869
+ };
4870
+ qq.Session = function(spec) {
4871
+ "use strict";
4872
+ var options = {
4873
+ endpoint: null,
4874
+ params: {},
4875
+ customHeaders: {},
4876
+ cors: {},
4877
+ addFileRecord: function(sessionData) {},
4878
+ log: function(message, level) {}
4879
+ };
4880
+ qq.extend(options, spec, true);
4881
+ function isJsonResponseValid(response) {
4882
+ if (qq.isArray(response)) {
4883
+ return true;
4884
+ }
4885
+ options.log("Session response is not an array.", "error");
4886
+ }
4887
+ function handleFileItems(fileItems, success, xhrOrXdr, promise) {
4888
+ var someItemsIgnored = false;
4889
+ success = success && isJsonResponseValid(fileItems);
4890
+ if (success) {
4891
+ qq.each(fileItems, function(idx, fileItem) {
4892
+ if (fileItem.uuid == null) {
4893
+ someItemsIgnored = true;
4894
+ options.log(qq.format("Session response item {} did not include a valid UUID - ignoring.", idx), "error");
4895
+ } else if (fileItem.name == null) {
4896
+ someItemsIgnored = true;
4897
+ options.log(qq.format("Session response item {} did not include a valid name - ignoring.", idx), "error");
4898
+ } else {
4899
+ try {
4900
+ options.addFileRecord(fileItem);
4901
+ return true;
4902
+ } catch (err) {
4903
+ someItemsIgnored = true;
4904
+ options.log(err.message, "error");
4905
+ }
4906
+ }
4907
+ return false;
4908
+ });
4909
+ }
4910
+ promise[success && !someItemsIgnored ? "success" : "failure"](fileItems, xhrOrXdr);
4911
+ }
4912
+ this.refresh = function() {
4913
+ var refreshEffort = new qq.Promise(), refreshCompleteCallback = function(response, success, xhrOrXdr) {
4914
+ handleFileItems(response, success, xhrOrXdr, refreshEffort);
4915
+ }, requesterOptions = qq.extend({}, options), requester = new qq.SessionAjaxRequester(qq.extend(requesterOptions, {
4916
+ onComplete: refreshCompleteCallback
4917
+ }));
4918
+ requester.queryServer();
4919
+ return refreshEffort;
4920
+ };
4921
+ };
4922
+ qq.SessionAjaxRequester = function(spec) {
4923
+ "use strict";
4924
+ var requester, options = {
4925
+ endpoint: null,
4926
+ customHeaders: {},
4927
+ params: {},
4928
+ cors: {
4929
+ expected: false,
4930
+ sendCredentials: false
4931
+ },
4932
+ onComplete: function(response, success, xhrOrXdr) {},
4933
+ log: function(str, level) {}
4934
+ };
4935
+ qq.extend(options, spec);
4936
+ function onComplete(id, xhrOrXdr, isError) {
4937
+ var response = null;
4938
+ if (xhrOrXdr.responseText != null) {
4939
+ try {
4940
+ response = qq.parseJson(xhrOrXdr.responseText);
4941
+ } catch (err) {
4942
+ options.log("Problem parsing session response: " + err.message, "error");
4943
+ isError = true;
4944
+ }
4945
+ }
4946
+ options.onComplete(response, !isError, xhrOrXdr);
4947
+ }
4948
+ requester = qq.extend(this, new qq.AjaxRequester({
4949
+ acceptHeader: "application/json",
4950
+ validMethods: [ "GET" ],
4951
+ method: "GET",
4952
+ endpointStore: {
4953
+ get: function() {
4954
+ return options.endpoint;
4955
+ }
4956
+ },
4957
+ customHeaders: options.customHeaders,
4958
+ log: options.log,
4959
+ onComplete: onComplete,
4960
+ cors: options.cors
4961
+ }));
4962
+ qq.extend(this, {
4963
+ queryServer: function() {
4964
+ var params = qq.extend({}, options.params);
4965
+ options.log("Session query request.");
4966
+ requester.initTransport("sessionRefresh").withParams(params).withCacheBuster().send();
4967
+ }
4968
+ });
4969
+ };
4970
+ qq.Scaler = function(spec, log) {
4971
+ "use strict";
4972
+ var self = this, customResizeFunction = spec.customResizer, includeOriginal = spec.sendOriginal, orient = spec.orient, defaultType = spec.defaultType, defaultQuality = spec.defaultQuality / 100, failedToScaleText = spec.failureText, includeExif = spec.includeExif, sizes = this._getSortedSizes(spec.sizes);
4973
+ qq.extend(this, {
4974
+ enabled: qq.supportedFeatures.scaling && sizes.length > 0,
4975
+ getFileRecords: function(originalFileUuid, originalFileName, originalBlobOrBlobData) {
4976
+ var self = this, records = [], originalBlob = originalBlobOrBlobData.blob ? originalBlobOrBlobData.blob : originalBlobOrBlobData, identifier = new qq.Identify(originalBlob, log);
4977
+ if (identifier.isPreviewableSync()) {
4978
+ qq.each(sizes, function(idx, sizeRecord) {
4979
+ var outputType = self._determineOutputType({
4980
+ defaultType: defaultType,
4981
+ requestedType: sizeRecord.type,
4982
+ refType: originalBlob.type
4983
+ });
4984
+ records.push({
4985
+ uuid: qq.getUniqueId(),
4986
+ name: self._getName(originalFileName, {
4987
+ name: sizeRecord.name,
4988
+ type: outputType,
4989
+ refType: originalBlob.type
4990
+ }),
4991
+ blob: new qq.BlobProxy(originalBlob, qq.bind(self._generateScaledImage, self, {
4992
+ customResizeFunction: customResizeFunction,
4993
+ maxSize: sizeRecord.maxSize,
4994
+ orient: orient,
4995
+ type: outputType,
4996
+ quality: defaultQuality,
4997
+ failedText: failedToScaleText,
4998
+ includeExif: includeExif,
4999
+ log: log
5000
+ }))
5001
+ });
5002
+ });
5003
+ records.push({
5004
+ uuid: originalFileUuid,
5005
+ name: originalFileName,
5006
+ size: originalBlob.size,
5007
+ blob: includeOriginal ? originalBlob : null
5008
+ });
5009
+ } else {
5010
+ records.push({
5011
+ uuid: originalFileUuid,
5012
+ name: originalFileName,
5013
+ size: originalBlob.size,
5014
+ blob: originalBlob
5015
+ });
5016
+ }
5017
+ return records;
5018
+ },
5019
+ handleNewFile: function(file, name, uuid, size, fileList, batchId, uuidParamName, api) {
5020
+ var self = this, buttonId = file.qqButtonId || file.blob && file.blob.qqButtonId, scaledIds = [], originalId = null, addFileToHandler = api.addFileToHandler, uploadData = api.uploadData, paramsStore = api.paramsStore, proxyGroupId = qq.getUniqueId();
5021
+ qq.each(self.getFileRecords(uuid, name, file), function(idx, record) {
5022
+ var blobSize = record.size, id;
5023
+ if (record.blob instanceof qq.BlobProxy) {
5024
+ blobSize = -1;
5025
+ }
5026
+ id = uploadData.addFile({
5027
+ uuid: record.uuid,
5028
+ name: record.name,
5029
+ size: blobSize,
5030
+ batchId: batchId,
5031
+ proxyGroupId: proxyGroupId
5032
+ });
5033
+ if (record.blob instanceof qq.BlobProxy) {
5034
+ scaledIds.push(id);
5035
+ } else {
5036
+ originalId = id;
5037
+ }
5038
+ if (record.blob) {
5039
+ addFileToHandler(id, record.blob);
5040
+ fileList.push({
5041
+ id: id,
5042
+ file: record.blob
5043
+ });
5044
+ } else {
5045
+ uploadData.setStatus(id, qq.status.REJECTED);
5046
+ }
5047
+ });
5048
+ if (originalId !== null) {
5049
+ qq.each(scaledIds, function(idx, scaledId) {
5050
+ var params = {
5051
+ qqparentuuid: uploadData.retrieve({
5052
+ id: originalId
5053
+ }).uuid,
5054
+ qqparentsize: uploadData.retrieve({
5055
+ id: originalId
5056
+ }).size
5057
+ };
5058
+ params[uuidParamName] = uploadData.retrieve({
5059
+ id: scaledId
5060
+ }).uuid;
5061
+ uploadData.setParentId(scaledId, originalId);
5062
+ paramsStore.addReadOnly(scaledId, params);
5063
+ });
5064
+ if (scaledIds.length) {
5065
+ (function() {
5066
+ var param = {};
5067
+ param[uuidParamName] = uploadData.retrieve({
5068
+ id: originalId
5069
+ }).uuid;
5070
+ paramsStore.addReadOnly(originalId, param);
5071
+ })();
5072
+ }
5073
+ }
5074
+ }
5075
+ });
5076
+ };
5077
+ qq.extend(qq.Scaler.prototype, {
5078
+ scaleImage: function(id, specs, api) {
5079
+ "use strict";
5080
+ if (!qq.supportedFeatures.scaling) {
5081
+ throw new qq.Error("Scaling is not supported in this browser!");
5082
+ }
5083
+ var scalingEffort = new qq.Promise(), log = api.log, file = api.getFile(id), uploadData = api.uploadData.retrieve({
5084
+ id: id
5085
+ }), name = uploadData && uploadData.name, uuid = uploadData && uploadData.uuid, scalingOptions = {
5086
+ customResizer: specs.customResizer,
5087
+ sendOriginal: false,
5088
+ orient: specs.orient,
5089
+ defaultType: specs.type || null,
5090
+ defaultQuality: specs.quality,
5091
+ failedToScaleText: "Unable to scale",
5092
+ sizes: [ {
5093
+ name: "",
5094
+ maxSize: specs.maxSize
5095
+ } ]
5096
+ }, scaler = new qq.Scaler(scalingOptions, log);
5097
+ if (!qq.Scaler || !qq.supportedFeatures.imagePreviews || !file) {
5098
+ scalingEffort.failure();
5099
+ log("Could not generate requested scaled image for " + id + ". " + "Scaling is either not possible in this browser, or the file could not be located.", "error");
5100
+ } else {
5101
+ qq.bind(function() {
5102
+ var record = scaler.getFileRecords(uuid, name, file)[0];
5103
+ if (record && record.blob instanceof qq.BlobProxy) {
5104
+ record.blob.create().then(scalingEffort.success, scalingEffort.failure);
5105
+ } else {
5106
+ log(id + " is not a scalable image!", "error");
5107
+ scalingEffort.failure();
5108
+ }
5109
+ }, this)();
5110
+ }
5111
+ return scalingEffort;
5112
+ },
5113
+ _determineOutputType: function(spec) {
5114
+ "use strict";
5115
+ var requestedType = spec.requestedType, defaultType = spec.defaultType, referenceType = spec.refType;
5116
+ if (!defaultType && !requestedType) {
5117
+ if (referenceType !== "image/jpeg") {
5118
+ return "image/png";
5119
+ }
5120
+ return referenceType;
5121
+ }
5122
+ if (!requestedType) {
5123
+ return defaultType;
5124
+ }
5125
+ if (qq.indexOf(Object.keys(qq.Identify.prototype.PREVIEWABLE_MIME_TYPES), requestedType) >= 0) {
5126
+ if (requestedType === "image/tiff") {
5127
+ return qq.supportedFeatures.tiffPreviews ? requestedType : defaultType;
5128
+ }
5129
+ return requestedType;
5130
+ }
5131
+ return defaultType;
5132
+ },
5133
+ _getName: function(originalName, scaledVersionProperties) {
5134
+ "use strict";
5135
+ var startOfExt = originalName.lastIndexOf("."), versionType = scaledVersionProperties.type || "image/png", referenceType = scaledVersionProperties.refType, scaledName = "", scaledExt = qq.getExtension(originalName), nameAppendage = "";
5136
+ if (scaledVersionProperties.name && scaledVersionProperties.name.trim().length) {
5137
+ nameAppendage = " (" + scaledVersionProperties.name + ")";
5138
+ }
5139
+ if (startOfExt >= 0) {
5140
+ scaledName = originalName.substr(0, startOfExt);
5141
+ if (referenceType !== versionType) {
5142
+ scaledExt = versionType.split("/")[1];
5143
+ }
5144
+ scaledName += nameAppendage + "." + scaledExt;
5145
+ } else {
5146
+ scaledName = originalName + nameAppendage;
5147
+ }
5148
+ return scaledName;
5149
+ },
5150
+ _getSortedSizes: function(sizes) {
5151
+ "use strict";
5152
+ sizes = qq.extend([], sizes);
5153
+ return sizes.sort(function(a, b) {
5154
+ if (a.maxSize > b.maxSize) {
5155
+ return 1;
5156
+ }
5157
+ if (a.maxSize < b.maxSize) {
5158
+ return -1;
5159
+ }
5160
+ return 0;
5161
+ });
5162
+ },
5163
+ _generateScaledImage: function(spec, sourceFile) {
5164
+ "use strict";
5165
+ var self = this, customResizeFunction = spec.customResizeFunction, log = spec.log, maxSize = spec.maxSize, orient = spec.orient, type = spec.type, quality = spec.quality, failedText = spec.failedText, includeExif = spec.includeExif && sourceFile.type === "image/jpeg" && type === "image/jpeg", scalingEffort = new qq.Promise(), imageGenerator = new qq.ImageGenerator(log), canvas = document.createElement("canvas");
5166
+ log("Attempting to generate scaled version for " + sourceFile.name);
5167
+ imageGenerator.generate(sourceFile, canvas, {
5168
+ maxSize: maxSize,
5169
+ orient: orient,
5170
+ customResizeFunction: customResizeFunction
5171
+ }).then(function() {
5172
+ var scaledImageDataUri = canvas.toDataURL(type, quality), signalSuccess = function() {
5173
+ log("Success generating scaled version for " + sourceFile.name);
5174
+ var blob = qq.dataUriToBlob(scaledImageDataUri);
5175
+ scalingEffort.success(blob);
5176
+ };
5177
+ if (includeExif) {
5178
+ self._insertExifHeader(sourceFile, scaledImageDataUri, log).then(function(scaledImageDataUriWithExif) {
5179
+ scaledImageDataUri = scaledImageDataUriWithExif;
5180
+ signalSuccess();
5181
+ }, function() {
5182
+ log("Problem inserting EXIF header into scaled image. Using scaled image w/out EXIF data.", "error");
5183
+ signalSuccess();
5184
+ });
5185
+ } else {
5186
+ signalSuccess();
5187
+ }
5188
+ }, function() {
5189
+ log("Failed attempt to generate scaled version for " + sourceFile.name, "error");
5190
+ scalingEffort.failure(failedText);
5191
+ });
5192
+ return scalingEffort;
5193
+ },
5194
+ _insertExifHeader: function(originalImage, scaledImageDataUri, log) {
5195
+ "use strict";
5196
+ var reader = new FileReader(), insertionEffort = new qq.Promise(), originalImageDataUri = "";
5197
+ reader.onload = function() {
5198
+ originalImageDataUri = reader.result;
5199
+ insertionEffort.success(qq.ExifRestorer.restore(originalImageDataUri, scaledImageDataUri));
5200
+ };
5201
+ reader.onerror = function() {
5202
+ log("Problem reading " + originalImage.name + " during attempt to transfer EXIF data to scaled version.", "error");
5203
+ insertionEffort.failure();
5204
+ };
5205
+ reader.readAsDataURL(originalImage);
5206
+ return insertionEffort;
5207
+ },
5208
+ _dataUriToBlob: function(dataUri) {
5209
+ "use strict";
5210
+ var byteString, mimeString, arrayBuffer, intArray;
5211
+ if (dataUri.split(",")[0].indexOf("base64") >= 0) {
5212
+ byteString = atob(dataUri.split(",")[1]);
5213
+ } else {
5214
+ byteString = decodeURI(dataUri.split(",")[1]);
5215
+ }
5216
+ mimeString = dataUri.split(",")[0].split(":")[1].split(";")[0];
5217
+ arrayBuffer = new ArrayBuffer(byteString.length);
5218
+ intArray = new Uint8Array(arrayBuffer);
5219
+ qq.each(byteString, function(idx, character) {
5220
+ intArray[idx] = character.charCodeAt(0);
5221
+ });
5222
+ return this._createBlob(arrayBuffer, mimeString);
5223
+ },
5224
+ _createBlob: function(data, mime) {
5225
+ "use strict";
5226
+ var BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder, blobBuilder = BlobBuilder && new BlobBuilder();
5227
+ if (blobBuilder) {
5228
+ blobBuilder.append(data);
5229
+ return blobBuilder.getBlob(mime);
5230
+ } else {
5231
+ return new Blob([ data ], {
5232
+ type: mime
5233
+ });
5234
+ }
5235
+ }
5236
+ });
5237
+ qq.ExifRestorer = function() {
5238
+ var ExifRestorer = {};
5239
+ ExifRestorer.KEY_STR = "ABCDEFGHIJKLMNOP" + "QRSTUVWXYZabcdef" + "ghijklmnopqrstuv" + "wxyz0123456789+/" + "=";
5240
+ ExifRestorer.encode64 = function(input) {
5241
+ var output = "", chr1, chr2, chr3 = "", enc1, enc2, enc3, enc4 = "", i = 0;
5242
+ do {
5243
+ chr1 = input[i++];
5244
+ chr2 = input[i++];
5245
+ chr3 = input[i++];
5246
+ enc1 = chr1 >> 2;
5247
+ enc2 = (chr1 & 3) << 4 | chr2 >> 4;
5248
+ enc3 = (chr2 & 15) << 2 | chr3 >> 6;
5249
+ enc4 = chr3 & 63;
5250
+ if (isNaN(chr2)) {
5251
+ enc3 = enc4 = 64;
5252
+ } else if (isNaN(chr3)) {
5253
+ enc4 = 64;
5254
+ }
5255
+ output = output + this.KEY_STR.charAt(enc1) + this.KEY_STR.charAt(enc2) + this.KEY_STR.charAt(enc3) + this.KEY_STR.charAt(enc4);
5256
+ chr1 = chr2 = chr3 = "";
5257
+ enc1 = enc2 = enc3 = enc4 = "";
5258
+ } while (i < input.length);
5259
+ return output;
5260
+ };
5261
+ ExifRestorer.restore = function(origFileBase64, resizedFileBase64) {
5262
+ var expectedBase64Header = "data:image/jpeg;base64,";
5263
+ if (!origFileBase64.match(expectedBase64Header)) {
5264
+ return resizedFileBase64;
5265
+ }
5266
+ var rawImage = this.decode64(origFileBase64.replace(expectedBase64Header, ""));
5267
+ var segments = this.slice2Segments(rawImage);
5268
+ var image = this.exifManipulation(resizedFileBase64, segments);
5269
+ return expectedBase64Header + this.encode64(image);
5270
+ };
5271
+ ExifRestorer.exifManipulation = function(resizedFileBase64, segments) {
5272
+ var exifArray = this.getExifArray(segments), newImageArray = this.insertExif(resizedFileBase64, exifArray), aBuffer = new Uint8Array(newImageArray);
5273
+ return aBuffer;
5274
+ };
5275
+ ExifRestorer.getExifArray = function(segments) {
5276
+ var seg;
5277
+ for (var x = 0; x < segments.length; x++) {
5278
+ seg = segments[x];
5279
+ if (seg[0] == 255 & seg[1] == 225) {
5280
+ return seg;
5281
+ }
5282
+ }
5283
+ return [];
5284
+ };
5285
+ ExifRestorer.insertExif = function(resizedFileBase64, exifArray) {
5286
+ var imageData = resizedFileBase64.replace("data:image/jpeg;base64,", ""), buf = this.decode64(imageData), separatePoint = buf.indexOf(255, 3), mae = buf.slice(0, separatePoint), ato = buf.slice(separatePoint), array = mae;
5287
+ array = array.concat(exifArray);
5288
+ array = array.concat(ato);
5289
+ return array;
5290
+ };
5291
+ ExifRestorer.slice2Segments = function(rawImageArray) {
5292
+ var head = 0, segments = [];
5293
+ while (1) {
5294
+ if (rawImageArray[head] == 255 & rawImageArray[head + 1] == 218) {
5295
+ break;
5296
+ }
5297
+ if (rawImageArray[head] == 255 & rawImageArray[head + 1] == 216) {
5298
+ head += 2;
5299
+ } else {
5300
+ var length = rawImageArray[head + 2] * 256 + rawImageArray[head + 3], endPoint = head + length + 2, seg = rawImageArray.slice(head, endPoint);
5301
+ segments.push(seg);
5302
+ head = endPoint;
5303
+ }
5304
+ if (head > rawImageArray.length) {
5305
+ break;
5306
+ }
5307
+ }
5308
+ return segments;
5309
+ };
5310
+ ExifRestorer.decode64 = function(input) {
5311
+ var output = "", chr1, chr2, chr3 = "", enc1, enc2, enc3, enc4 = "", i = 0, buf = [];
5312
+ var base64test = /[^A-Za-z0-9\+\/\=]/g;
5313
+ if (base64test.exec(input)) {
5314
+ throw new Error("There were invalid base64 characters in the input text. " + "Valid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='");
5315
+ }
5316
+ input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
5317
+ do {
5318
+ enc1 = this.KEY_STR.indexOf(input.charAt(i++));
5319
+ enc2 = this.KEY_STR.indexOf(input.charAt(i++));
5320
+ enc3 = this.KEY_STR.indexOf(input.charAt(i++));
5321
+ enc4 = this.KEY_STR.indexOf(input.charAt(i++));
5322
+ chr1 = enc1 << 2 | enc2 >> 4;
5323
+ chr2 = (enc2 & 15) << 4 | enc3 >> 2;
5324
+ chr3 = (enc3 & 3) << 6 | enc4;
5325
+ buf.push(chr1);
5326
+ if (enc3 != 64) {
5327
+ buf.push(chr2);
5328
+ }
5329
+ if (enc4 != 64) {
5330
+ buf.push(chr3);
5331
+ }
5332
+ chr1 = chr2 = chr3 = "";
5333
+ enc1 = enc2 = enc3 = enc4 = "";
5334
+ } while (i < input.length);
5335
+ return buf;
5336
+ };
5337
+ return ExifRestorer;
5338
+ }();
5339
+ qq.TotalProgress = function(callback, getSize) {
5340
+ "use strict";
5341
+ var perFileProgress = {}, totalLoaded = 0, totalSize = 0, lastLoadedSent = -1, lastTotalSent = -1, callbackProxy = function(loaded, total) {
5342
+ if (loaded !== lastLoadedSent || total !== lastTotalSent) {
5343
+ callback(loaded, total);
5344
+ }
5345
+ lastLoadedSent = loaded;
5346
+ lastTotalSent = total;
5347
+ }, noRetryableFiles = function(failed, retryable) {
5348
+ var none = true;
5349
+ qq.each(failed, function(idx, failedId) {
5350
+ if (qq.indexOf(retryable, failedId) >= 0) {
5351
+ none = false;
5352
+ return false;
5353
+ }
5354
+ });
5355
+ return none;
5356
+ }, onCancel = function(id) {
5357
+ updateTotalProgress(id, -1, -1);
5358
+ delete perFileProgress[id];
5359
+ }, onAllComplete = function(successful, failed, retryable) {
5360
+ if (failed.length === 0 || noRetryableFiles(failed, retryable)) {
5361
+ callbackProxy(totalSize, totalSize);
5362
+ this.reset();
5363
+ }
5364
+ }, onNew = function(id) {
5365
+ var size = getSize(id);
5366
+ if (size > 0) {
5367
+ updateTotalProgress(id, 0, size);
5368
+ perFileProgress[id] = {
5369
+ loaded: 0,
5370
+ total: size
5371
+ };
5372
+ }
5373
+ }, updateTotalProgress = function(id, newLoaded, newTotal) {
5374
+ var oldLoaded = perFileProgress[id] ? perFileProgress[id].loaded : 0, oldTotal = perFileProgress[id] ? perFileProgress[id].total : 0;
5375
+ if (newLoaded === -1 && newTotal === -1) {
5376
+ totalLoaded -= oldLoaded;
5377
+ totalSize -= oldTotal;
5378
+ } else {
5379
+ if (newLoaded) {
5380
+ totalLoaded += newLoaded - oldLoaded;
5381
+ }
5382
+ if (newTotal) {
5383
+ totalSize += newTotal - oldTotal;
5384
+ }
5385
+ }
5386
+ callbackProxy(totalLoaded, totalSize);
5387
+ };
5388
+ qq.extend(this, {
5389
+ onAllComplete: onAllComplete,
5390
+ onStatusChange: function(id, oldStatus, newStatus) {
5391
+ if (newStatus === qq.status.CANCELED || newStatus === qq.status.REJECTED) {
5392
+ onCancel(id);
5393
+ } else if (newStatus === qq.status.SUBMITTING) {
5394
+ onNew(id);
5395
+ }
5396
+ },
5397
+ onIndividualProgress: function(id, loaded, total) {
5398
+ updateTotalProgress(id, loaded, total);
5399
+ perFileProgress[id] = {
5400
+ loaded: loaded,
5401
+ total: total
5402
+ };
5403
+ },
5404
+ onNewSize: function(id) {
5405
+ onNew(id);
5406
+ },
5407
+ reset: function() {
5408
+ perFileProgress = {};
5409
+ totalLoaded = 0;
5410
+ totalSize = 0;
5411
+ }
5412
+ });
5413
+ };
5414
+ qq.PasteSupport = function(o) {
5415
+ "use strict";
5416
+ var options, detachPasteHandler;
5417
+ options = {
5418
+ targetElement: null,
5419
+ callbacks: {
5420
+ log: function(message, level) {},
5421
+ pasteReceived: function(blob) {}
5422
+ }
5423
+ };
5424
+ function isImage(item) {
5425
+ return item.type && item.type.indexOf("image/") === 0;
5426
+ }
5427
+ function registerPasteHandler() {
5428
+ detachPasteHandler = qq(options.targetElement).attach("paste", function(event) {
5429
+ var clipboardData = event.clipboardData;
5430
+ if (clipboardData) {
5431
+ qq.each(clipboardData.items, function(idx, item) {
5432
+ if (isImage(item)) {
5433
+ var blob = item.getAsFile();
5434
+ options.callbacks.pasteReceived(blob);
5435
+ }
5436
+ });
5437
+ }
5438
+ });
5439
+ }
5440
+ function unregisterPasteHandler() {
5441
+ if (detachPasteHandler) {
5442
+ detachPasteHandler();
5443
+ }
5444
+ }
5445
+ qq.extend(options, o);
5446
+ registerPasteHandler();
5447
+ qq.extend(this, {
5448
+ reset: function() {
5449
+ unregisterPasteHandler();
5450
+ }
5451
+ });
5452
+ };
5453
+ qq.FormSupport = function(options, startUpload, log) {
5454
+ "use strict";
5455
+ var self = this, interceptSubmit = options.interceptSubmit, formEl = options.element, autoUpload = options.autoUpload;
5456
+ qq.extend(this, {
5457
+ newEndpoint: null,
5458
+ newAutoUpload: autoUpload,
5459
+ attachedToForm: false,
5460
+ getFormInputsAsObject: function() {
5461
+ if (formEl == null) {
5462
+ return null;
5463
+ }
5464
+ return self._form2Obj(formEl);
5465
+ }
5466
+ });
5467
+ function determineNewEndpoint(formEl) {
5468
+ if (formEl.getAttribute("action")) {
5469
+ self.newEndpoint = formEl.getAttribute("action");
5470
+ }
5471
+ }
5472
+ function validateForm(formEl, nativeSubmit) {
5473
+ if (formEl.checkValidity && !formEl.checkValidity()) {
5474
+ log("Form did not pass validation checks - will not upload.", "error");
5475
+ nativeSubmit();
5476
+ } else {
5477
+ return true;
5478
+ }
5479
+ }
5480
+ function maybeUploadOnSubmit(formEl) {
5481
+ var nativeSubmit = formEl.submit;
5482
+ qq(formEl).attach("submit", function(event) {
5483
+ event = event || window.event;
5484
+ if (event.preventDefault) {
5485
+ event.preventDefault();
5486
+ } else {
5487
+ event.returnValue = false;
5488
+ }
5489
+ validateForm(formEl, nativeSubmit) && startUpload();
5490
+ });
5491
+ formEl.submit = function() {
5492
+ validateForm(formEl, nativeSubmit) && startUpload();
5493
+ };
5494
+ }
5495
+ function determineFormEl(formEl) {
5496
+ if (formEl) {
5497
+ if (qq.isString(formEl)) {
5498
+ formEl = document.getElementById(formEl);
5499
+ }
5500
+ if (formEl) {
5501
+ log("Attaching to form element.");
5502
+ determineNewEndpoint(formEl);
5503
+ interceptSubmit && maybeUploadOnSubmit(formEl);
5504
+ }
5505
+ }
5506
+ return formEl;
5507
+ }
5508
+ formEl = determineFormEl(formEl);
5509
+ this.attachedToForm = !!formEl;
5510
+ };
5511
+ qq.extend(qq.FormSupport.prototype, {
5512
+ _form2Obj: function(form) {
5513
+ "use strict";
5514
+ var obj = {}, notIrrelevantType = function(type) {
5515
+ var irrelevantTypes = [ "button", "image", "reset", "submit" ];
5516
+ return qq.indexOf(irrelevantTypes, type.toLowerCase()) < 0;
5517
+ }, radioOrCheckbox = function(type) {
5518
+ return qq.indexOf([ "checkbox", "radio" ], type.toLowerCase()) >= 0;
5519
+ }, ignoreValue = function(el) {
5520
+ if (radioOrCheckbox(el.type) && !el.checked) {
5521
+ return true;
5522
+ }
5523
+ return el.disabled && el.type.toLowerCase() !== "hidden";
5524
+ }, selectValue = function(select) {
5525
+ var value = null;
5526
+ qq.each(qq(select).children(), function(idx, child) {
5527
+ if (child.tagName.toLowerCase() === "option" && child.selected) {
5528
+ value = child.value;
5529
+ return false;
5530
+ }
5531
+ });
5532
+ return value;
5533
+ };
5534
+ qq.each(form.elements, function(idx, el) {
5535
+ if ((qq.isInput(el, true) || el.tagName.toLowerCase() === "textarea") && notIrrelevantType(el.type) && !ignoreValue(el)) {
5536
+ obj[el.name] = el.value;
5537
+ } else if (el.tagName.toLowerCase() === "select" && !ignoreValue(el)) {
5538
+ var value = selectValue(el);
5539
+ if (value !== null) {
5540
+ obj[el.name] = value;
5541
+ }
5542
+ }
5543
+ });
5544
+ return obj;
5545
+ }
5546
+ });
5547
+ qq.traditional = qq.traditional || {};
5548
+ qq.traditional.FormUploadHandler = function(options, proxy) {
5549
+ "use strict";
5550
+ var handler = this, getName = proxy.getName, getUuid = proxy.getUuid, log = proxy.log;
5551
+ function getIframeContentJson(id, iframe) {
5552
+ var response, doc, innerHtml;
5553
+ try {
5554
+ doc = iframe.contentDocument || iframe.contentWindow.document;
5555
+ innerHtml = doc.body.innerHTML;
5556
+ log("converting iframe's innerHTML to JSON");
5557
+ log("innerHTML = " + innerHtml);
5558
+ if (innerHtml && innerHtml.match(/^<pre/i)) {
5559
+ innerHtml = doc.body.firstChild.firstChild.nodeValue;
5560
+ }
5561
+ response = handler._parseJsonResponse(innerHtml);
5562
+ } catch (error) {
5563
+ log("Error when attempting to parse form upload response (" + error.message + ")", "error");
5564
+ response = {
5565
+ success: false
5566
+ };
5567
+ }
5568
+ return response;
5569
+ }
5570
+ function createForm(id, iframe) {
5571
+ var params = options.paramsStore.get(id), method = options.method.toLowerCase() === "get" ? "GET" : "POST", endpoint = options.endpointStore.get(id), name = getName(id);
5572
+ params[options.uuidName] = getUuid(id);
5573
+ params[options.filenameParam] = name;
5574
+ return handler._initFormForUpload({
5575
+ method: method,
5576
+ endpoint: endpoint,
5577
+ params: params,
5578
+ paramsInBody: options.paramsInBody,
5579
+ targetName: iframe.name
5580
+ });
5581
+ }
5582
+ this.uploadFile = function(id) {
5583
+ var input = handler.getInput(id), iframe = handler._createIframe(id), promise = new qq.Promise(), form;
5584
+ form = createForm(id, iframe);
5585
+ form.appendChild(input);
5586
+ handler._attachLoadEvent(iframe, function(responseFromMessage) {
5587
+ log("iframe loaded");
5588
+ var response = responseFromMessage ? responseFromMessage : getIframeContentJson(id, iframe);
5589
+ handler._detachLoadEvent(id);
5590
+ if (!options.cors.expected) {
5591
+ qq(iframe).remove();
5592
+ }
5593
+ if (response.success) {
5594
+ promise.success(response);
5595
+ } else {
5596
+ promise.failure(response);
5597
+ }
5598
+ });
5599
+ log("Sending upload request for " + id);
5600
+ form.submit();
5601
+ qq(form).remove();
5602
+ return promise;
5603
+ };
5604
+ qq.extend(this, new qq.FormUploadHandler({
5605
+ options: {
5606
+ isCors: options.cors.expected,
5607
+ inputName: options.inputName
5608
+ },
5609
+ proxy: {
5610
+ onCancel: options.onCancel,
5611
+ getName: getName,
5612
+ getUuid: getUuid,
5613
+ log: log
5614
+ }
5615
+ }));
5616
+ };
5617
+ qq.traditional = qq.traditional || {};
5618
+ qq.traditional.XhrUploadHandler = function(spec, proxy) {
5619
+ "use strict";
5620
+ var handler = this, getName = proxy.getName, getSize = proxy.getSize, getUuid = proxy.getUuid, log = proxy.log, multipart = spec.forceMultipart || spec.paramsInBody, addChunkingSpecificParams = function(id, params, chunkData) {
5621
+ var size = getSize(id), name = getName(id);
5622
+ params[spec.chunking.paramNames.partIndex] = chunkData.part;
5623
+ params[spec.chunking.paramNames.partByteOffset] = chunkData.start;
5624
+ params[spec.chunking.paramNames.chunkSize] = chunkData.size;
5625
+ params[spec.chunking.paramNames.totalParts] = chunkData.count;
5626
+ params[spec.totalFileSizeName] = size;
5627
+ if (multipart) {
5628
+ params[spec.filenameParam] = name;
5629
+ }
5630
+ }, allChunksDoneRequester = new qq.traditional.AllChunksDoneAjaxRequester({
5631
+ cors: spec.cors,
5632
+ endpoint: spec.chunking.success.endpoint,
5633
+ log: log
5634
+ }), createReadyStateChangedHandler = function(id, xhr) {
5635
+ var promise = new qq.Promise();
5636
+ xhr.onreadystatechange = function() {
5637
+ if (xhr.readyState === 4) {
5638
+ var result = onUploadOrChunkComplete(id, xhr);
5639
+ if (result.success) {
5640
+ promise.success(result.response, xhr);
5641
+ } else {
5642
+ promise.failure(result.response, xhr);
5643
+ }
5644
+ }
5645
+ };
5646
+ return promise;
5647
+ }, getChunksCompleteParams = function(id) {
5648
+ var params = spec.paramsStore.get(id), name = getName(id), size = getSize(id);
5649
+ params[spec.uuidName] = getUuid(id);
5650
+ params[spec.filenameParam] = name;
5651
+ params[spec.totalFileSizeName] = size;
5652
+ params[spec.chunking.paramNames.totalParts] = handler._getTotalChunks(id);
5653
+ return params;
5654
+ }, isErrorUploadResponse = function(xhr, response) {
5655
+ return qq.indexOf([ 200, 201, 202, 203, 204 ], xhr.status) < 0 || !response.success || response.reset;
5656
+ }, onUploadOrChunkComplete = function(id, xhr) {
5657
+ var response;
5658
+ log("xhr - server response received for " + id);
5659
+ log("responseText = " + xhr.responseText);
5660
+ response = parseResponse(true, xhr);
5661
+ return {
5662
+ success: !isErrorUploadResponse(xhr, response),
5663
+ response: response
5664
+ };
5665
+ }, parseResponse = function(upload, xhr) {
5666
+ var response = {};
5667
+ try {
5668
+ log(qq.format("Received response status {} with body: {}", xhr.status, xhr.responseText));
5669
+ response = qq.parseJson(xhr.responseText);
5670
+ } catch (error) {
5671
+ upload && log("Error when attempting to parse xhr response text (" + error.message + ")", "error");
5672
+ }
5673
+ return response;
5674
+ }, sendChunksCompleteRequest = function(id) {
5675
+ var promise = new qq.Promise();
5676
+ allChunksDoneRequester.complete(id, handler._createXhr(id), getChunksCompleteParams(id), spec.customHeaders.get(id)).then(function(xhr) {
5677
+ promise.success(parseResponse(false, xhr), xhr);
5678
+ }, function(xhr) {
5679
+ promise.failure(parseResponse(false, xhr), xhr);
5680
+ });
5681
+ return promise;
5682
+ }, setParamsAndGetEntityToSend = function(params, xhr, fileOrBlob, id) {
5683
+ var formData = new FormData(), method = spec.method, endpoint = spec.endpointStore.get(id), name = getName(id), size = getSize(id);
5684
+ params[spec.uuidName] = getUuid(id);
5685
+ params[spec.filenameParam] = name;
5686
+ if (multipart) {
5687
+ params[spec.totalFileSizeName] = size;
5688
+ }
5689
+ if (!spec.paramsInBody) {
5690
+ if (!multipart) {
5691
+ params[spec.inputName] = name;
5692
+ }
5693
+ endpoint = qq.obj2url(params, endpoint);
5694
+ }
5695
+ xhr.open(method, endpoint, true);
5696
+ if (spec.cors.expected && spec.cors.sendCredentials) {
5697
+ xhr.withCredentials = true;
5698
+ }
5699
+ if (multipart) {
5700
+ if (spec.paramsInBody) {
5701
+ qq.obj2FormData(params, formData);
5702
+ }
5703
+ formData.append(spec.inputName, fileOrBlob);
5704
+ return formData;
5705
+ }
5706
+ return fileOrBlob;
5707
+ }, setUploadHeaders = function(id, xhr) {
5708
+ var extraHeaders = spec.customHeaders.get(id), fileOrBlob = handler.getFile(id);
5709
+ xhr.setRequestHeader("Accept", "application/json");
5710
+ xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
5711
+ xhr.setRequestHeader("Cache-Control", "no-cache");
5712
+ if (!multipart) {
5713
+ xhr.setRequestHeader("Content-Type", "application/octet-stream");
5714
+ xhr.setRequestHeader("X-Mime-Type", fileOrBlob.type);
5715
+ }
5716
+ qq.each(extraHeaders, function(name, val) {
5717
+ xhr.setRequestHeader(name, val);
5718
+ });
5719
+ };
5720
+ qq.extend(this, {
5721
+ uploadChunk: function(id, chunkIdx, resuming) {
5722
+ var chunkData = handler._getChunkData(id, chunkIdx), xhr = handler._createXhr(id, chunkIdx), size = getSize(id), promise, toSend, params;
5723
+ promise = createReadyStateChangedHandler(id, xhr);
5724
+ handler._registerProgressHandler(id, chunkIdx, chunkData.size);
5725
+ params = spec.paramsStore.get(id);
5726
+ addChunkingSpecificParams(id, params, chunkData);
5727
+ if (resuming) {
5728
+ params[spec.resume.paramNames.resuming] = true;
5729
+ }
5730
+ toSend = setParamsAndGetEntityToSend(params, xhr, chunkData.blob, id);
5731
+ setUploadHeaders(id, xhr);
5732
+ xhr.send(toSend);
5733
+ return promise;
5734
+ },
5735
+ uploadFile: function(id) {
5736
+ var fileOrBlob = handler.getFile(id), promise, xhr, params, toSend;
5737
+ xhr = handler._createXhr(id);
5738
+ handler._registerProgressHandler(id);
5739
+ promise = createReadyStateChangedHandler(id, xhr);
5740
+ params = spec.paramsStore.get(id);
5741
+ toSend = setParamsAndGetEntityToSend(params, xhr, fileOrBlob, id);
5742
+ setUploadHeaders(id, xhr);
5743
+ xhr.send(toSend);
5744
+ return promise;
5745
+ }
5746
+ });
5747
+ qq.extend(this, new qq.XhrUploadHandler({
5748
+ options: qq.extend({
5749
+ namespace: "traditional"
5750
+ }, spec),
5751
+ proxy: qq.extend({
5752
+ getEndpoint: spec.endpointStore.get
5753
+ }, proxy)
5754
+ }));
5755
+ qq.override(this, function(super_) {
5756
+ return {
5757
+ finalizeChunks: function(id) {
5758
+ if (spec.chunking.success.endpoint) {
5759
+ return sendChunksCompleteRequest(id);
5760
+ } else {
5761
+ return super_.finalizeChunks(id, qq.bind(parseResponse, this, true));
5762
+ }
5763
+ }
5764
+ };
5765
+ });
5766
+ };
5767
+ qq.traditional.AllChunksDoneAjaxRequester = function(o) {
5768
+ "use strict";
5769
+ var requester, method = "POST", options = {
5770
+ cors: {
5771
+ allowXdr: false,
5772
+ expected: false,
5773
+ sendCredentials: false
5774
+ },
5775
+ endpoint: null,
5776
+ log: function(str, level) {}
5777
+ }, promises = {}, endpointHandler = {
5778
+ get: function(id) {
5779
+ return options.endpoint;
5780
+ }
5781
+ };
5782
+ qq.extend(options, o);
5783
+ requester = qq.extend(this, new qq.AjaxRequester({
5784
+ acceptHeader: "application/json",
5785
+ validMethods: [ method ],
5786
+ method: method,
5787
+ endpointStore: endpointHandler,
5788
+ allowXRequestedWithAndCacheControl: false,
5789
+ cors: options.cors,
5790
+ log: options.log,
5791
+ onComplete: function(id, xhr, isError) {
5792
+ var promise = promises[id];
5793
+ delete promises[id];
5794
+ if (isError) {
5795
+ promise.failure(xhr);
5796
+ } else {
5797
+ promise.success(xhr);
5798
+ }
5799
+ }
5800
+ }));
5801
+ qq.extend(this, {
5802
+ complete: function(id, xhr, params, headers) {
5803
+ var promise = new qq.Promise();
5804
+ options.log("Submitting All Chunks Done request for " + id);
5805
+ promises[id] = promise;
5806
+ requester.initTransport(id).withParams(params).withHeaders(headers).send(xhr);
5807
+ return promise;
5808
+ }
5809
+ });
5810
+ };
5811
+ qq.DragAndDrop = function(o) {
5812
+ "use strict";
5813
+ var options, HIDE_ZONES_EVENT_NAME = "qq-hidezones", HIDE_BEFORE_ENTER_ATTR = "qq-hide-dropzone", uploadDropZones = [], droppedFiles = [], disposeSupport = new qq.DisposeSupport();
5814
+ options = {
5815
+ dropZoneElements: [],
5816
+ allowMultipleItems: true,
5817
+ classes: {
5818
+ dropActive: null
5819
+ },
5820
+ callbacks: new qq.DragAndDrop.callbacks()
5821
+ };
5822
+ qq.extend(options, o, true);
5823
+ function uploadDroppedFiles(files, uploadDropZone) {
5824
+ var filesAsArray = Array.prototype.slice.call(files);
5825
+ options.callbacks.dropLog("Grabbed " + files.length + " dropped files.");
5826
+ uploadDropZone.dropDisabled(false);
5827
+ options.callbacks.processingDroppedFilesComplete(filesAsArray, uploadDropZone.getElement());
5828
+ }
5829
+ function traverseFileTree(entry) {
5830
+ var parseEntryPromise = new qq.Promise();
5831
+ if (entry.isFile) {
5832
+ entry.file(function(file) {
5833
+ var name = entry.name, fullPath = entry.fullPath, indexOfNameInFullPath = fullPath.indexOf(name);
5834
+ fullPath = fullPath.substr(0, indexOfNameInFullPath);
5835
+ if (fullPath.charAt(0) === "/") {
5836
+ fullPath = fullPath.substr(1);
5837
+ }
5838
+ file.qqPath = fullPath;
5839
+ droppedFiles.push(file);
5840
+ parseEntryPromise.success();
5841
+ }, function(fileError) {
5842
+ options.callbacks.dropLog("Problem parsing '" + entry.fullPath + "'. FileError code " + fileError.code + ".", "error");
5843
+ parseEntryPromise.failure();
5844
+ });
5845
+ } else if (entry.isDirectory) {
5846
+ getFilesInDirectory(entry).then(function allEntriesRead(entries) {
5847
+ var entriesLeft = entries.length;
5848
+ qq.each(entries, function(idx, entry) {
5849
+ traverseFileTree(entry).done(function() {
5850
+ entriesLeft -= 1;
5851
+ if (entriesLeft === 0) {
5852
+ parseEntryPromise.success();
5853
+ }
5854
+ });
5855
+ });
5856
+ if (!entries.length) {
5857
+ parseEntryPromise.success();
5858
+ }
5859
+ }, function readFailure(fileError) {
5860
+ options.callbacks.dropLog("Problem parsing '" + entry.fullPath + "'. FileError code " + fileError.code + ".", "error");
5861
+ parseEntryPromise.failure();
5862
+ });
5863
+ }
5864
+ return parseEntryPromise;
5865
+ }
5866
+ function getFilesInDirectory(entry, reader, accumEntries, existingPromise) {
5867
+ var promise = existingPromise || new qq.Promise(), dirReader = reader || entry.createReader();
5868
+ dirReader.readEntries(function readSuccess(entries) {
5869
+ var newEntries = accumEntries ? accumEntries.concat(entries) : entries;
5870
+ if (entries.length) {
5871
+ setTimeout(function() {
5872
+ getFilesInDirectory(entry, dirReader, newEntries, promise);
5873
+ }, 0);
5874
+ } else {
5875
+ promise.success(newEntries);
5876
+ }
5877
+ }, promise.failure);
5878
+ return promise;
5879
+ }
5880
+ function handleDataTransfer(dataTransfer, uploadDropZone) {
5881
+ var pendingFolderPromises = [], handleDataTransferPromise = new qq.Promise();
5882
+ options.callbacks.processingDroppedFiles();
5883
+ uploadDropZone.dropDisabled(true);
5884
+ if (dataTransfer.files.length > 1 && !options.allowMultipleItems) {
5885
+ options.callbacks.processingDroppedFilesComplete([]);
5886
+ options.callbacks.dropError("tooManyFilesError", "");
5887
+ uploadDropZone.dropDisabled(false);
5888
+ handleDataTransferPromise.failure();
5889
+ } else {
5890
+ droppedFiles = [];
5891
+ if (qq.isFolderDropSupported(dataTransfer)) {
5892
+ qq.each(dataTransfer.items, function(idx, item) {
5893
+ var entry = item.webkitGetAsEntry();
5894
+ if (entry) {
5895
+ if (entry.isFile) {
5896
+ droppedFiles.push(item.getAsFile());
5897
+ } else {
5898
+ pendingFolderPromises.push(traverseFileTree(entry).done(function() {
5899
+ pendingFolderPromises.pop();
5900
+ if (pendingFolderPromises.length === 0) {
5901
+ handleDataTransferPromise.success();
5902
+ }
5903
+ }));
5904
+ }
5905
+ }
5906
+ });
5907
+ } else {
5908
+ droppedFiles = dataTransfer.files;
5909
+ }
5910
+ if (pendingFolderPromises.length === 0) {
5911
+ handleDataTransferPromise.success();
5912
+ }
5913
+ }
5914
+ return handleDataTransferPromise;
5915
+ }
5916
+ function setupDropzone(dropArea) {
5917
+ var dropZone = new qq.UploadDropZone({
5918
+ HIDE_ZONES_EVENT_NAME: HIDE_ZONES_EVENT_NAME,
5919
+ element: dropArea,
5920
+ onEnter: function(e) {
5921
+ qq(dropArea).addClass(options.classes.dropActive);
5922
+ e.stopPropagation();
5923
+ },
5924
+ onLeaveNotDescendants: function(e) {
5925
+ qq(dropArea).removeClass(options.classes.dropActive);
5926
+ },
5927
+ onDrop: function(e) {
5928
+ handleDataTransfer(e.dataTransfer, dropZone).then(function() {
5929
+ uploadDroppedFiles(droppedFiles, dropZone);
5930
+ }, function() {
5931
+ options.callbacks.dropLog("Drop event DataTransfer parsing failed. No files will be uploaded.", "error");
5932
+ });
5933
+ }
5934
+ });
5935
+ disposeSupport.addDisposer(function() {
5936
+ dropZone.dispose();
5937
+ });
5938
+ qq(dropArea).hasAttribute(HIDE_BEFORE_ENTER_ATTR) && qq(dropArea).hide();
5939
+ uploadDropZones.push(dropZone);
5940
+ return dropZone;
5941
+ }
5942
+ function isFileDrag(dragEvent) {
5943
+ var fileDrag;
5944
+ qq.each(dragEvent.dataTransfer.types, function(key, val) {
5945
+ if (val === "Files") {
5946
+ fileDrag = true;
5947
+ return false;
5948
+ }
5949
+ });
5950
+ return fileDrag;
5951
+ }
5952
+ function leavingDocumentOut(e) {
5953
+ if (qq.safari()) {
5954
+ return e.x < 0 || e.y < 0;
5955
+ }
5956
+ return e.x === 0 && e.y === 0;
5957
+ }
5958
+ function setupDragDrop() {
5959
+ var dropZones = options.dropZoneElements, maybeHideDropZones = function() {
5960
+ setTimeout(function() {
5961
+ qq.each(dropZones, function(idx, dropZone) {
5962
+ qq(dropZone).hasAttribute(HIDE_BEFORE_ENTER_ATTR) && qq(dropZone).hide();
5963
+ qq(dropZone).removeClass(options.classes.dropActive);
5964
+ });
5965
+ }, 10);
5966
+ };
5967
+ qq.each(dropZones, function(idx, dropZone) {
5968
+ var uploadDropZone = setupDropzone(dropZone);
5969
+ if (dropZones.length && qq.supportedFeatures.fileDrop) {
5970
+ disposeSupport.attach(document, "dragenter", function(e) {
5971
+ if (!uploadDropZone.dropDisabled() && isFileDrag(e)) {
5972
+ qq.each(dropZones, function(idx, dropZone) {
5973
+ if (dropZone instanceof HTMLElement && qq(dropZone).hasAttribute(HIDE_BEFORE_ENTER_ATTR)) {
5974
+ qq(dropZone).css({
5975
+ display: "block"
5976
+ });
5977
+ }
5978
+ });
5979
+ }
5980
+ });
5981
+ }
5982
+ });
5983
+ disposeSupport.attach(document, "dragleave", function(e) {
5984
+ if (leavingDocumentOut(e)) {
5985
+ maybeHideDropZones();
5986
+ }
5987
+ });
5988
+ disposeSupport.attach(qq(document).children()[0], "mouseenter", function(e) {
5989
+ maybeHideDropZones();
5990
+ });
5991
+ disposeSupport.attach(document, "drop", function(e) {
5992
+ if (isFileDrag(e)) {
5993
+ e.preventDefault();
5994
+ maybeHideDropZones();
5995
+ }
5996
+ });
5997
+ disposeSupport.attach(document, HIDE_ZONES_EVENT_NAME, maybeHideDropZones);
5998
+ }
5999
+ setupDragDrop();
6000
+ qq.extend(this, {
6001
+ setupExtraDropzone: function(element) {
6002
+ options.dropZoneElements.push(element);
6003
+ setupDropzone(element);
6004
+ },
6005
+ removeDropzone: function(element) {
6006
+ var i, dzs = options.dropZoneElements;
6007
+ for (i in dzs) {
6008
+ if (dzs[i] === element) {
6009
+ return dzs.splice(i, 1);
6010
+ }
6011
+ }
6012
+ },
6013
+ dispose: function() {
6014
+ disposeSupport.dispose();
6015
+ qq.each(uploadDropZones, function(idx, dropZone) {
6016
+ dropZone.dispose();
6017
+ });
6018
+ }
6019
+ });
6020
+ };
6021
+ qq.DragAndDrop.callbacks = function() {
6022
+ "use strict";
6023
+ return {
6024
+ processingDroppedFiles: function() {},
6025
+ processingDroppedFilesComplete: function(files, targetEl) {},
6026
+ dropError: function(code, errorSpecifics) {
6027
+ qq.log("Drag & drop error code '" + code + " with these specifics: '" + errorSpecifics + "'", "error");
6028
+ },
6029
+ dropLog: function(message, level) {
6030
+ qq.log(message, level);
6031
+ }
6032
+ };
6033
+ };
6034
+ qq.UploadDropZone = function(o) {
6035
+ "use strict";
6036
+ var disposeSupport = new qq.DisposeSupport(), options, element, preventDrop, dropOutsideDisabled;
6037
+ options = {
6038
+ element: null,
6039
+ onEnter: function(e) {},
6040
+ onLeave: function(e) {},
6041
+ onLeaveNotDescendants: function(e) {},
6042
+ onDrop: function(e) {}
6043
+ };
6044
+ qq.extend(options, o);
6045
+ element = options.element;
6046
+ function dragoverShouldBeCanceled() {
6047
+ return qq.safari() || qq.firefox() && qq.windows();
6048
+ }
6049
+ function disableDropOutside(e) {
6050
+ if (!dropOutsideDisabled) {
6051
+ if (dragoverShouldBeCanceled) {
6052
+ disposeSupport.attach(document, "dragover", function(e) {
6053
+ e.preventDefault();
6054
+ });
6055
+ } else {
6056
+ disposeSupport.attach(document, "dragover", function(e) {
6057
+ if (e.dataTransfer) {
6058
+ e.dataTransfer.dropEffect = "none";
6059
+ e.preventDefault();
6060
+ }
6061
+ });
6062
+ }
6063
+ dropOutsideDisabled = true;
6064
+ }
6065
+ }
6066
+ function isValidFileDrag(e) {
6067
+ if (!qq.supportedFeatures.fileDrop) {
6068
+ return false;
6069
+ }
6070
+ var effectTest, dt = e.dataTransfer, isSafari = qq.safari();
6071
+ effectTest = qq.ie() && qq.supportedFeatures.fileDrop ? true : dt.effectAllowed !== "none";
6072
+ return dt && effectTest && (dt.files && dt.files.length || !isSafari && dt.types.contains && dt.types.contains("Files") || dt.types.includes && dt.types.includes("Files"));
6073
+ }
6074
+ function isOrSetDropDisabled(isDisabled) {
6075
+ if (isDisabled !== undefined) {
6076
+ preventDrop = isDisabled;
6077
+ }
6078
+ return preventDrop;
6079
+ }
6080
+ function triggerHidezonesEvent() {
6081
+ var hideZonesEvent;
6082
+ function triggerUsingOldApi() {
6083
+ hideZonesEvent = document.createEvent("Event");
6084
+ hideZonesEvent.initEvent(options.HIDE_ZONES_EVENT_NAME, true, true);
6085
+ }
6086
+ if (window.CustomEvent) {
6087
+ try {
6088
+ hideZonesEvent = new CustomEvent(options.HIDE_ZONES_EVENT_NAME);
6089
+ } catch (err) {
6090
+ triggerUsingOldApi();
6091
+ }
6092
+ } else {
6093
+ triggerUsingOldApi();
6094
+ }
6095
+ document.dispatchEvent(hideZonesEvent);
6096
+ }
6097
+ function attachEvents() {
6098
+ disposeSupport.attach(element, "dragover", function(e) {
6099
+ if (!isValidFileDrag(e)) {
6100
+ return;
6101
+ }
6102
+ var effect = qq.ie() && qq.supportedFeatures.fileDrop ? null : e.dataTransfer.effectAllowed;
6103
+ if (effect === "move" || effect === "linkMove") {
6104
+ e.dataTransfer.dropEffect = "move";
6105
+ } else {
6106
+ e.dataTransfer.dropEffect = "copy";
6107
+ }
6108
+ e.stopPropagation();
6109
+ e.preventDefault();
6110
+ });
6111
+ disposeSupport.attach(element, "dragenter", function(e) {
6112
+ if (!isOrSetDropDisabled()) {
6113
+ if (!isValidFileDrag(e)) {
6114
+ return;
6115
+ }
6116
+ options.onEnter(e);
6117
+ }
6118
+ });
6119
+ disposeSupport.attach(element, "dragleave", function(e) {
6120
+ if (!isValidFileDrag(e)) {
6121
+ return;
6122
+ }
6123
+ options.onLeave(e);
6124
+ var relatedTarget = document.elementFromPoint(e.clientX, e.clientY);
6125
+ if (qq(this).contains(relatedTarget)) {
6126
+ return;
6127
+ }
6128
+ options.onLeaveNotDescendants(e);
6129
+ });
6130
+ disposeSupport.attach(element, "drop", function(e) {
6131
+ if (!isOrSetDropDisabled()) {
6132
+ if (!isValidFileDrag(e)) {
6133
+ return;
6134
+ }
6135
+ e.preventDefault();
6136
+ e.stopPropagation();
6137
+ options.onDrop(e);
6138
+ triggerHidezonesEvent();
6139
+ }
6140
+ });
6141
+ }
6142
+ disableDropOutside();
6143
+ attachEvents();
6144
+ qq.extend(this, {
6145
+ dropDisabled: function(isDisabled) {
6146
+ return isOrSetDropDisabled(isDisabled);
6147
+ },
6148
+ dispose: function() {
6149
+ disposeSupport.dispose();
6150
+ },
6151
+ getElement: function() {
6152
+ return element;
6153
+ }
6154
+ });
6155
+ this._testing = {};
6156
+ this._testing.isValidFileDrag = isValidFileDrag;
6157
+ };
6158
+ (function() {
6159
+ "use strict";
6160
+ qq.uiPublicApi = {
6161
+ addInitialFiles: function(cannedFileList) {
6162
+ this._parent.prototype.addInitialFiles.apply(this, arguments);
6163
+ this._templating.addCacheToDom();
6164
+ },
6165
+ clearStoredFiles: function() {
6166
+ this._parent.prototype.clearStoredFiles.apply(this, arguments);
6167
+ this._templating.clearFiles();
6168
+ },
6169
+ addExtraDropzone: function(element) {
6170
+ this._dnd && this._dnd.setupExtraDropzone(element);
6171
+ },
6172
+ removeExtraDropzone: function(element) {
6173
+ if (this._dnd) {
6174
+ return this._dnd.removeDropzone(element);
6175
+ }
6176
+ },
6177
+ getItemByFileId: function(id) {
6178
+ if (!this._templating.isHiddenForever(id)) {
6179
+ return this._templating.getFileContainer(id);
6180
+ }
6181
+ },
6182
+ reset: function() {
6183
+ this._parent.prototype.reset.apply(this, arguments);
6184
+ this._templating.reset();
6185
+ if (!this._options.button && this._templating.getButton()) {
6186
+ this._defaultButtonId = this._createUploadButton({
6187
+ element: this._templating.getButton(),
6188
+ title: this._options.text.fileInputTitle
6189
+ }).getButtonId();
6190
+ }
6191
+ if (this._dnd) {
6192
+ this._dnd.dispose();
6193
+ this._dnd = this._setupDragAndDrop();
6194
+ }
6195
+ this._totalFilesInBatch = 0;
6196
+ this._filesInBatchAddedToUi = 0;
6197
+ this._setupClickAndEditEventHandlers();
6198
+ },
6199
+ setName: function(id, newName) {
6200
+ var formattedFilename = this._options.formatFileName(newName);
6201
+ this._parent.prototype.setName.apply(this, arguments);
6202
+ this._templating.updateFilename(id, formattedFilename);
6203
+ },
6204
+ pauseUpload: function(id) {
6205
+ var paused = this._parent.prototype.pauseUpload.apply(this, arguments);
6206
+ paused && this._templating.uploadPaused(id);
6207
+ return paused;
6208
+ },
6209
+ continueUpload: function(id) {
6210
+ var continued = this._parent.prototype.continueUpload.apply(this, arguments);
6211
+ continued && this._templating.uploadContinued(id);
6212
+ return continued;
6213
+ },
6214
+ getId: function(fileContainerOrChildEl) {
6215
+ return this._templating.getFileId(fileContainerOrChildEl);
6216
+ },
6217
+ getDropTarget: function(fileId) {
6218
+ var file = this.getFile(fileId);
6219
+ return file.qqDropTarget;
6220
+ }
6221
+ };
6222
+ qq.uiPrivateApi = {
6223
+ _getButton: function(buttonId) {
6224
+ var button = this._parent.prototype._getButton.apply(this, arguments);
6225
+ if (!button) {
6226
+ if (buttonId === this._defaultButtonId) {
6227
+ button = this._templating.getButton();
6228
+ }
6229
+ }
6230
+ return button;
6231
+ },
6232
+ _removeFileItem: function(fileId) {
6233
+ this._templating.removeFile(fileId);
6234
+ },
6235
+ _setupClickAndEditEventHandlers: function() {
6236
+ this._fileButtonsClickHandler = qq.FileButtonsClickHandler && this._bindFileButtonsClickEvent();
6237
+ this._focusinEventSupported = !qq.firefox();
6238
+ if (this._isEditFilenameEnabled()) {
6239
+ this._filenameClickHandler = this._bindFilenameClickEvent();
6240
+ this._filenameInputFocusInHandler = this._bindFilenameInputFocusInEvent();
6241
+ this._filenameInputFocusHandler = this._bindFilenameInputFocusEvent();
6242
+ }
6243
+ },
6244
+ _setupDragAndDrop: function() {
6245
+ var self = this, dropZoneElements = this._options.dragAndDrop.extraDropzones, templating = this._templating, defaultDropZone = templating.getDropZone();
6246
+ defaultDropZone && dropZoneElements.push(defaultDropZone);
6247
+ return new qq.DragAndDrop({
6248
+ dropZoneElements: dropZoneElements,
6249
+ allowMultipleItems: this._options.multiple,
6250
+ classes: {
6251
+ dropActive: this._options.classes.dropActive
6252
+ },
6253
+ callbacks: {
6254
+ processingDroppedFiles: function() {
6255
+ templating.showDropProcessing();
6256
+ },
6257
+ processingDroppedFilesComplete: function(files, targetEl) {
6258
+ templating.hideDropProcessing();
6259
+ qq.each(files, function(idx, file) {
6260
+ file.qqDropTarget = targetEl;
6261
+ });
6262
+ if (files.length) {
6263
+ self.addFiles(files, null, null);
6264
+ }
6265
+ },
6266
+ dropError: function(code, errorData) {
6267
+ self._itemError(code, errorData);
6268
+ },
6269
+ dropLog: function(message, level) {
6270
+ self.log(message, level);
6271
+ }
6272
+ }
6273
+ });
6274
+ },
6275
+ _bindFileButtonsClickEvent: function() {
6276
+ var self = this;
6277
+ return new qq.FileButtonsClickHandler({
6278
+ templating: this._templating,
6279
+ log: function(message, lvl) {
6280
+ self.log(message, lvl);
6281
+ },
6282
+ onDeleteFile: function(fileId) {
6283
+ self.deleteFile(fileId);
6284
+ },
6285
+ onCancel: function(fileId) {
6286
+ self.cancel(fileId);
6287
+ },
6288
+ onRetry: function(fileId) {
6289
+ self.retry(fileId);
6290
+ },
6291
+ onPause: function(fileId) {
6292
+ self.pauseUpload(fileId);
6293
+ },
6294
+ onContinue: function(fileId) {
6295
+ self.continueUpload(fileId);
6296
+ },
6297
+ onGetName: function(fileId) {
6298
+ return self.getName(fileId);
6299
+ }
6300
+ });
6301
+ },
6302
+ _isEditFilenameEnabled: function() {
6303
+ return this._templating.isEditFilenamePossible() && !this._options.autoUpload && qq.FilenameClickHandler && qq.FilenameInputFocusHandler && qq.FilenameInputFocusHandler;
6304
+ },
6305
+ _filenameEditHandler: function() {
6306
+ var self = this, templating = this._templating;
6307
+ return {
6308
+ templating: templating,
6309
+ log: function(message, lvl) {
6310
+ self.log(message, lvl);
6311
+ },
6312
+ onGetUploadStatus: function(fileId) {
6313
+ return self.getUploads({
6314
+ id: fileId
6315
+ }).status;
6316
+ },
6317
+ onGetName: function(fileId) {
6318
+ return self.getName(fileId);
6319
+ },
6320
+ onSetName: function(id, newName) {
6321
+ self.setName(id, newName);
6322
+ },
6323
+ onEditingStatusChange: function(id, isEditing) {
6324
+ var qqInput = qq(templating.getEditInput(id)), qqFileContainer = qq(templating.getFileContainer(id));
6325
+ if (isEditing) {
6326
+ qqInput.addClass("qq-editing");
6327
+ templating.hideFilename(id);
6328
+ templating.hideEditIcon(id);
6329
+ } else {
6330
+ qqInput.removeClass("qq-editing");
6331
+ templating.showFilename(id);
6332
+ templating.showEditIcon(id);
6333
+ }
6334
+ qqFileContainer.addClass("qq-temp").removeClass("qq-temp");
6335
+ }
6336
+ };
6337
+ },
6338
+ _onUploadStatusChange: function(id, oldStatus, newStatus) {
6339
+ this._parent.prototype._onUploadStatusChange.apply(this, arguments);
6340
+ if (this._isEditFilenameEnabled()) {
6341
+ if (this._templating.getFileContainer(id) && newStatus !== qq.status.SUBMITTED) {
6342
+ this._templating.markFilenameEditable(id);
6343
+ this._templating.hideEditIcon(id);
6344
+ }
6345
+ }
6346
+ if (oldStatus === qq.status.UPLOAD_RETRYING && newStatus === qq.status.UPLOADING) {
6347
+ this._templating.hideRetry(id);
6348
+ this._templating.setStatusText(id);
6349
+ qq(this._templating.getFileContainer(id)).removeClass(this._classes.retrying);
6350
+ } else if (newStatus === qq.status.UPLOAD_FAILED) {
6351
+ this._templating.hidePause(id);
6352
+ }
6353
+ },
6354
+ _bindFilenameInputFocusInEvent: function() {
6355
+ var spec = qq.extend({}, this._filenameEditHandler());
6356
+ return new qq.FilenameInputFocusInHandler(spec);
6357
+ },
6358
+ _bindFilenameInputFocusEvent: function() {
6359
+ var spec = qq.extend({}, this._filenameEditHandler());
6360
+ return new qq.FilenameInputFocusHandler(spec);
6361
+ },
6362
+ _bindFilenameClickEvent: function() {
6363
+ var spec = qq.extend({}, this._filenameEditHandler());
6364
+ return new qq.FilenameClickHandler(spec);
6365
+ },
6366
+ _storeForLater: function(id) {
6367
+ this._parent.prototype._storeForLater.apply(this, arguments);
6368
+ this._templating.hideSpinner(id);
6369
+ },
6370
+ _onAllComplete: function(successful, failed) {
6371
+ this._parent.prototype._onAllComplete.apply(this, arguments);
6372
+ this._templating.resetTotalProgress();
6373
+ },
6374
+ _onSubmit: function(id, name) {
6375
+ var file = this.getFile(id);
6376
+ if (file && file.qqPath && this._options.dragAndDrop.reportDirectoryPaths) {
6377
+ this._paramsStore.addReadOnly(id, {
6378
+ qqpath: file.qqPath
6379
+ });
6380
+ }
6381
+ this._parent.prototype._onSubmit.apply(this, arguments);
6382
+ this._addToList(id, name);
6383
+ },
6384
+ _onSubmitted: function(id) {
6385
+ if (this._isEditFilenameEnabled()) {
6386
+ this._templating.markFilenameEditable(id);
6387
+ this._templating.showEditIcon(id);
6388
+ if (!this._focusinEventSupported) {
6389
+ this._filenameInputFocusHandler.addHandler(this._templating.getEditInput(id));
6390
+ }
6391
+ }
6392
+ },
6393
+ _onProgress: function(id, name, loaded, total) {
6394
+ this._parent.prototype._onProgress.apply(this, arguments);
6395
+ this._templating.updateProgress(id, loaded, total);
6396
+ if (total === 0 || Math.round(loaded / total * 100) === 100) {
6397
+ this._templating.hideCancel(id);
6398
+ this._templating.hidePause(id);
6399
+ this._templating.hideProgress(id);
6400
+ this._templating.setStatusText(id, this._options.text.waitingForResponse);
6401
+ this._displayFileSize(id);
6402
+ } else {
6403
+ this._displayFileSize(id, loaded, total);
6404
+ }
6405
+ },
6406
+ _onTotalProgress: function(loaded, total) {
6407
+ this._parent.prototype._onTotalProgress.apply(this, arguments);
6408
+ this._templating.updateTotalProgress(loaded, total);
6409
+ },
6410
+ _onComplete: function(id, name, result, xhr) {
6411
+ var parentRetVal = this._parent.prototype._onComplete.apply(this, arguments), templating = this._templating, fileContainer = templating.getFileContainer(id), self = this;
6412
+ function completeUpload(result) {
6413
+ if (!fileContainer) {
6414
+ return;
6415
+ }
6416
+ templating.setStatusText(id);
6417
+ qq(fileContainer).removeClass(self._classes.retrying);
6418
+ templating.hideProgress(id);
6419
+ if (self.getUploads({
6420
+ id: id
6421
+ }).status !== qq.status.UPLOAD_FAILED) {
6422
+ templating.hideCancel(id);
6423
+ }
6424
+ templating.hideSpinner(id);
6425
+ if (result.success) {
6426
+ self._markFileAsSuccessful(id);
6427
+ } else {
6428
+ qq(fileContainer).addClass(self._classes.fail);
6429
+ templating.showCancel(id);
6430
+ if (templating.isRetryPossible() && !self._preventRetries[id]) {
6431
+ qq(fileContainer).addClass(self._classes.retryable);
6432
+ templating.showRetry(id);
6433
+ }
6434
+ self._controlFailureTextDisplay(id, result);
6435
+ }
6436
+ }
6437
+ if (parentRetVal instanceof qq.Promise) {
6438
+ parentRetVal.done(function(newResult) {
6439
+ completeUpload(newResult);
6440
+ });
6441
+ } else {
6442
+ completeUpload(result);
6443
+ }
6444
+ return parentRetVal;
6445
+ },
6446
+ _markFileAsSuccessful: function(id) {
6447
+ var templating = this._templating;
6448
+ if (this._isDeletePossible()) {
6449
+ templating.showDeleteButton(id);
6450
+ }
6451
+ qq(templating.getFileContainer(id)).addClass(this._classes.success);
6452
+ this._maybeUpdateThumbnail(id);
6453
+ },
6454
+ _onUploadPrep: function(id) {
6455
+ this._parent.prototype._onUploadPrep.apply(this, arguments);
6456
+ this._templating.showSpinner(id);
6457
+ },
6458
+ _onUpload: function(id, name) {
6459
+ var parentRetVal = this._parent.prototype._onUpload.apply(this, arguments);
6460
+ this._templating.showSpinner(id);
6461
+ return parentRetVal;
6462
+ },
6463
+ _onUploadChunk: function(id, chunkData) {
6464
+ this._parent.prototype._onUploadChunk.apply(this, arguments);
6465
+ if (chunkData.partIndex > 0 && this._handler.isResumable(id)) {
6466
+ this._templating.allowPause(id);
6467
+ }
6468
+ },
6469
+ _onCancel: function(id, name) {
6470
+ this._parent.prototype._onCancel.apply(this, arguments);
6471
+ this._removeFileItem(id);
6472
+ if (this._getNotFinished() === 0) {
6473
+ this._templating.resetTotalProgress();
6474
+ }
6475
+ },
6476
+ _onBeforeAutoRetry: function(id) {
6477
+ var retryNumForDisplay, maxAuto, retryNote;
6478
+ this._parent.prototype._onBeforeAutoRetry.apply(this, arguments);
6479
+ this._showCancelLink(id);
6480
+ if (this._options.retry.showAutoRetryNote) {
6481
+ retryNumForDisplay = this._autoRetries[id];
6482
+ maxAuto = this._options.retry.maxAutoAttempts;
6483
+ retryNote = this._options.retry.autoRetryNote.replace(/\{retryNum\}/g, retryNumForDisplay);
6484
+ retryNote = retryNote.replace(/\{maxAuto\}/g, maxAuto);
6485
+ this._templating.setStatusText(id, retryNote);
6486
+ qq(this._templating.getFileContainer(id)).addClass(this._classes.retrying);
6487
+ }
6488
+ },
6489
+ _onBeforeManualRetry: function(id) {
6490
+ if (this._parent.prototype._onBeforeManualRetry.apply(this, arguments)) {
6491
+ this._templating.resetProgress(id);
6492
+ qq(this._templating.getFileContainer(id)).removeClass(this._classes.fail);
6493
+ this._templating.setStatusText(id);
6494
+ this._templating.showSpinner(id);
6495
+ this._showCancelLink(id);
6496
+ return true;
6497
+ } else {
6498
+ qq(this._templating.getFileContainer(id)).addClass(this._classes.retryable);
6499
+ this._templating.showRetry(id);
6500
+ return false;
6501
+ }
6502
+ },
6503
+ _onSubmitDelete: function(id) {
6504
+ var onSuccessCallback = qq.bind(this._onSubmitDeleteSuccess, this);
6505
+ this._parent.prototype._onSubmitDelete.call(this, id, onSuccessCallback);
6506
+ },
6507
+ _onSubmitDeleteSuccess: function(id, uuid, additionalMandatedParams) {
6508
+ if (this._options.deleteFile.forceConfirm) {
6509
+ this._showDeleteConfirm.apply(this, arguments);
6510
+ } else {
6511
+ this._sendDeleteRequest.apply(this, arguments);
6512
+ }
6513
+ },
6514
+ _onDeleteComplete: function(id, xhr, isError) {
6515
+ this._parent.prototype._onDeleteComplete.apply(this, arguments);
6516
+ this._templating.hideSpinner(id);
6517
+ if (isError) {
6518
+ this._templating.setStatusText(id, this._options.deleteFile.deletingFailedText);
6519
+ this._templating.showDeleteButton(id);
6520
+ } else {
6521
+ this._removeFileItem(id);
6522
+ }
6523
+ },
6524
+ _sendDeleteRequest: function(id, uuid, additionalMandatedParams) {
6525
+ this._templating.hideDeleteButton(id);
6526
+ this._templating.showSpinner(id);
6527
+ this._templating.setStatusText(id, this._options.deleteFile.deletingStatusText);
6528
+ this._deleteHandler.sendDelete.apply(this, arguments);
6529
+ },
6530
+ _showDeleteConfirm: function(id, uuid, mandatedParams) {
6531
+ var fileName = this.getName(id), confirmMessage = this._options.deleteFile.confirmMessage.replace(/\{filename\}/g, fileName), uuid = this.getUuid(id), deleteRequestArgs = arguments, self = this, retVal;
6532
+ retVal = this._options.showConfirm(confirmMessage);
6533
+ if (qq.isGenericPromise(retVal)) {
6534
+ retVal.then(function() {
6535
+ self._sendDeleteRequest.apply(self, deleteRequestArgs);
6536
+ });
6537
+ } else if (retVal !== false) {
6538
+ self._sendDeleteRequest.apply(self, deleteRequestArgs);
6539
+ }
6540
+ },
6541
+ _addToList: function(id, name, canned) {
6542
+ var prependData, prependIndex = 0, dontDisplay = this._handler.isProxied(id) && this._options.scaling.hideScaled, record;
6543
+ if (this._options.display.prependFiles) {
6544
+ if (this._totalFilesInBatch > 1 && this._filesInBatchAddedToUi > 0) {
6545
+ prependIndex = this._filesInBatchAddedToUi - 1;
6546
+ }
6547
+ prependData = {
6548
+ index: prependIndex
6549
+ };
6550
+ }
6551
+ if (!canned) {
6552
+ if (this._options.disableCancelForFormUploads && !qq.supportedFeatures.ajaxUploading) {
6553
+ this._templating.disableCancel();
6554
+ }
6555
+ if (!this._options.multiple) {
6556
+ record = this.getUploads({
6557
+ id: id
6558
+ });
6559
+ this._handledProxyGroup = this._handledProxyGroup || record.proxyGroupId;
6560
+ if (record.proxyGroupId !== this._handledProxyGroup || !record.proxyGroupId) {
6561
+ this._handler.cancelAll();
6562
+ this._clearList();
6563
+ this._handledProxyGroup = null;
6564
+ }
6565
+ }
6566
+ }
6567
+ if (canned) {
6568
+ this._templating.addFileToCache(id, this._options.formatFileName(name), prependData, dontDisplay);
6569
+ this._templating.updateThumbnail(id, this._thumbnailUrls[id], true, this._options.thumbnails.customResizer);
6570
+ } else {
6571
+ this._templating.addFile(id, this._options.formatFileName(name), prependData, dontDisplay);
6572
+ this._templating.generatePreview(id, this.getFile(id), this._options.thumbnails.customResizer);
6573
+ }
6574
+ this._filesInBatchAddedToUi += 1;
6575
+ if (canned || this._options.display.fileSizeOnSubmit && qq.supportedFeatures.ajaxUploading) {
6576
+ this._displayFileSize(id);
6577
+ }
6578
+ },
6579
+ _clearList: function() {
6580
+ this._templating.clearFiles();
6581
+ this.clearStoredFiles();
6582
+ },
6583
+ _displayFileSize: function(id, loadedSize, totalSize) {
6584
+ var size = this.getSize(id), sizeForDisplay = this._formatSize(size);
6585
+ if (size >= 0) {
6586
+ if (loadedSize !== undefined && totalSize !== undefined) {
6587
+ sizeForDisplay = this._formatProgress(loadedSize, totalSize);
6588
+ }
6589
+ this._templating.updateSize(id, sizeForDisplay);
6590
+ }
6591
+ },
6592
+ _formatProgress: function(uploadedSize, totalSize) {
6593
+ var message = this._options.text.formatProgress;
6594
+ function r(name, replacement) {
6595
+ message = message.replace(name, replacement);
6596
+ }
6597
+ r("{percent}", Math.round(uploadedSize / totalSize * 100));
6598
+ r("{total_size}", this._formatSize(totalSize));
6599
+ return message;
6600
+ },
6601
+ _controlFailureTextDisplay: function(id, response) {
6602
+ var mode, responseProperty, failureReason;
6603
+ mode = this._options.failedUploadTextDisplay.mode;
6604
+ responseProperty = this._options.failedUploadTextDisplay.responseProperty;
6605
+ if (mode === "custom") {
6606
+ failureReason = response[responseProperty];
6607
+ if (!failureReason) {
6608
+ failureReason = this._options.text.failUpload;
6609
+ }
6610
+ this._templating.setStatusText(id, failureReason);
6611
+ if (this._options.failedUploadTextDisplay.enableTooltip) {
6612
+ this._showTooltip(id, failureReason);
6613
+ }
6614
+ } else if (mode === "default") {
6615
+ this._templating.setStatusText(id, this._options.text.failUpload);
6616
+ } else if (mode !== "none") {
6617
+ this.log("failedUploadTextDisplay.mode value of '" + mode + "' is not valid", "warn");
6618
+ }
6619
+ },
6620
+ _showTooltip: function(id, text) {
6621
+ this._templating.getFileContainer(id).title = text;
6622
+ },
6623
+ _showCancelLink: function(id) {
6624
+ if (!this._options.disableCancelForFormUploads || qq.supportedFeatures.ajaxUploading) {
6625
+ this._templating.showCancel(id);
6626
+ }
6627
+ },
6628
+ _itemError: function(code, name, item) {
6629
+ var message = this._parent.prototype._itemError.apply(this, arguments);
6630
+ this._options.showMessage(message);
6631
+ },
6632
+ _batchError: function(message) {
6633
+ this._parent.prototype._batchError.apply(this, arguments);
6634
+ this._options.showMessage(message);
6635
+ },
6636
+ _setupPastePrompt: function() {
6637
+ var self = this;
6638
+ this._options.callbacks.onPasteReceived = function() {
6639
+ var message = self._options.paste.namePromptMessage, defaultVal = self._options.paste.defaultName;
6640
+ return self._options.showPrompt(message, defaultVal);
6641
+ };
6642
+ },
6643
+ _fileOrBlobRejected: function(id, name) {
6644
+ this._totalFilesInBatch -= 1;
6645
+ this._parent.prototype._fileOrBlobRejected.apply(this, arguments);
6646
+ },
6647
+ _prepareItemsForUpload: function(items, params, endpoint) {
6648
+ this._totalFilesInBatch = items.length;
6649
+ this._filesInBatchAddedToUi = 0;
6650
+ this._parent.prototype._prepareItemsForUpload.apply(this, arguments);
6651
+ },
6652
+ _maybeUpdateThumbnail: function(fileId) {
6653
+ var thumbnailUrl = this._thumbnailUrls[fileId], fileStatus = this.getUploads({
6654
+ id: fileId
6655
+ }).status;
6656
+ if (fileStatus !== qq.status.DELETED && (thumbnailUrl || this._options.thumbnails.placeholders.waitUntilResponse || !qq.supportedFeatures.imagePreviews)) {
6657
+ this._templating.updateThumbnail(fileId, thumbnailUrl, this._options.thumbnails.customResizer);
6658
+ }
6659
+ },
6660
+ _addCannedFile: function(sessionData) {
6661
+ var id = this._parent.prototype._addCannedFile.apply(this, arguments);
6662
+ this._addToList(id, this.getName(id), true);
6663
+ this._templating.hideSpinner(id);
6664
+ this._templating.hideCancel(id);
6665
+ this._markFileAsSuccessful(id);
6666
+ return id;
6667
+ },
6668
+ _setSize: function(id, newSize) {
6669
+ this._parent.prototype._setSize.apply(this, arguments);
6670
+ this._templating.updateSize(id, this._formatSize(newSize));
6671
+ },
6672
+ _sessionRequestComplete: function() {
6673
+ this._templating.addCacheToDom();
6674
+ this._parent.prototype._sessionRequestComplete.apply(this, arguments);
6675
+ }
6676
+ };
6677
+ })();
6678
+ qq.FineUploader = function(o, namespace) {
6679
+ "use strict";
6680
+ var self = this;
6681
+ this._parent = namespace ? qq[namespace].FineUploaderBasic : qq.FineUploaderBasic;
6682
+ this._parent.apply(this, arguments);
6683
+ qq.extend(this._options, {
6684
+ element: null,
6685
+ button: null,
6686
+ listElement: null,
6687
+ dragAndDrop: {
6688
+ extraDropzones: [],
6689
+ reportDirectoryPaths: false
6690
+ },
6691
+ text: {
6692
+ formatProgress: "{percent}% of {total_size}",
6693
+ failUpload: "Upload failed",
6694
+ waitingForResponse: "Processing...",
6695
+ paused: "Paused"
6696
+ },
6697
+ template: "qq-template",
6698
+ classes: {
6699
+ retrying: "qq-upload-retrying",
6700
+ retryable: "qq-upload-retryable",
6701
+ success: "qq-upload-success",
6702
+ fail: "qq-upload-fail",
6703
+ editable: "qq-editable",
6704
+ hide: "qq-hide",
6705
+ dropActive: "qq-upload-drop-area-active"
6706
+ },
6707
+ failedUploadTextDisplay: {
6708
+ mode: "default",
6709
+ responseProperty: "error",
6710
+ enableTooltip: true
6711
+ },
6712
+ messages: {
6713
+ tooManyFilesError: "You may only drop one file",
6714
+ unsupportedBrowser: "Unrecoverable error - this browser does not permit file uploading of any kind."
6715
+ },
6716
+ retry: {
6717
+ showAutoRetryNote: true,
6718
+ autoRetryNote: "Retrying {retryNum}/{maxAuto}..."
6719
+ },
6720
+ deleteFile: {
6721
+ forceConfirm: false,
6722
+ confirmMessage: "Are you sure you want to delete {filename}?",
6723
+ deletingStatusText: "Deleting...",
6724
+ deletingFailedText: "Delete failed"
6725
+ },
6726
+ display: {
6727
+ fileSizeOnSubmit: false,
6728
+ prependFiles: false
6729
+ },
6730
+ paste: {
6731
+ promptForName: false,
6732
+ namePromptMessage: "Please name this image"
6733
+ },
6734
+ thumbnails: {
6735
+ customResizer: null,
6736
+ maxCount: 0,
6737
+ placeholders: {
6738
+ waitUntilResponse: false,
6739
+ notAvailablePath: null,
6740
+ waitingPath: null
6741
+ },
6742
+ timeBetweenThumbs: 750
6743
+ },
6744
+ scaling: {
6745
+ hideScaled: false
6746
+ },
6747
+ showMessage: function(message) {
6748
+ if (self._templating.hasDialog("alert")) {
6749
+ return self._templating.showDialog("alert", message);
6750
+ } else {
6751
+ setTimeout(function() {
6752
+ window.alert(message);
6753
+ }, 0);
6754
+ }
6755
+ },
6756
+ showConfirm: function(message) {
6757
+ if (self._templating.hasDialog("confirm")) {
6758
+ return self._templating.showDialog("confirm", message);
6759
+ } else {
6760
+ return window.confirm(message);
6761
+ }
6762
+ },
6763
+ showPrompt: function(message, defaultValue) {
6764
+ if (self._templating.hasDialog("prompt")) {
6765
+ return self._templating.showDialog("prompt", message, defaultValue);
6766
+ } else {
6767
+ return window.prompt(message, defaultValue);
6768
+ }
6769
+ }
6770
+ }, true);
6771
+ qq.extend(this._options, o, true);
6772
+ this._templating = new qq.Templating({
6773
+ log: qq.bind(this.log, this),
6774
+ templateIdOrEl: this._options.template,
6775
+ containerEl: this._options.element,
6776
+ fileContainerEl: this._options.listElement,
6777
+ button: this._options.button,
6778
+ imageGenerator: this._imageGenerator,
6779
+ classes: {
6780
+ hide: this._options.classes.hide,
6781
+ editable: this._options.classes.editable
6782
+ },
6783
+ limits: {
6784
+ maxThumbs: this._options.thumbnails.maxCount,
6785
+ timeBetweenThumbs: this._options.thumbnails.timeBetweenThumbs
6786
+ },
6787
+ placeholders: {
6788
+ waitUntilUpdate: this._options.thumbnails.placeholders.waitUntilResponse,
6789
+ thumbnailNotAvailable: this._options.thumbnails.placeholders.notAvailablePath,
6790
+ waitingForThumbnail: this._options.thumbnails.placeholders.waitingPath
6791
+ },
6792
+ text: this._options.text
6793
+ });
6794
+ if (this._options.workarounds.ios8SafariUploads && qq.ios800() && qq.iosSafari()) {
6795
+ this._templating.renderFailure(this._options.messages.unsupportedBrowserIos8Safari);
6796
+ } else if (!qq.supportedFeatures.uploading || this._options.cors.expected && !qq.supportedFeatures.uploadCors) {
6797
+ this._templating.renderFailure(this._options.messages.unsupportedBrowser);
6798
+ } else {
6799
+ this._wrapCallbacks();
6800
+ this._templating.render();
6801
+ this._classes = this._options.classes;
6802
+ if (!this._options.button && this._templating.getButton()) {
6803
+ this._defaultButtonId = this._createUploadButton({
6804
+ element: this._templating.getButton(),
6805
+ title: this._options.text.fileInputTitle
6806
+ }).getButtonId();
6807
+ }
6808
+ this._setupClickAndEditEventHandlers();
6809
+ if (qq.DragAndDrop && qq.supportedFeatures.fileDrop) {
6810
+ this._dnd = this._setupDragAndDrop();
6811
+ }
6812
+ if (this._options.paste.targetElement && this._options.paste.promptForName) {
6813
+ if (qq.PasteSupport) {
6814
+ this._setupPastePrompt();
6815
+ } else {
6816
+ this.log("Paste support module not found.", "error");
6817
+ }
6818
+ }
6819
+ this._totalFilesInBatch = 0;
6820
+ this._filesInBatchAddedToUi = 0;
6821
+ }
6822
+ };
6823
+ qq.extend(qq.FineUploader.prototype, qq.basePublicApi);
6824
+ qq.extend(qq.FineUploader.prototype, qq.basePrivateApi);
6825
+ qq.extend(qq.FineUploader.prototype, qq.uiPublicApi);
6826
+ qq.extend(qq.FineUploader.prototype, qq.uiPrivateApi);
6827
+ qq.Templating = function(spec) {
6828
+ "use strict";
6829
+ var FILE_ID_ATTR = "qq-file-id", FILE_CLASS_PREFIX = "qq-file-id-", THUMBNAIL_MAX_SIZE_ATTR = "qq-max-size", THUMBNAIL_SERVER_SCALE_ATTR = "qq-server-scale", HIDE_DROPZONE_ATTR = "qq-hide-dropzone", DROPZPONE_TEXT_ATTR = "qq-drop-area-text", IN_PROGRESS_CLASS = "qq-in-progress", HIDDEN_FOREVER_CLASS = "qq-hidden-forever", fileBatch = {
6830
+ content: document.createDocumentFragment(),
6831
+ map: {}
6832
+ }, isCancelDisabled = false, generatedThumbnails = 0, thumbnailQueueMonitorRunning = false, thumbGenerationQueue = [], thumbnailMaxSize = -1, options = {
6833
+ log: null,
6834
+ limits: {
6835
+ maxThumbs: 0,
6836
+ timeBetweenThumbs: 750
6837
+ },
6838
+ templateIdOrEl: "qq-template",
6839
+ containerEl: null,
6840
+ fileContainerEl: null,
6841
+ button: null,
6842
+ imageGenerator: null,
6843
+ classes: {
6844
+ hide: "qq-hide",
6845
+ editable: "qq-editable"
6846
+ },
6847
+ placeholders: {
6848
+ waitUntilUpdate: false,
6849
+ thumbnailNotAvailable: null,
6850
+ waitingForThumbnail: null
6851
+ },
6852
+ text: {
6853
+ paused: "Paused"
6854
+ }
6855
+ }, selectorClasses = {
6856
+ button: "qq-upload-button-selector",
6857
+ alertDialog: "qq-alert-dialog-selector",
6858
+ dialogCancelButton: "qq-cancel-button-selector",
6859
+ confirmDialog: "qq-confirm-dialog-selector",
6860
+ dialogMessage: "qq-dialog-message-selector",
6861
+ dialogOkButton: "qq-ok-button-selector",
6862
+ promptDialog: "qq-prompt-dialog-selector",
6863
+ uploader: "qq-uploader-selector",
6864
+ drop: "qq-upload-drop-area-selector",
6865
+ list: "qq-upload-list-selector",
6866
+ progressBarContainer: "qq-progress-bar-container-selector",
6867
+ progressBar: "qq-progress-bar-selector",
6868
+ totalProgressBarContainer: "qq-total-progress-bar-container-selector",
6869
+ totalProgressBar: "qq-total-progress-bar-selector",
6870
+ file: "qq-upload-file-selector",
6871
+ spinner: "qq-upload-spinner-selector",
6872
+ size: "qq-upload-size-selector",
6873
+ cancel: "qq-upload-cancel-selector",
6874
+ pause: "qq-upload-pause-selector",
6875
+ continueButton: "qq-upload-continue-selector",
6876
+ deleteButton: "qq-upload-delete-selector",
6877
+ retry: "qq-upload-retry-selector",
6878
+ statusText: "qq-upload-status-text-selector",
6879
+ editFilenameInput: "qq-edit-filename-selector",
6880
+ editNameIcon: "qq-edit-filename-icon-selector",
6881
+ dropText: "qq-upload-drop-area-text-selector",
6882
+ dropProcessing: "qq-drop-processing-selector",
6883
+ dropProcessingSpinner: "qq-drop-processing-spinner-selector",
6884
+ thumbnail: "qq-thumbnail-selector"
6885
+ }, previewGeneration = {}, cachedThumbnailNotAvailableImg = new qq.Promise(), cachedWaitingForThumbnailImg = new qq.Promise(), log, isEditElementsExist, isRetryElementExist, templateDom, container, fileList, showThumbnails, serverScale, cacheThumbnailPlaceholders = function() {
6886
+ var notAvailableUrl = options.placeholders.thumbnailNotAvailable, waitingUrl = options.placeholders.waitingForThumbnail, spec = {
6887
+ maxSize: thumbnailMaxSize,
6888
+ scale: serverScale
6889
+ };
6890
+ if (showThumbnails) {
6891
+ if (notAvailableUrl) {
6892
+ options.imageGenerator.generate(notAvailableUrl, new Image(), spec).then(function(updatedImg) {
6893
+ cachedThumbnailNotAvailableImg.success(updatedImg);
6894
+ }, function() {
6895
+ cachedThumbnailNotAvailableImg.failure();
6896
+ log("Problem loading 'not available' placeholder image at " + notAvailableUrl, "error");
6897
+ });
6898
+ } else {
6899
+ cachedThumbnailNotAvailableImg.failure();
6900
+ }
6901
+ if (waitingUrl) {
6902
+ options.imageGenerator.generate(waitingUrl, new Image(), spec).then(function(updatedImg) {
6903
+ cachedWaitingForThumbnailImg.success(updatedImg);
6904
+ }, function() {
6905
+ cachedWaitingForThumbnailImg.failure();
6906
+ log("Problem loading 'waiting for thumbnail' placeholder image at " + waitingUrl, "error");
6907
+ });
6908
+ } else {
6909
+ cachedWaitingForThumbnailImg.failure();
6910
+ }
6911
+ }
6912
+ }, displayWaitingImg = function(thumbnail) {
6913
+ var waitingImgPlacement = new qq.Promise();
6914
+ cachedWaitingForThumbnailImg.then(function(img) {
6915
+ maybeScalePlaceholderViaCss(img, thumbnail);
6916
+ if (!thumbnail.src) {
6917
+ thumbnail.src = img.src;
6918
+ thumbnail.onload = function() {
6919
+ thumbnail.onload = null;
6920
+ show(thumbnail);
6921
+ waitingImgPlacement.success();
6922
+ };
6923
+ } else {
6924
+ waitingImgPlacement.success();
6925
+ }
6926
+ }, function() {
6927
+ hide(thumbnail);
6928
+ waitingImgPlacement.success();
6929
+ });
6930
+ return waitingImgPlacement;
6931
+ }, generateNewPreview = function(id, blob, spec) {
6932
+ var thumbnail = getThumbnail(id);
6933
+ log("Generating new thumbnail for " + id);
6934
+ blob.qqThumbnailId = id;
6935
+ return options.imageGenerator.generate(blob, thumbnail, spec).then(function() {
6936
+ generatedThumbnails++;
6937
+ show(thumbnail);
6938
+ previewGeneration[id].success();
6939
+ }, function() {
6940
+ previewGeneration[id].failure();
6941
+ if (!options.placeholders.waitUntilUpdate) {
6942
+ maybeSetDisplayNotAvailableImg(id, thumbnail);
6943
+ }
6944
+ });
6945
+ }, generateNextQueuedPreview = function() {
6946
+ if (thumbGenerationQueue.length) {
6947
+ thumbnailQueueMonitorRunning = true;
6948
+ var queuedThumbRequest = thumbGenerationQueue.shift();
6949
+ if (queuedThumbRequest.update) {
6950
+ processUpdateQueuedPreviewRequest(queuedThumbRequest);
6951
+ } else {
6952
+ processNewQueuedPreviewRequest(queuedThumbRequest);
6953
+ }
6954
+ } else {
6955
+ thumbnailQueueMonitorRunning = false;
6956
+ }
6957
+ }, getCancel = function(id) {
6958
+ return getTemplateEl(getFile(id), selectorClasses.cancel);
6959
+ }, getContinue = function(id) {
6960
+ return getTemplateEl(getFile(id), selectorClasses.continueButton);
6961
+ }, getDialog = function(type) {
6962
+ return getTemplateEl(container, selectorClasses[type + "Dialog"]);
6963
+ }, getDelete = function(id) {
6964
+ return getTemplateEl(getFile(id), selectorClasses.deleteButton);
6965
+ }, getDropProcessing = function() {
6966
+ return getTemplateEl(container, selectorClasses.dropProcessing);
6967
+ }, getEditIcon = function(id) {
6968
+ return getTemplateEl(getFile(id), selectorClasses.editNameIcon);
6969
+ }, getFile = function(id) {
6970
+ return fileBatch.map[id] || qq(fileList).getFirstByClass(FILE_CLASS_PREFIX + id);
6971
+ }, getFilename = function(id) {
6972
+ return getTemplateEl(getFile(id), selectorClasses.file);
6973
+ }, getPause = function(id) {
6974
+ return getTemplateEl(getFile(id), selectorClasses.pause);
6975
+ }, getProgress = function(id) {
6976
+ if (id == null) {
6977
+ return getTemplateEl(container, selectorClasses.totalProgressBarContainer) || getTemplateEl(container, selectorClasses.totalProgressBar);
6978
+ }
6979
+ return getTemplateEl(getFile(id), selectorClasses.progressBarContainer) || getTemplateEl(getFile(id), selectorClasses.progressBar);
6980
+ }, getRetry = function(id) {
6981
+ return getTemplateEl(getFile(id), selectorClasses.retry);
6982
+ }, getSize = function(id) {
6983
+ return getTemplateEl(getFile(id), selectorClasses.size);
6984
+ }, getSpinner = function(id) {
6985
+ return getTemplateEl(getFile(id), selectorClasses.spinner);
6986
+ }, getTemplateEl = function(context, cssClass) {
6987
+ return context && qq(context).getFirstByClass(cssClass);
6988
+ }, getThumbnail = function(id) {
6989
+ return showThumbnails && getTemplateEl(getFile(id), selectorClasses.thumbnail);
6990
+ }, hide = function(el) {
6991
+ el && qq(el).addClass(options.classes.hide);
6992
+ }, maybeScalePlaceholderViaCss = function(placeholder, thumbnail) {
6993
+ var maxWidth = placeholder.style.maxWidth, maxHeight = placeholder.style.maxHeight;
6994
+ if (maxHeight && maxWidth && !thumbnail.style.maxWidth && !thumbnail.style.maxHeight) {
6995
+ qq(thumbnail).css({
6996
+ maxWidth: maxWidth,
6997
+ maxHeight: maxHeight
6998
+ });
6999
+ }
7000
+ }, maybeSetDisplayNotAvailableImg = function(id, thumbnail) {
7001
+ var previewing = previewGeneration[id] || new qq.Promise().failure(), notAvailableImgPlacement = new qq.Promise();
7002
+ cachedThumbnailNotAvailableImg.then(function(img) {
7003
+ previewing.then(function() {
7004
+ notAvailableImgPlacement.success();
7005
+ }, function() {
7006
+ maybeScalePlaceholderViaCss(img, thumbnail);
7007
+ thumbnail.onload = function() {
7008
+ thumbnail.onload = null;
7009
+ notAvailableImgPlacement.success();
7010
+ };
7011
+ thumbnail.src = img.src;
7012
+ show(thumbnail);
7013
+ });
7014
+ });
7015
+ return notAvailableImgPlacement;
7016
+ }, parseAndGetTemplate = function() {
7017
+ var scriptEl, scriptHtml, fileListNode, tempTemplateEl, fileListEl, defaultButton, dropArea, thumbnail, dropProcessing, dropTextEl, uploaderEl;
7018
+ log("Parsing template");
7019
+ if (options.templateIdOrEl == null) {
7020
+ throw new Error("You MUST specify either a template element or ID!");
7021
+ }
7022
+ if (qq.isString(options.templateIdOrEl)) {
7023
+ scriptEl = document.getElementById(options.templateIdOrEl);
7024
+ if (scriptEl === null) {
7025
+ throw new Error(qq.format("Cannot find template script at ID '{}'!", options.templateIdOrEl));
7026
+ }
7027
+ scriptHtml = scriptEl.innerHTML;
7028
+ } else {
7029
+ if (options.templateIdOrEl.innerHTML === undefined) {
7030
+ throw new Error("You have specified an invalid value for the template option! " + "It must be an ID or an Element.");
7031
+ }
7032
+ scriptHtml = options.templateIdOrEl.innerHTML;
7033
+ }
7034
+ scriptHtml = qq.trimStr(scriptHtml);
7035
+ tempTemplateEl = document.createElement("div");
7036
+ tempTemplateEl.appendChild(qq.toElement(scriptHtml));
7037
+ uploaderEl = qq(tempTemplateEl).getFirstByClass(selectorClasses.uploader);
7038
+ if (options.button) {
7039
+ defaultButton = qq(tempTemplateEl).getFirstByClass(selectorClasses.button);
7040
+ if (defaultButton) {
7041
+ qq(defaultButton).remove();
7042
+ }
7043
+ }
7044
+ if (!qq.DragAndDrop || !qq.supportedFeatures.fileDrop) {
7045
+ dropProcessing = qq(tempTemplateEl).getFirstByClass(selectorClasses.dropProcessing);
7046
+ if (dropProcessing) {
7047
+ qq(dropProcessing).remove();
7048
+ }
7049
+ }
7050
+ dropArea = qq(tempTemplateEl).getFirstByClass(selectorClasses.drop);
7051
+ if (dropArea && !qq.DragAndDrop) {
7052
+ log("DnD module unavailable.", "info");
7053
+ qq(dropArea).remove();
7054
+ }
7055
+ if (!qq.supportedFeatures.fileDrop) {
7056
+ uploaderEl.removeAttribute(DROPZPONE_TEXT_ATTR);
7057
+ if (dropArea && qq(dropArea).hasAttribute(HIDE_DROPZONE_ATTR)) {
7058
+ qq(dropArea).css({
7059
+ display: "none"
7060
+ });
7061
+ }
7062
+ } else if (qq(uploaderEl).hasAttribute(DROPZPONE_TEXT_ATTR) && dropArea) {
7063
+ dropTextEl = qq(dropArea).getFirstByClass(selectorClasses.dropText);
7064
+ dropTextEl && qq(dropTextEl).remove();
7065
+ }
7066
+ thumbnail = qq(tempTemplateEl).getFirstByClass(selectorClasses.thumbnail);
7067
+ if (!showThumbnails) {
7068
+ thumbnail && qq(thumbnail).remove();
7069
+ } else if (thumbnail) {
7070
+ thumbnailMaxSize = parseInt(thumbnail.getAttribute(THUMBNAIL_MAX_SIZE_ATTR));
7071
+ thumbnailMaxSize = thumbnailMaxSize > 0 ? thumbnailMaxSize : null;
7072
+ serverScale = qq(thumbnail).hasAttribute(THUMBNAIL_SERVER_SCALE_ATTR);
7073
+ }
7074
+ showThumbnails = showThumbnails && thumbnail;
7075
+ isEditElementsExist = qq(tempTemplateEl).getByClass(selectorClasses.editFilenameInput).length > 0;
7076
+ isRetryElementExist = qq(tempTemplateEl).getByClass(selectorClasses.retry).length > 0;
7077
+ fileListNode = qq(tempTemplateEl).getFirstByClass(selectorClasses.list);
7078
+ if (fileListNode == null) {
7079
+ throw new Error("Could not find the file list container in the template!");
7080
+ }
7081
+ fileListEl = fileListNode.children[0].cloneNode(true);
7082
+ fileListNode.innerHTML = "";
7083
+ if (tempTemplateEl.getElementsByTagName("DIALOG").length) {
7084
+ document.createElement("dialog");
7085
+ }
7086
+ log("Template parsing complete");
7087
+ return {
7088
+ template: tempTemplateEl,
7089
+ fileTemplate: fileListEl
7090
+ };
7091
+ }, prependFile = function(el, index, fileList) {
7092
+ var parentEl = fileList, beforeEl = parentEl.firstChild;
7093
+ if (index > 0) {
7094
+ beforeEl = qq(parentEl).children()[index].nextSibling;
7095
+ }
7096
+ parentEl.insertBefore(el, beforeEl);
7097
+ }, processNewQueuedPreviewRequest = function(queuedThumbRequest) {
7098
+ var id = queuedThumbRequest.id, optFileOrBlob = queuedThumbRequest.optFileOrBlob, relatedThumbnailId = optFileOrBlob && optFileOrBlob.qqThumbnailId, thumbnail = getThumbnail(id), spec = {
7099
+ customResizeFunction: queuedThumbRequest.customResizeFunction,
7100
+ maxSize: thumbnailMaxSize,
7101
+ orient: true,
7102
+ scale: true
7103
+ };
7104
+ if (qq.supportedFeatures.imagePreviews) {
7105
+ if (thumbnail) {
7106
+ if (options.limits.maxThumbs && options.limits.maxThumbs <= generatedThumbnails) {
7107
+ maybeSetDisplayNotAvailableImg(id, thumbnail);
7108
+ generateNextQueuedPreview();
7109
+ } else {
7110
+ displayWaitingImg(thumbnail).done(function() {
7111
+ previewGeneration[id] = new qq.Promise();
7112
+ previewGeneration[id].done(function() {
7113
+ setTimeout(generateNextQueuedPreview, options.limits.timeBetweenThumbs);
7114
+ });
7115
+ if (relatedThumbnailId != null) {
7116
+ useCachedPreview(id, relatedThumbnailId);
7117
+ } else {
7118
+ generateNewPreview(id, optFileOrBlob, spec);
7119
+ }
7120
+ });
7121
+ }
7122
+ } else {
7123
+ generateNextQueuedPreview();
7124
+ }
7125
+ } else if (thumbnail) {
7126
+ displayWaitingImg(thumbnail);
7127
+ generateNextQueuedPreview();
7128
+ }
7129
+ }, processUpdateQueuedPreviewRequest = function(queuedThumbRequest) {
7130
+ var id = queuedThumbRequest.id, thumbnailUrl = queuedThumbRequest.thumbnailUrl, showWaitingImg = queuedThumbRequest.showWaitingImg, thumbnail = getThumbnail(id), spec = {
7131
+ customResizeFunction: queuedThumbRequest.customResizeFunction,
7132
+ scale: serverScale,
7133
+ maxSize: thumbnailMaxSize
7134
+ };
7135
+ if (thumbnail) {
7136
+ if (thumbnailUrl) {
7137
+ if (options.limits.maxThumbs && options.limits.maxThumbs <= generatedThumbnails) {
7138
+ maybeSetDisplayNotAvailableImg(id, thumbnail);
7139
+ generateNextQueuedPreview();
7140
+ } else {
7141
+ if (showWaitingImg) {
7142
+ displayWaitingImg(thumbnail);
7143
+ }
7144
+ return options.imageGenerator.generate(thumbnailUrl, thumbnail, spec).then(function() {
7145
+ show(thumbnail);
7146
+ generatedThumbnails++;
7147
+ setTimeout(generateNextQueuedPreview, options.limits.timeBetweenThumbs);
7148
+ }, function() {
7149
+ maybeSetDisplayNotAvailableImg(id, thumbnail);
7150
+ setTimeout(generateNextQueuedPreview, options.limits.timeBetweenThumbs);
7151
+ });
7152
+ }
7153
+ } else {
7154
+ maybeSetDisplayNotAvailableImg(id, thumbnail);
7155
+ generateNextQueuedPreview();
7156
+ }
7157
+ }
7158
+ }, setProgressBarWidth = function(id, percent) {
7159
+ var bar = getProgress(id), progressBarSelector = id == null ? selectorClasses.totalProgressBar : selectorClasses.progressBar;
7160
+ if (bar && !qq(bar).hasClass(progressBarSelector)) {
7161
+ bar = qq(bar).getFirstByClass(progressBarSelector);
7162
+ }
7163
+ if (bar) {
7164
+ qq(bar).css({
7165
+ width: percent + "%"
7166
+ });
7167
+ bar.setAttribute("aria-valuenow", percent);
7168
+ }
7169
+ }, show = function(el) {
7170
+ el && qq(el).removeClass(options.classes.hide);
7171
+ }, useCachedPreview = function(targetThumbnailId, cachedThumbnailId) {
7172
+ var targetThumbnail = getThumbnail(targetThumbnailId), cachedThumbnail = getThumbnail(cachedThumbnailId);
7173
+ log(qq.format("ID {} is the same file as ID {}. Will use generated thumbnail from ID {} instead.", targetThumbnailId, cachedThumbnailId, cachedThumbnailId));
7174
+ previewGeneration[cachedThumbnailId].then(function() {
7175
+ generatedThumbnails++;
7176
+ previewGeneration[targetThumbnailId].success();
7177
+ log(qq.format("Now using previously generated thumbnail created for ID {} on ID {}.", cachedThumbnailId, targetThumbnailId));
7178
+ targetThumbnail.src = cachedThumbnail.src;
7179
+ show(targetThumbnail);
7180
+ }, function() {
7181
+ previewGeneration[targetThumbnailId].failure();
7182
+ if (!options.placeholders.waitUntilUpdate) {
7183
+ maybeSetDisplayNotAvailableImg(targetThumbnailId, targetThumbnail);
7184
+ }
7185
+ });
7186
+ };
7187
+ qq.extend(options, spec);
7188
+ log = options.log;
7189
+ if (!qq.supportedFeatures.imagePreviews) {
7190
+ options.limits.timeBetweenThumbs = 0;
7191
+ options.limits.maxThumbs = 0;
7192
+ }
7193
+ container = options.containerEl;
7194
+ showThumbnails = options.imageGenerator !== undefined;
7195
+ templateDom = parseAndGetTemplate();
7196
+ cacheThumbnailPlaceholders();
7197
+ qq.extend(this, {
7198
+ render: function() {
7199
+ log("Rendering template in DOM.");
7200
+ generatedThumbnails = 0;
7201
+ container.appendChild(templateDom.template.cloneNode(true));
7202
+ hide(getDropProcessing());
7203
+ this.hideTotalProgress();
7204
+ fileList = options.fileContainerEl || getTemplateEl(container, selectorClasses.list);
7205
+ log("Template rendering complete");
7206
+ },
7207
+ renderFailure: function(message) {
7208
+ var cantRenderEl = qq.toElement(message);
7209
+ container.innerHTML = "";
7210
+ container.appendChild(cantRenderEl);
7211
+ },
7212
+ reset: function() {
7213
+ container.innerHTML = "";
7214
+ this.render();
7215
+ },
7216
+ clearFiles: function() {
7217
+ fileList.innerHTML = "";
7218
+ },
7219
+ disableCancel: function() {
7220
+ isCancelDisabled = true;
7221
+ },
7222
+ addFile: function(id, name, prependInfo, hideForever, batch) {
7223
+ var fileEl = templateDom.fileTemplate.cloneNode(true), fileNameEl = getTemplateEl(fileEl, selectorClasses.file), uploaderEl = getTemplateEl(container, selectorClasses.uploader), fileContainer = batch ? fileBatch.content : fileList, thumb;
7224
+ if (batch) {
7225
+ fileBatch.map[id] = fileEl;
7226
+ }
7227
+ qq(fileEl).addClass(FILE_CLASS_PREFIX + id);
7228
+ uploaderEl.removeAttribute(DROPZPONE_TEXT_ATTR);
7229
+ if (fileNameEl) {
7230
+ qq(fileNameEl).setText(name);
7231
+ fileNameEl.setAttribute("title", name);
7232
+ }
7233
+ fileEl.setAttribute(FILE_ID_ATTR, id);
7234
+ if (prependInfo) {
7235
+ prependFile(fileEl, prependInfo.index, fileContainer);
7236
+ } else {
7237
+ fileContainer.appendChild(fileEl);
7238
+ }
7239
+ if (hideForever) {
7240
+ fileEl.style.display = "none";
7241
+ qq(fileEl).addClass(HIDDEN_FOREVER_CLASS);
7242
+ } else {
7243
+ hide(getProgress(id));
7244
+ hide(getSize(id));
7245
+ hide(getDelete(id));
7246
+ hide(getRetry(id));
7247
+ hide(getPause(id));
7248
+ hide(getContinue(id));
7249
+ if (isCancelDisabled) {
7250
+ this.hideCancel(id);
7251
+ }
7252
+ thumb = getThumbnail(id);
7253
+ if (thumb && !thumb.src) {
7254
+ cachedWaitingForThumbnailImg.then(function(waitingImg) {
7255
+ thumb.src = waitingImg.src;
7256
+ if (waitingImg.style.maxHeight && waitingImg.style.maxWidth) {
7257
+ qq(thumb).css({
7258
+ maxHeight: waitingImg.style.maxHeight,
7259
+ maxWidth: waitingImg.style.maxWidth
7260
+ });
7261
+ }
7262
+ show(thumb);
7263
+ });
7264
+ }
7265
+ }
7266
+ },
7267
+ addFileToCache: function(id, name, prependInfo, hideForever) {
7268
+ this.addFile(id, name, prependInfo, hideForever, true);
7269
+ },
7270
+ addCacheToDom: function() {
7271
+ fileList.appendChild(fileBatch.content);
7272
+ fileBatch.content = document.createDocumentFragment();
7273
+ fileBatch.map = {};
7274
+ },
7275
+ removeFile: function(id) {
7276
+ qq(getFile(id)).remove();
7277
+ },
7278
+ getFileId: function(el) {
7279
+ var currentNode = el;
7280
+ if (currentNode) {
7281
+ while (currentNode.getAttribute(FILE_ID_ATTR) == null) {
7282
+ currentNode = currentNode.parentNode;
7283
+ }
7284
+ return parseInt(currentNode.getAttribute(FILE_ID_ATTR));
7285
+ }
7286
+ },
7287
+ getFileList: function() {
7288
+ return fileList;
7289
+ },
7290
+ markFilenameEditable: function(id) {
7291
+ var filename = getFilename(id);
7292
+ filename && qq(filename).addClass(options.classes.editable);
7293
+ },
7294
+ updateFilename: function(id, name) {
7295
+ var filenameEl = getFilename(id);
7296
+ if (filenameEl) {
7297
+ qq(filenameEl).setText(name);
7298
+ filenameEl.setAttribute("title", name);
7299
+ }
7300
+ },
7301
+ hideFilename: function(id) {
7302
+ hide(getFilename(id));
7303
+ },
7304
+ showFilename: function(id) {
7305
+ show(getFilename(id));
7306
+ },
7307
+ isFileName: function(el) {
7308
+ return qq(el).hasClass(selectorClasses.file);
7309
+ },
7310
+ getButton: function() {
7311
+ return options.button || getTemplateEl(container, selectorClasses.button);
7312
+ },
7313
+ hideDropProcessing: function() {
7314
+ hide(getDropProcessing());
7315
+ },
7316
+ showDropProcessing: function() {
7317
+ show(getDropProcessing());
7318
+ },
7319
+ getDropZone: function() {
7320
+ return getTemplateEl(container, selectorClasses.drop);
7321
+ },
7322
+ isEditFilenamePossible: function() {
7323
+ return isEditElementsExist;
7324
+ },
7325
+ hideRetry: function(id) {
7326
+ hide(getRetry(id));
7327
+ },
7328
+ isRetryPossible: function() {
7329
+ return isRetryElementExist;
7330
+ },
7331
+ showRetry: function(id) {
7332
+ show(getRetry(id));
7333
+ },
7334
+ getFileContainer: function(id) {
7335
+ return getFile(id);
7336
+ },
7337
+ showEditIcon: function(id) {
7338
+ var icon = getEditIcon(id);
7339
+ icon && qq(icon).addClass(options.classes.editable);
7340
+ },
7341
+ isHiddenForever: function(id) {
7342
+ return qq(getFile(id)).hasClass(HIDDEN_FOREVER_CLASS);
7343
+ },
7344
+ hideEditIcon: function(id) {
7345
+ var icon = getEditIcon(id);
7346
+ icon && qq(icon).removeClass(options.classes.editable);
7347
+ },
7348
+ isEditIcon: function(el) {
7349
+ return qq(el).hasClass(selectorClasses.editNameIcon, true);
7350
+ },
7351
+ getEditInput: function(id) {
7352
+ return getTemplateEl(getFile(id), selectorClasses.editFilenameInput);
7353
+ },
7354
+ isEditInput: function(el) {
7355
+ return qq(el).hasClass(selectorClasses.editFilenameInput, true);
7356
+ },
7357
+ updateProgress: function(id, loaded, total) {
7358
+ var bar = getProgress(id), percent;
7359
+ if (bar && total > 0) {
7360
+ percent = Math.round(loaded / total * 100);
7361
+ if (percent === 100) {
7362
+ hide(bar);
7363
+ } else {
7364
+ show(bar);
7365
+ }
7366
+ setProgressBarWidth(id, percent);
7367
+ }
7368
+ },
7369
+ updateTotalProgress: function(loaded, total) {
7370
+ this.updateProgress(null, loaded, total);
7371
+ },
7372
+ hideProgress: function(id) {
7373
+ var bar = getProgress(id);
7374
+ bar && hide(bar);
7375
+ },
7376
+ hideTotalProgress: function() {
7377
+ this.hideProgress();
7378
+ },
7379
+ resetProgress: function(id) {
7380
+ setProgressBarWidth(id, 0);
7381
+ this.hideTotalProgress(id);
7382
+ },
7383
+ resetTotalProgress: function() {
7384
+ this.resetProgress();
7385
+ },
7386
+ showCancel: function(id) {
7387
+ if (!isCancelDisabled) {
7388
+ var cancel = getCancel(id);
7389
+ cancel && qq(cancel).removeClass(options.classes.hide);
7390
+ }
7391
+ },
7392
+ hideCancel: function(id) {
7393
+ hide(getCancel(id));
7394
+ },
7395
+ isCancel: function(el) {
7396
+ return qq(el).hasClass(selectorClasses.cancel, true);
7397
+ },
7398
+ allowPause: function(id) {
7399
+ show(getPause(id));
7400
+ hide(getContinue(id));
7401
+ },
7402
+ uploadPaused: function(id) {
7403
+ this.setStatusText(id, options.text.paused);
7404
+ this.allowContinueButton(id);
7405
+ hide(getSpinner(id));
7406
+ },
7407
+ hidePause: function(id) {
7408
+ hide(getPause(id));
7409
+ },
7410
+ isPause: function(el) {
7411
+ return qq(el).hasClass(selectorClasses.pause, true);
7412
+ },
7413
+ isContinueButton: function(el) {
7414
+ return qq(el).hasClass(selectorClasses.continueButton, true);
7415
+ },
7416
+ allowContinueButton: function(id) {
7417
+ show(getContinue(id));
7418
+ hide(getPause(id));
7419
+ },
7420
+ uploadContinued: function(id) {
7421
+ this.setStatusText(id, "");
7422
+ this.allowPause(id);
7423
+ show(getSpinner(id));
7424
+ },
7425
+ showDeleteButton: function(id) {
7426
+ show(getDelete(id));
7427
+ },
7428
+ hideDeleteButton: function(id) {
7429
+ hide(getDelete(id));
7430
+ },
7431
+ isDeleteButton: function(el) {
7432
+ return qq(el).hasClass(selectorClasses.deleteButton, true);
7433
+ },
7434
+ isRetry: function(el) {
7435
+ return qq(el).hasClass(selectorClasses.retry, true);
7436
+ },
7437
+ updateSize: function(id, text) {
7438
+ var size = getSize(id);
7439
+ if (size) {
7440
+ show(size);
7441
+ qq(size).setText(text);
7442
+ }
7443
+ },
7444
+ setStatusText: function(id, text) {
7445
+ var textEl = getTemplateEl(getFile(id), selectorClasses.statusText);
7446
+ if (textEl) {
7447
+ if (text == null) {
7448
+ qq(textEl).clearText();
7449
+ } else {
7450
+ qq(textEl).setText(text);
7451
+ }
7452
+ }
7453
+ },
7454
+ hideSpinner: function(id) {
7455
+ qq(getFile(id)).removeClass(IN_PROGRESS_CLASS);
7456
+ hide(getSpinner(id));
7457
+ },
7458
+ showSpinner: function(id) {
7459
+ qq(getFile(id)).addClass(IN_PROGRESS_CLASS);
7460
+ show(getSpinner(id));
7461
+ },
7462
+ generatePreview: function(id, optFileOrBlob, customResizeFunction) {
7463
+ if (!this.isHiddenForever(id)) {
7464
+ thumbGenerationQueue.push({
7465
+ id: id,
7466
+ customResizeFunction: customResizeFunction,
7467
+ optFileOrBlob: optFileOrBlob
7468
+ });
7469
+ !thumbnailQueueMonitorRunning && generateNextQueuedPreview();
7470
+ }
7471
+ },
7472
+ updateThumbnail: function(id, thumbnailUrl, showWaitingImg, customResizeFunction) {
7473
+ if (!this.isHiddenForever(id)) {
7474
+ thumbGenerationQueue.push({
7475
+ customResizeFunction: customResizeFunction,
7476
+ update: true,
7477
+ id: id,
7478
+ thumbnailUrl: thumbnailUrl,
7479
+ showWaitingImg: showWaitingImg
7480
+ });
7481
+ !thumbnailQueueMonitorRunning && generateNextQueuedPreview();
7482
+ }
7483
+ },
7484
+ hasDialog: function(type) {
7485
+ return qq.supportedFeatures.dialogElement && !!getDialog(type);
7486
+ },
7487
+ showDialog: function(type, message, defaultValue) {
7488
+ var dialog = getDialog(type), messageEl = getTemplateEl(dialog, selectorClasses.dialogMessage), inputEl = dialog.getElementsByTagName("INPUT")[0], cancelBtn = getTemplateEl(dialog, selectorClasses.dialogCancelButton), okBtn = getTemplateEl(dialog, selectorClasses.dialogOkButton), promise = new qq.Promise(), closeHandler = function() {
7489
+ cancelBtn.removeEventListener("click", cancelClickHandler);
7490
+ okBtn && okBtn.removeEventListener("click", okClickHandler);
7491
+ promise.failure();
7492
+ }, cancelClickHandler = function() {
7493
+ cancelBtn.removeEventListener("click", cancelClickHandler);
7494
+ dialog.close();
7495
+ }, okClickHandler = function() {
7496
+ dialog.removeEventListener("close", closeHandler);
7497
+ okBtn.removeEventListener("click", okClickHandler);
7498
+ dialog.close();
7499
+ promise.success(inputEl && inputEl.value);
7500
+ };
7501
+ dialog.addEventListener("close", closeHandler);
7502
+ cancelBtn.addEventListener("click", cancelClickHandler);
7503
+ okBtn && okBtn.addEventListener("click", okClickHandler);
7504
+ if (inputEl) {
7505
+ inputEl.value = defaultValue;
7506
+ }
7507
+ messageEl.textContent = message;
7508
+ dialog.showModal();
7509
+ return promise;
7510
+ }
7511
+ });
7512
+ };
7513
+ qq.UiEventHandler = function(s, protectedApi) {
7514
+ "use strict";
7515
+ var disposer = new qq.DisposeSupport(), spec = {
7516
+ eventType: "click",
7517
+ attachTo: null,
7518
+ onHandled: function(target, event) {}
7519
+ };
7520
+ qq.extend(this, {
7521
+ addHandler: function(element) {
7522
+ addHandler(element);
7523
+ },
7524
+ dispose: function() {
7525
+ disposer.dispose();
7526
+ }
7527
+ });
7528
+ function addHandler(element) {
7529
+ disposer.attach(element, spec.eventType, function(event) {
7530
+ event = event || window.event;
7531
+ var target = event.target || event.srcElement;
7532
+ spec.onHandled(target, event);
7533
+ });
7534
+ }
7535
+ qq.extend(protectedApi, {
7536
+ getFileIdFromItem: function(item) {
7537
+ return item.qqFileId;
7538
+ },
7539
+ getDisposeSupport: function() {
7540
+ return disposer;
7541
+ }
7542
+ });
7543
+ qq.extend(spec, s);
7544
+ if (spec.attachTo) {
7545
+ addHandler(spec.attachTo);
7546
+ }
7547
+ };
7548
+ qq.FileButtonsClickHandler = function(s) {
7549
+ "use strict";
7550
+ var inheritedInternalApi = {}, spec = {
7551
+ templating: null,
7552
+ log: function(message, lvl) {},
7553
+ onDeleteFile: function(fileId) {},
7554
+ onCancel: function(fileId) {},
7555
+ onRetry: function(fileId) {},
7556
+ onPause: function(fileId) {},
7557
+ onContinue: function(fileId) {},
7558
+ onGetName: function(fileId) {}
7559
+ }, buttonHandlers = {
7560
+ cancel: function(id) {
7561
+ spec.onCancel(id);
7562
+ },
7563
+ retry: function(id) {
7564
+ spec.onRetry(id);
7565
+ },
7566
+ deleteButton: function(id) {
7567
+ spec.onDeleteFile(id);
7568
+ },
7569
+ pause: function(id) {
7570
+ spec.onPause(id);
7571
+ },
7572
+ continueButton: function(id) {
7573
+ spec.onContinue(id);
7574
+ }
7575
+ };
7576
+ function examineEvent(target, event) {
7577
+ qq.each(buttonHandlers, function(buttonType, handler) {
7578
+ var firstLetterCapButtonType = buttonType.charAt(0).toUpperCase() + buttonType.slice(1), fileId;
7579
+ if (spec.templating["is" + firstLetterCapButtonType](target)) {
7580
+ fileId = spec.templating.getFileId(target);
7581
+ qq.preventDefault(event);
7582
+ spec.log(qq.format("Detected valid file button click event on file '{}', ID: {}.", spec.onGetName(fileId), fileId));
7583
+ handler(fileId);
7584
+ return false;
7585
+ }
7586
+ });
7587
+ }
7588
+ qq.extend(spec, s);
7589
+ spec.eventType = "click";
7590
+ spec.onHandled = examineEvent;
7591
+ spec.attachTo = spec.templating.getFileList();
7592
+ qq.extend(this, new qq.UiEventHandler(spec, inheritedInternalApi));
7593
+ };
7594
+ qq.FilenameClickHandler = function(s) {
7595
+ "use strict";
7596
+ var inheritedInternalApi = {}, spec = {
7597
+ templating: null,
7598
+ log: function(message, lvl) {},
7599
+ classes: {
7600
+ file: "qq-upload-file",
7601
+ editNameIcon: "qq-edit-filename-icon"
7602
+ },
7603
+ onGetUploadStatus: function(fileId) {},
7604
+ onGetName: function(fileId) {}
7605
+ };
7606
+ qq.extend(spec, s);
7607
+ function examineEvent(target, event) {
7608
+ if (spec.templating.isFileName(target) || spec.templating.isEditIcon(target)) {
7609
+ var fileId = spec.templating.getFileId(target), status = spec.onGetUploadStatus(fileId);
7610
+ if (status === qq.status.SUBMITTED) {
7611
+ spec.log(qq.format("Detected valid filename click event on file '{}', ID: {}.", spec.onGetName(fileId), fileId));
7612
+ qq.preventDefault(event);
7613
+ inheritedInternalApi.handleFilenameEdit(fileId, target, true);
7614
+ }
7615
+ }
7616
+ }
7617
+ spec.eventType = "click";
7618
+ spec.onHandled = examineEvent;
7619
+ qq.extend(this, new qq.FilenameEditHandler(spec, inheritedInternalApi));
7620
+ };
7621
+ qq.FilenameInputFocusInHandler = function(s, inheritedInternalApi) {
7622
+ "use strict";
7623
+ var spec = {
7624
+ templating: null,
7625
+ onGetUploadStatus: function(fileId) {},
7626
+ log: function(message, lvl) {}
7627
+ };
7628
+ if (!inheritedInternalApi) {
7629
+ inheritedInternalApi = {};
7630
+ }
7631
+ function handleInputFocus(target, event) {
7632
+ if (spec.templating.isEditInput(target)) {
7633
+ var fileId = spec.templating.getFileId(target), status = spec.onGetUploadStatus(fileId);
7634
+ if (status === qq.status.SUBMITTED) {
7635
+ spec.log(qq.format("Detected valid filename input focus event on file '{}', ID: {}.", spec.onGetName(fileId), fileId));
7636
+ inheritedInternalApi.handleFilenameEdit(fileId, target);
7637
+ }
7638
+ }
7639
+ }
7640
+ spec.eventType = "focusin";
7641
+ spec.onHandled = handleInputFocus;
7642
+ qq.extend(spec, s);
7643
+ qq.extend(this, new qq.FilenameEditHandler(spec, inheritedInternalApi));
7644
+ };
7645
+ qq.FilenameInputFocusHandler = function(spec) {
7646
+ "use strict";
7647
+ spec.eventType = "focus";
7648
+ spec.attachTo = null;
7649
+ qq.extend(this, new qq.FilenameInputFocusInHandler(spec, {}));
7650
+ };
7651
+ qq.FilenameEditHandler = function(s, inheritedInternalApi) {
7652
+ "use strict";
7653
+ var spec = {
7654
+ templating: null,
7655
+ log: function(message, lvl) {},
7656
+ onGetUploadStatus: function(fileId) {},
7657
+ onGetName: function(fileId) {},
7658
+ onSetName: function(fileId, newName) {},
7659
+ onEditingStatusChange: function(fileId, isEditing) {}
7660
+ };
7661
+ function getFilenameSansExtension(fileId) {
7662
+ var filenameSansExt = spec.onGetName(fileId), extIdx = filenameSansExt.lastIndexOf(".");
7663
+ if (extIdx > 0) {
7664
+ filenameSansExt = filenameSansExt.substr(0, extIdx);
7665
+ }
7666
+ return filenameSansExt;
7667
+ }
7668
+ function getOriginalExtension(fileId) {
7669
+ var origName = spec.onGetName(fileId);
7670
+ return qq.getExtension(origName);
7671
+ }
7672
+ function handleNameUpdate(newFilenameInputEl, fileId) {
7673
+ var newName = newFilenameInputEl.value, origExtension;
7674
+ if (newName !== undefined && qq.trimStr(newName).length > 0) {
7675
+ origExtension = getOriginalExtension(fileId);
7676
+ if (origExtension !== undefined) {
7677
+ newName = newName + "." + origExtension;
7678
+ }
7679
+ spec.onSetName(fileId, newName);
7680
+ }
7681
+ spec.onEditingStatusChange(fileId, false);
7682
+ }
7683
+ function registerInputBlurHandler(inputEl, fileId) {
7684
+ inheritedInternalApi.getDisposeSupport().attach(inputEl, "blur", function() {
7685
+ handleNameUpdate(inputEl, fileId);
7686
+ });
7687
+ }
7688
+ function registerInputEnterKeyHandler(inputEl, fileId) {
7689
+ inheritedInternalApi.getDisposeSupport().attach(inputEl, "keyup", function(event) {
7690
+ var code = event.keyCode || event.which;
7691
+ if (code === 13) {
7692
+ handleNameUpdate(inputEl, fileId);
7693
+ }
7694
+ });
7695
+ }
7696
+ qq.extend(spec, s);
7697
+ spec.attachTo = spec.templating.getFileList();
7698
+ qq.extend(this, new qq.UiEventHandler(spec, inheritedInternalApi));
7699
+ qq.extend(inheritedInternalApi, {
7700
+ handleFilenameEdit: function(id, target, focusInput) {
7701
+ var newFilenameInputEl = spec.templating.getEditInput(id);
7702
+ spec.onEditingStatusChange(id, true);
7703
+ newFilenameInputEl.value = getFilenameSansExtension(id);
7704
+ if (focusInput) {
7705
+ newFilenameInputEl.focus();
7706
+ }
7707
+ registerInputBlurHandler(newFilenameInputEl, id);
7708
+ registerInputEnterKeyHandler(newFilenameInputEl, id);
7709
+ }
7710
+ });
7711
+ };
7712
+ })(window);
7713
+ //# sourceMappingURL=jquery.fine-uploader.js.map
inc/exopite-simple-options/assets/dev/jquery.interdependencies.js ADDED
@@ -0,0 +1,617 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * jQuery Interdependencies library
3
+ *
4
+ * http://miohtama.github.com/jquery-interdependencies/
5
+ *
6
+ * Copyright 2012-2013 Mikko Ohtamaa, others
7
+ */
8
+
9
+ /*global console, window*/
10
+
11
+ (function($) {
12
+
13
+ "use strict";
14
+
15
+ /**
16
+ * Microsoft safe helper to spit out our little diagnostics information
17
+ *
18
+ * @ignore
19
+ */
20
+ function log(msg) {
21
+ if(window.console && window.console.log) {
22
+ console.log(msg);
23
+ }
24
+ }
25
+
26
+
27
+ /**
28
+ * jQuery.find() workaround for IE7
29
+ *
30
+ * If your selector is an pure tag id (#foo) IE7 finds nothing
31
+ * if you do jQuery.find() in a specific jQuery context.
32
+ *
33
+ * This workaround makes a (false) assumptions
34
+ * ids are always unique across the page.
35
+ *
36
+ * @ignore
37
+ *
38
+ * @param {jQuery} context jQuery context where we look child elements
39
+ * @param {String} selector selector as a string
40
+ * @return {jQuery} context.find() result
41
+ */
42
+ function safeFind(context, selector) {
43
+
44
+ if(selector[0] == "#") {
45
+
46
+ // Pseudo-check that this is a simple id selector
47
+ // and not a complex jQuery selector
48
+ if(selector.indexOf(" ") < 0) {
49
+ return $(selector);
50
+ }
51
+ }
52
+
53
+ return context.find(selector);
54
+ }
55
+
56
+ /**
57
+ * Sample configuration object which can be passed to {@link jQuery.deps#enable}
58
+ *
59
+ * @class Configuration
60
+ */
61
+ var configExample = {
62
+
63
+ /**
64
+ * @cfg show Callback function show(elem) for showing elements
65
+ * @type {Function}
66
+ */
67
+ show : null,
68
+
69
+ /**
70
+ * @cfg hide Callback function hide(elem) for hiding elements
71
+ * @type {Function}
72
+ */
73
+ hide : null,
74
+
75
+ /**
76
+ * @cfg log Write console.log() output of rule applying
77
+ * @type {Boolean}
78
+ */
79
+ log : false,
80
+
81
+
82
+ /**
83
+ * @cfg checkTargets When ruleset is enabled, check that all controllers and controls referred by ruleset exist on the page.
84
+ *
85
+ * @default true
86
+ *
87
+ * @type {Boolean}
88
+ */
89
+ checkTargets : true
90
+
91
+ };
92
+
93
+ /**
94
+ * Define one field inter-dependency rule.
95
+ *
96
+ * When condition is true then this input and all
97
+ * its children rules' inputs are visible.
98
+ *
99
+ * Possible condition strings:
100
+ *
101
+ * * **==** Widget value must be equal to given value
102
+ *
103
+ * * **any** Widget value must be any of the values in the given value array
104
+ *
105
+ * * **non-any** Widget value must not be any of the values in the given value array
106
+ *
107
+ * * **!=** Widget value must not be qual to given value
108
+ *
109
+ * * **()** Call value as a function(context, controller, ourWidgetValue) and if it's true then the condition is true
110
+ *
111
+ * * **null** This input does not have any sub-conditions
112
+ *
113
+ *
114
+ *
115
+ */
116
+ function Rule(controller, condition, value) {
117
+ this.init(controller, condition, value);
118
+ }
119
+
120
+ $.extend(Rule.prototype, {
121
+
122
+ /**
123
+ * @method constructor
124
+ *
125
+ * @param {String} controller jQuery expression to match the `<input>` source
126
+ *
127
+ * @param {String} condition What input value must be that {@link Rule the rule takes effective}.
128
+ *
129
+ * @param value Matching value of **controller** when widgets become visible
130
+ *
131
+ */
132
+ init : function(controller, condition, value) {
133
+ this.controller = controller;
134
+
135
+ this.condition = condition;
136
+
137
+ this.value = value;
138
+
139
+ // Child rules
140
+ this.rules = [];
141
+
142
+ // Controls shown/hidden by this rule
143
+ this.controls = [];
144
+ },
145
+
146
+ /**
147
+ * Evaluation engine
148
+ *
149
+ * @param {String} condition Any of given conditions in Rule class description
150
+ * @param {Object} val1 The base value we compare against
151
+ * @param {Object} val2 Something we got out of input
152
+ * @return {Boolean} true or false
153
+ */
154
+ evalCondition : function(context, control, condition, val1, val2) {
155
+
156
+ /**
157
+ *
158
+ * Codestar Framework
159
+ * Added new condition for Codestar Framework
160
+ *
161
+ * @since 1.0.0
162
+ * @version 1.0.0
163
+ *
164
+ */
165
+ if(condition == "==" || condition == "OR") {
166
+ return this.checkBoolean(val1) == this.checkBoolean(val2);
167
+ } else if(condition == "!=") {
168
+ return this.checkBoolean(val1) != this.checkBoolean(val2);
169
+ } else if(condition == ">=") {
170
+ return Number(val2) >= Number(val1);
171
+ } else if(condition == "<=") {
172
+ return Number(val2) <= Number(val1);
173
+ } else if(condition == ">") {
174
+ return Number(val2) > Number(val1);
175
+ } else if(condition == "<") {
176
+ return Number(val2) < Number(val1);
177
+ } else if(condition == "()") {
178
+ return window[val1](context, control, val2); // FIXED: function method
179
+ } else if(condition == "any") {
180
+ return $.inArray(val2, val1.split(',')) > -1;
181
+ } else if(condition == "not-any") {
182
+ return $.inArray(val2, val1.split(',')) == -1;
183
+ } else {
184
+ throw new Error("Unknown condition:" + condition);
185
+ }
186
+
187
+ },
188
+
189
+ /**
190
+ *
191
+ * Codestar Framework
192
+ * Added Boolean value type checker
193
+ *
194
+ * @since 1.0.0
195
+ * @version 1.0.0
196
+ *
197
+ */
198
+ checkBoolean: function(value) {
199
+
200
+ switch(value) {
201
+
202
+ case true:
203
+ case 'true':
204
+ case 1:
205
+ case '1':
206
+ //case 'on':
207
+ //case 'yes':
208
+ value = true;
209
+ break;
210
+
211
+ case false:
212
+ case 'false':
213
+ case 0:
214
+ case '0':
215
+ //case 'off':
216
+ //case 'no':
217
+ value = false;
218
+ break;
219
+
220
+ }
221
+
222
+ return value;
223
+ },
224
+
225
+ /**
226
+ * Evaluate the condition of this rule in given jQuery context.
227
+ *
228
+ * The widget value is extracted using getControlValue()
229
+ *
230
+ * @param {jQuery} context The jQuery selection in which this rule is evaluated.
231
+ *
232
+ */
233
+ checkCondition : function(context, cfg) {
234
+
235
+ // We do not have condition set, we are always true
236
+ if(!this.condition) {
237
+ return true;
238
+ }
239
+
240
+ var control = context.find(this.controller);
241
+ if(control.size() === 0 && cfg.log) {
242
+ log("Evaling condition: Could not find controller input " + this.controller);
243
+ }
244
+
245
+ var val = this.getControlValue(context, control);
246
+ if(cfg.log && val === undefined) {
247
+ log("Evaling condition: Could not exctract value from input " + this.controller);
248
+ }
249
+
250
+ if(val === undefined) {
251
+ return false;
252
+ }
253
+
254
+ val = this.normalizeValue(control, this.value, val);
255
+
256
+ return this.evalCondition(context, control, this.condition, this.value, val);
257
+ },
258
+
259
+ /**
260
+ * Make sure that what we read from input field is comparable against Javascript primitives
261
+ *
262
+ */
263
+ normalizeValue : function(control, baseValue, val) {
264
+
265
+ if(typeof baseValue == "number") {
266
+ // Make sure we compare numbers against numbers
267
+ return parseFloat(val);
268
+ }
269
+
270
+ return val;
271
+ },
272
+
273
+ /**
274
+ * Read value from a diffent HTML controls.
275
+ *
276
+ * Handle, text, checkbox, radio, select.
277
+ *
278
+ */
279
+ getControlValue : function(context, control) {
280
+
281
+ /**
282
+ *
283
+ * Codestar Framework
284
+ * Added multiple checkbox value control
285
+ *
286
+ * @since 1.0.0
287
+ * @version 1.0.0
288
+ *
289
+ */
290
+ if( ( control.attr("type") == "radio" || control.attr("type") == "checkbox" ) && control.size() > 1 ) {
291
+ return control.filter(":checked").val();
292
+ }
293
+
294
+ // Handle individual checkboxes & radio
295
+ if ( control.attr("type") == "checkbox" || control.attr("type") == "radio" ) {
296
+ return control.is(":checked");
297
+ }
298
+
299
+ return control.val();
300
+
301
+ },
302
+
303
+ /**
304
+ * Create a sub-rule.
305
+ *
306
+ * Example:
307
+ *
308
+ * var masterSwitch = ruleset.createRule("#mechanicalThrombectomyDevice")
309
+ * var twoAttempts = masterSwitch.createRule("#numberOfAttempts", "==", 2);
310
+ *
311
+ * @return Rule instance
312
+ */
313
+ createRule : function(controller, condition, value) {
314
+ var rule = new Rule(controller, condition, value);
315
+ this.rules.push(rule);
316
+ return rule;
317
+ },
318
+
319
+ /**
320
+ * Include a control in this rule.
321
+ *
322
+ * @param {String} input jQuery expression to match the input within ruleset context
323
+ */
324
+ include : function(input) {
325
+
326
+ if(!input) {
327
+ throw new Error("Must give an input selector");
328
+ }
329
+
330
+ this.controls.push(input);
331
+ },
332
+
333
+ /**
334
+ * Apply this rule to all controls in the given context
335
+ *
336
+ * @param {jQuery} context jQuery selection within we operate
337
+ * @param {Object} cfg {@link Configuration} object or undefined
338
+ * @param {Object} enforced Recursive rule enforcer: undefined to evaluate condition, true show always, false hide always
339
+ *
340
+ */
341
+ applyRule : function(context, cfg, enforced) {
342
+
343
+ var result;
344
+
345
+ if(enforced === undefined) {
346
+ result = this.checkCondition(context, cfg);
347
+ } else {
348
+ result = enforced;
349
+ }
350
+
351
+ if(cfg.log) {
352
+ log("Applying rule on " + this.controller + "==" + this.value + " enforced:" + enforced + " result:" + result);
353
+ }
354
+
355
+ if(cfg.log && !this.controls.length) {
356
+ log("Zero length controls slipped through");
357
+ }
358
+
359
+ // Get show/hide callback functions
360
+
361
+ var show = cfg.show || function(control) {
362
+ control.show();
363
+ };
364
+
365
+ var hide = cfg.hide || function(control) {
366
+ control.hide();
367
+ };
368
+
369
+
370
+ // Resolve controls from ids to jQuery selections
371
+ // we are controlling in this context
372
+ var controls = $.map(this.controls, function(elem, idx) {
373
+ var control = context.find(elem);
374
+ if(cfg.log && control.size() === 0) {
375
+ log("Could not find element:" + elem);
376
+ }
377
+ return control;
378
+ });
379
+
380
+ if(result) {
381
+
382
+ $(controls).each(function() {
383
+
384
+
385
+ // Some friendly debug info
386
+ if(cfg.log && $(this).size() === 0) {
387
+ log("Control selection is empty when showing");
388
+ log(this);
389
+ }
390
+
391
+ show(this);
392
+ });
393
+
394
+ // Evaluate all child rules
395
+ $(this.rules).each(function() {
396
+ if(this.condition !== "OR"){
397
+ this.applyRule(context, cfg);
398
+ }
399
+ });
400
+
401
+ } else {
402
+
403
+ $(controls).each(function() {
404
+
405
+ // Some friendly debug info
406
+ if(cfg.log && $(this).size() === 0) {
407
+ log("Control selection is empty when hiding:");
408
+ log(this);
409
+ }
410
+
411
+ hide(this);
412
+ });
413
+
414
+ // Supress all child rules
415
+ $(this.rules).each(function() {
416
+ if(this.condition !== "OR"){
417
+ this.applyRule(context, cfg, false);
418
+ } else {
419
+ this.applyRule(context, cfg);
420
+ }
421
+ });
422
+ }
423
+ }
424
+ });
425
+
426
+ /**
427
+ * A class which manages interdependenice rules.
428
+ */
429
+ function Ruleset() {
430
+
431
+ // Hold a tree of rules
432
+ this.rules = [];
433
+ }
434
+
435
+ $.extend(Ruleset.prototype, {
436
+
437
+ /**
438
+ * Add a new rule into this ruletset.
439
+ *
440
+ * See {@link Rule} about the contstruction parameters.
441
+ * @return {Rule}
442
+ */
443
+ createRule : function(controller, condition, value) {
444
+ var rule = new Rule(controller, condition, value);
445
+ this.rules.push(rule);
446
+ return rule;
447
+ },
448
+
449
+ /**
450
+ * Apply these rules on an element.
451
+ *
452
+ * @param {jQuery} context Selection we are dealing with
453
+ *
454
+ * @param cfg {@link Configuration} object or undefined.
455
+ */
456
+ applyRules: function(context, cfg) {
457
+ var i;
458
+
459
+ cfg = cfg || {};
460
+
461
+ if(cfg.log) {
462
+ log("Starting evaluation ruleset of " + this.rules.length + " rules");
463
+ }
464
+
465
+ for(i=0; i<this.rules.length; i++) {
466
+ this.rules[i].applyRule(context, cfg);
467
+ }
468
+ },
469
+
470
+ /**
471
+ * Walk all rules and sub-rules in this ruleset
472
+ * @param {Function} callback(rule)
473
+ *
474
+ * @return {Array} Rules as depth-first searched
475
+ */
476
+ walk : function() {
477
+
478
+ var rules = [];
479
+
480
+ function descent(rule) {
481
+
482
+ rules.push(rule);
483
+
484
+ $(rule.children).each(function() {
485
+ descent(this);
486
+ });
487
+ }
488
+
489
+ $(this.rules).each(function() {
490
+ descent(this);
491
+ });
492
+
493
+ return rules;
494
+ },
495
+
496
+
497
+ /**
498
+ * Check that all controllers and controls referred in ruleset exist.
499
+ *
500
+ * Throws an Error if any of them are missing.
501
+ *
502
+ * @param {jQuery} context jQuery selection of items
503
+ *
504
+ * @param {Configuration} cfg
505
+ */
506
+ checkTargets : function(context, cfg) {
507
+
508
+ var controls = 0;
509
+ var rules = this.walk();
510
+
511
+ $(rules).each(function() {
512
+
513
+ if(context.find(this.controller).size() === 0) {
514
+ throw new Error("Rule's controller does not exist:" + this.controller);
515
+ }
516
+
517
+ if(this.controls.length === 0) {
518
+ throw new Error("Rule has no controls:" + this);
519
+ }
520
+
521
+ $(this.controls).each(function() {
522
+
523
+ if(safeFind(context, this) === 0) {
524
+ throw new Error("Rule's target control " + this + " does not exist in context " + context.get(0));
525
+ }
526
+
527
+ controls++;
528
+ });
529
+
530
+ });
531
+
532
+ if(cfg.log) {
533
+ log("Controller check ok, rules count " + rules.length + " controls count " + controls);
534
+ }
535
+
536
+ },
537
+
538
+ /**
539
+ * Make this ruleset effective on the whole page.
540
+ *
541
+ * Set event handler on **window.document** to catch all input events
542
+ * and apply those events to defined rules.
543
+ *
544
+ * @param {Configuration} cfg {@link Configuration} object or undefined
545
+ *
546
+ */
547
+ install : function(cfg) {
548
+ $.deps.enable($(document.body), this, cfg);
549
+ }
550
+
551
+ });
552
+
553
+ /**
554
+ * jQuery interdependencie plug-in
555
+ *
556
+ * @class jQuery.deps
557
+ *
558
+ */
559
+ var deps = {
560
+
561
+ /**
562
+ * Create a new Ruleset instance.
563
+ *
564
+ * Example:
565
+ *
566
+ * $(document).ready(function() {
567
+ * // Start creating a new ruleset
568
+ * var ruleset = $.deps.createRuleset();
569
+ *
570
+ *
571
+ * @return {Ruleset}
572
+ */
573
+ createRuleset : function() {
574
+ return new Ruleset();
575
+ },
576
+
577
+
578
+ /**
579
+ * Enable ruleset on a specific jQuery selection.
580
+ *
581
+ * Checks the existince of all ruleset controllers and controls
582
+ * by default (see config).
583
+ *
584
+ * See possible IE event bubbling problems: http://stackoverflow.com/q/265074/315168
585
+ *
586
+ * @param {Object} selection jQuery selection in where we monitor all change events. All controls and controllers must exist within this selection.
587
+ * @param {Ruleset} ruleset
588
+ * @param {Configuration} cfg
589
+ */
590
+ enable : function(selection, ruleset, cfg) {
591
+
592
+ cfg = cfg || {};
593
+
594
+ if(cfg.checkTargets || cfg.checkTargets === undefined) {
595
+ ruleset.checkTargets(selection, cfg);
596
+ }
597
+
598
+ var self = this;
599
+
600
+ if(cfg.log) {
601
+ log("Enabling dependency change monitoring on " + selection.get(0));
602
+ }
603
+
604
+ // Namespace our handler to avoid conflicts
605
+ //
606
+ var handler = function() { ruleset.applyRules(selection, cfg); };
607
+ var val = selection.on ? selection.on("change.deps", null, null, handler) : selection.live("change.deps", handler);
608
+
609
+ ruleset.applyRules(selection, cfg);
610
+
611
+ return val;
612
+ }
613
+ };
614
+
615
+ $.deps = deps;
616
+
617
+ })(jQuery);
inc/exopite-simple-options/assets/dev/jquery.minicolors.css ADDED
@@ -0,0 +1,432 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .minicolors {
2
+ position: relative;
3
+ }
4
+
5
+ .minicolors-sprite {
6
+ background-image: url(jquery.minicolors.png);
7
+ }
8
+
9
+ .minicolors-swatch {
10
+ position: absolute;
11
+ vertical-align: middle;
12
+ background-position: -80px 0;
13
+ border: solid 1px #ccc;
14
+ cursor: text;
15
+ padding: 0;
16
+ margin: 0;
17
+ display: inline-block;
18
+ }
19
+
20
+ .minicolors-swatch-color {
21
+ position: absolute;
22
+ top: 0;
23
+ left: 0;
24
+ right: 0;
25
+ bottom: 0;
26
+ }
27
+
28
+ .minicolors input[type=hidden] + .minicolors-swatch {
29
+ width: 28px;
30
+ position: static;
31
+ cursor: pointer;
32
+ }
33
+
34
+ .minicolors input[type=hidden][disabled] + .minicolors-swatch {
35
+ cursor: default;
36
+ }
37
+
38
+ /* Panel */
39
+ .minicolors-panel {
40
+ position: absolute;
41
+ width: 173px;
42
+ background: white;
43
+ border: solid 1px #CCC;
44
+ box-shadow: 0 0 20px rgba(0, 0, 0, .2);
45
+ z-index: 99999;
46
+ box-sizing: content-box;
47
+ display: none;
48
+ }
49
+
50
+ .minicolors-panel.minicolors-visible {
51
+ display: block;
52
+ }
53
+
54
+ /* Panel positioning */
55
+ .minicolors-position-top .minicolors-panel {
56
+ top: -154px;
57
+ }
58
+
59
+ .minicolors-position-right .minicolors-panel {
60
+ right: 0;
61
+ }
62
+
63
+ .minicolors-position-bottom .minicolors-panel {
64
+ top: auto;
65
+ }
66
+
67
+ .minicolors-position-left .minicolors-panel {
68
+ left: 0;
69
+ }
70
+
71
+ .minicolors-with-opacity .minicolors-panel {
72
+ width: 194px;
73
+ }
74
+
75
+ .minicolors .minicolors-grid {
76
+ position: relative;
77
+ top: 1px;
78
+ left: 1px; /* LTR */
79
+ width: 150px;
80
+ height: 150px;
81
+ margin-bottom: 2px;
82
+ background-position: -120px 0;
83
+ cursor: crosshair;
84
+ }
85
+ [dir=rtl] .minicolors .minicolors-grid {
86
+ right: 1px;
87
+ }
88
+
89
+ .minicolors .minicolors-grid-inner {
90
+ position: absolute;
91
+ top: 0;
92
+ left: 0;
93
+ width: 150px;
94
+ height: 150px;
95
+ }
96
+
97
+ .minicolors-slider-saturation .minicolors-grid {
98
+ background-position: -420px 0;
99
+ }
100
+
101
+ .minicolors-slider-saturation .minicolors-grid-inner {
102
+ background-position: -270px 0;
103
+ background-image: inherit;
104
+ }
105
+
106
+ .minicolors-slider-brightness .minicolors-grid {
107
+ background-position: -570px 0;
108
+ }
109
+
110
+ .minicolors-slider-brightness .minicolors-grid-inner {
111
+ background-color: black;
112
+ }
113
+
114
+ .minicolors-slider-wheel .minicolors-grid {
115
+ background-position: -720px 0;
116
+ }
117
+
118
+ .minicolors-slider,
119
+ .minicolors-opacity-slider {
120
+ position: absolute;
121
+ top: 1px;
122
+ left: 152px; /* LTR */
123
+ width: 20px;
124
+ height: 150px;
125
+ background-color: white;
126
+ background-position: 0 0;
127
+ cursor: row-resize;
128
+ }
129
+ [dir=rtl] .minicolors-slider,
130
+ [dir=rtl] .minicolors-opacity-slider {
131
+ right: 152px;
132
+ }
133
+
134
+ .minicolors-slider-saturation .minicolors-slider {
135
+ background-position: -60px 0;
136
+ }
137
+
138
+ .minicolors-slider-brightness .minicolors-slider {
139
+ background-position: -20px 0;
140
+ }
141
+
142
+ .minicolors-slider-wheel .minicolors-slider {
143
+ background-position: -20px 0;
144
+ }
145
+
146
+ .minicolors-opacity-slider {
147
+ left: 173px; /* LTR */
148
+ background-position: -40px 0;
149
+ display: none;
150
+ }
151
+ [dir=rtl] .minicolors-opacity-slider {
152
+ right: 173px;
153
+ }
154
+
155
+ .minicolors-with-opacity .minicolors-opacity-slider {
156
+ display: block;
157
+ }
158
+
159
+ /* Pickers */
160
+ .minicolors-grid .minicolors-picker {
161
+ position: absolute;
162
+ top: 70px;
163
+ left: 70px;
164
+ width: 12px;
165
+ height: 12px;
166
+ border: solid 1px black;
167
+ border-radius: 10px;
168
+ margin-top: -6px;
169
+ margin-left: -6px;
170
+ background: none;
171
+ }
172
+
173
+ .minicolors-grid .minicolors-picker > div {
174
+ position: absolute;
175
+ top: 0;
176
+ left: 0;
177
+ width: 8px;
178
+ height: 8px;
179
+ border-radius: 8px;
180
+ border: solid 2px white;
181
+ box-sizing: content-box;
182
+ }
183
+
184
+ .minicolors-picker {
185
+ position: absolute;
186
+ top: 0;
187
+ left: 0;
188
+ width: 18px;
189
+ height: 2px;
190
+ background: white;
191
+ border: solid 1px black;
192
+ margin-top: -2px;
193
+ box-sizing: content-box;
194
+ }
195
+
196
+ /* Swatches */
197
+ .minicolors-swatches,
198
+ .minicolors-swatches li {
199
+ margin: 5px 0 3px 5px; /* LTR */
200
+ padding: 0;
201
+ list-style: none;
202
+ overflow: hidden;
203
+ }
204
+ [dir=rtl] .minicolors-swatches,
205
+ [dir=rtl] .minicolors-swatches li {
206
+ margin: 5px 5px 3px 0;
207
+ }
208
+
209
+ .minicolors-swatches .minicolors-swatch {
210
+ position: relative;
211
+ float: left; /* LTR */
212
+ cursor: pointer;
213
+ margin:0 4px 0 0; /* LTR */
214
+ }
215
+ [dir=rtl] .minicolors-swatches .minicolors-swatch {
216
+ float: right;
217
+ margin:0 0 0 4px;
218
+ }
219
+
220
+ .minicolors-with-opacity .minicolors-swatches .minicolors-swatch {
221
+ margin-right: 7px; /* LTR */
222
+ }
223
+ [dir=rtl] .minicolors-with-opacity .minicolors-swatches .minicolors-swatch {
224
+ margin-right: 0;
225
+ margin-left: 7px;
226
+ }
227
+
228
+ .minicolors-swatch.selected {
229
+ border-color: #000;
230
+ }
231
+
232
+ /* Inline controls */
233
+ .minicolors-inline {
234
+ display: inline-block;
235
+ }
236
+
237
+ .minicolors-inline .minicolors-input {
238
+ display: none !important;
239
+ }
240
+
241
+ .minicolors-inline .minicolors-panel {
242
+ position: relative;
243
+ top: auto;
244
+ left: auto; /* LTR */
245
+ box-shadow: none;
246
+ z-index: auto;
247
+ display: inline-block;
248
+ }
249
+ [dir=rtl] .minicolors-inline .minicolors-panel {
250
+ right: auto;
251
+ }
252
+
253
+ /* Default theme */
254
+ .minicolors-theme-default .minicolors-swatch {
255
+ top: 5px;
256
+ left: 5px; /* LTR */
257
+ width: 18px;
258
+ height: 18px;
259
+ }
260
+ [dir=rtl] .minicolors-theme-default .minicolors-swatch {
261
+ right: 5px;
262
+ }
263
+ .minicolors-theme-default .minicolors-swatches .minicolors-swatch {
264
+ margin-bottom: 2px;
265
+ top: 0;
266
+ left: 0; /* LTR */
267
+ width: 18px;
268
+ height: 18px;
269
+ }
270
+ [dir=rtl] .minicolors-theme-default .minicolors-swatches .minicolors-swatch {
271
+ right: 0;
272
+ }
273
+ .minicolors-theme-default.minicolors-position-right .minicolors-swatch {
274
+ left: auto; /* LTR */
275
+ right: 5px; /* LTR */
276
+ }
277
+ [dir=rtl] .minicolors-theme-default.minicolors-position-left .minicolors-swatch {
278
+ right: auto;
279
+ left: 5px;
280
+ }
281
+ .minicolors-theme-default.minicolors {
282
+ width: auto;
283
+ display: inline-block;
284
+ }
285
+ .minicolors-theme-default .minicolors-input {
286
+ height: 20px;
287
+ width: auto;
288
+ display: inline-block;
289
+ padding-left: 26px; /* LTR */
290
+ }
291
+ [dir=rtl] .minicolors-theme-default .minicolors-input {
292
+ text-align: right;
293
+ unicode-bidi: plaintext;
294
+ padding-left: 1px;
295
+ padding-right: 26px;
296
+ }
297
+ .minicolors-theme-default.minicolors-position-right .minicolors-input {
298
+ padding-right: 26px; /* LTR */
299
+ padding-left: inherit; /* LTR */
300
+ }
301
+ [dir=rtl] .minicolors-theme-default.minicolors-position-left .minicolors-input {
302
+ padding-right: inherit;
303
+ padding-left: 26px;
304
+ }
305
+
306
+ /* Bootstrap theme */
307
+ .minicolors-theme-bootstrap .minicolors-swatch {
308
+ z-index: 2;
309
+ top: 3px;
310
+ left: 3px; /* LTR */
311
+ width: 28px;
312
+ height: 28px;
313
+ border-radius: 3px;
314
+ }
315
+ [dir=rtl] .minicolors-theme-bootstrap .minicolors-swatch {
316
+ right: 3px;
317
+ }
318
+ .minicolors-theme-bootstrap .minicolors-swatches .minicolors-swatch {
319
+ margin-bottom: 2px;
320
+ top: 0;
321
+ left: 0; /* LTR */
322
+ width: 20px;
323
+ height: 20px;
324
+ }
325
+ [dir=rtl] .minicolors-theme-bootstrap .minicolors-swatches .minicolors-swatch {
326
+ right: 0;
327
+ }
328
+ .minicolors-theme-bootstrap .minicolors-swatch-color {
329
+ border-radius: inherit;
330
+ }
331
+ .minicolors-theme-bootstrap.minicolors-position-right > .minicolors-swatch {
332
+ left: auto; /* LTR */
333
+ right: 3px; /* LTR */
334
+ }
335
+ [dir=rtl] .minicolors-theme-bootstrap.minicolors-position-left > .minicolors-swatch {
336
+ right: auto;
337
+ left: 3px;
338
+ }
339
+ .minicolors-theme-bootstrap .minicolors-input {
340
+ float: none;
341
+ padding-left: 44px; /* LTR */
342
+ }
343
+ [dir=rtl] .minicolors-theme-bootstrap .minicolors-input {
344
+ text-align: right;
345
+ unicode-bidi: plaintext;
346
+ padding-left: 12px;
347
+ padding-right: 44px;
348
+ }
349
+ .minicolors-theme-bootstrap.minicolors-position-right .minicolors-input {
350
+ padding-right: 44px; /* LTR */
351
+ padding-left: 12px; /* LTR */
352
+ }
353
+ [dir=rtl] .minicolors-theme-bootstrap.minicolors-position-left .minicolors-input {
354
+ padding-right: 12px;
355
+ padding-left: 44px;
356
+ }
357
+ .minicolors-theme-bootstrap .minicolors-input.input-lg + .minicolors-swatch {
358
+ top: 4px;
359
+ left: 4px; /* LTR */
360
+ width: 37px;
361
+ height: 37px;
362
+ border-radius: 5px;
363
+ }
364
+ [dir=rtl] .minicolors-theme-bootstrap .minicolors-input.input-lg + .minicolors-swatch {
365
+ right: 4px;
366
+ }
367
+ .minicolors-theme-bootstrap .minicolors-input.input-sm + .minicolors-swatch {
368
+ width: 24px;
369
+ height: 24px;
370
+ }
371
+ .minicolors-theme-bootstrap .minicolors-input.input-xs + .minicolors-swatch {
372
+ width: 18px;
373
+ height: 18px;
374
+ }
375
+ .input-group .minicolors-theme-bootstrap:not(:first-child) .minicolors-input {
376
+ border-top-left-radius: 0; /* LTR */
377
+ border-bottom-left-radius: 0; /* LTR */
378
+ }
379
+ [dir=rtl] .input-group .minicolors-theme-bootstrap .minicolors-input {
380
+ border-radius: 4px;
381
+ }
382
+ [dir=rtl] .input-group .minicolors-theme-bootstrap:not(:first-child) .minicolors-input {
383
+ border-top-right-radius: 0;
384
+ border-bottom-right-radius: 0;
385
+ }
386
+ [dir=rtl] .input-group .minicolors-theme-bootstrap:not(:last-child) .minicolors-input {
387
+ border-top-left-radius: 0;
388
+ border-bottom-left-radius: 0;
389
+ }
390
+ /* bootstrap input-group rtl override */
391
+ [dir=rtl] .input-group .form-control,
392
+ [dir=rtl] .input-group-addon,
393
+ [dir=rtl] .input-group-btn > .btn,
394
+ [dir=rtl] .input-group-btn > .btn-group > .btn,
395
+ [dir=rtl] .input-group-btn > .dropdown-toggle {
396
+ border: 1px solid #ccc;
397
+ border-radius: 4px;
398
+ }
399
+ [dir=rtl] .input-group .form-control:first-child,
400
+ [dir=rtl] .input-group-addon:first-child,
401
+ [dir=rtl] .input-group-btn:first-child > .btn,
402
+ [dir=rtl] .input-group-btn:first-child > .btn-group > .btn,
403
+ [dir=rtl] .input-group-btn:first-child > .dropdown-toggle,
404
+ [dir=rtl] .input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle),
405
+ [dir=rtl] .input-group-btn:last-child > .btn-group:not(:last-child) > .btn {
406
+ border-top-left-radius: 0;
407
+ border-bottom-left-radius: 0;
408
+ border-left: 0;
409
+ }
410
+ [dir=rtl] .input-group .form-control:last-child,
411
+ [dir=rtl] .input-group-addon:last-child,
412
+ [dir=rtl] .input-group-btn:last-child > .btn,
413
+ [dir=rtl] .input-group-btn:last-child > .btn-group > .btn,
414
+ [dir=rtl] .input-group-btn:last-child > .dropdown-toggle,
415
+ [dir=rtl] .input-group-btn:first-child > .btn:not(:first-child),
416
+ [dir=rtl] .input-group-btn:first-child > .btn-group:not(:first-child) > .btn {
417
+ border-top-right-radius: 0;
418
+ border-bottom-right-radius: 0;
419
+ }
420
+
421
+ /* Semantic Ui theme */
422
+ .minicolors-theme-semanticui .minicolors-swatch {
423
+ top: 0;
424
+ left: 0; /* LTR */
425
+ padding: 18px;
426
+ }
427
+ [dir=rtl] .minicolors-theme-semanticui .minicolors-swatch {
428
+ right: 0;
429
+ }
430
+ .minicolors-theme-semanticui input {
431
+ text-indent: 30px;
432
+ }
inc/exopite-simple-options/assets/dev/jquery.minicolors.js ADDED
@@ -0,0 +1,1127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //
2
+ // jQuery MiniColors: A tiny color picker built on jQuery
3
+ //
4
+ // Developed by Cory LaViska for A Beautiful Site, LLC
5
+ //
6
+ // Licensed under the MIT license: http://opensource.org/licenses/MIT
7
+ //
8
+ (function (factory) {
9
+ if(typeof define === 'function' && define.amd) {
10
+ // AMD. Register as an anonymous module.
11
+ define(['jquery'], factory);
12
+ } else if(typeof exports === 'object') {
13
+ // Node/CommonJS
14
+ module.exports = factory(require('jquery'));
15
+ } else {
16
+ // Browser globals
17
+ factory(jQuery);
18
+ }
19
+ }(function ($) {
20
+ 'use strict';
21
+
22
+ // Defaults
23
+ $.minicolors = {
24
+ defaults: {
25
+ animationSpeed: 50,
26
+ animationEasing: 'swing',
27
+ change: null,
28
+ changeDelay: 0,
29
+ control: 'hue',
30
+ defaultValue: '',
31
+ format: 'hex',
32
+ hide: null,
33
+ hideSpeed: 100,
34
+ inline: false,
35
+ keywords: '',
36
+ letterCase: 'lowercase',
37
+ opacity: false,
38
+ position: 'bottom',
39
+ show: null,
40
+ showSpeed: 100,
41
+ theme: 'default',
42
+ swatches: []
43
+ }
44
+ };
45
+
46
+ // Public methods
47
+ $.extend($.fn, {
48
+ minicolors: function(method, data) {
49
+
50
+ switch(method) {
51
+ // Destroy the control
52
+ case 'destroy':
53
+ $(this).each(function() {
54
+ destroy($(this));
55
+ });
56
+ return $(this);
57
+
58
+ // Hide the color picker
59
+ case 'hide':
60
+ hide();
61
+ return $(this);
62
+
63
+ // Get/set opacity
64
+ case 'opacity':
65
+ // Getter
66
+ if(data === undefined) {
67
+ // Getter
68
+ return $(this).attr('data-opacity');
69
+ } else {
70
+ // Setter
71
+ $(this).each(function() {
72
+ updateFromInput($(this).attr('data-opacity', data));
73
+ });
74
+ }
75
+ return $(this);
76
+
77
+ // Get an RGB(A) object based on the current color/opacity
78
+ case 'rgbObject':
79
+ return rgbObject($(this), method === 'rgbaObject');
80
+
81
+ // Get an RGB(A) string based on the current color/opacity
82
+ case 'rgbString':
83
+ case 'rgbaString':
84
+ return rgbString($(this), method === 'rgbaString');
85
+
86
+ // Get/set settings on the fly
87
+ case 'settings':
88
+ if(data === undefined) {
89
+ return $(this).data('minicolors-settings');
90
+ } else {
91
+ // Setter
92
+ $(this).each(function() {
93
+ var settings = $(this).data('minicolors-settings') || {};
94
+ destroy($(this));
95
+ $(this).minicolors($.extend(true, settings, data));
96
+ });
97
+ }
98
+ return $(this);
99
+
100
+ // Show the color picker
101
+ case 'show':
102
+ show($(this).eq(0));
103
+ return $(this);
104
+
105
+ // Get/set the hex color value
106
+ case 'value':
107
+ if(data === undefined) {
108
+ // Getter
109
+ return $(this).val();
110
+ } else {
111
+ // Setter
112
+ $(this).each(function() {
113
+ if(typeof(data) === 'object' && data !== null) {
114
+ if(data.opacity !== undefined) {
115
+ $(this).attr('data-opacity', keepWithin(data.opacity, 0, 1));
116
+ }
117
+ if(data.color) {
118
+ $(this).val(data.color);
119
+ }
120
+ } else {
121
+ $(this).val(data);
122
+ }
123
+ updateFromInput($(this));
124
+ });
125
+ }
126
+ return $(this);
127
+
128
+ // Initializes the control
129
+ default:
130
+ if(method !== 'create') data = method;
131
+ $(this).each(function() {
132
+ init($(this), data);
133
+ });
134
+ return $(this);
135
+
136
+ }
137
+
138
+ }
139
+ });
140
+
141
+ // Initialize input elements
142
+ function init(input, settings) {
143
+ var minicolors = $('<div class="minicolors" />');
144
+ var defaults = $.minicolors.defaults;
145
+ var name;
146
+ var size;
147
+ var swatches;
148
+ var swatch;
149
+ var swatchString;
150
+ var panel;
151
+ var i;
152
+
153
+ // Do nothing if already initialized
154
+ if(input.data('minicolors-initialized')) return;
155
+
156
+ // Handle settings
157
+ settings = $.extend(true, {}, defaults, settings);
158
+
159
+ // The wrapper
160
+ minicolors
161
+ .addClass('minicolors-theme-' + settings.theme)
162
+ .toggleClass('minicolors-with-opacity', settings.opacity);
163
+
164
+ // Custom positioning
165
+ if(settings.position !== undefined) {
166
+ $.each(settings.position.split(' '), function() {
167
+ minicolors.addClass('minicolors-position-' + this);
168
+ });
169
+ }
170
+
171
+ // Input size
172
+ if(settings.format === 'rgb') {
173
+ size = settings.opacity ? '25' : '20';
174
+ } else {
175
+ size = settings.keywords ? '11' : '7';
176
+ }
177
+
178
+ // The input
179
+ input
180
+ .addClass('minicolors-input')
181
+ .data('minicolors-initialized', false)
182
+ .data('minicolors-settings', settings)
183
+ .prop('size', size)
184
+ .wrap(minicolors)
185
+ .after(
186
+ '<div class="minicolors-panel minicolors-slider-' + settings.control + '">' +
187
+ '<div class="minicolors-slider minicolors-sprite">' +
188
+ '<div class="minicolors-picker"></div>' +
189
+ '</div>' +
190
+ '<div class="minicolors-opacity-slider minicolors-sprite">' +
191
+ '<div class="minicolors-picker"></div>' +
192
+ '</div>' +
193
+ '<div class="minicolors-grid minicolors-sprite">' +
194
+ '<div class="minicolors-grid-inner"></div>' +
195
+ '<div class="minicolors-picker"><div></div></div>' +
196
+ '</div>' +
197
+ '</div>'
198
+ );
199
+
200
+ // The swatch
201
+ if(!settings.inline) {
202
+ input.after('<span class="minicolors-swatch minicolors-sprite minicolors-input-swatch"><span class="minicolors-swatch-color"></span></span>');
203
+ input.next('.minicolors-input-swatch').on('click', function(event) {
204
+ event.preventDefault();
205
+ input.focus();
206
+ });
207
+ }
208
+
209
+ // Prevent text selection in IE
210
+ panel = input.parent().find('.minicolors-panel');
211
+ panel.on('selectstart', function() { return false; }).end();
212
+
213
+ // Swatches
214
+ if(settings.swatches && settings.swatches.length !== 0) {
215
+ panel.addClass('minicolors-with-swatches');
216
+ swatches = $('<ul class="minicolors-swatches"></ul>')
217
+ .appendTo(panel);
218
+ for(i = 0; i < settings.swatches.length; ++i) {
219
+ // allow for custom objects as swatches
220
+ if($.type(settings.swatches[i]) === 'object') {
221
+ name = settings.swatches[i].name;
222
+ swatch = settings.swatches[i].color;
223
+ } else {
224
+ name = '';
225
+ swatch = settings.swatches[i];
226
+ }
227
+ swatchString = swatch;
228
+ swatch = isRgb(swatch) ? parseRgb(swatch, true) : hex2rgb(parseHex(swatch, true));
229
+ $('<li class="minicolors-swatch minicolors-sprite"><span class="minicolors-swatch-color" title="' + name + '"></span></li>')
230
+ .appendTo(swatches)
231
+ .data('swatch-color', swatchString)
232
+ .find('.minicolors-swatch-color')
233
+ .css({
234
+ backgroundColor: rgb2hex(swatch),
235
+ opacity: swatch.a
236
+ });
237
+ settings.swatches[i] = swatch;
238
+ }
239
+ }
240
+
241
+ // Inline controls
242
+ if(settings.inline) input.parent().addClass('minicolors-inline');
243
+
244
+ updateFromInput(input, false);
245
+
246
+ input.data('minicolors-initialized', true);
247
+ }
248
+
249
+ // Returns the input back to its original state
250
+ function destroy(input) {
251
+ var minicolors = input.parent();
252
+
253
+ // Revert the input element
254
+ input
255
+ .removeData('minicolors-initialized')
256
+ .removeData('minicolors-settings')
257
+ .removeProp('size')
258
+ .removeClass('minicolors-input');
259
+
260
+ // Remove the wrap and destroy whatever remains
261
+ minicolors.before(input).remove();
262
+ }
263
+
264
+ // Shows the specified dropdown panel
265
+ function show(input) {
266
+ var minicolors = input.parent();
267
+ var panel = minicolors.find('.minicolors-panel');
268
+ var settings = input.data('minicolors-settings');
269
+
270
+ // Do nothing if uninitialized, disabled, inline, or already open
271
+ if(
272
+ !input.data('minicolors-initialized') ||
273
+ input.prop('disabled') ||
274
+ minicolors.hasClass('minicolors-inline') ||
275
+ minicolors.hasClass('minicolors-focus')
276
+ ) return;
277
+
278
+ hide();
279
+
280
+ minicolors.addClass('minicolors-focus');
281
+ if (panel.animate) {
282
+ panel
283
+ .stop(true, true)
284
+ .fadeIn(settings.showSpeed, function () {
285
+ if (settings.show) settings.show.call(input.get(0));
286
+ });
287
+ } else {
288
+ panel.show();
289
+ if (settings.show) settings.show.call(input.get(0));
290
+ }
291
+ }
292
+
293
+ // Hides all dropdown panels
294
+ function hide() {
295
+ $('.minicolors-focus').each(function() {
296
+ var minicolors = $(this);
297
+ var input = minicolors.find('.minicolors-input');
298
+ var panel = minicolors.find('.minicolors-panel');
299
+ var settings = input.data('minicolors-settings');
300
+
301
+ if (panel.animate) {
302
+ panel.fadeOut(settings.hideSpeed, function () {
303
+ if (settings.hide) settings.hide.call(input.get(0));
304
+ minicolors.removeClass('minicolors-focus');
305
+ });
306
+ } else {
307
+ panel.hide();
308
+ if (settings.hide) settings.hide.call(input.get(0));
309
+ minicolors.removeClass('minicolors-focus');
310
+ }
311
+ });
312
+ }
313
+
314
+ // Moves the selected picker
315
+ function move(target, event, animate) {
316
+ var input = target.parents('.minicolors').find('.minicolors-input');
317
+ var settings = input.data('minicolors-settings');
318
+ var picker = target.find('[class$=-picker]');
319
+ var offsetX = target.offset().left;
320
+ var offsetY = target.offset().top;
321
+ var x = Math.round(event.pageX - offsetX);
322
+ var y = Math.round(event.pageY - offsetY);
323
+ var duration = animate ? settings.animationSpeed : 0;
324
+ var wx, wy, r, phi, styles;
325
+
326
+ // Touch support
327
+ if(event.originalEvent.changedTouches) {
328
+ x = event.originalEvent.changedTouches[0].pageX - offsetX;
329
+ y = event.originalEvent.changedTouches[0].pageY - offsetY;
330
+ }
331
+
332
+ // Constrain picker to its container
333
+ if(x < 0) x = 0;
334
+ if(y < 0) y = 0;
335
+ if(x > target.width()) x = target.width();
336
+ if(y > target.height()) y = target.height();
337
+
338
+ // Constrain color wheel values to the wheel
339
+ if(target.parent().is('.minicolors-slider-wheel') && picker.parent().is('.minicolors-grid')) {
340
+ wx = 75 - x;
341
+ wy = 75 - y;
342
+ r = Math.sqrt(wx * wx + wy * wy);
343
+ phi = Math.atan2(wy, wx);
344
+ if(phi < 0) phi += Math.PI * 2;
345
+ if(r > 75) {
346
+ r = 75;
347
+ x = 75 - (75 * Math.cos(phi));
348
+ y = 75 - (75 * Math.sin(phi));
349
+ }
350
+ x = Math.round(x);
351
+ y = Math.round(y);
352
+ }
353
+
354
+ // Move the picker
355
+ styles = {
356
+ top: y + 'px'
357
+ };
358
+ if(target.is('.minicolors-grid')) {
359
+ styles.left = x + 'px';
360
+ }
361
+ if (picker.animate) {
362
+ picker
363
+ .stop(true)
364
+ .animate(styles, duration, settings.animationEasing, function() {
365
+ updateFromControl(input, target);
366
+ });
367
+ } else {
368
+ picker
369
+ .css(styles);
370
+ updateFromControl(input, target);
371
+ }
372
+ }
373
+
374
+ // Sets the input based on the color picker values
375
+ function updateFromControl(input, target) {
376
+
377
+ function getCoords(picker, container) {
378
+ var left, top;
379
+ if(!picker.length || !container) return null;
380
+ left = picker.offset().left;
381
+ top = picker.offset().top;
382
+
383
+ return {
384
+ x: left - container.offset().left + (picker.outerWidth() / 2),
385
+ y: top - container.offset().top + (picker.outerHeight() / 2)
386
+ };
387
+ }
388
+
389
+ var hue, saturation, brightness, x, y, r, phi;
390
+ var hex = input.val();
391
+ var opacity = input.attr('data-opacity');
392
+
393
+ // Helpful references
394
+ var minicolors = input.parent();
395
+ var settings = input.data('minicolors-settings');
396
+ var swatch = minicolors.find('.minicolors-input-swatch');
397
+
398
+ // Panel objects
399
+ var grid = minicolors.find('.minicolors-grid');
400
+ var slider = minicolors.find('.minicolors-slider');
401
+ var opacitySlider = minicolors.find('.minicolors-opacity-slider');
402
+
403
+ // Picker objects
404
+ var gridPicker = grid.find('[class$=-picker]');
405
+ var sliderPicker = slider.find('[class$=-picker]');
406
+ var opacityPicker = opacitySlider.find('[class$=-picker]');
407
+
408
+ // Picker positions
409
+ var gridPos = getCoords(gridPicker, grid);
410
+ var sliderPos = getCoords(sliderPicker, slider);
411
+ var opacityPos = getCoords(opacityPicker, opacitySlider);
412
+
413
+ // Handle colors
414
+ if(target.is('.minicolors-grid, .minicolors-slider, .minicolors-opacity-slider')) {
415
+
416
+ // Determine HSB values
417
+ switch(settings.control) {
418
+ case 'wheel':
419
+ // Calculate hue, saturation, and brightness
420
+ x = (grid.width() / 2) - gridPos.x;
421
+ y = (grid.height() / 2) - gridPos.y;
422
+ r = Math.sqrt(x * x + y * y);
423
+ phi = Math.atan2(y, x);
424
+ if(phi < 0) phi += Math.PI * 2;
425
+ if(r > 75) {
426
+ r = 75;
427
+ gridPos.x = 69 - (75 * Math.cos(phi));
428
+ gridPos.y = 69 - (75 * Math.sin(phi));
429
+ }
430
+ saturation = keepWithin(r / 0.75, 0, 100);
431
+ hue = keepWithin(phi * 180 / Math.PI, 0, 360);
432
+ brightness = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
433
+ hex = hsb2hex({
434
+ h: hue,
435
+ s: saturation,
436
+ b: brightness
437
+ });
438
+
439
+ // Update UI
440
+ slider.css('backgroundColor', hsb2hex({ h: hue, s: saturation, b: 100 }));
441
+ break;
442
+
443
+ case 'saturation':
444
+ // Calculate hue, saturation, and brightness
445
+ hue = keepWithin(parseInt(gridPos.x * (360 / grid.width()), 10), 0, 360);
446
+ saturation = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
447
+ brightness = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
448
+ hex = hsb2hex({
449
+ h: hue,
450
+ s: saturation,
451
+ b: brightness
452
+ });
453
+
454
+ // Update UI
455
+ slider.css('backgroundColor', hsb2hex({ h: hue, s: 100, b: brightness }));
456
+ minicolors.find('.minicolors-grid-inner').css('opacity', saturation / 100);
457
+ break;
458
+
459
+ case 'brightness':
460
+ // Calculate hue, saturation, and brightness
461
+ hue = keepWithin(parseInt(gridPos.x * (360 / grid.width()), 10), 0, 360);
462
+ saturation = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
463
+ brightness = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
464
+ hex = hsb2hex({
465
+ h: hue,
466
+ s: saturation,
467
+ b: brightness
468
+ });
469
+
470
+ // Update UI
471
+ slider.css('backgroundColor', hsb2hex({ h: hue, s: saturation, b: 100 }));
472
+ minicolors.find('.minicolors-grid-inner').css('opacity', 1 - (brightness / 100));
473
+ break;
474
+
475
+ default:
476
+ // Calculate hue, saturation, and brightness
477
+ hue = keepWithin(360 - parseInt(sliderPos.y * (360 / slider.height()), 10), 0, 360);
478
+ saturation = keepWithin(Math.floor(gridPos.x * (100 / grid.width())), 0, 100);
479
+ brightness = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
480
+ hex = hsb2hex({
481
+ h: hue,
482
+ s: saturation,
483
+ b: brightness
484
+ });
485
+
486
+ // Update UI
487
+ grid.css('backgroundColor', hsb2hex({ h: hue, s: 100, b: 100 }));
488
+ break;
489
+ }
490
+
491
+ // Handle opacity
492
+ if(settings.opacity) {
493
+ opacity = parseFloat(1 - (opacityPos.y / opacitySlider.height())).toFixed(2);
494
+ } else {
495
+ opacity = 1;
496
+ }
497
+
498
+ updateInput(input, hex, opacity);
499
+ }
500
+ else {
501
+ // Set swatch color
502
+ swatch.find('span').css({
503
+ backgroundColor: hex,
504
+ opacity: opacity
505
+ });
506
+
507
+ // Handle change event
508
+ doChange(input, hex, opacity);
509
+ }
510
+ }
511
+
512
+ // Sets the value of the input and does the appropriate conversions
513
+ // to respect settings, also updates the swatch
514
+ function updateInput(input, value, opacity) {
515
+ var rgb;
516
+
517
+ // Helpful references
518
+ var minicolors = input.parent();
519
+ var settings = input.data('minicolors-settings');
520
+ var swatch = minicolors.find('.minicolors-input-swatch');
521
+
522
+ if(settings.opacity) input.attr('data-opacity', opacity);
523
+
524
+ // Set color string
525
+ if(settings.format === 'rgb') {
526
+ // Returns RGB(A) string
527
+
528
+ // Checks for input format and does the conversion
529
+ if(isRgb(value)) {
530
+ rgb = parseRgb(value, true);
531
+ }
532
+ else {
533
+ rgb = hex2rgb(parseHex(value, true));
534
+ }
535
+
536
+ opacity = input.attr('data-opacity') === '' ? 1 : keepWithin(parseFloat(input.attr('data-opacity')).toFixed(2), 0, 1);
537
+ if(isNaN(opacity) || !settings.opacity) opacity = 1;
538
+
539
+ if(input.minicolors('rgbObject').a <= 1 && rgb && settings.opacity) {
540
+ // Set RGBA string if alpha
541
+ value = 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', ' + parseFloat(opacity) + ')';
542
+ } else {
543
+ // Set RGB string (alpha = 1)
544
+ value = 'rgb(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ')';
545
+ }
546
+ } else {
547
+ // Returns hex color
548
+
549
+ // Checks for input format and does the conversion
550
+ if(isRgb(value)) {
551
+ value = rgbString2hex(value);
552
+ }
553
+
554
+ value = convertCase(value, settings.letterCase);
555
+ }
556
+
557
+ // Update value from picker
558
+ input.val(value);
559
+
560
+ // Set swatch color
561
+ swatch.find('span').css({
562
+ backgroundColor: value,
563
+ opacity: opacity
564
+ });
565
+
566
+ // Handle change event
567
+ doChange(input, value, opacity);
568
+ }
569
+
570
+ // Sets the color picker values from the input
571
+ function updateFromInput(input, preserveInputValue) {
572
+ var hex, hsb, opacity, keywords, alpha, value, x, y, r, phi;
573
+
574
+ // Helpful references
575
+ var minicolors = input.parent();
576
+ var settings = input.data('minicolors-settings');
577
+ var swatch = minicolors.find('.minicolors-input-swatch');
578
+
579
+ // Panel objects
580
+ var grid = minicolors.find('.minicolors-grid');
581
+ var slider = minicolors.find('.minicolors-slider');
582
+ var opacitySlider = minicolors.find('.minicolors-opacity-slider');
583
+
584
+ // Picker objects
585
+ var gridPicker = grid.find('[class$=-picker]');
586
+ var sliderPicker = slider.find('[class$=-picker]');
587
+ var opacityPicker = opacitySlider.find('[class$=-picker]');
588
+
589
+ // Determine hex/HSB values
590
+ if(isRgb(input.val())) {
591
+ // If input value is a rgb(a) string, convert it to hex color and update opacity
592
+ hex = rgbString2hex(input.val());
593
+ alpha = keepWithin(parseFloat(getAlpha(input.val())).toFixed(2), 0, 1);
594
+ if(alpha) {
595
+ input.attr('data-opacity', alpha);
596
+ }
597
+ } else {
598
+ hex = convertCase(parseHex(input.val(), true), settings.letterCase);
599
+ }
600
+
601
+ if(!hex){
602
+ hex = convertCase(parseInput(settings.defaultValue, true), settings.letterCase);
603
+ }
604
+ hsb = hex2hsb(hex);
605
+
606
+ // Get array of lowercase keywords
607
+ keywords = !settings.keywords ? [] : $.map(settings.keywords.split(','), function(a) {
608
+ return $.trim(a.toLowerCase());
609
+ });
610
+
611
+ // Set color string
612
+ if(input.val() !== '' && $.inArray(input.val().toLowerCase(), keywords) > -1) {
613
+ value = convertCase(input.val());
614
+ } else {
615
+ value = isRgb(input.val()) ? parseRgb(input.val()) : hex;
616
+ }
617
+
618
+ // Update input value
619
+ if(!preserveInputValue) input.val(value);
620
+
621
+ // Determine opacity value
622
+ if(settings.opacity) {
623
+ // Get from data-opacity attribute and keep within 0-1 range
624
+ opacity = input.attr('data-opacity') === '' ? 1 : keepWithin(parseFloat(input.attr('data-opacity')).toFixed(2), 0, 1);
625
+ if(isNaN(opacity)) opacity = 1;
626
+ input.attr('data-opacity', opacity);
627
+ swatch.find('span').css('opacity', opacity);
628
+
629
+ // Set opacity picker position
630
+ y = keepWithin(opacitySlider.height() - (opacitySlider.height() * opacity), 0, opacitySlider.height());
631
+ opacityPicker.css('top', y + 'px');
632
+ }
633
+
634
+ // Set opacity to zero if input value is transparent
635
+ if(input.val().toLowerCase() === 'transparent') {
636
+ swatch.find('span').css('opacity', 0);
637
+ }
638
+
639
+ // Update swatch
640
+ swatch.find('span').css('backgroundColor', hex);
641
+
642
+ // Determine picker locations
643
+ switch(settings.control) {
644
+ case 'wheel':
645
+ // Set grid position
646
+ r = keepWithin(Math.ceil(hsb.s * 0.75), 0, grid.height() / 2);
647
+ phi = hsb.h * Math.PI / 180;
648
+ x = keepWithin(75 - Math.cos(phi) * r, 0, grid.width());
649
+ y = keepWithin(75 - Math.sin(phi) * r, 0, grid.height());
650
+ gridPicker.css({
651
+ top: y + 'px',
652
+ left: x + 'px'
653
+ });
654
+
655
+ // Set slider position
656
+ y = 150 - (hsb.b / (100 / grid.height()));
657
+ if(hex === '') y = 0;
658
+ sliderPicker.css('top', y + 'px');
659
+
660
+ // Update panel color
661
+ slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: hsb.s, b: 100 }));
662
+ break;
663
+
664
+ case 'saturation':
665
+ // Set grid position
666
+ x = keepWithin((5 * hsb.h) / 12, 0, 150);
667
+ y = keepWithin(grid.height() - Math.ceil(hsb.b / (100 / grid.height())), 0, grid.height());
668
+ gridPicker.css({
669
+ top: y + 'px',
670
+ left: x + 'px'
671
+ });
672
+
673
+ // Set slider position
674
+ y = keepWithin(slider.height() - (hsb.s * (slider.height() / 100)), 0, slider.height());
675
+ sliderPicker.css('top', y + 'px');
676
+
677
+ // Update UI
678
+ slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: 100, b: hsb.b }));
679
+ minicolors.find('.minicolors-grid-inner').css('opacity', hsb.s / 100);
680
+ break;
681
+
682
+ case 'brightness':
683
+ // Set grid position
684
+ x = keepWithin((5 * hsb.h) / 12, 0, 150);
685
+ y = keepWithin(grid.height() - Math.ceil(hsb.s / (100 / grid.height())), 0, grid.height());
686
+ gridPicker.css({
687
+ top: y + 'px',
688
+ left: x + 'px'
689
+ });
690
+
691
+ // Set slider position
692
+ y = keepWithin(slider.height() - (hsb.b * (slider.height() / 100)), 0, slider.height());
693
+ sliderPicker.css('top', y + 'px');
694
+
695
+ // Update UI
696
+ slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: hsb.s, b: 100 }));
697
+ minicolors.find('.minicolors-grid-inner').css('opacity', 1 - (hsb.b / 100));
698
+ break;
699
+
700
+ default:
701
+ // Set grid position
702
+ x = keepWithin(Math.ceil(hsb.s / (100 / grid.width())), 0, grid.width());
703
+ y = keepWithin(grid.height() - Math.ceil(hsb.b / (100 / grid.height())), 0, grid.height());
704
+ gridPicker.css({
705
+ top: y + 'px',
706
+ left: x + 'px'
707
+ });
708
+
709
+ // Set slider position
710
+ y = keepWithin(slider.height() - (hsb.h / (360 / slider.height())), 0, slider.height());
711
+ sliderPicker.css('top', y + 'px');
712
+
713
+ // Update panel color
714
+ grid.css('backgroundColor', hsb2hex({ h: hsb.h, s: 100, b: 100 }));
715
+ break;
716
+ }
717
+
718
+ // Fire change event, but only if minicolors is fully initialized
719
+ if(input.data('minicolors-initialized')) {
720
+ doChange(input, value, opacity);
721
+ }
722
+ }
723
+
724
+ // Runs the change and changeDelay callbacks
725
+ function doChange(input, value, opacity) {
726
+ var settings = input.data('minicolors-settings');
727
+ var lastChange = input.data('minicolors-lastChange');
728
+ var obj, sel, i;
729
+
730
+ // Only run if it actually changed
731
+ if(!lastChange || lastChange.value !== value || lastChange.opacity !== opacity) {
732
+
733
+ // Remember last-changed value
734
+ input.data('minicolors-lastChange', {
735
+ value: value,
736
+ opacity: opacity
737
+ });
738
+
739
+ // Check and select applicable swatch
740
+ if(settings.swatches && settings.swatches.length !== 0) {
741
+ if(!isRgb(value)) {
742
+ obj = hex2rgb(value);
743
+ }
744
+ else {
745
+ obj = parseRgb(value, true);
746
+ }
747
+ sel = -1;
748
+ for(i = 0; i < settings.swatches.length; ++i) {
749
+ if(obj.r === settings.swatches[i].r && obj.g === settings.swatches[i].g && obj.b === settings.swatches[i].b && obj.a === settings.swatches[i].a) {
750
+ sel = i;
751
+ break;
752
+ }
753
+ }
754
+
755
+ input.parent().find('.minicolors-swatches .minicolors-swatch').removeClass('selected');
756
+ if(sel !== -1) {
757
+ input.parent().find('.minicolors-swatches .minicolors-swatch').eq(i).addClass('selected');
758
+ }
759
+ }
760
+
761
+ // Fire change event
762
+ if(settings.change) {
763
+ if(settings.changeDelay) {
764
+ // Call after a delay
765
+ clearTimeout(input.data('minicolors-changeTimeout'));
766
+ input.data('minicolors-changeTimeout', setTimeout(function() {
767
+ settings.change.call(input.get(0), value, opacity);
768
+ }, settings.changeDelay));
769
+ } else {
770
+ // Call immediately
771
+ settings.change.call(input.get(0), value, opacity);
772
+ }
773
+ }
774
+ input.trigger('change').trigger('input');
775
+ }
776
+ }
777
+
778
+ // Generates an RGB(A) object based on the input's value
779
+ function rgbObject(input) {
780
+ var rgb,
781
+ opacity = $(input).attr('data-opacity');
782
+ if( isRgb($(input).val()) ) {
783
+ rgb = parseRgb($(input).val(), true);
784
+ } else {
785
+ var hex = parseHex($(input).val(), true);
786
+ rgb = hex2rgb(hex);
787
+ }
788
+ if( !rgb ) return null;
789
+ if( opacity !== undefined ) $.extend(rgb, { a: parseFloat(opacity) });
790
+ return rgb;
791
+ }
792
+
793
+ // Generates an RGB(A) string based on the input's value
794
+ function rgbString(input, alpha) {
795
+ var rgb,
796
+ opacity = $(input).attr('data-opacity');
797
+ if( isRgb($(input).val()) ) {
798
+ rgb = parseRgb($(input).val(), true);
799
+ } else {
800
+ var hex = parseHex($(input).val(), true);
801
+ rgb = hex2rgb(hex);
802
+ }
803
+ if( !rgb ) return null;
804
+ if( opacity === undefined ) opacity = 1;
805
+ if( alpha ) {
806
+ return 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', ' + parseFloat(opacity) + ')';
807
+ } else {
808
+ return 'rgb(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ')';
809
+ }
810
+ }
811
+
812
+ // Converts to the letter case specified in settings
813
+ function convertCase(string, letterCase) {
814
+ return letterCase === 'uppercase' ? string.toUpperCase() : string.toLowerCase();
815
+ }
816
+
817
+ // Parses a string and returns a valid hex string when possible
818
+ function parseHex(string, expand) {
819
+ string = string.replace(/^#/g, '');
820
+ if(!string.match(/^[A-F0-9]{3,6}/ig)) return '';
821
+ if(string.length !== 3 && string.length !== 6) return '';
822
+ if(string.length === 3 && expand) {
823
+ string = string[0] + string[0] + string[1] + string[1] + string[2] + string[2];
824
+ }
825
+ return '#' + string;
826
+ }
827
+
828
+ // Parses a string and returns a valid RGB(A) string when possible
829
+ function parseRgb(string, obj) {
830
+ var values = string.replace(/[^\d,.]/g, '');
831
+ var rgba = values.split(',');
832
+
833
+ rgba[0] = keepWithin(parseInt(rgba[0], 10), 0, 255);
834
+ rgba[1] = keepWithin(parseInt(rgba[1], 10), 0, 255);
835
+ rgba[2] = keepWithin(parseInt(rgba[2], 10), 0, 255);
836
+ if(rgba[3] !== undefined) {
837
+ rgba[3] = keepWithin(parseFloat(rgba[3], 10), 0, 1);
838
+ }
839
+
840
+ // Return RGBA object
841
+ if( obj ) {
842
+ if (rgba[3] !== undefined) {
843
+ return {
844
+ r: rgba[0],
845
+ g: rgba[1],
846
+ b: rgba[2],
847
+ a: rgba[3]
848
+ };
849
+ } else {
850
+ return {
851
+ r: rgba[0],
852
+ g: rgba[1],
853
+ b: rgba[2]
854
+ };
855
+ }
856
+ }
857
+
858
+ // Return RGBA string
859
+ if(typeof(rgba[3]) !== 'undefined' && rgba[3] <= 1) {
860
+ return 'rgba(' + rgba[0] + ', ' + rgba[1] + ', ' + rgba[2] + ', ' + rgba[3] + ')';
861
+ } else {
862
+ return 'rgb(' + rgba[0] + ', ' + rgba[1] + ', ' + rgba[2] + ')';
863
+ }
864
+
865
+ }
866
+
867
+ // Parses a string and returns a valid color string when possible
868
+ function parseInput(string, expand) {
869
+ if(isRgb(string)) {
870
+ // Returns a valid rgb(a) string
871
+ return parseRgb(string);
872
+ } else {
873
+ return parseHex(string, expand);
874
+ }
875
+ }
876
+
877
+ // Keeps value within min and max
878
+ function keepWithin(value, min, max) {
879
+ if(value < min) value = min;
880
+ if(value > max) value = max;
881
+ return value;
882
+ }
883
+
884
+ // Checks if a string is a valid RGB(A) string
885
+ function isRgb(string) {
886
+ var rgb = string.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
887
+ return (rgb && rgb.length === 4) ? true : false;
888
+ }
889
+
890
+ // Function to get alpha from a RGB(A) string
891
+ function getAlpha(rgba) {
892
+ rgba = rgba.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+(\.\d{1,2})?|\.\d{1,2})[\s+]?/i);
893
+ return (rgba && rgba.length === 6) ? rgba[4] : '1';
894
+ }
895
+
896
+ // Converts an HSB object to an RGB object
897
+ function hsb2rgb(hsb) {
898
+ var rgb = {};
899
+ var h = Math.round(hsb.h);
900
+ var s = Math.round(hsb.s * 255 / 100);
901
+ var v = Math.round(hsb.b * 255 / 100);
902
+ if(s === 0) {
903
+ rgb.r = rgb.g = rgb.b = v;
904
+ } else {
905
+ var t1 = v;
906
+ var t2 = (255 - s) * v / 255;
907
+ var t3 = (t1 - t2) * (h % 60) / 60;
908
+ if(h === 360) h = 0;
909
+ if(h < 60) { rgb.r = t1; rgb.b = t2; rgb.g = t2 + t3; }
910
+ else if(h < 120) {rgb.g = t1; rgb.b = t2; rgb.r = t1 - t3; }
911
+ else if(h < 180) {rgb.g = t1; rgb.r = t2; rgb.b = t2 + t3; }
912
+ else if(h < 240) {rgb.b = t1; rgb.r = t2; rgb.g = t1 - t3; }
913
+ else if(h < 300) {rgb.b = t1; rgb.g = t2; rgb.r = t2 + t3; }
914
+ else if(h < 360) {rgb.r = t1; rgb.g = t2; rgb.b = t1 - t3; }
915
+ else { rgb.r = 0; rgb.g = 0; rgb.b = 0; }
916
+ }
917
+ return {
918
+ r: Math.round(rgb.r),
919
+ g: Math.round(rgb.g),
920
+ b: Math.round(rgb.b)
921
+ };
922
+ }
923
+
924
+ // Converts an RGB string to a hex string
925
+ function rgbString2hex(rgb){
926
+ rgb = rgb.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
927
+ return (rgb && rgb.length === 4) ? '#' +
928
+ ('0' + parseInt(rgb[1],10).toString(16)).slice(-2) +
929
+ ('0' + parseInt(rgb[2],10).toString(16)).slice(-2) +
930
+ ('0' + parseInt(rgb[3],10).toString(16)).slice(-2) : '';
931
+ }
932
+
933
+ // Converts an RGB object to a hex string
934
+ function rgb2hex(rgb) {
935
+ var hex = [
936
+ rgb.r.toString(16),
937
+ rgb.g.toString(16),
938
+ rgb.b.toString(16)
939
+ ];
940
+ $.each(hex, function(nr, val) {
941
+ if(val.length === 1) hex[nr] = '0' + val;
942
+ });
943
+ return '#' + hex.join('');
944
+ }
945
+
946
+ // Converts an HSB object to a hex string
947
+ function hsb2hex(hsb) {
948
+ return rgb2hex(hsb2rgb(hsb));
949
+ }
950
+
951
+ // Converts a hex string to an HSB object
952
+ function hex2hsb(hex) {
953
+ var hsb = rgb2hsb(hex2rgb(hex));
954
+ if(hsb.s === 0) hsb.h = 360;
955
+ return hsb;
956
+ }
957
+
958
+ // Converts an RGB object to an HSB object
959
+ function rgb2hsb(rgb) {
960
+ var hsb = { h: 0, s: 0, b: 0 };
961
+ var min = Math.min(rgb.r, rgb.g, rgb.b);
962
+ var max = Math.max(rgb.r, rgb.g, rgb.b);
963
+ var delta = max - min;
964
+ hsb.b = max;
965
+ hsb.s = max !== 0 ? 255 * delta / max : 0;
966
+ if(hsb.s !== 0) {
967
+ if(rgb.r === max) {
968
+ hsb.h = (rgb.g - rgb.b) / delta;
969
+ } else if(rgb.g === max) {
970
+ hsb.h = 2 + (rgb.b - rgb.r) / delta;
971
+ } else {
972
+ hsb.h = 4 + (rgb.r - rgb.g) / delta;
973
+ }
974
+ } else {
975
+ hsb.h = -1;
976
+ }
977
+ hsb.h *= 60;
978
+ if(hsb.h < 0) {
979
+ hsb.h += 360;
980
+ }
981
+ hsb.s *= 100/255;
982
+ hsb.b *= 100/255;
983
+ return hsb;
984
+ }
985
+
986
+ // Converts a hex string to an RGB object
987
+ function hex2rgb(hex) {
988
+ hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
989
+ return {
990
+ r: hex >> 16,
991
+ g: (hex & 0x00FF00) >> 8,
992
+ b: (hex & 0x0000FF)
993
+ };
994
+ }
995
+
996
+ // Handle events
997
+ $([document])
998
+ // Hide on clicks outside of the control
999
+ .on('mousedown.minicolors touchstart.minicolors', function(event) {
1000
+ if(!$(event.target).parents().add(event.target).hasClass('minicolors')) {
1001
+ hide();
1002
+ }
1003
+ })
1004
+ // Start moving
1005
+ .on('mousedown.minicolors touchstart.minicolors', '.minicolors-grid, .minicolors-slider, .minicolors-opacity-slider', function(event) {
1006
+ var target = $(this);
1007
+ event.preventDefault();
1008
+ $(event.delegateTarget).data('minicolors-target', target);
1009
+ move(target, event, true);
1010
+ })
1011
+ // Move pickers
1012
+ .on('mousemove.minicolors touchmove.minicolors', function(event) {
1013
+ var target = $(event.delegateTarget).data('minicolors-target');
1014
+ if(target) move(target, event);
1015
+ })
1016
+ // Stop moving
1017
+ .on('mouseup.minicolors touchend.minicolors', function() {
1018
+ $(this).removeData('minicolors-target');
1019
+ })
1020
+ // Selected a swatch
1021
+ .on('click.minicolors', '.minicolors-swatches li', function(event) {
1022
+ event.preventDefault();
1023
+ var target = $(this), input = target.parents('.minicolors').find('.minicolors-input'), color = target.data('swatch-color');
1024
+ updateInput(input, color, getAlpha(color));
1025
+ updateFromInput(input);
1026
+ })
1027
+ // Show panel when swatch is clicked
1028
+ .on('mousedown.minicolors touchstart.minicolors', '.minicolors-input-swatch', function(event) {
1029
+ var input = $(this).parent().find('.minicolors-input');
1030
+ event.preventDefault();
1031
+ show(input);
1032
+ })
1033
+ // Show on focus
1034
+ .on('focus.minicolors', '.minicolors-input', function() {
1035
+ var input = $(this);
1036
+ if(!input.data('minicolors-initialized')) return;
1037
+ show(input);
1038
+ })
1039
+ // Update value on blur
1040
+ .on('blur.minicolors', '.minicolors-input', function() {
1041
+ var input = $(this);
1042
+ var settings = input.data('minicolors-settings');
1043
+ var keywords;
1044
+ var hex;
1045
+ var rgba;
1046
+ var swatchOpacity;
1047
+ var value;
1048
+
1049
+ if(!input.data('minicolors-initialized')) return;
1050
+
1051
+ // Get array of lowercase keywords
1052
+ keywords = !settings.keywords ? [] : $.map(settings.keywords.split(','), function(a) {
1053
+ return $.trim(a.toLowerCase());
1054
+ });
1055
+
1056
+ // Set color string
1057
+ if(input.val() !== '' && $.inArray(input.val().toLowerCase(), keywords) > -1) {
1058
+ value = input.val();
1059
+ } else {
1060
+ // Get RGBA values for easy conversion
1061
+ if(isRgb(input.val())) {
1062
+ rgba = parseRgb(input.val(), true);
1063
+ } else {
1064
+ hex = parseHex(input.val(), true);
1065
+ rgba = hex ? hex2rgb(hex) : null;
1066
+ }
1067
+
1068
+ // Convert to format
1069
+ if(rgba === null) {
1070
+ value = settings.defaultValue;
1071
+ } else if(settings.format === 'rgb') {
1072
+ value = settings.opacity ?
1073
+ parseRgb('rgba(' + rgba.r + ',' + rgba.g + ',' + rgba.b + ',' + input.attr('data-opacity') + ')') :
1074
+ parseRgb('rgb(' + rgba.r + ',' + rgba.g + ',' + rgba.b + ')');
1075
+ } else {
1076
+ value = rgb2hex(rgba);
1077
+ }
1078
+ }
1079
+
1080
+ // Update swatch opacity
1081
+ swatchOpacity = settings.opacity ? input.attr('data-opacity') : 1;
1082
+ if(value.toLowerCase() === 'transparent') swatchOpacity = 0;
1083
+ input
1084
+ .closest('.minicolors')
1085
+ .find('.minicolors-input-swatch > span')
1086
+ .css('opacity', swatchOpacity);
1087
+
1088
+ // Set input value
1089
+ input.val(value);
1090
+
1091
+ // Is it blank?
1092
+ if(input.val() === '') input.val(parseInput(settings.defaultValue, true));
1093
+
1094
+ // Adjust case
1095
+ input.val(convertCase(input.val(), settings.letterCase));
1096
+
1097
+ })
1098
+ // Handle keypresses
1099
+ .on('keydown.minicolors', '.minicolors-input', function(event) {
1100
+ var input = $(this);
1101
+ if(!input.data('minicolors-initialized')) return;
1102
+ switch(event.which) {
1103
+ case 9: // tab
1104
+ hide();
1105
+ break;
1106
+ case 13: // enter
1107
+ case 27: // esc
1108
+ hide();
1109
+ input.blur();
1110
+ break;
1111
+ }
1112
+ })
1113
+ // Update on keyup
1114
+ .on('keyup.minicolors', '.minicolors-input', function() {
1115
+ var input = $(this);
1116
+ if(!input.data('minicolors-initialized')) return;
1117
+ updateFromInput(input, true);
1118
+ })
1119
+ // Update on paste
1120
+ .on('paste.minicolors', '.minicolors-input', function() {
1121
+ var input = $(this);
1122
+ if(!input.data('minicolors-initialized')) return;
1123
+ setTimeout(function() {
1124
+ updateFromInput(input, true);
1125
+ }, 1);
1126
+ });
1127
+ }));
inc/exopite-simple-options/assets/dev/loader-color-picker.js ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ /**
3
+ * Exopite Simple Options Framework Trumbowyg
4
+ */
5
+ ; (function ($, window, document, undefined) {
6
+
7
+ var pluginName = "exopiteSOFColorpicker";
8
+
9
+ // The actual plugin constructor
10
+ function Plugin(element, options) {
11
+
12
+ this.element = element;
13
+ this._name = pluginName;
14
+ this.$element = $(element);
15
+ this.init();
16
+
17
+ }
18
+
19
+ Plugin.prototype = {
20
+
21
+ init: function () {
22
+
23
+ var plugin = this;
24
+
25
+ plugin.$element.find('.colorpicker').each(function (index, el) {
26
+
27
+ if ($(el).closest('.exopite-sof-cloneable__item').hasClass('exopite-sof-cloneable__muster')) return;
28
+ if ($(el).hasClass('disabled')) return;
29
+
30
+ $(el).wpColorPicker({
31
+ /**
32
+ * @param {Event} event - standard jQuery event, produced by whichever
33
+ * control was changed.
34
+ * @param {Object} ui - standard jQuery UI object, with a color member
35
+ * containing a Color.js object.
36
+ */
37
+ change: function (event, ui) {
38
+ plugin.change(event, ui, $(this));
39
+ },
40
+ });
41
+
42
+ });
43
+
44
+ plugin.$element.closest('.exopite-sof-wrapper').on('exopite-sof-field-group-item-added-after', function (event, $cloned) {
45
+
46
+ $cloned.find('.colorpicker').each(function (index, el) {
47
+
48
+ if ($(el).closest('.exopite-sof-cloneable__item').hasClass('exopite-sof-cloneable__muster')) return;
49
+ if ($(el).hasClass('disabled')) return;
50
+
51
+ $(el).wpColorPicker({
52
+ change: function (event, ui) {
53
+ plugin.change(event, ui, $(this));
54
+ },
55
+ });
56
+
57
+ });
58
+
59
+ console.log('color picker clone');
60
+
61
+ });
62
+
63
+ },
64
+
65
+ change: function (event, ui, $this) {
66
+ var color = ui.color.toString();
67
+ if ($this.hasClass('font-color-js')) {
68
+ console.log('has font-color');
69
+ $this.parents('.exopite-sof-font-field').find('.exopite-sof-font-preview').css({ 'color': color });
70
+ }
71
+ },
72
+
73
+ };
74
+
75
+ $.fn[pluginName] = function (options) {
76
+ return this.each(function () {
77
+ if (!$.data(this, "plugin_" + pluginName)) {
78
+ $.data(this, "plugin_" + pluginName,
79
+ new Plugin(this, options));
80
+ }
81
+ });
82
+ };
83
+
84
+ })(jQuery, window, document);
85
+
86
+ ; (function ($) {
87
+ "use strict";
88
+
89
+ $(document).ready(function () {
90
+
91
+ $('.exopite-sof-field').exopiteSOFColorpicker();
92
+
93
+ });
94
+
95
+ }(jQuery));
inc/exopite-simple-options/assets/dev/loader-datepicker.js ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ /**
3
+ * Exopite Simple Options Framework Trumbowyg
4
+ */
5
+ ; (function ($, window, document, undefined) {
6
+
7
+ var pluginName = "exopiteSOFDatepicker";
8
+
9
+ // The actual plugin constructor
10
+ function Plugin(element, options) {
11
+
12
+ this.element = element;
13
+ this._name = pluginName;
14
+ this.$element = $(element);
15
+ this.init();
16
+
17
+ }
18
+
19
+ Plugin.prototype = {
20
+
21
+ init: function () {
22
+
23
+ var plugin = this;
24
+
25
+ plugin.$element.find('.datepicker').each(function (index, el) {
26
+ if ($(el).parents('.exopite-sof-cloneable__muster').length) return;
27
+ if ($(el).hasClass('.disabled')) return;
28
+ var dateFormat = $(el).data('format');
29
+ $(el).datepicker({ 'dateFormat': dateFormat });
30
+ });
31
+
32
+ plugin.$element.closest('.exopite-sof-wrapper').on('exopite-sof-field-group-item-added-after', function (event, $cloned) {
33
+
34
+ $cloned.find('.datepicker').each(function (index, el) {
35
+
36
+ /**
37
+ * For some reason, datepicker will be attached to muster.
38
+ * Check if exist before added, if yes, firs tremove it.
39
+ */
40
+ if ($(el).closest('.exopite-sof-cloneable__item').hasClass('exopite-sof-cloneable__muster')) return;
41
+ if ($(el).hasClass('disabled')) return;
42
+
43
+ if ($(el).hasClass('hasDatepicker')) {
44
+ $(el).datepicker("destroy");
45
+ $(el).removeClass("hasDatepicker").removeAttr('id');
46
+ }
47
+
48
+ var dateFormat = $(el).data('format');
49
+ $(el).datepicker({ 'dateFormat': dateFormat });
50
+
51
+
52
+ });
53
+
54
+ });
55
+
56
+ },
57
+
58
+ };
59
+
60
+ $.fn[pluginName] = function (options) {
61
+ return this.each(function () {
62
+ if (!$.data(this, "plugin_" + pluginName)) {
63
+ $.data(this, "plugin_" + pluginName,
64
+ new Plugin(this, options));
65
+ }
66
+ });
67
+ };
68
+
69
+ })(jQuery, window, document);
70
+
71
+ ; (function ($) {
72
+ "use strict";
73
+
74
+ $(document).ready(function () {
75
+
76
+ $('.exopite-sof-field-date').exopiteSOFDatepicker();
77
+
78
+ });
79
+
80
+ }(jQuery));
inc/exopite-simple-options/assets/dev/loader-fine-uploader.js ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ;(function ( $, window, document, undefined ) {
2
+
3
+ /*
4
+ * A jQuery Plugin Boilerplate
5
+ *
6
+ * https://github.com/johndugan/jquery-plugin-boilerplate/blob/master/jquery.plugin-boilerplate.js
7
+ * https://john-dugan.com/jquery-plugin-boilerplate-explained/
8
+ */
9
+
10
+ var pluginName = "exopiteFineUploader";
11
+
12
+ // The actual plugin constructor
13
+ function Plugin( element, options ) {
14
+
15
+ this.element = element;
16
+ this._name = pluginName;
17
+ this.$element = $( element );
18
+ this.init();
19
+
20
+ }
21
+
22
+ Plugin.prototype = {
23
+
24
+ init: function() {
25
+
26
+ // console.log( 'maxsize: ' + this.$element.data('maxsize') );
27
+ // console.log( 'allowedExtensions: ' + this.$element.data('mimetypes') );
28
+
29
+ var ajaxUrl = this.$element.data('ajaxurl');
30
+
31
+ this.$element.fineUploader({
32
+ template: 'qq-template-manual-trigger',
33
+ request: {
34
+ endpoint: ajaxUrl,
35
+ // Admin AJAX Param
36
+ params: {
37
+ action: 'exopite-sof-file_uploader',
38
+ postId: this.$element.data('postid')
39
+ },
40
+ paramsInBody: true
41
+ },
42
+ deleteFile: {
43
+ /**
44
+ * Delete file on AJAX request with qquuid
45
+ *
46
+ * @link https://docs.fineuploader.com/features/delete.html
47
+ * @link https://docs.fineuploader.com/branch/master/api/options.html#deleteFile
48
+ */
49
+ method: 'POST',
50
+ endpoint: ajaxUrl,
51
+ params: {
52
+ action: 'exopite-sof-file_uploader',
53
+ },
54
+ enabled : this.$element.data('delete-enabled'),
55
+ forceConfirm : this.$element.data('delete-force-confirm')
56
+ },
57
+ retry: {
58
+ enableAuto : this.$element.data('retry-enable-auto'),
59
+ maxAutoAttempts : this.$element.data('retry-max-auto-attempts'),
60
+ autoAttemptDelay : this.$element.data('retry-auto-attempt-delay'),
61
+ },
62
+ validation: {
63
+ allowedExtensions: this.$element.data('mimetypes').split(','),
64
+ sizeLimit: this.$element.data('maxsize'),
65
+ itemLimit: this.$element.data('filecount')
66
+ },
67
+ autoUpload: this.$element.data('auto-upload'),
68
+ debug: true
69
+ });
70
+
71
+ this.bindEvents();
72
+
73
+ },
74
+
75
+ // Bind events that trigger methods
76
+ bindEvents: function() {
77
+ var plugin = this;
78
+
79
+ plugin.$element.find( '.trigger-upload' ).on( 'click'+'.'+plugin._name, function() {
80
+
81
+ plugin.$element.fineUploader('uploadStoredFiles');
82
+
83
+ });
84
+
85
+ },
86
+
87
+ };
88
+
89
+ $.fn[pluginName] = function ( options ) {
90
+ return this.each(function () {
91
+ if (!$.data(this, "plugin_" + pluginName)) {
92
+ $.data(this, "plugin_" + pluginName,
93
+ new Plugin( this, options ));
94
+ }
95
+ });
96
+ };
97
+
98
+ $( document ).ready(function() {
99
+
100
+ $('.qq-template').exopiteFineUploader();
101
+
102
+ });
103
+
104
+ })( jQuery, window, document );
inc/exopite-simple-options/assets/dev/loader-jquery-chosen.js ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ;(function( $ ) {
2
+ "use strict";
3
+
4
+ $( document ).ready(function() {
5
+
6
+ $( '.exopite-sof-field-select ').find( 'select.chosen' ).each(function(index, el) {
7
+ $( el ).chosen({
8
+ disable_search_threshold: 15,
9
+ width: '375px',
10
+ allow_single_deselect: true
11
+ });
12
+ });
13
+
14
+ });
15
+
16
+ }(jQuery));
inc/exopite-simple-options/assets/dev/loader-jquery-finderselect.js ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ;(function ( $, window, document, undefined ) {
2
+
3
+ /*
4
+ * A jQuery Plugin Boilerplate
5
+ *
6
+ * https://github.com/johndugan/jquery-plugin-boilerplate/blob/master/jquery.plugin-boilerplate.js
7
+ * https://john-dugan.com/jquery-plugin-boilerplate-explained/
8
+ */
9
+
10
+ var pluginName = "exopiteAttachmentRemover";
11
+
12
+ // The actual plugin constructor
13
+ function Plugin( element, options ) {
14
+
15
+ this.element = element;
16
+ this._name = pluginName;
17
+ this.$element = $( element );
18
+ this.init();
19
+
20
+ }
21
+
22
+ Plugin.prototype = {
23
+
24
+ init: function() {
25
+
26
+ this.bindEvents();
27
+
28
+ },
29
+
30
+ // Bind events that trigger methods
31
+ bindEvents: function() {
32
+ var plugin = this;
33
+
34
+ plugin.$element.find( '.exopite-sof-attachment-media-js' ).on( 'click'+'.'+plugin._name, function( event ) {
35
+
36
+ plugin.toggleSelect.call( plugin, $( this ), event );
37
+
38
+ });
39
+
40
+ },
41
+
42
+ toggleSelect: function( $this, event ) {
43
+
44
+ if ( event.ctrlKey ) {
45
+
46
+ $this.toggleClass( 'selected' );
47
+
48
+ } else {
49
+
50
+ var already_selected = $this.hasClass( 'selected' );
51
+ this.$element.find( '.exopite-sof-attachment-media-js' ).removeClass( 'selected' );
52
+
53
+ if ( ! already_selected ) {
54
+
55
+ $this.addClass( 'selected' );
56
+
57
+ }
58
+
59
+ }
60
+
61
+ },
62
+
63
+ };
64
+
65
+ $.fn[pluginName] = function ( options ) {
66
+ return this.each(function () {
67
+ if (!$.data(this, "plugin_" + pluginName)) {
68
+ $.data(this, "plugin_" + pluginName,
69
+ new Plugin( this, options ));
70
+ }
71
+ });
72
+ };
73
+
74
+ $( document ).ready(function() {
75
+
76
+ // $( '.exopite-sof-attachment-container' ).exopiteAttachmentRemover();
77
+ var finderSelect = $( '.exopite-sof-attachment-container' ).finderSelect({children:".exopite-sof-attachment-media-js"});
78
+
79
+ finderSelect.on( "mousedown",".exopite-sof-attachment-media-delete-js", function(e){
80
+ e.stopPropagation();
81
+ });
82
+
83
+ $( '.exopite-sof-attachment-media-delete-js' ).on('click', function(event) {
84
+
85
+ var $attachmentContainer = $( this ).closest( '.exopite-sof-attachment-container' );
86
+ var ajaxUrl = $attachmentContainer.data('ajaxurl');
87
+ var attachmentIDs = new Array();
88
+
89
+ $attachmentContainer.find( '.selected' ).each(function(index, el) {
90
+ attachmentIDs.push( $( el ).data( 'media-id' ) );
91
+ });
92
+
93
+ var confirmDelete = confirm( "Are you sure, you want to delete the selected " + attachmentIDs.length + " media?" );
94
+ if ( confirmDelete == true ) {
95
+
96
+ var dataJSON = {
97
+ 'action': 'exopite-sof-file-batch-delete',
98
+ 'media-ids': attachmentIDs
99
+ };
100
+
101
+ $.ajax({
102
+ cache: false,
103
+ type: "POST",
104
+ url: ajaxUrl,
105
+ data: dataJSON,
106
+ success: function( response ){
107
+ var ids = jQuery.parseJSON( response );
108
+ $.each( ids, function(index, item) {
109
+ $attachmentContainer.find("[data-media-id='" + item + "']").remove();
110
+ });
111
+ },
112
+ error: function( xhr, status, error ) {
113
+ console.log( 'Status: ' + xhr.status );
114
+ console.log( 'Error: ' + xhr.responseText );
115
+ }
116
+ });
117
+
118
+ }
119
+
120
+ });
121
+
122
+ });
123
+
124
+ })( jQuery, window, document );
inc/exopite-simple-options/assets/dev/loader-jquery-trumbowyg.js ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ /**
3
+ * Exopite Simple Options Framework Trumbowyg
4
+ */
5
+ ; (function ($, window, document, undefined) {
6
+
7
+ var pluginName = "exopiteSOFTrumbowyg";
8
+
9
+ // The actual plugin constructor
10
+ function Plugin(element, options) {
11
+
12
+ this.element = element;
13
+ this._name = pluginName;
14
+ this.$element = $(element);
15
+ this.init();
16
+
17
+ }
18
+
19
+ Plugin.prototype = {
20
+
21
+ init: function () {
22
+
23
+ var plugin = this;
24
+
25
+ plugin.trumbowygOptions = new Object();
26
+ plugin.trumbowygOptions.svgPath = plugin.$element.find('.trumbowyg-js').data('icon-path');
27
+
28
+ plugin.trumbowygOptions.btnsDef = {
29
+ // Customizables dropdowns
30
+ image: {
31
+ dropdown: ['insertImage', 'base64'],
32
+ ico: 'insertImage',
33
+ }
34
+ };
35
+
36
+ plugin.trumbowygOptions.btns = [
37
+ ['viewHTML'],
38
+ ['undo', 'redo'],
39
+ ['formatting'],
40
+ ['strong', 'em'],
41
+ ['link'],
42
+ ['image'],
43
+ ['unorderedList', 'orderedList'],
44
+ ['foreColor', 'backColor'],
45
+ ['preformatted'],
46
+ ['fullscreen']
47
+ ];
48
+
49
+ // plugin.$element.find('.trumbowyg-js').not('.disabled').trumbowyg(plugin.trumbowygOptions);
50
+ plugin.$element.find('.trumbowyg-js').not(':disabled').trumbowyg(plugin.trumbowygOptions);
51
+
52
+ var $group = plugin.$element.closest('.exopite-sof-group');
53
+
54
+ // $group.on('exopite-sof-field-group-item-added-after', function (event, $cloned) {
55
+ plugin.$element.on('exopite-sof-field-group-item-added-after', function (event, $cloned) {
56
+
57
+ console.log('test exopite-sof-field-group-item-added-after');
58
+ $cloned.find('.trumbowyg-js').not(':disabled').trumbowyg(plugin.trumbowygOptions);
59
+
60
+ });
61
+
62
+ },
63
+
64
+ };
65
+
66
+ $.fn[pluginName] = function (options) {
67
+ return this.each(function () {
68
+ if (!$.data(this, "plugin_" + pluginName)) {
69
+ $.data(this, "plugin_" + pluginName,
70
+ new Plugin(this, options));
71
+ }
72
+ });
73
+ };
74
+
75
+ })(jQuery, window, document);
76
+
77
+ ; (function ($) {
78
+ "use strict";
79
+
80
+ $(document).ready(function () {
81
+
82
+ $('.exopite-sof-wrapper').exopiteSOFTrumbowyg();
83
+
84
+ });
85
+
86
+ }(jQuery));
inc/exopite-simple-options/assets/dev/loader-minicolors.js ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ /**
3
+ * Exopite Simple Options Framework Color Picker
4
+ *
5
+ * https://tovic.github.io/color-picker/#section:extend
6
+ * https://bgrins.github.io/spectrum/
7
+ * https://www.jqueryscript.net/other/Color-Picker-Plugin-jQuery-MiniColors.html
8
+ * - https://www.jqueryscript.net/demo/Color-Picker-Plugin-jQuery-MiniColors/
9
+ * https://www.jqueryscript.net/other/Color-Picker-Plugin-jQuery-ChromoSelector.html
10
+ */
11
+ ; (function ($, window, document, undefined) {
12
+
13
+ var pluginName = "exopiteSOFMinicolors";
14
+
15
+ // The actual plugin constructor
16
+ function Plugin(element, options) {
17
+
18
+ this.element = element;
19
+ this._name = pluginName;
20
+ this.$element = $(element);
21
+ this.init();
22
+
23
+ }
24
+
25
+ Plugin.prototype = {
26
+
27
+ init: function () {
28
+
29
+ var plugin = this;
30
+
31
+ plugin.minicolorOptions = {
32
+ theme: 'default',
33
+ swatches: '#000|#fff|#f00|#dd9933|#eeee22|#81d742|#1e73be|#8224e3|#2196f3|#4caf50|#ffeb3b|#ff9800|#795548|rgba(0, 0, 0, 0)'.split('|'),
34
+ change: function(value, opacity) {
35
+ plugin.change(value, opacity, $(this));
36
+ if( !value ) return;
37
+ },
38
+ hide : function() {
39
+ let color = $(this).val();
40
+ $(this).val( plugin.rgb2hex(color) );
41
+ }
42
+ };
43
+
44
+ plugin.$element.find('.minicolor').each(function (index, el) {
45
+
46
+ if ($(el).closest('.exopite-sof-cloneable__item').hasClass('exopite-sof-cloneable__muster')) return;
47
+ if ($(el).hasClass('disabled')) return;
48
+
49
+ plugin.minicolorOptions.opacity = $(el).attr('data-opacity') || false;
50
+ plugin.minicolorOptions.control = $(el).attr('data-control') || 'saturation';
51
+ plugin.minicolorOptions.format = $(el).attr('data-format') || 'rgb';
52
+
53
+ $(el).minicolors(plugin.minicolorOptions);
54
+
55
+ });
56
+
57
+ plugin.$element.closest('.exopite-sof-wrapper').on('exopite-sof-field-group-item-added-after', function (event, $cloned) {
58
+
59
+ $cloned.find('.minicolor').each(function (index, el) {
60
+
61
+ if ($(el).closest('.exopite-sof-cloneable__item').hasClass('exopite-sof-cloneable__muster')) return;
62
+ if ($(el).hasClass('disabled')) return;
63
+
64
+ $(el).minicolors(plugin.minicolorOptions);
65
+
66
+ });
67
+
68
+ });
69
+
70
+ },
71
+ rgb2hex: function (rgb){
72
+ var plugin = this;
73
+ rgba = rgb.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?1[\s+]?\)/i);
74
+ console.log('rgba: ' + rgba);
75
+ if (rgba === null) return rgb;
76
+ return (rgba && rgba.length === 4) ? "#" +
77
+ ("0" + parseInt(rgba[1],10).toString(16)).slice(-2) +
78
+ ("0" + parseInt(rgba[2],10).toString(16)).slice(-2) +
79
+ ("0" + parseInt(rgba[3],10).toString(16)).slice(-2) : '';
80
+ },
81
+ change: function (value, opacity, $this) {
82
+ var plugin = this;
83
+ var color = value;
84
+ if ($this.hasClass('font-color-js')) {
85
+ console.log('has font-color');
86
+ $this.parents('.exopite-sof-font-field').find('.exopite-sof-font-preview').css({ 'color': color });
87
+ }
88
+
89
+ $this.val( plugin.rgb2hex(color) );
90
+ },
91
+
92
+ };
93
+
94
+ $.fn[pluginName] = function (options) {
95
+ return this.each(function () {
96
+ if (!$.data(this, "plugin_" + pluginName)) {
97
+ $.data(this, "plugin_" + pluginName,
98
+ new Plugin(this, options));
99
+ }
100
+ });
101
+ };
102
+
103
+ })(jQuery, window, document);
104
+
105
+ ; (function ($) {
106
+ "use strict";
107
+
108
+ $(document).ready(function () {
109
+
110
+ $('.exopite-sof-field').exopiteSOFMinicolors();
111
+
112
+ });
113
+
114
+ }(jQuery));
inc/exopite-simple-options/assets/dev/scripts.js ADDED
@@ -0,0 +1,2106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function updateRangeInput(elem) {
2
+ jQuery(elem).next().val(jQuery(elem).val());
3
+ }
4
+
5
+ function updateInputRange(elem) {
6
+ jQuery(elem).prev().val(jQuery(elem).val());
7
+ }
8
+
9
+ if (typeof throttle !== "function") {
10
+ // Source: https://gist.github.com/killersean/6742f98122d1207cf3bd
11
+ function throttle(callback, limit, callingEvent) {
12
+ var wait = false;
13
+ return function () {
14
+ if (wait && jQuery(window).scrollTop() > 0) {
15
+ return;
16
+ }
17
+ callback.call(undefined, callingEvent);
18
+ wait = true;
19
+ setTimeout(function () {
20
+ wait = false;
21
+ }, limit);
22
+ };
23
+ }
24
+ }
25
+
26
+ // https://stackoverflow.com/questions/24159478/skip-recursion-in-jquery-find-for-a-selector/24215566?noredirect=1#comment37410122_24215566
27
+ jQuery.fn.findExclude = function (selector, mask, result) {
28
+ result = typeof result !== 'undefined' ? result : new jQuery();
29
+ this.children().each(function () {
30
+ var thisObject = jQuery(this);
31
+ if (thisObject.is(selector))
32
+ result.push(this);
33
+ if (!thisObject.is(mask))
34
+ thisObject.findExclude(selector, mask, result);
35
+ });
36
+ return result;
37
+ }
38
+
39
+ /**
40
+ * Get url parameter in jQuery
41
+ * @link https://stackoverflow.com/questions/19491336/get-url-parameter-jquery-or-how-to-get-query-string-values-in-js/25359264#25359264
42
+ */
43
+ ; (function ($, window, document, undefined) {
44
+ $.urlParam = function (name) {
45
+ var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
46
+ if (results == null) {
47
+ return null;
48
+ }
49
+ else {
50
+ return decodeURI(results[1]) || 0;
51
+ }
52
+ };
53
+ })(jQuery, window, document);
54
+
55
+ /**
56
+ * Plugin to handle dependencies
57
+ *
58
+ * @link https://github.com/miohtama/jquery-interdependencies
59
+ *
60
+ * CodeStar Framework
61
+ * The code for process dependencies from data attribute
62
+ *
63
+ * @link https://github.com/Codestar/codestar-framework/
64
+ */
65
+ ; (function ($, window, document, undefined) {
66
+ 'use strict';
67
+ /**
68
+ * Dependency System
69
+ *
70
+ * Codestar Framework
71
+ */
72
+ $.fn.exopiteSofManageDependencies = function (param) {
73
+ return this.each(function () {
74
+
75
+ var base = this,
76
+ $this = $(this);
77
+
78
+ base.init = function () {
79
+
80
+ base.ruleset = $.deps.createRuleset();
81
+ base.param = (param !== undefined) ? base.param = param + '-' : '';
82
+
83
+ var cfg = {
84
+ show: function (el) {
85
+ el.removeClass('hidden');
86
+ },
87
+ hide: function (el) {
88
+ el.addClass('hidden');
89
+ },
90
+ log: false,
91
+ checkTargets: false
92
+
93
+ };
94
+
95
+ base.dep();
96
+
97
+ $.deps.enable($this, base.ruleset, cfg);
98
+
99
+ };
100
+
101
+ base.dep = function () {
102
+
103
+ $this.each(function () {
104
+
105
+ $(this).find('[data-' + base.param + 'controller]').each(function () {
106
+
107
+ var $this = $(this),
108
+ _controller = $this.data(base.param + 'controller').split('|'),
109
+ _condition = $this.data(base.param + 'condition').split('|'),
110
+ _value = $this.data(base.param + 'value').toString().split('|'),
111
+ _rules = base.ruleset;
112
+
113
+ $.each(_controller, function (index, element) {
114
+
115
+ var value = _value[index] || '',
116
+ condition = _condition[index] || _condition[0];
117
+
118
+ _rules = _rules.createRule('[data-' + base.param + 'depend-id="' + element + '"]', condition, value);
119
+ _rules.include($this);
120
+
121
+ });
122
+
123
+ });
124
+
125
+ });
126
+
127
+ };
128
+
129
+ base.init();
130
+
131
+ });
132
+
133
+ };
134
+
135
+ })(jQuery, window, document);
136
+
137
+ /**
138
+ * Exopite SOF Save Options with AJAX
139
+ */
140
+ ; (function ($, window, document, undefined) {
141
+
142
+ var pluginName = "exopiteSaveOptionsAJAX";
143
+
144
+ // The actual plugin constructor
145
+ function Plugin(element, options) {
146
+
147
+ this.element = element;
148
+ this._name = pluginName;
149
+ this.$element = $(element);
150
+ this.init();
151
+
152
+ }
153
+
154
+ Plugin.prototype = {
155
+
156
+ init: function () {
157
+
158
+ this.bindEvents();
159
+
160
+ },
161
+
162
+ // Bind events that trigger methods
163
+ bindEvents: function () {
164
+ var plugin = this;
165
+
166
+ plugin.$element.find('.exopite-sof-form-js').on('submit' + '.' + plugin._name, function (event) {
167
+ plugin.submitOptions.call(this, event);
168
+ });
169
+
170
+ /**
171
+ * Save on CRTL+S
172
+ * @link https://stackoverflow.com/questions/93695/best-cross-browser-method-to-capture-ctrls-with-jquery/14180949#14180949
173
+ */
174
+ $(window).on('keydown' + '.' + plugin._name, function (event) {
175
+
176
+ if (plugin.$element.find('.exopite-sof-form-js').length) {
177
+ if (event.ctrlKey || event.metaKey) {
178
+ switch (String.fromCharCode(event.which).toLowerCase()) {
179
+ case 's':
180
+ event.preventDefault();
181
+ var $form = plugin.$element.find('.exopite-sof-form-js');
182
+ plugin.submitOptions.call($form, event);
183
+ break;
184
+ }
185
+ }
186
+ }
187
+ });
188
+
189
+ $(window).on('scroll' + '.' + plugin._name, throttle(plugin.checkFixed, 100, ''));
190
+
191
+ },
192
+
193
+ // Unbind events that trigger methods
194
+ unbindEvents: function () {
195
+ this.$element.off('.' + this._name);
196
+ },
197
+
198
+ checkFixed: function () {
199
+
200
+ var footerWidth = $('.exopite-sof-form-js').outerWidth();
201
+ var bottom = 0;
202
+
203
+ if (($(window).scrollTop() > ($('.exopite-sof-header-js').position().top + $('.exopite-sof-header-js').outerHeight(true))) &&
204
+ ($(window).scrollTop() + $(window).height() < $(document).height() - 100)) {
205
+ bottom = '0';
206
+ } else {
207
+ bottom = '-' + $('.exopite-sof-footer-js').outerHeight() + 'px';
208
+ }
209
+
210
+
211
+ $('.exopite-sof-footer-js').outerWidth(footerWidth);
212
+ $('.exopite-sof-footer-js').css({
213
+ bottom: bottom,
214
+ });
215
+
216
+ },
217
+
218
+ /**
219
+ * https://thoughtbot.com/blog/ridiculously-simple-ajax-uploads-with-formdata
220
+ * https://stackoverflow.com/questions/17066875/how-to-inspect-formdata
221
+ * https://developer.mozilla.org/en-US/docs/Web/API/FormData/FormData
222
+ * https://developer.mozilla.org/en-US/docs/Web/API/FormData
223
+ * https://stackoverflow.com/questions/2019608/pass-entire-form-as-data-in-jquery-ajax-function
224
+ * https://stackoverflow.com/questions/33487360/formdata-and-checkboxes
225
+ */
226
+ submitOptions: function (event) {
227
+
228
+ event.preventDefault();
229
+ var saveButtonString = $(this).data('save');
230
+ var savedButtonString = $(this).data('saved');
231
+ var $submitButtons = $(this).find('.exopite-sof-submit-button-js');
232
+ var currentButtonString = $submitButtons.val();
233
+ var $ajaxMessage = $(this).find('.exopite-sof-ajax-message');
234
+ $submitButtons.val(saveButtonString).attr('disabled', true);
235
+
236
+ if (typeof tinyMCE != 'undefined') {
237
+ tinyMCE.triggerSave();
238
+ }
239
+
240
+ var formElement = $(this)[0];
241
+ var formData = new FormData(formElement);
242
+
243
+ var formName = $('.exopite-sof-form-js').attr('name');
244
+
245
+ /**
246
+ * 2.) Via ajaxSubmit
247
+ */
248
+ var $that = $(this);
249
+ $(this).ajaxSubmit({
250
+ beforeSubmit: function(arr, $form, options) {
251
+ // The array of form data takes the following form:
252
+ // [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
253
+ // https://jsonformatter.curiousconcept.com/
254
+
255
+ $that.find('[name]').not(':disabled').each(function (index, el) {
256
+ if ($(el).prop('nodeName') == 'INPUT' && $(el).attr('type') == 'checkbox' && !$(el).is(":checked") && !$(el).attr('name').endsWith('[]')) {
257
+ // not checked checkbox
258
+ var element = {
259
+ "name": $(el).attr('name'),
260
+ "value": "no",
261
+ "type": "checkbox",
262
+ // "required":false
263
+ };
264
+ arr.push(element);
265
+ }
266
+ if ($(el).prop('nodeName') == 'SELECT' && $(el).val() == null) {
267
+ // multiselect is empty
268
+ var element = {
269
+ "name": $(el).attr('name'),
270
+ "value": "",
271
+ "type": "select",
272
+ // "required":false
273
+ };
274
+ arr.push(element);
275
+ }
276
+ });
277
+
278
+ // return false to cancel submit
279
+ },
280
+ success: function () {
281
+ $submitButtons.val(currentButtonString).attr('disabled', false);
282
+ $ajaxMessage.html(savedButtonString).addClass('success show');
283
+ $submitButtons.blur();
284
+ setTimeout(function () {
285
+ // $ajaxMessage.fadeOut( 400 );
286
+ $ajaxMessage.removeClass('show');
287
+ }, 3000);
288
+ },
289
+
290
+ error: function (data) {
291
+ $submitButtons.val(currentButtonString).attr('disabled', false);
292
+ $ajaxMessage.html('Error! See console!').addClass('error show');
293
+ },
294
+ });
295
+
296
+ return false;
297
+
298
+ }
299
+
300
+ };
301
+
302
+ $.fn[pluginName] = function (options) {
303
+ return this.each(function () {
304
+ if (!$.data(this, "plugin_" + pluginName)) {
305
+ $.data(this, "plugin_" + pluginName,
306
+ new Plugin(this, options));
307
+ }
308
+ });
309
+ };
310
+
311
+ })(jQuery, window, document);
312
+
313
+ /**
314
+ * Exopite SOF Media Uploader
315
+ */
316
+ ; (function ($, window, document, undefined) {
317
+
318
+ var pluginName = "exopiteMediaUploader";
319
+
320
+ // The actual plugin constructor
321
+ function Plugin(element, options) {
322
+
323
+ this.element = element;
324
+ this._name = pluginName;
325
+ this.$element = $(element);
326
+
327
+ this._defaults = $.fn.exopiteMediaUploader.defaults;
328
+ this.options = $.extend({}, this._defaults, options);
329
+
330
+ this.init();
331
+
332
+ }
333
+
334
+ Plugin.prototype = {
335
+
336
+ init: function () {
337
+
338
+ this.bindEvents();
339
+
340
+ },
341
+
342
+ // Bind events that trigger methods
343
+ bindEvents: function () {
344
+ var plugin = this;
345
+
346
+ plugin.$element.find('.button').on('click' + '.' + plugin._name, function (event) {
347
+ // this refer to the "[plugin-selector] .button" element
348
+ plugin.openMediaUploader.call(this, event, plugin);
349
+ });
350
+
351
+ if (plugin.options.remove !== undefined && plugin.options.input !== undefined && plugin.options.preview !== undefined) {
352
+ plugin.$element.find(plugin.options.remove).on('click' + '.' + plugin._name, function (event) {
353
+ // this refer to the "[plugin-selector] .button" element
354
+ plugin.removePreview.call(this, event, plugin);
355
+ });
356
+ }
357
+
358
+ },
359
+
360
+ openMediaUploader: function (event, plugin) {
361
+
362
+ event.preventDefault();
363
+
364
+ /*
365
+ * Open WordPress Media Uploader
366
+ *
367
+ * @link https://rudrastyh.com/wordpress/customizable-media-uploader.html
368
+ */
369
+
370
+ var button = $(this),
371
+ parent = button.closest('.exopite-sof-media'),
372
+ isVideo = parent.hasClass('exopite-sof-video'),
373
+ mediaType = (isVideo) ? 'video' : 'image',
374
+ custom_uploader = wp.media({
375
+ title: 'Insert image',
376
+ library: {
377
+ // uncomment the next line if you want to attach image to the current post
378
+ // uploadedTo : wp.media.view.settings.post.id,
379
+ type: mediaType
380
+ },
381
+ button: {
382
+ text: 'Use this image' // button label text
383
+ },
384
+ multiple: false // for multiple image selection set to true
385
+ }).on('select', function () { // it also has "open" and "close" events
386
+ var attachment = custom_uploader.state().get('selection').first().toJSON();
387
+
388
+ if (plugin.options.input !== undefined) {
389
+ parent.find(plugin.options.input).val(attachment.url);
390
+ }
391
+ if (!isVideo && plugin.options.preview !== undefined) {
392
+ parent.find(plugin.options.preview).removeClass('hidden');
393
+ parent.find('img').attr({ 'src': attachment.url });
394
+ }
395
+ if (isVideo) {
396
+ parent.find('video').attr({ 'src': attachment.url });
397
+ }
398
+ // $(button).removeClass('button').html('<img class="true_pre_image" src="' + attachment.url + '" style="max-width:95%;display:block;" />').next().val(attachment.id).next().show();
399
+ /* if you sen multiple to true, here is some code for getting the image IDs
400
+ var attachments = frame.state().get('selection'),
401
+ attachment_ids = new Array(),
402
+ i = 0;
403
+ attachments.each(function(attachment) {
404
+ attachment_ids[i] = attachment['id'];
405
+ console.log( attachment );
406
+ i++;
407
+ });
408
+ */
409
+ })
410
+ .open();
411
+
412
+ },
413
+
414
+ removePreview: function (event, plugin) {
415
+
416
+ var parent = plugin.$element;
417
+
418
+ var previewWrapper = parent.find(plugin.options.preview);
419
+ var previewImg = parent.find('img');
420
+
421
+ if (previewWrapper.css('display') !== 'none' &&
422
+ previewImg.css('display') !== 'none'
423
+ ) {
424
+ previewWrapper.addClass('hidden');
425
+ previewImg.attr({ 'src': '' });
426
+ }
427
+
428
+ parent.find(plugin.options.input).val('');
429
+ }
430
+
431
+ };
432
+
433
+ $.fn[pluginName] = function (options) {
434
+ return this.each(function () {
435
+ if (!$.data(this, "plugin_" + pluginName)) {
436
+ $.data(this, "plugin_" + pluginName,
437
+ new Plugin(this, options));
438
+ }
439
+ });
440
+ };
441
+
442
+ })(jQuery, window, document);
443
+
444
+ /**
445
+ * Exopite SOF Options Navigation
446
+ */
447
+ ; (function ($, window, document, undefined) {
448
+
449
+ /**
450
+ * A jQuery Plugin Boilerplate
451
+ *
452
+ * https://github.com/johndugan/jquery-plugin-boilerplate/blob/master/jquery.plugin-boilerplate.js
453
+ * https://john-dugan.com/jquery-plugin-boilerplate-explained/
454
+ */
455
+
456
+ var pluginName = "exopiteOptionsNavigation";
457
+
458
+ // The actual plugin constructor
459
+ function Plugin(element, options) {
460
+
461
+ this.element = element;
462
+ this._name = pluginName;
463
+ this.$element = $(element);
464
+ this.init();
465
+
466
+ }
467
+
468
+ Plugin.prototype = {
469
+
470
+ init: function () {
471
+
472
+ this.bindEvents();
473
+
474
+ },
475
+
476
+ // Bind events that trigger methods
477
+ bindEvents: function () {
478
+ var plugin = this;
479
+
480
+ plugin.onLoad.call(plugin);
481
+
482
+ plugin.$element.find('.exopite-sof-nav-list-item').on('click' + '.' + plugin._name, function () {
483
+
484
+ plugin.changeTab.call(plugin, $(this));
485
+
486
+ });
487
+
488
+ plugin.$element.find('.exopite-sof-nav-list-parent-item > .exopite-sof-nav-list-item-title').on('click' + '.' + plugin._name, function () {
489
+
490
+ plugin.toggleSubMenu.call(plugin, $(this));
491
+
492
+ });
493
+
494
+ },
495
+
496
+ // Unbind events that trigger methods
497
+ unbindEvents: function () {
498
+ this.$element.off('.' + this._name);
499
+ },
500
+
501
+ toggleSubMenu: function (button) {
502
+ // var $parent = button;
503
+ var $parent = button.parents('.exopite-sof-nav-list-parent-item');
504
+ $parent.toggleClass('active').find('ul').slideToggle(200);
505
+ },
506
+ changeTab: function (button) {
507
+
508
+ if (!button.hasClass('active')) {
509
+
510
+ var section = '.exopite-sof-section-' + button.data('section');
511
+
512
+ this.$element.find('.exopite-sof-nav-list-item.active').removeClass('active');
513
+
514
+ button.addClass('active');
515
+
516
+ this.$element.find('.exopite-sof-section').addClass('hide');
517
+ this.$element.find(section).removeClass('hide');
518
+
519
+ }
520
+
521
+ },
522
+
523
+ onLoad: function () {
524
+ var plugin = this;
525
+
526
+ /**
527
+ * "Sanitize" URL
528
+ * @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent
529
+ */
530
+ var URLSection = encodeURIComponent($.urlParam('section'));
531
+
532
+ // If section not exist, then return
533
+ if (!plugin.$element.find('.exopite-sof-section-' + URLSection).length) return false;
534
+
535
+ var navList = plugin.$element.find('.exopite-sof-nav-list-item');
536
+ plugin.$element.find('.exopite-sof-section').addClass('hide');
537
+ plugin.$element.find('.exopite-sof-section-' + URLSection).removeClass('hide');
538
+ navList.removeClass('active');
539
+ navList.each(function (index, el) {
540
+ var section = $(el).data('section');
541
+ if (section == URLSection) {
542
+ $(el).addClass('active');
543
+ }
544
+ });
545
+ },
546
+
547
+ };
548
+
549
+ $.fn[pluginName] = function (options) {
550
+ return this.each(function () {
551
+ if (!$.data(this, "plugin_" + pluginName)) {
552
+ $.data(this, "plugin_" + pluginName,
553
+ new Plugin(this, options));
554
+ }
555
+ });
556
+ };
557
+
558
+ })(jQuery, window, document);
559
+
560
+ /**
561
+ * Exopite SOF Handle TinyMCE
562
+ */
563
+ ; (function ($, window, document, undefined) {
564
+
565
+ var pluginName = "exopiteSOFTinyMCE";
566
+
567
+ // The actual plugin constructor
568
+ function Plugin(element, options) {
569
+
570
+ if (typeof tinyMCE == 'undefined') return;
571
+
572
+ this.element = element;
573
+ this._name = pluginName;
574
+ this.$element = $(element);
575
+ this.init();
576
+
577
+ }
578
+
579
+ Plugin.prototype = {
580
+
581
+ init: function () {
582
+
583
+ var plugin = this;
584
+
585
+ tinyMCE.init({
586
+ theme: 'modern',
587
+ plugins: "charmap,colorpicker,hr,lists,media,paste,tabfocus,textcolor,fullscreen,wordpress,wpautoresize,wpeditimage,wpemoji,wpgallery,wplink,wpdialogs,wptextpattern,wpview",
588
+ quicktags: true,
589
+ tinymce: true,
590
+ branding: false,
591
+ media_buttons: true,
592
+ });
593
+
594
+ plugin.initTinyMCE();
595
+
596
+ plugin.$element.on('exopite-sof-accordion-sortstart', function (event, $sortable) {
597
+ $sortable.find('.tinymce-js').not(':disabled').each(function () {
598
+ tinyMCE.execCommand('mceRemoveEditor', false, $(this).attr('id'));
599
+ });
600
+ });
601
+
602
+ plugin.$element.on('exopite-sof-accordion-sortstop', function (event, $sortable) {
603
+ $sortable.find('.tinymce-js').not(':disabled').each(function () {
604
+ tinyMCE.execCommand('mceAddEditor', true, $(this).attr('id'));
605
+ });
606
+ });
607
+
608
+ var $group = plugin.$element.parents('.exopite-sof-field-group');
609
+
610
+ plugin.$element.on('exopite-sof-field-group-item-inserted-after', function (event, $cloned) {
611
+ $cloned.find('.tinymce-js').each(function (index, el) {
612
+ var nextEditorID = plugin.musterID + (parseInt($group.find('.tinymce-js').not(':disabled').length) - 1);
613
+ $(el).attr('id', nextEditorID);
614
+ tinyMCE.execCommand('mceAddEditor', true, nextEditorID);
615
+ });
616
+
617
+ });
618
+
619
+ plugin.$element.on('exopite-sof-field-group-item-cloned-after', function (event, $cloned) {
620
+
621
+ $cloned.find('.tinymce-js').each(function (index, el) {
622
+ var nextEditorID = plugin.musterID + (parseInt($group.find('.tinymce-js').not(':disabled').length) - 1);
623
+ $(el).attr('id', nextEditorID);
624
+ $(el).show();
625
+ $(el).prev('.mce-tinymce').remove();
626
+ tinyMCE.execCommand('mceAddEditor', true, nextEditorID);
627
+ });
628
+
629
+ });
630
+
631
+ },
632
+
633
+ initTinyMCE: function () {
634
+ var plugin = this;
635
+ plugin.musterID = plugin.$element.find('.exopite-sof-cloneable__muster .tinymce-js').first().attr('id') + '-';
636
+
637
+ plugin.$element.find('.tinymce-js').not(':disabled').each(function (index, el) {
638
+ $(this).attr('id', plugin.musterID + index);
639
+ var fullId = $(this).attr('id');
640
+
641
+ tinyMCE.execCommand('mceAddEditor', true, fullId);
642
+
643
+ });
644
+
645
+ },
646
+
647
+
648
+ };
649
+
650
+ $.fn[pluginName] = function (options) {
651
+ return this.each(function () {
652
+ if (!$.data(this, "plugin_" + pluginName)) {
653
+ $.data(this, "plugin_" + pluginName,
654
+ new Plugin(this, options));
655
+ }
656
+ });
657
+ };
658
+
659
+ })(jQuery, window, document);
660
+
661
+ /**
662
+ * Exopite SOF Font Field Preview
663
+ */
664
+ ; (function ($, window, document, undefined) {
665
+
666
+ var pluginName = "exopiteFontPreview";
667
+
668
+ // The actual plugin constructor
669
+ function Plugin(element, options) {
670
+
671
+ this.element = element;
672
+ this._name = pluginName;
673
+ this.$element = $(element);
674
+ this.$nav = this.$element.find('.exopite-sof-nav');
675
+
676
+ this.init();
677
+
678
+ }
679
+
680
+ Plugin.prototype = {
681
+
682
+ init: function () {
683
+ var plugin = this;
684
+
685
+ var $sizeHeightWrapper = this.$element.children('.exopite-sof-typography-size-height');
686
+ var $colorWrapper = this.$element.children('.exopite-sof-typography-color');
687
+ plugin.preview = this.$element.children('.exopite-sof-font-preview');
688
+ plugin.fontColor = $colorWrapper.find('.font-color-js').first();
689
+ plugin.fontSize = $sizeHeightWrapper.children('span').children('.font-size-js');
690
+ plugin.lineHeight = $sizeHeightWrapper.children('span').children('.line-height-js');
691
+ // plugin.lineHeight = this.$element.find( '.line-height-js' );
692
+ plugin.fontFamily = this.$element.children('.exopite-sof-typography-family').children('.exopite-sof-typo-family');
693
+ plugin.fontWeight = this.$element.children('.exopite-sof-typography-variant').children('.exopite-sof-typo-variant');
694
+
695
+ // Set current values to preview
696
+ this.loadGoogleFont();
697
+ this.updatePreview();
698
+ this.setColorOnStart();
699
+
700
+ this.bindEvents();
701
+
702
+ },
703
+
704
+ // Bind events that trigger methods
705
+ bindEvents: function () {
706
+ var plugin = this;
707
+
708
+ plugin.$element.on('change' + '.' + plugin._name, '.font-size-js, .line-height-js, .font-color-js, .exopite-sof-typo-variant', function (e) {
709
+ e.preventDefault();
710
+ plugin.updatePreview();
711
+ });
712
+
713
+ plugin.$element.on('change' + '.' + plugin._name, '.exopite-sof-typo-family', function (e) {
714
+ e.preventDefault();
715
+ plugin.loadGoogleFont();
716
+ });
717
+
718
+
719
+ },
720
+
721
+ // Unbind events that trigger methods
722
+ unbindEvents: function () {
723
+ this.$element.off('.' + this._name);
724
+ },
725
+ // Remove plugin instance completely
726
+ destroy: function() {
727
+ this.unbindEvents();
728
+ this.$element.removeData('plugin_' + this._name);
729
+ // this.element.removeData();
730
+ this.element = null;
731
+ this.$element = null;
732
+ },
733
+ setColorOnStart: function() {
734
+ var plugin = this;
735
+ var color = plugin.fontColor.val();
736
+ plugin.preview.css({ 'color': color });
737
+ },
738
+ updatePreview: function () {
739
+ var plugin = this;
740
+ var fontWeightStyle = plugin.calculateFontWeight(plugin.fontWeight.find(':selected').text());
741
+ // Update preiew
742
+ plugin.preview.css({
743
+ 'font-size': plugin.fontSize.val() + 'px',
744
+ 'line-height': plugin.lineHeight.val() + 'px',
745
+ 'font-weight': fontWeightStyle.fontWeightValue,
746
+ 'font-style': fontWeightStyle.fontStyleValue
747
+ });
748
+ },
749
+ updateVariants: function (variants) {
750
+ var plugin = this;
751
+ var variantsArray = variants.split('|');
752
+ var selected = plugin.fontWeight.children('option:selected').val();
753
+ plugin.fontWeight.empty();
754
+ $.each(variantsArray, function (key, value) {
755
+ var $option = $("<option></option>").attr("value", value).text(value);
756
+ plugin.fontWeight.append($option);
757
+ if (value == selected) {
758
+ $option.attr('selected', 'selected');
759
+ }
760
+ });
761
+ plugin.fontWeight.trigger("chosen:updated");
762
+ },
763
+ loadGoogleFont: function () {
764
+ var plugin = this;
765
+ var variants = plugin.fontFamily.find(":selected").data('variants');
766
+
767
+ plugin.updateVariants(variants);
768
+
769
+ var font = plugin.fontFamily.val();
770
+ if (!font) return;
771
+ var href = '//fonts.googleapis.com/css?family=' + font + ':' + variants.replace(/\|/g, ',');
772
+ var parentName = plugin.$element.find('.exopite-sof-font-field-js').data('id');
773
+ var html = '<link href="' + href + '" class="cs-font-preview-' + parentName + '" rel="stylesheet" type="text/css" />';
774
+
775
+ if ($('.cs-font-preview-' + parentName).length > 0) {
776
+ $('.cs-font-preview-' + parentName).attr('href', href).load();
777
+ } else {
778
+ $('head').append(html).load();
779
+ }
780
+
781
+ // Update preiew
782
+ plugin.preview.css('font-family', font).css('font-weight', '400');
783
+
784
+ },
785
+ calculateFontWeight: function (fontWeight) {
786
+ var fontWeightValue = '400';
787
+ var fontStyleValue = 'normal';
788
+
789
+ switch (fontWeight) {
790
+ case '100':
791
+ fontWeightValue = '100';
792
+ break;
793
+ case '100italic':
794
+ fontWeightValue = '100';
795
+ fontStyleValue = 'italic';
796
+ break;
797
+ case '300':
798
+ fontWeightValue = '300';
799
+ break;
800
+ case '300italic':
801
+ fontWeightValue = '300';
802
+ fontStyleValue = 'italic';
803
+ break;
804
+ case '500':
805
+ fontWeightValue = '500';
806
+ break;
807
+ case '500italic':
808
+ fontWeightValue = '500';
809
+ fontStyleValue = 'italic';
810
+ break;
811
+ case '700':
812
+ fontWeightValue = '700';
813
+ break;
814
+ case '700italic':
815
+ fontWeightValue = '700';
816
+ fontStyleValue = 'italic';
817
+ break;
818
+ case '900':
819
+ fontWeightValue = '900';
820
+ break;
821
+ case '900italic':
822
+ fontWeightValue = '900';
823
+ fontStyleValue = 'italic';
824
+ break;
825
+ case 'italic':
826
+ fontStyleValue = 'italic';
827
+ break;
828
+ }
829
+
830
+ return { fontWeightValue, fontStyleValue };
831
+ },
832
+
833
+
834
+ };
835
+
836
+ $.fn[pluginName] = function (options) {
837
+ return this.each(function () {
838
+ if (!$.data(this, "plugin_" + pluginName)) {
839
+ $.data(this, "plugin_" + pluginName,
840
+ new Plugin(this, options));
841
+ }
842
+ });
843
+ };
844
+
845
+ })(jQuery, window, document);
846
+
847
+ /**
848
+ * Exopite SOF Repeater
849
+ */
850
+ ; (function ($, window, document, undefined) {
851
+
852
+ /**
853
+ * A jQuery Plugin Boilerplate
854
+ *
855
+ * https://github.com/johndugan/jquery-plugin-boilerplate/blob/master/jquery.plugin-boilerplate.js
856
+ * https://john-dugan.com/jquery-plugin-boilerplate-explained/
857
+ */
858
+
859
+ var pluginName = "exopiteSOFRepeater";
860
+
861
+ // The actual plugin constructor
862
+ function Plugin(element, options) {
863
+
864
+ this.element = element;
865
+ this._name = pluginName;
866
+ this.$element = $(element);
867
+ this.$sortableWrapper = this.$element.children('.exopite-sof-cloneable__wrapper');
868
+ this.$container = $(element).children('.exopite-sof-accordion__wrapper').first();
869
+ this.sortable = null;
870
+
871
+ this.init();
872
+
873
+ }
874
+
875
+ Plugin.prototype = {
876
+
877
+ init: function () {
878
+
879
+ this.isSortable = (this.$container.data('is-sortable'));
880
+ this.bindEvents();
881
+ this.updateTitle();
882
+ this.setMusterDisabled();
883
+ this.sortableInit();
884
+
885
+ /**
886
+ * Access other plugin functions and variables
887
+ */
888
+ // this.$element.data('plugin_exopiteSOFAccordion').showYorself('test')
889
+ // console.log('options: ' + JSON.stringify(this.$element.data('plugin_exopiteSOFAccordion').sortableOptions));
890
+
891
+ },
892
+
893
+ sortableInit: function() {
894
+
895
+ if (this.isSortable) {
896
+
897
+ //https://github.com/lukasoppermann/html5sortable
898
+ sortable('.exopite-sof-cloneable__wrapper', {
899
+ handle: '.exopite-sof-cloneable__title',
900
+ });
901
+ }
902
+
903
+ },
904
+
905
+ // Bind events that trigger methods
906
+ bindEvents: function () {
907
+ var plugin = this;
908
+
909
+ // Predefinied
910
+ plugin.$element.find('.exopite-sof-cloneable--add').off().on('click' + '.' + plugin._name, function (e) {
911
+ e.preventDefault();
912
+ if ($(this).is(":disabled")) return;
913
+ plugin.addNew.call(plugin, $(this));
914
+
915
+ });
916
+
917
+ // Dynamically added
918
+ plugin.$element.on('click' + '.' + plugin._name, '.exopite-sof-cloneable--remove:not(.disabled)', function (e) {
919
+
920
+ if (e.target != this) return false;
921
+ e.preventDefault();
922
+ plugin.remove($(this));
923
+
924
+ });
925
+
926
+ plugin.$element.on('click' + '.' + plugin._name, '.exopite-sof-cloneable--clone:not(.disabled)', function (e) {
927
+
928
+ // Match only on clicked element
929
+ if (e.target != this) return false;
930
+
931
+ e.preventDefault();
932
+
933
+ // Stop event bubbling
934
+ e.stopPropagation();
935
+
936
+ plugin.addNew($(this));
937
+
938
+ });
939
+
940
+ plugin.$element.find('.exopite-sof-cloneable__item').on('input change blur', '[data-title=title]', function (event) {
941
+
942
+ plugin.updateTitleElement($(this));
943
+
944
+ });
945
+
946
+ /**
947
+ * Need to "reorder" name elements for metabox,
948
+ * so it is saved in the order of displayed.
949
+ */
950
+ // Call function if sorting is stopped
951
+ plugin.$container.on('sortstart' + '.' + plugin._name, function () {
952
+
953
+ plugin.$element.trigger('exopite-sof-accordion-sortstart', [plugin.$container]);
954
+
955
+ });
956
+
957
+
958
+ plugin.$container.on('sortstop' + '.' + plugin._name, function (event, ui) {
959
+
960
+ event.stopPropagation();
961
+
962
+ plugin.updateName($(this));
963
+
964
+ });
965
+
966
+ },
967
+
968
+ // Unbind events that trigger methods
969
+ unbindEvents: function () {
970
+ this.$element.off('.' + this._name);
971
+ },
972
+
973
+ updateName: function( $element ) {
974
+ var plugin = this;
975
+
976
+ var text = $element.closest('.exopite-sof-group').children('.exopite-sof-cloneable--add').text();
977
+
978
+ var $wrapper = $element.closest('.exopite-sof-cloneable__wrapper');
979
+ var wrapperName = $wrapper.attr('data-name');
980
+ var baseName = wrapperName.replace(/\[REPLACEME\]$/, '');
981
+ var baseNameRegex = plugin.escapeRegExp(baseName);
982
+ var regexGroupName = new RegExp(baseNameRegex + "\\[(.*?)\\]", "i");
983
+
984
+ $wrapper.findExclude('.exopite-sof-cloneable__item', '.exopite-sof-group').each(function(index, el){
985
+
986
+ /**
987
+ * Update data-name for muster element (set parent indexes for cloning)
988
+ */
989
+ $(el).find('[data-name^="' + baseName + '"]').each(function(indexName, elDataName){
990
+ var elementName = $(elDataName).attr('data-name');
991
+
992
+ var relpacedName = elementName.replace(regexGroupName, function ($0, $1) {
993
+ // options[en][group][0][field][]
994
+
995
+ return baseName + '[' + index + ']';
996
+ });
997
+
998
+ $(elDataName).attr('data-name', relpacedName);
999
+
1000
+ });
1001
+
1002
+ /**
1003
+ * Update element names (only this parent index) from current level to the last level
1004
+ */
1005
+ $(el).find('[name^="' + baseName + '"]').each(function(indexName, elName){
1006
+
1007
+ var elementName = $(elName).attr('name');
1008
+ var relpacedName = elementName.replace(regexGroupName, function ($0, $1) {
1009
+ // options[en][group][0][field][]
1010
+
1011
+ return baseName + '[' + index + ']';
1012
+ });
1013
+
1014
+ $(elName).attr('name', relpacedName);
1015
+
1016
+ });
1017
+
1018
+
1019
+ });
1020
+
1021
+ },
1022
+
1023
+ remove: function ($button) {
1024
+
1025
+ $wrapper = $button.closest('.exopite-sof-cloneable__wrapper');
1026
+ $button.closest('.exopite-sof-cloneable__item').remove();
1027
+ this.updateName($wrapper);
1028
+ this.checkAmount($wrapper);
1029
+
1030
+ $button.trigger('exopite-sof-field-group-item-removed');
1031
+
1032
+ },
1033
+
1034
+ checkAmount: function ($wrapper) {
1035
+
1036
+ var numItems = $wrapper.children('.exopite-sof-cloneable__item').length;
1037
+ var maxItems = $wrapper.data('limit');
1038
+
1039
+ if (typeof maxItems !== 'undefined') {
1040
+ return numItems;
1041
+ }
1042
+
1043
+ /**
1044
+ * Fixme:
1045
+ * - This apply to all child, wrong!
1046
+ */
1047
+ if (maxItems <= numItems) {
1048
+ this.$element.find('.exopite-sof-cloneable--add').attr("disabled", true);
1049
+ return false;
1050
+ } else {
1051
+ this.$element.find('.exopite-sof-cloneable--add').attr("disabled", false);
1052
+ return numItems;
1053
+ }
1054
+
1055
+
1056
+ },
1057
+
1058
+ setMusterDisabled: function () {
1059
+
1060
+ /**
1061
+ * Mainly for nested elements (in our case: tab)
1062
+ * This will prevent dinamically added muster elements to save.
1063
+ */
1064
+ this.$element.find('.exopite-sof-cloneable__muster').find('[name]').prop('disabled', true).addClass('disabled');
1065
+
1066
+ },
1067
+
1068
+ updateTitleElement: function ($element) {
1069
+
1070
+ var $item = $element.closest('.exopite-sof-cloneable__item');
1071
+ var title = $item.find('[data-title=title]').first().val();
1072
+ $item.children('.exopite-sof-cloneable__title').children('.exopite-sof-cloneable__text').text(title);
1073
+ $item.trigger('exopite-sof-field-group-item-title-updated');
1074
+
1075
+ },
1076
+
1077
+ updateTitle: function () {
1078
+
1079
+ this.$element.find('.exopite-sof-cloneable__wrapper').find('.exopite-sof-cloneable__item').find('[data-title=title]').each(function (index, el) {
1080
+ var title = $(el).val();
1081
+ if (title) {
1082
+ $(el).closest('.exopite-sof-cloneable__item').children('.exopite-sof-cloneable__title').children('.exopite-sof-cloneable__text').text(title);
1083
+ }
1084
+
1085
+ $(el).trigger('exopite-sof-field-group-item-title-updated');
1086
+ });
1087
+
1088
+ },
1089
+
1090
+ escapeRegExp: function (stringToGoIntoTheRegex) {
1091
+ // https://stackoverflow.com/questions/17885855/use-dynamic-variable-string-as-regex-pattern-in-javascript/17886301#17886301
1092
+ return stringToGoIntoTheRegex.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
1093
+ },
1094
+
1095
+ removeIfNested: function(index) {
1096
+ // this is the corrent DOM element
1097
+ var $this = $(this),
1098
+ return_value = false;
1099
+
1100
+ $.each($this.attr('class').split(/\s+/), function(index) {
1101
+ if ($this.parents("." + this).length > 0) {
1102
+ return_value = default_value || true;
1103
+ }
1104
+ });
1105
+
1106
+ return return_value;
1107
+ },
1108
+
1109
+ addNew: function ($element) {
1110
+
1111
+ var plugin = this;
1112
+
1113
+ var $group = $element.closest('.exopite-sof-group');
1114
+
1115
+ if ($.fn.chosen) $group.find("select.chosen").chosen("destroy");
1116
+
1117
+ var is_cloned = false;
1118
+ var $cloned = null;
1119
+
1120
+ // Decide which element need to clone: the clicked or the muster?
1121
+ if ($element.hasClass('exopite-sof-cloneable--clone')) {
1122
+ $cloned = $element.parent().parent().parent('.exopite-sof-cloneable__item').clone(true);
1123
+ is_cloned = true;
1124
+ } else {
1125
+ var $muster = $element.parent().children('.exopite-sof-cloneable__muster');
1126
+ $cloned = $muster.clone(true);
1127
+ }
1128
+
1129
+ /**
1130
+ * Get hidden "muster" element and clone it. Remove hidden muster classes.
1131
+ * Add trigger before and after (for various programs, like TinyMCE, Trumbowyg, etc...)
1132
+ * Finaly append to group.
1133
+ */
1134
+ $cloned.find('.exopite-sof-cloneable--remove').removeClass('disabled');
1135
+ $cloned.find('.exopite-sof-cloneable--clone').removeClass('disabled');
1136
+ $cloned.removeClass('exopite-sof-cloneable__muster');
1137
+ $cloned.removeClass('exopite-sof-cloneable__muster--hidden');
1138
+ $cloned.removeClass('exopite-sof-accordion--hidden');
1139
+ $cloned.findExclude('[disabled]', '.exopite-sof-cloneable__muster').attr('disabled', false).removeClass('disabled');;
1140
+
1141
+ plugin.$element.trigger('exopite-sof-field-group-item-added-before', [$cloned, $group]);
1142
+
1143
+ if (is_cloned) {
1144
+
1145
+ // Remove font preview plugin
1146
+ $cloned.find('.exopite-sof-font-field').unbind().removeData('plugin_exopiteFontPreview');
1147
+
1148
+ if ($.fn.chosen) $cloned.find('select.chosen').unbind().removeData().next().remove();
1149
+
1150
+ // Insert after clicked element
1151
+ $cloned.insertAfter($element.closest('.exopite-sof-cloneable__item'));
1152
+ $wrapper = $element.closest('.exopite-sof-cloneable__wrapper');
1153
+ } else {
1154
+ // Insert after all elements
1155
+ $group.children('.exopite-sof-cloneable__wrapper').first().append($cloned);
1156
+ $wrapper = $element.closest('.exopite-sof-group').children('.exopite-sof-cloneable__wrapper');
1157
+ }
1158
+
1159
+ var numItem = plugin.checkAmount($wrapper);
1160
+ if (! numItem) {
1161
+ return;
1162
+ }
1163
+
1164
+ plugin.setMusterDisabled();
1165
+ plugin.updateName($wrapper);
1166
+
1167
+ if ($.fn.chosen) $group.find("select.chosen").chosen({ width: "375px" });
1168
+
1169
+ // If has date picker, initilize it.
1170
+ $cloned.find('.datepicker').each(function (index, el) {
1171
+ var dateFormat = $(el).data('format');
1172
+ $(el).removeClass('hasDatepicker').datepicker({ 'dateFormat': dateFormat });
1173
+ });
1174
+
1175
+ plugin.sortableInit();
1176
+
1177
+ // Handle dependencies.
1178
+ $cloned.exopiteSofManageDependencies('sub');
1179
+ $cloned.find('.exopite-sof-cloneable__content').removeAttr("style").show();
1180
+
1181
+ $cloned.find('.exopite-sof-font-field').each(function(index,el){
1182
+
1183
+ if (!$(el).children('label').children('select').is(":disabled")) {
1184
+ $(el).exopiteFontPreview();
1185
+ }
1186
+
1187
+ });
1188
+
1189
+ sortable('.exopite-sof-gallery', {
1190
+ forcePlaceholderSize: true,
1191
+ });
1192
+
1193
+ plugin.$element.trigger('exopite-sof-field-group-item-added-after', [$cloned, $group]);
1194
+ if (is_cloned) {
1195
+ plugin.$element.trigger('exopite-sof-field-group-item-cloned-after', [$cloned, $group]);
1196
+ } else {
1197
+ plugin.$element.trigger('exopite-sof-field-group-item-inserted-after', [$cloned, $group]);
1198
+ }
1199
+
1200
+ },
1201
+
1202
+ };
1203
+
1204
+ $.fn[pluginName] = function (options) {
1205
+ return this.each(function () {
1206
+ if (!$.data(this, "plugin_" + pluginName)) {
1207
+ $.data(this, "plugin_" + pluginName,
1208
+ new Plugin(this, options));
1209
+ }
1210
+ });
1211
+ };
1212
+
1213
+ })(jQuery, window, document);
1214
+
1215
+ /**
1216
+ * Exopite SOF Accordion
1217
+ */
1218
+ ; (function ($, window, document, undefined) {
1219
+
1220
+ var pluginName = "exopiteSOFAccordion";
1221
+
1222
+ // The actual plugin constructor
1223
+ function Plugin(element, options) {
1224
+
1225
+ this.element = element;
1226
+ this._name = pluginName;
1227
+ this.$element = $(element);
1228
+ this.$container = $(element).children('.exopite-sof-accordion__wrapper').first();
1229
+ this.allOpen = (this.$container.data('all-open') || typeof this.$container.data('all-open') == 'undefined');
1230
+ this.init();
1231
+
1232
+ }
1233
+
1234
+ Plugin.prototype = {
1235
+
1236
+ init: function () {
1237
+
1238
+ this.bindEvents();
1239
+
1240
+ },
1241
+
1242
+ // showYorself: function(somevar){
1243
+ // console.log('Yeah baby it is me: ' + somevar);
1244
+ // },
1245
+
1246
+ // Bind events that trigger methods
1247
+ bindEvents: function () {
1248
+ var plugin = this;
1249
+
1250
+ plugin.$container.off().on('click' + '.' + plugin._name, '.exopite-sof-accordion__title', function (e) {
1251
+ e.preventDefault();
1252
+
1253
+ if (!$(e.target).hasClass('exopite-sof-cloneable--clone') && !$(this).closest('.exopite-sof-accordion__wrapper').hasClass('exopite-sof-group-compact')) {
1254
+ plugin.toggleAccordion.call(plugin, $(this));
1255
+ }
1256
+
1257
+ });
1258
+
1259
+ },
1260
+
1261
+ // Unbind events that trigger methods
1262
+ unbindEvents: function () {
1263
+ this.$container.off('.' + this._name);
1264
+ },
1265
+
1266
+ slideUp: function ($element) {
1267
+ $element.children('.exopite-sof-accordion__content').slideUp(350, function () {
1268
+ $element.addClass('exopite-sof-accordion--hidden');
1269
+ });
1270
+ },
1271
+
1272
+ slideDown: function ($element) {
1273
+ $element.children('.exopite-sof-accordion__content').slideDown(350, function () {
1274
+ $element.removeClass('exopite-sof-accordion--hidden');
1275
+ });
1276
+ },
1277
+
1278
+ toggleAccordion: function ($header) {
1279
+ var plugin = this;
1280
+ var $this = $header.parent('.exopite-sof-accordion__item');
1281
+
1282
+ /**
1283
+ * This is for the accordion field.
1284
+ */
1285
+ if (!this.allOpen) {
1286
+
1287
+ this.$container.findExclude('.exopite-sof-accordion__item', '.exopite-sof-accordion').each(function (index, el) {
1288
+
1289
+ if ($(el).is($this)) {
1290
+ plugin.slideDown($this);
1291
+ } else {
1292
+ plugin.slideUp($(el));
1293
+ }
1294
+
1295
+ });
1296
+
1297
+ } else {
1298
+
1299
+ if ($this.hasClass('exopite-sof-accordion--hidden')) {
1300
+ plugin.slideDown($this);
1301
+ } else {
1302
+ plugin.slideUp($this);
1303
+ }
1304
+
1305
+ }
1306
+
1307
+ },
1308
+
1309
+ };
1310
+
1311
+ $.fn[pluginName] = function (options) {
1312
+ return this.each(function () {
1313
+ if (!$.data(this, "plugin_" + pluginName)) {
1314
+ $.data(this, "plugin_" + pluginName,
1315
+ new Plugin(this, options));
1316
+ }
1317
+ });
1318
+ };
1319
+
1320
+ })(jQuery, window, document);
1321
+
1322
+
1323
+ /**
1324
+ * Exopite SOF Search In Options
1325
+ */
1326
+ ; (function ($, window, document, undefined) {
1327
+
1328
+ var pluginName = "exopiteSofSearch";
1329
+
1330
+ // The actual plugin constructor
1331
+ function Plugin(element, options) {
1332
+
1333
+ this.element = element;
1334
+ this._name = pluginName;
1335
+ this.$element = $(element);
1336
+ this.$nav = this.$element.find('.exopite-sof-nav');
1337
+
1338
+ this.init();
1339
+
1340
+ }
1341
+
1342
+ Plugin.prototype = {
1343
+
1344
+ init: function () {
1345
+
1346
+ $.expr[':'].containsIgnoreCase = function (n, i, m) {
1347
+ return jQuery(n).text().toUpperCase().indexOf(m[3].toUpperCase()) >= 0;
1348
+ };
1349
+
1350
+ this.bindEvents();
1351
+
1352
+ },
1353
+
1354
+ // Bind events that trigger methods
1355
+ bindEvents: function () {
1356
+ var plugin = this;
1357
+
1358
+ plugin.$element.on('keyup' + '.' + plugin._name, '.exopite-sof-search', function (e) {
1359
+ e.preventDefault();
1360
+ plugin.doSearch.call(plugin, $(this));
1361
+ });
1362
+
1363
+ plugin.$element.on('click' + '.' + plugin._name, '.exopite-sof-section-header', function (e) {
1364
+ e.preventDefault();
1365
+ plugin.selectSection.call(plugin, $(this));
1366
+ });
1367
+
1368
+ plugin.$element.on('click' + '.' + plugin._name, '.exopite-sof-nav.search', function (e) {
1369
+ e.preventDefault();
1370
+ plugin.clearSearch.call(plugin, $(this));
1371
+ });
1372
+
1373
+ },
1374
+
1375
+ // Unbind events that trigger methods
1376
+ unbindEvents: function () {
1377
+ this.$element.off('.' + this._name);
1378
+ },
1379
+ clearSearch: function ($clickedElement) {
1380
+ var plugin = this;
1381
+ plugin.$element.find('.exopite-sof-search').val('').blur();
1382
+ plugin.$element.find('.exopite-sof-nav').removeClass('search');
1383
+ plugin.$element.find('.exopite-sof-section-header').hide();
1384
+ plugin.$element.find('.exopite-sof-field h4').closest('.exopite-sof-field').not('.hidden').removeAttr('style');
1385
+ plugin.$element.find('.exopite-sof-field-card').removeAttr('style');
1386
+ var activeElement = plugin.$nav.find("ul li.active").data('section');
1387
+ plugin.$element.find('.exopite-sof-sections .exopite-sof-section-' + activeElement).removeClass('hide');
1388
+ },
1389
+ activateSection: function (activeElement) {
1390
+ var plugin = this;
1391
+ if (plugin.$nav.length > 0) {
1392
+ plugin.$element.find('.exopite-sof-section-header').hide();
1393
+ var $activeElement = plugin.$element.find('.exopite-sof-nav li[data-section="' + activeElement + '"]');
1394
+ $activeElement.addClass('active');
1395
+ if ( $activeElement.parents('.exopite-sof-nav-list-parent-item').length > 0 &&
1396
+ ! $activeElement.parents('.exopite-sof-nav-list-parent-item').hasClass('active') ) {
1397
+ $activeElement.parents('.exopite-sof-nav-list-parent-item').addClass('active').find('ul').slideToggle(200);;
1398
+ }
1399
+ plugin.$element.find('.exopite-sof-nav').removeClass('search');
1400
+ }
1401
+ plugin.$element.find('.exopite-sof-sections .exopite-sof-section').addClass('hide');
1402
+ plugin.$element.find('.exopite-sof-sections .exopite-sof-section-' + activeElement).removeClass('hide');
1403
+ plugin.$element.find('.exopite-sof-field h4').closest('.exopite-sof-field').not('.hidden').removeAttr('style');
1404
+ plugin.$element.find('.exopite-sof-field-card').removeAttr('style');
1405
+
1406
+ },
1407
+ selectSection: function ($sectionHeader) {
1408
+ var plugin = this;
1409
+ plugin.$element.find('.exopite-sof-search').val('').blur();
1410
+ var activeElement = $sectionHeader.data('section');
1411
+ plugin.activateSection(activeElement);
1412
+ },
1413
+ doSearch: function ($searchField) {
1414
+ var plugin = this;
1415
+ var searchValue = $searchField.val();
1416
+ var activeElement = this.$nav.find("ul li.active").data('section');
1417
+ if (typeof this.$element.data('section') === 'undefined') {
1418
+ this.$element.data('section', activeElement);
1419
+ }
1420
+
1421
+ if (searchValue) {
1422
+ if (this.$nav.length > 0) {
1423
+ this.$element.find('.exopite-sof-nav-list-item').removeClass('active');
1424
+ this.$element.find('.exopite-sof-nav').addClass('search');
1425
+ }
1426
+ this.$element.find('.exopite-sof-section-header').show();
1427
+ this.$element.find('.exopite-sof-section').removeClass('hide');
1428
+ this.$element.find('.exopite-sof-field h4').closest('.exopite-sof-field').not('.hidden').hide();
1429
+ this.$element.find('.exopite-sof-field-card').hide();
1430
+ this.$element.find('.exopite-sof-field h4:containsIgnoreCase(' + searchValue + ')').closest('.exopite-sof-field').not('.hidden').show();
1431
+ } else {
1432
+ activeElement = this.$element.data('section');
1433
+ this.$element.removeData('section');
1434
+ plugin.activateSection(activeElement);
1435
+ }
1436
+
1437
+ },
1438
+
1439
+ };
1440
+
1441
+ $.fn[pluginName] = function (options) {
1442
+ return this.each(function () {
1443
+ if (!$.data(this, "plugin_" + pluginName)) {
1444
+ $.data(this, "plugin_" + pluginName,
1445
+ new Plugin(this, options));
1446
+ }
1447
+ });
1448
+ };
1449
+
1450
+ })(jQuery, window, document);
1451
+
1452
+ /**
1453
+ * Exopite SOF Import/Export Options with AJAX
1454
+ */
1455
+ ; (function ($, window, document, undefined) {
1456
+
1457
+ var pluginName = "exopiteImportExportAJAX";
1458
+
1459
+ // The actual plugin constructor
1460
+ function Plugin(element, options) {
1461
+
1462
+ this.element = element;
1463
+ this._name = pluginName;
1464
+ this.$element = $(element);
1465
+ this.init();
1466
+
1467
+ }
1468
+
1469
+ Plugin.prototype = {
1470
+
1471
+ init: function () {
1472
+
1473
+ this.bindEvents();
1474
+
1475
+ },
1476
+
1477
+ // Bind events that trigger methods
1478
+ bindEvents: function () {
1479
+ var plugin = this;
1480
+
1481
+ plugin.$element.find('.exopite-sof-import-js').off().on('click' + '.' + plugin._name, function (event) {
1482
+
1483
+ event.preventDefault();
1484
+ if ($(this).hasClass('loading')) return;
1485
+
1486
+ swal({
1487
+
1488
+ // title: "Are you sure?",
1489
+ text: $(this).data('confirm'),
1490
+ icon: "warning",
1491
+ buttons: true,
1492
+ dangerMode: true,
1493
+
1494
+ }).then((willImport) => {
1495
+
1496
+ if (willImport) {
1497
+
1498
+ $(this).addClass('loading');
1499
+ $(this).prop("disabled", true);
1500
+ this.disabled = true;
1501
+ plugin.importOptions.call(this, event, plugin);
1502
+
1503
+ }
1504
+
1505
+ });
1506
+
1507
+ // if ( confirm( $( this ).data( 'confirm' ) ) ) {
1508
+
1509
+ // plugin.importOptions.call( this, event, plugin );
1510
+
1511
+ // }
1512
+
1513
+ });
1514
+
1515
+ plugin.$element.find('.exopite-sof-reset-js').off().on('click' + '.' + plugin._name, function (event) {
1516
+
1517
+ event.preventDefault();
1518
+
1519
+ swal({
1520
+
1521
+ // title: "Are you sure?",
1522
+ text: $(this).data('confirm'),
1523
+ icon: "warning",
1524
+ buttons: true,
1525
+ dangerMode: true,
1526
+
1527
+ }).then((willDelete) => {
1528
+
1529
+ if (willDelete) {
1530
+
1531
+ $(this).addClass('loading');
1532
+ $(this).prop("disabled", true);
1533
+ plugin.resetOptions.call(this, event, plugin);
1534
+
1535
+ }
1536
+
1537
+ });
1538
+
1539
+ });
1540
+
1541
+ },
1542
+
1543
+ // Unbind events that trigger methods
1544
+ unbindEvents: function () {
1545
+ this.$element.off('.' + this._name);
1546
+ },
1547
+
1548
+ importOptions: function (event, plugin) {
1549
+
1550
+ var AJAXData = plugin.$element.find('.exopite-sof--data');
1551
+
1552
+ $.ajax({
1553
+ url: AJAXData.data('admin'),
1554
+ type: 'post',
1555
+ data: {
1556
+ action: 'exopite-sof-import-options',
1557
+ unique: AJAXData.data('unique'),
1558
+ value: plugin.$element.find('.exopite-sof__import').val(),
1559
+ wpnonce: AJAXData.data('wpnonce')
1560
+ },
1561
+ success: function (response) {
1562
+
1563
+ if (response == 'success') {
1564
+
1565
+ plugin.$element.find('.exopite-sof__import').val('');
1566
+ swal({
1567
+ icon: "success",
1568
+ });
1569
+ location.reload();
1570
+
1571
+ }
1572
+
1573
+ },
1574
+ error: function (xhr, status, error) {
1575
+
1576
+ console.log('Status: ' + xhr.status);
1577
+ console.log('Error: ' + xhr.responseText);
1578
+ swal("Error!", "Check console for more info!", "error");
1579
+
1580
+ }
1581
+ });
1582
+
1583
+ return false;
1584
+
1585
+ },
1586
+
1587
+ resetOptions: function (event, plugin) {
1588
+
1589
+ var AJAXData = plugin.$element.find('.exopite-sof--data');
1590
+
1591
+ $.ajax({
1592
+ url: AJAXData.data('admin'),
1593
+ type: 'post',
1594
+ data: {
1595
+ action: 'exopite-sof-reset-options',
1596
+ unique: AJAXData.data('unique'),
1597
+ wpnonce: AJAXData.data('wpnonce')
1598
+ },
1599
+ success: function (response) {
1600
+
1601
+ if (response == 'success') {
1602
+
1603
+ swal({
1604
+ icon: "success",
1605
+ });
1606
+ location.reload();
1607
+
1608
+ }
1609
+
1610
+ },
1611
+
1612
+ error: function (xhr, status, error) {
1613
+ console.log('Status: ' + xhr.status);
1614
+ console.log('Error: ' + xhr.responseText);
1615
+ swal("Error!", "Check console for more info!", "error");
1616
+ }
1617
+ });
1618
+
1619
+ return false;
1620
+
1621
+ },
1622
+
1623
+ };
1624
+
1625
+ $.fn[pluginName] = function (options) {
1626
+ return this.each(function () {
1627
+ if (!$.data(this, "plugin_" + pluginName)) {
1628
+ $.data(this, "plugin_" + pluginName,
1629
+ new Plugin(this, options));
1630
+ }
1631
+ });
1632
+ };
1633
+
1634
+ })(jQuery, window, document);
1635
+
1636
+ /**
1637
+ * Exopite SOF Tab Navigation
1638
+ */
1639
+ ; (function ($, window, document, undefined) {
1640
+
1641
+ var pluginName = "exopiteTabs";
1642
+
1643
+ // The actual plugin constructor
1644
+ function Plugin(element, options) {
1645
+
1646
+ this.element = element;
1647
+ this._name = pluginName;
1648
+ this.$element = $(element);
1649
+ this.init();
1650
+
1651
+ }
1652
+
1653
+ Plugin.prototype = {
1654
+
1655
+ init: function () {
1656
+
1657
+ this.bindEvents();
1658
+
1659
+ },
1660
+
1661
+ /**
1662
+ * Looks a little bit strange, but some readon this is the only way
1663
+ * what I find, to make this work in group field.
1664
+ */
1665
+ // Bind events that trigger methods
1666
+ bindEvents: function () {
1667
+ var plugin = this;
1668
+ plugin.$tabLinks = plugin.$element.children('.exopite-sof-tab-header').children('.exopite-sof-tab-link');
1669
+ plugin.$tabContents = plugin.$element.children('.exopite-sof-tab-content');
1670
+ plugin.mobileHeader = plugin.$tabContents.children('.exopite-sof-tab-mobile-header');
1671
+
1672
+ plugin.$tabLinks.off().on('click' + '.' + plugin._name, function (event) {
1673
+
1674
+ plugin.changeTabs(event, this);
1675
+
1676
+ });
1677
+
1678
+ plugin.mobileHeader.off().on('click' + '.' + plugin._name, function (event) {
1679
+
1680
+ var index = $(this).parent().index() - 1;
1681
+ var that = this;
1682
+
1683
+ // tabLinks
1684
+ var $tabLinks = $(that).parent().parent().children('.exopite-sof-tab-header').children('.exopite-sof-tab-link');
1685
+ var $tabContents = $(that).parent().parent().children('.exopite-sof-tab-content');
1686
+
1687
+ $tabLinks.removeClass('active');
1688
+ $tabLinks.eq(index).addClass('active');
1689
+ $tabContents.removeClass('active');
1690
+ $(that).parent().addClass('active');
1691
+
1692
+ });
1693
+
1694
+ },
1695
+
1696
+ // Unbind events that trigger methods
1697
+ unbindEvents: function () {
1698
+ this.$element.off('.' + this._name);
1699
+ },
1700
+
1701
+ changeTabs: function (event, that, index) {
1702
+ var plugin = this;
1703
+ var index = $(that).index();
1704
+
1705
+ $(that).parent().children('.exopite-sof-tab-link').removeClass('active');
1706
+ $(that).parent().parent().children('.exopite-sof-tab-content').removeClass('active');
1707
+ $(that).addClass('active');
1708
+ $(that).parent().parent().children('.exopite-sof-tab-content').eq(index).addClass('active');
1709
+
1710
+ },
1711
+
1712
+ };
1713
+
1714
+ $.fn[pluginName] = function (options) {
1715
+ return this.each(function () {
1716
+ if (!$.data(this, "plugin_" + pluginName)) {
1717
+ $.data(this, "plugin_" + pluginName,
1718
+ new Plugin(this, options));
1719
+ }
1720
+ });
1721
+ };
1722
+
1723
+ })(jQuery, window, document);
1724
+
1725
+ ; (function ($, window, document, undefined) {
1726
+
1727
+ "use strict";
1728
+
1729
+ var pluginName = "exopiteSOFGallery";
1730
+
1731
+ function Plugin(element, options) {
1732
+ this.element = element;
1733
+ this._name = pluginName;
1734
+ this.meta_gallery_frame = null;
1735
+ this.$container = $(element).children('.exopite-sof-gallery').first();
1736
+
1737
+ this.buildCache();
1738
+ this.init();
1739
+ }
1740
+
1741
+ $.extend(Plugin.prototype, {
1742
+ init: function () {
1743
+ var plugin = this;
1744
+
1745
+ plugin.bindEvents();
1746
+ plugin.sortableInit();
1747
+
1748
+ },
1749
+ sortableInit: function () {
1750
+ var plugin = this;
1751
+
1752
+ sortable('.exopite-sof-gallery', {
1753
+ forcePlaceholderSize: true,
1754
+ });
1755
+
1756
+ // From documentation, not working with dinamically added elements.
1757
+ // sortable('.exopite-sof-gallery', {
1758
+ // forcePlaceholderSize: true,
1759
+ // })[0].addEventListener('sortstop', function(e) {
1760
+
1761
+ // console.log('gallery sortstop 0');
1762
+
1763
+ // });
1764
+
1765
+ /**
1766
+ * html5sortable - sortupdate event is not triggered on dynamic elements
1767
+ * @link https://stackoverflow.com/questions/46211700/html5sortable-sortupdate-event-is-not-triggered-on-dynamic-elements/46212177#46212177
1768
+ */
1769
+ // if( sortable('.exopite-sof-gallery').length > 0) {
1770
+ // sortable('.exopite-sof-gallery')[sortable('.exopite-sof-gallery').length-1].addEventListener('sortstop', function (e) {
1771
+
1772
+ // plugin.updateIDs( $(this) );
1773
+ // console.log('gallery sortstop 1');
1774
+
1775
+ // });
1776
+ // }
1777
+
1778
+ // plugin.$galleryList.sortable({
1779
+ // tolerance: "pointer",
1780
+ // cursor: "grabbing",
1781
+ // stop: function( event, ui ) {
1782
+ // console.log('test stop');
1783
+ // let imageIDs = [];
1784
+ // plugin.$galleryList.children('li').each(function( index, el ){
1785
+ // imageIDs.push( $(el).children('img').attr('id') );
1786
+ // });
1787
+ // plugin.$imageIDs.val( imageIDs.join(',') );
1788
+ // }
1789
+ // });
1790
+ },
1791
+ bindEvents: function () {
1792
+ var plugin = this;
1793
+
1794
+ plugin.$element.on('click' + '.' + plugin._name, '> .exopite-sof-gallery-add', function (e) {
1795
+ e.preventDefault();
1796
+
1797
+ plugin.manageMediaFrame.call( plugin, $(this) );
1798
+
1799
+ });
1800
+
1801
+ plugin.$element.on('click' + '.' + plugin._name, '.exopite-sof-image-delete', function (e) {
1802
+ e.preventDefault();
1803
+
1804
+ plugin.deleteImage.call( plugin, $(this) );
1805
+
1806
+ });
1807
+
1808
+ plugin.$container.on('sortstop' + '.' + plugin._name, function (event, ui) {
1809
+
1810
+ // console.log('gallery sortstop 2');
1811
+
1812
+ plugin.updateIDs( $(this) );
1813
+
1814
+ });
1815
+
1816
+ },
1817
+ updateIDs: function ( $element ) {
1818
+
1819
+ let imageIDs = [];
1820
+ $element.children('span').each(function( index, el ){
1821
+ imageIDs.push( $(el).children('img').attr('id') );
1822
+ });
1823
+ $element.closest('.exopite-sof-gallery').prev().val( imageIDs.join(',') );
1824
+
1825
+ },
1826
+ deleteImage: function ($button) {
1827
+ var plugin = this;
1828
+ if (confirm('Are you sure you want to remove this image?')) {
1829
+
1830
+ let $imageIDs = $button.closest('.exopite-sof-gallery').prev();
1831
+ var removedImage = $button.next().attr('id');
1832
+ var galleryIds = $imageIDs.val().split(",");
1833
+ galleryIds = $( galleryIds ).not([removedImage]).get();
1834
+ $imageIDs.val( galleryIds );
1835
+ $button.parent().remove();
1836
+ plugin.sortableInit();
1837
+
1838
+ }
1839
+ },
1840
+ manageMediaFrame: function ( $button ) {
1841
+ var plugin = this;
1842
+
1843
+ let $imageIDs = $button.prev().prev();
1844
+ let $galleryWrapper = $button.prev();
1845
+
1846
+ // If the frame already exists, re-open it.
1847
+ plugin.meta_gallery_frame = null;
1848
+
1849
+ let title = plugin.$element.data('media-frame-title') || 'Select Images';
1850
+ let button = plugin.$element.data('media-frame-button') || 'Add';
1851
+ let image = plugin.$element.data('media-frame-type') || 'image';
1852
+
1853
+ // Sets up the media library frame
1854
+ plugin.meta_gallery_frame = wp.media.frames.meta_gallery_frame = wp.media({
1855
+ title: title,
1856
+ button: {
1857
+ text: button
1858
+ },
1859
+ library: {
1860
+ type: image
1861
+ },
1862
+ multiple: true
1863
+ });
1864
+
1865
+ // Create Featured Gallery state. This is essentially the Gallery state, but selection behavior is altered.
1866
+ plugin.meta_gallery_frame.states.add([
1867
+ new wp.media.controller.Library({
1868
+ title: title,
1869
+ priority: 20,
1870
+ toolbar: 'main-gallery',
1871
+ filterable: 'uploaded',
1872
+ library: wp.media.query(plugin.meta_gallery_frame.options.library),
1873
+ multiple: plugin.meta_gallery_frame.options.multiple ? 'reset' : false,
1874
+ editable: true,
1875
+ allowLocalEdits: true,
1876
+ displaySettings: true,
1877
+ displayUserSettings: true
1878
+ }),
1879
+ ]);
1880
+
1881
+ plugin.meta_gallery_frame.on('open', function () {
1882
+ var selection = plugin.meta_gallery_frame.state().get('selection');
1883
+
1884
+ var library = plugin.meta_gallery_frame.state('gallery-edit').get('library');
1885
+ var ids = $imageIDs.val();
1886
+ if (ids) {
1887
+ let idsArray = ids.split(',');
1888
+ idsArray.forEach(function (id) {
1889
+ let attachment = wp.media.attachment(id);
1890
+ attachment.fetch();
1891
+ selection.add(attachment ? [attachment] : []);
1892
+ });
1893
+ }
1894
+ });
1895
+
1896
+ // When an image is selected, run a callback.
1897
+ plugin.meta_gallery_frame.on('select', function () {
1898
+ var imageIDArray = [];
1899
+ var imageHTML = '';
1900
+ var metadataString = '';
1901
+ var images;
1902
+ images = plugin.meta_gallery_frame.state().get('selection');
1903
+ images.each(function (attachment) {
1904
+ imageIDArray.push(attachment.attributes.id);
1905
+ imageHTML += '<span><span class="exopite-sof-image-delete"></span><img id="' + attachment.attributes.id + '" src="' + attachment.attributes.sizes.thumbnail.url + '"></span>';
1906
+ });
1907
+ metadataString = imageIDArray.join(",");
1908
+ if (metadataString) {
1909
+ $imageIDs.val( metadataString );
1910
+ $galleryWrapper.html( imageHTML );
1911
+ plugin.sortableInit();
1912
+ }
1913
+ });
1914
+
1915
+ // Finally, open the modal
1916
+ plugin.meta_gallery_frame.open();
1917
+
1918
+ },
1919
+ destroy: function () {
1920
+ this.unbindEvents();
1921
+ this.$element.removeData();
1922
+ },
1923
+ unbindEvents: function () {
1924
+ this.$element.off('.' + this._name);
1925
+ },
1926
+ buildCache: function () {
1927
+ this.$element = $(this.element);
1928
+ this.$imageIDs = this.$element.children('[data-control="gallery-ids"]');
1929
+ this.$galleryList = this.$element.children('.exopite-sof-gallery');
1930
+ },
1931
+ });
1932
+
1933
+ $.fn[pluginName] = function (options) {
1934
+ return this.each(function () {
1935
+ if (!$.data(this, "plugin_" + pluginName)) {
1936
+ $.data(this, "plugin_" + pluginName, new Plugin(this, options));
1937
+ }
1938
+ });
1939
+ };
1940
+
1941
+ })(jQuery, window, document);
1942
+
1943
+
1944
+ /**
1945
+ * Exopite SOF - Manage empty checkboxes and selects (multiple)
1946
+ *
1947
+ * When checkbox is not checked or select with attribute multiple is empty,
1948
+ * they are not sent in POST so create a hidden input before the element for that.
1949
+ *
1950
+ * This is only relevant for metabox, because in the options the POST can be
1951
+ * check and add them before being sent.
1952
+ */
1953
+ ; (function ($, window, document, undefined) {
1954
+
1955
+ var pluginName = "exopitePrepareForm";
1956
+
1957
+ // The actual plugin constructor
1958
+ function Plugin(element, options) {
1959
+
1960
+ this.element = element;
1961
+ this._name = pluginName;
1962
+ this.$element = $(element);
1963
+ this.init();
1964
+
1965
+ }
1966
+
1967
+ Plugin.prototype = {
1968
+
1969
+ init: function () {
1970
+
1971
+ this.bindEvents();
1972
+
1973
+ },
1974
+
1975
+ // Bind events that trigger methods
1976
+ bindEvents: function () {
1977
+ var plugin = this;
1978
+
1979
+ plugin.$element.find('select[multiple]').not(':disabled').each(function (index, element) {
1980
+
1981
+ var $this = $(this),
1982
+ selected_value = $this.val();
1983
+
1984
+ if (!selected_value) {
1985
+ plugin.addHidden($this.attr('name'), $this);
1986
+ }
1987
+
1988
+ });
1989
+
1990
+ plugin.$element.find('select[multiple]').on('change', function () {
1991
+
1992
+ var $this = $(this),
1993
+ selected_value = $this.val();
1994
+
1995
+ if (selected_value) {
1996
+ plugin.removeHidden($this);
1997
+ } else {
1998
+ plugin.addHidden($this.attr('name'), $this);
1999
+ }
2000
+
2001
+ });
2002
+
2003
+ plugin.$element.find('input:checkbox:not(:checked):not([disabled])').each(function (index, element) {
2004
+
2005
+ var $this = $(this);
2006
+ plugin.addHidden($this.attr('name'), $this);
2007
+
2008
+ });
2009
+
2010
+ plugin.$element.find('input[type="checkbox"]').on('change', function () {
2011
+
2012
+ var $this = $(this),
2013
+ checked = $this.prop('checked');
2014
+
2015
+ if (checked) {
2016
+ plugin.removeHidden($this);
2017
+ } else {
2018
+ plugin.addHidden($this.attr('name'), $this);
2019
+ }
2020
+
2021
+ });
2022
+
2023
+ },
2024
+
2025
+ // Unbind events that trigger methods
2026
+ unbindEvents: function () {
2027
+ this.$element.off('.' + this._name);
2028
+ },
2029
+
2030
+ addHidden: function ( name, $element ) {
2031
+
2032
+ $('<input>').attr({
2033
+ 'type': 'hidden',
2034
+ 'name': name,
2035
+ 'value': 'no'
2036
+ }).insertBefore($element);
2037
+
2038
+ },
2039
+
2040
+ removeHidden: function ( $element ) {
2041
+
2042
+ $element.prev('input[type="hidden"]').remove();
2043
+
2044
+ },
2045
+
2046
+ };
2047
+
2048
+ $.fn[pluginName] = function (options) {
2049
+ return this.each(function () {
2050
+ if (!$.data(this, "plugin_" + pluginName)) {
2051
+ $.data(this, "plugin_" + pluginName,
2052
+ new Plugin(this, options));
2053
+ }
2054
+ });
2055
+ };
2056
+
2057
+ })(jQuery, window, document);
2058
+
2059
+ /**
2060
+ * ToDos:
2061
+ * - sortable only if data-is-sortable is 1 || true
2062
+ * - maybe move sortable to a separate plugin?
2063
+ * - clean up
2064
+ * - fix name generation (if added or cloned) <- drag&drop is working az expected
2065
+ * - replace color picker (
2066
+ * https://acko.net/blog/farbtastic-jquery-color-picker-plug-in/
2067
+ * https://www.jqueryscript.net/other/Color-Picker-Plugin-jQuery-MiniColors.html
2068
+ * https://www.jquery-az.com/a-bootstrap-jquery-color-picker-with-7-demos/
2069
+ * )?
2070
+ */
2071
+ ; (function ($) {
2072
+ "use strict";
2073
+
2074
+ $(document).ready(function () {
2075
+
2076
+ $('.exopite-sof-wrapper').exopiteSofManageDependencies();
2077
+ $('.exopite-sof-wrapper').exopiteSofSearch();
2078
+ $('.exopite-sof-sub-dependencies').exopiteSofManageDependencies('sub');
2079
+
2080
+ $('.exopite-sof-wrapper-menu').exopiteSaveOptionsAJAX();
2081
+
2082
+ $('.exopite-sof-media').exopiteMediaUploader({
2083
+ input: 'input',
2084
+ preview: '.exopite-sof-image-preview',
2085
+ remove: '.exopite-sof-image-remove'
2086
+ });
2087
+
2088
+ $('.exopite-sof-content-js').exopiteOptionsNavigation();
2089
+ $('.exopite-sof-wrapper').find('.exopite-sof-font-field').each(function(index,el){
2090
+
2091
+ if (!$(el).children('label').children('select').is(":disabled")) {
2092
+ $(el).exopiteFontPreview();
2093
+ }
2094
+
2095
+ });
2096
+ $('.exopite-sof-group').exopiteSOFTinyMCE();
2097
+ $('.exopite-sof-accordion').exopiteSOFAccordion();
2098
+ $('.exopite-sof-group').exopiteSOFRepeater();
2099
+ $('.exopite-sof-field-backup').exopiteImportExportAJAX();
2100
+ $('.exopite-sof-tabs').exopiteTabs();
2101
+ $('.exopite-sof-gallery-field').exopiteSOFGallery();
2102
+ $('.exopite-sof-wrapper-metabox').exopitePrepareForm();
2103
+
2104
+ });
2105
+
2106
+ }(jQuery));
inc/exopite-simple-options/assets/dev/styles.css ADDED
@@ -0,0 +1,2970 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Select */
2
+ /* .exopite-sof-field-select .chosen-container-multi .chosen-choices {
3
+ padding: 3px 5px;
4
+ border: 1px solid #ccc;
5
+ border-radius: 3px;
6
+ } */
7
+
8
+ /* exopite-sof-fieldset .chosen-container-multi .chosen-choices li.search-choice {
9
+ position: relative;
10
+ margin: 3px 5px 3px 0;
11
+ padding: 4px 20px 5px 5px;
12
+ border: 1px solid #ccc;
13
+ max-width: 100%;
14
+ border-radius: 0;
15
+ background-color: #f5f5f5;
16
+ background-image: none;
17
+ background-size: 100% 19px;
18
+ background-repeat: repeat-x;
19
+ background-clip: padding-box;
20
+ box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
21
+ color: #333;
22
+ line-height: 13px;
23
+ cursor: default;
24
+ } */
25
+ /* Video */
26
+ .exopite-sof-video-container {
27
+ max-width: 100%;
28
+ }
29
+ .video-wrap {
30
+ height: 0;
31
+ overflow: hidden;
32
+ padding-bottom: 56.25%;
33
+ position: relative;
34
+ background: #000;
35
+ }
36
+
37
+ .video-wrap iframe,
38
+ .video-wrap object,
39
+ .video-wrap embed,
40
+ .video-wrap video {
41
+ height: 100%;
42
+ left: 0;
43
+ position: absolute;
44
+ top: 0;
45
+ width: 100%;
46
+ }
47
+ .exopite-sof-video-input {
48
+ padding-top: 10px;
49
+ }
50
+ /* Attached */
51
+ .exopite-sof-attachment-media {
52
+ display: inline-block;
53
+ position: relative;
54
+ border: 2px solid transparent;
55
+ }
56
+ .exopite-sof-attachment-media.selected {
57
+ border-color: #80a9d4;
58
+ }
59
+ .exopite-sof-attachment-media.selected .exopite-sof-attachment-media-delete-overlay {
60
+ position: absolute;
61
+ top: 0;
62
+ left: 0;
63
+ bottom: 0;
64
+ right: 0;
65
+ background: rgba(128,169,212, 0.3);
66
+ }
67
+ .exopite-sof-attachment-media-delete {
68
+ display: none;
69
+ position: absolute;
70
+ top: 3px;
71
+ right: 3px;
72
+ background: rgba( 255, 0, 0, .6);
73
+ padding: 2px 5px 4px 5px;
74
+ color: #fff;
75
+ border-radius: 3px;
76
+ line-height: 14px;
77
+ font-size: 14px;
78
+ cursor: pointer;
79
+ }
80
+ .exopite-sof-attachment-media.selected .exopite-sof-attachment-media-delete {
81
+ display: block;
82
+ }
83
+ .exopite-sof-attachment-media img {
84
+ float: left;
85
+ }
86
+ /* Upload */
87
+ .exopite-sof-field-upload .exopite-sof-fieldset input[type="text"],
88
+ .qq-upload-list-selector.qq-upload-list input {
89
+ width: 1px;
90
+ }
91
+ .exopite-sof-field-upload .exopite-sof-fieldset .qq-edit-filename-selector.qq-edit-filename {
92
+ width: auto;
93
+ }
94
+ .exopite-sof-field-upload .exopite-sof-fieldset {
95
+ position: relative;
96
+ }
97
+ .exopite-sof-field-upload .qq-template-info {
98
+ text-align: center;
99
+ color: #ccc;
100
+ padding-top: 10px;
101
+ }
102
+ .exopite-sof-field-upload .qq-template {
103
+ z-index: 1;
104
+ position: relative;
105
+ }
106
+ .exopite-sof-field-upload .qq-uploader {
107
+ border-radius: 0;
108
+ border: 3px dashed #ccc;
109
+ background: transparent;
110
+ }
111
+ .exopite-sof-field .qq-template .exopite-sof-btn {
112
+ margin-right: 8px;
113
+ }
114
+ /*
115
+ .exopite-sof-btn {
116
+ position: relative;
117
+ display: inline-block;
118
+ padding: 10px 20px;
119
+ color: #fff;
120
+ border-radius: 3px;
121
+ cursor: pointer;
122
+ margin-right: 10px;
123
+ margin-bottom: 10px;
124
+ text-decoration: none;
125
+ }
126
+ */
127
+ /* STYLE 2 */
128
+
129
+ .exopite-sof-field-upload .qq-uploader::before {
130
+ content: "\f0ee";
131
+ position: absolute;
132
+ font-size: 6rem;
133
+ left: 0;
134
+ width: 100%;
135
+ text-align: center;
136
+ top: 50%;
137
+ opacity: .25;
138
+ font-family: fontAwesome;
139
+ z-index: -1;
140
+ }
141
+ .qq-template .qq-upload-button {
142
+ margin-right: 15px;
143
+ }
144
+ .qq-template .buttons {
145
+ width: 36%;
146
+ display: flex;
147
+ }
148
+ .qq-template .qq-uploader .qq-total-progress-bar-container {
149
+ width: 60%;
150
+ }
151
+ /* ACE Editor */
152
+ .exopite-sof-ace-editor {
153
+ border: 1px solid #e5e5e5;
154
+ }
155
+ /* Header */
156
+ .exopite-sof-wrapper-menu {
157
+ margin-right: 15px;
158
+ margin-top: 22px;
159
+ }
160
+ .exopite-sof-header {
161
+ padding: 10px;
162
+ background: #345;
163
+ }
164
+ /*.exopite-sof-header h1 {
165
+ text-align: center;
166
+ display: block;
167
+ margin-bottom: 10px;
168
+ }*/
169
+ .exopite-sof-header h1,
170
+ .exopite-sof-wrapper fieldset {
171
+ display: block;
172
+ text-align: center;
173
+ margin: 0;
174
+ color: #fff;
175
+ font-weight: 400;
176
+ line-height: 1em;
177
+ }
178
+ .exopite-sof-header h1 {
179
+ font-size: 1.7em;
180
+ }
181
+ @media only screen and (min-width: 600px) {
182
+ .exopite-sof-wrapper fieldset {
183
+ display: inline-block;
184
+ float: right;
185
+ }
186
+ .exopite-sof-header input,
187
+ .exopite-sof-header h1 {
188
+ display: inline-block;
189
+ text-align: right;
190
+ margin: 0;
191
+ }
192
+ }
193
+ .exopite-sof-header input {
194
+ float: right;
195
+ }
196
+ .exopite-sof-footer {
197
+ padding: 6px 15px;
198
+ background: #345;
199
+ position: fixed;
200
+ bottom: -48px;
201
+ z-index: 999;
202
+ transition: all .4s ease 0s;
203
+ opacity: 0.9;
204
+ }
205
+ .exopite-sof-footer:hover {
206
+ opacity: 1;
207
+ }
208
+ .exopite-sof-form-js {
209
+ margin-bottom: 50px;
210
+ }
211
+ /* Help */
212
+ .exopite-sof-help {
213
+ cursor: help;
214
+ }
215
+ /* Hidden */
216
+ .hidden {
217
+ display: none;
218
+ }
219
+ /* Sections */
220
+ .exopite-sof-nav {
221
+ display: none;
222
+ }
223
+ .exopite-sof-sections {
224
+ background-color: #fff;
225
+ }
226
+ @media only screen and (max-width: 899px) {
227
+ .exopite-sof-fieldset .color-alpha {
228
+ width: 40px !important;
229
+ height: 30px !important;
230
+ }
231
+ }
232
+ @media only screen and (min-width: 900px) {
233
+ /* .exopite-sof-fieldset .color-alpha {
234
+ height: 22px !important;
235
+ } */
236
+ .exopite-sof-content-nav {
237
+ position: relative;
238
+ background-color: #23282d;
239
+ }
240
+ .exopite-sof-nav-list-item.active {
241
+ /* background-color: #32373c; */
242
+ background-color: #0073aa;
243
+ color: #fff;
244
+ }
245
+ .exopite-sof-nav-icon {
246
+ padding-right: 10px;
247
+ }
248
+ .exopite-sof-nav {
249
+ display: none;
250
+ position: relative;
251
+ z-index: 10;
252
+ /*float: left;*/
253
+ width: 200px;
254
+ background-color: #23282d;
255
+ }
256
+ .exopite-sof-content-nav .exopite-sof-nav {
257
+ display: inline-block;
258
+ vertical-align: top;
259
+ }
260
+ .exopite-sof-content-nav .exopite-sof-sections {
261
+ position: relative;
262
+ /*margin-left: 200px;*/
263
+ display: inline-block;
264
+ width: calc(100% - 200px);
265
+ }
266
+ .exopite-sof-nav-list {
267
+ margin: 0;
268
+ }
269
+ .exopite-sof-nav-list-parent-item {
270
+ margin-bottom: 0;
271
+ }
272
+ .exopite-sof-nav-list-parent-item > span {
273
+ display: block;
274
+ }
275
+ .exopite-sof-nav-list-parent-item > span,
276
+ .exopite-sof-nav-list-item {
277
+ color: #999;
278
+ padding: 13px 15px;
279
+ margin: 0;
280
+ cursor: pointer;
281
+ font-size: 14px;
282
+ border-bottom: 1px solid #2f2f2f;
283
+ position: relative;
284
+ }
285
+ .exopite-sof-nav-list-parent-item ul li {
286
+ padding-left: 25px;
287
+ background-color: #181818;
288
+ font-size: 13px;
289
+ padding-top: 11px;
290
+ padding-bottom: 11px;
291
+ }
292
+ .exopite-sof-nav-list-parent-item > span:hover,
293
+ .exopite-sof-nav-list-item:hover {
294
+ color: #fff;
295
+ }
296
+ .exopite-sof-nav-list-item.active:after {
297
+ content: " ";
298
+ position: absolute;
299
+ right: 0;
300
+ top: 50%;
301
+ height: 0;
302
+ width: 0;
303
+ pointer-events: none;
304
+ border: solid transparent;
305
+ border-right-color: #fff;
306
+ border-width: 4px;
307
+ margin-top: -4px;
308
+ }
309
+ .exopite-sof-content-nav .hide,
310
+ .exopite-sof-content-nav .exopite-sof-section-header {
311
+ display: none;
312
+ }
313
+ .exopite-sof-nav-list-parent-item > .exopite-sof-nav-list-item-title::after {
314
+ content: "\f054";
315
+ display: inline-block;
316
+ font-family: "FontAwesome";
317
+ font-size: 9px;
318
+ line-height: 1;
319
+ position: absolute;
320
+ right: 10px;
321
+ top: 50%;
322
+ margin-top: -4px;
323
+ -moz-transform: rotate(0);
324
+ -ms-transform: rotate(0);
325
+ -webkit-transform: rotate(0);
326
+ transform: rotate(0);
327
+ -moz-transition: -moz-transform 0.2s;
328
+ -o-transition: -o-transform 0.2s;
329
+ -webkit-transition: -webkit-transform 0.2s;
330
+ transition: transform 0.2s;
331
+ }
332
+ .exopite-sof-nav-list-parent-item.active > .exopite-sof-nav-list-item-title::after {
333
+ -moz-transform: rotate(90deg);
334
+ -ms-transform: rotate(90deg);
335
+ -webkit-transform: rotate(90deg);
336
+ transform: rotate(90deg);
337
+ }
338
+
339
+ }
340
+ .exopite-sof-wrapper-metabox {
341
+ /* margin: -6px -12px -12px -12px; */
342
+ margin: -6px -12px -12px -12px !important;
343
+ box-sizing: content-box;
344
+ }
345
+ .block-editor-page .exopite-sof-wrapper-metabox {
346
+ margin: 0;
347
+ }
348
+ /* Image upload */
349
+ .exopite-sof-image-preview img {
350
+ max-width: 150px;
351
+ }
352
+ .exopite-sof-image-inner {
353
+ display: inline-block;
354
+ position: relative;
355
+ }
356
+ .exopite-sof-image-remove {
357
+ position: absolute;
358
+ top: 3px;
359
+ right: 3px;
360
+ background: rgba(255, 0 ,0 , .6);
361
+ color: #fff;
362
+ padding: 3px 5px 4px;
363
+ cursor: pointer;
364
+ border-radius: 3px;
365
+ }
366
+ .exopite-sof-media .exopite-sof-button {
367
+ margin-top: 3px;
368
+ margin-left: 10px;
369
+ }
370
+ .exopite-sof-fieldset .exopite-sof-image input[type="text"] {
371
+ width: calc( 100% - 100px);
372
+ max-width: calc( 100% - 100px);
373
+ }
374
+ /* Saving */
375
+ .exopite-sof-ajax-message {
376
+ padding: 7px 13px;
377
+ border-radius: 3px;
378
+ display: none;
379
+ margin-right: 10px;
380
+ color: #fff;
381
+ display: inline-block;
382
+ opacity: 0;
383
+ transition: all .4s ease 0s;
384
+ }
385
+ .exopite-sof-ajax-message.success {
386
+ background-color: #27ae60;
387
+ }
388
+ .exopite-sof-ajax-message.error {
389
+ background-color: #ae2c27;
390
+ }
391
+ .exopite-sof-ajax-message.show {
392
+ opacity: 1;
393
+ }
394
+ /* Grid */
395
+ .exopite-sof-field .exopite-sof-title {
396
+ float: none;
397
+ width: 100%;
398
+ /*margin-bottom: 10px;*/
399
+ }
400
+ .exopite-sof-field .exopite-sof-fieldset {
401
+ margin-left: 0;
402
+ }
403
+ .exopite-sof-field-notice .exopite-sof-title {
404
+ padding-top: 15px;
405
+ padding-left: 30px;
406
+ padding-bottom: 15px;
407
+ }
408
+ @media only screen and (min-width: 786px) {
409
+ .exopite-sof-field .exopite-sof-title {
410
+ position: relative;
411
+ width: 25%;
412
+ float: left;
413
+ }
414
+ .exopite-sof-field .exopite-sof-fieldset {
415
+ margin-left: 30%;
416
+ }
417
+ }
418
+ @media only screen and (min-width: 900px) {
419
+ .exopite-sof-content.exopite-sof-content-nav {
420
+ display: flex;
421
+ }
422
+ }
423
+ @media only screen and (min-width: 1000px) {
424
+ .exopite-sof-field .exopite-sof-title {
425
+ position: relative;
426
+ width: 25%;
427
+ float: left;
428
+ }
429
+ .exopite-sof-field .exopite-sof-fieldset {
430
+ margin-left: 27%;
431
+ }
432
+ .exopite-sof-field-notice .exopite-sof-fieldset {
433
+ margin-left: calc(27% - 10px);
434
+ }
435
+ }
436
+ .exopite-sof-field::after, .exopite-sof-field::before {
437
+ content: " ";
438
+ display: table;
439
+ clear: both;
440
+ }
441
+ .exopite-sof-field {
442
+ position: relative;
443
+ padding: 15px 30px;
444
+ /* border-bottom: 1px solid #eee; */
445
+ }
446
+ .exopite-sof-section > .exopite-sof-field {
447
+ border-bottom: 1px solid #eee;
448
+ }
449
+ .exopite-sof-content {
450
+ position: relative;
451
+ }
452
+ .exopite-sof-content,
453
+ .exopite-sof-content .checkbox {
454
+ font-size: 13px;
455
+ }
456
+ .exopite-sof-section-header .dashicons-before {
457
+ padding-right: 20px;
458
+ }
459
+ /* .exopite-sof-section-header .dashicons-before::before {
460
+ font-size: 24px;
461
+ line-height: 28px;
462
+ } */
463
+ .exopite-sof-section-header {
464
+ padding: 8px 32px 10px 32px;
465
+ background: #ccc;
466
+ /*background: #32373c;*/
467
+ color: #fff;
468
+ font-size: 24px;
469
+ line-height: 24px;
470
+ margin: 0;
471
+ }
472
+ .exopite-sof-fieldset ul,
473
+ .exopite-sof-title {
474
+ margin: 0;
475
+ }
476
+ .exopite-sof-field-image_select input {
477
+ display: none;
478
+ }
479
+ .exopite-sof-field-image_select input:checked ~ img {
480
+ border-color: #333;
481
+ opacity: 1;
482
+ }
483
+ .exopite-sof-field-image-selector-horizontal label {
484
+ display: inline-block;
485
+ margin-right: 10px;
486
+ margin-bottom: 10px;
487
+ }
488
+ .exopite-sof-field-image-selector-horizontal label:first-child {
489
+ /* margin-left: 0; */
490
+ }
491
+ @media screen and (max-width: 782px) {
492
+ #wpbody .exopite-sof-font-field select {
493
+ margin-bottom: 8px;
494
+ }
495
+ #wpbody .exopite-sof-field select {
496
+ height: 31px;
497
+ padding: 5px 12px;
498
+ font-size: 14px;
499
+ line-height: 16px;
500
+ }
501
+ }
502
+ .exopite-sof-field-image-selector-vertical label {
503
+ display: block;
504
+ margin-bottom: 10px;
505
+ }
506
+ .exopite-sof-field-image_select label img {
507
+ max-width: 100%;
508
+ vertical-align: bottom;
509
+ background-color: #fff;
510
+ border: 2px solid #ccc;
511
+ opacity: 0.75;
512
+ -moz-transition: all 0.15s ease-out;
513
+ -o-transition: all 0.15s ease-out;
514
+ -webkit-transition: all 0.15s ease-out;
515
+ transition: all 0.15s ease-out;
516
+ }
517
+ .exopite-sof-field-switcher label {
518
+ /*display: block;
519
+ float: left;*/
520
+ display: inline-block;
521
+ }
522
+ .exopite-sof-field-switcher .exopite-sof-text-desc {
523
+ /*float: left;*/
524
+ margin-left: 5px;
525
+ margin-top: 0;
526
+ padding-top: 0.4em;
527
+ font-size: 1em;
528
+ display: inline-block;
529
+ }
530
+ .exopite-sof-description,
531
+ .exopite-sof-content .text-muted,
532
+ .exopite-sof-text-desc {
533
+ font-weight: 400;
534
+ margin-top: 10px;
535
+ color: #999;
536
+ }
537
+ .exopite-sof-content .text-muted,
538
+ .exopite-sof-text-desc {
539
+ font-style: italic;
540
+ }
541
+ .exopite-sof-fieldset textarea,
542
+ .exopite-sof-fieldset select,
543
+ .exopite-sof-fieldset input[type="number"],
544
+ .exopite-sof-fieldset input[type="date"],
545
+ .exopite-sof-fieldset input[type="email"],
546
+ .exopite-sof-fieldset input[type="password"],
547
+ .exopite-sof-fieldset input[type="text"] {
548
+ padding: 6px 12px;
549
+ max-width: 100%;
550
+ border: 1px solid #ccc;
551
+ border-radius: 3px;
552
+ }
553
+
554
+ /* Color picker */
555
+ .exopite-sof-fieldset .wp-picker-container .hidden {
556
+ /* display: inline-block; */
557
+ }
558
+ .exopite-sof-fieldset input[type="text"].colorpicker {
559
+ width: 88px;
560
+ padding-top: 5px;
561
+ padding-bottom: 2px;
562
+ font-size: 1em;
563
+ }
564
+ /* Toggle button */
565
+ .checkbox__switch, .checkbox__switch:after {
566
+ display: block;
567
+ height: 2em;
568
+ border: 2px solid #f5c6cb;
569
+ border-radius: 2em;
570
+ }
571
+ /* STYLE 2 */
572
+ .checkbox__switch, .checkbox__switch::after {
573
+ border-radius: 0px;
574
+ }
575
+ .checkbox__input {
576
+ display: none !important;
577
+ }
578
+ .checkbox__input:checked + .checkbox__switch:after {
579
+ left: 1em;
580
+ }
581
+ .checkbox__input:checked + .checkbox__switch:before {
582
+ left: 0;
583
+ }
584
+ .checkbox__input:checked + .checkbox__switch {
585
+ border-color: #c3e6cb;
586
+ background-color: #c3e6cb;
587
+ }
588
+ .checkbox__switch {
589
+ -webkit-transition: 0.2s cubic-bezier(0.95, 0.05, 0.795, 0.035);
590
+ transition: 0.2s cubic-bezier(0.95, 0.05, 0.795, 0.035);
591
+ position: relative;
592
+ width: 3em;
593
+ background-color: #f5c6cb;
594
+ cursor: pointer;
595
+ }
596
+ .checkbox__switch:after {
597
+ content: "";
598
+ -webkit-transition: 0.2s cubic-bezier(0.95, 0.05, 0.795, 0.035);
599
+ transition: 0.2s cubic-bezier(0.95, 0.05, 0.795, 0.035);
600
+ content: "";
601
+ width: 2em;
602
+ background-color: white;
603
+ border: none;
604
+ position: absolute;
605
+ box-shadow: 0 3px 4px rgba(0, 0, 0, 0.4), 0 0 2px rgba(0, 0, 0, 0.4);
606
+ top: 0px;
607
+ left: 0px;
608
+ }
609
+ /* STYLE 2 */
610
+ .checkbox__switch:after {
611
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 0 0px rgba(0, 0, 0, 0.3);
612
+ }
613
+
614
+ /* Alerts */
615
+ .unknown {
616
+ padding: 20px 10px;
617
+ font-size: 18px;
618
+ text-align: center;
619
+ border-style: solid;
620
+ border-width: 1px;
621
+ }
622
+ .exopite-sof-field .exopite-sof-notice {
623
+ position: relative;
624
+ padding: 1rem 1.5rem;
625
+ border: 1px solid transparent;
626
+ border-radius: 0;
627
+ }
628
+ .exopite-sof-field.exopite-sof-field-notice {
629
+ padding: 0;
630
+ border-bottom: none;
631
+ }
632
+ .exopite-sof-content .info {
633
+ color: #0c5460;
634
+ background-color: #d1ecf1;
635
+ border-color: #bee5eb;
636
+ }
637
+ .exopite-sof-content .primary {
638
+ color: #004085;
639
+ background-color: #cce5ff;
640
+ border-color: #b8daff;
641
+ }
642
+ .exopite-sof-content .secondary {
643
+ color: #464a4e;
644
+ background-color: #e7e8ea;
645
+ border-color: #dddfe2;
646
+ }
647
+ .exopite-sof-content .success {
648
+ color: #155724;
649
+ background-color: #d4edda;
650
+ border-color: #c3e6cb;
651
+ }
652
+ .exopite-sof-content .danger {
653
+ color: #721c24;
654
+ background-color: #f8d7da;
655
+ border-color: #f5c6cb;
656
+ }
657
+ .exopite-sof-content .warning {
658
+ color: #856404;
659
+ background-color: #fff3cd;
660
+ border-color: #ffeeba;
661
+ }
662
+ /* Card */
663
+ .exopite-sof-content .card {
664
+ position: relative;
665
+ display: -ms-flexbox;
666
+ display: flex;
667
+ -ms-flex-direction: column;
668
+ flex-direction: column;
669
+ min-width: 0;
670
+ word-wrap: break-word;
671
+ background-color: #fff;
672
+ background-clip: border-box;
673
+ border: 1px solid rgba(0,0,0,.125);
674
+ /* border-radius: .25rem; */
675
+ padding: 0;
676
+ width: 100%;
677
+ max-width: 100%;
678
+ margin-top: 0;
679
+ }
680
+ .exopite-sof-content .card-body {
681
+ -ms-flex: 1 1 auto;
682
+ flex: 1 1 auto;
683
+ padding: 1.25rem;
684
+ }
685
+ .exopite-sof-content .card-footer:last-child {
686
+ border-radius: 0 0 calc(.25rem - 1px) calc(.25rem - 1px);
687
+ }
688
+ /* .exopite-sof-content .card-header:first-child {
689
+ border-radius: calc(.25rem - 1px) calc(.25rem - 1px) 0 0;
690
+ } */
691
+ /* .exopite-sof-content .card-header {
692
+ padding: .75rem 1.25rem;
693
+ margin-bottom: 0;
694
+ background-color: rgba(0,0,0,.03);
695
+ border-bottom: 1px solid rgba(0,0,0,.125);
696
+ } */
697
+ /* .exopite-sof-content .card-footer {
698
+ padding: .75rem 1.25rem;
699
+ background-color: rgba(0,0,0,.03);
700
+ border-top: 1px solid rgba(0,0,0,.125);
701
+ } */
702
+ /* STYLE 2*/
703
+ .exopite-sof-content .card {
704
+ border-radius: 0;
705
+ -webkit-border-radius: 0;
706
+ -moz-border-radius: 0;
707
+ -ms-border-radius: 0;
708
+ -o-border-radius: 0;
709
+ border: 1px solid #e5e5e5;
710
+ }
711
+ .exopite-sof-content .card-header {
712
+ padding: .75rem 1.25rem;
713
+ margin-bottom: 0;
714
+ background-color: rgba(0,0,0,.015);
715
+ border-bottom: 1px solid #e5e5e5;
716
+ }
717
+ .exopite-sof-content .card-footer {
718
+ padding: .75rem 1.25rem;
719
+ background-color: rgba(0,0,0,.015);
720
+ border-top: 1px solid #e5e5e5;
721
+ }
722
+ /* Range */
723
+ .range {
724
+ padding: 0;
725
+ margin: 0;
726
+ font: inherit;
727
+ color: inherit;
728
+ background: transparent;
729
+ border: none;
730
+ line-height: normal;
731
+ -webkit-box-sizing: border-box;
732
+ -moz-box-sizing: border-box;
733
+ box-sizing: border-box;
734
+ -webkit-background-clip: padding-box;
735
+ background-clip: padding-box;
736
+ vertical-align: top;
737
+ outline: none;
738
+ line-height: 1;
739
+ -webkit-appearance: none;
740
+ border: none;
741
+ height: 2px;
742
+ -webkit-border-radius: 3px;
743
+ border-radius: 3px;
744
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#ccc), to(#ccc));
745
+ background-image: -webkit-linear-gradient(#ccc, #ccc);
746
+ background-image: -moz-linear-gradient(#ccc, #ccc);
747
+ background-image: -o-linear-gradient(#ccc, #ccc);
748
+ background-image: linear-gradient(#ccc, #ccc);
749
+ background-position: left center;
750
+ -webkit-background-size: 100% 2px;
751
+ background-size: 100% 2px;
752
+ background-repeat: no-repeat;
753
+ overflow: hidden;
754
+ height: 31px;
755
+ max-width: 100%;
756
+ width: 375px;
757
+ }
758
+ .range::-moz-range-track {
759
+ position: relative;
760
+ border: none;
761
+ background-color: #ccc;
762
+ height: 2px;
763
+ border-radius: 30px;
764
+ box-shadow: none;
765
+ top: 0;
766
+ margin: 0;
767
+ padding: 0;
768
+ }
769
+ .range::-ms-track {
770
+ position: relative;
771
+ border: none;
772
+ background-color: #ccc;
773
+ height: 0;
774
+ border-radius: 30px;
775
+ }
776
+ .range::-webkit-slider-thumb {
777
+ cursor: pointer;
778
+ position: relative;
779
+ height: 2em;
780
+ width: 2em;
781
+ background-color: #fff;
782
+ border: 1px solid #ccc;
783
+ -webkit-border-radius: 30px;
784
+ border-radius: 30px;
785
+ -webkit-box-shadow: none;
786
+ box-shadow: none;
787
+ margin: 0;
788
+ padding: 0;
789
+ -webkit-appearance: none;
790
+ top: 0;
791
+ }
792
+ .range::-moz-range-thumb {
793
+ cursor: pointer;
794
+ position: relative;
795
+ height: 2em;
796
+ width: 2em;
797
+ background-color: #fff;
798
+ border: 1px solid #ccc;
799
+ border-radius: 30px;
800
+ box-shadow: none;
801
+ margin: 0;
802
+ padding: 0;
803
+ }
804
+ .range::-ms-thumb {
805
+ cursor: pointer;
806
+ position: relative;
807
+ height: 2em;
808
+ width: 2em;
809
+ background-color: #fff;
810
+ border: 1px solid #ccc;
811
+ border-radius: 30px;
812
+ box-shadow: none;
813
+ margin: 0;
814
+ padding: 0;
815
+ top: 0;
816
+ }
817
+ .range::-ms-fill-lower {
818
+ height: 2px;
819
+ background-color: rgba(24,103,194,0.81);
820
+ }
821
+ .range::-ms-tooltip {
822
+ display: none;
823
+ }
824
+ .range:disabled {
825
+ opacity: 0.3;
826
+ cursor: default;
827
+ pointer-events: none;
828
+ }
829
+ .range__left {
830
+ position: relative;
831
+ top: 17px;
832
+ height: 2px;
833
+ width: 0;
834
+ background-color: rgba(24,103,194,0.81);
835
+ pointer-events: none;
836
+ }
837
+ [disabled] > .range__left,
838
+ .range--material:disabled + .range__left {
839
+ visibility: hidden;
840
+ }
841
+ .exopite-sof-field-range input[type="number"] {
842
+ width: 74px;
843
+ margin-left: 7px;
844
+ height: 32px;
845
+ }
846
+ /* Segment/Buttonbar*/
847
+ .button-bar {
848
+ font-family: -apple-system, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;
849
+ -webkit-font-smoothing: antialiased;
850
+ -moz-osx-font-smoothing: grayscale;
851
+ font-weight: 400;
852
+ font-size: 17px;
853
+ display: table;
854
+ table-layout: fixed;
855
+ white-space: nowrap;
856
+ margin: 0;
857
+ padding: 0;
858
+ position: relative;
859
+ margin: 0;
860
+ border: none;
861
+ }
862
+ .button-bar__item {
863
+ font-family: -apple-system, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;
864
+ -webkit-font-smoothing: antialiased;
865
+ -moz-osx-font-smoothing: grayscale;
866
+ font-weight: 400;
867
+ font-size: 17px;
868
+ display: table-cell;
869
+ width: auto;
870
+ -webkit-border-radius: 0;
871
+ border-radius: 0;
872
+ position: relative;
873
+ position: relative;
874
+ overflow: hidden;
875
+ padding: 0;
876
+ position: relative;
877
+ overflow: hidden;
878
+ }
879
+ .button-bar__item > input {
880
+ position: absolute;
881
+ overflow: hidden;
882
+ right: 0px;
883
+ top: 0px;
884
+ left: 0px;
885
+ bottom: 0px;
886
+ padding: 0;
887
+ border: 0;
888
+ opacity: 0.001;
889
+ z-index: 1;
890
+ vertical-align: top;
891
+ outline: none;
892
+ width: 100%;
893
+ height: 100%;
894
+ margin: 0;
895
+ -webkit-appearance: none;
896
+ appearance: none;
897
+ }
898
+ .button-bar__button {
899
+ font-family: -apple-system, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;
900
+ -webkit-font-smoothing: antialiased;
901
+ -moz-osx-font-smoothing: grayscale;
902
+ font-weight: 400;
903
+ font-size: 17px;
904
+ -webkit-border-radius: inherit;
905
+ border-radius: inherit;
906
+ background-color: #fff;
907
+ font-weight: 400;
908
+ padding: 1px 12px 0 12px;
909
+ font-size: 13px;
910
+ width: 100%;
911
+ -webkit-transition: background-color 0.2s linear, color 0.2s linear;
912
+ -moz-transition: background-color 0.2s linear, color 0.2s linear;
913
+ -o-transition: background-color 0.2s linear, color 0.2s linear;
914
+ transition: background-color 0.2s linear, color 0.2s linear;
915
+ -webkit-box-sizing: border-box;
916
+ -moz-box-sizing: border-box;
917
+ box-sizing: border-box;
918
+ min-width: 80px;
919
+ }
920
+ /* .button-bar__item:first-child > .button-bar__button {
921
+ -webkit-border-top-left-radius: 3px;
922
+ border-top-left-radius: 3px;
923
+ -webkit-border-bottom-left-radius: 3px;
924
+ border-bottom-left-radius: 3px;
925
+ }
926
+ .button-bar__item:last-child > .button-bar__button {
927
+ -webkit-border-top-right-radius: 3px;
928
+ border-top-right-radius: 3px;
929
+ -webkit-border-bottom-right-radius: 3px;
930
+ border-bottom-right-radius: 3px;
931
+ } */
932
+ /* STYLE 2 */
933
+ .button-bar__item:first-child > .button-bar__button {
934
+ -webkit-border-top-left-radius: 0;
935
+ border-top-left-radius: 0;
936
+ -webkit-border-bottom-left-radius: 0;
937
+ border-bottom-left-radius: 0;
938
+ }
939
+ .button-bar__item:last-child > .button-bar__button {
940
+ -webkit-border-top-right-radius: 0;
941
+ border-top-right-radius: 0;
942
+ -webkit-border-bottom-right-radius: 0;
943
+ border-bottom-right-radius: 0;
944
+ }
945
+ /* .button-bar__button,
946
+ .button-bar__button:active,
947
+ :active + .button-bar__button {
948
+ height: 32px;
949
+ line-height: 30px;
950
+ } */
951
+ /* STYLE 2 */
952
+ .button-bar__button,
953
+ .button-bar__button:active,
954
+ :active + .button-bar__button {
955
+ height: 30px;
956
+ line-height: 28px;
957
+ }
958
+ .button-bar__item.active > .button-bar__button,
959
+ :checked + .button-bar__button,
960
+ .button-bar__button:active,
961
+ :active + .button-bar__button {
962
+ background-color: #80a9d4;
963
+ }
964
+
965
+ .button-bar__button {
966
+ color: #5e93cb;
967
+ }
968
+ .button-bar__item:first-child > .button-bar__button {
969
+ border-left: 1px solid #80a9d4;
970
+ border-right: 1px solid #80a9d4;
971
+ }
972
+ .button-bar__item:last-child > .button-bar__button {
973
+ border-right: 1px solid #80a9d4;
974
+ }
975
+ .button-bar__button,
976
+ .button-bar__button:active,
977
+ :active + .button-bar__button {
978
+ border: 0px solid #80a9d4;
979
+ border-top: 1px solid #80a9d4;
980
+ border-bottom: 1px solid #80a9d4;
981
+ border-right: 1px solid #80a9d4;
982
+ }
983
+
984
+ .button-bar__button:active,
985
+ :active + .button-bar__button {
986
+ font-size: 13px;
987
+ width: 100%;
988
+ -webkit-transition: none;
989
+ -moz-transition: none;
990
+ -o-transition: none;
991
+ transition: none;
992
+ }
993
+ .button-bar__item.active > .button-bar__button,
994
+ :checked + .button-bar__button {
995
+ color: #fff;
996
+ -webkit-transition: none;
997
+ -moz-transition: none;
998
+ -o-transition: none;
999
+ transition: none;
1000
+ }
1001
+ .button-bar__button:disabled {
1002
+ opacity: 0.3;
1003
+ cursor: default;
1004
+ pointer-events: none;
1005
+ }
1006
+ .button-bar__button:hover {
1007
+ -webkit-transition: none;
1008
+ -moz-transition: none;
1009
+ -o-transition: none;
1010
+ transition: none;
1011
+ }
1012
+ .button-bar__button:focus {
1013
+ outline: 0;
1014
+ }
1015
+ /* Radio Button in List Item */
1016
+ .radio-button__input {
1017
+ position: absolute;
1018
+ overflow: hidden;
1019
+ right: 0px;
1020
+ top: 0px;
1021
+ left: 0px;
1022
+ bottom: 0px;
1023
+ padding: 0;
1024
+ border: 0;
1025
+ opacity: 0.001;
1026
+ z-index: 1;
1027
+ vertical-align: top;
1028
+ outline: none;
1029
+ width: 100%;
1030
+ height: 100%;
1031
+ margin: 0;
1032
+ -webkit-appearance: none;
1033
+ appearance: none;
1034
+ }
1035
+ .radio-button__input:active,
1036
+ .radio-button__input:focus {
1037
+ outline: 0;
1038
+ -webkit-tap-highlight-color: rgba(0,0,0,0);
1039
+ }
1040
+ .radio-button__input:checked + .radio-button__checkmark:after {
1041
+ opacity: 1;
1042
+ }
1043
+ .radio-button__input:checked + .radio-button__checkmark:before {
1044
+ background: transparent;
1045
+ border: none;
1046
+ }
1047
+ .radio-button {
1048
+ position: relative;
1049
+ display: inline-block;
1050
+ vertical-align: top;
1051
+ cursor: default;
1052
+ -webkit-user-select: none;
1053
+ -moz-user-select: none;
1054
+ -ms-user-select: none;
1055
+ user-select: none;
1056
+ position: relative;
1057
+ overflow: hidden;
1058
+ line-height: 24px;
1059
+ text-align: left;
1060
+ }
1061
+ .radio-button__checkmark:before {
1062
+ content: '';
1063
+ position: absolute;
1064
+ -webkit-border-radius: 100%;
1065
+ border-radius: 100%;
1066
+ -webkit-box-sizing: border-box;
1067
+ -moz-box-sizing: border-box;
1068
+ box-sizing: border-box;
1069
+ -webkit-background-clip: padding-box;
1070
+ background-clip: padding-box;
1071
+ width: 24px;
1072
+ height: 24px;
1073
+ background: transparent;
1074
+ border: none;
1075
+ -webkit-border-radius: 16px;
1076
+ border-radius: 16px;
1077
+ left: 0;
1078
+ }
1079
+ .radio-button__checkmark {
1080
+ -webkit-box-sizing: border-box;
1081
+ -moz-box-sizing: border-box;
1082
+ box-sizing: border-box;
1083
+ -webkit-background-clip: padding-box;
1084
+ background-clip: padding-box;
1085
+ position: relative;
1086
+ display: inline-block;
1087
+ vertical-align: top;
1088
+ cursor: default;
1089
+ -webkit-user-select: none;
1090
+ -moz-user-select: none;
1091
+ -ms-user-select: none;
1092
+ user-select: none;
1093
+ font-family: -apple-system, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;
1094
+ -webkit-font-smoothing: antialiased;
1095
+ -moz-osx-font-smoothing: grayscale;
1096
+ font-weight: 400;
1097
+ font-size: 17px;
1098
+ position: relative;
1099
+ overflow: hidden;
1100
+ position: relative;
1101
+ width: 24px;
1102
+ height: 24px;
1103
+ background: transparent;
1104
+ pointer-events: none;
1105
+ }
1106
+ .radio-button__input:checked + .radio-button__checkmark {
1107
+ background: rgba(0,0,0,0);
1108
+ }
1109
+ .radio-button__checkmark:after {
1110
+ content: '';
1111
+ position: absolute;
1112
+ -webkit-border-radius: 100%;
1113
+ border-radius: 100%;
1114
+ top: 50%;
1115
+ left: 50%;
1116
+ -webkit-transform: translate(-50%, -50%);
1117
+ -moz-transform: translate(-50%, -50%);
1118
+ -ms-transform: translate(-50%, -50%);
1119
+ -o-transform: translate(-50%, -50%);
1120
+ transform: translate(-50%, -50%);
1121
+ top: 6px;
1122
+ left: 5px;
1123
+ opacity: 0;
1124
+ width: 12px;
1125
+ height: 6px;
1126
+ background: transparent;
1127
+ border: 3px solid #337ab7;
1128
+ border-width: 2px;
1129
+ border-top: none;
1130
+ border-right: none;
1131
+ -webkit-border-radius: 0px;
1132
+ border-radius: 0px;
1133
+ -webkit-transform: rotate(-45deg);
1134
+ -moz-transform: rotate(-45deg);
1135
+ -ms-transform: rotate(-45deg);
1136
+ -o-transform: rotate(-45deg);
1137
+ transform: rotate(-45deg);
1138
+ }
1139
+ .radio-button__input:disabled + .radio-button__checkmark {
1140
+ opacity: 0.3;
1141
+ cursor: default;
1142
+ pointer-events: none;
1143
+ }
1144
+
1145
+ /* No border Checkbox in List Item */
1146
+ .switch {
1147
+ position: relative;
1148
+ display: inline-block;
1149
+ vertical-align: top;
1150
+ -webkit-box-sizing: border-box;
1151
+ -moz-box-sizing: border-box;
1152
+ box-sizing: border-box;
1153
+ -webkit-background-clip: padding-box;
1154
+ background-clip: padding-box;
1155
+ position: relative;
1156
+ overflow: hidden;
1157
+ min-width: 51px;
1158
+ font-size: 17px;
1159
+ padding: 0 20px;
1160
+ border: none;
1161
+ overflow: visible;
1162
+ width: 51px;
1163
+ height: 32px;
1164
+ z-index: 0;
1165
+ text-align: left;
1166
+ }
1167
+ .switch__input {
1168
+ position: absolute;
1169
+ overflow: hidden;
1170
+ right: 0px;
1171
+ top: 0px;
1172
+ left: 0px;
1173
+ bottom: 0px;
1174
+ padding: 0;
1175
+ border: 0;
1176
+ opacity: 0.001;
1177
+ z-index: 1;
1178
+ vertical-align: top;
1179
+ outline: none;
1180
+ width: 100%;
1181
+ height: 100%;
1182
+ margin: 0;
1183
+ -webkit-appearance: none;
1184
+ appearance: none;
1185
+ z-index: -1;
1186
+ }
1187
+ .switch__toggle {
1188
+ background-color: #fff;
1189
+ position: absolute;
1190
+ top: 0px;
1191
+ left: 0px;
1192
+ right: 0px;
1193
+ bottom: 0px;
1194
+ -webkit-border-radius: 30px;
1195
+ border-radius: 30px;
1196
+ -webkit-transition-property: all;
1197
+ -moz-transition-property: all;
1198
+ -o-transition-property: all;
1199
+ transition-property: all;
1200
+ -webkit-transition-duration: 0.35s;
1201
+ -moz-transition-duration: 0.35s;
1202
+ -o-transition-duration: 0.35s;
1203
+ transition-duration: 0.35s;
1204
+ -webkit-transition-timing-function: ease-out;
1205
+ -moz-transition-timing-function: ease-out;
1206
+ -o-transition-timing-function: ease-out;
1207
+ transition-timing-function: ease-out;
1208
+ -webkit-box-shadow: inset 0 0 0 2px #e5e5e5;
1209
+ box-shadow: inset 0 0 0 2px #e5e5e5;
1210
+ }
1211
+ .switch__handle {
1212
+ -webkit-box-sizing: border-box;
1213
+ -moz-box-sizing: border-box;
1214
+ box-sizing: border-box;
1215
+ -webkit-background-clip: padding-box;
1216
+ background-clip: padding-box;
1217
+ position: absolute;
1218
+ content: '';
1219
+ -webkit-border-radius: 28px;
1220
+ border-radius: 28px;
1221
+ height: 28px;
1222
+ width: 28px;
1223
+ background-color: #fff;
1224
+ left: 1px;
1225
+ top: 2px;
1226
+ -webkit-transition-property: all;
1227
+ -moz-transition-property: all;
1228
+ -o-transition-property: all;
1229
+ transition-property: all;
1230
+ -webkit-transition-duration: 0.35s;
1231
+ -moz-transition-duration: 0.35s;
1232
+ -o-transition-duration: 0.35s;
1233
+ transition-duration: 0.35s;
1234
+ -webkit-transition-timing-function: cubic-bezier(0.59, 0.01, 0.5, 0.99);
1235
+ -moz-transition-timing-function: cubic-bezier(0.59, 0.01, 0.5, 0.99);
1236
+ -o-transition-timing-function: cubic-bezier(0.59, 0.01, 0.5, 0.99);
1237
+ transition-timing-function: cubic-bezier(0.59, 0.01, 0.5, 0.99);
1238
+ -webkit-box-shadow: 0 0 0 1px #e4e4e4, 0 3px 2px rgba(0,0,0,0.25);
1239
+ box-shadow: 0 0 0 1px #e4e4e4, 0 3px 2px rgba(0,0,0,0.25);
1240
+ }
1241
+ .switch--active .switch__handle {
1242
+ -webkit-transition-duration: 0s;
1243
+ -moz-transition-duration: 0s;
1244
+ -o-transition-duration: 0s;
1245
+ transition-duration: 0s;
1246
+ }
1247
+ input:checked + .switch__toggle {
1248
+ -webkit-box-shadow: inset 0 0 0 2px #5198db;
1249
+ box-shadow: inset 0 0 0 2px #5198db;
1250
+ background-color: #5198db;
1251
+ }
1252
+ input:checked + .switch__toggle .switch__handle {
1253
+ left: 21px;
1254
+ -webkit-box-shadow: 0 3px 2px rgba(0,0,0,0.25);
1255
+ box-shadow: 0 3px 2px rgba(0,0,0,0.25);
1256
+ }
1257
+ input:disabled + .switch__toggle {
1258
+ opacity: 0.3;
1259
+ cursor: default;
1260
+ pointer-events: none;
1261
+ }
1262
+ .switch__touch {
1263
+ position: absolute;
1264
+ top: -5px;
1265
+ bottom: -5px;
1266
+ left: -10px;
1267
+ right: -10px;
1268
+ }
1269
+ /* Checkbox */
1270
+ .checkbox {
1271
+ position: relative;
1272
+ display: inline-block;
1273
+ vertical-align: top;
1274
+ cursor: default;
1275
+ -webkit-user-select: none;
1276
+ -moz-user-select: none;
1277
+ -ms-user-select: none;
1278
+ user-select: none;
1279
+ font-family: -apple-system, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;
1280
+ -webkit-font-smoothing: antialiased;
1281
+ -moz-osx-font-smoothing: grayscale;
1282
+ font-weight: 400;
1283
+ font-size: 17px;
1284
+ line-height: 24px;
1285
+ cursor: pointer;
1286
+ }
1287
+ .checkbox__checkmark {
1288
+ -webkit-box-sizing: border-box;
1289
+ -moz-box-sizing: border-box;
1290
+ box-sizing: border-box;
1291
+ -webkit-background-clip: padding-box;
1292
+ background-clip: padding-box;
1293
+ position: relative;
1294
+ display: inline-block;
1295
+ vertical-align: top;
1296
+ cursor: default;
1297
+ -webkit-user-select: none;
1298
+ -moz-user-select: none;
1299
+ -ms-user-select: none;
1300
+ user-select: none;
1301
+ font-family: -apple-system, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;
1302
+ -webkit-font-smoothing: antialiased;
1303
+ -moz-osx-font-smoothing: grayscale;
1304
+ font-weight: 400;
1305
+ font-size: 17px;
1306
+ position: relative;
1307
+ overflow: hidden;
1308
+ height: 24px;
1309
+ pointer-events: none;
1310
+ }
1311
+ .checkbox__input {
1312
+ position: absolute;
1313
+ overflow: hidden;
1314
+ right: 0px;
1315
+ top: 0px;
1316
+ left: 0px;
1317
+ bottom: 0px;
1318
+ padding: 0;
1319
+ border: 0;
1320
+ opacity: 0.001;
1321
+ z-index: 1;
1322
+ vertical-align: top;
1323
+ outline: none;
1324
+ width: 100%;
1325
+ height: 100%;
1326
+ margin: 0;
1327
+ -webkit-appearance: none;
1328
+ appearance: none;
1329
+ }
1330
+ .checkbox__input:checked {
1331
+ background: rgba(24,103,194,0.81);
1332
+ }
1333
+ .checkbox__input:checked + .checkbox__checkmark:before {
1334
+ background: #80a9d4;
1335
+ border: 1px solid #80a9d4;
1336
+ }
1337
+ .checkbox__input:checked + .checkbox__checkmark:after {
1338
+ opacity: 1;
1339
+ }
1340
+
1341
+ .checkbox__checkmark::before {
1342
+ content: '';
1343
+ position: absolute;
1344
+ -webkit-box-sizing: border-box;
1345
+ -moz-box-sizing: border-box;
1346
+ box-sizing: border-box;
1347
+ -webkit-background-clip: padding-box;
1348
+ background-clip: padding-box;
1349
+ width: 24px;
1350
+ height: 24px;
1351
+ background: #fff;
1352
+ border: 1px solid #ccc;
1353
+ -webkit-border-radius: 16px;
1354
+ border-radius: 3px;
1355
+ -webkit-box-shadow: none;
1356
+ box-shadow: none;
1357
+ left: 0;
1358
+ }
1359
+ .checkbox__checkmark {
1360
+ -webkit-box-sizing: border-box;
1361
+ -moz-box-sizing: border-box;
1362
+ box-sizing: border-box;
1363
+ -webkit-background-clip: padding-box;
1364
+ background-clip: padding-box;
1365
+ position: relative;
1366
+ display: inline-block;
1367
+ vertical-align: top;
1368
+ cursor: default;
1369
+ -webkit-user-select: none;
1370
+ -moz-user-select: none;
1371
+ -ms-user-select: none;
1372
+ user-select: none;
1373
+ font-family: -apple-system, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;
1374
+ -webkit-font-smoothing: antialiased;
1375
+ -moz-osx-font-smoothing: grayscale;
1376
+ font-weight: 400;
1377
+ font-size: 17px;
1378
+ position: relative;
1379
+ overflow: hidden;
1380
+ width: 24px;
1381
+ height: 24px;
1382
+ margin-right: 10px;
1383
+ }
1384
+ .checkbox__checkmark:after {
1385
+ content: '';
1386
+ position: absolute;
1387
+ top: 6px;
1388
+ left: 5px;
1389
+ width: 12px;
1390
+ height: 6px;
1391
+ background: transparent;
1392
+ border: 3px solid #fff;
1393
+ border-width: 2px;
1394
+ border-top: none;
1395
+ border-right: none;
1396
+ -webkit-border-radius: 0px;
1397
+ border-radius: 0px;
1398
+ -webkit-transform: rotate(-45deg);
1399
+ -moz-transform: rotate(-45deg);
1400
+ -ms-transform: rotate(-45deg);
1401
+ -o-transform: rotate(-45deg);
1402
+ transform: rotate(-45deg);
1403
+ opacity: 0;
1404
+ }
1405
+ .checkbox__input:focus + .checkbox__checkmark:before {
1406
+ -webkit-box-shadow: none;
1407
+ box-shadow: none;
1408
+ }
1409
+ .checkbox__input:disabled + .checkbox__checkmark {
1410
+ opacity: 0.3;
1411
+ cursor: default;
1412
+ pointer-events: none;
1413
+ }
1414
+ .checkbox__input:disabled:active + .checkbox__checkmark:before {
1415
+ background: transparent;
1416
+ -webkit-box-shadow: none;
1417
+ box-shadow: none;
1418
+ }
1419
+ /* checkbox--noborder */
1420
+ .checkbox--noborder__input {
1421
+ position: absolute;
1422
+ overflow: hidden;
1423
+ right: 0px;
1424
+ top: 0px;
1425
+ left: 0px;
1426
+ bottom: 0px;
1427
+ padding: 0;
1428
+ border: 0;
1429
+ opacity: 0.001;
1430
+ z-index: 1;
1431
+ vertical-align: top;
1432
+ outline: none;
1433
+ width: 100%;
1434
+ height: 100%;
1435
+ margin: 0;
1436
+ -webkit-appearance: none;
1437
+ appearance: none;
1438
+ }
1439
+ .checkbox--noborder {
1440
+ position: relative;
1441
+ display: inline-block;
1442
+ vertical-align: top;
1443
+ cursor: default;
1444
+ -webkit-user-select: none;
1445
+ -moz-user-select: none;
1446
+ -ms-user-select: none;
1447
+ user-select: none;
1448
+ font-family: -apple-system, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;
1449
+ -webkit-font-smoothing: antialiased;
1450
+ -moz-osx-font-smoothing: grayscale;
1451
+ font-weight: 400;
1452
+ font-size: 17px;
1453
+ line-height: 24px;
1454
+ position: relative;
1455
+ overflow: hidden;
1456
+ }
1457
+ .checkbox--noborder__checkmark {
1458
+ position: relative;
1459
+ display: inline-block;
1460
+ vertical-align: top;
1461
+ cursor: default;
1462
+ -webkit-user-select: none;
1463
+ -moz-user-select: none;
1464
+ -ms-user-select: none;
1465
+ user-select: none;
1466
+ -webkit-box-sizing: border-box;
1467
+ -moz-box-sizing: border-box;
1468
+ box-sizing: border-box;
1469
+ -webkit-background-clip: padding-box;
1470
+ background-clip: padding-box;
1471
+ height: 24px;
1472
+ background: transparent;
1473
+ }
1474
+ .checkbox--noborder__input {
1475
+ position: absolute;
1476
+ overflow: hidden;
1477
+ right: 0px;
1478
+ top: 0px;
1479
+ left: 0px;
1480
+ bottom: 0px;
1481
+ padding: 0;
1482
+ border: 0;
1483
+ opacity: 0.001;
1484
+ z-index: 1;
1485
+ vertical-align: top;
1486
+ outline: none;
1487
+ width: 100%;
1488
+ height: 100%;
1489
+ margin: 0;
1490
+ -webkit-appearance: none;
1491
+ appearance: none;
1492
+ }
1493
+ .checkbox--noborder__input:checked + .checkbox--noborder__checkmark:before {
1494
+ background: transparent;
1495
+ border: none;
1496
+ }
1497
+ .checkbox--noborder__input:checked + .checkbox--noborder__checkmark:after {
1498
+ opacity: 1;
1499
+ }
1500
+ .checkbox--noborder__checkmark:before {
1501
+ content: '';
1502
+ position: absolute;
1503
+ width: 24px;
1504
+ height: 24px;
1505
+ background: transparent;
1506
+ border: none;
1507
+ -webkit-border-radius: 16px;
1508
+ border-radius: 16px;
1509
+ left: 0;
1510
+ }
1511
+ .checkbox--noborder__checkmark {
1512
+ position: relative;
1513
+ display: inline-block;
1514
+ vertical-align: top;
1515
+ cursor: default;
1516
+ -webkit-user-select: none;
1517
+ -moz-user-select: none;
1518
+ -ms-user-select: none;
1519
+ user-select: none;
1520
+ -webkit-box-sizing: border-box;
1521
+ -moz-box-sizing: border-box;
1522
+ box-sizing: border-box;
1523
+ -webkit-background-clip: padding-box;
1524
+ background-clip: padding-box;
1525
+ width: 24px;
1526
+ height: 24px;
1527
+ border: none;
1528
+ }
1529
+ .checkbox--noborder__checkmark:after {
1530
+ content: '';
1531
+ position: absolute;
1532
+ top: 6px;
1533
+ left: 5px;
1534
+ opacity: 0;
1535
+ width: 12px;
1536
+ height: 6px;
1537
+ background: transparent;
1538
+ border: 3px solid rgba(24,103,194,0.81);
1539
+ border-width: 2px;
1540
+ border-top: none;
1541
+ border-right: none;
1542
+ -webkit-border-radius: 0px;
1543
+ border-radius: 0px;
1544
+ -webkit-transform: rotate(-45deg);
1545
+ -moz-transform: rotate(-45deg);
1546
+ -ms-transform: rotate(-45deg);
1547
+ -o-transform: rotate(-45deg);
1548
+ transform: rotate(-45deg);
1549
+ }
1550
+ .checkbox--noborder__input:focus + .checkbox--noborder__checkmark:before {
1551
+ border: none;
1552
+ -webkit-box-shadow: none;
1553
+ box-shadow: none;
1554
+ }
1555
+ .checkbox--noborder__input:disabled + .checkbox--noborder__checkmark {
1556
+ opacity: 0.3;
1557
+ cursor: default;
1558
+ pointer-events: none;
1559
+ }
1560
+ .checkbox--noborder__input:disabled:active + .checkbox--noborder__checkmark:before {
1561
+ background: transparent;
1562
+ -webkit-box-shadow: none;
1563
+ box-shadow: none;
1564
+ border: none;
1565
+ }
1566
+
1567
+ /* List */
1568
+ .exopite-sof-content .list__item__left {
1569
+ -webkit-box-sizing: border-box;
1570
+ -moz-box-sizing: border-box;
1571
+ box-sizing: border-box;
1572
+ display: -webkit-box;
1573
+ display: -webkit-flex;
1574
+ display: -moz-box;
1575
+ display: -ms-flexbox;
1576
+ display: flex;
1577
+ padding: 12px 14px 12px 0;
1578
+ -webkit-box-ordinal-group: 1;
1579
+ -webkit-order: 0;
1580
+ -moz-box-ordinal-group: 1;
1581
+ -ms-flex-order: 0;
1582
+ order: 0;
1583
+ -webkit-box-align: center;
1584
+ -webkit-align-items: center;
1585
+ -moz-box-align: center;
1586
+ -ms-flex-align: center;
1587
+ align-items: center;
1588
+ -webkit-align-self: stretch;
1589
+ -ms-flex-item-align: stretch;
1590
+ align-self: stretch;
1591
+ line-height: 1.2em;
1592
+ min-height: 44px;
1593
+ }
1594
+ .exopite-sof-content .list__item__left:empty {
1595
+ width: 0;
1596
+ min-width: 0;
1597
+ padding: 0;
1598
+ margin: 0;
1599
+ }
1600
+ .exopite-sof-content .list__item__center {
1601
+ -webkit-box-sizing: border-box;
1602
+ -moz-box-sizing: border-box;
1603
+ box-sizing: border-box;
1604
+ display: -webkit-box;
1605
+ display: -webkit-flex;
1606
+ display: -moz-box;
1607
+ display: -ms-flexbox;
1608
+ display: flex;
1609
+ -webkit-box-flex: 1;
1610
+ -webkit-flex-grow: 1;
1611
+ -moz-box-flex: 1;
1612
+ -ms-flex-positive: 1;
1613
+ flex-grow: 1;
1614
+ -webkit-flex-wrap: wrap;
1615
+ -ms-flex-wrap: wrap;
1616
+ flex-wrap: wrap;
1617
+ -webkit-box-orient: horizontal;
1618
+ -webkit-box-direction: normal;
1619
+ -webkit-flex-direction: row;
1620
+ -moz-box-orient: horizontal;
1621
+ -moz-box-direction: normal;
1622
+ -ms-flex-direction: row;
1623
+ flex-direction: row;
1624
+ -webkit-box-ordinal-group: 2;
1625
+ -webkit-order: 1;
1626
+ -moz-box-ordinal-group: 2;
1627
+ -ms-flex-order: 1;
1628
+ order: 1;
1629
+ margin-right: auto;
1630
+ -webkit-box-align: center;
1631
+ -webkit-align-items: center;
1632
+ -moz-box-align: center;
1633
+ -ms-flex-align: center;
1634
+ align-items: center;
1635
+ -webkit-align-self: stretch;
1636
+ -ms-flex-item-align: stretch;
1637
+ align-self: stretch;
1638
+ margin-left: 0;
1639
+ border-bottom: none;
1640
+ -webkit-background-size: 100% 1px;
1641
+ background-size: 100% 1px;
1642
+ background-repeat: no-repeat;
1643
+ background-position: bottom;
1644
+ background-image: -webkit-linear-gradient(90deg, #ccc, #ccc 100%);
1645
+ background-image: -moz-linear-gradient(90deg, #ccc, #ccc 100%);
1646
+ background-image: -o-linear-gradient(90deg, #ccc, #ccc 100%);
1647
+ background-image: linear-gradient(0deg, #ccc, #ccc 100%);
1648
+ padding: 12px 6px 12px 0;
1649
+ line-height: 1.2em;
1650
+ min-height: 44px;
1651
+ margin-right: 15px;
1652
+ }
1653
+ @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
1654
+ .exopite-sof-content .list__item__center {
1655
+ background-image: -webkit-linear-gradient(90deg, #ccc, #ccc 50%, transparent 50%);
1656
+ background-image: -moz-linear-gradient(90deg, #ccc, #ccc 50%, transparent 50%);
1657
+ background-image: -o-linear-gradient(90deg, #ccc, #ccc 50%, transparent 50%);
1658
+ background-image: linear-gradient(0deg, #ccc, #ccc 50%, transparent 50%);
1659
+ }
1660
+ }
1661
+ .exopite-sof-content .list__item__right {
1662
+ -webkit-box-sizing: border-box;
1663
+ -moz-box-sizing: border-box;
1664
+ box-sizing: border-box;
1665
+ display: -webkit-box;
1666
+ display: -webkit-flex;
1667
+ display: -moz-box;
1668
+ display: -ms-flexbox;
1669
+ display: flex;
1670
+ margin-left: auto;
1671
+ padding: 12px 12px 12px 0;
1672
+ -webkit-box-ordinal-group: 3;
1673
+ -webkit-order: 2;
1674
+ -moz-box-ordinal-group: 3;
1675
+ -ms-flex-order: 2;
1676
+ order: 2;
1677
+ -webkit-box-align: center;
1678
+ -webkit-align-items: center;
1679
+ -moz-box-align: center;
1680
+ -ms-flex-align: center;
1681
+ align-items: center;
1682
+ -webkit-align-self: stretch;
1683
+ -ms-flex-item-align: stretch;
1684
+ align-self: stretch;
1685
+ border-bottom: none;
1686
+ -webkit-background-size: 100% 1px;
1687
+ background-size: 100% 1px;
1688
+ background-repeat: no-repeat;
1689
+ background-position: bottom;
1690
+ background-image: -webkit-linear-gradient(90deg, #ccc, #ccc 100%);
1691
+ background-image: -moz-linear-gradient(90deg, #ccc, #ccc 100%);
1692
+ background-image: -o-linear-gradient(90deg, #ccc, #ccc 100%);
1693
+ background-image: linear-gradient(0deg, #ccc, #ccc 100%);
1694
+ line-height: 1.2em;
1695
+ min-height: 44px;
1696
+ }
1697
+ @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
1698
+ .exopite-sof-content .list__item__right {
1699
+ background-image: -webkit-linear-gradient(90deg, #ccc, #ccc 50%, transparent 50%);
1700
+ background-image: -moz-linear-gradient(90deg, #ccc, #ccc 50%, transparent 50%);
1701
+ background-image: -o-linear-gradient(90deg, #ccc, #ccc 50%, transparent 50%);
1702
+ background-image: linear-gradient(0deg, #ccc, #ccc 50%, transparent 50%);
1703
+ }
1704
+ }
1705
+ .exopite-sof-content .list__header {
1706
+ margin: 0;
1707
+ padding: 0;
1708
+ list-style: none;
1709
+ text-align: left;
1710
+ display: block;
1711
+ -webkit-box-sizing: border-box;
1712
+ -moz-box-sizing: border-box;
1713
+ box-sizing: border-box;
1714
+ padding: 20px 0 0 15px;
1715
+ font-size: 12px;
1716
+ font-weight: 500;
1717
+ color: #1f1f21;
1718
+ text-shadow: none;
1719
+ border-top: none;
1720
+ border-bottom: 1px solid #ccc;
1721
+ -webkit-box-shadow: 0px 1px 0px 0px #fff;
1722
+ box-shadow: 0px 1px 0px 0px #fff;
1723
+ min-height: 24px;
1724
+ line-height: 24px;
1725
+ margin-top: -1px;
1726
+ text-transform: uppercase;
1727
+ position: relative;
1728
+ }
1729
+ .exopite-sof-content .list__header:not(:first-of-type) {
1730
+ border-top: 1px solid #ccc;
1731
+ }
1732
+ .exopite-sof-content .list {
1733
+ padding: 0;
1734
+ margin: 0;
1735
+ font: inherit;
1736
+ color: inherit;
1737
+ background: transparent;
1738
+ border: none;
1739
+ line-height: normal;
1740
+ cursor: default;
1741
+ -webkit-user-select: none;
1742
+ -moz-user-select: none;
1743
+ -ms-user-select: none;
1744
+ user-select: none;
1745
+ font-family: -apple-system, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;
1746
+ -webkit-font-smoothing: antialiased;
1747
+ -moz-osx-font-smoothing: grayscale;
1748
+ font-weight: 400;
1749
+ font-size: 17px;
1750
+ padding: 0;
1751
+ margin: 0;
1752
+ list-style-type: none;
1753
+ text-align: left;
1754
+ overflow: auto;
1755
+ display: block;
1756
+ -webkit-overflow-scrolling: touch;
1757
+ overflow: hidden;
1758
+ border: 1px solid #ccc;
1759
+ max-width: 500px;
1760
+ border-radius: 3px;
1761
+ }
1762
+ .exopite-sof-content .list__item {
1763
+ margin: 0;
1764
+ padding: 0;
1765
+ width: 100%;
1766
+ position: relative;
1767
+ list-style: none;
1768
+ -webkit-box-sizing: border-box;
1769
+ -moz-box-sizing: border-box;
1770
+ box-sizing: border-box;
1771
+ display: -webkit-box;
1772
+ display: -webkit-flex;
1773
+ display: -moz-box;
1774
+ display: -ms-flexbox;
1775
+ display: flex;
1776
+ -webkit-box-orient: horizontal;
1777
+ -webkit-box-direction: normal;
1778
+ -webkit-flex-direction: row;
1779
+ -moz-box-orient: horizontal;
1780
+ -moz-box-direction: normal;
1781
+ -ms-flex-direction: row;
1782
+ flex-direction: row;
1783
+ -webkit-box-pack: start;
1784
+ -webkit-justify-content: flex-start;
1785
+ -moz-box-pack: start;
1786
+ -ms-flex-pack: start;
1787
+ justify-content: flex-start;
1788
+ -webkit-box-align: center;
1789
+ -webkit-align-items: center;
1790
+ -moz-box-align: center;
1791
+ -ms-flex-align: center;
1792
+ align-items: center;
1793
+ padding: 0 0 0 14px;
1794
+ margin: 1px 0 -1px 0;
1795
+ color: #1f1f21;
1796
+ background-color: #fff;
1797
+ }
1798
+ .exopite-sof-content .list__item:first-child {
1799
+ margin-top: 0;
1800
+ }
1801
+ .exopite-sof-content .list__item_active:active {
1802
+ background-color: #d9d9d9;
1803
+ -webkit-transition: none;
1804
+ -moz-transition: none;
1805
+ -o-transition: none;
1806
+ transition: none;
1807
+ }
1808
+ .exopite-sof-content .list__item--tappable:active {
1809
+ background-color: #d9d9d9;
1810
+ }
1811
+ .exopite-sof-field-radio .radio-button__checkmark::before {
1812
+ width: 24px;
1813
+ height: 24px;
1814
+ background: #fff;
1815
+ border: 1px solid #ccc;
1816
+ cursor: pointer;
1817
+ }
1818
+ .exopite-sof-field-radio .radio-button__input:checked + .radio-button__checkmark::before {
1819
+ border: 1px solid #80a9d4;
1820
+ }
1821
+ .exopite-sof-field-radio .radio-button__checkmark::after {
1822
+ top: 5px;
1823
+ left: 5px;
1824
+ opacity: 0;
1825
+ width: 14px;
1826
+ height: 14px;
1827
+ background: #80a9d4;
1828
+ border: none;
1829
+ transform: none;
1830
+ border-radius: 50%;
1831
+ }
1832
+ .exopite-sof-field-radio .radio-button__checkmark {
1833
+ margin-right: 10px;
1834
+ }
1835
+ /*repeater*/
1836
+ .exopite-sof-cloneable__title {
1837
+ border-bottom: 1px solid #e5e5e5;
1838
+ background: #fafafa;
1839
+ padding: 12px 30px;
1840
+ cursor: pointer;
1841
+ position: relative;
1842
+ margin: 0;
1843
+ }
1844
+ /* STYLE 2 */
1845
+ .exopite-sof-cloneable__title {
1846
+ border-bottom: 1px solid #e5e5e5;
1847
+ padding: 11px 30px;
1848
+ }
1849
+ .exopite-sof-cloneable__item {
1850
+ border: 1px solid #e5e5e5;
1851
+ margin-bottom: 5px;
1852
+ }
1853
+ .exopite-sof-cloneable--helper {
1854
+ float: right;
1855
+ }
1856
+ .exopite-sof-group-compact .exopite-sof-cloneable__item .exopite-sof-cloneable__muster--hidden,
1857
+ .exopite-sof-cloneable__muster--hidden {
1858
+ display: none !important;
1859
+ }
1860
+ .exopite-sof-accordion--hidden .exopite-sof-accordion__content {
1861
+ display: none;
1862
+ }
1863
+ .exopite-sof-cloneable__item mute {
1864
+ font-size: 89%;
1865
+ font-style: italic;
1866
+ color: #aaa;
1867
+ }
1868
+ .chosen-container {
1869
+ max-width: 100%;
1870
+ }
1871
+ .exopite-sof-info--small {
1872
+ display: block;
1873
+ color: #777;
1874
+ font-style: italic;
1875
+ }
1876
+ .exopite-sof-info--warning {
1877
+ color: #f00;
1878
+ }
1879
+ .wp-core-ui .button-warning:focus,
1880
+ .wp-core-ui .button-warning:hover,
1881
+ .wp-core-ui .button-warning:active,
1882
+ .wp-core-ui .button-warning {
1883
+ background: #de0000;
1884
+ border-color: #c00000;
1885
+ box-shadow: 0 1px 0 red;
1886
+ text-shadow: 0 -1px 1px #b40000,1px 0 1px #b40000,0 1px 1px #b40000,-1px 0 1px #b40000;
1887
+ color: #fff;
1888
+ }
1889
+ .button.loading,
1890
+ .button.loading:active,
1891
+ .button.loading:focus,
1892
+ .button.loading:hover {
1893
+ background: #aaa;
1894
+ border-color: #aaa;
1895
+ box-shadow: none;
1896
+ color: #666;
1897
+ text-shadow: none;
1898
+ cursor: default;
1899
+ }
1900
+ .exopite-sof-fieldset input[type=text].colorpicker.wp-color-picker {
1901
+ display: inline-block;
1902
+ background: #fff;
1903
+ /* height: auto; */
1904
+ position: relative;
1905
+ }
1906
+ /* Datepicker */
1907
+ .ui-datepicker .ui-datepicker-next span,
1908
+ .ui-datepicker .ui-datepicker-prev span {
1909
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAADwCAQAAABFnnJAAAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAAAEgAAABIAEbJaz4AABe4SURBVHja7V1diCXHdf56vbZmVl6nxwKFO2yyq1mM4qAwM7oDsR6C7iYIKesH3V1QHgyBu5YYJwHjrB9NQCuByIthHbAga6TZxeBgHMJKISZ+SDIb1oQgRtoVgtjGyD8PmSGQMIpfJmCLk4f+q6o+daq6+965P1VfM3Pv7VN16ud8Vd1dp6o6IUSEjBPTzkDEdBEJEDgiAXT0QOhNOxPHiUgAFT3sA9gPiQLjJsD0208Pbe9rM/OvwkaBQvP0yzhG6ASQO0AqDwmu9mOPT3nqPWsYV9qFEduVIDP/QU4BSfMC9REqAcbRAa520FDELdphc3SJCyRIcADgAAkSQXOXMs4ckrIxFEUs2oENBNSqR0WmJ2kVv2hltvRdaVPHvPtqdpVxjlD1AHIH6AupDbovH1nqkgllLd3apnQJUjV362dmDEnjOya5FUltsEqqbdtxa5Dbppx3uQ+sNLv6mblCcwLIoKlXTQ/7rQkmX4IKzdMv4xgxbgLMO3rYXyTzuhEJEDjiSGDgiAQIHJEAgSMSIHBEAgSOSIDAEQkQOOJ8ADPutPN/zGgyH8BvRoDLGdMT5wPIKbjN02U+gNsdnuV9oUjSbD6AnwdMrkK7gVYt3311u8zv0r5vfNq1L8xsgPp8gAz20fAilORvs8tdsX3mA0i5k1N3x5dBue7icyGgzwfgvus48OoF+DDu9ukzH0Bqf355s9OHnLMNmqQ0F2jjDJIcrrM+H0Ail6v/KUoe3cECpl85XecDTDv/x4zoDg4ccSAocEQCBI5IgMARCRA4IgECRyRA4IgECBwnp52BmQNNcZS/+1hp4/yf7BZ9IpUwzRyQMwftXUHumFMouX4JIED09fvsD0AtJE3RNg1X/jPTJ6IWNznaxvYrgU+oBnFPaAFcxU88CmCPn3hUkE8RSHD2+OQvEWT6Z7M0Com7BuQSygQiR2zA1Yi1/KuXAN/i22bruCspGUMHT6In0nUV7ZIDKmMnrFRNnUulaF72PJAgl3VXpZObgZrLBGh6E0gerccVyoed7dq4n3ETD+2SgXz0tq0BqQn66HbXQU3e5DGw6uJ8QvEyuQt0M1jW4epi/bpoVwtype5zE9kWboq75VoOTHdw6E8B851+i8fIOB8gcMSRwMARCRA4IgECRyRA4IgECByRAIEjEiBw6ItDi81Spwf3fuCThE8N+HhE28VzrY32TaURKgIUC6N8tntvVwHjQztdrpz71YC01Wzljes1jp35KYvDXoZe6xogI5cA+MWh8hJOH492jzk3PgrYdPltDWHPv18N2NLoGctre41iVyVw9UDdlqbXFujqQ8E+26m7lmDbFoj6zaRx58Cmx72FuzvnfhvS8z63umkTQ+5aWF4Zh1ufSJpm2WFsc1gn9TBNCeBfAUmDuH45kKvQJ3332n57+q7YLgK460A2oJsAMoEsBGj2FFBVQBuPVaLo4LWT9iml3wZVvtveQ0ipr+bS4grO7yAgpV/E5O8BXJqrvRuk9c1mLhvOB5AqQL+BkYovZ04qoqRDLZp72hdnAjcBpRIcGBtIHDTW4AfJvAfla2/8commlwA/XzU5t4iQr4JdYvtVL18Ov2tw9yltkp72L7Vx3wOwiPMBVPScb0xaOEQCBI44FBw4IgECRyRA4IgECByRAIEjEmDcmLPHKnM+gAuSv8qn6L2O/u5Jo3vuEsdg94yVvT4fQILkMfcZJSw8dqseC0zt6Lq4Sl4enjiXv7oNbIsvaZ8SqoEgNVvu3X7rg43q0sh2b//2HWgGJI+dK3ZiDaeetXk7pcWj5CX1L+mxgL8HsE06kP1V1aWhzaSFrOW4p03Z9zAg+Pr6kgZnuXS59N0rm2cS5vsCqips+gZu8xKSNIhbSP2WQLsXb7ffQkIyo6uH8Ncs7RFwzKh6ANVR2CZrrjcJuJ2tXa+OidKD8D2E/smFGE8r5lLQe48ZMb9+CTgoM8V14FkHn0334nEgzgfw8fa7t4eQUc0F4KdUyFVfXYTsu4sUIZOGUjVE2wk1EwHvDSRrB+7jLLXdBI7D2eo3a7HtjabPTSQAB0Fnxrg+iO5gHTPTNR8XIgECRxwKDhyRAIEjEiBwRAIEjkiAwDF7BEhny1u26DAJ4OfLllw25CW1hUhxeCxP4tPeB2Fm0Gy7eJ/tpBOsdMjPIQqSpGK4tlvWV1igN4B3gU4AeZRaHu0uWnWKQ5YCVA6U8mv3sq5/pQxxaIlffGu3qbra+/i9an7BURFA3+69jsofbtsyPUGSm/8DNi25a8+6/g+wIqydLVLn09dnFJha/LaPCA7FULDf6nYJxVwbm/nNuThmL+L6LZ2tS8xw5vYR0lvOg4I6JSxB3Uwm7FMZ/CZE2CeVmQSyTcngc+jaPkEn+IK9Ar4LqhdGqFVm32DE/dYL39dK2OQZBah2H1E4gvld+fX8+Lw2IgIAtz+A38r1ul/evUONJM1uHuUQurbE61wB9w5CgcL/hRH6rNjq+7hhv4voBv/tI4LCrM0HmJT5IyyYNQJEHDNmzxcQcayIBAgckQCBIxIgcCwSAfqlJ6A/Ef0nsZQfzd63OtPICDDMK24Xw9aaXnZ4+l0g3NBmCzQ1Yh975fc9Nna/Ez1O4ld4FEc4wqP4FUuBvjP3a7l0zZKGXe6KCTxnHHIKxtwOoqs0oAENSUUVtjo/JFgOKj+3tbhqCF57doyor8lHmrRPJvqN5HoOudytGfHXDPkSrRPREi0R0TotCTXAp1GHVEP+EjXEtncZyxAFk+8BAO5YJnPcxpdxD0CK2+W5O7hgZeMXLCOKy+W3o5rsJr4htL89ZBtLZNgHYU9LYQ9bSg8AbBlyN95Xcpfl0Ix/H8t4EEAf942wej6BLUbim5suL5+XsYb3y++lpoIA9/NPdRqGmuV7AH6EI3G2z1L+ecMa4qNC7Ct4D9uC/JLmSr6kUDHD2woFtvC2ISWoizP5FYYfxS/K759g8/AgPoEEp4RcXhRkpkeSl/MvoE4YLc0IXpj/D/DP6unqWnboUPAjHNXC6FnICLAiaLO1G8DVAwBvlRQgXMJbTIiCAnXzZ0iNz3rufl3M6Qb+G38I4B+xwcZ/GygpxOdgK++p9N7qOFCY/4+wrFPA936WM3+9AgG5o8razk9ZmasHKCgAi/mRpw7rTd5549PEEn6efzvLSB/Eu9jAfQAbeBcP4f8MuTkLqe0yU3dH7wrxOfxN7Vxm/i/gQQD/AADFBdz/MbBufrOAp3AKp7CMU9ZO8gE8gAcAcC3spsP8QA9v4RIu4S3LdM4+DjDEEAct7/OX8Vv5sVzLXw9nQPgFNrCBEyCcEaeUblmMf075s2EJLrhCfIs5l5H+Bj6G7wAALuBOJmj/RFsv4rIzzg+FkK4eoIcDIG/7B0z19zU5R4HfMD7NKspayQayOyK9n3gY9wH8pPx9HxvCjKIuHfxRxxD8hNmf5OXL7s9K86N8DEwdj1HuR5iXNfnL1scV+2PMjQk+BhYPSdWnLRd95hGQe4hzPeg1fQwGjayl9wmhlpDXXzwEDtSzs+MO7gP4HeX3e5YbqcmCAJxXWvr4tWeYztSUNbyvtX7E+QDBY5F8AREtEAkQOCIBAkckQOCIBFgsvIJXmkXQCZCC4FqYbQeVjoyujxZ9cB71LeXxte5vGxqPvUNDvm3IuUEn1Vu+NgE5APylo34GGLSut9P4Cr6C045QI4wwKn8pdZISUZ/6RJTWBhF2aSkfRrhG6zRkh0Fu5AMR23TDkMuebPPos+G3FE82EdEWOxBSHPX47oGcLMw6rdP6hORFmGxQx5QMqBiQS83hmtw6RNuEvHQpo/suERHdFWu3GEwa0TkCQU+gn4+h1dUT9RqNg3FyENGf5X9XrRXUp2wCSt+iH5YUXAYmAv07ge4R6N+InzJBtJ5L1gU5RPlpWqLTFnlR/SMaNa7BAtusfLsWe5tNf0hEI0qrkUTVHVw4Kfew1WqjFnWuAO85fAL7+DF+gJ/jPYtPsI89XMIbVpduF/wTfhffwwa+hyfwL9ZQ2Vj6hijXxyx1/LLmJ6wwwk0AyP/X6+9Q+8WDn21x1uMMAHwJwEp+eUzxAcoe4IYxmt6nG417ALWDs/UAV4noL4joFbaF9InY1j+uHuBvCfRdAn2Llpj0H3X0AIUcotzeA4y03JmXgIGS6wyDRuX7qib7KlOD5+hcPXUziX5OhHr1j4MAn6HfpM/R+fyvifn1WXE2AqRElFKaXy9N+XeI6Nv539/V5EX5bNfwSv64Q87Hr6692XG+IQFMd10q1JDsatLOmwrUT122RENCyaEBE0ImQN1f18T8ZvFkAvDys/Rdeph26WH6e/q0IV+t5W5trPLK/LAeuolTUW6T3s1vBE35iIpr/25bAsBxUJ6N1DM8b+C+Vb5lVDD3FJCWRecJYidghsccuesih8P8Pi73ggIpI3uKPsxv/LbpQ3qKIcBVGtXj+ibvNqh+H8rfg0qTlmXzmxTYqkld07plORFRz2GcLvKR0/yux8CKAqkl9nPl9+dqsa09kK87eB3v+gWM6IgBoHvsx4QRAOCWeTrOBwgc0RcQOCIBAkckQOCIBAgc4REgcxsPGMmgfDZ61EOPbTfFOburVgmwXlbAemt9NLUqSEHYyb/vwDar4Vq+qHS3RoHfxy4u4zI+hU/hh/h0LWZWO1fzX9mepeq+55v4LAhP4AkQPovNWnx5+4ph7cF+6JC7QgxraRgjQObZdSLapSEN6ZAqpwc34CENZpAzRPtjlOdrnR1UybBDoB1rLorhkHPsUNep8vgYOxa6Q8M8B5meAZO+fRyv8FKklmEw+UwVO7XoycYa+7k3B0z51BjrxXc1QDZKvENEh1YjTpMAxVgWn0Zh9uqzruGaONZ5gj5CCSX0ETrBGmRIIKJB6dPncicTQPWHmCuXMm9Iv6zjOgGgzaKoEyDTul2OyXIEOEOr+cEQYJhX4w4748dFAHJWgdu4cvx1Rcb1UDuKnDN/KuonSspjjUn9eh5rlx9SpWz3kOLgCWBPn8oZV7wGKn2cQwKdYwkAhQB8n7JOm7RZ+isZAuzkVcdP+XIxXA7RTMoTyOVTk1p/NeMpw8CQf5uI1vKD6DqjYVC6bLn0iU53IsBD+dmHyv9m7KL/GhLROUsPYK+/PhGdoTO0Smdok4iuZefV9wV8gBQ38fn8FknecR9OubSbuFvKpbBe7mOSrdE38U38cfn9+/g9TZYqM56AK/UxcazjS8qvl/EzIfWslszyrwD4EADwS2aDGcKKNs/KfMHFI9p5ws8MuT5f6Ca+bMzayrbwzybL7jHb+RMeB/BfAID/VGpX62APaUhD2qXZvAksWh+fxjfL1p/hrhG3n7f71Kp/s2w759jUd+gqUd4Odxh59vmQ5UbPnGhjtt/H6DHjv9x/NL8HGFKfNmmTNolos34JUK+xNvPP/lPAXSrmxnLVM3CksEPbtM1Op0IeO6MQRwESfpln12ohhrUOfGjEPFc7mt0DEA3Lw0IA31Y4LQLIR6q0+rtkes2z1uFTOlv+s57lkFIqbieTWtzP02eoJ9QSEZT7DF22lD8FZP/NbejqBDEpMhSlaum0MkZ3sIqH8BKAF/E/rHSEFdzM32aQ4n/xa9qbDVz3SIC+meUk5j23QCRA4AjPFxChIRIgcEQCBA6TAEPrfuEXcau8obwlbokaMU/QHhRuExHRbeYB5ou1h5AvTuVhLx5jPtQfz5TGfcYIdlF7eixwkVG4R0R71uR+6jkgA48Qx3/sKfTfm3puJkCA21T4nMw+4DWWAK8xCuWBoNowhNX8HEncy6tcIVxyor1yuGiPlfvlf46O6uszmoH1PsCGpgQAgV24WTd/vZ9Q19byBnSFGBHR07RET1s1+JVuQQmQXf8Lr7PeB+gFl6phm2zLwlTz7zKSQfnJXyZcxkFu+DQnAid/Ov/2tKBhT0hjgQkwIBOqAfwJwHfeuqZ7jEeuiGczvy8BUrL3MVSOsNf99RXsBOgT0R7t0R75+BXm5DArwPzelACuozBS3fyZ2W3mn4UeYIFvAqv2nyp+58oMX2cJ8HVGoasHsB1qD8THn/49gJuCc3hwRasX8ilW+hSj0FU5dqnU+nUDj1qH6PoUkIWZutHGT4A91sBqFTxfkz5vNeNASFCiR9ve43iPBSOAvzv4SQzx5/n3r+EN/Ou0xzCnhLbvAppRxPkAgSN6AwNHJEDgiAQIHJEAgSMSIHBEApgYgFpL5xAqAYjZNkEHYVyvhJgWbgjvNgeAAXZbS+cTxigd0a4wGqd6A0xJES+1ahjQbu4IGtCuoAGEfHmTLt/WNLVx1w4cg80Dj9hFDdi1zNXBV5/NhBIB1Hj1ah6UcQb5CntZg50Atvg+BJCksqOnLl2QIWFbIflpHS4CZCasfutSEErjuTTYCGCP7yZAUxPbpfwGDHN58DeBd3AB32hxPbmDC7iAbJ3cBWXMPFHOXhB3wi002OCKfzxYJG9AjeWLfA/gOgK8B1CdQYQ7eElsX5Szv/icL6hPLrbcZ/f57aRziegNNDHArmBiWTqHiAQIHHEkMHBEAgSOSIDAEQkQOCIBAodJAFJeLB4RACoCpPlWqWdx1rLXfjZ0dM0ijZhLFARIcVhuDvMIDlkjb+ACvoYXcejxQglzeGHbGIHcPmZ5hA15je0Q0V8RiOhFyvbFtY0ep+JewtWovOt3/1jl8bAchVGJ7hEI9CINCHSPbG+n3qFzlDllU6tSfqfapXw79dP5n7nT7WmSNlwv5CTKl8q/pdYOocCOkwCA8wDeBAC8BAB4Exs4X9vKdAObuIkreASXcIgruN6oq/mk0ukkqI9Afzz/S8Avvzqd/30S/ObyHwewkstXFmu8fpLIfAEpDnFfedHRPWxgRdsJt0CKQ9zBBezgClvJlO9UX9+t/re13/9h7JU7aXmEDXlXsEvVoukR8Zu4ZL7w7H0VtpfK2ObL6O8Wr883mrQ8Hpaj8AZm78O4jzfxLDbAv5Gjmg1wAWDcomrrX7A1tIuLyh28jmv5g+AbuBZfFh8K4nyAwBF9AYEjEiBwRAIEjkiAwFERwPU+gK7yJ3G9lF/Hk8cun3T5pi1vi1yn630AXeWubeYmLZ90+aYtb31kHxeJQ/U+gK5y10aTk5ZPunzTlnc4skvA5bJDSJQRvMvMNxWm/IU8boIXDPmzin4wZ5/l1FvkSYv4l9n4XPlc5Vfz3zz+20iUELb4klzNBW+VhsgGgqrRoKT2S5dzGSnkCYDnAbyunRmffp/4bv1qiKbxE/ALzKjBb1K01OV/AgD4a2v9FWc38Q7GskhNJYD+Lup6Blxy4AW8DuB5vCZWsK2C3PoTVpuvAdz6ZQJ0r5+kPN9O/jjeUcw/FgKc7K5CwYfK/+YgZ48gQ12O3kZDony2iU8ecV1usj8VZI/jnmb+sWDcl4ARgFtofwno3sXb81fX0K4Ll/T79SCuHsqW/uO4p5l/DD1AdhP4Kit7lfkmyZ8HcBM382+q/HUlFjFnX1ekLjlEOVi5nn+qnX1Vk7jkbeunKB+1lr+jmZ9PtSmCeAyb9mPopOWdxwEWfyBm2gNRk5Z3JgDoSbpeKr9OT9aCdpVfpFul/BYziDFp+aTLN215yyNOCAkc0RsYOCIBAkckQOCIBAgckQCBIxIgcKjOoLrTUcesyyNaQPcGLpffjtjQXeURM4f6JaCb6Y6cGrq13KSzhggNJgFcBjzCkShfxpHSD9ThMqA6JYoDtfT1R1hgEmAZEA24jGVRfoRlkSAEecJE7qGwIq47HjPql4DlFlr02LKGbu3XRaCIhtDfF6BJamFnXR7RAtEbGDjiQFDgiAQIHJEAgSMSIHBEAgSOSIDAMb8E6MUBoXFAJ0D3cTZCH4T+xPPdwz5WJ55KANAJsJr/TRuu1p2Z/2Da2VwE6ATYz/+mC1frjuYfI3x7AEKv9tcMzKokFpl57TQszB/vAcYCfUbQPhLss26WhPlrhi2vUIX5V0X5QbwHGBd0Akg9wGppmuKvWSe8VztTJ1FP0c9RTDd/vAiMAbPUA0TzTwG+PUB3uN/f0cz8PUu4iEbw7QGOA1Lvwpk/3gOMAfqEkB4O0JvJzpXyTt/8jOiIOCMocMyvLyBiLPh/gj9Qphd3t8gAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTMtMDItMDFUMDU6MzM6MTAtMDg6MDApYMCSAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDEzLTAyLTAxVDA1OjMzOjEwLTA4OjAwWD14LgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAAASUVORK5CYII=);
1910
+ background-position: -32px 0;
1911
+ margin-top: 0;
1912
+ top: 0;
1913
+ font-weight: 400;
1914
+ }
1915
+ .ui-icon {
1916
+ width: 16px;
1917
+ height: 16px;
1918
+ text-indent: -99999px;
1919
+ overflow: hidden;
1920
+ background-repeat: no-repeat;
1921
+ }
1922
+ .ui-datepicker * {
1923
+ padding: 0;
1924
+ -webkit-border-radius: 0;
1925
+ -moz-border-radius: 0;
1926
+ border-radius: 0;
1927
+ font-family: "Open Sans",sans-serif;
1928
+ border-radius: 0;
1929
+ }
1930
+ .ui-datepicker {
1931
+ background: #f1f1f1;
1932
+ padding: 0;
1933
+ border: 1px solid #e5e5e5;
1934
+ -webkit-border-radius: 0;
1935
+ -moz-border-radius: 0;
1936
+ border-radius: 0;
1937
+ width: 17em;
1938
+ display: none;
1939
+ font-family: "Open Sans",sans-serif;
1940
+ -webkit-box-shadow: 2px 2px 6px 0px rgba(0,0,0,0.2);
1941
+ -moz-box-shadow: 2px 2px 6px 0px rgba(0,0,0,0.2);
1942
+ box-shadow: 2px 2px 6px 0px rgba(0,0,0,0.2);
1943
+ }
1944
+ .ui-datepicker
1945
+ .ui-datepicker-header {
1946
+ border: none;
1947
+ background: #23282d;
1948
+ color: #fff;
1949
+ font-weight: 400;
1950
+ position: relative;
1951
+ padding: .2em 0;
1952
+ text-align: center;
1953
+ }
1954
+ .ui-datepicker .ui-datepicker-title {
1955
+ margin-top: .4em;
1956
+ margin-bottom: .3em;
1957
+ color: #fff;
1958
+ font-size: 14px;
1959
+ }
1960
+ .ui-datepicker .ui-datepicker-next,
1961
+ .ui-datepicker .ui-datepicker-next-hover,
1962
+ .ui-datepicker .ui-datepicker-prev,
1963
+ .ui-datepicker .ui-datepicker-prev-hover {
1964
+ height: 1em;
1965
+ top: .9em;
1966
+ border: none;
1967
+ }
1968
+ .ui-datepicker .ui-datepicker-prev {
1969
+ left: 2px;
1970
+ }
1971
+ .ui-datepicker .ui-datepicker-next {
1972
+ right: 2px;
1973
+ }
1974
+ .ui-datepicker .ui-datepicker-next,
1975
+ .ui-datepicker .ui-datepicker-prev {
1976
+ position: absolute;
1977
+ width: 1.8em;
1978
+ }
1979
+ .ui-datepicker .ui-datepicker-next span,
1980
+ .ui-datepicker .ui-datepicker-prev span {
1981
+ display: block;
1982
+ position: absolute;
1983
+ left: 50%;
1984
+ margin-left: -8px;
1985
+ }
1986
+ .ui-datepicker .ui-datepicker-prev span {
1987
+ background-position: -96px 0;
1988
+ }
1989
+ .ui-datepicker table {
1990
+ font-size: 13px;
1991
+ margin: 0;
1992
+ width: 100%;
1993
+ border-collapse: collapse;
1994
+ }
1995
+ .ui-datepicker thead {
1996
+ background: #23282d;
1997
+ color: #fff;
1998
+ }
1999
+ .ui-datepicker th {
2000
+ padding: .3em 0;
2001
+ color: #fff;
2002
+ font-weight: 400;
2003
+ border: none;
2004
+ text-align: center;
2005
+ border-top: 1px solid #32373c;
2006
+ font-size: 11px;
2007
+ }
2008
+ .ui-state-default,
2009
+ .ui-widget-header .ui-state-default {
2010
+ border: 1px solid #d3d3d3;
2011
+ font-weight: 400;
2012
+ color: #555;
2013
+ }
2014
+ .ui-datepicker td {
2015
+ padding: 0;
2016
+ }
2017
+ .ui-datepicker td a,
2018
+ .ui-datepicker td span {
2019
+ display: block;
2020
+ padding: .2em;
2021
+ text-align: right;
2022
+ text-decoration: none;
2023
+ }
2024
+ .ui-widget-content a {
2025
+ color: #23282d;
2026
+ }
2027
+ .ui-datepicker td .ui-state-default {
2028
+ background: 0 0;
2029
+ border: none;
2030
+ text-align: center;
2031
+ padding: .5em;
2032
+ margin: 0;
2033
+ font-weight: 400;
2034
+ color: #23282d;
2035
+ }
2036
+ .ui-datepicker td .ui-state-default.ui-state-highlight {
2037
+ background: #65badd;
2038
+ color: #fff;
2039
+ }
2040
+ .ui-datepicker td .ui-state-active,
2041
+ .ui-datepicker td .ui-state-default.ui-state-highlight.ui-state-hover,
2042
+ .ui-datepicker td .ui-state-hover {
2043
+ background: #0073aa;
2044
+ color: #fff;
2045
+ }
2046
+ .exopite-sof-accordion__title {
2047
+ min-height: 19px;
2048
+ }
2049
+ /* Admin sidebar in posts */
2050
+ #side-sortables .exopite-sof-field .exopite-sof-title {
2051
+ position: relative;
2052
+ width: 100%;
2053
+ float: none;
2054
+ }
2055
+ #side-sortables .exopite-sof-field .exopite-sof-fieldset {
2056
+ margin-left: 0;
2057
+ padding-top: 5px;
2058
+ }
2059
+ #side-sortables .exopite-sof-content-nav {
2060
+ background-color: #fff;
2061
+ }
2062
+ #side-sortables .exopite-sof-nav {
2063
+ display: none;
2064
+ }
2065
+ #side-sortables .exopite-sof-content-nav .exopite-sof-sections {
2066
+ width: 100%;
2067
+ }
2068
+ #side-sortables .exopite-sof-content-nav .exopite-sof-section-header,
2069
+ #side-sortables .exopite-sof-content-nav .hide {
2070
+ display: block;
2071
+ }
2072
+ #side-sortables .exopite-sof-field {
2073
+ padding: 7px 7px;
2074
+ border-bottom: none;
2075
+ }
2076
+ #side-sortables .exopite-sof-sections h4 {
2077
+ font-size: 1.3em;
2078
+ padding: 6px 0;
2079
+ }
2080
+ #side-sortables .exopite-sof-sections .exopite-sof-cloneable__title {
2081
+ border-bottom: none;
2082
+ padding: 7px 10px;
2083
+ cursor: pointer;
2084
+ font-size: 0.8rem;
2085
+ font-weight: 400;
2086
+ }
2087
+ #side-sortables .exopite-sof-sections .exopite-sof-field .exopite-sof-title {
2088
+ font-size: 13px;
2089
+ }
2090
+ #poststuff .exopite-sof-sections h2 {
2091
+ font-size: 18px;
2092
+ padding: 8px 6px;
2093
+ }
2094
+ #side-sortables .exopite-sof-section-header .dashicons-before {
2095
+ padding-right: 14px;
2096
+ }
2097
+ /* Loading */
2098
+ /* https://austin.passy.co/2014/native-wordpress-loading-gifs/ */
2099
+ .exopite-sof-field .loading {
2100
+ z-index: 0;
2101
+ }
2102
+ .exopite-sof-field .loading::before {
2103
+ position: absolute;
2104
+ content: '';
2105
+ top: 0;
2106
+ left: 0;
2107
+ right: 0;
2108
+ bottom: 0;
2109
+ background: rgba(255,255,255, 0.7);
2110
+ z-index: 1;
2111
+ }
2112
+ .exopite-sof-field .loading::after {
2113
+ content: url('/wp-includes/images/spinner-2x.gif');
2114
+ position: absolute;
2115
+ top: calc(50% - 20px);
2116
+ left: calc(50% - 20px);
2117
+ z-index: 2;
2118
+ }
2119
+ /**
2120
+ * TO SORT
2121
+ */
2122
+ .exopite-sof-field.no-padding-top {
2123
+ padding-top: 0;
2124
+ }
2125
+ .exopite-sof-field.no-padding-bottom {
2126
+ padding-bottom: 0;
2127
+ }
2128
+ .exopite-sof-section > .exopite-sof-field.no-border-bottom {
2129
+ border-bottom: none;
2130
+ }
2131
+ .exopite-sof-group .exopite-sof-tinymce-editor .exopite-sof-fieldset {
2132
+ border: 1px solid #e5e5e5;
2133
+ }
2134
+ /* .wp-picker-input-wrap input[type="text"] {
2135
+ visibility: hidden;
2136
+ width: 0 !important;
2137
+ padding: 0;
2138
+ } */
2139
+ .exopite-sof-fieldset .wp-picker-container .hidden {
2140
+ /* display: inline-block; */
2141
+ }
2142
+ .exopite-sof-header .exopite-sof-search {
2143
+ float: none;
2144
+ margin-left: 10px;
2145
+ vertical-align: bottom;
2146
+ padding-right: 20px;
2147
+ border: none;
2148
+ text-align: left;
2149
+ color: #fff;
2150
+ background: rgba(255, 255, 255, .2);
2151
+ }
2152
+ .exopite-sof-search-wrapper {
2153
+ display: inline-block;
2154
+ position: relative;
2155
+ }
2156
+ .exopite-sof-search-wrapper::after {
2157
+ content: '\f002';
2158
+ position: absolute;
2159
+ right: 6px;
2160
+ top: 4px;
2161
+ font-family: FontAwesome;
2162
+ }
2163
+ .exopite-sof-header {
2164
+ padding: 15px 10px;
2165
+ background-image: url('images/exopite-sof-title-bg.jpg');
2166
+ background-size: cover;
2167
+ box-shadow: inset 0 0 0 1000px rgba(48, 64, 75, 0.83);
2168
+ }
2169
+ .exopite-sof-font-preview {
2170
+ border: 1px solid #e5e5e5;
2171
+ padding: 6px 10px;
2172
+ background: #fbfbfb;
2173
+ }
2174
+ .exopite-sof-typography-family .chosen-container {
2175
+ width: 280px !important;
2176
+ }
2177
+ .exopite-sof-typography-variant .chosen-container {
2178
+ width: 100px !important;
2179
+ }
2180
+ .exopite-sof-font-field input,
2181
+ .exopite-sof-font-field label {
2182
+ vertical-align: bottom;
2183
+ }
2184
+ .exopite-sof-font-field span {
2185
+ /* line-height: 32px; */
2186
+ }
2187
+ .exopite-sof-font-field .wp-picker-container {
2188
+ display: inline-block;
2189
+ }
2190
+ .exopite-sof-wrapper .dashicons,
2191
+ .exopite-sof-wrapper .dashicons-before::before {
2192
+ width: 16px;
2193
+ height: 16px;
2194
+ font-size: 16px;
2195
+ line-height: 18px;
2196
+ }
2197
+ .exopite-sof-wrapper .exopite-sof-section-header span::before {
2198
+ line-height: 27px;
2199
+ height: 24px;
2200
+ }
2201
+ .exopite-sof-wrapper .exopite-sof-section-header .fa-before::before {
2202
+ padding-right: 20px;
2203
+ vertical-align: bottom;
2204
+ }
2205
+ .exopite-sof-wrapper .exopite-sof-section-header .dashicons-before::before {
2206
+ font-size: 18px;
2207
+ line-height: 27px;
2208
+ height: 24px;
2209
+ }
2210
+ .exopite-sof-wrapper .fa-before::before {
2211
+ width: 16px;
2212
+ height: 16px;
2213
+ display: inline-block;
2214
+ text-align: center;
2215
+ font-size: 15px;
2216
+ }
2217
+ .exopite-sof-cloneable--clone {
2218
+ margin-right: 5px;
2219
+ }
2220
+ .exopite-sof-nav.search .exopite-sof-nav-list-parent-item > span,
2221
+ .exopite-sof-nav.search .exopite-sof-nav-list-item,
2222
+ .exopite-sof-nav.search li {
2223
+ color: #555;
2224
+ }
2225
+ /* Color */
2226
+ .exopite-sof-font-field .wp-color-result-text {
2227
+ line-height: 22px;
2228
+ }
2229
+ /* .exopite-sof-font-field .wp-color-result-text {
2230
+ line-height: 22px;
2231
+ border-radius: 0;
2232
+ border-left: none;
2233
+ color: #555;
2234
+ }
2235
+ .exopite-sof-font-field .wp-core-ui .button {
2236
+ box-shadow: none !important;
2237
+ border-radius: 0 !important;
2238
+ -webkit-border-radius: 0 !important;
2239
+ -moz-border-radius: 0 !important;
2240
+ -ms-border-radius: 0 !important;
2241
+ -o-border-radius: 0 !important;
2242
+ }
2243
+ .exopite-sof-font-field .color-alpha {
2244
+ border-top-left-radius: 0 !important;
2245
+ border-bottom-left-radius: 0 !important;
2246
+ } */
2247
+
2248
+ /* Tabs */
2249
+ .exopite-sof-tabs {
2250
+ width: 100%;
2251
+ margin: 0;
2252
+ max-width: 100%;
2253
+ }
2254
+ .exopite-sof-tab-header {
2255
+ margin: 0px;
2256
+ padding: 0px;
2257
+ list-style: none;
2258
+ display: flex;
2259
+ }
2260
+ .exopite-sof-tab-header > li{
2261
+ background: none;
2262
+ padding: 10px 15px;
2263
+ cursor: pointer;
2264
+ }
2265
+
2266
+ .exopite-sof-tab-mobile-header,
2267
+ .exopite-sof-tab-header > li {
2268
+ background: #ededed;
2269
+ margin-bottom: -1px;
2270
+ border: 1px solid #e5e5e5;
2271
+ }
2272
+ .exopite-sof-tab-header > li {
2273
+ margin-left: 1px;
2274
+ margin-right: 1px;
2275
+ }
2276
+ .exopite-sof-tab-header.equal-width > li {
2277
+ flex-grow: 1;
2278
+ flex-basis: 0;
2279
+ }
2280
+ .exopite-sof-tab-header > li:first-of-type {
2281
+ margin-left: 0;
2282
+ }
2283
+ .exopite-sof-tab-header > li:last-of-type {
2284
+ margin-right: 0;
2285
+ }
2286
+ .active > .exopite-sof-tab-mobile-header,
2287
+ .exopite-sof-tab-header li.active {
2288
+ border: 1px solid #e5e5e5;
2289
+ border-bottom-color: #fff;
2290
+ background: #fff;
2291
+
2292
+ }
2293
+ .exopite-sof-tab-content {
2294
+ display: none;
2295
+ }
2296
+ .exopite-sof-tab-content-body-inner {
2297
+ border: 1px solid #e5e5e5;
2298
+ padding: 15px;
2299
+ }
2300
+ .exopite-sof-tab-mobile-header {
2301
+ padding: 15px;
2302
+ display: none;
2303
+ }
2304
+ .exopite-sof-tab-content.active{
2305
+ display: inherit;
2306
+ }
2307
+
2308
+ @media only screen and (max-width: 500px) {
2309
+ .exopite-sof-tab-mobile-header {
2310
+ display: block;
2311
+ cursor: pointer;
2312
+ }
2313
+ .exopite-sof-tab-header {
2314
+ display: none;
2315
+ }
2316
+ .exopite-sof-tab-content {
2317
+ display: block;
2318
+ }
2319
+ .exopite-sof-tab-content-body {
2320
+ max-height: 0;
2321
+ overflow: hidden;
2322
+ transition-property: all;
2323
+ transition-duration: .3s;
2324
+ transition-timing-function: cubic-bezier(0.5, 1, 0.1, 1);
2325
+ }
2326
+ .active > .exopite-sof-tab-content-body {
2327
+ max-height: 1000px;
2328
+ overflow-y: auto;
2329
+ }
2330
+ }
2331
+ /* .exopite-sof-tabs {
2332
+ display: flex;
2333
+ flex-wrap: wrap;
2334
+ }
2335
+ .exopite-sof-tabs .tab {
2336
+ border: 1px solid #e5e5e5;
2337
+ }
2338
+ .exopite-sof-tabs label {
2339
+ order: 1;
2340
+ display: block;
2341
+ padding: 10px 32px;
2342
+ margin-left: 1px;
2343
+ margin-right: 1px;
2344
+ cursor: pointer;
2345
+ font-weight: bold;
2346
+ transition: background ease 0.2s;
2347
+ border: 1px solid #e5e5e5;
2348
+ border-top-width: 4px;
2349
+ margin-bottom: -1px;
2350
+ background: #fff;
2351
+ z-index: 1;
2352
+ }
2353
+ .exopite-sof-tabs .tab {
2354
+ order: 99;
2355
+ flex-grow: 1;
2356
+ width: 100%;
2357
+ display: none;
2358
+
2359
+ background: #fff;
2360
+ }
2361
+ .exopite-sof-tabs input[type="radio"] {
2362
+ display: none;
2363
+ }
2364
+ .exopite-sof-tabs input[type="radio"]:checked + label {
2365
+ border-top-color: #80a9d4;
2366
+ border-bottom-color: #fff;
2367
+ }
2368
+ .exopite-sof-tabs input[type="radio"]:checked + label + .tab {
2369
+ display: block;
2370
+ }
2371
+ @media (min-width: 46em) {
2372
+ .exopite-sof-tabs label:first-of-type {
2373
+ margin-left: 0;
2374
+ }
2375
+ .exopite-sof-tabs label:last-of-type {
2376
+ margin-right: 0;
2377
+ }
2378
+ .exopite-sof-tabs label.equal-width {
2379
+ flex: 1;
2380
+ }
2381
+ }
2382
+ @media (max-width: 45em) {
2383
+ .exopite-sof-tabs .tab,
2384
+ .exopite-sof-tabs label {
2385
+ order: initial;
2386
+ }
2387
+ .exopite-sof-tabs label {
2388
+ width: 100%;
2389
+ margin-right: 0;
2390
+ margin-top: 0.2rem;
2391
+ }
2392
+ } */
2393
+
2394
+ /* STYLE 2 */
2395
+ /* Color Picker */
2396
+ /* .exopite-sof-wrapper .exopite-sof-sections .exopite-sof-section .exopite-sof-field .exopite-sof-fieldset */
2397
+ .exopite-sof-wrapper .exopite-sof-field .wp-color-result {
2398
+ /* .fusionredux-container #fusionredux-form-wrapper .fusionredux-main .wp-color-result { */
2399
+ border-radius: 0 !important;
2400
+ -moz-border-radius: 0 !important;
2401
+ -webkit-border-radius: 0 !important;
2402
+ border-bottom-left-radius: 0 !important;
2403
+ border-bottom-right-radius: 0 !important;
2404
+ border-top-left-radius: 0 !important;
2405
+ border-top-right-radius: 0 !important;
2406
+ box-shadow: none !important;
2407
+ -webkit-box-shadow: none !important;
2408
+ }
2409
+ .exopite-sof-wrapper .exopite-sof-field .button.wp-color-result {
2410
+ border-color: #e5e5e5 !important;
2411
+ }
2412
+ .exopite-sof-wrapper .exopite-sof-field .wp-picker-container .wp-color-result.button {
2413
+ height: 31px;
2414
+ }
2415
+ .exopite-sof-wrapper .exopite-sof-field .button .wp-color-result-text {
2416
+ height: 100%;
2417
+ line-height: 30px;
2418
+ border-radius: 0;
2419
+ }
2420
+ .exopite-sof-fieldset .color-alpha {
2421
+ border-radius: 0 !important;
2422
+ height: 29px !important;
2423
+ }
2424
+ .exopite-sof-fieldset .wp-color-result-text {
2425
+ border-left: 1px solid #ddd;
2426
+ }
2427
+ .iris-picker .iris-square,
2428
+ .iris-picker .iris-slider,
2429
+ .iris-picker .iris-square-inner,
2430
+ .iris-picker .iris-palette {
2431
+ border-radius: 0;
2432
+ }
2433
+ /* FORMS */
2434
+ .exopite-sof-fieldset .button.button-small.wp-picker-clear,
2435
+ .exopite-sof-fieldset input[type="text"].colorpicker,
2436
+ .exopite-sof-fieldset textarea,
2437
+ .exopite-sof-fieldset select,
2438
+ .exopite-sof-fieldset input[type="number"],
2439
+ .exopite-sof-fieldset input[type="date"],
2440
+ .exopite-sof-fieldset input[type="email"],
2441
+ .exopite-sof-fieldset input[type="password"],
2442
+ .exopite-sof-fieldset input[type="text"] {
2443
+ padding: 5px 12px;
2444
+ border-radius: 0;
2445
+ line-height: 18px;
2446
+ box-shadow: none;
2447
+ background: #f4f4f4;
2448
+ }
2449
+ .exopite-sof-fieldset select {
2450
+ padding: 4px 12px 5px 12px;
2451
+ }
2452
+ .exopite-sof-fieldset .chosen-container-multi .chosen-choices li.search-choice ,
2453
+ .exopite-sof-fieldset .chosen-container-active .chosen-single,
2454
+ .exopite-sof-fieldset .chosen-container-single .chosen-single,
2455
+ .exopite-sof-fieldset .chosen-container-multi .chosen-choices,
2456
+ .exopite-sof-fieldset .button.button-small.wp-picker-clear,
2457
+ .exopite-sof-fieldset input[type="text"].colorpicker,
2458
+ .exopite-sof-fieldset textarea,
2459
+ .exopite-sof-fieldset select,
2460
+ .exopite-sof-fieldset input[type="number"],
2461
+ .exopite-sof-fieldset input[type="date"],
2462
+ .exopite-sof-fieldset input[type="email"],
2463
+ .exopite-sof-fieldset input[type="password"],
2464
+ .exopite-sof-fieldset input[type="text"] {
2465
+ border: 1px solid #e5e5e5;
2466
+ }
2467
+ .exopite-sof-fieldset .button.button-small.wp-picker-clear,
2468
+ .exopite-sof-fieldset input[type="text"].colorpicker,
2469
+ .exopite-sof-fieldset select,
2470
+ .exopite-sof-wrapper .exopite-sof-fieldset select,
2471
+ .exopite-sof-fieldset input[type="number"],
2472
+ .exopite-sof-fieldset input[type="email"],
2473
+ .exopite-sof-fieldset input[type="password"],
2474
+ .exopite-sof-fieldset input[type="text"] {
2475
+ height: 31px;
2476
+ }
2477
+ .exopite-sof-fieldset select,
2478
+ .exopite-sof-fieldset input[type="email"],
2479
+ .exopite-sof-fieldset input[type="password"],
2480
+ .exopite-sof-fieldset input[type="text"] {
2481
+ max-width: 375px;
2482
+ width: 100%;
2483
+ }
2484
+ .exopite-sof-field-date .exopite-sof-fieldset .datepicker,
2485
+ .exopite-sof-fieldset input[type="text"].chosen-search-input {
2486
+ min-width: initial;
2487
+ }
2488
+ .exopite-sof-fieldset input[type="date"],
2489
+ .exopite-sof-field-date input[type="text"] {
2490
+ width: 160px;
2491
+ line-height: 1em;
2492
+ padding-top: 9px;
2493
+ padding-bottom: 9px;
2494
+ }
2495
+ .exopite-sof-fieldset input[type="number"] {
2496
+ padding: 5px 5px 5px 12px;
2497
+ }
2498
+ .exopite-sof-fieldset textarea {
2499
+ width: 100%;
2500
+ height: 150px;
2501
+ }
2502
+ .wp-editor-container textarea.wp-editor-area {
2503
+ border: 0;
2504
+ background: #fff;
2505
+ }
2506
+ .exopite-sof-field-number .text-muted,
2507
+ .exopite-sof-field-range .text-muted {
2508
+ padding-top: 0;
2509
+ margin-top: 5px;
2510
+ display: inline-block;
2511
+ margin-left: 10px;
2512
+ }
2513
+ .checkbox__checkmark::before {
2514
+ border-radius: 0;
2515
+ }
2516
+ /* Chosen */
2517
+ /* .exopite-sof-fieldset .chosen-container-multi .chosen-choices, */
2518
+ .exopite-sof-fieldset .chosen-container-single .chosen-single {
2519
+ height: 31px;
2520
+ }
2521
+ .exopite-sof-fieldset .chosen-container-multi .chosen-choices {
2522
+ padding: 0px 3px;
2523
+ border-radius: 0;
2524
+ }
2525
+ .exopite-sof-fieldset .chosen-container-multi .chosen-choices {
2526
+ background-image: none;
2527
+ }
2528
+ .exopite-sof-fieldset .chosen-container-multi .chosen-choices li.search-choice {
2529
+ background-image: none;
2530
+ border-radius: 0;
2531
+ background-color: #f5f5f5;
2532
+ margin: 3px 3px 3px 0;
2533
+ padding: 4px 20px 4px 5px;
2534
+ }
2535
+ .exopite-sof-fieldset .chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
2536
+ top: 6px;
2537
+ }
2538
+ .exopite-sof-fieldset .chosen-container-single .chosen-single {
2539
+ position: relative;
2540
+ display: block;
2541
+ overflow: hidden;
2542
+ padding: 0 0 0 8px;
2543
+ border-radius: 0;
2544
+ background: #f5f5f5;
2545
+ box-shadow: none;
2546
+ color: #444;
2547
+ text-decoration: none;
2548
+ white-space: nowrap;
2549
+ line-height: 28px;
2550
+ }
2551
+ .exopite-sof-fieldset .chosen-container-single .chosen-single div {
2552
+ position: absolute;
2553
+ top: 3px;
2554
+ }
2555
+ .exopite-sof-fieldset .chosen-container-active .chosen-single {
2556
+ box-shadow: none;
2557
+ }
2558
+ .exopite-sof-field-typography .exopite-sof-btn,
2559
+ .exopite-sof-field-typography .exopite-sof-fieldset .chosen-container,
2560
+ .exopite-sof-field-typography .exopite-sof-form-field {
2561
+ margin-bottom: 8px;
2562
+ margin-right: 8px;
2563
+ }
2564
+
2565
+ .exopite-sof-fieldset .chosen-container-active.chosen-with-drop .chosen-single {
2566
+ border: 1px solid #ddd;
2567
+ background-image: none;
2568
+ box-shadow: none;
2569
+ }
2570
+ .exopite-sof-fieldset .exopite-sof-fieldset .chosen-container-single .chosen-single {
2571
+ background: #fff;
2572
+ }
2573
+ .exopite-sof-fieldset .chosen-container-single .chosen-search input[type="text"] {
2574
+ border: 1px solid #ddd;
2575
+ min-width: 100%;
2576
+ }
2577
+ .exopite-sof-fieldset .chosen-container-single .chosen-drop {
2578
+ border-radius: 0;
2579
+ }
2580
+ .exopite-sof-fieldset .chosen-container .chosen-drop {
2581
+ border: 1px solid #ddd;
2582
+ box-shadow: none;
2583
+ }
2584
+ .exopite-sof-fieldset .chosen-container-single .chosen-single abbr {
2585
+ top: 9px;
2586
+ }
2587
+ .exopite-sof-help {
2588
+ cursor: help;
2589
+ border: 1px solid #ddd;
2590
+ height: 29px;
2591
+ display: inline-block;
2592
+ vertical-align: top;
2593
+ /* margin-top: 1px; */
2594
+ line-height: 27px;
2595
+ width: 29px;
2596
+ background: #fff;
2597
+ text-align: center;
2598
+ display: inline-flex;
2599
+ align-items: center;
2600
+ justify-content: center;
2601
+ }
2602
+ input[type="color"] {
2603
+ height: 31px;
2604
+ border-color: #ddd;
2605
+ padding: 0;
2606
+ }
2607
+ /* BUTTONS */
2608
+ /* .exopite-sof-btn {
2609
+ padding: 6px 20px;
2610
+ border-radius: 0;
2611
+ }
2612
+ .exopite-sof-btn,
2613
+ .exopite-sof-btn:hover {
2614
+ background-color: #80a9d4;
2615
+ }
2616
+ .exopite-sof-btn:focus,
2617
+ .exopite-sof-btn:hover {
2618
+ color: #fff;
2619
+ box-shadow: none;
2620
+ }
2621
+ .exopite-sof-btn {
2622
+ position: relative;
2623
+
2624
+ display: inline-block;
2625
+ padding: 6px 20px 7px 20px;
2626
+ color: #fff;
2627
+ cursor: pointer;
2628
+ text-decoration: none;
2629
+
2630
+ }
2631
+ */
2632
+ .exopite-sof-field .exopite-sof-btn,
2633
+ .exopite-sof-field .button.button-primary {
2634
+ margin: 0;
2635
+ background: #80a9d4;
2636
+ border: 1px solid #80a9d4;
2637
+ border-radius: 0;
2638
+ height: 31px;
2639
+ line-height: 29px;
2640
+ box-shadow: none;
2641
+ text-shadow: none;
2642
+ vertical-align: baseline;
2643
+ padding: 0 10px;
2644
+ color: #fff;
2645
+ text-decoration: none;
2646
+ display: inline-block;
2647
+ white-space: nowrap;
2648
+ box-sizing: border-box;
2649
+ }
2650
+ .exopite-sof-field button.insert-media {
2651
+ box-shadow: none;
2652
+ border-radius: 0;
2653
+ border-color: #ddd;
2654
+ }
2655
+ /* List */
2656
+ .exopite-sof-content .list {
2657
+ border: 1px solid #ddd;
2658
+ border-radius: 0;
2659
+ }
2660
+ .exopite-sof-content .list__item__center {
2661
+ background-image: -webkit-linear-gradient(90deg, #ddd, #ddd 100%);
2662
+ background-image: -moz-linear-gradient(90deg, #ddd, #ddd 100%);
2663
+ background-image: -o-linear-gradient(90deg, #ddd, #ddd 100%);
2664
+ background-image: linear-gradient(0deg, #ddd, #ddd 100%);
2665
+ }
2666
+ .exopite-sof-content .trumbowyg-button-pane {
2667
+ background: #f4f4f4;
2668
+ }
2669
+ .exopite-sof-fieldset input[type="date"],
2670
+ .exopite-sof-field-date input[type="text"] {
2671
+ width: 160px;
2672
+ line-height: 1em;
2673
+ padding-top: 7px;
2674
+ padding-bottom: 6px;
2675
+ }
2676
+
2677
+ /* Form Field Group */
2678
+ .exopite-sof-fieldset input[type="text"].colorpicker {
2679
+ min-width: initial;
2680
+ }
2681
+ .exopite-sof-form-field {
2682
+ display: inline-flex;
2683
+ height: 31px;
2684
+ white-space: nowrap;
2685
+ }
2686
+ .exopite-sof-form-field input {
2687
+ margin: 0;
2688
+ }
2689
+ .exopite-sof-form-field .input-append,
2690
+ .exopite-sof-form-field .input-prepend {
2691
+ height: 29px;
2692
+ min-width: 20px;
2693
+ border: 1px solid #e5e5e5;
2694
+ text-align: center;
2695
+ /* line-height: 29px; */
2696
+ color: #888;
2697
+ padding: 0 5px;
2698
+ display: flex;
2699
+ align-items: center;
2700
+ justify-content: center;
2701
+ }
2702
+ .exopite-sof-form-field .input-prepend {
2703
+ border-right: none;
2704
+ }
2705
+ .exopite-sof-form-field .input-append {
2706
+ border-left: none;
2707
+ }
2708
+ .exopite-sof-wrapper .exopite-sof-fieldset .dashicons {
2709
+ /* line-height: 29px; */
2710
+ }
2711
+ .exopite-sof-fieldset input.disabled,
2712
+ .exopite-sof-fieldset input:disabled,
2713
+ .exopite-sof-fieldset select.disabled,
2714
+ .exopite-sof-fieldset select:disabled,
2715
+ .exopite-sof-fieldset textarea.disabled,
2716
+ .exopite-sof-fieldset textarea:disabled {
2717
+ background: #ddd;
2718
+ }
2719
+ .exopite-sof-wrapper input, .exopite-sof-wrapper select {
2720
+ margin: 0;
2721
+ }
2722
+ .exopite-sof-media input {
2723
+ margin-right: 1px;
2724
+ }
2725
+ .search + .exopite-sof-sections h2 {
2726
+ cursor: pointer;
2727
+ }
2728
+ .sortable-placeholder {
2729
+ background: rgb(255, 252, 244);
2730
+ height: 42px;
2731
+ margin-bottom: 5px;
2732
+ border: 1px dashed #e1e5e9;
2733
+ }
2734
+ .exopite-sof-cloneable--helper .fa-arrows-v {
2735
+ padding: 0 6px;
2736
+ cursor: move;
2737
+ }
2738
+ .exopite-sof-form-field-input input[type="text"] {
2739
+ flex: 1 1 auto;
2740
+ width: 1%;
2741
+ }
2742
+ .width-150 + .chosen-container {
2743
+ max-width: 150px !important;
2744
+ }
2745
+ .width-150 + .chosen-container {
2746
+ max-width: 200px !important;
2747
+ }
2748
+ /* Fieldset */
2749
+ .container {
2750
+ width: 100%;
2751
+ padding-right: 15px;
2752
+ padding-left: 15px;
2753
+ margin-right: auto;
2754
+ margin-left: auto;
2755
+ box-sizing: border-box;
2756
+ }
2757
+ .row {
2758
+ display: -webkit-box;
2759
+ display: -ms-flexbox;
2760
+ display: flex;
2761
+ -ms-flex-wrap: wrap;
2762
+ flex-wrap: wrap;
2763
+ margin-right: -15px;
2764
+ margin-left: -15px;
2765
+ box-sizing: border-box;
2766
+ }
2767
+ .col, .col-xl-12, .col-xl-1, .col-xl-10, .col-xl-11, .col-xl-12, .col-xl-2, .col-xl-3, .col-xl-4, .col-xl-5, .col-xl-6, .col-xl-7, .col-xl-8, .col-xl-9 {
2768
+ position: relative;
2769
+ width: 100%;
2770
+ min-height: 1px;
2771
+ padding-right: 15px;
2772
+ padding-left: 15px;
2773
+ box-sizing: border-box;
2774
+
2775
+ }
2776
+ .col {
2777
+ -ms-flex-preferred-size: 0;
2778
+ flex-basis: 0;
2779
+ -ms-flex-positive: 1;
2780
+ flex-grow: 1;
2781
+ max-width: 100%;
2782
+ }
2783
+ .col-xs-12 {
2784
+ -ms-flex: 0 0 100%;
2785
+ flex: 0 0 100%;
2786
+ max-width: 100%;
2787
+ }
2788
+ @media (min-width: 992px) {
2789
+ .col-lg {
2790
+ -ms-flex-preferred-size: 0;
2791
+ flex-basis: 0;
2792
+ -ms-flex-positive: 1;
2793
+ flex-grow: 1;
2794
+ max-width: 100%;
2795
+ }
2796
+ .col-lg-auto {
2797
+ -ms-flex: 0 0 auto;
2798
+ flex: 0 0 auto;
2799
+ width: auto;
2800
+ max-width: 100%;
2801
+ }
2802
+ .col-lg-1 {
2803
+ -ms-flex: 0 0 8.333333%;
2804
+ flex: 0 0 8.333333%;
2805
+ max-width: 8.333333%;
2806
+ }
2807
+ .col-lg-2 {
2808
+ -ms-flex: 0 0 16.666667%;
2809
+ flex: 0 0 16.666667%;
2810
+ max-width: 16.666667%;
2811
+ }
2812
+ .col-lg-3 {
2813
+ -ms-flex: 0 0 25%;
2814
+ flex: 0 0 25%;
2815
+ max-width: 25%;
2816
+ }
2817
+ .col-lg-4 {
2818
+ -ms-flex: 0 0 33.333333%;
2819
+ flex: 0 0 33.333333%;
2820
+ max-width: 33.333333%;
2821
+ }
2822
+ .col-lg-5 {
2823
+ -ms-flex: 0 0 41.666667%;
2824
+ flex: 0 0 41.666667%;
2825
+ max-width: 41.666667%;
2826
+ }
2827
+ .col-lg-6 {
2828
+ -ms-flex: 0 0 50%;
2829
+ flex: 0 0 50%;
2830
+ max-width: 50%;
2831
+ }
2832
+ }
2833
+ .col-xs-12 .exopite-sof-field {
2834
+ padding-left: 0;
2835
+ padding-right: 0;
2836
+ padding-top: 0;
2837
+ }
2838
+ .col-xs-12.exopite-sof-col-lg .exopite-sof-field .exopite-sof-fieldset {
2839
+ margin-left: 0;
2840
+ }
2841
+ .col-xs-12.exopite-sof-col-lg .exopite-sof-field .exopite-sof-title {
2842
+ position: relative;
2843
+ width: 100%;
2844
+ float: none;
2845
+ }
2846
+ .exopite-sof-group .exopite-sof-field:not(:last-child) {
2847
+ padding-bottom: 0;
2848
+ }
2849
+ /* Group compact */
2850
+ .exopite-sof-group-compact .exopite-sof-cloneable__content > .exopite-sof-field,
2851
+ .exopite-sof-group-compact .exopite-sof-cloneable__content,
2852
+ .exopite-sof-group-compact .exopite-sof-cloneable--helper,
2853
+ .exopite-sof-group-compact .exopite-sof-cloneable__item,
2854
+ .exopite-sof-group-compact .exopite-sof-cloneable__title {
2855
+ display: flex;
2856
+ }
2857
+ .exopite-sof-group-compact .exopite-sof-cloneable__title {
2858
+ width: 9%;
2859
+ min-width: 55px;
2860
+ order: 2;
2861
+ padding: 0;
2862
+ align-items: center;
2863
+ border-bottom: none;
2864
+ border-left: 1px solid #e5e5e5;
2865
+ justify-content: center;
2866
+ }
2867
+ .exopite-sof-group-compact .exopite-sof-cloneable__text {
2868
+ display: none;
2869
+ }
2870
+ .exopite-sof-group-compact .exopite-sof-cloneable--helper {
2871
+ align-items: center;
2872
+ justify-content: center;
2873
+ }
2874
+ .exopite-sof-group-compact .exopite-sof-cloneable__content {
2875
+ flex: 1;
2876
+ flex-direction: column;
2877
+ }
2878
+ .exopite-sof-group-compact .exopite-sof-cloneable__content > .exopite-sof-field .exopite-sof-fieldset {
2879
+ margin-left: 0;
2880
+ }
2881
+ .exopite-sof-group-compact .exopite-sof-cloneable__content > .exopite-sof-field {
2882
+ flex-direction: column;
2883
+ flex: 1;
2884
+ padding: 5px 15px;
2885
+ }
2886
+ .exopite-sof-fieldset .exopite-sof-group-compact select,
2887
+ .exopite-sof-fieldset .exopite-sof-group-compact input[type="email"],
2888
+ .exopite-sof-fieldset .exopite-sof-group-compact input[type="password"],
2889
+ .exopite-sof-fieldset .exopite-sof-group-compact input[type="text"] {
2890
+ max-width: 100%;
2891
+ }
2892
+ .exopite-sof-cloneable--helper {
2893
+ font-size: 14px;
2894
+ color: #888;
2895
+ }
2896
+ .exopite-sof-cloneable--helper i:hover {
2897
+ color: #444;
2898
+ }
2899
+ .exopite-sof-wrapper input[type="text"].minicolor {
2900
+ padding-left: 40px;
2901
+ }
2902
+ .exopite-sof-wrapper .minicolors-theme-default .minicolors-swatch {
2903
+ top: 0;
2904
+ left: 0;
2905
+ width: 29px;
2906
+ height: 29px;
2907
+ }
2908
+ .exopite-sof-typography-color {
2909
+ margin-bottom: 8px;
2910
+ }
2911
+ /* Gallery */
2912
+ .exopite-sof-gallery {
2913
+ list-style: none;
2914
+ }
2915
+ .exopite-sof-gallery > span {
2916
+ position: relative;
2917
+ display: inline-block;
2918
+ margin-right: 6px;
2919
+ margin-bottom: 6px;
2920
+ cursor: grab;
2921
+ }
2922
+ .exopite-sof-image-delete::before {
2923
+ content: '×';
2924
+ }
2925
+ .exopite-sof-image-delete {
2926
+ font-size: 18px;
2927
+ position: absolute;
2928
+ top: 5px;
2929
+ right: 5px;
2930
+ line-height: 16px;
2931
+ padding: 0 2px 2px 2px;
2932
+ background: red;
2933
+ color: #fff;
2934
+ display: inline-block;
2935
+ box-sizing: border-box;
2936
+ cursor: pointer;
2937
+ }
2938
+ .exopite-sof-gallery {
2939
+ line-height: 0;
2940
+ }
2941
+ .exopite-sof-gallery img {
2942
+ float: left;
2943
+ }
2944
+ .exopite-sof-gallery-add {
2945
+ cursor: pointer;
2946
+ }
2947
+ .exopite-sof-gallery .sortable-placeholder {
2948
+ width: 80px;
2949
+ /* border: 3px dashed #ccc; */
2950
+ margin-bottom: 6px;
2951
+ margin-right: 6px;
2952
+ box-sizing: border-box;
2953
+ height: initial;
2954
+ display: inline-block;
2955
+ }
2956
+ .edit-post-sidebar .exopite-sof-field-color input.minicolor {
2957
+ border-radius: 0;
2958
+ height: 31px;
2959
+ border-color: #e5e5e5;
2960
+ background: #f4f4f4;
2961
+ }
2962
+ .edit-post-sidebar .exopite-sof-field-color input.minicolor,
2963
+ .edit-post-sidebar .exopite-sof-field-color .minicolors-swatch {
2964
+ border-color: #e5e5e5;
2965
+ }
2966
+ .minicolors,
2967
+ .exopite-sof-form-field,
2968
+ .exopite-sof-fieldset {
2969
+ box-sizing: content-box;
2970
+ }
inc/exopite-simple-options/assets/dev/sweetalert.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.swal=e():t.swal=e()}(this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=8)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o="swal-button";e.CLASS_NAMES={MODAL:"swal-modal",OVERLAY:"swal-overlay",SHOW_MODAL:"swal-overlay--show-modal",MODAL_TITLE:"swal-title",MODAL_TEXT:"swal-text",ICON:"swal-icon",ICON_CUSTOM:"swal-icon--custom",CONTENT:"swal-content",FOOTER:"swal-footer",BUTTON_CONTAINER:"swal-button-container",BUTTON:o,CONFIRM_BUTTON:o+"--confirm",CANCEL_BUTTON:o+"--cancel",DANGER_BUTTON:o+"--danger",BUTTON_LOADING:o+"--loading",BUTTON_LOADER:o+"__loader"},e.default=e.CLASS_NAMES},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getNode=function(t){var e="."+t;return document.querySelector(e)},e.stringToNode=function(t){var e=document.createElement("div");return e.innerHTML=t.trim(),e.firstChild},e.insertAfter=function(t,e){var n=e.nextSibling;e.parentNode.insertBefore(t,n)},e.removeNode=function(t){t.parentElement.removeChild(t)},e.throwErr=function(t){throw t=t.replace(/ +(?= )/g,""),"SweetAlert: "+(t=t.trim())},e.isPlainObject=function(t){if("[object Object]"!==Object.prototype.toString.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype},e.ordinalSuffixOf=function(t){var e=t%10,n=t%100;return 1===e&&11!==n?t+"st":2===e&&12!==n?t+"nd":3===e&&13!==n?t+"rd":t+"th"}},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(25));var r=n(26);e.overlayMarkup=r.default,o(n(27)),o(n(28)),o(n(29));var i=n(0),a=i.default.MODAL_TITLE,s=i.default.MODAL_TEXT,c=i.default.ICON,l=i.default.FOOTER;e.iconMarkup='\n <div class="'+c+'"></div>',e.titleMarkup='\n <div class="'+a+'"></div>\n',e.textMarkup='\n <div class="'+s+'"></div>',e.footerMarkup='\n <div class="'+l+'"></div>\n'},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1);e.CONFIRM_KEY="confirm",e.CANCEL_KEY="cancel";var r={visible:!0,text:null,value:null,className:"",closeModal:!0},i=Object.assign({},r,{visible:!1,text:"Cancel",value:null}),a=Object.assign({},r,{text:"OK",value:!0});e.defaultButtonList={cancel:i,confirm:a};var s=function(t){switch(t){case e.CONFIRM_KEY:return a;case e.CANCEL_KEY:return i;default:var n=t.charAt(0).toUpperCase()+t.slice(1);return Object.assign({},r,{text:n,value:t})}},c=function(t,e){var n=s(t);return!0===e?Object.assign({},n,{visible:!0}):"string"==typeof e?Object.assign({},n,{visible:!0,text:e}):o.isPlainObject(e)?Object.assign({visible:!0},n,e):Object.assign({},n,{visible:!1})},l=function(t){for(var e={},n=0,o=Object.keys(t);n<o.length;n++){var r=o[n],a=t[r],s=c(r,a);e[r]=s}return e.cancel||(e.cancel=i),e},u=function(t){var n={};switch(t.length){case 1:n[e.CANCEL_KEY]=Object.assign({},i,{visible:!1});break;case 2:n[e.CANCEL_KEY]=c(e.CANCEL_KEY,t[0]),n[e.CONFIRM_KEY]=c(e.CONFIRM_KEY,t[1]);break;default:o.throwErr("Invalid number of 'buttons' in array ("+t.length+").\n If you want more than 2 buttons, you need to use an object!")}return n};e.getButtonListOpts=function(t){var n=e.defaultButtonList;return"string"==typeof t?n[e.CONFIRM_KEY]=c(e.CONFIRM_KEY,t):Array.isArray(t)?n=u(t):o.isPlainObject(t)?n=l(t):!0===t?n=u([!0,!0]):!1===t?n=u([!1,!1]):void 0===t&&(n=e.defaultButtonList),n}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),r=n(2),i=n(0),a=i.default.MODAL,s=i.default.OVERLAY,c=n(30),l=n(31),u=n(32),f=n(33);e.injectElIntoModal=function(t){var e=o.getNode(a),n=o.stringToNode(t);return e.appendChild(n),n};var d=function(t){t.className=a,t.textContent=""},p=function(t,e){d(t);var n=e.className;n&&t.classList.add(n)};e.initModalContent=function(t){var e=o.getNode(a);p(e,t),c.default(t.icon),l.initTitle(t.title),l.initText(t.text),f.default(t.content),u.default(t.buttons,t.dangerMode)};var m=function(){var t=o.getNode(s),e=o.stringToNode(r.modalMarkup);t.appendChild(e)};e.default=m},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),r={isOpen:!1,promise:null,actions:{},timer:null},i=Object.assign({},r);e.resetState=function(){i=Object.assign({},r)},e.setActionValue=function(t){if("string"==typeof t)return a(o.CONFIRM_KEY,t);for(var e in t)a(e,t[e])};var a=function(t,e){i.actions[t]||(i.actions[t]={}),Object.assign(i.actions[t],{value:e})};e.setActionOptionsFor=function(t,e){var n=(void 0===e?{}:e).closeModal,o=void 0===n||n;Object.assign(i.actions[t],{closeModal:o})},e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),r=n(3),i=n(0),a=i.default.OVERLAY,s=i.default.SHOW_MODAL,c=i.default.BUTTON,l=i.default.BUTTON_LOADING,u=n(5);e.openModal=function(){o.getNode(a).classList.add(s),u.default.isOpen=!0};var f=function(){o.getNode(a).classList.remove(s),u.default.isOpen=!1};e.onAction=function(t){void 0===t&&(t=r.CANCEL_KEY);var e=u.default.actions[t],n=e.value;if(!1===e.closeModal){var i=c+"--"+t;o.getNode(i).classList.add(l)}else f();u.default.promise.resolve(n)},e.getState=function(){var t=Object.assign({},u.default);return delete t.promise,delete t.timer,t},e.stopLoading=function(){for(var t=document.querySelectorAll("."+c),e=0;e<t.length;e++){t[e].classList.remove(l)}}},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){(function(e){t.exports=e.sweetAlert=n(9)}).call(e,n(7))},function(t,e,n){(function(e){t.exports=e.swal=n(10)}).call(e,n(7))},function(t,e,n){"undefined"!=typeof window&&n(11),n(16);var o=n(23).default;t.exports=o},function(t,e,n){var o=n(12);"string"==typeof o&&(o=[[t.i,o,""]]);var r={insertAt:"top"};r.transform=void 0;n(14)(o,r);o.locals&&(t.exports=o.locals)},function(t,e,n){e=t.exports=n(13)(void 0),e.push([t.i,'.swal-icon--error{border-color:#f27474;-webkit-animation:animateErrorIcon .5s;animation:animateErrorIcon .5s}.swal-icon--error__x-mark{position:relative;display:block;-webkit-animation:animateXMark .5s;animation:animateXMark .5s}.swal-icon--error__line{position:absolute;height:5px;width:47px;background-color:#f27474;display:block;top:37px;border-radius:2px}.swal-icon--error__line--left{-webkit-transform:rotate(45deg);transform:rotate(45deg);left:17px}.swal-icon--error__line--right{-webkit-transform:rotate(-45deg);transform:rotate(-45deg);right:16px}@-webkit-keyframes animateErrorIcon{0%{-webkit-transform:rotateX(100deg);transform:rotateX(100deg);opacity:0}to{-webkit-transform:rotateX(0deg);transform:rotateX(0deg);opacity:1}}@keyframes animateErrorIcon{0%{-webkit-transform:rotateX(100deg);transform:rotateX(100deg);opacity:0}to{-webkit-transform:rotateX(0deg);transform:rotateX(0deg);opacity:1}}@-webkit-keyframes animateXMark{0%{-webkit-transform:scale(.4);transform:scale(.4);margin-top:26px;opacity:0}50%{-webkit-transform:scale(.4);transform:scale(.4);margin-top:26px;opacity:0}80%{-webkit-transform:scale(1.15);transform:scale(1.15);margin-top:-6px}to{-webkit-transform:scale(1);transform:scale(1);margin-top:0;opacity:1}}@keyframes animateXMark{0%{-webkit-transform:scale(.4);transform:scale(.4);margin-top:26px;opacity:0}50%{-webkit-transform:scale(.4);transform:scale(.4);margin-top:26px;opacity:0}80%{-webkit-transform:scale(1.15);transform:scale(1.15);margin-top:-6px}to{-webkit-transform:scale(1);transform:scale(1);margin-top:0;opacity:1}}.swal-icon--warning{border-color:#f8bb86;-webkit-animation:pulseWarning .75s infinite alternate;animation:pulseWarning .75s infinite alternate}.swal-icon--warning__body{width:5px;height:47px;top:10px;border-radius:2px;margin-left:-2px}.swal-icon--warning__body,.swal-icon--warning__dot{position:absolute;left:50%;background-color:#f8bb86}.swal-icon--warning__dot{width:7px;height:7px;border-radius:50%;margin-left:-4px;bottom:-11px}@-webkit-keyframes pulseWarning{0%{border-color:#f8d486}to{border-color:#f8bb86}}@keyframes pulseWarning{0%{border-color:#f8d486}to{border-color:#f8bb86}}.swal-icon--success{border-color:#a5dc86}.swal-icon--success:after,.swal-icon--success:before{content:"";border-radius:50%;position:absolute;width:60px;height:120px;background:#fff;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.swal-icon--success:before{border-radius:120px 0 0 120px;top:-7px;left:-33px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:60px 60px;transform-origin:60px 60px}.swal-icon--success:after{border-radius:0 120px 120px 0;top:-11px;left:30px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:0 60px;transform-origin:0 60px;-webkit-animation:rotatePlaceholder 4.25s ease-in;animation:rotatePlaceholder 4.25s ease-in}.swal-icon--success__ring{width:80px;height:80px;border:4px solid hsla(98,55%,69%,.2);border-radius:50%;box-sizing:content-box;position:absolute;left:-4px;top:-4px;z-index:2}.swal-icon--success__hide-corners{width:5px;height:90px;background-color:#fff;padding:1px;position:absolute;left:28px;top:8px;z-index:1;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.swal-icon--success__line{height:5px;background-color:#a5dc86;display:block;border-radius:2px;position:absolute;z-index:2}.swal-icon--success__line--tip{width:25px;left:14px;top:46px;-webkit-transform:rotate(45deg);transform:rotate(45deg);-webkit-animation:animateSuccessTip .75s;animation:animateSuccessTip .75s}.swal-icon--success__line--long{width:47px;right:8px;top:38px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-animation:animateSuccessLong .75s;animation:animateSuccessLong .75s}@-webkit-keyframes rotatePlaceholder{0%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}5%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}12%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}to{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}}@keyframes rotatePlaceholder{0%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}5%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}12%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}to{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}}@-webkit-keyframes animateSuccessTip{0%{width:0;left:1px;top:19px}54%{width:0;left:1px;top:19px}70%{width:50px;left:-8px;top:37px}84%{width:17px;left:21px;top:48px}to{width:25px;left:14px;top:45px}}@keyframes animateSuccessTip{0%{width:0;left:1px;top:19px}54%{width:0;left:1px;top:19px}70%{width:50px;left:-8px;top:37px}84%{width:17px;left:21px;top:48px}to{width:25px;left:14px;top:45px}}@-webkit-keyframes animateSuccessLong{0%{width:0;right:46px;top:54px}65%{width:0;right:46px;top:54px}84%{width:55px;right:0;top:35px}to{width:47px;right:8px;top:38px}}@keyframes animateSuccessLong{0%{width:0;right:46px;top:54px}65%{width:0;right:46px;top:54px}84%{width:55px;right:0;top:35px}to{width:47px;right:8px;top:38px}}.swal-icon--info{border-color:#c9dae1}.swal-icon--info:before{width:5px;height:29px;bottom:17px;border-radius:2px;margin-left:-2px}.swal-icon--info:after,.swal-icon--info:before{content:"";position:absolute;left:50%;background-color:#c9dae1}.swal-icon--info:after{width:7px;height:7px;border-radius:50%;margin-left:-3px;top:19px}.swal-icon{width:80px;height:80px;border-width:4px;border-style:solid;border-radius:50%;padding:0;position:relative;box-sizing:content-box;margin:20px auto}.swal-icon:first-child{margin-top:32px}.swal-icon--custom{width:auto;height:auto;max-width:100%;border:none;border-radius:0}.swal-icon img{max-width:100%;max-height:100%}.swal-title{color:rgba(0,0,0,.65);font-weight:600;text-transform:none;position:relative;display:block;padding:13px 16px;font-size:27px;line-height:normal;text-align:center;margin-bottom:0}.swal-title:first-child{margin-top:26px}.swal-title:not(:first-child){padding-bottom:0}.swal-title:not(:last-child){margin-bottom:13px}.swal-text{font-size:16px;position:relative;float:none;line-height:normal;vertical-align:top;text-align:left;display:inline-block;margin:0;padding:0 10px;font-weight:400;color:rgba(0,0,0,.64);max-width:calc(100% - 20px);overflow-wrap:break-word;box-sizing:border-box}.swal-text:first-child{margin-top:45px}.swal-text:last-child{margin-bottom:45px}.swal-footer{text-align:right;padding-top:13px;margin-top:13px;padding:13px 16px;border-radius:inherit;border-top-left-radius:0;border-top-right-radius:0}.swal-button-container{margin:5px;display:inline-block;position:relative}.swal-button{background-color:#7cd1f9;color:#fff;border:none;box-shadow:none;border-radius:5px;font-weight:600;font-size:14px;padding:10px 24px;margin:0;cursor:pointer}.swal-button[not:disabled]:hover{background-color:#78cbf2}.swal-button:active{background-color:#70bce0}.swal-button:focus{outline:none;box-shadow:0 0 0 1px #fff,0 0 0 3px rgba(43,114,165,.29)}.swal-button[disabled]{opacity:.5;cursor:default}.swal-button::-moz-focus-inner{border:0}.swal-button--cancel{color:#555;background-color:#efefef}.swal-button--cancel[not:disabled]:hover{background-color:#e8e8e8}.swal-button--cancel:active{background-color:#d7d7d7}.swal-button--cancel:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px rgba(116,136,150,.29)}.swal-button--danger{background-color:#e64942}.swal-button--danger[not:disabled]:hover{background-color:#df4740}.swal-button--danger:active{background-color:#cf423b}.swal-button--danger:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px rgba(165,43,43,.29)}.swal-content{padding:0 20px;margin-top:20px;font-size:medium}.swal-content:last-child{margin-bottom:20px}.swal-content__input,.swal-content__textarea{-webkit-appearance:none;background-color:#fff;border:none;font-size:14px;display:block;box-sizing:border-box;width:100%;border:1px solid rgba(0,0,0,.14);padding:10px 13px;border-radius:2px;transition:border-color .2s}.swal-content__input:focus,.swal-content__textarea:focus{outline:none;border-color:#6db8ff}.swal-content__textarea{resize:vertical}.swal-button--loading{color:transparent}.swal-button--loading~.swal-button__loader{opacity:1}.swal-button__loader{position:absolute;height:auto;width:43px;z-index:2;left:50%;top:50%;-webkit-transform:translateX(-50%) translateY(-50%);transform:translateX(-50%) translateY(-50%);text-align:center;pointer-events:none;opacity:0}.swal-button__loader div{display:inline-block;float:none;vertical-align:baseline;width:9px;height:9px;padding:0;border:none;margin:2px;opacity:.4;border-radius:7px;background-color:hsla(0,0%,100%,.9);transition:background .2s;-webkit-animation:swal-loading-anim 1s infinite;animation:swal-loading-anim 1s infinite}.swal-button__loader div:nth-child(3n+2){-webkit-animation-delay:.15s;animation-delay:.15s}.swal-button__loader div:nth-child(3n+3){-webkit-animation-delay:.3s;animation-delay:.3s}@-webkit-keyframes swal-loading-anim{0%{opacity:.4}20%{opacity:.4}50%{opacity:1}to{opacity:.4}}@keyframes swal-loading-anim{0%{opacity:.4}20%{opacity:.4}50%{opacity:1}to{opacity:.4}}.swal-overlay{position:fixed;top:0;bottom:0;left:0;right:0;text-align:center;font-size:0;overflow-y:auto;background-color:rgba(0,0,0,.4);z-index:10000;pointer-events:none;opacity:0;transition:opacity .3s}.swal-overlay:before{content:" ";display:inline-block;vertical-align:middle;height:100%}.swal-overlay--show-modal{opacity:1;pointer-events:auto}.swal-overlay--show-modal .swal-modal{opacity:1;pointer-events:auto;box-sizing:border-box;-webkit-animation:showSweetAlert .3s;animation:showSweetAlert .3s;will-change:transform}.swal-modal{width:478px;opacity:0;pointer-events:none;background-color:#fff;text-align:center;border-radius:5px;position:static;margin:20px auto;display:inline-block;vertical-align:middle;-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 50%;transform-origin:50% 50%;z-index:10001;transition:opacity .2s,-webkit-transform .3s;transition:transform .3s,opacity .2s;transition:transform .3s,opacity .2s,-webkit-transform .3s}@media (max-width:500px){.swal-modal{width:calc(100% - 20px)}}@-webkit-keyframes showSweetAlert{0%{-webkit-transform:scale(1);transform:scale(1)}1%{-webkit-transform:scale(.5);transform:scale(.5)}45%{-webkit-transform:scale(1.05);transform:scale(1.05)}80%{-webkit-transform:scale(.95);transform:scale(.95)}to{-webkit-transform:scale(1);transform:scale(1)}}@keyframes showSweetAlert{0%{-webkit-transform:scale(1);transform:scale(1)}1%{-webkit-transform:scale(.5);transform:scale(.5)}45%{-webkit-transform:scale(1.05);transform:scale(1.05)}80%{-webkit-transform:scale(.95);transform:scale(.95)}to{-webkit-transform:scale(1);transform:scale(1)}}',""])},function(t,e){function n(t,e){var n=t[1]||"",r=t[3];if(!r)return n;if(e&&"function"==typeof btoa){var i=o(r);return[n].concat(r.sources.map(function(t){return"/*# sourceURL="+r.sourceRoot+t+" */"})).concat([i]).join("\n")}return[n].join("\n")}function o(t){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t))))+" */"}t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var o=n(e,t);return e[2]?"@media "+e[2]+"{"+o+"}":o}).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var o={},r=0;r<this.length;r++){var i=this[r][0];"number"==typeof i&&(o[i]=!0)}for(r=0;r<t.length;r++){var a=t[r];"number"==typeof a[0]&&o[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(t,e,n){function o(t,e){for(var n=0;n<t.length;n++){var o=t[n],r=m[o.id];if(r){r.refs++;for(var i=0;i<r.parts.length;i++)r.parts[i](o.parts[i]);for(;i<o.parts.length;i++)r.parts.push(u(o.parts[i],e))}else{for(var a=[],i=0;i<o.parts.length;i++)a.push(u(o.parts[i],e));m[o.id]={id:o.id,refs:1,parts:a}}}}function r(t,e){for(var n=[],o={},r=0;r<t.length;r++){var i=t[r],a=e.base?i[0]+e.base:i[0],s=i[1],c=i[2],l=i[3],u={css:s,media:c,sourceMap:l};o[a]?o[a].parts.push(u):n.push(o[a]={id:a,parts:[u]})}return n}function i(t,e){var n=v(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var o=w[w.length-1];if("top"===t.insertAt)o?o.nextSibling?n.insertBefore(e,o.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),w.push(e);else{if("bottom"!==t.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");n.appendChild(e)}}function a(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=w.indexOf(t);e>=0&&w.splice(e,1)}function s(t){var e=document.createElement("style");return t.attrs.type="text/css",l(e,t.attrs),i(t,e),e}function c(t){var e=document.createElement("link");return t.attrs.type="text/css",t.attrs.rel="stylesheet",l(e,t.attrs),i(t,e),e}function l(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}function u(t,e){var n,o,r,i;if(e.transform&&t.css){if(!(i=e.transform(t.css)))return function(){};t.css=i}if(e.singleton){var l=h++;n=g||(g=s(e)),o=f.bind(null,n,l,!1),r=f.bind(null,n,l,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=c(e),o=p.bind(null,n,e),r=function(){a(n),n.href&&URL.revokeObjectURL(n.href)}):(n=s(e),o=d.bind(null,n),r=function(){a(n)});return o(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;o(t=e)}else r()}}function f(t,e,n,o){var r=n?"":o.css;if(t.styleSheet)t.styleSheet.cssText=x(e,r);else{var i=document.createTextNode(r),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(i,a[e]):t.appendChild(i)}}function d(t,e){var n=e.css,o=e.media;if(o&&t.setAttribute("media",o),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}function p(t,e,n){var o=n.css,r=n.sourceMap,i=void 0===e.convertToAbsoluteUrls&&r;(e.convertToAbsoluteUrls||i)&&(o=y(o)),r&&(o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var a=new Blob([o],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}var m={},b=function(t){var e;return function(){return void 0===e&&(e=t.apply(this,arguments)),e}}(function(){return window&&document&&document.all&&!window.atob}),v=function(t){var e={};return function(n){return void 0===e[n]&&(e[n]=t.call(this,n)),e[n]}}(function(t){return document.querySelector(t)}),g=null,h=0,w=[],y=n(15);t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");e=e||{},e.attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||(e.singleton=b()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=r(t,e);return o(n,e),function(t){for(var i=[],a=0;a<n.length;a++){var s=n[a],c=m[s.id];c.refs--,i.push(c)}if(t){o(r(t,e),e)}for(var a=0;a<i.length;a++){var c=i[a];if(0===c.refs){for(var l=0;l<c.parts.length;l++)c.parts[l]();delete m[c.id]}}}};var x=function(){var t=[];return function(e,n){return t[e]=n,t.filter(Boolean).join("\n")}}()},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,o=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,e){var r=e.trim().replace(/^"(.*)"$/,function(t,e){return e}).replace(/^'(.*)'$/,function(t,e){return e});if(/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(r))return t;var i;return i=0===r.indexOf("//")?r:0===r.indexOf("/")?n+r:o+r.replace(/^\.\//,""),"url("+JSON.stringify(i)+")"})}},function(t,e,n){var o=n(17);"undefined"==typeof window||window.Promise||(window.Promise=o),n(21),String.prototype.includes||(String.prototype.includes=function(t,e){"use strict";return"number"!=typeof e&&(e=0),!(e+t.length>this.length)&&-1!==this.indexOf(t,e)}),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(t,e){if(null==this)throw new TypeError('"this" is null or not defined');var n=Object(this),o=n.length>>>0;if(0===o)return!1;for(var r=0|e,i=Math.max(r>=0?r:o-Math.abs(r),0);i<o;){if(function(t,e){return t===e||"number"==typeof t&&"number"==typeof e&&isNaN(t)&&isNaN(e)}(n[i],t))return!0;i++}return!1}}),"undefined"!=typeof window&&function(t){t.forEach(function(t){t.hasOwnProperty("remove")||Object.defineProperty(t,"remove",{configurable:!0,enumerable:!0,writable:!0,value:function(){this.parentNode.removeChild(this)}})})}([Element.prototype,CharacterData.prototype,DocumentType.prototype])},function(t,e,n){(function(e){!function(n){function o(){}function r(t,e){return function(){t.apply(e,arguments)}}function i(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],f(t,this)}function a(t,e){for(;3===t._state;)t=t._value;if(0===t._state)return void t._deferreds.push(e);t._handled=!0,i._immediateFn(function(){var n=1===t._state?e.onFulfilled:e.onRejected;if(null===n)return void(1===t._state?s:c)(e.promise,t._value);var o;try{o=n(t._value)}catch(t){return void c(e.promise,t)}s(e.promise,o)})}function s(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var n=e.then;if(e instanceof i)return t._state=3,t._value=e,void l(t);if("function"==typeof n)return void f(r(n,e),t)}t._state=1,t._value=e,l(t)}catch(e){c(t,e)}}function c(t,e){t._state=2,t._value=e,l(t)}function l(t){2===t._state&&0===t._deferreds.length&&i._immediateFn(function(){t._handled||i._unhandledRejectionFn(t._value)});for(var e=0,n=t._deferreds.length;e<n;e++)a(t,t._deferreds[e]);t._deferreds=null}function u(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}function f(t,e){var n=!1;try{t(function(t){n||(n=!0,s(e,t))},function(t){n||(n=!0,c(e,t))})}catch(t){if(n)return;n=!0,c(e,t)}}var d=setTimeout;i.prototype.catch=function(t){return this.then(null,t)},i.prototype.then=function(t,e){var n=new this.constructor(o);return a(this,new u(t,e,n)),n},i.all=function(t){var e=Array.prototype.slice.call(t);return new i(function(t,n){function o(i,a){try{if(a&&("object"==typeof a||"function"==typeof a)){var s=a.then;if("function"==typeof s)return void s.call(a,function(t){o(i,t)},n)}e[i]=a,0==--r&&t(e)}catch(t){n(t)}}if(0===e.length)return t([]);for(var r=e.length,i=0;i<e.length;i++)o(i,e[i])})},i.resolve=function(t){return t&&"object"==typeof t&&t.constructor===i?t:new i(function(e){e(t)})},i.reject=function(t){return new i(function(e,n){n(t)})},i.race=function(t){return new i(function(e,n){for(var o=0,r=t.length;o<r;o++)t[o].then(e,n)})},i._immediateFn="function"==typeof e&&function(t){e(t)}||function(t){d(t,0)},i._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)},i._setImmediateFn=function(t){i._immediateFn=t},i._setUnhandledRejectionFn=function(t){i._unhandledRejectionFn=t},void 0!==t&&t.exports?t.exports=i:n.Promise||(n.Promise=i)}(this)}).call(e,n(18).setImmediate)},function(t,e,n){function o(t,e){this._id=t,this._clearFn=e}var r=Function.prototype.apply;e.setTimeout=function(){return new o(r.call(setTimeout,window,arguments),clearTimeout)},e.setInterval=function(){return new o(r.call(setInterval,window,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(window,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(19),e.setImmediate=setImmediate,e.clearImmediate=clearImmediate},function(t,e,n){(function(t,e){!function(t,n){"use strict";function o(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var o={callback:t,args:e};return l[c]=o,s(c),c++}function r(t){delete l[t]}function i(t){var e=t.callback,o=t.args;switch(o.length){case 0:e();break;case 1:e(o[0]);break;case 2:e(o[0],o[1]);break;case 3:e(o[0],o[1],o[2]);break;default:e.apply(n,o)}}function a(t){if(u)setTimeout(a,0,t);else{var e=l[t];if(e){u=!0;try{i(e)}finally{r(t),u=!1}}}}if(!t.setImmediate){var s,c=1,l={},u=!1,f=t.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(t);d=d&&d.setTimeout?d:t,"[object process]"==={}.toString.call(t.process)?function(){s=function(t){e.nextTick(function(){a(t)})}}():function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?function(){var e="setImmediate$"+Math.random()+"$",n=function(n){n.source===t&&"string"==typeof n.data&&0===n.data.indexOf(e)&&a(+n.data.slice(e.length))};t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n),s=function(n){t.postMessage(e+n,"*")}}():t.MessageChannel?function(){var t=new MessageChannel;t.port1.onmessage=function(t){a(t.data)},s=function(e){t.port2.postMessage(e)}}():f&&"onreadystatechange"in f.createElement("script")?function(){var t=f.documentElement;s=function(e){var n=f.createElement("script");n.onreadystatechange=function(){a(e),n.onreadystatechange=null,t.removeChild(n),n=null},t.appendChild(n)}}():function(){s=function(t){setTimeout(a,0,t)}}(),d.setImmediate=o,d.clearImmediate=r}}("undefined"==typeof self?void 0===t?this:t:self)}).call(e,n(7),n(20))},function(t,e){function n(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function r(t){if(u===setTimeout)return setTimeout(t,0);if((u===n||!u)&&setTimeout)return u=setTimeout,setTimeout(t,0);try{return u(t,0)}catch(e){try{return u.call(null,t,0)}catch(e){return u.call(this,t,0)}}}function i(t){if(f===clearTimeout)return clearTimeout(t);if((f===o||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(t);try{return f(t)}catch(e){try{return f.call(null,t)}catch(e){return f.call(this,t)}}}function a(){b&&p&&(b=!1,p.length?m=p.concat(m):v=-1,m.length&&s())}function s(){if(!b){var t=r(a);b=!0;for(var e=m.length;e;){for(p=m,m=[];++v<e;)p&&p[v].run();v=-1,e=m.length}p=null,b=!1,i(t)}}function c(t,e){this.fun=t,this.array=e}function l(){}var u,f,d=t.exports={};!function(){try{u="function"==typeof setTimeout?setTimeout:n}catch(t){u=n}try{f="function"==typeof clearTimeout?clearTimeout:o}catch(t){f=o}}();var p,m=[],b=!1,v=-1;d.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];m.push(new c(t,e)),1!==m.length||b||r(s)},c.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=l,d.addListener=l,d.once=l,d.off=l,d.removeListener=l,d.removeAllListeners=l,d.emit=l,d.prependListener=l,d.prependOnceListener=l,d.listeners=function(t){return[]},d.binding=function(t){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(t){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},function(t,e,n){"use strict";n(22).polyfill()},function(t,e,n){"use strict";function o(t,e){if(void 0===t||null===t)throw new TypeError("Cannot convert first argument to object");for(var n=Object(t),o=1;o<arguments.length;o++){var r=arguments[o];if(void 0!==r&&null!==r)for(var i=Object.keys(Object(r)),a=0,s=i.length;a<s;a++){var c=i[a],l=Object.getOwnPropertyDescriptor(r,c);void 0!==l&&l.enumerable&&(n[c]=r[c])}}return n}function r(){Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:o})}t.exports={assign:o,polyfill:r}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(24),r=n(6),i=n(5),a=n(36),s=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if("undefined"!=typeof window){var n=a.getOpts.apply(void 0,t);return new Promise(function(t,e){i.default.promise={resolve:t,reject:e},o.default(n),setTimeout(function(){r.openModal()})})}};s.close=r.onAction,s.getState=r.getState,s.setActionValue=i.setActionValue,s.stopLoading=r.stopLoading,s.setDefaults=a.setDefaults,e.default=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),r=n(0),i=r.default.MODAL,a=n(4),s=n(34),c=n(35),l=n(1);e.init=function(t){o.getNode(i)||(document.body||l.throwErr("You can only use SweetAlert AFTER the DOM has loaded!"),s.default(),a.default()),a.initModalContent(t),c.default(t)},e.default=e.init},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=o.default.MODAL;e.modalMarkup='\n <div class="'+r+'" role="dialog" aria-modal="true"></div>',e.default=e.modalMarkup},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=o.default.OVERLAY,i='<div \n class="'+r+'"\n tabIndex="-1">\n </div>';e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=o.default.ICON;e.errorIconMarkup=function(){var t=r+"--error",e=t+"__line";return'\n <div class="'+t+'__x-mark">\n <span class="'+e+" "+e+'--left"></span>\n <span class="'+e+" "+e+'--right"></span>\n </div>\n '},e.warningIconMarkup=function(){var t=r+"--warning";return'\n <span class="'+t+'__body">\n <span class="'+t+'__dot"></span>\n </span>\n '},e.successIconMarkup=function(){var t=r+"--success";return'\n <span class="'+t+"__line "+t+'__line--long"></span>\n <span class="'+t+"__line "+t+'__line--tip"></span>\n\n <div class="'+t+'__ring"></div>\n <div class="'+t+'__hide-corners"></div>\n '}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=o.default.CONTENT;e.contentMarkup='\n <div class="'+r+'">\n\n </div>\n'},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=o.default.BUTTON_CONTAINER,i=o.default.BUTTON,a=o.default.BUTTON_LOADER;e.buttonMarkup='\n <div class="'+r+'">\n\n <button\n class="'+i+'"\n ></button>\n\n <div class="'+a+'">\n <div></div>\n <div></div>\n <div></div>\n </div>\n\n </div>\n'},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(4),r=n(2),i=n(0),a=i.default.ICON,s=i.default.ICON_CUSTOM,c=["error","warning","success","info"],l={error:r.errorIconMarkup(),warning:r.warningIconMarkup(),success:r.successIconMarkup()},u=function(t,e){var n=a+"--"+t;e.classList.add(n);var o=l[t];o&&(e.innerHTML=o)},f=function(t,e){e.classList.add(s);var n=document.createElement("img");n.src=t,e.appendChild(n)},d=function(t){if(t){var e=o.injectElIntoModal(r.iconMarkup);c.includes(t)?u(t,e):f(t,e)}};e.default=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(2),r=n(4),i=function(t){navigator.userAgent.includes("AppleWebKit")&&(t.style.display="none",t.offsetHeight,t.style.display="")};e.initTitle=function(t){if(t){var e=r.injectElIntoModal(o.titleMarkup);e.textContent=t,i(e)}},e.initText=function(t){if(t){var e=document.createDocumentFragment();t.split("\n").forEach(function(t,n,o){e.appendChild(document.createTextNode(t)),n<o.length-1&&e.appendChild(document.createElement("br"))});var n=r.injectElIntoModal(o.textMarkup);n.appendChild(e),i(n)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),r=n(4),i=n(0),a=i.default.BUTTON,s=i.default.DANGER_BUTTON,c=n(3),l=n(2),u=n(6),f=n(5),d=function(t,e,n){var r=e.text,i=e.value,d=e.className,p=e.closeModal,m=o.stringToNode(l.buttonMarkup),b=m.querySelector("."+a),v=a+"--"+t;if(b.classList.add(v),d){(Array.isArray(d)?d:d.split(" ")).filter(function(t){return t.length>0}).forEach(function(t){b.classList.add(t)})}n&&t===c.CONFIRM_KEY&&b.classList.add(s),b.textContent=r;var g={};return g[t]=i,f.setActionValue(g),f.setActionOptionsFor(t,{closeModal:p}),b.addEventListener("click",function(){return u.onAction(t)}),m},p=function(t,e){var n=r.injectElIntoModal(l.footerMarkup);for(var o in t){var i=t[o],a=d(o,i,e);i.visible&&n.appendChild(a)}0===n.children.length&&n.remove()};e.default=p},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),r=n(4),i=n(2),a=n(5),s=n(6),c=n(0),l=c.default.CONTENT,u=function(t){t.addEventListener("input",function(t){var e=t.target,n=e.value;a.setActionValue(n)}),t.addEventListener("keyup",function(t){if("Enter"===t.key)return s.onAction(o.CONFIRM_KEY)}),setTimeout(function(){t.focus(),a.setActionValue("")},0)},f=function(t,e,n){var o=document.createElement(e),r=l+"__"+e;o.classList.add(r);for(var i in n){var a=n[i];o[i]=a}"input"===e&&u(o),t.appendChild(o)},d=function(t){if(t){var e=r.injectElIntoModal(i.contentMarkup),n=t.element,o=t.attributes;"string"==typeof n?f(e,n,o):e.appendChild(n)}};e.default=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),r=n(2),i=function(){var t=o.stringToNode(r.overlayMarkup);document.body.appendChild(t)};e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(5),r=n(6),i=n(1),a=n(3),s=n(0),c=s.default.MODAL,l=s.default.BUTTON,u=s.default.OVERLAY,f=function(t){t.preventDefault(),v()},d=function(t){t.preventDefault(),g()},p=function(t){if(o.default.isOpen)switch(t.key){case"Escape":return r.onAction(a.CANCEL_KEY)}},m=function(t){if(o.default.isOpen)switch(t.key){case"Tab":return f(t)}},b=function(t){if(o.default.isOpen)return"Tab"===t.key&&t.shiftKey?d(t):void 0},v=function(){var t=i.getNode(l);t&&(t.tabIndex=0,t.focus())},g=function(){var t=i.getNode(c),e=t.querySelectorAll("."+l),n=e.length-1,o=e[n];o&&o.focus()},h=function(t){t[t.length-1].addEventListener("keydown",m)},w=function(t){t[0].addEventListener("keydown",b)},y=function(){var t=i.getNode(c),e=t.querySelectorAll("."+l);e.length&&(h(e),w(e))},x=function(t){if(i.getNode(u)===t.target)return r.onAction(a.CANCEL_KEY)},_=function(t){var e=i.getNode(u);e.removeEventListener("click",x),t&&e.addEventListener("click",x)},k=function(t){o.default.timer&&clearTimeout(o.default.timer),t&&(o.default.timer=window.setTimeout(function(){return r.onAction(a.CANCEL_KEY)},t))},O=function(t){t.closeOnEsc?document.addEventListener("keyup",p):document.removeEventListener("keyup",p),t.dangerMode?v():g(),y(),_(t.closeOnClickOutside),k(t.timer)};e.default=O},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),r=n(3),i=n(37),a=n(38),s={title:null,text:null,icon:null,buttons:r.defaultButtonList,content:null,className:null,closeOnClickOutside:!0,closeOnEsc:!0,dangerMode:!1,timer:null},c=Object.assign({},s);e.setDefaults=function(t){c=Object.assign({},s,t)};var l=function(t){var e=t&&t.button,n=t&&t.buttons;return void 0!==e&&void 0!==n&&o.throwErr("Cannot set both 'button' and 'buttons' options!"),void 0!==e?{confirm:e}:n},u=function(t){return o.ordinalSuffixOf(t+1)},f=function(t,e){o.throwErr(u(e)+" argument ('"+t+"') is invalid")},d=function(t,e){var n=t+1,r=e[n];o.isPlainObject(r)||void 0===r||o.throwErr("Expected "+u(n)+" argument ('"+r+"') to be a plain object")},p=function(t,e){var n=t+1,r=e[n];void 0!==r&&o.throwErr("Unexpected "+u(n)+" argument ("+r+")")},m=function(t,e,n,r){var i=typeof e,a="string"===i,s=e instanceof Element;if(a){if(0===n)return{text:e};if(1===n)return{text:e,title:r[0]};if(2===n)return d(n,r),{icon:e};f(e,n)}else{if(s&&0===n)return d(n,r),{content:e};if(o.isPlainObject(e))return p(n,r),e;f(e,n)}};e.getOpts=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n={};t.forEach(function(e,o){var r=m(0,e,o,t);Object.assign(n,r)});var o=l(n);n.buttons=r.getButtonListOpts(o),delete n.button,n.content=i.getContentOpts(n.content);var u=Object.assign({},s,c,n);return Object.keys(u).forEach(function(t){a.DEPRECATED_OPTS[t]&&a.logDeprecation(t)}),u}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),r={element:"input",attributes:{placeholder:""}};e.getContentOpts=function(t){var e={};return o.isPlainObject(t)?Object.assign(e,t):t instanceof Element?{element:t}:"input"===t?r:null}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.logDeprecation=function(t){var n=e.DEPRECATED_OPTS[t],o=n.onlyRename,r=n.replacement,i=n.subOption,a=n.link,s=o?"renamed":"deprecated",c='SweetAlert warning: "'+t+'" option has been '+s+".";if(r){c+=" Please use"+(i?' "'+i+'" in ':" ")+'"'+r+'" instead.'}var l="https://sweetalert.js.org";c+=a?" More details: "+l+a:" More details: "+l+"/guides/#upgrading-from-1x",console.warn(c)},e.DEPRECATED_OPTS={type:{replacement:"icon",link:"/docs/#icon"},imageUrl:{replacement:"icon",link:"/docs/#icon"},customClass:{replacement:"className",onlyRename:!0,link:"/docs/#classname"},imageSize:{},showCancelButton:{replacement:"buttons",link:"/docs/#buttons"},showConfirmButton:{replacement:"button",link:"/docs/#button"},confirmButtonText:{replacement:"button",link:"/docs/#button"},confirmButtonColor:{},cancelButtonText:{replacement:"buttons",link:"/docs/#buttons"},closeOnConfirm:{replacement:"button",subOption:"closeModal",link:"/docs/#button"},closeOnCancel:{replacement:"buttons",subOption:"closeModal",link:"/docs/#buttons"},showLoaderOnConfirm:{replacement:"buttons"},animation:{},inputType:{replacement:"content",link:"/docs/#content"},inputValue:{replacement:"content",link:"/docs/#content"},inputPlaceholder:{replacement:"content",link:"/docs/#content"},html:{replacement:"content",link:"/docs/#content"},allowEscapeKey:{replacement:"closeOnEsc",onlyRename:!0,link:"/docs/#closeonesc"},allowClickOutside:{replacement:"closeOnClickOutside",onlyRename:!0,link:"/docs/#closeonclickoutside"}}}])});
inc/exopite-simple-options/assets/dev/wp-color-picker-alpha.js ADDED
@@ -0,0 +1,496 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**!
2
+ * wp-color-picker-alpha
3
+ *
4
+ * Overwrite Automattic Iris for enabled Alpha Channel in wpColorPicker
5
+ * Only run in input and is defined data alpha in true
6
+ *
7
+ * Version: 2.1.3
8
+ * https://github.com/kallookoo/wp-color-picker-alpha
9
+ * Licensed under the GPLv2 license.
10
+ */
11
+ ( function( $ ) {
12
+ // Prevent double-init.
13
+ if ( $.wp.wpColorPicker.prototype._hasAlpha ) {
14
+ return;
15
+ }
16
+
17
+ // Variable for some backgrounds ( grid )
18
+ var image = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==',
19
+ // html stuff for wpColorPicker copy of the original color-picker.js
20
+ _after = '<div class="wp-picker-holder" />',
21
+ _wrap = '<div class="wp-picker-container" />',
22
+ _button = '<input type="button" class="button button-small" />',
23
+ // Prevent CSS issues in < WordPress 4.9
24
+ _deprecated = ( wpColorPickerL10n.current !== undefined );
25
+ // Declare some global variables when is deprecated or not
26
+ if ( _deprecated ) {
27
+ var _before = '<a tabindex="0" class="wp-color-result" />';
28
+ } else {
29
+ var _before = '<button type="button" class="button wp-color-result" aria-expanded="false"><span class="wp-color-result-text"></span></button>',
30
+ _wrappingLabel = '<label></label>',
31
+ _wrappingLabelText = '<span class="screen-reader-text"></span>';
32
+ }
33
+ /**
34
+ * Overwrite Color
35
+ * for enable support rbga
36
+ */
37
+ Color.fn.toString = function() {
38
+ if ( this._alpha < 1 )
39
+ return this.toCSS( 'rgba', this._alpha ).replace( /\s+/g, '' );
40
+
41
+ var hex = parseInt( this._color, 10 ).toString( 16 );
42
+
43
+ if ( this.error )
44
+ return '';
45
+
46
+ if ( hex.length < 6 )
47
+ hex = ( '00000' + hex ).substr( -6 );
48
+
49
+ return '#' + hex;
50
+ };
51
+
52
+ /**
53
+ * Overwrite wpColorPicker
54
+ */
55
+ $.widget( 'wp.wpColorPicker', $.wp.wpColorPicker, {
56
+ _hasAlpha: true,
57
+ /**
58
+ * @summary Creates the color picker.
59
+ *
60
+ * Creates the color picker, sets default values, css classes and wraps it all in HTML.
61
+ *
62
+ * @since 3.5.0
63
+ *
64
+ * @access private
65
+ *
66
+ * @returns {void}
67
+ */
68
+ _create: function() {
69
+ // Return early if Iris support is missing.
70
+ if ( ! $.support.iris ) {
71
+ return;
72
+ }
73
+
74
+ var self = this,
75
+ el = self.element;
76
+
77
+ // Override default options with options bound to the element.
78
+ $.extend( self.options, el.data() );
79
+
80
+ // Create a color picker which only allows adjustments to the hue.
81
+ if ( self.options.type === 'hue' ) {
82
+ return self._createHueOnly();
83
+ }
84
+
85
+ // Bind the close event.
86
+ self.close = $.proxy( self.close, self );
87
+
88
+ self.initialValue = el.val();
89
+
90
+ // Add a CSS class to the input field.
91
+ el.addClass( 'wp-color-picker' );
92
+
93
+ if ( _deprecated ) {
94
+ el.hide().wrap( _wrap );
95
+ self.wrap = el.parent();
96
+ self.toggler = $( _before )
97
+ .insertBefore( el )
98
+ .css( { backgroundColor : self.initialValue } )
99
+ .attr( 'title', wpColorPickerL10n.pick )
100
+ .attr( 'data-current', wpColorPickerL10n.current );
101
+ self.pickerContainer = $( _after ).insertAfter( el );
102
+ self.button = $( _button ).addClass('hidden');
103
+ } else {
104
+ /*
105
+ * Check if there's already a wrapping label, e.g. in the Customizer.
106
+ * If there's no label, add a default one to match the Customizer template.
107
+ */
108
+ if ( ! el.parent( 'label' ).length ) {
109
+ // Wrap the input field in the default label.
110
+ el.wrap( _wrappingLabel );
111
+ // Insert the default label text.
112
+ self.wrappingLabelText = $( _wrappingLabelText )
113
+ .insertBefore( el )
114
+ .text( wpColorPickerL10n.defaultLabel );
115
+ }
116
+
117
+ /*
118
+ * At this point, either it's the standalone version or the Customizer
119
+ * one, we have a wrapping label to use as hook in the DOM, let's store it.
120
+ */
121
+ self.wrappingLabel = el.parent();
122
+
123
+ // Wrap the label in the main wrapper.
124
+ self.wrappingLabel.wrap( _wrap );
125
+ // Store a reference to the main wrapper.
126
+ self.wrap = self.wrappingLabel.parent();
127
+ // Set up the toggle button and insert it before the wrapping label.
128
+ self.toggler = $( _before )
129
+ .insertBefore( self.wrappingLabel )
130
+ .css( { backgroundColor: self.initialValue } );
131
+ // Set the toggle button span element text.
132
+ self.toggler.find( '.wp-color-result-text' ).text( wpColorPickerL10n.pick );
133
+ // Set up the Iris container and insert it after the wrapping label.
134
+ self.pickerContainer = $( _after ).insertAfter( self.wrappingLabel );
135
+ // Store a reference to the Clear/Default button.
136
+ self.button = $( _button );
137
+ }
138
+
139
+ // Set up the Clear/Default button.
140
+ if ( self.options.defaultColor ) {
141
+ self.button.addClass( 'wp-picker-default' ).val( wpColorPickerL10n.defaultString );
142
+ if ( ! _deprecated ) {
143
+ self.button.attr( 'aria-label', wpColorPickerL10n.defaultAriaLabel );
144
+ }
145
+ } else {
146
+ self.button.addClass( 'wp-picker-clear' ).val( wpColorPickerL10n.clear );
147
+ if ( ! _deprecated ) {
148
+ self.button.attr( 'aria-label', wpColorPickerL10n.clearAriaLabel );
149
+ }
150
+ }
151
+
152
+ if ( _deprecated ) {
153
+ el.wrap( '<span class="wp-picker-input-wrap" />' ).after( self.button );
154
+ } else {
155
+ // Wrap the wrapping label in its wrapper and append the Clear/Default button.
156
+ self.wrappingLabel
157
+ .wrap( '<span class="wp-picker-input-wrap hidden" />' )
158
+ .after( self.button );
159
+
160
+ /*
161
+ * The input wrapper now contains the label+input+Clear/Default button.
162
+ * Store a reference to the input wrapper: we'll use this to toggle
163
+ * the controls visibility.
164
+ */
165
+ self.inputWrapper = el.closest( '.wp-picker-input-wrap' );
166
+ }
167
+
168
+ el.iris( {
169
+ target: self.pickerContainer,
170
+ hide: self.options.hide,
171
+ width: self.options.width,
172
+ mode: self.options.mode,
173
+ palettes: self.options.palettes,
174
+ /**
175
+ * @summary Handles the onChange event if one has been defined in the options.
176
+ *
177
+ * Handles the onChange event if one has been defined in the options and additionally
178
+ * sets the background color for the toggler element.
179
+ *
180
+ * @since 3.5.0
181
+ *
182
+ * @param {Event} event The event that's being called.
183
+ * @param {HTMLElement} ui The HTMLElement containing the color picker.
184
+ *
185
+ * @returns {void}
186
+ */
187
+ change: function( event, ui ) {
188
+ if ( self.options.alpha ) {
189
+ self.toggler.css( { 'background-image' : 'url(' + image + ')' } );
190
+ if ( _deprecated ) {
191
+ self.toggler.html( '<span class="color-alpha" />' );
192
+ } else {
193
+ self.toggler.css( {
194
+ 'position' : 'relative'
195
+ } );
196
+ if ( self.toggler.find('span.color-alpha').length == 0 ) {
197
+ self.toggler.append('<span class="color-alpha" />');
198
+ }
199
+ }
200
+
201
+ self.toggler.find( 'span.color-alpha' ).css( {
202
+ 'width' : '30px',
203
+ 'height' : '24px',
204
+ 'position' : 'absolute',
205
+ 'top' : 0,
206
+ 'left' : 0,
207
+ 'border-top-left-radius' : '2px',
208
+ 'border-bottom-left-radius' : '2px',
209
+ 'background' : ui.color.toString()
210
+ } );
211
+ } else {
212
+ self.toggler.css( { backgroundColor : ui.color.toString() } );
213
+ }
214
+
215
+ if ( $.isFunction( self.options.change ) ) {
216
+ self.options.change.call( this, event, ui );
217
+ }
218
+ }
219
+ } );
220
+
221
+ el.val( self.initialValue );
222
+ self._addListeners();
223
+
224
+ // Force the color picker to always be closed on initial load.
225
+ if ( ! self.options.hide ) {
226
+ self.toggler.click();
227
+ }
228
+ },
229
+ /**
230
+ * @summary Binds event listeners to the color picker.
231
+ *
232
+ * @since 3.5.0
233
+ *
234
+ * @access private
235
+ *
236
+ * @returns {void}
237
+ */
238
+ _addListeners: function() {
239
+ var self = this;
240
+
241
+ /**
242
+ * @summary Prevent any clicks inside this widget from leaking to the top and closing it.
243
+ *
244
+ * @since 3.5.0
245
+ *
246
+ * @param {Event} event The event that's being called.
247
+ *
248
+ * @returs {void}
249
+ */
250
+ self.wrap.on( 'click.wpcolorpicker', function( event ) {
251
+ event.stopPropagation();
252
+ });
253
+
254
+ /**
255
+ * @summary Open or close the color picker depending on the class.
256
+ *
257
+ * @since 3.5
258
+ */
259
+ self.toggler.click( function(){
260
+ if ( self.toggler.hasClass( 'wp-picker-open' ) ) {
261
+ self.close();
262
+ } else {
263
+ self.open();
264
+ }
265
+ });
266
+
267
+ /**
268
+ * @summary Checks if value is empty when changing the color in the color picker.
269
+ *
270
+ * Checks if value is empty when changing the color in the color picker.
271
+ * If so, the background color is cleared.
272
+ *
273
+ * @since 3.5.0
274
+ *
275
+ * @param {Event} event The event that's being called.
276
+ *
277
+ * @returns {void}
278
+ */
279
+ self.element.on( 'change', function( event ) {
280
+ // Empty or Error = clear
281
+ if ( $( this ).val() === '' || self.element.hasClass( 'iris-error' ) ) {
282
+ if ( self.options.alpha ) {
283
+ if ( _deprecated ) {
284
+ self.toggler.removeAttr( 'style' );
285
+ }
286
+ self.toggler.find( 'span.color-alpha' ).css( 'backgroundColor', '' );
287
+ } else {
288
+ self.toggler.css( 'backgroundColor', '' );
289
+ }
290
+
291
+ // fire clear callback if we have one
292
+ if ( $.isFunction( self.options.clear ) )
293
+ self.options.clear.call( this, event );
294
+ }
295
+ } );
296
+
297
+ /**
298
+ * @summary Enables the user to clear or revert the color in the color picker.
299
+ *
300
+ * Enables the user to either clear the color in the color picker or revert back to the default color.
301
+ *
302
+ * @since 3.5.0
303
+ *
304
+ * @param {Event} event The event that's being called.
305
+ *
306
+ * @returns {void}
307
+ */
308
+ self.button.on( 'click', function( event ) {
309
+ if ( $( this ).hasClass( 'wp-picker-clear' ) ) {
310
+ self.element.val( '' );
311
+ if ( self.options.alpha ) {
312
+ if ( _deprecated ) {
313
+ self.toggler.removeAttr( 'style' );
314
+ }
315
+ self.toggler.find( 'span.color-alpha' ).css( 'backgroundColor', '' );
316
+ } else {
317
+ self.toggler.css( 'backgroundColor', '' );
318
+ }
319
+
320
+ if ( $.isFunction( self.options.clear ) )
321
+ self.options.clear.call( this, event );
322
+
323
+ } else if ( $( this ).hasClass( 'wp-picker-default' ) ) {
324
+ self.element.val( self.options.defaultColor ).change();
325
+ }
326
+ });
327
+ },
328
+ });
329
+
330
+ /**
331
+ * Overwrite iris
332
+ */
333
+ $.widget( 'a8c.iris', $.a8c.iris, {
334
+ _create: function() {
335
+ this._super();
336
+
337
+ // Global option for check is mode rbga is enabled
338
+ this.options.alpha = this.element.data( 'alpha' ) || false;
339
+
340
+ // Is not input disabled
341
+ if ( ! this.element.is( ':input' ) )
342
+ this.options.alpha = false;
343
+
344
+ if ( typeof this.options.alpha !== 'undefined' && this.options.alpha ) {
345
+ var self = this,
346
+ el = self.element,
347
+ _html = '<div class="iris-strip iris-slider iris-alpha-slider"><div class="iris-slider-offset iris-slider-offset-alpha"></div></div>',
348
+ aContainer = $( _html ).appendTo( self.picker.find( '.iris-picker-inner' ) ),
349
+ aSlider = aContainer.find( '.iris-slider-offset-alpha' ),
350
+ controls = {
351
+ aContainer : aContainer,
352
+ aSlider : aSlider
353
+ };
354
+
355
+ if ( typeof el.data( 'custom-width' ) !== 'undefined' ) {
356
+ self.options.customWidth = parseInt( el.data( 'custom-width' ) ) || 0;
357
+ } else {
358
+ self.options.customWidth = 100;
359
+ }
360
+
361
+ // Set default width for input reset
362
+ self.options.defaultWidth = el.width();
363
+
364
+ // Update width for input
365
+ if ( self._color._alpha < 1 || self._color.toString().indexOf('rgb') != -1 )
366
+ el.width( parseInt( self.options.defaultWidth + self.options.customWidth ) );
367
+
368
+ // Push new controls
369
+ $.each( controls, function( k, v ) {
370
+ self.controls[k] = v;
371
+ } );
372
+
373
+ // Change size strip and add margin for sliders
374
+ self.controls.square.css( { 'margin-right': '0' } );
375
+ var emptyWidth = ( self.picker.width() - self.controls.square.width() - 20 ),
376
+ stripsMargin = ( emptyWidth / 6 ),
377
+ stripsWidth = ( ( emptyWidth / 2 ) - stripsMargin );
378
+
379
+ $.each( [ 'aContainer', 'strip' ], function( k, v ) {
380
+ self.controls[v].width( stripsWidth ).css( { 'margin-left' : stripsMargin + 'px' } );
381
+ } );
382
+
383
+ // Add new slider
384
+ self._initControls();
385
+
386
+ // For updated widget
387
+ self._change();
388
+ }
389
+ },
390
+ _initControls: function() {
391
+ this._super();
392
+
393
+ if ( this.options.alpha ) {
394
+ var self = this,
395
+ controls = self.controls;
396
+
397
+ controls.aSlider.slider({
398
+ orientation : 'vertical',
399
+ min : 0,
400
+ max : 100,
401
+ step : 1,
402
+ value : parseInt( self._color._alpha * 100 ),
403
+ slide : function( event, ui ) {
404
+ // Update alpha value
405
+ self._color._alpha = parseFloat( ui.value / 100 );
406
+ self._change.apply( self, arguments );
407
+ }
408
+ });
409
+ }
410
+ },
411
+ _change: function() {
412
+ this._super();
413
+
414
+ var self = this,
415
+ el = self.element;
416
+
417
+ if ( this.options.alpha ) {
418
+ var controls = self.controls,
419
+ alpha = parseInt( self._color._alpha * 100 ),
420
+ color = self._color.toRgb(),
421
+ gradient = [
422
+ 'rgb(' + color.r + ',' + color.g + ',' + color.b + ') 0%',
423
+ 'rgba(' + color.r + ',' + color.g + ',' + color.b + ', 0) 100%'
424
+ ],
425
+ defaultWidth = self.options.defaultWidth,
426
+ customWidth = self.options.customWidth,
427
+ target = self.picker.closest( '.wp-picker-container' ).find( '.wp-color-result' );
428
+
429
+ // Generate background slider alpha, only for CSS3 old browser fuck!! :)
430
+ controls.aContainer.css( { 'background' : 'linear-gradient(to bottom, ' + gradient.join( ', ' ) + '), url(' + image + ')' } );
431
+
432
+ if ( target.hasClass( 'wp-picker-open' ) ) {
433
+ // Update alpha value
434
+ controls.aSlider.slider( 'value', alpha );
435
+
436
+ /**
437
+ * Disabled change opacity in default slider Saturation ( only is alpha enabled )
438
+ * and change input width for view all value
439
+ */
440
+ if ( self._color._alpha < 1 ) {
441
+ controls.strip.attr( 'style', controls.strip.attr( 'style' ).replace( /rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g, 'rgb($1$3$5)' ) );
442
+ el.width( parseInt( defaultWidth + customWidth ) );
443
+ } else {
444
+ el.width( defaultWidth );
445
+ }
446
+ }
447
+ }
448
+
449
+ var reset = el.data( 'reset-alpha' ) || false;
450
+
451
+ if ( reset ) {
452
+ self.picker.find( '.iris-palette-container' ).on( 'click.palette', '.iris-palette', function() {
453
+ self._color._alpha = 1;
454
+ self.active = 'external';
455
+ self._change();
456
+ } );
457
+ }
458
+ },
459
+ _addInputListeners: function( input ) {
460
+ var self = this,
461
+ debounceTimeout = 100,
462
+ callback = function( event ) {
463
+ var color = new Color( input.val() ),
464
+ val = input.val();
465
+
466
+ input.removeClass( 'iris-error' );
467
+ // we gave a bad color
468
+ if ( color.error ) {
469
+ // don't error on an empty input
470
+ if ( val !== '' )
471
+ input.addClass( 'iris-error' );
472
+ } else {
473
+ if ( color.toString() !== self._color.toString() ) {
474
+ // let's not do this on keyup for hex shortcodes
475
+ if ( ! ( event.type === 'keyup' && val.match( /^[0-9a-fA-F]{3}$/ ) ) )
476
+ self._setOption( 'color', color.toString() );
477
+ }
478
+ }
479
+ };
480
+
481
+ input.on( 'change', callback ).on( 'keyup', self._debounce( callback, debounceTimeout ) );
482
+
483
+ // If we initialized hidden, show on first focus. The rest is up to you.
484
+ if ( self.options.hide ) {
485
+ input.on( 'focus', function() {
486
+ self.show();
487
+ } );
488
+ }
489
+ }
490
+ } );
491
+ }( jQuery ) );
492
+
493
+ // Auto Call plugin is class is color-picker
494
+ jQuery( document ).ready( function( $ ) {
495
+ $( '.color-picker' ).wpColorPicker();
496
+ } );
inc/exopite-simple-options/assets/editors/ace/ace.js ADDED
@@ -0,0 +1,18 @@
 
1
+ (function(){function o(n){var i=e;n&&(e[n]||(e[n]={}),i=e[n]);if(!i.define||!i.define.packaged)t.original=i.define,i.define=t,i.define.packaged=!0;if(!i.require||!i.require.packaged)r.original=i.require,i.require=r,i.require.packaged=!0}var ACE_NAMESPACE = "ace",e=function(){return this}();!e&&typeof window!="undefined"&&(e=window);if(!ACE_NAMESPACE&&typeof requirejs!="undefined")return;var t=function(e,n,r){if(typeof e!="string"){t.original?t.original.apply(this,arguments):(console.error("dropping module because define wasn't a string."),console.trace());return}arguments.length==2&&(r=n),t.modules[e]||(t.payloads[e]=r,t.modules[e]=null)};t.modules={},t.payloads={};var n=function(e,t,n){if(typeof t=="string"){var i=s(e,t);if(i!=undefined)return n&&n(),i}else if(Object.prototype.toString.call(t)==="[object Array]"){var o=[];for(var u=0,a=t.length;u<a;++u){var f=s(e,t[u]);if(f==undefined&&r.original)return;o.push(f)}return n&&n.apply(null,o)||!0}},r=function(e,t){var i=n("",e,t);return i==undefined&&r.original?r.original.apply(this,arguments):i},i=function(e,t){if(t.indexOf("!")!==-1){var n=t.split("!");return i(e,n[0])+"!"+i(e,n[1])}if(t.charAt(0)=="."){var r=e.split("/").slice(0,-1).join("/");t=r+"/"+t;while(t.indexOf(".")!==-1&&s!=t){var s=t;t=t.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return t},s=function(e,r){r=i(e,r);var s=t.modules[r];if(!s){s=t.payloads[r];if(typeof s=="function"){var o={},u={id:r,uri:"",exports:o,packaged:!0},a=function(e,t){return n(r,e,t)},f=s(a,o,u);o=f||u.exports,t.modules[r]=o,delete t.payloads[r]}s=t.modules[r]=o||s}return s};o(ACE_NAMESPACE)})(),ace.define("ace/lib/regexp",["require","exports","module"],function(e,t,n){"use strict";function o(e){return(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.extended?"x":"")+(e.sticky?"y":"")}function u(e,t,n){if(Array.prototype.indexOf)return e.indexOf(t,n);for(var r=n||0;r<e.length;r++)if(e[r]===t)return r;return-1}var r={exec:RegExp.prototype.exec,test:RegExp.prototype.test,match:String.prototype.match,replace:String.prototype.replace,split:String.prototype.split},i=r.exec.call(/()??/,"")[1]===undefined,s=function(){var e=/^/g;return r.test.call(e,""),!e.lastIndex}();if(s&&i)return;RegExp.prototype.exec=function(e){var t=r.exec.apply(this,arguments),n,a;if(typeof e=="string"&&t){!i&&t.length>1&&u(t,"")>-1&&(a=RegExp(this.source,r.replace.call(o(this),"g","")),r.replace.call(e.slice(t.index),a,function(){for(var e=1;e<arguments.length-2;e++)arguments[e]===undefined&&(t[e]=undefined)}));if(this._xregexp&&this._xregexp.captureNames)for(var f=1;f<t.length;f++)n=this._xregexp.captureNames[f-1],n&&(t[n]=t[f]);!s&&this.global&&!t[0].length&&this.lastIndex>t.index&&this.lastIndex--}return t},s||(RegExp.prototype.test=function(e){var t=r.exec.call(this,e);return t&&this.global&&!t[0].length&&this.lastIndex>t.index&&this.lastIndex--,!!t})}),ace.define("ace/lib/es5-shim",["require","exports","module"],function(e,t,n){function r(){}function w(e){try{return Object.defineProperty(e,"sentinel",{}),"sentinel"in e}catch(t){}}function H(e){return e=+e,e!==e?e=0:e!==0&&e!==1/0&&e!==-1/0&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function B(e){var t=typeof e;return e===null||t==="undefined"||t==="boolean"||t==="number"||t==="string"}function j(e){var t,n,r;if(B(e))return e;n=e.valueOf;if(typeof n=="function"){t=n.call(e);if(B(t))return t}r=e.toString;if(typeof r=="function"){t=r.call(e);if(B(t))return t}throw new TypeError}Function.prototype.bind||(Function.prototype.bind=function(t){var n=this;if(typeof n!="function")throw new TypeError("Function.prototype.bind called on incompatible "+n);var i=u.call(arguments,1),s=function(){if(this instanceof s){var e=n.apply(this,i.concat(u.call(arguments)));return Object(e)===e?e:this}return n.apply(t,i.concat(u.call(arguments)))};return n.prototype&&(r.prototype=n.prototype,s.prototype=new r,r.prototype=null),s});var i=Function.prototype.call,s=Array.prototype,o=Object.prototype,u=s.slice,a=i.bind(o.toString),f=i.bind(o.hasOwnProperty),l,c,h,p,d;if(d=f(o,"__defineGetter__"))l=i.bind(o.__defineGetter__),c=i.bind(o.__defineSetter__),h=i.bind(o.__lookupGetter__),p=i.bind(o.__lookupSetter__);if([1,2].splice(0).length!=2)if(!function(){function e(e){var t=new Array(e+2);return t[0]=t[1]=0,t}var t=[],n;t.splice.apply(t,e(20)),t.splice.apply(t,e(26)),n=t.length,t.splice(5,0,"XXX"),n+1==t.length;if(n+1==t.length)return!0}())Array.prototype.splice=function(e,t){var n=this.length;e>0?e>n&&(e=n):e==void 0?e=0:e<0&&(e=Math.max(n+e,0)),e+t<n||(t=n-e);var r=this.slice(e,e+t),i=u.call(arguments,2),s=i.length;if(e===n)s&&this.push.apply(this,i);else{var o=Math.min(t,n-e),a=e+o,f=a+s-o,l=n-a,c=n-o;if(f<a)for(var h=0;h<l;++h)this[f+h]=this[a+h];else if(f>a)for(h=l;h--;)this[f+h]=this[a+h];if(s&&e===c)this.length=c,this.push.apply(this,i);else{this.length=c+s;for(h=0;h<s;++h)this[e+h]=i[h]}}return r};else{var v=Array.prototype.splice;Array.prototype.splice=function(e,t){return arguments.length?v.apply(this,[e===void 0?0:e,t===void 0?this.length-e:t].concat(u.call(arguments,2))):[]}}Array.isArray||(Array.isArray=function(t){return a(t)=="[object Array]"});var m=Object("a"),g=m[0]!="a"||!(0 in m);Array.prototype.forEach||(Array.prototype.forEach=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=arguments[1],s=-1,o=r.length>>>0;if(a(t)!="[object Function]")throw new TypeError;while(++s<o)s in r&&t.call(i,r[s],s,n)}),Array.prototype.map||(Array.prototype.map=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=r.length>>>0,s=Array(i),o=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var u=0;u<i;u++)u in r&&(s[u]=t.call(o,r[u],u,n));return s}),Array.prototype.filter||(Array.prototype.filter=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=r.length>>>0,s=[],o,u=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var f=0;f<i;f++)f in r&&(o=r[f],t.call(u,o,f,n)&&s.push(o));return s}),Array.prototype.every||(Array.prototype.every=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=r.length>>>0,s=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var o=0;o<i;o++)if(o in r&&!t.call(s,r[o],o,n))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=r.length>>>0,s=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var o=0;o<i;o++)if(o in r&&t.call(s,r[o],o,n))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=r.length>>>0;if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");if(!i&&arguments.length==1)throw new TypeError("reduce of empty array with no initial value");var s=0,o;if(arguments.length>=2)o=arguments[1];else do{if(s in r){o=r[s++];break}if(++s>=i)throw new TypeError("reduce of empty array with no initial value")}while(!0);for(;s<i;s++)s in r&&(o=t.call(void 0,o,r[s],s,n));return o}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=r.length>>>0;if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");if(!i&&arguments.length==1)throw new TypeError("reduceRight of empty array with no initial value");var s,o=i-1;if(arguments.length>=2)s=arguments[1];else do{if(o in r){s=r[o--];break}if(--o<0)throw new TypeError("reduceRight of empty array with no initial value")}while(!0);do o in this&&(s=t.call(void 0,s,r[o],o,n));while(o--);return s});if(!Array.prototype.indexOf||[0,1].indexOf(1,2)!=-1)Array.prototype.indexOf=function(t){var n=g&&a(this)=="[object String]"?this.split(""):F(this),r=n.length>>>0;if(!r)return-1;var i=0;arguments.length>1&&(i=H(arguments[1])),i=i>=0?i:Math.max(0,r+i);for(;i<r;i++)if(i in n&&n[i]===t)return i;return-1};if(!Array.prototype.lastIndexOf||[0,1].lastIndexOf(0,-3)!=-1)Array.prototype.lastIndexOf=function(t){var n=g&&a(this)=="[object String]"?this.split(""):F(this),r=n.length>>>0;if(!r)return-1;var i=r-1;arguments.length>1&&(i=Math.min(i,H(arguments[1]))),i=i>=0?i:r-Math.abs(i);for(;i>=0;i--)if(i in n&&t===n[i])return i;return-1};Object.getPrototypeOf||(Object.getPrototypeOf=function(t){return t.__proto__||(t.constructor?t.constructor.prototype:o)});if(!Object.getOwnPropertyDescriptor){var y="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function(t,n){if(typeof t!="object"&&typeof t!="function"||t===null)throw new TypeError(y+t);if(!f(t,n))return;var r,i,s;r={enumerable:!0,configurable:!0};if(d){var u=t.__proto__;t.__proto__=o;var i=h(t,n),s=p(t,n);t.__proto__=u;if(i||s)return i&&(r.get=i),s&&(r.set=s),r}return r.value=t[n],r}}Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(t){return Object.keys(t)});if(!Object.create){var b;Object.prototype.__proto__===null?b=function(){return{__proto__:null}}:b=function(){var e={};for(var t in e)e[t]=null;return e.constructor=e.hasOwnProperty=e.propertyIsEnumerable=e.isPrototypeOf=e.toLocaleString=e.toString=e.valueOf=e.__proto__=null,e},Object.create=function(t,n){var r;if(t===null)r=b();else{if(typeof t!="object")throw new TypeError("typeof prototype["+typeof t+"] != 'object'");var i=function(){};i.prototype=t,r=new i,r.__proto__=t}return n!==void 0&&Object.defineProperties(r,n),r}}if(Object.defineProperty){var E=w({}),S=typeof document=="undefined"||w(document.createElement("div"));if(!E||!S)var x=Object.defineProperty}if(!Object.defineProperty||x){var T="Property description must be an object: ",N="Object.defineProperty called on non-object: ",C="getters & setters can not be defined on this javascript engine";Object.defineProperty=function(t,n,r){if(typeof t!="object"&&typeof t!="function"||t===null)throw new TypeError(N+t);if(typeof r!="object"&&typeof r!="function"||r===null)throw new TypeError(T+r);if(x)try{return x.call(Object,t,n,r)}catch(i){}if(f(r,"value"))if(d&&(h(t,n)||p(t,n))){var s=t.__proto__;t.__proto__=o,delete t[n],t[n]=r.value,t.__proto__=s}else t[n]=r.value;else{if(!d)throw new TypeError(C);f(r,"get")&&l(t,n,r.get),f(r,"set")&&c(t,n,r.set)}return t}}Object.defineProperties||(Object.defineProperties=function(t,n){for(var r in n)f(n,r)&&Object.defineProperty(t,r,n[r]);return t}),Object.seal||(Object.seal=function(t){return t}),Object.freeze||(Object.freeze=function(t){return t});try{Object.freeze(function(){})}catch(k){Object.freeze=function(t){return function(n){return typeof n=="function"?n:t(n)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(t){return t}),Object.isSealed||(Object.isSealed=function(t){return!1}),Object.isFrozen||(Object.isFrozen=function(t){return!1}),Object.isExtensible||(Object.isExtensible=function(t){if(Object(t)===t)throw new TypeError;var n="";while(f(t,n))n+="?";t[n]=!0;var r=f(t,n);return delete t[n],r});if(!Object.keys){var L=!0,A=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],O=A.length;for(var M in{toString:null})L=!1;Object.keys=function I(e){if(typeof e!="object"&&typeof e!="function"||e===null)throw new TypeError("Object.keys called on a non-object");var I=[];for(var t in e)f(e,t)&&I.push(t);if(L)for(var n=0,r=O;n<r;n++){var i=A[n];f(e,i)&&I.push(i)}return I}}Date.now||(Date.now=function(){return(new Date).getTime()});var _=" \n\x0b\f\r \u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\ufeff";if(!String.prototype.trim||_.trim()){_="["+_+"]";var D=new RegExp("^"+_+_+"*"),P=new RegExp(_+_+"*$");String.prototype.trim=function(){return String(this).replace(D,"").replace(P,"")}}var F=function(e){if(e==null)throw new TypeError("can't convert "+e+" to object");return Object(e)}}),ace.define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/regexp","ace/lib/es5-shim"],function(e,t,n){"use strict";e("./regexp"),e("./es5-shim"),typeof Element!="undefined"&&!Element.prototype.remove&&Object.defineProperty(Element.prototype,"remove",{enumerable:!1,writable:!0,configurable:!0,value:function(){this.parentNode&&this.parentNode.removeChild(this)}})}),ace.define("ace/lib/useragent",["require","exports","module"],function(e,t,n){"use strict";t.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},t.getOS=function(){return t.isMac?t.OS.MAC:t.isLinux?t.OS.LINUX:t.OS.WINDOWS};if(typeof navigator!="object")return;var r=(navigator.platform.match(/mac|win|linux/i)||["other"])[0].toLowerCase(),i=navigator.userAgent;t.isWin=r=="win",t.isMac=r=="mac",t.isLinux=r=="linux",t.isIE=navigator.appName=="Microsoft Internet Explorer"||navigator.appName.indexOf("MSAppHost")>=0?parseFloat((i.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]):parseFloat((i.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]),t.isOldIE=t.isIE&&t.isIE<9,t.isGecko=t.isMozilla=i.match(/ Gecko\/\d+/),t.isOpera=window.opera&&Object.prototype.toString.call(window.opera)=="[object Opera]",t.isWebKit=parseFloat(i.split("WebKit/")[1])||undefined,t.isChrome=parseFloat(i.split(" Chrome/")[1])||undefined,t.isEdge=parseFloat(i.split(" Edge/")[1])||undefined,t.isAIR=i.indexOf("AdobeAIR")>=0,t.isIPad=i.indexOf("iPad")>=0,t.isAndroid=i.indexOf("Android")>=0,t.isChromeOS=i.indexOf(" CrOS ")>=0,t.isIOS=/iPad|iPhone|iPod/.test(i)&&!window.MSStream,t.isIOS&&(t.isMac=!0),t.isMobile=t.isIPad||t.isAndroid}),ace.define("ace/lib/dom",["require","exports","module","ace/lib/useragent"],function(e,t,n){"use strict";var r=e("./useragent"),i="http://www.w3.org/1999/xhtml";t.buildDom=function o(e,t,n){if(typeof e=="string"&&e){var r=document.createTextNode(e);return t&&t.appendChild(r),r}if(!Array.isArray(e))return e;if(typeof e[0]!="string"||!e[0]){var i=[];for(var s=0;s<e.length;s++){var u=o(e[s],t,n);u&&i.push(u)}return i}var a=document.createElement(e[0]),f=e[1],l=1;f&&typeof f=="object"&&!Array.isArray(f)&&(l=2);for(var s=l;s<e.length;s++)o(e[s],a,n);return l==2&&Object.keys(f).forEach(function(e){var t=f[e];e==="class"?a.className=Array.isArray(t)?t.join(" "):t:typeof t=="function"||e=="value"?a[e]=t:e==="ref"?n&&(n[t]=a):t!=null&&a.setAttribute(e,t)}),t&&t.appendChild(a),a},t.getDocumentHead=function(e){return e||(e=document),e.head||e.getElementsByTagName("head")[0]||e.documentElement},t.createElement=function(e,t){return document.createElementNS?document.createElementNS(t||i,e):document.createElement(e)},t.removeChildren=function(e){e.innerHTML=""},t.createTextNode=function(e,t){var n=t?t.ownerDocument:document;return n.createTextNode(e)},t.createFragment=function(e){var t=e?e.ownerDocument:document;return t.createDocumentFragment()},t.hasCssClass=function(e,t){var n=(e.className+"").split(/\s+/g);return n.indexOf(t)!==-1},t.addCssClass=function(e,n){t.hasCssClass(e,n)||(e.className+=" "+n)},t.removeCssClass=function(e,t){var n=e.className.split(/\s+/g);for(;;){var r=n.indexOf(t);if(r==-1)break;n.splice(r,1)}e.className=n.join(" ")},t.toggleCssClass=function(e,t){var n=e.className.split(/\s+/g),r=!0;for(;;){var i=n.indexOf(t);if(i==-1)break;r=!1,n.splice(i,1)}return r&&n.push(t),e.className=n.join(" "),r},t.setCssClass=function(e,n,r){r?t.addCssClass(e,n):t.removeCssClass(e,n)},t.hasCssString=function(e,t){var n=0,r;t=t||document;if(r=t.querySelectorAll("style"))while(n<r.length)if(r[n++].id===e)return!0},t.importCssString=function(n,r,i){var s=i&&i.getRootNode?i.getRootNode():document,o=s.ownerDocument||s;if(r&&t.hasCssString(r,s))return null;r&&(n+="\n/*# sourceURL=ace/css/"+r+" */");var u=t.createElement("style");u.appendChild(o.createTextNode(n)),r&&(u.id=r),s==o&&(s=t.getDocumentHead(o)),s.insertBefore(u,s.firstChild)},t.importCssStylsheet=function(e,n){t.buildDom(["link",{rel:"stylesheet",href:e}],t.getDocumentHead(n))},t.scrollbarWidth=function(e){var n=t.createElement("ace_inner");n.style.width="100%",n.style.minWidth="0px",n.style.height="200px",n.style.display="block";var r=t.createElement("ace_outer"),i=r.style;i.position="absolute",i.left="-10000px",i.overflow="hidden",i.width="200px",i.minWidth="0px",i.height="150px",i.display="block",r.appendChild(n);var s=e.documentElement;s.appendChild(r);var o=n.offsetWidth;i.overflow="scroll";var u=n.offsetWidth;return o==u&&(u=r.clientWidth),s.removeChild(r),o-u},typeof document=="undefined"&&(t.importCssString=function(){}),t.computedStyle=function(e,t){return window.getComputedStyle(e,"")||{}},t.setStyle=function(e,t,n){e[t]!==n&&(e[t]=n)},t.HAS_CSS_ANIMATION=!1,t.HAS_CSS_TRANSFORMS=!1,t.HI_DPI=r.isWin?typeof window!="undefined"&&window.devicePixelRatio>=1.5:!0;if(typeof document!="undefined"){var s=document.createElement("div");t.HI_DPI&&s.style.transform!==undefined&&(t.HAS_CSS_TRANSFORMS=!0),!r.isEdge&&typeof s.style.animationName!="undefined"&&(t.HAS_CSS_ANIMATION=!0),s=null}t.HAS_CSS_TRANSFORMS?t.translate=function(e,t,n){e.style.transform="translate("+Math.round(t)+"px, "+Math.round(n)+"px)"}:t.translate=function(e,t,n){e.style.top=Math.round(n)+"px",e.style.left=Math.round(t)+"px"}}),ace.define("ace/lib/oop",["require","exports","module"],function(e,t,n){"use strict";t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var n in t)e[n]=t[n];return e},t.implement=function(e,n){t.mixin(e,n)}}),ace.define("ace/lib/keys",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/oop"],function(e,t,n){"use strict";e("./fixoldbrowsers");var r=e("./oop"),i=function(){var e={MODIFIER_KEYS:{16:"Shift",17:"Ctrl",18:"Alt",224:"Meta"},KEY_MODS:{ctrl:1,alt:2,option:2,shift:4,"super":8,meta:8,command:8,cmd:8},FUNCTION_KEYS:{8:"Backspace",9:"Tab",13:"Return",19:"Pause",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"Print",45:"Insert",46:"Delete",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9","-13":"NumpadEnter",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"Numlock",145:"Scrolllock"},PRINTABLE_KEYS:{32:" ",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",107:"+",109:"-",110:".",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",111:"/",106:"*"}},t,n;for(n in e.FUNCTION_KEYS)t=e.FUNCTION_KEYS[n].toLowerCase(),e[t]=parseInt(n,10);for(n in e.PRINTABLE_KEYS)t=e.PRINTABLE_KEYS[n].toLowerCase(),e[t]=parseInt(n,10);return r.mixin(e,e.MODIFIER_KEYS),r.mixin(e,e.PRINTABLE_KEYS),r.mixin(e,e.FUNCTION_KEYS),e.enter=e["return"],e.escape=e.esc,e.del=e["delete"],e[173]="-",function(){var t=["cmd","ctrl","alt","shift"];for(var n=Math.pow(2,t.length);n--;)e.KEY_MODS[n]=t.filter(function(t){return n&e.KEY_MODS[t]}).join("-")+"-"}(),e.KEY_MODS[0]="",e.KEY_MODS[-1]="input-",e}();r.mixin(t,i),t.keyCodeToString=function(e){var t=i[e];return typeof t!="string"&&(t=String.fromCharCode(e)),t.toLowerCase()}}),ace.define("ace/lib/event",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(e,t,n){"use strict";function a(e,t,n){var a=u(t);if(!i.isMac&&s){t.getModifierState&&(t.getModifierState("OS")||t.getModifierState("Win"))&&(a|=8);if(s.altGr){if((3&a)==3)return;s.altGr=0}if(n===18||n===17){var f="location"in t?t.location:t.keyLocation;if(n===17&&f===1)s[n]==1&&(o=t.timeStamp);else if(n===18&&a===3&&f===2){var l=t.timeStamp-o;l<50&&(s.altGr=!0)}}}n in r.MODIFIER_KEYS&&(n=-1),a&8&&n>=91&&n<=93&&(n=-1);if(!a&&n===13){var f="location"in t?t.location:t.keyLocation;if(f===3){e(t,a,-n);if(t.defaultPrevented)return}}if(i.isChromeOS&&a&8){e(t,a,n);if(t.defaultPrevented)return;a&=-9}return!!a||n in r.FUNCTION_KEYS||n in r.PRINTABLE_KEYS?e(t,a,n):!1}function f(){s=Object.create(null)}var r=e("./keys"),i=e("./useragent"),s=null,o=0;t.addListener=function(e,t,n){if(e.addEventListener)return e.addEventListener(t,n,!1);if(e.attachEvent){var r=function(){n.call(e,window.event)};n._wrapper=r,e.attachEvent("on"+t,r)}},t.removeListener=function(e,t,n){if(e.removeEventListener)return e.removeEventListener(t,n,!1);e.detachEvent&&e.detachEvent("on"+t,n._wrapper||n)},t.stopEvent=function(e){return t.stopPropagation(e),t.preventDefault(e),!1},t.stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},t.preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},t.getButton=function(e){return e.type=="dblclick"?0:e.type=="contextmenu"||i.isMac&&e.ctrlKey&&!e.altKey&&!e.shiftKey?2:e.preventDefault?e.button:{1:0,2:2,4:1}[e.button]},t.capture=function(e,n,r){function i(e){n&&n(e),r&&r(e),t.removeListener(document,"mousemove",n,!0),t.removeListener(document,"mouseup",i,!0),t.removeListener(document,"dragstart",i,!0)}return t.addListener(document,"mousemove",n,!0),t.addListener(document,"mouseup",i,!0),t.addListener(document,"dragstart",i,!0),i},t.addTouchMoveListener=function(e,n){var r,i;t.addListener(e,"touchstart",function(e){var t=e.touches,n=t[0];r=n.clientX,i=n.clientY}),t.addListener(e,"touchmove",function(e){var t=e.touches;if(t.length>1)return;var s=t[0];e.wheelX=r-s.clientX,e.wheelY=i-s.clientY,r=s.clientX,i=s.clientY,n(e)})},t.addMouseWheelListener=function(e,n){"onmousewheel"in e?t.addListener(e,"mousewheel",function(e){var t=8;e.wheelDeltaX!==undefined?(e.wheelX=-e.wheelDeltaX/t,e.wheelY=-e.wheelDeltaY/t):(e.wheelX=0,e.wheelY=-e.wheelDelta/t),n(e)}):"onwheel"in e?t.addListener(e,"wheel",function(e){var t=.35;switch(e.deltaMode){case e.DOM_DELTA_PIXEL:e.wheelX=e.deltaX*t||0,e.wheelY=e.deltaY*t||0;break;case e.DOM_DELTA_LINE:case e.DOM_DELTA_PAGE:e.wheelX=(e.deltaX||0)*5,e.wheelY=(e.deltaY||0)*5}n(e)}):t.addListener(e,"DOMMouseScroll",function(e){e.axis&&e.axis==e.HORIZONTAL_AXIS?(e.wheelX=(e.detail||0)*5,e.wheelY=0):(e.wheelX=0,e.wheelY=(e.detail||0)*5),n(e)})},t.addMultiMouseDownListener=function(e,n,r,s){function c(e){t.getButton(e)!==0?o=0:e.detail>1?(o++,o>4&&(o=1)):o=1;if(i.isIE){var c=Math.abs(e.clientX-u)>5||Math.abs(e.clientY-a)>5;if(!f||c)o=1;f&&clearTimeout(f),f=setTimeout(function(){f=null},n[o-1]||600),o==1&&(u=e.clientX,a=e.clientY)}e._clicks=o,r[s]("mousedown",e);if(o>4)o=0;else if(o>1)return r[s](l[o],e)}function h(e){o=2,f&&clearTimeout(f),f=setTimeout(function(){f=null},n[o-1]||600),r[s]("mousedown",e),r[s](l[o],e)}var o=0,u,a,f,l={2:"dblclick",3:"tripleclick",4:"quadclick"};Array.isArray(e)||(e=[e]),e.forEach(function(e){t.addListener(e,"mousedown",c),i.isOldIE&&t.addListener(e,"dblclick",h)})};var u=!i.isMac||!i.isOpera||"KeyboardEvent"in window?function(e){return 0|(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0)}:function(e){return 0|(e.metaKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.ctrlKey?8:0)};t.getModifierString=function(e){return r.KEY_MODS[u(e)]},t.addCommandKeyListener=function(e,n){var r=t.addListener;if(i.isOldGecko||i.isOpera&&!("KeyboardEvent"in window)){var o=null;r(e,"keydown",function(e){o=e.keyCode}),r(e,"keypress",function(e){return a(n,e,o)})}else{var u=null;r(e,"keydown",function(e){s[e.keyCode]=(s[e.keyCode]||0)+1;var t=a(n,e,e.keyCode);return u=e.defaultPrevented,t}),r(e,"keypress",function(e){u&&(e.ctrlKey||e.altKey||e.shiftKey||e.metaKey)&&(t.stopEvent(e),u=null)}),r(e,"keyup",function(e){s[e.keyCode]=null}),s||(f(),r(window,"focus",f))}};if(typeof window=="object"&&window.postMessage&&!i.isOldIE){var l=1;t.nextTick=function(e,n){n=n||window;var r="zero-timeout-message-"+l++,i=function(s){s.data==r&&(t.stopPropagation(s),t.removeListener(n,"message",i),e())};t.addListener(n,"message",i),n.postMessage(r,"*")}}t.$idleBlocked=!1,t.onIdle=function(e,n){return setTimeout(function r(){t.$idleBlocked?setTimeout(r,100):e()},n)},t.$idleBlockId=null,t.blockIdle=function(e){t.$idleBlockId&&clearTimeout(t.$idleBlockId),t.$idleBlocked=!0,t.$idleBlockId=setTimeout(function(){t.$idleBlocked=!1},e||100)},t.nextFrame=typeof window=="object"&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame),t.nextFrame?t.nextFrame=t.nextFrame.bind(window):t.nextFrame=function(e){setTimeout(e,17)}}),ace.define("ace/range",["require","exports","module"],function(e,t,n){"use strict";var r=function(e,t){return e.row-t.row||e.column-t.column},i=function(e,t,n,r){this.start={row:e,column:t},this.end={row:n,column:r}};(function(){this.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},this.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(e,t){return this.compare(e,t)==0},this.compareRange=function(e){var t,n=e.end,r=e.start;return t=this.compare(n.row,n.column),t==1?(t=this.compare(r.row,r.column),t==1?2:t==0?1:0):t==-1?-2:(t=this.compare(r.row,r.column),t==-1?-1:t==1?42:0)},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return this.comparePoint(e.start)==0&&this.comparePoint(e.end)==0},this.intersects=function(e){var t=this.compareRange(e);return t==-1||t==0||t==1},this.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},this.isStart=function(e,t){return this.start.row==e&&this.start.column==t},this.setStart=function(e,t){typeof e=="object"?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){typeof e=="object"?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)||this.isStart(e,t)?!1:!0:!1},this.insideStart=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)?!1:!0:!1},this.insideEnd=function(e,t){return this.compare(e,t)==0?this.isStart(e,t)?!1:!0:!1},this.compare=function(e,t){return!this.isMultiLine()&&e===this.start.row?t<this.start.column?-1:t>this.end.column?1:0:e<this.start.row?-1:e>this.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0},this.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},this.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.clipRows=function(e,t){if(this.end.row>t)var n={row:t+1,column:0};else if(this.end.row<e)var n={row:e,column:0};if(this.start.row>t)var r={row:t+1,column:0};else if(this.start.row<e)var r={row:e,column:0};return i.fromPoints(r||this.start,n||this.end)},this.extend=function(e,t){var n=this.compare(e,t);if(n==0)return this;if(n==-1)var r={row:e,column:t};else var s={row:e,column:t};return i.fromPoints(r||this.start,s||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return i.fromPoints(this.start,this.end)},this.collapseRows=function(){return this.end.column==0?new i(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new i(this.start.row,0,this.end.row,0)},this.toScreenRange=function(e){var t=e.documentToScreenPosition(this.start),n=e.documentToScreenPosition(this.end);return new i(t.row,t.column,n.row,n.column)},this.moveBy=function(e,t){this.start.row+=e,this.start.column+=t,this.end.row+=e,this.end.column+=t}}).call(i.prototype),i.fromPoints=function(e,t){return new i(e.row,e.column,t.row,t.column)},i.comparePoints=r,i.comparePoints=function(e,t){return e.row-t.row||e.column-t.column},t.Range=i}),ace.define("ace/lib/lang",["require","exports","module"],function(e,t,n){"use strict";t.last=function(e){return e[e.length-1]},t.stringReverse=function(e){return e.split("").reverse().join("")},t.stringRepeat=function(e,t){var n="";while(t>0){t&1&&(n+=e);if(t>>=1)e+=e}return n};var r=/^\s\s*/,i=/\s\s*$/;t.stringTrimLeft=function(e){return e.replace(r,"")},t.stringTrimRight=function(e){return e.replace(i,"")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){var t=[];for(var n=0,r=e.length;n<r;n++)e[n]&&typeof e[n]=="object"?t[n]=this.copyObject(e[n]):t[n]=e[n];return t},t.deepCopy=function s(e){if(typeof e!="object"||!e)return e;var t;if(Array.isArray(e)){t=[];for(var n=0;n<e.length;n++)t[n]=s(e[n]);return t}if(Object.prototype.toString.call(e)!=="[object Object]")return e;t={};for(var n in e)t[n]=s(e[n]);return t},t.arrayToMap=function(e){var t={};for(var n=0;n<e.length;n++)t[e[n]]=1;return t},t.createMap=function(e){var t=Object.create(null);for(var n in e)t[n]=e[n];return t},t.arrayRemove=function(e,t){for(var n=0;n<=e.length;n++)t===e[n]&&e.splice(n,1)},t.escapeRegExp=function(e){return e.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},t.escapeHTML=function(e){return(""+e).replace(/&/g,"&#38;").replace(/"/g,"&#34;").replace(/'/g,"&#39;").replace(/</g,"&#60;")},t.getMatchOffsets=function(e,t){var n=[];return e.replace(t,function(e){n.push({offset:arguments[arguments.length-2],length:e.length})}),n},t.deferredCall=function(e){var t=null,n=function(){t=null,e()},r=function(e){return r.cancel(),t=setTimeout(n,e||0),r};return r.schedule=r,r.call=function(){return this.cancel(),e(),r},r.cancel=function(){return clearTimeout(t),t=null,r},r.isPending=function(){return t},r},t.delayedCall=function(e,t){var n=null,r=function(){n=null,e()},i=function(e){n==null&&(n=setTimeout(r,e||t))};return i.delay=function(e){n&&clearTimeout(n),n=setTimeout(r,e||t)},i.schedule=i,i.call=function(){this.cancel(),e()},i.cancel=function(){n&&clearTimeout(n),n=null},i.isPending=function(){return n},i}}),ace.define("ace/keyboard/textinput_ios",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/lib/dom","ace/lib/lang","ace/lib/keys"],function(e,t,n){"use strict";var r=e("../lib/event"),i=e("../lib/useragent"),s=e("../lib/dom"),o=e("../lib/lang"),u=e("../lib/keys"),a=u.KEY_MODS,f=i.isChrome<18,l=i.isIE,c=function(e,t){function x(e){if(m)return;m=!0;if(k)t=0,n=e?0:c.value.length-1;else var t=4,n=5;try{c.setSelectionRange(t,n)}catch(r){}m=!1}function T(){if(m)return;c.value=h,i.isWebKit&&S.schedule()}function R(){clearTimeout(q),q=setTimeout(function(){g&&(c.style.cssText=g,g=""),t.renderer.$keepTextAreaAtCursor==null&&(t.renderer.$keepTextAreaAtCursor=!0,t.renderer.$moveTextAreaToCursor())},0)}var n=this,c=s.createElement("textarea");c.className=i.isIOS?"ace_text-input ace_text-input-ios":"ace_text-input",i.isTouchPad&&c.setAttribute("x-palm-disable-auto-cap",!0),c.setAttribute("wrap","off"),c.setAttribute("autocorrect","off"),c.setAttribute("autocapitalize","off"),c.setAttribute("spellcheck",!1),c.style.opacity="0",e.insertBefore(c,e.firstChild);var h="\n aaaa a\n",p=!1,d=!1,v=!1,m=!1,g="",y=!0;try{var b=document.activeElement===c}catch(w){}r.addListener(c,"blur",function(e){t.onBlur(e),b=!1}),r.addListener(c,"focus",function(e){b=!0,t.onFocus(e),x()}),this.focus=function(){if(g)return c.focus();c.style.position="fixed",c.focus()},this.blur=function(){c.blur()},this.isFocused=function(){return b};var E=o.delayedCall(function(){b&&x(y)}),S=o.delayedCall(function(){m||(c.value=h,b&&x())});i.isWebKit||t.addEventListener("changeSelection",function(){t.selection.isEmpty()!=y&&(y=!y,E.schedule())}),T(),b&&t.onFocus();var N=function(e){return e.selectionStart===0&&e.selectionEnd===e.value.length},C=function(e){N(c)?(t.selectAll(),x()):k&&x(t.selection.isEmpty())},k=null;this.setInputHandler=function(e){k=e},this.getInputHandler=function(){return k};var L=!1,A=function(e){if(c.selectionStart===4&&c.selectionEnd===5)return;k&&(e=k(e),k=null),v?(x(),e&&t.onPaste(e),v=!1):e==h.substr(0)&&c.selectionStart===4?L?t.execCommand("del",{source:"ace"}):t.execCommand("backspace",{source:"ace"}):p||(e.substring(0,9)==h&&e.length>h.length?e=e.substr(9):e.substr(0,4)==h.substr(0,4)?e=e.substr(4,e.length-h.length+1):e.charAt(e.length-1)==h.charAt(0)&&(e=e.slice(0,-1)),e!=h.charAt(0)&&e.charAt(e.length-1)==h.charAt(0)&&(e=e.slice(0,-1)),e&&t.onTextInput(e)),p&&(p=!1),L&&(L=!1)},O=function(e){if(m)return;var t=c.value;A(t),T()},M=function(e,t,n){var r=e.clipboardData||window.clipboardData;if(!r||f)return;var i=l||n?"Text":"text/plain";try{return t?r.setData(i,t)!==!1:r.getData(i)}catch(e){if(!n)return M(e,t,!0)}},_=function(e,n){var s=t.getCopyText();if(!s)return r.preventDefault(e);M(e,s)?(i.isIOS&&(d=n,c.value="\n aa"+s+"a a\n",c.setSelectionRange(4,4+s.length),p={value:s}),n?t.onCut():t.onCopy(),i.isIOS||r.preventDefault(e)):(p=!0,c.value=s,c.select(),setTimeout(function(){p=!1,T(),x(),n?t.onCut():t.onCopy()}))},D=function(e){_(e,!0)},P=function(e){_(e,!1)},H=function(e){var n=M(e);typeof n=="string"?(n&&t.onPaste(n,e),i.isIE&&setTimeout(x),r.preventDefault(e)):(c.value="",v=!0)};r.addCommandKeyListener(c,t.onCommandKey.bind(t)),r.addListener(c,"select",C),r.addListener(c,"input",O),r.addListener(c,"cut",D),r.addListener(c,"copy",P),r.addListener(c,"paste",H);var B=function(e){if(m||!t.onCompositionStart||t.$readOnly)return;m={},m.canUndo=t.session.$undoManager,t.onCompositionStart(),setTimeout(j,0),t.on("mousedown",F),m.canUndo&&!t.selection.isEmpty()&&(t.insert(""),t.session.markUndoGroup(),t.selection.clearSelection()),t.session.markUndoGroup()},j=function(){if(!m||!t.onCompositionUpdate||t.$readOnly)return;var e=c.value.replace(/\x01/g,"");if(m.lastValue===e)return;t.onCompositionUpdate(e),m.lastValue&&t.undo(),m.canUndo&&(m.lastValue=e);if(m.lastValue){var n=t.selection.getRange();t.insert(m.lastValue),t.session.markUndoGroup(),m.range=t.selection.getRange(),t.selection.setRange(n),t.selection.clearSelection()}},F=function(e){if(!t.onCompositionEnd||t.$readOnly)return;var n=m;m=!1;var r=setTimeout(function(){r=null;var e=c.value.replace(/\x01/g,"");if(m)return;e==n.lastValue?T():!n.lastValue&&e&&(T(),A(e))});k=function(i){return r&&clearTimeout(r),i=i.replace(/\x01/g,""),i==n.lastValue?"":(n.lastValue&&r&&t.undo(),i)},t.onCompositionEnd(),t.removeListener("mousedown",F),e.type=="compositionend"&&n.range&&t.selection.setRange(n.range);var s=!!i.isChrome&&i.isChrome>=53||!!i.isWebKit&&i.isWebKit>=603;s&&O()},I=o.delayedCall(j,50);r.addListener(c,"compositionstart",B),r.addListener(c,"compositionupdate",function(){I.schedule()}),r.addListener(c,"keyup",function(){I.schedule()}),r.addListener(c,"keydown",function(){I.schedule()}),r.addListener(c,"compositionend",F),this.getElement=function(){return c},this.setReadOnly=function(e){c.readOnly=e},this.onContextMenu=function(e){L=!0,x(t.selection.isEmpty()),t._emit("nativecontextmenu",{target:t,domEvent:e}),this.moveToMouse(e,!0)},this.moveToMouse=function(e,n){g||(g=c.style.cssText),c.style.cssText=(n?"z-index:100000;":"")+"height:"+c.style.height+";"+(i.isIE?"opacity:0.1;":"");var o=t.container.getBoundingClientRect(),u=s.computedStyle(t.container),a=o.top+(parseInt(u.borderTopWidth)||0),f=o.left+(parseInt(o.borderLeftWidth)||0),l=o.bottom-a-c.clientHeight-2,h=function(e){c.style.left=e.clientX-f-2+"px",c.style.top=Math.min(e.clientY-a-2,l)+"px"};h(e);if(e.type!="mousedown")return;t.renderer.$keepTextAreaAtCursor&&(t.renderer.$keepTextAreaAtCursor=null),clearTimeout(q),i.isWin&&r.capture(t.container,h,R)},this.onContextMenuClose=R;var q,U=function(e){t.textInput.onContextMenu(e),R()};r.addListener(c,"mouseup",U),r.addListener(c,"mousedown",function(e){e.preventDefault(),R()}),r.addListener(t.renderer.scroller,"contextmenu",U),r.addListener(c,"contextmenu",U);if(i.isIOS){var z=null,W=!1;e.addEventListener("keydown",function(e){z&&clearTimeout(z),W=!0}),e.addEventListener("keyup",function(e){z=setTimeout(function(){W=!1},100)});var X=function(e){if(document.activeElement!==c)return;if(W)return;if(d)return setTimeout(function(){d=!1},100);var n=c.selectionStart,r=c.selectionEnd;c.setSelectionRange(4,5);if(n==r)switch(n){case 0:t.onCommandKey(null,0,u.up);break;case 1:t.onCommandKey(null,0,u.home);break;case 2:t.onCommandKey(null,a.option,u.left);break;case 4:t.onCommandKey(null,0,u.left);break;case 5:t.onCommandKey(null,0,u.right);break;case 7:t.onCommandKey(null,a.option,u.right);break;case 8:t.onCommandKey(null,0,u.end);break;case 9:t.onCommandKey(null,0,u.down)}else{switch(r){case 6:t.onCommandKey(null,a.shift,u.right);break;case 7:t.onCommandKey(null,a.shift|a.option,u.right);break;case 8:t.onCommandKey(null,a.shift,u.end);break;case 9:t.onCommandKey(null,a.shift,u.down)}switch(n){case 0:t.onCommandKey(null,a.shift,u.up);break;case 1:t.onCommandKey(null,a.shift,u.home);break;case 2:t.onCommandKey(null,a.shift|a.option,u.left);break;case 3:t.onCommandKey(null,a.shift,u.left)}}};document.addEventListener("selectionchange",X),t.on("destroy",function(){document.removeEventListener("selectionchange",X)})}};t.TextInput=c}),ace.define("ace/keyboard/textinput",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/lib/dom","ace/lib/lang","ace/keyboard/textinput_ios"],function(e,t,n){"use strict";var r=e("../lib/event"),i=e("../lib/useragent"),s=e("../lib/dom"),o=e("../lib/lang"),u=i.isChrome<18,a=i.isIE,f=i.isChrome>63,l=400,c=e("./textinput_ios").TextInput,h=function(e,t){function C(){if(d||v)return;if(!T&&!O)return;d=!0;var e=t.selection,r=e.getRange(),i=e.cursor.row,s=r.start.column,o=r.end.column,u=t.session.getLine(i);if(r.start.row!=i){var a=t.session.getLine(i-1);s=r.start.row<i-1?0:s,o+=a.length+1,u=a+"\n"+u}else if(r.end.row!=i){var f=t.session.getLine(i+1);o=r.end.row>i+1?f.length:o,o+=u.length+1,u=u+"\n"+f}u.length>l&&(s<l&&o<l?u=u.slice(0,l):(u="\n",s=0,o=1));var c=u+"\n\n";c!=E&&(n.value=E=c,S=x=c.length),O&&(S=n.selectionStart,x=n.selectionEnd);if(x!=o||S!=s)try{n.setSelectionRange(s,o),S=s,x=o}catch(h){}d=!1}function R(){w=!0,n.blur(),n.focus(),w=!1}function z(e){e.keyCode==27&&n.value.length<n.selectionStart&&(d||(E=n.value),S=x=-1,C()),U()}function X(){clearTimeout(W),W=setTimeout(function(){m&&(n.style.cssText=m,m=""),t.renderer.$keepTextAreaAtCursor==null&&(t.renderer.$keepTextAreaAtCursor=!0,t.renderer.$moveTextAreaToCursor())},0)}if(i.isIOS)return c.call(this,e,t);var n=s.createElement("textarea");n.className="ace_text-input",n.setAttribute("wrap","off"),n.setAttribute("autocorrect","off"),n.setAttribute("autocapitalize","off"),n.setAttribute("spellcheck",!1),n.style.opacity="0",e.insertBefore(n,e.firstChild);var h=!1,p=!1,d=!1,v=!1,m="",g=!0,y=!1;i.isMobile||(n.style.fontSize="1px");var b=!1,w=!1,E="",S=0,x=0;try{var T=document.activeElement===n}catch(N){}r.addListener(n,"blur",function(e){if(w)return;t.onBlur(e),T=!1}),r.addListener(n,"focus",function(e){if(w)return;T=!0,t.onFocus(e),C()}),this.$focusScroll=!1,this.focus=function(){if(m||f||this.$focusScroll=="browser")return n.focus({preventScroll:!0});if(!document.documentElement.contains(n))return;var e=n.style.top;n.style.position="fixed",n.style.top="0px";var t=n.getBoundingClientRect().top!=0,r=[];if(t){var i=n.parentElement;while(i&&i.nodeType==1)r.push(i),i.setAttribute("ace_nocontext",!0),!i.parentElement&&i.getRootNode?i=i.getRootNode().host:i=i.parentElement}n.focus({preventScroll:!0}),t&&r.forEach(function(e){e.removeAttribute("ace_nocontext")}),setTimeout(function(){n.style.position="",n.style.top=="0px"&&(n.style.top=e)},0)},this.blur=function(){n.blur()},this.isFocused=function(){return T},t.on("beforeEndOperation",function(){if(t.curOp&&t.curOp.command.name=="insertstring")return;d&&(E=n.value="",q()),C()}),T&&t.onFocus();var k=function(e){return e.selectionStart===0&&e.selectionEnd>=E.length&&e.value===E&&E&&e.selectionEnd!==x},L=function(e){if(d)return;h?h=!1:k(n)&&(t.selectAll(),C())},A=null;this.setInputHandler=function(e){A=e},this.getInputHandler=function(){return A};var O=!1,M=function(e,r){O&&(O=!1);if(p)return C(),e&&t.onPaste(e),p=!1,"";var i=n.selectionStart,s=n.selectionEnd,o=S,u=E.length-x,a=e,f=e.length-i,l=e.length-s,c=0;while(o>0&&E[c]==e[c])c++,o--;a=a.slice(c),c=1;while(u>0&&E.length-c>S-1&&E[E.length-c]==e[e.length-c])c++,u--;return f-=c-1,l-=c-1,a=a.slice(0,a.length-c+1),!r&&f==a.length&&!o&&!u&&!l?"":(v=!0,a&&!o&&!u&&!f&&!l||b?t.onTextInput(a):t.onTextInput(a,{extendLeft:o,extendRight:u,restoreStart:f,restoreEnd:l}),v=!1,E=e,S=i,x=s,a)},_=function(e){if(d)return I();var t=n.value,r=M(t,!0);(t.length>l+100||/\n/.test(r))&&C()},D=function(e,t,n){var r=e.clipboardData||window.clipboardData;if(!r||u)return;var i=a||n?"Text":"text/plain";try{return t?r.setData(i,t)!==!1:r.getData(i)}catch(e){if(!n)return D(e,t,!0)}},P=function(e,i){var s=t.getCopyText();if(!s)return r.preventDefault(e);D(e,s)?(i?t.onCut():t.onCopy(),r.preventDefault(e)):(h=!0,n.value=s,n.select(),setTimeout(function(){h=!1,C(),i?t.onCut():t.onCopy()}))},H=function(e){P(e,!0)},B=function(e){P(e,!1)},j=function(e){var s=D(e);typeof s=="string"?(s&&t.onPaste(s,e),i.isIE&&setTimeout(C),r.preventDefault(e)):(n.value="",p=!0)};r.addCommandKeyListener(n,t.onCommandKey.bind(t)),r.addListener(n,"select",L),r.addListener(n,"input",_),r.addListener(n,"cut",H),r.addListener(n,"copy",B),r.addListener(n,"paste",j),(!("oncut"in n)||!("oncopy"in n)||!("onpaste"in n))&&r.addListener(e,"keydown",function(e){if(i.isMac&&!e.metaKey||!e.ctrlKey)return;switch(e.keyCode){case 67:B(e);break;case 86:j(e);break;case 88:H(e)}});var F=function(e){if(d||!t.onCompositionStart||t.$readOnly)return;d={};if(b)return;setTimeout(I,0),t.on("mousedown",R);var r=t.getSelectionRange();r.end.row=r.start.row,r.end.column=r.start.column,d.markerRange=r,d.selectionStart=S,t.onCompositionStart(d),d.useTextareaForIME?(n.value="",E="",S=0,x=0):(n.msGetInputContext&&(d.context=n.msGetInputContext()),n.getInputContext&&(d.context=n.getInputContext()))},I=function(){if(!d||!t.onCompositionUpdate||t.$readOnly)return;if(b)return R();if(d.useTextareaForIME)t.onCompositionUpdate(n.value);else{var e=n.value;M(e),d.markerRange&&(d.context&&(d.markerRange.start.column=d.selectionStart=d.context.compositionStartOffset),d.markerRange.end.column=d.markerRange.start.column+x-d.selectionStart)}},q=function(e){if(!t.onCompositionEnd||t.$readOnly)return;d=!1,t.onCompositionEnd(),t.off("mousedown",R),e&&_()},U=o.delayedCall(I,50).schedule.bind(null,null);r.addListener(n,"compositionstart",F),r.addListener(n,"compositionupdate",I),r.addListener(n,"keyup",z),r.addListener(n,"keydown",U),r.addListener(n,"compositionend",q),this.getElement=function(){return n},this.setCommandMode=function(e){b=e,n.readOnly=!1},this.setReadOnly=function(e){b||(n.readOnly=e)},this.setCopyWithEmptySelection=function(e){y=e},this.onContextMenu=function(e){O=!0,C(),t._emit("nativecontextmenu",{target:t,domEvent:e}),this.moveToMouse(e,!0)},this.moveToMouse=function(e,o){m||(m=n.style.cssText),n.style.cssText=(o?"z-index:100000;":"")+(i.isIE?"opacity:0.1;":"")+"text-indent: -"+(S+x)*t.renderer.characterWidth*.5+"px;";var u=t.container.getBoundingClientRect(),a=s.computedStyle(t.container),f=u.top+(parseInt(a.borderTopWidth)||0),l=u.left+(parseInt(u.borderLeftWidth)||0),c=u.bottom-f-n.clientHeight-2,h=function(e){n.style.left=e.clientX-l-2+"px",n.style.top=Math.min(e.clientY-f-2,c)+"px"};h(e);if(e.type!="mousedown")return;t.renderer.$keepTextAreaAtCursor&&(t.renderer.$keepTextAreaAtCursor=null),clearTimeout(W),i.isWin&&r.capture(t.container,h,X)},this.onContextMenuClose=X;var W,V=function(e){t.textInput.onContextMenu(e),X()};r.addListener(n,"mouseup",V),r.addListener(n,"mousedown",function(e){e.preventDefault(),X()}),r.addListener(t.renderer.scroller,"contextmenu",V),r.addListener(n,"contextmenu",V)};t.TextInput=h}),ace.define("ace/mouse/default_handlers",["require","exports","module","ace/lib/useragent"],function(e,t,n){"use strict";function o(e){e.$clickSelection=null;var t=e.editor;t.setDefaultHandler("mousedown",this.onMouseDown.bind(e)),t.setDefaultHandler("dblclick",this.onDoubleClick.bind(e)),t.setDefaultHandler("tripleclick",this.onTripleClick.bind(e)),t.setDefaultHandler("quadclick",this.onQuadClick.bind(e)),t.setDefaultHandler("mousewheel",this.onMouseWheel.bind(e)),t.setDefaultHandler("touchmove",this.onTouchMove.bind(e));var n=["select","startSelect","selectEnd","selectAllEnd","selectByWordsEnd","selectByLinesEnd","dragWait","dragWaitEnd","focusWait"];n.forEach(function(t){e[t]=this[t]},this),e.selectByLines=this.extendSelectionBy.bind(e,"getLineRange"),e.selectByWords=this.extendSelectionBy.bind(e,"getWordRange")}function u(e,t,n,r){return Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2))}function a(e,t){if(e.start.row==e.end.row)var n=2*t.column-e.start.column-e.end.column;else if(e.start.row==e.end.row-1&&!e.start.column&&!e.end.column)var n=t.column-4;else var n=2*t.row-e.start.row-e.end.row;return n<0?{cursor:e.start,anchor:e.end}:{cursor:e.end,anchor:e.start}}var r=e("../lib/useragent"),i=0,s=250;(function(){this.onMouseDown=function(e){var t=e.inSelection(),n=e.getDocumentPosition();this.mousedownEvent=e;var i=this.editor,s=e.getButton();if(s!==0){var o=i.getSelectionRange(),u=o.isEmpty();(u||s==1)&&i.selection.moveToPosition(n),s==2&&(i.textInput.onContextMenu(e.domEvent),r.isMozilla||e.preventDefault());return}this.mousedownEvent.time=Date.now();if(t&&!i.isFocused()){i.focus();if(this.$focusTimeout&&!this.$clickSelection&&!i.inMultiSelectMode){this.setState("focusWait"),this.captureMouse(e);return}}return this.captureMouse(e),this.startSelect(n,e.domEvent._clicks>1),e.preventDefault()},this.startSelect=function(e,t){e=e||this.editor.renderer.screenToTextCoordinates(this.x,this.y);var n=this.editor;if(!this.mousedownEvent)return;this.mousedownEvent.getShiftKey()?n.selection.selectToPosition(e):t||n.selection.moveToPosition(e),t||this.select(),n.renderer.scroller.setCapture&&n.renderer.scroller.setCapture(),n.setStyle("ace_selecting"),this.setState("select")},this.select=function(){var e,t=this.editor,n=t.renderer.screenToTextCoordinates(this.x,this.y);if(this.$clickSelection){var r=this.$clickSelection.comparePoint(n);if(r==-1)e=this.$clickSelection.end;else if(r==1)e=this.$clickSelection.start;else{var i=a(this.$clickSelection,n);n=i.cursor,e=i.anchor}t.selection.setSelectionAnchor(e.row,e.column)}t.selection.selectToPosition(n),t.renderer.scrollCursorIntoView()},this.extendSelectionBy=function(e){var t,n=this.editor,r=n.renderer.screenToTextCoordinates(this.x,this.y),i=n.selection[e](r.row,r.column);if(this.$clickSelection){var s=this.$clickSelection.comparePoint(i.start),o=this.$clickSelection.comparePoint(i.end);if(s==-1&&o<=0){t=this.$clickSelection.end;if(i.end.row!=r.row||i.end.column!=r.column)r=i.start}else if(o==1&&s>=0){t=this.$clickSelection.start;if(i.start.row!=r.row||i.start.column!=r.column)r=i.end}else if(s==-1&&o==1)r=i.end,t=i.start;else{var u=a(this.$clickSelection,r);r=u.cursor,t=u.anchor}n.selection.setSelectionAnchor(t.row,t.column)}n.selection.selectToPosition(r),n.renderer.scrollCursorIntoView()},this.selectEnd=this.selectAllEnd=this.selectByWordsEnd=this.selectByLinesEnd=function(){this.$clickSelection=null,this.editor.unsetStyle("ace_selecting"),this.editor.renderer.scroller.releaseCapture&&this.editor.renderer.scroller.releaseCapture()},this.focusWait=function(){var e=u(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y),t=Date.now();(e>i||t-this.mousedownEvent.time>this.$focusTimeout)&&this.startSelect(this.mousedownEvent.getDocumentPosition())},this.onDoubleClick=function(e){var t=e.getDocumentPosition(),n=this.editor,r=n.session,i=r.getBracketRange(t);i?(i.isEmpty()&&(i.start.column--,i.end.column++),this.setState("select")):(i=n.selection.getWordRange(t.row,t.column),this.setState("selectByWords")),this.$clickSelection=i,this.select()},this.onTripleClick=function(e){var t=e.getDocumentPosition(),n=this.editor;this.setState("selectByLines");var r=n.getSelectionRange();r.isMultiLine()&&r.contains(t.row,t.column)?(this.$clickSelection=n.selection.getLineRange(r.start.row),this.$clickSelection.end=n.selection.getLineRange(r.end.row).end):this.$clickSelection=n.selection.getLineRange(t.row),this.select()},this.onQuadClick=function(e){var t=this.editor;t.selectAll(),this.$clickSelection=t.getSelectionRange(),this.setState("selectAll")},this.onMouseWheel=function(e){if(e.getAccelKey())return;e.getShiftKey()&&e.wheelY&&!e.wheelX&&(e.wheelX=e.wheelY,e.wheelY=0);var t=this.editor;this.$lastScroll||(this.$lastScroll={t:0,vx:0,vy:0,allowed:0});var n=this.$lastScroll,r=e.domEvent.timeStamp,i=r-n.t,o=i?e.wheelX/i:n.vx,u=i?e.wheelY/i:n.vy;i<s&&(o=(o+n.vx)/2,u=(u+n.vy)/2);var a=Math.abs(o/u),f=!1;a>=1&&t.renderer.isScrollableBy(e.wheelX*e.speed,0)&&(f=!0),a<=1&&t.renderer.isScrollableBy(0,e.wheelY*e.speed)&&(f=!0);if(f)n.allowed=r;else if(r-n.allowed<s){var l=Math.abs(o)<=1.1*Math.abs(n.vx)&&Math.abs(u)<=1.1*Math.abs(n.vy);l?(f=!0,n.allowed=r):n.allowed=0}n.t=r,n.vx=o,n.vy=u;if(f)return t.renderer.scrollBy(e.wheelX*e.speed,e.wheelY*e.speed),e.stop()},this.onTouchMove=function(e){this.editor._emit("mousewheel",e)}}).call(o.prototype),t.DefaultHandlers=o}),ace.define("ace/tooltip",["require","exports","module","ace/lib/oop","ace/lib/dom"],function(e,t,n){"use strict";function s(e){this.isOpen=!1,this.$element=null,this.$parentNode=e}var r=e("./lib/oop"),i=e("./lib/dom");(function(){this.$init=function(){return this.$element=i.createElement("div"),this.$element.className="ace_tooltip",this.$element.style.display="none",this.$parentNode.appendChild(this.$element),this.$element},this.getElement=function(){return this.$element||this.$init()},this.setText=function(e){this.getElement().textContent=e},this.setHtml=function(e){this.getElement().innerHTML=e},this.setPosition=function(e,t){this.getElement().style.left=e+"px",this.getElement().style.top=t+"px"},this.setClassName=function(e){i.addCssClass(this.getElement(),e)},this.show=function(e,t,n){e!=null&&this.setText(e),t!=null&&n!=null&&this.setPosition(t,n),this.isOpen||(this.getElement().style.display="block",this.isOpen=!0)},this.hide=function(){this.isOpen&&(this.getElement().style.display="none",this.isOpen=!1)},this.getHeight=function(){return this.getElement().offsetHeight},this.getWidth=function(){return this.getElement().offsetWidth},this.destroy=function(){this.isOpen=!1,this.$element&&this.$element.parentNode&&this.$element.parentNode.removeChild(this.$element)}}).call(s.prototype),t.Tooltip=s}),ace.define("ace/mouse/default_gutter_handler",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event","ace/tooltip"],function(e,t,n){"use strict";function u(e){function l(){var r=u.getDocumentPosition().row,s=n.$annotations[r];if(!s)return c();var o=t.session.getLength();if(r==o){var a=t.renderer.pixelToScreenCoordinates(0,u.y).row,l=u.$pos;if(a>t.session.documentToScreenRow(l.row,l.column))return c()}if(f==s)return;f=s.text.join("<br/>"),i.setHtml(f),i.show(),t._signal("showGutterTooltip",i),t.on("mousewheel",c);if(e.$tooltipFollowsMouse)h(u);else{var p=u.domEvent.target,d=p.getBoundingClientRect(),v=i.getElement().style;v.left=d.right+"px",v.top=d.bottom+"px"}}function c(){o&&(o=clearTimeout(o)),f&&(i.hide(),f=null,t._signal("hideGutterTooltip",i),t.removeEventListener("mousewheel",c))}function h(e){i.setPosition(e.x,e.y)}var t=e.editor,n=t.renderer.$gutterLayer,i=new a(t.container);e.editor.setDefaultHandler("guttermousedown",function(r){if(!t.isFocused()||r.getButton()!=0)return;var i=n.getRegion(r);if(i=="foldWidgets")return;var s=r.getDocumentPosition().row,o=t.session.selection;if(r.getShiftKey())o.selectTo(s,0);else{if(r.domEvent.detail==2)return t.selectAll(),r.preventDefault();e.$clickSelection=t.selection.getLineRange(s)}return e.setState("selectByLines"),e.captureMouse(r),r.preventDefault()});var o,u,f;e.editor.setDefaultHandler("guttermousemove",function(t){var n=t.domEvent.target||t.domEvent.srcElement;if(r.hasCssClass(n,"ace_fold-widget"))return c();f&&e.$tooltipFollowsMouse&&h(t),u=t;if(o)return;o=setTimeout(function(){o=null,u&&!e.isMousePressed?l():c()},50)}),s.addListener(t.renderer.$gutter,"mouseout",function(e){u=null;if(!f||o)return;o=setTimeout(function(){o=null,c()},50)}),t.on("changeSession",c)}function a(e){o.call(this,e)}var r=e("../lib/dom"),i=e("../lib/oop"),s=e("../lib/event"),o=e("../tooltip").Tooltip;i.inherits(a,o),function(){this.setPosition=function(e,t){var n=window.innerWidth||document.documentElement.clientWidth,r=window.innerHeight||document.documentElement.clientHeight,i=this.getWidth(),s=this.getHeight();e+=15,t+=15,e+i>n&&(e-=e+i-n),t+s>r&&(t-=20+s),o.prototype.setPosition.call(this,e,t)}}.call(a.prototype),t.GutterHandler=u}),ace.define("ace/mouse/mouse_event",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(e,t,n){"use strict";var r=e("../lib/event"),i=e("../lib/useragent"),s=t.MouseEvent=function(e,t){this.domEvent=e,this.editor=t,this.x=this.clientX=e.clientX,this.y=this.clientY=e.clientY,this.$pos=null,this.$inSelection=null,this.propagationStopped=!1,this.defaultPrevented=!1};(function(){this.stopPropagation=function(){r.stopPropagation(this.domEvent),this.propagationStopped=!0},this.preventDefault=function(){r.preventDefault(this.domEvent),this.defaultPrevented=!0},this.stop=function(){this.stopPropagation(),this.preventDefault()},this.getDocumentPosition=function(){return this.$pos?this.$pos:(this.$pos=this.editor.renderer.screenToTextCoordinates(this.clientX,this.clientY),this.$pos)},this.inSelection=function(){if(this.$inSelection!==null)return this.$inSelection;var e=this.editor,t=e.getSelectionRange();if(t.isEmpty())this.$inSelection=!1;else{var n=this.getDocumentPosition();this.$inSelection=t.contains(n.row,n.column)}return this.$inSelection},this.getButton=function(){return r.getButton(this.domEvent)},this.getShiftKey=function(){return this.domEvent.shiftKey},this.getAccelKey=i.isMac?function(){return this.domEvent.metaKey}:function(){return this.domEvent.ctrlKey}}).call(s.prototype)}),ace.define("ace/mouse/dragdrop_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"],function(e,t,n){"use strict";function f(e){function T(e,n){var r=Date.now(),i=!n||e.row!=n.row,s=!n||e.column!=n.column;if(!S||i||s)t.moveCursorToPosition(e),S=r,x={x:p,y:d};else{var o=l(x.x,x.y,p,d);o>a?S=null:r-S>=u&&(t.renderer.scrollCursorIntoView(),S=null)}}function N(e,n){var r=Date.now(),i=t.renderer.layerConfig.lineHeight,s=t.renderer.layerConfig.characterWidth,u=t.renderer.scroller.getBoundingClientRect(),a={x:{left:p-u.left,right:u.right-p},y:{top:d-u.top,bottom:u.bottom-d}},f=Math.min(a.x.left,a.x.right),l=Math.min(a.y.top,a.y.bottom),c={row:e.row,column:e.column};f/s<=2&&(c.column+=a.x.left<a.x.right?-3:2),l/i<=1&&(c.row+=a.y.top<a.y.bottom?-1:1);var h=e.row!=c.row,v=e.column!=c.column,m=!n||e.row!=n.row;h||v&&!m?E?r-E>=o&&t.renderer.scrollCursorIntoView(c):E=r:E=null}function C(){var e=g;g=t.renderer.screenToTextCoordinates(p,d),T(g,e),N(g,e)}function k(){m=t.selection.toOrientedRange(),h=t.session.addMarker(m,"ace_selection",t.getSelectionStyle()),t.clearSelection(),t.isFocused()&&t.renderer.$cursorLayer.setBlinking(!1),clearInterval(v),C(),v=setInterval(C,20),y=0,i.addListener(document,"mousemove",O)}function L(){clearInterval(v),t.session.removeMarker(h),h=null,t.selection.fromOrientedRange(m),t.isFocused()&&!w&&t.renderer.$cursorLayer.setBlinking(!t.getReadOnly()),m=null,g=null,y=0,E=null,S=null,i.removeListener(document,"mousemove",O)}function O(){A==null&&(A=setTimeout(function(){A!=null&&h&&L()},20))}function M(e){var t=e.types;return!t||Array.prototype.some.call(t,function(e){return e=="text/plain"||e=="Text"})}function _(e){var t=["copy","copymove","all","uninitialized"],n=["move","copymove","linkmove","all","uninitialized"],r=s.isMac?e.altKey:e.ctrlKey,i="uninitialized";try{i=e.dataTransfer.effectAllowed.toLowerCase()}catch(e){}var o="none";return r&&t.indexOf(i)>=0?o="copy":n.indexOf(i)>=0?o="move":t.indexOf(i)>=0&&(o="copy"),o}var t=e.editor,n=r.createElement("img");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",s.isOpera&&(n.style.cssText="width:1px;height:1px;position:fixed;top:0;left:0;z-index:2147483647;opacity:0;");var f=["dragWait","dragWaitEnd","startDrag","dragReadyEnd","onMouseDrag"];f.forEach(function(t){e[t]=this[t]},this),t.addEventListener("mousedown",this.onMouseDown.bind(e));var c=t.container,h,p,d,v,m,g,y=0,b,w,E,S,x;this.onDragStart=function(e){if(this.cancelDrag||!c.draggable){var r=this;return setTimeout(function(){r.startSelect(),r.captureMouse(e)},0),e.preventDefault()}m=t.getSelectionRange();var i=e.dataTransfer;i.effectAllowed=t.getReadOnly()?"copy":"copyMove",s.isOpera&&(t.container.appendChild(n),n.scrollTop=0),i.setDragImage&&i.setDragImage(n,0,0),s.isOpera&&t.container.removeChild(n),i.clearData(),i.setData("Text",t.session.getTextRange()),w=!0,this.setState("drag")},this.onDragEnd=function(e){c.draggable=!1,w=!1,this.setState(null);if(!t.getReadOnly()){var n=e.dataTransfer.dropEffect;!b&&n=="move"&&t.session.remove(t.getSelectionRange()),t.renderer.$cursorLayer.setBlinking(!0)}this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle("")},this.onDragEnter=function(e){if(t.getReadOnly()||!M(e.dataTransfer))return;return p=e.clientX,d=e.clientY,h||k(),y++,e.dataTransfer.dropEffect=b=_(e),i.preventDefault(e)},this.onDragOver=function(e){if(t.getReadOnly()||!M(e.dataTransfer))return;return p=e.clientX,d=e.clientY,h||(k(),y++),A!==null&&(A=null),e.dataTransfer.dropEffect=b=_(e),i.preventDefault(e)},this.onDragLeave=function(e){y--;if(y<=0&&h)return L(),b=null,i.preventDefault(e)},this.onDrop=function(e){if(!g)return;var n=e.dataTransfer;if(w)switch(b){case"move":m.contains(g.row,g.column)?m={start:g,end:g}:m=t.moveText(m,g);break;case"copy":m=t.moveText(m,g,!0)}else{var r=n.getData("Text");m={start:g,end:t.session.insert(g,r)},t.focus(),b=null}return L(),i.preventDefault(e)},i.addListener(c,"dragstart",this.onDragStart.bind(e)),i.addListener(c,"dragend",this.onDragEnd.bind(e)),i.addListener(c,"dragenter",this.onDragEnter.bind(e)),i.addListener(c,"dragover",this.onDragOver.bind(e)),i.addListener(c,"dragleave",this.onDragLeave.bind(e)),i.addListener(c,"drop",this.onDrop.bind(e));var A=null}function l(e,t,n,r){return Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2))}var r=e("../lib/dom"),i=e("../lib/event"),s=e("../lib/useragent"),o=200,u=200,a=5;(function(){this.dragWait=function(){var e=Date.now()-this.mousedownEvent.time;e>this.editor.getDragDelay()&&this.startDrag()},this.dragWaitEnd=function(){var e=this.editor.container;e.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()),this.selectEnd()},this.dragReadyEnd=function(e){this.editor.renderer.$cursorLayer.setBlinking(!this.editor.getReadOnly()),this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle(""),this.dragWaitEnd()},this.startDrag=function(){this.cancelDrag=!1;var e=this.editor,t=e.container;t.draggable=!0,e.renderer.$cursorLayer.setBlinking(!1),e.setStyle("ace_dragging");var n=s.isWin?"default":"move";e.renderer.setCursorStyle(n),this.setState("dragReady")},this.onMouseDrag=function(e){var t=this.editor.container;if(s.isIE&&this.state=="dragReady"){var n=l(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);n>3&&t.dragDrop()}if(this.state==="dragWait"){var n=l(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);n>0&&(t.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()))}},this.onMouseDown=function(e){if(!this.$dragEnabled)return;this.mousedownEvent=e;var t=this.editor,n=e.inSelection(),r=e.getButton(),i=e.domEvent.detail||1;if(i===1&&r===0&&n){if(e.editor.inMultiSelectMode&&(e.getAccelKey()||e.getShiftKey()))return;this.mousedownEvent.time=Date.now();var o=e.domEvent.target||e.domEvent.srcElement;"unselectable"in o&&(o.unselectable="on");if(t.getDragDelay()){if(s.isWebKit){this.cancelDrag=!0;var u=t.container;u.draggable=!0}this.setState("dragWait")}else this.startDrag();this.captureMouse(e,this.onMouseDrag.bind(this)),e.defaultPrevented=!0}}}).call(f.prototype),t.DragdropHandler=f}),ace.define("ace/lib/net",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";var r=e("./dom");t.get=function(e,t){var n=new XMLHttpRequest;n.open("GET",e,!0),n.onreadystatechange=function(){n.readyState===4&&t(n.responseText)},n.send(null)},t.loadScript=function(e,t){var n=r.getDocumentHead(),i=document.createElement("script");i.src=e,n.appendChild(i),i.onload=i.onreadystatechange=function(e,n){if(n||!i.readyState||i.readyState=="loaded"||i.readyState=="complete")i=i.onload=i.onreadystatechange=null,n||t()}},t.qualifyURL=function(e){var t=document.createElement("a");return t.href=e,t.href}}),ace.define("ace/lib/event_emitter",["require","exports","module"],function(e,t,n){"use strict";var r={},i=function(){this.propagationStopped=!0},s=function(){this.defaultPrevented=!0};r._emit=r._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var n=this._eventRegistry[e]||[],r=this._defaultHandlers[e];if(!n.length&&!r)return;if(typeof t!="object"||!t)t={};t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=i),t.preventDefault||(t.preventDefault=s),n=n.slice();for(var o=0;o<n.length;o++){n[o](t,this);if(t.propagationStopped)break}if(r&&!t.defaultPrevented)return r(t,this)},r._signal=function(e,t){var n=(this._eventRegistry||{})[e];if(!n)return;n=n.slice();for(var r=0;r<n.length;r++)n[r](t,this)},r.once=function(e,t){var n=this;t&&this.addEventListener(e,function r(){n.removeEventListener(e,r),t.apply(null,arguments)})},r.setDefaultHandler=function(e,t){var n=this._defaultHandlers;n||(n=this._defaultHandlers={_disabled_:{}});if(n[e]){var r=n[e],i=n._disabled_[e];i||(n._disabled_[e]=i=[]),i.push(r);var s=i.indexOf(t);s!=-1&&i.splice(s,1)}n[e]=t},r.removeDefaultHandler=function(e,t){var n=this._defaultHandlers;if(!n)return;var r=n._disabled_[e];if(n[e]==t)r&&this.setDefaultHandler(e,r.pop());else if(r){var i=r.indexOf(t);i!=-1&&r.splice(i,1)}},r.on=r.addEventListener=function(e,t,n){this._eventRegistry=this._eventRegistry||{};var r=this._eventRegistry[e];return r||(r=this._eventRegistry[e]=[]),r.indexOf(t)==-1&&r[n?"unshift":"push"](t),t},r.off=r.removeListener=r.removeEventListener=function(e,t){this._eventRegistry=this._eventRegistry||{};var n=this._eventRegistry[e];if(!n)return;var r=n.indexOf(t);r!==-1&&n.splice(r,1)},r.removeAllListeners=function(e){this._eventRegistry&&(this._eventRegistry[e]=[])},t.EventEmitter=r}),ace.define("ace/lib/app_config",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,t,n){"no use strict";function o(e){typeof console!="undefined"&&console.warn&&console.warn.apply(console,arguments)}function u(e,t){var n=new Error(e);n.data=t,typeof console=="object"&&console.error&&console.error(n),setTimeout(function(){throw n})}var r=e("./oop"),i=e("./event_emitter").EventEmitter,s={setOptions:function(e){Object.keys(e).forEach(function(t){this.setOption(t,e[t])},this)},getOptions:function(e){var t={};if(!e){var n=this.$options;e=Object.keys(n).filter(function(e){return!n[e].hidden})}else Array.isArray(e)||(t=e,e=Object.keys(t));return e.forEach(function(e){t[e]=this.getOption(e)},this),t},setOption:function(e,t){if(this["$"+e]===t)return;var n=this.$options[e];if(!n)return o('misspelled option "'+e+'"');if(n.forwardTo)return this[n.forwardTo]&&this[n.forwardTo].setOption(e,t);n.handlesSet||(this["$"+e]=t),n&&n.set&&n.set.call(this,t)},getOption:function(e){var t=this.$options[e];return t?t.forwardTo?this[t.forwardTo]&&this[t.forwardTo].getOption(e):t&&t.get?t.get.call(this):this["$"+e]:o('misspelled option "'+e+'"')}},a=function(){this.$defaultOptions={}};(function(){r.implement(this,i),this.defineOptions=function(e,t,n){return e.$options||(this.$defaultOptions[t]=e.$options={}),Object.keys(n).forEach(function(t){var r=n[t];typeof r=="string"&&(r={forwardTo:r}),r.name||(r.name=t),e.$options[r.name]=r,"initialValue"in r&&(e["$"+r.name]=r.initialValue)}),r.implement(e,s),this},this.resetOptions=function(e){Object.keys(e.$options).forEach(function(t){var n=e.$options[t];"value"in n&&e.setOption(t,n.value)})},this.setDefaultValue=function(e,t,n){var r=this.$defaultOptions[e]||(this.$defaultOptions[e]={});r[t]&&(r.forwardTo?this.setDefaultValue(r.forwardTo,t,n):r[t].value=n)},this.setDefaultValues=function(e,t){Object.keys(t).forEach(function(n){this.setDefaultValue(e,n,t[n])},this)},this.warn=o,this.reportError=u}).call(a.prototype),t.AppConfig=a}),ace.define("ace/config",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/lib/net","ace/lib/app_config"],function(e,t,n){"no use strict";function l(r){if(!u||!u.document)return;a.packaged=r||e.packaged||n.packaged||u.define&&define.packaged;var i={},s="",o=document.currentScript||document._currentScript,f=o&&o.ownerDocument||document,l=f.getElementsByTagName("script");for(var h=0;h<l.length;h++){var p=l[h],d=p.src||p.getAttribute("src");if(!d)continue;var v=p.attributes;for(var m=0,g=v.length;m<g;m++){var y=v[m];y.name.indexOf("data-ace-")===0&&(i[c(y.name.replace(/^data-ace-/,""))]=y.value)}var b=d.match(/^(.*)\/ace(\-\w+)?\.js(\?|$)/);b&&(s=b[1])}s&&(i.base=i.base||s,i.packaged=!0),i.basePath=i.base,i.workerPath=i.workerPath||i.base,i.modePath=i.modePath||i.base,i.themePath=i.themePath||i.base,delete i.base;for(var w in i)typeof i[w]!="undefined"&&t.set(w,i[w])}function c(e){return e.replace(/-(.)/g,function(e,t){return t.toUpperCase()})}var r=e("./lib/lang"),i=e("./lib/oop"),s=e("./lib/net"),o=e("./lib/app_config").AppConfig;n.exports=t=new o;var u=function(){return this||typeof window!="undefined"&&window}(),a={packaged:!1,workerPath:null,modePath:null,themePath:null,basePath:"",suffix:".js",$moduleUrls:{}};t.get=function(e){if(!a.hasOwnProperty(e))throw new Error("Unknown config key: "+e);return a[e]},t.set=function(e,t){if(!a.hasOwnProperty(e))throw new Error("Unknown config key: "+e);a[e]=t},t.all=function(){return r.copyObject(a)},t.$modes={},t.moduleUrl=function(e,t){if(a.$moduleUrls[e])return a.$moduleUrls[e];var n=e.split("/");t=t||n[n.length-2]||"";var r=t=="snippets"?"/":"-",i=n[n.length-1];if(t=="worker"&&r=="-"){var s=new RegExp("^"+t+"[\\-_]|[\\-_]"+t+"$","g");i=i.replace(s,"")}(!i||i==t)&&n.length>1&&(i=n[n.length-2]);var o=a[t+"Path"];return o==null?o=a.basePath:r=="/"&&(t=r=""),o&&o.slice(-1)!="/"&&(o+="/"),o+t+r+i+this.get("suffix")},t.setModuleUrl=function(e,t){return a.$moduleUrls[e]=t},t.$loading={},t.loadModule=function(n,r){var i,o;Array.isArray(n)&&(o=n[0],n=n[1]);try{i=e(n)}catch(u){}if(i&&!t.$loading[n])return r&&r(i);t.$loading[n]||(t.$loading[n]=[]),t.$loading[n].push(r);if(t.$loading[n].length>1)return;var a=function(){e([n],function(e){t._emit("load.module",{name:n,module:e});var r=t.$loading[n];t.$loading[n]=null,r.forEach(function(t){t&&t(e)})})};if(!t.get("packaged"))return a();s.loadScript(t.moduleUrl(n,o),a),f()};var f=function(){!a.basePath&&!a.workerPath&&!a.modePath&&!a.themePath&&!Object.keys(a.$moduleUrls).length&&(console.error("Unable to infer path to ace from script src,","use ace.config.set('basePath', 'path') to enable dynamic loading of modes and themes","or with webpack use ace/webpack-resolver"),f=function(){})};t.init=l}),ace.define("ace/mouse/mouse_handler",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/mouse/default_handlers","ace/mouse/default_gutter_handler","ace/mouse/mouse_event","ace/mouse/dragdrop_handler","ace/config"],function(e,t,n){"use strict";var r=e("../lib/event"),i=e("../lib/useragent"),s=e("./default_handlers").DefaultHandlers,o=e("./default_gutter_handler").GutterHandler,u=e("./mouse_event").MouseEvent,a=e("./dragdrop_handler").DragdropHandler,f=e("../config"),l=function(e){var t=this;this.editor=e,new s(this),new o(this),new a(this);var n=function(t){var n=!document.hasFocus||!document.hasFocus()||!e.isFocused()&&document.activeElement==(e.textInput&&e.textInput.getElement());n&&window.focus(),e.focus()},u=e.renderer.getMouseEventTarget();r.addListener(u,"click",this.onMouseEvent.bind(this,"click")),r.addListener(u,"mousemove",this.onMouseMove.bind(this,"mousemove")),r.addMultiMouseDownListener([u,e.renderer.scrollBarV&&e.renderer.scrollBarV.inner,e.renderer.scrollBarH&&e.renderer.scrollBarH.inner,e.textInput&&e.textInput.getElement()].filter(Boolean),[400,300,250],this,"onMouseEvent"),r.addMouseWheelListener(e.container,this.onMouseWheel.bind(this,"mousewheel")),r.addTouchMoveListener(e.container,this.onTouchMove.bind(this,"touchmove"));var f=e.renderer.$gutter;r.addListener(f,"mousedown",this.onMouseEvent.bind(this,"guttermousedown")),r.addListener(f,"click",this.onMouseEvent.bind(this,"gutterclick")),r.addListener(f,"dblclick",this.onMouseEvent.bind(this,"gutterdblclick")),r.addListener(f,"mousemove",this.onMouseEvent.bind(this,"guttermousemove")),r.addListener(u,"mousedown",n),r.addListener(f,"mousedown",n),i.isIE&&e.renderer.scrollBarV&&(r.addListener(e.renderer.scrollBarV.element,"mousedown",n),r.addListener(e.renderer.scrollBarH.element,"mousedown",n)),e.on("mousemove",function(n){if(t.state||t.$dragDelay||!t.$dragEnabled)return;var r=e.renderer.screenToTextCoordinates(n.x,n.y),i=e.session.selection.getRange(),s=e.renderer;!i.isEmpty()&&i.insideStart(r.row,r.column)?s.setCursorStyle("default"):s.setCursorStyle("")})};(function(){this.onMouseEvent=function(e,t){this.editor._emit(e,new u(t,this.editor))},this.onMouseMove=function(e,t){var n=this.editor._eventRegistry&&this.editor._eventRegistry.mousemove;if(!n||!n.length)return;this.editor._emit(e,new u(t,this.editor))},this.onMouseWheel=function(e,t){var n=new u(t,this.editor);n.speed=this.$scrollSpeed*2,n.wheelX=t.wheelX,n.wheelY=t.wheelY,this.editor._emit(e,n)},this.onTouchMove=function(e,t){var n=new u(t,this.editor);n.speed=1,n.wheelX=t.wheelX,n.wheelY=t.wheelY,this.editor._emit(e,n)},this.setState=function(e){this.state=e},this.captureMouse=function(e,t){this.x=e.x,this.y=e.y,this.isMousePressed=!0;var n=this.editor,s=this.editor.renderer;s.$keepTextAreaAtCursor&&(s.$keepTextAreaAtCursor=null);var o=this,a=function(e){if(!e)return;if(i.isWebKit&&!e.which&&o.releaseMouse)return o.releaseMouse();o.x=e.clientX,o.y=e.clientY,t&&t(e),o.mouseEvent=new u(e,o.editor),o.$mouseMoved=!0},f=function(e){n.off("beforeEndOperation",c),clearInterval(h),l(),o[o.state+"End"]&&o[o.state+"End"](e),o.state="",s.$keepTextAreaAtCursor==null&&(s.$keepTextAreaAtCursor=!0,s.$moveTextAreaToCursor()),o.isMousePressed=!1,o.$onCaptureMouseMove=o.releaseMouse=null,e&&o.onMouseEvent("mouseup",e),n.endOperation()},l=function(){o[o.state]&&o[o.state](),o.$mouseMoved=!1};if(i.isOldIE&&e.domEvent.type=="dblclick")return setTimeout(function(){f(e)});var c=function(e){if(!o.releaseMouse)return;n.curOp.command.name&&n.curOp.selectionChanged&&(o[o.state+"End"]&&o[o.state+"End"](),o.state="",o.releaseMouse())};n.on("beforeEndOperation",c),n.startOperation({command:{name:"mouse"}}),o.$onCaptureMouseMove=a,o.releaseMouse=r.capture(this.editor.container,a,f);var h=setInterval(l,20)},this.releaseMouse=null,this.cancelContextMenu=function(){var e=function(t){if(t&&t.domEvent&&t.domEvent.type!="contextmenu")return;this.editor.off("nativecontextmenu",e),t&&t.domEvent&&r.stopEvent(t.domEvent)}.bind(this);setTimeout(e,10),this.editor.on("nativecontextmenu",e)}}).call(l.prototype),f.defineOptions(l.prototype,"mouseHandler",{scrollSpeed:{initialValue:2},dragDelay:{initialValue:i.isMac?150:0},dragEnabled:{initialValue:!0},focusTimeout:{initialValue:0},tooltipFollowsMouse:{initialValue:!0}}),t.MouseHandler=l}),ace.define("ace/mouse/fold_handler",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";function i(e){e.on("click",function(t){var n=t.getDocumentPosition(),i=e.session,s=i.getFoldAt(n.row,n.column,1);s&&(t.getAccelKey()?i.removeFold(s):i.expandFold(s),t.stop());var o=t.domEvent&&t.domEvent.target;o&&r.hasCssClass(o,"ace_inline_button")&&r.hasCssClass(o,"ace_toggle_wrap")&&(i.setOption("wrap",!0),e.renderer.scrollCursorIntoView())}),e.on("gutterclick",function(t){var n=e.renderer.$gutterLayer.getRegion(t);if(n=="foldWidgets"){var r=t.getDocumentPosition().row,i=e.session;i.foldWidgets&&i.foldWidgets[r]&&e.session.onFoldWidgetClick(r,t),e.isFocused()||e.focus(),t.stop()}}),e.on("gutterdblclick",function(t){var n=e.renderer.$gutterLayer.getRegion(t);if(n=="foldWidgets"){var r=t.getDocumentPosition().row,i=e.session,s=i.getParentFoldRangeData(r,!0),o=s.range||s.firstRange;if(o){r=o.start.row;var u=i.getFoldAt(r,i.getLine(r).length,1);u?i.removeFold(u):(i.addFold("...",o),e.renderer.scrollCursorIntoView({row:o.start.row,column:0}))}t.stop()}})}var r=e("../lib/dom");t.FoldHandler=i}),ace.define("ace/keyboard/keybinding",["require","exports","module","ace/lib/keys","ace/lib/event"],function(e,t,n){"use strict";var r=e("../lib/keys"),i=e("../lib/event"),s=function(e){this.$editor=e,this.$data={editor:e},this.$handlers=[],this.setDefaultHandler(e.commands)};(function(){this.setDefaultHandler=function(e){this.removeKeyboardHandler(this.$defaultHandler),this.$defaultHandler=e,this.addKeyboardHandler(e,0)},this.setKeyboardHandler=function(e){var t=this.$handlers;if(t[t.length-1]==e)return;while(t[t.length-1]&&t[t.length-1]!=this.$defaultHandler)this.removeKeyboardHandler(t[t.length-1]);this.addKeyboardHandler(e,1)},this.addKeyboardHandler=function(e,t){if(!e)return;typeof e=="function"&&!e.handleKeyboard&&(e.handleKeyboard=e);var n=this.$handlers.indexOf(e);n!=-1&&this.$handlers.splice(n,1),t==undefined?this.$handlers.push(e):this.$handlers.splice(t,0,e),n==-1&&e.attach&&e.attach(this.$editor)},this.removeKeyboardHandler=function(e){var t=this.$handlers.indexOf(e);return t==-1?!1:(this.$handlers.splice(t,1),e.detach&&e.detach(this.$editor),!0)},this.getKeyboardHandler=function(){return this.$handlers[this.$handlers.length-1]},this.getStatusText=function(){var e=this.$data,t=e.editor;return this.$handlers.map(function(n){return n.getStatusText&&n.getStatusText(t,e)||""}).filter(Boolean).join(" ")},this.$callKeyboardHandlers=function(e,t,n,r){var s,o=!1,u=this.$editor.commands;for(var a=this.$handlers.length;a--;){s=this.$handlers[a].handleKeyboard(this.$data,e,t,n,r);if(!s||!s.command)continue;s.command=="null"?o=!0:o=u.exec(s.command,this.$editor,s.args,r),o&&r&&e!=-1&&s.passEvent!=1&&s.command.passEvent!=1&&i.stopEvent(r);if(o)break}return!o&&e==-1&&(s={command:"insertstring"},o=u.exec("insertstring",this.$editor,t)),o&&this.$editor._signal&&this.$editor._signal("keyboardActivity",s),o},this.onCommandKey=function(e,t,n){var i=r.keyCodeToString(n);this.$callKeyboardHandlers(t,i,n,e)},this.onTextInput=function(e){this.$callKeyboardHandlers(-1,e)}}).call(s.prototype),t.KeyBinding=s}),ace.define("ace/lib/bidiutil",["require","exports","module"],function(e,t,n){"use strict";function F(e,t,n,r){var i=s?d:p,c=null,h=null,v=null,m=0,g=null,y=null,b=-1,w=null,E=null,T=[];if(!r)for(w=0,r=[];w<n;w++)r[w]=R(e[w]);o=s,u=!1,a=!1,f=!1,l=!1;for(E=0;E<n;E++){c=m,T[E]=h=q(e,r,T,E),m=i[c][h],g=m&240,m&=15,t[E]=v=i[m][5];if(g>0)if(g==16){for(w=b;w<E;w++)t[w]=1;b=-1}else b=-1;y=i[m][6];if(y)b==-1&&(b=E);else if(b>-1){for(w=b;w<E;w++)t[w]=v;b=-1}r[E]==S&&(t[E]=0),o|=v}if(l)for(w=0;w<n;w++)if(r[w]==x){t[w]=s;for(var C=w-1;C>=0;C--){if(r[C]!=N)break;t[C]=s}}}function I(e,t,n){if(o<e)return;if(e==1&&s==m&&!f){n.reverse();return}var r=n.length,i=0,u,a,l,c;while(i<r){if(t[i]>=e){u=i+1;while(u<r&&t[u]>=e)u++;for(a=i,l=u-1;a<l;a++,l--)c=n[a],n[a]=n[l],n[l]=c;i=u}i++}}function q(e,t,n,r){var i=t[r],o,c,h,p;switch(i){case g:case y:u=!1;case E:case w:return i;case b:return u?w:b;case T:return u=!0,a=!0,y;case N:return E;case C:if(r<1||r+1>=t.length||(o=n[r-1])!=b&&o!=w||(c=t[r+1])!=b&&c!=w)return E;return u&&(c=w),c==o?c:E;case k:o=r>0?n[r-1]:S;if(o==b&&r+1<t.length&&t[r+1]==b)return b;return E;case L:if(r>0&&n[r-1]==b)return b;if(u)return E;p=r+1,h=t.length;while(p<h&&t[p]==L)p++;if(p<h&&t[p]==b)return b;return E;case A:h=t.length,p=r+1;while(p<h&&t[p]==A)p++;if(p<h){var d=e[r],v=d>=1425&&d<=2303||d==64286;o=t[p];if(v&&(o==y||o==T))return y}if(r<1||(o=t[r-1])==S)return E;return n[r-1];case S:return u=!1,f=!0,s;case x:return l=!0,E;case O:case M:case D:case P:case _:u=!1;case H:return E}}function R(e){var t=e.charCodeAt(0),n=t>>8;return n==0?t>191?g:B[t]:n==5?/[\u0591-\u05f4]/.test(e)?y:g:n==6?/[\u0610-\u061a\u064b-\u065f\u06d6-\u06e4\u06e7-\u06ed]/.test(e)?A:/[\u0660-\u0669\u066b-\u066c]/.test(e)?w:t==1642?L:/[\u06f0-\u06f9]/.test(e)?b:T:n==32&&t<=8287?j[t&255]:n==254?t>=65136?T:E:E}function U(e){return e>="\u064b"&&e<="\u0655"}var r=["\u0621","\u0641"],i=["\u063a","\u064a"],s=0,o=0,u=!1,a=!1,f=!1,l=!1,c=!1,h=!1,p=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],d=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],v=0,m=1,g=0,y=1,b=2,w=3,E=4,S=5,x=6,T=7,N=8,C=9,k=10,L=11,A=12,O=13,M=14,_=15,D=16,P=17,H=18,B=[H,H,H,H,H,H,H,H,H,x,S,x,N,S,H,H,H,H,H,H,H,H,H,H,H,H,H,H,S,S,S,x,N,E,E,L,L,L,E,E,E,E,E,k,C,k,C,C,b,b,b,b,b,b,b,b,b,b,C,E,E,E,E,E,E,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,E,E,E,E,E,E,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,E,E,E,E,H,H,H,H,H,H,S,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,C,E,L,L,L,L,E,E,E,E,g,E,E,H,E,E,L,L,b,b,E,g,E,E,E,b,g,E,E,E,E,E],j=[N,N,N,N,N,N,N,N,N,N,N,H,H,H,g,y,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,N,S,O,M,_,D,P,C,L,L,L,L,L,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,C,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,N];t.L=g,t.R=y,t.EN=b,t.ON_R=3,t.AN=4,t.R_H=5,t.B=6,t.RLE=7,t.DOT="\u00b7",t.doBidiReorder=function(e,n,r){if(e.length<2)return{};var i=e.split(""),o=new Array(i.length),u=new Array(i.length),a=[];s=r?m:v,F(i,a,i.length,n);for(var f=0;f<o.length;o[f]=f,f++);I(2,a,o),I(1,a,o);for(var f=0;f<o.length-1;f++)n[f]===w?a[f]=t.AN:a[f]===y&&(n[f]>T&&n[f]<O||n[f]===E||n[f]===H)?a[f]=t.ON_R:f>0&&i[f-1]==="\u0644"&&/\u0622|\u0623|\u0625|\u0627/.test(i[f])&&(a[f-1]=a[f]=t.R_H,f++);i[i.length-1]===t.DOT&&(a[i.length-1]=t.B),i[0]==="\u202b"&&(a[0]=t.RLE);for(var f=0;f<o.length;f++)u[f]=a[o[f]];return{logicalFromVisual:o,bidiLevels:u}},t.hasBidiCharacters=function(e,t){var n=!1;for(var r=0;r<e.length;r++)t[r]=R(e.charAt(r)),!n&&(t[r]==y||t[r]==T||t[r]==w)&&(n=!0);return n},t.getVisualFromLogicalIdx=function(e,t){for(var n=0;n<t.logicalFromVisual.length;n++)if(t.logicalFromVisual[n]==e)return n;return 0}}),ace.define("ace/bidihandler",["require","exports","module","ace/lib/bidiutil","ace/lib/lang"],function(e,t,n){"use strict";var r=e("./lib/bidiutil"),i=e("./lib/lang"),s=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\u202B]/,o=function(e){this.session=e,this.bidiMap={},this.currentRow=null,this.bidiUtil=r,this.charWidths=[],this.EOL="\u00ac",this.showInvisibles=!0,this.isRtlDir=!1,this.line="",this.wrapIndent=0,this.EOF="\u00b6",this.RLE="\u202b",this.contentWidth=0,this.fontMetrics=null,this.rtlLineOffset=0,this.wrapOffset=0,this.isMoveLeftOperation=!1,this.seenBidi=s.test(e.getValue())};(function(){this.isBidiRow=function(e,t,n){return this.seenBidi?(e!==this.currentRow&&(this.currentRow=e,this.updateRowLine(t,n),this.updateBidiMap()),this.bidiMap.bidiLevels):!1},this.onChange=function(e){this.seenBidi?this.currentRow=null:e.action=="insert"&&s.test(e.lines.join("\n"))&&(this.seenBidi=!0,this.currentRow=null)},this.getDocumentRow=function(){var e=0,t=this.session.$screenRowCache;if(t.length){var n=this.session.$getRowCacheIndex(t,this.currentRow);n>=0&&(e=this.session.$docRowCache[n])}return e},this.getSplitIndex=function(){var e=0,t=this.session.$screenRowCache;if(t.length){var n,r=this.session.$getRowCacheIndex(t,this.currentRow);while(this.currentRow-e>0){n=this.session.$getRowCacheIndex(t,this.currentRow-e-1);if(n!==r)break;r=n,e++}}else e=this.currentRow;return e},this.updateRowLine=function(e,t){e===undefined&&(e=this.getDocumentRow());var n=e===this.session.getLength()-1,s=n?this.EOF:this.EOL;this.wrapIndent=0,this.line=this.session.getLine(e),this.isRtlDir=this.line.charAt(0)===this.RLE;if(this.session.$useWrapMode){var o=this.session.$wrapData[e];o&&(t===undefined&&(t=this.getSplitIndex()),t>0&&o.length?(this.wrapIndent=o.indent,this.wrapOffset=this.wrapIndent*this.charWidths[r.L],this.line=t<o.length?this.line.substring(o[t-1],o[t]):this.line.substring(o[o.length-1])):this.line=this.line.substring(0,o[t])),t==o.length&&(this.line+=this.showInvisibles?s:r.DOT)}else this.line+=this.showInvisibles?s:r.DOT;var u=this.session,a=0,f;this.line=this.line.replace(/\t|[\u1100-\u2029, \u202F-\uFFE6]/g,function(e,t){return e===" "||u.isFullWidth(e.charCodeAt(0))?(f=e===" "?u.getScreenTabSize(t+a):2,a+=f-1,i.stringRepeat(r.DOT,f)):e}),this.isRtlDir&&(this.fontMetrics.$main.innerHTML=this.line.charAt(this.line.length-1)==r.DOT?this.line.substr(0,this.line.length-1):this.line,this.rtlLineOffset=this.contentWidth-this.fontMetrics.$main.getBoundingClientRect().width)},this.updateBidiMap=function(){var e=[];r.hasBidiCharacters(this.line,e)||this.isRtlDir?this.bidiMap=r.doBidiReorder(this.line,e,this.isRtlDir):this.bidiMap={}},this.markAsDirty=function(){this.currentRow=null},this.updateCharacterWidths=function(e){if(this.characterWidth===e.$characterSize.width)return;this.fontMetrics=e;var t=this.characterWidth=e.$characterSize.width,n=e.$measureCharWidth("\u05d4");this.charWidths[r.L]=this.charWidths[r.EN]=this.charWidths[r.ON_R]=t,this.charWidths[r.R]=this.charWidths[r.AN]=n,this.charWidths[r.R_H]=n*.45,this.charWidths[r.B]=this.charWidths[r.RLE]=0,this.currentRow=null},this.setShowInvisibles=function(e){this.showInvisibles=e,this.currentRow=null},this.setEolChar=function(e){this.EOL=e},this.setContentWidth=function(e){this.contentWidth=e},this.isRtlLine=function(e){return e!=undefined?this.session.getLine(e).charAt(0)==this.RLE:this.isRtlDir},this.setRtlDirection=function(e,t){var n=e.getCursorPosition();for(var r=e.selection.getSelectionAnchor().row;r<=n.row;r++)!t&&e.session.getLine(r).charAt(0)===e.session.$bidiHandler.RLE?e.session.doc.removeInLine(r,0,1):t&&e.session.getLine(r).charAt(0)!==e.session.$bidiHandler.RLE&&e.session.doc.insert({column:0,row:r},e.session.$bidiHandler.RLE)},this.getPosLeft=function(e){e-=this.wrapIndent;var t=this.line.charAt(0)===this.RLE?1:0,n=e>t?this.session.getOverwrite()?e:e-1:t,i=r.getVisualFromLogicalIdx(n,this.bidiMap),s=this.bidiMap.bidiLevels,o=0;!this.session.getOverwrite()&&e<=t&&s[i]%2!==0&&i++;for(var u=0;u<i;u++)o+=this.charWidths[s[u]];return!this.session.getOverwrite()&&e>t&&s[i]%2===0&&(o+=this.charWidths[s[i]]),this.wrapIndent&&(o+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset),this.isRtlDir&&(o+=this.rtlLineOffset),o},this.getSelections=function(e,t){var n=this.bidiMap,r=n.bidiLevels,i,s=[],o=0,u=Math.min(e,t)-this.wrapIndent,a=Math.max(e,t)-this.wrapIndent,f=!1,l=!1,c=0;this.wrapIndent&&(o+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);for(var h,p=0;p<r.length;p++)h=n.logicalFromVisual[p],i=r[p],f=h>=u&&h<a,f&&!l?c=o:!f&&l&&s.push({left:c,width:o-c}),o+=this.charWidths[i],l=f;f&&p===r.length&&s.push({left:c,width:o-c});if(this.isRtlDir)for(var d=0;d<s.length;d++)s[d].left+=this.rtlLineOffset;return s},this.offsetToCol=function(e){this.isRtlDir&&(e-=this.rtlLineOffset);var t=0,e=Math.max(e,0),n=0,r=0,i=this.bidiMap.bidiLevels,s=this.charWidths[i[r]];this.wrapIndent&&(e-=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);while(e>n+s/2){n+=s;if(r===i.length-1){s=0;break}s=this.charWidths[i[++r]]}return r>0&&i[r-1]%2!==0&&i[r]%2===0?(e<n&&r--,t=this.bidiMap.logicalFromVisual[r]):r>0&&i[r-1]%2===0&&i[r]%2!==0?t=1+(e>n?this.bidiMap.logicalFromVisual[r]:this.bidiMap.logicalFromVisual[r-1]):this.isRtlDir&&r===i.length-1&&s===0&&i[r-1]%2===0||!this.isRtlDir&&r===0&&i[r]%2!==0?t=1+this.bidiMap.logicalFromVisual[r]:(r>0&&i[r-1]%2!==0&&s!==0&&r--,t=this.bidiMap.logicalFromVisual[r]),t===0&&this.isRtlDir&&t++,t+this.wrapIndent}}).call(o.prototype),t.BidiHandler=o}),ace.define("ace/selection",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/range"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/lang"),s=e("./lib/event_emitter").EventEmitter,o=e("./range").Range,u=function(e){this.session=e,this.doc=e.getDocument(),this.clearSelection(),this.cursor=this.lead=this.doc.createAnchor(0,0),this.anchor=this.doc.createAnchor(0,0),this.$silent=!1;var t=this;this.cursor.on("change",function(e){t.$cursorChanged=!0,t.$silent||t._emit("changeCursor"),!t.$isEmpty&&!t.$silent&&t._emit("changeSelection"),!t.$keepDesiredColumnOnChange&&e.old.column!=e.value.column&&(t.$desiredColumn=null)}),this.anchor.on("change",function(){t.$anchorChanged=!0,!t.$isEmpty&&!t.$silent&&t._emit("changeSelection")})};(function(){r.implement(this,s),this.isEmpty=function(){return this.$isEmpty||this.anchor.row==this.lead.row&&this.anchor.column==this.lead.column},this.isMultiLine=function(){return!this.$isEmpty&&this.anchor.row!=this.cursor.row},this.getCursor=function(){return this.lead.getPosition()},this.setSelectionAnchor=function(e,t){this.$isEmpty=!1,this.anchor.setPosition(e,t)},this.getAnchor=this.getSelectionAnchor=function(){return this.$isEmpty?this.getSelectionLead():this.anchor.getPosition()},this.getSelectionLead=function(){return this.lead.getPosition()},this.isBackwards=function(){var e=this.anchor,t=this.lead;return e.row>t.row||e.row==t.row&&e.column>t.column},this.getRange=function(){var e=this.anchor,t=this.lead;return this.$isEmpty?o.fromPoints(t,t):this.isBackwards()?o.fromPoints(t,e):o.fromPoints(e,t)},this.clearSelection=function(){this.$isEmpty||(this.$isEmpty=!0,this._emit("changeSelection"))},this.selectAll=function(){this.$setSelection(0,0,Number.MAX_VALUE,Number.MAX_VALUE)},this.setRange=this.setSelectionRange=function(e,t){var n=t?e.end:e.start,r=t?e.start:e.end;this.$setSelection(n.row,n.column,r.row,r.column)},this.$setSelection=function(e,t,n,r){var i=this.$isEmpty,s=this.inMultiSelectMode;this.$silent=!0,this.$cursorChanged=this.$anchorChanged=!1,this.anchor.setPosition(e,t),this.cursor.setPosition(n,r),this.$isEmpty=!o.comparePoints(this.anchor,this.cursor),this.$silent=!1,this.$cursorChanged&&this._emit("changeCursor"),(this.$cursorChanged||this.$anchorChanged||i!=this.$isEmpty||s)&&this._emit("changeSelection")},this.$moveSelection=function(e){var t=this.lead;this.$isEmpty&&this.setSelectionAnchor(t.row,t.column),e.call(this)},this.selectTo=function(e,t){this.$moveSelection(function(){this.moveCursorTo(e,t)})},this.selectToPosition=function(e){this.$moveSelection(function(){this.moveCursorToPosition(e)})},this.moveTo=function(e,t){this.clearSelection(),this.moveCursorTo(e,t)},this.moveToPosition=function(e){this.clearSelection(),this.moveCursorToPosition(e)},this.selectUp=function(){this.$moveSelection(this.moveCursorUp)},this.selectDown=function(){this.$moveSelection(this.moveCursorDown)},this.selectRight=function(){this.$moveSelection(this.moveCursorRight)},this.selectLeft=function(){this.$moveSelection(this.moveCursorLeft)},this.selectLineStart=function(){this.$moveSelection(this.moveCursorLineStart)},this.selectLineEnd=function(){this.$moveSelection(this.moveCursorLineEnd)},this.selectFileEnd=function(){this.$moveSelection(this.moveCursorFileEnd)},this.selectFileStart=function(){this.$moveSelection(this.moveCursorFileStart)},this.selectWordRight=function(){this.$moveSelection(this.moveCursorWordRight)},this.selectWordLeft=function(){this.$moveSelection(this.moveCursorWordLeft)},this.getWordRange=function(e,t){if(typeof t=="undefined"){var n=e||this.lead;e=n.row,t=n.column}return this.session.getWordRange(e,t)},this.selectWord=function(){this.setSelectionRange(this.getWordRange())},this.selectAWord=function(){var e=this.getCursor(),t=this.session.getAWordRange(e.row,e.column);this.setSelectionRange(t)},this.getLineRange=function(e,t){var n=typeof e=="number"?e:this.lead.row,r,i=this.session.getFoldLine(n);return i?(n=i.start.row,r=i.end.row):r=n,t===!0?new o(n,0,r,this.session.getLine(r).length):new o(n,0,r+1,0)},this.selectLine=function(){this.setSelectionRange(this.getLineRange())},this.moveCursorUp=function(){this.moveCursorBy(-1,0)},this.moveCursorDown=function(){this.moveCursorBy(1,0)},this.wouldMoveIntoSoftTab=function(e,t,n){var r=e.column,i=e.column+t;return n<0&&(r=e.column-t,i=e.column),this.session.isTabStop(e)&&this.doc.getLine(e.row).slice(r,i).split(" ").length-1==t},this.moveCursorLeft=function(){var e=this.lead.getPosition(),t;if(t=this.session.getFoldAt(e.row,e.column,-1))this.moveCursorTo(t.start.row,t.start.column);else if(e.column===0)e.row>0&&this.moveCursorTo(e.row-1,this.doc.getLine(e.row-1).length);else{var n=this.session.getTabSize();this.wouldMoveIntoSoftTab(e,n,-1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,-n):this.moveCursorBy(0,-1)}},this.moveCursorRight=function(){var e=this.lead.getPosition(),t;if(t=this.session.getFoldAt(e.row,e.column,1))this.moveCursorTo(t.end.row,t.end.column);else if(this.lead.column==this.doc.getLine(this.lead.row).length)this.lead.row<this.doc.getLength()-1&&this.moveCursorTo(this.lead.row+1,0);else{var n=this.session.getTabSize(),e=this.lead;this.wouldMoveIntoSoftTab(e,n,1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,n):this.moveCursorBy(0,1)}},this.moveCursorLineStart=function(){var e=this.lead.row,t=this.lead.column,n=this.session.documentToScreenRow(e,t),r=this.session.screenToDocumentPosition(n,0),i=this.session.getDisplayLine(e,null,r.row,r.column),s=i.match(/^\s*/);s[0].length!=t&&!this.session.$useEmacsStyleLineStart&&(r.column+=s[0].length),this.moveCursorToPosition(r)},this.moveCursorLineEnd=function(){var e=this.lead,t=this.session.getDocumentLastRowColumnPosition(e.row,e.column);if(this.lead.column==t.column){var n=this.session.getLine(t.row);if(t.column==n.length){var r=n.search(/\s+$/);r>0&&(t.column=r)}}this.moveCursorTo(t.row,t.column)},this.moveCursorFileEnd=function(){var e=this.doc.getLength()-1,t=this.doc.getLine(e).length;this.moveCursorTo(e,t)},this.moveCursorFileStart=function(){this.moveCursorTo(0,0)},this.moveCursorLongWordRight=function(){var e=this.lead.row,t=this.lead.column,n=this.doc.getLine(e),r=n.substring(t);this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0;var i=this.session.getFoldAt(e,t,1);if(i){this.moveCursorTo(i.end.row,i.end.column);return}this.session.nonTokenRe.exec(r)&&(t+=this.session.nonTokenRe.lastIndex,this.session.nonTokenRe.lastIndex=0,r=n.substring(t));if(t>=n.length){this.moveCursorTo(e,n.length),this.moveCursorRight(),e<this.doc.getLength()-1&&this.moveCursorWordRight();return}this.session.tokenRe.exec(r)&&(t+=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(e,t)},this.moveCursorLongWordLeft=function(){var e=this.lead.row,t=this.lead.column,n;if(n=this.session.getFoldAt(e,t,-1)){this.moveCursorTo(n.start.row,n.start.column);return}var r=this.session.getFoldStringAt(e,t,-1);r==null&&(r=this.doc.getLine(e).substring(0,t));var s=i.stringReverse(r);this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0,this.session.nonTokenRe.exec(s)&&(t-=this.session.nonTokenRe.lastIndex,s=s.slice(this.session.nonTokenRe.lastIndex),this.session.nonTokenRe.lastIndex=0);if(t<=0){this.moveCursorTo(e,0),this.moveCursorLeft(),e>0&&this.moveCursorWordLeft();return}this.session.tokenRe.exec(s)&&(t-=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(e,t)},this.$shortWordEndIndex=function(e){var t=0,n,r=/\s/,i=this.session.tokenRe;i.lastIndex=0;if(this.session.tokenRe.exec(e))t=this.session.tokenRe.lastIndex;else{while((n=e[t])&&r.test(n))t++;if(t<1){i.lastIndex=0;while((n=e[t])&&!i.test(n)){i.lastIndex=0,t++;if(r.test(n)){if(t>2){t--;break}while((n=e[t])&&r.test(n))t++;if(t>2)break}}}}return i.lastIndex=0,t},this.moveCursorShortWordRight=function(){var e=this.lead.row,t=this.lead.column,n=this.doc.getLine(e),r=n.substring(t),i=this.session.getFoldAt(e,t,1);if(i)return this.moveCursorTo(i.end.row,i.end.column);if(t==n.length){var s=this.doc.getLength();do e++,r=this.doc.getLine(e);while(e<s&&/^\s*$/.test(r));/^\s+/.test(r)||(r=""),t=0}var o=this.$shortWordEndIndex(r);this.moveCursorTo(e,t+o)},this.moveCursorShortWordLeft=function(){var e=this.lead.row,t=this.lead.column,n;if(n=this.session.getFoldAt(e,t,-1))return this.moveCursorTo(n.start.row,n.start.column);var r=this.session.getLine(e).substring(0,t);if(t===0){do e--,r=this.doc.getLine(e);while(e>0&&/^\s*$/.test(r));t=r.length,/\s+$/.test(r)||(r="")}var s=i.stringReverse(r),o=this.$shortWordEndIndex(s);return this.moveCursorTo(e,t-o)},this.moveCursorWordRight=function(){this.session.$selectLongWords?this.moveCursorLongWordRight():this.moveCursorShortWordRight()},this.moveCursorWordLeft=function(){this.session.$selectLongWords?this.moveCursorLongWordLeft():this.moveCursorShortWordLeft()},this.moveCursorBy=function(e,t){var n=this.session.documentToScreenPosition(this.lead.row,this.lead.column),r;t===0&&(e!==0&&(this.session.$bidiHandler.isBidiRow(n.row,this.lead.row)?(r=this.session.$bidiHandler.getPosLeft(n.column),n.column=Math.round(r/this.session.$bidiHandler.charWidths[0])):r=n.column*this.session.$bidiHandler.charWidths[0]),this.$desiredColumn?n.column=this.$desiredColumn:this.$desiredColumn=n.column);var i=this.session.screenToDocumentPosition(n.row+e,n.column,r);e!==0&&t===0&&i.row===this.lead.row&&i.column===this.lead.column&&this.session.lineWidgets&&this.session.lineWidgets[i.row]&&(i.row>0||e>0)&&i.row++,this.moveCursorTo(i.row,i.column+t,t===0)},this.moveCursorToPosition=function(e){this.moveCursorTo(e.row,e.column)},this.moveCursorTo=function(e,t,n){var r=this.session.getFoldAt(e,t,1);r&&(e=r.start.row,t=r.start.column),this.$keepDesiredColumnOnChange=!0;var i=this.session.getLine(e);/[\uDC00-\uDFFF]/.test(i.charAt(t))&&i.charAt(t-1)&&(this.lead.row==e&&this.lead.column==t+1?t-=1:t+=1),this.lead.setPosition(e,t),this.$keepDesiredColumnOnChange=!1,n||(this.$desiredColumn=null)},this.moveCursorToScreen=function(e,t,n){var r=this.session.screenToDocumentPosition(e,t);this.moveCursorTo(r.row,r.column,n)},this.detach=function(){this.lead.detach(),this.anchor.detach(),this.session=this.doc=null},this.fromOrientedRange=function(e){this.setSelectionRange(e,e.cursor==e.start),this.$desiredColumn=e.desiredColumn||this.$desiredColumn},this.toOrientedRange=function(e){var t=this.getRange();return e?(e.start.column=t.start.column,e.start.row=t.start.row,e.end.column=t.end.column,e.end.row=t.end.row):e=t,e.cursor=this.isBackwards()?e.start:e.end,e.desiredColumn=this.$desiredColumn,e},this.getRangeOfMovements=function(e){var t=this.getCursor();try{e(this);var n=this.getCursor();return o.fromPoints(t,n)}catch(r){return o.fromPoints(t,t)}finally{this.moveCursorToPosition(t)}},this.toJSON=function(){if(this.rangeCount)var e=this.ranges.map(function(e){var t=e.clone();return t.isBackwards=e.cursor==e.start,t});else{var e=this.getRange();e.isBackwards=this.isBackwards()}return e},this.fromJSON=function(e){if(e.start==undefined){if(this.rangeList){this.toSingleRange(e[0]);for(var t=e.length;t--;){var n=o.fromPoints(e[t].start,e[t].end);e[t].isBackwards&&(n.cursor=n.start),this.addRange(n,!0)}return}e=e[0]}this.rangeList&&this.toSingleRange(e),this.setSelectionRange(e,e.isBackwards)},this.isEqual=function(e){if((e.length||this.rangeCount)&&e.length!=this.rangeCount)return!1;if(!e.length||!this.ranges)return this.getRange().isEqual(e);for(var t=this.ranges.length;t--;)if(!this.ranges[t].isEqual(e[t]))return!1;return!0}}).call(u.prototype),t.Selection=u}),ace.define("ace/tokenizer",["require","exports","module","ace/config"],function(e,t,n){"use strict";var r=e("./config"),i=2e3,s=function(e){this.states=e,this.regExps={},this.matchMappings={};for(var t in this.states){var n=this.states[t],r=[],i=0,s=this.matchMappings[t]={defaultToken:"text"},o="g",u=[];for(var a=0;a<n.length;a++){var f=n[a];f.defaultToken&&(s.defaultToken=f.defaultToken),f.caseInsensitive&&(o="gi");if(f.regex==null)continue;f.regex instanceof RegExp&&(f.regex=f.regex.toString().slice(1,-1));var l=f.regex,c=(new RegExp("(?:("+l+")|(.))")).exec("a").length-2;Array.isArray(f.token)?f.token.length==1||c==1?f.token=f.token[0]:c-1!=f.token.length?(this.reportError("number of classes and regexp groups doesn't match",{rule:f,groupCount:c-1}),f.token=f.token[0]):(f.tokenArray=f.token,f.token=null,f.onMatch=this.$arrayTokens):typeof f.token=="function"&&!f.onMatch&&(c>1?f.onMatch=this.$applyToken:f.onMatch=f.token),c>1&&(/\\\d/.test(f.regex)?l=f.regex.replace(/\\([0-9]+)/g,function(e,t){return"\\"+(parseInt(t,10)+i+1)}):(c=1,l=this.removeCapturingGroups(f.regex)),!f.splitRegex&&typeof f.token!="string"&&u.push(f)),s[i]=a,i+=c,r.push(l),f.onMatch||(f.onMatch=null)}r.length||(s[0]=0,r.push("$")),u.forEach(function(e){e.splitRegex=this.createSplitterRegexp(e.regex,o)},this),this.regExps[t]=new RegExp("("+r.join(")|(")+")|($)",o)}};(function(){this.$setMaxTokenCount=function(e){i=e|0},this.$applyToken=function(e){var t=this.splitRegex.exec(e).slice(1),n=this.token.apply(this,t);if(typeof n=="string")return[{type:n,value:e}];var r=[];for(var i=0,s=n.length;i<s;i++)t[i]&&(r[r.length]={type:n[i],value:t[i]});return r},this.$arrayTokens=function(e){if(!e)return[];var t=this.splitRegex.exec(e);if(!t)return"text";var n=[],r=this.tokenArray;for(var i=0,s=r.length;i<s;i++)t[i+1]&&(n[n.length]={type:r[i],value:t[i+1]});return n},this.removeCapturingGroups=function(e){var t=e.replace(/\\.|\[(?:\\.|[^\\\]])*|\(\?[:=!]|(\()/g,function(e,t){return t?"(?:":e});return t},this.createSplitterRegexp=function(e,t){if(e.indexOf("(?=")!=-1){var n=0,r=!1,i={};e.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g,function(e,t,s,o,u,a){return r?r=u!="]":u?r=!0:o?(n==i.stack&&(i.end=a+1,i.stack=-1),n--):s&&(n++,s.length!=1&&(i.stack=n,i.start=a)),e}),i.end!=null&&/^\)*$/.test(e.substr(i.end))&&(e=e.substring(0,i.start)+e.substr(i.end))}return e.charAt(0)!="^"&&(e="^"+e),e.charAt(e.length-1)!="$"&&(e+="$"),new RegExp(e,(t||"").replace("g",""))},this.getLineTokens=function(e,t){if(t&&typeof t!="string"){var n=t.slice(0);t=n[0],t==="#tmp"&&(n.shift(),t=n.shift())}else var n=[];var r=t||"start",s=this.states[r];s||(r="start",s=this.states[r]);var o=this.matchMappings[r],u=this.regExps[r];u.lastIndex=0;var a,f=[],l=0,c=0,h={type:null,value:""};while(a=u.exec(e)){var p=o.defaultToken,d=null,v=a[0],m=u.lastIndex;if(m-v.length>l){var g=e.substring(l,m-v.length);h.type==p?h.value+=g:(h.type&&f.push(h),h={type:p,value:g})}for(var y=0;y<a.length-2;y++){if(a[y+1]===undefined)continue;d=s[o[y]],d.onMatch?p=d.onMatch(v,r,n,e):p=d.token,d.next&&(typeof d.next=="string"?r=d.next:r=d.next(r,n),s=this.states[r],s||(this.reportError("state doesn't exist",r),r="start",s=this.states[r]),o=this.matchMappings[r],l=m,u=this.regExps[r],u.lastIndex=m),d.consumeLineEnd&&(l=m);break}if(v)if(typeof p=="string")!!d&&d.merge===!1||h.type!==p?(h.type&&f.push(h),h={type:p,value:v}):h.value+=v;else if(p){h.type&&f.push(h),h={type:null,value:""};for(var y=0;y<p.length;y++)f.push(p[y])}if(l==e.length)break;l=m;if(c++>i){c>2*e.length&&this.reportError("infinite loop with in ace tokenizer",{startState:t,line:e});while(l<e.length)h.type&&f.push(h),h={value:e.substring(l,l+=2e3),type:"overflow"};r="start",n=[];break}}return h.type&&f.push(h),n.length>1&&n[0]!==r&&n.unshift("#tmp",r),{tokens:f,state:n.length?n:r}},this.reportError=r.reportError}).call(s.prototype),t.Tokenizer=s}),ace.define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/lang"],function(e,t,n){"use strict";var r=e("../lib/lang"),i=function(){this.$rules={start:[{token:"empty_line",regex:"^$"},{defaultToken:"text"}]}};(function(){this.addRules=function(e,t){if(!t){for(var n in e)this.$rules[n]=e[n];return}for(var n in e){var r=e[n];for(var i=0;i<r.length;i++){var s=r[i];if(s.next||s.onMatch)typeof s.next=="string"&&s.next.indexOf(t)!==0&&(s.next=t+s.next),s.nextState&&s.nextState.indexOf(t)!==0&&(s.nextState=t+s.nextState)}this.$rules[t+n]=r}},this.getRules=function(){return this.$rules},this.embedRules=function(e,t,n,i,s){var o=typeof e=="function"?(new e).getRules():e;if(i)for(var u=0;u<i.length;u++)i[u]=t+i[u];else{i=[];for(var a in o)i.push(t+a)}this.addRules(o,t);if(n){var f=Array.prototype[s?"push":"unshift"];for(var u=0;u<i.length;u++)f.apply(this.$rules[i[u]],r.deepCopy(n))}this.$embeds||(this.$embeds=[]),this.$embeds.push(t)},this.getEmbeds=function(){return this.$embeds};var e=function(e,t){return(e!="start"||t.length)&&t.unshift(this.nextState,e),this.nextState},t=function(e,t){return t.shift(),t.shift()||"start"};this.normalizeRules=function(){function i(s){var o=r[s];o.processed=!0;for(var u=0;u<o.length;u++){var a=o[u],f=null;Array.isArray(a)&&(f=a,a={}),!a.regex&&a.start&&(a.regex=a.start,a.next||(a.next=[]),a.next.push({defaultToken:a.token},{token:a.token+".end",regex:a.end||a.start,next:"pop"}),a.token=a.token+".start",a.push=!0);var l=a.next||a.push;if(l&&Array.isArray(l)){var c=a.stateName;c||(c=a.token,typeof c!="string"&&(c=c[0]||""),r[c]&&(c+=n++)),r[c]=l,a.next=c,i(c)}else l=="pop"&&(a.next=t);a.push&&(a.nextState=a.next||a.push,a.next=e,delete a.push);if(a.rules)for(var h in a.rules)r[h]?r[h].push&&r[h].push.apply(r[h],a.rules[h]):r[h]=a.rules[h];var p=typeof a=="string"?a:a.include;p&&(Array.isArray(p)?f=p.map(function(e){return r[e]}):f=r[p]);if(f){var d=[u,1].concat(f);a.noEscape&&(d=d.filter(function(e){return!e.next})),o.splice.apply(o,d),u--}a.keywordMap&&(a.token=this.createKeywordMapper(a.keywordMap,a.defaultToken||"text",a.caseInsensitive),delete a.defaultToken)}}var n=0,r=this.$rules;Object.keys(r).forEach(i,this)},this.createKeywordMapper=function(e,t,n,r){var i=Object.create(null);return Object.keys(e).forEach(function(t){var s=e[t];n&&(s=s.toLowerCase());var o=s.split(r||"|");for(var u=o.length;u--;)i[o[u]]=t}),Object.getPrototypeOf(i)&&(i.__proto__=null),this.$keywordList=Object.keys(i),e=null,n?function(e){return i[e.toLowerCase()]||t}:function(e){return i[e]||t}},this.getKeywords=function(){return this.$keywords}}).call(i.prototype),t.TextHighlightRules=i}),ace.define("ace/mode/behaviour",["require","exports","module"],function(e,t,n){"use strict";var r=function(){this.$behaviours={}};(function(){this.add=function(e,t,n){switch(undefined){case this.$behaviours:this.$behaviours={};case this.$behaviours[e]:this.$behaviours[e]={}}this.$behaviours[e][t]=n},this.addBehaviours=function(e){for(var t in e)for(var n in e[t])this.add(t,n,e[t][n])},this.remove=function(e){this.$behaviours&&this.$behaviours[e]&&delete this.$behaviours[e]},this.inherit=function(e,t){if(typeof e=="function")var n=(new e).getBehaviours(t);else var n=e.getBehaviours(t);this.addBehaviours(n)},this.getBehaviours=function(e){if(!e)return this.$behaviours;var t={};for(var n=0;n<e.length;n++)this.$behaviours[e[n]]&&(t[e[n]]=this.$behaviours[e[n]]);return t}}).call(r.prototype),t.Behaviour=r}),ace.define("ace/token_iterator",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("./range").Range,i=function(e,t,n){this.$session=e,this.$row=t,this.$rowTokens=e.getTokens(t);var r=e.getTokenAt(t,n);this.$tokenIndex=r?r.index:-1};(function(){this.stepBackward=function(){this.$tokenIndex-=1;while(this.$tokenIndex<0){this.$row-=1;if(this.$row<0)return this.$row=0,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=this.$rowTokens.length-1}return this.$rowTokens[this.$tokenIndex]},this.stepForward=function(){this.$tokenIndex+=1;var e;while(this.$tokenIndex>=this.$rowTokens.length){this.$row+=1,e||(e=this.$session.getLength());if(this.$row>=e)return this.$row=e-1,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=0}return this.$rowTokens[this.$tokenIndex]},this.getCurrentToken=function(){return this.$rowTokens[this.$tokenIndex]},this.getCurrentTokenRow=function(){return this.$row},this.getCurrentTokenColumn=function(){var e=this.$rowTokens,t=this.$tokenIndex,n=e[t].start;if(n!==undefined)return n;n=0;while(t>0)t-=1,n+=e[t].value.length;return n},this.getCurrentTokenPosition=function(){return{row:this.$row,column:this.getCurrentTokenColumn()}},this.getCurrentTokenRange=function(){var e=this.$rowTokens[this.$tokenIndex],t=this.getCurrentTokenColumn();return new r(this.$row,t,this.$row,t+e.value.length)}}).call(i.prototype),t.TokenIterator=i}),ace.define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../behaviour").Behaviour,s=e("../../token_iterator").TokenIterator,o=e("../../lib/lang"),u=["text","paren.rparen","punctuation.operator"],a=["text","paren.rparen","punctuation.operator","comment"],f,l={},c={'"':'"',"'":"'"},h=function(e){var t=-1;e.multiSelect&&(t=e.selection.index,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:"",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:"",maybeInsertedLineEnd:""}},p=function(e,t,n,r){var i=e.end.row-e.start.row;return{text:n+t+r,selection:[0,e.start.column+1,i,e.end.column+(i?0:1)]}},d=function(e){this.add("braces","insertion",function(t,n,r,i,s){var u=r.getCursorPosition(),a=i.doc.getLine(u.row);if(s=="{"){h(r);var l=r.getSelectionRange(),c=i.doc.getTextRange(l);if(c!==""&&c!=="{"&&r.getWrapBehavioursEnabled())return p(l,c,"{","}");if(d.isSaneInsertion(r,i))return/[\]\}\)]/.test(a[u.column])||r.inMultiSelectMode||e&&e.braces?(d.recordAutoInsert(r,i,"}"),{text:"{}",selection:[1,1]}):(d.recordMaybeInsert(r,i,"{"),{text:"{",selection:[1,1]})}else if(s=="}"){h(r);var v=a.substring(u.column,u.column+1);if(v=="}"){var m=i.$findOpeningBracket("}",{column:u.column+1,row:u.row});if(m!==null&&d.isAutoInsertedClosing(u,a,s))return d.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}else{if(s=="\n"||s=="\r\n"){h(r);var g="";d.isMaybeInsertedClosing(u,a)&&(g=o.stringRepeat("}",f.maybeInsertedBrackets),d.clearMaybeInsertedClosing());var v=a.substring(u.column,u.column+1);if(v==="}"){var y=i.findMatchingBracket({row:u.row,column:u.column+1},"}");if(!y)return null;var b=this.$getIndent(i.getLine(y.row))}else{if(!g){d.clearMaybeInsertedClosing();return}var b=this.$getIndent(a)}var w=b+i.getTabString();return{text:"\n"+w+"\n"+b+g,selection:[1,w.length,1,w.length]}}d.clearMaybeInsertedClosing()}}),this.add("braces","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="{"){h(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u=="}")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add("parens","insertion",function(e,t,n,r,i){if(i=="("){h(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==""&&n.getWrapBehavioursEnabled())return p(s,o,"(",")");if(d.isSaneInsertion(n,r))return d.recordAutoInsert(n,r,")"),{text:"()",selection:[1,1]}}else if(i==")"){h(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==")"){var l=r.$findOpeningBracket(")",{column:u.column+1,row:u.row});if(l!==null&&d.isAutoInsertedClosing(u,a,i))return d.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("parens","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="("){h(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==")")return i.end.column++,i}}),this.add("brackets","insertion",function(e,t,n,r,i){if(i=="["){h(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==""&&n.getWrapBehavioursEnabled())return p(s,o,"[","]");if(d.isSaneInsertion(n,r))return d.recordAutoInsert(n,r,"]"),{text:"[]",selection:[1,1]}}else if(i=="]"){h(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f=="]"){var l=r.$findOpeningBracket("]",{column:u.column+1,row:u.row});if(l!==null&&d.isAutoInsertedClosing(u,a,i))return d.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("brackets","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="["){h(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u=="]")return i.end.column++,i}}),this.add("string_dquotes","insertion",function(e,t,n,r,i){var s=r.$mode.$quotes||c;if(i.length==1&&s[i]){if(this.lineCommentStart&&this.lineCommentStart.indexOf(i)!=-1)return;h(n);var o=i,u=n.getSelectionRange(),a=r.doc.getTextRange(u);if(a!==""&&(a.length!=1||!s[a])&&n.getWrapBehavioursEnabled())return p(u,a,o,o);if(!a){var f=n.getCursorPosition(),l=r.doc.getLine(f.row),d=l.substring(f.column-1,f.column),v=l.substring(f.column,f.column+1),m=r.getTokenAt(f.row,f.column),g=r.getTokenAt(f.row,f.column+1);if(d=="\\"&&m&&/escape/.test(m.type))return null;var y=m&&/string|escape/.test(m.type),b=!g||/string|escape/.test(g.type),w;if(v==o)w=y!==b,w&&/string\.end/.test(g.type)&&(w=!1);else{if(y&&!b)return null;if(y&&b)return null;var E=r.$mode.tokenRe;E.lastIndex=0;var S=E.test(d);E.lastIndex=0;var x=E.test(d);if(S||x)return null;if(v&&!/[\s;,.})\]\\]/.test(v))return null;w=!0}return{text:w?o+o:"",selection:[1,1]}}}}),this.add("string_dquotes","deletion",function(e,t,n,r,i){var s=r.$mode.$quotes||c,o=r.doc.getTextRange(i);if(!i.isMultiLine()&&s.hasOwnProperty(o)){h(n);var u=r.doc.getLine(i.start.row),a=u.substring(i.start.column+1,i.start.column+2);if(a==o)return i.end.column++,i}})};d.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||"text",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||"text",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||"text",a)},d.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},d.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},d.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},d.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},d.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},d.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},d.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(d,i),t.CstyleBehaviour=d}),ace.define("ace/unicode",["require","exports","module"],function(e,t,n){"use strict";var r=[48,9,8,25,5,0,2,25,48,0,11,0,5,0,6,22,2,30,2,457,5,11,15,4,8,0,2,0,18,116,2,1,3,3,9,0,2,2,2,0,2,19,2,82,2,138,2,4,3,155,12,37,3,0,8,38,10,44,2,0,2,1,2,1,2,0,9,26,6,2,30,10,7,61,2,9,5,101,2,7,3,9,2,18,3,0,17,58,3,100,15,53,5,0,6,45,211,57,3,18,2,5,3,11,3,9,2,1,7,6,2,2,2,7,3,1,3,21,2,6,2,0,4,3,3,8,3,1,3,3,9,0,5,1,2,4,3,11,16,2,2,5,5,1,3,21,2,6,2,1,2,1,2,1,3,0,2,4,5,1,3,2,4,0,8,3,2,0,8,15,12,2,2,8,2,2,2,21,2,6,2,1,2,4,3,9,2,2,2,2,3,0,16,3,3,9,18,2,2,7,3,1,3,21,2,6,2,1,2,4,3,8,3,1,3,2,9,1,5,1,2,4,3,9,2,0,17,1,2,5,4,2,2,3,4,1,2,0,2,1,4,1,4,2,4,11,5,4,4,2,2,3,3,0,7,0,15,9,18,2,2,7,2,2,2,22,2,9,2,4,4,7,2,2,2,3,8,1,2,1,7,3,3,9,19,1,2,7,2,2,2,22,2,9,2,4,3,8,2,2,2,3,8,1,8,0,2,3,3,9,19,1,2,7,2,2,2,22,2,15,4,7,2,2,2,3,10,0,9,3,3,9,11,5,3,1,2,17,4,23,2,8,2,0,3,6,4,0,5,5,2,0,2,7,19,1,14,57,6,14,2,9,40,1,2,0,3,1,2,0,3,0,7,3,2,6,2,2,2,0,2,0,3,1,2,12,2,2,3,4,2,0,2,5,3,9,3,1,35,0,24,1,7,9,12,0,2,0,2,0,5,9,2,35,5,19,2,5,5,7,2,35,10,0,58,73,7,77,3,37,11,42,2,0,4,328,2,3,3,6,2,0,2,3,3,40,2,3,3,32,2,3,3,6,2,0,2,3,3,14,2,56,2,3,3,66,5,0,33,15,17,84,13,619,3,16,2,25,6,74,22,12,2,6,12,20,12,19,13,12,2,2,2,1,13,51,3,29,4,0,5,1,3,9,34,2,3,9,7,87,9,42,6,69,11,28,4,11,5,11,11,39,3,4,12,43,5,25,7,10,38,27,5,62,2,28,3,10,7,9,14,0,89,75,5,9,18,8,13,42,4,11,71,55,9,9,4,48,83,2,2,30,14,230,23,280,3,5,3,37,3,5,3,7,2,0,2,0,2,0,2,30,3,52,2,6,2,0,4,2,2,6,4,3,3,5,5,12,6,2,2,6,67,1,20,0,29,0,14,0,17,4,60,12,5,0,4,11,18,0,5,0,3,9,2,0,4,4,7,0,2,0,2,0,2,3,2,10,3,3,6,4,5,0,53,1,2684,46,2,46,2,132,7,6,15,37,11,53,10,0,17,22,10,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,31,48,0,470,1,36,5,2,4,6,1,5,85,3,1,3,2,2,89,2,3,6,40,4,93,18,23,57,15,513,6581,75,20939,53,1164,68,45,3,268,4,27,21,31,3,13,13,1,2,24,9,69,11,1,38,8,3,102,3,1,111,44,25,51,13,68,12,9,7,23,4,0,5,45,3,35,13,28,4,64,15,10,39,54,10,13,3,9,7,22,4,1,5,66,25,2,227,42,2,1,3,9,7,11171,13,22,5,48,8453,301,3,61,3,105,39,6,13,4,6,11,2,12,2,4,2,0,2,1,2,1,2,107,34,362,19,63,3,53,41,11,5,15,17,6,13,1,25,2,33,4,2,134,20,9,8,25,5,0,2,25,12,88,4,5,3,5,3,5,3,2],i=0,s=[];for(var o=0;o<r.length;o+=2)s.push(i+=r[o]),r[o+1]&&s.push(45,i+=r[o+1]);t.wordChars=String.fromCharCode.apply(null,s)}),ace.define("ace/mode/text",["require","exports","module","ace/config","ace/tokenizer","ace/mode/text_highlight_rules","ace/mode/behaviour/cstyle","ace/unicode","ace/lib/lang","ace/token_iterator","ace/range"],function(e,t,n){"use strict";var r=e("../config"),i=e("../tokenizer").Tokenizer,s=e("./text_highlight_rules").TextHighlightRules,o=e("./behaviour/cstyle").CstyleBehaviour,u=e("../unicode"),a=e("../lib/lang"),f=e("../token_iterator").TokenIterator,l=e("../range").Range,c=function(){this.HighlightRules=s};(function(){this.$defaultBehaviour=new o,this.tokenRe=new RegExp("^["+u.wordChars+"\\$_]+","g"),this.nonTokenRe=new RegExp("^(?:[^"+u.wordChars+"\\$_]|\\s])+","g"),this.getTokenizer=function(){return this.$tokenizer||(this.$highlightRules=this.$highlightRules||new this.HighlightRules(this.$highlightRuleConfig),this.$tokenizer=new i(this.$highlightRules.getRules())),this.$tokenizer},this.lineCommentStart="",this.blockComment="",this.toggleCommentLines=function(e,t,n,r){function w(e){for(var t=n;t<=r;t++)e(i.getLine(t),t)}var i=t.doc,s=!0,o=!0,u=Infinity,f=t.getTabSize(),l=!1;if(!this.lineCommentStart){if(!this.blockComment)return!1;var c=this.blockComment.start,h=this.blockComment.end,p=new RegExp("^(\\s*)(?:"+a.escapeRegExp(c)+")"),d=new RegExp("(?:"+a.escapeRegExp(h)+")\\s*$"),v=function(e,t){if(g(e,t))return;if(!s||/\S/.test(e))i.insertInLine({row:t,column:e.length},h),i.insertInLine({row:t,column:u},c)},m=function(e,t){var n;(n=e.match(d))&&i.removeInLine(t,e.length-n[0].length,e.length),(n=e.match(p))&&i.removeInLine(t,n[1].length,n[0].length)},g=function(e,n){if(p.test(e))return!0;var r=t.getTokens(n);for(var i=0;i<r.length;i++)if(r[i].type==="comment")return!0}}else{if(Array.isArray(this.lineCommentStart))var p=this.lineCommentStart.map(a.escapeRegExp).join("|"),c=this.lineCommentStart[0];else var p=a.escapeRegExp(this.lineCommentStart),c=this.lineCommentStart;p=new RegExp("^(\\s*)(?:"+p+") ?"),l=t.getUseSoftTabs();var m=function(e,t){var n=e.match(p);if(!n)return;var r=n[1].length,s=n[0].length;!b(e,r,s)&&n[0][s-1]==" "&&s--,i.removeInLine(t,r,s)},y=c+" ",v=function(e,t){if(!s||/\S/.test(e))b(e,u,u)?i.insertInLine({row:t,column:u},y):i.insertInLine({row:t,column:u},c)},g=function(e,t){return p.test(e)},b=function(e,t,n){var r=0;while(t--&&e.charAt(t)==" ")r++;if(r%f!=0)return!1;var r=0;while(e.charAt(n++)==" ")r++;return f>2?r%f!=f-1:r%f==0}}var E=Infinity;w(function(e,t){var n=e.search(/\S/);n!==-1?(n<u&&(u=n),o&&!g(e,t)&&(o=!1)):E>e.length&&(E=e.length)}),u==Infinity&&(u=E,s=!1,o=!1),l&&u%f!=0&&(u=Math.floor(u/f)*f),w(o?m:v)},this.toggleBlockComment=function(e,t,n,r){var i=this.blockComment;if(!i)return;!i.start&&i[0]&&(i=i[0]);var s=new f(t,r.row,r.column),o=s.getCurrentToken(),u=t.selection,a=t.selection.toOrientedRange(),c,h;if(o&&/comment/.test(o.type)){var p,d;while(o&&/comment/.test(o.type)){var v=o.value.indexOf(i.start);if(v!=-1){var m=s.getCurrentTokenRow(),g=s.getCurrentTokenColumn()+v;p=new l(m,g,m,g+i.start.length);break}o=s.stepBackward()}var s=new f(t,r.row,r.column),o=s.getCurrentToken();while(o&&/comment/.test(o.type)){var v=o.value.indexOf(i.end);if(v!=-1){var m=s.getCurrentTokenRow(),g=s.getCurrentTokenColumn()+v;d=new l(m,g,m,g+i.end.length);break}o=s.stepForward()}d&&t.remove(d),p&&(t.remove(p),c=p.start.row,h=-i.start.length)}else h=i.start.length,c=n.start.row,t.insert(n.end,i.end),t.insert(n.start,i.start);a.start.row==c&&(a.start.column+=h),a.end.row==c&&(a.end.column+=h),t.selection.fromOrientedRange(a)},this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.checkOutdent=function(e,t,n){return!1},this.autoOutdent=function(e,t,n){},this.$getIndent=function(e){return e.match(/^\s*/)[0]},this.createWorker=function(e){return null},this.createModeDelegates=function(e){this.$embeds=[],this.$modes={};for(var t in e)if(e[t]){var n=e[t],i=n.prototype.$id,s=r.$modes[i];s||(r.$modes[i]=s=new n),r.$modes[t]||(r.$modes[t]=s),this.$embeds.push(t),this.$modes[t]=s}var o=["toggleBlockComment","toggleCommentLines","getNextLineIndent","checkOutdent","autoOutdent","transformAction","getCompletions"];for(var t=0;t<o.length;t++)(function(e){var n=o[t],r=e[n];e[o[t]]=function(){return this.$delegator(n,arguments,r)}})(this)},this.$delegator=function(e,t,n){var r=t[0];if(typeof r!="string"){if(Array.isArray(r[2])){var i=r[2][r[2].length-1],s=this.$modes[i];if(s)return s[e].apply(s,[r[1]].concat([].slice.call(t,1)))}r=r[0]}for(var o=0;o<this.$embeds.length;o++){if(!this.$modes[this.$embeds[o]])continue;var u=r.split(this.$embeds[o]);if(!u[0]&&u[1]){t[0]=u[1];var s=this.$modes[this.$embeds[o]];return s[e].apply(s,t)}}var a=n.apply(this,t);return n?a:undefined},this.transformAction=function(e,t,n,r,i){if(this.$behaviour){var s=this.$behaviour.getBehaviours();for(var o in s)if(s[o][t]){var u=s[o][t].apply(this,arguments);if(u)return u}}},this.getKeywords=function(e){if(!this.completionKeywords){var t=this.$tokenizer.rules,n=[];for(var r in t){var i=t[r];for(var s=0,o=i.length;s<o;s++)if(typeof i[s].token=="string")/keyword|support|storage/.test(i[s].token)&&n.push(i[s].regex);else if(typeof i[s].token=="object")for(var u=0,a=i[s].token.length;u<a;u++)if(/keyword|support|storage/.test(i[s].token[u])){var r=i[s].regex.match(/\(.+?\)/g)[u];n.push(r.substr(1,r.length-2))}}this.completionKeywords=n}return e?n.concat(this.$keywordList||[]):this.$keywordList},this.$createKeywordList=function(){return this.$highlightRules||this.getTokenizer(),this.$keywordList=this.$highlightRules.$keywordList||[]},this.getCompletions=function(e,t,n,r){var i=this.$keywordList||this.$createKeywordList();return i.map(function(e){return{name:e,value:e,score:0,meta:"keyword"}})},this.$id="ace/mode/text"}).call(c.prototype),t.Mode=c}),ace.define("ace/apply_delta",["require","exports","module"],function(e,t,n){"use strict";function r(e,t){throw console.log("Invalid Delta:",e),"Invalid Delta: "+t}function i(e,t){return t.row>=0&&t.row<e.length&&t.column>=0&&t.column<=e[t.row].length}function s(e,t){t.action!="insert"&&t.action!="remove"&&r(t,"delta.action must be 'insert' or 'remove'"),t.lines instanceof Array||r(t,"delta.lines must be an Array"),(!t.start||!t.end)&&r(t,"delta.start/end must be an present");var n=t.start;i(e,t.start)||r(t,"delta.start must be contained in document");var s=t.end;t.action=="remove"&&!i(e,s)&&r(t,"delta.end must contained in document for 'remove' actions");var o=s.row-n.row,u=s.column-(o==0?n.column:0);(o!=t.lines.length-1||t.lines[o].length!=u)&&r(t,"delta.range must match delta lines")}t.applyDelta=function(e,t,n){var r=t.start.row,i=t.start.column,s=e[r]||"";switch(t.action){case"insert":var o=t.lines;if(o.length===1)e[r]=s.substring(0,i)+t.lines[0]+s.substring(i);else{var u=[r,1].concat(t.lines);e.splice.apply(e,u),e[r]=s.substring(0,i)+e[r],e[r+t.lines.length-1]+=s.substring(i)}break;case"remove":var a=t.end.column,f=t.end.row;r===f?e[r]=s.substring(0,i)+s.substring(a):e.splice(r,f-r+1,s.substring(0,i)+e[f].substring(a))}}}),ace.define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/event_emitter").EventEmitter,s=t.Anchor=function(e,t,n){this.$onChange=this.onChange.bind(this),this.attach(e),typeof n=="undefined"?this.setPosition(t.row,t.column):this.setPosition(t,n)};(function(){function e(e,t,n){var r=n?e.column<=t.column:e.column<t.column;return e.row<t.row||e.row==t.row&&r}function t(t,n,r){var i=t.action=="insert",s=(i?1:-1)*(t.end.row-t.start.row),o=(i?1:-1)*(t.end.column-t.start.column),u=t.start,a=i?u:t.end;return e(n,u,r)?{row:n.row,column:n.column}:e(a,n,!r)?{row:n.row+s,column:n.column+(n.row==a.row?o:0)}:{row:u.row,column:u.column}}r.implement(this,i),this.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},this.getDocument=function(){return this.document},this.$insertRight=!1,this.onChange=function(e){if(e.start.row==e.end.row&&e.start.row!=this.row)return;if(e.start.row>this.row)return;var n=t(e,{row:this.row,column:this.column},this.$insertRight);this.setPosition(n.row,n.column,!0)},this.setPosition=function(e,t,n){var r;n?r={row:e,column:t}:r=this.$clipPositionToDocument(e,t);if(this.row==r.row&&this.column==r.column)return;var i={row:this.row,column:this.column};this.row=r.row,this.column=r.column,this._signal("change",{old:i,value:r})},this.detach=function(){this.document.removeEventListener("change",this.$onChange)},this.attach=function(e){this.document=e||this.document,this.document.on("change",this.$onChange)},this.$clipPositionToDocument=function(e,t){var n={};return e>=this.document.getLength()?(n.row=Math.max(0,this.document.getLength()-1),n.column=this.document.getLine(n.row).length):e<0?(n.row=0,n.column=0):(n.row=e,n.column=Math.min(this.document.getLine(n.row).length,Math.max(0,t))),t<0&&(n.column=0),n}}).call(s.prototype)}),ace.define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./apply_delta").applyDelta,s=e("./lib/event_emitter").EventEmitter,o=e("./range").Range,u=e("./anchor").Anchor,a=function(e){this.$lines=[""],e.length===0?this.$lines=[""]:Array.isArray(e)?this.insertMergedLines({row:0,column:0},e):this.insert({row:0,column:0},e)};(function(){r.implement(this,s),this.setValue=function(e){var t=this.getLength()-1;this.remove(new o(0,0,t,this.getLine(t).length)),this.insert({row:0,column:0},e)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(e,t){return new u(this,e,t)},"aaa".split(/a/).length===0?this.$split=function(e){return e.replace(/\r\n|\r/g,"\n").split("\n")}:this.$split=function(e){return e.split(/\r\n|\r|\n/)},this.$detectNewLine=function(e){var t=e.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=t?t[1]:"\n",this._signal("changeNewLineMode")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return"\r\n";case"unix":return"\n";default:return this.$autoNewLine||"\n"}},this.$autoNewLine="",this.$newLineMode="auto",this.setNewLineMode=function(e){if(this.$newLineMode===e)return;this.$newLineMode=e,this._signal("changeNewLineMode")},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(e){return e=="\r\n"||e=="\r"||e=="\n"},this.getLine=function(e){return this.$lines[e]||""},this.getLines=function(e,t){return this.$lines.slice(e,t+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(e){return this.getLinesForRange(e).join(this.getNewLineCharacter())},this.getLinesForRange=function(e){var t;if(e.start.row===e.end.row)t=[this.getLine(e.start.row).substring(e.start.column,e.end.column)];else{t=this.getLines(e.start.row,e.end.row),t[0]=(t[0]||"").substring(e.start.column);var n=t.length-1;e.end.row-e.start.row==n&&(t[n]=t[n].substring(0,e.end.column))}return t},this.insertLines=function(e,t){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(e,t)},this.removeLines=function(e,t){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(e,t)},this.insertNewLine=function(e){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(e,["",""])},this.insert=function(e,t){return this.getLength()<=1&&this.$detectNewLine(t),this.insertMergedLines(e,this.$split(t))},this.insertInLine=function(e,t){var n=this.clippedPos(e.row,e.column),r=this.pos(e.row,e.column+t.length);return this.applyDelta({start:n,end:r,action:"insert",lines:[t]},!0),this.clonePos(r)},this.clippedPos=function(e,t){var n=this.getLength();e===undefined?e=n:e<0?e=0:e>=n&&(e=n-1,t=undefined);var r=this.getLine(e);return t==undefined&&(t=r.length),t=Math.min(Math.max(t,0),r.length),{row:e,column:t}},this.clonePos=function(e){return{row:e.row,column:e.column}},this.pos=function(e,t){return{row:e,column:t}},this.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):(e.row=Math.max(0,e.row),e.column=Math.min(Math.max(e.column,0),this.getLine(e.row).length)),e},this.insertFullLines=function(e,t){e=Math.min(Math.max(e,0),this.getLength());var n=0;e<this.getLength()?(t=t.concat([""]),n=0):(t=[""].concat(t),e--,n=this.$lines[e].length),this.insertMergedLines({row:e,column:n},t)},this.insertMergedLines=function(e,t){var n=this.clippedPos(e.row,e.column),r={row:n.row+t.length-1,column:(t.length==1?n.column:0)+t[t.length-1].length};return this.applyDelta({start:n,end:r,action:"insert",lines:t}),this.clonePos(r)},this.remove=function(e){var t=this.clippedPos(e.start.row,e.start.column),n=this.clippedPos(e.end.row,e.end.column);return this.applyDelta({start:t,end:n,action:"remove",lines:this.getLinesForRange({start:t,end:n})}),this.clonePos(t)},this.removeInLine=function(e,t,n){var r=this.clippedPos(e,t),i=this.clippedPos(e,n);return this.applyDelta({start:r,end:i,action:"remove",lines:this.getLinesForRange({start:r,end:i})},!0),this.clonePos(r)},this.removeFullLines=function(e,t){e=Math.min(Math.max(0,e),this.getLength()-1),t=Math.min(Math.max(0,t),this.getLength()-1);var n=t==this.getLength()-1&&e>0,r=t<this.getLength()-1,i=n?e-1:e,s=n?this.getLine(i).length:0,u=r?t+1:t,a=r?0:this.getLine(u).length,f=new o(i,s,u,a),l=this.$lines.slice(e,t+1);return this.applyDelta({start:f.start,end:f.end,action:"remove",lines:this.getLinesForRange(f)}),l},this.removeNewLine=function(e){e<this.getLength()-1&&e>=0&&this.applyDelta({start:this.pos(e,this.getLine(e).length),end:this.pos(e+1,0),action:"remove",lines:["",""]})},this.replace=function(e,t){e instanceof o||(e=o.fromPoints(e.start,e.end));if(t.length===0&&e.isEmpty())return e.start;if(t==this.getTextRange(e))return e.end;this.remove(e);var n;return t?n=this.insert(e.start,t):n=e.start,n},this.applyDeltas=function(e){for(var t=0;t<e.length;t++)this.applyDelta(e[t])},this.revertDeltas=function(e){for(var t=e.length-1;t>=0;t--)this.revertDelta(e[t])},this.applyDelta=function(e,t){var n=e.action=="insert";if(n?e.lines.length<=1&&!e.lines[0]:!o.comparePoints(e.start,e.end))return;n&&e.lines.length>2e4?this.$splitAndapplyLargeDelta(e,2e4):(i(this.$lines,e,t),this._signal("change",e))},this.$splitAndapplyLargeDelta=function(e,t){var n=e.lines,r=n.length-t+1,i=e.start.row,s=e.start.column;for(var o=0,u=0;o<r;o=u){u+=t-1;var a=n.slice(o,u);a.push(""),this.applyDelta({start:this.pos(i+o,s),end:this.pos(i+u,s=0),action:e.action,lines:a},!0)}e.lines=n.slice(o),e.start.row=i+o,e.start.column=s,this.applyDelta(e,!0)},this.revertDelta=function(e){this.applyDelta({start:this.clonePos(e.start),end:this.clonePos(e.end),action:e.action=="insert"?"remove":"insert",lines:e.lines.slice()})},this.indexToPosition=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length;for(var i=t||0,s=n.length;i<s;i++){e-=n[i].length+r;if(e<0)return{row:i,column:e+n[i].length+r}}return{row:s-1,column:e+n[s-1].length+r}},this.positionToIndex=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length,i=0,s=Math.min(e.row,n.length);for(var o=t||0;o<s;++o)i+=n[o].length+r;return i+e.column}}).call(a.prototype),t.Document=a}),ace.define("ace/background_tokenizer",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/event_emitter").EventEmitter,s=function(e,t){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.tokenizer=e;var n=this;this.$worker=function(){if(!n.running)return;var e=new Date,t=n.currentLine,r=-1,i=n.doc,s=t;while(n.lines[t])t++;var o=i.getLength(),u=0;n.running=!1;while(t<o){n.$tokenizeRow(t),r=t;do t++;while(n.lines[t]);u++;if(u%5===0&&new Date-e>20){n.running=setTimeout(n.$worker,20);break}}n.currentLine=t,r==-1&&(r=t),s<=r&&n.fireUpdateEvent(s,r)}};(function(){r.implement(this,i),this.setTokenizer=function(e){this.tokenizer=e,this.lines=[],this.states=[],this.start(0)},this.setDocument=function(e){this.doc=e,this.lines=[],this.states=[],this.stop()},this.fireUpdateEvent=function(e,t){var n={first:e,last:t};this._signal("update",{data:n})},this.start=function(e){this.currentLine=Math.min(e||0,this.currentLine,this.doc.getLength()),this.lines.splice(this.currentLine,this.lines.length),this.states.splice(this.currentLine,this.states.length),this.stop(),this.running=setTimeout(this.$worker,700)},this.scheduleStart=function(){this.running||(this.running=setTimeout(this.$worker,700))},this.$updateOnChange=function(e){var t=e.start.row,n=e.end.row-t;if(n===0)this.lines[t]=null;else if(e.action=="remove")this.lines.splice(t,n+1,null),this.states.splice(t,n+1,null);else{var r=Array(n+1);r.unshift(t,1),this.lines.splice.apply(this.lines,r),this.states.splice.apply(this.states,r)}this.currentLine=Math.min(t,this.currentLine,this.doc.getLength()),this.stop()},this.stop=function(){this.running&&clearTimeout(this.running),this.running=!1},this.getTokens=function(e){return this.lines[e]||this.$tokenizeRow(e)},this.getState=function(e){return this.currentLine==e&&this.$tokenizeRow(e),this.states[e]||"start"},this.$tokenizeRow=function(e){var t=this.doc.getLine(e),n=this.states[e-1],r=this.tokenizer.getLineTokens(t,n,e);return this.states[e]+""!=r.state+""?(this.states[e]=r.state,this.lines[e+1]=null,this.currentLine>e+1&&(this.currentLine=e+1)):this.currentLine==e&&(this.currentLine=e+1),this.lines[e]=r.tokens}}).call(s.prototype),t.BackgroundTokenizer=s}),ace.define("ace/search_highlight",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(e,t,n){"use strict";var r=e("./lib/lang"),i=e("./lib/oop"),s=e("./range").Range,o=function(e,t,n){this.setRegexp(e),this.clazz=t,this.type=n||"text"};(function(){this.MAX_RANGES=500,this.setRegexp=function(e){if(this.regExp+""==e+"")return;this.regExp=e,this.cache=[]},this.update=function(e,t,n,i){if(!this.regExp)return;var o=i.firstRow,u=i.lastRow;for(var a=o;a<=u;a++){var f=this.cache[a];f==null&&(f=r.getMatchOffsets(n.getLine(a),this.regExp),f.length>this.MAX_RANGES&&(f=f.slice(0,this.MAX_RANGES)),f=f.map(function(e){return new s(a,e.offset,a,e.offset+e.length)}),this.cache[a]=f.length?f:"");for(var l=f.length;l--;)t.drawSingleLineMarker(e,f[l].toScreenRange(n),this.clazz,i)}}}).call(o.prototype),t.SearchHighlight=o}),ace.define("ace/edit_session/fold_line",["require","exports","module","ace/range"],function(e,t,n){"use strict";function i(e,t){this.foldData=e,Array.isArray(t)?this.folds=t:t=this.folds=[t];var n=t[t.length-1];this.range=new r(t[0].start.row,t[0].start.column,n.end.row,n.end.column),this.start=this.range.start,this.end=this.range.end,this.folds.forEach(function(e){e.setFoldLine(this)},this)}var r=e("../range").Range;(function(){this.shiftRow=function(e){this.start.row+=e,this.end.row+=e,this.folds.forEach(function(t){t.start.row+=e,t.end.row+=e})},this.addFold=function(e){if(e.sameRow){if(e.start.row<this.startRow||e.endRow>this.endRow)throw new Error("Can't add a fold to this FoldLine as it has no connection");this.folds.push(e),this.folds.sort(function(e,t){return-e.range.compareEnd(t.start.row,t.start.column)}),this.range.compareEnd(e.start.row,e.start.column)>0?(this.end.row=e.end.row,this.end.column=e.end.column):this.range.compareStart(e.end.row,e.end.column)<0&&(this.start.row=e.start.row,this.start.column=e.start.column)}else if(e.start.row==this.end.row)this.folds.push(e),this.end.row=e.end.row,this.end.column=e.end.column;else{if(e.end.row!=this.start.row)throw new Error("Trying to add fold to FoldRow that doesn't have a matching row");this.folds.unshift(e),this.start.row=e.start.row,this.start.column=e.start.column}e.foldLine=this},this.containsRow=function(e){return e>=this.start.row&&e<=this.end.row},this.walk=function(e,t,n){var r=0,i=this.folds,s,o,u,a=!0;t==null&&(t=this.end.row,n=this.end.column);for(var f=0;f<i.length;f++){s=i[f],o=s.range.compareStart(t,n);if(o==-1){e(null,t,n,r,a);return}u=e(null,s.start.row,s.start.column,r,a),u=!u&&e(s.placeholder,s.start.row,s.start.column,r);if(u||o===0)return;a=!s.sameRow,r=s.end.column}e(null,t,n,r,a)},this.getNextFoldTo=function(e,t){var n,r;for(var i=0;i<this.folds.length;i++){n=this.folds[i],r=n.range.compareEnd(e,t);if(r==-1)return{fold:n,kind:"after"};if(r===0)return{fold:n,kind:"inside"}}return null},this.addRemoveChars=function(e,t,n){var r=this.getNextFoldTo(e,t),i,s;if(r){i=r.fold;if(r.kind=="inside"&&i.start.column!=t&&i.start.row!=e)window.console&&window.console.log(e,t,i);else if(i.start.row==e){s=this.folds;var o=s.indexOf(i);o===0&&(this.start.column+=n);for(o;o<s.length;o++){i=s[o],i.start.column+=n;if(!i.sameRow)return;i.end.column+=n}this.end.column+=n}}},this.split=function(e,t){var n=this.getNextFoldTo(e,t);if(!n||n.kind=="inside")return null;var r=n.fold,s=this.folds,o=this.foldData,u=s.indexOf(r),a=s[u-1];this.end.row=a.end.row,this.end.column=a.end.column,s=s.splice(u,s.length-u);var f=new i(o,s);return o.splice(o.indexOf(this)+1,0,f),f},this.merge=function(e){var t=e.folds;for(var n=0;n<t.length;n++)this.addFold(t[n]);var r=this.foldData;r.splice(r.indexOf(e),1)},this.toString=function(){var e=[this.range.toString()+": ["];return this.folds.forEach(function(t){e.push(" "+t.toString())}),e.push("]"),e.join("\n")},this.idxToPosition=function(e){var t=0;for(var n=0;n<this.folds.length;n++){var r=this.folds[n];e-=r.start.column-t;if(e<0)return{row:r.start.row,column:r.start.column+e};e-=r.placeholder.length;if(e<0)return r.start;t=r.end.column}return{row:this.end.row,column:this.end.column+e}}}).call(i.prototype),t.FoldLine=i}),ace.define("ace/range_list",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("./range").Range,i=r.comparePoints,s=function(){this.ranges=[]};(function(){this.comparePoints=i,this.pointIndex=function(e,t,n){var r=this.ranges;for(var s=n||0;s<r.length;s++){var o=r[s],u=i(e,o.end);if(u>0)continue;var a=i(e,o.start);return u===0?t&&a!==0?-s-2:s:a>0||a===0&&!t?s:-s-1}return-s-1},this.add=function(e){var t=!e.isEmpty(),n=this.pointIndex(e.start,t);n<0&&(n=-n-1);var r=this.pointIndex(e.end,t,n);return r<0?r=-r-1:r++,this.ranges.splice(n,r-n,e)},this.addList=function(e){var t=[];for(var n=e.length;n--;)t.push.apply(t,this.add(e[n]));return t},this.substractPoint=function(e){var t=this.pointIndex(e);if(t>=0)return this.ranges.splice(t,1)},this.merge=function(){var e=[],t=this.ranges;t=t.sort(function(e,t){return i(e.start,t.start)});var n=t[0],r;for(var s=1;s<t.length;s++){r=n,n=t[s];var o=i(r.end,n.start);if(o<0)continue;if(o==0&&!r.isEmpty()&&!n.isEmpty())continue;i(r.end,n.end)<0&&(r.end.row=n.end.row,r.end.column=n.end.column),t.splice(s,1),e.push(n),n=r,s--}return this.ranges=t,e},this.contains=function(e,t){return this.pointIndex({row:e,column:t})>=0},this.containsPoint=function(e){return this.pointIndex(e)>=0},this.rangeAtPoint=function(e){var t=this.pointIndex(e);if(t>=0)return this.ranges[t]},this.clipRows=function(e,t){var n=this.ranges;if(n[0].start.row>t||n[n.length-1].start.row<e)return[];var r=this.pointIndex({row:e,column:0});r<0&&(r=-r-1);var i=this.pointIndex({row:t,column:0},r);i<0&&(i=-i-1);var s=[];for(var o=r;o<i;o++)s.push(n[o]);return s},this.removeAll=function(){return this.ranges.splice(0,this.ranges.length)},this.attach=function(e){this.session&&this.detach(),this.session=e,this.onChange=this.$onChange.bind(this),this.session.on("change",this.onChange)},this.detach=function(){if(!this.session)return;this.session.removeListener("change",this.onChange),this.session=null},this.$onChange=function(e){var t=e.start,n=e.end,r=t.row,i=n.row,s=this.ranges;for(var o=0,u=s.length;o<u;o++){var a=s[o];if(a.end.row>=r)break}if(e.action=="insert"){var f=i-r,l=-t.column+n.column;for(;o<u;o++){var a=s[o];if(a.start.row>r)break;a.start.row==r&&a.start.column>=t.column&&(a.start.column!=t.column||!this.$insertRight)&&(a.start.column+=l,a.start.row+=f);if(a.end.row==r&&a.end.column>=t.column){if(a.end.column==t.column&&this.$insertRight)continue;a.end.column==t.column&&l>0&&o<u-1&&a.end.column>a.start.column&&a.end.column==s[o+1].start.column&&(a.end.column-=l),a.end.column+=l,a.end.row+=f}}}else{var f=r-i,l=t.column-n.column;for(;o<u;o++){var a=s[o];if(a.start.row>i)break;a.end.row<i&&(a.end.row=r,a.end.column=t.column);if(a.start.row<i||a.start.row==i&&a.start.column<=n.colum)a.start.row=r,a.start.column=t.column;if(a.end.row==i)if(a.end.column<=n.column){if(f||a.end.column>t.column)a.end.column=t.column,a.end.row=t.row}else a.end.column+=l,a.end.row+=f;if(a.start.row==i)if(a.start.column<=n.column){if(f||a.start.column>t.column)a.start.column=t.column,a.start.row=t.row}else a.start.column+=l,a.start.row+=f}}if(f!=0&&o<u)for(;o<u;o++){var a=s[o];a.start.row+=f,a.end.row+=f}}}).call(s.prototype),t.RangeList=s}),ace.define("ace/edit_session/fold",["require","exports","module","ace/range","ace/range_list","ace/lib/oop"],function(e,t,n){"use strict";function u(e,t){e.row-=t.row,e.row==0&&(e.column-=t.column)}function a(e,t){u(e.start,t),u(e.end,t)}function f(e,t){e.row==0&&(e.column+=t.column),e.row+=t.row}function l(e,t){f(e.start,t),f(e.end,t)}var r=e("../range").Range,i=e("../range_list").RangeList,s=e("../lib/oop"),o=t.Fold=function(e,t){this.foldLine=null,this.placeholder=t,this.range=e,this.start=e.start,this.end=e.end,this.sameRow=e.start.row==e.end.row,this.subFolds=this.ranges=[]};s.inherits(o,i),function(){this.toString=function(){return'"'+this.placeholder+'" '+this.range.toString()},this.setFoldLine=function(e){this.foldLine=e,this.subFolds.forEach(function(t){t.setFoldLine(e)})},this.clone=function(){var e=this.range.clone(),t=new o(e,this.placeholder);return this.subFolds.forEach(function(e){t.subFolds.push(e.clone())}),t.collapseChildren=this.collapseChildren,t},this.addSubFold=function(e){if(this.range.isEqual(e))return;if(!this.range.containsRange(e))throw new Error("A fold can't intersect already existing fold"+e.range+this.range);a(e,this.start);var t=e.start.row,n=e.start.column;for(var r=0,i=-1;r<this.subFolds.length;r++){i=this.subFolds[r].range.compare(t,n);if(i!=1)break}var s=this.subFolds[r];if(i==0)return s.addSubFold(e);var t=e.range.end.row,n=e.range.end.column;for(var o=r,i=-1;o<this.subFolds.length;o++){i=this.subFolds[o].range.compare(t,n);if(i!=1)break}var u=this.subFolds[o];if(i==0)throw new Error("A fold can't intersect already existing fold"+e.range+this.range);var f=this.subFolds.splice(r,o-r,e);return e.setFoldLine(this.foldLine),e},this.restoreRange=function(e){return l(e,this.start)}}.call(o.prototype)}),ace.define("ace/edit_session/folding",["require","exports","module","ace/range","ace/edit_session/fold_line","ace/edit_session/fold","ace/token_iterator"],function(e,t,n){"use strict";function u(){this.getFoldAt=function(e,t,n){var r=this.getFoldLine(e);if(!r)return null;var i=r.folds;for(var s=0;s<i.length;s++){var o=i[s];if(o.range.contains(e,t)){if(n==1&&o.range.isEnd(e,t))continue;if(n==-1&&o.range.isStart(e,t))continue;return o}}},this.getFoldsInRange=function(e){var t=e.start,n=e.end,r=this.$foldData,i=[];t.column+=1,n.column-=1;for(var s=0;s<r.length;s++){var o=r[s].range.compareRange(e);if(o==2)continue;if(o==-2)break;var u=r[s].folds;for(var a=0;a<u.length;a++){var f=u[a];o=f.range.compareRange(e);if(o==-2)break;if(o==2)continue;if(o==42)break;i.push(f)}}return t.column-=1,n.column+=1,i},this.getFoldsInRangeList=function(e){if(Array.isArray(e)){var t=[];e.forEach(function(e){t=t.concat(this.getFoldsInRange(e))},this)}else var t=this.getFoldsInRange(e);return t},this.getAllFolds=function(){var e=[],t=this.$foldData;for(var n=0;n<t.length;n++)for(var r=0;r<t[n].folds.length;r++)e.push(t[n].folds[r]);return e},this.getFoldStringAt=function(e,t,n,r){r=r||this.getFoldLine(e);if(!r)return null;var i={end:{column:0}},s,o;for(var u=0;u<r.folds.length;u++){o=r.folds[u];var a=o.range.compareEnd(e,t);if(a==-1){s=this.getLine(o.start.row).substring(i.end.column,o.start.column);break}if(a===0)return null;i=o}return s||(s=this.getLine(o.start.row).substring(i.end.column)),n==-1?s.substring(0,t-i.end.column):n==1?s.substring(t-i.end.column):s},this.getFoldLine=function(e,t){var n=this.$foldData,r=0;t&&(r=n.indexOf(t)),r==-1&&(r=0);for(r;r<n.length;r++){var i=n[r];if(i.start.row<=e&&i.end.row>=e)return i;if(i.end.row>e)return null}return null},this.getNextFoldLine=function(e,t){var n=this.$foldData,r=0;t&&(r=n.indexOf(t)),r==-1&&(r=0);for(r;r<n.length;r++){var i=n[r];if(i.end.row>=e)return i}return null},this.getFoldedRowCount=function(e,t){var n=this.$foldData,r=t-e+1;for(var i=0;i<n.length;i++){var s=n[i],o=s.end.row,u=s.start.row;if(o>=t){u<t&&(u>=e?r-=t-u:r=0);break}o>=e&&(u>=e?r-=o-u:r-=o-e+1)}return r},this.$addFoldLine=function(e){return this.$foldData.push(e),this.$foldData.sort(function(e,t){return e.start.row-t.start.row}),e},this.addFold=function(e,t){var n=this.$foldData,r=!1,o;e instanceof s?o=e:(o=new s(t,e),o.collapseChildren=t.collapseChildren),this.$clipRangeToDocument(o.range);var u=o.start.row,a=o.start.column,f=o.end.row,l=o.end.column;if(u<f||u==f&&a<=l-2){var c=this.getFoldAt(u,a,1),h=this.getFoldAt(f,l,-1);if(c&&h==c)return c.addSubFold(o);c&&!c.range.isStart(u,a)&&this.removeFold(c),h&&!h.range.isEnd(f,l)&&this.removeFold(h);var p=this.getFoldsInRange(o.range);p.length>0&&(this.removeFolds(p),p.forEach(function(e){o.addSubFold(e)}));for(var d=0;d<n.length;d++){var v=n[d];if(f==v.start.row){v.addFold(o),r=!0;break}if(u==v.end.row){v.addFold(o),r=!0;if(!o.sameRow){var m=n[d+1];if(m&&m.start.row==f){v.merge(m);break}}break}if(f<=v.start.row)break}return r||(v=this.$addFoldLine(new i(this.$foldData,o))),this.$useWrapMode?this.$updateWrapData(v.start.row,v.start.row):this.$updateRowLengthCache(v.start.row,v.start.row),this.$modified=!0,this._signal("changeFold",{data:o,action:"add"}),o}throw new Error("The range has to be at least 2 characters width")},this.addFolds=function(e){e.forEach(function(e){this.addFold(e)},this)},this.removeFold=function(e){var t=e.foldLine,n=t.start.row,r=t.end.row,i=this.$foldData,s=t.folds;if(s.length==1)i.splice(i.indexOf(t),1);else if(t.range.isEnd(e.end.row,e.end.column))s.pop(),t.end.row=s[s.length-1].end.row,t.end.column=s[s.length-1].end.column;else if(t.range.isStart(e.start.row,e.start.column))s.shift(),t.start.row=s[0].start.row,t.start.column=s[0].start.column;else if(e.sameRow)s.splice(s.indexOf(e),1);else{var o=t.split(e.start.row,e.start.column);s=o.folds,s.shift(),o.start.row=s[0].start.row,o.start.column=s[0].start.column}this.$updating||(this.$useWrapMode?this.$updateWrapData(n,r):this.$updateRowLengthCache(n,r)),this.$modified=!0,this._signal("changeFold",{data:e,action:"remove"})},this.removeFolds=function(e){var t=[];for(var n=0;n<e.length;n++)t.push(e[n]);t.forEach(function(e){this.removeFold(e)},this),this.$modified=!0},this.expandFold=function(e){this.removeFold(e),e.subFolds.forEach(function(t){e.restoreRange(t),this.addFold(t)},this),e.collapseChildren>0&&this.foldAll(e.start.row+1,e.end.row,e.collapseChildren-1),e.subFolds=[]},this.expandFolds=function(e){e.forEach(function(e){this.expandFold(e)},this)},this.unfold=function(e,t){var n,i;e==null?(n=new r(0,0,this.getLength(),0),t=!0):typeof e=="number"?n=new r(e,0,e,this.getLine(e).length):"row"in e?n=r.fromPoints(e,e):n=e,i=this.getFoldsInRangeList(n);if(t)this.removeFolds(i);else{var s=i;while(s.length)this.expandFolds(s),s=this.getFoldsInRangeList(n)}if(i.length)return i},this.isRowFolded=function(e,t){return!!this.getFoldLine(e,t)},this.getRowFoldEnd=function(e,t){var n=this.getFoldLine(e,t);return n?n.end.row:e},this.getRowFoldStart=function(e,t){var n=this.getFoldLine(e,t);return n?n.start.row:e},this.getFoldDisplayLine=function(e,t,n,r,i){r==null&&(r=e.start.row),i==null&&(i=0),t==null&&(t=e.end.row),n==null&&(n=this.getLine(t).length);var s=this.doc,o="";return e.walk(function(e,t,n,u){if(t<r)return;if(t==r){if(n<i)return;u=Math.max(i,u)}e!=null?o+=e:o+=s.getLine(t).substring(u,n)},t,n),o},this.getDisplayLine=function(e,t,n,r){var i=this.getFoldLine(e);if(!i){var s;return s=this.doc.getLine(e),s.substring(r||0,t||s.length)}return this.getFoldDisplayLine(i,e,t,n,r)},this.$cloneFoldData=function(){var e=[];return e=this.$foldData.map(function(t){var n=t.folds.map(function(e){return e.clone()});return new i(e,n)}),e},this.toggleFold=function(e){var t=this.selection,n=t.getRange(),r,i;if(n.isEmpty()){var s=n.start;r=this.getFoldAt(s.row,s.column);if(r){this.expandFold(r);return}(i=this.findMatchingBracket(s))?n.comparePoint(i)==1?n.end=i:(n.start=i,n.start.column++,n.end.column--):(i=this.findMatchingBracket({row:s.row,column:s.column+1}))?(n.comparePoint(i)==1?n.end=i:n.start=i,n.start.column++):n=this.getCommentFoldRange(s.row,s.column)||n}else{var o=this.getFoldsInRange(n);if(e&&o.length){this.expandFolds(o);return}o.length==1&&(r=o[0])}r||(r=this.getFoldAt(n.start.row,n.start.column));if(r&&r.range.toString()==n.toString()){this.expandFold(r);return}var u="...";if(!n.isMultiLine()){u=this.getTextRange(n);if(u.length<4)return;u=u.trim().substring(0,2)+".."}this.addFold(u,n)},this.getCommentFoldRange=function(e,t,n){var i=new o(this,e,t),s=i.getCurrentToken(),u=s.type;if(s&&/^comment|string/.test(u)){u=u.match(/comment|string/)[0],u=="comment"&&(u+="|doc-start");var a=new RegExp(u),f=new r;if(n!=1){do s=i.stepBackward();while(s&&a.test(s.type));i.stepForward()}f.start.row=i.getCurrentTokenRow(),f.start.column=i.getCurrentTokenColumn()+2,i=new o(this,e,t);if(n!=-1){var l=-1;do{s=i.stepForward();if(l==-1){var c=this.getState(i.$row);a.test(c)||(l=i.$row)}else if(i.$row>l)break}while(s&&a.test(s.type));s=i.stepBackward()}else s=i.getCurrentToken();return f.end.row=i.getCurrentTokenRow(),f.end.column=i.getCurrentTokenColumn()+s.value.length-2,f}},this.foldAll=function(e,t,n){n==undefined&&(n=1e5);var r=this.foldWidgets;if(!r)return;t=t||this.getLength(),e=e||0;for(var i=e;i<t;i++){r[i]==null&&(r[i]=this.getFoldWidget(i));if(r[i]!="start")continue;var s=this.getFoldWidgetRange(i);if(s&&s.isMultiLine()&&s.end.row<=t&&s.start.row>=e){i=s.end.row;try{var o=this.addFold("...",s);o&&(o.collapseChildren=n)}catch(u){}}}},this.$foldStyles={manual:1,markbegin:1,markbeginend:1},this.$foldStyle="markbegin",this.setFoldStyle=function(e){if(!this.$foldStyles[e])throw new Error("invalid fold style: "+e+"["+Object.keys(this.$foldStyles).join(", ")+"]");if(this.$foldStyle==e)return;this.$foldStyle=e,e=="manual"&&this.unfold();var t=this.$foldMode;this.$setFolding(null),this.$setFolding(t)},this.$setFolding=function(e){if(this.$foldMode==e)return;this.$foldMode=e,this.off("change",this.$updateFoldWidgets),this.off("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets),this._signal("changeAnnotation");if(!e||this.$foldStyle=="manual"){this.foldWidgets=null;return}this.foldWidgets=[],this.getFoldWidget=e.getFoldWidget.bind(e,this,this.$foldStyle),this.getFoldWidgetRange=e.getFoldWidgetRange.bind(e,this,this.$foldStyle),this.$updateFoldWidgets=this.updateFoldWidgets.bind(this),this.$tokenizerUpdateFoldWidgets=this.tokenizerUpdateFoldWidgets.bind(this),this.on("change",this.$updateFoldWidgets),this.on("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets)},this.getParentFoldRangeData=function(e,t){var n=this.foldWidgets;if(!n||t&&n[e])return{};var r=e-1,i;while(r>=0){var s=n[r];s==null&&(s=n[r]=this.getFoldWidget(r));if(s=="start"){var o=this.getFoldWidgetRange(r);i||(i=o);if(o&&o.end.row>=e)break}r--}return{range:r!==-1&&o,firstRange:i}},this.onFoldWidgetClick=function(e,t){t=t.domEvent;var n={children:t.shiftKey,all:t.ctrlKey||t.metaKey,siblings:t.altKey},r=this.$toggleFoldWidget(e,n);if(!r){var i=t.target||t.srcElement;i&&/ace_fold-widget/.test(i.className)&&(i.className+=" ace_invalid")}},this.$toggleFoldWidget=function(e,t){if(!this.getFoldWidget)return;var n=this.getFoldWidget(e),r=this.getLine(e),i=n==="end"?-1:1,s=this.getFoldAt(e,i===-1?0:r.length,i);if(s)return t.children||t.all?this.removeFold(s):this.expandFold(s),s;var o=this.getFoldWidgetRange(e,!0);if(o&&!o.isMultiLine()){s=this.getFoldAt(o.start.row,o.start.column,1);if(s&&o.isEqual(s.range))return this.removeFold(s),s}if(t.siblings){var u=this.getParentFoldRangeData(e);if(u.range)var a=u.range.start.row+1,f=u.range.end.row;this.foldAll(a,f,t.all?1e4:0)}else t.children?(f=o?o.end.row:this.getLength(),this.foldAll(e+1,f,t.all?1e4:0)):o&&(t.all&&(o.collapseChildren=1e4),this.addFold("...",o));return o},this.toggleFoldWidget=function(e){var t=this.selection.getCursor().row;t=this.getRowFoldStart(t);var n=this.$toggleFoldWidget(t,{});if(n)return;var r=this.getParentFoldRangeData(t,!0);n=r.range||r.firstRange;if(n){t=n.start.row;var i=this.getFoldAt(t,this.getLine(t).length,1);i?this.removeFold(i):this.addFold("...",n)}},this.updateFoldWidgets=function(e){var t=e.start.row,n=e.end.row-t;if(n===0)this.foldWidgets[t]=null;else if(e.action=="remove")this.foldWidgets.splice(t,n+1,null);else{var r=Array(n+1);r.unshift(t,1),this.foldWidgets.splice.apply(this.foldWidgets,r)}},this.tokenizerUpdateFoldWidgets=function(e){var t=e.data;t.first!=t.last&&this.foldWidgets.length>t.first&&this.foldWidgets.splice(t.first,this.foldWidgets.length)}}var r=e("../range").Range,i=e("./fold_line").FoldLine,s=e("./fold").Fold,o=e("../token_iterator").TokenIterator;t.Folding=u}),ace.define("ace/edit_session/bracket_match",["require","exports","module","ace/token_iterator","ace/range"],function(e,t,n){"use strict";function s(){this.findMatchingBracket=function(e,t){if(e.column==0)return null;var n=t||this.getLine(e.row).charAt(e.column-1);if(n=="")return null;var r=n.match(/([\(\[\{])|([\)\]\}])/);return r?r[1]?this.$findClosingBracket(r[1],e):this.$findOpeningBracket(r[2],e):null},this.getBracketRange=function(e){var t=this.getLine(e.row),n=!0,r,s=t.charAt(e.column-1),o=s&&s.match(/([\(\[\{])|([\)\]\}])/);o||(s=t.charAt(e.column),e={row:e.row,column:e.column+1},o=s&&s.match(/([\(\[\{])|([\)\]\}])/),n=!1);if(!o)return null;if(o[1]){var u=this.$findClosingBracket(o[1],e);if(!u)return null;r=i.fromPoints(e,u),n||(r.end.column++,r.start.column--),r.cursor=r.end}else{var u=this.$findOpeningBracket(o[2],e);if(!u)return null;r=i.fromPoints(u,e),n||(r.start.column++,r.end.column--),r.cursor=r.start}return r},this.$brackets={")":"(","(":")","]":"[","[":"]","{":"}","}":"{"},this.$findOpeningBracket=function(e,t,n){var i=this.$brackets[e],s=1,o=new r(this,t.row,t.column),u=o.getCurrentToken();u||(u=o.stepForward());if(!u)return;n||(n=new RegExp("(\\.?"+u.type.replace(".","\\.").replace("rparen",".paren").replace(/\b(?:end)\b/,"(?:start|begin|end)")+")+"));var a=t.column-o.getCurrentTokenColumn()-2,f=u.value;for(;;){while(a>=0){var l=f.charAt(a);if(l==i){s-=1;if(s==0)return{row:o.getCurrentTokenRow(),column:a+o.getCurrentTokenColumn()}}else l==e&&(s+=1);a-=1}do u=o.stepBackward();while(u&&!n.test(u.type));if(u==null)break;f=u.value,a=f.length-1}return null},this.$findClosingBracket=function(e,t,n){var i=this.$brackets[e],s=1,o=new r(this,t.row,t.column),u=o.getCurrentToken();u||(u=o.stepForward());if(!u)return;n||(n=new RegExp("(\\.?"+u.type.replace(".","\\.").replace("lparen",".paren").replace(/\b(?:start|begin)\b/,"(?:start|begin|end)")+")+"));var a=t.column-o.getCurrentTokenColumn();for(;;){var f=u.value,l=f.length;while(a<l){var c=f.charAt(a);if(c==i){s-=1;if(s==0)return{row:o.getCurrentTokenRow(),column:a+o.getCurrentTokenColumn()}}else c==e&&(s+=1);a+=1}do u=o.stepForward();while(u&&!n.test(u.type));if(u==null)break;a=0}return null}}var r=e("../token_iterator").TokenIterator,i=e("../range").Range;t.BracketMatch=s}),ace.define("ace/edit_session",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/bidihandler","ace/config","ace/lib/event_emitter","ace/selection","ace/mode/text","ace/range","ace/document","ace/background_tokenizer","ace/search_highlight","ace/edit_session/folding","ace/edit_session/bracket_match"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/lang"),s=e("./bidihandler").BidiHandler,o=e("./config"),u=e("./lib/event_emitter").EventEmitter,a=e("./selection").Selection,f=e("./mode/text").Mode,l=e("./range").Range,c=e("./document").Document,h=e("./background_tokenizer").BackgroundTokenizer,p=e("./search_highlight").SearchHighlight,d=function(e,t){this.$breakpoints=[],this.$decorations=[],this.$frontMarkers={},this.$backMarkers={},this.$markerId=1,this.$undoSelect=!0,this.$foldData=[],this.id="session"+ ++d.$uid,this.$foldData.toString=function(){return this.join("\n")},this.on("changeFold",this.onChangeFold.bind(this)),this.$onChange=this.onChange.bind(this);if(typeof e!="object"||!e.getLine)e=new c(e);this.setDocument(e),this.selection=new a(this),this.$bidiHandler=new s(this),o.resetOptions(this),this.setMode(t),o._signal("session",this)};d.$uid=0,function(){function m(e){return e<4352?!1:e>=4352&&e<=4447||e>=4515&&e<=4519||e>=4602&&e<=4607||e>=9001&&e<=9002||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12283||e>=12288&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12589||e>=12593&&e<=12686||e>=12688&&e<=12730||e>=12736&&e<=12771||e>=12784&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=13054||e>=13056&&e<=19903||e>=19968&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=55216&&e<=55238||e>=55243&&e<=55291||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=65281&&e<=65376||e>=65504&&e<=65510}r.implement(this,u),this.setDocument=function(e){this.doc&&this.doc.removeListener("change",this.$onChange),this.doc=e,e.on("change",this.$onChange),this.bgTokenizer&&this.bgTokenizer.setDocument(this.getDocument()),this.resetCaches()},this.getDocument=function(){return this.doc},this.$resetRowCache=function(e){if(!e){this.$docRowCache=[],this.$screenRowCache=[];return}var t=this.$docRowCache.length,n=this.$getRowCacheIndex(this.$docRowCache,e)+1;t>n&&(this.$docRowCache.splice(n,t),this.$screenRowCache.splice(n,t))},this.$getRowCacheIndex=function(e,t){var n=0,r=e.length-1;while(n<=r){var i=n+r>>1,s=e[i];if(t>s)n=i+1;else{if(!(t<s))return i;r=i-1}}return n-1},this.resetCaches=function(){this.$modified=!0,this.$wrapData=[],this.$rowLengthCache=[],this.$resetRowCache(0),this.bgTokenizer&&this.bgTokenizer.start(0)},this.onChangeFold=function(e){var t=e.data;this.$resetRowCache(t.start.row)},this.onChange=function(e){this.$modified=!0,this.$bidiHandler.onChange(e),this.$resetRowCache(e.start.row);var t=this.$updateInternalDataOnChange(e);!this.$fromUndo&&this.$undoManager&&(t&&t.length&&(this.$undoManager.add({action:"removeFolds",folds:t},this.mergeUndoDeltas),this.mergeUndoDeltas=!0),this.$undoManager.add(e,this.mergeUndoDeltas),this.mergeUndoDeltas=!0,this.$informUndoManager.schedule()),this.bgTokenizer&&this.bgTokenizer.$updateOnChange(e),this._signal("change",e)},this.setValue=function(e){this.doc.setValue(e),this.selection.moveTo(0,0),this.$resetRowCache(0),this.setUndoManager(this.$undoManager),this.getUndoManager().reset()},this.getValue=this.toString=function(){return this.doc.getValue()},this.getSelection=function(){return this.selection},this.getState=function(e){return this.bgTokenizer.getState(e)},this.getTokens=function(e){return this.bgTokenizer.getTokens(e)},this.getTokenAt=function(e,t){var n=this.bgTokenizer.getTokens(e),r,i=0;if(t==null){var s=n.length-1;i=this.getLine(e).length}else for(var s=0;s<n.length;s++){i+=n[s].value.length;if(i>=t)break}return r=n[s],r?(r.index=s,r.start=i-r.value.length,r):null},this.setUndoManager=function(e){this.$undoManager=e,this.$informUndoManager&&this.$informUndoManager.cancel();if(e){var t=this;e.addSession(this),this.$syncInformUndoManager=function(){t.$informUndoManager.cancel(),t.mergeUndoDeltas=!1},this.$informUndoManager=i.delayedCall(this.$syncInformUndoManager)}else this.$syncInformUndoManager=function(){}},this.markUndoGroup=function(){this.$syncInformUndoManager&&this.$syncInformUndoManager()},this.$defaultUndoManager={undo:function(){},redo:function(){},reset:function(){},add:function(){},addSelection:function(){},startNewGroup:function(){},addSession:function(){}},this.getUndoManager=function(){return this.$undoManager||this.$defaultUndoManager},this.getTabString=function(){return this.getUseSoftTabs()?i.stringRepeat(" ",this.getTabSize()):" "},this.setUseSoftTabs=function(e){this.setOption("useSoftTabs",e)},this.getUseSoftTabs=function(){return this.$useSoftTabs&&!this.$mode.$indentWithTabs},this.setTabSize=function(e){this.setOption("tabSize",e)},this.getTabSize=function(){return this.$tabSize},this.isTabStop=function(e){return this.$useSoftTabs&&e.column%this.$tabSize===0},this.setNavigateWithinSoftTabs=function(e){this.setOption("navigateWithinSoftTabs",e)},this.getNavigateWithinSoftTabs=function(){return this.$navigateWithinSoftTabs},this.$overwrite=!1,this.setOverwrite=function(e){this.setOption("overwrite",e)},this.getOverwrite=function(){return this.$overwrite},this.toggleOverwrite=function(){this.setOverwrite(!this.$overwrite)},this.addGutterDecoration=function(e,t){this.$decorations[e]||(this.$decorations[e]=""),this.$decorations[e]+=" "+t,this._signal("changeBreakpoint",{})},this.removeGutterDecoration=function(e,t){this.$decorations[e]=(this.$decorations[e]||"").replace(" "+t,""),this._signal("changeBreakpoint",{})},this.getBreakpoints=function(){return this.$breakpoints},this.setBreakpoints=function(e){this.$breakpoints=[];for(var t=0;t<e.length;t++)this.$breakpoints[e[t]]="ace_breakpoint";this._signal("changeBreakpoint",{})},this.clearBreakpoints=function(){this.$breakpoints=[],this._signal("changeBreakpoint",{})},this.setBreakpoint=function(e,t){t===undefined&&(t="ace_breakpoint"),t?this.$breakpoints[e]=t:delete this.$breakpoints[e],this._signal("changeBreakpoint",{})},this.clearBreakpoint=function(e){delete this.$breakpoints[e],this._signal("changeBreakpoint",{})},this.addMarker=function(e,t,n,r){var i=this.$markerId++,s={range:e,type:n||"line",renderer:typeof n=="function"?n:null,clazz:t,inFront:!!r,id:i};return r?(this.$frontMarkers[i]=s,this._signal("changeFrontMarker")):(this.$backMarkers[i]=s,this._signal("changeBackMarker")),i},this.addDynamicMarker=function(e,t){if(!e.update)return;var n=this.$markerId++;return e.id=n,e.inFront=!!t,t?(this.$frontMarkers[n]=e,this._signal("changeFrontMarker")):(this.$backMarkers[n]=e,this._signal("changeBackMarker")),e},this.removeMarker=function(e){var t=this.$frontMarkers[e]||this.$backMarkers[e];if(!t)return;var n=t.inFront?this.$frontMarkers:this.$backMarkers;delete n[e],this._signal(t.inFront?"changeFrontMarker":"changeBackMarker")},this.getMarkers=function(e){return e?this.$frontMarkers:this.$backMarkers},this.highlight=function(e){if(!this.$searchHighlight){var t=new p(null,"ace_selected-word","text");this.$searchHighlight=this.addDynamicMarker(t)}this.$searchHighlight.setRegexp(e)},this.highlightLines=function(e,t,n,r){typeof t!="number"&&(n=t,t=e),n||(n="ace_step");var i=new l(e,0,t,Infinity);return i.id=this.addMarker(i,n,"fullLine",r),i},this.setAnnotations=function(e){this.$annotations=e,this._signal("changeAnnotation",{})},this.getAnnotations=function(){return this.$annotations||[]},this.clearAnnotations=function(){this.setAnnotations([])},this.$detectNewLine=function(e){var t=e.match(/^.*?(\r?\n)/m);t?this.$autoNewLine=t[1]:this.$autoNewLine="\n"},this.getWordRange=function(e,t){var n=this.getLine(e),r=!1;t>0&&(r=!!n.charAt(t-1).match(this.tokenRe)),r||(r=!!n.charAt(t).match(this.tokenRe));if(r)var i=this.tokenRe;else if(/^\s+$/.test(n.slice(t-1,t+1)))var i=/\s/;else var i=this.nonTokenRe;var s=t;if(s>0){do s--;while(s>=0&&n.charAt(s).match(i));s++}var o=t;while(o<n.length&&n.charAt(o).match(i))o++;return new l(e,s,e,o)},this.getAWordRange=function(e,t){var n=this.getWordRange(e,t),r=this.getLine(n.end.row);while(r.charAt(n.end.column).match(/[ \t]/))n.end.column+=1;return n},this.setNewLineMode=function(e){this.doc.setNewLineMode(e)},this.getNewLineMode=function(){return this.doc.getNewLineMode()},this.setUseWorker=function(e){this.setOption("useWorker",e)},this.getUseWorker=function(){return this.$useWorker},this.onReloadTokenizer=function(e){var t=e.data;this.bgTokenizer.start(t.first),this._signal("tokenizerUpdate",e)},this.$modes=o.$modes,this.$mode=null,this.$modeId=null,this.setMode=function(e,t){if(e&&typeof e=="object"){if(e.getTokenizer)return this.$onChangeMode(e);var n=e,r=n.path}else r=e||"ace/mode/text";this.$modes["ace/mode/text"]||(this.$modes["ace/mode/text"]=new f);if(this.$modes[r]&&!n){this.$onChangeMode(this.$modes[r]),t&&t();return}this.$modeId=r,o.loadModule(["mode",r],function(e){if(this.$modeId!==r)return t&&t();this.$modes[r]&&!n?this.$onChangeMode(this.$modes[r]):e&&e.Mode&&(e=new e.Mode(n),n||(this.$modes[r]=e,e.$id=r),this.$onChangeMode(e)),t&&t()}.bind(this)),this.$mode||this.$onChangeMode(this.$modes["ace/mode/text"],!0)},this.$onChangeMode=function(e,t){t||(this.$modeId=e.$id);if(this.$mode===e)return;this.$mode=e,this.$stopWorker(),this.$useWorker&&this.$startWorker();var n=e.getTokenizer();if(n.addEventListener!==undefined){var r=this.onReloadTokenizer.bind(this);n.addEventListener("update",r)}if(!this.bgTokenizer){this.bgTokenizer=new h(n);var i=this;this.bgTokenizer.addEventListener("update",function(e){i._signal("tokenizerUpdate",e)})}else this.bgTokenizer.setTokenizer(n);this.bgTokenizer.setDocument(this.getDocument()),this.tokenRe=e.tokenRe,this.nonTokenRe=e.nonTokenRe,t||(e.attachToSession&&e.attachToSession(this),this.$options.wrapMethod.set.call(this,this.$wrapMethod),this.$setFolding(e.foldingRules),this.bgTokenizer.start(0),this._emit("changeMode"))},this.$stopWorker=function(){this.$worker&&(this.$worker.terminate(),this.$worker=null)},this.$startWorker=function(){try{this.$worker=this.$mode.createWorker(this)}catch(e){o.warn("Could not load worker",e),this.$worker=null}},this.getMode=function(){return this.$mode},this.$scrollTop=0,this.setScrollTop=function(e){if(this.$scrollTop===e||isNaN(e))return;this.$scrollTop=e,this._signal("changeScrollTop",e)},this.getScrollTop=function(){return this.$scrollTop},this.$scrollLeft=0,this.setScrollLeft=function(e){if(this.$scrollLeft===e||isNaN(e))return;this.$scrollLeft=e,this._signal("changeScrollLeft",e)},this.getScrollLeft=function(){return this.$scrollLeft},this.getScreenWidth=function(){return this.$computeWidth(),this.lineWidgets?Math.max(this.getLineWidgetMaxWidth(),this.screenWidth):this.screenWidth},this.getLineWidgetMaxWidth=function(){if(this.lineWidgetsWidth!=null)return this.lineWidgetsWidth;var e=0;return this.lineWidgets.forEach(function(t){t&&t.screenWidth>e&&(e=t.screenWidth)}),this.lineWidgetWidth=e},this.$computeWidth=function(e){if(this.$modified||e){this.$modified=!1;if(this.$useWrapMode)return this.screenWidth=this.$wrapLimit;var t=this.doc.getAllLines(),n=this.$rowLengthCache,r=0,i=0,s=this.$foldData[i],o=s?s.start.row:Infinity,u=t.length;for(var a=0;a<u;a++){if(a>o){a=s.end.row+1;if(a>=u)break;s=this.$foldData[i++],o=s?s.start.row:Infinity}n[a]==null&&(n[a]=this.$getStringScreenWidth(t[a])[0]),n[a]>r&&(r=n[a])}this.screenWidth=r}},this.getLine=function(e){return this.doc.getLine(e)},this.getLines=function(e,t){return this.doc.getLines(e,t)},this.getLength=function(){return this.doc.getLength()},this.getTextRange=function(e){return this.doc.getTextRange(e||this.selection.getRange())},this.insert=function(e,t){return this.doc.insert(e,t)},this.remove=function(e){return this.doc.remove(e)},this.removeFullLines=function(e,t){return this.doc.removeFullLines(e,t)},this.undoChanges=function(e,t){if(!e.length)return;this.$fromUndo=!0;for(var n=e.length-1;n!=-1;n--){var r=e[n];r.action=="insert"||r.action=="remove"?this.doc.revertDelta(r):r.folds&&this.addFolds(r.folds)}!t&&this.$undoSelect&&(e.selectionBefore?this.selection.fromJSON(e.selectionBefore):this.selection.setRange(this.$getUndoSelection(e,!0))),this.$fromUndo=!1},this.redoChanges=function(e,t){if(!e.length)return;this.$fromUndo=!0;for(var n=0;n<e.length;n++){var r=e[n];(r.action=="insert"||r.action=="remove")&&this.doc.applyDelta(r)}!t&&this.$undoSelect&&(e.selectionAfter?this.selection.fromJSON(e.selectionAfter):this.selection.setRange(this.$getUndoSelection(e,!1))),this.$fromUndo=!1},this.setUndoSelect=function(e){this.$undoSelect=e},this.$getUndoSelection=function(e,t){function n(e){return t?e.action!=="insert":e.action==="insert"}var r,i,s;for(var o=0;o<e.length;o++){var u=e[o];if(!u.start)continue;if(!r){n(u)?(r=l.fromPoints(u.start,u.end),s=!0):(r=l.fromPoints(u.start,u.start),s=!1);continue}n(u)?(i=u.start,r.compare(i.row,i.column)==-1&&r.setStart(i),i=u.end,r.compare(i.row,i.column)==1&&r.setEnd(i),s=!0):(i=u.start,r.compare(i.row,i.column)==-1&&(r=l.fromPoints(u.start,u.start)),s=!1)}return r},this.replace=function(e,t){return this.doc.replace(e,t)},this.moveText=function(e,t,n){var r=this.getTextRange(e),i=this.getFoldsInRange(e),s=l.fromPoints(t,t);if(!n){this.remove(e);var o=e.start.row-e.end.row,u=o?-e.end.column:e.start.column-e.end.column;u&&(s.start.row==e.end.row&&s.start.column>e.end.column&&(s.start.column+=u),s.end.row==e.end.row&&s.end.column>e.end.column&&(s.end.column+=u)),o&&s.start.row>=e.end.row&&(s.start.row+=o,s.end.row+=o)}s.end=this.insert(s.start,r);if(i.length){var a=e.start,f=s.start,o=f.row-a.row,u=f.column-a.column;this.addFolds(i.map(function(e){return e=e.clone(),e.start.row==a.row&&(e.start.column+=u),e.end.row==a.row&&(e.end.column+=u),e.start.row+=o,e.end.row+=o,e}))}return s},this.indentRows=function(e,t,n){n=n.replace(/\t/g,this.getTabString());for(var r=e;r<=t;r++)this.doc.insertInLine({row:r,column:0},n)},this.outdentRows=function(e){var t=e.collapseRows(),n=new l(0,0,0,0),r=this.getTabSize();for(var i=t.start.row;i<=t.end.row;++i){var s=this.getLine(i);n.start.row=i,n.end.row=i;for(var o=0;o<r;++o)if(s.charAt(o)!=" ")break;o<r&&s.charAt(o)==" "?(n.start.column=o,n.end.column=o+1):(n.start.column=0,n.end.column=o),this.remove(n)}},this.$moveLines=function(e,t,n){e=this.getRowFoldStart(e),t=this.getRowFoldEnd(t);if(n<0){var r=this.getRowFoldStart(e+n);if(r<0)return 0;var i=r-e}else if(n>0){var r=this.getRowFoldEnd(t+n);if(r>this.doc.getLength()-1)return 0;var i=r-t}else{e=this.$clipRowToDocument(e),t=this.$clipRowToDocument(t);var i=t-e+1}var s=new l(e,0,t,Number.MAX_VALUE),o=this.getFoldsInRange(s).map(function(e){return e=e.clone(),e.start.row+=i,e.end.row+=i,e}),u=n==0?this.doc.getLines(e,t):this.doc.removeFullLines(e,t);return this.doc.insertFullLines(e+i,u),o.length&&this.addFolds(o),i},this.moveLinesUp=function(e,t){return this.$moveLines(e,t,-1)},this.moveLinesDown=function(e,t){return this.$moveLines(e,t,1)},this.duplicateLines=function(e,t){return this.$moveLines(e,t,0)},this.$clipRowToDocument=function(e){return Math.max(0,Math.min(e,this.doc.getLength()-1))},this.$clipColumnToRow=function(e,t){return t<0?0:Math.min(this.doc.getLine(e).length,t)},this.$clipPositionToDocument=function(e,t){t=Math.max(0,t);if(e<0)e=0,t=0;else{var n=this.doc.getLength();e>=n?(e=n-1,t=this.doc.getLine(n-1).length):t=Math.min(this.doc.getLine(e).length,t)}return{row:e,column:t}},this.$clipRangeToDocument=function(e){e.start.row<0?(e.start.row=0,e.start.column=0):e.start.column=this.$clipColumnToRow(e.start.row,e.start.column);var t=this.doc.getLength()-1;return e.end.row>t?(e.end.row=t,e.end.column=this.doc.getLine(t).length):e.end.column=this.$clipColumnToRow(e.end.row,e.end.column),e},this.$wrapLimit=80,this.$useWrapMode=!1,this.$wrapLimitRange={min:null,max:null},this.setUseWrapMode=function(e){if(e!=this.$useWrapMode){this.$useWrapMode=e,this.$modified=!0,this.$resetRowCache(0);if(e){var t=this.getLength();this.$wrapData=Array(t),this.$updateWrapData(0,t-1)}this._signal("changeWrapMode")}},this.getUseWrapMode=function(){return this.$useWrapMode},this.setWrapLimitRange=function(e,t){if(this.$wrapLimitRange.min!==e||this.$wrapLimitRange.max!==t)this.$wrapLimitRange={min:e,max:t},this.$modified=!0,this.$bidiHandler.markAsDirty(),this.$useWrapMode&&this._signal("changeWrapMode")},this.adjustWrapLimit=function(e,t){var n=this.$wrapLimitRange;n.max<0&&(n={min:t,max:t});var r=this.$constrainWrapLimit(e,n.min,n.max);return r!=this.$wrapLimit&&r>1?(this.$wrapLimit=r,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this.$resetRowCache(0),this._signal("changeWrapLimit")),!0):!1},this.$constrainWrapLimit=function(e,t,n){return t&&(e=Math.max(t,e)),n&&(e=Math.min(n,e)),e},this.getWrapLimit=function(){return this.$wrapLimit},this.setWrapLimit=function(e){this.setWrapLimitRange(e,e)},this.getWrapLimitRange=function(){return{min:this.$wrapLimitRange.min,max:this.$wrapLimitRange.max}},this.$updateInternalDataOnChange=function(e){var t=this.$useWrapMode,n=e.action,r=e.start,i=e.end,s=r.row,o=i.row,u=o-s,a=null;this.$updating=!0;if(u!=0)if(n==="remove"){this[t?"$wrapData":"$rowLengthCache"].splice(s,u);var f=this.$foldData;a=this.getFoldsInRange(e),this.removeFolds(a);var l=this.getFoldLine(i.row),c=0;if(l){l.addRemoveChars(i.row,i.column,r.column-i.column),l.shiftRow(-u);var h=this.getFoldLine(s);h&&h!==l&&(h.merge(l),l=h),c=f.indexOf(l)+1}for(c;c<f.length;c++){var l=f[c];l.start.row>=i.row&&l.shiftRow(-u)}o=s}else{var p=Array(u);p.unshift(s,0);var d=t?this.$wrapData:this.$rowLengthCache;d.splice.apply(d,p);var f=this.$foldData,l=this.getFoldLine(s),c=0;if(l){var v=l.range.compareInside(r.row,r.column);v==0?(l=l.split(r.row,r.column),l&&(l.shiftRow(u),l.addRemoveChars(o,0,i.column-r.column))):v==-1&&(l.addRemoveChars(s,0,i.column-r.column),l.shiftRow(u)),c=f.indexOf(l)+1}for(c;c<f.length;c++){var l=f[c];l.start.row>=s&&l.shiftRow(u)}}else{u=Math.abs(e.start.column-e.end.column),n==="remove"&&(a=this.getFoldsInRange(e),this.removeFolds(a),u=-u);var l=this.getFoldLine(s);l&&l.addRemoveChars(s,r.column,u)}return t&&this.$wrapData.length!=this.doc.getLength()&&console.error("doc.getLength() and $wrapData.length have to be the same!"),this.$updating=!1,t?this.$updateWrapData(s,o):this.$updateRowLengthCache(s,o),a},this.$updateRowLengthCache=function(e,t,n){this.$rowLengthCache[e]=null,this.$rowLengthCache[t]=null},this.$updateWrapData=function(e,t){var r=this.doc.getAllLines(),i=this.getTabSize(),o=this.$wrapData,u=this.$wrapLimit,a,f,l=e;t=Math.min(t,r.length-1);while(l<=t)f=this.getFoldLine(l,f),f?(a=[],f.walk(function(e,t,i,o){var u;if(e!=null){u=this.$getDisplayTokens(e,a.length),u[0]=n;for(var f=1;f<u.length;f++)u[f]=s}else u=this.$getDisplayTokens(r[t].substring(o,i),a.length);a=a.concat(u)}.bind(this),f.end.row,r[f.end.row].length+1),o[f.start.row]=this.$computeWrapSplits(a,u,i),l=f.end.row+1):(a=this.$getDisplayTokens(r[l]),o[l]=this.$computeWrapSplits(a,u,i),l++)};var e=1,t=2,n=3,s=4,a=9,c=10,d=11,v=12;this.$computeWrapSplits=function(e,r,i){function g(){var t=0;if(m===0)return t;if(p)for(var n=0;n<e.length;n++){var r=e[n];if(r==c)t+=1;else{if(r!=d){if(r==v)continue;break}t+=i}}return h&&p!==!1&&(t+=i),Math.min(t,m)}function y(t){var n=t-f;for(var r=f;r<t;r++){var i=e[r];if(i===12||i===2)n-=1}o.length||(b=g(),o.indent=b),l+=n,o.push(l),f=t}if(e.length==0)return[];var o=[],u=e.length,f=0,l=0,h=this.$wrapAsCode,p=this.$indentedSoftWrap,m=r<=Math.max(2*i,8)||p===!1?0:Math.floor(r/2),b=0;while(u-f>r-b){var w=f+r-b;if(e[w-1]>=c&&e[w]>=c){y(w);continue}if(e[w]==n||e[w]==s){for(w;w!=f-1;w--)if(e[w]==n)break;if(w>f){y(w);continue}w=f+r;for(w;w<e.length;w++)if(e[w]!=s)break;if(w==e.length)break;y(w);continue}var E=Math.max(w-(r-(r>>2)),f-1);while(w>E&&e[w]<n)w--;if(h){while(w>E&&e[w]<n)w--;while(w>E&&e[w]==a)w--}else while(w>E&&e[w]<c)w--;if(w>E){y(++w);continue}w=f+r,e[w]==t&&w--,y(w-b)}return o},this.$getDisplayTokens=function(n,r){var i=[],s;r=r||0;for(var o=0;o<n.length;o++){var u=n.charCodeAt(o);if(u==9){s=this.getScreenTabSize(i.length+r),i.push(d);for(var f=1;f<s;f++)i.push(v)}else u==32?i.push(c):u>39&&u<48||u>57&&u<64?i.push(a):u>=4352&&m(u)?i.push(e,t):i.push(e)}return i},this.$getStringScreenWidth=function(e,t,n){if(t==0)return[0,0];t==null&&(t=Infinity),n=n||0;var r,i;for(i=0;i<e.length;i++){r=e.charCodeAt(i),r==9?n+=this.getScreenTabSize(n):r>=4352&&m(r)?n+=2:n+=1;if(n>t)break}return[n,i]},this.lineWidgets=null,this.getRowLength=function(e){if(this.lineWidgets)var t=this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0;else t=0;return!this.$useWrapMode||!this.$wrapData[e]?1+t:this.$wrapData[e].length+1+t},this.getRowLineCount=function(e){return!this.$useWrapMode||!this.$wrapData[e]?1:this.$wrapData[e].length+1},this.getRowWrapIndent=function(e){if(this.$useWrapMode){var t=this.screenToDocumentPosition(e,Number.MAX_VALUE),n=this.$wrapData[t.row];return n.length&&n[0]<t.column?n.indent:0}return 0},this.getScreenLastRowColumn=function(e){var t=this.screenToDocumentPosition(e,Number.MAX_VALUE);return this.documentToScreenColumn(t.row,t.column)},this.getDocumentLastRowColumn=function(e,t){var n=this.documentToScreenRow(e,t);return this.getScreenLastRowColumn(n)},this.getDocumentLastRowColumnPosition=function(e,t){var n=this.documentToScreenRow(e,t);return this.screenToDocumentPosition(n,Number.MAX_VALUE/10)},this.getRowSplitData=function(e){return this.$useWrapMode?this.$wrapData[e]:undefined},this.getScreenTabSize=function(e){return this.$tabSize-e%this.$tabSize},this.screenToDocumentRow=function(e,t){return this.screenToDocumentPosition(e,t).row},this.screenToDocumentColumn=function(e,t){return this.screenToDocumentPosition(e,t).column},this.screenToDocumentPosition=function(e,t,n){if(e<0)return{row:0,column:0};var r,i=0,s=0,o,u=0,a=0,f=this.$screenRowCache,l=this.$getRowCacheIndex(f,e),c=f.length;if(c&&l>=0)var u=f[l],i=this.$docRowCache[l],h=e>f[c-1];else var h=!c;var p=this.getLength()-1,d=this.getNextFoldLine(i),v=d?d.start.row:Infinity;while(u<=e){a=this.getRowLength(i);if(u+a>e||i>=p)break;u+=a,i++,i>v&&(i=d.end.row+1,d=this.getNextFoldLine(i,d),v=d?d.start.row:Infinity),h&&(this.$docRowCache.push(i),this.$screenRowCache.push(u))}if(d&&d.start.row<=i)r=this.getFoldDisplayLine(d),i=d.start.row;else{if(u+a<=e||i>p)return{row:p,column:this.getLine(p).length};r=this.getLine(i),d=null}var m=0,g=Math.floor(e-u);if(this.$useWrapMode){var y=this.$wrapData[i];y&&(o=y[g],g>0&&y.length&&(m=y.indent,s=y[g-1]||y[y.length-1],r=r.substring(s)))}return n!==undefined&&this.$bidiHandler.isBidiRow(u+g,i,g)&&(t=this.$bidiHandler.offsetToCol(n)),s+=this.$getStringScreenWidth(r,t-m)[1],this.$useWrapMode&&s>=o&&(s=o-1),d?d.idxToPosition(s):{row:i,column:s}},this.documentToScreenPosition=function(e,t){if(typeof t=="undefined")var n=this.$clipPositionToDocument(e.row,e.column);else n=this.$clipPositionToDocument(e,t);e=n.row,t=n.column;var r=0,i=null,s=null;s=this.getFoldAt(e,t,1),s&&(e=s.start.row,t=s.start.column);var o,u=0,a=this.$docRowCache,f=this.$getRowCacheIndex(a,e),l=a.length;if(l&&f>=0)var u=a[f],r=this.$screenRowCache[f],c=e>a[l-1];else var c=!l;var h=this.getNextFoldLine(u),p=h?h.start.row:Infinity;while(u<e){if(u>=p){o=h.end.row+1;if(o>e)break;h=this.getNextFoldLine(o,h),p=h?h.start.row:Infinity}else o=u+1;r+=this.getRowLength(u),u=o,c&&(this.$docRowCache.push(u),this.$screenRowCache.push(r))}var d="";h&&u>=p?(d=this.getFoldDisplayLine(h,e,t),i=h.start.row):(d=this.getLine(e).substring(0,t),i=e);var v=0;if(this.$useWrapMode){var m=this.$wrapData[i];if(m){var g=0;while(d.length>=m[g])r++,g++;d=d.substring(m[g-1]||0,d.length),v=g>0?m.indent:0}}return{row:r,column:v+this.$getStringScreenWidth(d)[0]}},this.documentToScreenColumn=function(e,t){return this.documentToScreenPosition(e,t).column},this.documentToScreenRow=function(e,t){return this.documentToScreenPosition(e,t).row},this.getScreenLength=function(){var e=0,t=null;if(!this.$useWrapMode){e=this.getLength();var n=this.$foldData;for(var r=0;r<n.length;r++)t=n[r],e-=t.end.row-t.start.row}else{var i=this.$wrapData.length,s=0,r=0,t=this.$foldData[r++],o=t?t.start.row:Infinity;while(s<i){var u=this.$wrapData[s];e+=u?u.length+1:1,s++,s>o&&(s=t.end.row+1,t=this.$foldData[r++],o=t?t.start.row:Infinity)}}return this.lineWidgets&&(e+=this.$getWidgetScreenLength()),e},this.$setFontMetrics=function(e){if(!this.$enableVarChar)return;this.$getStringScreenWidth=function(t,n,r){if(n===0)return[0,0];n||(n=Infinity),r=r||0;var i,s;for(s=0;s<t.length;s++){i=t.charAt(s),i===" "?r+=this.getScreenTabSize(r):r+=e.getCharacterWidth(i);if(r>n)break}return[r,s]}},this.destroy=function(){this.bgTokenizer&&(this.bgTokenizer.setDocument(null),this.bgTokenizer=null),this.$stopWorker()},this.isFullWidth=m}.call(d.prototype),e("./edit_session/folding").Folding.call(d.prototype),e("./edit_session/bracket_match").BracketMatch.call(d.prototype),o.defineOptions(d.prototype,"session",{wrap:{set:function(e){!e||e=="off"?e=!1:e=="free"?e=!0:e=="printMargin"?e=-1:typeof e=="string"&&(e=parseInt(e,10)||!1);if(this.$wrap==e)return;this.$wrap=e;if(!e)this.setUseWrapMode(!1);else{var t=typeof e=="number"?e:null;this.setWrapLimitRange(t,t),this.setUseWrapMode(!0)}},get:function(){return this.getUseWrapMode()?this.$wrap==-1?"printMargin":this.getWrapLimitRange().min?this.$wrap:"free":"off"},handlesSet:!0},wrapMethod:{set:function(e){e=e=="auto"?this.$mode.type!="text":e!="text",e!=this.$wrapAsCode&&(this.$wrapAsCode=e,this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0)))},initialValue:"auto"},indentedSoftWrap:{set:function(){this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0))},initialValue:!0},firstLineNumber:{set:function(){this._signal("changeBreakpoint")},initialValue:1},useWorker:{set:function(e){this.$useWorker=e,this.$stopWorker(),e&&this.$startWorker()},initialValue:!0},useSoftTabs:{initialValue:!0},tabSize:{set:function(e){if(isNaN(e)||this.$tabSize===e)return;this.$modified=!0,this.$rowLengthCache=[],this.$tabSize=e,this._signal("changeTabSize")},initialValue:4,handlesSet:!0},navigateWithinSoftTabs:{initialValue:!1},foldStyle:{set:function(e){this.setFoldStyle(e)},handlesSet:!0},overwrite:{set:function(e){this._signal("changeOverwrite")},initialValue:!1},newLineMode:{set:function(e){this.doc.setNewLineMode(e)},get:function(){return this.doc.getNewLineMode()},handlesSet:!0},mode:{set:function(e){this.setMode(e)},get:function(){return this.$modeId},handlesSet:!0}}),t.EditSession=d}),ace.define("ace/search",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(e,t,n){"use strict";function u(e,t){function n(e){return/\w/.test(e)||t.regExp?"\\b":""}return n(e[0])+e+n(e[e.length-1])}var r=e("./lib/lang"),i=e("./lib/oop"),s=e("./range").Range,o=function(){this.$options={}};(function(){this.set=function(e){return i.mixin(this.$options,e),this},this.getOptions=function(){return r.copyObject(this.$options)},this.setOptions=function(e){this.$options=e},this.find=function(e){var t=this.$options,n=this.$matchIterator(e,t);if(!n)return!1;var r=null;return n.forEach(function(e,n,i,o){return r=new s(e,n,i,o),n==o&&t.start&&t.start.start&&t.skipCurrent!=0&&r.isEqual(t.start)?(r=null,!1):!0}),r},this.findAll=function(e){var t=this.$options;if(!t.needle)return[];this.$assembleRegExp(t);var n=t.range,i=n?e.getLines(n.start.row,n.end.row):e.doc.getAllLines(),o=[],u=t.re;if(t.$isMultiLine){var a=u.length,f=i.length-a,l;e:for(var c=u.offset||0;c<=f;c++){for(var h=0;h<a;h++)if(i[c+h].search(u[h])==-1)continue e;var p=i[c],d=i[c+a-1],v=p.length-p.match(u[0])[0].length,m=d.match(u[a-1])[0].length;if(l&&l.end.row===c&&l.end.column>v)continue;o.push(l=new s(c,v,c+a-1,m)),a>2&&(c=c+a-2)}}else for(var g=0;g<i.length;g++){var y=r.getMatchOffsets(i[g],u);for(var h=0;h<y.length;h++){var b=y[h];o.push(new s(g,b.offset,g,b.offset+b.length))}}if(n){var w=n.start.column,E=n.start.column,g=0,h=o.length-1;while(g<h&&o[g].start.column<w&&o[g].start.row==n.start.row)g++;while(g<h&&o[h].end.column>E&&o[h].end.row==n.end.row)h--;o=o.slice(g,h+1);for(g=0,h=o.length;g<h;g++)o[g].start.row+=n.start.row,o[g].end.row+=n.start.row}return o},this.replace=function(e,t){var n=this.$options,r=this.$assembleRegExp(n);if(n.$isMultiLine)return t;if(!r)return;var i=r.exec(e);if(!i||i[0].length!=e.length)return null;t=e.replace(r,t);if(n.preserveCase){t=t.split("");for(var s=Math.min(e.length,e.length);s--;){var o=e[s];o&&o.toLowerCase()!=o?t[s]=t[s].toUpperCase():t[s]=t[s].toLowerCase()}t=t.join("")}return t},this.$assembleRegExp=function(e,t){if(e.needle instanceof RegExp)return e.re=e.needle;var n=e.needle;if(!e.needle)return e.re=!1;e.regExp||(n=r.escapeRegExp(n)),e.wholeWord&&(n=u(n,e));var i=e.caseSensitive?"gm":"gmi";e.$isMultiLine=!t&&/[\n\r]/.test(n);if(e.$isMultiLine)return e.re=this.$assembleMultilineRegExp(n,i);try{var s=new RegExp(n,i)}catch(o){s=!1}return e.re=s},this.$assembleMultilineRegExp=function(e,t){var n=e.replace(/\r\n|\r|\n/g,"$\n^").split("\n"),r=[];for(var i=0;i<n.length;i++)try{r.push(new RegExp(n[i],t))}catch(s){return!1}return r},this.$matchIterator=function(e,t){var n=this.$assembleRegExp(t);if(!n)return!1;var r=t.backwards==1,i=t.skipCurrent!=0,s=t.range,o=t.start;o||(o=s?s[r?"end":"start"]:e.selection.getRange()),o.start&&(o=o[i!=r?"end":"start"]);var u=s?s.start.row:0,a=s?s.end.row:e.getLength()-1;if(r)var f=function(e){var n=o.row;if(c(n,o.column,e))return;for(n--;n>=u;n--)if(c(n,Number.MAX_VALUE,e))return;if(t.wrap==0)return;for(n=a,u=o.row;n>=u;n--)if(c(n,Number.MAX_VALUE,e))return};else var f=function(e){var n=o.row;if(c(n,o.column,e))return;for(n+=1;n<=a;n++)if(c(n,0,e))return;if(t.wrap==0)return;for(n=u,a=o.row;n<=a;n++)if(c(n,0,e))return};if(t.$isMultiLine)var l=n.length,c=function(t,i,s){var o=r?t-l+1:t;if(o<0)return;var u=e.getLine(o),a=u.search(n[0]);if(!r&&a<i||a===-1)return;for(var f=1;f<l;f++){u=e.getLine(o+f);if(u.search(n[f])==-1)return}var c=u.match(n[l-1])[0].length;if(r&&c>i)return;if(s(o,a,o+l-1,c))return!0};else if(r)var c=function(t,r,i){var s=e.getLine(t),o=[],u,a=0;n.lastIndex=0;while(u=n.exec(s)){var f=u[0].length;a=u.index;if(!f){if(a>=s.length)break;n.lastIndex=a+=1}if(u.index+f>r)break;o.push(u.index,f)}for(var l=o.length-1;l>=0;l-=2){var c=o[l-1],f=o[l];if(i(t,c,t,c+f))return!0}};else var c=function(t,r,i){var s=e.getLine(t),o,u;n.lastIndex=r;while(u=n.exec(s)){var a=u[0].length;o=u.index;if(i(t,o,t,o+a))return!0;if(!a){n.lastIndex=o+=1;if(o>=s.length)return!1}}};return{forEach:f}}}).call(o.prototype),t.Search=o}),ace.define("ace/keyboard/hash_handler",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(e,t,n){"use strict";function o(e,t){this.platform=t||(i.isMac?"mac":"win"),this.commands={},this.commandKeyBinding={},this.addCommands(e),this.$singleCommand=!0}function u(e,t){o.call(this,e,t),this.$singleCommand=!1}var r=e("../lib/keys"),i=e("../lib/useragent"),s=r.KEY_MODS;u.prototype=o.prototype,function(){function e(e){return typeof e=="object"&&e.bindKey&&e.bindKey.position||(e.isDefault?-100:0)}this.addCommand=function(e){this.commands[e.name]&&this.removeCommand(e),this.commands[e.name]=e,e.bindKey&&this._buildKeyHash(e)},this.removeCommand=function(e,t){var n=e&&(typeof e=="string"?e:e.name);e=this.commands[n],t||delete this.commands[n];var r=this.commandKeyBinding;for(var i in r){var s=r[i];if(s==e)delete r[i];else if(Array.isArray(s)){var o=s.indexOf(e);o!=-1&&(s.splice(o,1),s.length==1&&(r[i]=s[0]))}}},this.bindKey=function(e,t,n){typeof e=="object"&&e&&(n==undefined&&(n=e.position),e=e[this.platform]);if(!e)return;if(typeof t=="function")return this.addCommand({exec:t,bindKey:e,name:t.name||e});e.split("|").forEach(function(e){var r="";if(e.indexOf(" ")!=-1){var i=e.split(/\s+/);e=i.pop(),i.forEach(function(e){var t=this.parseKeys(e),n=s[t.hashId]+t.key;r+=(r?" ":"")+n,this._addCommandToBinding(r,"chainKeys")},this),r+=" "}var o=this.parseKeys(e),u=s[o.hashId]+o.key;this._addCommandToBinding(r+u,t,n)},this)},this._addCommandToBinding=function(t,n,r){var i=this.commandKeyBinding,s;if(!n)delete i[t];else if(!i[t]||this.$singleCommand)i[t]=n;else{Array.isArray(i[t])?(s=i[t].indexOf(n))!=-1&&i[t].splice(s,1):i[t]=[i[t]],typeof r!="number"&&(r=e(n));var o=i[t];for(s=0;s<o.length;s++){var u=o[s],a=e(u);if(a>r)break}o.splice(s,0,n)}},this.addCommands=function(e){e&&Object.keys(e).forEach(function(t){var n=e[t];if(!n)return;if(typeof n=="string")return this.bindKey(n,t);typeof n=="function"&&(n={exec:n});if(typeof n!="object")return;n.name||(n.name=t),this.addCommand(n)},this)},this.removeCommands=function(e){Object.keys(e).forEach(function(t){this.removeCommand(e[t])},this)},this.bindKeys=function(e){Object.keys(e).forEach(function(t){this.bindKey(t,e[t])},this)},this._buildKeyHash=function(e){this.bindKey(e.bindKey,e)},this.parseKeys=function(e){var t=e.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(e){return e}),n=t.pop(),i=r[n];if(r.FUNCTION_KEYS[i])n=r.FUNCTION_KEYS[i].toLowerCase();else{if(!t.length)return{key:n,hashId:-1};if(t.length==1&&t[0]=="shift")return{key:n.toUpperCase(),hashId:-1}}var s=0;for(var o=t.length;o--;){var u=r.KEY_MODS[t[o]];if(u==null)return typeof console!="undefined"&&console.error("invalid modifier "+t[o]+" in "+e),!1;s|=u}return{key:n,hashId:s}},this.findKeyCommand=function(t,n){var r=s[t]+n;return this.commandKeyBinding[r]},this.handleKeyboard=function(e,t,n,r){if(r<0)return;var i=s[t]+n,o=this.commandKeyBinding[i];e.$keyChain&&(e.$keyChain+=" "+i,o=this.commandKeyBinding[e.$keyChain]||o);if(o)if(o=="chainKeys"||o[o.length-1]=="chainKeys")return e.$keyChain=e.$keyChain||i,{command:"null"};if(e.$keyChain)if(!!t&&t!=4||n.length!=1){if(t==-1||r>0)e.$keyChain=""}else e.$keyChain=e.$keyChain.slice(0,-i.length-1);return{command:o}},this.getStatusText=function(e,t){return t.$keyChain||""}}.call(o.prototype),t.HashHandler=o,t.MultiHashHandler=u}),ace.define("ace/commands/command_manager",["require","exports","module","ace/lib/oop","ace/keyboard/hash_handler","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("../keyboard/hash_handler").MultiHashHandler,s=e("../lib/event_emitter").EventEmitter,o=function(e,t){i.call(this,t,e),this.byName=this.commands,this.setDefaultHandler("exec",function(e){return e.command.exec(e.editor,e.args||{})})};r.inherits(o,i),function(){r.implement(this,s),this.exec=function(e,t,n){if(Array.isArray(e)){for(var r=e.length;r--;)if(this.exec(e[r],t,n))return!0;return!1}typeof e=="string"&&(e=this.commands[e]);if(!e)return!1;if(t&&t.$readOnly&&!e.readOnly)return!1;if(this.$checkCommandState!=0&&e.isAvailable&&!e.isAvailable(t))return!1;var i={editor:t,command:e,args:n};return i.returnValue=this._emit("exec",i),this._signal("afterExec",i),i.returnValue===!1?!1:!0},this.toggleRecording=function(e){if(this.$inReplay)return;return e&&e._emit("changeStatus"),this.recording?(this.macro.pop(),this.removeEventListener("exec",this.$addCommandToMacro),this.macro.length||(this.macro=this.oldMacro),this.recording=!1):(this.$addCommandToMacro||(this.$addCommandToMacro=function(e){this.macro.push([e.command,e.args])}.bind(this)),this.oldMacro=this.macro,this.macro=[],this.on("exec",this.$addCommandToMacro),this.recording=!0)},this.replay=function(e){if(this.$inReplay||!this.macro)return;if(this.recording)return this.toggleRecording(e);try{this.$inReplay=!0,this.macro.forEach(function(t){typeof t=="string"?this.exec(t,e):this.exec(t[0],e,t[1])},this)}finally{this.$inReplay=!1}},this.trimMacro=function(e){return e.map(function(e){return typeof e[0]!="string"&&(e[0]=e[0].name),e[1]||(e=e[0]),e})}}.call(o.prototype),t.CommandManager=o}),ace.define("ace/commands/default_commands",["require","exports","module","ace/lib/lang","ace/config","ace/range"],function(e,t,n){"use strict";function o(e,t){return{win:e,mac:t}}var r=e("../lib/lang"),i=e("../config"),s=e("../range").Range;t.commands=[{name:"showSettingsMenu",bindKey:o("Ctrl-,","Command-,"),exec:function(e){i.loadModule("ace/ext/settings_menu",function(t){t.init(e),e.showSettingsMenu()})},readOnly:!0},{name:"goToNextError",bindKey:o("Alt-E","F4"),exec:function(e){i.loadModule("./ext/error_marker",function(t){t.showErrorMarker(e,1)})},scrollIntoView:"animate",readOnly:!0},{name:"goToPreviousError",bindKey:o("Alt-Shift-E","Shift-F4"),exec:function(e){i.loadModule("./ext/error_marker",function(t){t.showErrorMarker(e,-1)})},scrollIntoView:"animate",readOnly:!0},{name:"selectall",bindKey:o("Ctrl-A","Command-A"),exec:function(e){e.selectAll()},readOnly:!0},{name:"centerselection",bindKey:o(null,"Ctrl-L"),exec:function(e){e.centerSelection()},readOnly:!0},{name:"gotoline",bindKey:o("Ctrl-L","Command-L"),exec:function(e,t){typeof t!="number"&&(t=parseInt(prompt("Enter line number:"),10)),isNaN(t)||e.gotoLine(t)},readOnly:!0},{name:"fold",bindKey:o("Alt-L|Ctrl-F1","Command-Alt-L|Command-F1"),exec:function(e){e.session.toggleFold(!1)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"unfold",bindKey:o("Alt-Shift-L|Ctrl-Shift-F1","Command-Alt-Shift-L|Command-Shift-F1"),exec:function(e){e.session.toggleFold(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleFoldWidget",bindKey:o("F2","F2"),exec:function(e){e.session.toggleFoldWidget()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleParentFoldWidget",bindKey:o("Alt-F2","Alt-F2"),exec:function(e){e.session.toggleFoldWidget(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"foldall",bindKey:o(null,"Ctrl-Command-Option-0"),exec:function(e){e.session.foldAll()},scrollIntoView:"center",readOnly:!0},{name:"foldOther",bindKey:o("Alt-0","Command-Option-0"),exec:function(e){e.session.foldAll(),e.session.unfold(e.selection.getAllRanges())},scrollIntoView:"center",readOnly:!0},{name:"unfoldall",bindKey:o("Alt-Shift-0","Command-Option-Shift-0"),exec:function(e){e.session.unfold()},scrollIntoView:"center",readOnly:!0},{name:"findnext",bindKey:o("Ctrl-K","Command-G"),exec:function(e){e.findNext()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"findprevious",bindKey:o("Ctrl-Shift-K","Command-Shift-G"),exec:function(e){e.findPrevious()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"selectOrFindNext",bindKey:o("Alt-K","Ctrl-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findNext()},readOnly:!0},{name:"selectOrFindPrevious",bindKey:o("Alt-Shift-K","Ctrl-Shift-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findPrevious()},readOnly:!0},{name:"find",bindKey:o("Ctrl-F","Command-F"),exec:function(e){i.loadModule("ace/ext/searchbox",function(t){t.Search(e)})},readOnly:!0},{name:"overwrite",bindKey:"Insert",exec:function(e){e.toggleOverwrite()},readOnly:!0},{name:"selecttostart",bindKey:o("Ctrl-Shift-Home","Command-Shift-Home|Command-Shift-Up"),exec:function(e){e.getSelection().selectFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotostart",bindKey:o("Ctrl-Home","Command-Home|Command-Up"),exec:function(e){e.navigateFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectup",bindKey:o("Shift-Up","Shift-Up|Ctrl-Shift-P"),exec:function(e){e.getSelection().selectUp()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golineup",bindKey:o("Up","Up|Ctrl-P"),exec:function(e,t){e.navigateUp(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttoend",bindKey:o("Ctrl-Shift-End","Command-Shift-End|Command-Shift-Down"),exec:function(e){e.getSelection().selectFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotoend",bindKey:o("Ctrl-End","Command-End|Command-Down"),exec:function(e){e.navigateFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectdown",bindKey:o("Shift-Down","Shift-Down|Ctrl-Shift-N"),exec:function(e){e.getSelection().selectDown()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golinedown",bindKey:o("Down","Down|Ctrl-N"),exec:function(e,t){e.navigateDown(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordleft",bindKey:o("Ctrl-Shift-Left","Option-Shift-Left"),exec:function(e){e.getSelection().selectWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordleft",bindKey:o("Ctrl-Left","Option-Left"),exec:function(e){e.navigateWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolinestart",bindKey:o("Alt-Shift-Left","Command-Shift-Left|Ctrl-Shift-A"),exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolinestart",bindKey:o("Alt-Left|Home","Command-Left|Home|Ctrl-A"),exec:function(e){e.navigateLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectleft",bindKey:o("Shift-Left","Shift-Left|Ctrl-Shift-B"),exec:function(e){e.getSelection().selectLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoleft",bindKey:o("Left","Left|Ctrl-B"),exec:function(e,t){e.navigateLeft(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordright",bindKey:o("Ctrl-Shift-Right","Option-Shift-Right"),exec:function(e){e.getSelection().selectWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordright",bindKey:o("Ctrl-Right","Option-Right"),exec:function(e){e.navigateWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolineend",bindKey:o("Alt-Shift-Right","Command-Shift-Right|Shift-End|Ctrl-Shift-E"),exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolineend",bindKey:o("Alt-Right|End","Command-Right|End|Ctrl-E"),exec:function(e){e.navigateLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectright",bindKey:o("Shift-Right","Shift-Right"),exec:function(e){e.getSelection().selectRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoright",bindKey:o("Right","Right|Ctrl-F"),exec:function(e,t){e.navigateRight(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectpagedown",bindKey:"Shift-PageDown",exec:function(e){e.selectPageDown()},readOnly:!0},{name:"pagedown",bindKey:o(null,"Option-PageDown"),exec:function(e){e.scrollPageDown()},readOnly:!0},{name:"gotopagedown",bindKey:o("PageDown","PageDown|Ctrl-V"),exec:function(e){e.gotoPageDown()},readOnly:!0},{name:"selectpageup",bindKey:"Shift-PageUp",exec:function(e){e.selectPageUp()},readOnly:!0},{name:"pageup",bindKey:o(null,"Option-PageUp"),exec:function(e){e.scrollPageUp()},readOnly:!0},{name:"gotopageup",bindKey:"PageUp",exec:function(e){e.gotoPageUp()},readOnly:!0},{name:"scrollup",bindKey:o("Ctrl-Up",null),exec:function(e){e.renderer.scrollBy(0,-2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"scrolldown",bindKey:o("Ctrl-Down",null),exec:function(e){e.renderer.scrollBy(0,2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"selectlinestart",bindKey:"Shift-Home",exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectlineend",bindKey:"Shift-End",exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"togglerecording",bindKey:o("Ctrl-Alt-E","Command-Option-E"),exec:function(e){e.commands.toggleRecording(e)},readOnly:!0},{name:"replaymacro",bindKey:o("Ctrl-Shift-E","Command-Shift-E"),exec:function(e){e.commands.replay(e)},readOnly:!0},{name:"jumptomatching",bindKey:o("Ctrl-P","Ctrl-P"),exec:function(e){e.jumpToMatching()},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"selecttomatching",bindKey:o("Ctrl-Shift-P","Ctrl-Shift-P"),exec:function(e){e.jumpToMatching(!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"expandToMatching",bindKey:o("Ctrl-Shift-M","Ctrl-Shift-M"),exec:function(e){e.jumpToMatching(!0,!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"passKeysToBrowser",bindKey:o(null,null),exec:function(){},passEvent:!0,readOnly:!0},{name:"copy",exec:function(e){},readOnly:!0},{name:"cut",exec:function(e){var t=e.$copyWithEmptySelection&&e.selection.isEmpty(),n=t?e.selection.getLineRange():e.selection.getRange();e._emit("cut",n),n.isEmpty()||e.session.remove(n),e.clearSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"paste",exec:function(e,t){e.$handlePaste(t)},scrollIntoView:"cursor"},{name:"removeline",bindKey:o("Ctrl-D","Command-D"),exec:function(e){e.removeLines()},scrollIntoView:"cursor",multiSelectAction:"forEachLine"},{name:"duplicateSelection",bindKey:o("Ctrl-Shift-D","Command-Shift-D"),exec:function(e){e.duplicateSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"sortlines",bindKey:o("Ctrl-Alt-S","Command-Alt-S"),exec:function(e){e.sortLines()},scrollIntoView:"selection",multiSelectAction:"forEachLine"},{name:"togglecomment",bindKey:o("Ctrl-/","Command-/"),exec:function(e){e.toggleCommentLines()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"toggleBlockComment",bindKey:o("Ctrl-Shift-/","Command-Shift-/"),exec:function(e){e.toggleBlockComment()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"modifyNumberUp",bindKey:o("Ctrl-Shift-Up","Alt-Shift-Up"),exec:function(e){e.modifyNumber(1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"modifyNumberDown",bindKey:o("Ctrl-Shift-Down","Alt-Shift-Down"),exec:function(e){e.modifyNumber(-1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"replace",bindKey:o("Ctrl-H","Command-Option-F"),exec:function(e){i.loadModule("ace/ext/searchbox",function(t){t.Search(e,!0)})}},{name:"undo",bindKey:o("Ctrl-Z","Command-Z"),exec:function(e){e.undo()}},{name:"redo",bindKey:o("Ctrl-Shift-Z|Ctrl-Y","Command-Shift-Z|Command-Y"),exec:function(e){e.redo()}},{name:"copylinesup",bindKey:o("Alt-Shift-Up","Command-Option-Up"),exec:function(e){e.copyLinesUp()},scrollIntoView:"cursor"},{name:"movelinesup",bindKey:o("Alt-Up","Option-Up"),exec:function(e){e.moveLinesUp()},scrollIntoView:"cursor"},{name:"copylinesdown",bindKey:o("Alt-Shift-Down","Command-Option-Down"),exec:function(e){e.copyLinesDown()},scrollIntoView:"cursor"},{name:"movelinesdown",bindKey:o("Alt-Down","Option-Down"),exec:function(e){e.moveLinesDown()},scrollIntoView:"cursor"},{name:"del",bindKey:o("Delete","Delete|Ctrl-D|Shift-Delete"),exec:function(e){e.remove("right")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"backspace",bindKey:o("Shift-Backspace|Backspace","Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"),exec:function(e){e.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"cut_or_delete",bindKey:o("Shift-Delete",null),exec:function(e){if(!e.selection.isEmpty())return!1;e.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestart",bindKey:o("Alt-Backspace","Command-Backspace"),exec:function(e){e.removeToLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineend",bindKey:o("Alt-Delete","Ctrl-K|Command-Delete"),exec:function(e){e.removeToLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestarthard",bindKey:o("Ctrl-Shift-Backspace",null),exec:function(e){var t=e.selection.getRange();t.start.column=0,e.session.remove(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineendhard",bindKey:o("Ctrl-Shift-Delete",null),exec:function(e){var t=e.selection.getRange();t.end.column=Number.MAX_VALUE,e.session.remove(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordleft",bindKey:o("Ctrl-Backspace","Alt-Backspace|Ctrl-Alt-Backspace"),exec:function(e){e.removeWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordright",bindKey:o("Ctrl-Delete","Alt-Delete"),exec:function(e){e.removeWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"outdent",bindKey:o("Shift-Tab","Shift-Tab"),exec:function(e){e.blockOutdent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"indent",bindKey:o("Tab","Tab"),exec:function(e){e.indent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"blockoutdent",bindKey:o("Ctrl-[","Ctrl-["),exec:function(e){e.blockOutdent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"blockindent",bindKey:o("Ctrl-]","Ctrl-]"),exec:function(e){e.blockIndent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"insertstring",exec:function(e,t){e.insert(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"inserttext",exec:function(e,t){e.insert(r.stringRepeat(t.text||"",t.times||1))},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"splitline",bindKey:o(null,"Ctrl-O"),exec:function(e){e.splitLine()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"transposeletters",bindKey:o("Alt-Shift-X","Ctrl-T"),exec:function(e){e.transposeLetters()},multiSelectAction:function(e){e.transposeSelections(1)},scrollIntoView:"cursor"},{name:"touppercase",bindKey:o("Ctrl-U","Ctrl-U"),exec:function(e){e.toUpperCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"tolowercase",bindKey:o("Ctrl-Shift-U","Ctrl-Shift-U"),exec:function(e){e.toLowerCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"expandtoline",bindKey:o("Ctrl-Shift-L","Command-Shift-L"),exec:function(e){var t=e.selection.getRange();t.start.column=t.end.column=0,t.end.row++,e.selection.setRange(t,!1)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"joinlines",bindKey:o(null,null),exec:function(e){var t=e.selection.isBackwards(),n=t?e.selection.getSelectionLead():e.selection.getSelectionAnchor(),i=t?e.selection.getSelectionAnchor():e.selection.getSelectionLead(),o=e.session.doc.getLine(n.row).length,u=e.session.doc.getTextRange(e.selection.getRange()),a=u.replace(/\n\s*/," ").length,f=e.session.doc.getLine(n.row);for(var l=n.row+1;l<=i.row+1;l++){var c=r.stringTrimLeft(r.stringTrimRight(e.session.doc.getLine(l)));c.length!==0&&(c=" "+c),f+=c}i.row+1<e.session.doc.getLength()-1&&(f+=e.session.doc.getNewLineCharacter()),e.clearSelection(),e.session.doc.replace(new s(n.row,0,i.row+2,0),f),a>0?(e.selection.moveCursorTo(n.row,n.column),e.selection.selectTo(n.row,n.column+a)):(o=e.session.doc.getLine(n.row).length>o?o+1:o,e.selection.moveCursorTo(n.row,o))},multiSelectAction:"forEach",readOnly:!0},{name:"invertSelection",bindKey:o(null,null),exec:function(e){var t=e.session.doc.getLength()-1,n=e.session.doc.getLine(t).length,r=e.selection.rangeList.ranges,i=[];r.length<1&&(r=[e.selection.getRange()]);for(var o=0;o<r.length;o++)o==r.length-1&&(r[o].end.row!==t||r[o].end.column!==n)&&i.push(new s(r[o].end.row,r[o].end.column,t,n)),o===0?(r[o].start.row!==0||r[o].start.column!==0)&&i.push(new s(0,0,r[o].start.row,r[o].start.column)):i.push(new s(r[o-1].end.row,r[o-1].end.column,r[o].start.row,r[o].start.column));e.exitMultiSelectMode(),e.clearSelection();for(var o=0;o<i.length;o++)e.selection.addRange(i[o],!1)},readOnly:!0,scrollIntoView:"none"}]}),ace.define("ace/clipboard",["require","exports","module"],function(e,t,n){"use strict";n.exports={lineMode:!1}}),ace.define("ace/editor",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/keyboard/textinput","ace/mouse/mouse_handler","ace/mouse/fold_handler","ace/keyboard/keybinding","ace/edit_session","ace/search","ace/range","ace/lib/event_emitter","ace/commands/command_manager","ace/commands/default_commands","ace/config","ace/token_iterator","ace/clipboard"],function(e,t,n){"use strict";e("./lib/fixoldbrowsers");var r=e("./lib/oop"),i=e("./lib/dom"),s=e("./lib/lang"),o=e("./lib/useragent"),u=e("./keyboard/textinput").TextInput,a=e("./mouse/mouse_handler").MouseHandler,f=e("./mouse/fold_handler").FoldHandler,l=e("./keyboard/keybinding").KeyBinding,c=e("./edit_session").EditSession,h=e("./search").Search,p=e("./range").Range,d=e("./lib/event_emitter").EventEmitter,v=e("./commands/command_manager").CommandManager,m=e("./commands/default_commands").commands,g=e("./config"),y=e("./token_iterator").TokenIterator,b=e("./clipboard"),w=function(e,t,n){var r=e.getContainerElement();this.container=r,this.renderer=e,this.id="editor"+ ++w.$uid,this.commands=new v(o.isMac?"mac":"win",m),typeof document=="object"&&(this.textInput=new u(e.getTextAreaContainer(),this),this.renderer.textarea=this.textInput.getElement(),this.$mouseHandler=new a(this),new f(this)),this.keyBinding=new l(this),this.$search=(new h).set({wrap:!0}),this.$historyTracker=this.$historyTracker.bind(this),this.commands.on("exec",this.$historyTracker),this.$initOperationListeners(),this._$emitInputEvent=s.delayedCall(function(){this._signal("input",{}),this.session&&this.session.bgTokenizer&&this.session.bgTokenizer.scheduleStart()}.bind(this)),this.on("change",function(e,t){t._$emitInputEvent.schedule(31)}),this.setSession(t||n&&n.session||new c("")),g.resetOptions(this),n&&this.setOptions(n),g._signal("editor",this)};w.$uid=0,function(){r.implement(this,d),this.$initOperationListeners=function(){this.commands.on("exec",this.startOperation.bind(this),!0),this.commands.on("afterExec",this.endOperation.bind(this),!0),this.$opResetTimer=s.delayedCall(this.endOperation.bind(this,!0)),this.on("change",function(){this.curOp||(this.startOperation(),this.curOp.selectionBefore=this.$lastSel),this.curOp.docChanged=!0}.bind(this),!0),this.on("changeSelection",function(){this.curOp||(this.startOperation(),this.curOp.selectionBefore=this.$lastSel),this.curOp.selectionChanged=!0}.bind(this),!0)},this.curOp=null,this.prevOp={},this.startOperation=function(e){if(this.curOp){if(!e||this.curOp.command)return;this.prevOp=this.curOp}e||(this.previousCommand=null,e={}),this.$opResetTimer.schedule(),this.curOp=this.session.curOp={command:e.command||{},args:e.args,scrollTop:this.renderer.scrollTop},this.curOp.selectionBefore=this.selection.toJSON()},this.endOperation=function(e){if(this.curOp){if(e&&e.returnValue===!1)return this.curOp=null;if(e==1&&this.curOp.command&&this.curOp.command.name=="mouse")return;this._signal("beforeEndOperation");if(!this.curOp)return;var t=this.curOp.command,n=t&&t.scrollIntoView;if(n){switch(n){case"center-animate":n="animate";case"center":this.renderer.scrollCursorIntoView(null,.5);break;case"animate":case"cursor":this.renderer.scrollCursorIntoView();break;case"selectionPart":var r=this.selection.getRange(),i=this.renderer.layerConfig;(r.start.row>=i.lastRow||r.end.row<=i.firstRow)&&this.renderer.scrollSelectionIntoView(this.selection.anchor,this.selection.lead);break;default:}n=="animate"&&this.renderer.animateScrolling(this.curOp.scrollTop)}var s=this.selection.toJSON();this.curOp.selectionAfter=s,this.$lastSel=this.selection.toJSON(),this.session.getUndoManager().addSelection(s),this.prevOp=this.curOp,this.curOp=null}},this.$mergeableCommands=["backspace","del","insertstring"],this.$historyTracker=function(e){if(!this.$mergeUndoDeltas)return;var t=this.prevOp,n=this.$mergeableCommands,r=t.command&&e.command.name==t.command.name;if(e.command.name=="insertstring"){var i=e.args;this.mergeNextCommand===undefined&&(this.mergeNextCommand=!0),r=r&&this.mergeNextCommand&&(!/\s/.test(i)||/\s/.test(t.args)),this.mergeNextCommand=!0}else r=r&&n.indexOf(e.command.name)!==-1;this.$mergeUndoDeltas!="always"&&Date.now()-this.sequenceStartTime>2e3&&(r=!1),r?this.session.mergeUndoDeltas=!0:n.indexOf(e.command.name)!==-1&&(this.sequenceStartTime=Date.now())},this.setKeyboardHandler=function(e,t){if(e&&typeof e=="string"&&e!="ace"){this.$keybindingId=e;var n=this;g.loadModule(["keybinding",e],function(r){n.$keybindingId==e&&n.keyBinding.setKeyboardHandler(r&&r.handler),t&&t()})}else this.$keybindingId=null,this.keyBinding.setKeyboardHandler(e),t&&t()},this.getKeyboardHandler=function(){return this.keyBinding.getKeyboardHandler()},this.setSession=function(e){if(this.session==e)return;this.curOp&&this.endOperation(),this.curOp={};var t=this.session;if(t){this.session.off("change",this.$onDocumentChange),this.session.off("changeMode",this.$onChangeMode),this.session.off("tokenizerUpdate",this.$onTokenizerUpdate),this.session.off("changeTabSize",this.$onChangeTabSize),this.s