Hueman Addons - Version 2.0.0

Version Description

: December 16th, 2016 = * added : new customizer interface. Requires WP 4.7+ and Hueman v3.3.0

Download this release

Release Info

Developer nikeo
Plugin Icon 128x128 Hueman Addons
Version 2.0.0
Comparing to
See all releases

Code changes from version 1.0.9 to 2.0.0

assets/czr/css/czr-control-footer.css CHANGED
@@ -25,7 +25,10 @@
25
  color: #E6B800;
26
  text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.6);
27
  }
28
-
 
 
 
29
 
30
  @media screen and (min-width: 1025px) {
31
  .wp-customizer .expanded #customize-footer-actions {
25
  color: #E6B800;
26
  text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.6);
27
  }
28
+ /* Add space at the bottom of each section => otherwise the last controls might be hidden */
29
+ .accordion-section-content {
30
+ margin-bottom: 40px!important;
31
+ }
32
 
33
  @media screen and (min-width: 1025px) {
34
  .wp-customizer .expanded #customize-footer-actions {
assets/czr/css/czr-control.css ADDED
@@ -0,0 +1,2601 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* OVERRIDE WP CUSTOMIZER */
2
+
3
+ /* LAYOUT */
4
+ .wp-customizer .wp-full-overlay.expanded {
5
+ margin-left: 440px;
6
+ }
7
+ .wp-customizer .wp-full-overlay-sidebar {
8
+ width: 440px;
9
+ }
10
+ .wp-customizer .wp-full-overlay.collapsed .wp-full-overlay-sidebar {
11
+ margin-left: -440px;
12
+ }
13
+ /*.in-sub-panel #customize-info,
14
+ .in-sub-panel #customize-theme-controls > ul > .accordion-section {
15
+ left: -440px;
16
+ width: 440px;
17
+ }*/
18
+ #customize-theme-controls .control-section.current-panel > h3.accordion-section-title {
19
+ left: -440px;
20
+ }
21
+ .accordion-sub-container.control-panel-content {
22
+ left: 440px;
23
+ }
24
+
25
+
26
+ /* RTL*/
27
+ .rtl.wp-customizer .wp-full-overlay.expanded {
28
+ margin-right: 440px;
29
+ margin-left: 0;
30
+ }
31
+ .rtl.wp-customizer .wp-full-overlay-sidebar {
32
+ width: 440px;
33
+ }
34
+ .rtl.wp-customizer .wp-full-overlay.collapsed .wp-full-overlay-sidebar {
35
+ margin-right: -440px;
36
+ margin-left: 0;
37
+ }
38
+ /*.rtl .in-sub-panel #customize-info,
39
+ .rtl .in-sub-panel #customize-theme-controls > ul > .accordion-section {
40
+ right: -440px;
41
+ width: 440px;
42
+ }*/
43
+ .rtl #customize-theme-controls .control-section.current-panel > h3.accordion-section-title {
44
+ right: -440px;
45
+ }
46
+ .rtl .accordion-sub-container.control-panel-content {
47
+ right: 440px;
48
+ }
49
+
50
+ /* CUSTOM CSS ( since wp 4.7 ) */
51
+ .customize-section-description-container + #customize-control-custom_css:last-child {
52
+ margin: 0;
53
+ width: 100%;
54
+ }
55
+ li#customize-control-custom_css textarea {
56
+ font-size: 13px;
57
+ background: #394143;
58
+ color: #95ff0c;
59
+ min-height: 300px;
60
+ }
61
+
62
+ @media screen and (max-width: 1400px) {
63
+ .wp-customizer .wp-full-overlay.expanded {
64
+ margin-left: 380px;
65
+ }
66
+ .wp-customizer .wp-full-overlay-sidebar {
67
+ width: 380px;
68
+ }
69
+ .wp-customizer .wp-full-overlay.collapsed .wp-full-overlay-sidebar {
70
+ margin-left: -380px;
71
+ }
72
+ /* .in-sub-panel #customize-info,
73
+ .in-sub-panel #customize-theme-controls > ul > .accordion-section {
74
+ left: -380px;
75
+ width: 380px;
76
+ }*/
77
+ #customize-theme-controls .control-section.current-panel > h3.accordion-section-title {
78
+ left: -380px;
79
+ }
80
+ .accordion-sub-container.control-panel-content {
81
+ left: 380px;
82
+ }
83
+
84
+ /* RTL */
85
+ .rtl.wp-customizer .wp-full-overlay.expanded {
86
+ margin-right: 380px;
87
+ margin-left: 0;
88
+ }
89
+ .rtl.wp-customizer .wp-full-overlay-sidebar {
90
+ width: 380px;
91
+ }
92
+ .rtl.wp-customizer .wp-full-overlay.collapsed .wp-full-overlay-sidebar {
93
+ margin-right: -380px;
94
+ margin-left: 0;
95
+ }
96
+ /* .rtl .in-sub-panel #customize-info,
97
+ .rtl .in-sub-panel #customize-theme-controls > ul > .accordion-section {
98
+ right: -380px;
99
+ width: 380px;
100
+ }*/
101
+ .rtl #customize-theme-controls .control-section.current-panel > h3.accordion-section-title {
102
+ right: -380px;
103
+ }
104
+ .rtl .accordion-sub-container.control-panel-content {
105
+ right: 380px;
106
+ }
107
+ }
108
+
109
+ @media screen and (max-width: 979px) {
110
+ .wp-customizer .wp-full-overlay.expanded {
111
+ margin-left: 300px;
112
+ }
113
+ .wp-customizer .wp-full-overlay-sidebar {
114
+ width: 300px;
115
+ }
116
+ .wp-customizer .wp-full-overlay.collapsed .wp-full-overlay-sidebar {
117
+ margin-left: -300px;
118
+ }
119
+ /* .in-sub-panel #customize-info,
120
+ .in-sub-panel #customize-theme-controls > ul > .accordion-section {
121
+ left: -300px;
122
+ width: 300px;
123
+ }*/
124
+ #customize-theme-controls .control-section.current-panel > h3.accordion-section-title {
125
+ left: -300px;
126
+ }
127
+ .accordion-sub-container.control-panel-content {
128
+ left: 300px;
129
+ }
130
+
131
+ /* RTL */
132
+ .rtl.wp-customizer .wp-full-overlay.expanded {
133
+ margin-right: 300px;
134
+ margin-left: 0;
135
+ }
136
+ .rtl.wp-customizer .wp-full-overlay-sidebar {
137
+ width: 300px;
138
+ }
139
+ .rtl.wp-customizer .wp-full-overlay.collapsed .wp-full-overlay-sidebar {
140
+ margin-right: -300px;
141
+ margin-left: 0;
142
+ }
143
+ /* .rtl .in-sub-panel #customize-info,
144
+ .rtl .in-sub-panel #customize-theme-controls > ul > .accordion-section {
145
+ right: -300px;
146
+ width: 300px;
147
+ }*/
148
+ .rtl #customize-theme-controls .control-section.current-panel > h3.accordion-section-title {
149
+ right: -300px;
150
+ }
151
+ .rtl .accordion-sub-container.control-panel-content {
152
+ right: 300px;
153
+ }
154
+ }
155
+
156
+ /* at max-width 640px the wp-full-overlay-sidebar becomes 100% */
157
+ @media screen and (max-width: 640px) {
158
+ .wp-customizer .customize-controls-preview-toggle {
159
+ height: 46px;
160
+ border-bottom: 1px solid #ddd;
161
+ left: 87px;
162
+ }
163
+
164
+ .wp-customizer .wp-full-overlay.expanded {
165
+ margin-left: 0;
166
+ }
167
+
168
+ /* .in-sub-panel #customize-info,
169
+ .in-sub-panel #customize-theme-controls > ul > .accordion-section {
170
+ left: -100%;
171
+ width: 100%;
172
+ }*/
173
+
174
+ #customize-theme-controls .control-section.current-panel > h3.accordion-section-title {
175
+ left: -100%;
176
+ }
177
+ .accordion-sub-container.control-panel-content {
178
+ left: 100%;
179
+ }
180
+
181
+ /* RTL */
182
+ .rtl.wp-customizer .wp-full-overlay.expanded {
183
+ margin-right: 0;
184
+ }
185
+
186
+ /* .rtl .in-sub-panel #customize-info,
187
+ .rtl .in-sub-panel #customize-theme-controls > ul > .accordion-section {
188
+ right: -100%;
189
+ width: 100%;
190
+ left: auto;
191
+ }*/
192
+ .rtl .in-sub-panel #czr-donate-customizer,
193
+ .rtl .in-sub-panel .czr-cta-wrap,
194
+ .rtl #customize-theme-controls .control-section.current-panel > h3.accordion-section-title {
195
+ right: -100%;
196
+ left: auto;
197
+ }
198
+ .rtl .accordion-sub-container.control-panel-content {
199
+ right: 100%;
200
+ }
201
+ }
202
+
203
+
204
+ /* PANELS AND SECTIONS TITLES */
205
+
206
+ .wp-customizer .control-section.control-panel .accordion-section-title .panel-title {
207
+ font-size: 24px;
208
+ font-weight: inherit;
209
+ line-height: 30px;
210
+ }
211
+
212
+ .wp-core-ui h3 {
213
+ color: #555;
214
+ }
215
+ .accordion-section-content {
216
+ padding: 10px 10px 15px 20px;
217
+ }
218
+ .widget-action, .handlediv, .item-edit, .sidebar-name-arrow, .accordion-section-title:after {
219
+ color: #00a0d2;
220
+ }
221
+ .control-section.control-panel > .accordion-section-title:after {
222
+ color: #00a0d2;
223
+ }
224
+ .customize-control-title {
225
+ line-height: 19px;
226
+ }
227
+
228
+ /* since v4.3 */
229
+ .wp-customizer #customize-theme-controls .accordion-section-content {
230
+ background: #fff;
231
+ }
232
+ /*.wp-customizer .customize-panel-back {
233
+ height: 60px;
234
+ }*/
235
+ .wp-customizer #customize-controls .customize-info .customize-help-toggle:hover, .wp-customizer #customize-controls .customize-info.open .customize-help-toggle, .wp-customizer #customize-controls .customize-info .customize-help-toggle:focus {
236
+ color:#00a0d2;
237
+ }
238
+ .wp-customizer .customize-screen-options-toggle:focus:before, .wp-customizer #customize-controls .customize-info .customize-help-toggle:focus:before {
239
+ -webkit-box-shadow: 0 0 0 1px #00a0d2;
240
+ box-shadow: 0 0 0 1px #00a0d2;
241
+ -webkit-border-radius: 100%;
242
+ border-radius: 100%;
243
+ }
244
+
245
+ .wp-customizer .menu-item-handle:hover .item-type, .wp-customizer .menu-item-handle:hover .item-edit, .wp-customizer #available-menu-items .menu-item-handle:hover .item-add, .wp-customizer .menu-item-handle:hover{
246
+ color: #00a0d2;
247
+ }
248
+
249
+ .customize-screen-options-toggle:hover, .customize-screen-options-toggle:active, .customize-screen-options-toggle:focus, .active-menu-screen-options .customize-screen-options-toggle, #customize-controls .customize-info.open.active-menu-screen-options .customize-help-toggle:hover, #customize-controls .customize-info.open.active-menu-screen-options .customize-help-toggle:active, #customize-controls .customize-info.open.active-menu-screen-options .customize-help-toggle:focus {
250
+ color: #00a0d2!important;
251
+ }
252
+
253
+ .customize-control input[type="text"] {
254
+ line-height: 23px;
255
+ }
256
+
257
+
258
+ /* GENERAL STYLE */
259
+ .control-section .accordion-section-content {
260
+ overflow-y: auto;
261
+ }
262
+ li[id*="customize-control-"] {
263
+ margin: 8px 0;
264
+ }
265
+
266
+ .wp-customizer .control-section h3.accordion-section-title {
267
+ padding: 10px 25px 11px 14px;
268
+
269
+ }
270
+ .wp-customizer #customize-controls h3 {
271
+ font-size: 15px;
272
+ font-weight: 400;
273
+ }
274
+
275
+ .control-section .accordion-section-title:after {
276
+ top: 7px;
277
+ }
278
+ .control-section.control-panel .accordion-section-title:after {
279
+ top: 11px;
280
+ -webkit-transition: right .3s ease-in-out, opacity .3s ease-in-out;
281
+ -moz-transition: right .3s ease-in-out, opacity .3s ease-in-out;
282
+ -ms-transition: right .3s ease-in-out, opacity .3s ease-in-out;
283
+ -o-transition: right .3s ease-in-out, opacity .3s ease-in-out;
284
+ transition: right .3s ease-in-out, opacity .3s ease-in-out;
285
+ right: 10px;
286
+ opacity:0.7;
287
+ }
288
+ .rtl .control-section.control-panel .accordion-section-title:after {
289
+ -webkit-transition: left .3s ease-in-out, opacity .3s ease-in-out;
290
+ -moz-transition: left .3s ease-in-out, opacity .3s ease-in-out;
291
+ -ms-transition: left .3s ease-in-out, opacity .3s ease-in-out;
292
+ -o-transition: left .3s ease-in-out, opacity .3s ease-in-out;
293
+ transition: left .3s ease-in-out, opacity .3s ease-in-out;
294
+ left: 10px;
295
+ right: initial;
296
+ }
297
+ #customize-theme-controls .control-section.control-panel h3.accordion-section-title:hover:after , #customize-theme-controls .control-section.control-panel h3.accordion-section-title:focus:after {
298
+ right: 8px;
299
+ opacity:1;
300
+ color: #666!important;
301
+ }
302
+
303
+ .rtl #customize-theme-controls .control-section.control-panel h3.accordion-section-title:hover:after , .rtl #customize-theme-controls .control-section.control-panel h3.accordion-section-title:focus:after {
304
+ left: 6px;
305
+ right: initial;
306
+ }
307
+ /* Overrides WP built in style : hack for nested section arrow */
308
+ #customize-theme-controls .control-section.control-panel>h3.accordion-section-title:focus:after, #customize-theme-controls .control-section.control-panel>h3.accordion-section-title:hover:after, .control-section.control-panel>.accordion-section-title:after {
309
+ background: none!important;
310
+ border: none!important;
311
+ }
312
+
313
+ #customize-theme-controls h3.accordion-section-title {
314
+ /*font-family: "Open Sans", sans-serif;*/
315
+ -webkit-transition: background .1s ease-in-out;
316
+ -moz-transition: background .1s ease-in-out;
317
+ -ms-transition: background .1s ease-in-out;
318
+ -o-transition: background .1s ease-in-out;
319
+ transition: background .1s ease-in-out;
320
+ }
321
+
322
+ /*#customize-theme-controls > .control-section:hover .accordion-section-title::after, #customize-theme-controls .control-section .accordion-section-title:hover::after, #customize-theme-controls .control-section.open .accordion-section-title::after, #customize-theme-controls .control-section .accordion-section-title:focus::after {
323
+ color: #FFF;
324
+ }*/
325
+
326
+
327
+ .customize-control-checkbox label, .customize-control-nav_menu_auto_add label, .customize-control-radio label {
328
+ line-height: 16px;
329
+ margin-left: 0;
330
+ }
331
+
332
+ /* Placeholders Styling for inputs */
333
+ input::-webkit-input-placeholder {
334
+ color:#9A9A9A;
335
+ font-style: italic;
336
+ }
337
+ input:-moz-placeholder { /* Firefox 18- */
338
+ color: #9A9A9A;
339
+ font-style: italic;
340
+ }
341
+ input::-moz-placeholder { /* Firefox 19+ */
342
+ color: #9A9A9A;
343
+ font-style: italic;
344
+ }
345
+ input:-ms-input-placeholder {
346
+ color: #9A9A9A;
347
+ font-style: italic;
348
+ }
349
+
350
+
351
+ .czr-customizr-title {
352
+ /* color: #555; */
353
+ text-transform: uppercase;
354
+ /* text-shadow: 0 1px 0 #FFF; */
355
+ margin: 1em 0em 5px 0em;
356
+ font-size: 15px!important;
357
+ border-bottom: 1px dotted #00a0d2;
358
+ padding-bottom: 5px;
359
+ text-align: center;
360
+ }
361
+ h3.czr-customizr-title::before {
362
+ content: '\00b7';
363
+ padding-right: 3px;
364
+ }
365
+ h3.czr-customizr-title::after {
366
+ content: '\00b7';
367
+ padding-left: 3px;
368
+ }
369
+ .czr-after-button {
370
+ border-color: white;
371
+ margin-top:15px;
372
+ }
373
+ .czr-emphasize {
374
+ line-height: 1.2em;
375
+ color: #2E2E2E;
376
+ }
377
+ i.czr-notice {
378
+ display: block;
379
+ clear: both;
380
+ }
381
+ span.czr-notice {
382
+ color: #313131;
383
+ font-size:12px;
384
+ font-style: italic;
385
+ clear: both;
386
+ display: block;
387
+ line-height: 18px;
388
+ }
389
+ .czr-customizer-separator-invisible {
390
+ border:none;
391
+ margin-top:15px;
392
+ }
393
+ .czr-skin-gen-label {
394
+ float: left;
395
+ }
396
+ .czr-skin-gen-color-picker {
397
+ float: right;
398
+ }
399
+ .czr-number-label {
400
+ float: left;
401
+ }
402
+ .czr-number-input {
403
+ float: right;
404
+ }
405
+ .czr-check-label {
406
+ float: left;
407
+ max-width: 85%;
408
+ }
409
+ /* RTL position fix */
410
+ .rtl .czr-check-label {
411
+ float: right;
412
+ }
413
+ input[type=checkbox], input[type=radio] {
414
+ float: right;
415
+ min-height: 18px;
416
+ }
417
+ .czr-font-select {
418
+ float: left;
419
+ }
420
+
421
+ /* CUSTOM CSS TEXT AREA */
422
+ li#customize-control-tc_theme_options-tc_custom_css textarea {
423
+ font-size: 14px;
424
+ background: #394143;
425
+ color: #E2E728;
426
+ min-height: 300px;
427
+ }
428
+
429
+
430
+
431
+
432
+
433
+
434
+
435
+
436
+
437
+
438
+
439
+
440
+
441
+ .customize-control .czr-navigate-to-post-list {
442
+ color: #00a0d2;
443
+ font-weight: bold;
444
+ float: left;
445
+ clear: both;
446
+ width: 100%;
447
+ margin-bottom: 8px;
448
+ }
449
+
450
+ .czr-sub-control {
451
+ padding-left: 13%;
452
+ max-width: 87%;
453
+ position: relative;
454
+ }
455
+
456
+ .czr-sub-control:before {
457
+ content: '';
458
+ height: 116%;
459
+ background: #00a0d2;
460
+ width: 2%;
461
+ position: absolute;
462
+ left: 7%;
463
+ }
464
+
465
+ /* Cropped Image style */
466
+ /* Unified with the default cropped_image CSS */
467
+ .customize-control-tc_cropped_image .upload-button {
468
+ float: right;
469
+ }
470
+ .customize-control-tc_cropped_image .remove-button {
471
+ float: left;
472
+ margin-right: 3px;
473
+ }
474
+ .customize-control-tc_cropped_image .actions {
475
+ margin-bottom: 32px;
476
+ }
477
+ .customize-control-tc_cropped_image .current {
478
+ margin-bottom: 8px;
479
+ }
480
+ .customize-control-tc_cropped_image .upload-button,
481
+ .customize-control-tc_cropped_image .remove-button {
482
+ white-space: normal;
483
+ width: 48%;
484
+ height: auto;
485
+ }
486
+
487
+ .customize-control-tc_cropped_image .current .container {
488
+ min-height: 40px;
489
+ overflow: hidden;
490
+ border: 1px solid #eee;
491
+ -webkit-border-radius: 2px;
492
+ border-radius: 2px;
493
+ }
494
+ .customize-control-tc_cropped_image img {
495
+ width: 100%;
496
+ -webkit-border-radius: 2px;
497
+ border-radius: 2px;
498
+ }
499
+ .customize-control-tc_cropped_image .inner {
500
+ line-height: 20px;
501
+ top: 10px;
502
+ }
503
+ /* rtl */
504
+ /* end tc cropped image */
505
+ .rtl .customize-control-tc_cropped_image .upload-button {
506
+ float: left;
507
+ }
508
+ .rtl .customize-control-tc_cropped_image .remove-button {
509
+ float: right;
510
+ margin-left: 3px;
511
+ }
512
+
513
+
514
+
515
+
516
+
517
+ /* LAYOUT SELECTION SPECIFICS */
518
+ .czr-layout-img {
519
+ height: 26px;
520
+ padding-top: 2px;
521
+ border: 1px solid #FFF;
522
+ }
523
+ .czr-layout-title {
524
+ padding: 0 0px 18px 12px;
525
+ display: inline-block;
526
+ line-height: 0px;
527
+ vertical-align: middle;
528
+ }
529
+
530
+
531
+
532
+ /* MULTI INPUT */
533
+ .customize-control-czr_multi_input {
534
+ width: 96%;
535
+ border: 1px solid #ccc;
536
+ padding: 2%;
537
+ }
538
+ .czr-multi-input-wrapper {
539
+ width: 95%;
540
+ padding: 0px 0% 0 5%;
541
+ }
542
+ .czr-multi-input-wrapper [data-input-type="color"] .czr-input {
543
+ float: left;
544
+ clear: both;
545
+ }
546
+
547
+
548
+
549
+ /* SPECIFIC PANELS AND SECTIONS MARGIN */
550
+ #customize-theme-controls #accordion-panel-czr-footer-panel {
551
+ border-bottom: 1px solid #ddd;
552
+ }
553
+ #customize-theme-controls .control-panel-widgets,
554
+ #customize-theme-controls #accordion-panel-nav_menus,
555
+ #customize-theme-controls #accordion-panel-hu-advanced-panel {
556
+ margin-top: 10px;
557
+ }
558
+ #customize-theme-controls #accordion-panel-hu-header-panel,
559
+ #customize-theme-controls .control-panel-widgets,
560
+ #customize-theme-controls #accordion-panel-nav_menus,
561
+ #customize-theme-controls #accordion-panel-hu-advanced-panel {
562
+ border-top: 1px solid #ddd;
563
+ }
564
+ #customize-theme-controls #accordion-panel-hu-general-panel {
565
+ margin-bottom: 10px;
566
+ }
567
+
568
+ #customize-theme-controls #accordion-section-static_front_page {
569
+ margin-bottom: 10px;
570
+ }
571
+
572
+ /* HOME BUTTON */
573
+ #customize-header-actions .customize-controls-close {
574
+ left:45px;
575
+ }
576
+ .customize-controls-home, .customize-controls-close {
577
+ top: -1px;
578
+ }
579
+ .customize-controls-home {
580
+ display: block;
581
+ position: absolute;
582
+ left: 0;
583
+ width: 45px;
584
+ height: 41px;
585
+ padding: 0 2px 0 0;
586
+ background: #eee;
587
+ border: none;
588
+ border-top: 4px solid #eee;
589
+ border-right: 1px solid #ddd;
590
+ border-bottom: 1px solid #ddd;
591
+ color: #444;
592
+ text-align: left;
593
+ cursor: pointer;
594
+ text-decoration: none;
595
+ -webkit-transition: color .15s ease-in-out, border-color .15s ease-in-out, background .15s ease-in-out;
596
+ transition: color .1s ease-in-out, border-color .15s ease-in-out, background .15s ease-in-out;
597
+ -webkit-box-sizing: content-box;
598
+ -moz-box-sizing: content-box;
599
+ box-sizing: content-box;
600
+ }
601
+
602
+ .customize-controls-home:before {
603
+ font-size: 17px;
604
+ line-height:45px;
605
+ position: relative;
606
+ top: -4px;
607
+ left: 14px;
608
+ }
609
+ .customize-controls-home:hover {
610
+ background: #fff;
611
+ color: #0073aa;
612
+ border-top-color: #0073aa;
613
+ outline: none;
614
+ -webkit-box-shadow: none;
615
+ box-shadow: none;
616
+ }
617
+
618
+ /* HEADER MENU NOTICE */
619
+ .control-panel-content .hu-menu-notice {
620
+ margin-left: 3%;
621
+
622
+ }
623
+
624
+ /* PANEL SUBTITLE */
625
+ span.czr-panel-subtitle {
626
+ display: block;
627
+ font-size: 12px;
628
+ font-style: italic;
629
+ }/*******************************************************************
630
+ * DYNAMIC CONTROLS : sidebars, socials, ...
631
+ ********************************************************************/
632
+ .czr-open-pre-add-new {
633
+ display: block;
634
+ float: left;
635
+ margin: 2% 2% 0%;
636
+ width: 99%;
637
+ padding: 2%;
638
+ background: #3b8dbd;
639
+ opacity: 1;
640
+ color: #fff;
641
+ font-size: 16px;
642
+ cursor: pointer;
643
+ border-width: 1px;
644
+ border-style: solid;
645
+ -webkit-appearance: none;
646
+ -webkit-border-radius: 3px;
647
+ border-radius: 3px;
648
+ white-space: nowrap;
649
+ -webkit-box-sizing: border-box;
650
+ -moz-box-sizing: border-box;
651
+ box-sizing: border-box;
652
+ -webkit-transition: opacity 1s ease-in-out;
653
+ -moz-transition: opacity 1s ease-in-out;
654
+ -ms-transition: opacity 1s ease-in-out;
655
+ -o-transition: opacity 1s ease-in-out;
656
+ transition: opacity 1s ease-in-out;
657
+ }
658
+
659
+ .czr-open-pre-add-new.active {
660
+ background: #646464;
661
+ opacity: 0.5;
662
+ border-radius: 3px 3px 0 0;
663
+ }
664
+
665
+ .czr-single-item {
666
+ padding: 0%;
667
+ border: 1px solid #ccc;
668
+ margin: 1% 0 0 2%;
669
+ float: left;
670
+ width: 98%;
671
+ -webkit-border-radius: 3px;
672
+ border-radius: 3px;
673
+ -webkit-transition: opacity 1s ease-in-out;
674
+ -moz-transition: opacity 1s ease-in-out;
675
+ -ms-transition: opacity 1s ease-in-out;
676
+ -o-transition: opacity 1s ease-in-out;
677
+ transition: opacity 1s ease-in-out;
678
+ }
679
+
680
+ #customize-theme-controls .czr-single-item.open {
681
+ border: 1px solid #00a0d2;
682
+ }
683
+ /* Keep the normal border for single module, mono items controls */
684
+ #customize-theme-controls .mono-item-mod .czr-single-item {
685
+ border: 1px solid #ccc;
686
+ }
687
+
688
+ .czr-single-item .czr-item-header, .czr-single-item .czr-item-content {
689
+ padding: 1%;
690
+ }
691
+
692
+ .czr-items-wrapper .czr-single-item .czr-builtin-model {
693
+ background: #E1DFDF;
694
+ color: #555
695
+ }
696
+
697
+ .czr-items-wrapper .inactive {
698
+ opacity: 0.6;
699
+ }
700
+
701
+ .czr-item-sort-handle {
702
+ cursor: move;
703
+ }
704
+
705
+ .czr-single-item .czr-item-header {
706
+ position: relative;
707
+ background: #dfdfdf;
708
+ color: white;
709
+ float: left;
710
+ width: 98%;
711
+ -webkit-transition: background .1s ease-in-out;
712
+ -moz-transition: background .1s ease-in-out;
713
+ -ms-transition: background .1s ease-in-out;
714
+ -o-transition: background .1s ease-in-out;
715
+ transition: background .1s ease-in-out;
716
+ }
717
+
718
+
719
+ /* sidebar specifics */
720
+ .czr_widget_areas_module .czr-single-item .czr-custom-model {
721
+ background: #3b8dbd;
722
+ }
723
+ . .czr-single-item .czr-custom-model:hover {
724
+ background: #aaa;
725
+ }
726
+ .czr-single-item .czr-item-header:hover {
727
+ background: #ccc;
728
+ }
729
+
730
+ /* sidebar specifics */
731
+ /*.czr-builtin-model .czr-single-item .czr-item-header {
732
+ background:#3b8dbd;
733
+ }*/
734
+ .czr-items-wrapper .czr-single-item .czr-builtin-model:hover {
735
+ background: #ccc;
736
+ }
737
+
738
+ .czr-move-icon {
739
+ position: absolute;
740
+ top: -2px;
741
+ left: 3px;
742
+ font-size: 10px;
743
+ color: #999;
744
+ }
745
+ .czr-item-title {
746
+ float: left;
747
+ font-size: 17px;
748
+ color: #000;
749
+ padding: 7px;
750
+ width: 67%;
751
+ }
752
+
753
+ .czr-inactive-alert {
754
+ font-size: 12px;
755
+ font-style: italic;
756
+ }
757
+ /* sidebar specifics */
758
+ .czr_widget_areas_module .czr-item-title {
759
+ color: #fff;
760
+ }
761
+
762
+
763
+ .czr-builtin-model .czr-item-title {
764
+ color: #23282d;
765
+ }
766
+ .czr-item-title h4 {
767
+ margin: 0;
768
+ }
769
+ .czr-item-title .fa:before {
770
+ padding-right: 2px;
771
+ }
772
+ .czr-item-btns {
773
+ float: right;
774
+ }
775
+ .czr-item-btns a {
776
+ font-size: 17px;
777
+ padding: 7px 5px;
778
+ color: #777;
779
+ -webkit-transition: color .1s ease-in-out;
780
+ -moz-transition: color .1s ease-in-out;
781
+ -ms-transition: color .1s ease-in-out;
782
+ -o-transition: color .1s ease-in-out;
783
+ transition: color .1s ease-in-out;
784
+ }
785
+ .czr-item-btns a:active, .czr-item-btns a:focus {
786
+ outline: none;
787
+ outline: 0;
788
+ -webkit-box-shadow: none;
789
+ box-shadow: none;
790
+ }
791
+ /* sidebar specifics */
792
+ .czr_widget_areas_module .czr-item-btns a {
793
+ color: #fff;
794
+ }
795
+
796
+ .czr-builtin-model .czr-item-btns a {
797
+ color: #555
798
+ }
799
+
800
+ .czr-builtin-model .czr-item-btns .czr-edit-view:hover, .czr-builtin-model .czr-item-btns .czr-edit-view.active {
801
+ color: #00a0d2;
802
+ }
803
+
804
+ .czr-item-btns .czr-edit-view:hover, .czr-item-btns .czr-edit-view.active {
805
+ color: #00a0d2;
806
+ }
807
+
808
+ /* sidebar specifics */
809
+ .czr_widget_areas_module .czr-edit-view:hover, .czr_widget_areas_module .czr-item-btns .czr-edit-view.active {
810
+ color: #000000;
811
+ }
812
+ .czr_widget_areas_module .czr-builtin-model .czr-edit-view:hover, .czr_widget_areas_module .czr-builtin-model .czr-edit-view.active {
813
+ color: #00a0d2;
814
+ }
815
+
816
+ .czr-item-btns .czr-display-alert:hover, .czr-item-btns .czr-display-alert.active {
817
+ color: #23282d;
818
+ }
819
+
820
+
821
+ .czr-single-item .czr-item-content {
822
+ display: none;
823
+ clear: both;
824
+ width: 96%;
825
+ padding: 2%;
826
+ }
827
+ .czr-single-item .czr-item-content input {
828
+ margin-bottom: 0;
829
+ }
830
+ .czr-sub-set {
831
+ margin-bottom: 0;
832
+ display: block;
833
+ float: left;
834
+ width: 100%;
835
+ padding: 1% 0;
836
+ position: relative;
837
+ }
838
+
839
+ .czr-sub-set .czr-input {
840
+ float: right;
841
+ width: 60%;
842
+ }
843
+ .width-100 .czr-input {
844
+ width: 100%;
845
+ }
846
+ .czr-sub-set .customize-control-title {
847
+ float: left;
848
+ width: 40%;
849
+ padding: 1px 0;
850
+ font-size: 13px;
851
+ }
852
+
853
+ .czr-item-title .fa {
854
+ font-size: 18px;
855
+ }
856
+
857
+ /* Remove alert block */
858
+ .czr-remove-alert-wrapper {
859
+ display: none;
860
+ clear: both;
861
+ float: left;
862
+ padding: 2%;
863
+ width: 95%;
864
+ margin: 10px 0;
865
+ text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
866
+ background-color: #EEE;
867
+ color: #000;
868
+ -webkit-border-radius: 4px;
869
+ -moz-border-radius: 4px;
870
+ border-radius: 4px;
871
+ }
872
+
873
+ .czr-remove-alert-wrapper p {
874
+ padding: 5px;
875
+ margin: 0px;
876
+ }
877
+
878
+ /* pre add dialog */
879
+ .czr-pre-add-wrapper {
880
+ position: relative;
881
+ float: left;
882
+ width: 100%;
883
+ }
884
+
885
+ .czr-adding-new .czr-items-wrapper {
886
+ opacity: 0.6;
887
+ }
888
+
889
+ .czr-pre-add-view-content {
890
+ display: none;
891
+ padding: 3%;
892
+ border: 1px solid #00a0d2;
893
+ border-top: none;
894
+ margin: 0 0 0 2%;
895
+ float: left;
896
+ width: 92%;
897
+ background: #eee;
898
+ -webkit-border-radius: 0px 0px 3px 3px;
899
+ -moz-border-radius: 0px 0px 3px 3px;
900
+ border-radius: 0px 0px 3px 3px;
901
+ position: relative;
902
+ opacity: 1;
903
+ -webkit-transition: opacity .2s linear;
904
+ -moz-transition: opacity .2s linear;
905
+ -ms-transition: opacity .2s linear;
906
+ -o-transition: opacity .2s linear;
907
+ transition: opacity .2s linear;
908
+ }
909
+
910
+ .czr-model-added .czr-pre-add-view-content {
911
+ opacity: 0.2;
912
+ }
913
+
914
+ .czr-pre-add-wrapper .czr-add-new {
915
+ background: #3b8dbd;
916
+ color: #fff;
917
+ -webkit-transition: background .5s linear;
918
+ -moz-transition: background .5s linear;
919
+ -ms-transition: background .5s linear;
920
+ -o-transition: background .5s linear;
921
+ transition: background .5s linear;
922
+ float: right;
923
+ border: none;
924
+ }
925
+
926
+ .czr-add-success {
927
+ width: 100%;
928
+ margin: 0 0 0 2%;
929
+ position: absolute;
930
+ top: 0;
931
+ left: 0;
932
+ font-size: 25px;
933
+ text-align: center;
934
+ opacity: 0;
935
+ -webkit-transition: opacity .1s linear;
936
+ -moz-transition: opacity .1s linear;
937
+ -ms-transition: opacity .1s linear;
938
+ -o-transition: opacity .1s linear;
939
+ transition: opacity .1s linear;
940
+ }
941
+ .czr-model-added .czr-add-success {
942
+ opacity: 1;
943
+ }
944
+
945
+ .czr-add-success p {
946
+ vertical-align: middle;
947
+ display: inline-block;
948
+ line-height: 35px;
949
+ margin: 0;
950
+ font-size: 25px;
951
+ color: #82b965;
952
+ padding: 0 3%;
953
+ }
954
+
955
+
956
+ /* WIDGETS ZONE SPECIFICS */
957
+ .control-section-widget_zones_management {
958
+ margin: 10px 0;
959
+ z-index: 1;
960
+ }
961
+ /*#customize-theme-controls .control-section-widget_zones_management .accordion-section-content {
962
+ display: none;
963
+ left: 0;
964
+ position: relative;
965
+ }*/
966
+
967
+ .czr-zone-infos {
968
+ width: 96%;
969
+ padding: 0 2%;
970
+ font-size: 12px;
971
+ float: left;
972
+ font-style: italic;
973
+ }
974
+
975
+ /*#customize-theme-controls .control-section-widget_zones_management .accordion-section-title:after {
976
+ content: "\f078";
977
+ display: inline-block;
978
+ font: normal normal normal 14px/1 FontAwesome;
979
+ font-size: inherit;
980
+ text-rendering: auto;
981
+ -webkit-font-smoothing: antialiased;
982
+ -moz-osx-font-smoothing: grayscale;
983
+ }
984
+
985
+ #customize-theme-controls .control-section-widget_zones_management.open .accordion-section-title:after {
986
+ content: "\f077";
987
+ }*/
988
+ .czr-unavailable-location {
989
+ opacity: 0.7;
990
+ }
991
+ .czr-location-alert {
992
+ float: left;
993
+ width: 100%;
994
+ padding: 1% 0;
995
+ margin: 1% 0;
996
+ text-align: center;
997
+ border: 1px solid orange;
998
+ background: #FEE5B6;
999
+ color: #000;
1000
+ font-size: 11px;
1001
+ font-style: italic;
1002
+ }
1003
+ .in-sub-panel #czr-donate-customizer,
1004
+ .in-sub-panel .czr-cta-wrap {
1005
+ left: -450px;
1006
+ height: 0;
1007
+ }
1008
+
1009
+
1010
+ .rtl .in-sub-panel #czr-donate-customizer,
1011
+ .rtl .in-sub-panel .czr-cta-wrap {
1012
+ right: -450px;
1013
+ }
1014
+
1015
+
1016
+ @media screen and (max-width: 1400px) {
1017
+
1018
+ .in-sub-panel #czr-donate-customizer,
1019
+ .in-sub-panel .czr-cta-wrap {
1020
+ left: -380px;
1021
+ }
1022
+
1023
+ .rtl .in-sub-panel #czr-donate-customizer,
1024
+ .rtl .in-sub-panel .czr-cta-wrap {
1025
+ right: -380px;
1026
+ }
1027
+ }
1028
+
1029
+
1030
+
1031
+
1032
+ @media screen and (max-width: 979px) {
1033
+
1034
+
1035
+ .in-sub-panel #czr-donate-customizer,
1036
+ .in-sub-panel .czr-cta-wrap {
1037
+ left: -300px;
1038
+ }
1039
+
1040
+ .rtl .in-sub-panel #czr-donate-customizer,
1041
+ .rtl .in-sub-panel .czr-cta-wrap {
1042
+ right: -300px;
1043
+ }
1044
+ }
1045
+
1046
+ /* at max-width 640px the wp-full-overlay-sidebar becomes 100% */
1047
+ @media screen and (max-width: 640px) {
1048
+ .in-sub-panel .czr-cta-wrap,
1049
+ .in-sub-panel #czr-donate-customizer {
1050
+ left: -100%;
1051
+ }
1052
+
1053
+ .rtl .in-sub-panel #czr-donate-customizer,
1054
+ .rtl .in-sub-panel .czr-cta-wrap {
1055
+ right: -100%;
1056
+ left: auto;
1057
+ }
1058
+ }
1059
+
1060
+ @media screen and (min-width: 980px) {
1061
+ .wp-customizer .expanded #customize-footer-actions {
1062
+ width: 380px;
1063
+ }
1064
+ }
1065
+
1066
+ @media screen and (min-width: 1401px) {
1067
+ .wp-customizer .expanded #customize-footer-actions {
1068
+ width: 440px;
1069
+ }
1070
+ }
1071
+ /*
1072
+ * Selecter v3.1.9 - 2014-09-02
1073
+ * A jQuery plugin for replacing default select elements. Part of the Formstone Library.
1074
+ * http://formstone.it/selecter/
1075
+ *
1076
+ * Copyright 2014 Ben Plum; MIT Licensed
1077
+ */
1078
+ .selecter-element { *left: -999999px; position: absolute; opacity: 0; }
1079
+ .selecter { display: block;float: right;margin: 2px 0;position: relative;width: 100%;z-index: 100; }
1080
+ .selecter .selecter-selected { background: #F9F9F9 url(img/jquery.fs.selecter-arrow.png) no-repeat right center; border: 1px solid #ccc; border-radius: 3px; color: #333; cursor: pointer; display: block; font-size: 13px; margin: 0; overflow: hidden; padding: 4px 4.6%; position: relative; text-overflow: clip; z-index: 49; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.07);height: auto;line-height: 18px;width: 90%; }
1081
+
1082
+ .selecter .selecter-options { border: 1px solid #ccc; border-width: 0 1px 1px; background-color: #fefefe; border-radius: 0 0 3px 3px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15); display: none; left: 0; margin: 0; max-height: 260px; overflow: auto; overflow-x: hidden; padding: 0; position: relative; top: 100%; width: 99%; *width: auto; z-index: 50; }
1083
+ .selecter .selecter-group { background: #F9F9F9; border-bottom: 1px solid #e3e3e3; color: #999; display: block; font-size: 11px; padding: 5px 10px 4px; text-transform: uppercase; }
1084
+ .selecter .selecter-item { background: #fff; border-bottom: 1px solid #e3e3e3; color: #333; cursor: pointer; display: block; font-size: 13px; margin: 0; overflow: hidden; padding: 8px 10px; text-overflow: ellipsis; width: 86%;height: auto;line-height: 14px;padding: 8px 24px 8px 10px;}
1085
+ .selecter .selecter-item.selected { background: #F9F9F9; }
1086
+ .selecter .selecter-item.disabled { color: #999; cursor: default; }
1087
+ .selecter .selecter-item:first-child { border-radius: 0; }
1088
+ .selecter .selecter-item:last-child { border-radius: 0 0 2px 2px; border-bottom: 0; }
1089
+
1090
+ /* CUSTOM FOR CUSTOMIZR */
1091
+ .rtl .selecter .selecter-selected {
1092
+ background: #F9F9F9 url(img/jquery.fs.selecter-arrow.png) no-repeat 4% center;
1093
+ }
1094
+
1095
+ @media screen and (min-width: 980px) {
1096
+ .selecter .selecter-item:hover,
1097
+ .selecter .selecter-item.selected:hover { background-color: #f3f3f3; }
1098
+ .selecter .selecter-item.disabled:hover { background-color: #fff; }
1099
+
1100
+ .selecter:hover .selecter-selected { background-color: #fff; }
1101
+
1102
+ .selecter.disabled .selecter-item:hover { background: #fff; }
1103
+ }
1104
+
1105
+ /* Open */
1106
+ .selecter.open { z-index: 101; }
1107
+ .selecter.open .selecter-selected { border-radius: 3px 3px 0 0; z-index: 51; }
1108
+
1109
+ .selecter.open .selecter-selected,
1110
+ .selecter.focus .selecter-selected { background-color: #fff; box-shadow: 0 0 5px rgba(0, 0, 0, 0.1); }
1111
+
1112
+ /* 'Cover' Positioning */
1113
+ .selecter.cover .selecter-options { border-radius: 3px; border-width: 1px; top: 0; }
1114
+ .selecter.cover .selecter-options .selecter-item.first { border-radius: 3px 3px 0 0; }
1115
+ .selecter.cover.open .selecter-selected { border-radius: 3px 3px 0 0; z-index: 49; }
1116
+
1117
+ /* 'Bottom' Positioning */
1118
+ .selecter.bottom .selecter-options { border-width: 1px 1px 0; bottom: 100%; top: auto; }
1119
+ .selecter.bottom .selecter-item:last-child { border: none; }
1120
+ .selecter.bottom.open .selecter-selected { border-radius: 0 0 3px 3px; }
1121
+ .selecter.bottom.open .selecter-options { border-radius: 3px 3px 0 0; }
1122
+
1123
+ /* 'Bottom' + 'Cover' Positioning */
1124
+ .selecter.bottom.cover .selecter-options { bottom: 0; top: auto; }
1125
+ .selecter.bottom.cover.open .selecter-selected { border-radius: 3px; }
1126
+ .selecter.bottom.cover.open .selecter-options { border-radius: 3px; }
1127
+
1128
+ /* Multiple Select */
1129
+ .selecter.multiple .selecter-options { border-radius: 3px; border-width: 1px; box-shadow: none; display: block; position: static; width: 100%; }
1130
+
1131
+ /* 'Disabled' State */
1132
+ .selecter.disabled .selecter-selected { background: #fff; border-color: #eee; color: #ccc; cursor: default; }
1133
+ .selecter.disabled .selecter-options { background: #fff; border-color: #eee; }
1134
+ .selecter.disabled .selecter-group,
1135
+ .selecter.disabled .selecter-item { border-color: #eee; color: #ccc; cursor: default; }
1136
+ .selecter.disabled .selecter-item.selected { background: #fafafa; }
1137
+
1138
+ /* Scroller Support */
1139
+ .selecter .selecter-options.scroller { overflow: hidden; }
1140
+ .selecter .selecter-options.scroller .scroller-content { max-height: 260px; padding: 0; }
1141
+
1142
+ /* Media Queries */
1143
+ @media screen and (max-width: 740px) {
1144
+ .selecter { max-width: 100%; }
1145
+ }
1146
+ @media screen and (max-width: 500px) {
1147
+ .selecter { max-width: 100%; }
1148
+ }
1149
+
1150
+
1151
+
1152
+
1153
+
1154
+
1155
+
1156
+
1157
+
1158
+
1159
+
1160
+ /*
1161
+ * Stepper v3.0.7 - 2014-05-07
1162
+ * A jQuery plugin for cross browser number inputs. Part of the Formstone Library.
1163
+ * http://formstone.it/stepper/
1164
+ *
1165
+ * Copyright 2014 Ben Plum; MIT Licensed
1166
+ */
1167
+ .stepper { border-radius: 3px; margin: 0 0 10px 0; overflow: hidden; position: relative; width: 35%;float: left; clear: both;}
1168
+ .stepper .stepper-input { background: #F9F9F9; border: 1px solid #ccc; border-radius: 3px; color: #333; font-size: 13px; line-height: 1.2; margin: 0; overflow: hidden; padding: 5px 10px 5px!important; width: 100%!important; z-index: 49; -moz-appearance: textfield;max-width: none!important;
1169
+ }
1170
+
1171
+ .stepper .stepper-input::-webkit-inner-spin-button,
1172
+ .stepper .stepper-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
1173
+
1174
+ .stepper .stepper-input:focus { background-color: #fff; }
1175
+ .stepper .stepper-arrow { background: #eee url(img/jquery.fs.stepper-arrows.png) no-repeat; border: 1px solid #ccc; cursor: pointer; display: block; height: 46%; position: absolute; right: 0; text-indent: -99999px; width: 20px; z-index: 50; }
1176
+ .stepper .stepper-arrow.up { background-position: center top; border-bottom: none; top: 0; }
1177
+ .stepper .stepper-arrow.down { background-position: center bottom; bottom: 0; }
1178
+
1179
+ /* CUSTOM FOR CUSTOMIZR */
1180
+ .rtl .stepper .stepper-input {
1181
+ text-align: left;
1182
+ }
1183
+
1184
+ @media screen and (min-width: 740px) {
1185
+ .stepper:hover .stepper-input { background-color: #fff; }
1186
+
1187
+ .stepper .stepper-step:hover { background-color: #F9F9F9; }
1188
+
1189
+ .stepper.disabled .stepper-arrow { background: #fff; border-color: #eee; cursor: default; }
1190
+ }
1191
+
1192
+ .stepper.disabled .stepper-input { background: #fff; border-color: #eee; color: #ccc; }
1193
+ .stepper.disabled .stepper-arrow { background: #fff; border-color: #eee; cursor: default; }
1194
+
1195
+
1196
+
1197
+
1198
+
1199
+
1200
+
1201
+
1202
+
1203
+
1204
+
1205
+
1206
+ /* iCheck plugin Flat skin, green
1207
+ ----------------------------------- */
1208
+ .icheckbox_flat-green,
1209
+ .iradio_flat-green {
1210
+ display: inline-block;
1211
+ *display: inline;
1212
+ vertical-align: middle;
1213
+ margin: 0;
1214
+ padding: 0;
1215
+ width: 20px;
1216
+ height: 20px;
1217
+ background: url(img/green.png) no-repeat;
1218
+ border: none;
1219
+ cursor: pointer;
1220
+ top: 4px;
1221
+ float: right;
1222
+ }
1223
+ /* RTL fix of check box position */
1224
+ .rtl .icheckbox_flat-green {
1225
+ float: left;
1226
+ }
1227
+ .icheckbox_flat-green {
1228
+ background-position: 0 0;
1229
+ }
1230
+ .icheckbox_flat-green.checked {
1231
+ background-position: -22px 0;
1232
+ }
1233
+ .icheckbox_flat-green.disabled {
1234
+ background-position: -44px 0;
1235
+ cursor: default;
1236
+ }
1237
+ .icheckbox_flat-green.checked.disabled {
1238
+ background-position: -66px 0;
1239
+ }
1240
+
1241
+ .iradio_flat-green {
1242
+ background-position: -88px 0;
1243
+ }
1244
+ .iradio_flat-green.checked {
1245
+ background-position: -110px 0;
1246
+ }
1247
+ .iradio_flat-green.disabled {
1248
+ background-position: -132px 0;
1249
+ cursor: default;
1250
+ }
1251
+ .iradio_flat-green.checked.disabled {
1252
+ background-position: -154px 0;
1253
+ }
1254
+
1255
+ /* Retina support */
1256
+ @media only screen and (-webkit-min-device-pixel-ratio: 1.5),
1257
+ only screen and (-moz-min-device-pixel-ratio: 1.5),
1258
+ only screen and (-o-min-device-pixel-ratio: 3/2),
1259
+ only screen and (min-device-pixel-ratio: 1.5) {
1260
+ .icheckbox_flat-green,
1261
+ .iradio_flat-green {
1262
+ background-image: url(img/green@2x.png);
1263
+ -webkit-background-size: 176px 22px;
1264
+ background-size: 176px 22px;
1265
+ }
1266
+ }
1267
+
1268
+ /* iCheck plugin Flat skin, grey
1269
+ ----------------------------------- */
1270
+ .icheckbox_flat-grey,
1271
+ .iradio_flat-grey {
1272
+ display: inline-block;
1273
+ *display: inline;
1274
+ vertical-align: middle;
1275
+ margin: 0;
1276
+ padding: 0;
1277
+ width: 20px;
1278
+ height: 20px;
1279
+ background: url(img/grey.png) no-repeat;
1280
+ border: none;
1281
+ cursor: pointer;
1282
+ top: 4px;
1283
+ float: right;
1284
+ }
1285
+
1286
+ .icheckbox_flat-grey {
1287
+ background-position: 0 0;
1288
+ }
1289
+ .icheckbox_flat-grey.checked {
1290
+ background-position: -22px 0;
1291
+ }
1292
+ .icheckbox_flat-grey.disabled {
1293
+ background-position: -44px 0;
1294
+ cursor: default;
1295
+ }
1296
+ .icheckbox_flat-grey.checked.disabled {
1297
+ background-position: -66px 0;
1298
+ }
1299
+
1300
+ .iradio_flat-grey {
1301
+ background-position: -88px 0;
1302
+ }
1303
+ .iradio_flat-grey.checked {
1304
+ background-position: -110px 0;
1305
+ }
1306
+ .iradio_flat-grey.disabled {
1307
+ background-position: -132px 0;
1308
+ cursor: default;
1309
+ }
1310
+ .iradio_flat-grey.checked.disabled {
1311
+ background-position: -154px 0;
1312
+ }
1313
+
1314
+ /* Retina support */
1315
+ @media only screen and (-webkit-min-device-pixel-ratio: 1.5),
1316
+ only screen and (-moz-min-device-pixel-ratio: 1.5),
1317
+ only screen and (-o-min-device-pixel-ratio: 3/2),
1318
+ only screen and (min-device-pixel-ratio: 1.5) {
1319
+ .icheckbox_flat-grey,
1320
+ .iradio_flat-grey {
1321
+ background-image: url(img/grey@2x.png);
1322
+ -webkit-background-size: 176px 22px;
1323
+ background-size: 176px 22px;
1324
+ }
1325
+ }
1326
+
1327
+ .czr-sub-set .icheckbox_flat-green, .iradio_flat-green {
1328
+ float: left;
1329
+ }
1330
+
1331
+
1332
+
1333
+
1334
+
1335
+
1336
+
1337
+
1338
+
1339
+
1340
+
1341
+
1342
+
1343
+
1344
+
1345
+
1346
+ /* SELECT 2 SPECIFICS */
1347
+ body .select2-container {
1348
+ z-index: 1000000;
1349
+ width: 100%!important;
1350
+ }
1351
+
1352
+ .customize-control-czr_layouts .select2-selection--single {
1353
+ height: 33px;
1354
+ }
1355
+ .customize-control-czr_layouts .select2-container--default .select2-selection--single .select2-selection__arrow {
1356
+ height: 30px;
1357
+ }
1358
+ .select2-selection__rendered:focus, .customize-control-czr_layouts .select2-selection--single:focus {
1359
+ outline: none;
1360
+ }
1361
+
1362
+
1363
+
1364
+
1365
+
1366
+ /* SPECIFIC INPUT STYLE */
1367
+ span.select2-results, body .select2-container {
1368
+ font-size: 14px;
1369
+ }
1370
+
1371
+
1372
+ /* for multipe picker */
1373
+ .select2-container--default .select2-selection--multiple {
1374
+ -webkit-border-radius: 0px;
1375
+ -moz-border-radius: 0px;
1376
+ border-radius: 0;
1377
+ width: 99%;
1378
+ min-height: 36px;
1379
+ border: 1px solid #ddd;
1380
+ -webkit-box-shadow: inset 0 1px 2px rgba( 0, 0, 0, 0.07 );
1381
+ box-shadow: inset 0 1px 2px rgba( 0, 0, 0, 0.07 );
1382
+ }
1383
+ .select2-container--default.select2-container--focus .select2-selection--multiple {
1384
+ border-color: #00a0d2!important;
1385
+ -webkit-box-shadow: 0 0 2px rgba(26, 188, 156, 0.8)!important;
1386
+ box-shadow: 0 0 2px rgba(26, 188, 156, 0.8)!important;
1387
+ }
1388
+ .select2-results__options li {
1389
+ margin-bottom: 0
1390
+ }
1391
+ .select2-container--default .select2-selection--multiple .select2-selection__choice {
1392
+ padding: 2px;
1393
+ font-size: 13px;
1394
+ -webkit-border-radius: 2px;
1395
+ -moz-border-radius: 2px;
1396
+ border-radius: 2px;
1397
+ margin-bottom: 0;
1398
+ }
1399
+ .select2-container--default .select2-results__option--highlighted[aria-selected] {
1400
+ background-color: #00a0d2;
1401
+ }
1402
+ .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
1403
+ font-size: 17px;
1404
+ position: relative;
1405
+ top: 2px;
1406
+ color: #23282d;
1407
+ }
1408
+
1409
+ /* Socials Specifics */
1410
+ .customize-control-czr_socials .select2-container--default .select2-selection--single .select2-selection__rendered {
1411
+ padding: 5px;
1412
+ line-height: 16px;
1413
+ }
1414
+
1415
+
1416
+
1417
+
1418
+
1419
+
1420
+
1421
+
1422
+
1423
+
1424
+
1425
+
1426
+ /* WP TEXT EDITOR */
1427
+ #czr-customize-content_editor-pane {
1428
+ border-top: solid 1px #ddd;
1429
+ position: absolute;
1430
+ height: 300px;
1431
+ bottom: -301px;
1432
+ right: 0;
1433
+ left: 0;
1434
+ z-index: 20;
1435
+ background: #f1f1f1;
1436
+ display: block;
1437
+ -webkit-transition: all 0.2s;
1438
+ transition: all 0.2s;
1439
+ visibility: hidden;
1440
+ }
1441
+ body.czr-customize-content_editor-pane-resize #customize-preview,
1442
+ body.czr-customize-content_editor-pane-resize #czr-customize-content_editor-pane {
1443
+ -webkit-transition: none;
1444
+ transition: none;
1445
+ }
1446
+ body.mce-fullscreen.czr-customize-content_editor-pane-open #czr-customize-content_editor-pane {
1447
+ top: 0;
1448
+ }
1449
+ body.czr-customize-content_editor-pane-open #czr-customize-content_editor-pane {
1450
+ bottom: 0;
1451
+ visibility: inherit;
1452
+ }
1453
+ #czr-customize-content_editor-pane .wp-editor-tools {
1454
+ padding-top: 5px;
1455
+ padding-right: 10px;
1456
+ }
1457
+ #czr-customize-content_editor-pane .wp-media-buttons {
1458
+ padding-left: 5px;
1459
+ }
1460
+ #customize-preview {
1461
+ height: auto;
1462
+ }
1463
+ body.czr-customize-content_editor-pane-open #customize-preview {
1464
+ bottom: 300px;
1465
+ }
1466
+ body.mce-fullscreen #customize-preview {
1467
+ bottom: 0;
1468
+ }
1469
+ body.mce-fullscreen.czr-customize-content_editor-pane-open div.mce-fullscreen {
1470
+ position: relative;
1471
+ left: 0;
1472
+ }
1473
+ #wp-czr-customize-content_editor-container {
1474
+ border-left: 0;
1475
+ }
1476
+ /* vertical resize bar */
1477
+ #czr-customize-content_editor-dragbar {
1478
+ top: 0;
1479
+ cursor: row-resize;
1480
+ display: block;
1481
+ height: 4px;
1482
+ position: absolute;
1483
+ width: 100%;
1484
+ z-index: 21;
1485
+ }
1486
+ body.czr-customize-content_editor-pane-resize #customize-preview:before {
1487
+ top: 0;
1488
+ right: 0;
1489
+ bottom: 0;
1490
+ left: 0;
1491
+ position: absolute;
1492
+ height: 100%;
1493
+ width: 100%;
1494
+ z-index: 999999;
1495
+ }
1496
+ /* @todo Mobile support for rich text editor */
1497
+ .wp-customizer .ui-autocomplete.wplink-autocomplete {
1498
+ z-index: 500110; /* originally 100110, but z-index of .wp-full-overlay is 500000 */
1499
+ }
1500
+ .wp-customizer #wp-link-wrap {
1501
+ z-index: 500105; /* originally 100105, but z-index of .wp-full-overlay is 500000 */
1502
+ }
1503
+ .wp-customizer #wp_editbtns,
1504
+ .wp-customizer #wp_gallerybtns {
1505
+ z-index: 500020; /* originally 100020, but z-index of .wp-full-overlay is 500000 */
1506
+ }
1507
+ .wp-customizer #TB_overlay,
1508
+ .wp-customizer #TB_window {
1509
+ z-index: 500050;
1510
+ }
1511
+ .wp-customizer .mce-panel,
1512
+ .wp-customizer .mce-tooltip {
1513
+ z-index: 500100 !important; /* originally 100100, but z-index of .wp-full-overlay is 500000 */
1514
+ }
1515
+ .czr-customize-content_editor-pane-open .wp-full-overlay.collapsed .wp-full-overlay-sidebar {
1516
+ z-index: 30;
1517
+ }
1518
+ .czr-customize-content_editor-pane-open .wp-full-overlay.collapsed .collapse-sidebar {
1519
+ bottom: 308px;
1520
+ }
1521
+ .czr-customize-content_editor-pane-open .wp-full-overlay.expanded .collapse-sidebar {
1522
+ bottom: 0 !important;
1523
+ }
1524
+ .czr-customize-content_editor-pane-resize .wp-full-overlay.collapsed .collapse-sidebar {
1525
+ -webkit-transition: none;
1526
+ transition: none;
1527
+ }
1528
+ .czr-customize-content_editor-pane-open.mce-fullscreen .wp-full-overlay.collapsed .collapse-sidebar {
1529
+ bottom: 8px !important;
1530
+ }/* OVERRIDE WP CUSTOMIZER */
1531
+
1532
+ /* SEKTIONS AND COLUMNS */
1533
+ .czr-sektion-buttons {
1534
+ position: absolute;
1535
+ right: 0;
1536
+ }
1537
+ .czr-column {
1538
+ width: 99%;
1539
+ margin-bottom: 1%;
1540
+ float: left;
1541
+ padding: 2% 0%;
1542
+ border: 2px dotted #aaa;
1543
+ text-align: center;
1544
+ }
1545
+ .czr-column-header {
1546
+ position: relative;
1547
+ }
1548
+ .czr-col-drag-handler {
1549
+ position: absolute;
1550
+ left: 0%;
1551
+ padding: 1%;
1552
+ color: #999;
1553
+ cursor: move;
1554
+ cursor: grab;
1555
+ cursor: -moz-grab;
1556
+ cursor: -webkit-grab;
1557
+ }
1558
+
1559
+
1560
+
1561
+
1562
+ /* MODULES */
1563
+ .czr-module-collection-wrapper {
1564
+ width: 100%;
1565
+ min-height: 5px;
1566
+ float: left;
1567
+ }
1568
+ .czr-single-module {
1569
+ width: 98%;
1570
+ float: left;
1571
+ min-height: 20px;
1572
+ margin: 1px 1%;
1573
+ border: 1px solid #ccc;
1574
+ }
1575
+
1576
+ .czr-single-module textarea {
1577
+ max-width: 100%;
1578
+ }
1579
+
1580
+ /*.czr-single-module .czr-single-item .czr-item-content {
1581
+ display: block;
1582
+ }*/
1583
+
1584
+ #customize-theme-controls .czr-single-module .czr-single-item {
1585
+ width: 96%;
1586
+ }
1587
+
1588
+ .czr-mod-header {
1589
+ background: #eee;
1590
+ float: left;
1591
+ width: 100%;
1592
+ }
1593
+ .czr-mod-title {
1594
+ position: relative;
1595
+ }
1596
+ .czr-mod-title > h4 {
1597
+ float: left;
1598
+ width: 70%;
1599
+ margin: 2% 0;
1600
+ }
1601
+ .czr-mod-drag-handler {
1602
+ position: absolute;
1603
+ left: 0%;
1604
+ padding: 1%;
1605
+ margin: 2% 0;
1606
+ color: #999;
1607
+ cursor: move;
1608
+ cursor: grab;
1609
+ cursor: -moz-grab;
1610
+ cursor: -webkit-grab;
1611
+ }
1612
+ .czr-mod-buttons {
1613
+ float: right;
1614
+ width: 30%;
1615
+ margin: 2% 0;
1616
+ }
1617
+
1618
+ .czr-mod-content {
1619
+ position: absolute;
1620
+ top: 0;
1621
+ left: 100%;
1622
+ float: left;
1623
+ width: 100%;
1624
+ background: #d5e9cc;
1625
+ display: none;
1626
+ }
1627
+
1628
+
1629
+
1630
+
1631
+
1632
+
1633
+
1634
+
1635
+
1636
+ /* EDIT MODULE */
1637
+ .czr-module-open #customize-info,
1638
+ .czr-module-open #customize-theme-controls {
1639
+ left: -200%;
1640
+ }
1641
+ .czr-module-open #customize-theme-controls .accordion-section-content {
1642
+ overflow: visible;
1643
+ }
1644
+ .czr-module-description-container {
1645
+ margin-bottom: 15px
1646
+ }
1647
+ .czr-module-title {
1648
+ /*margin: -12px -12px 0 -12px;*/
1649
+ border-bottom: 1px solid #ddd;
1650
+ background: #fff;
1651
+ }
1652
+ .czr-module-title h3 {
1653
+ padding: 10px 10px 12px 14px;
1654
+ margin: 0;
1655
+ line-height: 21px;
1656
+ color: #555;
1657
+ font-size: 20px;
1658
+ font-weight: 200;
1659
+ line-height: 26px;
1660
+ display: block;
1661
+ overflow: hidden;
1662
+ white-space: nowrap;
1663
+ text-overflow: ellipsis;
1664
+ }
1665
+
1666
+ #customize-controls .czr-module-title span.customize-action {
1667
+ overflow: hidden;
1668
+ white-space: nowrap;
1669
+ text-overflow: ellipsis;
1670
+ font-size: 13px;
1671
+ display: block;
1672
+ font-weight: 400;
1673
+ }
1674
+
1675
+ .czr-module-back {
1676
+ display: block;
1677
+ float: left;
1678
+ width: 48px;
1679
+ height: 74px;
1680
+ padding: 0 24px 0 0;
1681
+ margin: 0;
1682
+ background: #fff;
1683
+ border: none;
1684
+ border-right: 1px solid #ddd;
1685
+ -webkit-box-shadow: none;
1686
+ box-shadow: none;
1687
+ cursor: pointer;
1688
+ -webkit-transition: left .18s ease-in-out, color .1s ease-in-out, background .1s ease-in-out;
1689
+ transition: left .18s ease-in-out, color .1s ease-in-out, background .1s ease-in-out;
1690
+ }
1691
+
1692
+ .czr-module-back:hover,
1693
+ .czr-module-back:focus {
1694
+ color: #23282d;
1695
+ background: #f5f5f5;
1696
+ outline: none;
1697
+ -webkit-box-shadow: none;
1698
+ box-shadow: none;
1699
+ }
1700
+
1701
+ .czr-module-back:before {
1702
+ font: normal 20px/72px dashicons;
1703
+ content: "\f341";
1704
+ position: relative;
1705
+ left: 13px;
1706
+ }
1707
+
1708
+
1709
+ .czr-module-back:hover {
1710
+ color: #23282d;
1711
+ background: #f5f5f5;
1712
+ outline: none;
1713
+ -webkit-box-shadow: none;
1714
+ box-shadow: none;
1715
+ }
1716
+
1717
+
1718
+
1719
+
1720
+
1721
+
1722
+
1723
+ /* DRAGULA */
1724
+ .gu-mirror {
1725
+ position: fixed !important;
1726
+ margin: 0 !important;
1727
+ z-index: 999999 !important;
1728
+ opacity: 0.8;
1729
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";
1730
+ filter: alpha(opacity=80);
1731
+ }
1732
+
1733
+ .gu-hide {
1734
+ display: none !important;
1735
+ }
1736
+ .gu-unselectable {
1737
+ -webkit-user-select: none !important;
1738
+ -moz-user-select: none !important;
1739
+ -ms-user-select: none !important;
1740
+ user-select: none !important;
1741
+ }
1742
+ .gu-transit {
1743
+ opacity: 0.2;
1744
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=20)";
1745
+ filter: alpha(opacity=20);
1746
+ }
1747
+
1748
+ /* CUSTOM FOR DRAGULA */
1749
+ .gu-unselectable .czr-module-collection-wrapper {
1750
+ width: 98%;
1751
+ border: 1px dotted green;
1752
+ background: #d1ffe0;
1753
+ min-height: 31px;
1754
+ }
1755
+ li.czr-single-module.gu-mirror, li.czr-module-candidate.gu-mirror {
1756
+ list-style: none;
1757
+ }
1758
+ /*.czr-dragula-fake-container {
1759
+ display: none;
1760
+ float: left;
1761
+ height: 60px;
1762
+ width: 96%;
1763
+ margin: 2%;
1764
+ border: 2px dotted #aaa;
1765
+ text-align: center;
1766
+ line-height: 30px;
1767
+ }
1768
+ .czr-show-fake-container .czr-dragula-fake-container {
1769
+ display: block;
1770
+ }*/
1771
+
1772
+
1773
+
1774
+
1775
+
1776
+
1777
+
1778
+
1779
+
1780
+
1781
+
1782
+
1783
+
1784
+
1785
+ /* MODULES LIST PANEL */
1786
+ #czr-module-list-panel {
1787
+ position: absolute;
1788
+ top: 0;
1789
+ bottom: 0;
1790
+ left: -301px;
1791
+ /*visibility: hidden;*/
1792
+ opacity: 0;
1793
+ overflow-x: hidden;
1794
+ overflow-y: auto;
1795
+ margin: 0;
1796
+ z-index: 4;
1797
+ background: rgba(0, 0, 0, 0.47);
1798
+ -webkit-transition: all .18s;
1799
+ transition: all .18s;
1800
+ border-right: 1px solid #ddd;
1801
+ }
1802
+ #czr-module-list-panel, #czr-available-modules-filter {
1803
+ width: 45%;
1804
+ min-width: 300px;
1805
+ }
1806
+ body.czr-adding-module #czr-module-list-panel {
1807
+ left: 0;
1808
+ visibility: visible;
1809
+ opacity: 1;
1810
+ }
1811
+
1812
+ /*body.czr-adding-module .wp-full-overlay-main {
1813
+ left: 300px;
1814
+ }*/
1815
+
1816
+ body.czr-adding-module #customize-preview {
1817
+ opacity: 0.7;
1818
+ }
1819
+
1820
+
1821
+ .add-new-module:before {
1822
+ content: "\f132";
1823
+ display: inline-block;
1824
+ position: relative;
1825
+ left: -2px;
1826
+ top: -1px;
1827
+ font: normal 20px/1 dashicons;
1828
+ vertical-align: middle;
1829
+ -webkit-transition: all 0.2s;
1830
+ transition: all 0.2s;
1831
+ -webkit-font-smoothing: antialiased;
1832
+ -moz-osx-font-smoothing: grayscale;
1833
+ }
1834
+
1835
+ .czr-column .add-new-module {
1836
+ margin: 1%;
1837
+ float: right;
1838
+ }
1839
+
1840
+ body.czr-adding-module .add-new-module,
1841
+ body.czr-adding-module .add-new-module:hover {
1842
+ background: #eee;
1843
+ border-color: #929793;
1844
+ color: #32373c;
1845
+ -webkit-box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, 0.5);
1846
+ box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, 0.5);
1847
+ }
1848
+
1849
+ body.czr-adding-module .add-new-module:before {
1850
+ -webkit-transform: rotate(45deg);
1851
+ -ms-transform: rotate(45deg);
1852
+ transform: rotate(45deg);
1853
+ }
1854
+
1855
+
1856
+ #czr-available-modules-list {
1857
+ top: 60px;
1858
+ position: absolute;
1859
+ overflow: auto;
1860
+ bottom: 0;
1861
+ width: 100%;
1862
+ }
1863
+
1864
+ #czr-available-modules-filter {
1865
+ position: fixed;
1866
+ top: 0;
1867
+ z-index: 1;
1868
+ background: rgba(0, 0, 0, 0.47);
1869
+ border-bottom: 1px solid #e5e5e5;
1870
+ }
1871
+
1872
+ /* search field container */
1873
+ #czr-available-modules-filter {
1874
+ padding: 12px 15px;
1875
+ -webkit-box-sizing: border-box;
1876
+ -moz-box-sizing: border-box;
1877
+ box-sizing: border-box;
1878
+ }
1879
+
1880
+ #czr-available-modules-filter input {
1881
+ padding: 6px 10px;
1882
+ width: 100%;
1883
+ }
1884
+
1885
+ #czr-available-modules-list .czr-module-candidate {
1886
+ position: relative;
1887
+ /*padding: 1%;*/
1888
+ border-bottom: 1px solid #e5e5e5;
1889
+ }
1890
+
1891
+ #czr-available-modules-list .czr-module-candidate h3 {
1892
+ color: #fff;
1893
+ padding: 0px;
1894
+ margin: 0;
1895
+ }
1896
+ #czr-available-modules-list .czr-mod-drag-handler {
1897
+ position: relative;
1898
+ left: 0%;
1899
+ padding: 1%;
1900
+ margin: 2% 4%;
1901
+ color: inherit;
1902
+ cursor: move;
1903
+ cursor: grab;
1904
+ cursor: -moz-grab;
1905
+ cursor: -webkit-grab;
1906
+ }
1907
+
1908
+
1909
+
1910
+
1911
+
1912
+
1913
+ /* SEKTION SETTINGS PANEL */
1914
+ #czr-sektion-settings-panel {
1915
+ position: absolute;
1916
+ top: 0;
1917
+ bottom: 0;
1918
+ width: 45%;
1919
+ min-width: 300px;
1920
+ left: -301px;
1921
+ /*visibility: hidden;*/
1922
+ opacity: 0;
1923
+ overflow-x: hidden;
1924
+ overflow-y: auto;
1925
+ margin: 0;
1926
+ z-index: 4;
1927
+ background: rgba(0, 0, 0, 0.47);
1928
+ -webkit-transition: all .18s;
1929
+ transition: all .18s;
1930
+ border-right: 1px solid #ddd;
1931
+ color: #fff;
1932
+ }
1933
+ #czr-sektion-settings-panel h3 {
1934
+ color: #fff;
1935
+ }
1936
+ body.czr-editing-sektion #czr-sektion-settings-panel {
1937
+ left: 0;
1938
+ visibility: visible;
1939
+ opacity: 1;
1940
+ }
1941
+
1942
+ /*body.czr-editing-sektion .wp-full-overlay-main {
1943
+ left: 300px;
1944
+ }*/
1945
+
1946
+ body.czr-editing-sektion #customize-preview {
1947
+ opacity: 0.7;
1948
+ }/* WP SAVE BUTTON */
1949
+ .czr-api-dirty input#save {
1950
+ background-color: #FFBD2E;
1951
+ border-color: #d99400;
1952
+ color: black;
1953
+ text-shadow: none;
1954
+ -webkit-box-shadow: none;
1955
+ box-shadow: none;
1956
+ -webkit-transition: background-color .2s ease-in-out;
1957
+ -moz-transition: background-color .2s ease-in-out;
1958
+ -ms-transition: background-color .2s ease-in-out;
1959
+ -o-transition: background-color .2s ease-in-out;
1960
+ transition: background-color .2s ease-in-out;
1961
+ }
1962
+ .czr-api-dirty input#save:hover {
1963
+ background-color: #fcad06;
1964
+ }
1965
+
1966
+
1967
+ /* HEADER AND SCOPE SWITCHER */
1968
+ .czr-skop-on .wp-full-overlay-sidebar .wp-full-overlay-header {
1969
+ height: 185px;
1970
+ }
1971
+ .czr-skop-on .wp-full-overlay-sidebar .wp-full-overlay-sidebar-content {
1972
+ top: 185px;
1973
+ }
1974
+ .wp-customizer .in-sub-panel .wp-full-overlay-sidebar .wp-full-overlay-header {
1975
+ padding: 0 15px;
1976
+ }
1977
+ .customize-controls-close {
1978
+ border-bottom: 1px solid #ddd;
1979
+ }
1980
+
1981
+
1982
+
1983
+ .wp-customizer #customize-header-actions {
1984
+ border-bottom: 0px;
1985
+ }
1986
+ .czr-scope-switcher {
1987
+ width: 100%;
1988
+ float: right;
1989
+ position: absolute;
1990
+ left: 0;
1991
+ bottom: 0;
1992
+ overflow: hidden;
1993
+ }
1994
+ .czr-scope-switcher .czr-skp-permanent-title {
1995
+ position: relative;
1996
+ color: #5f5f5f;
1997
+ }
1998
+ #customize-header-actions .czr-scope-switcher .spinner {
1999
+ float: none;
2000
+ display: none;
2001
+ margin: 0px;
2002
+ left: -26px;
2003
+ top: 0px;
2004
+ position: absolute;
2005
+ visibility: visible;
2006
+ }
2007
+ h2.czr-current-skope-title {
2008
+ font-size: 13px;
2009
+ line-height: 21px;
2010
+ margin: 6px 0 4px;
2011
+ text-align: center;
2012
+ height: 63px;
2013
+ font-weight:normal;
2014
+ overflow: hidden;
2015
+ }
2016
+ .czr-main-title {
2017
+ max-height: 24px;
2018
+ overflow: hidden;
2019
+ display: inline-block;
2020
+ text-overflow: ellipsis;
2021
+ white-space: nowrap;
2022
+ width: 95%;
2023
+ }
2024
+ .czr-skope-title {
2025
+ display: block;
2026
+ font-size: 17px;
2027
+ font-style: italic;
2028
+ line-height: 25px;
2029
+ }
2030
+ .czr-toggle-title-notice {
2031
+ cursor: pointer;
2032
+ font-size: 14px;
2033
+ color: #777;
2034
+ }
2035
+ .czr-skope-inherits-from {
2036
+ display: inline-block;
2037
+ opacity: 0;
2038
+ width: 90%;
2039
+ font-size: 12px;
2040
+ line-height: 18px;
2041
+ color: #357315;
2042
+ top: -6px;
2043
+ position: relative;
2044
+ }
2045
+ .notice-visible .czr-toggle-title-notice {
2046
+ color: #357315;
2047
+ }
2048
+ .notice-visible .czr-skope-inherits-from {
2049
+ opacity: 1;
2050
+ -webkit-transition: opacity .3s ease-in-out;
2051
+ -moz-transition: opacity .3s ease-in-out;
2052
+ -ms-transition: opacity .3s ease-in-out;
2053
+ -o-transition: opacity .3s ease-in-out;
2054
+ transition: opacity .3s ease-in-out;
2055
+ }
2056
+ .czr-scope-switcher .button {
2057
+ float: left;
2058
+ width: 40%;
2059
+ text-align: center;
2060
+ margin: 0 2%;
2061
+ opacity: 0.7;
2062
+ -webkit-transition: opacity .3s ease-in-out;
2063
+ -moz-transition: opacity .3s ease-in-out;
2064
+ -ms-transition: opacity .3s ease-in-out;
2065
+ -o-transition: opacity .3s ease-in-out;
2066
+ transition: opacity .3s ease-in-out;
2067
+ }
2068
+ .czr-scope-switcher .button.active {
2069
+ font-weight: bold;
2070
+ opacity: 1;
2071
+ }
2072
+ .czr-scope-switcher .active, .czr-scope-switcher .czr-scope:hover {
2073
+ opacity: 1;
2074
+ /*border-bottom: 2px solid #52ff3f;*/
2075
+ }
2076
+ .czr-skopes-wrapper {
2077
+ overflow: hidden;
2078
+ position: relative;
2079
+ }
2080
+ .czr-scope.active:before {
2081
+ height: 101%;
2082
+ float: left;
2083
+ position: absolute;
2084
+ z-index: 1;
2085
+ content: '';
2086
+ -webkit-box-shadow : -4px 0px 15px 0px rgba(119, 119, 119, 0.58);
2087
+ box-shadow: -4px 0px 15px 0px rgba(119, 119, 119, 0.58);
2088
+ top: 0;
2089
+ }
2090
+ .czr-scope-switcher .active:after {
2091
+ content: '';
2092
+ height: 100%;
2093
+ position: absolute;
2094
+ -webkit-box-shadow : 4px 0px 15px 0px rgba(119, 119, 119, 0.58);
2095
+ box-shadow: 4px 0px 15px 0px rgba(119, 119, 119, 0.58);
2096
+ top: 0;
2097
+ z-index: 3;
2098
+ }
2099
+
2100
+ .czr-skopes-wrapper .active-collection.local:after {
2101
+ right:0;
2102
+ }
2103
+ .czr-scope-switcher .czr-scope:last-child:after {
2104
+ -webkit-box-shadow :none;
2105
+ box-shadow: none;
2106
+ right: 0;
2107
+ }
2108
+ .czr-scope-switcher .czr-scope:first-child:after {
2109
+ left: 0;
2110
+ }
2111
+ .czr-scope {
2112
+ float: left;
2113
+ width: 30.5%;
2114
+ /*margin-left: 1.5%;*/
2115
+ background: #fff;
2116
+ /*border-bottom: 2px solid #cccccc;*/
2117
+ border-top: 1px solid #cccccc;
2118
+ /*-webkit-border-radius: 3px;
2119
+ border-radius: 3px;*/
2120
+ overflow: hidden;
2121
+ opacity: 0.65;
2122
+ -webkit-transition: opacity .3s ease-in-out;
2123
+ -moz-transition: opacity .3s ease-in-out;
2124
+ -ms-transition: opacity .3s ease-in-out;
2125
+ -o-transition: opacity .3s ease-in-out;
2126
+ transition: opacity .3s ease-in-out;
2127
+ }
2128
+
2129
+ /* LAYOUTS */
2130
+ .czr-scope-switcher .width-100, .czr-scope.width-100.active:before, .czr-scope.width-100.active:after { width: 100%; }
2131
+ .czr-scope-switcher .width-50, .czr-scope.width-50.active:before, .czr-scope.width-50.active:after { width: 50%; }
2132
+ .czr-scope-switcher .width-33, .czr-scope.width-33.active:before, .czr-scope.width-33.active:after { width: 33.33%; }
2133
+ .czr-scope-switcher .width-25, .czr-scope.width-25.active:before, .czr-scope.width-25.active:after { width: 25%; }
2134
+
2135
+ .czr-scope-header, .czr-scope-footer {
2136
+ width: 100%;
2137
+ min-height: 16px;
2138
+ position: relative;
2139
+ z-index: 5;
2140
+ }
2141
+ .inactive .czr-scope-footer:after {
2142
+ content: '';
2143
+ width: 100%;
2144
+ position: absolute;
2145
+ height: 5px;
2146
+ bottom: -7px;
2147
+ left: 0;
2148
+ -webkit-box-shadow : 0px 0px 13px 4px rgba(119, 119, 119, 0.85);
2149
+ box-shadow: 0px 0px 13px 4px rgba(119, 119, 119, 0.85);
2150
+ }
2151
+ .czr-scope-content {
2152
+ height: 35px;
2153
+ padding: 0 3%;
2154
+ width: 94%;
2155
+ line-height: 35px;
2156
+ text-align: center;
2157
+ clear: both;
2158
+ color: #000;
2159
+ overflow: hidden;
2160
+ }
2161
+ .czr-scope-content h4 {
2162
+ margin: 0;
2163
+ display: inline-block;
2164
+ text-align: center;
2165
+ font-size: 14px;
2166
+ line-height: 18px;
2167
+ font-weight: normal;
2168
+ text-shadow: 1px 1px 0px #dedede;
2169
+ }
2170
+ .czr-scope .fa {
2171
+ font-size: 10px;
2172
+ padding: 2%;
2173
+ color: #585858;
2174
+ cursor: pointer;
2175
+ -webkit-transition: opacity .3s ease-in-out;
2176
+ -moz-transition: opacity .3s ease-in-out;
2177
+ -ms-transition: opacity .3s ease-in-out;
2178
+ -o-transition: opacity .3s ease-in-out;
2179
+ transition: opacity .3s ease-in-out;
2180
+ }
2181
+ .czr-scope .czr-scope-footer .info {
2182
+ cursor: inherit;
2183
+ }
2184
+ .czr-scope-header .czr-scope-switch {
2185
+ font-size: 22px;
2186
+ padding: 0 2px 0 0;
2187
+ text-shadow: 1px 1px 2px white;
2188
+ }
2189
+ .czr-skp-switch-link {
2190
+ cursor: pointer;
2191
+ }
2192
+ .czr-skp-switch-link:hover {
2193
+ text-decoration: underline;
2194
+ }
2195
+ .czr-pull-left {
2196
+ float: left;
2197
+ }
2198
+ .czr-pull-right {
2199
+ float: right;
2200
+ }
2201
+
2202
+
2203
+ /* DIALOG BOX REACTIONS */
2204
+ .active .czr-scope-switch {
2205
+ color: #52ff3f;
2206
+ cursor:inherit;
2207
+ }
2208
+
2209
+ .czr-scope .czr-scope-reset {
2210
+ /*opacity: 0;*/
2211
+ display: none;
2212
+ font-size: 13px;
2213
+ text-shadow: 1px 1px 0px #dedede;
2214
+
2215
+ }
2216
+ .has-db-val .czr-scope-reset {
2217
+ color: #00a0d2;
2218
+ }
2219
+ .dirty .czr-scope-reset {
2220
+ color: #FFBD2E!important;
2221
+ }
2222
+
2223
+ .is_winner .czr-scope-winner {
2224
+ color: #52ff3f;
2225
+ font-size: 14px;
2226
+ position: absolute;
2227
+ bottom: 2px;
2228
+ left: 2px;
2229
+ }
2230
+
2231
+ .czr-scope-force {
2232
+ display: none;
2233
+ }
2234
+
2235
+ /* Underline skope switch text in control notices and in the main skope switcher title */
2236
+ .czr-skope-notice .czr-skope-switch, .czr-scope-switcher .czr-skope-switch {
2237
+ cursor: pointer;
2238
+ text-decoration: underline;
2239
+ }
2240
+
2241
+ /**************************************
2242
+ ******* RESET */
2243
+ /* RESET COMMONS */
2244
+ .czr-spinner-wrapper {
2245
+ visibility: hidden;
2246
+ }
2247
+ .czr-reset-success, .czr-reset-fail {
2248
+ display: none;
2249
+ }
2250
+ .czr-spinner {
2251
+ background: url(img/czr-spinner.gif) no-repeat;
2252
+ -webkit-background-size: 32px 32px;
2253
+ background-size: 32px 32px;
2254
+ display: inline-block;
2255
+ float: right;
2256
+ vertical-align: middle;
2257
+ opacity: 0.7;
2258
+ filter: alpha(opacity=70);
2259
+ width: 32px;
2260
+ height: 32px;
2261
+ margin: 4px 10px 0;
2262
+ }
2263
+
2264
+
2265
+ /* SINGLE CONTROL RESET */
2266
+ .customize-control span.customize-control-title:first-child {
2267
+ padding-left: 16px;
2268
+ -webkit-transition: left, right, 0.15s ease-in-out;
2269
+ -moz-transition: left, right, 0.15s ease-in-out;
2270
+ -ms-transition: left, right, 0.15s ease-in-out;
2271
+ -o-transition: left, right, 0.15s ease-in-out;
2272
+ transition: left, right, 0.15s ease-in-out;
2273
+ position: relative;
2274
+ }
2275
+
2276
+ .wp-customizer .customize-control.czr-not-skoped .customize-control-title {
2277
+ padding-left: 0px;
2278
+ }
2279
+ .czr-setting-reset {
2280
+ color: #eee;
2281
+ -webkit-transition: color 0.4s;
2282
+ transition: color 0.4s;
2283
+ position: absolute;
2284
+ left: 0px;
2285
+ line-height: 21px;
2286
+ display: none;
2287
+ text-shadow: 1px 1px 0px #a0a0a0;
2288
+ }
2289
+ .czr-global-skope-level .is-wp-authorized-setting.has-db-val .czr-setting-reset {
2290
+ color: #eee;
2291
+ }
2292
+ .has-db-val .czr-setting-reset {
2293
+ color: #00a0d2;
2294
+ }
2295
+ .is-dirty .czr-setting-reset {
2296
+ color: #FFBD2E!important;
2297
+ }
2298
+ .czr-ctrl-reset-warning .czr-spinner {
2299
+ display: none;
2300
+ }
2301
+ .czr-resetting-control .czr-ctrl-reset-warning .czr-spinner {
2302
+ display: block;
2303
+ }
2304
+
2305
+ /* RESET ALERTS */
2306
+ .is-dirty .czr-remove-alert-wrapper {
2307
+ background-color: rgba(255, 189, 46, 0.54)!important;
2308
+ border: 1px solid #FFBD2E!important;
2309
+ text-shadow:none;
2310
+ color: #000;
2311
+ }
2312
+
2313
+ .has-db-val .czr-remove-alert-wrapper {
2314
+ background-color: rgba(0, 160, 210, 0.45);
2315
+ border: 1px solid #00a0d2;
2316
+ text-shadow:none;
2317
+ color: #000;
2318
+ }
2319
+
2320
+ .czr-resetting-control .czr-remove-alert-wrapper {
2321
+ -webkit-transition: all, 0.3s ease-in-out;
2322
+ -moz-transition: all, 0.3s ease-in-out;
2323
+ -ms-transition: all, 0.3s ease-in-out;
2324
+ -o-transition: all, 0.3s ease-in-out;
2325
+ transition: all, 0.3s ease-in-out;
2326
+ }
2327
+
2328
+ /* SKOPE LOADING */
2329
+ body.czr-skop-loading #czr-skope-pane {
2330
+ top : 0;
2331
+ }
2332
+ body.czr-skop-loading #customize-preview {
2333
+ opacity: 0!important;
2334
+ }
2335
+
2336
+ /* Pure CSS loader */
2337
+ @-webkit-keyframes czr-mr-loader {
2338
+ 0% {
2339
+ -webkit-transform: scale(0.1);
2340
+ transform: scale(0.1);
2341
+ opacity: 1; }
2342
+
2343
+ 70% {
2344
+ -webkit-transform: scale(1);
2345
+ transform: scale(1);
2346
+ opacity: 0.7; }
2347
+
2348
+ 100% {
2349
+ opacity: 0.0; }
2350
+ }
2351
+
2352
+ @keyframes czr-mr-loader {
2353
+ 0% {
2354
+ -webkit-transform: scale(0.1);
2355
+ transform: scale(0.1);
2356
+ opacity: 1; }
2357
+
2358
+ 70% {
2359
+ -webkit-transform: scale(1);
2360
+ transform: scale(1);
2361
+ opacity: 0.7; }
2362
+
2363
+ 100% {
2364
+ opacity: 0.0; }
2365
+ }
2366
+ /*.czr-css-loader {
2367
+ display: none;
2368
+ }*/
2369
+ .czr-css-loader {
2370
+ width: 50px;
2371
+ height: 50px;
2372
+ position: absolute;
2373
+ -webkit-transform: translate3d(-50%, -50%, 0);
2374
+ -ms-transform: translate3d(-50%, -50%, 0);
2375
+ transform: translate3d(-50%, -50%, 0);
2376
+ top: 50%;
2377
+ left: 50%;
2378
+ display: block;
2379
+ }
2380
+ .czr-mr-loader > div:nth-child(0) {
2381
+ -webkit-animation-delay: -0.8s;
2382
+ animation-delay: -0.8s;
2383
+ }
2384
+ .czr-mr-loader > div:nth-child(1) {
2385
+ -webkit-animation-delay: -0.6s;
2386
+ animation-delay: -0.6s;
2387
+ }
2388
+ .czr-mr-loader > div:nth-child(2) {
2389
+ -webkit-animation-delay: -0.4s;
2390
+ animation-delay: -0.4s;
2391
+ }
2392
+ .czr-mr-loader > div:nth-child(3) {
2393
+ -webkit-animation-delay: -0.2s;
2394
+ animation-delay: -0.2s;
2395
+ }
2396
+ .czr-mr-loader > div {
2397
+ -webkit-animation-fill-mode: both;
2398
+ animation-fill-mode: both;
2399
+ position: absolute;
2400
+ top: -4%;
2401
+ left: -4%;
2402
+ width: 100%;
2403
+ height: 100%;
2404
+ border-radius: 100%;
2405
+ border: 2px solid #fff;
2406
+ -webkit-animation: czr-mr-loader 1.25s 0s infinite cubic-bezier(.21, .53, .56, .8);
2407
+ animation: czr-mr-loader 1.25s 0s infinite cubic-bezier(.21, .53, .56, .8);
2408
+ }
2409
+
2410
+
2411
+
2412
+ /* TOP NOTE ( for Welcome, etc ) */
2413
+ #czr-top-note {
2414
+ position: absolute;
2415
+ text-align: center;
2416
+ padding: 2%;
2417
+ top : -100%;
2418
+ right: 0;
2419
+ left: 0;
2420
+ z-index: 20;
2421
+ color: #fff;
2422
+ display: block;
2423
+ -webkit-transition: all 0.3s ease-in-out;
2424
+ -moz-transition: all, 0.3s ease-in-out;
2425
+ -ms-transition: all, 0.3s ease-in-out;
2426
+ -o-transition: all, 0.3s ease-in-out;
2427
+ transition: all 0.3s ease-in-out;
2428
+ visibility: hidden;
2429
+ background: rgba(0, 0, 0, 0.80);
2430
+ }
2431
+ #czr-top-note h2 {
2432
+ color: #fff;
2433
+ font-size: 25px
2434
+ }
2435
+ #czr-top-note a {
2436
+ color: #fff;
2437
+ }
2438
+ #czr-top-note .czr-top-note-close {
2439
+ position: absolute;
2440
+ top: 10px;
2441
+ right: 25px;
2442
+ font-size: 31px;
2443
+ cursor: pointer;
2444
+ }
2445
+
2446
+ #czr-top-note .fa-arrow-left {
2447
+ position: absolute;
2448
+ bottom: 10px;
2449
+ left: 25px;
2450
+ font-size: 40px;
2451
+ }
2452
+ #czr-top-note .czr-note-content {
2453
+ display: inline-block;
2454
+ line-height: 20px;
2455
+ width: 80%;
2456
+ }
2457
+ #czr-top-note .czr-note-message {
2458
+ font-size: 16px;
2459
+ line-height: 20px;
2460
+ }
2461
+ body.czr-top-note-open #czr-top-note {
2462
+ top: 0;
2463
+ visibility: inherit;
2464
+ }
2465
+
2466
+
2467
+
2468
+
2469
+ /* SKOPE PANE */
2470
+ /* WP TEXT EDITOR */
2471
+ #czr-skope-pane {
2472
+ position: absolute;
2473
+ min-height: 100%;
2474
+ text-align: center;
2475
+ padding: 2%;
2476
+ top : -100%;
2477
+ right: 0;
2478
+ left: 0;
2479
+ z-index: 20;
2480
+ color: #fff;
2481
+ display: block;
2482
+ -webkit-transition: all 0.3s ease-in-out;
2483
+ -moz-transition: all, 0.3s ease-in-out;
2484
+ -ms-transition: all, 0.3s ease-in-out;
2485
+ -o-transition: all, 0.3s ease-in-out;
2486
+ transition: all 0.3s ease-in-out;
2487
+ visibility: hidden;
2488
+ }
2489
+
2490
+ /* RESET */
2491
+ #czr-skope-pane.dirty-reset {
2492
+ background: rgba(252, 173, 6, 0.23);
2493
+ }
2494
+ #czr-skope-pane.db-reset {
2495
+ background: rgba(0, 160, 210, 0.3);
2496
+ }
2497
+ .czr-reset-content {
2498
+ display: inline-block;
2499
+ line-height: 20px;
2500
+ width: 80%;
2501
+ padding: 5%;
2502
+ background: rgba(0, 0, 0, 0.63);
2503
+ }
2504
+
2505
+ #czr-skope-pane h2 {
2506
+ color: #fff;
2507
+ }
2508
+ body.czr-skope-pane-open #czr-skope-pane {
2509
+ top: 0;
2510
+ visibility: inherit;
2511
+ min-height: 100%;
2512
+ }
2513
+
2514
+ body.czr-skope-pane-open #customize-preview, body.czr-skope-pane-open .wp-full-overlay-sidebar {
2515
+ opacity: 0.5;
2516
+ }
2517
+
2518
+ body.czr-resetting-skope #czr-skope-pane .czr-spinner-wrapper {
2519
+ visibility: visible;
2520
+ }
2521
+
2522
+ .czr-skope-pane-open .wp-full-overlay.collapsed .wp-full-overlay-sidebar {
2523
+ z-index: 30;
2524
+ }
2525
+ .czr-skope-pane-open .wp-full-overlay.expanded .collapse-sidebar {
2526
+ bottom: 0 !important;
2527
+ }
2528
+
2529
+
2530
+ /* CONTROL INFOS */
2531
+ .customize-control .czr-skope-notice {
2532
+ color: #357315;
2533
+ }
2534
+
2535
+ .czr-toggle-notice {
2536
+ color: #95a5a6;
2537
+ text-shadow: 1px 1px 0px white;
2538
+ -webkit-transition: color 0.4s;
2539
+ transition: color 0.4s;
2540
+ position: absolute;
2541
+ padding-left: 3px;
2542
+ line-height: 21px;
2543
+ display: none;
2544
+ }
2545
+ .czr-notice-visible .czr-toggle-notice, .czr-toggle-notice:hover {
2546
+ color: #357315;
2547
+ }
2548
+
2549
+
2550
+
2551
+ /* Error Notification */
2552
+ .wp-full-overlay-header, .wp-full-overlay-sidebar .wp-full-overlay-sidebar-content {
2553
+ -webkit-transition: height, top, .4s ease-in-out;
2554
+ -moz-transition: height, top, .4s ease-in-out;
2555
+ -ms-transition: height, top, .4s ease-in-out;
2556
+ -o-transition: height, top, .4s ease-in-out;
2557
+ transition: height, top, .4s ease-in-out;
2558
+ }
2559
+ .czr-server-notice {
2560
+ width: calc(96% - 2px);
2561
+ bottom: 75px;
2562
+ text-align: center;
2563
+ background: rgba(0, 156, 0, 0.18);
2564
+ color: #000;
2565
+ display: none;
2566
+ position: absolute;
2567
+ font-size: 12px;
2568
+ line-height: 13px;
2569
+ padding: 2%;
2570
+ overflow: hidden;
2571
+ }
2572
+ .czr-server-notice.czr-server-error {
2573
+ color: #000;
2574
+ background: rgba(255, 0, 0, 0.24);
2575
+ }
2576
+
2577
+ .czr-dismiss-notification {
2578
+ position: absolute;
2579
+ right: 5px;
2580
+ top: 5px;
2581
+ cursor: pointer;
2582
+ }
2583
+
2584
+ /*ickeck specifics */
2585
+ .wp-customizer .icheckbox_flat-grey, .wp-customizer .iradio_flat-grey {
2586
+ border: 1px solid white;
2587
+ -webkit-border-radius: 5px;
2588
+ border-radius: 5px;
2589
+ background-color : white;
2590
+ }
2591
+
2592
+ /* SKOPE PAINTING */
2593
+ .czr-painted {
2594
+ -webkit-transition: background .3s ease-in-out!important;
2595
+ -moz-transition: background .3s ease-in-out!important;
2596
+ -ms-transition: background .3s ease-in-out!important;
2597
+ -o-transition: background .3s ease-in-out!important;
2598
+ transition: background .3s ease-in-out!important;
2599
+ }
2600
+
2601
+
assets/czr/css/czr-control.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .rtl.wp-customizer .wp-full-overlay-sidebar,.wp-customizer .wp-full-overlay-sidebar{width:440px}i.czr-notice,span.czr-notice{display:block;clear:both}.wp-customizer .wp-full-overlay.expanded{margin-left:440px}.wp-customizer .wp-full-overlay.collapsed .wp-full-overlay-sidebar{margin-left:-440px}#customize-theme-controls .control-section.current-panel>h3.accordion-section-title{left:-440px}.accordion-sub-container.control-panel-content{left:440px}.rtl.wp-customizer .wp-full-overlay.expanded{margin-right:440px;margin-left:0}.rtl.wp-customizer .wp-full-overlay.collapsed .wp-full-overlay-sidebar{margin-right:-440px;margin-left:0}.rtl #customize-theme-controls .control-section.current-panel>h3.accordion-section-title{right:-440px}.rtl .accordion-sub-container.control-panel-content{right:440px}.customize-section-description-container+#customize-control-custom_css:last-child{margin:0;width:100%}li#customize-control-custom_css textarea{font-size:13px;background:#394143;color:#95ff0c;min-height:300px}@media screen and (max-width:1400px){.rtl.wp-customizer .wp-full-overlay-sidebar,.wp-customizer .wp-full-overlay-sidebar{width:380px}.wp-customizer .wp-full-overlay.expanded{margin-left:380px}.wp-customizer .wp-full-overlay.collapsed .wp-full-overlay-sidebar{margin-left:-380px}#customize-theme-controls .control-section.current-panel>h3.accordion-section-title{left:-380px}.accordion-sub-container.control-panel-content{left:380px}.rtl.wp-customizer .wp-full-overlay.expanded{margin-right:380px;margin-left:0}.rtl.wp-customizer .wp-full-overlay.collapsed .wp-full-overlay-sidebar{margin-right:-380px;margin-left:0}.rtl #customize-theme-controls .control-section.current-panel>h3.accordion-section-title{right:-380px}.rtl .accordion-sub-container.control-panel-content{right:380px}}@media screen and (max-width:979px){.rtl.wp-customizer .wp-full-overlay-sidebar,.wp-customizer .wp-full-overlay-sidebar{width:300px}.wp-customizer .wp-full-overlay.expanded{margin-left:300px}.wp-customizer .wp-full-overlay.collapsed .wp-full-overlay-sidebar{margin-left:-300px}#customize-theme-controls .control-section.current-panel>h3.accordion-section-title{left:-300px}.accordion-sub-container.control-panel-content{left:300px}.rtl.wp-customizer .wp-full-overlay.expanded{margin-right:300px;margin-left:0}.rtl.wp-customizer .wp-full-overlay.collapsed .wp-full-overlay-sidebar{margin-right:-300px;margin-left:0}.rtl #customize-theme-controls .control-section.current-panel>h3.accordion-section-title{right:-300px}.rtl .accordion-sub-container.control-panel-content{right:300px}}@media screen and (max-width:640px){.wp-customizer .customize-controls-preview-toggle{height:46px;border-bottom:1px solid #ddd;left:87px}.wp-customizer .wp-full-overlay.expanded{margin-left:0}#customize-theme-controls .control-section.current-panel>h3.accordion-section-title{left:-100%}.accordion-sub-container.control-panel-content{left:100%}.rtl.wp-customizer .wp-full-overlay.expanded{margin-right:0}.rtl #customize-theme-controls .control-section.current-panel>h3.accordion-section-title,.rtl .in-sub-panel #czr-donate-customizer,.rtl .in-sub-panel .czr-cta-wrap{right:-100%;left:auto}.rtl .accordion-sub-container.control-panel-content{right:100%}}.wp-customizer .control-section.control-panel .accordion-section-title .panel-title{font-size:24px;font-weight:inherit;line-height:30px}.wp-core-ui h3{color:#555}.accordion-section-title:after,.control-section.control-panel>.accordion-section-title:after,.handlediv,.item-edit,.sidebar-name-arrow,.widget-action,.wp-customizer #available-menu-items .menu-item-handle:hover .item-add,.wp-customizer #customize-controls .customize-info .customize-help-toggle:focus,.wp-customizer #customize-controls .customize-info .customize-help-toggle:hover,.wp-customizer #customize-controls .customize-info.open .customize-help-toggle,.wp-customizer .menu-item-handle:hover,.wp-customizer .menu-item-handle:hover .item-edit,.wp-customizer .menu-item-handle:hover .item-type{color:#00a0d2}.accordion-section-content{padding:10px 10px 15px 20px}.customize-control-title{line-height:19px}.wp-customizer #customize-theme-controls .accordion-section-content{background:#fff}.wp-customizer #customize-controls .customize-info .customize-help-toggle:focus:before,.wp-customizer .customize-screen-options-toggle:focus:before{-webkit-box-shadow:0 0 0 1px #00a0d2;box-shadow:0 0 0 1px #00a0d2;-webkit-border-radius:100%;border-radius:100%}#customize-controls .customize-info.open.active-menu-screen-options .customize-help-toggle:active,#customize-controls .customize-info.open.active-menu-screen-options .customize-help-toggle:focus,#customize-controls .customize-info.open.active-menu-screen-options .customize-help-toggle:hover,.active-menu-screen-options .customize-screen-options-toggle,.customize-screen-options-toggle:active,.customize-screen-options-toggle:focus,.customize-screen-options-toggle:hover{color:#00a0d2!important}.customize-control input[type=text]{line-height:23px}.control-section .accordion-section-content{overflow-y:auto}li[id*=customize-control-]{margin:8px 0}.wp-customizer .control-section h3.accordion-section-title{padding:10px 25px 11px 14px}.wp-customizer #customize-controls h3{font-size:15px;font-weight:400}.control-section .accordion-section-title:after{top:7px}.control-section.control-panel .accordion-section-title:after{top:11px;-webkit-transition:right .3s ease-in-out,opacity .3s ease-in-out;-moz-transition:right .3s ease-in-out,opacity .3s ease-in-out;-ms-transition:right .3s ease-in-out,opacity .3s ease-in-out;-o-transition:right .3s ease-in-out,opacity .3s ease-in-out;transition:right .3s ease-in-out,opacity .3s ease-in-out;right:10px;opacity:.7}.rtl .control-section.control-panel .accordion-section-title:after{-webkit-transition:left .3s ease-in-out,opacity .3s ease-in-out;-moz-transition:left .3s ease-in-out,opacity .3s ease-in-out;-ms-transition:left .3s ease-in-out,opacity .3s ease-in-out;-o-transition:left .3s ease-in-out,opacity .3s ease-in-out;transition:left .3s ease-in-out,opacity .3s ease-in-out;left:10px;right:initial}#customize-theme-controls .control-section.control-panel h3.accordion-section-title:focus:after,#customize-theme-controls .control-section.control-panel h3.accordion-section-title:hover:after{right:8px;opacity:1;color:#666!important}.rtl #customize-theme-controls .control-section.control-panel h3.accordion-section-title:focus:after,.rtl #customize-theme-controls .control-section.control-panel h3.accordion-section-title:hover:after{left:6px;right:initial}#customize-theme-controls .control-section.control-panel>h3.accordion-section-title:focus:after,#customize-theme-controls .control-section.control-panel>h3.accordion-section-title:hover:after,.control-section.control-panel>.accordion-section-title:after{background:0 0!important;border:none!important}#customize-theme-controls h3.accordion-section-title{-webkit-transition:background .1s ease-in-out;-moz-transition:background .1s ease-in-out;-ms-transition:background .1s ease-in-out;-o-transition:background .1s ease-in-out;transition:background .1s ease-in-out}.customize-control-checkbox label,.customize-control-nav_menu_auto_add label,.customize-control-radio label{line-height:16px;margin-left:0}input::-webkit-input-placeholder{color:#9A9A9A;font-style:italic}input:-moz-placeholder{color:#9A9A9A;font-style:italic}input::-moz-placeholder{color:#9A9A9A;font-style:italic}input:-ms-input-placeholder{color:#9A9A9A;font-style:italic}.czr-customizr-title{text-transform:uppercase;margin:1em 0 5px;font-size:15px!important;border-bottom:1px dotted #00a0d2;padding-bottom:5px;text-align:center}h3.czr-customizr-title::before{content:'\00b7';padding-right:3px}h3.czr-customizr-title::after{content:'\00b7';padding-left:3px}.czr-after-button{border-color:#fff;margin-top:15px}.czr-emphasize{line-height:1.2em;color:#2E2E2E}span.czr-notice{color:#313131;font-size:12px;font-style:italic;line-height:18px}.czr-customizer-separator-invisible{border:none;margin-top:15px}.czr-skin-gen-label{float:left}.czr-skin-gen-color-picker{float:right}.czr-number-label{float:left}.czr-number-input{float:right}.czr-check-label{float:left;max-width:85%}.rtl .czr-check-label{float:right}input[type=checkbox],input[type=radio]{float:right;min-height:18px}.czr-font-select{float:left}li#customize-control-tc_theme_options-tc_custom_css textarea{font-size:14px;background:#394143;color:#E2E728;min-height:300px}.customize-control .czr-navigate-to-post-list{color:#00a0d2;font-weight:700;float:left;clear:both;width:100%;margin-bottom:8px}.czr-sub-control{padding-left:13%;max-width:87%;position:relative}.czr-sub-control:before{content:'';height:116%;background:#00a0d2;width:2%;position:absolute;left:7%}.customize-control-tc_cropped_image .upload-button{float:right}.customize-control-tc_cropped_image .remove-button{float:left;margin-right:3px}.customize-control-tc_cropped_image .actions{margin-bottom:32px}.customize-control-tc_cropped_image .current{margin-bottom:8px}.customize-control-tc_cropped_image .remove-button,.customize-control-tc_cropped_image .upload-button{white-space:normal;width:48%;height:auto}.customize-control-tc_cropped_image .current .container{min-height:40px;overflow:hidden;border:1px solid #eee;-webkit-border-radius:2px;border-radius:2px}.customize-control-tc_cropped_image img{width:100%;-webkit-border-radius:2px;border-radius:2px}.customize-control-tc_cropped_image .inner{line-height:20px;top:10px}.rtl .customize-control-tc_cropped_image .upload-button{float:left}.rtl .customize-control-tc_cropped_image .remove-button{float:right;margin-left:3px}.czr-layout-img{height:26px;padding-top:2px;border:1px solid #FFF}.czr-layout-title{padding:0 0 18px 12px;display:inline-block;line-height:0;vertical-align:middle}.customize-control-czr_multi_input{width:96%;border:1px solid #ccc;padding:2%}.czr-multi-input-wrapper{width:95%;padding:0 0 0 5%}.czr-multi-input-wrapper [data-input-type=color] .czr-input{float:left;clear:both}#customize-theme-controls #accordion-panel-czr-footer-panel{border-bottom:1px solid #ddd}#customize-theme-controls #accordion-panel-hu-advanced-panel,#customize-theme-controls #accordion-panel-nav_menus,#customize-theme-controls .control-panel-widgets{margin-top:10px}#customize-theme-controls #accordion-panel-hu-advanced-panel,#customize-theme-controls #accordion-panel-hu-header-panel,#customize-theme-controls #accordion-panel-nav_menus,#customize-theme-controls .control-panel-widgets{border-top:1px solid #ddd}#customize-theme-controls #accordion-panel-hu-general-panel,#customize-theme-controls #accordion-section-static_front_page{margin-bottom:10px}#customize-header-actions .customize-controls-close{left:45px}.customize-controls-close,.customize-controls-home{top:-1px}.customize-controls-home{display:block;position:absolute;left:0;width:45px;height:41px;padding:0 2px 0 0;background:#eee;border:none;border-top:4px solid #eee;border-right:1px solid #ddd;border-bottom:1px solid #ddd;color:#444;text-align:left;cursor:pointer;text-decoration:none;-webkit-transition:color .15s ease-in-out,border-color .15s ease-in-out,background .15s ease-in-out;transition:color .1s ease-in-out,border-color .15s ease-in-out,background .15s ease-in-out;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.customize-controls-home:before{font-size:17px;line-height:45px;position:relative;top:-4px;left:14px}.customize-controls-home:hover{background:#fff;color:#0073aa;border-top-color:#0073aa;outline:0;-webkit-box-shadow:none;box-shadow:none}.control-panel-content .hu-menu-notice{margin-left:3%}span.czr-panel-subtitle{display:block;font-size:12px;font-style:italic}.czr-open-pre-add-new{display:block;float:left;margin:2% 2% 0;width:99%;padding:2%;background:#3b8dbd;opacity:1;color:#fff;font-size:16px;cursor:pointer;border-width:1px;border-style:solid;-webkit-appearance:none;-webkit-border-radius:3px;border-radius:3px;white-space:nowrap;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-transition:opacity 1s ease-in-out;-moz-transition:opacity 1s ease-in-out;-ms-transition:opacity 1s ease-in-out;-o-transition:opacity 1s ease-in-out;transition:opacity 1s ease-in-out}.czr-open-pre-add-new.active{background:#646464;opacity:.5;border-radius:3px 3px 0 0}.czr-adding-new .czr-items-wrapper,.czr-items-wrapper .inactive{opacity:.6}.czr-single-item{padding:0;border:1px solid #ccc;margin:1% 0 0 2%;float:left;width:98%;-webkit-border-radius:3px;border-radius:3px;-webkit-transition:opacity 1s ease-in-out;-moz-transition:opacity 1s ease-in-out;-ms-transition:opacity 1s ease-in-out;-o-transition:opacity 1s ease-in-out;transition:opacity 1s ease-in-out}.czr-single-item .czr-item-content input,.czr-sub-set{margin-bottom:0}#customize-theme-controls .czr-single-item.open{border:1px solid #00a0d2}#customize-theme-controls .mono-item-mod .czr-single-item{border:1px solid #ccc}.czr-single-item .czr-item-content,.czr-single-item .czr-item-header{padding:1%}.czr-items-wrapper .czr-single-item .czr-builtin-model{background:#E1DFDF;color:#555}.czr-item-sort-handle{cursor:move}.czr-single-item .czr-item-header{position:relative;background:#dfdfdf;color:#fff;float:left;width:98%;-webkit-transition:background .1s ease-in-out;-moz-transition:background .1s ease-in-out;-ms-transition:background .1s ease-in-out;-o-transition:background .1s ease-in-out;transition:background .1s ease-in-out}.czr_widget_areas_module .czr-single-item .czr-custom-model{background:#3b8dbd}. .czr-single-item .czr-custom-model:hover{background:#aaa}.czr-items-wrapper .czr-single-item .czr-builtin-model:hover,.czr-single-item .czr-item-header:hover{background:#ccc}.czr-move-icon{position:absolute;top:-2px;left:3px;font-size:10px;color:#999}.czr-item-title{float:left;font-size:17px;color:#000;padding:7px;width:67%}.czr-inactive-alert{font-size:12px;font-style:italic}.czr_widget_areas_module .czr-item-title{color:#fff}.czr-builtin-model .czr-item-title{color:#23282d}.czr-item-title h4{margin:0}.czr-item-title .fa:before{padding-right:2px}.czr-item-btns{float:right}.czr-item-btns a{font-size:17px;padding:7px 5px;color:#777;-webkit-transition:color .1s ease-in-out;-moz-transition:color .1s ease-in-out;-ms-transition:color .1s ease-in-out;-o-transition:color .1s ease-in-out;transition:color .1s ease-in-out}.czr-item-btns a:active,.czr-item-btns a:focus{outline:0;-webkit-box-shadow:none;box-shadow:none}.czr_widget_areas_module .czr-item-btns a{color:#fff}.czr-builtin-model .czr-item-btns a{color:#555}.czr-builtin-model .czr-item-btns .czr-edit-view.active,.czr-builtin-model .czr-item-btns .czr-edit-view:hover,.czr-item-btns .czr-edit-view.active,.czr-item-btns .czr-edit-view:hover{color:#00a0d2}.czr_widget_areas_module .czr-edit-view:hover,.czr_widget_areas_module .czr-item-btns .czr-edit-view.active{color:#000}.czr_widget_areas_module .czr-builtin-model .czr-edit-view.active,.czr_widget_areas_module .czr-builtin-model .czr-edit-view:hover{color:#00a0d2}.czr-item-btns .czr-display-alert.active,.czr-item-btns .czr-display-alert:hover{color:#23282d}.czr-single-item .czr-item-content{display:none;clear:both;width:96%;padding:2%}.czr-sub-set{display:block;float:left;width:100%;padding:1% 0;position:relative}.czr-sub-set .czr-input{float:right;width:60%}.width-100 .czr-input{width:100%}.czr-sub-set .customize-control-title{float:left;width:40%;padding:1px 0;font-size:13px}.czr-item-title .fa{font-size:18px}.czr-remove-alert-wrapper{display:none;clear:both;float:left;padding:2%;width:95%;margin:10px 0;text-shadow:0 1px 0 rgba(255,255,255,.5);background-color:#EEE;color:#000;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.czr-remove-alert-wrapper p{padding:5px;margin:0}.czr-pre-add-wrapper{position:relative;float:left;width:100%}.czr-pre-add-view-content{display:none;padding:3%;border:1px solid #00a0d2;border-top:none;margin:0 0 0 2%;float:left;width:92%;background:#eee;-webkit-border-radius:0 0 3px 3px;-moz-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px;position:relative;opacity:1;-webkit-transition:opacity .2s linear;-moz-transition:opacity .2s linear;-ms-transition:opacity .2s linear;-o-transition:opacity .2s linear;transition:opacity .2s linear}.czr-model-added .czr-pre-add-view-content{opacity:.2}.czr-pre-add-wrapper .czr-add-new{background:#3b8dbd;color:#fff;-webkit-transition:background .5s linear;-moz-transition:background .5s linear;-ms-transition:background .5s linear;-o-transition:background .5s linear;transition:background .5s linear;float:right;border:none}.czr-add-success{width:100%;margin:0 0 0 2%;position:absolute;top:0;left:0;font-size:25px;text-align:center;opacity:0;-webkit-transition:opacity .1s linear;-moz-transition:opacity .1s linear;-ms-transition:opacity .1s linear;-o-transition:opacity .1s linear;transition:opacity .1s linear}.czr-model-added .czr-add-success{opacity:1}.czr-add-success p{vertical-align:middle;display:inline-block;line-height:35px;margin:0;font-size:25px;color:#82b965;padding:0 3%}.control-section-widget_zones_management{margin:10px 0;z-index:1}.czr-zone-infos{width:96%;padding:0 2%;font-size:12px;float:left;font-style:italic}.czr-unavailable-location{opacity:.7}.czr-location-alert{float:left;width:100%;padding:1% 0;margin:1% 0;text-align:center;border:1px solid orange;background:#FEE5B6;color:#000;font-size:11px;font-style:italic}.in-sub-panel #czr-donate-customizer,.in-sub-panel .czr-cta-wrap{left:-450px;height:0}.rtl .in-sub-panel #czr-donate-customizer,.rtl .in-sub-panel .czr-cta-wrap{right:-450px}@media screen and (max-width:1400px){.in-sub-panel #czr-donate-customizer,.in-sub-panel .czr-cta-wrap{left:-380px}.rtl .in-sub-panel #czr-donate-customizer,.rtl .in-sub-panel .czr-cta-wrap{right:-380px}}@media screen and (max-width:979px){.in-sub-panel #czr-donate-customizer,.in-sub-panel .czr-cta-wrap{left:-300px}.rtl .in-sub-panel #czr-donate-customizer,.rtl .in-sub-panel .czr-cta-wrap{right:-300px}}@media screen and (max-width:640px){.in-sub-panel #czr-donate-customizer,.in-sub-panel .czr-cta-wrap{left:-100%}.rtl .in-sub-panel #czr-donate-customizer,.rtl .in-sub-panel .czr-cta-wrap{right:-100%;left:auto}}@media screen and (min-width:980px){.wp-customizer .expanded #customize-footer-actions{width:380px}}@media screen and (min-width:1401px){.wp-customizer .expanded #customize-footer-actions{width:440px}}.selecter-element{position:absolute;opacity:0}.selecter{display:block;float:right;margin:2px 0;position:relative;width:100%;z-index:100}.selecter .selecter-selected{background:url(img/jquery.fs.selecter-arrow.png) right center no-repeat #F9F9F9;border:1px solid #ccc;border-radius:3px;color:#333;cursor:pointer;display:block;font-size:13px;margin:0;overflow:hidden;padding:4px 4.6%;position:relative;text-overflow:clip;z-index:49;box-shadow:inset 0 1px 2px rgba(0,0,0,.07);height:auto;line-height:18px;width:90%}.selecter .selecter-options{border:1px solid #ccc;border-width:0 1px 1px;background-color:#fefefe;border-radius:0 0 3px 3px;box-shadow:0 1px 4px rgba(0,0,0,.15);display:none;left:0;margin:0;max-height:260px;overflow:auto;overflow-x:hidden;padding:0;position:relative;top:100%;width:99%;z-index:50}.selecter .selecter-group{background:#F9F9F9;border-bottom:1px solid #e3e3e3;color:#999;display:block;font-size:11px;padding:5px 10px 4px;text-transform:uppercase}.selecter .selecter-item{background:#fff;border-bottom:1px solid #e3e3e3;color:#333;cursor:pointer;display:block;font-size:13px;margin:0;overflow:hidden;text-overflow:ellipsis;width:86%;height:auto;line-height:14px;padding:8px 24px 8px 10px}.selecter.disabled .selecter-group,.selecter.disabled .selecter-item,.selecter.disabled .selecter-selected{cursor:default;color:#ccc;border-color:#eee}.selecter .selecter-item.selected{background:#F9F9F9}.selecter .selecter-item.disabled{color:#999;cursor:default}.selecter .selecter-item:first-child{border-radius:0}.selecter .selecter-item:last-child{border-radius:0 0 2px 2px;border-bottom:0}.rtl .selecter .selecter-selected{background:url(img/jquery.fs.selecter-arrow.png) 4% center no-repeat #F9F9F9}@media screen and (min-width:980px){.selecter .selecter-item.selected:hover,.selecter .selecter-item:hover{background-color:#f3f3f3}.selecter .selecter-item.disabled:hover,.selecter:hover .selecter-selected{background-color:#fff}.selecter.disabled .selecter-item:hover{background:#fff}}.selecter.open{z-index:101}.selecter.open .selecter-selected{border-radius:3px 3px 0 0;z-index:51}.selecter.focus .selecter-selected,.selecter.open .selecter-selected{background-color:#fff;box-shadow:0 0 5px rgba(0,0,0,.1)}.selecter.cover .selecter-options{border-radius:3px;border-width:1px;top:0}.selecter.cover .selecter-options .selecter-item.first{border-radius:3px 3px 0 0}.selecter.cover.open .selecter-selected{border-radius:3px 3px 0 0;z-index:49}.selecter.bottom .selecter-options{border-width:1px 1px 0;bottom:100%;top:auto}.selecter.bottom .selecter-item:last-child{border:none}.selecter.bottom.open .selecter-selected{border-radius:0 0 3px 3px}.selecter.bottom.open .selecter-options{border-radius:3px 3px 0 0}.selecter.bottom.cover.open .selecter-options,.selecter.bottom.cover.open .selecter-selected,.stepper{border-radius:3px}.selecter.bottom.cover .selecter-options{bottom:0;top:auto}.selecter.multiple .selecter-options{border-radius:3px;border-width:1px;box-shadow:none;display:block;position:static;width:100%}.selecter.disabled .selecter-selected{background:#fff}.selecter.disabled .selecter-options{background:#fff;border-color:#eee}.selecter.disabled .selecter-item.selected{background:#fafafa}.selecter .selecter-options.scroller{overflow:hidden}.selecter .selecter-options.scroller .scroller-content{max-height:260px;padding:0}@media screen and (max-width:740px){.selecter{max-width:100%}}@media screen and (max-width:500px){.selecter{max-width:100%}}.stepper{margin:0 0 10px;overflow:hidden;position:relative;width:35%;float:left;clear:both}.stepper .stepper-input{background:#F9F9F9;border:1px solid #ccc;border-radius:3px;color:#333;font-size:13px;line-height:1.2;margin:0;overflow:hidden;padding:5px 10px!important;width:100%!important;z-index:49;-moz-appearance:textfield;max-width:none!important}.stepper .stepper-input::-webkit-inner-spin-button,.stepper .stepper-input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.stepper .stepper-input:focus{background-color:#fff}.stepper .stepper-arrow{background:url(img/jquery.fs.stepper-arrows.png) no-repeat #eee;border:1px solid #ccc;cursor:pointer;display:block;height:46%;position:absolute;right:0;text-indent:-99999px;width:20px;z-index:50}.stepper .stepper-arrow.up{background-position:center top;border-bottom:none;top:0}.stepper .stepper-arrow.down{background-position:center bottom;bottom:0}.rtl .stepper .stepper-input{text-align:left}@media screen and (min-width:740px){.stepper:hover .stepper-input{background-color:#fff}.stepper .stepper-step:hover{background-color:#F9F9F9}.stepper.disabled .stepper-arrow{background:#fff;border-color:#eee;cursor:default}}.stepper.disabled .stepper-input{background:#fff;border-color:#eee;color:#ccc}.stepper.disabled .stepper-arrow{background:#fff;border-color:#eee;cursor:default}.icheckbox_flat-green,.icheckbox_flat-grey,.iradio_flat-green,.iradio_flat-grey{display:inline-block;margin:0;padding:0;width:20px;height:20px;border:none;top:4px;vertical-align:middle}.icheckbox_flat-green,.iradio_flat-green{background:url(img/green.png) no-repeat;cursor:pointer;float:right}.rtl .icheckbox_flat-green{float:left}.icheckbox_flat-green{background-position:0 0}.icheckbox_flat-green.checked{background-position:-22px 0}.icheckbox_flat-green.disabled{background-position:-44px 0;cursor:default}.icheckbox_flat-green.checked.disabled{background-position:-66px 0}.iradio_flat-green{background-position:-88px 0}.iradio_flat-green.checked{background-position:-110px 0}.iradio_flat-green.disabled{background-position:-132px 0;cursor:default}.iradio_flat-green.checked.disabled{background-position:-154px 0}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (-moz-min-device-pixel-ratio:1.5),only screen and (-o-min-device-pixel-ratio:3/2),only screen and (min-device-pixel-ratio:1.5){.icheckbox_flat-green,.iradio_flat-green{background-image:url(img/green@2x.png);-webkit-background-size:176px 22px;background-size:176px 22px}}.icheckbox_flat-grey,.iradio_flat-grey{background:url(img/grey.png) no-repeat;cursor:pointer;float:right}.icheckbox_flat-grey{background-position:0 0}.icheckbox_flat-grey.checked{background-position:-22px 0}.icheckbox_flat-grey.disabled{background-position:-44px 0;cursor:default}.icheckbox_flat-grey.checked.disabled{background-position:-66px 0}.iradio_flat-grey{background-position:-88px 0}.iradio_flat-grey.checked{background-position:-110px 0}.iradio_flat-grey.disabled{background-position:-132px 0;cursor:default}.iradio_flat-grey.checked.disabled{background-position:-154px 0}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (-moz-min-device-pixel-ratio:1.5),only screen and (-o-min-device-pixel-ratio:3/2),only screen and (min-device-pixel-ratio:1.5){.icheckbox_flat-grey,.iradio_flat-grey{background-image:url(img/grey@2x.png);-webkit-background-size:176px 22px;background-size:176px 22px}}.czr-sub-set .icheckbox_flat-green,.iradio_flat-green{float:left}body .select2-container{z-index:1000000;width:100%!important}.customize-control-czr_layouts .select2-selection--single{height:33px}.customize-control-czr_layouts .select2-container--default .select2-selection--single .select2-selection__arrow{height:30px}.customize-control-czr_layouts .select2-selection--single:focus,.select2-selection__rendered:focus{outline:0}body .select2-container,span.select2-results{font-size:14px}.select2-container--default .select2-selection--multiple{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;width:99%;min-height:36px;border:1px solid #ddd;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.07);box-shadow:inset 0 1px 2px rgba(0,0,0,.07)}.select2-container--default.select2-container--focus .select2-selection--multiple{border-color:#00a0d2!important;-webkit-box-shadow:0 0 2px rgba(26,188,156,.8)!important;box-shadow:0 0 2px rgba(26,188,156,.8)!important}.select2-results__options li{margin-bottom:0}.select2-container--default .select2-selection--multiple .select2-selection__choice{padding:2px;font-size:13px;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;margin-bottom:0}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#00a0d2}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{font-size:17px;position:relative;top:2px;color:#23282d}.customize-control-czr_socials .select2-container--default .select2-selection--single .select2-selection__rendered{padding:5px;line-height:16px}#czr-customize-content_editor-pane{border-top:solid 1px #ddd;position:absolute;height:300px;bottom:-301px;right:0;left:0;z-index:20;background:#f1f1f1;display:block;-webkit-transition:all .2s;transition:all .2s;visibility:hidden}body.czr-customize-content_editor-pane-resize #customize-preview,body.czr-customize-content_editor-pane-resize #czr-customize-content_editor-pane{-webkit-transition:none;transition:none}body.mce-fullscreen.czr-customize-content_editor-pane-open #czr-customize-content_editor-pane{top:0}body.czr-customize-content_editor-pane-open #czr-customize-content_editor-pane{bottom:0;visibility:inherit}#czr-customize-content_editor-pane .wp-editor-tools{padding-top:5px;padding-right:10px}#czr-customize-content_editor-pane .wp-media-buttons{padding-left:5px}#customize-preview{height:auto}body.czr-customize-content_editor-pane-open #customize-preview{bottom:300px}body.mce-fullscreen #customize-preview{bottom:0}body.mce-fullscreen.czr-customize-content_editor-pane-open div.mce-fullscreen{position:relative;left:0}#wp-czr-customize-content_editor-container{border-left:0}#czr-customize-content_editor-dragbar{top:0;cursor:row-resize;display:block;height:4px;position:absolute;width:100%;z-index:21}body.czr-customize-content_editor-pane-resize #customize-preview:before{top:0;right:0;bottom:0;left:0;position:absolute;height:100%;width:100%;z-index:999999}.wp-customizer .ui-autocomplete.wplink-autocomplete{z-index:500110}.wp-customizer #wp-link-wrap{z-index:500105}.wp-customizer #wp_editbtns,.wp-customizer #wp_gallerybtns{z-index:500020}.wp-customizer #TB_overlay,.wp-customizer #TB_window{z-index:500050}.wp-customizer .mce-panel,.wp-customizer .mce-tooltip{z-index:500100!important}.czr-customize-content_editor-pane-open .wp-full-overlay.collapsed .wp-full-overlay-sidebar{z-index:30}.czr-customize-content_editor-pane-open .wp-full-overlay.collapsed .collapse-sidebar{bottom:308px}.czr-customize-content_editor-pane-open .wp-full-overlay.expanded .collapse-sidebar{bottom:0!important}.czr-customize-content_editor-pane-resize .wp-full-overlay.collapsed .collapse-sidebar{-webkit-transition:none;transition:none}.czr-customize-content_editor-pane-open.mce-fullscreen .wp-full-overlay.collapsed .collapse-sidebar{bottom:8px!important}.czr-sektion-buttons{position:absolute;right:0}.czr-column{width:99%;margin-bottom:1%;float:left;padding:2% 0;border:2px dotted #aaa;text-align:center}.czr-column-header{position:relative}.czr-col-drag-handler{position:absolute;left:0;padding:1%;color:#999;cursor:move;cursor:grab;cursor:-moz-grab;cursor:-webkit-grab}.czr-module-collection-wrapper{width:100%;min-height:5px;float:left}.czr-single-module{width:98%;float:left;min-height:20px;margin:1px 1%;border:1px solid #ccc}.czr-single-module textarea{max-width:100%}#customize-theme-controls .czr-single-module .czr-single-item{width:96%}.czr-mod-header{background:#eee;float:left;width:100%}.czr-mod-title{position:relative}.czr-mod-title>h4{float:left;width:70%;margin:2% 0}.czr-mod-drag-handler{position:absolute;left:0;padding:1%;margin:2% 0;color:#999;cursor:move;cursor:grab;cursor:-moz-grab;cursor:-webkit-grab}.czr-mod-buttons{float:right;width:30%;margin:2% 0}.czr-mod-content{position:absolute;top:0;left:100%;float:left;width:100%;background:#d5e9cc;display:none}.czr-module-open #customize-info,.czr-module-open #customize-theme-controls{left:-200%}.czr-module-open #customize-theme-controls .accordion-section-content{overflow:visible}.czr-module-description-container{margin-bottom:15px}.czr-module-title{border-bottom:1px solid #ddd;background:#fff}.czr-module-title h3{padding:10px 10px 12px 14px;margin:0;color:#555;font-size:20px;font-weight:200;line-height:26px;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#customize-controls .czr-module-title span.customize-action{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:13px;display:block;font-weight:400}.czr-module-back{display:block;float:left;width:48px;height:74px;padding:0 24px 0 0;margin:0;background:#fff;border:none;border-right:1px solid #ddd;-webkit-box-shadow:none;box-shadow:none;cursor:pointer;-webkit-transition:left .18s ease-in-out,color .1s ease-in-out,background .1s ease-in-out;transition:left .18s ease-in-out,color .1s ease-in-out,background .1s ease-in-out}.czr-module-back:focus,.czr-module-back:hover{color:#23282d;background:#f5f5f5;outline:0;-webkit-box-shadow:none;box-shadow:none}.czr-module-back:before{font:400 20px/72px dashicons;content:"\f341";position:relative;left:13px}.czr-module-back:hover{color:#23282d;background:#f5f5f5;outline:0;-webkit-box-shadow:none;box-shadow:none}.gu-mirror{position:fixed!important;margin:0!important;z-index:999999!important;opacity:.8;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";filter:alpha(opacity=80)}#czr-module-list-panel,#czr-sektion-settings-panel{left:-301px;overflow-x:hidden;overflow-y:auto;z-index:4;bottom:0}.gu-hide{display:none!important}.gu-unselectable{-webkit-user-select:none!important;-moz-user-select:none!important;-ms-user-select:none!important;user-select:none!important}.gu-transit{opacity:.2;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=20)";filter:alpha(opacity=20)}.gu-unselectable .czr-module-collection-wrapper{width:98%;border:1px dotted green;background:#d1ffe0;min-height:31px}li.czr-module-candidate.gu-mirror,li.czr-single-module.gu-mirror{list-style:none}#czr-module-list-panel{position:absolute;top:0;opacity:0;margin:0;background:rgba(0,0,0,.47);-webkit-transition:all .18s;transition:all .18s;border-right:1px solid #ddd}#czr-available-modules-filter,#czr-module-list-panel{width:45%;min-width:300px}body.czr-adding-module #czr-module-list-panel{left:0;visibility:visible;opacity:1}body.czr-adding-module #customize-preview{opacity:.7}.add-new-module:before{content:"\f132";display:inline-block;position:relative;left:-2px;top:-1px;font:400 20px/1 dashicons;vertical-align:middle;-webkit-transition:all .2s;transition:all .2s;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.czr-column .add-new-module{margin:1%;float:right}body.czr-adding-module .add-new-module,body.czr-adding-module .add-new-module:hover{background:#eee;border-color:#929793;color:#32373c;-webkit-box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.5);box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.5)}body.czr-adding-module .add-new-module:before{-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}#czr-available-modules-list{top:60px;position:absolute;overflow:auto;bottom:0;width:100%}#czr-available-modules-filter{position:fixed;top:0;z-index:1;background:rgba(0,0,0,.47);border-bottom:1px solid #e5e5e5;padding:12px 15px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#czr-available-modules-filter input{padding:6px 10px;width:100%}#czr-available-modules-list .czr-module-candidate{position:relative;border-bottom:1px solid #e5e5e5}#czr-available-modules-list .czr-module-candidate h3{color:#fff;padding:0;margin:0}#czr-available-modules-list .czr-mod-drag-handler{position:relative;left:0;padding:1%;margin:2% 4%;color:inherit;cursor:move;cursor:grab;cursor:-moz-grab;cursor:-webkit-grab}#czr-sektion-settings-panel{position:absolute;top:0;width:45%;min-width:300px;opacity:0;margin:0;background:rgba(0,0,0,.47);-webkit-transition:all .18s;transition:all .18s;border-right:1px solid #ddd;color:#fff}#czr-sektion-settings-panel h3{color:#fff}body.czr-editing-sektion #czr-sektion-settings-panel{left:0;visibility:visible;opacity:1}body.czr-editing-sektion #customize-preview{opacity:.7}.czr-api-dirty input#save{background-color:#FFBD2E;border-color:#d99400;color:#000;text-shadow:none;-webkit-box-shadow:none;box-shadow:none;-webkit-transition:background-color .2s ease-in-out;-moz-transition:background-color .2s ease-in-out;-ms-transition:background-color .2s ease-in-out;-o-transition:background-color .2s ease-in-out;transition:background-color .2s ease-in-out}.czr-api-dirty input#save:hover{background-color:#fcad06}.czr-skop-on .wp-full-overlay-sidebar .wp-full-overlay-header{height:185px}.czr-skop-on .wp-full-overlay-sidebar .wp-full-overlay-sidebar-content{top:185px}.wp-customizer .in-sub-panel .wp-full-overlay-sidebar .wp-full-overlay-header{padding:0 15px}.customize-controls-close{border-bottom:1px solid #ddd}.wp-customizer #customize-header-actions{border-bottom:0}.czr-scope-switcher{width:100%;float:right;position:absolute;left:0;bottom:0;overflow:hidden}.czr-scope-switcher .czr-skp-permanent-title{position:relative;color:#5f5f5f}#customize-header-actions .czr-scope-switcher .spinner{float:none;display:none;margin:0;left:-26px;top:0;position:absolute;visibility:visible}#czr-top-note,.czr-spinner-wrapper{visibility:hidden}h2.czr-current-skope-title{font-size:13px;line-height:21px;margin:6px 0 4px;text-align:center;height:63px;font-weight:400;overflow:hidden}.czr-main-title{max-height:24px;overflow:hidden;display:inline-block;text-overflow:ellipsis;white-space:nowrap;width:95%}.czr-skope-title{display:block;font-size:17px;font-style:italic;line-height:25px}.czr-toggle-title-notice{cursor:pointer;font-size:14px;color:#777}.czr-skope-inherits-from{display:inline-block;opacity:0;width:90%;font-size:12px;line-height:18px;color:#357315;top:-6px;position:relative}.notice-visible .czr-toggle-title-notice{color:#357315}.notice-visible .czr-skope-inherits-from{opacity:1;-webkit-transition:opacity .3s ease-in-out;-moz-transition:opacity .3s ease-in-out;-ms-transition:opacity .3s ease-in-out;-o-transition:opacity .3s ease-in-out;transition:opacity .3s ease-in-out}.czr-scope,.czr-scope-switcher .button{-webkit-transition:opacity .3s ease-in-out;-moz-transition:opacity .3s ease-in-out;-ms-transition:opacity .3s ease-in-out;-o-transition:opacity .3s ease-in-out;float:left}.czr-scope-switcher .button{width:40%;text-align:center;margin:0 2%;opacity:.7;transition:opacity .3s ease-in-out}.czr-scope-switcher .button.active{font-weight:700;opacity:1}.czr-scope-switcher .active,.czr-scope-switcher .czr-scope:hover{opacity:1}.czr-skopes-wrapper{overflow:hidden;position:relative}.czr-scope-switcher .active:after,.czr-scope.active:before{position:absolute;content:'';top:0}.czr-scope.active:before{height:101%;float:left;z-index:1;-webkit-box-shadow:-4px 0 15px 0 rgba(119,119,119,.58);box-shadow:-4px 0 15px 0 rgba(119,119,119,.58)}.czr-scope-switcher .active:after{height:100%;-webkit-box-shadow:4px 0 15px 0 rgba(119,119,119,.58);box-shadow:4px 0 15px 0 rgba(119,119,119,.58);z-index:3}.czr-skopes-wrapper .active-collection.local:after{right:0}.czr-scope-switcher .czr-scope:last-child:after{-webkit-box-shadow:none;box-shadow:none;right:0}.czr-scope-switcher .czr-scope:first-child:after{left:0}.czr-scope{width:30.5%;background:#fff;border-top:1px solid #ccc;overflow:hidden;opacity:.65;transition:opacity .3s ease-in-out}.czr-scope-switcher .width-100,.czr-scope.width-100.active:after,.czr-scope.width-100.active:before{width:100%}.czr-scope-switcher .width-50,.czr-scope.width-50.active:after,.czr-scope.width-50.active:before{width:50%}.czr-scope-switcher .width-33,.czr-scope.width-33.active:after,.czr-scope.width-33.active:before{width:33.33%}.czr-scope-switcher .width-25,.czr-scope.width-25.active:after,.czr-scope.width-25.active:before{width:25%}.czr-scope-footer,.czr-scope-header{width:100%;min-height:16px;position:relative;z-index:5}.inactive .czr-scope-footer:after{content:'';width:100%;position:absolute;height:5px;bottom:-7px;left:0;-webkit-box-shadow:0 0 13px 4px rgba(119,119,119,.85);box-shadow:0 0 13px 4px rgba(119,119,119,.85)}.czr-scope-content{height:35px;padding:0 3%;width:94%;line-height:35px;text-align:center;clear:both;color:#000;overflow:hidden}.czr-scope-content h4{margin:0;display:inline-block;text-align:center;font-size:14px;line-height:18px;font-weight:400;text-shadow:1px 1px 0 #dedede}.czr-reset-fail,.czr-reset-success,.czr-scope-force{display:none}.czr-scope .fa{font-size:10px;padding:2%;color:#585858;cursor:pointer;-webkit-transition:opacity .3s ease-in-out;-moz-transition:opacity .3s ease-in-out;-ms-transition:opacity .3s ease-in-out;-o-transition:opacity .3s ease-in-out;transition:opacity .3s ease-in-out}.czr-scope .czr-scope-footer .info{cursor:inherit}.czr-scope-header .czr-scope-switch{font-size:22px;padding:0 2px 0 0;text-shadow:1px 1px 2px #fff}.czr-skp-switch-link{cursor:pointer}.czr-skp-switch-link:hover{text-decoration:underline}.czr-pull-left{float:left}.czr-pull-right{float:right}.active .czr-scope-switch{color:#52ff3f;cursor:inherit}.czr-scope .czr-scope-reset{display:none;font-size:13px;text-shadow:1px 1px 0 #dedede}.has-db-val .czr-scope-reset{color:#00a0d2}.dirty .czr-scope-reset{color:#FFBD2E!important}.is_winner .czr-scope-winner{color:#52ff3f;font-size:14px;position:absolute;bottom:2px;left:2px}.czr-scope-switcher .czr-skope-switch,.czr-skope-notice .czr-skope-switch{cursor:pointer;text-decoration:underline}.czr-spinner{background:url(img/czr-spinner.gif) no-repeat;-webkit-background-size:32px 32px;background-size:32px 32px;display:inline-block;float:right;vertical-align:middle;opacity:.7;filter:alpha(opacity=70);width:32px;height:32px;margin:4px 10px 0}.customize-control span.customize-control-title:first-child{padding-left:16px;-webkit-transition:left,right,.15s ease-in-out;-moz-transition:left,right,.15s ease-in-out;-ms-transition:left,right,.15s ease-in-out;-o-transition:left,right,.15s ease-in-out;transition:left,right,.15s ease-in-out;position:relative}.wp-customizer .customize-control.czr-not-skoped .customize-control-title{padding-left:0}#czr-skope-pane,#czr-top-note{padding:2%;z-index:20;text-align:center;position:absolute}.czr-setting-reset{color:#eee;-webkit-transition:color .4s;transition:color .4s;position:absolute;left:0;line-height:21px;display:none;text-shadow:1px 1px 0 #a0a0a0}#czr-top-note,.czr-resetting-control .czr-remove-alert-wrapper{-moz-transition:all,.3s ease-in-out;-ms-transition:all,.3s ease-in-out;-o-transition:all,.3s ease-in-out}.czr-global-skope-level .is-wp-authorized-setting.has-db-val .czr-setting-reset{color:#eee}.has-db-val .czr-setting-reset{color:#00a0d2}.is-dirty .czr-setting-reset{color:#FFBD2E!important}.czr-ctrl-reset-warning .czr-spinner{display:none}#czr-top-note,.czr-resetting-control .czr-ctrl-reset-warning .czr-spinner{display:block}.is-dirty .czr-remove-alert-wrapper{background-color:rgba(255,189,46,.54)!important;border:1px solid #FFBD2E!important;text-shadow:none;color:#000}.has-db-val .czr-remove-alert-wrapper{background-color:rgba(0,160,210,.45);border:1px solid #00a0d2;text-shadow:none;color:#000}#czr-skope-pane,#czr-skope-pane h2,#czr-top-note,#czr-top-note a{color:#fff}.czr-resetting-control .czr-remove-alert-wrapper{-webkit-transition:all,.3s ease-in-out;transition:all,.3s ease-in-out}body.czr-skop-loading #czr-skope-pane{top:0}body.czr-skop-loading #customize-preview{opacity:0!important}@-webkit-keyframes czr-mr-loader{0%{-webkit-transform:scale(.1);transform:scale(.1);opacity:1}70%{-webkit-transform:scale(1);transform:scale(1);opacity:.7}100%{opacity:0}}@keyframes czr-mr-loader{0%{-webkit-transform:scale(.1);transform:scale(.1);opacity:1}70%{-webkit-transform:scale(1);transform:scale(1);opacity:.7}100%{opacity:0}}.czr-css-loader{width:50px;height:50px;position:absolute;-webkit-transform:translate3d(-50%,-50%,0);-ms-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0);top:50%;left:50%;display:block}.czr-mr-loader>div:nth-child(0){-webkit-animation-delay:-.8s;animation-delay:-.8s}.czr-mr-loader>div:nth-child(1){-webkit-animation-delay:-.6s;animation-delay:-.6s}.czr-mr-loader>div:nth-child(2){-webkit-animation-delay:-.4s;animation-delay:-.4s}.czr-mr-loader>div:nth-child(3){-webkit-animation-delay:-.2s;animation-delay:-.2s}.czr-mr-loader>div{position:absolute;top:-4%;left:-4%;width:100%;height:100%;border-radius:100%;border:2px solid #fff;-webkit-animation:czr-mr-loader 1.25s 0s infinite cubic-bezier(.21,.53,.56,.8);animation:czr-mr-loader 1.25s 0s infinite cubic-bezier(.21,.53,.56,.8)}#czr-top-note{top:-100%;right:0;left:0;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out;background:rgba(0,0,0,.8)}#czr-top-note h2{color:#fff;font-size:25px}#czr-top-note .czr-top-note-close{position:absolute;top:10px;right:25px;font-size:31px;cursor:pointer}#czr-top-note .fa-arrow-left{position:absolute;bottom:10px;left:25px;font-size:40px}#czr-top-note .czr-note-content{display:inline-block;line-height:20px;width:80%}#czr-top-note .czr-note-message{font-size:16px;line-height:20px}body.czr-top-note-open #czr-top-note{top:0;visibility:inherit}#czr-skope-pane{min-height:100%;top:-100%;right:0;left:0;display:block;-webkit-transition:all .3s ease-in-out;-moz-transition:all,.3s ease-in-out;-ms-transition:all,.3s ease-in-out;-o-transition:all,.3s ease-in-out;transition:all .3s ease-in-out;visibility:hidden}#czr-skope-pane.dirty-reset{background:rgba(252,173,6,.23)}#czr-skope-pane.db-reset{background:rgba(0,160,210,.3)}.czr-reset-content{display:inline-block;line-height:20px;width:80%;padding:5%;background:rgba(0,0,0,.63)}body.czr-skope-pane-open #czr-skope-pane{top:0;visibility:inherit;min-height:100%}body.czr-skope-pane-open #customize-preview,body.czr-skope-pane-open .wp-full-overlay-sidebar{opacity:.5}body.czr-resetting-skope #czr-skope-pane .czr-spinner-wrapper{visibility:visible}.czr-skope-pane-open .wp-full-overlay.collapsed .wp-full-overlay-sidebar{z-index:30}.czr-skope-pane-open .wp-full-overlay.expanded .collapse-sidebar{bottom:0!important}.customize-control .czr-skope-notice{color:#357315}.czr-toggle-notice{color:#95a5a6;text-shadow:1px 1px 0 #fff;-webkit-transition:color .4s;transition:color .4s;position:absolute;padding-left:3px;line-height:21px;display:none}.czr-notice-visible .czr-toggle-notice,.czr-toggle-notice:hover{color:#357315}.wp-full-overlay-header,.wp-full-overlay-sidebar .wp-full-overlay-sidebar-content{-webkit-transition:height,top,.4s ease-in-out;-moz-transition:height,top,.4s ease-in-out;-ms-transition:height,top,.4s ease-in-out;-o-transition:height,top,.4s ease-in-out;transition:height,top,.4s ease-in-out}.czr-server-notice{width:calc(96% - 2px);bottom:75px;text-align:center;background:rgba(0,156,0,.18);color:#000;display:none;position:absolute;font-size:12px;line-height:13px;padding:2%;overflow:hidden}.czr-server-notice.czr-server-error{color:#000;background:rgba(255,0,0,.24)}.czr-dismiss-notification{position:absolute;right:5px;top:5px;cursor:pointer}.wp-customizer .icheckbox_flat-grey,.wp-customizer .iradio_flat-grey{border:1px solid #fff;-webkit-border-radius:5px;border-radius:5px;background-color:#fff}.czr-painted{-webkit-transition:background .3s ease-in-out!important;-moz-transition:background .3s ease-in-out!important;-ms-transition:background .3s ease-in-out!important;-o-transition:background .3s ease-in-out!important;transition:background .3s ease-in-out!important}
assets/czr/css/img/czr-spinner.gif ADDED
Binary file
assets/czr/css/img/fs-sprite.png ADDED
Binary file
assets/czr/css/img/green.png ADDED
Binary file
assets/czr/css/img/green@2x.png ADDED
Binary file
assets/czr/css/img/grey.png ADDED
Binary file
assets/czr/css/img/grey@2x.png ADDED
Binary file
assets/czr/css/img/jquery.fs.selecter-arrow.png ADDED
Binary file
assets/czr/css/img/jquery.fs.stepper-arrows.png ADDED
Binary file
assets/czr/css/lib/select2.css ADDED
@@ -0,0 +1,482 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .select2-container {
2
+ box-sizing: border-box;
3
+ display: inline-block;
4
+ margin: 0;
5
+ position: relative;
6
+ vertical-align: middle; }
7
+ .select2-container .select2-selection--single {
8
+ box-sizing: border-box;
9
+ cursor: pointer;
10
+ display: block;
11
+ height: 28px;
12
+ user-select: none;
13
+ -webkit-user-select: none; }
14
+ .select2-container .select2-selection--single .select2-selection__rendered {
15
+ display: block;
16
+ padding-left: 8px;
17
+ padding-right: 20px;
18
+ overflow: hidden;
19
+ text-overflow: ellipsis;
20
+ white-space: nowrap; }
21
+ .select2-container .select2-selection--single .select2-selection__clear {
22
+ position: relative; }
23
+ .select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
24
+ padding-right: 8px;
25
+ padding-left: 20px; }
26
+ .select2-container .select2-selection--multiple {
27
+ box-sizing: border-box;
28
+ cursor: pointer;
29
+ display: block;
30
+ min-height: 32px;
31
+ user-select: none;
32
+ -webkit-user-select: none; }
33
+ .select2-container .select2-selection--multiple .select2-selection__rendered {
34
+ display: inline-block;
35
+ overflow: hidden;
36
+ padding-left: 8px;
37
+ text-overflow: ellipsis;
38
+ white-space: nowrap; }
39
+ .select2-container .select2-search--inline {
40
+ float: left; }
41
+ .select2-container .select2-search--inline .select2-search__field {
42
+ box-sizing: border-box;
43
+ border: none;
44
+ font-size: 100%;
45
+ margin-top: 5px;
46
+ padding: 0; }
47
+ .select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button {
48
+ -webkit-appearance: none; }
49
+
50
+ .select2-dropdown {
51
+ background-color: white;
52
+ border: 1px solid #aaa;
53
+ border-radius: 4px;
54
+ box-sizing: border-box;
55
+ display: block;
56
+ position: absolute;
57
+ left: -100000px;
58
+ width: 100%;
59
+ z-index: 1051; }
60
+
61
+ .select2-results {
62
+ display: block; }
63
+
64
+ .select2-results__options {
65
+ list-style: none;
66
+ margin: 0;
67
+ padding: 0; }
68
+
69
+ .select2-results__option {
70
+ padding: 6px;
71
+ user-select: none;
72
+ -webkit-user-select: none; }
73
+ .select2-results__option[aria-selected] {
74
+ cursor: pointer; }
75
+
76
+ .select2-container--open .select2-dropdown {
77
+ left: 0; }
78
+
79
+ .select2-container--open .select2-dropdown--above {
80
+ border-bottom: none;
81
+ border-bottom-left-radius: 0;
82
+ border-bottom-right-radius: 0; }
83
+
84
+ .select2-container--open .select2-dropdown--below {
85
+ border-top: none;
86
+ border-top-left-radius: 0;
87
+ border-top-right-radius: 0; }
88
+
89
+ .select2-search--dropdown {
90
+ display: block;
91
+ padding: 4px; }
92
+ .select2-search--dropdown .select2-search__field {
93
+ padding: 4px;
94
+ width: 100%;
95
+ box-sizing: border-box; }
96
+ .select2-search--dropdown .select2-search__field::-webkit-search-cancel-button {
97
+ -webkit-appearance: none; }
98
+ .select2-search--dropdown.select2-search--hide {
99
+ display: none; }
100
+
101
+ .select2-close-mask {
102
+ border: 0;
103
+ margin: 0;
104
+ padding: 0;
105
+ display: block;
106
+ position: fixed;
107
+ left: 0;
108
+ top: 0;
109
+ min-height: 100%;
110
+ min-width: 100%;
111
+ height: auto;
112
+ width: auto;
113
+ opacity: 0;
114
+ z-index: 99;
115
+ background-color: #fff;
116
+ filter: alpha(opacity=0); }
117
+
118
+ .select2-hidden-accessible {
119
+ border: 0 !important;
120
+ clip: rect(0 0 0 0) !important;
121
+ height: 1px !important;
122
+ margin: -1px !important;
123
+ overflow: hidden !important;
124
+ padding: 0 !important;
125
+ position: absolute !important;
126
+ width: 1px !important; }
127
+
128
+ .select2-container--default .select2-selection--single {
129
+ background-color: #fff;
130
+ border: 1px solid #aaa;
131
+ border-radius: 4px; }
132
+ .select2-container--default .select2-selection--single .select2-selection__rendered {
133
+ color: #444;
134
+ line-height: 28px; }
135
+ .select2-container--default .select2-selection--single .select2-selection__clear {
136
+ cursor: pointer;
137
+ float: right;
138
+ font-weight: bold; }
139
+ .select2-container--default .select2-selection--single .select2-selection__placeholder {
140
+ color: #999; }
141
+ .select2-container--default .select2-selection--single .select2-selection__arrow {
142
+ height: 26px;
143
+ position: absolute;
144
+ top: 1px;
145
+ right: 1px;
146
+ width: 20px; }
147
+ .select2-container--default .select2-selection--single .select2-selection__arrow b {
148
+ border-color: #888 transparent transparent transparent;
149
+ border-style: solid;
150
+ border-width: 5px 4px 0 4px;
151
+ height: 0;
152
+ left: 50%;
153
+ margin-left: -4px;
154
+ margin-top: -2px;
155
+ position: absolute;
156
+ top: 50%;
157
+ width: 0; }
158
+
159
+ .select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear {
160
+ float: left; }
161
+
162
+ .select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow {
163
+ left: 1px;
164
+ right: auto; }
165
+
166
+ .select2-container--default.select2-container--disabled .select2-selection--single {
167
+ background-color: #eee;
168
+ cursor: default; }
169
+ .select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear {
170
+ display: none; }
171
+
172
+ .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
173
+ border-color: transparent transparent #888 transparent;
174
+ border-width: 0 4px 5px 4px; }
175
+
176
+ .select2-container--default .select2-selection--multiple {
177
+ background-color: white;
178
+ border: 1px solid #aaa;
179
+ border-radius: 4px;
180
+ cursor: text; }
181
+ .select2-container--default .select2-selection--multiple .select2-selection__rendered {
182
+ box-sizing: border-box;
183
+ list-style: none;
184
+ margin: 0;
185
+ padding: 0 5px;
186
+ width: 100%; }
187
+ .select2-container--default .select2-selection--multiple .select2-selection__placeholder {
188
+ color: #999;
189
+ margin-top: 5px;
190
+ float: left; }
191
+ .select2-container--default .select2-selection--multiple .select2-selection__clear {
192
+ cursor: pointer;
193
+ float: right;
194
+ font-weight: bold;
195
+ margin-top: 5px;
196
+ margin-right: 10px; }
197
+ .select2-container--default .select2-selection--multiple .select2-selection__choice {
198
+ background-color: #e4e4e4;
199
+ border: 1px solid #aaa;
200
+ border-radius: 4px;
201
+ cursor: default;
202
+ float: left;
203
+ margin-right: 5px;
204
+ margin-top: 5px;
205
+ padding: 0 5px; }
206
+ .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
207
+ color: #999;
208
+ cursor: pointer;
209
+ display: inline-block;
210
+ font-weight: bold;
211
+ margin-right: 2px; }
212
+ .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
213
+ color: #333; }
214
+
215
+ .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline {
216
+ float: right; }
217
+
218
+ .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
219
+ margin-left: 5px;
220
+ margin-right: auto; }
221
+
222
+ .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
223
+ margin-left: 2px;
224
+ margin-right: auto; }
225
+
226
+ .select2-container--default.select2-container--focus .select2-selection--multiple {
227
+ border: solid black 1px;
228
+ outline: 0; }
229
+
230
+ .select2-container--default.select2-container--disabled .select2-selection--multiple {
231
+ background-color: #eee;
232
+ cursor: default; }
233
+
234
+ .select2-container--default.select2-container--disabled .select2-selection__choice__remove {
235
+ display: none; }
236
+
237
+ .select2-container--default.select2-container--open.select2-container--above .select2-selection--single, .select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple {
238
+ border-top-left-radius: 0;
239
+ border-top-right-radius: 0; }
240
+
241
+ .select2-container--default.select2-container--open.select2-container--below .select2-selection--single, .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
242
+ border-bottom-left-radius: 0;
243
+ border-bottom-right-radius: 0; }
244
+
245
+ .select2-container--default .select2-search--dropdown .select2-search__field {
246
+ border: 1px solid #aaa; }
247
+
248
+ .select2-container--default .select2-search--inline .select2-search__field {
249
+ background: transparent;
250
+ border: none;
251
+ outline: 0;
252
+ box-shadow: none;
253
+ -webkit-appearance: textfield; }
254
+
255
+ .select2-container--default .select2-results > .select2-results__options {
256
+ max-height: 200px;
257
+ overflow-y: auto; }
258
+
259
+ .select2-container--default .select2-results__option[role=group] {
260
+ padding: 0; }
261
+
262
+ .select2-container--default .select2-results__option[aria-disabled=true] {
263
+ color: #999; }
264
+
265
+ .select2-container--default .select2-results__option[aria-selected=true] {
266
+ background-color: #ddd; }
267
+
268
+ .select2-container--default .select2-results__option .select2-results__option {
269
+ padding-left: 1em; }
270
+ .select2-container--default .select2-results__option .select2-results__option .select2-results__group {
271
+ padding-left: 0; }
272
+ .select2-container--default .select2-results__option .select2-results__option .select2-results__option {
273
+ margin-left: -1em;
274
+ padding-left: 2em; }
275
+ .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
276
+ margin-left: -2em;
277
+ padding-left: 3em; }
278
+ .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
279
+ margin-left: -3em;
280
+ padding-left: 4em; }
281
+ .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
282
+ margin-left: -4em;
283
+ padding-left: 5em; }
284
+ .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
285
+ margin-left: -5em;
286
+ padding-left: 6em; }
287
+
288
+ .select2-container--default .select2-results__option--highlighted[aria-selected] {
289
+ background-color: #5897fb;
290
+ color: white; }
291
+
292
+ .select2-container--default .select2-results__group {
293
+ cursor: default;
294
+ display: block;
295
+ padding: 6px; }
296
+
297
+ .select2-container--classic .select2-selection--single {
298
+ background-color: #f7f7f7;
299
+ border: 1px solid #aaa;
300
+ border-radius: 4px;
301
+ outline: 0;
302
+ background-image: -webkit-linear-gradient(top, white 50%, #eeeeee 100%);
303
+ background-image: -o-linear-gradient(top, white 50%, #eeeeee 100%);
304
+ background-image: linear-gradient(to bottom, white 50%, #eeeeee 100%);
305
+ background-repeat: repeat-x;
306
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
307
+ .select2-container--classic .select2-selection--single:focus {
308
+ border: 1px solid #5897fb; }
309
+ .select2-container--classic .select2-selection--single .select2-selection__rendered {
310
+ color: #444;
311
+ line-height: 28px; }
312
+ .select2-container--classic .select2-selection--single .select2-selection__clear {
313
+ cursor: pointer;
314
+ float: right;
315
+ font-weight: bold;
316
+ margin-right: 10px; }
317
+ .select2-container--classic .select2-selection--single .select2-selection__placeholder {
318
+ color: #999; }
319
+ .select2-container--classic .select2-selection--single .select2-selection__arrow {
320
+ background-color: #ddd;
321
+ border: none;
322
+ border-left: 1px solid #aaa;
323
+ border-top-right-radius: 4px;
324
+ border-bottom-right-radius: 4px;
325
+ height: 26px;
326
+ position: absolute;
327
+ top: 1px;
328
+ right: 1px;
329
+ width: 20px;
330
+ background-image: -webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
331
+ background-image: -o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
332
+ background-image: linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);
333
+ background-repeat: repeat-x;
334
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0); }
335
+ .select2-container--classic .select2-selection--single .select2-selection__arrow b {
336
+ border-color: #888 transparent transparent transparent;
337
+ border-style: solid;
338
+ border-width: 5px 4px 0 4px;
339
+ height: 0;
340
+ left: 50%;
341
+ margin-left: -4px;
342
+ margin-top: -2px;
343
+ position: absolute;
344
+ top: 50%;
345
+ width: 0; }
346
+
347
+ .select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear {
348
+ float: left; }
349
+
350
+ .select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow {
351
+ border: none;
352
+ border-right: 1px solid #aaa;
353
+ border-radius: 0;
354
+ border-top-left-radius: 4px;
355
+ border-bottom-left-radius: 4px;
356
+ left: 1px;
357
+ right: auto; }
358
+
359
+ .select2-container--classic.select2-container--open .select2-selection--single {
360
+ border: 1px solid #5897fb; }
361
+ .select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow {
362
+ background: transparent;
363
+ border: none; }
364
+ .select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b {
365
+ border-color: transparent transparent #888 transparent;
366
+ border-width: 0 4px 5px 4px; }
367
+
368
+ .select2-container--classic.select2-container--open.select2-container--above .select2-selection--single {
369
+ border-top: none;
370
+ border-top-left-radius: 0;
371
+ border-top-right-radius: 0;
372
+ background-image: -webkit-linear-gradient(top, white 0%, #eeeeee 50%);
373
+ background-image: -o-linear-gradient(top, white 0%, #eeeeee 50%);
374
+ background-image: linear-gradient(to bottom, white 0%, #eeeeee 50%);
375
+ background-repeat: repeat-x;
376
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
377
+
378
+ .select2-container--classic.select2-container--open.select2-container--below .select2-selection--single {
379
+ border-bottom: none;
380
+ border-bottom-left-radius: 0;
381
+ border-bottom-right-radius: 0;
382
+ background-image: -webkit-linear-gradient(top, #eeeeee 50%, white 100%);
383
+ background-image: -o-linear-gradient(top, #eeeeee 50%, white 100%);
384
+ background-image: linear-gradient(to bottom, #eeeeee 50%, white 100%);
385
+ background-repeat: repeat-x;
386
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0); }
387
+
388
+ .select2-container--classic .select2-selection--multiple {
389
+ background-color: white;
390
+ border: 1px solid #aaa;
391
+ border-radius: 4px;
392
+ cursor: text;
393
+ outline: 0; }
394
+ .select2-container--classic .select2-selection--multiple:focus {
395
+ border: 1px solid #5897fb; }
396
+ .select2-container--classic .select2-selection--multiple .select2-selection__rendered {
397
+ list-style: none;
398
+ margin: 0;
399
+ padding: 0 5px; }
400
+ .select2-container--classic .select2-selection--multiple .select2-selection__clear {
401
+ display: none; }
402
+ .select2-container--classic .select2-selection--multiple .select2-selection__choice {
403
+ background-color: #e4e4e4;
404
+ border: 1px solid #aaa;
405
+ border-radius: 4px;
406
+ cursor: default;
407
+ float: left;
408
+ margin-right: 5px;
409
+ margin-top: 5px;
410
+ padding: 0 5px; }
411
+ .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove {
412
+ color: #888;
413
+ cursor: pointer;
414
+ display: inline-block;
415
+ font-weight: bold;
416
+ margin-right: 2px; }
417
+ .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover {
418
+ color: #555; }
419
+
420
+ .select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
421
+ float: right; }
422
+
423
+ .select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
424
+ margin-left: 5px;
425
+ margin-right: auto; }
426
+
427
+ .select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
428
+ margin-left: 2px;
429
+ margin-right: auto; }
430
+
431
+ .select2-container--classic.select2-container--open .select2-selection--multiple {
432
+ border: 1px solid #5897fb; }
433
+
434
+ .select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple {
435
+ border-top: none;
436
+ border-top-left-radius: 0;
437
+ border-top-right-radius: 0; }
438
+
439
+ .select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple {
440
+ border-bottom: none;
441
+ border-bottom-left-radius: 0;
442
+ border-bottom-right-radius: 0; }
443
+
444
+ .select2-container--classic .select2-search--dropdown .select2-search__field {
445
+ border: 1px solid #aaa;
446
+ outline: 0; }
447
+
448
+ .select2-container--classic .select2-search--inline .select2-search__field {
449
+ outline: 0;
450
+ box-shadow: none; }
451
+
452
+ .select2-container--classic .select2-dropdown {
453
+ background-color: white;
454
+ border: 1px solid transparent; }
455
+
456
+ .select2-container--classic .select2-dropdown--above {
457
+ border-bottom: none; }
458
+
459
+ .select2-container--classic .select2-dropdown--below {
460
+ border-top: none; }
461
+
462
+ .select2-container--classic .select2-results > .select2-results__options {
463
+ max-height: 200px;
464
+ overflow-y: auto; }
465
+
466
+ .select2-container--classic .select2-results__option[role=group] {
467
+ padding: 0; }
468
+
469
+ .select2-container--classic .select2-results__option[aria-disabled=true] {
470
+ color: grey; }
471
+
472
+ .select2-container--classic .select2-results__option--highlighted[aria-selected] {
473
+ background-color: #3875d7;
474
+ color: white; }
475
+
476
+ .select2-container--classic .select2-results__group {
477
+ cursor: default;
478
+ display: block;
479
+ padding: 6px; }
480
+
481
+ .select2-container--classic.select2-container--open .select2-dropdown {
482
+ border-color: #5897fb; }
assets/czr/css/lib/select2.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid #000 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
assets/czr/js/czr-control.js ADDED
@@ -0,0 +1,9828 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! addEventListener Polyfill ie9- http://stackoverflow.com/a/27790212*/
2
+ window.addEventListener=window.addEventListener||function(a,b){window.attachEvent("on"+a,b)},/*! Datenow Polyfill ie9- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now */
3
+ Date.now||(Date.now=function(){return(new Date).getTime()}),/*! Object.create monkey patch ie8 http://stackoverflow.com/a/18020326 */
4
+ Object.create||(Object.create=function(a,b){function c(){}if("undefined"!=typeof b)throw"The multiple-argument version of Object.create is not provided by this browser and cannot be shimmed.";return c.prototype=a,new c}),/*! https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter */
5
+ Array.prototype.filter||(Array.prototype.filter=function(a){"use strict";if(void 0===this||null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if("function"!=typeof a)throw new TypeError;for(var d=[],e=arguments.length>=2?arguments[1]:void 0,f=0;f<c;f++)if(f in b){var g=b[f];a.call(e,g,f,b)&&d.push(g)}return d}),/*! map was added to the ECMA-262 standard in the 5th edition */
6
+ Array.prototype.map||(Array.prototype.map=function(a,b){var c,d,e;if(null===this)throw new TypeError(" this is null or not defined");var f=Object(this),g=f.length>>>0;if("function"!=typeof a)throw new TypeError(a+" is not a function");for(arguments.length>1&&(c=b),d=new Array(g),e=0;e<g;){var h,i;e in f&&(h=f[e],i=a.call(c,h,e,f),d[e]=i),e++}return d});/*! iCheck v1.0.1 by Damir Sultanov, http://git.io/arlzeA, MIT Licensed */
7
+ if ( 'function' != typeof(jQuery.fn.iCheck) ) {
8
+ !function(a){function b(a,b,e){var f=a[0],g=/er/.test(e)?p:/bl/.test(e)?n:l,h=e==q?{checked:f[l],disabled:f[n],indeterminate:"true"==a.attr(p)||"false"==a.attr(o)}:f[g];if(/^(ch|di|in)/.test(e)&&!h)c(a,g);else if(/^(un|en|de)/.test(e)&&h)d(a,g);else if(e==q)for(g in h)h[g]?c(a,g,!0):d(a,g,!0);else b&&"toggle"!=e||(b||a[u]("ifClicked"),h?f[r]!==k&&d(a,g):c(a,g))}function c(b,c,e){var q=b[0],u=b.parent(),v=c==l,x=c==p,y=c==n,z=x?o:v?m:"enabled",A=f(b,z+g(q[r])),B=f(b,c+g(q[r]));if(!0!==q[c]){if(!e&&c==l&&q[r]==k&&q.name){var C=b.closest("form"),D='input[name="'+q.name+'"]',D=C.length?C.find(D):a(D);D.each(function(){this!==q&&a(this).data(i)&&d(a(this),c)})}x?(q[c]=!0,q[l]&&d(b,l,"force")):(e||(q[c]=!0),v&&q[p]&&d(b,p,!1)),h(b,v,c,e)}q[n]&&f(b,w,!0)&&u.find("."+j).css(w,"default"),u[s](B||f(b,c)||""),y?u.attr("aria-disabled","true"):u.attr("aria-checked",x?"mixed":"true"),u[t](A||f(b,z)||"")}function d(a,b,c){var d=a[0],e=a.parent(),i=b==l,k=b==p,q=b==n,u=k?o:i?m:"enabled",v=f(a,u+g(d[r])),x=f(a,b+g(d[r]));!1!==d[b]&&((k||!c||"force"==c)&&(d[b]=!1),h(a,i,u,c)),!d[n]&&f(a,w,!0)&&e.find("."+j).css(w,"pointer"),e[t](x||f(a,b)||""),q?e.attr("aria-disabled","false"):e.attr("aria-checked","false"),e[s](v||f(a,u)||"")}function e(b,c){b.data(i)&&(b.parent().html(b.attr("style",b.data(i).s||"")),c&&b[u](c),b.off(".i").unwrap(),a(v+'[for="'+b[0].id+'"]').add(b.closest(v)).off(".i"))}function f(a,b,c){return a.data(i)?a.data(i).o[b+(c?"":"Class")]:void 0}function g(a){return a.charAt(0).toUpperCase()+a.slice(1)}function h(a,b,c,d){d||(b&&a[u]("ifToggled"),a[u]("ifChanged")[u]("if"+g(c)))}var i="iCheck",j=i+"-helper",k="radio",l="checked",m="un"+l,n="disabled",o="determinate",p="in"+o,q="update",r="type",s="addClass",t="removeClass",u="trigger",v="label",w="cursor",x=/ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent);a.fn[i]=function(f,g){var h='input[type="checkbox"], input[type="'+k+'"]',m=a(),o=function(b){b.each(function(){var b=a(this);m=b.is(h)?m.add(b):m.add(b.find(h))})};if(/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(f))return f=f.toLowerCase(),o(this),m.each(function(){var c=a(this);"destroy"==f?e(c,"ifDestroyed"):b(c,!0,f),a.isFunction(g)&&g()});if("object"!=typeof f&&f)return this;var w=a.extend({checkedClass:l,disabledClass:n,indeterminateClass:p,labelHover:!0,aria:!1},f),y=w.handle,z=w.hoverClass||"hover",A=w.focusClass||"focus",B=w.activeClass||"active",C=!!w.labelHover,D=w.labelHoverClass||"hover",E=0|(""+w.increaseArea).replace("%","");return("checkbox"==y||y==k)&&(h='input[type="'+y+'"]'),-50>E&&(E=-50),o(this),m.each(function(){var f=a(this);e(f);var g=this,h=g.id,m=-E+"%",o=100+2*E+"%",o={position:"absolute",top:m,left:m,display:"block",width:o,height:o,margin:0,padding:0,background:"#fff",border:0,opacity:0},m=x?{position:"absolute",visibility:"hidden"}:E?o:{position:"absolute",opacity:0},p="checkbox"==g[r]?w.checkboxClass||"icheckbox":w.radioClass||"i"+k,y=a(v+'[for="'+h+'"]').add(f.closest(v)),F=!!w.aria,G=i+"-"+Math.random().toString(36).substr(2,6),H='<div class="'+p+'" '+(F?'role="'+g[r]+'" ':"");F&&y.each(function(){H+='aria-labelledby="',this.id?H+=this.id:(this.id=G,H+=G),H+='"'}),H=f.wrap(H+"/>")[u]("ifCreated").parent().append(w.insert),o=a('<ins class="'+j+'"/>').css(o).appendTo(H),f.data(i,{o:w,s:f.attr("style")}).css(m),w.inheritClass&&H[s](g.className||""),w.inheritID&&h&&H.attr("id",i+"-"+h),"static"==H.css("position")&&H.css("position","relative"),b(f,!0,q),y.length&&y.on("click.i mouseover.i mouseout.i touchbegin.i touchend.i",function(c){var d=c[r],e=a(this);if(!g[n]){if("click"==d){if(a(c.target).is("a"))return;b(f,!1,!0)}else C&&(/ut|nd/.test(d)?(H[t](z),e[t](D)):(H[s](z),e[s](D)));if(!x)return!1;c.stopPropagation()}}),f.on("click.i focus.i blur.i keyup.i keydown.i keypress.i",function(a){var b=a[r];return a=a.keyCode,"click"==b?!1:"keydown"==b&&32==a?(g[r]==k&&g[l]||(g[l]?d(f,l):c(f,l)),!1):("keyup"==b&&g[r]==k?!g[l]&&c(f,l):/us|ur/.test(b)&&H["blur"==b?t:s](A),void 0)}),o.on("click mousedown mouseup mouseover mouseout touchbegin.i touchend.i",function(a){var c=a[r],d=/wn|up/.test(c)?B:z;if(!g[n]){if("click"==c?b(f,!1,!0):(/wn|er|in/.test(c)?H[s](d):H[t](d+" "+B),y.length&&C&&d==z&&y[/ut|nd/.test(c)?t:s](D)),!x)return!1;a.stopPropagation()}})})}}(window.jQuery||window.Zepto);
9
+ }
10
+ if ( 'function' != typeof(jQuery.fn.selecter) ) {
11
+ !function(a,b){"use strict";function c(b){b=a.extend({},x,b||{}),null===w&&(w=a("body"));for(var c=a(this),e=0,f=c.length;f>e;e++)d(c.eq(e),b);return c}function d(b,c){if(!b.hasClass("selecter-element")){c=a.extend({},c,b.data("selecter-options")),c.external&&(c.links=!0);var d=b.find("option, optgroup"),g=d.filter("option"),h=g.filter(":selected"),n=""!==c.label?-1:g.index(h),p=c.links?"nav":"div";c.tabIndex=b[0].tabIndex,b[0].tabIndex=-1,c.multiple=b.prop("multiple"),c.disabled=b.is(":disabled");var q="<"+p+' class="selecter '+c.customClass;v?q+=" mobile":c.cover&&(q+=" cover"),q+=c.multiple?" multiple":" closed",c.disabled&&(q+=" disabled"),q+='" tabindex="'+c.tabIndex+'">',c.multiple||(q+='<span class="selecter-selected'+(""!==c.label?" placeholder":"")+'">',q+=a("<span></span").text(r(""!==c.label?c.label:h.text(),c.trim)).html(),q+="</span>"),q+='<div class="selecter-options">',q+="</div>",q+="</"+p+">",b.addClass("selecter-element").after(q);var s=b.next(".selecter"),u=a.extend({$select:b,$allOptions:d,$options:g,$selecter:s,$selected:s.find(".selecter-selected"),$itemsWrapper:s.find(".selecter-options"),index:-1,guid:t++},c);e(u),o(n,u),void 0!==a.fn.scroller&&u.$itemsWrapper.scroller(),u.$selecter.on("touchstart.selecter click.selecter",".selecter-selected",u,f).on("click.selecter",".selecter-item",u,j).on("close.selecter",u,i).data("selecter",u),u.$select.on("change.selecter",u,k),v||(u.$selecter.on("focus.selecter",u,l).on("blur.selecter",u,m),u.$select.on("focus.selecter",u,function(a){a.data.$selecter.trigger("focus")}))}}function e(b){for(var c="",d=b.links?"a":"span",e=0,f=0,g=b.$allOptions.length;g>f;f++){var h=b.$allOptions.eq(f);if("OPTGROUP"===h[0].tagName)c+='<span class="selecter-group',h.is(":disabled")&&(c+=" disabled"),c+='">'+h.attr("label")+"</span>";else{var i=h.val();h.attr("value")||h.attr("value",i),c+="<"+d+' class="selecter-item',h.is(":selected")&&""===b.label&&(c+=" selected"),h.is(":disabled")&&(c+=" disabled"),c+='" ',c+=b.links?'href="'+i+'"':'data-value="'+i+'"',c+=">"+a("<span></span>").text(r(h.text(),b.trim)).html()+"</"+d+">",e++}}b.$itemsWrapper.html(c),b.$items=b.$selecter.find(".selecter-item")}function f(c){c.preventDefault(),c.stopPropagation();var d=c.data;if(!d.$select.is(":disabled"))if(a(".selecter").not(d.$selecter).trigger("close.selecter",[d]),v){var e=d.$select[0];if(b.document.createEvent){var f=b.document.createEvent("MouseEvents");f.initMouseEvent("mousedown",!1,!0,b,0,0,0,0,0,!1,!1,!1,!1,0,null),e.dispatchEvent(f)}else e.fireEvent&&e.fireEvent("onmousedown")}else d.$selecter.hasClass("closed")?g(c):d.$selecter.hasClass("open")&&i(c)}function g(b){b.preventDefault(),b.stopPropagation();var c=b.data;if(!c.$selecter.hasClass("open")){var d=c.$selecter.offset(),e=w.outerHeight(),f=c.$itemsWrapper.outerHeight(!0),g=c.index>=0?c.$items.eq(c.index).position():{left:0,top:0};d.top+f>e&&c.$selecter.addClass("bottom"),c.$itemsWrapper.show(),c.$selecter.removeClass("closed").addClass("open"),w.on("click.selecter-"+c.guid,":not(.selecter-options)",c,h),void 0!==a.fn.scroller?c.$itemsWrapper.scroller("scroll",c.$itemsWrapper.find(".scroller-content").scrollTop()+g.top,0).scroller("reset"):c.$itemsWrapper.scrollTop(c.$itemsWrapper.scrollTop()+g.top)}}function h(b){b.preventDefault(),b.stopPropagation(),0===a(b.currentTarget).parents(".selecter").length&&i(b)}function i(a){a.preventDefault(),a.stopPropagation();var b=a.data;b.$selecter.hasClass("open")&&(b.$itemsWrapper.hide(),b.$selecter.removeClass("open bottom").addClass("closed"),w.off(".selecter-"+b.guid))}function j(b){b.preventDefault(),b.stopPropagation();var c=a(this),d=b.data;if(!d.$select.is(":disabled")){if(d.$itemsWrapper.is(":visible")){var e=d.$items.index(c);o(e,d),p(d)}d.multiple||i(b)}}function k(b,c){var d=a(this),e=b.data;if(!c&&!e.multiple){var f=e.$options.index(e.$options.filter("[value='"+s(d.val())+"']"));o(f,e),p(e)}}function l(b){b.preventDefault(),b.stopPropagation();var c=b.data;c.$select.is(":disabled")||c.multiple||(c.$selecter.addClass("focus").on("keydown.selecter"+c.guid,c,n),a(".selecter").not(c.$selecter).trigger("close.selecter",[c]))}function m(b){b.preventDefault(),b.stopPropagation();var c=b.data;c.$selecter.removeClass("focus").off("keydown.selecter"+c.guid+" keyup.selecter"+c.guid),a(".selecter").not(c.$selecter).trigger("close.selecter",[c])}function n(b){var c=b.data;if(13===b.keyCode)c.$selecter.hasClass("open")&&(i(b),o(c.index,c)),p(c);else if(!(9===b.keyCode||b.metaKey||b.altKey||b.ctrlKey||b.shiftKey)){b.preventDefault(),b.stopPropagation();var d=c.$items.length-1,e=c.index<0?0:c.index;if(a.inArray(b.keyCode,u?[38,40,37,39]:[38,40])>-1)e+=38===b.keyCode||u&&37===b.keyCode?-1:1,0>e&&(e=0),e>d&&(e=d);else{var f,g,h=String.fromCharCode(b.keyCode).toUpperCase();for(g=c.index+1;d>=g;g++)if(f=c.$options.eq(g).text().charAt(0).toUpperCase(),f===h){e=g;break}if(0>e)for(g=0;d>=g;g++)if(f=c.$options.eq(g).text().charAt(0).toUpperCase(),f===h){e=g;break}}e>=0&&o(e,c)}}function o(a,b){var c=b.$items.eq(a),d=c.hasClass("selected"),e=c.hasClass("disabled");if(!e){if(-1===a&&""!==b.label)b.$selected.html(b.label);else if(d)b.multiple&&(b.$options.eq(a).prop("selected",null),c.removeClass("selected"));else{{var f=c.html();c.data("value")}b.multiple?b.$options.eq(a).prop("selected",!0):(b.$selected.html(f).removeClass("placeholder"),b.$items.filter(".selected").removeClass("selected"),b.$select[0].selectedIndex=a),c.addClass("selected")}(!d||b.multiple)&&(b.index=a)}}function p(a){a.links?q(a):(a.callback.call(a.$selecter,a.$select.val(),a.index),a.$select.trigger("change",[!0]))}function q(a){var c=a.$select.val();a.external?b.open(c):b.location.href=c}function r(a,b){return 0===b?a:a.length>b?a.substring(0,b)+"...":a}function s(a){return a.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1")}var t=0,u=b.navigator.userAgent.toLowerCase().indexOf("firefox")>-1,v=/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(b.navigator.userAgent||b.navigator.vendor||b.opera),w=null,x={callback:a.noop,cover:!1,customClass:"",label:"",external:!1,links:!1,trim:0},y={defaults:function(b){return x=a.extend(x,b||{}),a(this)},disable:function(b){return a(this).each(function(c,d){var e=a(d).next(".selecter").data("selecter");if(e)if("undefined"!=typeof b){var f=e.$items.index(e.$items.filter("[data-value="+b+"]"));e.$items.eq(f).addClass("disabled"),e.$options.eq(f).prop("disabled",!0)}else e.$selecter.hasClass("open")&&e.$selecter.find(".selecter-selected").trigger("click.selecter"),e.$selecter.addClass("disabled"),e.$select.prop("disabled",!0)})},enable:function(b){return a(this).each(function(c,d){var e=a(d).next(".selecter").data("selecter");if(e)if("undefined"!=typeof b){var f=e.$items.index(e.$items.filter("[data-value="+b+"]"));e.$items.eq(f).removeClass("disabled"),e.$options.eq(f).prop("disabled",!1)}else e.$selecter.removeClass("disabled"),e.$select.prop("disabled",!1)})},destroy:function(){return a(this).each(function(b,c){var d=a(c).next(".selecter").data("selecter");d&&(d.$selecter.hasClass("open")&&d.$selecter.find(".selecter-selected").trigger("click.selecter"),void 0!==a.fn.scroller&&d.$selecter.find(".selecter-options").scroller("destroy"),d.$select[0].tabIndex=d.tabIndex,d.$select.off(".selecter").removeClass("selecter-element").show(),d.$selecter.off(".selecter").remove())})},refresh:function(){return a(this).each(function(b,c){var d=a(c).next(".selecter").data("selecter");if(d){var f=d.index;d.$allOptions=d.$select.find("option, optgroup"),d.$options=d.$allOptions.filter("option"),d.index=-1,f=d.$options.index(d.$options.filter(":selected")),e(d),o(f,d)}})}};a.fn.selecter=function(a){return y[a]?y[a].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof a&&a?this:c.apply(this,arguments)},a.selecter=function(a){"defaults"===a&&y.defaults.apply(this,Array.prototype.slice.call(arguments,1))}}(jQuery,window);
12
+ }
13
+ if ( 'function' != typeof(jQuery.fn.stepper) ) {
14
+ !function(a){"use strict";function b(b){b=a.extend({},k,b||{});for(var d=a(this),e=0,f=d.length;f>e;e++)c(d.eq(e),b);return d}function c(b,c){if(!b.hasClass("stepper-input")){c=a.extend({},c,b.data("stepper-options"));var e=parseFloat(b.attr("min")),f=parseFloat(b.attr("max")),g=parseFloat(b.attr("step"))||1;b.addClass("stepper-input").wrap('<div class="stepper '+c.customClass+'" />').after('<span class="stepper-arrow up">'+c.labels.up+'</span><span class="stepper-arrow down">'+c.labels.down+"</span>");var h=b.parent(".stepper"),j=a.extend({$stepper:h,$input:b,$arrow:h.find(".stepper-arrow"),min:void 0===typeof e||isNaN(e)?!1:e,max:void 0===typeof f||isNaN(f)?!1:f,step:void 0===typeof g||isNaN(g)?1:g,timer:null},c);j.digits=i(j.step),b.is(":disabled")&&h.addClass("disabled"),h.on("touchstart.stepper mousedown.stepper",".stepper-arrow",j,d).data("stepper",j)}}function d(b){b.preventDefault(),b.stopPropagation(),e(b);var c=b.data;if(!c.$input.is(":disabled")&&!c.$stepper.hasClass("disabled")){var d=a(b.target).hasClass("up")?c.step:-c.step;c.timer=g(c.timer,125,function(){f(c,d,!1)}),f(c,d),a("body").on("touchend.stepper mouseup.stepper",c,e)}}function e(b){b.preventDefault(),b.stopPropagation();var c=b.data;h(c.timer),a("body").off(".stepper")}function f(a,b){var c=parseFloat(a.$input.val()),d=b;void 0===typeof c||isNaN(c)?d=a.min!==!1?a.min:0:a.min!==!1&&c<a.min?d=a.min:d+=c;var e=(d-a.min)%a.step;0!==e&&(d-=e),a.min!==!1&&d<a.min&&(d=a.min),a.max!==!1&&d>a.max&&(d-=a.step),d!==c&&(d=j(d,a.digits),a.$input.val(d).trigger("change"))}function g(a,b,c){return h(a),setInterval(c,b)}function h(a){a&&(clearInterval(a),a=null)}function i(a){var b=String(a);return b.indexOf(".")>-1?b.length-b.indexOf(".")-1:0}function j(a,b){var c=Math.pow(10,b);return Math.round(a*c)/c}var k={customClass:"",labels:{up:"Up",down:"Down"}},l={defaults:function(b){return k=a.extend(k,b||{}),a(this)},destroy:function(){return a(this).each(function(){var b=a(this).data("stepper");b&&(b.$stepper.off(".stepper").find(".stepper-arrow").remove(),b.$input.unwrap().removeClass("stepper-input"))})},disable:function(){return a(this).each(function(){var b=a(this).data("stepper");b&&(b.$input.attr("disabled","disabled"),b.$stepper.addClass("disabled"))})},enable:function(){return a(this).each(function(){var b=a(this).data("stepper");b&&(b.$input.attr("disabled",null),b.$stepper.removeClass("disabled"))})}};a.fn.stepper=function(a){return l[a]?l[a].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof a&&a?this:b.apply(this,arguments)},a.stepper=function(a){"defaults"===a&&l.defaults.apply(this,Array.prototype.slice.call(arguments,1))}}(jQuery,this);
15
+ }/*! Select2 4.0.1 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k<a.length;k+=1)if(m=a[k],"."===m)a.splice(k,1),k-=1;else if(".."===m){if(1===k&&(".."===a[2]||".."===a[0]))break;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=v.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),n.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var c=r[a];delete r[a],t[a]=!0,m.apply(b,c)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,c,d,f){var h,k,l,m,n,s,u=[],v=typeof d;if(f=f||a,"undefined"===v||"function"===v){for(c=!c.length&&d.length?["require","exports","module"]:c,n=0;n<c.length;n+=1)if(m=o(c[n],f),k=m.f,"require"===k)u[n]=p.require(a);else if("exports"===k)u[n]=p.exports(a),s=!0;else if("module"===k)h=u[n]=p.module(a);else if(e(q,k)||e(r,k)||e(t,k))u[n]=j(k);else{if(!m.p)throw new Error(a+" missing "+k);m.p.load(m.n,g(f,!0),i(k),{}),u[n]=q[k]}l=d?d.apply(q[a],u):void 0,a&&(h&&h.exports!==b&&h.exports!==q[a]?q[a]=h.exports:l===b&&s||(q[a]=l))}else a&&(q[a]=d)},a=c=n=function(a,c,d,e,f){if("string"==typeof a)return p[a]?p[a](c):j(o(a,c).f);if(!a.splice){if(s=a,s.deps&&n(s.deps,s.callback),!c)return;c.splice?(a=c,c=d,d=null):a=b}return c=c||function(){},"function"==typeof d&&(d=e,e=f),e?m(b,a,c,d):setTimeout(function(){m(b,a,c,d)},4),n},n.config=function(a){return n(a)},a._defined=q,d=function(a,b,c){if("string"!=typeof a)throw new Error("See almond README: incorrect module build, no module name");b.splice||(c=b,b=[]),e(q,a)||e(r,a)||(r[a]=[a,b,c])},d.amd={jQuery:!0}}(),b.requirejs=a,b.require=c,b.define=d}}(),b.define("almond",function(){}),b.define("jquery",[],function(){var b=a||$;return null==b&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),b}),b.define("select2/utils",["jquery"],function(a){function b(a){var b=a.prototype,c=[];for(var d in b){var e=b[d];"function"==typeof e&&"constructor"!==d&&c.push(d)}return c}var c={};c.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},c.Decorate=function(a,c){function d(){var b=Array.prototype.unshift,d=c.prototype.constructor.length,e=a.prototype.constructor;d>0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=a.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){var a=Array.prototype.unshift;return a.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var d=function(){this.listeners={}};return d.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},d.prototype.trigger=function(a){var b=Array.prototype.slice;this.listeners=this.listeners||{},a in this.listeners&&this.invoke(this.listeners[a],b.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},d.prototype.invoke=function(a,b){for(var c=0,d=a.length;d>c;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;a>c;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e<c.length;e++){var f=c[e];f=f.substring(0,1).toLowerCase()+f.substring(1),f in d||(d[f]={}),e==c.length-1&&(d[f]=a[b]),d=d[f]}delete a[b]}}return a},c.hasScroll=function(b,c){var d=a(c),e=c.style.overflowX,f=c.style.overflowY;return e!==f||"hidden"!==f&&"visible"!==f?"scroll"===e||"scroll"===f?!0:d.innerHeight()<c.scrollHeight||d.innerWidth()<c.scrollWidth:!1},c.escapeMarkup=function(a){var b={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('<li role="treeitem" aria-live="assertive" class="select2-results__option"></li>'),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c<a.results.length;c++){var d=a.results[c],e=this.option(d);b.push(e)}this.$results.append(b)},c.prototype.position=function(a,b){var c=b.find(".select2-results");c.append(a)},c.prototype.sort=function(a){var b=this.options.get("sorter");return b(a)},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()}),e=b.$results.find(".select2-results__option[aria-selected]");e.each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")});var f=e.filter("[aria-selected=true]");f.length>0?f.first().trigger("mouseenter"):e.first().trigger("mouseenter")})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j<b.children.length;j++){var k=b.children[j],l=this.option(k);i.push(l)}var m=a("<ul></ul>",{"class":"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&d.setClasses()}),b.on("unselect",function(){b.isOpen()&&d.setClasses()}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):0>h-g&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-d.$results.scrollTop()+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");return"true"===c.attr("aria-selected")?void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{})):void d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),2>=c?this.$results.scrollTop(0):(g>this.$results.outerHeight()||0>g)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},e.prototype.selectionContainer=function(){return a("<span></span>")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('<ul class="select2-selection__rendered"></ul>'),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},d.prototype.selectionContainer=function(){var b=a('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">&times;</span></li>');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d<a.length;d++){var e=a[d],f=this.selectionContainer(),g=this.display(e,f);f.append(g),f.prop("title",e.title||e.text),f.data("data",e),b.push(f)}var h=this.$selection.find(".select2-selection__rendered");c.appendMany(h,b)}},d}),b.define("select2/selection/placeholder",["../utils"],function(a){function b(a,b,c){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c)}return b.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},b.prototype.createPlaceholder=function(a,b){var c=this.selectionContainer();return c.html(this.display(b)),c.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),c},b.prototype.update=function(a,b){var c=1==b.length&&b[0].id!=this.placeholder.id,d=b.length>1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e<d.length;e++){var f={data:d[e]};if(this.trigger("unselect",f),f.prevented)return}this.$element.val(this.placeholder.id).trigger("change"),this.trigger("toggle",{})}}},c.prototype._handleKeyboardClear=function(a,c,d){d.isOpen()||(c.which==b.DELETE||c.which==b.BACKSPACE)&&this._handleClear(c)},c.prototype.update=function(b,c){if(b.call(this,c),!(this.$selection.find(".select2-selection__placeholder").length>0||0===c.length)){var d=a('<span class="select2-selection__clear">&times;</span>');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" aria-autocomplete="list" /></li>');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&11>=f;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"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","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"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","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f<a.length;f++){var g=a[f].id;-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")});else{var d=a.id;this.$element.val(d),this.$element.trigger("change")}},d.prototype.unselect=function(a){
16
+ var b=this;if(this.$element.prop("multiple"))return a.selected=!1,c(a.element).is("option")?(a.element.selected=!1,void this.$element.trigger("change")):void this.current(function(d){for(var e=[],f=0;f<d.length;f++){var g=d[f].id;g!==a.id&&-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")})},d.prototype.bind=function(a,b){var c=this;this.container=a,a.on("select",function(a){c.select(a.data)}),a.on("unselect",function(a){c.unselect(a.data)})},d.prototype.destroy=function(){this.$element.find("*").each(function(){c.removeData(this,"data")})},d.prototype.query=function(a,b){var d=[],e=this,f=this.$element.children();f.each(function(){var b=c(this);if(b.is("option")||b.is("optgroup")){var f=e.item(b),g=e.matches(a,f);null!==g&&d.push(g)}}),b({results:d})},d.prototype.addOptions=function(a){b.appendMany(this.$element,a)},d.prototype.option=function(a){var b;a.children?(b=document.createElement("optgroup"),b.label=a.text):(b=document.createElement("option"),void 0!==b.textContent?b.textContent=a.text:b.innerText=a.text),a.id&&(b.value=a.id),a.disabled&&(b.disabled=!0),a.selected&&(b.selected=!0),a.title&&(b.title=a.title);var d=c(b),e=this._normalizeItem(a);return e.element=b,c.data(b,"data",e),d},d.prototype.item=function(a){var b={};if(b=c.data(a[0],"data"),null!=b)return b;if(a.is("option"))b={id:a.val(),text:a.text(),disabled:a.prop("disabled"),selected:a.prop("selected"),title:a.prop("title")};else if(a.is("optgroup")){b={text:a.prop("label"),children:[],title:a.prop("title")};for(var d=a.children("option"),e=[],f=0;f<d.length;f++){var g=c(d[f]),h=this.item(g);e.push(h)}b.children=e}return b=this._normalizeItem(b),b.element=a[0],c.data(a[0],"data",b),b},d.prototype._normalizeItem=function(a){c.isPlainObject(a)||(a={id:a,text:a}),a=c.extend({},{text:""},a);var b={selected:!1,disabled:!1};return null!=a.id&&(a.id=a.id.toString()),null!=a.text&&(a.text=a.text.toString()),null==a._resultId&&a.id&&null!=this.container&&(a._resultId=this.generateResultId(this.container,a)),c.extend({},b,a)},d.prototype.matches=function(a,b){var c=this.options.get("matcher");return c(a,b)},d}),b.define("select2/data/array",["./select","../utils","jquery"],function(a,b,c){function d(a,b){var c=b.get("data")||[];d.__super__.constructor.call(this,a,b),this.addOptions(this.convertToOptions(c))}return b.Extend(d,a),d.prototype.select=function(a){var b=this.$element.find("option").filter(function(b,c){return c.value==a.id.toString()});0===b.length&&(b=this.option(a),this.addOptions(b)),d.__super__.select.call(this,a)},d.prototype.convertToOptions=function(a){function d(a){return function(){return c(this).val()==a.id}}for(var e=this,f=this.$element.find("option"),g=f.map(function(){return e.item(c(this)).id}).get(),h=[],i=0;i<a.length;i++){var j=this._normalizeItem(a[i]);if(c.inArray(j.id,g)>=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},l,j),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&""!==a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");if(void 0!==f&&(this.createTag=f),b.call(this,c,d),a.isArray(e))for(var g=0;g<e.length;g++){var h=e[g],i=this._normalizeItem(h),j=this.option(i);this.$element.append(j)}}return b.prototype.query=function(a,b,c){function d(a,f){for(var g=a.results,h=0;h<g.length;h++){var i=g[h],j=null!=i.children&&!d({results:i.children},!0),k=i.text===b.term;if(k||j)return f?!1:(a.data=g,void c(a))}if(f)return!0;var l=e.createTag(b);if(null!=l){var m=e.option(l);m.attr("data-select2-tag",!0),e.addOptions([m]),e.insertTag(g,l)}a.results=g,c(a)}var e=this;return this._removeOldTags(),null==b.term||null!=b.page?void a.call(this,b,c):void a.call(this,b,d)},b.prototype.createTag=function(b,c){var d=a.trim(c.term);return""===d?null:{id:d,text:d}},b.prototype.insertTag=function(a,b,c){b.unshift(c)},b.prototype._removeOldTags=function(b){var c=(this._lastTag,this.$element.find("option[data-select2-tag]"));c.each(function(){this.selected||a(this).remove()})},b}),b.define("select2/data/tokenizer",["jquery"],function(a){function b(a,b,c){var d=c.get("tokenizer");void 0!==d&&(this.tokenizer=d),a.call(this,b,c)}return b.prototype.bind=function(a,b,c){a.call(this,b,c),this.$search=b.dropdown.$search||b.selection.$search||c.find(".select2-search__field")},b.prototype.query=function(a,b,c){function d(a){e.trigger("select",{data:a})}var e=this;b.term=b.term||"";var f=this.tokenizer(b,this.options,d);f.term!==b.term&&(this.$search.length&&(this.$search.val(f.term),this.$search.focus()),b.term=f.term),a.call(this,b,c)},b.prototype.tokenizer=function(b,c,d,e){for(var f=d.get("tokenSeparators")||[],g=c.term,h=0,i=this.createTag||function(a){return{id:a.term,text:a.term}};h<g.length;){var j=g[h];if(-1!==a.inArray(j,f)){var k=g.substr(0,h),l=a.extend({},c,{term:k}),m=i(l);null!=m?(e(m),g=g.substr(h+1)||"",h=0):h++}else h++}return{term:g}},b}),b.define("select2/data/minimumInputLength",[],function(){function a(a,b,c){this.minimumInputLength=c.get("minimumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",b.term.length<this.minimumInputLength?void this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumInputLength",[],function(){function a(a,b,c){this.maximumInputLength=c.get("maximumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",this.maximumInputLength>0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<span class="select2-dropdown"><span class="select2-results"></span></span>');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('<li class="select2-results__option select2-results__option--load-more"role="treeitem" aria-disabled="true"></li>'),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a("<span></span>"),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=(this.$container.position(),this.$container.offset());f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.top<f.top-h.height,k=i.bottom>f.bottom+h.height,l={left:f.left,top:g.bottom};if("static"!==this.$dropdownParent[0].style.position){var m=this.$dropdownParent.offset();l.top-=m.top,l.left-=m.left}c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d<b.length;d++){var e=b[d];e.children?c+=a(e.children):c++}return c}function b(a,b,c,d){this.minimumResultsForSearch=c.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),a.call(this,b,c,d)}return b.prototype.showSearch=function(b,c){return a(c.data.results)<this.minimumResultsForSearch?!1:b.call(this,c)},b}),b.define("select2/dropdown/selectOnClose",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("close",function(){d._handleSelectOnClose()})},a.prototype._handleSelectOnClose=function(){var a=this.getHighlightedResults();if(!(a.length<1)){var b=a.data("data");null!=b.element&&b.element.selected||null==b.element&&b.selected||this.trigger("select",{data:b})}},a}),b.define("select2/dropdown/closeOnSelect",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("select",function(a){d._selectTriggered(a)}),b.on("unselect",function(a){d._selectTriggered(a)})},a.prototype._selectTriggered=function(a,b){var c=b.originalEvent;c&&c.ctrlKey||this.trigger("close",{})},a}),b.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(a){var b=a.input.length-a.maximum,c="Please delete "+b+" character";return 1!=b&&(c+="s"),c},inputTooShort:function(a){var b=a.minimum-a.input.length,c="Please enter "+b+" or more characters";return c},loadingMore:function(){return"Loading more results…"},maximumSelected:function(a){var b="You can only select "+a.maximum+" item";return 1!=a.maximum&&(b+="s"),b},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),b.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C){function D(){this.reset()}D.prototype.apply=function(l){if(l=a.extend({},this.defaults,l),null==l.dataAdapter){if(null!=l.ajax?l.dataAdapter=o:null!=l.data?l.dataAdapter=n:l.dataAdapter=m,l.minimumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L<K.length;L++){var M=K[L],N={};try{N=k.loadPath(M)}catch(O){try{M=this.defaults.amdLanguageBase+M,N=k.loadPath(M)}catch(P){l.debug&&window.console&&console.warn&&console.warn('Select2: The language file for "'+M+'" could not be automatically loaded. A fallback will be used instead.');continue}}J.extend(N)}l.translations=J}else{var Q=k.loadPath(this.defaults.amdLanguageBase+"en"),R=new k(l.language);R.extend(Q),l.translations=R}return l},D.prototype.reset=function(){function b(a){function b(a){return l[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function c(d,e){if(""===a.trim(d.term))return e;if(e.children&&e.children.length>0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this._sync=c.bind(this._syncAttributes,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._sync);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._sync)}),this._observer.observe(this.$element[0],{attributes:!0,subtree:!1})):this.$element[0].addEventListener&&this.$element[0].addEventListener("DOMAttrModified",b._sync,!1)},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),(null==a||0===a.length)&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._sync),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&this.$element[0].removeEventListener("DOMAttrModified",this._sync,!1),this._sync=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},e.prototype.render=function(){var b=a('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("jquery-mousewheel",["jquery"],function(a){return a}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if(b=b||{},"object"==typeof b)return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d;return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2.");var e=Array.prototype.slice.call(arguments,1);d=c[b].apply(c,e)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c});var czr_debug = {
17
+ log: function(o) {debug.queue.push(['log', arguments, debug.stack.slice(0)]); if (window.console && typeof window.console.log == 'function') {window.console.log(o);}},
18
+ error: function(o) {debug.queue.push(['error', arguments, debug.stack.slice(0)]); if (window.console && typeof window.console.error == 'function') {window.console.error(o);}},
19
+ queue: [],
20
+ stack: []
21
+ };
22
+
23
+ var api = api || wp.customize, $ = $ || jQuery;
24
+ (function (api, $, _) {
25
+ api.consoleLog = function() {
26
+ if ( ( _.isUndefined( console ) && typeof window.console.log != 'function' ) || ! serverControlParams.isDevMode )
27
+ return;
28
+ console.log.apply( console, arguments );
29
+ };
30
+
31
+ api.czr_isSkopOn = function() {
32
+ return serverControlParams.isSkopOn && _.has( api, 'czr_skopeBase' );
33
+ };
34
+
35
+ api.czr_isChangeSetOn = function() {
36
+ return serverControlParams.isChangeSetOn && true === true;//&& true === true is just there to hackily cast the returned value as boolean.
37
+ };
38
+ api.czr_wp_conditionals = new api.Value();
39
+ api.czr_widgetZoneSettings = new api.Value();//will store all widget zones data sent by preview as an observable object
40
+ api.sidebar_insights = new api.Values();
41
+ api.sidebar_insights.create('candidates');//will store the sidebar candidates on preview refresh
42
+ api.sidebar_insights.create('actives');//will record the refreshed active list of active sidebars sent from the preview
43
+ api.sidebar_insights.create('inactives');
44
+ api.sidebar_insights.create('registered');
45
+ api.sidebar_insights.create('available_locations');
46
+ api.czr_partials = new api.Value();
47
+ api.czr_activeSectionId = new api.Value('');
48
+ api.czr_activePanelId = new api.Value('');
49
+ api.bind('ready', function() {
50
+ if ( 'function' != typeof api.Section ) {
51
+ throw new Error( 'Your current version of WordPress does not support the customizer sections needed for this theme. Please upgrade WordPress to the latest version.' );
52
+ }
53
+ var _bindSectionExpanded = function( expanded, section_id ) {
54
+ api.czr_activeSectionId( expanded ? section_id : '' );
55
+ };
56
+ api.section.each( function( _sec ) {
57
+ _sec.expanded.bind( function( expanded ) { _bindSectionExpanded( expanded, _sec.id ); } );
58
+ });
59
+ api.section.bind( 'add', function( section_instance ) {
60
+ api.trigger('czr-paint', { active_panel_id : section_instance.panel() } );
61
+ section_instance.expanded.bind( function( expanded ) { _bindSectionExpanded( expanded, section_instance.id ); } );
62
+ });
63
+
64
+ var _bindPanelExpanded = function( expanded, panel_id ) {
65
+ api.czr_activePanelId( expanded ? panel_id : '' );
66
+ if ( _.isEmpty( api.czr_activePanelId() ) ) {
67
+ api.czr_activeSectionId( '' );
68
+ }
69
+ };
70
+ api.panel.each( function( _panel ) {
71
+ _panel.expanded.bind( function( expanded ) { _bindPanelExpanded( expanded, _panel.id ); } );
72
+ });
73
+ api.panel.bind( 'add', function( panel_instance ) {
74
+ panel_instance.expanded.bind( function( expanded ) { _bindPanelExpanded( expanded, panel_instance.id ); } );
75
+ });
76
+
77
+ });
78
+ api.bind('ready', function() {
79
+ var _do = function() {
80
+ api.section('themes').active.bind( function( active ) {
81
+ if ( ! _.has( serverControlParams, 'isThemeSwitchOn' ) || ! _.isEmpty( serverControlParams.isThemeSwitchOn ) )
82
+ return;
83
+ api.section('themes').active(false);
84
+ api.section('themes').active.callbacks = $.Callbacks();
85
+ });
86
+ };
87
+ if ( api.section.has( 'themes') )
88
+ _do();
89
+ else
90
+ api.section.when( 'themes', function( _s ) {
91
+ _do();
92
+ });
93
+ });
94
+ api.czr_skopeReady = $.Deferred();
95
+ api.bind( 'ready' , function() {
96
+ if ( serverControlParams.isSkopOn ) {
97
+ api.czr_skopeBase = new api.CZR_skopeBase();
98
+ api.czr_skopeSave = new api.CZR_skopeSave();
99
+ api.czr_skopeReset = new api.CZR_skopeReset();
100
+ api.trigger('czr-skope-started');
101
+ api.czr_skopeReady.done( function() {
102
+ api.trigger('czr-skope-ready');
103
+ });
104
+ }
105
+ if ( serverControlParams.isChangeSetOn ) {
106
+ api.settings.timeouts.changesetAutoSave = 10000;
107
+ }
108
+ } );
109
+ if ( ! _.has( api, '_latestRevision') ) {
110
+ api._latestRevision = 0;
111
+ api._latestSettingRevisions = {};
112
+ api.bind( 'change', function incrementChangedSettingRevision( setting ) {
113
+ api._latestRevision += 1;
114
+ api._latestSettingRevisions[ setting.id ] = api._latestRevision;
115
+ } );
116
+ api.bind( 'ready', function() {
117
+ api.bind( 'add', function incrementCreatedSettingRevision( setting ) {
118
+ if ( setting._dirty ) {
119
+ api._latestRevision += 1;
120
+ api._latestSettingRevisions[ setting.id ] = api._latestRevision;
121
+ }
122
+ } );
123
+ } );
124
+ }
125
+
126
+ })( wp.customize , jQuery, _);
127
+ var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
128
+ $.extend( CZRSkopeBaseMths, {
129
+
130
+ globalSettingVal : {},//will store the global setting val. Populated on init.
131
+
132
+ initialize: function() {
133
+ var self = this;
134
+ self.skope_colors = {
135
+ global : 'rgb(255, 255, 255)',
136
+ special_group : 'rgba(173, 213, 247, 0.55)',
137
+ group : 'rgba(173, 213, 247, 0.55)',
138
+ local : 'rgba(78, 122, 199, 0.35)'
139
+ };
140
+ api.czr_isPreviewerSkopeAware = $.Deferred();
141
+ api.czr_initialSkopeCollectionPopulated = $.Deferred();
142
+ self.skopeWrapperEmbedded = $.Deferred();
143
+ api.czr_skope = new api.Values();
144
+ api.czr_skopeCollection = new api.Value([]);//all available skope, including the current skopes
145
+ api.czr_currentSkopesCollection = new api.Value([]);
146
+ api.czr_activeSkopeId = new api.Value();
147
+ api.czr_dirtyness = new api.Value( false );
148
+ api.czr_isResettingSkope = new api.Value( false );
149
+ api.state.create('switching-skope')(false);
150
+ api.czr_dirtyness.callbacks.add( function() { return self.apiDirtynessReact.apply(self, arguments ); } );
151
+ self.toggleSkopeLoadPane();
152
+ self.bindAPISettings();
153
+ api.state.bind( 'change', function() {
154
+ self.setSaveButtonStates();
155
+ });
156
+ if ( 'pending' == self.skopeWrapperEmbedded.state() ) {
157
+ $.when( self.embedSkopeWrapper() ).done( function() {
158
+ self.skopeWrapperEmbedded.resolve();
159
+ });
160
+ }
161
+ api.previewer.bind( 'czr-skopes-synced', function( data ) {
162
+ if ( ! serverControlParams.isSkopOn )
163
+ return;
164
+ var preview = this,
165
+ previousSkopeCollection = api.czr_currentSkopesCollection();
166
+ if ( ! _.has( data, 'czr_skopes') ) {
167
+ throw new Error('Missing skopes in the server data');
168
+ }
169
+ api.czr_skopeBase.updateSkopeCollection( data.czr_skopes , preview.channel() );
170
+ api.czr_initialSkopeCollectionPopulated.then( function() {
171
+ var refreshActiveSkope = _.isUndefined( _.findWhere( api.czr_currentSkopesCollection(), {id : api.czr_activeSkopeId() } ) );
172
+ api.czr_skopeBase.reactWhenSkopeSyncedDone( data ).done( function() {
173
+ if ( refreshActiveSkope ) {
174
+ api.czr_activeSkopeId( self.getActiveSkopeId() )
175
+ .done( function() {
176
+ api.consoleLog('INITIAL ACTIVE SKOPE SET : ' + arguments[1] + ' => ' + arguments[0] );
177
+ if ( 'pending' == api.czr_skopeReady.state() ) {
178
+ api.czr_skopeReady.resolve( self.getActiveSkopeId() );
179
+ }
180
+ self._writeCurrentSkopeTitle();
181
+ });
182
+ } else if ( ! _.isEmpty( previousSkopeCollection ) ) { //Rewrite the title when the local skope has changed
183
+ var _prevLoc = _.findWhere( previousSkopeCollection , { skope : 'local' } ).opt_name,
184
+ _newLoc =_.findWhere( data.czr_skopes, { skope : 'local' } ).opt_name;
185
+
186
+ if ( _newLoc !== _prevLoc && 'resolved' == api.czr_skopeReady.state() ) {
187
+ self._writeCurrentSkopeTitle();
188
+ }
189
+ }
190
+ });
191
+ });
192
+ });
193
+ api.czr_currentSkopesCollection.bind( function( to, from ) {
194
+ return self.currentSkopesCollectionReact( to, from );
195
+ }, { deferred : true });
196
+ api.czr_initialSkopeCollectionPopulated.done( function() {
197
+ api.czr_activeSkopeId.bind( function( to, from ) {
198
+ return self.activeSkopeReact( to, from );
199
+ }, { deferred : true } );
200
+ api.czr_activeSectionId.callbacks.add( function() { return self.activeSectionReact.apply(self, arguments ); } );
201
+ api.czr_activePanelId.callbacks.add( function() { return self.activePanelReact.apply(self, arguments ); } );
202
+ });
203
+ api.bind( 'skope-switched', function( skope_id, previous_id ) {
204
+ api.czr_skopeReady.then( function() {
205
+ api.czr_CrtlDependenciesReady.then( function() {
206
+ if ( ! _.isUndefined( api.czr_activeSectionId() ) && ! _.isEmpty( api.czr_activeSectionId() ) ) {
207
+ api.czr_ctrlDependencies.setServiDependencies( api.czr_activeSectionId(), null, true );//target sec id, source sec id, refresh
208
+ }
209
+ });
210
+ self.updateCtrlSkpNot( api.CZR_Helpers.getSectionControlIds() );
211
+ if ( api.czr_skope.has( previous_id ) ) {
212
+ $('#customize-controls').removeClass( [ 'czr-', api.czr_skope( previous_id )().skope, '-skope-level'].join('') );
213
+ }
214
+ if ( api.czr_skope.has( skope_id ) ) {
215
+ $('#customize-controls').addClass( [ 'czr-', api.czr_skope( skope_id )().skope, '-skope-level'].join('') );
216
+ }
217
+ });
218
+ });
219
+ api.czr_serverNotification = new api.Value( {status : 'success', message : '', expanded : true} );
220
+ api.czr_serverNotification.bind( function( to, from ) {
221
+ self.toggleServerNotice( to );
222
+ });
223
+ api.czr_topNoteVisible = new api.Value( false );
224
+ api.czr_skopeReady.then( function() {
225
+ api.czr_topNoteVisible.bind( function( visible ) {
226
+ self.toggleTopNote( visible, serverControlParams.topNoteParams || {} );
227
+ if ( ! visible ) {
228
+ var _query = $.extend(
229
+ api.previewer.query(),
230
+ { nonce: api.previewer.nonce.save }
231
+ );
232
+ wp.ajax.post( 'czr_dismiss_top_note' , _query )
233
+ .always( function () {})
234
+ .fail( function ( response ) { api.consoleLog( 'czr_dismiss_top_note failed', _query, response ); })
235
+ .done( function( response ) {});
236
+ }
237
+ });
238
+ _.delay( function() {
239
+ api.czr_topNoteVisible( ! _.isEmpty( serverControlParams.isTopNoteOn ) || 1 == serverControlParams.isTopNoteOn );
240
+ }, 2000 );
241
+ });
242
+ self.scopeSwitcherEventMap = [
243
+ {
244
+ trigger : 'click keydown',
245
+ selector : '.czr-dismiss-notification',
246
+ name : 'dismiss-notification',
247
+ actions : function() {
248
+ api.czr_serverNotification( { expanded : false } );
249
+ }
250
+ },
251
+ {
252
+ trigger : 'click keydown',
253
+ selector : '.czr-toggle-title-notice',
254
+ name : 'toggle-title-notice',
255
+ actions : function( params ) {
256
+ if ( _.isUndefined( self.skopeTitleNoticeVisible ) ) {
257
+ self.skopeTitleNoticeVisible = new api.Value( false );
258
+ self.skopeTitleNoticeVisible.bind( function( to ) {
259
+ params.dom_el.find( '.czr-skope-title')
260
+ .toggleClass( 'notice-visible', to );
261
+ });
262
+ }
263
+
264
+ self.skopeTitleNoticeVisible( ! self.skopeTitleNoticeVisible() );
265
+ }
266
+ }
267
+ ];
268
+ api.CZR_Helpers.setupDOMListeners( self.scopeSwitcherEventMap , { dom_el : $('.czr-scope-switcher') }, self );
269
+ self.refreshedControls = [ 'czr_cropped_image'];// [ 'czr_cropped_image', 'czr_multi_module', 'czr_module' ];
270
+ self.initWidgetSidebarSpecifics();
271
+ api.bind( 'czr-paint', function( params ) {
272
+ api.czr_skopeReady.then( function() {
273
+ self.wash( params ).paint( params );
274
+ });
275
+ });
276
+ },//initialize
277
+ toggleSkopeLoadPane : function() {
278
+ var self = this, $skopeLoadingPanel;
279
+ _render = function() {
280
+ var dfd = $.Deferred();
281
+ try {
282
+ _tmpl = wp.template( 'czr-skope-pane' )({ is_skope_loading : true });
283
+ }
284
+ catch(e) {
285
+ throw new Error('Error when parsing the the reset skope template : ' + e );//@to_translate
286
+ }
287
+ $.when( $('#customize-preview').after( $( _tmpl ) ) )
288
+ .always( function() {
289
+ dfd.resolve( $( '#czr-skope-pane' ) );
290
+ });
291
+
292
+ return dfd.promise();
293
+ };
294
+
295
+
296
+ $('body').addClass('czr-skop-loading');
297
+ _render()
298
+ .done( function( $_el ) {
299
+ $skopeLoadingPanel = $_el;
300
+ })
301
+ .then( function() {
302
+ if ( ! $skopeLoadingPanel.length )
303
+ return;
304
+
305
+ _.delay( function() {
306
+ var _height = $('#customize-preview').height();
307
+ $skopeLoadingPanel.css( 'line-height', _height +'px' ).css( 'height', _height + 'px' );
308
+ $('body').addClass('czr-skope-pane-open');
309
+ }, 50 );
310
+ });
311
+
312
+ api.czr_skopeReady.done( function() {
313
+ _.delay( function() {
314
+ $.when( $('body').removeClass('czr-skope-pane-open') ).done( function() {
315
+ _.delay( function() {
316
+ $.when( $('body').removeClass('czr-skop-loading') ).done( function() {
317
+ if ( false !== $skopeLoadingPanel.length ) {
318
+ setTimeout( function() {
319
+ $skopeLoadingPanel.remove();
320
+ }, 400 );
321
+ }
322
+ });
323
+ }, 200);
324
+ });
325
+ }, 50);
326
+
327
+ });
328
+ },
329
+ embedSkopeWrapper : function() {
330
+ var self = this;
331
+ $('#customize-header-actions').append( $('<div/>', {class:'czr-scope-switcher', html:'<div class="czr-skopes-wrapper"></div>'}) );
332
+ $('body').addClass('czr-skop-on');
333
+ var _eventMap = [
334
+ {
335
+ trigger : 'click keydown',
336
+ selector : '.czr-skope-switch',
337
+ name : 'control_skope_switch',
338
+ actions : function( params ) {
339
+ var _skopeIdToSwithTo = $( params.dom_event.currentTarget, params.dom_el ).attr('data-skope-id');
340
+ if ( ! _.isEmpty( _skopeIdToSwithTo ) && api.czr_skope.has( _skopeIdToSwithTo ) )
341
+ api.czr_activeSkopeId( _skopeIdToSwithTo );
342
+ }
343
+ }
344
+ ];
345
+ api.CZR_Helpers.setupDOMListeners( _eventMap , { dom_el : $('.czr-scope-switcher') }, self );
346
+ },
347
+ apiDirtynessReact : function( is_dirty ) {
348
+ $('body').toggleClass('czr-api-dirty', is_dirty );
349
+ api.state( 'saved')( ! is_dirty );
350
+ },
351
+ setSaveButtonStates : function() {
352
+ if ( ! api.state.has('saving') ) {
353
+ api.state.create('saving');
354
+ api.state('saving').bind( function( isSaving ) {
355
+ $( document.body ).toggleClass( 'saving', isSaving );
356
+ } );
357
+ }
358
+ var saveBtn = $( '#save' ),
359
+ closeBtn = $( '.customize-controls-close' ),
360
+ saved = api.state( 'saved'),
361
+ saving = api.state( 'saving'),
362
+ activated = api.state( 'activated' ),
363
+ changesetStatus = api.state.has('changesetStatus' ) ? api.state( 'changesetStatus' )() : 'auto-draft';
364
+
365
+ if ( api.czr_dirtyness() || ! saved() ) {
366
+ saveBtn.val( api.l10n.save );
367
+ closeBtn.find( '.screen-reader-text' ).text( api.l10n.cancel );
368
+ } else {
369
+ saveBtn.val( api.l10n.saved );
370
+ closeBtn.find( '.screen-reader-text' ).text( api.l10n.close );
371
+ }
372
+ var canSave = ! saving() && ( ! activated() || ! saved() ) && 'publish' !== changesetStatus;
373
+ saveBtn.prop( 'disabled', ! canSave );
374
+ }
375
+ });//$.extend()
376
+
377
+ var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
378
+ $.extend( CZRSkopeBaseMths, {
379
+ toggleServerNotice : function( notice ) {
380
+ notice = _.isObject( notice ) ? notice : {};
381
+ notice = _.extend( {
382
+ status : 'success',
383
+ expanded : true,
384
+ message : '',
385
+ auto_collapse : false
386
+ }, notice );
387
+ if ( 'changeset_already_published' == notice.message )
388
+ return;
389
+ if ( ! serverControlParams.isDevMode )
390
+ return;
391
+
392
+ this.serverNoticeEmbedded = this.serverNoticeEmbedded || $.Deferred();
393
+
394
+ var self = this,
395
+ _embed = function() {
396
+ $('.czr-scope-switcher').prepend(
397
+ $( '<div/>', {
398
+ class:'czr-server-notice',
399
+ html:'<span class="czr-server-message"></span><span class="fa fa-times-circle czr-dismiss-notification"></span>'
400
+ } )
401
+ );
402
+ },
403
+ _toggleNotice = function() {
404
+ var $notif_wrap = $( '.czr-server-notice', '.czr-scope-switcher' ),
405
+ $header = $('.wp-full-overlay-header'),
406
+ $sidebar = $('.wp-full-overlay-sidebar .wp-full-overlay-sidebar-content'),
407
+ _header_height,
408
+ _notif_wrap_height,
409
+ _set_height = function( _h ) {
410
+ return true;
411
+ };
412
+ if ( self.skopeTitleNoticeVisible )
413
+ self.skopeTitleNoticeVisible( false );
414
+
415
+ if ( ! notice.expanded ) {
416
+ $notif_wrap
417
+ .fadeOut( {
418
+ duration : 200,
419
+ complete : function() {
420
+ } } );
421
+ setTimeout( function() {
422
+ _set_height();
423
+ } , 200 );
424
+
425
+ } else {
426
+ $notif_wrap.toggleClass( 'czr-server-error', 'error' == notice.status );
427
+ if ( 'error' == notice.status ) {
428
+ $('.czr-server-message', $notif_wrap )
429
+ .html( _.isEmpty( notice.message ) ? 'Server Problem.' : notice.message );
430
+ } else {
431
+ $('.czr-server-message', $notif_wrap )
432
+ .html( _.isEmpty( notice.message ) ? 'Success.' : notice.message );
433
+ }
434
+ _notif_wrap_height = $( '.czr-server-notice', '.czr-scope-switcher' ).outerHeight();
435
+ _header_height = $header.outerHeight() + _notif_wrap_height;
436
+
437
+ setTimeout( function() {
438
+ $.when( _set_height( _header_height ) ).done( function() {
439
+ $notif_wrap
440
+ .fadeIn( {
441
+ duration : 200,
442
+ complete : function() {
443
+ $( this ).css( 'height', 'auto' );
444
+ } } );
445
+ } );
446
+ }, 400 );
447
+ }
448
+ };
449
+ if ( 'pending' == self.serverNoticeEmbedded.state() ) {
450
+ $.when( _embed() ).done( function() {
451
+ setTimeout( function() {
452
+ self.serverNoticeEmbedded.resolve();
453
+ _toggleNotice();
454
+ }, 200 );
455
+ });
456
+ } else {
457
+ _toggleNotice();
458
+ }
459
+ _.delay( function() {
460
+ api.czr_serverNotification( { expanded : false } );
461
+ },
462
+ ( 'success' == notice.status || false !== notice.auto_collapse ) ? 4000 : 5000
463
+ );
464
+ },
465
+ buildServerResponse : function( _r ) {
466
+ var resp = false;
467
+ if ( _.isObject( _r ) ) {
468
+ if ( _.has( _r, 'responseJSON') && ! _.isUndefined( _r.responseJSON.data ) && ! _.isEmpty( _r.responseJSON.data ) ) {
469
+ resp = _r.responseJSON.data;
470
+ }
471
+ else if ( _.has( _r , 'statusText' ) && ! _.isEmpty( _r.statusText ) ) {
472
+ resp = _r.statusText;
473
+ }
474
+ }
475
+ if ( _.isObject( _r ) && ! resp ) {
476
+ try {
477
+ JSON.stringify( _r );
478
+ } catch( e ) {
479
+ resp = 'Server Error';
480
+ }
481
+ } else if ( ! resp ) {
482
+ resp = '0' === _r ? 'Not logged in.' : _r;//@to_translate
483
+ } else if ( '-1' === _r ) {
484
+ resp = 'Identification issue detected, please refresh your page.';//@to_translate
485
+ }
486
+ return resp;
487
+ }
488
+ });//$.extend()
489
+
490
+ var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
491
+ $.extend( CZRSkopeBaseMths, {
492
+ toggleTopNote : function( visible, noteParams ) {
493
+ noteParams = _.isObject( noteParams ) ? noteParams : {};
494
+ var self = this,
495
+ _defaultParams = {
496
+ title : '',
497
+ message : ''
498
+ };
499
+
500
+ noteParams = $.extend( _defaultParams , noteParams);
501
+
502
+ if ( visible ) {
503
+ $.when( self.renderTopNoteTmpl( noteParams ) ).done( function( $_el ) {
504
+ self.welcomeNote = $_el;
505
+ _.delay( function() {
506
+ $('body').addClass('czr-top-note-open');
507
+ }, 200 );
508
+ api.CZR_Helpers.setupDOMListeners(
509
+ [ {
510
+ trigger : 'click keydown',
511
+ selector : '.czr-top-note-close',
512
+ name : 'close-top-note',
513
+ actions : function() {
514
+ api.czr_topNoteVisible( false );
515
+ }
516
+ } ] ,
517
+ { dom_el : self.welcomeNote },
518
+ self
519
+ );
520
+ });
521
+ } else {
522
+ $('body').removeClass('czr-top-note-open');
523
+ if ( self.welcomeNote.length ) {
524
+ _.delay( function() {
525
+ self.welcomeNote.remove();
526
+ }, 300 );
527
+ }
528
+ }
529
+ _.delay( function() {
530
+ api.czr_topNoteVisible( false );
531
+ },
532
+ 20000
533
+ );
534
+ },
535
+ renderTopNoteTmpl : function( params ) {
536
+ if ( $( '#czr-top-note' ).length )
537
+ return $( '#czr-top-note' );
538
+
539
+ var self = this,
540
+ _tmpl = '',
541
+ _title = params.title || '',
542
+ _message = params.message || '';
543
+
544
+ try {
545
+ _tmpl = wp.template( 'czr-top-note' )( { title : _title } );
546
+ }
547
+ catch(e) {
548
+ throw new Error('Error when parsing the the top note template : ' + e );//@to_translate
549
+ }
550
+ $('#customize-preview').after( $( _tmpl ) );
551
+ $('.czr-note-message', '#czr-top-note').html( _message );
552
+ return $( '#czr-top-note' );
553
+ }
554
+ });//$.extend()
555
+ var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
556
+ $.extend( CZRSkopeBaseMths, {
557
+ bindAPISettings : function( requestedSetId ) {
558
+ var self = this,
559
+ _settingChangeReact = function( new_val, old_val, o ) {
560
+ var setId = this.id,
561
+ skope_id;
562
+
563
+ if ( ! _.has( api, 'czr_activeSkopeId') || _.isUndefined( api.czr_activeSkopeId() ) ) {
564
+ api.consoleLog( 'The api.czr_activeSkopeId() is undefined in the api.previewer._new_refresh() method.');
565
+ }
566
+ if ( api( setId )._dirty ) {
567
+ skope_id = self.isSettingSkopeEligible( setId ) ? api.czr_activeSkopeId() : self.getGlobalSkopeId();
568
+ api.czr_skope( skope_id ).updateSkopeDirties( setId, new_val );
569
+ }
570
+ if ( _.has( api.control(setId), 'czr_states' ) && ! api.control(setId).czr_states( 'isResetting' )() ) {
571
+ api.control(setId).czr_states( 'resetVisible' )( false );
572
+ }
573
+ if ( self.isSettingSkopeEligible( setId ) ) {
574
+ self.updateCtrlSkpNot( setId );
575
+ }
576
+ };//bindListener()
577
+ if ( ! _.isUndefined( requestedSetId ) ) {
578
+ api( requestedSetId ).bind( _settingChangeReact );
579
+ }
580
+ else {
581
+ api.each( function ( _setting ) {
582
+ _setting.bind( _settingChangeReact );
583
+ });
584
+ }
585
+ var _dynamicallyAddedSettingsReact = function( setting_instance ) {
586
+ if ( setting_instance.callbacks.has( _settingChangeReact ) )
587
+ return;
588
+ setting_instance.bind( _settingChangeReact );
589
+ };
590
+
591
+ if ( ! api.topics.change.has( _dynamicallyAddedSettingsReact ) ) {
592
+ api.bind( 'change', _dynamicallyAddedSettingsReact );
593
+ }
594
+ }
595
+ });//$.extend()
596
+ var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
597
+ $.extend( CZRSkopeBaseMths, {
598
+ reactWhenSkopeSyncedDone : function( server_params ) {
599
+ var self = this, dfd = $.Deferred();
600
+ if ( ! _.has( server_params, 'czr_skopes' ) || _.isEmpty( server_params.czr_skopes ) ) {
601
+ throw new Error( 'Missing skope data after refresh', server_params );
602
+ }
603
+ if ( ! api.czr_dirtyness() ) {
604
+ api.czr_dirtyness( _.isBoolean( server_params.isChangesetDirty ) ? server_params.isChangesetDirty : false );
605
+ }
606
+
607
+ var _sentSkopeCollection = server_params.czr_skopes;
608
+ _.each( api.czr_skopeCollection(), function( _skp ) {
609
+ var _sent_skope = _.findWhere( _sentSkopeCollection, { opt_name : _skp.opt_name } );
610
+ if ( _.isUndefined( _sent_skope ) )
611
+ return;
612
+ var _changeset_candidate = _.isEmpty( _sent_skope.changeset || {} ) ? {} : _sent_skope.changeset,
613
+ _api_ready_chgset = {};
614
+ _.each( _changeset_candidate, function( _val, _setId ) {
615
+ if ( ! api.has( _setId ) ) {
616
+ api.consoleLog( 'In reactWhenSkopeSyncedDone : attempting to update the changeset with a non registered setting : ' + _setId );
617
+ }
618
+ _api_ready_chgset[_setId] = _val;
619
+ });
620
+ api.czr_skope( _skp.id ).changesetValues( _api_ready_chgset );
621
+ });
622
+ _.each( api.czr_skopeCollection(), function( _skp ) {
623
+ var _sent_skope = _.findWhere( _sentSkopeCollection, { opt_name : _skp.opt_name } );
624
+ if ( _.isUndefined( _sent_skope ) )
625
+ return;
626
+ var _current_db_vals = $.extend( true, {}, api.czr_skope( _skp.id ).dbValues() ),
627
+ _dbVals_candidate = $.extend( _current_db_vals , _sent_skope.db || {} ),
628
+ _api_ready_dbvals = {};
629
+ _.each( _dbVals_candidate, function( _val, _setId ) {
630
+ if ( ! api.has( _setId ) ) {
631
+ api.consoleLog( 'In reactWhenSkopeSyncedDone : attempting to update the db values with a non registered setting : ' + _setId );
632
+ }
633
+ _api_ready_dbvals[_setId] = _val;
634
+ });
635
+
636
+
637
+ api.czr_skope( _skp.id ).dbValues( _api_ready_dbvals );
638
+ });
639
+ _.delay( function() {
640
+ dfd.resolve();
641
+ }, 500 );
642
+ return dfd.promise();
643
+ }
644
+ });//$.extend()
645
+
646
+ var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
647
+ $.extend( CZRSkopeBaseMths, {
648
+ _maybeSetupAssignedMenuLocations : function( active_section ) {
649
+ if ( _.isUndefined( active_section ) || _.isEmpty( active_section ) || ! api.section.has( active_section.id ) ) {
650
+ api.consoleLog( 'In _maybeSetupAssignedMenuLocations : no valid section_id provided.');
651
+ }
652
+ var self = this;
653
+ if ( ! active_section.assignedLocations )
654
+ return;
655
+ var _assignedLocReact = function( locations ) {};
656
+
657
+ if ( ! active_section.assignedLocations.callbacks.has( _assignedLocReact ) ) {
658
+ active_section.assignedLocations.bind( _assignedLocReact );
659
+ }
660
+ },
661
+ activeSectionReact : function( active_sec_id , previous_sec_id ) {
662
+ if ( 'add_menu' != active_sec_id ) {
663
+ api.trigger('czr-paint', { active_section_id : active_sec_id } );
664
+ }
665
+
666
+ var self = this,
667
+ _doReactPrevious = function( previous_sec_id ) {
668
+ var controls = api.CZR_Helpers.getSectionControlIds( previous_sec_id );
669
+ _.each( controls, function( ctrlId ) {
670
+ if ( ! api.has( ctrlId ) || _.isUndefined( api.control( ctrlId ) ) )
671
+ return;
672
+ var ctrl = api.control( ctrlId );
673
+ if ( ! _.has( ctrl, 'czr_states' ) )
674
+ return;
675
+ ctrl.czr_states( 'noticeVisible' )( false );
676
+ ctrl.czr_states( 'resetVisible' )( false );
677
+ });
678
+ },
679
+ _doReactActive = function( active_section, active_sec_id ) {
680
+ self.setupActiveSkopedControls( {
681
+ section_id : active_sec_id
682
+ });
683
+ self.processSilentUpdates( { section_id : active_sec_id } )
684
+ .fail( function() {
685
+ throw new Error( 'Fail to process silent updates after initial skope collection has been populated' );
686
+ })
687
+ .done( function() {
688
+ if ( ! self.isExcludedSidebarsWidgets() ) {
689
+ self.forceSidebarDirtyRefresh( active_sec_id , api.czr_activeSkopeId() );
690
+ }
691
+ });
692
+ if ( ! _.has( api.topics, 'active-section-setup' ) ) {
693
+ api.bind( 'active-section-setup', function( params ) {
694
+ var defaults = {
695
+ controls : [],
696
+ section_id : ''
697
+ };
698
+ params = _.extend( defaults, params );
699
+ self._maybeSetupAssignedMenuLocations( params );
700
+ });
701
+ }
702
+ api.czr_skopeReady.then( function() {
703
+ var _switchBack = function( _title ) {
704
+ api.czr_serverNotification({
705
+ status:'success',
706
+ message : [ _title, 'can only be customized site wide.' ].join(' ')//@to_translate
707
+ });
708
+ api.czr_activeSkopeId( self.getGlobalSkopeId() );
709
+ };
710
+ if ( 'global' != api.czr_skope( api.czr_activeSkopeId() )().skope ) {
711
+ if (
712
+ self.isExcludedWPCustomCss() &&
713
+ ( 'custom_css' == active_sec_id || 'admin_sec' == active_sec_id )
714
+ ) {
715
+ _switchBack( api.section( active_sec_id ).params.title );
716
+ }
717
+
718
+ if ( 'nav_menu[' == active_sec_id.substring( 0, 'nav_menu['.length ) || 'add_menu' == active_sec_id ) {
719
+ api.czr_serverNotification({
720
+ status:'success',
721
+ message : [
722
+ 'Menus are created site wide.'//@to_translate
723
+ ].join(' ')
724
+ });
725
+ }
726
+ }
727
+ });
728
+ api.trigger('active-section-setup', active_section );
729
+ };
730
+ api.czr_initialSkopeCollectionPopulated.then( function() {
731
+ api.section.when( active_sec_id , function( active_section ) {
732
+ active_section.deferred.embedded.then( function() {
733
+ _doReactActive( active_section, active_sec_id );
734
+ });
735
+ });
736
+ if ( ! _.isEmpty( previous_sec_id ) && api.section.has( previous_sec_id ) ) {
737
+ _doReactPrevious( previous_sec_id );
738
+ }
739
+ });
740
+ },
741
+ activePanelReact : function( active_panel_id , previous_panel_id ) {
742
+ var self = this;
743
+ api.czr_initialSkopeCollectionPopulated.then( function() {
744
+ api.trigger('czr-paint', { active_panel_id : active_panel_id } );
745
+ var _switchBack = function( _title ) {
746
+ api.czr_serverNotification({
747
+ status:'success',
748
+ message : [ _title, 'can only be customized site wide.' ].join(' ')
749
+ });
750
+ api.czr_activeSkopeId( self.getGlobalSkopeId() );
751
+ };
752
+ api.czr_skopeReady.then( function() {
753
+ if ( 'global' != api.czr_skope( api.czr_activeSkopeId() )().skope ) {
754
+ if ( self.isExcludedSidebarsWidgets() && 'widgets' == active_panel_id ) {
755
+ api.czr_serverNotification({
756
+ status:'success',
757
+ message : [
758
+ 'Widgets are created site wide.'//@to_translate
759
+ ].join(' ')
760
+ });
761
+ }
762
+ }
763
+ });
764
+ api.czr_skopeReady.then( function() {
765
+ if ( 'nav_menus' == active_panel_id ) {
766
+ _.each( api.panel( active_panel_id ).sections(), function( _sec ) {
767
+ self.processSilentUpdates( { section_id : _sec.id, awake_if_not_active : true } );
768
+ });
769
+ }
770
+ });
771
+ });
772
+ }
773
+ });//$.extend()
774
+ var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
775
+ $.extend( CZRSkopeBaseMths, {
776
+ wash : function( params ) {
777
+ var self = this,
778
+ _do_wash = function( element ) {
779
+ if ( ! _.has( element, 'el') || ! element.el.length )
780
+ return;
781
+ $.when( element.el.removeClass('czr-painted') ).done( function() {
782
+ $(this).css( 'background', '' ).css('color', '');
783
+ });
784
+ };
785
+ if ( api.czr_skopeBase.paintedElements ) {
786
+ _.each( api.czr_skopeBase.paintedElements(), function( _el ) { _do_wash( _el ); } );
787
+ api.czr_skopeBase.paintedElements( [] );
788
+ }
789
+ return this;
790
+ },
791
+ paint : function( params ) {
792
+ var _bgColor = 'inherit',
793
+ defaults = {
794
+ active_panel_id : api.czr_activePanelId(),
795
+ active_section_id : api.czr_activeSectionId(),
796
+ is_skope_switch : false
797
+ },
798
+ _paint_candidates = [];
799
+ params = $.extend( defaults, params );
800
+
801
+ if ( ! _.isUndefined( api.czr_activeSkopeId() ) && api.czr_skope.has( api.czr_activeSkopeId() ) ) {
802
+ _bgColor = api.czr_skope( api.czr_activeSkopeId() ).color;
803
+ }
804
+ var _do_paint = function( element ) {
805
+ if ( ! _.has( element, 'el') || ! element.el.length )
806
+ return;
807
+ if ( params.is_skope_switch ) {
808
+ $.when( element.el.addClass('czr-painted') ).done( function() {
809
+ $(this).css( 'background', element.bgColor || _bgColor );
810
+ });
811
+ } else {
812
+ element.el.css( 'background', element.bgColor || _bgColor );
813
+ }
814
+ if ( 'global' != api.czr_skope( api.czr_activeSkopeId() )().skope ) {
815
+ element.el.css( 'color', '#000');
816
+ }
817
+
818
+ };
819
+
820
+ api.czr_skopeBase.paintedElements = api.czr_skopeBase.paintedElements || new api.Value( [] );
821
+ if ( _.isEmpty( params.active_panel_id ) && _.isEmpty( params.active_section_id ) ) {
822
+ _paint_candidates.push( {
823
+ el : $( '#customize-info' ).find('.accordion-section-title').first()
824
+ });
825
+ api.panel.each( function( _panel ) {
826
+ _paint_candidates.push( {
827
+ el : _panel.container.find( '.accordion-section-title').first()
828
+ });
829
+ });
830
+ api.section.each( function( _section ) {
831
+ if ( ! _.isEmpty( _section.panel() ) )
832
+ return;
833
+ _paint_candidates.push( {
834
+ el : _section.container.find( '.accordion-section-title').first()
835
+ });
836
+ });
837
+ }
838
+ if ( ! _.isEmpty( params.active_panel_id ) && _.isEmpty( params.active_section_id ) ) {
839
+ api.panel.when( params.active_panel_id , function( active_panel ) {
840
+ active_panel.deferred.embedded.then( function() {
841
+ _paint_candidates.push( {
842
+ el : active_panel.container.find( '.accordion-section-title, .customize-panel-back' )
843
+ });
844
+ });
845
+ });
846
+ }
847
+ if ( ! _.isEmpty( params.active_section_id ) ) {
848
+ api.section.when( params.active_section_id , function( active_section ) {
849
+ active_section.deferred.embedded.then( function() {
850
+ _paint_candidates.push(
851
+ {
852
+ el : active_section.container.find( '.customize-section-title, .customize-section-back' ),
853
+ bgColor : 'inherit'
854
+ },
855
+ {
856
+ el : active_section.container
857
+ }
858
+ );
859
+ if ( ! api.czr_isChangeSetOn() ) {
860
+ _paint_candidates.push(
861
+ {
862
+ el : active_section.container.find('.accordion-section-content')
863
+ }
864
+ );
865
+ }
866
+ });
867
+ });
868
+ }
869
+ _.each( _paint_candidates, function( _el ) { _do_paint( _el ); } );
870
+ api.czr_skopeBase.paintedElements( _paint_candidates );
871
+ return this;
872
+ }
873
+ });//$.extend()
874
+ var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
875
+ $.extend( CZRSkopeBaseMths, {
876
+ isSkopeRegisteredInCollection : function( skope_id, collection ) {
877
+ var self = this;
878
+ collection = collection || api.czr_skopeCollection();
879
+ return ! _.isUndefined( _.findWhere( collection, { id : skope_id } ) );
880
+ },
881
+ isSkopeRegisteredInCurrentCollection : function( skope_id, collection ) {
882
+ var self = this;
883
+ collection = collection || api.czr_currentSkopesCollection();
884
+ return ! _.isUndefined( _.findWhere( collection, { id : skope_id } ) );
885
+ },
886
+ isGlobalSkopeRegistered : function() {
887
+ var _model = _.findWhere( api.czr_currentSkopesCollection(), { skope : 'global'} );
888
+ return _.isObject( _model ) && _.has( _model, 'id' );
889
+ },
890
+ getGlobalSkopeId : function() {
891
+ if ( ! _.has(api, 'czr_skope') )
892
+ return '';
893
+ var id = '';
894
+ api.czr_skope.each( function(skp){
895
+ if ( 'global' == skp().skope )
896
+ id = skp().id;
897
+ });
898
+ return id;
899
+ },
900
+ getChangedGlobalDBSettingValues : function( serverGlobalDBValues ) {
901
+ var _changedDbVal = {};
902
+
903
+ _.each( serverGlobalDBValues, function( _val, _setId ){
904
+ _wpSetId = api.CZR_Helpers.build_setId( _setId);
905
+
906
+ if ( ! _.has( api.settings.settings, _wpSetId ) )
907
+ return;
908
+ if ( _.isEqual( _val , api.settings.settings[ _wpSetId ].value ) )
909
+ return;
910
+ _changedDbVal[_setId] = _val;
911
+ });
912
+ return _changedDbVal;
913
+ },
914
+ getActiveSkopeId : function( _current_skope_collection ) {
915
+ _current_skope_collection = _current_skope_collection || api.czr_currentSkopesCollection();
916
+
917
+ var _currentSkopeLevel = ( ! _.isEmpty( api.czr_activeSkopeId() ) && api.czr_skope.has( api.czr_activeSkopeId() ) ) ? api.czr_skope( api.czr_activeSkopeId() )().skope : serverControlParams.isLocalSkope ? 'local' : 'global',
918
+ _newSkopeCandidate = _.findWhere( _current_skope_collection, { skope : _currentSkopeLevel } );
919
+
920
+ _skpId = ! _.isUndefined( _newSkopeCandidate ) ? _newSkopeCandidate.id : _.findWhere( _current_skope_collection, { skope : 'global' } ).id;
921
+
922
+ if ( _.isUndefined( _skpId ) ) {
923
+ throw new Error( 'No default skope was found in getActiveSkopeId ', _current_skope_collection );
924
+ }
925
+ return _skpId;
926
+ },
927
+ getActiveSkopeName : function() {
928
+ if ( ! api.czr_skope.has( api.czr_activeSkopeId() ) )
929
+ return 'global';
930
+ return api.czr_skope( api.czr_activeSkopeId() )().skope;
931
+ },
932
+ isSettingSkopeEligible : function( setId ) {
933
+ var self = this,
934
+ shortSetId = api.CZR_Helpers.getOptionName( setId );
935
+
936
+ if( _.isUndefined( setId ) || ! api.has( setId ) ) {
937
+ api.consoleLog( 'THE SETTING ' + setId + ' IS NOT ELIGIBLE TO SKOPE BECAUSE UNDEFINED OR NOT REGISTERED IN THE API.' );
938
+ return false;
939
+ }
940
+ if ( self.isExcludedWPBuiltinSetting( setId ) )
941
+ return false;
942
+ if ( _.contains( serverControlParams.skopeExcludedSettings, shortSetId ) ) {
943
+ return false;
944
+ } else if ( self.isThemeSetting( setId ) ) {
945
+ return true;
946
+ } else
947
+ return true;
948
+ },
949
+ isSettingResetEligible : function( setId ) {
950
+ var self = this,
951
+ shortSetId = api.CZR_Helpers.getOptionName( setId );
952
+
953
+ if( _.isUndefined( setId ) || ! api.has( setId ) ) {
954
+ api.consoleLog( 'THE SETTING ' + setId + ' IS NOT ELIGIBLE TO RESET BECAUSE UNDEFINED OR NOT REGISTERED IN THE API.' );
955
+ return;
956
+ }
957
+ if ( self.isExcludedWPBuiltinSetting( setId ) )
958
+ return;
959
+ if ( ! self.isThemeSetting( setId ) && ! self.isWPAuthorizedSetting( setId ) ) {
960
+ api.consoleLog( 'THE SETTING ' + setId + ' IS NOT ELIGIBLE TO RESET BECAUSE NOT PART OF THE THEME OPTIONS AND NOT WP AUTHORIZED BUILT IN OPTIONS' );
961
+ } else
962
+ return true;
963
+ },
964
+ isThemeSetting : function( setId ) {
965
+ return _.isString( setId ) && -1 !== setId.indexOf( serverControlParams.themeOptions );
966
+ },
967
+ isWPAuthorizedSetting : function( setId ) {
968
+ return _.isString( setId ) && _.contains( serverControlParams.wpBuiltinSettings, setId );
969
+ },
970
+ isExcludedWPBuiltinSetting : function( setId ) {
971
+ var self = this;
972
+ if ( _.isUndefined(setId) )
973
+ return true;
974
+ if ( 'active_theme' == setId )
975
+ return true;
976
+ if ( _.contains( serverControlParams.wpBuiltinSettings, setId ) )
977
+ return false;
978
+ var _patterns = [ 'widget_', 'nav_menu', 'sidebars_', 'custom_css', 'nav_menu[', 'nav_menu_item', 'nav_menus_created_posts', 'nav_menu_locations' ],
979
+ _isExcld = false;
980
+ _.each( _patterns, function( _ptrn ) {
981
+ switch( _ptrn ) {
982
+ case 'widget_' :
983
+ case 'sidebars_' :
984
+ if ( _ptrn == setId.substring( 0, _ptrn.length ) ) {
985
+ _isExcld = self.isExcludedSidebarsWidgets();
986
+ }
987
+ break;
988
+
989
+ case 'nav_menu[' :
990
+ case 'nav_menu_item' :
991
+ case 'nav_menus_created_posts' :
992
+ if ( _ptrn == setId.substring( 0, _ptrn.length ) ) {
993
+ _isExcld = true;
994
+ }
995
+ break;
996
+
997
+ case 'nav_menu_locations' :
998
+ if ( _ptrn == setId.substring( 0, _ptrn.length ) ) {
999
+ _isExcld = self.isExcludedNavMenuLocations();
1000
+ }
1001
+ break;
1002
+
1003
+ case 'custom_css' :
1004
+ if ( _ptrn == setId.substring( 0, _ptrn.length ) ) {
1005
+ _isExcld = self.isExcludedWPCustomCss();
1006
+ }
1007
+ break;
1008
+
1009
+
1010
+ }
1011
+ });
1012
+ return _isExcld;
1013
+ },
1014
+ isExcludedSidebarsWidgets : function() {
1015
+ var _servParam = serverControlParams.isSidebarsWigetsSkoped;//can be a boolean or a string "" for false, "1" for true
1016
+ return ! ( ! _.isUndefined( _servParam ) && ! _.isEmpty( _servParam ) && false !== _servParam );
1017
+ },
1018
+ isExcludedNavMenuLocations : function() {
1019
+ if ( ! api.czr_isChangeSetOn() )
1020
+ return true;
1021
+ var _servParam = serverControlParams.isNavMenuLocationsSkoped;//can be a boolean or a string "" for false, "1" for true
1022
+ return ! ( ! _.isUndefined( _servParam ) && ! _.isEmpty( _servParam ) && false !== _servParam );
1023
+ },
1024
+ isExcludedWPCustomCss : function() {
1025
+ var _servParam = serverControlParams.isWPCustomCssSkoped;//can be a boolean or a string "" for false, "1" for true
1026
+ return ! ( ! _.isUndefined( _servParam ) && ! _.isEmpty( _servParam ) && false !== _servParam );
1027
+ },
1028
+ _getDBSettingVal : function( setId, skope_id ) {
1029
+ var shortSetId = api.CZR_Helpers.getOptionName(setId),
1030
+ wpSetId = api.CZR_Helpers.build_setId(setId);
1031
+ if ( ! api.czr_skope.has( skope_id ) ) {
1032
+ api.consoleLog( '_getDBSettingVal : the requested skope id is not registered : ' + skope_id );
1033
+ return '_no_db_val';
1034
+ }
1035
+ if ( _.has( api.czr_skope( skope_id ).dbValues(), wpSetId ) ) {
1036
+ return api.czr_skope( skope_id ).dbValues()[wpSetId];
1037
+ } else if ( _.has( api.czr_skope( skope_id ).dbValues(), shortSetId ) ) {
1038
+ return api.czr_skope( skope_id ).dbValues()[shortSetId];
1039
+ } else {
1040
+ return '_no_db_val';
1041
+ }
1042
+ },
1043
+ getSkopeDirties : function( skope_id, options ) {
1044
+ if ( ! api.czr_skope.has( skope_id ) )
1045
+ return {};
1046
+ options = options || {};
1047
+ options = _.extend( { unsaved : true }, options );
1048
+
1049
+ var values = {};
1050
+ _.each( api.czr_skope( skope_id ).dirtyValues(), function( _val, _setId ) {
1051
+ var settingRevision;
1052
+ if ( api.czr_isChangeSetOn() ) {
1053
+ settingRevision = api._latestSettingRevisions[ _setId ];
1054
+ if ( api.state( 'changesetStatus' ).get() && ( options && options.unsaved ) && ( _.isUndefined( settingRevision ) || settingRevision <= api._lastSavedRevision ) ) {
1055
+ return;
1056
+ }
1057
+ }
1058
+ values[ _setId ] = _val;
1059
+ } );
1060
+ return values;
1061
+ },
1062
+
1063
+ getSkopeExcludedDirties : function() {
1064
+ var self = this,
1065
+ _wpDirties = {};
1066
+ api.each( function ( value, setId ) {
1067
+ if ( value._dirty ) {
1068
+ _wpDirties[ setId ] = value();
1069
+ }
1070
+ } );
1071
+ var _globalSkopeId = self.getGlobalSkopeId(),
1072
+ _globalSkpDirties = self.getSkopeDirties( _globalSkopeId );
1073
+ return _.omit( _wpDirties, function( _value, setId ) {
1074
+ return self.isSettingSkopeEligible( setId );
1075
+ } );
1076
+ },
1077
+ parseWidgetId : function( widgetId, prefixToRemove ) {
1078
+ var matches, parsed = {
1079
+ number: null,
1080
+ id_base: null
1081
+ };
1082
+
1083
+ matches = widgetId.match( /^(.+)-(\d+)$/ );
1084
+ if ( matches ) {
1085
+ parsed.id_base = matches[1];
1086
+ parsed.number = parseInt( matches[2], 10 );
1087
+ } else {
1088
+ parsed.id_base = widgetId;
1089
+ }
1090
+
1091
+ if ( ! _.isUndefined( prefixToRemove ) )
1092
+ parsed.id_base = parsed.id_base.replace( prefixToRemove , '');
1093
+ return parsed;
1094
+ },
1095
+ widgetIdToSettingId: function( widgetId , prefixToRemove ) {
1096
+ var parsed = this.parseWidgetId( widgetId, prefixToRemove ), settingId;
1097
+
1098
+ settingId = parsed.id_base;
1099
+ if ( parsed.number ) {
1100
+ settingId += '[' + parsed.number + ']';
1101
+ }
1102
+ return settingId;
1103
+ },
1104
+
1105
+
1106
+
1107
+
1108
+ isWidgetRegisteredGlobally : function( widgetId ) {
1109
+ var self = this;
1110
+ registered = false;
1111
+ _.each( _wpCustomizeWidgetsSettings.registeredWidgets, function( _val, _short_id ) {
1112
+ if ( ! registered && 'widget_' + self.widgetIdToSettingId(_short_id) == widgetId )
1113
+ registered = true;
1114
+ } );
1115
+ return registered;
1116
+ }
1117
+ });//$.extend
1118
+ var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
1119
+ $.extend( CZRSkopeBaseMths, {
1120
+
1121
+ getAppliedPrioritySkopeId : function( setId, skope_id ) {
1122
+ if ( ! api.has( api.CZR_Helpers.build_setId(setId) ) ) {
1123
+ throw new Error('getAppliedPrioritySkopeId : the requested setting id does not exist in the api : ' + api.CZR_Helpers.build_setId(setId) );
1124
+ }
1125
+ if ( ! api.czr_skope.has( skope_id ) ) {
1126
+ throw new Error('getAppliedPrioritySkopeId : the requested skope id is not registered : ' + skope_id );
1127
+ }
1128
+ var self = this,
1129
+ _local_skope_id = _.findWhere( api.czr_currentSkopesCollection(), { skope : 'local' } ).id;
1130
+
1131
+ if ( _.isUndefined( _local_skope_id ) || skope_id == _local_skope_id )
1132
+ return skope_id;
1133
+ var _salmonToMatch = function( _skp_id ) {
1134
+ var wpSetId = api.CZR_Helpers.build_setId( setId ),
1135
+ val_candidate = '___',
1136
+ skope_model = api.czr_skope( _skp_id )(),
1137
+ initial_val;
1138
+
1139
+ if ( _skp_id == skope_id )
1140
+ return skope_id;
1141
+ if ( api.czr_skope( _skp_id ).getSkopeSettingAPIDirtyness( wpSetId ) )
1142
+ return skope_model.id;
1143
+ if ( api.czr_isChangeSetOn() ) {
1144
+ if ( api.czr_skope( _skp_id ).getSkopeSettingChangesetDirtyness( wpSetId ) )
1145
+ return skope_model.id;
1146
+ }
1147
+ var _skope_db_val = self._getDBSettingVal( setId, _skp_id);
1148
+ if ( _skope_db_val != '_no_db_val' ) {
1149
+ return skope_model.id;
1150
+ }
1151
+ else if( 'global' == skope_model.skope ) {
1152
+ return skope_model.id;
1153
+ }
1154
+ else {
1155
+ return '___' != val_candidate ? skope_model.title : _salmonToMatch( self._getParentSkopeId( skope_model ) );
1156
+ }
1157
+ };
1158
+ return _salmonToMatch( _local_skope_id );
1159
+ },
1160
+ getOverridenSkopeTitles : function() {
1161
+ var skope_id = skope_id || api.czr_activeSkopeId();
1162
+ if ( ! api.czr_skope.has( skope_id ) ) {
1163
+ throw new Error('getInheritedSkopeTitles : the requested skope id is not registered : ' + skope_id );
1164
+ }
1165
+ var self = this,
1166
+ _local_skope_id = _.findWhere( api.czr_currentSkopesCollection(), { skope : 'local' } ).id;
1167
+
1168
+ if ( _.isUndefined( _local_skope_id ) || skope_id == _local_skope_id )
1169
+ return;
1170
+ var _salmonToMatch = function( _skp_id, _skp_ids ) {
1171
+ _skp_ids = _skp_ids || [];
1172
+ var skope_model = api.czr_skope( _skp_id )();
1173
+
1174
+ if ( _skp_id == skope_id )
1175
+ return _skp_ids;
1176
+ _skp_ids.unshift( _skp_id );
1177
+ return _salmonToMatch( self._getParentSkopeId( skope_model ), _skp_ids );
1178
+ };
1179
+
1180
+ return _.map( _salmonToMatch( _local_skope_id ), function( id ) {
1181
+ return self.buildSkopeLink( id );
1182
+ }).join(' and ');//@to_translate
1183
+ },
1184
+ getInheritedSkopeId : function( setId, skope_id ) {
1185
+ if ( ! api.has( api.CZR_Helpers.build_setId(setId) ) ) {
1186
+ throw new Error('getInheritedSkopeId : the requested setting id does not exist in the api : ' + api.CZR_Helpers.build_setId(setId) );
1187
+ }
1188
+ if ( ! api.czr_skope.has( skope_id ) ) {
1189
+ throw new Error('getInheritedSkopeId : the requested skope id is not registered : ' + skope_id );
1190
+ }
1191
+
1192
+ var self = this,
1193
+ wpSetId = api.CZR_Helpers.build_setId( setId ),
1194
+ val_candidate = '___',
1195
+ skope_model = api.czr_skope( skope_id )(),
1196
+ initial_val;
1197
+ if ( _.has( api.settings.settings, wpSetId ) )
1198
+ initial_val = api.settings.settings[wpSetId].value;
1199
+ else
1200
+ initial_val = null;
1201
+ if ( api.czr_skope( skope_id ).getSkopeSettingAPIDirtyness( wpSetId ) )
1202
+ return skope_id;
1203
+ if ( api.czr_isChangeSetOn() ) {
1204
+ if ( api.czr_skope( skope_id ).getSkopeSettingChangesetDirtyness( wpSetId ) )
1205
+ return skope_id;
1206
+ }
1207
+ var _skope_db_val = self._getDBSettingVal( setId, skope_id );
1208
+ if ( _skope_db_val != '_no_db_val' )
1209
+ return skope_id;
1210
+ else if( 'global' == skope_model.skope ) {
1211
+ return skope_id;
1212
+ }
1213
+ else
1214
+ return '___' != val_candidate ?skope_id : self.getInheritedSkopeId( setId, self._getParentSkopeId( skope_model ) );
1215
+ },
1216
+ getInheritedSkopeTitles : function( skope_id, skope_ids ) {
1217
+ skope_id = skope_id || api.czr_activeSkopeId();
1218
+ if ( ! api.czr_skope.has( skope_id ) ) {
1219
+ throw new Error('getInheritedSkopeTitles : the requested skope id is not registered : ' + skope_id );
1220
+ }
1221
+ skope_ids = skope_ids || [];
1222
+ var self = this,
1223
+ skope_model = api.czr_skope( skope_id )();
1224
+
1225
+ if ( skope_id !== api.czr_activeSkopeId() )
1226
+ skope_ids.unshift( skope_id );
1227
+
1228
+ if ( 'global' !== skope_model.skope )
1229
+ return self.getInheritedSkopeTitles( self._getParentSkopeId( skope_model ), skope_ids );
1230
+
1231
+ return _.map( skope_ids, function( id ) {
1232
+ return self.buildSkopeLink( id );
1233
+ }).join(' and ');//@to_translate
1234
+ },
1235
+
1236
+
1237
+ buildSkopeLink : function( skope_id ) {
1238
+ if ( ! api.czr_skope.has( skope_id ) ) {
1239
+ throw new Error('buildSkopeLink : the requested skope id is not registered : ' + skope_id );
1240
+ }
1241
+ var _link_title = "Switch to scope : " + api.czr_skope( skope_id )().title;//@to_translate
1242
+ return [
1243
+ '<span class="czr-skope-switch" title=" ' + _link_title + '" data-skope-id="' + skope_id + '">',
1244
+ api.czr_skope( skope_id )().title,
1245
+ '</span>'
1246
+ ].join( '' );
1247
+ },
1248
+ getSkopeSettingVal : function( setId, skope_id ) {
1249
+ if ( ! api.has( api.CZR_Helpers.build_setId(setId) ) ) {
1250
+ throw new Error('getSkopeSettingVal : the requested setting id does not exist in the api : ' + api.CZR_Helpers.build_setId(setId) );
1251
+ }
1252
+ if ( ! api.czr_skope.has( skope_id ) ) {
1253
+ throw new Error('getSkopeSettingVal : the requested skope id is not registered : ' + skope_id );
1254
+ }
1255
+
1256
+ var self = this,
1257
+ wpSetId = api.CZR_Helpers.build_setId( setId ),
1258
+ val_candidate = '___',
1259
+ skope_model = api.czr_skope( skope_id )(),
1260
+ initial_val;
1261
+ if ( _.has( api.settings.settings, wpSetId ) )
1262
+ initial_val = api.settings.settings[wpSetId].value;
1263
+ else
1264
+ initial_val = null;
1265
+ if ( api.czr_skope( skope_id ).getSkopeSettingAPIDirtyness( wpSetId ) )
1266
+ return api.czr_skope( skope_id ).dirtyValues()[ wpSetId ];
1267
+ if ( api.czr_isChangeSetOn() ) {
1268
+ if ( api.czr_skope( skope_id ).getSkopeSettingChangesetDirtyness( wpSetId ) )
1269
+ return api.czr_skope( skope_id ).changesetValues()[ wpSetId ];
1270
+ }
1271
+ var _skope_db_val = self._getDBSettingVal( setId, skope_id );
1272
+ if ( _skope_db_val != '_no_db_val' )
1273
+ return _skope_db_val;
1274
+ else if( 'global' == skope_model.skope ) {
1275
+ return '___' == val_candidate ? initial_val : val_candidate;
1276
+ }
1277
+ else
1278
+ return '___' != val_candidate ? val_candidate : self.getSkopeSettingVal( setId, self._getParentSkopeId( skope_model ) );
1279
+ },
1280
+ applyDirtyCustomizedInheritance : function( dirtyCustomized, skope_id ) {
1281
+ skope_id = skope_id || api.czr_activeSkopeId() || api.czr_skopeBase.getGlobalSkopeId();
1282
+ dirtyCustomized = dirtyCustomized || {};
1283
+
1284
+ var self = this,
1285
+ skope_model = api.czr_skope( skope_id )();
1286
+
1287
+ if ( 'global' == skope_model.skope )
1288
+ return dirtyCustomized;
1289
+
1290
+ var parent_skope_id = self._getParentSkopeId( skope_model ),
1291
+ parent_dirties = api.czr_skope( parent_skope_id ).dirtyValues();
1292
+ _.each( parent_dirties, function( _val, wpSetId ){
1293
+ var shortSetId = api.CZR_Helpers.getOptionName( wpSetId );
1294
+ if ( _.isUndefined( dirtyCustomized[wpSetId] ) && _.isUndefined( api.czr_skope( skope_model.id ).dbValues()[shortSetId] ) )
1295
+ dirtyCustomized[wpSetId] = _val;
1296
+ });
1297
+ return 'global' == api.czr_skope( parent_skope_id )().skope ? dirtyCustomized : self.applyDirtyCustomizedInheritance( dirtyCustomized, parent_skope_id );
1298
+ },
1299
+ _getParentSkopeId : function( skope_model, _index ) {
1300
+ var self = this,
1301
+ hierark = ['local', 'group', 'special_group', 'global'],
1302
+ parent_skope_ind = _index || ( _.findIndex( hierark, function( _skp ) { return skope_model.skope == _skp; } ) + 1 ) * 1,
1303
+ parent_skope_skope = hierark[ parent_skope_ind ];
1304
+
1305
+ if ( _.isUndefined( parent_skope_skope ) ) {
1306
+ return _.findWhere( api.czr_currentSkopesCollection(), { skope : 'global' } ).id;
1307
+ }
1308
+ if ( _.isUndefined( _.findWhere( api.czr_currentSkopesCollection(), { skope : parent_skope_skope } ) ) ) {
1309
+ return self._getParentSkopeId( skope_model, parent_skope_ind + 1 );
1310
+ }
1311
+ return _.findWhere( api.czr_currentSkopesCollection(), { skope : parent_skope_skope } ).id;
1312
+ },
1313
+ _getChildSkopeId : function( skope_model, _index ) {
1314
+ var self = this,
1315
+ hierark = ['local', 'group', 'special_group', 'global'],
1316
+ child_skope_ind = _index || ( _.findIndex( hierark, function( _skp ) { return skope_model.skope == _skp; } ) - 1 ) * 1,
1317
+ child_skope_skope = hierark[ child_skope_ind ];
1318
+
1319
+ if ( _.isUndefined( child_skope_skope ) ) {
1320
+ return _.findWhere( api.czr_currentSkopesCollection(), { skope : 'local' } ).id;
1321
+ }
1322
+ if ( _.isUndefined( _.findWhere( api.czr_currentSkopesCollection(), { skope : child_skope_skope } ) ) ) {
1323
+ return self._getParentSkopeId( skope_model, child_skope_ind - 1 );
1324
+ }
1325
+ return _.findWhere( api.czr_currentSkopesCollection(), { skope : child_skope_skope } ).id;
1326
+ }
1327
+
1328
+ });//$.extend
1329
+ var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
1330
+ $.extend( CZRSkopeBaseMths, {
1331
+ updateSkopeCollection : function( sent_collection, sent_channel ) {
1332
+ var self = this;
1333
+ _api_ready_collection = [];
1334
+ _.each( sent_collection, function( _skope, _key ) {
1335
+ var skope_candidate = $.extend( true, {}, _skope );//deep clone to avoid any shared references
1336
+ _api_ready_collection.push( self.prepareSkopeForAPI( skope_candidate ) );
1337
+ });
1338
+ if ( self.isGlobalSkopeRegistered() ) {
1339
+ var _updated_api_ready_collection = [],
1340
+ _global_skp_model = $.extend( true, {}, api.czr_skope( self.getGlobalSkopeId() )() );
1341
+
1342
+ _.each( _api_ready_collection, function( _skp, _k ) {
1343
+ if ( 'global' == _skp.skope )
1344
+ _updated_api_ready_collection.push( _global_skp_model );
1345
+ else
1346
+ _updated_api_ready_collection.push( _skp );
1347
+ });
1348
+ _api_ready_collection = _updated_api_ready_collection;
1349
+ }
1350
+ api.czr_currentSkopesCollection( _api_ready_collection );
1351
+ },
1352
+
1353
+
1354
+
1355
+ prepareSkopeForAPI : function( skope_candidate ) {
1356
+ if ( ! _.isObject( skope_candidate ) ) {
1357
+ throw new Error('prepareSkopeForAPI : a skope must be an object to be API ready');
1358
+ }
1359
+ var self = this,
1360
+ api_ready_skope = {};
1361
+
1362
+ _.each( serverControlParams.defaultSkopeModel , function( _value, _key ) {
1363
+ var _candidate_val = skope_candidate[_key];
1364
+ switch( _key ) {
1365
+ case 'title' :
1366
+ if ( ! _.isString( _candidate_val ) ) {
1367
+ throw new Error('prepareSkopeForAPI : a skope title property must a string');
1368
+ }
1369
+ api_ready_skope[_key] = _candidate_val;
1370
+ break;
1371
+ case 'long_title' :
1372
+ if ( ! _.isString( _candidate_val ) ) {
1373
+ throw new Error('prepareSkopeForAPI : a skope title property must a string');
1374
+ }
1375
+ api_ready_skope[_key] = _candidate_val;
1376
+ break;
1377
+ case 'skope' :
1378
+ if ( ! _.isString( _candidate_val ) || _.isEmpty( _candidate_val ) ) {
1379
+ throw new Error('prepareSkopeForAPI : a skope "skope" property must a string not empty');
1380
+ }
1381
+ api_ready_skope[_key] = _candidate_val;
1382
+ break;
1383
+ case 'level' :
1384
+ if ( ! _.isString( _candidate_val ) || _.isEmpty( _candidate_val ) ) {
1385
+ throw new Error('prepareSkopeForAPI : a skope level must a string not empty for skope ' + _candidate_val.skope );
1386
+ }
1387
+ api_ready_skope[_key] = _candidate_val;
1388
+ break;
1389
+ case 'dyn_type' :
1390
+ if ( ! _.isString( _candidate_val ) || ! _.contains( serverControlParams.skopeDynTypes, _candidate_val ) ) {
1391
+ throw new Error('prepareSkopeForAPI : missing or invalid dyn type for skope ' + skope_candidate );
1392
+ }
1393
+ api_ready_skope[_key] = _candidate_val;
1394
+ break;
1395
+ case 'opt_name' :
1396
+ if ( ! _.isString( _candidate_val ) || _.isEmpty( _candidate_val ) ) {
1397
+ throw new Error('prepareSkopeForAPI : invalid "opt_name" property for skope ' + _candidate_val.skope );
1398
+ }
1399
+ api_ready_skope[_key] = _candidate_val;
1400
+ break;
1401
+ case 'obj_id' :
1402
+ if ( ! _.isString( _candidate_val ) ) {
1403
+ throw new Error('prepareSkopeForAPI : invalid "obj_id" for skope ' + _candidate_val.skope );
1404
+ }
1405
+ api_ready_skope[_key] = _candidate_val;
1406
+ break;
1407
+ case 'is_winner' :
1408
+ if ( ! _.isUndefined( _candidate_val) && ! _.isBoolean( _candidate_val ) ) {
1409
+ throw new Error('prepareSkopeForAPI : skope property "is_winner" must be a boolean');
1410
+ }
1411
+ api_ready_skope[_key] = _candidate_val;
1412
+ break;
1413
+ case 'is_forced' :
1414
+ if ( ! _.isUndefined( _candidate_val) && ! _.isBoolean( _candidate_val ) ) {
1415
+ throw new Error('prepareSkopeForAPI : skope property "is_primary" must be a boolean');
1416
+ }
1417
+ api_ready_skope[_key] = _candidate_val;
1418
+ break;
1419
+ case 'db' :
1420
+ if ( _.isArray( _candidate_val ) || _.isEmpty( _candidate_val ) )
1421
+ _candidate_val = {};
1422
+ if ( _.isUndefined( _candidate_val) || ! _.isObject( _candidate_val ) ) {
1423
+ throw new Error('prepareSkopeForAPI : skope property "db" must be an object');
1424
+ }
1425
+ api_ready_skope[_key] = _candidate_val;
1426
+ break;
1427
+ case 'changeset' :
1428
+ if ( _.isArray( _candidate_val ) || _.isEmpty( _candidate_val ) )
1429
+ _candidate_val = {};
1430
+ if ( _.isUndefined( _candidate_val) || ! _.isObject( _candidate_val ) ) {
1431
+ throw new Error('prepareSkopeForAPI : skope property "changeset" must be an object');
1432
+ }
1433
+ api_ready_skope[_key] = _candidate_val;
1434
+ break;
1435
+ case 'has_db_val' :
1436
+ if ( ! _.isUndefined( _candidate_val) && ! _.isBoolean( _candidate_val ) ) {
1437
+ throw new Error('prepareSkopeForAPI : skope property "has_db_val" must be a boolean');
1438
+ }
1439
+ api_ready_skope[_key] = _candidate_val;
1440
+ break;
1441
+ }//switch
1442
+ });
1443
+ api_ready_skope.color = self.skope_colors[ api_ready_skope.skope ] || 'rgb(255, 255, 255)';
1444
+ api_ready_skope.id = api_ready_skope.skope + '_' + api_ready_skope.level;
1445
+ if ( ! _.isString( api_ready_skope.id ) || _.isEmpty( api_ready_skope.id ) ) {
1446
+ throw new Error('prepareSkopeForAPI : a skope id must a string not empty');
1447
+ }
1448
+ if ( ! _.isString( api_ready_skope.title ) || _.isEmpty( api_ready_skope.title ) ) {
1449
+ api_ready_skope.title = id;
1450
+ api_ready_skope.long_title = id;
1451
+ }
1452
+ return api_ready_skope;
1453
+ },
1454
+ currentSkopesCollectionReact : function( to, from ) {
1455
+ var self = this,
1456
+ _new_collection = $.extend( true, [], to ) || [],
1457
+ _old_collection = $.extend( true, [], from ) || [],
1458
+ dfd = $.Deferred();
1459
+ var _to_instantiate = [];
1460
+ var _to_remove = [];
1461
+ var _to_update = [];
1462
+ _.each( _new_collection, function( _sent_skope ) {
1463
+ if ( ! api.czr_skope.has( _sent_skope.id ) )
1464
+ _to_instantiate.push( _sent_skope );
1465
+ });
1466
+ _.each( _to_instantiate, function( _skope ) {
1467
+ _skope = $.extend( true, {}, _skope );//use a cloned skop to instantiate : @todo : do we still need that ?
1468
+ api.czr_skope.add( _skope.id , new api.CZR_skope( _skope.id , _skope ) );
1469
+ });
1470
+ _.each( _to_instantiate, function( _skope ) {
1471
+ if ( ! api.czr_skope.has( _skope.id ) ) {
1472
+ throw new Error( 'Skope id : ' + _skope.id + ' has not been instantiated.');
1473
+ }
1474
+ if ( 'pending' == api.czr_skope( _skope.id ).isReady.state() ) {
1475
+ api.czr_skope( _skope.id ).ready();
1476
+ }
1477
+ });
1478
+ var _activeSkopeNum = _.size( _new_collection ),
1479
+ _setLayoutClass = function( _skp_instance ) {
1480
+ var _newClasses = _skp_instance.container.attr('class').split(' ');
1481
+ _.each( _skp_instance.container.attr('class').split(' '), function( _c ) {
1482
+ if ( 'width-' == _c.substring( 0, 6) ) {
1483
+ _newClasses = _.without( _newClasses, _c );
1484
+ }
1485
+ });
1486
+ $.when( _skp_instance.container.attr('class', _newClasses.join(' ') ) )
1487
+ .done( function() {
1488
+ _skp_instance.container.addClass( 'width-' + ( Math.round( 100 / _activeSkopeNum ) ) );
1489
+ });
1490
+ };
1491
+ api.czr_skope.each( function( _skp_instance ){
1492
+ if ( _.isUndefined( _.findWhere( _new_collection, { id : _skp_instance().id } ) ) ) {
1493
+ _skp_instance.visible( false );
1494
+ _skp_instance.isReady.then( function() {
1495
+ _skp_instance.container.toggleClass( 'active-collection', false );
1496
+ });
1497
+ }
1498
+ else {
1499
+ _skp_instance.visible( true );
1500
+ var _activeSkpDomPostProcess = function() {
1501
+ _setLayoutClass( _skp_instance );
1502
+ _skp_instance.container.toggleClass( 'active-collection', true );
1503
+ };
1504
+ if ( 'pending' == _skp_instance.isReady.state() ) {
1505
+ _skp_instance.isReady.then( function() {
1506
+ _activeSkpDomPostProcess();
1507
+ });
1508
+ } else {
1509
+ _activeSkpDomPostProcess();
1510
+ }
1511
+ }
1512
+ } );
1513
+ if ( _.isEmpty(from) && ! _.isEmpty(to) )
1514
+ api.czr_initialSkopeCollectionPopulated.resolve();
1515
+ self.maybeSynchronizeGlobalSkope();
1516
+
1517
+ return dfd.resolve( 'changed' ).promise();
1518
+ },//listenToSkopeCollection()
1519
+ maybeSynchronizeGlobalSkope : function( args ) {
1520
+ args = args || {};
1521
+ if ( ! _.isObject( args ) ) {
1522
+ throw new Error('maybeSynchronizeGlobalSkope : args must be an object');
1523
+ }
1524
+ var self = this,
1525
+ dfd = $.Deferred(),
1526
+ defaults = _.extend({
1527
+ isGlobalReset : false,
1528
+ isSetting : false,
1529
+ settingIdToReset : '',
1530
+ isSkope : false,
1531
+ skopeIdToReset : ''
1532
+ },
1533
+ args
1534
+ ),
1535
+ _setIdToReset,
1536
+ shortSetId,
1537
+ defaultVal;
1538
+
1539
+ if ( self.isGlobalSkopeRegistered() ) {
1540
+ var _global_skp_db_values = api.czr_skope( self.getGlobalSkopeId() ).dbValues();
1541
+ _.each( _global_skp_db_values, function( _val, setId ){
1542
+ if ( api.has( setId ) && ! _.isEqual( api.settings.settings[setId].value, _val ) ) {
1543
+ api.settings.settings[setId].value = _val;
1544
+ }
1545
+ });
1546
+ if ( args.isGlobalReset && args.isSetting ) {
1547
+ _setIdToReset = args.settingIdToReset;
1548
+ shortSetId = api.CZR_Helpers.getOptionName( _setIdToReset );
1549
+ defaultVal = serverControlParams.defaultOptionsValues[ shortSetId ];
1550
+
1551
+ if ( _.isUndefined( api.settings.settings[ _setIdToReset ] ) || _.isUndefined( defaultVal ) )
1552
+ return;
1553
+ if ( defaultVal != api.settings.settings[ _setIdToReset ].value ) {
1554
+ api.settings.settings[ _setIdToReset ].value = defaultVal;
1555
+ }
1556
+ }
1557
+ if ( args.isGlobalReset && args.isSkope ) {
1558
+ _.each( api.settings.settings, function( _params, _setId ) {
1559
+ if ( ! self.isThemeSetting( _setId ) )
1560
+ return;
1561
+
1562
+ shortSetId = api.CZR_Helpers.getOptionName( _setId );
1563
+ if ( ! _.has( serverControlParams.defaultOptionsValues, shortSetId ) )
1564
+ return;
1565
+ api.settings.settings[_setId].value = serverControlParams.defaultOptionsValues[ shortSetId ];
1566
+ });
1567
+ }
1568
+ }
1569
+ return dfd.resolve().promise();
1570
+ }
1571
+ });//$.extend
1572
+ var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
1573
+ $.extend( CZRSkopeBaseMths, {
1574
+ activeSkopeReact : function( to, from ) {
1575
+ var self = this, dfd = $.Deferred();
1576
+ if ( ! _.isUndefined(from) && api.czr_skope.has(from) )
1577
+ api.czr_skope(from).active(false);
1578
+ else if ( ! _.isUndefined(from) )
1579
+ throw new Error('listenToActiveSkope : previous scope does not exist in the collection', from );
1580
+
1581
+ if ( ! _.isUndefined(to) && api.czr_skope.has(to) )
1582
+ api.czr_skope(to).active(true);
1583
+ else
1584
+ throw new Error('listenToActiveSkope : requested scope ' + to + ' does not exist in the collection');
1585
+ var _switchBack = function( _title ) {
1586
+ api.czr_activeSkopeId( self.getGlobalSkopeId() );
1587
+ api.czr_serverNotification({
1588
+ status:'success',
1589
+ message : [ _title , 'can only be customized site wide.' ].join(' ')
1590
+ });
1591
+ return dfd.resolve().promise();
1592
+ };
1593
+ if ( self.isExcludedSidebarsWidgets() && 'widgets' == api.czr_activePanelId() && to != self.getGlobalSkopeId() ) {
1594
+ api.czr_serverNotification({
1595
+ status:'success',
1596
+ message : [
1597
+ 'Widgets are created site wide.'//@to_translate
1598
+ ].join(' ')
1599
+ });
1600
+ }
1601
+ if ( self.isExcludedWPCustomCss() && 'custom_css' == api.czr_activeSectionId() && to != self.getGlobalSkopeId() ) {
1602
+ return _switchBack( api.section( api.czr_activeSectionId() ).params.title );
1603
+ }
1604
+ if ( 'admin_sec' == api.czr_activeSectionId() && to != self.getGlobalSkopeId() ) {
1605
+ return _switchBack( api.section( api.czr_activeSectionId() ).params.title );
1606
+ }
1607
+ if ( ( 'nav_menu' == api.czr_activeSectionId().substring( 0, 'nav_menu'.length ) || 'add_menu' == api.czr_activeSectionId() ) && to != self.getGlobalSkopeId() ) {
1608
+ api.czr_serverNotification({
1609
+ status:'success',
1610
+ message : [
1611
+ 'Menus are created site wide.'//@to_translate
1612
+ ].join(' ')
1613
+ });
1614
+ }
1615
+ if ( 'nav_menus' == api.czr_activePanelId() ) {
1616
+ _.each( api.panel( api.czr_activePanelId() ).sections(), function( _sec ) {
1617
+ self.processSilentUpdates( { section_id : _sec.id, awake_if_not_active : true } );
1618
+ });
1619
+ }
1620
+ api.state('switching-skope')( true );
1621
+ self._writeCurrentSkopeTitle( to );
1622
+ api.trigger( 'czr-paint', { is_skope_switch : true } );
1623
+ if ( _.isUndefined( api.czr_activeSectionId() ) ) {
1624
+ api.state('switching-skope')( false );
1625
+ api.previewer.refresh();
1626
+ return dfd.resolve().promise();
1627
+ }
1628
+ if ( _.has( api, 'czrModulePanelState') )
1629
+ api.czrModulePanelState(false);
1630
+ var _silentUpdateCands = self._getSilentUpdateCandidates();
1631
+ if ( ! _.isUndefined( from ) ) {
1632
+ _.each( api.czr_skope( from ).dirtyValues(), function( val, _setId ) {
1633
+ if ( ! _.contains( _silentUpdateCands, _setId ) )
1634
+ _silentUpdateCands.push( _setId );
1635
+ } );
1636
+ }
1637
+ if ( ! _.isUndefined( to ) ) {
1638
+ _.each( api.czr_skope( to ).dirtyValues(), function( val, _setId ) {
1639
+ if ( ! _.contains( _silentUpdateCands, _setId ) )
1640
+ _silentUpdateCands.push( _setId );
1641
+ } );
1642
+ }
1643
+ var _debouncedProcessSilentUpdates = function() {
1644
+ self.processSilentUpdates( {
1645
+ candidates : _silentUpdateCands,
1646
+ section_id : null,
1647
+ refresh : false//will be done on done()
1648
+ })
1649
+ .fail( function() {
1650
+ dfd.reject();
1651
+ api.state('switching-skope')( false );
1652
+ throw new Error( 'Fail to process silent updates in _debouncedProcessSilentUpdates');
1653
+ })
1654
+ .done( function( _updatedSetIds ) {
1655
+ api.previewer.refresh()
1656
+ .always( function() {
1657
+ api.trigger( 'skope-switched', to, from );
1658
+ dfd.resolve();
1659
+ api.state('switching-skope')( false );
1660
+ });
1661
+ });
1662
+ };
1663
+ if ( _.has(api, 'czr_isModuleExpanded') && false !== api.czr_isModuleExpanded() ) {
1664
+ api.czr_isModuleExpanded().setupModuleViewStateListeners(false);
1665
+ _debouncedProcessSilentUpdates = _.debounce( _debouncedProcessSilentUpdates, 400 );
1666
+ _debouncedProcessSilentUpdates();
1667
+ } else {
1668
+ _debouncedProcessSilentUpdates();
1669
+ }
1670
+
1671
+ return dfd.promise();
1672
+ },
1673
+ _writeCurrentSkopeTitle : function( skope_id ) {
1674
+ var self = this,
1675
+ current_title = api.czr_skope( skope_id || api.czr_activeSkopeId() )().long_title,
1676
+ _buildTitleHtml = function() {
1677
+ var _inheritedFrom = self.getInheritedSkopeTitles(),
1678
+ _overrides = self.getOverridenSkopeTitles();
1679
+
1680
+ return $.trim( [
1681
+ '<span class="czr-main-title"><span class="czr-toggle-title-notice fa fa-info-circle"></span>',
1682
+ 'global' == api.czr_skope( skope_id || api.czr_activeSkopeId() )().skope ? current_title : ['Customizing', current_title ].join(' '),
1683
+ '</span>',
1684
+ '<span class="czr-skope-inherits-from">',
1685
+ 'In this context :',//@to_translate
1686
+ _.isEmpty( _inheritedFrom ) ? ' ' : 'inherits from',//@to_translate
1687
+ _inheritedFrom,
1688
+ _.isEmpty( _inheritedFrom ) ? '' : _.isEmpty( _overrides ) ? '.' : ', and',//@to_translate
1689
+ _.isEmpty( _overrides ) ? ' ' : 'overridden by',//@to_translate
1690
+ _overrides,
1691
+ _.isEmpty( _overrides ) ? '' : '.',
1692
+ '</span>'
1693
+ ].join(' ') );
1694
+ },
1695
+ _toggle_spinner = function( visible ) {
1696
+ if ( visible ) {
1697
+ $('.czr-scope-switcher').find('.spinner').fadeIn();
1698
+ } else {
1699
+ $('.czr-scope-switcher').find('.spinner').fadeOut();
1700
+ }
1701
+ };
1702
+ self.skopeWrapperEmbedded
1703
+ .then( function() {
1704
+ if ( ! $('.czr-scope-switcher').find('.czr-current-skope-title').length ) {
1705
+ $('.czr-scope-switcher').prepend(
1706
+ $( '<h2/>', {
1707
+ class : 'czr-current-skope-title',
1708
+ html : [
1709
+ '<span class="czr-skope-title">',
1710
+ '<span class="spinner">',
1711
+ _buildTitleHtml(),
1712
+ '</span>',
1713
+ '</span>'
1714
+ ].join('')
1715
+ })
1716
+ );
1717
+ } else {
1718
+ $.when( $('.czr-scope-switcher').find('.czr-skope-title').fadeOut(200) ).done( function() {
1719
+ $(this)
1720
+ .html( _buildTitleHtml() )
1721
+ .fadeIn(200);
1722
+ });
1723
+ }
1724
+
1725
+ if ( _.isUndefined( api.state( 'switching-skope' ).isBound ) ) {
1726
+ api.state('switching-skope').bind( _toggle_spinner );
1727
+ api.state( 'switching-skope' ).isBound = true;
1728
+ }
1729
+ });
1730
+ }
1731
+ });//$.extend
1732
+ var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
1733
+ $.extend( CZRSkopeBaseMths, {
1734
+ processSilentUpdates : function( params ) {
1735
+ if ( _.isString( params ) )
1736
+ params = { candidates : [ params ] };
1737
+ else
1738
+ params = params || {};
1739
+
1740
+ var self = this,
1741
+ defaultParams = {
1742
+ candidates : [],
1743
+ section_id : api.czr_activeSectionId(),
1744
+ refresh : true,
1745
+ awake_if_not_active : false
1746
+ },
1747
+ dfd = $.Deferred();
1748
+
1749
+ params = $.extend( defaultParams, params );
1750
+ if ( _.isString( params.candidates ) ) {
1751
+ params.candidates = [ params.candidates ];
1752
+ }
1753
+ if ( _.isEmpty( params.candidates ) )
1754
+ params.candidates = self._getSilentUpdateCandidates( params.section_id, params.awake_if_not_active );
1755
+ if ( ! _.isArray( params.candidates ) ) {
1756
+ throw new Error('processSilentUpdates : the update candidates must be an array.');
1757
+ }
1758
+ if ( _.isEmpty( params.candidates ) )
1759
+ return dfd.resolve( [] ).promise();
1760
+
1761
+
1762
+ var _enjoyTheSilence = function() {
1763
+ self.silentlyUpdateSettings( params.candidates, params.refresh )
1764
+ .fail( function() {
1765
+ dfd.reject();
1766
+ })
1767
+ .done( function( updated_settings ) {
1768
+ _.delay( function() {
1769
+ self.setupActiveSkopedControls( {
1770
+ section_id : params.section_id
1771
+ });
1772
+ }, 1000 );
1773
+ dfd.resolve( updated_settings );
1774
+ });
1775
+ };
1776
+ if ( 'pending' == api.czr_skopeReady.state() ) {
1777
+ dfd.resolve( [] );
1778
+ api.czr_skopeReady.done( function() {
1779
+ _enjoyTheSilence();
1780
+ });
1781
+ } else {
1782
+ _enjoyTheSilence();
1783
+ }
1784
+
1785
+ return dfd.promise();
1786
+ },
1787
+ silentlyUpdateSettings : function( _silentUpdateCands, refresh ) {
1788
+ if ( ! api.state.has( 'silent-update-processing') )
1789
+ api.state.create( 'silent-update-processing' )( false );
1790
+
1791
+ api.state( 'silent-update-processing' )(true);
1792
+ var self = this,
1793
+ _silentUpdatePromises = {},
1794
+ dfd = $.Deferred();
1795
+
1796
+ refresh = _.isUndefined( refresh ) ? true : refresh;
1797
+
1798
+ if ( _.isUndefined( _silentUpdateCands ) || _.isEmpty( _silentUpdateCands ) ) {
1799
+ _silentUpdateCands = self._getSilentUpdateCandidates();
1800
+ }
1801
+
1802
+ if ( _.isString( _silentUpdateCands ) ) {
1803
+ _silentUpdateCands = [ _silentUpdateCands ];
1804
+ }
1805
+ _.each( _silentUpdateCands, function( setId ) {
1806
+ if ( api.control.has( setId ) && 'czr_multi_module' == api.control(setId).params.type )
1807
+ return;
1808
+ _silentUpdatePromises[setId] = self.getSettingUpdatePromise( setId );
1809
+ });
1810
+
1811
+
1812
+ var _deferred = [],
1813
+ _updatedSetIds = [];
1814
+ _.each( _silentUpdatePromises, function( _promise_ , setId ) {
1815
+ _promise_.done( function( _new_setting_val_ ) {
1816
+ var wpSetId = api.CZR_Helpers.build_setId( setId ),
1817
+ _skopeDirtyness = api.czr_skope( api.czr_activeSkopeId() ).getSkopeSettingDirtyness( setId );
1818
+ if ( ! _.isEqual( api( wpSetId )(), _new_setting_val_ ) ) {
1819
+ _updatedSetIds.push( setId );
1820
+ }
1821
+ api( wpSetId ).silent_set( _new_setting_val_ , _skopeDirtyness );
1822
+ });
1823
+
1824
+ _deferred.push( _promise_ );
1825
+ });
1826
+ $.when.apply( null, _deferred )
1827
+ .fail( function() {
1828
+ dfd.reject();
1829
+ throw new Error( 'silentlyUpdateSettings FAILED. Candidates : ' + _silentUpdateCands );
1830
+ })
1831
+ .always( function() {
1832
+ api.state( 'silent-update-processing' )( false );
1833
+ })
1834
+ .then( function() {
1835
+ _.each( _deferred, function( prom ){
1836
+ if ( _.isObject( prom ) && 'resolved' !== prom.state() ) {
1837
+ throw new Error( 'a silent update promise is unresolved : ' + _silentUpdateCands );
1838
+ }
1839
+ });
1840
+ if ( refresh && ! _.isEmpty( _updatedSetIds ) ) {
1841
+ api.previewer.refresh()
1842
+ .always( function() {
1843
+ dfd.resolve( _updatedSetIds );
1844
+ });
1845
+ } else {
1846
+ dfd.resolve( _updatedSetIds );
1847
+ }
1848
+ });
1849
+ return dfd.promise();
1850
+ },
1851
+ getSettingUpdatePromise : function( setId ) {
1852
+ if ( _.isUndefined( setId ) ) {
1853
+ throw new Error('getSettingUpdatePromise : the provided setId is not defined');
1854
+ }
1855
+ if ( ! api.has( api.CZR_Helpers.build_setId( setId ) ) ) {
1856
+ throw new Error('getSettingUpdatePromise : the provided wpSetId is not registered : ' + api.CZR_Helpers.build_setId( setId ) );
1857
+ }
1858
+
1859
+ var self = this,
1860
+ wpSetId = api.CZR_Helpers.build_setId( setId ),
1861
+ current_setting_val = api( wpSetId )(),//typically the previous skope val
1862
+ dfd = $.Deferred(),
1863
+ _promise = false,
1864
+ skope_id = api.czr_activeSkopeId(),
1865
+ val = api.czr_skopeBase.getSkopeSettingVal( setId, skope_id );
1866
+ if ( _.isEqual( current_setting_val, val ) ) {
1867
+ return dfd.resolve( val ).promise();
1868
+ }
1869
+ if ( api.control.has( wpSetId ) ) {
1870
+ var control_type = api.control( wpSetId ).params.type,
1871
+ _control_data = api.settings.controls[wpSetId],
1872
+ _constructor;
1873
+
1874
+ switch ( control_type ) {
1875
+ case 'czr_cropped_image' :
1876
+ _promise = self._getCzrCroppedImagePromise( wpSetId, _control_data );
1877
+ break;
1878
+
1879
+ case 'czr_module' :
1880
+ self._processCzrModuleSilentActions( wpSetId, control_type, skope_id , _control_data);
1881
+ break;
1882
+ }//switch
1883
+ }//end if api.control.has( wpSetId )
1884
+ if ( _.has(api.settings.controls, 'header_image') && 'header_image' == wpSetId ) {
1885
+ _promise = self._getHeaderImagePromise( wpSetId, skope_id );
1886
+ }
1887
+ if ( ! _promise || ! _.isObject( _promise ) ) {
1888
+ dfd.resolve( val );
1889
+ } else {
1890
+ _promise.always( function() {
1891
+ dfd.resolve( val );
1892
+ });
1893
+ }
1894
+
1895
+ return dfd.promise();
1896
+ },//getSettingUpdatePromise()
1897
+ _getSilentUpdateCandidates : function( section_id, awake_if_not_active ) {
1898
+ var self = this,
1899
+ SilentUpdateCands = [];
1900
+ section_id = ( _.isUndefined( section_id ) || _.isNull( section_id ) ) ? api.czr_activeSectionId() : section_id;
1901
+ if ( _.isEmpty( api.czr_activeSectionId() ) && ! awake_if_not_active ) {
1902
+ return [];
1903
+ }
1904
+ if ( _.isUndefined( section_id ) ) {
1905
+ api.consoleLog( '_getSilentUpdateCandidates : No active section provided');
1906
+ return [];
1907
+ }
1908
+ if ( ! api.section.has( section_id ) ) {
1909
+ throw new Error( '_getSilentUpdateCandidates : The section ' + section_id + ' is not registered in the API.');
1910
+ }
1911
+ var section_settings = api.CZR_Helpers.getSectionSettingIds( section_id );
1912
+ section_settings = _.filter( section_settings, function( setId ) {
1913
+ return self.isSettingSkopeEligible( setId );
1914
+ });
1915
+ _.each( section_settings, function( setId ) {
1916
+ SilentUpdateCands.push( setId );
1917
+ });
1918
+
1919
+ return SilentUpdateCands;
1920
+ }
1921
+
1922
+ });//$.extend
1923
+ var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
1924
+ $.extend( CZRSkopeBaseMths, {
1925
+ _processCzrModuleSilentActions : function( wpSetId, control_type, skope_id, _control_data) {
1926
+ var _synced_control_id, _synced_control_val, _synced_control_data, _synced_control_constructor, _syncSektionModuleId,
1927
+ _synced_short_id = _.has( api.control( wpSetId ).params, 'syncCollection' ) ? api.control( wpSetId ).params.syncCollection : '',
1928
+ _shortSetId = api.CZR_Helpers.build_setId(wpSetId),
1929
+ _val = api.czr_skopeBase.getSkopeSettingVal( _shortSetId, skope_id ),
1930
+ current_skope_instance = api.czr_skope( api.czr_activeSkopeId() );
1931
+ if ( ! _.isEmpty( _synced_short_id ) && ! _.isUndefined( _synced_short_id ) ) {
1932
+ _synced_control_id = api.CZR_Helpers.build_setId( _synced_short_id );
1933
+ _synced_control_val = api.czr_skopeBase.getSkopeSettingVal( _synced_control_id, skope_id );
1934
+ _synced_control_data = api.settings.controls[_synced_control_id];
1935
+ _synced_control_constructor = api.controlConstructor.czr_multi_module;
1936
+ _syncSektionModuleId = api.control( _synced_control_id ).syncSektionModule()().id;
1937
+ api.control( _synced_control_id ).container.remove();
1938
+ api.control.remove(_synced_control_id );
1939
+ api( _synced_control_id ).silent_set( _synced_control_val, current_skope_instance.getSkopeSettingDirtyness( _synced_control_id ) );
1940
+ $.extend( _synced_control_data, { czr_skope : skope_id });
1941
+ api.control.add( _synced_control_id, new _synced_control_constructor( _synced_control_id, { params : _synced_control_data, previewer : api.previewer }) );
1942
+ }
1943
+
1944
+ _constructor = api.controlConstructor[control_type];
1945
+ api.control( wpSetId ).container.remove();
1946
+ api.control.remove( wpSetId );
1947
+ api( wpSetId ).silent_set( _val, current_skope_instance.getSkopeSettingDirtyness( _shortSetId ) );
1948
+ $.extend( _control_data, { czr_skope : skope_id });
1949
+ api.control.add( wpSetId, new _constructor( wpSetId, { params : _control_data, previewer : api.previewer }) );
1950
+ if ( ! _.isEmpty( _synced_short_id ) && ! _.isUndefined( _synced_short_id ) ) {
1951
+ api.consoleLog('FIRE SEKTION MODULE?', _syncSektionModuleId, api.control( wpSetId ).czr_Module( _syncSektionModuleId ).isReady.state() );
1952
+ api.control( wpSetId ).czr_Module( _syncSektionModuleId ).fireSektionModule();
1953
+ }
1954
+ },
1955
+ _getCzrCroppedImagePromise : function( wpSetId, _control_data ) {
1956
+ var _constructor = api.controlConstructor.czr_cropped_image, dfd = $.Deferred(),
1957
+ val = api.has(wpSetId) ? api(wpSetId)() : null;
1958
+ val = null === val ? "" : val;
1959
+ wp.media.attachment( val ).fetch().done( function() {
1960
+ api.control( wpSetId ).container.remove();
1961
+ api.control.remove( wpSetId );
1962
+ _control_data.attachment = this.attributes;
1963
+ api.control.add( wpSetId, new _constructor( wpSetId, { params : _control_data, previewer : api.previewer }) );
1964
+ dfd.resolve();
1965
+ } ).fail( function() {
1966
+ api.control( wpSetId ).container.remove();
1967
+ api.control.remove( wpSetId );
1968
+ _control_data = _.omit( _control_data, 'attachment' );
1969
+ api.control.add( wpSetId, new _constructor( wpSetId, { params : _control_data, previewer : api.previewer }) );
1970
+ dfd.reject();
1971
+ });
1972
+ return dfd.promise();
1973
+ },
1974
+ _getHeaderImagePromise : function( wpSetId, skope_id ) {
1975
+ var dfd = $.Deferred();
1976
+ if ( ! _.has(api.settings.controls, 'header_image') || 'header_image' != wpSetId ) {
1977
+ return dfd.resolve().promise();
1978
+ }
1979
+
1980
+ var _header_constructor = api.controlConstructor.header,
1981
+ _header_control_data = $.extend( true, {}, api.settings.controls.header_image );
1982
+ header_image_data = null === api.czr_skopeBase.getSkopeSettingVal( 'header_image_data', skope_id ) ? "" : api.czr_skopeBase.getSkopeSettingVal( 'header_image_data', skope_id );
1983
+
1984
+ var attachment_id;
1985
+ var _reset_header_image_crtl = function( _updated_header_control_data ) {
1986
+ _updated_header_control_data = _updated_header_control_data || _header_control_data;
1987
+ api.control( 'header_image' ).container.remove();
1988
+ api.control.remove( 'header_image' );
1989
+ api.HeaderTool.UploadsList = api.czr_HeaderTool.UploadsList;
1990
+ api.HeaderTool.DefaultsList = api.czr_HeaderTool.DefaultsList;
1991
+ api.HeaderTool.CombinedList = api.czr_HeaderTool.CombinedList;
1992
+ var _render_control = function() {
1993
+ api.control.add( 'header_image', new _header_constructor( 'header_image', { params : _updated_header_control_data, previewer : api.previewer }) );
1994
+ };
1995
+ _render_control = _.debounce( _render_control, 800 );
1996
+ _render_control();
1997
+ };
1998
+
1999
+
2000
+ if ( ! _.has( header_image_data, 'attachment_id' ) ) {
2001
+ _reset_header_image_crtl();
2002
+ dfd.resolve();
2003
+ } else {
2004
+ attachment_id = header_image_data.attachment_id;
2005
+ wp.media.attachment( attachment_id ).fetch().done( function() {
2006
+ _header_control_data.attachment = this.attributes;
2007
+ _reset_header_image_crtl( _header_control_data );
2008
+ dfd.resolve();
2009
+ } ).fail( function() {
2010
+ _header_control_data = _.omit( _header_control_data, 'attachment' );
2011
+ api.control( 'header_image' ).container.remove();
2012
+ api.control.remove( 'header_image' );
2013
+ api.HeaderTool.UploadsList = api.czr_HeaderTool.UploadsList;
2014
+ api.HeaderTool.DefaultsList = api.czr_HeaderTool.DefaultsList;
2015
+ api.HeaderTool.CombinedList = api.czr_HeaderTool.CombinedList;
2016
+ api.control.add( 'header_image', new _header_constructor( 'header_image', { params : _header_control_data, previewer : api.previewer }) );
2017
+ dfd.reject();
2018
+ });
2019
+ }//else
2020
+ return dfd.promise();
2021
+ }
2022
+ });//$.extend
2023
+ var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
2024
+ $.extend( CZRSkopeBaseMths, {
2025
+ setupActiveSkopedControls : function( obj ) {
2026
+ var self = this, section_id, controls, setupParams, eligibleCtrls;
2027
+ defaultSetupParams = {
2028
+ controls : [],
2029
+ section_id : api.czr_activeSectionId()
2030
+ };
2031
+ setupParams = $.extend( defaultSetupParams, obj );
2032
+
2033
+ if ( ! _.isObject( setupParams ) || ! _.has( setupParams, 'controls' ) || ! _.has( setupParams, 'section_id' ) ) {
2034
+ throw new Error( 'SetupControlsReset : the setupParams param must be an object with properties controls and section_id.');
2035
+ }
2036
+
2037
+ section_id = setupParams.section_id;
2038
+ controls = setupParams.controls;
2039
+ eligibleCtrls = [];
2040
+
2041
+ if ( _.isEmpty( section_id ) || ! _.isString( section_id ) ) {
2042
+ section_id = api.czr_activeSectionId();
2043
+ }
2044
+ if ( _.isEmpty( controls ) ) {
2045
+ controls = api.CZR_Helpers.getSectionControlIds( section_id );
2046
+ }
2047
+
2048
+ controls = _.isString( controls ) ? [controls] : controls;
2049
+ eligibleCtrls = _.filter( controls, function( ctrlId ) {
2050
+ var setId = api.CZR_Helpers.getControlSettingId( ctrlId );
2051
+ if ( setId && ! self.isSettingSkopeEligible( setId ) ) {
2052
+ api.control( ctrlId ).container.addClass('czr-not-skoped');
2053
+ }
2054
+ if ( setId && self.isWPAuthorizedSetting( setId ) ) {
2055
+ api.control( ctrlId ).container.addClass('is-wp-authorized-setting');
2056
+ }
2057
+ return setId && self.isSettingSkopeEligible( setId );
2058
+ });
2059
+ if ( 'nav_menu[' == section_id.substring( 0, 'nav_menu['.length ) )
2060
+ return;
2061
+ if ( ! _.isEmpty( controls ) ) {
2062
+ api.czr_skopeReady.then( function() {
2063
+ $.when( self.renderControlsSingleReset( eligibleCtrls ) ).done( function() {
2064
+ self.listenSkopedControls( controls );
2065
+ });
2066
+ });
2067
+ }
2068
+ self.renderCtrlSkpNotIcon( controls );
2069
+ },
2070
+ listenSkopedControls : function( controls ) {
2071
+ var self = this;
2072
+ _.each( controls, function( ctrlId ) {
2073
+ if ( ! api.has( ctrlId ) || _.isUndefined( api.control( ctrlId ) ) )
2074
+ return;
2075
+ var ctrl = api.control( ctrlId ),
2076
+ setId = api.CZR_Helpers.getControlSettingId( ctrlId ),
2077
+ shortSetId = api.CZR_Helpers.getOptionName( setId ),
2078
+ defaults = {
2079
+ hasDBVal : false,
2080
+ isDirty : false,
2081
+ noticeVisible : false,
2082
+ resetVisible : false,
2083
+ isResetting : false
2084
+ },
2085
+ initial_states = {};
2086
+ if ( ! _.has( ctrl, 'czr_states' ) ) {
2087
+ ctrl.czr_states = new api.Values();
2088
+ _.each( defaults, function( _state_val, _state_name ) {
2089
+ ctrl.czr_states.create( _state_name );
2090
+ });
2091
+
2092
+ self.bindControlStates( ctrl );
2093
+ }
2094
+ ctrl.czr_states( 'hasDBVal' )( api.czr_skope( api.czr_activeSkopeId() ).hasSkopeSettingDBValues( setId ) );
2095
+ ctrl.czr_states( 'isDirty' )( api.czr_skope( api.czr_activeSkopeId() ).getSkopeSettingDirtyness( setId ) );
2096
+
2097
+
2098
+ if ( ! _.has( ctrl, 'userEventMap' ) ) {
2099
+ ctrl.userEventMap = [
2100
+ {
2101
+ trigger : 'click keydown',
2102
+ selector : '.czr-setting-reset, .czr-cancel-button',
2103
+ name : 'control_reset_warning',
2104
+ actions : function() {
2105
+ if ( ! ctrl.czr_states('isDirty')() && ! ctrl.czr_states( 'hasDBVal' )() )
2106
+ return;
2107
+ _.each( _.without( api.CZR_Helpers.getSectionControlIds( ctrl.section() ), ctrlId ) , function( _id ) {
2108
+ if ( _.has( api.control(_id), 'czr_states') ) {
2109
+ api.control(_id).czr_states( 'resetVisible' )( false );
2110
+ }
2111
+ });
2112
+ ctrl.czr_states( 'resetVisible' )( ! ctrl.czr_states( 'resetVisible' )() );
2113
+ if ( ctrl.czr_states( 'resetVisible' )() ) {
2114
+ ctrl.czr_states( 'noticeVisible' )( false );
2115
+ }
2116
+ }
2117
+ },
2118
+ {
2119
+ trigger : 'click keydown',
2120
+ selector : '.czr-control-do-reset',
2121
+ name : 'control_do_reset',
2122
+ actions : function() {
2123
+ self.doResetSetting( ctrlId );
2124
+ }
2125
+ },
2126
+ {
2127
+ trigger : 'click keydown',
2128
+ selector : '.czr-skope-switch',
2129
+ name : 'control_skope_switch',
2130
+ actions : function( params ) {
2131
+ var _skopeIdToSwithTo = $( params.dom_event.currentTarget, params.dom_el ).attr('data-skope-id');
2132
+ if ( ! _.isEmpty( _skopeIdToSwithTo ) && api.czr_skope.has( _skopeIdToSwithTo ) )
2133
+ api.czr_activeSkopeId( _skopeIdToSwithTo );
2134
+ }
2135
+ },
2136
+ {
2137
+ trigger : 'click keydown',
2138
+ selector : '.czr-toggle-notice',
2139
+ name : 'control_toggle_notice',
2140
+ actions : function( params ) {
2141
+ ctrl.czr_states( 'noticeVisible' )( ! ctrl.czr_states( 'noticeVisible' )() );
2142
+ if ( ctrl.czr_states( 'noticeVisible' )() ) {
2143
+ ctrl.czr_states( 'resetVisible' )( false );
2144
+ }
2145
+ }
2146
+ }
2147
+ ];
2148
+ api.CZR_Helpers.setupDOMListeners( ctrl.userEventMap , { dom_el : ctrl.container }, self );
2149
+ }
2150
+ });
2151
+ },
2152
+ bindControlStates : function( ctrl ) {
2153
+ if ( ! api.control.has( ctrl.id ) ) {
2154
+ throw new Error( 'in bindControlStates, the provided ctrl id is not registered in the api : ' + ctrl.id );
2155
+ }
2156
+ var self = this,
2157
+ setId = api.CZR_Helpers.getControlSettingId( ctrl.id );
2158
+ ctrl.czr_states('hasDBVal').bind( function( bool ) {
2159
+ ctrl.container.toggleClass( 'has-db-val', bool );
2160
+ if ( bool ) {
2161
+ _title = 'Reset your customized ( and published ) value';//@to_translate
2162
+ } else if ( ctrl.czr_states('isDirty')() ) {
2163
+ _title = 'Reset your customized ( but not yet published ) value';//@to_translate
2164
+ } else {
2165
+ _title = 'Not customized yet, nothing to reset';//@to_translate;
2166
+ }
2167
+ ctrl.container.find('.czr-setting-reset').attr( 'title', _title );
2168
+ });
2169
+ ctrl.czr_states('isDirty').bind( function( bool ) {
2170
+ ctrl.container.toggleClass( 'is-dirty', bool );
2171
+ var _title;
2172
+ if ( bool ) {
2173
+ _title = 'Reset your customized ( but not yet published ) value';//@to_translate
2174
+ } else if ( ctrl.czr_states('hasDBVal')() ) {
2175
+ _title = 'Reset your customized ( and published ) value';//@to_translate
2176
+ } else {
2177
+ _title = 'Not customized yet, nothing to reset';//@to_translate;
2178
+ }
2179
+ ctrl.container.find('.czr-setting-reset').attr( 'title', _title );
2180
+ });
2181
+ ctrl.czr_states('noticeVisible').bind( function( visible ) {
2182
+ ctrl.container.toggleClass( 'czr-notice-visible', visible );
2183
+ var $noticeContainer = ctrl.getNotificationsContainerElement();
2184
+ if ( false !== $noticeContainer && false !== $noticeContainer.length ) {
2185
+ if ( ! visible ) {
2186
+ $.when( $noticeContainer
2187
+ .stop()
2188
+ .slideUp( 'fast', null, function() {
2189
+ $( this ).css( 'height', 'auto' );
2190
+ } ) ).done( function() {
2191
+ self.removeCtrlSkpNot( ctrl.id );
2192
+ });
2193
+ } else {
2194
+ self.updateCtrlSkpNot( ctrl.id );
2195
+ $noticeContainer
2196
+ .stop()
2197
+ .slideDown( 'fast', null, function() {
2198
+ $( this ).css( 'height', 'auto' );
2199
+ } );
2200
+ }
2201
+ }
2202
+ });
2203
+ ctrl.czr_states('resetVisible').bind( function( visible ) {
2204
+ var section_id = ctrl.section() || api.czr_activeSectionId();
2205
+ if ( visible ) {
2206
+ $.when( self.renderControlResetWarningTmpl( ctrl.id ) ).done( function( _params ) {
2207
+ if ( _.isEmpty( _params ) )
2208
+ return;
2209
+ ctrl.czr_resetDialogContainer = _params.container;
2210
+ _params.container.slideToggle('fast');
2211
+ if ( ! _params.is_authorized ) {
2212
+ _.delay( function() {
2213
+ $.when( ctrl.czr_resetDialogContainer.slideToggle('fast') ).done( function() {
2214
+ ctrl.czr_resetDialogContainer.remove();
2215
+ });
2216
+ }, 3000 );
2217
+ }
2218
+ });
2219
+ } else {
2220
+ if ( _.has( ctrl, 'czr_resetDialogContainer' ) && ctrl.czr_resetDialogContainer.length )
2221
+ $.when( ctrl.czr_resetDialogContainer.slideToggle('fast') ).done( function() {
2222
+ ctrl.czr_resetDialogContainer.remove();
2223
+ });
2224
+ }
2225
+ });
2226
+ }
2227
+ });//$.extend()
2228
+ var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
2229
+ $.extend( CZRSkopeBaseMths, {
2230
+ renderControlsSingleReset : function( controls ) {
2231
+ var self = this, dfd = $.Deferred();
2232
+ if ( _.isUndefined( controls ) || _.isEmpty( controls ) ) {
2233
+ controls = api.CZR_Helpers.getSectionControlIds( api.czr_activeSectionId() );
2234
+ controls = _.filter( controls, function( _id ) {
2235
+ var setId = api.CZR_Helpers.getControlSettingId( _id );
2236
+ return setId && self.isSettingSkopeEligible( setId );
2237
+ });
2238
+ }
2239
+
2240
+ var controlIds = _.isArray(controls) ? controls : [controls],
2241
+ render_reset_icons = function( ctrlIds ) {
2242
+ if ( _.isEmpty( ctrlIds ) ) {
2243
+ dfd.resolve();
2244
+ return;
2245
+ }
2246
+ _.each( ctrlIds, function( _id ) {
2247
+ api.control.when( _id, function() {
2248
+ var ctrl = api.control( _id ),
2249
+ setId = api.CZR_Helpers.getControlSettingId( _id );
2250
+
2251
+ if( $('.czr-setting-reset', ctrl.container ).length ) {
2252
+ dfd.resolve();
2253
+ return;
2254
+ }
2255
+
2256
+ ctrl.deferred.embedded.then( function() {
2257
+ $.when(
2258
+ ctrl.container
2259
+ .find('.customize-control-title').first()//was.find('.customize-control-title')
2260
+ .prepend( $( '<span/>', {
2261
+ class : 'czr-setting-reset fa fa-refresh',
2262
+ title : ''
2263
+ } ) ) )
2264
+ .done( function(){
2265
+ ctrl.container.addClass('czr-skoped');
2266
+ $('.czr-setting-reset', ctrl.container).fadeIn( 400 );
2267
+ dfd.resolve();
2268
+ });
2269
+ });//then()
2270
+ });//when()
2271
+ });//_each
2272
+ };
2273
+ render_reset_icons = _.debounce( render_reset_icons , 200 );
2274
+ render_reset_icons( controlIds );
2275
+ return dfd.promise();
2276
+ },
2277
+ renderControlResetWarningTmpl : function( ctrlId ) {
2278
+ if ( ! api.control.has( ctrlId ) )
2279
+ return {};
2280
+
2281
+ var self = this,
2282
+ ctrl = api.control( ctrlId ),
2283
+ setId = api.CZR_Helpers.getControlSettingId( ctrlId ),
2284
+
2285
+ _tmpl = '',
2286
+ warning_message,
2287
+ success_message,
2288
+ isWPSetting = ( function() {
2289
+ if ( _.contains( serverControlParams.wpBuiltinSettings, api.CZR_Helpers.getOptionName( setId ) ) )
2290
+ return true;
2291
+ if ( ! _.contains( serverControlParams.themeSettingList, api.CZR_Helpers.getOptionName( setId ) ) )
2292
+ return true;
2293
+ return false;
2294
+ })();
2295
+
2296
+ if ( ctrl.czr_states( 'isDirty' )() ) {
2297
+ warning_message = [
2298
+ 'Please confirm that you want to reset your current customizations for this option in ',//@to_translate
2299
+ api.czr_skope( api.czr_activeSkopeId() )().title,
2300
+ '.',
2301
+ ].join('');
2302
+ success_message = 'Your customizations have been reset.';//@to_translate
2303
+ } else {
2304
+ if ( isWPSetting && 'global' == api.czr_skope( api.czr_activeSkopeId() )().skope ) {
2305
+ warning_message = 'This WordPress setting can not be reset site wide.';//@to_translate
2306
+ } else {
2307
+ warning_message = [
2308
+ 'Please confirm that you want to reset this option in ',//@to_translate
2309
+ api.czr_skope( api.czr_activeSkopeId() )().title,
2310
+ '.'
2311
+ ].join('');//@to_translate
2312
+ success_message = 'The options have been reset.';//@to_translate
2313
+ }
2314
+ }
2315
+ var is_authorized = ! ( isWPSetting && 'global' == api.czr_skope( api.czr_activeSkopeId() )().skope && ! ctrl.czr_states( 'isDirty' )() ),
2316
+ _tmpl_data = {
2317
+ warning_message : warning_message,
2318
+ success_message : success_message,
2319
+ is_authorized : is_authorized
2320
+ };
2321
+ try {
2322
+ _tmpl = wp.template('czr-reset-control')( _tmpl_data );
2323
+ } catch(e) {
2324
+ throw new Error('Error when parsing the the reset control template : ' + e );//@to_translate
2325
+ }
2326
+
2327
+ $('.customize-control-title', ctrl.container).first().after( $( _tmpl ) );
2328
+
2329
+ return { container : $( '.czr-ctrl-reset-warning', ctrl.container ), is_authorized : is_authorized };
2330
+ },
2331
+ doResetSetting : function( ctrlId ) {
2332
+ var self = this,
2333
+ setId = api.CZR_Helpers.getControlSettingId( ctrlId ),
2334
+ ctrl = api.control( ctrlId ),
2335
+ skope_id = api.czr_activeSkopeId(),
2336
+ reset_method = ctrl.czr_states( 'isDirty' )() ? '_resetControlDirtyness' : '_resetControlAPIVal',
2337
+ _setResetDialogVisibility = function( ctrl, val ) {
2338
+ val = _.isUndefined( val ) ? false : val;//@todo why this ?
2339
+ ctrl.czr_states( 'resetVisible' )( false );
2340
+ ctrl.czr_states( 'isResetting' )( false);
2341
+ ctrl.container.removeClass('czr-resetting-control');
2342
+ },
2343
+ _updateAPI = function( ctrlId ) {
2344
+ var _silentUpdate = function() {
2345
+ api.czr_skopeBase.processSilentUpdates( { candidates : ctrlId, refresh : false } )
2346
+ .fail( function() { api.consoleLog( 'Silent update failed after resetting control : ' + ctrlId ); } )
2347
+ .done( function() {
2348
+ $.when( $('.czr-crtl-reset-dialog', ctrl.container ).fadeOut('300') ).done( function() {
2349
+ $.when( $('.czr-reset-success', ctrl.container ).fadeIn('300') ).done( function( $_el ) {
2350
+ _.delay( function() {
2351
+ $.when( $_el.fadeOut('300') ).done( function() {
2352
+ _setResetDialogVisibility( ctrl );
2353
+ self.setupActiveSkopedControls( { controls : [ ctrlId ] } );
2354
+ _.delay( function() {
2355
+ ctrl.czr_states( 'noticeVisible' )(true);
2356
+ }, 300 );
2357
+ _.delay( function() {
2358
+ ctrl.czr_states( 'noticeVisible' )(false);
2359
+ }, 4000 );
2360
+ });
2361
+ }, 1000 );
2362
+ });
2363
+ });
2364
+ });
2365
+ };
2366
+ self[reset_method](ctrlId)
2367
+ .done( function() {
2368
+ api.consoleLog('REFRESH AFTER A SETTING RESET');
2369
+ api.previewer.refresh()
2370
+ .fail( function( refresh_data ) {
2371
+ api.consoleLog('SETTING RESET REFRESH FAILED', refresh_data );
2372
+ })
2373
+ .done( function( refresh_data ) {
2374
+ if ( 'global' == api.czr_skope( skope_id )().skope && '_resetControlAPIVal' == reset_method ) {
2375
+ var _sentSkopeCollection,
2376
+ _serverGlobalDbValues = {},
2377
+ _skope_opt_name = api.czr_skope( skope_id )().opt_name;
2378
+
2379
+ if ( ! _.isUndefined( refresh_data.skopesServerData ) && _.has( refresh_data.skopesServerData, 'czr_skopes' ) ) {
2380
+ _sentSkopeCollection = refresh_data.skopesServerData.czr_skopes;
2381
+ if ( _.isUndefined( _.findWhere( _sentSkopeCollection, { opt_name : _skope_opt_name } ) ) ) {
2382
+ _serverGlobalDbValues = _.findWhere( _sentSkopeCollection, { opt_name : _skope_opt_name } ).db || {};
2383
+ }
2384
+ }
2385
+ api.czr_skopeBase.maybeSynchronizeGlobalSkope( { isGlobalReset : true, isSetting : true, settingIdToReset : setId } )
2386
+ .done( function() {
2387
+ _silentUpdate();
2388
+ });
2389
+ } else {
2390
+ _silentUpdate();
2391
+ }
2392
+ });
2393
+ });
2394
+ };//_updateAPI
2395
+
2396
+
2397
+ ctrl.czr_states( 'isResetting' )( true );
2398
+ ctrl.container.addClass('czr-resetting-control');
2399
+
2400
+ api.czr_skopeReset[ ctrl.czr_states( 'isDirty' )() ? 'resetChangeset' : 'resetPublished' ](
2401
+ { skope_id : skope_id, setId : setId, is_setting : true } )
2402
+ .done( function( r ) {
2403
+ _updateAPI( ctrlId );
2404
+ })
2405
+ .fail( function( r ) {
2406
+ $.when( $('.czr-crtl-reset-dialog', ctrl.container ).fadeOut('300') ).done( function() {
2407
+ $.when( $('.czr-reset-fail', ctrl.container ).fadeIn('300') ).done( function() {
2408
+ $('.czr-reset-fail', ctrl.container ).append('<p>' + r + '</p>');
2409
+ _.delay( function() {
2410
+ _setResetDialogVisibility( ctrl );
2411
+ self.setupActiveSkopedControls( { controls : [ ctrlId ] } );
2412
+ }, 2000 );
2413
+ });
2414
+ });
2415
+ });
2416
+
2417
+ },
2418
+ _resetControlDirtyness : function( ctrlId ) {
2419
+ var setId = api.CZR_Helpers.getControlSettingId( ctrlId ),
2420
+ skope_instance = api.czr_skope( api.czr_activeSkopeId() ),
2421
+ current_dirties = $.extend( true, {}, skope_instance.dirtyValues() ),
2422
+ new_dirties = {},
2423
+ current_changeset = $.extend( true, {}, skope_instance.changesetValues() ),
2424
+ new_changeset = {},
2425
+ dfd = $.Deferred();
2426
+
2427
+ new_dirties = _.omit( current_dirties, setId );
2428
+ new_changeset = _.omit( current_changeset, setId );
2429
+ skope_instance.dirtyValues( new_dirties );
2430
+ skope_instance.changesetValues( new_dirties );
2431
+
2432
+ return dfd.resolve().promise();
2433
+ },
2434
+ _resetControlAPIVal : function( ctrlId ) {
2435
+ var setId = api.CZR_Helpers.getControlSettingId( ctrlId ),
2436
+ current_skope_db = api.czr_skope( api.czr_activeSkopeId() ).dbValues(),
2437
+ new_skope_db = $.extend( true, {}, current_skope_db ),
2438
+ dfd = $.Deferred();
2439
+
2440
+ if ( _.has( api.control( ctrlId ), 'czr_states') ) {
2441
+ api.control(ctrlId).czr_states( 'hasDBVal' )( false );
2442
+ api.czr_skope( api.czr_activeSkopeId() ).dbValues( _.omit( new_skope_db, setId ) );
2443
+ }
2444
+ return dfd.resolve().promise();
2445
+ }
2446
+
2447
+ });//$.extend()
2448
+ var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
2449
+ $.extend( CZRSkopeBaseMths, {
2450
+ renderCtrlSkpNotIcon : function( controlIdCandidates ) {
2451
+ var self = this,
2452
+ controlIds = _.isArray(controlIdCandidates) ? controlIdCandidates : [controlIdCandidates];
2453
+
2454
+ _.each( controlIds, function( _id ) {
2455
+ api.control.when( _id, function() {
2456
+ var ctrl = api.control( _id );
2457
+ ctrl.deferred.embedded.then( function() {
2458
+ if( $('.czr-toggle-notice', ctrl.container ).length )
2459
+ return;
2460
+
2461
+ $.when( ctrl.container
2462
+ .find('.customize-control-title').first()//was.find('.customize-control-title')
2463
+ .append( $( '<span/>', {
2464
+ class : 'czr-toggle-notice fa fa-info-circle',
2465
+ title : 'Display informations about the scope of this option.'//@to_translate
2466
+ } ) ) )
2467
+ .done( function(){
2468
+ $('.czr-toggle-notice', ctrl.container).fadeIn( 400 );
2469
+ });
2470
+ });
2471
+
2472
+ });
2473
+
2474
+ });
2475
+ },
2476
+ updateCtrlSkpNot : function( controlIdCandidates ) {
2477
+ var self = this,
2478
+ controlIds = _.isArray(controlIdCandidates) ? controlIdCandidates : [controlIdCandidates],
2479
+ _isSkoped = function( setId ) {
2480
+ return setId && self.isSettingSkopeEligible( setId );
2481
+ },//filter only eligible ctrlIds
2482
+ _generateControlNotice = function( setId, _localSkopeId ) {
2483
+ var _currentSkopeId = api.czr_activeSkopeId(),
2484
+ _inheritedFromSkopeId = self.getInheritedSkopeId( setId, _currentSkopeId ),
2485
+ _overridedBySkopeId = self.getAppliedPrioritySkopeId( setId, _currentSkopeId ),
2486
+ _html = [],
2487
+ _isCustomized,
2488
+ _hasDBVal;
2489
+ if ( ! _isSkoped( setId ) ) {
2490
+ _html.push( [
2491
+ "This option is always customized site wide and can't be reset.",//@to_translate
2492
+ ].join(' ') );
2493
+ return _html.join(' | ');
2494
+ }
2495
+ if ( _inheritedFromSkopeId == _overridedBySkopeId && api.czr_skope.has( _inheritedFromSkopeId ) && _currentSkopeId == _inheritedFromSkopeId ) {
2496
+ _isCustomized = ! _.isUndefined( api.czr_skope( _currentSkopeId ).dirtyValues()[setId] );
2497
+ _hasDBVal = ! _.isUndefined( api.czr_skope( _currentSkopeId ).dbValues()[setId] );
2498
+
2499
+ if ( _isCustomized ) {
2500
+ if ( 'global' == api.czr_skope( _inheritedFromSkopeId )().skope ) {
2501
+ _html.push( [
2502
+ 'Customized. Will be published site wide.',//@to_translate
2503
+ ].join(' ') );
2504
+ } else {
2505
+ _html.push( [
2506
+ 'Customized. Will be published for :',//@to_translate
2507
+ api.czr_skope( _inheritedFromSkopeId )().title
2508
+ ].join(' ') );
2509
+ }
2510
+ } else {
2511
+ if ( _hasDBVal ) {
2512
+ if ( 'global' == api.czr_skope( _inheritedFromSkopeId )().skope ) {
2513
+ _html.push( [
2514
+ 'Customized and published site wide.',//@to_translate
2515
+ ].join(' ') );
2516
+ } else {
2517
+ _html.push( [
2518
+ 'Customized and published for :',//@to_translate
2519
+ api.czr_skope( _inheritedFromSkopeId )().title
2520
+ ].join(' ') );
2521
+ }
2522
+ } else {
2523
+ _html.push( 'Default website value published site wide.' );//@to_translate
2524
+ }
2525
+ }
2526
+ }
2527
+ if ( _inheritedFromSkopeId !== _currentSkopeId && api.czr_skope.has( _inheritedFromSkopeId ) ) {
2528
+ _isCustomized = ! _.isUndefined( api.czr_skope( _inheritedFromSkopeId ).dirtyValues()[setId] );
2529
+ _hasDBVal = ! _.isUndefined( api.czr_skope( _inheritedFromSkopeId ).dbValues()[setId] );
2530
+ if ( ! _isCustomized && ! _hasDBVal ) {
2531
+ _html.push( 'Default website value' );//@to_translate
2532
+ } else {
2533
+ _html.push( 'Inherited from : ' + self.buildSkopeLink( _inheritedFromSkopeId ) );//@to_translate
2534
+ }
2535
+ }
2536
+ if ( _overridedBySkopeId !== _currentSkopeId && api.czr_skope.has( _overridedBySkopeId ) ) {
2537
+ _isCustomized = ! _.isUndefined( api.czr_skope( _overridedBySkopeId ).dirtyValues()[setId] );
2538
+
2539
+ _html.push( [
2540
+ ! _isCustomized ? 'The value currently published for' : 'The value that will be published for',//@to_translate
2541
+ api.czr_skope( _localSkopeId )().title,
2542
+ ! _isCustomized ? 'is set in scope :' : 'is customized in scope :',//@to_translate
2543
+ self.buildSkopeLink( _overridedBySkopeId ),
2544
+ ! _isCustomized ? ', because it has a higher priority than this one.' : ', and will override this one once published because it has a higher priority.',//@to_translate
2545
+ ].join(' ') );
2546
+ }
2547
+
2548
+ return _html.join(' | ');
2549
+ };
2550
+
2551
+ _.each( controlIds, function( _id ) {
2552
+ api.control.when( _id, function() {
2553
+ var ctrl = api.control( _id ),
2554
+ setId = api.CZR_Helpers.getControlSettingId( _id );//get the relevant setting_id for this control
2555
+ if ( ! _.has( ctrl, 'czr_states' ) || ! ctrl.czr_states('noticeVisible')() )
2556
+ return;
2557
+
2558
+ ctrl.deferred.embedded.then( function() {
2559
+ var _localSkopeId = _.findWhere( api.czr_currentSkopesCollection(), { skope : 'local' } ).id,
2560
+ $noticeContainer = ctrl.getNotificationsContainerElement();
2561
+
2562
+ if ( ! $noticeContainer || ! $noticeContainer.length || _.isUndefined( _localSkopeId ) )
2563
+ return;
2564
+
2565
+ _html = _generateControlNotice( setId, _localSkopeId );
2566
+
2567
+ var $skopeNoticeEl = $( '.czr-skope-notice', $noticeContainer );
2568
+ if ( $skopeNoticeEl.length ) {
2569
+ $skopeNoticeEl.html( _html );
2570
+ } else {
2571
+ $noticeContainer.append(
2572
+ [ '<span class="czr-notice czr-skope-notice">', _html ,'</span>' ].join('')
2573
+ );
2574
+ }
2575
+ });
2576
+ });
2577
+ });
2578
+ },
2579
+ removeCtrlSkpNot : function( controlIdCandidates ) {
2580
+ var self = this,
2581
+ controlIds = _.isArray(controlIdCandidates) ? controlIdCandidates : [controlIdCandidates];
2582
+
2583
+ _.each( controlIds, function( _id ) {
2584
+ api.control.when( _id, function() {
2585
+ var ctrl = api.control( _id );
2586
+
2587
+ ctrl.deferred.embedded.then( function() {
2588
+ var $noticeContainer = ctrl.getNotificationsContainerElement();
2589
+
2590
+ if ( ! $noticeContainer || ! $noticeContainer.length )
2591
+ return;
2592
+
2593
+ var $skopeNoticeEl = $( '.czr-skope-notice', $noticeContainer );
2594
+ if ( $skopeNoticeEl.length )
2595
+ $skopeNoticeEl.remove();
2596
+ });
2597
+ });
2598
+ });
2599
+ }
2600
+ });//$.extend()
2601
+ var CZRSkopeSaveMths = CZRSkopeSaveMths || {};
2602
+ $.extend( CZRSkopeSaveMths, {
2603
+ initialize: function() {
2604
+ var self = this;
2605
+ this.changesetStatus = 'publish';
2606
+ this.saveBtn = $( '#save' );
2607
+ },
2608
+
2609
+
2610
+ save: function( args ) {
2611
+ var self = this,
2612
+ processing = api.state( 'processing' ),
2613
+ submitWhenDoneProcessing,
2614
+ parent = new api.Messenger({
2615
+ url: api.settings.url.parent,
2616
+ channel: 'loader',
2617
+ });//this has to be reinstantiated because not accessible from core
2618
+ self.globalSaveDeferred = $.Deferred();
2619
+ self.previewer = api.previewer;
2620
+ self.globalSkopeId = api.czr_skopeBase.getGlobalSkopeId();
2621
+ self.saveArgs = args;
2622
+
2623
+ if ( args && args.status ) {
2624
+ self.changesetStatus = args.status;
2625
+ }
2626
+
2627
+ if ( api.state( 'saving' )() ) {
2628
+ self.globalSaveDeferred.reject( 'already_saving' );//@to_translate
2629
+ }
2630
+ var alwaysAfterSubmission = function( response, state ) {
2631
+ api.state( 'saving' )( false );
2632
+ api.state( 'processing' ).set( 0 );
2633
+ self.saveBtn.prop( 'disabled', false );
2634
+ if ( ! _.isUndefined( response ) && response.setting_validities ) {
2635
+ api._handleSettingValidities( {
2636
+ settingValidities: response.setting_validities,
2637
+ focusInvalidControl: true
2638
+ } );
2639
+ }
2640
+ if ( 'pending' == state ) {
2641
+ api.czr_serverNotification( { message: response, status : 'error' } );
2642
+ } else {
2643
+ }
2644
+ },
2645
+ resolveSave = function( params ) {
2646
+ var response, resolveSaveDfd = $.Deferred();
2647
+ api.state( 'saving' )( true );
2648
+ self.fireAllSubmission( params )
2649
+ .always( function( _response_ ) {
2650
+ response = _response_.response;
2651
+ alwaysAfterSubmission( response , this.state() );
2652
+ })
2653
+ .fail( function( _response_ ) {
2654
+ response = _response_.response;
2655
+ api.consoleLog('ALL SUBMISSIONS FAILED', response );
2656
+ self.globalSaveDeferred.reject( response );
2657
+ api.trigger( 'error', response );
2658
+ resolveSaveDfd.resolve( _response_.hasNewMenu );
2659
+ })
2660
+ .done( function( _response_ ) {
2661
+ response = _response_.response;
2662
+ api.previewer.refresh( { waitSkopeSynced : true } )
2663
+ .fail( function( refresh_data ) {
2664
+ self.globalSaveDeferred.reject( self.previewer, [ response ] );
2665
+ api.consoleLog('SAVE REFRESH FAIL', refresh_data );
2666
+ })
2667
+ .done( function( refresh_data ) {
2668
+ api.previewer.send( 'saved', response );
2669
+ response = _.extend( { changeset_status : 'publish' }, response || {} );
2670
+ if ( api.czr_isChangeSetOn() ) {
2671
+ var latestRevision = api._latestRevision;
2672
+ api.state( 'changesetStatus' ).set( response.changeset_status );
2673
+ if ( 'publish' === response.changeset_status ) {
2674
+ api.each( function( setting ) {
2675
+ if ( setting._dirty && ( _.isUndefined( api._latestSettingRevisions[ setting.id ] ) || api._latestSettingRevisions[ setting.id ] <= latestRevision ) ) {
2676
+ setting._dirty = false;
2677
+ }
2678
+ } );
2679
+
2680
+ api.state( 'changesetStatus' ).set( '' );
2681
+ api.settings.changeset.uuid = response.next_changeset_uuid;
2682
+ parent.send( 'changeset-uuid', api.settings.changeset.uuid );
2683
+ }
2684
+ } else {
2685
+ api.each( function ( value ) {
2686
+ value._dirty = false;
2687
+ } );
2688
+ }
2689
+ refresh_data = _.extend( {
2690
+ previewer : refresh_data.previewer || self.previewer,
2691
+ skopesServerData : refresh_data.skopesServerData || {},
2692
+ },
2693
+ refresh_data
2694
+ );
2695
+ self.reactWhenSaveDone( refresh_data.skopesServerData );
2696
+ self.globalSaveDeferred.resolveWith( self.previewer, [ response ] );
2697
+
2698
+ api.trigger( 'saved', response || {} );
2699
+ resolveSaveDfd.resolve( _response_.hasNewMenu );
2700
+ });
2701
+ });
2702
+ return resolveSaveDfd.promise();
2703
+ };//resolveSave
2704
+
2705
+ if ( 0 === processing() ) {
2706
+ resolveSave().done( function( hasNewMenu ) {
2707
+ if ( hasNewMenu ) {
2708
+ resolveSave( { saveGlobal :false, saveSkopes : true } );
2709
+ }
2710
+ } );
2711
+ } else {
2712
+ submitWhenDoneProcessing = function () {
2713
+ if ( 0 === processing() ) {
2714
+ api.state.unbind( 'change', submitWhenDoneProcessing );
2715
+ resolveSave();
2716
+ }
2717
+ };
2718
+ api.state.bind( 'change', submitWhenDoneProcessing );
2719
+ }
2720
+ return self.globalSaveDeferred.promise();
2721
+ }//save
2722
+ });//$.extend
2723
+ var CZRSkopeSaveMths = CZRSkopeSaveMths || {};
2724
+ $.extend( CZRSkopeSaveMths, {
2725
+ getSubmitPromise : function( skope_id ) {
2726
+ var self = this,
2727
+ dfd = $.Deferred(),
2728
+ submittedChanges = {};
2729
+
2730
+ if ( _.isEmpty( skope_id ) || ! api.czr_skope.has( skope_id ) ) {
2731
+ api.consoleLog( 'getSubmitPromise : no skope id requested OR skope_id not registered : ' + skope_id );
2732
+ return dfd.resolve().promise();
2733
+ }
2734
+
2735
+ var skopeObjectToSubmit = api.czr_skope( skope_id )();
2736
+ if ( ! api.czr_skope( skope_id ).dirtyness() && skope_id !== self.globalSkopeId ) {
2737
+ return dfd.resolve().promise();
2738
+ }
2739
+ _.each( api.czr_skopeBase.getSkopeDirties( skope_id ) , function( dirtyValue, settingId ) {
2740
+ submittedChanges[ settingId ] = _.extend(
2741
+ { value: dirtyValue }
2742
+ );
2743
+ } );
2744
+
2745
+ this.submit(
2746
+ {
2747
+ skope_id : skope_id,
2748
+ customize_changeset_data : submittedChanges,//{}
2749
+ dyn_type : skopeObjectToSubmit.dyn_type
2750
+ })
2751
+ .done( function(_resp) {
2752
+ dfd.resolve( _resp );
2753
+ } )
2754
+ .fail( function( _resp ) {
2755
+ api.consoleLog('GETSUBMIT FAILED PROMISE FOR SKOPE : ', skope_id, _resp );
2756
+ dfd.reject( _resp );
2757
+ } );
2758
+
2759
+ return dfd.promise();
2760
+ },//getSubmitPromise
2761
+
2762
+
2763
+
2764
+
2765
+ submit : function( params ) {
2766
+ var self = this,
2767
+ default_params = {
2768
+ skope_id : null,
2769
+ the_dirties : {},
2770
+ customize_changeset_data : {},
2771
+ dyn_type : null,
2772
+ opt_name : null
2773
+ },
2774
+ invalidSettings = [],
2775
+ modifiedWhileSaving = {},
2776
+ invalidControls,
2777
+ submit_dfd = $.Deferred();
2778
+
2779
+
2780
+ params = $.extend( default_params, params );
2781
+
2782
+ if ( _.isNull( params.skope_id ) ) {
2783
+ throw new Error( 'OVERRIDEN SAVE::submit : MISSING skope_id');
2784
+ }
2785
+ if ( _.isNull( params.the_dirties ) ) {
2786
+ throw new Error( 'OVERRIDEN SAVE::submit : MISSING the_dirties');
2787
+ }
2788
+ if ( _.has( api, 'Notification') ) {
2789
+ api.each( function( setting ) {
2790
+ setting.notifications.each( function( notification ) {
2791
+ if ( 'error' === notification.type ) {
2792
+ api.consoleLog('NOTIFICATION ERROR on SUBMIT SAVE' , notification );
2793
+ }
2794
+ if ( 'error' === notification.type && ( ! notification.data || ! notification.data.from_server ) ) {
2795
+ invalidSettings.push( setting.id );
2796
+ if ( ! settingInvalidities[ setting.id ] ) {
2797
+ settingInvalidities[ setting.id ] = {};
2798
+ }
2799
+ settingInvalidities[ setting.id ][ notification.code ] = notification;
2800
+ }
2801
+ } );
2802
+ } );
2803
+ invalidControls = api.findControlsForSettings( invalidSettings );
2804
+ if ( ! _.isEmpty( invalidControls ) ) {
2805
+ _.values( invalidControls )[0][0].focus();
2806
+ return submit_dfd.rejectWith( self.previewer, [
2807
+ { setting_invalidities: settingInvalidities }
2808
+ ] ).promise();
2809
+ }
2810
+ }
2811
+ var query_params = {
2812
+ skope_id : params.skope_id,
2813
+ action : 'save',
2814
+ the_dirties : params.the_dirties,
2815
+ dyn_type : params.dyn_type,
2816
+ opt_name : params.opt_name
2817
+ };
2818
+ if ( api.czr_isChangeSetOn() ) {
2819
+ $.extend( query_params, { excludeCustomizedSaved: false } );
2820
+ }
2821
+ var query = $.extend( self.previewer.query( query_params ), {
2822
+ nonce: self.previewer.nonce.save,
2823
+ customize_changeset_status: self.changesetStatus,
2824
+ customize_changeset_data : JSON.stringify( params.customize_changeset_data )
2825
+ } );
2826
+ if ( api.czr_isChangeSetOn() ) {
2827
+ if ( self.saveArgs && self.saveArgs.date ) {
2828
+ query.customize_changeset_date = self.saveArgs.date;
2829
+ }
2830
+ if ( self.saveArgs && self.saveArgs.title ) {
2831
+ query.customize_changeset_title = self.saveArgs.title;
2832
+ }
2833
+ }
2834
+ var request = wp.ajax.post(
2835
+ 'global' !== query.skope ? 'customize_skope_changeset_save' : 'customize_save',
2836
+ query
2837
+ );
2838
+ self.saveBtn.prop( 'disabled', true );
2839
+
2840
+ api.trigger( 'save', request );
2841
+
2842
+ request.fail( function ( response ) {
2843
+ api.consoleLog('SUBMIT REQUEST FAIL', params.skope_id, response );
2844
+ if ( '0' === response ) {
2845
+ response = 'not_logged_in';
2846
+ } else if ( '-1' === response ) {
2847
+ response = 'invalid_nonce';
2848
+ }
2849
+
2850
+ if ( 'invalid_nonce' === response ) {
2851
+ self.previewer.cheatin();
2852
+ } else if ( 'not_logged_in' === response ) {
2853
+ self.previewer.preview.iframe.hide();
2854
+ self.previewer.login().done( function() {
2855
+ self.previewer.save();
2856
+ self.previewer.preview.iframe.show();
2857
+ } );
2858
+ }
2859
+ api.trigger( 'error', response );
2860
+ submit_dfd.reject( response );
2861
+ } );
2862
+
2863
+ request.done( function( response ) {
2864
+ submit_dfd.resolve( response );
2865
+ } );
2866
+ return submit_dfd.promise();
2867
+ }//submit()
2868
+ });//$.extend
2869
+ var CZRSkopeSaveMths = CZRSkopeSaveMths || {};
2870
+ $.extend( CZRSkopeSaveMths, {
2871
+ fireAllSubmission : function( params ) {
2872
+ var self = this,
2873
+ dfd = $.Deferred(),
2874
+ skopesToSave = [],
2875
+ _recursiveCallDeferred = $.Deferred(),
2876
+ _responses_ = {},
2877
+ _promises = [],
2878
+ failedPromises = [],
2879
+ _defaultParams = {
2880
+ saveGlobal : true,
2881
+ saveSkopes : true
2882
+ };
2883
+ params = $.extend( _defaultParams, params );
2884
+ _.each( api.czr_skopeCollection(), function( _skp_ ) {
2885
+ if ( 'global' !== _skp_.skope ) {
2886
+ skopesToSave.push( _skp_.id );
2887
+ }
2888
+ });
2889
+
2890
+ var _mayBeresolve = function( _index ) {
2891
+ if ( ! _.isUndefined( skopesToSave[ _index + 1 ] ) || _promises.length != skopesToSave.length )
2892
+ return;
2893
+
2894
+ if ( _.isEmpty( failedPromises ) ) {
2895
+ _recursiveCallDeferred.resolve( _responses_ );
2896
+ } else {
2897
+ var _buildResponse = function() {
2898
+ var _failedResponse = [];
2899
+ _.each( failedPromises, function( _r ) {
2900
+ _failedResponse.push( api.czr_skopeBase.buildServerResponse( _r ) );
2901
+ } );
2902
+ return $.trim( _failedResponse.join( ' | ') );
2903
+ };
2904
+ _recursiveCallDeferred.reject( _buildResponse() );
2905
+ }
2906
+ return true;
2907
+ };
2908
+ var recursiveCall = function( _index ) {
2909
+ _index = _index || 0;
2910
+ if ( _.isUndefined( skopesToSave[_index] ) ) {
2911
+ api.consoleLog( 'Undefined Skope in Save recursive call ', _index, _skopesToUpdate, _skopesToUpdate[_index] );
2912
+ _recursiveCallDeferred.resolve( _responses_ );
2913
+ }
2914
+ self.getSubmitPromise( skopesToSave[ _index ] )
2915
+ .always( function() { _promises.push( _index ); } )
2916
+ .fail( function( response ) {
2917
+ failedPromises.push( response );
2918
+ api.consoleLog('RECURSIVE PUSH FAIL FOR SKOPE : ', skopesToSave[_index] );
2919
+ if ( ! _mayBeresolve( _index ) )
2920
+ recursiveCall( _index + 1 );
2921
+ } )
2922
+ .done( function( response ) {
2923
+ response = response || {};
2924
+ if ( _.isEmpty( _responses_ ) ) {
2925
+ _responses_ = response || {};
2926
+ } else {
2927
+ _responses_ = $.extend( _responses_ , response );
2928
+ }
2929
+ if ( ! _mayBeresolve( _index ) )
2930
+ recursiveCall( _index + 1 );
2931
+ } );
2932
+
2933
+ return _recursiveCallDeferred.promise();
2934
+ };
2935
+ var _globalHasNewMenu = false;
2936
+ _.each( api.czr_skope('global__all_').dirtyValues(), function( _setDirtVal , _setId ) {
2937
+ if ( 'nav_menu[' != _setId.substring( 0, 'nav_menu['.length ) )
2938
+ return;
2939
+ _globalHasNewMenu = true;
2940
+ } );
2941
+
2942
+ var _submitGlobal = function() {
2943
+ self.getSubmitPromise( self.globalSkopeId )
2944
+ .fail( function( r ) {
2945
+ api.consoleLog('GLOBAL SAVE SUBMIT FAIL', r );
2946
+ r = api.czr_skopeBase.buildServerResponse( r );
2947
+ dfd.reject( r );
2948
+ })
2949
+ .done( function( r ) {
2950
+ if ( _.isEmpty( _responses_ ) ) {
2951
+ _responses_ = r || {};
2952
+ } else {
2953
+ _responses_ = $.extend( _responses_ , r );
2954
+ }
2955
+ dfd.resolve( { response : _responses_, hasNewMenu : _globalHasNewMenu } );
2956
+ });
2957
+ };
2958
+
2959
+
2960
+ if ( _globalHasNewMenu && params.saveGlobal ) {
2961
+ _submitGlobal();
2962
+ } else {
2963
+ if ( params.saveGlobal && params.saveSkopes ) {
2964
+ recursiveCall()
2965
+ .fail( function( r ) {
2966
+ api.consoleLog('RECURSIVE SAVE CALL FAIL', r );
2967
+ dfd.reject( r );
2968
+ })
2969
+ .done( function( r ) {
2970
+ self.cleanSkopeChangesetMetas().always( function() { _submitGlobal(); } );
2971
+ });
2972
+ } else if ( params.saveGlobal && ! params.saveSkopes ) {
2973
+ _submitGlobal();
2974
+ } else if ( ! params.saveGlobal && params.saveSkopes ) {
2975
+ recursiveCall()
2976
+ .fail( function( r ) {
2977
+ api.consoleLog('RECURSIVE SAVE CALL FAIL', r );
2978
+ dfd.reject( r );
2979
+ })
2980
+ .done( function( r ) {
2981
+ if ( _.isEmpty( _responses_ ) ) {
2982
+ _responses_ = r || {};
2983
+ } else {
2984
+ _responses_ = $.extend( _responses_ , r );
2985
+ }
2986
+ self.cleanSkopeChangesetMetas().always( function() {
2987
+ dfd.resolve( { response : _responses_, hasNewMenu : _globalHasNewMenu } );
2988
+ });
2989
+ });
2990
+ }
2991
+ }//else
2992
+
2993
+ return dfd.promise();
2994
+ },//fireAllSubmissions
2995
+ cleanSkopeChangesetMetas : function() {
2996
+ var self = this,
2997
+ dfd = $.Deferred();
2998
+ _query = $.extend(
2999
+ api.previewer.query(),
3000
+ { nonce: api.previewer.nonce.save }
3001
+ );
3002
+ wp.ajax.post( 'czr_clean_skope_changeset_metas_after_publish' , _query )
3003
+ .always( function () { dfd.resolve(); })
3004
+ .fail( function ( response ) { api.consoleLog( 'cleanSkopeChangesetMetas failed', _query, response ); })
3005
+ .done( function( response ) { api.consoleLog( 'cleanSkopeChangesetMetas done', _query, response ); });
3006
+
3007
+ return dfd.promise();
3008
+ }
3009
+ });//$.extend
3010
+ var CZRSkopeSaveMths = CZRSkopeSaveMths || {};
3011
+ $.extend( CZRSkopeSaveMths, {
3012
+ reactWhenSaveDone : function( skopesServerData ) {
3013
+ var saved_dirties = {};
3014
+ skopesServerData = _.extend(
3015
+ {
3016
+ czr_skopes : [],
3017
+ isChangesetDirty : false
3018
+ },
3019
+ skopesServerData
3020
+ );
3021
+ _.each( api.czr_skopeCollection(), function( _skp_ ) {
3022
+ saved_dirties[ _skp_.opt_name ] = api.czr_skopeBase.getSkopeDirties( _skp_.id );
3023
+ api.czr_skope( _skp_.id ).dirtyValues( {} );
3024
+ api.czr_skope( _skp_.id ).changesetValues( {} );
3025
+ });
3026
+ var _notSyncedSettings = [],
3027
+ _sentSkopeCollection = skopesServerData.czr_skopes;
3028
+
3029
+ api.consoleLog('REACT WHEN SAVE DONE', saved_dirties, _sentSkopeCollection );
3030
+
3031
+ _.each( saved_dirties, function( skp_data, _saved_opt_name ) {
3032
+ _.each( skp_data, function( _val, _setId ) {
3033
+ if ( _.isUndefined( _.findWhere( _sentSkopeCollection, { opt_name : _saved_opt_name } ) ) )
3034
+ return;
3035
+ if ( ! api.czr_skopeBase.isSettingSkopeEligible( _setId ) )
3036
+ return;
3037
+
3038
+ var sent_skope_db_values = _.findWhere( _sentSkopeCollection, { opt_name : _saved_opt_name } ).db,
3039
+ sent_skope_level = _.findWhere( _sentSkopeCollection, { opt_name : _saved_opt_name } ).skope,
3040
+ wpSetId = api.CZR_Helpers.build_setId( _setId ),
3041
+ shortSetId = api.CZR_Helpers.getOptionName( _setId ),
3042
+ sent_set_val = sent_skope_db_values[wpSetId];
3043
+ if ( _.isUndefined( sent_set_val ) && 'global' == sent_skope_level && _val === serverControlParams.defaultOptionsValues[shortSetId] )
3044
+ return;
3045
+
3046
+ if ( _.isUndefined( sent_set_val ) || ! _.isEqual( sent_set_val, _val ) ) {
3047
+ _notSyncedSettings.push( { opt_name : _saved_opt_name, setId : wpSetId, server_val : sent_set_val, api_val : _val } );
3048
+ }
3049
+ });
3050
+ });
3051
+
3052
+ if ( ! _.isEmpty( _notSyncedSettings ) ) {
3053
+ api.consoleLog('SOME SETTINGS HAVE NOT BEEN PROPERLY SAVED : ', _notSyncedSettings );
3054
+ } else {
3055
+ api.consoleLog('ALL RIGHT, SERVER AND API ARE SYNCHRONIZED AFTER SAVE' );
3056
+ }
3057
+ api.czr_skopeBase.maybeSynchronizeGlobalSkope();
3058
+ api.czr_skopeBase.updateCtrlSkpNot( api.CZR_Helpers.getSectionControlIds() );
3059
+ }
3060
+ });//$.extend
3061
+ var CZRSkopeResetMths = CZRSkopeResetMths || {};
3062
+ $.extend( CZRSkopeResetMths, {
3063
+ initialize: function() {
3064
+ var self = this;
3065
+ self.previewer = api.previewer;
3066
+ api.state.create('czr-resetting')(false);
3067
+ api.state('czr-resetting').bind( function( state ) {
3068
+ $( document.body ).toggleClass( 'czr-resetting', false !== state );
3069
+ });
3070
+ },
3071
+ resetChangeset : function( args ) {
3072
+ var dfd = $.Deferred(),
3073
+ self = this,
3074
+ processing = api.state( 'processing' ),
3075
+ submitWhenPossible,
3076
+ submit_reset,
3077
+ request,
3078
+ requestAjaxAction,
3079
+ query_params,
3080
+ query,
3081
+ defaults = {
3082
+ is_setting : false,
3083
+ is_skope : false,
3084
+ skope_id : api.czr_activeSkopeId() || '',
3085
+ setId : ''
3086
+ };
3087
+
3088
+ args = _.extend( defaults, args );
3089
+ var skope_id = args.skope_id,
3090
+ setId = args.setId;
3091
+
3092
+ if( ! api.czr_isChangeSetOn() )
3093
+ return dfd.resolve().promise();
3094
+ submit_reset = function( skope_id, setId ) {
3095
+ if ( _.isUndefined( skope_id ) ) {
3096
+ throw new Error( 'RESET: MISSING skope_id');
3097
+ }
3098
+ api.state( 'czr-resetting' )( true );
3099
+ query_params = {
3100
+ skope_id : skope_id,
3101
+ action : 'reset'
3102
+ };
3103
+ query = $.extend(
3104
+ self.previewer.query( query_params ),
3105
+ { nonce: self.previewer.nonce.save }
3106
+ );
3107
+ if ( args.is_setting ) {
3108
+ $.extend( query , { setting_id : setId } );
3109
+ requestAjaxAction = 'czr_changeset_setting_reset';
3110
+ } else if ( args.is_skope ) {
3111
+ requestAjaxAction = 'czr_changeset_skope_reset';
3112
+ } else {
3113
+ return dfd.reject( 'reset_ajax_action_not_specified' ).promise();
3114
+ }
3115
+
3116
+ wp.ajax.post( requestAjaxAction , query )
3117
+ .always( function () {
3118
+ api.state( 'czr-resetting' )( false );
3119
+ })
3120
+ .fail( function ( response ) {
3121
+ if ( '0' === response ) {
3122
+ response = 'not_logged_in';
3123
+ } else if ( '-1' === response ) {
3124
+ response = 'invalid_nonce';
3125
+ }
3126
+
3127
+ if ( 'invalid_nonce' === response ) {
3128
+ self.previewer.cheatin();
3129
+ } else if ( 'not_logged_in' === response ) {
3130
+ self.previewer.preview.iframe.hide();
3131
+ self.previewer.login().done( function() {
3132
+ self.resetChangeset( args );
3133
+ self.previewer.preview.iframe.show();
3134
+ } );
3135
+ }
3136
+ api.consoleLog( requestAjaxAction + ' failed ', query, response );
3137
+ response = api.czr_skopeBase.buildServerResponse( response );
3138
+ api.trigger( 'error', response );
3139
+
3140
+ api.czr_serverNotification( { message: response, status : 'error' } );
3141
+ dfd.reject( response );
3142
+ })
3143
+ .done( function( response ) {
3144
+ dfd.resolve( response );
3145
+ });
3146
+ };//submit_reset()
3147
+
3148
+ if ( 0 === processing() && false === api.state( 'czr-resetting' )() ) {
3149
+ submit_reset( skope_id, setId );
3150
+ } else {
3151
+ submitWhenPossible = function () {
3152
+ if ( 0 === processing() && false === api.state( 'czr-resetting' )() ) {
3153
+ api.state.unbind( 'change', submitWhenPossible );
3154
+ submit_reset( skope_id, setId );
3155
+ }
3156
+ };
3157
+ api.state.bind( 'change', submitWhenPossible );
3158
+ }
3159
+
3160
+ return dfd.promise();
3161
+ },
3162
+ resetPublished : function( args ) {
3163
+ var dfd = $.Deferred(),
3164
+ self = this,
3165
+ processing = api.state( 'processing' ),
3166
+ submitWhenPossible,
3167
+ submit_reset,
3168
+ request,
3169
+ requestAjaxAction,
3170
+ query_params,
3171
+ query,
3172
+ defaults = {
3173
+ is_setting : false,
3174
+ is_skope : false,
3175
+ skope_id : api.czr_activeSkopeId() || '',
3176
+ setId : ''
3177
+ };
3178
+
3179
+ args = _.extend( defaults, args );
3180
+ var skope_id = args.skope_id,
3181
+ setId = args.setId;
3182
+ submit_reset = function( skope_id, setId ) {
3183
+ if ( _.isUndefined( skope_id ) ) {
3184
+ throw new Error( 'RESET: MISSING skope_id');
3185
+ }
3186
+ api.state( 'czr-resetting' )( true );
3187
+ query_params = {
3188
+ skope_id : skope_id,
3189
+ action : 'reset'
3190
+ };
3191
+ query = $.extend(
3192
+ self.previewer.query( query_params ),
3193
+ { nonce: self.previewer.nonce.save }
3194
+ );
3195
+ if ( args.is_setting ) {
3196
+ $.extend( query , { setting_id : setId } );
3197
+ requestAjaxAction = 'czr_published_setting_reset';
3198
+ } else if ( args.is_skope ) {
3199
+ requestAjaxAction = 'czr_published_skope_reset';
3200
+ } else {
3201
+ return dfd.reject( 'reset_ajax_action_not_specified' ).promise();
3202
+ }
3203
+
3204
+ api.consoleLog('in czr_reset submit : ', skope_id, query );
3205
+
3206
+ wp.ajax.post( requestAjaxAction , query )
3207
+ .always( function () {
3208
+ api.state( 'czr-resetting' )( false );
3209
+ })
3210
+ .fail( function ( response ) {
3211
+ if ( '0' === response ) {
3212
+ response = 'not_logged_in';
3213
+ } else if ( '-1' === response ) {
3214
+ response = 'invalid_nonce';
3215
+ }
3216
+
3217
+ if ( 'invalid_nonce' === response ) {
3218
+ self.previewer.cheatin();
3219
+ } else if ( 'not_logged_in' === response ) {
3220
+ self.previewer.preview.iframe.hide();
3221
+ self.previewer.login().done( function() {
3222
+ self.resetChangeset( args );
3223
+ self.previewer.preview.iframe.show();
3224
+ } );
3225
+ }
3226
+ api.consoleLog( requestAjaxAction + ' failed ', query, response );
3227
+ response = api.czr_skopeBase.buildServerResponse( response );
3228
+ api.trigger( 'error', response );
3229
+
3230
+ api.czr_serverNotification( { message: response, status : 'error' } );
3231
+ dfd.reject( response );
3232
+ })
3233
+ .done( function( response ) {
3234
+ dfd.resolve( response );
3235
+ });
3236
+
3237
+ };//submit_reset()
3238
+
3239
+ if ( 0 === processing() && false === api.state( 'czr-resetting' )() ) {
3240
+ submit_reset( skope_id, setId );
3241
+ } else {
3242
+ submitWhenPossible = function () {
3243
+ if ( 0 === processing() && false === api.state( 'czr-resetting' )() ) {
3244
+ api.state.unbind( 'change', submitWhenPossible );
3245
+ submit_reset( skope_id, setId );
3246
+ }
3247
+ };
3248
+ api.state.bind( 'change', submitWhenPossible );
3249
+ }
3250
+
3251
+ return dfd.promise();
3252
+ }
3253
+ });//$.extend
3254
+
3255
+ var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
3256
+ $.extend( CZRSkopeBaseMths, {
3257
+ initWidgetSidebarSpecifics : function() {
3258
+ var self = this;
3259
+ if ( ! self.isExcludedSidebarsWidgets() ) {
3260
+ api.czr_activeSkopeId.bind( function( active_skope ) {
3261
+ self.forceSidebarDirtyRefresh( api.czr_activeSectionId(), active_skope );
3262
+ });
3263
+ }
3264
+ $( document ).bind( 'widget-added', function( e, $o ) {
3265
+ if ( self.isExcludedSidebarsWidgets() )
3266
+ return;
3267
+
3268
+ var wgtIdAttr = $o.closest('.customize-control').attr('id'),
3269
+ wdgtSetId = api.czr_skopeBase.widgetIdToSettingId( wgtIdAttr, 'customize-control-' );
3270
+ if ( ! api.has( wdgtSetId ) ) {
3271
+ throw new Error( 'AN ADDED WIDGET COULD NOT BE BOUND IN SKOPE. ' + wdgtSetId);
3272
+ } else {
3273
+ self.listenAPISettings( wdgtSetId );
3274
+ }
3275
+ });
3276
+ },
3277
+
3278
+
3279
+ forceSidebarDirtyRefresh : function( active_section, active_skope ) {
3280
+ var self = this;
3281
+ if ( self.isExcludedSidebarsWidgets() )
3282
+ return;
3283
+ var _save_state = api.state('saved')();
3284
+ var _debounced = function() {
3285
+ if ( api.section.has( active_section ) && "sidebar" == api.section(active_section).params.type ) {
3286
+ var active_skope = active_skope || api.czr_activeSkopeId(),
3287
+ related_setting_name = 'sidebars_widgets[' + api.section(active_section).params.sidebarId + ']',
3288
+ related_setting_val = self.getSkopeSettingVal( related_setting_name, active_skope );
3289
+ api.czr_skope( active_skope ).updateSkopeDirties( related_setting_name, related_setting_val );
3290
+
3291
+ api.previewer.refresh( { the_dirties : api.czr_skope( active_skope ).dirtyValues() } )
3292
+ .done( function() {
3293
+ api.state('saved')( _save_state );
3294
+ });
3295
+ }
3296
+ };
3297
+ _debounced = _.debounce( _debounced, 500 );
3298
+ _debounced();
3299
+ }
3300
+ } );//$.extend(
3301
+
3302
+ var CZRSkopeMths = CZRSkopeMths || {};
3303
+
3304
+ $.extend( CZRSkopeMths, {
3305
+ initialize: function( skope_id, constructor_options ) {
3306
+ var skope = this;
3307
+ api.Value.prototype.initialize.call( skope, null, constructor_options );
3308
+
3309
+ skope.isReady = $.Deferred();
3310
+ skope.embedded = $.Deferred();
3311
+ skope.el = 'czr-scope-' + skope_id;//@todo replace with a css selector based on the scope name
3312
+ $.extend( skope, constructor_options || {} );
3313
+ skope.visible = new api.Value( true );
3314
+ skope.winner = new api.Value( false ); //is this skope the one that will be applied on front end in the current context?
3315
+ skope.priority = new api.Value(); //shall this skope always win or respect the default skopes priority
3316
+ skope.active = new api.Value( false ); //active, inactive. Are we currently customizing this skope ?
3317
+ skope.dirtyness = new api.Value( false ); //true or false : has this skope been customized ?
3318
+ skope.skopeResetDialogVisibility = new api.Value( false );
3319
+ skope.hasDBValues = new api.Value( false );
3320
+ skope.dirtyValues = new api.Value({});//stores the current customized value.
3321
+ skope.dbValues = new api.Value({});//stores the latest db values => will be updated on each skope synced event
3322
+ skope.changesetValues = new api.Value({});//stores the latest changeset values => will be updated on each skope synced eventsynced event
3323
+ skope.userEventMap = new api.Value( [
3324
+ {
3325
+ trigger : 'click keydown',
3326
+ selector : '.czr-scope-switch, .czr-skp-switch-link',
3327
+ name : 'skope_switch',
3328
+ actions : function() {
3329
+ api.czr_activeSkopeId( skope().id );
3330
+ }
3331
+ },
3332
+ {
3333
+ trigger : 'click keydown',
3334
+ selector : '.czr-scope-reset',
3335
+ name : 'skope_reset_warning',
3336
+ actions : 'reactOnSkopeResetUserRequest'
3337
+ }
3338
+ ]);//module.userEventMap
3339
+ skope.skopeResetDialogVisibility.bind( function( to, from ) {
3340
+ return skope.skopeResetDialogReact( to );
3341
+ }, { deferred : true } );
3342
+ skope.dirtyValues.callbacks.add(function() { return skope.dirtyValuesReact.apply(skope, arguments ); } );
3343
+ skope.changesetValues.callbacks.add(function() { return skope.changesetValuesReact.apply(skope, arguments ); } );
3344
+ skope.dbValues.callbacks.add(function() { return skope.dbValuesReact.apply(skope, arguments ); } );
3345
+ skope.callbacks.add(function() { return skope.skopeReact.apply( skope, arguments ); } );
3346
+ skope.set( _.omit( constructor_options, function( _v, _key ) {
3347
+ return _.contains( [ 'db', 'changeset', 'has_db_val' ], _key );
3348
+ } ) );
3349
+ skope.embedded
3350
+ .fail( function() {
3351
+ throw new Error('The container of skope ' + skope().id + ' has not been embededd');
3352
+ })
3353
+ .done( function() {
3354
+ skope.setupDOMListeners( skope.userEventMap() , { dom_el : skope.container } );
3355
+ skope.visible.bind( function( is_visible ){
3356
+ skope.container.toggle( is_visible );
3357
+ });
3358
+ skope.active.callbacks.add(function() { return skope.activeStateReact.apply(skope, arguments ); } );
3359
+ skope.dirtyness.callbacks.add(function() { return skope.dirtynessReact.apply(skope, arguments ); } );
3360
+ skope.hasDBValues.callbacks.add(function() { return skope.hasDBValuesReact.apply(skope, arguments ); } );
3361
+ skope.winner.callbacks.add(function() { return skope.winnerReact.apply(skope, arguments ); } );
3362
+
3363
+
3364
+ skope.dirtyness( ! _.isEmpty( constructor_options.changeset ) );
3365
+ skope.hasDBValues( ! _.isEmpty( constructor_options.db ) );
3366
+ skope.winner( constructor_options.is_winner );
3367
+
3368
+ skope.isReady.resolve();
3369
+ });
3370
+ },
3371
+ ready : function() {
3372
+ var skope = this;
3373
+ $.when( skope.embedSkopeDialogBox() ).done( function( $_container ){
3374
+ if ( false !== $_container.length ) {
3375
+ $_container.css('background-color', skope.color );
3376
+ skope.container = $_container;
3377
+ skope.embedded.resolve( $_container );
3378
+ } else {
3379
+ skope.embedded.reject();
3380
+ }
3381
+ });
3382
+ },
3383
+ dirtyValuesReact : function( to, from ) {
3384
+ var skope = this;
3385
+ skope.dirtyness( ! _.isEmpty( to ) );
3386
+ api.czr_dirtyness( ! _.isEmpty(to) );
3387
+ var ctrlIdDirtynessToClean = [];
3388
+ _.each( from, function( _val, _id ) {
3389
+ if ( _.has( to, _id ) )
3390
+ return;
3391
+ ctrlIdDirtynessToClean.push( _id );
3392
+ });
3393
+ if ( skope().id == api.czr_activeSkopeId() ) {
3394
+ _.each( ctrlIdDirtynessToClean , function( setId ) {
3395
+ if ( ! _.has( api.control( setId ), 'czr_states') )
3396
+ return;
3397
+ api.control( setId ).czr_states( 'isDirty' )( false );
3398
+ });
3399
+ _.each( to, function( _val, _setId ) {
3400
+ if ( ! _.has( api.control( _setId ), 'czr_states') )
3401
+ return;
3402
+ api.control( _setId ).czr_states( 'isDirty' )( true );
3403
+ });
3404
+ }
3405
+ },
3406
+ changesetValuesReact : function( to, from ) {
3407
+ var skope = this,
3408
+ _currentServerDirties = $.extend( true, {}, skope.dirtyValues() );
3409
+ skope.dirtyValues( $.extend( _currentServerDirties, to ) );
3410
+ },
3411
+ dbValuesReact : function( to, from ) {
3412
+ var skope = this;
3413
+ skope.hasDBValues(
3414
+ ! _.isEmpty(
3415
+ 'global' != skope().skope ?
3416
+ to :
3417
+ _.omit( to, function( _val, _id ) {
3418
+ return ! api.czr_skopeBase.isThemeSetting( _id );
3419
+ })
3420
+ )
3421
+ );
3422
+ var ctrlIdDbToReset = [];
3423
+ _.each( from, function( _val, _id ) {
3424
+ if ( _.has( to, _id ) )
3425
+ return;
3426
+ ctrlIdDbToReset.push( _id );
3427
+ });
3428
+ if ( skope().id == api.czr_activeSkopeId() ) {
3429
+ _.each( ctrlIdDbToReset , function( setId ) {
3430
+ if ( ! _.has( api.control( setId ), 'czr_states') )
3431
+ return;
3432
+ api.control( setId ).czr_states( 'hasDBVal' )( false );
3433
+ });
3434
+ _.each( to, function( _val, _setId ) {
3435
+ if ( ! _.has( api.control( _setId ), 'czr_states') )
3436
+ return;
3437
+
3438
+ api.control( _setId ).czr_states( 'hasDBVal' )( true );
3439
+ });
3440
+ }
3441
+ },
3442
+ skopeReact : function( to, from ) {
3443
+ var skope = this,
3444
+ _current_collection = [],
3445
+ _new_collection = [];
3446
+ if ( ! api.czr_skopeBase.isSkopeRegisteredInCollection( to.id ) ) {
3447
+ _current_collection = $.extend( true, [], api.czr_skopeCollection() );
3448
+ _current_collection.push( to );
3449
+ api.czr_skopeCollection( _current_collection );
3450
+ }
3451
+ else {
3452
+ _current_collection = $.extend( true, [], api.czr_skopeCollection() );
3453
+ _new_collection = _current_collection;
3454
+ _.each( _current_collection, function( _skope, _key ) {
3455
+ if ( _skope.id != skope().id )
3456
+ return;
3457
+ _new_collection[_key] = to;
3458
+ });
3459
+ api.czr_skopeCollection( _new_collection );
3460
+ }
3461
+ },
3462
+ activeStateReact : function(to, from){
3463
+ var skope = this;
3464
+ skope.container.toggleClass('inactive').toggleClass('active', to);
3465
+ $('.czr-scope-switch', skope.container).toggleClass('fa-toggle-on', to).toggleClass('fa-toggle-off', !to);
3466
+ },
3467
+ dirtynessReact : function(to, from) {
3468
+ var skope = this;
3469
+ $.when( this.container.toggleClass( 'dirty', to) ).done( function() {
3470
+ if ( to )
3471
+ $( '.czr-scope-reset', skope.container).fadeIn('slow').attr('title', [ 'Reset the current customizations for', skope().title ].join(' ') );//@to_translate
3472
+ else if ( ! skope.hasDBValues() )
3473
+ $( '.czr-scope-reset', skope.container).fadeOut('fast');
3474
+ });
3475
+ },
3476
+ hasDBValuesReact : function( to, from ) {
3477
+ var skope = this;
3478
+ $.when( skope.container.toggleClass('has-db-val', to ) ).done( function() {
3479
+ if ( to ) {
3480
+ $( '.czr-scope-reset', skope.container)
3481
+ .fadeIn( 'slow')
3482
+ .attr( 'title', [
3483
+ 'global' == skope().skope ? 'Reset the theme options published site wide' : 'Reset your website published options for',//@to_translate
3484
+ 'global' == skope().skope ? '' : skope().title
3485
+ ].join(' ') );//@to_translate
3486
+ }
3487
+ else if ( ! skope.dirtyness() ) {
3488
+ $( '.czr-scope-reset', skope.container).fadeOut('fast');
3489
+ }
3490
+ });
3491
+ },
3492
+ winnerReact : function( is_winner ) {
3493
+ var skope = this;
3494
+ this.container.toggleClass('is_winner', is_winner );
3495
+
3496
+ if ( is_winner ) {
3497
+ _.each( api.czr_currentSkopesCollection(), function( _skope ) {
3498
+ if ( _skope.id == skope().id )
3499
+ return;
3500
+ var _current_model = $.extend( true, {}, _skope );
3501
+ $.extend( _current_model, { is_winner : false } );
3502
+ api.czr_skope( _skope.id )( _current_model );
3503
+ });
3504
+ }
3505
+ },
3506
+ updateSkopeDirties : function( setId, new_val ) {
3507
+ var skope = this,
3508
+ shortSetId = api.CZR_Helpers.getOptionName( setId );
3509
+ if ( ! api.czr_skopeBase.isSettingSkopeEligible( setId ) && 'global' != skope().skope )
3510
+ return api.czr_skope( api.czr_skopeBase.getGlobalSkopeId() ).updateSkopeDirties( setId, new_val );
3511
+
3512
+ var current_dirties = $.extend( true, {}, skope.dirtyValues() ),
3513
+ _dirtyCustomized = {};
3514
+
3515
+ _dirtyCustomized[ setId ] = new_val;
3516
+ skope.dirtyValues.set( $.extend( current_dirties , _dirtyCustomized ) );
3517
+ return skope.dirtyValues();
3518
+ },
3519
+ getSkopeSettingDirtyness : function( setId ) {
3520
+ var skope = this;
3521
+ return skope.getSkopeSettingAPIDirtyness( setId ) || skope.getSkopeSettingChangesetDirtyness( setId );
3522
+ },
3523
+ getSkopeSettingAPIDirtyness : function( setId ) {
3524
+ var skope = this;
3525
+ return _.has( skope.dirtyValues(), api.CZR_Helpers.build_setId( setId ) );
3526
+ },
3527
+ getSkopeSettingChangesetDirtyness : function( setId ) {
3528
+ var skope = this;
3529
+ if ( ! api.czr_isChangeSetOn() )
3530
+ return skope.getSkopeSettingAPIDirtyness( setId );
3531
+ return _.has( skope.changesetValues(), api.CZR_Helpers.build_setId( setId ) );
3532
+ },
3533
+ hasSkopeSettingDBValues : function( setId ) {
3534
+ var skope = this,
3535
+ _setId = api.CZR_Helpers.build_setId(setId);
3536
+
3537
+ return ! _.isUndefined( api.czr_skope( api.czr_activeSkopeId() ).dbValues()[_setId] );
3538
+ }
3539
+ } );//$.extend(
3540
+ var CZRSkopeMths = CZRSkopeMths || {};
3541
+ $.extend( CZRSkopeMths, {
3542
+ embedSkopeDialogBox : function() {
3543
+ var skope = this,
3544
+ skope_model = $.extend( true, {}, skope() ),
3545
+ _tmpl = '';
3546
+ if ( ! $('#customize-header-actions').find('.czr-scope-switcher').length ) {
3547
+ throw new Error('The skope switcher wrapper is not printed, the skope can not be embedded.');
3548
+ }
3549
+ try {
3550
+ _tmpl = wp.template('czr-skope')( _.extend( skope_model, { el : skope.el } ) );
3551
+ }
3552
+ catch(e) {
3553
+ throw new Error('Error when parsing the template of a skope' + e );
3554
+ }
3555
+
3556
+ $('.czr-skopes-wrapper', '#customize-header-actions').append( $( _tmpl ) );
3557
+ return $( '.' + skope.el , '.czr-skopes-wrapper' );
3558
+ },
3559
+ renderResetWarningTmpl : function() {
3560
+ var skope = this,
3561
+ skope_model = $.extend( true, {}, skope() ),
3562
+ _tmpl = '',
3563
+ warning_message,
3564
+ success_message;
3565
+
3566
+ if ( skope.dirtyness() ) {
3567
+ warning_message = [
3568
+ 'Please confirm that you want to reset your current customizations for : ',//@to_translate
3569
+ skope().title,
3570
+ '.'
3571
+ ].join('');
3572
+ success_message = [
3573
+ 'Your customizations have been reset for ',//@to_translate
3574
+ skope().title,
3575
+ '.'
3576
+ ].join('');
3577
+ } else {
3578
+ warning_message = [
3579
+ 'Please confirm that you want to reset your published customizations to defaults for : ',//@to_translate
3580
+ skope().title,
3581
+ '.'
3582
+ ].join('');
3583
+ success_message = [
3584
+ 'The options have been reset to defaults for ',//@to_translate
3585
+ skope().title,
3586
+ '.'
3587
+ ].join('');
3588
+ }
3589
+
3590
+ try {
3591
+ _tmpl = wp.template( 'czr-skope-pane' )(
3592
+ _.extend( skope_model, {
3593
+ el : skope.el,
3594
+ warning_message : warning_message,
3595
+ success_message : success_message
3596
+ } )
3597
+ );
3598
+ }
3599
+ catch(e) {
3600
+ throw new Error('Error when parsing the the reset skope template : ' + e );//@to_translate
3601
+ }
3602
+
3603
+ $('#customize-preview').after( $( _tmpl ) );
3604
+
3605
+ return $( '#czr-skope-pane' );
3606
+ },
3607
+ getEl : function() {
3608
+ var skope = this;
3609
+ return $( skope.el, '#customize-header-actions');
3610
+ }
3611
+ });//$.extend()
3612
+
3613
+ var CZRSkopeMths = CZRSkopeMths || {};
3614
+ $.extend( CZRSkopeMths, {
3615
+ reactOnSkopeResetUserRequest : function() {
3616
+ var skope = this,
3617
+ _fireReaction = function() {
3618
+ api.state( 'czr-resetting')( true );
3619
+ if ( api.czr_activeSkopeId() != skope().id ) {
3620
+ api.czr_activeSkopeId( skope().id )
3621
+ .done( function() {
3622
+ skope.skopeResetDialogVisibility( ! skope.skopeResetDialogVisibility() ).done( function() {
3623
+ api.state( 'czr-resetting')( false );
3624
+ });
3625
+
3626
+ });
3627
+ } else {
3628
+ skope.skopeResetDialogVisibility( ! skope.skopeResetDialogVisibility() ).done( function() {
3629
+ api.state( 'czr-resetting')( false );
3630
+ });
3631
+ }
3632
+ };
3633
+ if ( ( api.state( 'czr-resetting')() || 0 !== api.state( 'processing' )() ) ) {
3634
+ api.czr_serverNotification( {
3635
+ message: 'Slow down, you move too fast !',//@to_translate
3636
+ status : 'success',
3637
+ auto_collapse : true
3638
+ });
3639
+ return;
3640
+ }
3641
+ if ( api.czr_activeSkopeId() != skope().id && api.czr_skope( api.czr_activeSkopeId() ).skopeResetDialogVisibility() ) {
3642
+ api.czr_skope( api.czr_activeSkopeId() ).skopeResetDialogVisibility( false ).done( function() {
3643
+ _fireReaction();
3644
+ });
3645
+ } else {
3646
+ _fireReaction();
3647
+ }
3648
+ },
3649
+ skopeResetDialogReact : function( visible ) {
3650
+ var skope = this, dfd = $.Deferred();
3651
+ skope.userResetEventMap = skope.userResetEventMap || new api.Value( [
3652
+ {
3653
+ trigger : 'click keydown',
3654
+ selector : '.czr-scope-reset-cancel',
3655
+ name : 'skope_reset_cancel',
3656
+ actions : function() {
3657
+ skope.skopeResetDialogVisibility( ! skope.skopeResetDialogVisibility() );
3658
+ }
3659
+ },
3660
+ {
3661
+ trigger : 'click keydown',
3662
+ selector : '.czr-scope-do-reset',
3663
+ name : 'skope_do_reset',
3664
+ actions : 'doResetSkopeValues'
3665
+ }
3666
+ ]
3667
+ );
3668
+
3669
+ if ( visible ) {
3670
+ api.czr_isResettingSkope( skope().id );
3671
+ $.when( skope.renderResetWarningTmpl() ).done( function( $_container ) {
3672
+ skope.resetPanel = $_container;
3673
+ skope.resetPanel.addClass( skope.dirtyness() ? 'dirty-reset' : 'db-reset' );
3674
+ skope.setupDOMListeners( skope.userResetEventMap() , { dom_el : skope.resetPanel } );
3675
+ }).then( function() {
3676
+ setTimeout( function() {
3677
+ var _height = $('#customize-preview').height();
3678
+ skope.resetPanel.css( 'line-height', _height +'px' ).css( 'height', _height + 'px' );
3679
+ $('body').addClass('czr-skope-pane-open');
3680
+ }, 50 );
3681
+ });
3682
+ } else {
3683
+ $.when( $('body').removeClass('czr-skope-pane-open') ).done( function() {
3684
+ if ( _.has( skope, 'resetPanel') && false !== skope.resetPanel.length ) {
3685
+ setTimeout( function() {
3686
+ skope.resetPanel.remove();
3687
+ api.czr_isResettingSkope( false );
3688
+ }, 300 );
3689
+ }
3690
+ });
3691
+ }
3692
+ _.delay( function() {
3693
+ dfd.resolve();
3694
+ }, 350 );
3695
+
3696
+ return dfd.promise();
3697
+ },
3698
+ doResetSkopeValues : function() {
3699
+ var skope = this,
3700
+ skope_id = skope().id,
3701
+ reset_method = skope.dirtyness() ? '_resetSkopeDirties' : '_resetSkopeAPIValues',
3702
+ _updateAPI = function() {
3703
+ var _silentUpdate = function() {
3704
+ api.czr_skopeBase.processSilentUpdates( { refresh : false } )
3705
+ .fail( function() { api.consoleLog( 'Silent update failed after resetting skope : ' + skope_id ); } )
3706
+ .done( function() {
3707
+ $.when( $('.czr-reset-warning', skope.resetPanel ).fadeOut('300') ).done( function() {
3708
+ $.when( $('.czr-reset-success', skope.resetPanel ).fadeIn('300') ).done( function() {
3709
+ _.delay( function() {
3710
+ api.czr_isResettingSkope( false );
3711
+ skope.skopeResetDialogVisibility( false );
3712
+ }, 2000 );
3713
+ });
3714
+ });
3715
+ });
3716
+ };
3717
+
3718
+ skope[reset_method]()
3719
+ .done( function() {
3720
+ api.previewer.refresh()
3721
+ .fail( function( refresh_data ) {
3722
+ api.consoleLog('SKOPE RESET REFRESH FAILED', refresh_data );
3723
+ })
3724
+ .done( function( refresh_data ) {
3725
+ if ( 'global' == api.czr_skope( skope_id )().skope && '_resetSkopeAPIValues' == reset_method ) {
3726
+ var _sentSkopeCollection,
3727
+ _serverGlobalDbValues = {},
3728
+ _skope_opt_name = api.czr_skope( skope_id )().opt_name;
3729
+
3730
+ if ( ! _.isUndefined( refresh_data.skopesServerData ) && _.has( refresh_data.skopesServerData, 'czr_skopes' ) ) {
3731
+ _sentSkopeCollection = refresh_data.skopesServerData.czr_skopes;
3732
+ if ( _.isUndefined( _.findWhere( _sentSkopeCollection, { opt_name : _skope_opt_name } ) ) ) {
3733
+ _serverGlobalDbValues = _.findWhere( _sentSkopeCollection, { opt_name : _skope_opt_name } ).db || {};
3734
+ }
3735
+ }
3736
+ api.czr_skopeBase.maybeSynchronizeGlobalSkope( { isGlobalReset : true, isSkope : true, skopeIdToReset : skope_id } )
3737
+ .done( function() {
3738
+ _silentUpdate();
3739
+ });
3740
+ } else {
3741
+ _silentUpdate();
3742
+ }
3743
+ });
3744
+
3745
+ });
3746
+ };//_updateAPI
3747
+
3748
+ $('body').addClass('czr-resetting-skope');
3749
+ api.czr_skopeReset[ skope.dirtyness() ? 'resetChangeset' : 'resetPublished' ](
3750
+ { skope_id : skope().id, is_skope : true } )
3751
+ .always( function() {
3752
+ $('body').removeClass('czr-resetting-skope');//hides the spinner
3753
+ })
3754
+ .done( function( r ) {
3755
+ _updateAPI();
3756
+ })
3757
+ .fail( function( r ) {
3758
+ skope.skopeResetDialogVisibility( false );
3759
+ api.consoleLog('Skope reset failed', r );
3760
+ });
3761
+ },
3762
+ _resetSkopeDirties : function() {
3763
+ var skope = this, dfd = $.Deferred();
3764
+ skope.dirtyValues({});
3765
+ skope.changesetValues({});
3766
+ return dfd.resolve().promise();
3767
+ },
3768
+ _resetSkopeAPIValues : function() {
3769
+ var skope = this, dfd = $.Deferred();
3770
+ skope.dbValues( {} );
3771
+ return dfd.resolve().promise();
3772
+ }
3773
+ } );//$.extend(
3774
+ (function (api, $, _) {
3775
+ if ( ! serverControlParams.isSkopOn )
3776
+ return;
3777
+ api.Value.prototype.set = function( to, o ) {
3778
+ var from = this._value, dfd = $.Deferred(), self = this, _promises = [];
3779
+
3780
+ to = this._setter.apply( this, arguments );
3781
+ to = this.validate( to );
3782
+ if ( null === to || _.isEqual( from, to ) ) {
3783
+ return this;
3784
+ }
3785
+
3786
+ this._value = to;
3787
+ this._dirty = true;
3788
+
3789
+ if ( this._deferreds ) {
3790
+ _.each( self._deferreds, function( _prom ) {
3791
+ _promises.push( _prom.apply( null, [ to, from, o ] ) );
3792
+ });
3793
+
3794
+ $.when.apply( null, _promises )
3795
+ .fail( function() { api.consoleLog( 'A deferred callback failed in api.Value::set()'); })
3796
+ .then( function() {
3797
+ self.callbacks.fireWith( self, [ to, from, o ] );
3798
+ dfd.resolveWith( self, [ to, from, o ] );
3799
+ });
3800
+ } else {
3801
+ this.callbacks.fireWith( this, [ to, from, o ] );
3802
+ return dfd.resolveWith( self, [ to, from, o ] ).promise( self );
3803
+ }
3804
+ return dfd.promise( self );
3805
+ };
3806
+ api.Value.prototype.bind = function() {
3807
+ var self = this,
3808
+ _isDeferred = false,
3809
+ _cbs = [];
3810
+
3811
+ $.each( arguments, function( _key, _arg ) {
3812
+ if ( ! _isDeferred )
3813
+ _isDeferred = _.isObject( _arg ) && _arg.deferred;
3814
+ if ( _.isFunction( _arg ) )
3815
+ _cbs.push( _arg );
3816
+ });
3817
+
3818
+ if ( _isDeferred ) {
3819
+ self._deferreds = self._deferreds || [];
3820
+ _.each( _cbs, function( _cb ) {
3821
+ if ( ! _.contains( _cb, self._deferreds ) )
3822
+ self._deferreds.push( _cb );
3823
+ });
3824
+ } else {
3825
+ self.callbacks.add.apply( self.callbacks, arguments );
3826
+ }
3827
+ return this;
3828
+ };
3829
+ api.Setting.prototype.silent_set =function( to, dirtyness ) {
3830
+ var from = this._value,
3831
+ _save_state = api.state('saved')();
3832
+
3833
+ to = this._setter.apply( this, arguments );
3834
+ to = this.validate( to );
3835
+ if ( null === to || _.isEqual( from, to ) ) {
3836
+ return this;
3837
+ }
3838
+
3839
+ this._value = to;
3840
+ this._dirty = ( _.isUndefined( dirtyness ) || ! _.isBoolean( dirtyness ) ) ? this._dirty : dirtyness;
3841
+
3842
+ this.callbacks.fireWith( this, [ to, from, { silent : true } ] );
3843
+ api.state('saved')( _save_state );
3844
+ return this;
3845
+ };
3846
+ })( wp.customize , jQuery, _ );
3847
+ (function (api, $, _) {
3848
+
3849
+ api.bind('ready', function() {
3850
+ if ( ! serverControlParams.isSkopOn )
3851
+ return;
3852
+ var _coreQuery = api.previewer.query;
3853
+ api.previewer.query = function( queryVars ) {
3854
+ if ( ! _.has( api, 'czr_skope') ) {
3855
+ api.consoleLog('QUERY : SKOPE IS NOT ON. FALLING BACK ON CORE QUERY');
3856
+ return _coreQuery.apply( this );
3857
+ }
3858
+ if ( 'pending' == api.czr_initialSkopeCollectionPopulated.state() ) {
3859
+ api.consoleLog('QUERY : INITIAL SKOPE COLLECTION NOT POPULATED YET. FALLING BACK ON CORE QUERY');
3860
+ return _coreQuery.apply( this );
3861
+ }
3862
+ if ( 'pending' == api.czr_isPreviewerSkopeAware.state() ) {
3863
+ api.czr_isPreviewerSkopeAware.resolve();
3864
+ }
3865
+ if ( ! _.isObject( queryVars ) && 'resolved' == api.czr_initialSkopeCollectionPopulated.state() && 'resolved' == api.czr_initialSkopeCollectionPopulated.state() ) {
3866
+ return _coreQuery.apply( this );
3867
+ }
3868
+ if ( _.isUndefined( queryVars.skope_id ) || ! _.isString( queryVars.skope_id ) ) {
3869
+ queryVars.skope_id = api.czr_activeSkopeId() || api.czr_skopeBase.getGlobalSkopeId();
3870
+ }
3871
+
3872
+ var globalCustomized = {},
3873
+ skopeCustomized = {},
3874
+ _defaults = {
3875
+ skope_id : null,
3876
+ action : null,
3877
+ the_dirties : {},
3878
+ dyn_type : null,
3879
+ opt_name : null
3880
+ },
3881
+ _to_return;
3882
+
3883
+ queryVars = $.extend( _defaults, queryVars );
3884
+ if ( ! _.isObject( queryVars.the_dirties ) ) {
3885
+ api.consoleLog('QUERY PARAMS : ', queryVars );
3886
+ throw new Error( 'QUERY DIRTIES MUST BE AN OBJECT. Requested action : ' + queryVars.action );
3887
+ }
3888
+ if ( 'pending' != api.czr_isPreviewerSkopeAware.state() && _.isNull( queryVars.skope_id ) ) {
3889
+ api.consoleLog('QUERY PARAMS : ', queryVars );
3890
+ throw new Error( 'OVERRIDEN QUERY : NO SKOPE ID. FALLING BACK ON CORE QUERY. Requested action : ' + queryVars.action );
3891
+ }
3892
+ if ( ! _.contains( [ null, 'refresh', 'save', 'reset', 'changeset_update' ], queryVars.action ) ) {
3893
+ api.consoleLog('QUERY PARAMS : ', queryVars );
3894
+ throw new Error( 'A REQUESTED QUERY HAS NO AUTHORIZED ACTION. Requested action : ' + queryVars.action );
3895
+ }
3896
+ var _getSkopesCustomized = function() {
3897
+ if ( 'pending' == api.czr_initialSkopeCollectionPopulated.state() )
3898
+ return {};
3899
+ var _skpCust = {};
3900
+ _.each( api.czr_currentSkopesCollection(), function( _skp ) {
3901
+ if ( 'global' == _skp.skope )
3902
+ return;
3903
+ _skpCust[_skp.id] = api.czr_skopeBase.getSkopeDirties( _skp.id );
3904
+ } );
3905
+ return _skpCust;
3906
+ };
3907
+ if ( _.isNull( queryVars.the_dirties ) || _.isEmpty( queryVars.the_dirties ) ) {
3908
+ globalCustomized = api.dirtyValues( { unsaved: queryVars.excludeCustomizedSaved || false } );
3909
+ skopeCustomized = _getSkopesCustomized();
3910
+ } else {
3911
+ if ( 'global' == api.czr_skopeBase.getActiveSkopeName() )
3912
+ globalCustomized = queryVars.the_dirties;
3913
+ else
3914
+ skopeCustomized[ api.czr_activeSkopeId() ] = queryVars.the_dirties;
3915
+ }
3916
+ switch( queryVars.action ) {
3917
+ case null :
3918
+ case 'refresh' :
3919
+ break;
3920
+
3921
+ case 'changeset_update' :
3922
+ if ( _.isUndefined( queryVars.opt_name ) ) {
3923
+ throw new Error('Missing opt_name param in the changeset_update query for skope : ' + queryVars.skope_id );
3924
+ }
3925
+ break;
3926
+
3927
+
3928
+ case 'save' :
3929
+ if ( _.isNull( queryVars.dyn_type ) )
3930
+ queryVars.dyn_type = api.czr_skope( queryVars.skope_id )().dyn_type;//post_meta, term_meta, user_meta, trans, option
3931
+ if ( _.isNull( queryVars.dyn_type ) || _.isUndefined( queryVars.dyn_type ) ) {
3932
+ throw new Error( 'QUERY : A SAVE QUERY MUST HAVE A VALID DYN TYPE.' + queryVars.skope_id );
3933
+ }
3934
+ break;
3935
+
3936
+ case 'reset' :
3937
+ if ( _.isNull( queryVars.dyn_type ) )
3938
+ queryVars.dyn_type = api.czr_skope( queryVars.skope_id )().dyn_type;//post_meta, term_meta, user_meta, trans, option
3939
+ if ( _.isNull( queryVars.dyn_type ) || _.isUndefined( queryVars.dyn_type ) ) {
3940
+ throw new Error( 'QUERY : A RESET QUERY MUST HAVE A VALID DYN TYPE.' + queryVars.skope_id );
3941
+ }
3942
+ break;
3943
+ }
3944
+ var _current_skopes = {};
3945
+ _.each( api.czr_currentSkopesCollection(), function( _skp ) {
3946
+ _current_skopes[_skp.skope] = { id : _skp.id, opt_name : _skp.opt_name };
3947
+ });
3948
+ _to_return = {
3949
+ wp_customize: 'on',
3950
+ customized: '{}' == JSON.stringify( globalCustomized ) ? '{\"__not_customized__\"}' : JSON.stringify( globalCustomized ),
3951
+ skopeCustomized: JSON.stringify( skopeCustomized ),
3952
+ nonce: this.nonce.preview,
3953
+ skope: api.czr_skope( queryVars.skope_id )().skope,
3954
+ level_id: api.czr_skope( queryVars.skope_id )().level,
3955
+ skope_id: queryVars.skope_id,
3956
+ dyn_type: queryVars.dyn_type,
3957
+ opt_name: ! _.isNull( queryVars.opt_name ) ? queryVars.opt_name : api.czr_skope( queryVars.skope_id )().opt_name,
3958
+ obj_id: api.czr_skope( queryVars.skope_id )().obj_id,
3959
+ current_skopes: JSON.stringify( _current_skopes ) || {},
3960
+ channel: this.channel(),
3961
+ revisionIndex: api._latestRevision
3962
+ };
3963
+ if ( api.czr_isChangeSetOn() ) {
3964
+ _to_return = $.extend( _to_return , {
3965
+ customize_theme: api.settings.theme.stylesheet,
3966
+ customize_changeset_uuid: api.settings.changeset.uuid
3967
+ });
3968
+ }
3969
+ else {
3970
+ _to_return = $.extend( _to_return , {
3971
+ theme: api.settings.theme.stylesheet
3972
+ });
3973
+ }
3974
+ return _to_return;
3975
+
3976
+ };//api.previewer.query
3977
+ });//api.bind('ready')
3978
+
3979
+ })( wp.customize , jQuery, _ );
3980
+ (function (api, $, _) {
3981
+ api.bind( 'czr-skope-started', function() {
3982
+ api.previewer.save = function( args ) {
3983
+ return api.czr_skopeSave.save();
3984
+ };
3985
+
3986
+ });//api.bind('ready')
3987
+ })( wp.customize , jQuery, _ );
3988
+ (function (api, $, _) {
3989
+
3990
+ if ( ! serverControlParams.isSkopOn )
3991
+ return;
3992
+ api.Element.synchronizer.checkbox.update = function( to ) {
3993
+ this.element.prop( 'checked', to );
3994
+ this.element.iCheck('update');
3995
+ };
3996
+
3997
+ var _original = api.Element.synchronizer.val.update;
3998
+ api.Element.synchronizer.val.update = function(to) {
3999
+ var self = this,
4000
+ _modifySynchronizer = function() {
4001
+ if ( self.element.is('select') ) {
4002
+ self.element.val(to).trigger('change');
4003
+ } else if ( self.element.hasClass('wp-color-picker') ) {
4004
+ self.element.val(to).trigger('change');
4005
+ }
4006
+ else {
4007
+ self.element.val( to );
4008
+ }
4009
+ };
4010
+ if ( serverControlParams.isSkopOn ) {
4011
+ api.czr_skopeReady.then( function () {
4012
+ _modifySynchronizer();
4013
+ });
4014
+ } else {
4015
+ _modifySynchronizer();
4016
+ }
4017
+ };
4018
+
4019
+ api.Element.synchronizer.val.refresh = function() {
4020
+ var syncApiInstance = this;
4021
+ if ( this.element.is('select') && _.isNull( this.element.val() ) ) {
4022
+ if ( _.isArray( syncApiInstance() ) )
4023
+ return [];
4024
+ else if ( _.isObject( syncApiInstance() ) )
4025
+ return {};
4026
+ else
4027
+ return '';
4028
+ } else {
4029
+ return this.element.val();
4030
+ }
4031
+ };
4032
+ })( wp.customize , jQuery, _ );
4033
+ (function (api, $, _) {
4034
+ var coreRefresh = api.Previewer.prototype.refresh;
4035
+ var _new_refresh = function( params ) {
4036
+ params = _.extend({
4037
+ waitSkopeSynced : true,
4038
+ the_dirties : {}
4039
+ },
4040
+ params
4041
+ );
4042
+
4043
+ if ( ! _.has( api, 'czr_activeSkopeId') || _.isUndefined( api.czr_activeSkopeId() ) ) {
4044
+ api.consoleLog( 'The api.czr_activeSkopeId() is undefined in the api.previewer._new_refresh() method.');
4045
+ }
4046
+ var previewer = this, dfd = $.Deferred();
4047
+ if ( ! _.has( api, 'czr_activeSkopeId') ) {
4048
+ if ( 'pending' == api.czr_skopeReady.state() ) {
4049
+ api.czr_skopeReady.done( function() {
4050
+ _new_refresh.apply( api.previewer, params );
4051
+ });
4052
+ coreRefresh.apply( previewer );
4053
+ return dfd.resolve().promise();
4054
+ }
4055
+ }
4056
+ previewer.send( 'loading-initiated' );
4057
+
4058
+ previewer.abort();
4059
+
4060
+ var query_params = api.czr_getSkopeQueryParams({
4061
+ skope_id : api.czr_activeSkopeId(),
4062
+ action : 'refresh',
4063
+ the_dirties : params.the_dirties || {}
4064
+ });
4065
+
4066
+ previewer.loading = new api.PreviewFrame({
4067
+ url: previewer.url(),
4068
+ previewUrl: previewer.previewUrl(),
4069
+ query: previewer.query( query_params ) || {},
4070
+ container: previewer.container,
4071
+ signature: 'WP_CUSTOMIZER_SIGNATURE'//will be deprecated in 4.7
4072
+ });
4073
+
4074
+
4075
+ previewer.settingsModifiedWhileLoading = {};
4076
+ onSettingChange = function( setting ) {
4077
+ previewer.settingsModifiedWhileLoading[ setting.id ] = true;
4078
+ };
4079
+ api.bind( 'change', onSettingChange );
4080
+
4081
+ previewer.loading.always( function() {
4082
+ api.unbind( 'change', onSettingChange );
4083
+ } );
4084
+ if ( ! api.czr_isChangeSetOn() ) {
4085
+ previewer._previousPreview = previewer._previousPreview || previewer.preview;
4086
+ }
4087
+
4088
+ previewer.loading.done( function( readyData ) {
4089
+ var loadingFrame = this, onceSynced;
4090
+
4091
+ previewer.preview = loadingFrame;
4092
+ previewer.targetWindow( loadingFrame.targetWindow() );
4093
+ previewer.channel( loadingFrame.channel() );
4094
+ onceSynced = function( skopesServerData ) {
4095
+ loadingFrame.unbind( 'synced', onceSynced );
4096
+ loadingFrame.unbind( 'czr-skopes-synced', onceSynced );
4097
+
4098
+ if ( previewer._previousPreview ) {
4099
+ previewer._previousPreview.destroy();
4100
+ } //before WP 4.7
4101
+ else {
4102
+ if ( previewer.preview )
4103
+ previewer.preview.destroy();
4104
+ }
4105
+
4106
+ previewer._previousPreview = previewer.preview;
4107
+ previewer.deferred.active.resolve();
4108
+ delete previewer.loading;
4109
+
4110
+ api.trigger( 'pre_refresh_done', { previewer : previewer, skopesServerData : skopesServerData || {} } );
4111
+ dfd.resolve( { previewer : previewer, skopesServerData : skopesServerData || {} } );
4112
+ };
4113
+ if ( ! api.czr_isChangeSetOn() ) {
4114
+ previewer.send( 'sync', {
4115
+ scroll: previewer.scroll,
4116
+ settings: api.get()
4117
+ });
4118
+ }
4119
+
4120
+ if ( params.waitSkopeSynced ) {
4121
+ loadingFrame.bind( 'czr-skopes-synced', onceSynced );
4122
+ } else {
4123
+ loadingFrame.bind( 'synced', onceSynced );
4124
+ }
4125
+ previewer.trigger( 'ready', readyData );
4126
+ });
4127
+ previewer.loading.fail( function( reason, location ) {
4128
+ api.consoleLog('LOADING FAILED : ' , arguments );
4129
+ previewer.send( 'loading-failed' );
4130
+ if ( ! api.czr_isChangeSetOn() ) {
4131
+ if ( 'redirect' === reason && location ) {
4132
+ previewer.previewUrl( location );
4133
+ }
4134
+ }
4135
+
4136
+ if ( 'logged out' === reason ) {
4137
+ if ( previewer.preview ) {
4138
+ previewer.preview.destroy();
4139
+ delete previewer.preview;
4140
+ }
4141
+
4142
+ previewer.login().done( previewer.refresh );
4143
+ }
4144
+
4145
+ if ( 'cheatin' === reason ) {
4146
+ previewer.cheatin();
4147
+ }
4148
+ dfd.reject( reason );
4149
+ });
4150
+
4151
+ return dfd.promise();
4152
+ };//_new_refresh()
4153
+ api.Previewer.prototype.refresh = _new_refresh;
4154
+ api.bind( 'czr-skope-started' , function() {
4155
+ czr_override_refresh_for_skope();
4156
+ });
4157
+ api.czr_getSkopeQueryParams = function( params ) {
4158
+ if ( ! api.czr_isChangeSetOn() )
4159
+ return params;
4160
+ params = ! _.isObject(params) ? {} : params;
4161
+ var _action = params.action || 'refresh';
4162
+ switch( _action ) {
4163
+ case 'refresh' :
4164
+ params = $.extend( params, { excludeCustomizedSaved: true } );
4165
+ break;
4166
+ }
4167
+ return params;
4168
+ };
4169
+ czr_override_refresh_for_skope = function() {
4170
+ if ( ! serverControlParams.isSkopOn )
4171
+ return;
4172
+ api.previewer.refresh = function( _params_ ) {
4173
+ var dfd = $.Deferred();
4174
+ var _refresh_ = function( params ) {
4175
+ var refreshOnceProcessingComplete,
4176
+ isProcessingComplete = function() {
4177
+ return 0 === api.state( 'processing' ).get();
4178
+ },
4179
+ resolveRefresh = function() {
4180
+ _new_refresh.call( api.previewer, params ).done( function( refresh_data ) {
4181
+ dfd.resolve( refresh_data );
4182
+ });
4183
+ };
4184
+ if ( isProcessingComplete() ) {
4185
+ resolveRefresh();
4186
+ } else {
4187
+ refreshOnceProcessingComplete = function() {
4188
+ if ( isProcessingComplete() ) {
4189
+ resolveRefresh();
4190
+ api.state( 'processing' ).unbind( refreshOnceProcessingComplete );
4191
+ }
4192
+ };
4193
+ api.state( 'processing' ).bind( refreshOnceProcessingComplete );
4194
+ }
4195
+ };
4196
+ _refresh_ = _.debounce( _refresh_, api.previewer.refreshBuffer );
4197
+ _refresh_( _params_ );
4198
+ return dfd.promise();
4199
+ };
4200
+
4201
+ };//czr_override_refresh_for_skope
4202
+
4203
+ })( wp.customize , jQuery, _ );
4204
+ (function (api, $, _) {
4205
+ if ( ! serverControlParams.isSkopOn )
4206
+ return;
4207
+ api.dirtyValues = function dirtyValues( options ) {
4208
+ return api.czr_skopeBase.getSkopeDirties( api.czr_skopeBase.getGlobalSkopeId(), options );
4209
+ };
4210
+
4211
+ })( wp.customize , jQuery, _ );
4212
+ (function (api, $, _) {
4213
+ if ( ! serverControlParams.isSkopOn || ! api.czr_isChangeSetOn() )
4214
+ return;
4215
+ var _original_requestChangesetUpdate = api.requestChangesetUpdate;
4216
+ api.requestChangesetUpdate = function( changes ) {
4217
+ var self = this,
4218
+ dfd = $.Deferred(),
4219
+ data,
4220
+ _skopesToUpdate = [],
4221
+ _promises = [],
4222
+ _global_skope_changes = changes || {},
4223
+ failedPromises = [],
4224
+ _all_skopes_data_ = [],
4225
+ _recursiveCallDeferred = $.Deferred();
4226
+ if ( 0 === api._lastSavedRevision || _.isEmpty( api.state( 'changesetStatus' )() ) ) {
4227
+ _global_skope_changes = _.extend( _global_skope_changes, {
4228
+ blogname : { dummy_change : 'dummy_change' }
4229
+ } );
4230
+ }
4231
+ _.each( api.czr_currentSkopesCollection(), function( _skp ) {
4232
+ if ( 'global' == _skp.skope )
4233
+ return;
4234
+ _skopesToUpdate.push( _skp.id );
4235
+ } );
4236
+
4237
+ var _mayBeresolve = function( _index ) {
4238
+ if ( ! _.isUndefined( _skopesToUpdate[ _index + 1 ] ) || _promises.length != _skopesToUpdate.length )
4239
+ return;
4240
+
4241
+ if ( _.isEmpty( failedPromises ) ) {
4242
+ _recursiveCallDeferred.resolve( _all_skopes_data_ );
4243
+ } else {
4244
+ var _buildResponse = function() {
4245
+ var _failedResponse = [];
4246
+ _.each( failedPromises, function( _r ) {
4247
+ _failedResponse.push( api.czr_skopeBase.buildServerResponse( _r ) );
4248
+ } );
4249
+ return $.trim( _failedResponse.join( ' | ') );
4250
+ };
4251
+ _recursiveCallDeferred.reject( _buildResponse() );
4252
+ }
4253
+ return true;
4254
+ };
4255
+ var recursiveCall = function( _index ) {
4256
+ if ( _.isUndefined( _index ) || ( ( 0 * 0 ) == _index ) ) {
4257
+ api.state( 'processing' ).set( 1 );
4258
+ }
4259
+
4260
+ _index = _index || 0;
4261
+ if ( _.isUndefined( _skopesToUpdate[_index] ) ) {
4262
+ api.consoleLog( 'Undefined Skope in changeset recursive call ', _index, _skopesToUpdate, _skopesToUpdate[_index] );
4263
+ return _recursiveCallDeferred.resolve( _all_skopes_data_ ).promise();
4264
+ }
4265
+ api._requestSkopeChangetsetUpdate( changes, _skopesToUpdate[_index] )
4266
+ .always( function() { _promises.push( _index ); } )
4267
+ .fail( function( response ) {
4268
+ failedPromises.push( response );
4269
+ api.consoleLog('CHANGESET UPDATE RECURSIVE FAIL FOR SKOPE : ', _skopesToUpdate[_index] );
4270
+ if ( ! _mayBeresolve( _index ) )
4271
+ recursiveCall( _index + 1 );
4272
+ } )
4273
+ .done( function( _skope_data_ ) {
4274
+ _all_skopes_data_.push( _skope_data_ );
4275
+ if ( ! _mayBeresolve( _index ) )
4276
+ recursiveCall( _index + 1 );
4277
+ } );
4278
+
4279
+ return _recursiveCallDeferred.promise();
4280
+ };
4281
+ var _lastSavedRevisionBefore = api._lastSavedRevision;
4282
+ _original_requestChangesetUpdate( _global_skope_changes )
4283
+ .fail( function( r ) {
4284
+ api.consoleLog( 'WP requestChangesetUpdateFail', r, api.czr_skopeBase.buildServerResponse(r) );
4285
+ api._lastSavedRevision = Math.max( api._latestRevision, api._lastSavedRevision );
4286
+ api.state( 'processing' ).set( 0 );
4287
+
4288
+ dfd.reject( r );
4289
+ r = api.czr_skopeBase.buildServerResponse(r);
4290
+ api.czr_serverNotification( { message: r, status : 'error' } );
4291
+ })
4292
+ .done( function( wp_original_response ) {
4293
+ if ( 'pending' == api.czr_initialSkopeCollectionPopulated.state() )
4294
+ dfd.resolve( wp_original_response );
4295
+
4296
+ api._lastSavedRevision = _lastSavedRevisionBefore;
4297
+ recursiveCall()
4298
+ .always( function() {
4299
+ api._lastSavedRevision = Math.max( api._latestRevision, api._lastSavedRevision );
4300
+ api.state( 'processing' ).set( 0 );
4301
+ })
4302
+ .fail( function( r ) {
4303
+ dfd.reject( r );
4304
+ api.consoleLog( 'CHANGESET UPDATE RECURSIVE PUSH FAIL', r , _all_skopes_data_ );
4305
+ api.trigger( 'changeset-error', r );
4306
+ api.czr_serverNotification( { message: r, status : 'error' } );
4307
+ } )
4308
+ .done( function() {
4309
+ dfd.resolve( wp_original_response );
4310
+ });
4311
+ });
4312
+
4313
+ return dfd.promise();
4314
+ };
4315
+ api._requestSkopeChangetsetUpdate = function( changes, skope_id ) {
4316
+ if ( _.isUndefined( skope_id ) || ! api.czr_skope.has( skope_id ) ) {
4317
+ throw new Error( 'In api._requestSkopeChangetsetUpdate() : a valid and registered skope_id must be provided' );
4318
+ }
4319
+
4320
+ var deferred = new $.Deferred(),
4321
+ request,
4322
+ submittedChanges = {},
4323
+ data;
4324
+ skope_id = skope_id || api.czr_activeSkopeId();
4325
+
4326
+ if ( changes ) {
4327
+ _.extend( submittedChanges, changes );
4328
+ }
4329
+ _.each( api.czr_skopeBase.getSkopeDirties( skope_id ) , function( dirtyValue, settingId ) {
4330
+ if ( ! changes || null !== changes[ settingId ] ) {
4331
+ submittedChanges[ settingId ] = _.extend(
4332
+ {},
4333
+ submittedChanges[ settingId ] || {},
4334
+ { value: dirtyValue }
4335
+ );
4336
+ }
4337
+ } );
4338
+ if ( _.isEmpty( submittedChanges ) ) {
4339
+ deferred.resolve( {} );
4340
+ return deferred.promise();
4341
+ }
4342
+
4343
+ if ( api._latestRevision <= api._lastSavedRevision ) {
4344
+ deferred.resolve( {} );
4345
+ return deferred.promise();
4346
+ }
4347
+ api.trigger( 'skope-changeset-save', submittedChanges );
4348
+
4349
+ var queryVars = {
4350
+ skope_id : skope_id,
4351
+ action : 'changeset_update',
4352
+ opt_name : api.czr_skope( skope_id ).opt_name
4353
+ };
4354
+ data = api.previewer.query( _.extend( queryVars, { excludeCustomizedSaved: true } ) );
4355
+ delete data.customized; // Being sent in customize_changeset_data instead.
4356
+ _.extend( data, {
4357
+ nonce: api.settings.nonce.save,
4358
+ customize_changeset_data: JSON.stringify( submittedChanges )
4359
+ } );
4360
+ wp.ajax.post( 'customize_skope_changeset_save', data )
4361
+ .done( function requestChangesetUpdateDone( _data_ ) {
4362
+ deferred.resolve( _data_ );
4363
+ } )
4364
+ .fail( function requestChangesetUpdateFail( _data_ ) {
4365
+ api.consoleLog('SKOPE CHANGESET FAIL FOR SKOPE ' + _data_.skope_id, _data_ );
4366
+ deferred.reject( _data_ );
4367
+ } )
4368
+ .always( function( _data_ ) {
4369
+ if ( _data_.setting_validities ) {
4370
+ api._handleSettingValidities( {
4371
+ settingValidities: _data_.setting_validities
4372
+ } );
4373
+ }
4374
+ } );
4375
+
4376
+ return deferred.promise();
4377
+ };
4378
+
4379
+ })( wp.customize , jQuery, _ );
4380
+ (function (api, $, _) {
4381
+ if ( serverControlParams.isSkopOn ) {
4382
+ var _old_preview = api.Setting.prototype.preview;
4383
+ api.Setting.prototype.preview = function( to, from , o) {
4384
+ if ( _.has( api, 'czr_isPreviewerSkopeAware' ) && 'pending' == api.czr_isPreviewerSkopeAware.state() )
4385
+ this.previewer.refresh();
4386
+ if ( ! _.has(o, 'silent') || false === o.silent ) {
4387
+ return _old_preview.call(this);
4388
+ }
4389
+ };
4390
+ }
4391
+
4392
+ })( wp.customize , jQuery, _ );
4393
+ (function (api, $, _) {
4394
+ if ( 'function' == typeof api.Section ) {
4395
+ var _original_section_initialize = api.Section.prototype.initialize;
4396
+ api.Section.prototype.initialize = function( id, options ) {
4397
+ _original_section_initialize.apply( this, [id, options] );
4398
+ var section = this;
4399
+
4400
+ this.expanded.callbacks.add( function( _expanded ) {
4401
+ if ( ! _expanded )
4402
+ return;
4403
+
4404
+ var container = section.container.closest( '.wp-full-overlay-sidebar-content' ),
4405
+ content = section.container.find( '.accordion-section-content' );
4406
+ _resizeContentHeight = function() {
4407
+ content.css( 'height', container.innerHeight() );
4408
+ };
4409
+ _resizeContentHeight();
4410
+ $( window ).on( 'resize.customizer-section', _.debounce( _resizeContentHeight, 110 ) );
4411
+ });
4412
+ };
4413
+ }
4414
+ })( wp.customize , jQuery, _ );
4415
+ (function (api, $, _) {
4416
+ api.CZR_Helpers = api.CZR_Helpers || {};
4417
+ api.CZR_Helpers = $.extend( api.CZR_Helpers, {
4418
+ getControlSettingId : function( control_id, setting_type ) {
4419
+ setting_type = 'default' || setting_type;
4420
+ if ( ! api.control.has( control_id ) ) {
4421
+ throw new Error( 'The requested control_id is not registered in the api yet : ' + control_id );
4422
+ }
4423
+ if ( ! _.has( api.control( control_id ), 'settings' ) || _.isEmpty( api.control( control_id ).settings ) )
4424
+ return;
4425
+
4426
+ if ( ! _.has( api.control( control_id ).settings, setting_type ) ) {
4427
+ throw new Error( 'The requested control_id does not have the requested setting type : ' + control_id + ' , ' + setting_type );
4428
+ }
4429
+ if ( _.isUndefined( api.control( control_id ).settings[setting_type].id ) ) {
4430
+ throw new Error( 'The requested control_id has no setting id assigned : ' + control_id );
4431
+ }
4432
+ return api.control( control_id ).settings[setting_type].id;
4433
+ },
4434
+
4435
+
4436
+
4437
+ getDocSearchLink : function( text ) {
4438
+ text = ! _.isString(text) ? '' : text;
4439
+ var _searchtext = text.replace( / /g, '+'),
4440
+ _url = [ serverControlParams.docURL, 'search?query=', _searchtext ].join('');
4441
+ return [
4442
+ '<a href="' + _url + '" title="' + serverControlParams.translatedStrings.readDocumentation + '" target="_blank">',
4443
+ ' ',
4444
+ '<span class="fa fa-question-circle-o"></span>'
4445
+ ].join('');
4446
+ },
4447
+ build_setId : function ( setId ) {
4448
+ if ( _.contains( serverControlParams.wpBuiltinSettings, setId ) )
4449
+ return setId;
4450
+ if ( ! _.contains( serverControlParams.themeSettingList, setId ) )
4451
+ return setId;
4452
+
4453
+ return -1 == setId.indexOf( serverControlParams.themeOptions ) ? [ serverControlParams.themeOptions +'[' , setId , ']' ].join('') : setId;
4454
+ },
4455
+ getOptionName : function(name) {
4456
+ var self = this;
4457
+ if ( -1 == name.indexOf(serverControlParams.themeOptions) )
4458
+ return name;
4459
+ return name.replace(/\[|\]/g, '').replace(serverControlParams.themeOptions, '');
4460
+ },
4461
+ has_part_refresh : function( setId ) {
4462
+ if ( ! _.has( api, 'czr_partials') )
4463
+ return;
4464
+ return _.contains( _.map( api.czr_partials(), function( partial, key ) {
4465
+ return _.contains( partial.settings, setId );
4466
+ }), true );
4467
+ },
4468
+ getSectionControlIds : function( section_id ) {
4469
+ section_id = section_id || api.czr_activeSectionId();
4470
+ return ! api.section.has( section_id ) ?
4471
+ [] :
4472
+ _.map( api.section( section_id ).controls(), function( _ctrl ) {
4473
+ return _ctrl.id;
4474
+ });
4475
+ },
4476
+ getSectionSettingIds : function( section_id ) {
4477
+ section_id = section_id || api.czr_activeSectionId();
4478
+ if ( ! api.section.has( section_id) )
4479
+ return;
4480
+ var self = this,
4481
+ _sec_settings = [],
4482
+ _sec_controls = self.getSectionControlIds( section_id );
4483
+
4484
+ _.each( _sec_controls, function( ctrlId ) {
4485
+ _.each( api.control(ctrlId).settings, function( _instance, _k ) {
4486
+ _sec_settings.push( _instance.id );
4487
+ });
4488
+ });
4489
+ return _sec_settings;
4490
+ },
4491
+ capitalize : function( string ) {
4492
+ if( ! _.isString(string) )
4493
+ return string;
4494
+ return string.charAt(0).toUpperCase() + string.slice(1);
4495
+ },
4496
+
4497
+ truncate : function( string, n, useWordBoundary ){
4498
+ if ( _.isUndefined(string) )
4499
+ return '';
4500
+ var isTooLong = string.length > n,
4501
+ s_ = isTooLong ? string.substr(0,n-1) : string;
4502
+ s_ = (useWordBoundary && isTooLong) ? s_.substr(0,s_.lastIndexOf(' ')) : s_;
4503
+ return isTooLong ? s_ + '...' : s_;
4504
+ },
4505
+ isMultiItemModule : function( module_type, moduleInst ) {
4506
+ if ( _.isUndefined( module_type ) && ! _.isObject( moduleInst ) )
4507
+ return;
4508
+ if ( _.isObject( moduleInst ) && _.has( moduleInst, 'module_type' ) )
4509
+ module_type = moduleInst.module_type;
4510
+ else if ( _.isUndefined( module_type ) || _.isNull( module_type ) )
4511
+ return;
4512
+ if ( ! _.has( api.czrModuleMap, module_type ) )
4513
+ return;
4514
+
4515
+ return api.czrModuleMap[module_type].crud || api.czrModuleMap[module_type].multi_item || false;
4516
+ },
4517
+ isCrudModule : function( module_type, moduleInst ) {
4518
+ if ( _.isUndefined( module_type ) && ! _.isObject( moduleInst ) )
4519
+ return;
4520
+ if ( _.isObject( moduleInst ) && _.has( moduleInst, 'module_type' ) )
4521
+ module_type = moduleInst.module_type;
4522
+ else if ( _.isUndefined( module_type ) || _.isNull( module_type ) )
4523
+ return;
4524
+ if ( ! _.has( api.czrModuleMap, module_type ) )
4525
+ return;
4526
+
4527
+ return api.czrModuleMap[module_type].crud || false;
4528
+ }
4529
+
4530
+ });//$.extend
4531
+ })( wp.customize , jQuery, _);
4532
+ (function (api, $, _) {
4533
+ api.CZR_Helpers = api.CZR_Helpers || {};
4534
+ api.CZR_Helpers = $.extend( api.CZR_Helpers, {
4535
+ addActions : function( event_map, new_events, instance ) {
4536
+ var control = this;
4537
+ instance = instance || control;
4538
+ instance[event_map] = instance[event_map] || [];
4539
+ new_event_map = _.clone( instance[event_map] );
4540
+ instance[event_map] = _.union( new_event_map, ! _.isArray(new_events) ? [new_events] : new_events );
4541
+ },
4542
+
4543
+ doActions : function( action, $dom_el, obj ) {
4544
+ $dom_el.trigger( action, obj );
4545
+ },
4546
+ setupDOMListeners : function( event_map , obj, instance ) {
4547
+ var control = this;
4548
+ instance = instance || control;
4549
+ _.map( event_map , function( _event ) {
4550
+ if ( ! _.isString( _event.selector ) || _.isEmpty( _event.selector ) ) {
4551
+ throw new Error( 'setupDOMListeners : selector must be a string not empty. Aborting setup of action(s) : ' + _event.actions.join(',') );
4552
+ }
4553
+ obj.dom_el.on( _event.trigger , _event.selector, function( e, event_params ) {
4554
+ e.stopPropagation();
4555
+ if ( api.utils.isKeydownButNotEnterEvent( e ) ) {
4556
+ return;
4557
+ }
4558
+ e.preventDefault(); // Keep this AFTER the key filter above
4559
+ var _obj = _.clone(obj);
4560
+ if ( _.has(_obj, 'model') && _.has( _obj.model, 'id') ) {
4561
+ if ( _.has(instance, 'get') )
4562
+ _obj.model = instance();
4563
+ else
4564
+ _obj.model = instance.getModel( _obj.model.id );
4565
+ }
4566
+ $.extend( _obj, { event : _event, dom_event : e } );
4567
+ $.extend( _obj, event_params );
4568
+ control.executeEventActionChain( _obj, instance );
4569
+ });//.on()
4570
+
4571
+ });//_.map()
4572
+ },
4573
+ executeEventActionChain : function( obj, instance ) {
4574
+ var control = this;
4575
+ if ( ! _.has( obj, 'event' ) || ! _.has( obj.event, 'actions' ) ) {
4576
+ throw new Error('executeEventActionChain : No obj.event or no obj.event.actions properties found');
4577
+ }
4578
+ if ( 'function' === typeof(obj.event.actions) )
4579
+ return obj.event.actions(obj);
4580
+ if ( ! _.isArray(obj.event.actions) )
4581
+ obj.event.actions = [ obj.event.actions ];
4582
+ var _break = false;
4583
+ _.map( obj.event.actions, function( _cb ) {
4584
+
4585
+ if ( _break )
4586
+ return;
4587
+
4588
+ if ( 'function' != typeof( instance[_cb] ) ) {
4589
+ throw new Error( 'executeEventActionChain : the action : ' + _cb + ' has not been found when firing event : ' + obj.event.selector );
4590
+ }
4591
+ var $_dom_el = ( _.has(obj, 'dom_el') && -1 != obj.dom_el.length ) ? obj.dom_el : control.container;
4592
+
4593
+ $_dom_el.trigger('before_' + _cb, _.omit( obj, 'event') );
4594
+ var _cb_return = instance[_cb](obj);
4595
+ if ( false === _cb_return )
4596
+ _break = true;
4597
+ $_dom_el.trigger('after_' + _cb, _.omit( obj, 'event') );
4598
+
4599
+ });//_.map
4600
+ }
4601
+ });//$.extend
4602
+ })( wp.customize , jQuery, _);
4603
+ (function (api, $, _) {
4604
+ api.bind('ready', function() {
4605
+ api.previewer.bind('houston-widget-settings', function(data) {
4606
+ var _candidates = _.filter( data.registeredSidebars, function( sb ) {
4607
+ return ! _.findWhere( _wpCustomizeWidgetsSettings.registeredSidebars, { id: sb.id } );
4608
+ });
4609
+
4610
+ var _inactives = _.filter( data.registeredSidebars, function( sb ) {
4611
+ return ! _.has( data.renderedSidebars, sb.id );
4612
+ });
4613
+
4614
+ _inactives = _.map( _inactives, function(obj) {
4615
+ return obj.id;
4616
+ });
4617
+
4618
+ var _registered = _.map( data.registeredSidebars, function(obj) {
4619
+ return obj.id;
4620
+ });
4621
+ api.czr_widgetZoneSettings.set( {
4622
+ actives : data.renderedSidebars,
4623
+ inactives : _inactives,
4624
+ registered : _registered,
4625
+ candidates : _candidates,
4626
+ available_locations : data.availableWidgetLocations//built server side
4627
+ } );
4628
+
4629
+ });
4630
+
4631
+ api.previewer.bind( 'czr-wp-conditional-ready', function(data ) {
4632
+ api.czr_wp_conditionals.set( data );
4633
+ });
4634
+
4635
+ api.previewer.bind( 'czr-partial-refresh', function(data) {
4636
+ api.czr_partials.set(data);
4637
+ });
4638
+ });//api.bind('ready')
4639
+ })( wp.customize , jQuery, _ );var CZRInputMths = CZRInputMths || {};
4640
+ $.extend( CZRInputMths , {
4641
+ initialize: function( name, options ) {
4642
+ if ( _.isUndefined(options.item ) || _.isEmpty(options.item) ) {
4643
+ throw new Error('No item assigned to input ' + options.id + '. Aborting');
4644
+ }
4645
+ if ( _.isUndefined(options.module ) ) {
4646
+ throw new Error('No module assigned to input ' + options.id + '. Aborting');
4647
+ }
4648
+
4649
+ api.Value.prototype.initialize.call( this, null, options );
4650
+
4651
+ var input = this;
4652
+ $.extend( input, options || {} );
4653
+ input.isReady = $.Deferred();
4654
+ if ( ! _.isUndefined(options.input_value) )
4655
+ input.set(options.input_value);
4656
+ input.type_map = {
4657
+ text : '',
4658
+ textarea : '',
4659
+ check : 'setupIcheck',
4660
+ select : 'setupSelect',
4661
+ upload : 'setupImageUploader',
4662
+ color : 'setupColorPicker',
4663
+ content_picker : 'setupContentPicker',
4664
+ text_editor : 'setupTextEditor',
4665
+ password : ''
4666
+ };
4667
+
4668
+ if ( _.has( input.type_map, input.type ) ) {
4669
+ var _meth = input.type_map[input.type];
4670
+ if ( _.isFunction(input[_meth]) )
4671
+ input[_meth]();
4672
+ }
4673
+
4674
+ var trigger_map = {
4675
+ text : 'keyup',
4676
+ textarea : 'keyup',
4677
+ password : 'keyup',
4678
+ color : 'colorpickerchange',
4679
+ range : 'input propertychange'
4680
+ };
4681
+ input.input_event_map = [
4682
+ {
4683
+ trigger : $.trim( ['change', trigger_map[input.type] || '' ].join(' ') ),//was 'propertychange change click keyup input',//colorpickerchange is a custom colorpicker event @see method setupColorPicker => otherwise we don't
4684
+ selector : 'input[data-type], select[data-type], textarea[data-type]',
4685
+ name : 'set_input_value',
4686
+ actions : function( obj ) {
4687
+ if ( ! _.has( input.item, 'syncElements') || ! _.has( input.item.syncElements, input.id ) ) {
4688
+ throw new Error('WARNING : THE INPUT ' + input.id + ' HAS NO SYNCED ELEMENT.');
4689
+ }
4690
+ }//was 'updateInput'
4691
+ }
4692
+ ];
4693
+ },
4694
+ ready : function() {
4695
+ var input = this;
4696
+ input.setupDOMListeners( input.input_event_map , { dom_el : input.container }, input );
4697
+ input.callbacks.add( function() { return input.inputReact.apply(input, arguments ); } );
4698
+ $.when( input.setupSynchronizer() ).done( function() {
4699
+ input.isReady.resolve( input );
4700
+ } );
4701
+
4702
+ },
4703
+ setupSynchronizer: function() {
4704
+ var input = this,
4705
+ item = input.item,
4706
+ $_input_el = input.container.find('[data-type]'),
4707
+ is_textarea = input.container.find('[data-type]').is('textarea');
4708
+ if ( is_textarea ) {
4709
+ throw new Error('TO DO : THE TEXTAREA INPUT ARE NOT READY IN THE SYNCHRONIZER!');
4710
+ }
4711
+
4712
+ var syncElement = new api.Element( $_input_el );
4713
+ item.syncElements = item.syncElements || {};
4714
+ item.syncElements[input.id] = syncElement;//adds the input syncElement to the collection
4715
+ syncElement.sync( input );//sync with the input instance
4716
+ syncElement.set( input() );
4717
+ },
4718
+ inputReact : function( to, from) {
4719
+ var input = this,
4720
+ _current_item = input.item(),
4721
+ _new_model = _.clone( _current_item );//initialize it to the current value
4722
+ _new_model = ( ! _.isObject(_new_model) || _.isEmpty(_new_model) ) ? {} : _new_model;
4723
+ _new_model[input.id] = to;
4724
+ input.item.set(_new_model);
4725
+
4726
+ if ( ! _.has( input, 'is_preItemInput' ) ) {
4727
+ input.item.trigger( input.id + ':changed', to );
4728
+ }
4729
+ }
4730
+ });//$.extend
4731
+ var CZRInputMths = CZRInputMths || {};
4732
+ $.extend( CZRInputMths , {
4733
+ setupImageUploader : function() {
4734
+ var input = this,
4735
+ _model = input();
4736
+ input.attachment = {};
4737
+ if ( ! input.container )
4738
+ return this;
4739
+
4740
+ this.contentRendered = $.Deferred();
4741
+ this.setupContentRendering( _model, {} );
4742
+ this.contentRendered.done( function(){
4743
+ input.czrImgUploaderBinding();
4744
+ });
4745
+ },
4746
+
4747
+ setupContentRendering : function( to, from) {
4748
+ var input = this;
4749
+ if ( ( input.attachment.id != to ) && from !== to ) {
4750
+ if ( ! to ) {
4751
+ input.attachment = {};
4752
+ input.renderImageUploaderTemplate();
4753
+ }
4754
+ wp.media.attachment( to ).fetch().done( function() {
4755
+ input.attachment = this.attributes;
4756
+ input.renderImageUploaderTemplate();
4757
+ });
4758
+ }//Standard reaction, the image has been updated by the user or init
4759
+ else if ( ! input.attachment.id || input.attachment.id === to ) {
4760
+ input.renderImageUploaderTemplate();
4761
+ }
4762
+ },
4763
+
4764
+ czrImgUploaderBinding : function() {
4765
+ var input = this;
4766
+ _.bindAll( input, 'czrImgUploadRemoveFile', 'czrImgUploadOpenFrame', 'czrImgUploadSelect');
4767
+ input.container.on( 'click keydown', '.upload-button', input.czrImgUploadOpenFrame );
4768
+ input.container.on( 'click keydown', '.thumbnail-image img', input.czrImgUploadOpenFrame );
4769
+ input.container.on( 'click keydown', '.remove-button', input.czrImgUploadRemoveFile );
4770
+
4771
+ input.bind( input.id + ':changed', function( to, from ){
4772
+ input.contentRendered = $.Deferred();
4773
+ input.setupContentRendering(to,from);
4774
+ });
4775
+ },
4776
+ czrImgUploadOpenFrame: function( event ) {
4777
+ if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
4778
+ return;
4779
+ }
4780
+
4781
+ event.preventDefault();
4782
+
4783
+ if ( ! this.frame ) {
4784
+ this.czrImgUploadInitFrame();
4785
+ }
4786
+
4787
+ this.frame.open();
4788
+ },
4789
+ czrImgUploadInitFrame: function() {
4790
+ var input = this;
4791
+
4792
+ var button_labels = this.getUploaderLabels();
4793
+
4794
+ input.frame = wp.media({
4795
+ button: {
4796
+ text: button_labels.frame_button
4797
+ },
4798
+ states: [
4799
+ new wp.media.controller.Library({
4800
+ title: button_labels.frame_title,
4801
+ library: wp.media.query({ type: 'image' }),
4802
+ multiple: false,
4803
+ date: false
4804
+ })
4805
+ ]
4806
+ });
4807
+ input.frame.on( 'select', input.czrImgUploadSelect );
4808
+ },
4809
+ czrImgUploadRemoveFile: function( event ) {
4810
+ var input = this;
4811
+
4812
+ if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
4813
+ return;
4814
+ }
4815
+ event.preventDefault();
4816
+ input.attachment = {};
4817
+ input.set('');
4818
+ },
4819
+ czrImgUploadSelect: function() {
4820
+ var node,
4821
+ input = this,
4822
+ attachment = input.frame.state().get( 'selection' ).first().toJSON(), // Get the attachment from the modal frame.
4823
+ mejsSettings = window._wpmejsSettings || {};
4824
+ input.attachment = attachment;
4825
+ input.set(attachment.id);
4826
+ },
4827
+ renderImageUploaderTemplate: function() {
4828
+ var input = this;
4829
+ if ( 0 === $( '#tmpl-czr-input-img-uploader-view-content' ).length )
4830
+ return;
4831
+
4832
+ var view_template = wp.template('czr-input-img-uploader-view-content');
4833
+ if ( ! view_template || ! input.container )
4834
+ return;
4835
+
4836
+ var $_view_el = input.container.find('.' + input.module.control.css_attr.img_upload_container );
4837
+
4838
+ if ( ! $_view_el.length )
4839
+ return;
4840
+
4841
+ var _template_params = {
4842
+ button_labels : input.getUploaderLabels(),
4843
+ settings : input.id,
4844
+ attachment : input.attachment,
4845
+ canUpload : true
4846
+ };
4847
+
4848
+ $_view_el.html( view_template( _template_params) );
4849
+
4850
+ input.contentRendered.resolve();
4851
+ input.container.trigger( input.id + ':content_rendered' );
4852
+
4853
+ return true;
4854
+ },
4855
+
4856
+ getUploaderLabels : function() {
4857
+ var _ts = serverControlParams.translatedStrings,
4858
+ _map = {
4859
+ 'select' : _ts.select_image,
4860
+ 'change' : _ts.change_image,
4861
+ 'remove' : _ts.remove_image,
4862
+ 'default' : _ts.default_image,
4863
+ 'placeholder' : _ts.placeholder_image,
4864
+ 'frame_title' : _ts.frame_title_image,
4865
+ 'frame_button': _ts.frame_button_image
4866
+ };
4867
+ _.each( _map, function( ts_string, key ) {
4868
+ if ( _.isUndefined( ts_string ) ) {
4869
+ var input = this;
4870
+ throw new Error( 'A translated string is missing ( ' + key + ' ) for the image uploader input in module : ' + input.module.id );
4871
+ }
4872
+ } );
4873
+
4874
+ return _map;
4875
+ }
4876
+ });//$.extendvar CZRInputMths = CZRInputMths || {};
4877
+ $.extend( CZRInputMths , {
4878
+ setupColorPicker : function() {
4879
+ var input = this;
4880
+
4881
+ input.container.find('input').wpColorPicker( {
4882
+ change : function( e, o ) {
4883
+ $(this).val( $(this).wpColorPicker('color') ).trigger('colorpickerchange').trigger('change');
4884
+ }
4885
+ });
4886
+ }
4887
+ });//$.extendvar CZRInputMths = CZRInputMths || {};
4888
+ $.extend( CZRInputMths , {
4889
+ setupSelect : function() {
4890
+ var input = this;
4891
+ $('select', input.container ).not('.no-selecter-js')
4892
+ .each( function() {
4893
+ $(this).selecter({
4894
+ });
4895
+ });
4896
+ }
4897
+ });//$.extend/* Fix caching, select2 default one seems to not correctly work, or it doesn't what I think it should */
4898
+ var CZRInputMths = CZRInputMths || {};
4899
+ $.extend( CZRInputMths , {
4900
+ setupContentPicker: function() {
4901
+ var input = this,
4902
+ _event_map = [];
4903
+ input.object = ['post']; //this.control.params.object_types - array('page', 'post')
4904
+ input.type = 'post_type'; //this.control.params.type - post_type
4905
+ input.container.find('.czr-input').append('<select data-select-type="content-picker-select" class="js-example-basic-simple"></select>');
4906
+ _event_map = [
4907
+ {
4908
+ trigger : 'change',
4909
+ selector : 'select[data-select-type]',
4910
+ name : 'set_input_value',
4911
+ actions : 'updateContentPickerModel'
4912
+ }
4913
+ ];
4914
+
4915
+ input.setupDOMListeners( _event_map , { dom_el : input.container }, input );
4916
+ input.setupContentSelecter();
4917
+ },
4918
+
4919
+ setupContentSelecter : function() {
4920
+ var input = this;
4921
+
4922
+ input.container.find('select').select2({
4923
+ placeholder: {
4924
+ id: '-1', // the value of the option
4925
+ title: 'Select'
4926
+ },
4927
+ data : input.setupSelectedContents(),
4928
+ ajax: {
4929
+ url: serverControlParams.AjaxUrl,
4930
+ type: 'POST',
4931
+ dataType: 'json',
4932
+ delay: 250,
4933
+ debug: true,
4934
+ data: function ( params ) {
4935
+ var page = params.page ? params.page - 1 : 0;
4936
+ page = params.term ? params.page : page;
4937
+ return {
4938
+ action: params.term ? "search-available-content-items-customizer" : "load-available-content-items-customizer",
4939
+ search: params.term,
4940
+ wp_customize: 'on',
4941
+ page: page,
4942
+ type: input.type,
4943
+ object: input.object,
4944
+ CZRCpNonce: serverControlParams.CZRCpNonce
4945
+ };
4946
+ },
4947
+ processResults: function (data, params) {
4948
+ if ( ! data.success )
4949
+ return { results: [] };
4950
+
4951
+ var items = data.data.items,
4952
+ _results = [];
4953
+
4954
+ _.each( items, function( item ) {
4955
+ _results.push({
4956
+ id : item.id,
4957
+ title : item.title,
4958
+ type_label : item.type_label,
4959
+ object_type : item.object
4960
+ });
4961
+ });
4962
+ return {
4963
+ results: _results,
4964
+ pagination: { more: data.data.items.length == 10 }
4965
+ };
4966
+ },
4967
+ },
4968
+ templateSelection: input.czrFormatContentSelected,
4969
+ templateResult: input.czrFormatContentSelected,
4970
+ escapeMarkup: function (markup) { return markup; },
4971
+ });
4972
+ },
4973
+
4974
+
4975
+ czrFormatContentSelected: function (item) {
4976
+ if ( item.loading ) return item.text;
4977
+ var markup = "<div class='content-picker-item clearfix'>" +
4978
+ "<div class='content-item-bar'>" +
4979
+ "<span class='item-title'>" + item.title + "</span>";
4980
+
4981
+ if ( item.type_label ) {
4982
+ markup += "<span class='item-type'>" + item.type_label + "</span>";
4983
+ }
4984
+
4985
+ markup += "</div></div>";
4986
+
4987
+ return markup;
4988
+ },
4989
+
4990
+ setupSelectedContents : function() {
4991
+ var input = this,
4992
+ _model = input();
4993
+
4994
+ return _model;
4995
+ },
4996
+
4997
+ updateContentPickerModel: function( obj ){
4998
+ var input = this,
4999
+ $_changed_input = $(obj.dom_event.currentTarget, obj.dom_el ),
5000
+ _new_val = $( $_changed_input, obj.dom_el ).select2('data');
5001
+ if ( _new_val.length ) {
5002
+ _new_val = _.map( _new_val, function( _item ){
5003
+ return {
5004
+ 'id' : _item.id,
5005
+ 'type_label' : _item.type_label,
5006
+ 'title' : _item.title,
5007
+ 'object_type' : _item.object_type
5008
+ };
5009
+ });
5010
+ }
5011
+
5012
+ input.set(_new_val);
5013
+ return;
5014
+ }
5015
+ });//$.extend
5016
+ var CZRInputMths = CZRInputMths || {};
5017
+ $.extend( CZRInputMths , {
5018
+ setupTextEditor : function() {
5019
+ var input = this,
5020
+ _model = input();
5021
+ if ( ! input.container ) {
5022
+ throw new Error( 'The input container is not set for WP text editor in module.' + input.module.id );
5023
+ }
5024
+
5025
+ if ( ! input.czrRenderInputTextEditorTemplate() )
5026
+ return;
5027
+
5028
+ input.editor = tinyMCE( 'czr-customize-content_editor' );
5029
+ input.textarea = $( '#czr-customize-content_editor' );
5030
+ input.editorPane = $( '#czr-customize-content_editor-pane' );
5031
+ input.dragbar = $( '#czr-customize-content_editor-dragbar' );
5032
+ input.editorFrame = $( '#czr-customize-content_editor_ifr' );
5033
+ input.mceTools = $( '#wp-czr-customize-content_editor-tools' );
5034
+ input.mceToolbar = input.editorPane.find( '.mce-toolbar-grp' );
5035
+ input.mceStatusbar = input.editorPane.find( '.mce-statusbar' );
5036
+
5037
+ input.preview = $( '#customize-preview' );
5038
+ input.collapse = $( '.collapse-sidebar' );
5039
+
5040
+ input.textpreview = input.container.find('textarea');
5041
+ input.toggleButton = input.container.find('button.text_editor-button');
5042
+ input.editorExpanded = new api.Value( false );
5043
+ input.czrUpdateTextPreview();
5044
+ input.czrSetToggleButtonText( input.editorExpanded() );
5045
+
5046
+ input.czrTextEditorBinding();
5047
+
5048
+ input.czrResizeEditorOnUserRequest();
5049
+ },
5050
+
5051
+ czrTextEditorBinding : function() {
5052
+ var input = this,
5053
+ editor = input.editor,
5054
+ textarea = input.textarea,
5055
+ toggleButton = input.toggleButton,
5056
+ editorExpanded = input.editorExpanded,
5057
+ editorPane = input.editorPane;
5058
+
5059
+
5060
+ input.bind( input.id + ':changed', input.czrUpdateTextPreview );
5061
+
5062
+ _.bindAll( input, 'czrOnVisualEditorChange', 'czrOnTextEditorChange', 'czrResizeEditorOnWindowResize' );
5063
+
5064
+ toggleButton.on( 'click', function() {
5065
+ input.editorExpanded.set( ! input.editorExpanded() );
5066
+ if ( input.editorExpanded() ) {
5067
+ editor.focus();
5068
+ }
5069
+ });
5070
+ input.module.czr_ModuleState.bind(
5071
+ function( state ) {
5072
+ if ( 'expanded' != state )
5073
+ input.editorExpanded.set( false );
5074
+ });
5075
+
5076
+ input.editorExpanded.bind( function (expanded) {
5077
+
5078
+ api.consoleLog('in input.editorExpanded', expanded, input() );
5079
+ if ( editor.locker && editor.locker !== input ) {
5080
+ editor.locker.editorExpanded.set(false);
5081
+ editor.locker = null;
5082
+ }if ( ! editor.locker || editor.locker === input ) {
5083
+ $(document.body).toggleClass('czr-customize-content_editor-pane-open', expanded);
5084
+ editor.locker = input;
5085
+ }
5086
+ input.czrSetToggleButtonText( expanded );
5087
+
5088
+ if ( expanded ) {
5089
+ editor.setContent( wp.editor.autop( input() ) );
5090
+ editor.on( 'input change keyup', input.czrOnVisualEditorChange );
5091
+ textarea.on( 'input', input.czrOnTextEditorChange );
5092
+ input.czrResizeEditor( window.innerHeight - editorPane.height() );
5093
+ $( window ).on('resize', input.czrResizeEditorOnWindowResize );
5094
+
5095
+ } else {
5096
+ editor.off( 'input change keyup', input.czrOnVisualEditorChange );
5097
+ textarea.off( 'input', input.czrOnTextEditorChange );
5098
+ $( window ).off('resize', input.czrResizeEditorOnWindowResize );
5099
+ input.czrResizeReset();
5100
+ }
5101
+ } );
5102
+ },
5103
+
5104
+ czrOnVisualEditorChange : function() {
5105
+ var input = this,
5106
+ editor = input.editor,
5107
+ value;
5108
+
5109
+ value = wp.editor.removep( editor.getContent() );
5110
+ input.set(value);
5111
+ },
5112
+
5113
+ czrOnTextEditorChange : function() {
5114
+ var input = this,
5115
+ textarea = input.textarea,
5116
+ value;
5117
+
5118
+ value = textarea.val();
5119
+ input.set(value);
5120
+ },
5121
+ czrUpdateTextPreview: function() {
5122
+ var input = this,
5123
+ input_model = input(),
5124
+ value;
5125
+ value = input_model.replace(/(<([^>]+)>)/ig,"");
5126
+ if ( value.length > 30 )
5127
+ value = value.substring(0, 34) + '...';
5128
+
5129
+ input.textpreview.val( value );
5130
+ },
5131
+ czrRenderInputTextEditorTemplate: function() {
5132
+ var input = this;
5133
+ if ( 0 === $( '#tmpl-czr-input-text_editor-view-content' ).length ) {
5134
+ throw new Error('Missing js template for text editor input in module : ' + input.module.id );
5135
+ }
5136
+
5137
+ var view_template = wp.template('czr-input-text_editor-view-content'),
5138
+ $_view_el = input.container.find('input');
5139
+ if ( ! view_template || ! input.container )
5140
+ return;
5141
+
5142
+ api.consoleLog('Model injected in text editor tmpl : ', input() );
5143
+
5144
+ $_view_el.after( view_template( input() ) );
5145
+
5146
+ return true;
5147
+ },
5148
+ czrIsEditorExpanded : function() {
5149
+ return $( document.body ).hasClass('czr-customize-content_editor-pane-open');
5150
+ },
5151
+ czrResizeReset : function() {
5152
+ var input = this,
5153
+ preview = input.preview,
5154
+ collapse = input.collapse,
5155
+ sectionContent = input.container.closest('ul.accordion-section-content');
5156
+
5157
+ sectionContent.css( 'padding-bottom', '' );
5158
+ preview.css( 'bottom', '' );
5159
+ collapse.css( 'bottom', '' );
5160
+ },
5161
+ czrResizeEditor : function( position ) {
5162
+ var windowHeight = window.innerHeight,
5163
+ windowWidth = window.innerWidth,
5164
+ minScroll = 40,
5165
+ maxScroll = 1,
5166
+ mobileWidth = 782,
5167
+ collapseMinSpacing = 56,
5168
+ collapseBottomOutsideEditor = 8,
5169
+ collapseBottomInsideEditor = 4,
5170
+ args = {},
5171
+ input = this,
5172
+ sectionContent = input.container.closest('ul.accordion-section-content'),
5173
+ mceTools = input.mceTools,
5174
+ mceToolbar = input.mceToolbar,
5175
+ mceStatusbar = input.mceStatusbar,
5176
+ preview = input.preview,
5177
+ collapse = input.collapse,
5178
+ editorPane = input.editorPane,
5179
+ editorFrame = input.editorFrame;
5180
+
5181
+ if ( ! input.editorExpanded() ) {
5182
+ return;
5183
+ }
5184
+
5185
+ if ( ! _.isNaN( position ) ) {
5186
+ resizeHeight = windowHeight - position;
5187
+ }
5188
+
5189
+ args.height = resizeHeight;
5190
+ args.components = mceTools.outerHeight() + mceToolbar.outerHeight() + mceStatusbar.outerHeight();
5191
+
5192
+ if ( resizeHeight < minScroll ) {
5193
+ args.height = minScroll;
5194
+ }
5195
+
5196
+ if ( resizeHeight > windowHeight - maxScroll ) {
5197
+ args.height = windowHeight - maxScroll;
5198
+ }
5199
+
5200
+ if ( windowHeight < editorPane.outerHeight() ) {
5201
+ args.height = windowHeight;
5202
+ }
5203
+
5204
+ preview.css( 'bottom', args.height );
5205
+ editorPane.css( 'height', args.height );
5206
+ editorFrame.css( 'height', args.height - args.components );
5207
+ collapse.css( 'bottom', args.height + collapseBottomOutsideEditor );
5208
+
5209
+ if ( collapseMinSpacing > windowHeight - args.height ) {
5210
+ collapse.css( 'bottom', mceStatusbar.outerHeight() + collapseBottomInsideEditor );
5211
+ }
5212
+
5213
+ if ( windowWidth <= mobileWidth ) {
5214
+ sectionContent.css( 'padding-bottom', args.height );
5215
+ } else {
5216
+ sectionContent.css( 'padding-bottom', '' );
5217
+ }
5218
+ },
5219
+ czrResizeEditorOnWindowResize : function() {
5220
+ var input = this,
5221
+ resizeDelay = 50,
5222
+ editorPane = input.editorPane;
5223
+
5224
+ if ( ! input.editorExpanded() ) {
5225
+ return;
5226
+ }
5227
+
5228
+ _.delay( function() {
5229
+ input.czrResizeEditor( window.innerHeight - editorPane.height() );
5230
+ }, resizeDelay );
5231
+
5232
+ },
5233
+ czrResizeEditorOnUserRequest : function() {
5234
+ var input = this,
5235
+ dragbar = input.dragbar,
5236
+ editorFrame = input.editorFrame;
5237
+
5238
+ dragbar.on( 'mousedown', function() {
5239
+ if ( ! input.editorExpanded() )
5240
+ return;
5241
+
5242
+ $( document ).on( 'mousemove.czr-customize-content_editor', function( event ) {
5243
+ event.preventDefault();
5244
+ $( document.body ).addClass( 'czr-customize-content_editor-pane-resize' );
5245
+ editorFrame.css( 'pointer-events', 'none' );
5246
+ input.czrResizeEditor( event.pageY );
5247
+ } );
5248
+ } );
5249
+
5250
+ dragbar.on( 'mouseup', function() {
5251
+ if ( ! input.editorExpanded() )
5252
+ return;
5253
+
5254
+ $( document ).off( 'mousemove.czr-customize-content_editor' );
5255
+ $( document.body ).removeClass( 'czr-customize-content_editor-pane-resize' );
5256
+ editorFrame.css( 'pointer-events', '' );
5257
+ } );
5258
+
5259
+ },
5260
+ czrSetToggleButtonText : function( $_expanded ) {
5261
+ var input = this;
5262
+
5263
+ input.toggleButton.text( serverControlParams.translatedStrings[ ! $_expanded ? 'textEditorOpen' : 'textEditorClose' ] );
5264
+ }
5265
+ });//$.extend//extends api.Value
5266
+ var CZRItemMths = CZRItemMths || {};
5267
+ $.extend( CZRItemMths , {
5268
+ initialize: function( id, options ) {
5269
+ if ( _.isUndefined(options.module) || _.isEmpty(options.module) ) {
5270
+ throw new Error('No module assigned to item ' + id + '. Aborting');
5271
+ }
5272
+
5273
+ var item = this;
5274
+ api.Value.prototype.initialize.call( item, null, options );
5275
+ item.isReady = $.Deferred();
5276
+ item.embedded = $.Deferred();
5277
+ item.contentRendered = $.Deferred();
5278
+ $.extend( item, options || {} );
5279
+ item.defaultItemModel = _.clone( options.defaultItemModel ) || { id : '', title : '' };
5280
+ var _initial_model = $.extend( item.defaultItemModel, options.initial_item_model );
5281
+ item.set( _initial_model );
5282
+ item.userEventMap = new api.Value( [
5283
+ {
5284
+ trigger : 'click keydown',
5285
+ selector : [ '.' + item.module.control.css_attr.display_alert_btn, '.' + item.module.control.css_attr.cancel_alert_btn ].join(','),
5286
+ name : 'toggle_remove_alert',
5287
+ actions : ['toggleRemoveAlertVisibility']
5288
+ },
5289
+ {
5290
+ trigger : 'click keydown',
5291
+ selector : '.' + item.module.control.css_attr.remove_view_btn,
5292
+ name : 'remove_item',
5293
+ actions : ['removeItem']
5294
+ },
5295
+ {
5296
+ trigger : 'click keydown',
5297
+ selector : [ '.' + item.module.control.css_attr.edit_view_btn, '.' + item.module.control.css_attr.item_title ].join(','),
5298
+ name : 'edit_view',
5299
+ actions : ['setViewVisibility']
5300
+ }
5301
+ ]);
5302
+ item.isReady.done( function() {
5303
+ item.module.updateItemsCollection( { item : item() } );
5304
+ item.callbacks.add( function() { return item.itemReact.apply(item, arguments ); } );
5305
+ item.mayBeRenderItemWrapper();
5306
+ item.embedded.done( function() {
5307
+ item.itemWrapperViewSetup( _initial_model );
5308
+ });
5309
+ item.contentRendered.done( function() {
5310
+ if ( ! _.has(item, 'czr_Input') )
5311
+ item.setupInputCollectionFromDOM();
5312
+ });
5313
+
5314
+ });//item.isReady.done()
5315
+
5316
+ },//initialize
5317
+ ready : function() {
5318
+ this.isReady.resolve();
5319
+ },
5320
+ itemReact : function( to, from ) {
5321
+ var item = this,
5322
+ module = item.module;
5323
+ module.updateItemsCollection( {item : to });
5324
+ item.writeItemViewTitle(to);
5325
+ if ( ! _.isEmpty(from) || ! _.isUndefined(from) ) {
5326
+ api.consoleLog('DO WE REALLY NEED TO SEND THIS TO THE PREVIEW WITH _sendItem(to, from) ?');
5327
+ item._sendItem(to, from);
5328
+ }
5329
+ },
5330
+
5331
+
5332
+ });//$.extend//extends api.Value
5333
+ var CZRItemMths = CZRItemMths || {};
5334
+ $.extend( CZRItemMths , {
5335
+ setupInputCollectionFromDOM : function() {
5336
+ var item = this,
5337
+ module = item.module;
5338
+ item.czr_Input = new api.Values();
5339
+ item.inputConstructor = module.inputConstructor;
5340
+
5341
+ if ( _.isEmpty(item.defaultItemModel) || _.isUndefined(item.defaultItemModel) ) {
5342
+ throw new Error('No default model found in item ' + item.id + '. Aborting');
5343
+ }
5344
+ var item_model = $.extend( true, {}, item() );
5345
+
5346
+ if ( ! _.isObject( item_model ) )
5347
+ item_model = item.defaultItemModel;
5348
+ else
5349
+ item_model = $.extend( item.defaultItemModel, item_model );
5350
+
5351
+ var dom_item_model = {};
5352
+ $( '.' + module.control.css_attr.sub_set_wrapper, item.container).each( function( _index ) {
5353
+ var _id = $(this).find('[data-type]').attr('data-type'),
5354
+ _value = _.has( item_model, _id) ? item_model[_id] : '';
5355
+ if ( _.isUndefined( _id ) || _.isEmpty( _id ) )
5356
+ return;
5357
+ if ( ! _.has( item_model, _id ) ) {
5358
+ throw new Error('The item property : ' + _id + ' has been found in the DOM but not in the item model : '+ item.id + '. The input can not be instantiated.');
5359
+ }
5360
+ item.czr_Input.add( _id, new item.inputConstructor( _id, {
5361
+ id : _id,
5362
+ type : $(this).attr('data-input-type'),
5363
+ input_value : _value,
5364
+ container : $(this),
5365
+ item : item,
5366
+ module : module
5367
+ } ) );
5368
+ item.czr_Input(_id).ready();
5369
+ dom_item_model[_id] = _value;
5370
+
5371
+ });//each
5372
+ },
5373
+
5374
+
5375
+ removeInputCollection : function() {
5376
+ var item = this;
5377
+ item.czr_Input.each( function( input ) {
5378
+ item.czr_Input.remove( input.id );
5379
+ });
5380
+ }
5381
+
5382
+
5383
+ });//$.extend//extends api.CZRBaseControl
5384
+ var CZRItemMths = CZRItemMths || {};
5385
+
5386
+ $.extend( CZRItemMths , {
5387
+ _sendItem : function( to, from ) {
5388
+ var item = this,
5389
+ module = item.module,
5390
+ _changed_props = [];
5391
+ _.each( from, function( _val, _key ) {
5392
+ if ( _val != to[_key] )
5393
+ _changed_props.push(_key);
5394
+ });
5395
+
5396
+ _.each( _changed_props, function( _prop ) {
5397
+ module.control.previewer.send( 'sub_setting', {
5398
+ set_id : module.control.id,
5399
+ id : to.id,
5400
+ changed_prop : _prop,
5401
+ value : to[_prop]
5402
+ });
5403
+ module.trigger('item_sent', { item : to , dom_el: item.container, changed_prop : _prop } );
5404
+ });
5405
+ },
5406
+ removeItem : function() {
5407
+ var item = this,
5408
+ module = this.module,
5409
+ _new_collection = _.clone( module.itemCollection() );
5410
+ module.trigger('pre_item_dom_remove', item() );
5411
+ item._destroyView();
5412
+ _new_collection = _.without( _new_collection, _.findWhere( _new_collection, {id: item.id }) );
5413
+ module.itemCollection.set( _new_collection );
5414
+ module.trigger('pre_item_api_remove', item() );
5415
+ module.czr_Item.remove(item.id);
5416
+ },
5417
+ getModel : function(id) {
5418
+ return this();
5419
+ }
5420
+
5421
+ });//$.extend
5422
+ var CZRItemMths = CZRItemMths || {};
5423
+
5424
+ $.extend( CZRItemMths , {
5425
+ mayBeRenderItemWrapper : function() {
5426
+ var item = this;
5427
+
5428
+ if ( 'pending' != item.embedded.state() )
5429
+ return;
5430
+
5431
+ $.when( item.renderItemWrapper() ).done( function( $_container ) {
5432
+ item.container = $_container;
5433
+ if ( _.isUndefined(item.container) || ! item.container.length ) {
5434
+ throw new Error( 'In mayBeRenderItemWrapper the Item view has not been rendered : ' + item.id );
5435
+ } else {
5436
+ item.embedded.resolve();
5437
+ }
5438
+ });
5439
+ },
5440
+ itemWrapperViewSetup : function( item_model ) {
5441
+ var item = this,
5442
+ module = this.module;
5443
+
5444
+ item_model = item() || item.initial_item_model;//could not be set yet
5445
+ item.czr_ItemState = new api.Value();
5446
+ item.czr_ItemState.set('closed');
5447
+ item.writeItemViewTitle();
5448
+ var _updateItemContentDeferred = function( $_content, to, from ) {
5449
+ if ( ! _.isUndefined( $_content ) && false !== $_content.length ) {
5450
+ item.contentRendered.resolve();
5451
+ item.toggleItemExpansion(to, from );
5452
+ }
5453
+ else {
5454
+ throw new Error( 'Module : ' + item.module.id + ', the item content has not been rendered for ' + item.id );
5455
+ }
5456
+ };
5457
+
5458
+ if ( item.module.isMultiItem() ) {
5459
+ item.czr_ItemState.callbacks.add( function( to, from ) {
5460
+ if ( 'resolved' == item.contentRendered.state() ) {
5461
+ item.toggleItemExpansion(to, from );
5462
+ return;
5463
+ }
5464
+
5465
+ $.when( item.renderItemContent( item_model ) ).done( function( $_item_content ) {
5466
+ _updateItemContentDeferred = _.debounce(_updateItemContentDeferred, 400 );
5467
+ _updateItemContentDeferred( $_item_content, to, from );
5468
+ });
5469
+ });
5470
+ } else {
5471
+ item.czr_ItemState.callbacks.add( function( to, from ) {
5472
+ item.toggleItemExpansion.apply(item, arguments );
5473
+ });
5474
+ $.when( item.renderItemContent( item_model ) ).done( function( $_item_content ) {
5475
+ _updateItemContentDeferred( $_item_content, true );
5476
+ });
5477
+ }
5478
+ api.CZR_Helpers.setupDOMListeners(
5479
+ item.userEventMap(),//actions to execute
5480
+ { model:item_model, dom_el:item.container },//model + dom scope
5481
+ item //instance where to look for the cb methods
5482
+ );
5483
+ },
5484
+ renderItemWrapper : function( item_model ) {
5485
+ var item = this,
5486
+ module = item.module;
5487
+
5488
+ item_model = item_model || item();
5489
+ $_view_el = $('<li>', { class : module.control.css_attr.single_item, 'data-id' : item_model.id, id : item_model.id } );
5490
+ module.itemsWrapper.append( $_view_el );
5491
+ if ( module.isMultiItem() ) {
5492
+ var _template_selector = module.getTemplateEl( 'rudItemPart', item_model );
5493
+ if ( 0 === $( '#tmpl-' + _template_selector ).length ) {
5494
+ throw new Error('Missing template for item ' + item.id + '. The provided template script has no been found : #tmpl-' + module.getTemplateEl( 'rudItemPart', item_model ) );
5495
+ }
5496
+ $_view_el.append( $( wp.template( _template_selector )( item_model ) ) );
5497
+ }
5498
+ $_view_el.append( $( '<div/>', { class: module.control.css_attr.item_content } ) );
5499
+
5500
+ return $_view_el;
5501
+ },
5502
+ renderItemContent : function( item_model ) {
5503
+ var item = this,
5504
+ module = this.module;
5505
+
5506
+ item_model = item_model || item();
5507
+ if ( 0 === $( '#tmpl-' + module.getTemplateEl( 'itemInputList', item_model ) ).length ) {
5508
+ throw new Error('No item content template defined for module ' + module.id + '. The template script id should be : #tmpl-' + module.getTemplateEl( 'itemInputList', item_model ) );
5509
+ }
5510
+
5511
+ var item_content_template = wp.template( module.getTemplateEl( 'itemInputList', item_model ) );
5512
+ if ( ! item_content_template )
5513
+ return this;
5514
+ $( item_content_template( item_model )).appendTo( $('.' + module.control.css_attr.item_content, item.container ) );
5515
+
5516
+ return $( $( item_content_template( item_model )), item.container );
5517
+ },
5518
+ writeItemViewTitle : function( item_model ) {
5519
+ var item = this,
5520
+ module = item.module,
5521
+ _model = item_model || item(),
5522
+ _title = _.has( _model, 'title')? api.CZR_Helpers.capitalize( _model.title ) : _model.id;
5523
+
5524
+ _title = api.CZR_Helpers.truncate(_title, 20);
5525
+ $( '.' + module.control.css_attr.item_title , item.container ).text(_title );
5526
+ api.CZR_Helpers.doActions('after_writeViewTitle', item.container , _model, item );
5527
+ },
5528
+ setViewVisibility : function( obj, is_added_by_user ) {
5529
+ var item = this,
5530
+ module = this.module;
5531
+ if ( is_added_by_user ) {
5532
+ item.czr_ItemState.set( 'expanded_noscroll' );
5533
+ } else {
5534
+ module.closeAllItems( item.id );
5535
+ if ( _.has(module, 'preItem') ) {
5536
+ module.preItemExpanded.set(false);
5537
+ }
5538
+ item.czr_ItemState.set( 'expanded' == item._getViewState() ? 'closed' : 'expanded' );
5539
+ }
5540
+ },
5541
+
5542
+
5543
+ _getViewState : function() {
5544
+ return -1 == this.czr_ItemState().indexOf('expanded') ? 'closed' : 'expanded';
5545
+ },
5546
+ toggleItemExpansion : function( status, from, duration ) {
5547
+ var item = this,
5548
+ module = this.module;
5549
+ $( '.' + module.control.css_attr.item_content , item.container ).first().slideToggle( {
5550
+ duration : duration || 200,
5551
+ done : function() {
5552
+ var _is_expanded = 'closed' != status;
5553
+ item.container.toggleClass('open' , _is_expanded );
5554
+ module.closeAllAlerts();
5555
+ var $_edit_icon = $(this).siblings().find('.' + module.control.css_attr.edit_view_btn );
5556
+
5557
+ $_edit_icon.toggleClass('active' , _is_expanded );
5558
+ if ( _is_expanded )
5559
+ $_edit_icon.removeClass('fa-pencil').addClass('fa-minus-square').attr('title', serverControlParams.translatedStrings.close );
5560
+ else
5561
+ $_edit_icon.removeClass('fa-minus-square').addClass('fa-pencil').attr('title', serverControlParams.translatedStrings.edit );
5562
+ if ( 'expanded' == status )
5563
+ module._adjustScrollExpandedBlock( item.container );
5564
+ }//done callback
5565
+ } );
5566
+ },
5567
+ toggleRemoveAlertVisibility : function(obj) {
5568
+ var item = this,
5569
+ module = this.module,
5570
+ $_alert_el = $( '.' + module.control.css_attr.remove_alert_wrapper, item.container ).first(),
5571
+ $_clicked = obj.dom_event;
5572
+ module.closeAllItems();
5573
+
5574
+ if ( _.has(module, 'preItem') ) {
5575
+ module.preItemExpanded.set(false);
5576
+ }
5577
+ $('.' + module.control.css_attr.remove_alert_wrapper, item.container ).not($_alert_el).each( function() {
5578
+ if ( $(this).hasClass('open') ) {
5579
+ $(this).slideToggle( {
5580
+ duration : 200,
5581
+ done : function() {
5582
+ $(this).toggleClass('open' , false );
5583
+ $(this).siblings().find('.' + module.control.css_attr.display_alert_btn).toggleClass('active' , false );
5584
+ }
5585
+ } );
5586
+ }
5587
+ });
5588
+ if ( ! wp.template( module.AlertPart ) || ! item.container ) {
5589
+ throw new Error( 'No removal alert template available for items in module :' + module.id );
5590
+ }
5591
+
5592
+ $_alert_el.html( wp.template( module.AlertPart )( { title : ( item().title || item.id ) } ) );
5593
+ $_alert_el.slideToggle( {
5594
+ duration : 200,
5595
+ done : function() {
5596
+ var _is_open = ! $(this).hasClass('open') && $(this).is(':visible');
5597
+ $(this).toggleClass('open' , _is_open );
5598
+ $( obj.dom_el ).find('.' + module.control.css_attr.display_alert_btn).toggleClass( 'active', _is_open );
5599
+ if ( _is_open )
5600
+ module._adjustScrollExpandedBlock( item.container );
5601
+ }
5602
+ } );
5603
+ },
5604
+ _destroyView : function ( duration ) {
5605
+ this.container.fadeOut( {
5606
+ duration : duration ||400,
5607
+ done : function() {
5608
+ $(this).remove();
5609
+ }
5610
+ });
5611
+ },
5612
+ });//$.extend
5613
+ var CZRModuleMths = CZRModuleMths || {};
5614
+
5615
+ $.extend( CZRModuleMths, {
5616
+
5617
+ initialize: function( id, constructorOptions ) {
5618
+ if ( _.isUndefined(constructorOptions.control) || _.isEmpty(constructorOptions.control) ) {
5619
+ throw new Error('No control assigned to module ' + id );
5620
+ }
5621
+ var module = this;
5622
+ api.Value.prototype.initialize.call( this, null, constructorOptions );
5623
+ module.isReady = $.Deferred();
5624
+ $.extend( module, constructorOptions || {} );
5625
+ $.extend( module, {
5626
+ crudModulePart : 'czr-crud-module-part',
5627
+ rudItemPart : 'czr-rud-item-part',//read, update, delete
5628
+ ruItemPart : 'czr-ru-item-part',//read, update
5629
+ itemInputList : '',//is specific for each crud module
5630
+ AlertPart : 'czr-rud-item-alert-part',//used both for items and modules removal
5631
+
5632
+ } );
5633
+ module.embedded = $.Deferred();
5634
+ if ( ! module.isInSektion() ) {
5635
+ module.container = $( module.control.selector );
5636
+ module.embedded.resolve();
5637
+ }
5638
+ module.embedded.done( function() {
5639
+ $.when( module.renderModuleParts() ).done(function( $_module_items_wrapper ){
5640
+ if ( false === $_module_items_wrapper.length ) {
5641
+ throw new Error( 'The items wrapper has not been rendered for module : ' + module.id );
5642
+ }
5643
+ module.itemsWrapper = $_module_items_wrapper;
5644
+ });
5645
+ });
5646
+ module.itemCollection = new api.Value();
5647
+ module.itemCollection.set([]);
5648
+ module.defaultAPIitemModel = {
5649
+ id : '',
5650
+ initial_item_model : {},
5651
+ defaultItemModel : {},
5652
+ control : {},//control instance
5653
+ module : {},//module instance
5654
+ is_added_by_user : false
5655
+ };
5656
+ module.defaultItemModel = { id : '', title : '' };
5657
+ module.itemConstructor = api.CZRItem;
5658
+ module.czr_Item = new api.Values();
5659
+ module.inputConstructor = api.CZRInput;
5660
+ module.isReady.done( function() {
5661
+ module.isDirty = new api.Value( constructorOptions.dirty || false );
5662
+ module.set( module.initializeModuleModel( constructorOptions ) );
5663
+ module.callbacks.add( function() { return module.moduleReact.apply(module, arguments ); } );
5664
+ if ( ! module.control.isModuleRegistered( module.id ) ) {
5665
+ module.control.updateModulesCollection( { module : constructorOptions, is_registered : false } );
5666
+ }
5667
+
5668
+ module.bind('items-collection-populated', function( collection ) {
5669
+ module.itemCollection.callbacks.add( function() { return module.itemCollectionReact.apply(module, arguments ); } );
5670
+ if ( module.isMultiItem() )
5671
+ module._makeItemsSortable();
5672
+
5673
+ api.consoleLog('SAVED ITEM COLLECTION OF MODULE ' + module.id + ' IS READY');
5674
+ });
5675
+ if ( ! module.isInSektion() )
5676
+ module.populateSavedItemCollection();
5677
+ });
5678
+ },
5679
+ ready : function() {
5680
+ var module = this;
5681
+ module.isReady.resolve();
5682
+ api.consoleLog('MODULE READY IN BASE MODULE CLASS : ', module.id );
5683
+ },
5684
+ initializeModuleModel : function( constructorOptions ) {
5685
+ var module = this;
5686
+ if ( ! module.isMultiItem() && ! module.isCrud() ) {
5687
+ if ( _.isEmpty( constructorOptions.items ) ) {
5688
+ var def = _.clone( module.defaultItemModel );
5689
+ constructorOptions.items = [ $.extend( def, { id : module.id } ) ];
5690
+ }
5691
+ }
5692
+ return constructorOptions;
5693
+ },
5694
+ itemCollectionReact : function( to, from, o ) {
5695
+ var module = this,
5696
+ _current_model = module(),
5697
+ _new_model = $.extend( true, {}, _current_model );
5698
+ _new_model.items = to;
5699
+ module.isDirty.set(true);
5700
+ module.set( _new_model, o || {} );
5701
+ },
5702
+ moduleReact : function( to, from, o ) {
5703
+ var module = this,
5704
+ control = module.control,
5705
+ is_item_update = ( _.size(from.items) == _.size(to.items) ) && ! _.isEmpty( _.difference(to.items, from.items) ),
5706
+ is_column_update = to.column_id != from.column_id,
5707
+ is_item_collection_sorted = _.has( o, 'item_collection_sorted' ) && o.item_collection_sorted,
5708
+ refreshPreview = function() {
5709
+ module.control.previewer.refresh();
5710
+ };
5711
+ if ( is_item_collection_sorted ) {
5712
+ if ( _.has(module, 'preItem') ) {
5713
+ module.preItemExpanded.set(false);
5714
+ }
5715
+ module.closeAllItems();
5716
+ module.closeAllAlerts();
5717
+ }
5718
+ if ( 'postMessage' == api(module.control.id).transport && is_item_collection_sorted && ! api.CZR_Helpers.has_part_refresh( module.control.id ) ) {
5719
+ refreshPreview = _.debounce( refreshPreview, 500 );//500ms are enough
5720
+ refreshPreview();
5721
+ }
5722
+ control.updateModulesCollection( {
5723
+ module : $.extend( true, {}, to ),
5724
+ data : o//useful to pass contextual info when a change happens
5725
+ } );
5726
+ },
5727
+ getModuleSection : function() {
5728
+ return this.section;
5729
+ },
5730
+ isInSektion : function() {
5731
+ var module = this;
5732
+ return _.has( module, 'sektion_id' );
5733
+ },
5734
+ isMultiItem : function() {
5735
+ return api.CZR_Helpers.isMultiItemModule( null, this );
5736
+ },
5737
+ isCrud : function() {
5738
+ return api.CZR_Helpers.isCrudModule( null, this );
5739
+ }
5740
+ });//$.extend//CZRBaseControlMths//MULTI CONTROL CLASS
5741
+
5742
+ var CZRModuleMths = CZRModuleMths || {};
5743
+
5744
+ $.extend( CZRModuleMths, {
5745
+ populateSavedItemCollection : function() {
5746
+ var module = this;
5747
+ if ( ! _.isArray( module().items ) ) {
5748
+ throw new Error( 'The saved items collection must be an array in module :' + module.id );
5749
+ }
5750
+ _.each( module().items, function( item_candidate , key ) {
5751
+ module.instantiateItem( item_candidate ).ready();
5752
+ });
5753
+ _.each( module().items, function( _item ) {
5754
+ if ( _.isUndefined( _.findWhere( module.itemCollection(), _item.id ) ) ) {
5755
+ throw new Error( 'The saved items have not been properly populated in module : ' + module.id );
5756
+ }
5757
+ });
5758
+
5759
+ module.trigger('items-collection-populated');
5760
+ },
5761
+
5762
+
5763
+ instantiateItem : function( item, is_added_by_user ) {
5764
+ var module = this;
5765
+ item_candidate = module.prepareItemForAPI( item );
5766
+ if ( ! _.has( item_candidate, 'id' ) ) {
5767
+ throw new Error('CZRModule::instantiateItem() : an item has no id and could not be added in the collection of : ' + this.id );
5768
+ }
5769
+ if ( module.czr_Item.has( item_candidate.id ) ) {
5770
+ throw new Error('CZRModule::instantiateItem() : the following item id ' + item_candidate.id + ' already exists in module.czr_Item() for module ' + this.id );
5771
+ }
5772
+ module.czr_Item.add( item_candidate.id, new module.itemConstructor( item_candidate.id, item_candidate ) );
5773
+
5774
+ if ( ! module.czr_Item.has( item_candidate.id ) ) {
5775
+ throw new Error('CZRModule::instantiateItem() : instantiation failed for item id ' + item_candidate.id + ' for module ' + this.id );
5776
+ }
5777
+ return module.czr_Item( item_candidate.id );
5778
+ },
5779
+ prepareItemForAPI : function( item_candidate ) {
5780
+ var module = this,
5781
+ api_ready_item = {};
5782
+ item_candidate = _.isObject( item_candidate ) ? item_candidate : {};
5783
+
5784
+ _.each( module.defaultAPIitemModel, function( _value, _key ) {
5785
+ var _candidate_val = item_candidate[_key];
5786
+ switch( _key ) {
5787
+ case 'id' :
5788
+ if ( _.isEmpty( _candidate_val ) ) {
5789
+ api_ready_item[_key] = module.generateItemId( module.module_type );
5790
+ } else {
5791
+ api_ready_item[_key] = _candidate_val;
5792
+ }
5793
+ break;
5794
+ case 'initial_item_model' :
5795
+ _.each( module.getDefaultModel() , function( _value, _property ) {
5796
+ if ( ! _.has( item_candidate, _property) )
5797
+ item_candidate[_property] = _value;
5798
+ });
5799
+ api_ready_item[_key] = item_candidate;
5800
+
5801
+ break;
5802
+ case 'defaultItemModel' :
5803
+ api_ready_item[_key] = _.clone( module.defaultItemModel );
5804
+ break;
5805
+ case 'control' :
5806
+ api_ready_item[_key] = module.control;
5807
+ break;
5808
+ case 'module' :
5809
+ api_ready_item[_key] = module;
5810
+ break;
5811
+ case 'is_added_by_user' :
5812
+ api_ready_item[_key] = _.isBoolean( _candidate_val ) ? _candidate_val : false;
5813
+ break;
5814
+ }//switch
5815
+ });
5816
+ if ( ! _.has( api_ready_item, 'id' ) ) {
5817
+ api_ready_item.id = module.generateItemId( module.module_type );
5818
+ }
5819
+ api_ready_item.initial_item_model.id = api_ready_item.id;
5820
+
5821
+ return api_ready_item;
5822
+ },
5823
+ generateItemId : function( module_type, key, i ) {
5824
+ i = i || 1;
5825
+ if ( i > 100 ) {
5826
+ throw new Error('Infinite loop when generating of a module id.');
5827
+ }
5828
+ var module = this;
5829
+ key = key || module._getNextItemKeyInCollection();
5830
+ var id_candidate = module_type + '_' + key;
5831
+ if ( ! _.has(module, 'itemCollection') || ! _.isArray( module.itemCollection() ) ) {
5832
+ throw new Error('The item collection does not exist or is not properly set in module : ' + module.id );
5833
+ }
5834
+ if ( module.isItemRegistered( id_candidate ) ) {
5835
+ key++; i++;
5836
+ return module.generateItemId( module_type, key, i );
5837
+ }
5838
+ return id_candidate;
5839
+ },
5840
+ _getNextItemKeyInCollection : function() {
5841
+ var module = this,
5842
+ _max_mod_key = {},
5843
+ _next_key = 0;
5844
+ if ( ! _.isEmpty( module.itemCollection() ) ) {
5845
+ _max_mod_key = _.max( module.itemCollection(), function( _mod ) {
5846
+ return parseInt( _mod.id.replace(/[^\/\d]/g,''), 10 );
5847
+ });
5848
+ _next_key = parseInt( _max_mod_key.id.replace(/[^\/\d]/g,''), 10 ) + 1;
5849
+ }
5850
+ return _next_key;
5851
+ },
5852
+ isItemRegistered : function( id_candidate ) {
5853
+ var module = this;
5854
+ return ! _.isUndefined( _.findWhere( module.itemCollection(), { id : id_candidate}) );
5855
+ },
5856
+ updateItemsCollection : function( obj ) {
5857
+ var module = this,
5858
+ _current_collection = module.itemCollection();
5859
+ _new_collection = _.clone(_current_collection);
5860
+ if ( _.has( obj, 'collection' ) ) {
5861
+ module.itemCollection.set(obj.collection);
5862
+ return;
5863
+ }
5864
+
5865
+ if ( ! _.has(obj, 'item') ) {
5866
+ throw new Error('updateItemsCollection, no item provided ' + module.control.id + '. Aborting');
5867
+ }
5868
+ var item = _.clone(obj.item);
5869
+ if ( _.findWhere( _new_collection, { id : item.id } ) ) {
5870
+ _.each( _current_collection , function( _item, _ind ) {
5871
+ if ( _item.id != item.id )
5872
+ return;
5873
+ _new_collection[_ind] = item;
5874
+ });
5875
+ }
5876
+ else {
5877
+ _new_collection.push(item);
5878
+ }
5879
+ module.itemCollection.set(_new_collection);
5880
+ },
5881
+ _getSortedDOMItemCollection : function( ) {
5882
+ var module = this,
5883
+ _old_collection = _.clone( module.itemCollection() ),
5884
+ _new_collection = [];
5885
+ $( '.' + module.control.css_attr.single_item, module.container ).each( function( _index ) {
5886
+ var _item = _.findWhere( _old_collection, {id: $(this).attr('data-id') });
5887
+ if ( ! _item )
5888
+ return;
5889
+
5890
+ _new_collection[_index] = _item;
5891
+ });
5892
+
5893
+ if ( _old_collection.length != _new_collection.length ) {
5894
+ throw new Error('There was a problem when re-building the item collection from the DOM in module : ' + module.id );
5895
+ }
5896
+ return _new_collection;
5897
+ }
5898
+ });//$.extend//CZRBaseControlMths//MULTI CONTROL CLASS
5899
+
5900
+ var CZRModuleMths = CZRModuleMths || {};
5901
+
5902
+ $.extend( CZRModuleMths, {
5903
+ getDefaultModel : function( id ) {
5904
+ var module = this;
5905
+ return $.extend( _.clone( module.defaultItemModel ), { id : id || '' } );
5906
+ },
5907
+ _initNewItem : function( _item , _next_key ) {
5908
+ var module = this,
5909
+ _new_item = { id : '' },
5910
+ _id;
5911
+ _next_key = 'undefined' != typeof(_next_key) ? _next_key : _.size( module.itemCollection() );
5912
+
5913
+ if ( _.isNumber(_next_key) ) {
5914
+ _id = module.module_type + '_' + _next_key;
5915
+ }
5916
+ else {
5917
+ _id = _next_key;
5918
+ _next_key = 0;
5919
+ }
5920
+
5921
+ if ( _item && ! _.isEmpty( _item) )
5922
+ _new_item = $.extend( _item, { id : _id } );
5923
+ else
5924
+ _new_item = this.getDefaultModel( _id );
5925
+ if ( _.has(_new_item, 'id') && module._isItemIdPossible(_id) ) {
5926
+ _.map( module.getDefaultModel() , function( value, property ){
5927
+ if ( ! _.has(_new_item, property) )
5928
+ _new_item[property] = value;
5929
+ });
5930
+
5931
+ return _new_item;
5932
+ }
5933
+ return module._initNewItem( _new_item, _next_key + 1);
5934
+ }
5935
+
5936
+ });//$.extend//MULTI CONTROL CLASS
5937
+ var CZRModuleMths = CZRModuleMths || {};
5938
+ $.extend( CZRModuleMths, {
5939
+ renderModuleParts : function() {
5940
+ var module = this,
5941
+ $_moduleContentEl = module.isInSektion() ? $( module.container ).find('.czr-mod-content') : $( module.container );
5942
+ if ( module.isCrud() ) {
5943
+ if ( 0 === $( '#tmpl-' + module.crudModulePart ).length ) {
5944
+ throw new Error('No crud Module Part template for module ' + module.id + '. The template script id should be : #tmpl-' + module.crudModulePart );
5945
+ }
5946
+ $_moduleContentEl.append( $( wp.template( module.crudModulePart )( {} ) ) );
5947
+ }
5948
+ var $_module_items_wrapper = $(
5949
+ '<ul/>',
5950
+ {
5951
+ class : [
5952
+ module.control.css_attr.items_wrapper,
5953
+ module.module_type,
5954
+ module.isMultiItem() ? 'multi-item-mod' : 'mono-item-mod',
5955
+ module.isCrud() ? 'crud-mod' : 'not-crud-mod'
5956
+ ].join(' ')
5957
+ }
5958
+ );
5959
+
5960
+ $_moduleContentEl.append($_module_items_wrapper);
5961
+
5962
+ return $( $_module_items_wrapper, $_moduleContentEl );
5963
+ },
5964
+ getTemplateEl : function( type, item_model ) {
5965
+ var module = this, _el;
5966
+ switch(type) {
5967
+ case 'rudItemPart' :
5968
+ _el = module.rudItemPart;
5969
+ break;
5970
+ case 'ruItemPart' :
5971
+ _el = module.ruItemPart;
5972
+ break;
5973
+ case 'itemInputList' :
5974
+ _el = module.itemInputList;
5975
+ break;
5976
+ }
5977
+ if ( _.isEmpty(_el) ) {
5978
+ throw new Error('No valid template has been found in getTemplateEl() ' + module.id + '. Aborting');
5979
+ } else {
5980
+ return _el;
5981
+ }
5982
+ },
5983
+ getViewEl : function( id ) {
5984
+ var module = this;
5985
+ return $( '[data-id = "' + id + '"]', module.container );
5986
+ },
5987
+ closeAllItems : function(id) {
5988
+ var module = this,
5989
+ _current_collection = _.clone( module.itemCollection() ),
5990
+ _filtered_collection = _.filter( _current_collection , function( mod) { return mod.id != id; } );
5991
+
5992
+ _.each( _filtered_collection, function(_item) {
5993
+ if ( module.czr_Item.has(_item.id) && 'expanded' == module.czr_Item(_item.id)._getViewState(_item.id) )
5994
+ module.czr_Item(_item.id).czr_ItemState.set( 'closed' ); // => will fire the cb toggleItemExpansion
5995
+ } );
5996
+ },
5997
+ _adjustScrollExpandedBlock : function( $_block_el, adjust ) {
5998
+ if ( ! $_block_el.length || _.isUndefined( this.getModuleSection() ) )
5999
+ return;
6000
+ var module = this,
6001
+ $_moduleSection = $( '.accordion-section-content', module.section.container ),//was api.section( control.section() )
6002
+ _currentScrollTopVal = $_moduleSection.scrollTop(),
6003
+ _scrollDownVal,
6004
+ _adjust = adjust || 90;
6005
+
6006
+ setTimeout( function() {
6007
+ if ( ( $_block_el.offset().top + $_block_el.height() + _adjust ) > $(window.top).height() ) {
6008
+ _scrollDownVal = $_block_el.offset().top + $_block_el.height() + _adjust - $(window.top).height();
6009
+ if ( _scrollDownVal > 0 ) {
6010
+ $_moduleSection.animate({
6011
+ scrollTop: _currentScrollTopVal + _scrollDownVal
6012
+ }, 500);
6013
+ }
6014
+ }
6015
+ }, 50);
6016
+ },
6017
+ closeAllAlerts : function() {
6018
+ var module = this;
6019
+ $('.' + module.control.css_attr.remove_alert_wrapper, module.container ).each( function() {
6020
+ if ( $(this).hasClass('open') ) {
6021
+ $(this).slideToggle( {
6022
+ duration : 100,
6023
+ done : function() {
6024
+ $(this).toggleClass('open' , false );
6025
+ $(this).siblings().find('.' + module.control.css_attr.display_alert_btn).toggleClass('active' , false );
6026
+ }
6027
+ } );
6028
+ }
6029
+ });
6030
+ },
6031
+ _makeItemsSortable : function(obj) {
6032
+ if ( wp.media.isTouchDevice || ! $.fn.sortable )
6033
+ return;
6034
+ var module = this;
6035
+ $( '.' + module.control.css_attr.items_wrapper, module.container ).sortable( {
6036
+ handle: '.' + module.control.css_attr.item_sort_handle,
6037
+ start: function() {
6038
+ if ( _.has(api, 'czrModulePanelState' ) )
6039
+ api.czrModulePanelState.set(false);
6040
+ if ( _.has(api, 'czrSekSettingsPanelState' ) )
6041
+ api.czrSekSettingsPanelState.set(false);
6042
+ },
6043
+ update: function( event, ui ) {
6044
+ module.itemCollection.set( module._getSortedDOMItemCollection(), { item_collection_sorted : true } );
6045
+ if ( 'postMessage' == api( module.control.id ).transport && ! api.CZR_Helpers.has_part_refresh( module.control.id ) ) {
6046
+ _.delay( function() { api.previewer.refresh(); }, 100 );
6047
+ }
6048
+ }
6049
+ }
6050
+ );
6051
+ }
6052
+ });//$.extend//MULTI CONTROL CLASS
6053
+
6054
+ var CZRDynModuleMths = CZRDynModuleMths || {};
6055
+
6056
+ $.extend( CZRDynModuleMths, {
6057
+ initialize: function( id, options ) {
6058
+ var module = this;
6059
+ api.CZRModule.prototype.initialize.call( module, id, options );
6060
+ $.extend( module, {
6061
+ itemPreAddEl : ''//is specific for each crud module
6062
+ } );
6063
+ module.itemAddedMessage = serverControlParams.translatedStrings.successMessage;
6064
+ module.userEventMap = new api.Value( [
6065
+ {
6066
+ trigger : 'click keydown',
6067
+ selector : [ '.' + module.control.css_attr.open_pre_add_btn, '.' + module.control.css_attr.cancel_pre_add_btn ].join(','),
6068
+ name : 'pre_add_item',
6069
+ actions : ['renderPreItemView','setPreItemViewVisibility'],
6070
+ },
6071
+ {
6072
+ trigger : 'click keydown',
6073
+ selector : '.' + module.control.css_attr.add_new_btn, //'.czr-add-new',
6074
+ name : 'add_item',
6075
+ actions : ['closeAllItems', 'addItem'],
6076
+ }
6077
+ ]);//module.userEventMap
6078
+ },
6079
+ ready : function() {
6080
+ var module = this;
6081
+ api.consoleLog( 'MODULE READY IN DYN MODULE CLASS : ', module.id );
6082
+ module.setupDOMListeners( module.userEventMap() , { dom_el : module.container } );
6083
+ module.preItem = new api.Value( module.getDefaultModel() );
6084
+ module.preItemEmbedded = $.Deferred();//was module.czr_preItem.create('item_content');
6085
+ module.preItemEmbedded.done( function() {
6086
+ module.setupPreItemInputCollection();
6087
+ });
6088
+ module.preItemExpanded = new api.Value(false);
6089
+ module.preItemExpanded.callbacks.add( function( to, from ) {
6090
+ module._togglePreItemViewExpansion( to );
6091
+ });
6092
+
6093
+ api.CZRModule.prototype.ready.call( module );//fires the parent
6094
+ },//ready()
6095
+ setupPreItemInputCollection : function() {
6096
+ var module = this;
6097
+ module.preItem.czr_Input = new api.Values();
6098
+ $('.' + module.control.css_attr.pre_add_wrapper, module.container)
6099
+ .find( '.' + module.control.css_attr.sub_set_wrapper)
6100
+ .each( function( _index ) {
6101
+ var _id = $(this).find('[data-type]').attr('data-type') || 'sub_set_' + _index;
6102
+ module.preItem.czr_Input.add( _id, new module.inputConstructor( _id, {//api.CZRInput;
6103
+ id : _id,
6104
+ type : $(this).attr('data-input-type'),
6105
+ container : $(this),
6106
+ item : module.preItem,
6107
+ module : module,
6108
+ is_preItemInput : true
6109
+ } ) );
6110
+ module.preItem.czr_Input(_id).ready();
6111
+ });//each
6112
+ },
6113
+ addItem : function(obj) {
6114
+ var module = this,
6115
+ item = module.preItem(),
6116
+ collapsePreItem = function() {
6117
+ module.preItemExpanded.set(false);
6118
+ module._resetPreItemInputs();
6119
+ module.toggleSuccessMessage('off');
6120
+ };
6121
+
6122
+ if ( _.isEmpty(item) || ! _.isObject(item) ) {
6123
+ throw new Error('addItem : an item should be an object and not empty. In : ' + module.id +'. Aborted.' );
6124
+ }
6125
+ collapsePreItem = _.debounce( collapsePreItem, 2000 );
6126
+ module.instantiateItem( item, true ).ready(); //true == Added by user
6127
+
6128
+ module.czr_Item( item.id ).isReady.then( function() {
6129
+ module.toggleSuccessMessage('on');
6130
+ collapsePreItem();
6131
+
6132
+ module.trigger('item_added', item );
6133
+ if ( 'postMessage' == api(module.control.id).transport && _.has( obj, 'dom_event') && ! _.has( obj.dom_event, 'isTrigger' ) && ! api.CZR_Helpers.has_part_refresh( module.control.id ) ) {
6134
+ module.control.previewer.refresh();
6135
+ }
6136
+ });
6137
+
6138
+
6139
+
6140
+ },
6141
+
6142
+ _resetPreItemInputs : function() {
6143
+ var module = this;
6144
+ module.preItem.set( module.getDefaultModel() );
6145
+ module.preItem.czr_Input.each( function( input_instance ) {
6146
+ var _input_id = input_instance.id;
6147
+ if ( ! _.has( module.getDefaultModel(), _input_id ) )
6148
+ return;
6149
+ input_instance.set( module.getDefaultModel()._input_id );
6150
+ });
6151
+ }
6152
+
6153
+ });//$.extend//MULTI CONTROL CLASS
6154
+
6155
+ var CZRDynModuleMths = CZRDynModuleMths || {};
6156
+
6157
+ $.extend( CZRDynModuleMths, {
6158
+ renderPreItemView : function( obj ) {
6159
+ var module = this;
6160
+ if ( 'pending' != module.preItemEmbedded.state() ) //was ! _.isEmpty( module.czr_preItem('item_content')() ) )
6161
+ return;
6162
+ if ( ! _.has(module, 'itemPreAddEl') || 0 === $( '#tmpl-' + module.itemPreAddEl ).length )
6163
+ return this;
6164
+ var pre_add_template = wp.template( module.itemPreAddEl );
6165
+ if ( ! pre_add_template || ! module.container )
6166
+ return this;
6167
+
6168
+ var $_pre_add_el = $('.' + module.control.css_attr.pre_add_item_content, module.container );
6169
+ $_pre_add_el.prepend( pre_add_template() );
6170
+ module.preItemEmbedded.resolve();
6171
+ },
6172
+ _getPreItemView : function() {
6173
+ var module = this;
6174
+ return $('.' + module.control.css_attr.pre_add_item_content, module.container );
6175
+ },
6176
+ setPreItemViewVisibility : function(obj) {
6177
+ var module = this;
6178
+
6179
+ module.closeAllItems();
6180
+ module.preItemExpanded.set( ! module.preItemExpanded() );
6181
+ },
6182
+ _togglePreItemViewExpansion : function( _is_expanded ) {
6183
+ var module = this,
6184
+ $_pre_add_el = $( '.' + module.control.css_attr.pre_add_item_content, module.container );
6185
+ $_pre_add_el.slideToggle( {
6186
+ duration : 200,
6187
+ done : function() {
6188
+ var $_btn = $( '.' + module.control.css_attr.open_pre_add_btn, module.container );
6189
+
6190
+ $(this).toggleClass('open' , _is_expanded );
6191
+ if ( _is_expanded )
6192
+ $_btn.find('.fa').removeClass('fa-plus-square').addClass('fa-minus-square');
6193
+ else
6194
+ $_btn.find('.fa').removeClass('fa-minus-square').addClass('fa-plus-square');
6195
+ $_btn.toggleClass( 'active', _is_expanded );
6196
+ $( module.container ).toggleClass( module.control.css_attr.adding_new, _is_expanded );
6197
+ module._adjustScrollExpandedBlock( $(this), 120 );
6198
+ }//done
6199
+ } );
6200
+ },
6201
+
6202
+
6203
+ toggleSuccessMessage : function( status ) {
6204
+ var module = this,
6205
+ _message = module.itemAddedMessage,
6206
+ $_pre_add_wrapper = $('.' + module.control.css_attr.pre_add_wrapper, module.container );
6207
+ $_success_wrapper = $('.' + module.control.css_attr.pre_add_success, module.container );
6208
+
6209
+ if ( 'on' == status ) {
6210
+ $_success_wrapper.find('p').text(_message);
6211
+ $_success_wrapper.css('z-index', 1000001 )
6212
+ .css('height', $_pre_add_wrapper.height() + 'px' )
6213
+ .css('line-height', $_pre_add_wrapper.height() + 'px');
6214
+ } else {
6215
+ $_success_wrapper.attr('style','');
6216
+ }
6217
+ module.container.toggleClass('czr-model-added', 'on' == status );
6218
+ return this;
6219
+ }
6220
+
6221
+ });//$.extend//CZRBaseControlMths//extends api.CZRDynModule
6222
+
6223
+ var CZRSektionMths = CZRSektionMths || {};
6224
+
6225
+ $.extend( CZRSektionMths, {
6226
+ initialize: function( id, options ) {
6227
+ var module = this;
6228
+ api.CZRDynModule.prototype.initialize.call( module, id, options );
6229
+ $.extend( module, {
6230
+ itemPreAddEl : 'czr-module-sektion-pre-add-view-content',
6231
+ rudItemPart : 'czr-module-sektion-rud-item-part',
6232
+ itemInputList : 'czr-module-sektion-view-content',
6233
+ } );
6234
+ module.defaultItemModel = {
6235
+ id : '',
6236
+ 'sektion-layout' : 1,
6237
+ columns : []
6238
+ };
6239
+ module.bind( 'pre_item_dom_remove', function( item ) {
6240
+ module.removeSektion( item );
6241
+ });
6242
+ module.defaultDBColumnModel = {
6243
+ id : '',
6244
+ sektion_id : '',
6245
+ modules : [],
6246
+ };
6247
+
6248
+ module.defaultAPIcolumnModel = {
6249
+ id : '',
6250
+ modules : [],
6251
+ sektion : {},//sektion instance
6252
+ module_id : '',
6253
+ control_id : '',
6254
+ is_added_by_user : false
6255
+ };
6256
+ module.czr_Column = new api.Values();
6257
+ module.czr_columnCollection = new api.Value();
6258
+ module.czr_columnCollection.set([]);
6259
+ module.czr_columnCollection.callbacks.add( function() { return module.columnCollectionReact.apply(module, arguments ); } );
6260
+ module.itemConstructor = api.CZRItem.extend( module.CZRSektionItem || {} );
6261
+ if ( ! _.has( module ,'modsDragInstance' ) )
6262
+ module.initModulesDragula();
6263
+ api.czrModulePanelState = api.czrModulePanelState || new api.Value( false );
6264
+ api.czrModulePanelEmbedded = api.czrModulePanelEmbedded || $.Deferred();
6265
+ module.userEventMap.set( _.union(
6266
+ module.userEventMap(),
6267
+ [
6268
+ {
6269
+ trigger : 'click keydown',
6270
+ selector : '.add-new-module',
6271
+ name : 'add_new_module',
6272
+ actions : 'toggleModuleListPanel'
6273
+ },
6274
+ {
6275
+ trigger : 'click keydown',
6276
+ selector : '.' + module.control.css_attr.open_pre_add_btn,
6277
+ name : 'close_module_panel',
6278
+ actions : function() {
6279
+ api.czrModulePanelState(false);
6280
+ },
6281
+ }
6282
+ ]
6283
+ ));
6284
+
6285
+
6286
+
6287
+ api.consoleLog('SEKTION MODULE INIT', module.control.params.czr_skope );
6288
+ if ( _.has( api, 'czr_activeSkopeId' ) )
6289
+ api.consoleLog('SEKTION MODULE INIT', api.czr_activeSkopeId() );
6290
+
6291
+ api.czrModulePanelBinded = api.czrModulePanelBinded || $.Deferred();
6292
+ if ( 'pending' == api.czrModulePanelBinded.state() ) {
6293
+
6294
+ api.czrModulePanelState.bind( function( expanded ) {
6295
+ var synced_control_id = api.CZR_Helpers.build_setId( module.control.params.syncCollection ),
6296
+ sek_module = api.control( synced_control_id ).syncSektionModule();
6297
+
6298
+ $('body').toggleClass('czr-adding-module', expanded );
6299
+
6300
+ if ( expanded ) {
6301
+ sek_module.renderModulePanel();
6302
+
6303
+
6304
+
6305
+ api.consoleLog('REACT TO MODULE PANEL STATE', expanded, module.control.params.syncCollection, sek_module() );
6306
+ api.consoleLog('WHEN DOES THIS ACTION OCCUR?', api.czrModulePanelBinded.state() );
6307
+ sek_module.modsDragInstance.containers.push( $('#czr-available-modules-list')[0]);
6308
+ } else {
6309
+ var _containers = $.extend( true, [], sek_module.modsDragInstance.containers );
6310
+ _containers = _.filter( _containers, function( con) {
6311
+ return 'czr-available-modules-list' != $(con).attr('id');
6312
+ });
6313
+ sek_module.modsDragInstance.containers = _containers;
6314
+ $('#czr-module-list-panel').remove();
6315
+ }
6316
+
6317
+ });
6318
+ api.czrModulePanelBinded.resolve();
6319
+ }//if pending
6320
+ api.czrSekSettingsPanelState = api.SekSettingsPanelState || new api.Value( false );
6321
+ api.czrSekSettingsPanelEmbedded = api.SekSettingsPanelEmbedded || $.Deferred();
6322
+ module.userEventMap.set( _.union(
6323
+ module.userEventMap(),
6324
+ [
6325
+ {
6326
+ trigger : 'click keydown',
6327
+ selector : '.czr-edit-sek-settings',
6328
+ name : 'edit_sek_settings',
6329
+ actions : 'toggleSekSettingsPanel'
6330
+ },
6331
+ {
6332
+ trigger : 'click keydown',
6333
+ selector : '.' + module.control.css_attr.open_pre_add_btn,
6334
+ name : 'close_sektion_panel',
6335
+ actions : function() {
6336
+ api.czrSekSettingsPanelState.set(false);
6337
+ },
6338
+ }
6339
+ ]
6340
+ ));
6341
+ api.czrSekSettingsPanelEmbedded.done( function() {
6342
+ api.czrSekSettingsPanelState.callbacks.add( function() { return module.reactToSekSettingPanelState.apply(module, arguments ); } );
6343
+ });
6344
+ api.section( module.control.section() ).expanded.bind(function(to) {
6345
+ api.consoleLog('FIRE SEKTION MODULE!', module.id );
6346
+ module.fireSektionModule();
6347
+ });
6348
+ },//initialize
6349
+
6350
+
6351
+
6352
+
6353
+ fireSektionModule : function() {
6354
+ var module = this;
6355
+ if ( 'resolved' == module.isReady.state() )
6356
+ return;
6357
+ module.ready();
6358
+ module.control.getSyncCollectionControl().syncSektionModule.set( module );
6359
+ },
6360
+ removeSektion : function( sekItem ) {
6361
+ var module = this;
6362
+
6363
+ _.each( sekItem.columns, function( _col ) {
6364
+
6365
+ _.each( _col.modules, function( _mod ){
6366
+ module.control.getSyncCollectionControl().removeModule( _mod );
6367
+ });//_.each
6368
+ if ( module.czr_Column.has(_col.id) && 'resolved' == module.czr_Column( _col.id ).embedded.state() )
6369
+ module.czr_Column( _col.id ).container.remove();
6370
+ module.removeColumnFromCollection( _col );
6371
+
6372
+
6373
+ });//_.each
6374
+
6375
+ },
6376
+
6377
+ closeAllOtherSektions : function( $_clicked_el ) {
6378
+ var module = this;
6379
+ _clicked_sektion_id = $_clicked_el.closest('.czr-single-item').attr('data-id');
6380
+
6381
+ module.czr_Item.each( function( _sektion ){
6382
+ if ( _clicked_sektion_id != _sektion.id ) {
6383
+ _sektion.czr_ItemState.set( 'closed');
6384
+ } else {
6385
+ _sektion.czr_ItemState.set( 'expanded' != _sektion.czr_ItemState() ? 'expanded_noscroll' : 'expanded' );
6386
+ }
6387
+ });
6388
+ }
6389
+
6390
+ });//extends api.CZRDynModule
6391
+
6392
+ var CZRSektionMths = CZRSektionMths || {};
6393
+
6394
+ $.extend( CZRSektionMths, {
6395
+ CZRSektionItem : {
6396
+ initialize: function(id, options ) {
6397
+ var sekItem = this;
6398
+ api.CZRItem.prototype.initialize.call( sekItem, null, options );
6399
+ sekItem.userEventMap.set( _.union(
6400
+ sekItem.userEventMap(),
6401
+ [
6402
+ {
6403
+ trigger : 'click keydown',
6404
+ selector : [ '.' + sekItem.module.control.css_attr.edit_view_btn, '.' + sekItem.module.control.css_attr.display_alert_btn,'.' + sekItem.module.control.css_attr.item_title ].join(','),
6405
+ name : 'close_module_panel',
6406
+ actions : function() {
6407
+ api.czrModulePanelState.set(false);
6408
+ },
6409
+ },
6410
+ {
6411
+ trigger : 'mouseenter',
6412
+ selector : '.czr-item-header',
6413
+ name : 'hovering_sek',
6414
+ actions : function( obj ) {
6415
+ sekItem.module.control.previewer.send( 'start_hovering_sek', {
6416
+ id : sekItem.id
6417
+ });
6418
+ }
6419
+ },
6420
+ {
6421
+ trigger : 'mouseleave',
6422
+ selector : '.czr-item-header',
6423
+ name : 'hovering_sek',
6424
+ actions : function( obj ) {
6425
+ sekItem.module.control.previewer.send( 'stop_hovering_sek', {
6426
+ id : sekItem.id
6427
+ });
6428
+ }
6429
+ },
6430
+ {
6431
+ trigger : 'click keydown',
6432
+ selector : [ '.' + sekItem.module.control.css_attr.edit_view_btn, '.' + sekItem.module.control.css_attr.item_title ].join(','),
6433
+ name : 'send_edit_view',
6434
+ actions : function( obj ) {
6435
+ sekItem.module.control.previewer.send( 'edit_sek', {
6436
+ id : sekItem.id
6437
+ });
6438
+ },
6439
+ }
6440
+ ]
6441
+ ));
6442
+
6443
+ var _sektion_model = sekItem(),
6444
+ module = options.module;
6445
+
6446
+ if ( ! _.has(_sektion_model, 'sektion-layout') ) {
6447
+ throw new Error('In Sektion Item initialize, no layout provided for ' + sekItem.id + '.');
6448
+ }
6449
+
6450
+ sekItem.isReady.done( function() {
6451
+ if ( ! _.isEmpty( sekItem().columns ) ) {
6452
+ _.each( sekItem().columns , function( _column ) {
6453
+ var column_candidate = $.extend( true, {}, _column );//create a deep clone
6454
+ module.instantiateColumn( $.extend( column_candidate, { sektion : sekItem } ) );
6455
+ });
6456
+ } else {
6457
+ var _col_nb = parseInt( _sektion_model['sektion-layout'] || 1, 10 );
6458
+ for( i = 1; i < _col_nb + 1 ; i++ ) {
6459
+ var _default_column = $.extend( true, {}, module.defaultDBColumnModel ),
6460
+ column_candidate = {
6461
+ id : '',//a unique id will be generated when preparing the column for API.
6462
+ sektion_id : sekItem.id
6463
+ };
6464
+ column_candidate = $.extend( _default_column, column_candidate );
6465
+
6466
+ module.instantiateColumn( $.extend( column_candidate, { sektion : sekItem } ) );
6467
+ }//for
6468
+ }
6469
+ });//sekItem.isReady
6470
+
6471
+ },
6472
+ itemReact : function( to, from ) {
6473
+ var sekItem = this,
6474
+ sektion_candidate = $.extend(true, {}, to);
6475
+ sektion_candidate = sekItem.prepareSekItemForDB( sektion_candidate );
6476
+ api.CZRItem.prototype.itemReact.call( sekItem, sektion_candidate );
6477
+ },
6478
+ prepareSekItemForDB : function( sektion_candidate ) {
6479
+ var sekItem = this,
6480
+ db_ready_sektItem = {};
6481
+
6482
+ _.each( sekItem.module.defaultItemModel, function( _value, _key ) {
6483
+ var _candidate_val = sektion_candidate[_key];
6484
+ switch( _key ) {
6485
+ case 'id' :
6486
+ if ( ! _.isString( _candidate_val ) || _.isEmpty( _candidate_val ) ) {
6487
+ throw new Error('The sekItem id property must be a not empty string');
6488
+ }
6489
+ db_ready_sektItem[_key] = _candidate_val;
6490
+ break;
6491
+ case 'sektion-layout' :
6492
+ if ( ! _.isNumber( parseInt( _candidate_val, 10 ) ) || ( parseInt( _candidate_val, 10 ) < 1 ) ) {
6493
+ throw new Error('The sekItem layout property must be an int number > 0');
6494
+ }
6495
+ db_ready_sektItem[_key] = _candidate_val;
6496
+ break;
6497
+ case 'columns' :
6498
+ if ( ! _.isArray( _candidate_val ) ) {
6499
+ throw new Error('The sekItem columns property must be an array');
6500
+ }
6501
+ var _db_ready_columns = [];
6502
+ _.each( _candidate_val, function( _col ) {
6503
+ var _db_ready_col = sekItem.module.prepareColumnForDB(_col);
6504
+ _db_ready_columns.push( _db_ready_col );
6505
+ });
6506
+
6507
+ db_ready_sektItem[_key] = _db_ready_columns;
6508
+ break;
6509
+ }
6510
+ });//each
6511
+
6512
+ return db_ready_sektItem;
6513
+ }
6514
+
6515
+ }//Sektion
6516
+
6517
+ });//extends api.CZRDynModule
6518
+
6519
+ var CZRSektionMths = CZRSektionMths || {};
6520
+
6521
+ $.extend( CZRSektionMths, {
6522
+ prepareColumnForDB : function( column_candidate ) {
6523
+ var module = this,
6524
+ _db_ready_col = {};
6525
+
6526
+ _.each( module.defaultDBColumnModel, function( _value, _key ){
6527
+ var _candidate_val = column_candidate[_key];
6528
+ switch( _key ) {
6529
+ case 'id' :
6530
+ if ( ! _.isString( _candidate_val ) || _.isEmpty( _candidate_val ) ) {
6531
+ throw new Error('The column id property must be a not empty string');
6532
+ }
6533
+ _db_ready_col[_key] = _candidate_val;
6534
+ break;
6535
+ case 'sektion_id' :
6536
+ if ( _.isString( _candidate_val ) && ! _.isEmpty( _candidate_val ) ) {
6537
+ _db_ready_col[_key] = _candidate_val;
6538
+ } else if ( _.has(column_candidate, 'sektion') ) {
6539
+ _db_ready_col[_key] = column_candidate.sektion.id;
6540
+ } else {
6541
+ throw new Error('The column sektion-id property must be a not empty string');
6542
+ }
6543
+ break;
6544
+ case 'modules' :
6545
+ if ( ! _.isArray( _candidate_val ) ) {
6546
+ throw new Error('The column modules property must be an array');
6547
+ }
6548
+ _db_ready_col[_key] = _candidate_val;
6549
+ break;
6550
+ }
6551
+
6552
+ } );
6553
+ return _db_ready_col;
6554
+ },
6555
+ instantiateColumn : function( _column, is_added_by_user ) {
6556
+ var module = this,
6557
+ column_model = _.clone( _column );
6558
+
6559
+ if ( ! _.isEmpty( column_model.id ) && module.czr_Column.has( column_model.id ) ) {
6560
+ throw new Error('The column id already exists in the collection in module : ' + module.id );
6561
+ }
6562
+
6563
+ column_model = module.prepareColumnForAPI( column_model );
6564
+ module.czr_Column.add( column_model.id , new api.CZRColumn( column_model.id, column_model ) );
6565
+ module.czr_Column(column_model.id).ready();
6566
+ },
6567
+ prepareColumnForAPI : function( column_candidate ) {
6568
+ var module = this,
6569
+ api_ready_column = {};
6570
+
6571
+ if ( ! _.isObject( column_candidate ) ) {
6572
+ throw new Error('Sektion Module::prepareColumnForAPI : a column must be an object to be instantiated.');
6573
+ }
6574
+
6575
+ _.each( module.defaultAPIcolumnModel, function( _value, _key ) {
6576
+ var _candidate_val = column_candidate[_key];
6577
+ switch( _key ) {
6578
+ case 'id' :
6579
+ if ( _.isEmpty( _candidate_val ) ) {
6580
+ api_ready_column[_key] = module.generateColId();
6581
+ } else {
6582
+ api_ready_column[_key] = _candidate_val;
6583
+ }
6584
+ break;
6585
+ case 'modules' :
6586
+ if ( ! _.isArray( _candidate_val ) ) {
6587
+ throw new Error('Sektion Module::prepareColumnForAPI : a collection of modules must be an array. Error in column ' + column_candidate.id );
6588
+ }
6589
+ api_ready_column[_key] = _candidate_val;
6590
+ break;
6591
+ case 'sektion' :
6592
+ if ( ! _.isObject( _candidate_val ) || _.isEmpty( _candidate_val ) ) {
6593
+ throw new Error('Sektion Module::prepareColumnForAPI : a sektion instance is missing for column ' + column_candidate.id );
6594
+ }
6595
+ api_ready_column[_key] = _candidate_val;
6596
+ break;
6597
+ case 'module_id' :
6598
+ api_ready_column[_key] = module.id;
6599
+ break;
6600
+ case 'control_id' :
6601
+ api_ready_column[_key] = module.control.id;
6602
+ break;
6603
+ case 'is_added_by_user' :
6604
+ api_ready_column[_key] = _.isBoolean( _candidate_val ) ? _candidate_val : false;
6605
+ break;
6606
+ }//switch
6607
+ });
6608
+ return api_ready_column;
6609
+ },
6610
+ updateColumnCollection : function( obj ) {
6611
+ var module = this,
6612
+ _current_collection = module.czr_columnCollection();
6613
+ _new_collection = $.extend( true, [] , _current_collection );
6614
+ api.consoleLog('in update column collection', module.id, module.czr_columnCollection() );
6615
+ if ( _.has( obj, 'collection' ) ) {
6616
+ module.czr_columnCollection.set(obj.collection);
6617
+ return;
6618
+ }
6619
+
6620
+ if ( ! _.has(obj, 'column') ) {
6621
+ throw new Error('updateColumnCollection, no column provided in module ' + module.id + '. Aborting');
6622
+ }
6623
+ var column = _.clone(obj.column);
6624
+
6625
+ if ( ! _.has(column, 'id') ) {
6626
+ throw new Error('updateColumnCollection, no id provided for a column in module' + module.id + '. Aborting');
6627
+ }
6628
+ if ( _.findWhere( _new_collection, { id : column.id } ) ) {
6629
+ _.each( _current_collection , function( _elt, _ind ) {
6630
+ if ( _elt.id != column.id )
6631
+ return;
6632
+ _new_collection[_ind] = column;
6633
+ });
6634
+ }
6635
+ else {
6636
+ _new_collection.push(column);
6637
+ }
6638
+ module.czr_columnCollection.set(_new_collection);
6639
+ },
6640
+
6641
+
6642
+ removeColumnFromCollection : function( column ) {
6643
+ var module = this,
6644
+ _current_collection = module.czr_columnCollection(),
6645
+ _new_collection = $.extend( true, [], _current_collection);
6646
+
6647
+ _new_collection = _.filter( _new_collection, function( _col ) {
6648
+ return _col.id != column.id;
6649
+ } );
6650
+
6651
+ module.czr_columnCollection.set(_new_collection);
6652
+ },
6653
+ columnCollectionReact : function( to, from ) {
6654
+ var module = this,
6655
+ is_column_added = _.size(from) < _.size(to),
6656
+ is_column_removed = _.size(from) > _.size(to),
6657
+ is_column_update = _.size(from) == _.size(to),
6658
+ _current_sek_model = {},
6659
+ _new_sek_model = {};
6660
+ if ( is_column_update ) {
6661
+ _.each( to, function( _col, _key ) {
6662
+ if ( _.isEqual( _col, from[_key] ) )
6663
+ return;
6664
+ _current_sek_model = _col.sektion();
6665
+ _new_sek_model = $.extend(true, {}, _current_sek_model);
6666
+ _.each( _current_sek_model.columns, function( _c, _k ){
6667
+ if ( _c.id != _col.id )
6668
+ return;
6669
+ _new_sek_model.columns[_k] = _col;
6670
+ } );
6671
+
6672
+ _col.sektion.set( _new_sek_model );
6673
+
6674
+ } );//_.each
6675
+ }//end if column update
6676
+ if ( is_column_added ) {
6677
+ var _new_column = _.filter( to, function( _col ){
6678
+ return _.isUndefined( _.findWhere( from, { id : _col.id } ) );
6679
+ });
6680
+
6681
+ _new_column = _new_column[0];
6682
+ _current_sek_model = _new_column.sektion();
6683
+ if ( _.isUndefined( _.findWhere( _current_sek_model.columns, {id : _new_column.id } ) ) ) {
6684
+ _new_sek_model = $.extend(true, {}, _current_sek_model);
6685
+ _new_sek_model.columns.push( _new_column );
6686
+ _new_column.sektion.set( _new_sek_model );
6687
+ }
6688
+
6689
+ }//end if new column case
6690
+ if ( is_column_removed ) {
6691
+ var _to_remove = _.filter( from, function( _col ){
6692
+ return _.isUndefined( _.findWhere( to, { id : _col.id } ) );
6693
+ });
6694
+ _to_remove = _to_remove[0];
6695
+
6696
+ _current_sek_model = _to_remove.sektion();
6697
+ _new_sek_model = $.extend(true, {}, _current_sek_model);//_.clone() is not enough there, we need a deep cloning.
6698
+ _new_sek_model.columns = _.filter( _new_sek_model.columns, function( _col ) {
6699
+ return _col.id != _to_remove.id;
6700
+ } );
6701
+
6702
+ _to_remove.sektion.set( _new_sek_model );
6703
+ module.czr_Column.remove( _to_remove.id );
6704
+ }
6705
+ },
6706
+ generateColId : function( key, i ) {
6707
+ i = i || 1;
6708
+ if ( i > 100 ) {
6709
+ throw new Error('Infinite loop when generating of a column id.');
6710
+ }
6711
+
6712
+ var module = this;
6713
+ key = key || module._getNextColKeyInCollection();
6714
+
6715
+ var id_candidate = 'col_' + key;
6716
+ if ( ! _.has(module, 'czr_columnCollection') || ! _.isArray( module.czr_columnCollection() ) ) {
6717
+ throw new Error('The column collection does not exist or is not properly set in module : ' + module.id );
6718
+ }
6719
+ if ( module.czr_Column.has( id_candidate ) ) {
6720
+ return module.generateColId( key++, i++ );
6721
+ }
6722
+
6723
+ return id_candidate;
6724
+ },
6725
+ _getNextColKeyInCollection : function() {
6726
+ var module = this,
6727
+ _max_col_key = {},
6728
+ _next_key = 0;
6729
+ if ( ! _.isEmpty( module.czr_columnCollection() ) ) {
6730
+ _max_col_key = _.max( module.czr_columnCollection(), function( _col ) {
6731
+ return parseInt( _col.id.replace(/[^\/\d]/g,''), 10 );
6732
+ });
6733
+ _next_key = parseInt( _max_col_key.id.replace(/[^\/\d]/g,''), 10 ) + 1;
6734
+ }
6735
+ return _next_key;
6736
+ },
6737
+ moduleExistsInOneColumnMax : function( module_id ) {
6738
+ return 2 > this.getModuleColumn( module_id ).length;
6739
+ },
6740
+ getModuleColumn : function( module_id ) {
6741
+ var module = this,
6742
+ _mod_columns = [];
6743
+ _.each( module.czr_columnCollection(), function( _col, _key ) {
6744
+ if ( _.findWhere( _col.modules, { id : module_id } ) )
6745
+ _mod_columns.push( _col.id );
6746
+ });
6747
+ return _mod_columns;
6748
+ }
6749
+
6750
+ });//extends api.CZRDynModule
6751
+
6752
+ var CZRSektionMths = CZRSektionMths || {};
6753
+
6754
+ $.extend( CZRSektionMths, {
6755
+ initModulesDragula : function() {
6756
+ var module = this;
6757
+ module.modsDragInstance = dragula({
6758
+ copy: function (el, source) {
6759
+ return $(el).hasClass( 'czr-module-candidate' );
6760
+ },
6761
+ moves: function (el, source, handle, sibling) {
6762
+ return _.contains( handle.className.split(' '), 'czr-mod-drag-handler' );
6763
+ },
6764
+ accepts: function ( el, target, source, sibling ) {
6765
+ return ! _.isUndefined(target) && 'czr-available-modules-list' != $(target).attr('id') ;
6766
+ },
6767
+ isContainer : function( el ) {
6768
+ return false;
6769
+ }
6770
+ });//dragula
6771
+ module.modsDragInstance.on('drag', function( el, source ){
6772
+ module.czr_Item.each( function( _sektion ){
6773
+ _sektion.czr_ItemState.set( 'expanded' != _sektion.czr_ItemState() ? 'expanded_noscroll' : 'expanded' );
6774
+ });
6775
+ }).on('dragend', function( el, source ){
6776
+ }).on('drop', function(el, target, source, sibling ) {
6777
+ var _dropped_module_id = $(el).attr('data-module-id'),
6778
+ _dropped_module_type = $(el).attr('data-module-type'),
6779
+ _target_col = $(target).closest('.czr-column').attr('data-id'),
6780
+ _source_col = $(source).closest('.czr-column').attr('data-id'),
6781
+ is_reorder = _target_col == _source_col,
6782
+ is_module_candidate = $(el).hasClass('czr-module-candidate');
6783
+
6784
+ if ( is_module_candidate ) {
6785
+ if ( _.isUndefined(_target_col) || _.isUndefined(_dropped_module_type ) )
6786
+ return;
6787
+
6788
+ module.userAddedModule( _target_col, _dropped_module_type );
6789
+ module.reorderModulesInColumn( _target_col );
6790
+ }
6791
+ else if ( is_reorder ) {
6792
+ module.reorderModulesInColumn( _target_col );
6793
+ } else {
6794
+ module.control.getSyncCollectionControl().czr_Module( _dropped_module_id ).modColumn.set( _target_col );
6795
+ }
6796
+ });
6797
+ var scroll = autoScroller([
6798
+ module.control.container.closest('.accordion-section-content')[0]
6799
+ ],
6800
+ {
6801
+ direction: "vertical",
6802
+ margin: 20,
6803
+ pixels: 100,
6804
+ scrollWhenOutside: true,
6805
+ autoScroll: function(){
6806
+ return module.modsDragInstance.dragging;
6807
+ }
6808
+ }
6809
+ );
6810
+ },
6811
+ userAddedModule : function( column_id, module_type ) {
6812
+ var module = this,
6813
+ syncedCollectionControl = module.control.getSyncCollectionControl(),
6814
+ defautAPIModuleModel = _.clone( syncedCollectionControl.getDefaultModuleApiModel() );
6815
+
6816
+ syncedCollectionControl.trigger(
6817
+ 'user-module-candidate',
6818
+ $.extend( defautAPIModuleModel, {
6819
+ module_type : module_type, //'czr_text_editor_module', //'czr_text_module',
6820
+ column_id : column_id,//a string
6821
+ sektion : module.czr_Column(column_id).sektion,//instance
6822
+ sektion_id : module.czr_Column(column_id).sektion.id,
6823
+ is_added_by_user : true
6824
+ } )
6825
+ );
6826
+
6827
+ },
6828
+
6829
+
6830
+
6831
+ reorderModulesInColumn : function( col_id ) {
6832
+ var module = this,
6833
+ _new_dom_module_collection = module.czr_Column( col_id ).getColumnModuleCollectionFromDom( col_id );
6834
+
6835
+ module.czr_Column( col_id ).updateColumnModuleCollection( { collection : _new_dom_module_collection } );
6836
+ },
6837
+ moveModuleFromTo : function( moved_module, source_column, target_column ) {
6838
+ api.consoleLog( 'ALORS CE BUG?', this(), this.czr_columnCollection() );
6839
+ var module = this,
6840
+ _new_dom_module_collection = module.czr_Column( target_column ).getColumnModuleCollectionFromDom( source_column );
6841
+ if ( _.has( api, 'czrModulePanelState') )
6842
+ api.czrModulePanelState(false);
6843
+ module.czr_Column( target_column ).updateColumnModuleCollection( { collection : _new_dom_module_collection } );
6844
+ module.czr_Column( source_column ).removeModuleFromColumnCollection( moved_module );
6845
+ }
6846
+ });//extends api.Value
6847
+ var CZRSektionMths = CZRSektionMths || {};
6848
+
6849
+ $.extend( CZRSektionMths, {
6850
+
6851
+ toggleModuleListPanel : function( obj ) {
6852
+ var module = this;
6853
+ api.czrSekSettingsPanelState.set(false);
6854
+
6855
+ api.czrModulePanelState.set( ! api.czrModulePanelState() );
6856
+ if ( ! api.czrModulePanelState() ) {
6857
+ module.closeAllOtherSektions( $(obj.dom_event.currentTarget, obj.dom_el ) );
6858
+ } else {
6859
+ module.czr_Item.each( function( _sektion ){
6860
+ _sektion.czr_ItemState.set( 'expanded' != _sektion.czr_ItemState() ? 'expanded_noscroll' : 'expanded' );
6861
+ });
6862
+ }
6863
+ },
6864
+ renderModulePanel : function() {
6865
+ var module = this;
6866
+ if ( 0 === $( '#tmpl-czr-available-modules' ).length ) {
6867
+ throw new Error('No template found to render the module panel list' );
6868
+ }
6869
+
6870
+ $('#widgets-left').after( $( wp.template( 'czr-available-modules' )() ) );
6871
+
6872
+ _.each( api.czrModuleMap, function( _data, _mod_type ) {
6873
+ var $_mod_candidate = $('<li/>', {
6874
+ class : 'czr-module-candidate',
6875
+ 'data-module-type' : _mod_type,
6876
+ html : '<h3><span class="czr-mod-drag-handler fa fa-arrows-alt"></span>' + _data.name + '</h3>'
6877
+ });
6878
+ $('#czr-available-modules-list').append( $_mod_candidate );
6879
+ });
6880
+ }
6881
+ });//$.extend
6882
+ var CZRColumnMths = CZRColumnMths || {};
6883
+ $.extend( CZRColumnMths , {
6884
+ initialize: function( name, options ) {
6885
+ var column = this;
6886
+ api.Value.prototype.initialize.call( column, null, options );
6887
+ $.extend( column, options || {} );
6888
+
6889
+ column.isReady = $.Deferred();
6890
+ column.embedded = $.Deferred();
6891
+ column.czr_columnModuleCollection = new api.Value();
6892
+ column.czr_columnModuleCollection.set( column.modules );
6893
+ column.set( options );
6894
+ column.defautModuleModelInColumn = { id : '' };
6895
+
6896
+ api.consoleLog('column.sektion.contentRendered.state()', column.sektion.contentRendered.state() );
6897
+ column.sektion.contentRendered.done(function() {
6898
+ column.container = column.render();
6899
+ api.consoleLog('COLUMN CONTAINER?', column.container );
6900
+ column.embedded.resolve();
6901
+ });
6902
+ column.embedded.done(function() {
6903
+ column.mayBeInstantiateColumnModules();
6904
+ column.callbacks.add( function() { return column.columnReact.apply(column, arguments ); } );
6905
+ column.czr_columnModuleCollection.callbacks.add( function() { return column.columnModuleCollectionReact.apply( column, arguments ); } );
6906
+ api.CZR_Helpers.setupDOMListeners(
6907
+ column.column_event_map,//actions to execute
6908
+ { dom_el : column.container },//dom scope
6909
+ column//instance where to look for the cb methods
6910
+ );
6911
+ var syncCollectionControl = api.control(column.control_id).getSyncCollectionControl();
6912
+ api.consoleLog('////////////////////////////////////////////////////');
6913
+ api.consoleLog('column.container?', column.container);
6914
+ api.consoleLog('syncCollectionControl.syncSektionModule()', syncCollectionControl.syncSektionModule()() );
6915
+ api.consoleLog('////////////////////////////////////////////////////');
6916
+ syncCollectionControl.syncSektionModule().modsDragInstance.containers.push( $('.czr-module-collection-wrapper', column.container )[0] );
6917
+
6918
+ });
6919
+ },
6920
+ ready : function() {
6921
+ var column = this;
6922
+ column.isReady.resolve();
6923
+ column.sektion.module.updateColumnCollection( {column : column() });
6924
+ },
6925
+ mayBeInstantiateColumnModules : function() {
6926
+ var column = this,
6927
+ syncedCollectionControl = column.sektion.control.getSyncCollectionControl();
6928
+ $.when( syncedCollectionControl.moduleCollectionReady.promise() ).then(
6929
+ function() {
6930
+ _.each( column.czr_columnModuleCollection() , function( _mod ) {
6931
+ if ( syncedCollectionControl.czr_Module.has(_mod.id) )
6932
+ return;
6933
+ $.when( _.findWhere( syncedCollectionControl.czr_moduleCollection() , { id : _mod.id } ) ).done( function( module_candidate ) {
6934
+ if ( _.isUndefined( module_candidate) ||_.isEmpty( module_candidate ) ) {
6935
+ throw new Error( 'Module ' + _mod.id + ' was not found in the module collection.');
6936
+ }
6937
+ syncedCollectionControl.instantiateModule( module_candidate, {} ).ready();
6938
+ });
6939
+ } );
6940
+ },//done callback
6941
+ function() {},//fail callback
6942
+ function() {
6943
+ api.consoleLog( 'NOT SYNCHRONIZED YET');
6944
+ }
6945
+ );//.then()
6946
+ },
6947
+ render : function() {
6948
+ var column = this;
6949
+ $view = $( wp.template('czr-sektion-column')( {id: column.id}) );
6950
+ $view.appendTo( $('.czr-column-wrapper', column.sektion.container ) );
6951
+ return $view;
6952
+ },
6953
+ columnReact : function( to ,from ) {
6954
+ var column = this;
6955
+ this.sektion.module.updateColumnCollection( {column : to });
6956
+ }
6957
+ });//$.extend
6958
+ var CZRColumnMths = CZRColumnMths || {};
6959
+ $.extend( CZRColumnMths , {
6960
+ updateColumnModuleCollection : function( obj ) {
6961
+ var column = this,
6962
+ _current_collection = column.czr_columnModuleCollection();
6963
+ _new_collection = $.extend( true, [], _current_collection );
6964
+
6965
+ api.consoleLog('column.czr_columnModuleCollection()', column.czr_columnModuleCollection() );
6966
+ if ( _.has( obj, 'collection' ) ) {
6967
+ column.czr_columnModuleCollection.set(obj.collection);
6968
+ return;
6969
+ }
6970
+
6971
+ if ( ! _.has(obj, 'module') ) {
6972
+ throw new Error('updateColumnModuleCollection, no module provided in column ' + column.id + '. Aborting');
6973
+ }
6974
+ var module_ready_for_column_api = column.prepareModuleForColumnAPI( _.clone(obj.module) );
6975
+ if ( _.findWhere( _new_collection, { id : module_ready_for_column_api.id } ) ) {
6976
+ _.each( _current_collection , function( _elt, _ind ) {
6977
+ if ( _elt.id != module_ready_for_column_api.id )
6978
+ return;
6979
+ _new_collection[_ind] = module_ready_for_column_api;
6980
+ });
6981
+ }
6982
+ else {
6983
+ _new_collection.push(module_ready_for_column_api);
6984
+ }
6985
+ column.czr_columnModuleCollection.set( _new_collection );
6986
+ },
6987
+ columnModuleCollectionReact : function( to, from ) {
6988
+ var column = this,
6989
+ _current_column_model = column(),
6990
+ _new_column_model = _.clone( _current_column_model ),
6991
+ _new_module_collection = [];
6992
+
6993
+ _.each( to , function( _mod, _key ) {
6994
+ _new_module_collection[_key] = { id : _mod.id };
6995
+ });
6996
+ _new_column_model.modules = _new_module_collection;
6997
+ column.set( _new_column_model );
6998
+ },
6999
+ removeModuleFromColumnCollection : function( module ) {
7000
+ var column = this,
7001
+ _current_collection = column.czr_columnModuleCollection();
7002
+ _new_collection = $.extend( true, [], _current_collection );
7003
+
7004
+ _new_collection = _.filter( _new_collection, function( _mod ){
7005
+ return _mod.id != module.id;
7006
+ } );
7007
+ column.czr_columnModuleCollection.set( _new_collection );
7008
+ },
7009
+ prepareModuleForColumnAPI : function( module_candidate ) {
7010
+ if ( ! _.isObject( module_candidate ) ) {
7011
+ throw new Error('prepareModuleForColumnAPI : a module must be an object.');
7012
+ }
7013
+ var column = this,
7014
+ api_ready_module = {};
7015
+
7016
+ _.each( column.defautModuleModelInColumn, function( _value, _key ) {
7017
+ var _candidate_val = module_candidate[ _key ];
7018
+ switch( _key ) {
7019
+ case 'id' :
7020
+ if ( ! _.isString( _candidate_val ) || _.isEmpty( _candidate_val ) ) {
7021
+ throw new Error('prepareModuleForColumnAPI : a module id must a string not empty');
7022
+ }
7023
+ if ( ! column.sektion.module.moduleExistsInOneColumnMax( module_candidate.id ) ) {
7024
+ throw new Error('A module can not be embedded in more than one column at a time. Module ' + module_candidate.id + ' exists in several columns : ' + column.sektion.module.getModuleColumn( module_candidate.id ).join(',') );
7025
+ }
7026
+ api_ready_module[ _key ] = _candidate_val;
7027
+ break;
7028
+ }//switch
7029
+ });//each
7030
+ return api_ready_module;
7031
+ },
7032
+ getColumnModuleCollectionFromDom : function( old_col_id ) {
7033
+ var column = this,
7034
+ $_moduleWrapper = $('.czr-module-collection-wrapper', column.container ),
7035
+ _previous_column_collection = column.sektion.module.czr_Column( old_col_id ).czr_columnModuleCollection(),
7036
+ _new_collection = [];
7037
+
7038
+ api.consoleLog('in GET COLUMN MODULE COLLECTION FROM DOM', old_col_id, $_moduleWrapper, column.container );
7039
+
7040
+ $('.czr-single-module', $_moduleWrapper).each( function( _index ) {
7041
+ if ( ! _.isUndefined( _.findWhere( column.czr_columnModuleCollection(), { id: $(this).attr('data-module-id') } ) ) ) {
7042
+ _new_collection[_index] = _.findWhere( column.czr_columnModuleCollection(), { id: $(this).attr('data-module-id') } );
7043
+ return;
7044
+ }
7045
+
7046
+ var _module_obj = _.findWhere( _previous_column_collection, { id: $(this).attr('data-module-id') } );
7047
+ if ( ! _module_obj ) {
7048
+ throw new Error('The module : ' + $(this).attr('data-module-id') + ' was not found in the collection of its previous column ' + old_col_id );
7049
+ }
7050
+ _new_collection[_index] = column.prepareModuleForColumnAPI( _module_obj );
7051
+ });
7052
+
7053
+ if ( _.isEmpty( _new_collection ) ) {
7054
+ throw new Error('There was a problem when re-building the column module collection from the DOM in column : ' + column.id );
7055
+ }
7056
+ return _new_collection;
7057
+ }
7058
+ });//$.extend//extends api.Value
7059
+ var CZRSektionMths = CZRSektionMths || {};
7060
+
7061
+ $.extend( CZRSektionMths, {
7062
+
7063
+ toggleSekSettingsPanel : function( obj ) {
7064
+ var module = this;
7065
+ if ( 'pending' == api.czrSekSettingsPanelEmbedded.state() ) {
7066
+ $.when( module.renderSekSettingsPanel() ).done( function(){
7067
+ api.czrSekSettingsPanelEmbedded.resolve();
7068
+ });
7069
+ }
7070
+ api.czrModulePanelState.set( false );
7071
+
7072
+ api.czrSekSettingsPanelState.set( ! api.czrSekSettingsPanelState() );
7073
+ module.closeAllOtherSektions( $(obj.dom_event.currentTarget, obj.dom_el ) );
7074
+ },
7075
+ reactToSekSettingPanelState : function( expanded ) {
7076
+ $('body').toggleClass('czr-editing-sektion', expanded );
7077
+ },
7078
+ renderSekSettingsPanel : function() {
7079
+ var module = this,
7080
+ _tmpl = '';
7081
+ if ( 0 === $( '#tmpl-czr-sektion-settings-panel' ).length ) {
7082
+ throw new Error('No template found to render the sektion setting panel' );
7083
+ }
7084
+ try {
7085
+ _tmpl = wp.template( 'czr-sektion-settings-panel' )();
7086
+ }
7087
+ catch(e) {
7088
+ throw new Error('Error when parsing the template of the sektion setting panel' + e );
7089
+ }
7090
+ $('#widgets-left').after( $( _tmpl ) );
7091
+ }
7092
+ });//$.extend//extends api.CZRDynModule
7093
+
7094
+ var CZRSocialModuleMths = CZRSocialModuleMths || {};
7095
+
7096
+ $.extend( CZRSocialModuleMths, {
7097
+ initialize: function( id, options ) {
7098
+ var module = this;
7099
+ api.CZRDynModule.prototype.initialize.call( module, id, options );
7100
+ $.extend( module, {
7101
+ itemPreAddEl : 'czr-module-social-pre-add-view-content',
7102
+ itemInputList : 'czr-module-social-item-content'
7103
+ } );
7104
+
7105
+
7106
+ this.social_icons = [
7107
+ '500px','adn','amazon','android','angellist','apple','behance','behance-square','bitbucket','bitbucket-square','black-tie','btc','buysellads','chrome','codepen','codiepie','connectdevelop','contao','dashcube','delicious','delicious','deviantart','digg','dribbble','dropbox','drupal','edge','empire','expeditedssl','facebook','facebook','facebook-f (alias)','facebook-official','facebook-square','firefox','flickr','fonticons','fort-awesome','forumbee','foursquare','get-pocket','gg','gg-circle','git','github','github','github-alt','github-square','git-square','google','google','google-plus','google-plus-circle','google-plus-official','google-plus-square', 'google-wallet','gratipay','hacker-news','houzz','instagram','internet-explorer','ioxhost','joomla','jsfiddle','lastfm','lastfm-square','leanpub','linkedin','linkedin','linkedin-square','linux','maxcdn','meanpath','medium','mixcloud','modx','odnoklassniki','odnoklassniki-square','opencart','openid','opera','optin-monster','pagelines','paypal','pied-piper','pied-piper-alt','pinterest','pinterest-p','pinterest-square','product-hunt','qq','rebel','reddit','reddit-alien','reddit-square','renren','rss','rss-square','safari','scribd','sellsy','share-alt','share-alt-square','shirtsinbulk','simplybuilt','skyatlas','skype','slack','slideshare','snapchat', 'soundcloud','spotify','stack-exchange','stack-overflow','steam','steam-square','stumbleupon','stumbleupon','stumbleupon-circle', 'telegram', 'tencent-weibo','trello','tripadvisor','tumblr','tumblr-square','twitch','twitter','twitter','twitter-square','usb','viacoin','vimeo','vimeo-square','vine','vk','weibo','weixin','whatsapp','wikipedia-w','windows','wordpress','xing','xing-square','yahoo','yahoo','y-combinator','yelp','youtube','youtube-play','youtube-square'
7108
+ ];
7109
+ module.inputConstructor = api.CZRInput.extend( module.CZRSocialsInputMths || {} );
7110
+ module.itemConstructor = api.CZRItem.extend( module.CZRSocialsItem || {} );
7111
+ this.defaultItemModel = {
7112
+ id : '',
7113
+ title : '' ,
7114
+ 'social-icon' : '',
7115
+ 'social-link' : '',
7116
+ 'social-color' : serverControlParams.social_el_params.defaultSocialColor,
7117
+ 'social-target' : 1
7118
+ };
7119
+ this.itemAddedMessage = serverControlParams.translatedStrings.socialLinkAdded;
7120
+ if ( _.has( api, 'czr_activeSectionId' ) && module.control.section() == api.czr_activeSectionId() && 'resolved' != module.isReady.state() ) {
7121
+ module.ready();
7122
+ }
7123
+ api.section( module.control.section() ).expanded.bind(function(to) {
7124
+ if ( 'resolved' == module.isReady.state() )
7125
+ return;
7126
+ module.ready();
7127
+ });
7128
+
7129
+ module.isReady.then( function() {
7130
+ module.preItem.bind( function( to, from ) {
7131
+ if ( ! _.has(to, 'social-icon') )
7132
+ return;
7133
+ if ( _.isEqual( to['social-icon'], from['social-icon'] ) )
7134
+ return;
7135
+ module.updateItemModel( module.preItem, true );
7136
+ });
7137
+ });
7138
+ },//initialize
7139
+ updateItemModel : function( item_instance, is_preItem ) {
7140
+ var item = item_instance;
7141
+ is_preItem = is_preItem || false;
7142
+ if ( ! _.has( item(), 'social-icon') || _.isEmpty( item()['social-icon'] ) )
7143
+ return;
7144
+
7145
+ var _new_model = $.extend( true, {}, item() ),//always safer to deep clone ( alternative to _.clone() ) => we don't know how nested this object might be in the future.
7146
+ _new_title = api.CZR_Helpers.capitalize( _new_model['social-icon'].replace('fa-', '') ),
7147
+ _new_color = serverControlParams.social_el_params.defaultSocialColor;
7148
+ _new_title = [ serverControlParams.translatedStrings.followUs, _new_title].join(' ');
7149
+
7150
+ if ( is_preItem ) {
7151
+ _new_model = $.extend( _new_model, { title : _new_title, 'social-color' : _new_color } );
7152
+ item.set( _new_model );
7153
+ } else {
7154
+ item.czr_Input('title').set( _new_title );
7155
+ item.czr_Input('social-link').set( '' );
7156
+ item.czr_Input('social-color').set( _new_color );
7157
+ }
7158
+ },
7159
+
7160
+
7161
+
7162
+
7163
+
7164
+
7165
+
7166
+
7167
+
7168
+ CZRSocialsInputMths : {
7169
+ setupSelect : function() {
7170
+ var input = this,
7171
+ item = input.item,
7172
+ module = input.module,
7173
+ socialList = module.social_icons,
7174
+ _model = item();
7175
+ if ( _.isEmpty(_model.id) ) {
7176
+ socialList = _.union( [serverControlParams.translatedStrings.selectSocialIcon], socialList );
7177
+ }
7178
+ _.each( socialList , function( icon_name, k ) {
7179
+ var _value = ( 0 === k ) ? '' : 'fa-' + icon_name.toLowerCase(),
7180
+ _attributes = {
7181
+ value : _value,
7182
+ html: api.CZR_Helpers.capitalize(icon_name)
7183
+ };
7184
+ if ( _value == _model['social-icon'] )
7185
+ $.extend( _attributes, { selected : "selected" } );
7186
+
7187
+ $( 'select[data-type="social-icon"]', input.container ).append( $('<option>', _attributes) );
7188
+ });
7189
+
7190
+ function addIcon( state ) {
7191
+ if (! state.id) { return state.text; }
7192
+ var $state = $(
7193
+ '<span class="fa ' + state.element.value.toLowerCase() + '">&nbsp;&nbsp;' + state.text + '</span>'
7194
+ );
7195
+ return $state;
7196
+ }
7197
+ $( 'select[data-type="social-icon"]', input.container ).select2( {
7198
+ templateResult: addIcon,
7199
+ templateSelection: addIcon
7200
+ });
7201
+ },
7202
+
7203
+ setupIcheck : function( obj ) {
7204
+ var input = this;
7205
+
7206
+ $( 'input[type=checkbox]', input.container ).each( function(e) {
7207
+ if ( 0 !== $(this).closest('div[class^="icheckbox"]').length )
7208
+ return;
7209
+
7210
+ $(this).iCheck({
7211
+ checkboxClass: 'icheckbox_flat-grey',
7212
+ checkedClass: 'checked',
7213
+ radioClass: 'iradio_flat-grey',
7214
+ })
7215
+ .on( 'ifChanged', function(e){
7216
+ $(this).val( false === $(this).is(':checked') ? 0 : 1 );
7217
+ $(e.currentTarget).trigger('change');
7218
+ });
7219
+ });
7220
+ },
7221
+
7222
+ setupColorPicker : function( obj ) {
7223
+ var input = this,
7224
+ item = input.item,
7225
+ module = input.module;
7226
+
7227
+ $( 'input[data-type="social-color"]', input.container ).wpColorPicker( {
7228
+ defaultColor : 'rgba(255,255,255,0.7)',
7229
+ change : function( e, o ) {
7230
+ if ( _.has(o, 'color') && 16777215 == o.color._color )
7231
+ $(this).val( 'rgba(255,255,255,0.7)' );
7232
+ else
7233
+ $(this).val( o.color.toString() );
7234
+
7235
+ $(this).trigger('colorpickerchange').trigger('change');
7236
+ }
7237
+ });
7238
+ $( 'input[data-type="social-color"]', input.container ).closest('div').on('click keydown', function() {
7239
+ module._adjustScrollExpandedBlock( input.container );
7240
+ });
7241
+ }
7242
+
7243
+ },//CZRSocialsInputMths
7244
+
7245
+
7246
+
7247
+
7248
+
7249
+
7250
+
7251
+
7252
+
7253
+ CZRSocialsItem : {
7254
+ ready : function() {
7255
+ var item = this;
7256
+ api.CZRItem.prototype.ready.call( item );
7257
+ item.bind('social-icon:changed', function(){
7258
+ item.module.updateItemModel( item );
7259
+ });
7260
+ },
7261
+
7262
+
7263
+ _buildTitle : function( title, icon, color ) {
7264
+ var item = this,
7265
+ module = item.module;
7266
+
7267
+ title = title || ( 'string' === typeof(icon) ? api.CZR_Helpers.capitalize( icon.replace( 'fa-', '') ) : '' );
7268
+ title = api.CZR_Helpers.truncate(title, 20);
7269
+ icon = icon || 'fa-' + module.social_icons[0];
7270
+ color = color || serverControlParams.social_el_params.defaultSocialColor;
7271
+
7272
+ return '<div><span class="fa ' + icon + '" style="color:' + color + '"></span> ' + title + '</div>';
7273
+ },
7274
+ writeItemViewTitle : function( model ) {
7275
+ var item = this,
7276
+ module = item.module,
7277
+ _model = model || item(),
7278
+ _title = api.CZR_Helpers.capitalize( _model['social-icon'].replace('fa-', '') );
7279
+
7280
+ $( '.' + module.control.css_attr.item_title , item.container ).html(
7281
+ item._buildTitle( _title, _model['social-icon'], _model['social-color'] )
7282
+ );
7283
+ }
7284
+ },//CZRSocialsItem
7285
+
7286
+ });
7287
+
7288
+ var CZRWidgetAreaModuleMths = CZRWidgetAreaModuleMths || {};
7289
+
7290
+ $.extend( CZRWidgetAreaModuleMths, {
7291
+ initialize: function( id, constructorOptions ) {
7292
+ var module = this;
7293
+
7294
+ api.CZRDynModule.prototype.initialize.call( this, id, constructorOptions );
7295
+ $.extend( module, {
7296
+ itemPreAddEl : 'czr-module-widgets-pre-add-view-content',
7297
+ itemInputList : 'czr-module-widgets-item-input-list',
7298
+ itemInputListReduced : 'czr-module-widgets-item-input-list-reduced',
7299
+ ruItemPart : 'czr-module-widgets-ru-item-part'
7300
+ } );
7301
+ module.inputConstructor = api.CZRInput.extend( module.CZRWZonesInputMths || {} );
7302
+ module.itemConstructor = api.CZRItem.extend( module.CZRWZonesItem || {} );
7303
+
7304
+ module.serverParams = serverControlParams.widget_area_el_params || {};
7305
+ module.contexts = _.has( module.serverParams , 'sidebar_contexts') ? module.serverParams.sidebar_contexts : {};
7306
+ module.context_match_map = {
7307
+ is_404 : '404',
7308
+ is_category : 'archive-category',
7309
+ is_home : 'home',
7310
+ is_page : 'page',
7311
+ is_search : 'search',
7312
+ is_single : 'single'
7313
+ };
7314
+
7315
+
7316
+ module.locations = _.has( module.serverParams , 'sidebar_locations') ? module.serverParams.sidebar_locations : {};
7317
+ module.defaultItemModel = {
7318
+ id : '',
7319
+ title : serverControlParams.translatedStrings.widgetZone,
7320
+ contexts : _.without( _.keys(module.contexts), '_all_' ),//the server list of contexts is an object, we only need the keys, whitout _all_
7321
+ locations : [ module.serverParams.defaultWidgetLocation ],
7322
+ description : ''
7323
+ };
7324
+ this.itemAddedMessage = serverControlParams.translatedStrings.widgetZoneAdded;
7325
+ this.listenToSidebarInsights();
7326
+ api.czr_widgetZoneSettings.bind( function( updated_data_sent_from_preview , from ) {
7327
+ module.isReady.then( function() {
7328
+ _.each( updated_data_sent_from_preview, function( _data, _key ) {
7329
+ api.sidebar_insights( _key ).set( _data );
7330
+ });
7331
+ });
7332
+ });
7333
+ module.preItem_location_alert_view_state = new api.Value( 'closed');
7334
+ module.preItem_location_alert_view_state.callbacks.add( function( to, from ) {
7335
+ module._toggleLocationAlertExpansion( module.container, to );
7336
+ });
7337
+ module.bind( 'item_added', function( model ) {
7338
+ module.addWidgetSidebar( model );
7339
+ });
7340
+
7341
+ module.bind( 'pre_item_api_remove' , function(model) {
7342
+ module.removeWidgetSidebar( model );
7343
+ });
7344
+ var fixTopMargin = new api.Values();
7345
+ fixTopMargin.create('fixed_for_current_session');
7346
+ fixTopMargin.create('value');
7347
+
7348
+ api.section(module.serverParams.dynWidgetSection).fixTopMargin = fixTopMargin;
7349
+ api.section(module.serverParams.dynWidgetSection).fixTopMargin('fixed_for_current_session').set(false);
7350
+ api.panel('widgets').expanded.callbacks.add( function(to, from) {
7351
+ module.widgetPanelReact();//setup some visual adjustments, must be ran each time panel is closed or expanded
7352
+ if ( 'resolved' == module.isReady.state() )
7353
+ return;
7354
+ module.ready();
7355
+ });
7356
+ },//initialize
7357
+ ready : function() {
7358
+ var module = this;
7359
+ api.CZRDynModule.prototype.ready.call( module );
7360
+ module.preItemExpanded.callbacks.add( function( to, from ) {
7361
+ if ( ! to )
7362
+ return;
7363
+ module.preItem.czr_Input('locations')._setupLocationSelect( true );//true for refresh
7364
+ module.preItem.czr_Input('locations').mayBeDisplayModelAlert();
7365
+ });
7366
+ },
7367
+ initializeModuleModel : function( constructorOptions ) {
7368
+ var module = this;
7369
+ constructorOptions.items = _.union( _.has( module.serverParams, 'default_zones' ) ? module.serverParams.default_zones : [], constructorOptions.items );
7370
+ return constructorOptions;
7371
+ },
7372
+
7373
+
7374
+
7375
+
7376
+
7377
+
7378
+
7379
+
7380
+
7381
+
7382
+
7383
+
7384
+
7385
+
7386
+
7387
+
7388
+ CZRWZonesInputMths : {
7389
+ ready : function() {
7390
+ var input = this;
7391
+
7392
+ input.bind('locations:changed', function(){
7393
+ input.mayBeDisplayModelAlert();
7394
+ });
7395
+
7396
+ api.CZRInput.prototype.ready.call( input);
7397
+ },
7398
+ setupSelect : function() {
7399
+ var input = this;
7400
+ if ( 'locations' == this.id )
7401
+ this._setupLocationSelect();
7402
+ if ( 'contexts' == this.id )
7403
+ this._setupContextSelect();
7404
+
7405
+ },
7406
+ _setupContextSelect : function() {
7407
+ var input = this,
7408
+ input_contexts = input(),
7409
+ item = input.item,
7410
+ module = input.module;
7411
+ _.each( module.contexts, function( title, key ) {
7412
+ var _attributes = {
7413
+ value : key,
7414
+ html: title
7415
+ };
7416
+ if ( key == input_contexts || _.contains( input_contexts, key ) )
7417
+ $.extend( _attributes, { selected : "selected" } );
7418
+
7419
+ $( 'select[data-type="contexts"]', input.container ).append( $('<option>', _attributes) );
7420
+ });
7421
+ $( 'select[data-type="contexts"]', input.container ).select2();
7422
+ },
7423
+ _setupLocationSelect : function(refresh ) {
7424
+ var input = this,
7425
+ input_locations = input(),
7426
+ item = input.item,
7427
+ module = input.module,
7428
+ available_locs = api.sidebar_insights('available_locations')();
7429
+ if ( ! $( 'select[data-type="locations"]', input.container ).children().length ) {
7430
+ _.each( module.locations, function( title, key ) {
7431
+ var _attributes = {
7432
+ value : key,
7433
+ html: title
7434
+ };
7435
+
7436
+ if ( key == input_locations || _.contains( input_locations, key ) )
7437
+ $.extend( _attributes, { selected : "selected" } );
7438
+
7439
+ $( 'select[data-type="locations"]', input.container ).append( $('<option>', _attributes) );
7440
+ });
7441
+ }//if
7442
+
7443
+ function setAvailability( state ) {
7444
+ if (! state.id) { return state.text; }
7445
+ if ( _.contains(available_locs, state.element.value) ) { return state.text; }
7446
+ var $state = $(
7447
+ '<span class="czr-unavailable-location fa fa-ban" title="' + serverControlParams.translatedStrings.unavailableLocation + '">&nbsp;&nbsp;' + state.text + '</span>'
7448
+ );
7449
+ return $state;
7450
+ }
7451
+
7452
+ if ( refresh ) {
7453
+ $( 'select[data-type="locations"]', input.container ).select2( 'destroy' );
7454
+ }
7455
+ $( 'select[data-type="locations"]', input.container ).select2( {
7456
+ templateResult: setAvailability,
7457
+ templateSelection: setAvailability
7458
+ });
7459
+ },
7460
+ mayBeDisplayModelAlert : function() {
7461
+ var input = this,
7462
+ item = input.item,
7463
+ module = input.module;
7464
+ if ( ! _.has( item(), 'locations') || _.isEmpty( item().locations ) )
7465
+ return;
7466
+
7467
+ var _selected_locations = $('select[data-type="locations"]', input.container ).val(),
7468
+ available_locs = api.sidebar_insights('available_locations')(),
7469
+ _unavailable = _.filter( _selected_locations, function( loc ) {
7470
+ return ! _.contains(available_locs, loc);
7471
+ });
7472
+ if ( ! _.has( item(), 'id' ) || _.isEmpty( item().id ) ) {
7473
+ module.preItem_location_alert_view_state.set( ! _.isEmpty( _unavailable ) ? 'expanded' : 'closed' );
7474
+ } else {
7475
+ item.czr_itemLocationAlert.set( ! _.isEmpty( _unavailable ) ? 'expanded' : 'closed' );
7476
+ }
7477
+ }
7478
+ },//CZRWZonesInputMths
7479
+
7480
+
7481
+
7482
+
7483
+
7484
+
7485
+
7486
+
7487
+
7488
+
7489
+
7490
+
7491
+
7492
+
7493
+
7494
+ CZRWZonesItem : {
7495
+ initialize : function( id, options ) {
7496
+ var item = this,
7497
+ module = item.module;
7498
+ item.czr_itemLocationAlert = new api.Value();
7499
+
7500
+ api.CZRItem.prototype.initialize.call( item, null, options );
7501
+ },
7502
+ itemWrapperViewSetup : function() {
7503
+ var item = this,
7504
+ module = item.module;
7505
+
7506
+ api.CZRItem.prototype.itemWrapperViewSetup.call(item);
7507
+ item.czr_itemLocationAlert.set('closed');
7508
+ item.czr_itemLocationAlert.callbacks.add( function( to, from ) {
7509
+ module._toggleLocationAlertExpansion( item.container , to );
7510
+ });
7511
+ item.writeSubtitleInfos(item());
7512
+ item.czr_ItemState.callbacks.add( function( to, from ) {
7513
+ if ( -1 == to.indexOf('expanded') )//can take the expanded_noscroll value !
7514
+ return;
7515
+ item.contentRendered.then( function() {
7516
+ item.czr_Input('locations')._setupLocationSelect( true );//true for refresh
7517
+ item.czr_Input('locations').mayBeDisplayModelAlert();
7518
+ });
7519
+
7520
+ });
7521
+ },
7522
+ itemReact : function(to, from) {
7523
+ var item = this;
7524
+ api.CZRItem.prototype.itemReact.call(item, to, from);
7525
+
7526
+ item.writeSubtitleInfos(to);
7527
+ item.updateSectionTitle(to).setModelUpdateTimer();
7528
+ },
7529
+ writeSubtitleInfos : function(model) {
7530
+ var item = this,
7531
+ module = item.module,
7532
+ _model = _.clone( model || item() ),
7533
+ _locations = [],
7534
+ _contexts = [],
7535
+ _html = '';
7536
+
7537
+ if ( ! item.container.length )
7538
+ return this;
7539
+ _model.locations =_.isString(_model.locations) ? [_model.locations] : _model.locations;
7540
+ _.each( _model.locations, function( loc ) {
7541
+ if ( _.has( module.locations , loc ) )
7542
+ _locations.push(module.locations[loc]);
7543
+ else
7544
+ _locations.push(loc);
7545
+ }
7546
+ );
7547
+ _model.contexts =_.isString(_model.contexts) ? [_model.contexts] : _model.contexts;
7548
+ if ( item._hasModelAllContexts( model ) ) {
7549
+ _contexts.push(module.contexts._all_);
7550
+ } else {
7551
+ _.each( _model.contexts, function( con ) {
7552
+ if ( _.has( module.contexts , con ) )
7553
+ _contexts.push(module.contexts[con]);
7554
+ else
7555
+ _contexts.push(con);
7556
+ }
7557
+ );
7558
+ }
7559
+ var _locationText = serverControlParams.translatedStrings.locations,
7560
+ _contextText = serverControlParams.translatedStrings.contexts,
7561
+ _notsetText = serverControlParams.translatedStrings.notset;
7562
+
7563
+ _locations = _.isEmpty( _locations ) ? '<span style="font-weight: bold;">' + _notsetText + '</span>' : _locations.join(', ');
7564
+ _contexts = _.isEmpty( _contexts ) ? '<span style="font-weight: bold;">' + _notsetText + '</span>' : _contexts.join(', ');
7565
+
7566
+ _html = '<u>' + _locationText + '</u> : ' + _locations + ' <strong>|</strong> <u>' + _contextText + '</u> : ' + _contexts;
7567
+
7568
+ if ( ! $('.czr-zone-infos', item.container ).length ) {
7569
+ var $_zone_infos = $('<div/>', {
7570
+ class : [ 'czr-zone-infos' , module.control.css_attr.item_sort_handle ].join(' '),
7571
+ html : _html
7572
+ });
7573
+ $( '.' + module.control.css_attr.item_btns, item.container ).after($_zone_infos);
7574
+ } else {
7575
+ $('.czr-zone-infos', item.container ).html(_html);
7576
+ }
7577
+
7578
+ return this;
7579
+ },//writeSubtitleInfos
7580
+ updateSectionTitle : function(model) {
7581
+ var _sidebar_id = 'sidebar-widgets-' + model.id,
7582
+ _new_title = model.title;
7583
+ if ( ! api.section.has(_sidebar_id) )
7584
+ return this;
7585
+ $('.accordion-section-title', api.section(_sidebar_id).container ).text(_new_title);
7586
+ $('.customize-section-title h3', api.section(_sidebar_id).container ).html(
7587
+ '<span class="customize-action">' + api.section(_sidebar_id).params.customizeAction + '</span>' + _new_title
7588
+ );
7589
+ return this;
7590
+ },
7591
+ setModelUpdateTimer : function() {
7592
+ var item = this,
7593
+ module = item.module;
7594
+
7595
+ clearTimeout( $.data(this, 'modelUpdateTimer') );
7596
+ $.data(
7597
+ this,
7598
+ 'modelUpdateTimer',
7599
+ setTimeout( function() {
7600
+ module.control.refreshPreview();
7601
+ } , 1000)
7602
+ );//$.data
7603
+ },
7604
+ _hasModelAllContexts : function( model ) {
7605
+ var item = this,
7606
+ module = item.module,
7607
+ moduleContexts = _.keys(module.contexts);
7608
+
7609
+ model = model || this();
7610
+
7611
+ if ( ! _.has(model, 'contexts') )
7612
+ return;
7613
+
7614
+ if ( _.contains( model.contexts, '_all_') )
7615
+ return true;
7616
+ return _.isEmpty( _.difference( _.without(moduleContexts, '_all_') , model.contexts ) );
7617
+ },
7618
+ _getMatchingContexts : function( defaults ) {
7619
+ var module = this,
7620
+ _current = api.czr_wp_conditionals() || {},
7621
+ _matched = _.filter(module.context_match_map, function( hu, wp ) { return true === _current[wp]; });
7622
+
7623
+ return _.isEmpty( _matched ) ? defaults : _matched;
7624
+
7625
+ }
7626
+ },//CZRWZonesItem
7627
+ addWidgetSidebar : function( model, sidebar_data ) {
7628
+ if ( ! _.isObject(model) && _.isEmpty(sidebar_data) ) {
7629
+ throw new Error('No valid input were provided to add a new Widget Zone.');
7630
+ }
7631
+ var module = this,
7632
+ _model = ! _.isEmpty(model) ? _.clone(model) : sidebar_data,
7633
+ _new_sidebar = _.isEmpty(model) ? sidebar_data : $.extend(
7634
+ _.clone( _.findWhere( api.Widgets.data.registeredSidebars, { id: module.serverParams.defaultWidgetSidebar } ) ),
7635
+ {
7636
+ name : _model.title,
7637
+ id : _model.id
7638
+ }
7639
+ );
7640
+ api.Widgets.registeredSidebars.add( _new_sidebar );
7641
+ var _params = $.extend(
7642
+ _.clone( api.section( "sidebar-widgets-" + module.serverParams.defaultWidgetSidebar ).params ),
7643
+ {
7644
+ id : "sidebar-widgets-" + _model.id,
7645
+ instanceNumber: _.max(api.settings.sections, function(sec){ return sec.instanceNumber; }).instanceNumber + 1,
7646
+ sidebarId: _new_sidebar.id,
7647
+ title: _new_sidebar.name,
7648
+ description : 'undefined' != typeof(sidebar_data) ? sidebar_data.description : api.section( "sidebar-widgets-" + module.serverParams.defaultWidgetSidebar ).params.description,
7649
+ priority: _.max( _.omit( api.settings.sections, module.serverParams.dynWidgetSection), function(sec){ return sec.instanceNumber; }).priority + 1,
7650
+ }
7651
+ );
7652
+
7653
+ api.section.add( _params.id, new api.sectionConstructor[ _params.type ]( _params.id ,{ params : _params } ) );
7654
+ api.settings.sections[ _params.id ] = _params.id;
7655
+ var _new_set_id = 'sidebars_widgets['+_model.id+']',
7656
+ _new_set = $.extend(
7657
+ _.clone( api.settings.settings['sidebars_widgets[' + module.serverParams.defaultWidgetSidebar + ']'] ),
7658
+ {
7659
+ value:[]
7660
+ }
7661
+ );
7662
+ api.settings.settings[ _new_set_id ] = _new_set;
7663
+ api.create( _new_set_id, _new_set_id, _new_set.value, {
7664
+ transport: _new_set.transport,
7665
+ previewer: api.previewer,
7666
+ dirty: false
7667
+ } );
7668
+ var _cloned_control = $.extend(
7669
+ _.clone( api.settings.controls['sidebars_widgets[' + module.serverParams.defaultWidgetSidebar + ']'] ),
7670
+ {
7671
+ settings : { default : _new_set_id }
7672
+ }),
7673
+ _new_control = {};
7674
+ _.each( _cloned_control, function( param, key ) {
7675
+ if ( 'string' == typeof(param) ) {
7676
+ param = param.replace( module.serverParams.defaultWidgetSidebar , _model.id );
7677
+ }
7678
+ _new_control[key] = param;
7679
+ });
7680
+ _new_control.instanceNumber = _.max(api.settings.controls, function(con){ return con.instanceNumber; }).instanceNumber + 1;
7681
+ api.settings.controls[_new_set_id] = _new_control;
7682
+ api.control.add( _new_set_id, new api.controlConstructor[ _new_control.type ]( _new_set_id, {
7683
+ params: _new_control,
7684
+ previewer: api.previewer
7685
+ } ) );
7686
+ if ( _.has(this, 'container') )
7687
+ this.container.trigger( 'widget_zone_created', { model : _model, section_id : "sidebar-widgets-" + _model.id , setting_id : _new_set_id });
7688
+
7689
+ },//addWidgetSidebar
7690
+ removeWidgetSidebar : function( model ) {
7691
+ var module = this;
7692
+ if ( ! _.isObject(model) || _.isEmpty(model) ) {
7693
+ throw new Error('No valid data were provided to remove a Widget Zone.');
7694
+ }
7695
+ api.Widgets.registeredSidebars.remove( model.id );
7696
+ if ( api.section.has("sidebar-widgets-" + model.id) ) {
7697
+ api.section("sidebar-widgets-" + model.id).container.remove();
7698
+ api.section.remove( "sidebar-widgets-" + model.id );
7699
+ delete api.settings.sections[ "sidebar-widgets-" + model.id ];
7700
+ }
7701
+ if ( api.has('sidebars_widgets['+model.id+']') ) {
7702
+ api.remove( 'sidebars_widgets['+model.id+']' );
7703
+ delete api.settings.settings['sidebars_widgets['+model.id+']'];
7704
+ }
7705
+ if ( api.control.has('sidebars_widgets['+model.id+']') ) {
7706
+ api.control( 'sidebars_widgets['+model.id+']' ).container.remove();
7707
+ api.control.remove( 'sidebars_widgets['+model.id+']' );
7708
+ delete api.settings.controls['sidebars_widgets['+model.id+']'];
7709
+ }
7710
+ var _refresh = function() {
7711
+ api.previewer.refresh();
7712
+ };
7713
+ _refresh = _.debounce( _refresh, 500 );
7714
+ $.when( _refresh() ).done( function() {
7715
+ module.trigger( 'widget_zone_removed',
7716
+ {
7717
+ model : model,
7718
+ section_id : "sidebar-widgets-" + model.id ,
7719
+ setting_id : 'sidebars_widgets['+model.id+']'
7720
+ }
7721
+ );
7722
+ });
7723
+
7724
+
7725
+ },
7726
+ widgetPanelReact : function() {
7727
+ var module = this;
7728
+ var _top_margin = api.panel('widgets').container.find( '.control-panel-content' ).css('margin-top');
7729
+ api.section(module.serverParams.dynWidgetSection).fixTopMargin('value').set( _top_margin );
7730
+
7731
+ var _section_content = api.section(module.serverParams.dynWidgetSection).container.find( '.accordion-section-content' ),
7732
+ _panel_content = api.panel('widgets').container.find( '.control-panel-content' ),
7733
+ _set_margins = function() {
7734
+ _section_content.css( 'margin-top', '' );
7735
+ _panel_content.css('margin-top', api.section(module.serverParams.dynWidgetSection).fixTopMargin('value')() );
7736
+ };
7737
+ api.bind( 'pane-contents-reflowed', _.debounce( function() {
7738
+ _set_margins();
7739
+ }, 150 ) );
7740
+ module.closeAllItems();
7741
+ if ( _.has( module, 'preItemExpanded' ) )
7742
+ module.preItemExpanded.set(false);
7743
+ },//widgetPanelReact()
7744
+ widgetSectionReact : function( to, from ) {
7745
+ var module = this,
7746
+ section = api.section(module.serverParams.dynWidgetSection),
7747
+ container = section.container.closest( '.wp-full-overlay-sidebar-content' ),
7748
+ content = section.container.find( '.accordion-section-content' ),
7749
+ overlay = section.container.closest( '.wp-full-overlay' ),
7750
+ backBtn = section.container.find( '.customize-section-back' ),
7751
+ sectionTitle = section.container.find( '.accordion-section-title' ).first(),
7752
+ headerActionsHeight = $( '#customize-header-actions' ).height(),
7753
+ resizeContentHeight, expand, position, scroll;
7754
+
7755
+ if ( to ) {
7756
+ overlay.removeClass( 'section-open' );
7757
+ content.css( 'height', 'auto' );
7758
+ sectionTitle.attr( 'tabindex', '0' );
7759
+ content.css( 'margin-top', '' );
7760
+ container.scrollTop( 0 );
7761
+ }
7762
+
7763
+ module.closeAllItems();
7764
+
7765
+ content.slideToggle();
7766
+ },
7767
+ listenToSidebarInsights : function() {
7768
+ var module = this;
7769
+ api.sidebar_insights('registered').callbacks.add( function( _registered_zones ) {
7770
+ var _current_collection = _.clone( module.itemCollection() );
7771
+ _.map(_current_collection, function( _model ) {
7772
+ if ( ! module.getViewEl(_model.id).length )
7773
+ return;
7774
+
7775
+ module.getViewEl(_model.id).css('display' , _.contains( _registered_zones, _model.id ) ? 'block' : 'none' );
7776
+ });
7777
+ });
7778
+ api.sidebar_insights('inactives').callbacks.add( function( _inactives_zones ) {
7779
+ var _current_collection = _.clone( module.itemCollection() );
7780
+ _.map(_current_collection, function( _model ) {
7781
+ if ( ! module.getViewEl(_model.id).length )
7782
+ return;
7783
+
7784
+ if ( _.contains( _inactives_zones, _model.id ) ) {
7785
+ module.getViewEl( _model.id ).addClass('inactive');
7786
+ if ( ! module.getViewEl( _model.id ).find('.czr-inactive-alert').length )
7787
+ module.getViewEl( _model.id ).find('.czr-item-title').append(
7788
+ $('<span/>', {class : "czr-inactive-alert", html : " [ " + serverControlParams.translatedStrings.inactiveWidgetZone + " ]" })
7789
+ );
7790
+ }
7791
+ else {
7792
+ module.getViewEl( _model.id ).removeClass('inactive');
7793
+ if ( module.getViewEl( _model.id ).find('.czr-inactive-alert').length )
7794
+ module.getViewEl( _model.id ).find('.czr-inactive-alert').remove();
7795
+ }
7796
+ });
7797
+ });
7798
+ api.sidebar_insights('candidates').callbacks.add( function(_candidates) {
7799
+ if ( ! _.isArray(_candidates) )
7800
+ return;
7801
+ _.map( _candidates, function( _sidebar ) {
7802
+ if ( ! _.isObject(_sidebar) )
7803
+ return;
7804
+ if ( api.section.has("sidebar-widgets-" +_sidebar.id ) )
7805
+ return;
7806
+ module.addWidgetSidebar( {}, _sidebar );
7807
+ if ( _.has( api.sidebar_insights('actives')(), _sidebar.id ) && api.section.has("sidebar-widgets-" +_sidebar.id ) )
7808
+ api.section( "sidebar-widgets-" +_sidebar.id ).activate();
7809
+ });
7810
+ });
7811
+ },//listenToSidebarInsights()
7812
+ _adjustScrollExpandedBlock : function( $_block_el, adjust ) {
7813
+ if ( ! $_block_el.length )
7814
+ return;
7815
+ var module = this,
7816
+ _currentScrollTopVal = $('.wp-full-overlay-sidebar-content').scrollTop(),
7817
+ _scrollDownVal,
7818
+ _adjust = adjust || 90;
7819
+ setTimeout( function() {
7820
+ if ( ( $_block_el.offset().top + $_block_el.height() + _adjust ) > $(window.top).height() ) {
7821
+ _scrollDownVal = $_block_el.offset().top + $_block_el.height() + _adjust - $(window.top).height();
7822
+ $('.wp-full-overlay-sidebar-content').animate({
7823
+ scrollTop: _currentScrollTopVal + _scrollDownVal
7824
+ }, 600);
7825
+ }
7826
+ }, 50);
7827
+ },
7828
+ getDefaultModel : function(id) {
7829
+ var module = this,
7830
+ _current_collection = module.itemCollection(),
7831
+ _default = _.clone( module.defaultItemModel ),
7832
+ _default_contexts = _default.contexts;
7833
+ return $.extend( _default, {
7834
+ title : 'Widget Zone ' + ( _.size(_current_collection)*1 + 1 )
7835
+ });
7836
+ },
7837
+ getTemplateEl : function( type, item_model ) {
7838
+ var module = this, _el;
7839
+ if ( 'rudItemPart' == type ) {
7840
+ type = ( _.has(item_model, 'is_builtin') && item_model.is_builtin ) ? 'ruItemPart' : type;
7841
+ } else if ( 'itemInputList' == type ) {
7842
+ type = ( _.has(item_model, 'is_builtin') && item_model.is_builtin ) ? 'itemInputListReduced' : type;
7843
+ }
7844
+
7845
+ switch(type) {
7846
+ case 'rudItemPart' :
7847
+ _el = module.rudItemPart;
7848
+ break;
7849
+ case 'ruItemPart' :
7850
+ _el = module.ruItemPart;
7851
+ break;
7852
+ case 'itemInputList' :
7853
+ _el = module.itemInputList;
7854
+ break;
7855
+ case 'itemInputListReduced' :
7856
+ _el = module.itemInputListReduced;
7857
+ break;
7858
+ }
7859
+
7860
+ if ( _.isEmpty(_el) ) {
7861
+ throw new Error( 'No valid template has been found in getTemplateEl()' );
7862
+ } else {
7863
+ return _el;
7864
+ }
7865
+ },
7866
+
7867
+
7868
+
7869
+
7870
+
7871
+
7872
+ _toggleLocationAlertExpansion : function($view, to) {
7873
+ var $_alert_el = $view.find('.czr-location-alert');
7874
+
7875
+ if ( ! $_alert_el.length ) {
7876
+ var _html = [
7877
+ '<span>' + serverControlParams.translatedStrings.locationWarning + '</span>',
7878
+ api.CZR_Helpers.getDocSearchLink( serverControlParams.translatedStrings.locationWarning ),
7879
+ ].join('');
7880
+
7881
+ $_alert_el = $('<div/>', {
7882
+ class:'czr-location-alert',
7883
+ html:_html,
7884
+ style:"display:none"
7885
+ });
7886
+
7887
+ $('select[data-type="locations"]', $view ).closest('div').after($_alert_el);
7888
+ }
7889
+ $_alert_el.toggle( 'expanded' == to);
7890
+ }
7891
+
7892
+
7893
+ });//$.extend()//extends api.CZRDynModule
7894
+
7895
+ var CZRFeaturedPageModuleMths = CZRFeaturedPageModuleMths || {};
7896
+
7897
+ $.extend( CZRFeaturedPageModuleMths, {
7898
+ initialize: function( id, options ) {
7899
+ var module = this;
7900
+ api.CZRDynModule.prototype.initialize.call( module, id, options );
7901
+ $.extend( module, {
7902
+ itemPreAddEl : 'czr-module-fp-pre-add-view-content',
7903
+ itemInputList : 'czr-module-fp-view-content'
7904
+ } );
7905
+ module.inputConstructor = api.CZRInput.extend( module.CZRFeaturedPagesInputMths || {} );
7906
+ module.itemConstructor = api.CZRItem.extend( module.CZRFeaturedPagesItem || {} );
7907
+ this.defaultItemModel = {
7908
+ id : '',
7909
+ title : '' ,
7910
+ 'fp-post' : '',
7911
+ 'fp-title' : '',
7912
+ 'fp-text' : '',
7913
+ 'fp-image' : '',
7914
+ };
7915
+ this.itemAddedMessage = serverControlParams.translatedStrings.featuredPageAdded;
7916
+ api.section( module.control.section() ).expanded.bind(function(to) {
7917
+ if ( 'resolved' == module.isReady.state() )
7918
+ return;
7919
+ module.ready();
7920
+ });
7921
+
7922
+ },//initialize
7923
+ addItem : function(obj) {
7924
+
7925
+ var module = this,
7926
+ item = module.preItem,
7927
+ item_model = item();
7928
+
7929
+ if ( _.isEmpty(item_model) || ! _.isObject(item_model) ) {
7930
+ throw new Error('addItem : an item should be an object and not empty. In : ' + module.id +'. Aborted.' );
7931
+ }
7932
+
7933
+ var _fp_post = item_model['fp-post'];
7934
+ if ( typeof _fp_post == "undefined" )
7935
+ return;
7936
+
7937
+ _fp_post = _fp_post[0];
7938
+ var done_callback = function( _to_update ) {
7939
+ item.set( $.extend( item_model, _to_update) );
7940
+ api.CZRDynModule.prototype.addItem.call( module, obj );
7941
+ };
7942
+
7943
+ var request = module.CZRFeaturedPagesItem.setContentAjaxInfo( _fp_post.id, {}, done_callback );
7944
+
7945
+ },
7946
+
7947
+
7948
+
7949
+
7950
+
7951
+
7952
+
7953
+ CZRFeaturedPagesInputMths : {
7954
+ ready : function() {
7955
+ var input = this;
7956
+ input.bind( 'fp-post:changed', function(){
7957
+ input.updateItemModel();
7958
+ });
7959
+ input.bind( 'fp-title:changed', function(){
7960
+ input.updateItemTitle();
7961
+ });
7962
+
7963
+ api.CZRInput.prototype.ready.call( input );
7964
+ },
7965
+ setupImageUploader: function(){
7966
+ var input = this;
7967
+ input.container.bind( 'fp-image:content_rendered', function(){
7968
+ input.addResetDefaultButton();
7969
+ });
7970
+ input.container.on('click keydown', '.default-fpimage-button', function(){
7971
+ input.setThumbnailAjax();
7972
+ });
7973
+
7974
+ api.CZRInput.prototype.setupImageUploader.call( input );
7975
+ },
7976
+ updateItemModel : function( _new_val ) {
7977
+
7978
+ var input = this,
7979
+ item = this.item,
7980
+ is_preItemInput = _.has( input, 'is_preItemInput' ) && input.is_preItemInput;
7981
+ if ( ! _.has( item(), 'fp-post') || _.isEmpty( item()['fp-post'] ) )
7982
+ return;
7983
+
7984
+ var _new_model = _.clone( item() ),
7985
+ _fp_post = _new_model['fp-post'][0],
7986
+ _new_title = _fp_post.title,
7987
+ inputCollection = is_preItemInput ? input.module.preItemInput : item.czr_Input;
7988
+
7989
+ if ( is_preItemInput ) {
7990
+ $.extend( _new_model, { title : _new_title, 'fp-title' : _new_title } );
7991
+ item.set( _new_model );
7992
+ } else {
7993
+
7994
+ var done_callback = function( _to_update ) {
7995
+ _.each( _to_update, function( value, id ){
7996
+ item.czr_Input( id ).set( value );
7997
+ });
7998
+ };
7999
+ var request = item.setContentAjaxInfo( _fp_post.id, {'fp-title' : _new_title}, done_callback );
8000
+ }
8001
+ },
8002
+
8003
+
8004
+ updateItemTitle : function( _new_val ) {
8005
+ var input = this,
8006
+ item = this.item,
8007
+ is_preItemInput = _.has( input, 'is_preItemInput' ) && input.is_preItemInput;
8008
+
8009
+ if ( is_preItemInput )
8010
+ return;
8011
+ var _new_model = _.clone( item() ),
8012
+ _new_title = "undefined" !== typeof _new_model['fp-title'] ? _new_model['fp-title'] : '';
8013
+
8014
+ $.extend( _new_model, { title : _new_title} );
8015
+ item.set( _new_model );
8016
+ },
8017
+
8018
+
8019
+ setThumbnailAjax : function() {
8020
+ var item = this.item,
8021
+ _fp_post = item.czr_Input('fp-post')(),
8022
+ _post_id;
8023
+
8024
+ if ( typeof _fp_post == "undefined" )
8025
+ return;
8026
+
8027
+ _fp_post = _fp_post[0];
8028
+ _post_id = _fp_post.id;
8029
+
8030
+ $('.fpimage-reset-messages p').hide();
8031
+ request = wp.ajax.post( 'get-fp-post-tb', {
8032
+ 'wp_customize': 'on',
8033
+ 'id' : _post_id,
8034
+ 'CZRFPNonce' : serverControlParams.CZRFPNonce
8035
+ });
8036
+
8037
+
8038
+ request.done( function( data ){
8039
+ var thumbnail = data,
8040
+ input = item.czr_Input('fp-image');
8041
+
8042
+ if ( 0 !== thumbnail.length ) {
8043
+ $('.fpimage-reset-messages .success', input.container ).show('fast').fadeOut();
8044
+ input.set( thumbnail );
8045
+ }else {
8046
+ $('.fpimage-reset-messages .warning', input.container ).show('fast').delay(2000).fadeOut();
8047
+ }
8048
+ });
8049
+
8050
+ request.fail(function( data ) {
8051
+ if ( typeof console !== 'undefined' && console.error ) {
8052
+ console.error( data );
8053
+ }
8054
+ });
8055
+ },
8056
+
8057
+ addResetDefaultButton : function( $_template_params ) {
8058
+ var input = this,
8059
+ item = input.item,
8060
+ buttonLabel = serverControlParams.translatedStrings.featuredPageImgReset,
8061
+ successMess = serverControlParams.translatedStrings.featuredPageResetSucc,
8062
+ errMess = serverControlParams.translatedStrings.featuredPageResetErr,
8063
+ messages = '<div class="fpimage-reset-messages" style="clear:both"><p class="success" style="display:none">'+successMess+'</p><p class="warning" style="display:none">'+errMess+'</p></div>';
8064
+
8065
+ $('.actions', input.container)
8066
+ .append('<button type="button" class="button default-fpimage-button">'+ buttonLabel +'</button>');
8067
+ $('.fpimage-reset-messages', input.container ).detach();
8068
+ $(input.container).append( messages );
8069
+ }
8070
+ },//CZRFeaturedPagesInputMths
8071
+
8072
+
8073
+
8074
+
8075
+
8076
+
8077
+
8078
+
8079
+ CZRFeaturedPagesItem : {
8080
+ setContentAjaxInfo : function( _post_id, _additional_inputs, done_callback ) {
8081
+ var _to_update = _additional_inputs || {};
8082
+ request = wp.ajax.post( 'get-fp-post', {
8083
+ 'wp_customize': 'on',
8084
+ 'id' : _post_id,
8085
+ 'CZRFPNonce' : serverControlParams.CZRFPNonce
8086
+ });
8087
+
8088
+ request.done( function( data ){
8089
+ var _post_info = data.post_info;
8090
+
8091
+ if ( 0 !== _post_info.length ) {
8092
+ $.extend( _to_update, { 'fp-image' : _post_info.thumbnail, 'fp-text' : _post_info.excerpt } );
8093
+ if ( "function" === typeof done_callback )
8094
+ done_callback( _to_update );
8095
+ }
8096
+ });
8097
+
8098
+ request.fail(function( data ) {
8099
+ if ( typeof console !== 'undefined' && console.error ) {
8100
+ console.error( data );
8101
+ }
8102
+ });
8103
+
8104
+ return request;
8105
+ },
8106
+ writeItemViewTitle : function( model ) {
8107
+ var item = this,
8108
+ module = item.module,
8109
+ _model = model || item(),
8110
+ _title = _model.title ? _model.title : serverControlParams.translatedStrings.featuredPageTitle;
8111
+
8112
+ _title = api.CZR_Helpers.truncate(_title, 25);
8113
+ $( '.' + module.control.css_attr.item_title , item.container ).html( _title );
8114
+ }
8115
+ }
8116
+ });
8117
+ var CZRTextModuleMths = CZRTextModuleMths || {};
8118
+
8119
+ $.extend( CZRTextModuleMths, {
8120
+ initialize: function( id, options ) {
8121
+ var module = this;
8122
+ api.CZRModule.prototype.initialize.call( module, id, options );
8123
+ $.extend( module, {
8124
+ itemInputList : 'czr-module-text-view-content',
8125
+ } );
8126
+ module.defaultItemModel = {
8127
+ id : '',
8128
+ text : ''
8129
+ };
8130
+ }//initialize
8131
+ });//extends api.CZRDynModule
8132
+
8133
+ var CZRSlideModuleMths = CZRSlideModuleMths || {};
8134
+
8135
+ $.extend( CZRSlideModuleMths, {
8136
+ initialize: function( id, options ) {
8137
+ var module = this;
8138
+ api.CZRDynModule.prototype.initialize.call( module, id, options );
8139
+ $.extend( module, {
8140
+ itemPreAddEl : 'czr-module-slide-pre-item-input-list',
8141
+ itemInputList : 'czr-module-slide-item-input-list'
8142
+ } );
8143
+ module.inputConstructor = api.CZRInput.extend( module.CZRSliderInputMths || {} );
8144
+ module.itemConstructor = api.CZRItem.extend( module.CZRSliderItem || {} );
8145
+ this.defaultItemModel = {
8146
+ id : '',
8147
+ title : '',
8148
+ 'slide-background' : '',
8149
+ 'slide-title' : '',
8150
+ 'slide-subtitle' : '',
8151
+ };
8152
+ this.itemAddedMessage = serverControlParams.translatedStrings.slideAdded;
8153
+ },//initialize
8154
+
8155
+
8156
+ CZRSliderInputMths : {
8157
+ ready : function() {
8158
+ var input = this;
8159
+ input.bind('slide-title:changed', function(){
8160
+ input.updateItemTitle();
8161
+ });
8162
+ api.CZRInput.prototype.ready.call( input);
8163
+ },
8164
+ updateItemTitle : function( _new_val ) {
8165
+ var input = this,
8166
+ item = this.item,
8167
+ is_preItemInput = _.has( input, 'is_preItemInput' ) && input.is_preItemInput;
8168
+
8169
+ var _new_model = _.clone( item() ),
8170
+ _new_title = _new_model['slide-title'];
8171
+
8172
+ $.extend( _new_model, { title : _new_title} );
8173
+ item.set( _new_model );
8174
+ },
8175
+ },//CZRSlidersInputMths
8176
+ CZRSliderItem : {
8177
+ writeItemViewTitle : function( model ) {
8178
+ var item = this,
8179
+ module = item.module,
8180
+ _model = model || item(),
8181
+ _title = _model.title ? _model.title : serverControlParams.translatedStrings.slideTitle;
8182
+
8183
+ _title = api.CZR_Helpers.truncate(_title, 25);
8184
+ $( '.' + module.control.css_attr.item_title , item.container ).html( _title );
8185
+ }
8186
+ }
8187
+ });//extends api.CZRDynModule
8188
+
8189
+ var CZRTextEditorModuleMths = CZRTextEditorModuleMths || {};
8190
+
8191
+ $.extend( CZRTextEditorModuleMths, {
8192
+ initialize: function( id, options ) {
8193
+ var module = this;
8194
+ api.CZRModule.prototype.initialize.call( module, id, options );
8195
+ $.extend( module, {
8196
+ itemInputList : 'czr-module-text_editor-item-content'
8197
+ } );
8198
+ module.inputConstructor = api.CZRInput.extend( module.CZRTextEditorInputMths || {} );
8199
+ module.itemConstructor = api.CZRItem.extend( module.CZRTextEditorItem || {} );
8200
+ this.defaultItemModel = {
8201
+ id : '',
8202
+ text: ''
8203
+ };
8204
+ },//initialize
8205
+
8206
+
8207
+
8208
+
8209
+ CZRTextEditorInputMths : {
8210
+ },//CZRTextEditorsInputMths
8211
+
8212
+
8213
+
8214
+ CZRTextEditorItem : {
8215
+
8216
+ },
8217
+ });//extends api.CZRModule
8218
+ var CZRBodyBgModuleMths = CZRBodyBgModuleMths || {};
8219
+
8220
+ $.extend( CZRBodyBgModuleMths, {
8221
+ initialize: function( id, options ) {
8222
+ var module = this;
8223
+ api.CZRModule.prototype.initialize.call( module, id, options );
8224
+ $.extend( module, {
8225
+ itemInputList : 'czr-module-bodybg-item-content'
8226
+ } );
8227
+ module.inputConstructor = api.CZRInput.extend( module.CZRBodyBgInputMths || {} );
8228
+ module.itemConstructor = api.CZRItem.extend( module.CZBodyBgItemMths || {} );
8229
+ module.defaultItemModel = {
8230
+ 'background-color' : '#eaeaea',
8231
+ 'background-image' : '',
8232
+ 'background-repeat' : 'no-repeat',
8233
+ 'background-attachment' : 'fixed',
8234
+ 'background-position' : 'center center',
8235
+ 'background-size' : 'cover'
8236
+ };
8237
+ api.consoleLog('module ID', module.id );
8238
+ if ( _.has( api, 'czr_activeSectionId' ) && module.control.section() == api.czr_activeSectionId() && 'resolved' != module.isReady.state() ) {
8239
+ module.ready();
8240
+ }
8241
+ api.section( module.control.section() ).expanded.bind(function(to) {
8242
+ if ( 'resolved' == module.isReady.state() )
8243
+ return;
8244
+ module.ready();
8245
+ });
8246
+ },//initialize
8247
+
8248
+
8249
+
8250
+ CZRBodyBgInputMths : {
8251
+ setupSelect : function() {
8252
+ var input = this,
8253
+ _id_param_map = {
8254
+ 'background-repeat' : 'bg_repeat_options',
8255
+ 'background-attachment' : 'bg_attachment_options',
8256
+ 'background-position' : 'bg_position_options'
8257
+ },
8258
+ item = input.item,
8259
+ serverParams = serverControlParams.body_bg_module_params,
8260
+ options = {},
8261
+ module = input.module;
8262
+
8263
+ if ( ! _.has( _id_param_map, input.id ) )
8264
+ return;
8265
+
8266
+ if ( _.isUndefined( serverParams ) || _.isUndefined( serverParams[ _id_param_map[input.id] ] ) )
8267
+ return;
8268
+ options = serverParams[ _id_param_map[input.id] ];
8269
+ if ( _.isEmpty(options) )
8270
+ return;
8271
+ _.each( options, function( title, key ) {
8272
+ var _attributes = {
8273
+ value : key,
8274
+ html: title
8275
+ };
8276
+ if ( key == input() || _.contains( input(), key ) )
8277
+ $.extend( _attributes, { selected : "selected" } );
8278
+
8279
+ $( 'select[data-type]', input.container ).append( $('<option>', _attributes) );
8280
+ });
8281
+ $( 'select[data-type]', input.container ).select2();
8282
+
8283
+ }
8284
+ },
8285
+
8286
+
8287
+ CZBodyBgItemMths : {
8288
+ ready : function() {
8289
+ var item = this;
8290
+ api.CZRItem.prototype.ready.call( item );
8291
+
8292
+ item.czr_Input('background-image').isReady.done( function( input_instance ) {
8293
+ var set_visibilities = function( bg_val ) {
8294
+ var is_bg_img_set = ! _.isEmpty( bg_val ) ||_.isNumber( bg_val);
8295
+ _.each( ['background-repeat', 'background-attachment', 'background-position', 'background-size'], function( dep ) {
8296
+ item.czr_Input(dep).container.toggle( is_bg_img_set || false );
8297
+ });
8298
+ };
8299
+ set_visibilities( input_instance() );
8300
+ item.bind('background-image:changed', function(){
8301
+ set_visibilities( item.czr_Input('background-image')() );
8302
+ });
8303
+ });
8304
+ },
8305
+
8306
+ }
8307
+ });//BASE CONTROL CLASS
8308
+
8309
+ var CZRBaseControlMths = CZRBaseControlMths || {};
8310
+
8311
+ $.extend( CZRBaseControlMths, {
8312
+
8313
+ initialize: function( id, options ) {
8314
+ var control = this;
8315
+ control.css_attr = _.has( serverControlParams , 'css_attr') ? serverControlParams.css_attr : {};
8316
+ api.Control.prototype.initialize.call( control, id, options );
8317
+ },
8318
+ refreshPreview : function( obj ) {
8319
+ this.previewer.refresh();
8320
+ }
8321
+
8322
+ });//$.extend//CZRBaseControlMths
8323
+ var CZRBaseModuleControlMths = CZRBaseModuleControlMths || {};
8324
+
8325
+ $.extend( CZRBaseModuleControlMths, {
8326
+
8327
+ initialize: function( id, options ) {
8328
+ var control = this;
8329
+
8330
+ control.czr_Module = new api.Values();
8331
+ control.czr_moduleCollection = new api.Value();
8332
+ control.czr_moduleCollection.set([]);
8333
+ control.moduleCollectionReady = $.Deferred();
8334
+ control.moduleCollectionReady.done( function( obj ) {
8335
+ if ( ! control.isMultiModuleControl( options.params ) ) {
8336
+ }
8337
+ control.czr_moduleCollection.callbacks.add( function() { return control.moduleCollectionReact.apply( control, arguments ); } );
8338
+ } );
8339
+ if ( control.isMultiModuleControl( options.params ) ) {
8340
+ control.syncSektionModule = new api.Value();
8341
+ }
8342
+
8343
+ api.CZRBaseControl.prototype.initialize.call( control, id, options );
8344
+
8345
+ },
8346
+ ready : function() {
8347
+ var control = this;
8348
+ if ( control.isMultiModuleControl() ) {
8349
+ control.syncSektionModule.bind( function( sektion_module_instance, from) {
8350
+ if ( 'resolved' == control.moduleCollectionReady.state() )
8351
+ return;
8352
+ control.registerModulesOnInit( sektion_module_instance );
8353
+ control.moduleCollectionReady.resolve();
8354
+ });
8355
+ } else {
8356
+ var single_module = {};
8357
+ _.each( control.getSavedModules() , function( _mod, _key ) {
8358
+ single_module = _mod;
8359
+ control.instantiateModule( _mod, {} );
8360
+ control.container.attr('data-module', _mod.id );
8361
+ });
8362
+ control.moduleCollectionReady.resolve( single_module );
8363
+ }
8364
+ control.bind( 'user-module-candidate', function( _module ) {
8365
+ control.instantiateModule( _module, {} ).ready( _module.is_added_by_user ); //module, constructor
8366
+ });
8367
+ },
8368
+ getDefaultModuleApiModel : function() {
8369
+ var commonAPIModel = {
8370
+ id : '',//module.id,
8371
+ module_type : '',//module.module_type,
8372
+ items : [],//$.extend( true, {}, module.items ),
8373
+ crud : false,
8374
+ multi_item : false,
8375
+ control : {},//control,
8376
+ };
8377
+ if ( ! this.isMultiModuleControl() ) {
8378
+ return $.extend( commonAPIModel, {
8379
+ section : ''//id of the control section
8380
+ } );
8381
+ } else {
8382
+ return $.extend( commonAPIModel, {
8383
+ column_id : '',//a string like col_7
8384
+ sektion : {},// => the sektion instance
8385
+ sektion_id : '',
8386
+ is_added_by_user : false,
8387
+ dirty : false
8388
+ } );
8389
+ }
8390
+ },
8391
+ getDefaultModuleDBModel : function() {
8392
+ var commonDBModel = {
8393
+ items : [],//$.extend( true, {}, module.items ),
8394
+ };
8395
+ if ( this.isMultiModuleControl() ) {
8396
+ return $.extend( commonDBModel, {
8397
+ id : '',
8398
+ module_type : '',
8399
+ column_id : '',
8400
+ sektion_id : '',
8401
+ dirty : false
8402
+ } );
8403
+ } else {
8404
+ return commonDBModel;
8405
+ }
8406
+ },
8407
+ isMultiModuleControl : function( params ) {
8408
+ return 'czr_multi_module' == ( params || this.params ).type;
8409
+ },
8410
+ getSyncCollectionControl : function() {
8411
+ var control = this;
8412
+ if ( _.isUndefined( control.params.syncCollection ) ) {
8413
+ throw new Error( 'Control ' + control.id + ' has no synchronized sektion control defined.');
8414
+ }
8415
+ return api.control( api.CZR_Helpers.build_setId( control.params.syncCollection ) );
8416
+ },
8417
+ getSavedModules : function() {
8418
+ var control = this,
8419
+ savedModules = [],
8420
+ _module_type = control.params.module_type;
8421
+ if ( control.isMultiModuleControl() ) {
8422
+ savedModules = $.extend( true, [], api(control.id)() );//deep clone
8423
+ } else {
8424
+ if ( api.CZR_Helpers.isMultiItemModule( _module_type ) && ! _.isEmpty( api(control.id)() ) && ! _.isObject( api(control.id)() ) ) {
8425
+ api.consoleLog('Module Control Init for ' + control.id + ' : a mono item module control value should be an object if not empty.');
8426
+ }
8427
+ var _saved_items = _.isArray( api(control.id)() ) ? api(control.id)() : [ api(control.id)() ];
8428
+ savedModules.push(
8429
+ {
8430
+ id : api.CZR_Helpers.getOptionName( control.id ) + '_' + control.params.type,
8431
+ module_type : control.params.module_type,
8432
+ section : control.section(),
8433
+ items : $.extend( true, [] , _saved_items )//deep clone//must be a collection [] of items
8434
+ }
8435
+ );
8436
+ }
8437
+ return savedModules;
8438
+ },
8439
+ isModuleRegistered : function( id_candidate ) {
8440
+ var control = this;
8441
+ return ! _.isUndefined( _.findWhere( control.czr_moduleCollection(), { id : id_candidate}) );
8442
+ },
8443
+
8444
+
8445
+ });//$.extend//CZRBaseControlMths
8446
+ var CZRBaseModuleControlMths = CZRBaseModuleControlMths || {};
8447
+
8448
+ $.extend( CZRBaseModuleControlMths, {
8449
+ instantiateModule : function( module, constructor ) {
8450
+ if ( ! _.has( module,'id') ) {
8451
+ throw new Error('CZRModule::instantiateModule() : a module has no id and could not be added in the collection of : ' + this.id +'. Aborted.' );
8452
+ }
8453
+
8454
+ var control = this;
8455
+ if ( _.isUndefined(constructor) || _.isEmpty(constructor) ) {
8456
+ constructor = control.getModuleConstructor( module );
8457
+ }
8458
+ if ( ! _.isEmpty( module.id ) && control.czr_Module.has( module.id ) ) {
8459
+ throw new Error('The module id already exists in the collection in control : ' + control.id );
8460
+ }
8461
+
8462
+ var module_api_ready = control.prepareModuleForAPI( module );
8463
+ control.czr_Module.add( module_api_ready.id, new constructor( module_api_ready.id, module_api_ready ) );
8464
+
8465
+ if ( ! control.czr_Module.has( module_api_ready.id ) ) {
8466
+ throw new Error('instantiateModule() : instantiation failed for module id ' + module_api_ready.id + ' in control ' + control.id );
8467
+ }
8468
+ return control.czr_Module(module_api_ready.id);
8469
+ },
8470
+ getModuleConstructor : function( module ) {
8471
+ var control = this,
8472
+ parentConstructor = {},
8473
+ constructor = {};
8474
+
8475
+ if ( ! _.has( module, 'module_type' ) ) {
8476
+ throw new Error('CZRModule::getModuleConstructor : no module type found for module ' + module.id );
8477
+ }
8478
+ if ( ! _.has( api.czrModuleMap, module.module_type ) ) {
8479
+ throw new Error('Module type ' + module.module_type + ' is not listed in the module map api.czrModuleMap.' );
8480
+ }
8481
+
8482
+ var _mthds = api.czrModuleMap[ module.module_type ].mthds,
8483
+ _is_crud = api.czrModuleMap[ module.module_type ].crud,
8484
+ _base_constructor = _is_crud ? api.CZRDynModule : api.CZRModule;
8485
+ if ( ! _.isEmpty( module.sektion_id ) ) {
8486
+ parentConstructor = _base_constructor.extend( _mthds );
8487
+ constructor = parentConstructor.extend( control.getMultiModuleExtender( parentConstructor ) );
8488
+ } else {
8489
+ constructor = _base_constructor.extend( _mthds );
8490
+ }
8491
+
8492
+ if ( _.isUndefined(constructor) || _.isEmpty(constructor) || ! constructor ) {
8493
+ throw new Error('CZRModule::getModuleConstructor : no constructor found for module type : ' + module.module_type +'.' );
8494
+ }
8495
+ return constructor;
8496
+ },
8497
+ prepareModuleForAPI : function( module_candidate ) {
8498
+ if ( ! _.isObject( module_candidate ) ) {
8499
+ throw new Error('prepareModuleForAPI : a module must be an object to be instantiated.');
8500
+ }
8501
+
8502
+ var control = this,
8503
+ api_ready_module = {};
8504
+
8505
+ _.each( control.getDefaultModuleApiModel() , function( _value, _key ) {
8506
+ var _candidate_val = module_candidate[_key];
8507
+ switch( _key ) {
8508
+ case 'id' :
8509
+ if ( _.isEmpty( _candidate_val ) ) {
8510
+ api_ready_module[_key] = control.generateModuleId( module_candidate.module_type );
8511
+ } else {
8512
+ api_ready_module[_key] = _candidate_val;
8513
+ }
8514
+ break;
8515
+ case 'module_type' :
8516
+ if ( ! _.isString( _candidate_val ) || _.isEmpty( _candidate_val ) ) {
8517
+ throw new Error('prepareModuleForAPI : a module type must a string not empty');
8518
+ }
8519
+ api_ready_module[_key] = _candidate_val;
8520
+ break;
8521
+ case 'items' :
8522
+ if ( ! _.isArray( _candidate_val ) ) {
8523
+ throw new Error('prepareModuleForAPI : a module item list must be an array');
8524
+ }
8525
+ api_ready_module[_key] = _candidate_val;
8526
+ break;
8527
+ case 'crud' :
8528
+ if ( _.has( api.czrModuleMap, module_candidate.module_type ) ) {
8529
+ _candidate_val = api.czrModuleMap[ module_candidate.module_type ].crud;
8530
+ } else if ( ! _.isUndefined( _candidate_val) && ! _.isBoolean( _candidate_val ) ) {
8531
+ throw new Error('prepareModuleForAPI : the module param "crud" must be a boolean');
8532
+ }
8533
+ api_ready_module[_key] = _candidate_val || false;
8534
+ break;
8535
+ case 'multi_item' :
8536
+ if ( _.has( api.czrModuleMap, module_candidate.module_type ) ) {
8537
+ _candidate_val = api.czrModuleMap[ module_candidate.module_type ].crud || api.czrModuleMap[ module_candidate.module_type ].multi_item;
8538
+ } else if ( ! _.isUndefined( _candidate_val) && ! _.isBoolean( _candidate_val ) ) {
8539
+ throw new Error('prepareModuleForAPI : the module param "multi_item" must be a boolean');
8540
+ }
8541
+ api_ready_module[_key] = _candidate_val || false;
8542
+ break;
8543
+ case 'control' :
8544
+ api_ready_module[_key] = control;//this
8545
+ break;
8546
+ case 'section' :
8547
+ if ( ! _.isString( _candidate_val ) || _.isEmpty( _candidate_val ) ) {
8548
+ throw new Error('prepareModuleForAPI : a module section must be a string not empty');
8549
+ }
8550
+ api_ready_module[_key] = _candidate_val;
8551
+ break;
8552
+ case 'column_id' :
8553
+ if ( ! _.isString( _candidate_val ) || _.isEmpty( _candidate_val ) ) {
8554
+ throw new Error('prepareModuleForAPI : a module column id must a string not empty');
8555
+ }
8556
+ api_ready_module[_key] = _candidate_val;
8557
+ break;
8558
+ case 'sektion' :
8559
+ if ( ! _.isObject( _candidate_val ) || _.isEmpty( _candidate_val ) ) {
8560
+ throw new Error('prepareModuleForAPI : a module sektion must be an object not empty');
8561
+ }
8562
+ api_ready_module[_key] = _candidate_val;
8563
+ break;
8564
+ case 'sektion_id' :
8565
+ if ( ! _.isString( _candidate_val ) || _.isEmpty( _candidate_val ) ) {
8566
+ throw new Error('prepareModuleForAPI : a module sektion id must be a string not empty');
8567
+ }
8568
+ api_ready_module[_key] = _candidate_val;
8569
+ break;
8570
+ case 'is_added_by_user' :
8571
+ if ( ! _.isUndefined( _candidate_val) && ! _.isBoolean( _candidate_val ) ) {
8572
+ throw new Error('prepareModuleForAPI : the module param "is_added_by_user" must be a boolean');
8573
+ }
8574
+ api_ready_module[_key] = _candidate_val || false;
8575
+ break;
8576
+ case 'dirty' :
8577
+ api_ready_module[_key] = _candidate_val || false;
8578
+ break;
8579
+ }//switch
8580
+ });
8581
+ return api_ready_module;
8582
+ },
8583
+ generateModuleId : function( module_type, key, i ) {
8584
+ i = i || 1;
8585
+ if ( i > 100 ) {
8586
+ throw new Error('Infinite loop when generating of a module id.');
8587
+ }
8588
+ var control = this;
8589
+ key = key || control._getNextModuleKeyInCollection();
8590
+ var id_candidate = module_type + '_' + key;
8591
+ if ( ! _.has(control, 'czr_moduleCollection') || ! _.isArray( control.czr_moduleCollection() ) ) {
8592
+ throw new Error('The module collection does not exist or is not properly set in control : ' + control.id );
8593
+ }
8594
+ if ( control.isModuleRegistered( id_candidate ) ) {
8595
+ key++; i++;
8596
+ return control.generateModuleId( module_type, key, i );
8597
+ }
8598
+
8599
+ return id_candidate;
8600
+ },
8601
+ _getNextModuleKeyInCollection : function() {
8602
+ var control = this,
8603
+ _max_mod_key = {},
8604
+ _next_key = 0;
8605
+ if ( ! _.isEmpty( control.czr_moduleCollection() ) ) {
8606
+ _max_mod_key = _.max( control.czr_moduleCollection(), function( _mod ) {
8607
+ return parseInt( _mod.id.replace(/[^\/\d]/g,''), 10 );
8608
+ });
8609
+ _next_key = parseInt( _max_mod_key.id.replace(/[^\/\d]/g,''), 10 ) + 1;
8610
+ }
8611
+ return _next_key;
8612
+ }
8613
+ });//$.extend//CZRBaseControlMths
8614
+ var CZRBaseModuleControlMths = CZRBaseModuleControlMths || {};
8615
+
8616
+ $.extend( CZRBaseModuleControlMths, {
8617
+ registerModulesOnInit : function( sektion_module_instance ) {
8618
+ var control = this,
8619
+ _orphan_mods = [];
8620
+
8621
+ _.each( control.getSavedModules() , function( _mod, _key ) {
8622
+ if ( ! sektion_module_instance.czr_Item.has( _mod.sektion_id ) ) {
8623
+ api.consoleLog('Warning Module ' + _mod.id + ' is orphan : it has no sektion to be embedded to. It Must be removed.');
8624
+ _orphan_mods.push(_mod);
8625
+ return;
8626
+ }
8627
+
8628
+ var _sektion = sektion_module_instance.czr_Item( _mod.sektion_id );
8629
+
8630
+ if ( _.isUndefined( _sektion ) ) {
8631
+ throw new Error('sektion instance missing. Impossible to instantiate module : ' + _mod.id );
8632
+ }
8633
+ $.extend( _mod, {sektion : _sektion} );
8634
+ control.updateModulesCollection( {module : _mod } );
8635
+ });
8636
+ control.moduleCollectionReady.then( function() {
8637
+ if ( ! _.isEmpty( _orphan_mods ) ) {
8638
+ control.moduleCollectionReact( control.czr_moduleCollection(), [], { orphans_module_removal : _orphan_mods } );
8639
+ }
8640
+ });
8641
+ },
8642
+ updateModulesCollection : function( obj ) {
8643
+ var control = this,
8644
+ _current_collection = control.czr_moduleCollection(),
8645
+ _new_collection = $.extend( true, [], _current_collection);
8646
+ if ( _.has( obj, 'collection' ) ) {
8647
+ control.czr_moduleCollection.set( obj.collection, obj.data || {} );
8648
+ return;
8649
+ }
8650
+
8651
+ if ( ! _.has(obj, 'module') ) {
8652
+ throw new Error('updateModulesCollection, no module provided ' + control.id + '. Aborting');
8653
+ }
8654
+ var module_api_ready = control.prepareModuleForAPI( _.clone(obj.module) );
8655
+ if ( _.findWhere( _new_collection, { id : module_api_ready.id } ) ) {
8656
+ _.each( _current_collection , function( _elt, _ind ) {
8657
+ if ( _elt.id != module_api_ready.id )
8658
+ return;
8659
+ _new_collection[_ind] = module_api_ready;
8660
+ });
8661
+ }
8662
+ else {
8663
+ _new_collection.push(module_api_ready);
8664
+ }
8665
+ var _params = {};
8666
+ if ( _.has( obj, 'data') ) {
8667
+ _params = $.extend( true, {}, obj.data );
8668
+ $.extend( _params, { module : module_api_ready } );
8669
+ }
8670
+ control.czr_moduleCollection.set( _new_collection, _params );
8671
+ },
8672
+ moduleCollectionReact : function( to, from, data ) {
8673
+ var control = this,
8674
+ is_module_added = _.size(to) > _.size(from),
8675
+ is_module_removed = _.size(from) > _.size(to),
8676
+ is_module_update = _.size(from) == _.size(to);
8677
+ is_collection_sorted = false;
8678
+ if ( is_module_removed ) {
8679
+ var _to_remove = _.filter( from, function( _mod ){
8680
+ return _.isUndefined( _.findWhere( to, { id : _mod.id } ) );
8681
+ });
8682
+ _to_remove = _to_remove[0];
8683
+ control.czr_Module.remove( _to_remove.id );
8684
+ }
8685
+ if ( _.isObject( data ) && _.has(data, 'module') ) {
8686
+ data.module = control.prepareModuleForDB( $.extend( true, {}, data.module ) );
8687
+ }
8688
+ if ( ! control.isMultiModuleControl() && is_module_added ) {
8689
+ return;
8690
+ }
8691
+ else {
8692
+ api(this.id).set( control.filterModuleCollectionBeforeAjax(to), data );
8693
+ }
8694
+ },
8695
+ filterModuleCollectionBeforeAjax : function( collection ) {
8696
+ var control = this,
8697
+ _filtered_collection = $.extend( true, [], collection );
8698
+
8699
+ _.each( collection , function( _mod, _key ) {
8700
+ var db_ready_mod = $.extend( true, {}, _mod );
8701
+ _filtered_collection[_key] = control.prepareModuleForDB( db_ready_mod );
8702
+ });
8703
+ if ( control.isMultiModuleControl() ) {
8704
+ return _filtered_collection;
8705
+ } else {
8706
+ if ( _.size(collection) > 1 ) {
8707
+ throw new Error('There should not be several modules in the collection of control : ' + control.id );
8708
+ }
8709
+ if ( ! _.isArray(collection) || _.isEmpty(collection) || ! _.has( collection[0], 'items' ) ) {
8710
+ throw new Error('The setting value could not be populated in control : ' + control.id );
8711
+ }
8712
+ var module_id = collection[0].id;
8713
+
8714
+ if ( ! control.czr_Module.has( module_id ) ) {
8715
+ throw new Error('The single module control (' + control.id + ') has no module registered with the id ' + module_id );
8716
+ }
8717
+ var module_instance = control.czr_Module( module_id );
8718
+ if ( ! _.isArray( module_instance().items ) ) {
8719
+ throw new Error('The module ' + module_id + ' should be an array in control : ' + control.id );
8720
+ }
8721
+ if ( module_instance.isMultiItem() )
8722
+ return module_instance().items;
8723
+ else {
8724
+ return module_instance().items[0] || [];
8725
+ }
8726
+ }
8727
+ },
8728
+ prepareModuleForDB : function ( module_db_candidate ) {
8729
+ if ( ! _.isObject( module_db_candidate ) ) {
8730
+ throw new Error('MultiModule Control::prepareModuleForDB : a module must be an object. Aborting.');
8731
+ }
8732
+ var control = this,
8733
+ db_ready_module = {};
8734
+
8735
+ _.each( control.getDefaultModuleDBModel() , function( _value, _key ) {
8736
+ if ( ! _.has( module_db_candidate, _key ) ) {
8737
+ throw new Error('MultiModule Control::prepareModuleForDB : a module is missing the property : ' + _key + ' . Aborting.');
8738
+ }
8739
+
8740
+ var _candidate_val = module_db_candidate[ _key ];
8741
+ switch( _key ) {
8742
+ case 'items' :
8743
+ if ( ! _.isArray( _candidate_val ) ) {
8744
+ throw new Error('prepareModuleForDB : a module item list must be an array');
8745
+ }
8746
+ db_ready_module[ _key ] = _candidate_val;
8747
+ break;
8748
+ case 'id' :
8749
+ if ( ! _.isString( _candidate_val ) || _.isEmpty( _candidate_val ) ) {
8750
+ throw new Error('prepareModuleForDB : a module id must a string not empty');
8751
+ }
8752
+ db_ready_module[ _key ] = _candidate_val;
8753
+ break;
8754
+ case 'module_type' :
8755
+ if ( ! _.isString( _candidate_val ) || _.isEmpty( _candidate_val ) ) {
8756
+ throw new Error('prepareModuleForDB : a module type must a string not empty');
8757
+ }
8758
+ db_ready_module[ _key ] = _candidate_val;
8759
+ break;
8760
+ case 'column_id' :
8761
+ if ( ! _.isString( _candidate_val ) || _.isEmpty( _candidate_val ) ) {
8762
+ throw new Error('prepareModuleForDB : a module column id must a string not empty');
8763
+ }
8764
+ db_ready_module[ _key ] = _candidate_val;
8765
+ break;
8766
+ case 'sektion_id' :
8767
+ if ( ! _.isObject( module_db_candidate.sektion ) || ! _.has( module_db_candidate.sektion, 'id' ) ) {
8768
+ throw new Error('prepareModuleForDB : a module sektion must be an object with an id.');
8769
+ }
8770
+ db_ready_module[ _key ] = module_db_candidate.sektion.id;
8771
+ break;
8772
+ case 'dirty' :
8773
+ if ( control.czr_Module.has( module_db_candidate.id ) )
8774
+ db_ready_module[ _key ] = control.czr_Module( module_db_candidate.id ).isDirty();
8775
+ else
8776
+ db_ready_module[ _key ] = _candidate_val;
8777
+ if ( ! _.isBoolean( db_ready_module[ _key ] ) ) {
8778
+ throw new Error('prepareModuleForDB : a module dirty state must be a boolean.');
8779
+ }
8780
+ break;
8781
+ }//switch
8782
+ });
8783
+ return db_ready_module;
8784
+ }
8785
+
8786
+ });//$.extend//CZRBaseControlMths
8787
+ var CZRMultiModuleControlMths = CZRMultiModuleControlMths || {};
8788
+
8789
+ $.extend( CZRMultiModuleControlMths, {
8790
+
8791
+ initialize: function( id, options ) {
8792
+ var control = this;
8793
+ api.consoleLog('IN MULTI MODULE INITIALIZE ? ', options );
8794
+ api(id).callbacks.add( function() { return control.syncColumn.apply( control, arguments ); } );
8795
+
8796
+ api.CZRBaseModuleControl.prototype.initialize.call( control, id, options );
8797
+
8798
+ },
8799
+
8800
+
8801
+ ready : function() {
8802
+ var control = this;
8803
+ api.consoleLog('MODULE-COLLECTION CONTROL READY', this.id );
8804
+ api.CZRBaseModuleControl.prototype.ready.apply( control, arguments);
8805
+ },
8806
+ syncColumn : function( to, from, data ) {
8807
+ api.consoleLog('IN SYNC COLUMN', to, from, data );
8808
+ if ( ! _.isUndefined(data) && data.silent )
8809
+ return;
8810
+ api.consoleLog('IN SYNXXX', api.control('hu_theme_options[module-collection]').syncSektionModule()(), this.syncSektionModule()(), this.id );
8811
+ if ( _.has( data, 'orphans_module_removal' ) )
8812
+ return;
8813
+ var control = api.control( this.id );
8814
+ var added_mod = _.filter( to, function( _mod, _key ){
8815
+ return ! _.findWhere( from, { id : _mod.id } );
8816
+ } );
8817
+ if ( ! _.isEmpty( added_mod ) ) {
8818
+ api.consoleLog('ADDED MODULE?', added_mod );
8819
+ _.each( added_mod, function( _mod ) {
8820
+ control.syncSektionModule().czr_Column( _mod.column_id ).updateColumnModuleCollection( { module : _mod } );
8821
+ });
8822
+ }
8823
+ var removed_mod = _.filter( from, function( _mod, _key ){
8824
+ return ! _.findWhere( to, { id : _mod.id } );
8825
+ } );
8826
+ if ( ! _.isEmpty( removed_mod ) ) {
8827
+ _.each( removed_mod, function( _mod ) {
8828
+ control.syncSektionModule().czr_Column( _mod.column_id ).removeModuleFromColumnCollection( _mod );
8829
+ });
8830
+ }
8831
+ if ( _.size(from) == _.size(to) && _.has( data, 'module') && _.has( data, 'source_column') && _.has( data, 'target_column') ) {
8832
+ $.when( control.syncSektionModule().moveModuleFromTo( data.module, data.source_column, data.target_column ) ).done( function() {
8833
+ control.syncSektionModule().control.trigger('module-moved', { module : data.module, source_column: data.source_column, target_column :data.target_column });
8834
+ } );
8835
+ }
8836
+ control.trigger( 'columns-synchronized', to );
8837
+ },
8838
+ removeModule : function( module ) {
8839
+ var control = this;
8840
+ if ( control.czr_Module.has( module.id ) && 'resolved' == control.czr_Module( module.id ).embedded.state() )
8841
+ control.czr_Module( module.id ).container.remove();
8842
+ control.removeModuleFromCollection( module );
8843
+ },
8844
+
8845
+
8846
+ removeModuleFromCollection : function( module ) {
8847
+ var control = this,
8848
+ _current_collection = control.czr_moduleCollection(),
8849
+ _new_collection = $.extend( true, [], _current_collection);
8850
+
8851
+ _new_collection = _.filter( _new_collection, function( _mod ) {
8852
+ return _mod.id != module.id;
8853
+ } );
8854
+ control.czr_moduleCollection.set( _new_collection );
8855
+ }
8856
+
8857
+ });//$.extend//CZRBaseControlMths
8858
+ var CZRMultiModuleControlMths = CZRMultiModuleControlMths || {};
8859
+ $.extend( CZRMultiModuleControlMths, {
8860
+ getMultiModuleExtender : function( parentConstructor ) {
8861
+ var control = this;
8862
+ $.extend( control.CZRModuleExtended, {
8863
+ initialize: function( id, constructorOptions ) {
8864
+ var module = this;
8865
+ parentConstructor.prototype.initialize.call( module, id, constructorOptions );
8866
+
8867
+ api.consoleLog('MODULE INSTANTIATED : ', module.id );
8868
+ $.extend( module, {
8869
+ singleModuleWrapper : 'czr-single-module-wrapper',
8870
+ sektionModuleTitle : 'czr-module-sektion-title-part',
8871
+ ruModuleEl : 'czr-ru-module-sektion-content'
8872
+ } );
8873
+ module.czr_ModuleState = new api.Value( false );
8874
+ module.isReady.done( function() {
8875
+ module.setupModuleView();
8876
+ });
8877
+ module.moduleTitleEmbedded = $.Deferred();
8878
+ module.modColumn = new api.Value();
8879
+ module.modColumn.set( constructorOptions.column_id );
8880
+ module.modColumn.bind( function( to, from ) {
8881
+ api.consoleLog('MODULE ' + module.id + ' HAS BEEN MOVED TO COLUMN', to, module() );
8882
+ var _current_model = module(),
8883
+ _new_model = $.extend( true, {}, _current_model );
8884
+
8885
+ _new_model.column_id = to;
8886
+ module.set( _new_model, { target_column : to, source_column : from } );
8887
+ } );
8888
+ },
8889
+ ready : function( is_added_by_user ) {
8890
+ var module = this;
8891
+ api.consoleLog('MODULE READY IN EXTENDED MODULE CLASS : ', module.id );
8892
+ $.when( module.renderModuleWrapper( is_added_by_user ) ).done( function( $_module_container ) {
8893
+ if ( _.isUndefined($_module_container) || false === $_module_container.length ) {
8894
+ throw new Error( 'Module container has not been embedded for module :' + module.id );
8895
+ }
8896
+ module.container = $_module_container;
8897
+ module.embedded.resolve();
8898
+ } );
8899
+ parentConstructor.prototype.ready.call( module );
8900
+ }
8901
+
8902
+ });
8903
+ return control.CZRModuleExtended;
8904
+ },
8905
+ CZRModuleExtended : {
8906
+ renderModuleWrapper : function( is_added_by_user ) {
8907
+ var module = this;
8908
+ if ( 'resolved' == module.embedded.state() )
8909
+ return module.container;
8910
+ if ( 0 === $( '#tmpl-' + module.singleModuleWrapper ).length ) {
8911
+ throw new Error('No template for module ' + module.id + '. The template script id should be : #tmpl-' + module.singleModuleWrapper );
8912
+ }
8913
+
8914
+ var module_wrapper_tmpl = wp.template( module.singleModuleWrapper ),
8915
+ tmpl_data = {
8916
+ id : module.id,
8917
+ type : module.module_type
8918
+ },
8919
+ $_module_el = $( module_wrapper_tmpl( tmpl_data ) );
8920
+ if ( is_added_by_user ) {
8921
+ $.when( $( '.czr-module-collection-wrapper' , module._getColumn().container ).find( '.czr-module-candidate').after( $_module_el ) ).
8922
+ done( function() {
8923
+ $( '.czr-module-collection-wrapper' , module._getColumn().container ).find( '.czr-module-candidate').remove();
8924
+ });
8925
+ } else {
8926
+ $( '.czr-module-collection-wrapper' , module._getColumn().container).append( $_module_el );
8927
+ }
8928
+
8929
+ return $_module_el;
8930
+ },
8931
+
8932
+
8933
+
8934
+
8935
+
8936
+ setupModuleView : function() {
8937
+ var module = this;
8938
+
8939
+ module.view_event_map = [
8940
+ {
8941
+ trigger : 'click keydown',
8942
+ selector : [ '.czr-remove-mod', '.' + module.control.css_attr.cancel_alert_btn ].join(','),
8943
+ name : 'toggle_remove_alert',
8944
+ actions : ['toggleModuleRemoveAlert']
8945
+ },
8946
+ {
8947
+ trigger : 'click keydown',
8948
+ selector : '.' + module.control.css_attr.remove_view_btn,
8949
+ name : 'remove_module',
8950
+ actions : ['removeModule']
8951
+ },
8952
+ {
8953
+ trigger : 'click keydown',
8954
+ selector : '.czr-edit-mod',
8955
+ name : 'edit_module',
8956
+ actions : ['setModuleViewVisibility', 'sendEditModule']
8957
+ },
8958
+ {
8959
+ trigger : 'click keydown',
8960
+ selector : '.czr-module-back',
8961
+ name : 'back_to_column',
8962
+ actions : ['setModuleViewVisibility']
8963
+ },
8964
+ {
8965
+ trigger : 'mouseenter',
8966
+ selector : '.czr-mod-header',
8967
+ name : 'hovering_module',
8968
+ actions : function( obj ) {
8969
+ module.control.previewer.send( 'start_hovering_module', {
8970
+ id : module.id
8971
+ });
8972
+ }
8973
+ },
8974
+ {
8975
+ trigger : 'mouseleave',
8976
+ selector : '.czr-mod-header',
8977
+ name : 'hovering_module',
8978
+ actions : function( obj ) {
8979
+ module.control.previewer.send( 'stop_hovering_module', {
8980
+ id : module.id
8981
+ });
8982
+ }
8983
+ }
8984
+ ];
8985
+ module.embedded.done( function() {
8986
+ module.czr_ModuleState.callbacks.add( function() { return module.setupModuleViewStateListeners.apply(module, arguments ); } );
8987
+ api.CZR_Helpers.setupDOMListeners(
8988
+ module.view_event_map,//actions to execute
8989
+ { module : { id : module.id } , dom_el:module.container },//model + dom scope
8990
+ module //instance where to look for the cb methods
8991
+ );//listeners for the view wrapper
8992
+ });
8993
+ },
8994
+ setModuleViewVisibility : function( obj, is_added_by_user ) {
8995
+ var module = this;
8996
+
8997
+ module.czr_ModuleState( ! module.czr_ModuleState() );
8998
+ api.czrModulePanelState.set(false);
8999
+ api.czrSekSettingsPanelState.set(false);
9000
+ module.control.syncSektionModule().closeAllOtherSektions( $(obj.dom_event.currentTarget, obj.dom_el ) );
9001
+ },
9002
+ sendEditModule : function( obj ) {
9003
+ var module = this;
9004
+ module.control.previewer.send( 'edit_module', {
9005
+ id : module.id
9006
+ });
9007
+ },
9008
+ setupModuleViewStateListeners : function( expanded ) {
9009
+ var module = this;
9010
+ api.czr_isModuleExpanded = api.czr_isModuleExpanded || new api.Value();
9011
+
9012
+ if ( expanded )
9013
+ api.czr_isModuleExpanded( module );
9014
+ else
9015
+ api.czr_isModuleExpanded( false );
9016
+ $.when( module.toggleModuleViewExpansion( expanded ) ).done( function() {
9017
+ if ( expanded ) {
9018
+ module.renderModuleTitle();
9019
+ module.populateSavedItemCollection();
9020
+ }
9021
+ else {
9022
+ module.czr_Item.each ( function( item ) {
9023
+ item.czr_ItemState.set('closed');
9024
+ item._destroyView( 0 );
9025
+ module.czr_Item.remove( item.id );
9026
+ } );
9027
+ }
9028
+ });
9029
+ },
9030
+
9031
+
9032
+ renderModuleTitle : function() {
9033
+ var module = this;
9034
+ if( 'resolved' == module.moduleTitleEmbedded.state() )
9035
+ return;
9036
+ if ( 0 === $( '#tmpl-' + module.sektionModuleTitle ).length ) {
9037
+ throw new Error('No sektion title Module Part template for module ' + module.id + '. The template script id should be : #tmpl-' + module.sektionModuleTitle );
9038
+ }
9039
+ $.when( $( module.container ).find('.czr-mod-content').prepend(
9040
+ $( wp.template( module.sektionModuleTitle )( { id : module.id } ) )
9041
+ ) ).done( function() {
9042
+ module.moduleTitleEmbedded.resolve();
9043
+ });
9044
+ },
9045
+ toggleModuleViewExpansion : function( expanded, duration ) {
9046
+ var module = this;
9047
+ $( '.czr-mod-content' , module.container ).slideToggle( {
9048
+ duration : duration || 200,
9049
+ done : function() {
9050
+ var $_overlay = module.container.closest( '.wp-full-overlay' ),
9051
+ $_backBtn = module.container.find( '.czr-module-back' ),
9052
+ $_modTitle = module.container.find('.czr-module-title');
9053
+
9054
+ module.container.toggleClass('open' , expanded );
9055
+ $_overlay.toggleClass('czr-module-open', expanded );
9056
+ $_modTitle.attr( 'tabindex', expanded ? '-1' : '0' );
9057
+ $_backBtn.attr( 'tabindex', expanded ? '0' : '-1' );
9058
+
9059
+ if( expanded ) {
9060
+ $_backBtn.focus();
9061
+ } else {
9062
+ $_modTitle.focus();
9063
+ }
9064
+ if ( expanded )
9065
+ module._adjustScrollExpandedBlock( module.container );
9066
+ }//done callback
9067
+ } );
9068
+ },
9069
+
9070
+
9071
+
9072
+
9073
+
9074
+
9075
+
9076
+
9077
+
9078
+ toggleModuleRemoveAlert : function( obj ) {
9079
+ var module = this,
9080
+ control = this.control,
9081
+ $_alert_el = $( '.' + module.control.css_attr.remove_alert_wrapper, module.container ).first(),
9082
+ $_clicked = obj.dom_event,
9083
+ $_column_container = control.syncSektionModule().czr_Column( module.column_id ).container;
9084
+ if ( _.has(module, 'preItem') ) {
9085
+ control.syncSektionModule().preItemExpanded.set( false );
9086
+ }
9087
+ $('.' + module.control.css_attr.remove_alert_wrapper, $_column_container ).not($_alert_el).each( function() {
9088
+ if ( $(this).hasClass('open') ) {
9089
+ $(this).slideToggle( {
9090
+ duration : 200,
9091
+ done : function() {
9092
+ $(this).toggleClass('open' , false );
9093
+ $(this).siblings().find('.' + module.control.css_attr.display_alert_btn).toggleClass('active' , false );
9094
+ }
9095
+ } );
9096
+ }
9097
+ });
9098
+ if ( ! wp.template( module.AlertPart ) || ! module.container ) {
9099
+ throw new Error( 'No removal alert template available for module :' + module.id );
9100
+ }
9101
+
9102
+ $_alert_el.html( wp.template( module.AlertPart )( { title : ( module().title || module.id ) } ) );
9103
+ $_alert_el.slideToggle( {
9104
+ duration : 200,
9105
+ done : function() {
9106
+ var _is_open = ! $(this).hasClass('open') && $(this).is(':visible');
9107
+ $(this).toggleClass('open' , _is_open );
9108
+ $( obj.dom_el ).find('.' + module.control.css_attr.display_alert_btn).toggleClass( 'active', _is_open );
9109
+ if ( _is_open )
9110
+ module._adjustScrollExpandedBlock( module.container );
9111
+ }
9112
+ } );
9113
+ },
9114
+ removeModule : function( obj ) {
9115
+ this.control.removeModule( obj.module );
9116
+ },
9117
+
9118
+
9119
+
9120
+
9121
+
9122
+
9123
+
9124
+
9125
+
9126
+
9127
+
9128
+
9129
+
9130
+
9131
+ _getColumn : function() {
9132
+ var module = this;
9133
+ return module.control.syncSektionModule().czr_Column( module.modColumn() );
9134
+ },
9135
+
9136
+ _getSektion : function() {
9137
+
9138
+ }
9139
+
9140
+ }
9141
+
9142
+ });//$.extend//CZRBaseControlMths
9143
+ var CZRMultiplePickerMths = CZRMultiplePickerMths || {};
9144
+ $.extend( CZRMultiplePickerMths , {
9145
+ ready: function() {
9146
+ var control = this,
9147
+ _select = this.container.find('select');
9148
+ _select.on('change', function(e){
9149
+ if ( 0 === $(this).find("option:selected").length )
9150
+ control.setting.set([]);
9151
+ });
9152
+ }
9153
+ });//$.extend
9154
+ var CZRCroppedImageMths = CZRCroppedImageMths || {};
9155
+
9156
+ (function (api, $, _) {
9157
+ if ( 'function' != typeof wp.media.controller.Cropper || 'function' != typeof api.CroppedImageControl )
9158
+ return;
9159
+ wp.media.controller.CZRCustomizeImageCropper = wp.media.controller.Cropper.extend({
9160
+ doCrop: function( attachment ) {
9161
+ var cropDetails = attachment.get( 'cropDetails' ),
9162
+ control = this.get( 'control' );
9163
+
9164
+ cropDetails.dst_width = control.params.dst_width;
9165
+ cropDetails.dst_height = control.params.dst_height;
9166
+
9167
+ return wp.ajax.post( 'crop-image', {
9168
+ wp_customize: 'on',
9169
+ nonce: attachment.get( 'nonces' ).edit,
9170
+ id: attachment.get( 'id' ),
9171
+ context: control.id,
9172
+ cropDetails: cropDetails
9173
+ } );
9174
+ }
9175
+ });
9176
+ $.extend( CZRCroppedImageMths , {
9177
+ initFrame: function() {
9178
+
9179
+ var l10n = _wpMediaViewsL10n;
9180
+
9181
+ this.frame = wp.media({
9182
+ button: {
9183
+ text: l10n.select,
9184
+ close: false
9185
+ },
9186
+ states: [
9187
+ new wp.media.controller.Library({
9188
+ title: this.params.button_labels.frame_title,
9189
+ library: wp.media.query({ type: 'image' }),
9190
+ multiple: false,
9191
+ date: false,
9192
+ priority: 20,
9193
+ suggestedWidth: this.params.width,
9194
+ suggestedHeight: this.params.height
9195
+ }),
9196
+ new wp.media.controller.CZRCustomizeImageCropper({
9197
+ imgSelectOptions: this.calculateImageSelectOptions,
9198
+ control: this
9199
+ })
9200
+ ]
9201
+ });
9202
+
9203
+ this.frame.on( 'select', this.onSelect, this );
9204
+ this.frame.on( 'cropped', this.onCropped, this );
9205
+ this.frame.on( 'skippedcrop', this.onSkippedCrop, this );
9206
+ },
9207
+ onSelect: function() {
9208
+ var attachment = this.frame.state().get( 'selection' ).first().toJSON();
9209
+ if ( ! ( attachment.mime && attachment.mime.indexOf("image") > -1 ) ){
9210
+ this.frame.trigger( 'content:error' );
9211
+ return;
9212
+ }
9213
+ if ( ( _.contains( ['image/svg+xml', 'image/gif'], attachment.mime ) ) || //do not crop gifs or svgs
9214
+ this.params.width === attachment.width && this.params.height === attachment.height && ! this.params.flex_width && ! this.params.flex_height ) {
9215
+ this.setImageFromAttachment( attachment );
9216
+ this.frame.close();
9217
+ } else {
9218
+ this.frame.setState( 'cropper' );
9219
+ }
9220
+ },
9221
+ });//Method definition
9222
+
9223
+ })( wp.customize, jQuery, _);
9224
+ var CZRUploadMths = CZRUploadMths || {};
9225
+ $.extend( CZRUploadMths, {
9226
+ ready: function() {
9227
+ var control = this;
9228
+
9229
+ this.params.removed = this.params.removed || '';
9230
+
9231
+ this.success = $.proxy( this.success, this );
9232
+
9233
+ this.uploader = $.extend({
9234
+ container: this.container,
9235
+ browser: this.container.find('.czr-upload'),
9236
+ success: this.success,
9237
+ plupload: {},
9238
+ params: {}
9239
+ }, this.uploader || {} );
9240
+
9241
+ if ( control.params.extensions ) {
9242
+ control.uploader.plupload.filters = [{
9243
+ title: api.l10n.allowedFiles,
9244
+ extensions: control.params.extensions
9245
+ }];
9246
+ }
9247
+
9248
+ if ( control.params.context )
9249
+ control.uploader.params['post_data[context]'] = this.params.context;
9250
+
9251
+ if ( api.settings.theme.stylesheet )
9252
+ control.uploader.params['post_data[theme]'] = api.settings.theme.stylesheet;
9253
+
9254
+ this.uploader = new wp.Uploader( this.uploader );
9255
+
9256
+ this.remover = this.container.find('.remove');
9257
+ this.remover.on( 'click keydown', function( event ) {
9258
+ if ( event.type === 'keydown' && 13 !== event.which ) // enter
9259
+ return;
9260
+ control.setting.set( control.params.removed );
9261
+ event.preventDefault();
9262
+ });
9263
+
9264
+ this.removerVisibility = $.proxy( this.removerVisibility, this );
9265
+ this.setting.bind( this.removerVisibility );
9266
+ this.removerVisibility( this.setting() );
9267
+ },
9268
+
9269
+
9270
+ success: function( attachment ) {
9271
+ this.setting.set( attachment.get('id') );
9272
+ },
9273
+ removerVisibility: function( to ) {
9274
+ this.remover.toggle( to != this.params.removed );
9275
+ }
9276
+ });//method definition
9277
+ var CZRLayoutSelectMths = CZRLayoutSelectMths || {};
9278
+
9279
+ $.extend( CZRLayoutSelectMths , {
9280
+ ready: function() {
9281
+ this.setupSelect();
9282
+ },
9283
+
9284
+
9285
+ setupSelect : function( obj ) {
9286
+ var control = this;
9287
+ $_select = this.container.find('select');
9288
+
9289
+ function addImg( state ) {
9290
+ if (! state.id) { return state.text; }
9291
+ if ( ! _.has( control.params.layouts, state.element.value ) )
9292
+ return;
9293
+
9294
+ var _layout_data = control.params.layouts[state.element.value],
9295
+ _src = _layout_data.src,
9296
+ _title = _layout_data.label,
9297
+ $state = $(
9298
+ '<img src="' + _src +'" class="czr-layout-img" title="' + _title + '" /><span class="czr-layout-title">' + _title + '</span>'
9299
+ );
9300
+ return $state;
9301
+ }
9302
+ $_select.select2( {
9303
+ templateResult: addImg,
9304
+ templateSelection: addImg,
9305
+ minimumResultsForSearch: Infinity
9306
+ });
9307
+ },
9308
+ });//$.extend
9309
+ (function ( api, $, _ ) {
9310
+ $.extend( CZRBaseControlMths, api.Events );
9311
+ $.extend( CZRModuleMths, api.Events );
9312
+ $.extend( CZRItemMths, api.Events );
9313
+ $.extend( CZRSkopeBaseMths, api.Events );
9314
+ $.extend( CZRSkopeMths, api.Events );
9315
+ $.extend( CZRBaseControlMths, api.CZR_Helpers );
9316
+ $.extend( CZRInputMths, api.CZR_Helpers );
9317
+ $.extend( CZRModuleMths, api.CZR_Helpers );
9318
+ $.extend( CZRSkopeMths, api.CZR_Helpers );
9319
+ api.CZR_skopeBase = api.Class.extend( CZRSkopeBaseMths );
9320
+ api.CZR_skopeSave = api.Class.extend( CZRSkopeSaveMths );
9321
+ api.CZR_skopeReset = api.Class.extend( CZRSkopeResetMths );
9322
+ api.CZR_skope = api.Value.extend( CZRSkopeMths ); //=> used as constructor when creating the collection of skopes
9323
+ if ( _.has(api, 'HeaderTool') ) {
9324
+ api.czr_HeaderTool = $.extend( true, {}, api.HeaderTool );
9325
+ }
9326
+ api.CZRInput = api.Value.extend( CZRInputMths );
9327
+ api.CZRItem = api.Value.extend( CZRItemMths );
9328
+ api.CZRModule = api.Value.extend( CZRModuleMths );
9329
+ api.CZRDynModule = api.CZRModule.extend( CZRDynModuleMths );
9330
+ api.CZRColumn = api.Value.extend( CZRColumnMths );
9331
+ api.CZRBaseControl = api.Control.extend( CZRBaseControlMths );
9332
+ api.CZRBaseModuleControl = api.CZRBaseControl.extend( CZRBaseModuleControlMths );
9333
+ api.CZRMultiModuleControl = api.CZRBaseModuleControl.extend( CZRMultiModuleControlMths );
9334
+
9335
+ api.CZRUploadControl = api.Control.extend( CZRUploadMths );
9336
+ api.CZRLayoutControl = api.Control.extend( CZRLayoutSelectMths );
9337
+ api.CZRMultiplePickerControl = api.Control.extend( CZRMultiplePickerMths );
9338
+
9339
+
9340
+
9341
+ $.extend( api.controlConstructor, {
9342
+ czr_upload : api.CZRUploadControl,
9343
+
9344
+ czr_module : api.CZRBaseModuleControl,
9345
+ czr_multi_module : api.CZRMultiModuleControl,
9346
+
9347
+ czr_multiple_picker : api.CZRMultiplePickerControl,
9348
+ czr_layouts : api.CZRLayoutControl
9349
+ });
9350
+ api.czrModuleMap = api.czrModuleMap || {};
9351
+ $.extend( api.czrModuleMap, {
9352
+ czr_widget_areas_module : {
9353
+ mthds : CZRWidgetAreaModuleMths,
9354
+ crud : true,
9355
+ sektion_allowed : false,
9356
+ name : 'Widget Areas'
9357
+ },
9358
+ czr_social_module : {
9359
+ mthds : CZRSocialModuleMths,
9360
+ crud : true,
9361
+ name : 'Social Icons'
9362
+ },
9363
+ czr_sektion_module : {
9364
+ mthds : CZRSektionMths,
9365
+ crud : true,
9366
+ name : 'Sektions'
9367
+ },
9368
+ czr_fp_module : {
9369
+ mthds : CZRFeaturedPageModuleMths,
9370
+ crud : true,
9371
+ name : 'Featured Pages'
9372
+ },
9373
+ czr_slide_module : {
9374
+ mthds : CZRSlideModuleMths,
9375
+ crud : true,
9376
+ name : 'Slider'
9377
+ },
9378
+ czr_text_module : {
9379
+ mthds : CZRTextModuleMths,
9380
+ crud : false,
9381
+ multi_item : false,
9382
+ name : 'Simple Text'
9383
+ },
9384
+ czr_text_editor_module : {
9385
+ mthds : CZRTextEditorModuleMths,
9386
+ crud : false,
9387
+ multi_item : false,
9388
+ name : 'WP Text Editor'
9389
+ },
9390
+ czr_background : {
9391
+ mthds : CZRBodyBgModuleMths,
9392
+ crud : false,
9393
+ multi_item : false,
9394
+ name : 'Slider'
9395
+ }
9396
+ });
9397
+
9398
+
9399
+ if ( 'function' == typeof api.CroppedImageControl ) {
9400
+ api.CZRCroppedImageControl = api.CroppedImageControl.extend( CZRCroppedImageMths );
9401
+
9402
+ $.extend( api.controlConstructor, {
9403
+ czr_cropped_image : api.CZRCroppedImageControl
9404
+ });
9405
+ }
9406
+ })( wp.customize, jQuery, _ );
9407
+
9408
+ (function (api, $, _) {
9409
+ var $_nav_section_container,
9410
+ translatedStrings = serverControlParams.translatedStrings || {};
9411
+
9412
+ api.czr_CrtlDependenciesReady = $.Deferred();
9413
+
9414
+ api.bind( 'ready' , function() {
9415
+ if ( _.has( api, 'czr_ctrlDependencies') )
9416
+ return;
9417
+ if ( serverControlParams.isSkopOn ) {
9418
+ api.czr_skopeReady.done( function() {
9419
+ api.czr_ctrlDependencies = new api.CZR_ctrlDependencies();
9420
+ api.czr_CrtlDependenciesReady.resolve();
9421
+ });
9422
+ } else {
9423
+ api.czr_ctrlDependencies = new api.CZR_ctrlDependencies();
9424
+ api.czr_CrtlDependenciesReady.resolve();
9425
+ }
9426
+
9427
+ } );
9428
+
9429
+
9430
+ api.CZR_ctrlDependencies = api.Class.extend( {
9431
+ dominiDeps : [],
9432
+ initialize: function() {
9433
+ var self = this;
9434
+
9435
+ this.defaultDominusParams = {
9436
+ dominus : '',
9437
+ servi : [],
9438
+ visibility : null,
9439
+ actions : null,
9440
+ onSectionExpand : true
9441
+ };
9442
+ this.dominiDeps = _.extend( this.dominiDeps, this._getControlDeps() );
9443
+ if ( ! _.isArray( self.dominiDeps ) ) {
9444
+ throw new Error('Visibilities : the dominos dependency array is not an array.');
9445
+ }
9446
+ api.czr_activeSectionId.bind( function( section_id ) {
9447
+ if ( ! _.isEmpty( section_id ) && api.section.has( section_id ) ) {
9448
+ self.setServiDependencies( section_id );
9449
+ }
9450
+ });
9451
+ api.bind( 'awaken-section', function( target_source ) {
9452
+ if ( serverControlParams.isSkopOn && _.has( api ,'czr_skopeBase' ) ) {
9453
+ api.czr_skopeBase.processSilentUpdates( {
9454
+ candidates : {},
9455
+ section_id : target_source.target,
9456
+ refresh : false
9457
+ } ).then( function() {
9458
+ self.setServiDependencies( target_source.target, target_source.source );
9459
+ });
9460
+ } else {
9461
+ self.setServiDependencies( target_source.target, target_source.source );
9462
+ }
9463
+ });
9464
+ this._handleFaviconNote();
9465
+ },
9466
+ setServiDependencies : function( targetSectionId, sourceSectionId, refresh ) {
9467
+ var self = this, params, dfd = $.Deferred();
9468
+
9469
+ refresh = refresh || false;
9470
+
9471
+ if ( _.isUndefined( targetSectionId ) || ! api.section.has( targetSectionId ) ) {
9472
+ throw new Error( 'Control Dependencies : the targetSectionId is missing or not registered : ' + targetSectionId );
9473
+ }
9474
+ api.section( targetSectionId ).czr_ctrlDependenciesReady = api.section( targetSectionId ).czr_ctrlDependenciesReady || $.Deferred();
9475
+ if ( ! refresh && 'resolved' == api.section( targetSectionId ).czr_ctrlDependenciesReady.state() )
9476
+ return dfd.resolve().promise();
9477
+ _.each( self.dominiDeps , function( params ) {
9478
+ if ( ! _.has( params, 'dominus' ) || ! _.isString( params.dominus ) || _.isEmpty( params.dominus ) ) {
9479
+ throw new Error( 'Control Dependencies : a dominus control id must be a not empty string.');
9480
+ }
9481
+
9482
+ var wpDominusId = api.CZR_Helpers.build_setId( params.dominus );
9483
+ if ( api.control( wpDominusId ).section() != targetSectionId )
9484
+ return;
9485
+
9486
+ params = self._prepareDominusParams( params );
9487
+
9488
+ self._processDominusCallbacks( params.dominus, params, refresh )
9489
+ .fail( function() {
9490
+ api.consoleLog( 'self._processDominusCallbacks fail for section ' + targetSectionId );
9491
+ dfd.reject();
9492
+ })
9493
+ .done( function() {
9494
+ dfd.resolve();
9495
+ });
9496
+ });
9497
+ var _secCtrls = api.CZR_Helpers.getSectionControlIds( targetSectionId ),
9498
+ _getServusDomini = function( shortServudId ) {
9499
+ var _dominiIds = [];
9500
+ _.each( self.dominiDeps , function( params ) {
9501
+ if ( ! _.has( params, 'servi' ) || ! _.isArray( params.servi ) || ! _.has( params, 'dominus' ) || _.isEmpty( params.dominus ) ) {
9502
+ throw new Error( 'Control Dependencies : wrong params in _getServusDomini.');
9503
+ }
9504
+
9505
+ if ( _.contains( params.servi , shortServudId ) && ! _.contains( _dominiIds , params.dominus ) ) {
9506
+ params = self._prepareDominusParams( params );
9507
+ _dominiIds.push( params.dominus );
9508
+ }
9509
+ });
9510
+ return ! _.isArray( _dominiIds ) ? [] : _dominiIds;
9511
+ },
9512
+ _servusDominiIds = [];
9513
+ _.each( _secCtrls, function( servusCandidateId ) {
9514
+ if ( _.isEmpty( _getServusDomini( servusCandidateId ) ) )
9515
+ return;
9516
+
9517
+ _servusDominiIds = _.union( _servusDominiIds, _getServusDomini( servusCandidateId ) );
9518
+ });
9519
+ _.each( _servusDominiIds, function( shortDominusId ){
9520
+
9521
+ var wpDominusId = api.CZR_Helpers.build_setId( shortDominusId );
9522
+ if ( api.control( wpDominusId ).section() == targetSectionId )
9523
+ return;
9524
+ if ( sourceSectionId == api.control( wpDominusId ).section() )
9525
+ return;
9526
+ api.trigger( 'awaken-section', {
9527
+ target : api.control( wpDominusId ).section(),
9528
+ source : targetSectionId
9529
+ } );
9530
+ } );
9531
+ dfd.always( function() {
9532
+ api.section( targetSectionId ).czr_ctrlDependenciesReady.resolve();
9533
+ });
9534
+ return dfd.promise();
9535
+ },
9536
+ _deferCallbackForControl : function( wpCrtlId, callback, args ) {
9537
+ var dfd = $.Deferred();
9538
+ if ( _.isEmpty(wpCrtlId) || ! _.isString(wpCrtlId) ) {
9539
+ throw new Error( '_deferCallbackForControl : the control id is missing.' );
9540
+ }
9541
+ if ( ! _.isFunction( callback ) ) {
9542
+ throw new Error( '_deferCallbackForControl : callback must be a funtion.' );
9543
+ }
9544
+ args = ( _.isUndefined(args) || ! _.isArray( args ) ) ? [] : args;
9545
+
9546
+ if ( api.control.has( wpCrtlId ) ) {
9547
+ if ( 'resolved' == api.control(wpCrtlId ).deferred.embedded.state() ) {
9548
+ $.when( callback.apply( null, args ) )
9549
+ .fail( function() { dfd.reject(); })
9550
+ .done( function() { dfd.resolve(); });
9551
+ } else {
9552
+ api.control( wpCrtlId ).deferred.embedded.then( function() {
9553
+ $.when( callback.apply( null, args ) )
9554
+ .fail( function() { dfd.reject(); })
9555
+ .done( function() { dfd.resolve(); });
9556
+ });
9557
+ }
9558
+ } else {
9559
+ api.control.when( wpCrtlId, function() {
9560
+ api.control( wpCrtlId ).deferred.embedded.then( function() {
9561
+ $.when( callback.apply( null, args ) )
9562
+ .fail( function() { dfd.reject(); })
9563
+ .done( function() { dfd.resolve(); });
9564
+ });
9565
+ });
9566
+ }
9567
+ return dfd.promise();
9568
+ },
9569
+ _processDominusCallbacks : function( shortDominusId, dominusParams, refresh ) {
9570
+ var self = this,
9571
+ wpDominusId = api.CZR_Helpers.build_setId( shortDominusId ),
9572
+ dominusSetInst = api( wpDominusId ),
9573
+ dfd = $.Deferred(),
9574
+ hasProcessed = false;
9575
+ _.each( dominusParams.servi , function( servusShortSetId ) {
9576
+ if ( ! api.control.has( api.CZR_Helpers.build_setId( servusShortSetId ) ) ) {
9577
+ return;
9578
+ }
9579
+ var _fireDominusCallbacks = function( dominusSetVal, servusShortSetId, dominusParams, refresh ) {
9580
+ var _toFire = [],
9581
+ _args = arguments;
9582
+ _.each( dominusParams, function( _item, _key ) {
9583
+ switch( _key ) {
9584
+ case 'visibility' :
9585
+ self._setVisibility.apply( null, _args );
9586
+ break;
9587
+ case 'actions' :
9588
+ if ( _.isFunction( _item ) )
9589
+ _item.apply( null, _args );
9590
+ break;
9591
+ }
9592
+ });
9593
+ },
9594
+ _deferCallbacks = function( dominusSetVal ) {
9595
+ dominusSetVal = dominusSetVal || dominusSetInst();
9596
+ var wpServusSetId = api.CZR_Helpers.build_setId( servusShortSetId );
9597
+ self._deferCallbackForControl(
9598
+ wpServusSetId,
9599
+ _fireDominusCallbacks,
9600
+ [ dominusSetVal, servusShortSetId, dominusParams ]
9601
+ )
9602
+ .always( function() { hasProcessed = true; })
9603
+ .fail( function() { dfd.reject(); })
9604
+ .done( function() { dfd.resolve(); });
9605
+ };
9606
+ _deferCallbacks();
9607
+ if ( ! _.has( dominusSetInst, 'czr_visibilityServi' ) )
9608
+ dominusSetInst.czr_visibilityServi = new api.Value( [] );
9609
+ var _currentDependantBound = dominusSetInst.czr_visibilityServi();
9610
+ if ( ! _.contains( _currentDependantBound, servusShortSetId ) ) {
9611
+ dominusSetInst.bind( function( dominusSetVal ) {
9612
+ _deferCallbacks( dominusSetVal );
9613
+ });
9614
+ dominusSetInst.czr_visibilityServi( _.union( _currentDependantBound, [ servusShortSetId ] ) );
9615
+ }
9616
+ } );//_.each
9617
+ if ( ! hasProcessed )
9618
+ return dfd.resolve().promise();
9619
+ return dfd.promise();
9620
+ },
9621
+ _setVisibility : function ( dominusSetVal, servusShortSetId, dominusParams, refresh ) {
9622
+ var wpServusSetId = api.CZR_Helpers.build_setId( servusShortSetId ),
9623
+ visibility = dominusParams.visibility( dominusSetVal, servusShortSetId, dominusParams.dominus );
9624
+
9625
+ refresh = refresh || false;
9626
+ if ( ! _.isBoolean( visibility ) || ( 'unchanged' == visibility && ! refresh ) )
9627
+ return;
9628
+
9629
+ var _doVisibilitiesWhenPossible = function() {
9630
+ if ( ! api.state.has( 'silent-update-processing' ) || api.state( 'silent-update-processing' )() )
9631
+ return;
9632
+ api.control( wpServusSetId, function( _controlInst ) {
9633
+ var _args = {
9634
+ duration : 'fast',
9635
+ completeCallback : function() {},
9636
+ unchanged : false
9637
+ };
9638
+
9639
+ if ( _.has( _controlInst, 'active' ) )
9640
+ visibility = visibility && _controlInst.active();
9641
+
9642
+ if ( _.has( _controlInst, 'defaultActiveArguments' ) )
9643
+ _args = control.defaultActiveArguments;
9644
+
9645
+ _controlInst.onChangeActive( visibility , _controlInst.defaultActiveArguments );
9646
+ });
9647
+ api.state( 'silent-update-processing' ).unbind( _doVisibilitiesWhenPossible );
9648
+ };
9649
+
9650
+ if ( api.state.has( 'silent-update-processing' ) && api.state( 'silent-update-processing' )() ) {
9651
+ api.state( 'silent-update-processing' ).bind( _doVisibilitiesWhenPossible );
9652
+ } else {
9653
+ _doVisibilitiesWhenPossible();
9654
+ }
9655
+
9656
+ },
9657
+ _getControlDeps : function() {
9658
+ return {};
9659
+ },
9660
+ _prepareDominusParams : function( params_candidate ) {
9661
+ var self = this,
9662
+ _ready_params = {};
9663
+ if ( ! _.isObject( params_candidate ) ) {
9664
+ throw new Error('Visibilities : a dominus param definition must be an object.');
9665
+ }
9666
+ if ( ! _.has( params_candidate, 'visibility' ) && ! _.has( params_candidate, 'actions' ) ) {
9667
+ throw new Error('Visibilities : a dominus definition must include a visibility or an actions callback.');
9668
+ }
9669
+ if ( ! _.has( params_candidate, 'dominus' ) || ! _.isString( params_candidate.dominus ) || _.isEmpty( params_candidate.dominus ) ) {
9670
+ throw new Error( 'Visibilities : a dominus control id must be a not empty string.');
9671
+ }
9672
+ var wpDominusId = api.CZR_Helpers.build_setId( params_candidate.dominus );
9673
+ if ( ! api.control.has( wpDominusId ) ) {
9674
+ throw new Error( 'Visibilities : a dominus control id is not registered : ' + wpDominusId );
9675
+ }
9676
+ if ( ! _.has( params_candidate, 'servi' ) || _.isUndefined( params_candidate.servi ) || ! _.isArray( params_candidate.servi ) || _.isEmpty( params_candidate.servi ) ) {
9677
+ throw new Error( 'Visibilities : servi must be set as an array not empty.');
9678
+ }
9679
+
9680
+ _.each( self.defaultDominusParams , function( _value, _key ) {
9681
+ var _candidate_val = params_candidate[ _key ];
9682
+
9683
+ switch( _key ) {
9684
+ case 'visibility' :
9685
+ if ( ! _.isUndefined( _candidate_val ) && ! _.isEmpty( _candidate_val ) && ! _.isFunction( _candidate_val ) ) {
9686
+ throw new Error( 'Visibilities : a dominus visibility callback must be a function : ' + params_candidate.dominus );
9687
+ }
9688
+ break;
9689
+ case 'actions' :
9690
+ if ( ! _.isUndefined( _candidate_val ) && ! _.isEmpty( _candidate_val ) && ! _.isFunction( _candidate_val ) ) {
9691
+ throw new Error( 'Visibilities : a dominus actions callback must be a function : ' + params_candidate.dominus );
9692
+ }
9693
+ break;
9694
+ case 'onSectionExpand' :
9695
+ if ( ! _.isUndefined( _candidate_val ) && ! _.isEmpty( _candidate_val ) && ! _.isBoolean( _candidate_val ) ) {
9696
+ throw new Error( 'Visibilities : a dominus onSectionExpand param must be a boolean : ' + params_candidate.dominus );
9697
+ }
9698
+ break;
9699
+ }
9700
+ _ready_params[_key] = _candidate_val;
9701
+ });
9702
+
9703
+ return _ready_params;
9704
+ },
9705
+ _handleFaviconNote : function() {
9706
+ var self = this,
9707
+ _fav_setId = api.CZR_Helpers.build_setId( serverControlParams.faviconOptionName );
9708
+ if ( ! api.has('site_icon') || ! api.control('site_icon') || ( api.has( _fav_setId ) && 0 === + api( _fav_setId )() ) || + api('site_icon')() > 0 )
9709
+ return;
9710
+
9711
+ var _oldDes = api.control('site_icon').params.description;
9712
+ _newDes = ['<strong>' , translatedStrings.faviconNote || '' , '</strong><br/><br/>' ].join('') + _oldDes;
9713
+ self._printFaviconNote(_newDes );
9714
+ api('site_icon').callbacks.add( function(to) {
9715
+ if ( +to > 0 ) {
9716
+ api.control('site_icon').container.find('.description').text(_oldDes);
9717
+ if ( api.has( _fav_setId ) )
9718
+ api( _fav_setId ).set("");
9719
+ }
9720
+ else {
9721
+ self._printFaviconNote(_newDes );
9722
+ }
9723
+ });
9724
+ },
9725
+ _printFaviconNote : function( _newDes ) {
9726
+ api.control('site_icon').container.find('.description').html(_newDes);
9727
+ }
9728
+ }
9729
+ );//api.Class.extend() //api.CZR_ctrlDependencies
9730
+
9731
+ })( wp.customize, jQuery, _);//DOM READY :
9732
+ (function (wp, $) {
9733
+ $( function($) {
9734
+ var api = wp.customize || api;
9735
+ $('.accordion-section').not('.control-panel').click( function () {
9736
+ _recenter_current_section($(this));
9737
+ });
9738
+
9739
+ function _recenter_current_section( section ) {
9740
+ var $siblings = section.siblings( '.open' );
9741
+ if ( 0 !== $siblings.length && $siblings.offset().top < 0 ) {
9742
+ $('.wp-full-overlay-sidebar-content').animate({
9743
+ scrollTop: - $('#customize-theme-controls').offset().top - $siblings.height() + section.offset().top + $('.wp-full-overlay-sidebar-content').offset().top
9744
+ }, 700);
9745
+ }
9746
+ }//end of fn
9747
+ api.czrSetupCheckbox = function( controlId, refresh ) {
9748
+ $('input[type=checkbox]', api.control(controlId).container ).each( function() {
9749
+ if ( 0 === $(this).val() || '0' == $(this).val() || 'off' == $(this).val() || _.isEmpty($(this).val() ) ) {
9750
+ $(this).prop('checked', false);
9751
+ } else {
9752
+ $(this).prop('checked', true);
9753
+ }
9754
+ if ( 0 !== $(this).closest('div[class^="icheckbox"]').length )
9755
+ return;
9756
+
9757
+ $(this).iCheck({
9758
+ checkboxClass: 'icheckbox_flat-grey',
9759
+ radioClass: 'iradio_flat-grey',
9760
+ })
9761
+ .on( 'ifChanged', function(e){
9762
+ $(this).val( false === $(this).is(':checked') ? 0 : 1 );
9763
+ $(e.currentTarget).trigger('change');
9764
+ });
9765
+ });
9766
+ };//api.czrSetupCheckbox()
9767
+ api.czrSetupSelect = function(controlId, refresh) {
9768
+ $('select[data-customize-setting-link]', api.control(controlId).container )
9769
+ .not('.no-selecter-js')
9770
+ .each( function() {
9771
+ $(this).selecter({
9772
+ });
9773
+ });
9774
+ };//api.czrSetupSelect()
9775
+ api.czrSetupStepper = function(controlId, refresh) {
9776
+ $('input[type="number"]', api.control(controlId).container ).each( function() {
9777
+ $(this).stepper();
9778
+ });
9779
+ };//api.czrSetupStepper()
9780
+
9781
+ api.control.each(function(control){
9782
+ if ( ! _.has(control,'id') )
9783
+ return;
9784
+ if ( 'widget_' != control.id.substring(0, 'widget_'.length ) && 'nav_menu' != control.id.substring( 0, 'nav_menu'.length ) ) {
9785
+ api.czrSetupCheckbox(control.id);
9786
+ }
9787
+ if ( 'nav_menu_locations' != control.id.substring( 0, 'nav_menu_locations'.length ) ) {
9788
+ api.czrSetupSelect(control.id);
9789
+ }
9790
+ api.czrSetupStepper(control.id);
9791
+ });
9792
+ if ( $('.control-panel-widgets').find('.accordion-section-title').first().length ) {
9793
+ $('.control-panel-widgets').find('.accordion-section-title')
9794
+ .first()
9795
+ .prepend( $('<span/>', {class:'fa fa-magic'} ) );
9796
+ }
9797
+
9798
+
9799
+ var fireHeaderButtons = function() {
9800
+ var $home_button = $('<span/>', { class:'customize-controls-home fa fa-home', html:'<span class="screen-reader-text">Home</span>' } );
9801
+ $.when( $('#customize-header-actions').append( $home_button ) )
9802
+ .done( function() {
9803
+ $home_button
9804
+ .keydown( function( event ) {
9805
+ if ( 9 === event.which ) // tab
9806
+ return;
9807
+ if ( 13 === event.which ) // enter
9808
+ this.click();
9809
+ event.preventDefault();
9810
+ })
9811
+ .on( 'click.customize-controls-home', function() {
9812
+ if ( api.section.has( api.czr_activeSectionId() ) ) {
9813
+ api.section( api.czr_activeSectionId() ).expanded( false );
9814
+ } else {
9815
+ api.section.each( function( _s ) {
9816
+ _s.expanded( false );
9817
+ });
9818
+ }
9819
+ api.panel.each( function( _p ) {
9820
+ _p.expanded( false );
9821
+ });
9822
+ });
9823
+ });
9824
+ };
9825
+ fireHeaderButtons();
9826
+ });//end of $( function($) ) dom ready
9827
+
9828
+ })( wp, jQuery);
assets/czr/js/czr-control.min.js ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! addEventListener Polyfill ie9- http://stackoverflow.com/a/27790212*/
2
+ window.addEventListener=window.addEventListener||function(a,b){window.attachEvent("on"+a,b)},/*! Datenow Polyfill ie9- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now */
3
+ Date.now||(Date.now=function(){return(new Date).getTime()}),/*! Object.create monkey patch ie8 http://stackoverflow.com/a/18020326 */
4
+ Object.create||(Object.create=function(a,b){function c(){}if("undefined"!=typeof b)throw"The multiple-argument version of Object.create is not provided by this browser and cannot be shimmed.";return c.prototype=a,new c}),/*! https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter */
5
+ Array.prototype.filter||(Array.prototype.filter=function(a){"use strict";if(void 0===this||null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if("function"!=typeof a)throw new TypeError;for(var d=[],e=arguments.length>=2?arguments[1]:void 0,f=0;f<c;f++)if(f in b){var g=b[f];a.call(e,g,f,b)&&d.push(g)}return d}),/*! map was added to the ECMA-262 standard in the 5th edition */
6
+ Array.prototype.map||(Array.prototype.map=function(a,b){var c,d,e;if(null===this)throw new TypeError(" this is null or not defined");var f=Object(this),g=f.length>>>0;if("function"!=typeof a)throw new TypeError(a+" is not a function");for(arguments.length>1&&(c=b),d=new Array(g),e=0;e<g;){var h,i;e in f&&(h=f[e],i=a.call(c,h,e,f),d[e]=i),e++}return d}),/*! iCheck v1.0.1 by Damir Sultanov, http://git.io/arlzeA, MIT Licensed */
7
+ "function"!=typeof jQuery.fn.iCheck&&!function(a){function b(a,b,e){var f=a[0],g=/er/.test(e)?p:/bl/.test(e)?n:l,h=e==q?{checked:f[l],disabled:f[n],indeterminate:"true"==a.attr(p)||"false"==a.attr(o)}:f[g];if(/^(ch|di|in)/.test(e)&&!h)c(a,g);else if(/^(un|en|de)/.test(e)&&h)d(a,g);else if(e==q)for(g in h)h[g]?c(a,g,!0):d(a,g,!0);else b&&"toggle"!=e||(b||a[u]("ifClicked"),h?f[r]!==k&&d(a,g):c(a,g))}function c(b,c,e){var q=b[0],u=b.parent(),v=c==l,x=c==p,y=c==n,z=x?o:v?m:"enabled",A=f(b,z+g(q[r])),B=f(b,c+g(q[r]));if(!0!==q[c]){if(!e&&c==l&&q[r]==k&&q.name){var C=b.closest("form"),D='input[name="'+q.name+'"]',D=C.length?C.find(D):a(D);D.each(function(){this!==q&&a(this).data(i)&&d(a(this),c)})}x?(q[c]=!0,q[l]&&d(b,l,"force")):(e||(q[c]=!0),v&&q[p]&&d(b,p,!1)),h(b,v,c,e)}q[n]&&f(b,w,!0)&&u.find("."+j).css(w,"default"),u[s](B||f(b,c)||""),y?u.attr("aria-disabled","true"):u.attr("aria-checked",x?"mixed":"true"),u[t](A||f(b,z)||"")}function d(a,b,c){var d=a[0],e=a.parent(),i=b==l,k=b==p,q=b==n,u=k?o:i?m:"enabled",v=f(a,u+g(d[r])),x=f(a,b+g(d[r]));!1!==d[b]&&((k||!c||"force"==c)&&(d[b]=!1),h(a,i,u,c)),!d[n]&&f(a,w,!0)&&e.find("."+j).css(w,"pointer"),e[t](x||f(a,b)||""),q?e.attr("aria-disabled","false"):e.attr("aria-checked","false"),e[s](v||f(a,u)||"")}function e(b,c){b.data(i)&&(b.parent().html(b.attr("style",b.data(i).s||"")),c&&b[u](c),b.off(".i").unwrap(),a(v+'[for="'+b[0].id+'"]').add(b.closest(v)).off(".i"))}function f(a,b,c){return a.data(i)?a.data(i).o[b+(c?"":"Class")]:void 0}function g(a){return a.charAt(0).toUpperCase()+a.slice(1)}function h(a,b,c,d){d||(b&&a[u]("ifToggled"),a[u]("ifChanged")[u]("if"+g(c)))}var i="iCheck",j=i+"-helper",k="radio",l="checked",m="un"+l,n="disabled",o="determinate",p="in"+o,q="update",r="type",s="addClass",t="removeClass",u="trigger",v="label",w="cursor",x=/ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent);a.fn[i]=function(f,g){var h='input[type="checkbox"], input[type="'+k+'"]',m=a(),o=function(b){b.each(function(){var b=a(this);m=b.is(h)?m.add(b):m.add(b.find(h))})};if(/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(f))return f=f.toLowerCase(),o(this),m.each(function(){var c=a(this);"destroy"==f?e(c,"ifDestroyed"):b(c,!0,f),a.isFunction(g)&&g()});if("object"!=typeof f&&f)return this;var w=a.extend({checkedClass:l,disabledClass:n,indeterminateClass:p,labelHover:!0,aria:!1},f),y=w.handle,z=w.hoverClass||"hover",A=w.focusClass||"focus",B=w.activeClass||"active",C=!!w.labelHover,D=w.labelHoverClass||"hover",E=0|(""+w.increaseArea).replace("%","");return("checkbox"==y||y==k)&&(h='input[type="'+y+'"]'),-50>E&&(E=-50),o(this),m.each(function(){var f=a(this);e(f);var g=this,h=g.id,m=-E+"%",o=100+2*E+"%",o={position:"absolute",top:m,left:m,display:"block",width:o,height:o,margin:0,padding:0,background:"#fff",border:0,opacity:0},m=x?{position:"absolute",visibility:"hidden"}:E?o:{position:"absolute",opacity:0},p="checkbox"==g[r]?w.checkboxClass||"icheckbox":w.radioClass||"i"+k,y=a(v+'[for="'+h+'"]').add(f.closest(v)),F=!!w.aria,G=i+"-"+Math.random().toString(36).substr(2,6),H='<div class="'+p+'" '+(F?'role="'+g[r]+'" ':"");F&&y.each(function(){H+='aria-labelledby="',this.id?H+=this.id:(this.id=G,H+=G),H+='"'}),H=f.wrap(H+"/>")[u]("ifCreated").parent().append(w.insert),o=a('<ins class="'+j+'"/>').css(o).appendTo(H),f.data(i,{o:w,s:f.attr("style")}).css(m),w.inheritClass&&H[s](g.className||""),w.inheritID&&h&&H.attr("id",i+"-"+h),"static"==H.css("position")&&H.css("position","relative"),b(f,!0,q),y.length&&y.on("click.i mouseover.i mouseout.i touchbegin.i touchend.i",function(c){var d=c[r],e=a(this);if(!g[n]){if("click"==d){if(a(c.target).is("a"))return;b(f,!1,!0)}else C&&(/ut|nd/.test(d)?(H[t](z),e[t](D)):(H[s](z),e[s](D)));if(!x)return!1;c.stopPropagation()}}),f.on("click.i focus.i blur.i keyup.i keydown.i keypress.i",function(a){var b=a[r];return a=a.keyCode,"click"!=b&&("keydown"==b&&32==a?(g[r]==k&&g[l]||(g[l]?d(f,l):c(f,l)),!1):void("keyup"==b&&g[r]==k?!g[l]&&c(f,l):/us|ur/.test(b)&&H["blur"==b?t:s](A)))}),o.on("click mousedown mouseup mouseover mouseout touchbegin.i touchend.i",function(a){var c=a[r],d=/wn|up/.test(c)?B:z;if(!g[n]){if("click"==c?b(f,!1,!0):(/wn|er|in/.test(c)?H[s](d):H[t](d+" "+B),y.length&&C&&d==z&&y[/ut|nd/.test(c)?t:s](D)),!x)return!1;a.stopPropagation()}})})}}(window.jQuery||window.Zepto),"function"!=typeof jQuery.fn.selecter&&!function(a,b){"use strict";function c(b){b=a.extend({},x,b||{}),null===w&&(w=a("body"));for(var c=a(this),e=0,f=c.length;f>e;e++)d(c.eq(e),b);return c}function d(b,c){if(!b.hasClass("selecter-element")){c=a.extend({},c,b.data("selecter-options")),c.external&&(c.links=!0);var d=b.find("option, optgroup"),g=d.filter("option"),h=g.filter(":selected"),n=""!==c.label?-1:g.index(h),p=c.links?"nav":"div";c.tabIndex=b[0].tabIndex,b[0].tabIndex=-1,c.multiple=b.prop("multiple"),c.disabled=b.is(":disabled");var q="<"+p+' class="selecter '+c.customClass;v?q+=" mobile":c.cover&&(q+=" cover"),q+=c.multiple?" multiple":" closed",c.disabled&&(q+=" disabled"),q+='" tabindex="'+c.tabIndex+'">',c.multiple||(q+='<span class="selecter-selected'+(""!==c.label?" placeholder":"")+'">',q+=a("<span></span").text(r(""!==c.label?c.label:h.text(),c.trim)).html(),q+="</span>"),q+='<div class="selecter-options">',q+="</div>",q+="</"+p+">",b.addClass("selecter-element").after(q);var s=b.next(".selecter"),u=a.extend({$select:b,$allOptions:d,$options:g,$selecter:s,$selected:s.find(".selecter-selected"),$itemsWrapper:s.find(".selecter-options"),index:-1,guid:t++},c);e(u),o(n,u),void 0!==a.fn.scroller&&u.$itemsWrapper.scroller(),u.$selecter.on("touchstart.selecter click.selecter",".selecter-selected",u,f).on("click.selecter",".selecter-item",u,j).on("close.selecter",u,i).data("selecter",u),u.$select.on("change.selecter",u,k),v||(u.$selecter.on("focus.selecter",u,l).on("blur.selecter",u,m),u.$select.on("focus.selecter",u,function(a){a.data.$selecter.trigger("focus")}))}}function e(b){for(var c="",d=b.links?"a":"span",e=0,f=0,g=b.$allOptions.length;g>f;f++){var h=b.$allOptions.eq(f);if("OPTGROUP"===h[0].tagName)c+='<span class="selecter-group',h.is(":disabled")&&(c+=" disabled"),c+='">'+h.attr("label")+"</span>";else{var i=h.val();h.attr("value")||h.attr("value",i),c+="<"+d+' class="selecter-item',h.is(":selected")&&""===b.label&&(c+=" selected"),h.is(":disabled")&&(c+=" disabled"),c+='" ',c+=b.links?'href="'+i+'"':'data-value="'+i+'"',c+=">"+a("<span></span>").text(r(h.text(),b.trim)).html()+"</"+d+">",e++}}b.$itemsWrapper.html(c),b.$items=b.$selecter.find(".selecter-item")}function f(c){c.preventDefault(),c.stopPropagation();var d=c.data;if(!d.$select.is(":disabled"))if(a(".selecter").not(d.$selecter).trigger("close.selecter",[d]),v){var e=d.$select[0];if(b.document.createEvent){var f=b.document.createEvent("MouseEvents");f.initMouseEvent("mousedown",!1,!0,b,0,0,0,0,0,!1,!1,!1,!1,0,null),e.dispatchEvent(f)}else e.fireEvent&&e.fireEvent("onmousedown")}else d.$selecter.hasClass("closed")?g(c):d.$selecter.hasClass("open")&&i(c)}function g(b){b.preventDefault(),b.stopPropagation();var c=b.data;if(!c.$selecter.hasClass("open")){var d=c.$selecter.offset(),e=w.outerHeight(),f=c.$itemsWrapper.outerHeight(!0),g=c.index>=0?c.$items.eq(c.index).position():{left:0,top:0};d.top+f>e&&c.$selecter.addClass("bottom"),c.$itemsWrapper.show(),c.$selecter.removeClass("closed").addClass("open"),w.on("click.selecter-"+c.guid,":not(.selecter-options)",c,h),void 0!==a.fn.scroller?c.$itemsWrapper.scroller("scroll",c.$itemsWrapper.find(".scroller-content").scrollTop()+g.top,0).scroller("reset"):c.$itemsWrapper.scrollTop(c.$itemsWrapper.scrollTop()+g.top)}}function h(b){b.preventDefault(),b.stopPropagation(),0===a(b.currentTarget).parents(".selecter").length&&i(b)}function i(a){a.preventDefault(),a.stopPropagation();var b=a.data;b.$selecter.hasClass("open")&&(b.$itemsWrapper.hide(),b.$selecter.removeClass("open bottom").addClass("closed"),w.off(".selecter-"+b.guid))}function j(b){b.preventDefault(),b.stopPropagation();var c=a(this),d=b.data;if(!d.$select.is(":disabled")){if(d.$itemsWrapper.is(":visible")){var e=d.$items.index(c);o(e,d),p(d)}d.multiple||i(b)}}function k(b,c){var d=a(this),e=b.data;if(!c&&!e.multiple){var f=e.$options.index(e.$options.filter("[value='"+s(d.val())+"']"));o(f,e),p(e)}}function l(b){b.preventDefault(),b.stopPropagation();var c=b.data;c.$select.is(":disabled")||c.multiple||(c.$selecter.addClass("focus").on("keydown.selecter"+c.guid,c,n),a(".selecter").not(c.$selecter).trigger("close.selecter",[c]))}function m(b){b.preventDefault(),b.stopPropagation();var c=b.data;c.$selecter.removeClass("focus").off("keydown.selecter"+c.guid+" keyup.selecter"+c.guid),a(".selecter").not(c.$selecter).trigger("close.selecter",[c])}function n(b){var c=b.data;if(13===b.keyCode)c.$selecter.hasClass("open")&&(i(b),o(c.index,c)),p(c);else if(!(9===b.keyCode||b.metaKey||b.altKey||b.ctrlKey||b.shiftKey)){b.preventDefault(),b.stopPropagation();var d=c.$items.length-1,e=c.index<0?0:c.index;if(a.inArray(b.keyCode,u?[38,40,37,39]:[38,40])>-1)e+=38===b.keyCode||u&&37===b.keyCode?-1:1,0>e&&(e=0),e>d&&(e=d);else{var f,g,h=String.fromCharCode(b.keyCode).toUpperCase();for(g=c.index+1;d>=g;g++)if(f=c.$options.eq(g).text().charAt(0).toUpperCase(),f===h){e=g;break}if(0>e)for(g=0;d>=g;g++)if(f=c.$options.eq(g).text().charAt(0).toUpperCase(),f===h){e=g;break}}e>=0&&o(e,c)}}function o(a,b){var c=b.$items.eq(a),d=c.hasClass("selected"),e=c.hasClass("disabled");if(!e){if(-1===a&&""!==b.label)b.$selected.html(b.label);else if(d)b.multiple&&(b.$options.eq(a).prop("selected",null),c.removeClass("selected"));else{var f=c.html();c.data("value"),b.multiple?b.$options.eq(a).prop("selected",!0):(b.$selected.html(f).removeClass("placeholder"),b.$items.filter(".selected").removeClass("selected"),b.$select[0].selectedIndex=a),c.addClass("selected")}(!d||b.multiple)&&(b.index=a)}}function p(a){a.links?q(a):(a.callback.call(a.$selecter,a.$select.val(),a.index),a.$select.trigger("change",[!0]))}function q(a){var c=a.$select.val();a.external?b.open(c):b.location.href=c}function r(a,b){return 0===b?a:a.length>b?a.substring(0,b)+"...":a}function s(a){return a.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1")}var t=0,u=b.navigator.userAgent.toLowerCase().indexOf("firefox")>-1,v=/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(b.navigator.userAgent||b.navigator.vendor||b.opera),w=null,x={callback:a.noop,cover:!1,customClass:"",label:"",external:!1,links:!1,trim:0},y={defaults:function(b){return x=a.extend(x,b||{}),a(this)},disable:function(b){return a(this).each(function(c,d){var e=a(d).next(".selecter").data("selecter");if(e)if("undefined"!=typeof b){var f=e.$items.index(e.$items.filter("[data-value="+b+"]"));e.$items.eq(f).addClass("disabled"),e.$options.eq(f).prop("disabled",!0)}else e.$selecter.hasClass("open")&&e.$selecter.find(".selecter-selected").trigger("click.selecter"),e.$selecter.addClass("disabled"),e.$select.prop("disabled",!0)})},enable:function(b){return a(this).each(function(c,d){var e=a(d).next(".selecter").data("selecter");if(e)if("undefined"!=typeof b){var f=e.$items.index(e.$items.filter("[data-value="+b+"]"));e.$items.eq(f).removeClass("disabled"),e.$options.eq(f).prop("disabled",!1)}else e.$selecter.removeClass("disabled"),e.$select.prop("disabled",!1)})},destroy:function(){return a(this).each(function(b,c){var d=a(c).next(".selecter").data("selecter");d&&(d.$selecter.hasClass("open")&&d.$selecter.find(".selecter-selected").trigger("click.selecter"),void 0!==a.fn.scroller&&d.$selecter.find(".selecter-options").scroller("destroy"),d.$select[0].tabIndex=d.tabIndex,d.$select.off(".selecter").removeClass("selecter-element").show(),d.$selecter.off(".selecter").remove())})},refresh:function(){return a(this).each(function(b,c){var d=a(c).next(".selecter").data("selecter");if(d){var f=d.index;d.$allOptions=d.$select.find("option, optgroup"),d.$options=d.$allOptions.filter("option"),d.index=-1,f=d.$options.index(d.$options.filter(":selected")),e(d),o(f,d)}})}};a.fn.selecter=function(a){return y[a]?y[a].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof a&&a?this:c.apply(this,arguments)},a.selecter=function(a){"defaults"===a&&y.defaults.apply(this,Array.prototype.slice.call(arguments,1))}}(jQuery,window),"function"!=typeof jQuery.fn.stepper&&!function(a){"use strict";function b(b){b=a.extend({},k,b||{});for(var d=a(this),e=0,f=d.length;f>e;e++)c(d.eq(e),b);return d}function c(b,c){if(!b.hasClass("stepper-input")){c=a.extend({},c,b.data("stepper-options"));var e=parseFloat(b.attr("min")),f=parseFloat(b.attr("max")),g=parseFloat(b.attr("step"))||1;b.addClass("stepper-input").wrap('<div class="stepper '+c.customClass+'" />').after('<span class="stepper-arrow up">'+c.labels.up+'</span><span class="stepper-arrow down">'+c.labels.down+"</span>");var h=b.parent(".stepper"),j=a.extend({$stepper:h,$input:b,$arrow:h.find(".stepper-arrow"),min:void 0!==typeof e&&!isNaN(e)&&e,max:void 0!==typeof f&&!isNaN(f)&&f,step:void 0===typeof g||isNaN(g)?1:g,timer:null},c);j.digits=i(j.step),b.is(":disabled")&&h.addClass("disabled"),h.on("touchstart.stepper mousedown.stepper",".stepper-arrow",j,d).data("stepper",j)}}function d(b){b.preventDefault(),b.stopPropagation(),e(b);var c=b.data;if(!c.$input.is(":disabled")&&!c.$stepper.hasClass("disabled")){var d=a(b.target).hasClass("up")?c.step:-c.step;c.timer=g(c.timer,125,function(){f(c,d,!1)}),f(c,d),a("body").on("touchend.stepper mouseup.stepper",c,e)}}function e(b){b.preventDefault(),b.stopPropagation();var c=b.data;h(c.timer),a("body").off(".stepper")}function f(a,b){var c=parseFloat(a.$input.val()),d=b;void 0===typeof c||isNaN(c)?d=a.min!==!1?a.min:0:a.min!==!1&&c<a.min?d=a.min:d+=c;var e=(d-a.min)%a.step;0!==e&&(d-=e),a.min!==!1&&d<a.min&&(d=a.min),a.max!==!1&&d>a.max&&(d-=a.step),d!==c&&(d=j(d,a.digits),a.$input.val(d).trigger("change"))}function g(a,b,c){return h(a),setInterval(c,b)}function h(a){a&&(clearInterval(a),a=null)}function i(a){var b=String(a);return b.indexOf(".")>-1?b.length-b.indexOf(".")-1:0}function j(a,b){var c=Math.pow(10,b);return Math.round(a*c)/c}var k={customClass:"",labels:{up:"Up",down:"Down"}},l={defaults:function(b){return k=a.extend(k,b||{}),a(this)},destroy:function(){return a(this).each(function(){var b=a(this).data("stepper");b&&(b.$stepper.off(".stepper").find(".stepper-arrow").remove(),b.$input.unwrap().removeClass("stepper-input"))})},disable:function(){return a(this).each(function(){var b=a(this).data("stepper");b&&(b.$input.attr("disabled","disabled"),b.$stepper.addClass("disabled"))})},enable:function(){return a(this).each(function(){var b=a(this).data("stepper");b&&(b.$input.attr("disabled",null),b.$stepper.removeClass("disabled"))})}};a.fn.stepper=function(a){return l[a]?l[a].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof a&&a?this:b.apply(this,arguments)},a.stepper=function(a){"defaults"===a&&l.defaults.apply(this,Array.prototype.slice.call(arguments,1))}}(jQuery,this),/*! Select2 4.0.1 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k<a.length;k+=1)if(m=a[k],"."===m)a.splice(k,1),k-=1;else if(".."===m){if(1===k&&(".."===a[2]||".."===a[0]))break;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=v.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),n.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var c=r[a];delete r[a],t[a]=!0,m.apply(b,c)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,c,d,f){var h,k,l,m,n,s,u=[],v=typeof d;if(f=f||a,"undefined"===v||"function"===v){for(c=!c.length&&d.length?["require","exports","module"]:c,n=0;n<c.length;n+=1)if(m=o(c[n],f),k=m.f,"require"===k)u[n]=p.require(a);else if("exports"===k)u[n]=p.exports(a),s=!0;else if("module"===k)h=u[n]=p.module(a);else if(e(q,k)||e(r,k)||e(t,k))u[n]=j(k);else{if(!m.p)throw new Error(a+" missing "+k);m.p.load(m.n,g(f,!0),i(k),{}),u[n]=q[k]}l=d?d.apply(q[a],u):void 0,a&&(h&&h.exports!==b&&h.exports!==q[a]?q[a]=h.exports:l===b&&s||(q[a]=l))}else a&&(q[a]=d)},a=c=n=function(a,c,d,e,f){if("string"==typeof a)return p[a]?p[a](c):j(o(a,c).f);if(!a.splice){if(s=a,s.deps&&n(s.deps,s.callback),!c)return;c.splice?(a=c,c=d,d=null):a=b}return c=c||function(){},"function"==typeof d&&(d=e,e=f),e?m(b,a,c,d):setTimeout(function(){m(b,a,c,d)},4),n},n.config=function(a){return n(a)},a._defined=q,d=function(a,b,c){if("string"!=typeof a)throw new Error("See almond README: incorrect module build, no module name");b.splice||(c=b,b=[]),e(q,a)||e(r,a)||(r[a]=[a,b,c])},d.amd={jQuery:!0}}(),b.requirejs=a,b.require=c,b.define=d}}(),b.define("almond",function(){}),b.define("jquery",[],function(){var b=a||$;return null==b&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),b}),b.define("select2/utils",["jquery"],function(a){function b(a){var b=a.prototype,c=[];for(var d in b){var e=b[d];"function"==typeof e&&"constructor"!==d&&c.push(d)}return c}var c={};c.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},c.Decorate=function(a,c){function d(){var b=Array.prototype.unshift,d=c.prototype.constructor.length,e=a.prototype.constructor;d>0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=a.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){var a=Array.prototype.unshift;return a.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var d=function(){this.listeners={}};return d.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},d.prototype.trigger=function(a){var b=Array.prototype.slice;this.listeners=this.listeners||{},a in this.listeners&&this.invoke(this.listeners[a],b.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},d.prototype.invoke=function(a,b){for(var c=0,d=a.length;d>c;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;a>c;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e<c.length;e++){var f=c[e];f=f.substring(0,1).toLowerCase()+f.substring(1),f in d||(d[f]={}),e==c.length-1&&(d[f]=a[b]),d=d[f]}delete a[b]}}return a},c.hasScroll=function(b,c){var d=a(c),e=c.style.overflowX,f=c.style.overflowY;return(e!==f||"hidden"!==f&&"visible"!==f)&&("scroll"===e||"scroll"===f||(d.innerHeight()<c.scrollHeight||d.innerWidth()<c.scrollWidth))},c.escapeMarkup=function(a){var b={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('<li role="treeitem" aria-live="assertive" class="select2-results__option"></li>'),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c<a.results.length;c++){var d=a.results[c],e=this.option(d);b.push(e)}this.$results.append(b)},c.prototype.position=function(a,b){var c=b.find(".select2-results");c.append(a)},c.prototype.sort=function(a){var b=this.options.get("sorter");return b(a)},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()}),e=b.$results.find(".select2-results__option[aria-selected]");e.each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")});var f=e.filter("[aria-selected=true]");f.length>0?f.first().trigger("mouseenter"):e.first().trigger("mouseenter")})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group",a(h),this.template(b,h);for(var i=[],j=0;j<b.children.length;j++){var k=b.children[j],l=this.option(k);i.push(l)}var m=a("<ul></ul>",{"class":"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&d.setClasses()}),b.on("unselect",function(){b.isOpen()&&d.setClasses()}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):0>h-g&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-d.$results.scrollTop()+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");return"true"===c.attr("aria-selected")?void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{})):void d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),2>=c?this.$results.scrollTop(0):(g>this.$results.outerHeight()||0>g)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},e.prototype.selectionContainer=function(){return a("<span></span>")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('<ul class="select2-selection__rendered"></ul>'),a},d.prototype.bind=function(b,c){
8
+ var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},d.prototype.selectionContainer=function(){var b=a('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">&times;</span></li>');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d<a.length;d++){var e=a[d],f=this.selectionContainer(),g=this.display(e,f);f.append(g),f.prop("title",e.title||e.text),f.data("data",e),b.push(f)}var h=this.$selection.find(".select2-selection__rendered");c.appendMany(h,b)}},d}),b.define("select2/selection/placeholder",["../utils"],function(a){function b(a,b,c){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c)}return b.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},b.prototype.createPlaceholder=function(a,b){var c=this.selectionContainer();return c.html(this.display(b)),c.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),c},b.prototype.update=function(a,b){var c=1==b.length&&b[0].id!=this.placeholder.id,d=b.length>1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e<d.length;e++){var f={data:d[e]};if(this.trigger("unselect",f),f.prevented)return}this.$element.val(this.placeholder.id).trigger("change"),this.trigger("toggle",{})}}},c.prototype._handleKeyboardClear=function(a,c,d){d.isOpen()||(c.which==b.DELETE||c.which==b.BACKSPACE)&&this._handleClear(c)},c.prototype.update=function(b,c){if(b.call(this,c),!(this.$selection.find(".select2-selection__placeholder").length>0||0===c.length)){var d=a('<span class="select2-selection__clear">&times;</span>');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" aria-autocomplete="list" /></li>');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&11>=f;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"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","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"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","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f<a.length;f++){var g=a[f].id;-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")});else{var d=a.id;this.$element.val(d),this.$element.trigger("change")}},d.prototype.unselect=function(a){var b=this;if(this.$element.prop("multiple"))return a.selected=!1,c(a.element).is("option")?(a.element.selected=!1,void this.$element.trigger("change")):void this.current(function(d){for(var e=[],f=0;f<d.length;f++){var g=d[f].id;g!==a.id&&-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")})},d.prototype.bind=function(a,b){var c=this;this.container=a,a.on("select",function(a){c.select(a.data)}),a.on("unselect",function(a){c.unselect(a.data)})},d.prototype.destroy=function(){this.$element.find("*").each(function(){c.removeData(this,"data")})},d.prototype.query=function(a,b){var d=[],e=this,f=this.$element.children();f.each(function(){var b=c(this);if(b.is("option")||b.is("optgroup")){var f=e.item(b),g=e.matches(a,f);null!==g&&d.push(g)}}),b({results:d})},d.prototype.addOptions=function(a){b.appendMany(this.$element,a)},d.prototype.option=function(a){var b;a.children?(b=document.createElement("optgroup"),b.label=a.text):(b=document.createElement("option"),void 0!==b.textContent?b.textContent=a.text:b.innerText=a.text),a.id&&(b.value=a.id),a.disabled&&(b.disabled=!0),a.selected&&(b.selected=!0),a.title&&(b.title=a.title);var d=c(b),e=this._normalizeItem(a);return e.element=b,c.data(b,"data",e),d},d.prototype.item=function(a){var b={};if(b=c.data(a[0],"data"),null!=b)return b;if(a.is("option"))b={id:a.val(),text:a.text(),disabled:a.prop("disabled"),selected:a.prop("selected"),title:a.prop("title")};else if(a.is("optgroup")){b={text:a.prop("label"),children:[],title:a.prop("title")};for(var d=a.children("option"),e=[],f=0;f<d.length;f++){var g=c(d[f]),h=this.item(g);e.push(h)}b.children=e}return b=this._normalizeItem(b),b.element=a[0],c.data(a[0],"data",b),b},d.prototype._normalizeItem=function(a){c.isPlainObject(a)||(a={id:a,text:a}),a=c.extend({},{text:""},a);var b={selected:!1,disabled:!1};return null!=a.id&&(a.id=a.id.toString()),null!=a.text&&(a.text=a.text.toString()),null==a._resultId&&a.id&&null!=this.container&&(a._resultId=this.generateResultId(this.container,a)),c.extend({},b,a)},d.prototype.matches=function(a,b){var c=this.options.get("matcher");return c(a,b)},d}),b.define("select2/data/array",["./select","../utils","jquery"],function(a,b,c){function d(a,b){var c=b.get("data")||[];d.__super__.constructor.call(this,a,b),this.addOptions(this.convertToOptions(c))}return b.Extend(d,a),d.prototype.select=function(a){var b=this.$element.find("option").filter(function(b,c){return c.value==a.id.toString()});0===b.length&&(b=this.option(a),this.addOptions(b)),d.__super__.select.call(this,a)},d.prototype.convertToOptions=function(a){function d(a){return function(){return c(this).val()==a.id}}for(var e=this,f=this.$element.find("option"),g=f.map(function(){return e.item(c(this)).id}).get(),h=[],i=0;i<a.length;i++){var j=this._normalizeItem(a[i]);if(c.inArray(j.id,g)>=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},l,j),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&""!==a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");if(void 0!==f&&(this.createTag=f),b.call(this,c,d),a.isArray(e))for(var g=0;g<e.length;g++){var h=e[g],i=this._normalizeItem(h),j=this.option(i);this.$element.append(j)}}return b.prototype.query=function(a,b,c){function d(a,f){for(var g=a.results,h=0;h<g.length;h++){var i=g[h],j=null!=i.children&&!d({results:i.children},!0),k=i.text===b.term;if(k||j)return!f&&(a.data=g,void c(a))}if(f)return!0;var l=e.createTag(b);if(null!=l){var m=e.option(l);m.attr("data-select2-tag",!0),e.addOptions([m]),e.insertTag(g,l)}a.results=g,c(a)}var e=this;return this._removeOldTags(),null==b.term||null!=b.page?void a.call(this,b,c):void a.call(this,b,d)},b.prototype.createTag=function(b,c){var d=a.trim(c.term);return""===d?null:{id:d,text:d}},b.prototype.insertTag=function(a,b,c){b.unshift(c)},b.prototype._removeOldTags=function(b){var c=(this._lastTag,this.$element.find("option[data-select2-tag]"));c.each(function(){this.selected||a(this).remove()})},b}),b.define("select2/data/tokenizer",["jquery"],function(a){function b(a,b,c){var d=c.get("tokenizer");void 0!==d&&(this.tokenizer=d),a.call(this,b,c)}return b.prototype.bind=function(a,b,c){a.call(this,b,c),this.$search=b.dropdown.$search||b.selection.$search||c.find(".select2-search__field")},b.prototype.query=function(a,b,c){function d(a){e.trigger("select",{data:a})}var e=this;b.term=b.term||"";var f=this.tokenizer(b,this.options,d);f.term!==b.term&&(this.$search.length&&(this.$search.val(f.term),this.$search.focus()),b.term=f.term),a.call(this,b,c)},b.prototype.tokenizer=function(b,c,d,e){for(var f=d.get("tokenSeparators")||[],g=c.term,h=0,i=this.createTag||function(a){return{id:a.term,text:a.term}};h<g.length;){var j=g[h];if(-1!==a.inArray(j,f)){var k=g.substr(0,h),l=a.extend({},c,{term:k}),m=i(l);null!=m?(e(m),g=g.substr(h+1)||"",h=0):h++}else h++}return{term:g}},b}),b.define("select2/data/minimumInputLength",[],function(){function a(a,b,c){this.minimumInputLength=c.get("minimumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",b.term.length<this.minimumInputLength?void this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumInputLength",[],function(){function a(a,b,c){this.maximumInputLength=c.get("maximumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",this.maximumInputLength>0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<span class="select2-dropdown"><span class="select2-results"></span></span>');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('<li class="select2-results__option select2-results__option--load-more"role="treeitem" aria-disabled="true"></li>'),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a("<span></span>"),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=(this.$container.position(),this.$container.offset());f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.top<f.top-h.height,k=i.bottom>f.bottom+h.height,l={left:f.left,top:g.bottom};if("static"!==this.$dropdownParent[0].style.position){var m=this.$dropdownParent.offset();l.top-=m.top,l.left-=m.left}c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d<b.length;d++){var e=b[d];e.children?c+=a(e.children):c++}return c}function b(a,b,c,d){this.minimumResultsForSearch=c.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),a.call(this,b,c,d)}return b.prototype.showSearch=function(b,c){return!(a(c.data.results)<this.minimumResultsForSearch)&&b.call(this,c)},b}),b.define("select2/dropdown/selectOnClose",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("close",function(){d._handleSelectOnClose()})},a.prototype._handleSelectOnClose=function(){var a=this.getHighlightedResults();if(!(a.length<1)){var b=a.data("data");null!=b.element&&b.element.selected||null==b.element&&b.selected||this.trigger("select",{data:b})}},a}),b.define("select2/dropdown/closeOnSelect",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("select",function(a){d._selectTriggered(a)}),b.on("unselect",function(a){d._selectTriggered(a)})},a.prototype._selectTriggered=function(a,b){var c=b.originalEvent;c&&c.ctrlKey||this.trigger("close",{})},a}),b.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(a){var b=a.input.length-a.maximum,c="Please delete "+b+" character";return 1!=b&&(c+="s"),c},inputTooShort:function(a){var b=a.minimum-a.input.length,c="Please enter "+b+" or more characters";return c},loadingMore:function(){return"Loading more results…"},maximumSelected:function(a){var b="You can only select "+a.maximum+" item";return 1!=a.maximum&&(b+="s"),b},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),b.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C){function D(){
9
+ this.reset()}D.prototype.apply=function(l){if(l=a.extend({},this.defaults,l),null==l.dataAdapter){if(null!=l.ajax?l.dataAdapter=o:null!=l.data?l.dataAdapter=n:l.dataAdapter=m,l.minimumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L<K.length;L++){var M=K[L],N={};try{N=k.loadPath(M)}catch(O){try{M=this.defaults.amdLanguageBase+M,N=k.loadPath(M)}catch(P){l.debug&&window.console&&console.warn&&console.warn('Select2: The language file for "'+M+'" could not be automatically loaded. A fallback will be used instead.');continue}}J.extend(N)}l.translations=J}else{var Q=k.loadPath(this.defaults.amdLanguageBase+"en"),R=new k(l.language);R.extend(Q),l.translations=R}return l},D.prototype.reset=function(){function b(a){function b(a){return l[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function c(d,e){if(""===a.trim(d.term))return e;if(e.children&&e.children.length>0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this._sync=c.bind(this._syncAttributes,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._sync);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._sync)}),this._observer.observe(this.$element[0],{attributes:!0,subtree:!1})):this.$element[0].addEventListener&&this.$element[0].addEventListener("DOMAttrModified",b._sync,!1)},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),(null==a||0===a.length)&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._sync),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&this.$element[0].removeEventListener("DOMAttrModified",this._sync,!1),this._sync=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},e.prototype.render=function(){var b=a('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("jquery-mousewheel",["jquery"],function(a){return a}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if(b=b||{},"object"==typeof b)return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d;return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2.");var e=Array.prototype.slice.call(arguments,1);d=c[b].apply(c,e)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c});var czr_debug={log:function(a){debug.queue.push(["log",arguments,debug.stack.slice(0)]),window.console&&"function"==typeof window.console.log&&window.console.log(a)},error:function(a){debug.queue.push(["error",arguments,debug.stack.slice(0)]),window.console&&"function"==typeof window.console.error&&window.console.error(a)},queue:[],stack:[]},api=api||wp.customize,$=$||jQuery;!function(a,b,c){a.consoleLog=function(){c.isUndefined(console)&&"function"!=typeof window.console.log||!serverControlParams.isDevMode||console.log.apply(console,arguments)},a.czr_isSkopOn=function(){return serverControlParams.isSkopOn&&c.has(a,"czr_skopeBase")},a.czr_isChangeSetOn=function(){return serverControlParams.isChangeSetOn&&!0},a.czr_wp_conditionals=new a.Value,a.czr_widgetZoneSettings=new a.Value,a.sidebar_insights=new a.Values,a.sidebar_insights.create("candidates"),a.sidebar_insights.create("actives"),a.sidebar_insights.create("inactives"),a.sidebar_insights.create("registered"),a.sidebar_insights.create("available_locations"),a.czr_partials=new a.Value,a.czr_activeSectionId=new a.Value(""),a.czr_activePanelId=new a.Value(""),a.bind("ready",function(){if("function"!=typeof a.Section)throw new Error("Your current version of WordPress does not support the customizer sections needed for this theme. Please upgrade WordPress to the latest version.");var b=function(b,c){a.czr_activeSectionId(b?c:"")};a.section.each(function(a){a.expanded.bind(function(c){b(c,a.id)})}),a.section.bind("add",function(c){a.trigger("czr-paint",{active_panel_id:c.panel()}),c.expanded.bind(function(a){b(a,c.id)})});var d=function(b,d){a.czr_activePanelId(b?d:""),c.isEmpty(a.czr_activePanelId())&&a.czr_activeSectionId("")};a.panel.each(function(a){a.expanded.bind(function(b){d(b,a.id)})}),a.panel.bind("add",function(a){a.expanded.bind(function(b){d(b,a.id)})})}),a.bind("ready",function(){var d=function(){a.section("themes").active.bind(function(d){c.has(serverControlParams,"isThemeSwitchOn")&&c.isEmpty(serverControlParams.isThemeSwitchOn)&&(a.section("themes").active(!1),a.section("themes").active.callbacks=b.Callbacks())})};a.section.has("themes")?d():a.section.when("themes",function(a){d()})}),a.czr_skopeReady=b.Deferred(),a.bind("ready",function(){serverControlParams.isSkopOn&&(a.czr_skopeBase=new a.CZR_skopeBase,a.czr_skopeSave=new a.CZR_skopeSave,a.czr_skopeReset=new a.CZR_skopeReset,a.trigger("czr-skope-started"),a.czr_skopeReady.done(function(){a.trigger("czr-skope-ready")})),serverControlParams.isChangeSetOn&&(a.settings.timeouts.changesetAutoSave=1e4)}),c.has(a,"_latestRevision")||(a._latestRevision=0,a._latestSettingRevisions={},a.bind("change",function(b){a._latestRevision+=1,a._latestSettingRevisions[b.id]=a._latestRevision}),a.bind("ready",function(){a.bind("add",function(b){b._dirty&&(a._latestRevision+=1,a._latestSettingRevisions[b.id]=a._latestRevision)})}))}(wp.customize,jQuery,_);var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{globalSettingVal:{},initialize:function(){var a=this;a.skope_colors={global:"rgb(255, 255, 255)",special_group:"rgba(173, 213, 247, 0.55)",group:"rgba(173, 213, 247, 0.55)",local:"rgba(78, 122, 199, 0.35)"},api.czr_isPreviewerSkopeAware=$.Deferred(),api.czr_initialSkopeCollectionPopulated=$.Deferred(),a.skopeWrapperEmbedded=$.Deferred(),api.czr_skope=new api.Values,api.czr_skopeCollection=new api.Value([]),api.czr_currentSkopesCollection=new api.Value([]),api.czr_activeSkopeId=new api.Value,api.czr_dirtyness=new api.Value((!1)),api.czr_isResettingSkope=new api.Value((!1)),api.state.create("switching-skope")(!1),api.czr_dirtyness.callbacks.add(function(){return a.apiDirtynessReact.apply(a,arguments)}),a.toggleSkopeLoadPane(),a.bindAPISettings(),api.state.bind("change",function(){a.setSaveButtonStates()}),"pending"==a.skopeWrapperEmbedded.state()&&$.when(a.embedSkopeWrapper()).done(function(){a.skopeWrapperEmbedded.resolve()}),api.previewer.bind("czr-skopes-synced",function(b){if(serverControlParams.isSkopOn){var c=this,d=api.czr_currentSkopesCollection();if(!_.has(b,"czr_skopes"))throw new Error("Missing skopes in the server data");api.czr_skopeBase.updateSkopeCollection(b.czr_skopes,c.channel()),api.czr_initialSkopeCollectionPopulated.then(function(){var c=_.isUndefined(_.findWhere(api.czr_currentSkopesCollection(),{id:api.czr_activeSkopeId()}));api.czr_skopeBase.reactWhenSkopeSyncedDone(b).done(function(){if(c)api.czr_activeSkopeId(a.getActiveSkopeId()).done(function(){api.consoleLog("INITIAL ACTIVE SKOPE SET : "+arguments[1]+" => "+arguments[0]),"pending"==api.czr_skopeReady.state()&&api.czr_skopeReady.resolve(a.getActiveSkopeId()),a._writeCurrentSkopeTitle()});else if(!_.isEmpty(d)){var e=_.findWhere(d,{skope:"local"}).opt_name,f=_.findWhere(b.czr_skopes,{skope:"local"}).opt_name;f!==e&&"resolved"==api.czr_skopeReady.state()&&a._writeCurrentSkopeTitle()}})})}}),api.czr_currentSkopesCollection.bind(function(b,c){return a.currentSkopesCollectionReact(b,c)},{deferred:!0}),api.czr_initialSkopeCollectionPopulated.done(function(){api.czr_activeSkopeId.bind(function(b,c){return a.activeSkopeReact(b,c)},{deferred:!0}),api.czr_activeSectionId.callbacks.add(function(){return a.activeSectionReact.apply(a,arguments)}),api.czr_activePanelId.callbacks.add(function(){return a.activePanelReact.apply(a,arguments)})}),api.bind("skope-switched",function(b,c){api.czr_skopeReady.then(function(){api.czr_CrtlDependenciesReady.then(function(){_.isUndefined(api.czr_activeSectionId())||_.isEmpty(api.czr_activeSectionId())||api.czr_ctrlDependencies.setServiDependencies(api.czr_activeSectionId(),null,!0)}),a.updateCtrlSkpNot(api.CZR_Helpers.getSectionControlIds()),api.czr_skope.has(c)&&$("#customize-controls").removeClass(["czr-",api.czr_skope(c)().skope,"-skope-level"].join("")),api.czr_skope.has(b)&&$("#customize-controls").addClass(["czr-",api.czr_skope(b)().skope,"-skope-level"].join(""))})}),api.czr_serverNotification=new api.Value({status:"success",message:"",expanded:!0}),api.czr_serverNotification.bind(function(b,c){a.toggleServerNotice(b)}),api.czr_topNoteVisible=new api.Value((!1)),api.czr_skopeReady.then(function(){api.czr_topNoteVisible.bind(function(b){if(a.toggleTopNote(b,serverControlParams.topNoteParams||{}),!b){var c=$.extend(api.previewer.query(),{nonce:api.previewer.nonce.save});wp.ajax.post("czr_dismiss_top_note",c).always(function(){}).fail(function(a){api.consoleLog("czr_dismiss_top_note failed",c,a)}).done(function(a){})}}),_.delay(function(){api.czr_topNoteVisible(!_.isEmpty(serverControlParams.isTopNoteOn)||1==serverControlParams.isTopNoteOn)},2e3)}),a.scopeSwitcherEventMap=[{trigger:"click keydown",selector:".czr-dismiss-notification",name:"dismiss-notification",actions:function(){api.czr_serverNotification({expanded:!1})}},{trigger:"click keydown",selector:".czr-toggle-title-notice",name:"toggle-title-notice",actions:function(b){_.isUndefined(a.skopeTitleNoticeVisible)&&(a.skopeTitleNoticeVisible=new api.Value((!1)),a.skopeTitleNoticeVisible.bind(function(a){b.dom_el.find(".czr-skope-title").toggleClass("notice-visible",a)})),a.skopeTitleNoticeVisible(!a.skopeTitleNoticeVisible())}}],api.CZR_Helpers.setupDOMListeners(a.scopeSwitcherEventMap,{dom_el:$(".czr-scope-switcher")},a),a.refreshedControls=["czr_cropped_image"],a.initWidgetSidebarSpecifics(),api.bind("czr-paint",function(b){api.czr_skopeReady.then(function(){a.wash(b).paint(b)})})},toggleSkopeLoadPane:function(){var a;_render=function(){var a=$.Deferred();try{_tmpl=wp.template("czr-skope-pane")({is_skope_loading:!0})}catch(b){throw new Error("Error when parsing the the reset skope template : "+b)}return $.when($("#customize-preview").after($(_tmpl))).always(function(){a.resolve($("#czr-skope-pane"))}),a.promise()},$("body").addClass("czr-skop-loading"),_render().done(function(b){a=b}).then(function(){a.length&&_.delay(function(){var b=$("#customize-preview").height();a.css("line-height",b+"px").css("height",b+"px"),$("body").addClass("czr-skope-pane-open")},50)}),api.czr_skopeReady.done(function(){_.delay(function(){$.when($("body").removeClass("czr-skope-pane-open")).done(function(){_.delay(function(){$.when($("body").removeClass("czr-skop-loading")).done(function(){!1!==a.length&&setTimeout(function(){a.remove()},400)})},200)})},50)})},embedSkopeWrapper:function(){var a=this;$("#customize-header-actions").append($("<div/>",{"class":"czr-scope-switcher",html:'<div class="czr-skopes-wrapper"></div>'})),$("body").addClass("czr-skop-on");var b=[{trigger:"click keydown",selector:".czr-skope-switch",name:"control_skope_switch",actions:function(a){var b=$(a.dom_event.currentTarget,a.dom_el).attr("data-skope-id");!_.isEmpty(b)&&api.czr_skope.has(b)&&api.czr_activeSkopeId(b)}}];api.CZR_Helpers.setupDOMListeners(b,{dom_el:$(".czr-scope-switcher")},a)},apiDirtynessReact:function(a){$("body").toggleClass("czr-api-dirty",a),api.state("saved")(!a)},setSaveButtonStates:function(){api.state.has("saving")||(api.state.create("saving"),api.state("saving").bind(function(a){$(document.body).toggleClass("saving",a)}));var a=$("#save"),b=$(".customize-controls-close"),c=api.state("saved"),d=api.state("saving"),e=api.state("activated"),f=api.state.has("changesetStatus")?api.state("changesetStatus")():"auto-draft";api.czr_dirtyness()||!c()?(a.val(api.l10n.save),b.find(".screen-reader-text").text(api.l10n.cancel)):(a.val(api.l10n.saved),b.find(".screen-reader-text").text(api.l10n.close));var g=!(d()||e()&&c()||"publish"===f);a.prop("disabled",!g)}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{toggleServerNotice:function(a){if(a=_.isObject(a)?a:{},a=_.extend({status:"success",expanded:!0,message:"",auto_collapse:!1},a),"changeset_already_published"!=a.message&&serverControlParams.isDevMode){this.serverNoticeEmbedded=this.serverNoticeEmbedded||$.Deferred();var b=this,c=function(){$(".czr-scope-switcher").prepend($("<div/>",{"class":"czr-server-notice",html:'<span class="czr-server-message"></span><span class="fa fa-times-circle czr-dismiss-notification"></span>'}))},d=function(){var c,d,e=$(".czr-server-notice",".czr-scope-switcher"),f=$(".wp-full-overlay-header"),g=($(".wp-full-overlay-sidebar .wp-full-overlay-sidebar-content"),function(a){return!0});b.skopeTitleNoticeVisible&&b.skopeTitleNoticeVisible(!1),a.expanded?(e.toggleClass("czr-server-error","error"==a.status),"error"==a.status?$(".czr-server-message",e).html(_.isEmpty(a.message)?"Server Problem.":a.message):$(".czr-server-message",e).html(_.isEmpty(a.message)?"Success.":a.message),d=$(".czr-server-notice",".czr-scope-switcher").outerHeight(),c=f.outerHeight()+d,setTimeout(function(){$.when(g(c)).done(function(){e.fadeIn({duration:200,complete:function(){$(this).css("height","auto")}})})},400)):(e.fadeOut({duration:200,complete:function(){}}),setTimeout(function(){g()},200))};"pending"==b.serverNoticeEmbedded.state()?$.when(c()).done(function(){setTimeout(function(){b.serverNoticeEmbedded.resolve(),d()},200)}):d(),_.delay(function(){api.czr_serverNotification({expanded:!1})},"success"==a.status||!1!==a.auto_collapse?4e3:5e3)}},buildServerResponse:function(a){var b=!1;if(_.isObject(a)&&(!_.has(a,"responseJSON")||_.isUndefined(a.responseJSON.data)||_.isEmpty(a.responseJSON.data)?_.has(a,"statusText")&&!_.isEmpty(a.statusText)&&(b=a.statusText):b=a.responseJSON.data),_.isObject(a)&&!b)try{JSON.stringify(a)}catch(c){b="Server Error"}else b?"-1"===a&&(b="Identification issue detected, please refresh your page."):b="0"===a?"Not logged in.":a;return b}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{toggleTopNote:function(a,b){b=_.isObject(b)?b:{};var c=this,d={title:"",message:""};b=$.extend(d,b),a?$.when(c.renderTopNoteTmpl(b)).done(function(a){c.welcomeNote=a,_.delay(function(){$("body").addClass("czr-top-note-open")},200),api.CZR_Helpers.setupDOMListeners([{trigger:"click keydown",selector:".czr-top-note-close",name:"close-top-note",actions:function(){api.czr_topNoteVisible(!1)}}],{dom_el:c.welcomeNote},c)}):($("body").removeClass("czr-top-note-open"),c.welcomeNote.length&&_.delay(function(){c.welcomeNote.remove()},300)),_.delay(function(){api.czr_topNoteVisible(!1)},2e4)},renderTopNoteTmpl:function(a){if($("#czr-top-note").length)return $("#czr-top-note");var b="",c=a.title||"",d=a.message||"";try{b=wp.template("czr-top-note")({title:c})}catch(e){throw new Error("Error when parsing the the top note template : "+e)}return $("#customize-preview").after($(b)),$(".czr-note-message","#czr-top-note").html(d),$("#czr-top-note")}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{bindAPISettings:function(a){var b=this,c=function(a,c,d){var e,f=this.id;_.has(api,"czr_activeSkopeId")&&!_.isUndefined(api.czr_activeSkopeId())||api.consoleLog("The api.czr_activeSkopeId() is undefined in the api.previewer._new_refresh() method."),api(f)._dirty&&(e=b.isSettingSkopeEligible(f)?api.czr_activeSkopeId():b.getGlobalSkopeId(),api.czr_skope(e).updateSkopeDirties(f,a)),_.has(api.control(f),"czr_states")&&!api.control(f).czr_states("isResetting")()&&api.control(f).czr_states("resetVisible")(!1),b.isSettingSkopeEligible(f)&&b.updateCtrlSkpNot(f)};_.isUndefined(a)?api.each(function(a){a.bind(c)}):api(a).bind(c);var d=function(a){a.callbacks.has(c)||a.bind(c)};api.topics.change.has(d)||api.bind("change",d)}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{reactWhenSkopeSyncedDone:function(a){var b=$.Deferred();if(!_.has(a,"czr_skopes")||_.isEmpty(a.czr_skopes))throw new Error("Missing skope data after refresh",a);api.czr_dirtyness()||api.czr_dirtyness(!!_.isBoolean(a.isChangesetDirty)&&a.isChangesetDirty);var c=a.czr_skopes;return _.each(api.czr_skopeCollection(),function(a){var b=_.findWhere(c,{opt_name:a.opt_name});if(!_.isUndefined(b)){var d=_.isEmpty(b.changeset||{})?{}:b.changeset,e={};_.each(d,function(a,b){api.has(b)||api.consoleLog("In reactWhenSkopeSyncedDone : attempting to update the changeset with a non registered setting : "+b),e[b]=a}),api.czr_skope(a.id).changesetValues(e)}}),_.each(api.czr_skopeCollection(),function(a){var b=_.findWhere(c,{opt_name:a.opt_name});if(!_.isUndefined(b)){var d=$.extend(!0,{},api.czr_skope(a.id).dbValues()),e=$.extend(d,b.db||{}),f={};_.each(e,function(a,b){api.has(b)||api.consoleLog("In reactWhenSkopeSyncedDone : attempting to update the db values with a non registered setting : "+b),f[b]=a}),api.czr_skope(a.id).dbValues(f)}}),_.delay(function(){b.resolve()},500),b.promise()}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{_maybeSetupAssignedMenuLocations:function(a){(_.isUndefined(a)||_.isEmpty(a)||!api.section.has(a.id))&&api.consoleLog("In _maybeSetupAssignedMenuLocations : no valid section_id provided.");if(a.assignedLocations){var b=function(a){};a.assignedLocations.callbacks.has(b)||a.assignedLocations.bind(b)}},activeSectionReact:function(a,b){"add_menu"!=a&&api.trigger("czr-paint",{active_section_id:a});var c=this,d=function(a){var b=api.CZR_Helpers.getSectionControlIds(a);_.each(b,function(a){if(api.has(a)&&!_.isUndefined(api.control(a))){var b=api.control(a);_.has(b,"czr_states")&&(b.czr_states("noticeVisible")(!1),b.czr_states("resetVisible")(!1))}})},e=function(a,b){c.setupActiveSkopedControls({section_id:b}),c.processSilentUpdates({section_id:b}).fail(function(){throw new Error("Fail to process silent updates after initial skope collection has been populated")}).done(function(){c.isExcludedSidebarsWidgets()||c.forceSidebarDirtyRefresh(b,api.czr_activeSkopeId())}),_.has(api.topics,"active-section-setup")||api.bind("active-section-setup",function(a){var b={controls:[],section_id:""};a=_.extend(b,a),c._maybeSetupAssignedMenuLocations(a)}),api.czr_skopeReady.then(function(){var a=function(a){api.czr_serverNotification({status:"success",message:[a,"can only be customized site wide."].join(" ")}),api.czr_activeSkopeId(c.getGlobalSkopeId())};"global"!=api.czr_skope(api.czr_activeSkopeId())().skope&&(!c.isExcludedWPCustomCss()||"custom_css"!=b&&"admin_sec"!=b||a(api.section(b).params.title),"nav_menu["!=b.substring(0,"nav_menu[".length)&&"add_menu"!=b||api.czr_serverNotification({status:"success",message:["Menus are created site wide."].join(" ")}))}),api.trigger("active-section-setup",a)};api.czr_initialSkopeCollectionPopulated.then(function(){api.section.when(a,function(b){b.deferred.embedded.then(function(){e(b,a)})}),!_.isEmpty(b)&&api.section.has(b)&&d(b)})},activePanelReact:function(a,b){var c=this;api.czr_initialSkopeCollectionPopulated.then(function(){api.trigger("czr-paint",{active_panel_id:a});api.czr_skopeReady.then(function(){"global"!=api.czr_skope(api.czr_activeSkopeId())().skope&&c.isExcludedSidebarsWidgets()&&"widgets"==a&&api.czr_serverNotification({status:"success",message:["Widgets are created site wide."].join(" ")})}),api.czr_skopeReady.then(function(){"nav_menus"==a&&_.each(api.panel(a).sections(),function(a){c.processSilentUpdates({section_id:a.id,awake_if_not_active:!0})})})})}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{wash:function(a){var b=function(a){_.has(a,"el")&&a.el.length&&$.when(a.el.removeClass("czr-painted")).done(function(){$(this).css("background","").css("color","")})};return api.czr_skopeBase.paintedElements&&(_.each(api.czr_skopeBase.paintedElements(),function(a){b(a)}),api.czr_skopeBase.paintedElements([])),this},paint:function(a){var b="inherit",c={active_panel_id:api.czr_activePanelId(),
10
+ active_section_id:api.czr_activeSectionId(),is_skope_switch:!1},d=[];a=$.extend(c,a),!_.isUndefined(api.czr_activeSkopeId())&&api.czr_skope.has(api.czr_activeSkopeId())&&(b=api.czr_skope(api.czr_activeSkopeId()).color);var e=function(c){_.has(c,"el")&&c.el.length&&(a.is_skope_switch?$.when(c.el.addClass("czr-painted")).done(function(){$(this).css("background",c.bgColor||b)}):c.el.css("background",c.bgColor||b),"global"!=api.czr_skope(api.czr_activeSkopeId())().skope&&c.el.css("color","#000"))};return api.czr_skopeBase.paintedElements=api.czr_skopeBase.paintedElements||new api.Value([]),_.isEmpty(a.active_panel_id)&&_.isEmpty(a.active_section_id)&&(d.push({el:$("#customize-info").find(".accordion-section-title").first()}),api.panel.each(function(a){d.push({el:a.container.find(".accordion-section-title").first()})}),api.section.each(function(a){_.isEmpty(a.panel())&&d.push({el:a.container.find(".accordion-section-title").first()})})),!_.isEmpty(a.active_panel_id)&&_.isEmpty(a.active_section_id)&&api.panel.when(a.active_panel_id,function(a){a.deferred.embedded.then(function(){d.push({el:a.container.find(".accordion-section-title, .customize-panel-back")})})}),_.isEmpty(a.active_section_id)||api.section.when(a.active_section_id,function(a){a.deferred.embedded.then(function(){d.push({el:a.container.find(".customize-section-title, .customize-section-back"),bgColor:"inherit"},{el:a.container}),api.czr_isChangeSetOn()||d.push({el:a.container.find(".accordion-section-content")})})}),_.each(d,function(a){e(a)}),api.czr_skopeBase.paintedElements(d),this}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{isSkopeRegisteredInCollection:function(a,b){return b=b||api.czr_skopeCollection(),!_.isUndefined(_.findWhere(b,{id:a}))},isSkopeRegisteredInCurrentCollection:function(a,b){return b=b||api.czr_currentSkopesCollection(),!_.isUndefined(_.findWhere(b,{id:a}))},isGlobalSkopeRegistered:function(){var a=_.findWhere(api.czr_currentSkopesCollection(),{skope:"global"});return _.isObject(a)&&_.has(a,"id")},getGlobalSkopeId:function(){if(!_.has(api,"czr_skope"))return"";var a="";return api.czr_skope.each(function(b){"global"==b().skope&&(a=b().id)}),a},getChangedGlobalDBSettingValues:function(a){var b={};return _.each(a,function(a,c){_wpSetId=api.CZR_Helpers.build_setId(c),_.has(api.settings.settings,_wpSetId)&&(_.isEqual(a,api.settings.settings[_wpSetId].value)||(b[c]=a))}),b},getActiveSkopeId:function(a){a=a||api.czr_currentSkopesCollection();var b=!_.isEmpty(api.czr_activeSkopeId())&&api.czr_skope.has(api.czr_activeSkopeId())?api.czr_skope(api.czr_activeSkopeId())().skope:serverControlParams.isLocalSkope?"local":"global",c=_.findWhere(a,{skope:b});if(_skpId=_.isUndefined(c)?_.findWhere(a,{skope:"global"}).id:c.id,_.isUndefined(_skpId))throw new Error("No default skope was found in getActiveSkopeId ",a);return _skpId},getActiveSkopeName:function(){return api.czr_skope.has(api.czr_activeSkopeId())?api.czr_skope(api.czr_activeSkopeId())().skope:"global"},isSettingSkopeEligible:function(a){var b=this,c=api.CZR_Helpers.getOptionName(a);return _.isUndefined(a)||!api.has(a)?(api.consoleLog("THE SETTING "+a+" IS NOT ELIGIBLE TO SKOPE BECAUSE UNDEFINED OR NOT REGISTERED IN THE API."),!1):!b.isExcludedWPBuiltinSetting(a)&&(!_.contains(serverControlParams.skopeExcludedSettings,c)&&(b.isThemeSetting(a),!0))},isSettingResetEligible:function(a){var b=this;api.CZR_Helpers.getOptionName(a);if(_.isUndefined(a)||!api.has(a))return void api.consoleLog("THE SETTING "+a+" IS NOT ELIGIBLE TO RESET BECAUSE UNDEFINED OR NOT REGISTERED IN THE API.");if(!b.isExcludedWPBuiltinSetting(a))return!(!b.isThemeSetting(a)&&!b.isWPAuthorizedSetting(a))||void api.consoleLog("THE SETTING "+a+" IS NOT ELIGIBLE TO RESET BECAUSE NOT PART OF THE THEME OPTIONS AND NOT WP AUTHORIZED BUILT IN OPTIONS")},isThemeSetting:function(a){return _.isString(a)&&-1!==a.indexOf(serverControlParams.themeOptions)},isWPAuthorizedSetting:function(a){return _.isString(a)&&_.contains(serverControlParams.wpBuiltinSettings,a)},isExcludedWPBuiltinSetting:function(a){var b=this;if(_.isUndefined(a))return!0;if("active_theme"==a)return!0;if(_.contains(serverControlParams.wpBuiltinSettings,a))return!1;var c=["widget_","nav_menu","sidebars_","custom_css","nav_menu[","nav_menu_item","nav_menus_created_posts","nav_menu_locations"],d=!1;return _.each(c,function(c){switch(c){case"widget_":case"sidebars_":c==a.substring(0,c.length)&&(d=b.isExcludedSidebarsWidgets());break;case"nav_menu[":case"nav_menu_item":case"nav_menus_created_posts":c==a.substring(0,c.length)&&(d=!0);break;case"nav_menu_locations":c==a.substring(0,c.length)&&(d=b.isExcludedNavMenuLocations());break;case"custom_css":c==a.substring(0,c.length)&&(d=b.isExcludedWPCustomCss())}}),d},isExcludedSidebarsWidgets:function(){var a=serverControlParams.isSidebarsWigetsSkoped;return!(!_.isUndefined(a)&&!_.isEmpty(a)&&!1!==a)},isExcludedNavMenuLocations:function(){if(!api.czr_isChangeSetOn())return!0;var a=serverControlParams.isNavMenuLocationsSkoped;return!(!_.isUndefined(a)&&!_.isEmpty(a)&&!1!==a)},isExcludedWPCustomCss:function(){var a=serverControlParams.isWPCustomCssSkoped;return!(!_.isUndefined(a)&&!_.isEmpty(a)&&!1!==a)},_getDBSettingVal:function(a,b){var c=api.CZR_Helpers.getOptionName(a),d=api.CZR_Helpers.build_setId(a);return api.czr_skope.has(b)?_.has(api.czr_skope(b).dbValues(),d)?api.czr_skope(b).dbValues()[d]:_.has(api.czr_skope(b).dbValues(),c)?api.czr_skope(b).dbValues()[c]:"_no_db_val":(api.consoleLog("_getDBSettingVal : the requested skope id is not registered : "+b),"_no_db_val")},getSkopeDirties:function(a,b){if(!api.czr_skope.has(a))return{};b=b||{},b=_.extend({unsaved:!0},b);var c={};return _.each(api.czr_skope(a).dirtyValues(),function(a,d){var e;api.czr_isChangeSetOn()&&(e=api._latestSettingRevisions[d],api.state("changesetStatus").get()&&b&&b.unsaved&&(_.isUndefined(e)||e<=api._lastSavedRevision))||(c[d]=a)}),c},getSkopeExcludedDirties:function(){var a=this,b={};api.each(function(a,c){a._dirty&&(b[c]=a())});var c=a.getGlobalSkopeId();a.getSkopeDirties(c);return _.omit(b,function(b,c){return a.isSettingSkopeEligible(c)})},parseWidgetId:function(a,b){var c,d={number:null,id_base:null};return c=a.match(/^(.+)-(\d+)$/),c?(d.id_base=c[1],d.number=parseInt(c[2],10)):d.id_base=a,_.isUndefined(b)||(d.id_base=d.id_base.replace(b,"")),d},widgetIdToSettingId:function(a,b){var c,d=this.parseWidgetId(a,b);return c=d.id_base,d.number&&(c+="["+d.number+"]"),c},isWidgetRegisteredGlobally:function(a){var b=this;return registered=!1,_.each(_wpCustomizeWidgetsSettings.registeredWidgets,function(c,d){registered||"widget_"+b.widgetIdToSettingId(d)!=a||(registered=!0)}),registered}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{getAppliedPrioritySkopeId:function(a,b){if(!api.has(api.CZR_Helpers.build_setId(a)))throw new Error("getAppliedPrioritySkopeId : the requested setting id does not exist in the api : "+api.CZR_Helpers.build_setId(a));if(!api.czr_skope.has(b))throw new Error("getAppliedPrioritySkopeId : the requested skope id is not registered : "+b);var c=this,d=_.findWhere(api.czr_currentSkopesCollection(),{skope:"local"}).id;if(_.isUndefined(d)||b==d)return b;var e=function(d){var f=api.CZR_Helpers.build_setId(a),g="___",h=api.czr_skope(d)();if(d==b)return b;if(api.czr_skope(d).getSkopeSettingAPIDirtyness(f))return h.id;if(api.czr_isChangeSetOn()&&api.czr_skope(d).getSkopeSettingChangesetDirtyness(f))return h.id;var i=c._getDBSettingVal(a,d);return"_no_db_val"!=i?h.id:"global"==h.skope?h.id:"___"!=g?h.title:e(c._getParentSkopeId(h))};return e(d)},getOverridenSkopeTitles:function(){var a=a||api.czr_activeSkopeId();if(!api.czr_skope.has(a))throw new Error("getInheritedSkopeTitles : the requested skope id is not registered : "+a);var b=this,c=_.findWhere(api.czr_currentSkopesCollection(),{skope:"local"}).id;if(!_.isUndefined(c)&&a!=c){var d=function(c,e){e=e||[];var f=api.czr_skope(c)();return c==a?e:(e.unshift(c),d(b._getParentSkopeId(f),e))};return _.map(d(c),function(a){return b.buildSkopeLink(a)}).join(" and ")}},getInheritedSkopeId:function(a,b){if(!api.has(api.CZR_Helpers.build_setId(a)))throw new Error("getInheritedSkopeId : the requested setting id does not exist in the api : "+api.CZR_Helpers.build_setId(a));if(!api.czr_skope.has(b))throw new Error("getInheritedSkopeId : the requested skope id is not registered : "+b);var c,d=this,e=api.CZR_Helpers.build_setId(a),f="___",g=api.czr_skope(b)();if(c=_.has(api.settings.settings,e)?api.settings.settings[e].value:null,api.czr_skope(b).getSkopeSettingAPIDirtyness(e))return b;if(api.czr_isChangeSetOn()&&api.czr_skope(b).getSkopeSettingChangesetDirtyness(e))return b;var h=d._getDBSettingVal(a,b);return"_no_db_val"!=h?b:"global"==g.skope?b:"___"!=f?b:d.getInheritedSkopeId(a,d._getParentSkopeId(g))},getInheritedSkopeTitles:function(a,b){if(a=a||api.czr_activeSkopeId(),!api.czr_skope.has(a))throw new Error("getInheritedSkopeTitles : the requested skope id is not registered : "+a);b=b||[];var c=this,d=api.czr_skope(a)();return a!==api.czr_activeSkopeId()&&b.unshift(a),"global"!==d.skope?c.getInheritedSkopeTitles(c._getParentSkopeId(d),b):_.map(b,function(a){return c.buildSkopeLink(a)}).join(" and ")},buildSkopeLink:function(a){if(!api.czr_skope.has(a))throw new Error("buildSkopeLink : the requested skope id is not registered : "+a);var b="Switch to scope : "+api.czr_skope(a)().title;return['<span class="czr-skope-switch" title=" '+b+'" data-skope-id="'+a+'">',api.czr_skope(a)().title,"</span>"].join("")},getSkopeSettingVal:function(a,b){if(!api.has(api.CZR_Helpers.build_setId(a)))throw new Error("getSkopeSettingVal : the requested setting id does not exist in the api : "+api.CZR_Helpers.build_setId(a));if(!api.czr_skope.has(b))throw new Error("getSkopeSettingVal : the requested skope id is not registered : "+b);var c,d=this,e=api.CZR_Helpers.build_setId(a),f="___",g=api.czr_skope(b)();if(c=_.has(api.settings.settings,e)?api.settings.settings[e].value:null,api.czr_skope(b).getSkopeSettingAPIDirtyness(e))return api.czr_skope(b).dirtyValues()[e];if(api.czr_isChangeSetOn()&&api.czr_skope(b).getSkopeSettingChangesetDirtyness(e))return api.czr_skope(b).changesetValues()[e];var h=d._getDBSettingVal(a,b);return"_no_db_val"!=h?h:"global"==g.skope?"___"==f?c:f:"___"!=f?f:d.getSkopeSettingVal(a,d._getParentSkopeId(g))},applyDirtyCustomizedInheritance:function(a,b){b=b||api.czr_activeSkopeId()||api.czr_skopeBase.getGlobalSkopeId(),a=a||{};var c=this,d=api.czr_skope(b)();if("global"==d.skope)return a;var e=c._getParentSkopeId(d),f=api.czr_skope(e).dirtyValues();return _.each(f,function(b,c){var e=api.CZR_Helpers.getOptionName(c);_.isUndefined(a[c])&&_.isUndefined(api.czr_skope(d.id).dbValues()[e])&&(a[c]=b)}),"global"==api.czr_skope(e)().skope?a:c.applyDirtyCustomizedInheritance(a,e)},_getParentSkopeId:function(a,b){var c=this,d=["local","group","special_group","global"],e=b||1*(_.findIndex(d,function(b){return a.skope==b})+1),f=d[e];return _.isUndefined(f)?_.findWhere(api.czr_currentSkopesCollection(),{skope:"global"}).id:_.isUndefined(_.findWhere(api.czr_currentSkopesCollection(),{skope:f}))?c._getParentSkopeId(a,e+1):_.findWhere(api.czr_currentSkopesCollection(),{skope:f}).id},_getChildSkopeId:function(a,b){var c=this,d=["local","group","special_group","global"],e=b||1*(_.findIndex(d,function(b){return a.skope==b})-1),f=d[e];return _.isUndefined(f)?_.findWhere(api.czr_currentSkopesCollection(),{skope:"local"}).id:_.isUndefined(_.findWhere(api.czr_currentSkopesCollection(),{skope:f}))?c._getParentSkopeId(a,e-1):_.findWhere(api.czr_currentSkopesCollection(),{skope:f}).id}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{updateSkopeCollection:function(a,b){var c=this;if(_api_ready_collection=[],_.each(a,function(a,b){var d=$.extend(!0,{},a);_api_ready_collection.push(c.prepareSkopeForAPI(d))}),c.isGlobalSkopeRegistered()){var d=[],e=$.extend(!0,{},api.czr_skope(c.getGlobalSkopeId())());_.each(_api_ready_collection,function(a,b){"global"==a.skope?d.push(e):d.push(a)}),_api_ready_collection=d}api.czr_currentSkopesCollection(_api_ready_collection)},prepareSkopeForAPI:function(a){if(!_.isObject(a))throw new Error("prepareSkopeForAPI : a skope must be an object to be API ready");var b=this,c={};if(_.each(serverControlParams.defaultSkopeModel,function(b,d){var e=a[d];switch(d){case"title":if(!_.isString(e))throw new Error("prepareSkopeForAPI : a skope title property must a string");c[d]=e;break;case"long_title":if(!_.isString(e))throw new Error("prepareSkopeForAPI : a skope title property must a string");c[d]=e;break;case"skope":if(!_.isString(e)||_.isEmpty(e))throw new Error('prepareSkopeForAPI : a skope "skope" property must a string not empty');c[d]=e;break;case"level":if(!_.isString(e)||_.isEmpty(e))throw new Error("prepareSkopeForAPI : a skope level must a string not empty for skope "+e.skope);c[d]=e;break;case"dyn_type":if(!_.isString(e)||!_.contains(serverControlParams.skopeDynTypes,e))throw new Error("prepareSkopeForAPI : missing or invalid dyn type for skope "+a);c[d]=e;break;case"opt_name":if(!_.isString(e)||_.isEmpty(e))throw new Error('prepareSkopeForAPI : invalid "opt_name" property for skope '+e.skope);c[d]=e;break;case"obj_id":if(!_.isString(e))throw new Error('prepareSkopeForAPI : invalid "obj_id" for skope '+e.skope);c[d]=e;break;case"is_winner":if(!_.isUndefined(e)&&!_.isBoolean(e))throw new Error('prepareSkopeForAPI : skope property "is_winner" must be a boolean');c[d]=e;break;case"is_forced":if(!_.isUndefined(e)&&!_.isBoolean(e))throw new Error('prepareSkopeForAPI : skope property "is_primary" must be a boolean');c[d]=e;break;case"db":if((_.isArray(e)||_.isEmpty(e))&&(e={}),_.isUndefined(e)||!_.isObject(e))throw new Error('prepareSkopeForAPI : skope property "db" must be an object');c[d]=e;break;case"changeset":if((_.isArray(e)||_.isEmpty(e))&&(e={}),_.isUndefined(e)||!_.isObject(e))throw new Error('prepareSkopeForAPI : skope property "changeset" must be an object');c[d]=e;break;case"has_db_val":if(!_.isUndefined(e)&&!_.isBoolean(e))throw new Error('prepareSkopeForAPI : skope property "has_db_val" must be a boolean');c[d]=e}}),c.color=b.skope_colors[c.skope]||"rgb(255, 255, 255)",c.id=c.skope+"_"+c.level,!_.isString(c.id)||_.isEmpty(c.id))throw new Error("prepareSkopeForAPI : a skope id must a string not empty");return _.isString(c.title)&&!_.isEmpty(c.title)||(c.title=id,c.long_title=id),c},currentSkopesCollectionReact:function(a,b){var c=this,d=$.extend(!0,[],a)||[],e=($.extend(!0,[],b)||[],$.Deferred()),f=[];_.each(d,function(a){api.czr_skope.has(a.id)||f.push(a)}),_.each(f,function(a){a=$.extend(!0,{},a),api.czr_skope.add(a.id,new api.CZR_skope(a.id,a))}),_.each(f,function(a){if(!api.czr_skope.has(a.id))throw new Error("Skope id : "+a.id+" has not been instantiated.");"pending"==api.czr_skope(a.id).isReady.state()&&api.czr_skope(a.id).ready()});var g=_.size(d),h=function(a){var b=a.container.attr("class").split(" ");_.each(a.container.attr("class").split(" "),function(a){"width-"==a.substring(0,6)&&(b=_.without(b,a))}),$.when(a.container.attr("class",b.join(" "))).done(function(){a.container.addClass("width-"+Math.round(100/g))})};return api.czr_skope.each(function(a){if(_.isUndefined(_.findWhere(d,{id:a().id})))a.visible(!1),a.isReady.then(function(){a.container.toggleClass("active-collection",!1)});else{a.visible(!0);var b=function(){h(a),a.container.toggleClass("active-collection",!0)};"pending"==a.isReady.state()?a.isReady.then(function(){b()}):b()}}),_.isEmpty(b)&&!_.isEmpty(a)&&api.czr_initialSkopeCollectionPopulated.resolve(),c.maybeSynchronizeGlobalSkope(),e.resolve("changed").promise()},maybeSynchronizeGlobalSkope:function(a){if(a=a||{},!_.isObject(a))throw new Error("maybeSynchronizeGlobalSkope : args must be an object");var b,c,d,e=this,f=$.Deferred();_.extend({isGlobalReset:!1,isSetting:!1,settingIdToReset:"",isSkope:!1,skopeIdToReset:""},a);if(e.isGlobalSkopeRegistered()){var g=api.czr_skope(e.getGlobalSkopeId()).dbValues();if(_.each(g,function(a,b){api.has(b)&&!_.isEqual(api.settings.settings[b].value,a)&&(api.settings.settings[b].value=a)}),a.isGlobalReset&&a.isSetting){if(b=a.settingIdToReset,c=api.CZR_Helpers.getOptionName(b),d=serverControlParams.defaultOptionsValues[c],_.isUndefined(api.settings.settings[b])||_.isUndefined(d))return;d!=api.settings.settings[b].value&&(api.settings.settings[b].value=d)}a.isGlobalReset&&a.isSkope&&_.each(api.settings.settings,function(a,b){e.isThemeSetting(b)&&(c=api.CZR_Helpers.getOptionName(b),_.has(serverControlParams.defaultOptionsValues,c)&&(api.settings.settings[b].value=serverControlParams.defaultOptionsValues[c]))})}return f.resolve().promise()}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{activeSkopeReact:function(a,b){var c=this,d=$.Deferred();if(!_.isUndefined(b)&&api.czr_skope.has(b))api.czr_skope(b).active(!1);else if(!_.isUndefined(b))throw new Error("listenToActiveSkope : previous scope does not exist in the collection",b);if(_.isUndefined(a)||!api.czr_skope.has(a))throw new Error("listenToActiveSkope : requested scope "+a+" does not exist in the collection");api.czr_skope(a).active(!0);var e=function(a){return api.czr_activeSkopeId(c.getGlobalSkopeId()),api.czr_serverNotification({status:"success",message:[a,"can only be customized site wide."].join(" ")}),d.resolve().promise()};if(c.isExcludedSidebarsWidgets()&&"widgets"==api.czr_activePanelId()&&a!=c.getGlobalSkopeId()&&api.czr_serverNotification({status:"success",message:["Widgets are created site wide."].join(" ")}),c.isExcludedWPCustomCss()&&"custom_css"==api.czr_activeSectionId()&&a!=c.getGlobalSkopeId())return e(api.section(api.czr_activeSectionId()).params.title);if("admin_sec"==api.czr_activeSectionId()&&a!=c.getGlobalSkopeId())return e(api.section(api.czr_activeSectionId()).params.title);if("nav_menu"!=api.czr_activeSectionId().substring(0,"nav_menu".length)&&"add_menu"!=api.czr_activeSectionId()||a==c.getGlobalSkopeId()||api.czr_serverNotification({status:"success",message:["Menus are created site wide."].join(" ")}),"nav_menus"==api.czr_activePanelId()&&_.each(api.panel(api.czr_activePanelId()).sections(),function(a){c.processSilentUpdates({section_id:a.id,awake_if_not_active:!0})}),api.state("switching-skope")(!0),c._writeCurrentSkopeTitle(a),api.trigger("czr-paint",{is_skope_switch:!0}),_.isUndefined(api.czr_activeSectionId()))return api.state("switching-skope")(!1),api.previewer.refresh(),d.resolve().promise();_.has(api,"czrModulePanelState")&&api.czrModulePanelState(!1);var f=c._getSilentUpdateCandidates();_.isUndefined(b)||_.each(api.czr_skope(b).dirtyValues(),function(a,b){_.contains(f,b)||f.push(b)}),_.isUndefined(a)||_.each(api.czr_skope(a).dirtyValues(),function(a,b){_.contains(f,b)||f.push(b)});var g=function(){c.processSilentUpdates({candidates:f,section_id:null,refresh:!1}).fail(function(){throw d.reject(),api.state("switching-skope")(!1),new Error("Fail to process silent updates in _debouncedProcessSilentUpdates")}).done(function(c){api.previewer.refresh().always(function(){api.trigger("skope-switched",a,b),d.resolve(),api.state("switching-skope")(!1)})})};return _.has(api,"czr_isModuleExpanded")&&!1!==api.czr_isModuleExpanded()?(api.czr_isModuleExpanded().setupModuleViewStateListeners(!1),(g=_.debounce(g,400))()):g(),d.promise()},_writeCurrentSkopeTitle:function(a){var b=this,c=api.czr_skope(a||api.czr_activeSkopeId())().long_title,d=function(){var d=b.getInheritedSkopeTitles(),e=b.getOverridenSkopeTitles();return $.trim(['<span class="czr-main-title"><span class="czr-toggle-title-notice fa fa-info-circle"></span>',"global"==api.czr_skope(a||api.czr_activeSkopeId())().skope?c:["Customizing",c].join(" "),"</span>",'<span class="czr-skope-inherits-from">',"In this context :",_.isEmpty(d)?" ":"inherits from",d,_.isEmpty(d)?"":_.isEmpty(e)?".":", and",_.isEmpty(e)?" ":"overridden by",e,_.isEmpty(e)?"":".","</span>"].join(" "))},e=function(a){a?$(".czr-scope-switcher").find(".spinner").fadeIn():$(".czr-scope-switcher").find(".spinner").fadeOut()};b.skopeWrapperEmbedded.then(function(){$(".czr-scope-switcher").find(".czr-current-skope-title").length?$.when($(".czr-scope-switcher").find(".czr-skope-title").fadeOut(200)).done(function(){$(this).html(d()).fadeIn(200)}):$(".czr-scope-switcher").prepend($("<h2/>",{"class":"czr-current-skope-title",html:['<span class="czr-skope-title">','<span class="spinner">',d(),"</span>","</span>"].join("")})),_.isUndefined(api.state("switching-skope").isBound)&&(api.state("switching-skope").bind(e),api.state("switching-skope").isBound=!0)})}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{processSilentUpdates:function(a){a=_.isString(a)?{candidates:[a]}:a||{};var b=this,c={candidates:[],section_id:api.czr_activeSectionId(),refresh:!0,awake_if_not_active:!1},d=$.Deferred();if(a=$.extend(c,a),_.isString(a.candidates)&&(a.candidates=[a.candidates]),_.isEmpty(a.candidates)&&(a.candidates=b._getSilentUpdateCandidates(a.section_id,a.awake_if_not_active)),!_.isArray(a.candidates))throw new Error("processSilentUpdates : the update candidates must be an array.");if(_.isEmpty(a.candidates))return d.resolve([]).promise();var e=function(){b.silentlyUpdateSettings(a.candidates,a.refresh).fail(function(){d.reject()}).done(function(c){_.delay(function(){b.setupActiveSkopedControls({section_id:a.section_id})},1e3),d.resolve(c)})};return"pending"==api.czr_skopeReady.state()?(d.resolve([]),api.czr_skopeReady.done(function(){e()})):e(),d.promise()},silentlyUpdateSettings:function(a,b){api.state.has("silent-update-processing")||api.state.create("silent-update-processing")(!1),api.state("silent-update-processing")(!0);var c=this,d={},e=$.Deferred();b=!!_.isUndefined(b)||b,(_.isUndefined(a)||_.isEmpty(a))&&(a=c._getSilentUpdateCandidates()),_.isString(a)&&(a=[a]),_.each(a,function(a){api.control.has(a)&&"czr_multi_module"==api.control(a).params.type||(d[a]=c.getSettingUpdatePromise(a))});var f=[],g=[];return _.each(d,function(a,b){a.done(function(a){var c=api.CZR_Helpers.build_setId(b),d=api.czr_skope(api.czr_activeSkopeId()).getSkopeSettingDirtyness(b);_.isEqual(api(c)(),a)||g.push(b),api(c).silent_set(a,d)}),f.push(a)}),$.when.apply(null,f).fail(function(){throw e.reject(),new Error("silentlyUpdateSettings FAILED. Candidates : "+a)}).always(function(){api.state("silent-update-processing")(!1)}).then(function(){_.each(f,function(b){if(_.isObject(b)&&"resolved"!==b.state())throw new Error("a silent update promise is unresolved : "+a)}),b&&!_.isEmpty(g)?api.previewer.refresh().always(function(){e.resolve(g)}):e.resolve(g)}),e.promise()},getSettingUpdatePromise:function(a){if(_.isUndefined(a))throw new Error("getSettingUpdatePromise : the provided setId is not defined");if(!api.has(api.CZR_Helpers.build_setId(a)))throw new Error("getSettingUpdatePromise : the provided wpSetId is not registered : "+api.CZR_Helpers.build_setId(a));var b=this,c=api.CZR_Helpers.build_setId(a),d=api(c)(),e=$.Deferred(),f=!1,g=api.czr_activeSkopeId(),h=api.czr_skopeBase.getSkopeSettingVal(a,g);if(_.isEqual(d,h))return e.resolve(h).promise();if(api.control.has(c)){var i=api.control(c).params.type,j=api.settings.controls[c];switch(i){case"czr_cropped_image":f=b._getCzrCroppedImagePromise(c,j);break;case"czr_module":b._processCzrModuleSilentActions(c,i,g,j)}}return _.has(api.settings.controls,"header_image")&&"header_image"==c&&(f=b._getHeaderImagePromise(c,g)),f&&_.isObject(f)?f.always(function(){e.resolve(h)}):e.resolve(h),e.promise()},_getSilentUpdateCandidates:function(a,b){var c=this,d=[];if(a=_.isUndefined(a)||_.isNull(a)?api.czr_activeSectionId():a,_.isEmpty(api.czr_activeSectionId())&&!b)return[];if(_.isUndefined(a))return api.consoleLog("_getSilentUpdateCandidates : No active section provided"),[];if(!api.section.has(a))throw new Error("_getSilentUpdateCandidates : The section "+a+" is not registered in the API.");var e=api.CZR_Helpers.getSectionSettingIds(a);return e=_.filter(e,function(a){return c.isSettingSkopeEligible(a)}),_.each(e,function(a){d.push(a)}),d}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{_processCzrModuleSilentActions:function(a,b,c,d){var e,f,g,h,i,j=_.has(api.control(a).params,"syncCollection")?api.control(a).params.syncCollection:"",k=api.CZR_Helpers.build_setId(a),l=api.czr_skopeBase.getSkopeSettingVal(k,c),m=api.czr_skope(api.czr_activeSkopeId());_.isEmpty(j)||_.isUndefined(j)||(e=api.CZR_Helpers.build_setId(j),f=api.czr_skopeBase.getSkopeSettingVal(e,c),g=api.settings.controls[e],h=api.controlConstructor.czr_multi_module,i=api.control(e).syncSektionModule()().id,api.control(e).container.remove(),api.control.remove(e),api(e).silent_set(f,m.getSkopeSettingDirtyness(e)),$.extend(g,{czr_skope:c}),api.control.add(e,new h(e,{params:g,previewer:api.previewer}))),_constructor=api.controlConstructor[b],api.control(a).container.remove(),api.control.remove(a),api(a).silent_set(l,m.getSkopeSettingDirtyness(k)),$.extend(d,{czr_skope:c}),api.control.add(a,new _constructor(a,{params:d,previewer:api.previewer})),_.isEmpty(j)||_.isUndefined(j)||(api.consoleLog("FIRE SEKTION MODULE?",i,api.control(a).czr_Module(i).isReady.state()),api.control(a).czr_Module(i).fireSektionModule())},_getCzrCroppedImagePromise:function(a,b){var c=api.controlConstructor.czr_cropped_image,d=$.Deferred(),e=api.has(a)?api(a)():null;return e=null===e?"":e,wp.media.attachment(e).fetch().done(function(){api.control(a).container.remove(),api.control.remove(a),b.attachment=this.attributes,api.control.add(a,new c(a,{params:b,previewer:api.previewer})),d.resolve()}).fail(function(){api.control(a).container.remove(),api.control.remove(a),b=_.omit(b,"attachment"),api.control.add(a,new c(a,{params:b,previewer:api.previewer})),d.reject()}),d.promise()},_getHeaderImagePromise:function(a,b){var c=$.Deferred();if(!_.has(api.settings.controls,"header_image")||"header_image"!=a)return c.resolve().promise();var d=api.controlConstructor.header,e=$.extend(!0,{},api.settings.controls.header_image);header_image_data=null===api.czr_skopeBase.getSkopeSettingVal("header_image_data",b)?"":api.czr_skopeBase.getSkopeSettingVal("header_image_data",b);var f,g=function(a){a=a||e,api.control("header_image").container.remove(),api.control.remove("header_image"),api.HeaderTool.UploadsList=api.czr_HeaderTool.UploadsList,api.HeaderTool.DefaultsList=api.czr_HeaderTool.DefaultsList,api.HeaderTool.CombinedList=api.czr_HeaderTool.CombinedList;var b=function(){api.control.add("header_image",new d("header_image",{params:a,previewer:api.previewer}))};(b=_.debounce(b,800))()};return _.has(header_image_data,"attachment_id")?(f=header_image_data.attachment_id,wp.media.attachment(f).fetch().done(function(){e.attachment=this.attributes,g(e),c.resolve()}).fail(function(){e=_.omit(e,"attachment"),api.control("header_image").container.remove(),api.control.remove("header_image"),api.HeaderTool.UploadsList=api.czr_HeaderTool.UploadsList,api.HeaderTool.DefaultsList=api.czr_HeaderTool.DefaultsList,api.HeaderTool.CombinedList=api.czr_HeaderTool.CombinedList,api.control.add("header_image",new d("header_image",{params:e,previewer:api.previewer})),c.reject()})):(g(),c.resolve()),c.promise()}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{setupActiveSkopedControls:function(a){var b,c,d,e,f=this;if(defaultSetupParams={controls:[],section_id:api.czr_activeSectionId()},d=$.extend(defaultSetupParams,a),!_.isObject(d)||!_.has(d,"controls")||!_.has(d,"section_id"))throw new Error("SetupControlsReset : the setupParams param must be an object with properties controls and section_id.");b=d.section_id,c=d.controls,e=[],!_.isEmpty(b)&&_.isString(b)||(b=api.czr_activeSectionId()),_.isEmpty(c)&&(c=api.CZR_Helpers.getSectionControlIds(b)),c=_.isString(c)?[c]:c,e=_.filter(c,function(a){var b=api.CZR_Helpers.getControlSettingId(a);return b&&!f.isSettingSkopeEligible(b)&&api.control(a).container.addClass("czr-not-skoped"),b&&f.isWPAuthorizedSetting(b)&&api.control(a).container.addClass("is-wp-authorized-setting"),b&&f.isSettingSkopeEligible(b)}),"nav_menu["!=b.substring(0,"nav_menu[".length)&&(_.isEmpty(c)||api.czr_skopeReady.then(function(){$.when(f.renderControlsSingleReset(e)).done(function(){f.listenSkopedControls(c)})}),f.renderCtrlSkpNotIcon(c))},listenSkopedControls:function(a){var b=this;_.each(a,function(a){if(api.has(a)&&!_.isUndefined(api.control(a))){var c=api.control(a),d=api.CZR_Helpers.getControlSettingId(a),e=(api.CZR_Helpers.getOptionName(d),{hasDBVal:!1,isDirty:!1,noticeVisible:!1,resetVisible:!1,isResetting:!1});_.has(c,"czr_states")||(c.czr_states=new api.Values,_.each(e,function(a,b){c.czr_states.create(b)}),b.bindControlStates(c)),c.czr_states("hasDBVal")(api.czr_skope(api.czr_activeSkopeId()).hasSkopeSettingDBValues(d)),c.czr_states("isDirty")(api.czr_skope(api.czr_activeSkopeId()).getSkopeSettingDirtyness(d)),_.has(c,"userEventMap")||(c.userEventMap=[{trigger:"click keydown",selector:".czr-setting-reset, .czr-cancel-button",name:"control_reset_warning",actions:function(){(c.czr_states("isDirty")()||c.czr_states("hasDBVal")())&&(_.each(_.without(api.CZR_Helpers.getSectionControlIds(c.section()),a),function(a){_.has(api.control(a),"czr_states")&&api.control(a).czr_states("resetVisible")(!1)}),c.czr_states("resetVisible")(!c.czr_states("resetVisible")()),c.czr_states("resetVisible")()&&c.czr_states("noticeVisible")(!1))}},{trigger:"click keydown",selector:".czr-control-do-reset",name:"control_do_reset",actions:function(){b.doResetSetting(a)}},{trigger:"click keydown",selector:".czr-skope-switch",name:"control_skope_switch",actions:function(a){var b=$(a.dom_event.currentTarget,a.dom_el).attr("data-skope-id");!_.isEmpty(b)&&api.czr_skope.has(b)&&api.czr_activeSkopeId(b)}},{trigger:"click keydown",selector:".czr-toggle-notice",name:"control_toggle_notice",actions:function(a){c.czr_states("noticeVisible")(!c.czr_states("noticeVisible")()),c.czr_states("noticeVisible")()&&c.czr_states("resetVisible")(!1)}}],api.CZR_Helpers.setupDOMListeners(c.userEventMap,{dom_el:c.container},b))}})},bindControlStates:function(a){if(!api.control.has(a.id))throw new Error("in bindControlStates, the provided ctrl id is not registered in the api : "+a.id);var b=this;api.CZR_Helpers.getControlSettingId(a.id);a.czr_states("hasDBVal").bind(function(b){a.container.toggleClass("has-db-val",b),b?_title="Reset your customized ( and published ) value":a.czr_states("isDirty")()?_title="Reset your customized ( but not yet published ) value":_title="Not customized yet, nothing to reset",a.container.find(".czr-setting-reset").attr("title",_title)}),a.czr_states("isDirty").bind(function(b){a.container.toggleClass("is-dirty",b);var c;c=b?"Reset your customized ( but not yet published ) value":a.czr_states("hasDBVal")()?"Reset your customized ( and published ) value":"Not customized yet, nothing to reset",a.container.find(".czr-setting-reset").attr("title",c)}),a.czr_states("noticeVisible").bind(function(c){a.container.toggleClass("czr-notice-visible",c);var d=a.getNotificationsContainerElement();!1!==d&&!1!==d.length&&(c?(b.updateCtrlSkpNot(a.id),d.stop().slideDown("fast",null,function(){$(this).css("height","auto")})):$.when(d.stop().slideUp("fast",null,function(){$(this).css("height","auto")})).done(function(){b.removeCtrlSkpNot(a.id)}))}),a.czr_states("resetVisible").bind(function(c){a.section()||api.czr_activeSectionId();c?$.when(b.renderControlResetWarningTmpl(a.id)).done(function(b){_.isEmpty(b)||(a.czr_resetDialogContainer=b.container,b.container.slideToggle("fast"),b.is_authorized||_.delay(function(){$.when(a.czr_resetDialogContainer.slideToggle("fast")).done(function(){a.czr_resetDialogContainer.remove()})},3e3))}):_.has(a,"czr_resetDialogContainer")&&a.czr_resetDialogContainer.length&&$.when(a.czr_resetDialogContainer.slideToggle("fast")).done(function(){a.czr_resetDialogContainer.remove()})})}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{renderControlsSingleReset:function(a){
11
+ var b=this,c=$.Deferred();(_.isUndefined(a)||_.isEmpty(a))&&(a=api.CZR_Helpers.getSectionControlIds(api.czr_activeSectionId()),a=_.filter(a,function(a){var c=api.CZR_Helpers.getControlSettingId(a);return c&&b.isSettingSkopeEligible(c)}));var d=_.isArray(a)?a:[a],e=function(a){return _.isEmpty(a)?void c.resolve():void _.each(a,function(a){api.control.when(a,function(){var b=api.control(a);api.CZR_Helpers.getControlSettingId(a);return $(".czr-setting-reset",b.container).length?void c.resolve():void b.deferred.embedded.then(function(){$.when(b.container.find(".customize-control-title").first().prepend($("<span/>",{"class":"czr-setting-reset fa fa-refresh",title:""}))).done(function(){b.container.addClass("czr-skoped"),$(".czr-setting-reset",b.container).fadeIn(400),c.resolve()})})})})};return e=_.debounce(e,200),e(d),c.promise()},renderControlResetWarningTmpl:function(a){if(!api.control.has(a))return{};var b,c,d=api.control(a),e=api.CZR_Helpers.getControlSettingId(a),f="",g=function(){return!!_.contains(serverControlParams.wpBuiltinSettings,api.CZR_Helpers.getOptionName(e))||!_.contains(serverControlParams.themeSettingList,api.CZR_Helpers.getOptionName(e))}();d.czr_states("isDirty")()?(b=["Please confirm that you want to reset your current customizations for this option in ",api.czr_skope(api.czr_activeSkopeId())().title,"."].join(""),c="Your customizations have been reset."):g&&"global"==api.czr_skope(api.czr_activeSkopeId())().skope?b="This WordPress setting can not be reset site wide.":(b=["Please confirm that you want to reset this option in ",api.czr_skope(api.czr_activeSkopeId())().title,"."].join(""),c="The options have been reset.");var h=!(g&&"global"==api.czr_skope(api.czr_activeSkopeId())().skope&&!d.czr_states("isDirty")()),i={warning_message:b,success_message:c,is_authorized:h};try{f=wp.template("czr-reset-control")(i)}catch(j){throw new Error("Error when parsing the the reset control template : "+j)}return $(".customize-control-title",d.container).first().after($(f)),{container:$(".czr-ctrl-reset-warning",d.container),is_authorized:h}},doResetSetting:function(a){var b=this,c=api.CZR_Helpers.getControlSettingId(a),d=api.control(a),e=api.czr_activeSkopeId(),f=d.czr_states("isDirty")()?"_resetControlDirtyness":"_resetControlAPIVal",g=function(a,b){b=!_.isUndefined(b)&&b,a.czr_states("resetVisible")(!1),a.czr_states("isResetting")(!1),a.container.removeClass("czr-resetting-control")},h=function(a){var h=function(){api.czr_skopeBase.processSilentUpdates({candidates:a,refresh:!1}).fail(function(){api.consoleLog("Silent update failed after resetting control : "+a)}).done(function(){$.when($(".czr-crtl-reset-dialog",d.container).fadeOut("300")).done(function(){$.when($(".czr-reset-success",d.container).fadeIn("300")).done(function(c){_.delay(function(){$.when(c.fadeOut("300")).done(function(){g(d),b.setupActiveSkopedControls({controls:[a]}),_.delay(function(){d.czr_states("noticeVisible")(!0)},300),_.delay(function(){d.czr_states("noticeVisible")(!1)},4e3)})},1e3)})})})};b[f](a).done(function(){api.consoleLog("REFRESH AFTER A SETTING RESET"),api.previewer.refresh().fail(function(a){api.consoleLog("SETTING RESET REFRESH FAILED",a)}).done(function(a){if("global"==api.czr_skope(e)().skope&&"_resetControlAPIVal"==f){var b,d={},g=api.czr_skope(e)().opt_name;!_.isUndefined(a.skopesServerData)&&_.has(a.skopesServerData,"czr_skopes")&&(b=a.skopesServerData.czr_skopes,_.isUndefined(_.findWhere(b,{opt_name:g}))&&(d=_.findWhere(b,{opt_name:g}).db||{})),api.czr_skopeBase.maybeSynchronizeGlobalSkope({isGlobalReset:!0,isSetting:!0,settingIdToReset:c}).done(function(){h()})}else h()})})};d.czr_states("isResetting")(!0),d.container.addClass("czr-resetting-control"),api.czr_skopeReset[d.czr_states("isDirty")()?"resetChangeset":"resetPublished"]({skope_id:e,setId:c,is_setting:!0}).done(function(b){h(a)}).fail(function(c){$.when($(".czr-crtl-reset-dialog",d.container).fadeOut("300")).done(function(){$.when($(".czr-reset-fail",d.container).fadeIn("300")).done(function(){$(".czr-reset-fail",d.container).append("<p>"+c+"</p>"),_.delay(function(){g(d),b.setupActiveSkopedControls({controls:[a]})},2e3)})})})},_resetControlDirtyness:function(a){var b=api.CZR_Helpers.getControlSettingId(a),c=api.czr_skope(api.czr_activeSkopeId()),d=$.extend(!0,{},c.dirtyValues()),e={},f=$.extend(!0,{},c.changesetValues()),g={},h=$.Deferred();return e=_.omit(d,b),g=_.omit(f,b),c.dirtyValues(e),c.changesetValues(e),h.resolve().promise()},_resetControlAPIVal:function(a){var b=api.CZR_Helpers.getControlSettingId(a),c=api.czr_skope(api.czr_activeSkopeId()).dbValues(),d=$.extend(!0,{},c),e=$.Deferred();return _.has(api.control(a),"czr_states")&&(api.control(a).czr_states("hasDBVal")(!1),api.czr_skope(api.czr_activeSkopeId()).dbValues(_.omit(d,b))),e.resolve().promise()}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{renderCtrlSkpNotIcon:function(a){var b=_.isArray(a)?a:[a];_.each(b,function(a){api.control.when(a,function(){var b=api.control(a);b.deferred.embedded.then(function(){$(".czr-toggle-notice",b.container).length||$.when(b.container.find(".customize-control-title").first().append($("<span/>",{"class":"czr-toggle-notice fa fa-info-circle",title:"Display informations about the scope of this option."}))).done(function(){$(".czr-toggle-notice",b.container).fadeIn(400)})})})})},updateCtrlSkpNot:function(a){var b=this,c=_.isArray(a)?a:[a],d=function(a){return a&&b.isSettingSkopeEligible(a)},e=function(a,c){var e,f,g=api.czr_activeSkopeId(),h=b.getInheritedSkopeId(a,g),i=b.getAppliedPrioritySkopeId(a,g),j=[];return d(a)?(h==i&&api.czr_skope.has(h)&&g==h&&(e=!_.isUndefined(api.czr_skope(g).dirtyValues()[a]),f=!_.isUndefined(api.czr_skope(g).dbValues()[a]),e?"global"==api.czr_skope(h)().skope?j.push(["Customized. Will be published site wide."].join(" ")):j.push(["Customized. Will be published for :",api.czr_skope(h)().title].join(" ")):f?"global"==api.czr_skope(h)().skope?j.push(["Customized and published site wide."].join(" ")):j.push(["Customized and published for :",api.czr_skope(h)().title].join(" ")):j.push("Default website value published site wide.")),h!==g&&api.czr_skope.has(h)&&(e=!_.isUndefined(api.czr_skope(h).dirtyValues()[a]),f=!_.isUndefined(api.czr_skope(h).dbValues()[a]),e||f?j.push("Inherited from : "+b.buildSkopeLink(h)):j.push("Default website value")),i!==g&&api.czr_skope.has(i)&&(e=!_.isUndefined(api.czr_skope(i).dirtyValues()[a]),j.push([e?"The value that will be published for":"The value currently published for",api.czr_skope(c)().title,e?"is customized in scope :":"is set in scope :",b.buildSkopeLink(i),e?", and will override this one once published because it has a higher priority.":", because it has a higher priority than this one."].join(" "))),j.join(" | ")):(j.push(["This option is always customized site wide and can't be reset."].join(" ")),j.join(" | "))};_.each(c,function(a){api.control.when(a,function(){var b=api.control(a),c=api.CZR_Helpers.getControlSettingId(a);_.has(b,"czr_states")&&b.czr_states("noticeVisible")()&&b.deferred.embedded.then(function(){var a=_.findWhere(api.czr_currentSkopesCollection(),{skope:"local"}).id,d=b.getNotificationsContainerElement();if(d&&d.length&&!_.isUndefined(a)){_html=e(c,a);var f=$(".czr-skope-notice",d);f.length?f.html(_html):d.append(['<span class="czr-notice czr-skope-notice">',_html,"</span>"].join(""))}})})})},removeCtrlSkpNot:function(a){var b=_.isArray(a)?a:[a];_.each(b,function(a){api.control.when(a,function(){var b=api.control(a);b.deferred.embedded.then(function(){var a=b.getNotificationsContainerElement();if(a&&a.length){var c=$(".czr-skope-notice",a);c.length&&c.remove()}})})})}});var CZRSkopeSaveMths=CZRSkopeSaveMths||{};$.extend(CZRSkopeSaveMths,{initialize:function(){this.changesetStatus="publish",this.saveBtn=$("#save")},save:function(a){var b,c=this,d=api.state("processing"),e=new api.Messenger({url:api.settings.url.parent,channel:"loader"});c.globalSaveDeferred=$.Deferred(),c.previewer=api.previewer,c.globalSkopeId=api.czr_skopeBase.getGlobalSkopeId(),c.saveArgs=a,a&&a.status&&(c.changesetStatus=a.status),api.state("saving")()&&c.globalSaveDeferred.reject("already_saving");var f=function(a,b){api.state("saving")(!1),api.state("processing").set(0),c.saveBtn.prop("disabled",!1),!_.isUndefined(a)&&a.setting_validities&&api._handleSettingValidities({settingValidities:a.setting_validities,focusInvalidControl:!0}),"pending"==b&&api.czr_serverNotification({message:a,status:"error"})},g=function(a){var b,d=$.Deferred();return api.state("saving")(!0),c.fireAllSubmission(a).always(function(a){b=a.response,f(b,this.state())}).fail(function(a){b=a.response,api.consoleLog("ALL SUBMISSIONS FAILED",b),c.globalSaveDeferred.reject(b),api.trigger("error",b),d.resolve(a.hasNewMenu)}).done(function(a){b=a.response,api.previewer.refresh({waitSkopeSynced:!0}).fail(function(a){c.globalSaveDeferred.reject(c.previewer,[b]),api.consoleLog("SAVE REFRESH FAIL",a)}).done(function(f){if(api.previewer.send("saved",b),b=_.extend({changeset_status:"publish"},b||{}),api.czr_isChangeSetOn()){var g=api._latestRevision;api.state("changesetStatus").set(b.changeset_status),"publish"===b.changeset_status&&(api.each(function(a){a._dirty&&(_.isUndefined(api._latestSettingRevisions[a.id])||api._latestSettingRevisions[a.id]<=g)&&(a._dirty=!1)}),api.state("changesetStatus").set(""),api.settings.changeset.uuid=b.next_changeset_uuid,e.send("changeset-uuid",api.settings.changeset.uuid))}else api.each(function(a){a._dirty=!1});f=_.extend({previewer:f.previewer||c.previewer,skopesServerData:f.skopesServerData||{}},f),c.reactWhenSaveDone(f.skopesServerData),c.globalSaveDeferred.resolveWith(c.previewer,[b]),api.trigger("saved",b||{}),d.resolve(a.hasNewMenu)})}),d.promise()};return 0===d()?g().done(function(a){a&&g({saveGlobal:!1,saveSkopes:!0})}):(b=function(){0===d()&&(api.state.unbind("change",b),g())},api.state.bind("change",b)),c.globalSaveDeferred.promise()}});var CZRSkopeSaveMths=CZRSkopeSaveMths||{};$.extend(CZRSkopeSaveMths,{getSubmitPromise:function(a){var b=this,c=$.Deferred(),d={};if(_.isEmpty(a)||!api.czr_skope.has(a))return api.consoleLog("getSubmitPromise : no skope id requested OR skope_id not registered : "+a),c.resolve().promise();var e=api.czr_skope(a)();return api.czr_skope(a).dirtyness()||a===b.globalSkopeId?(_.each(api.czr_skopeBase.getSkopeDirties(a),function(a,b){d[b]=_.extend({value:a})}),this.submit({skope_id:a,customize_changeset_data:d,dyn_type:e.dyn_type}).done(function(a){c.resolve(a)}).fail(function(b){api.consoleLog("GETSUBMIT FAILED PROMISE FOR SKOPE : ",a,b),c.reject(b)}),c.promise()):c.resolve().promise()},submit:function(a){var b,c=this,d={skope_id:null,the_dirties:{},customize_changeset_data:{},dyn_type:null,opt_name:null},e=[],f=$.Deferred();if(a=$.extend(d,a),_.isNull(a.skope_id))throw new Error("OVERRIDEN SAVE::submit : MISSING skope_id");if(_.isNull(a.the_dirties))throw new Error("OVERRIDEN SAVE::submit : MISSING the_dirties");if(_.has(api,"Notification")&&(api.each(function(a){a.notifications.each(function(b){"error"===b.type&&api.consoleLog("NOTIFICATION ERROR on SUBMIT SAVE",b),"error"!==b.type||b.data&&b.data.from_server||(e.push(a.id),settingInvalidities[a.id]||(settingInvalidities[a.id]={}),settingInvalidities[a.id][b.code]=b)})}),b=api.findControlsForSettings(e),!_.isEmpty(b)))return _.values(b)[0][0].focus(),f.rejectWith(c.previewer,[{setting_invalidities:settingInvalidities}]).promise();var g={skope_id:a.skope_id,action:"save",the_dirties:a.the_dirties,dyn_type:a.dyn_type,opt_name:a.opt_name};api.czr_isChangeSetOn()&&$.extend(g,{excludeCustomizedSaved:!1});var h=$.extend(c.previewer.query(g),{nonce:c.previewer.nonce.save,customize_changeset_status:c.changesetStatus,customize_changeset_data:JSON.stringify(a.customize_changeset_data)});api.czr_isChangeSetOn()&&(c.saveArgs&&c.saveArgs.date&&(h.customize_changeset_date=c.saveArgs.date),c.saveArgs&&c.saveArgs.title&&(h.customize_changeset_title=c.saveArgs.title));var i=wp.ajax.post("global"!==h.skope?"customize_skope_changeset_save":"customize_save",h);return c.saveBtn.prop("disabled",!0),api.trigger("save",i),i.fail(function(b){api.consoleLog("SUBMIT REQUEST FAIL",a.skope_id,b),"0"===b?b="not_logged_in":"-1"===b&&(b="invalid_nonce"),"invalid_nonce"===b?c.previewer.cheatin():"not_logged_in"===b&&(c.previewer.preview.iframe.hide(),c.previewer.login().done(function(){c.previewer.save(),c.previewer.preview.iframe.show()})),api.trigger("error",b),f.reject(b)}),i.done(function(a){f.resolve(a)}),f.promise()}});var CZRSkopeSaveMths=CZRSkopeSaveMths||{};$.extend(CZRSkopeSaveMths,{fireAllSubmission:function(a){var b=this,c=$.Deferred(),d=[],e=$.Deferred(),f={},g=[],h=[],i={saveGlobal:!0,saveSkopes:!0};a=$.extend(i,a),_.each(api.czr_skopeCollection(),function(a){"global"!==a.skope&&d.push(a.id)});var j=function(a){if(_.isUndefined(d[a+1])&&g.length==d.length){if(_.isEmpty(h))e.resolve(f);else{var b=function(){var a=[];return _.each(h,function(b){a.push(api.czr_skopeBase.buildServerResponse(b))}),$.trim(a.join(" | "))};e.reject(b())}return!0}},k=function(a){return a=a||0,_.isUndefined(d[a])&&(api.consoleLog("Undefined Skope in Save recursive call ",a,_skopesToUpdate,_skopesToUpdate[a]),e.resolve(f)),b.getSubmitPromise(d[a]).always(function(){g.push(a)}).fail(function(b){h.push(b),api.consoleLog("RECURSIVE PUSH FAIL FOR SKOPE : ",d[a]),j(a)||k(a+1)}).done(function(b){b=b||{},f=_.isEmpty(f)?b||{}:$.extend(f,b),j(a)||k(a+1)}),e.promise()},l=!1;_.each(api.czr_skope("global__all_").dirtyValues(),function(a,b){"nav_menu["==b.substring(0,"nav_menu[".length)&&(l=!0)});var m=function(){b.getSubmitPromise(b.globalSkopeId).fail(function(a){api.consoleLog("GLOBAL SAVE SUBMIT FAIL",a),a=api.czr_skopeBase.buildServerResponse(a),c.reject(a)}).done(function(a){f=_.isEmpty(f)?a||{}:$.extend(f,a),c.resolve({response:f,hasNewMenu:l})})};return l&&a.saveGlobal?m():a.saveGlobal&&a.saveSkopes?k().fail(function(a){api.consoleLog("RECURSIVE SAVE CALL FAIL",a),c.reject(a)}).done(function(a){b.cleanSkopeChangesetMetas().always(function(){m()})}):a.saveGlobal&&!a.saveSkopes?m():!a.saveGlobal&&a.saveSkopes&&k().fail(function(a){api.consoleLog("RECURSIVE SAVE CALL FAIL",a),c.reject(a)}).done(function(a){f=_.isEmpty(f)?a||{}:$.extend(f,a),b.cleanSkopeChangesetMetas().always(function(){c.resolve({response:f,hasNewMenu:l})})}),c.promise()},cleanSkopeChangesetMetas:function(){var a=$.Deferred();return _query=$.extend(api.previewer.query(),{nonce:api.previewer.nonce.save}),wp.ajax.post("czr_clean_skope_changeset_metas_after_publish",_query).always(function(){a.resolve()}).fail(function(a){api.consoleLog("cleanSkopeChangesetMetas failed",_query,a)}).done(function(a){api.consoleLog("cleanSkopeChangesetMetas done",_query,a)}),a.promise()}});var CZRSkopeSaveMths=CZRSkopeSaveMths||{};$.extend(CZRSkopeSaveMths,{reactWhenSaveDone:function(a){var b={};a=_.extend({czr_skopes:[],isChangesetDirty:!1},a),_.each(api.czr_skopeCollection(),function(a){b[a.opt_name]=api.czr_skopeBase.getSkopeDirties(a.id),api.czr_skope(a.id).dirtyValues({}),api.czr_skope(a.id).changesetValues({})});var c=[],d=a.czr_skopes;api.consoleLog("REACT WHEN SAVE DONE",b,d),_.each(b,function(a,b){_.each(a,function(a,e){if(!_.isUndefined(_.findWhere(d,{opt_name:b}))&&api.czr_skopeBase.isSettingSkopeEligible(e)){var f=_.findWhere(d,{opt_name:b}).db,g=_.findWhere(d,{opt_name:b}).skope,h=api.CZR_Helpers.build_setId(e),i=api.CZR_Helpers.getOptionName(e),j=f[h];_.isUndefined(j)&&"global"==g&&a===serverControlParams.defaultOptionsValues[i]||!_.isUndefined(j)&&_.isEqual(j,a)||c.push({opt_name:b,setId:h,server_val:j,api_val:a})}})}),_.isEmpty(c)?api.consoleLog("ALL RIGHT, SERVER AND API ARE SYNCHRONIZED AFTER SAVE"):api.consoleLog("SOME SETTINGS HAVE NOT BEEN PROPERLY SAVED : ",c),api.czr_skopeBase.maybeSynchronizeGlobalSkope(),api.czr_skopeBase.updateCtrlSkpNot(api.CZR_Helpers.getSectionControlIds())}});var CZRSkopeResetMths=CZRSkopeResetMths||{};$.extend(CZRSkopeResetMths,{initialize:function(){var a=this;a.previewer=api.previewer,api.state.create("czr-resetting")(!1),api.state("czr-resetting").bind(function(a){$(document.body).toggleClass("czr-resetting",!1!==a)})},resetChangeset:function(a){var b,c,d,e,f,g=$.Deferred(),h=this,i=api.state("processing"),j={is_setting:!1,is_skope:!1,skope_id:api.czr_activeSkopeId()||"",setId:""};a=_.extend(j,a);var k=a.skope_id,l=a.setId;return api.czr_isChangeSetOn()?(c=function(b,c){if(_.isUndefined(b))throw new Error("RESET: MISSING skope_id");if(api.state("czr-resetting")(!0),e={skope_id:b,action:"reset"},f=$.extend(h.previewer.query(e),{nonce:h.previewer.nonce.save}),a.is_setting)$.extend(f,{setting_id:c}),d="czr_changeset_setting_reset";else{if(!a.is_skope)return g.reject("reset_ajax_action_not_specified").promise();d="czr_changeset_skope_reset"}wp.ajax.post(d,f).always(function(){api.state("czr-resetting")(!1)}).fail(function(b){"0"===b?b="not_logged_in":"-1"===b&&(b="invalid_nonce"),"invalid_nonce"===b?h.previewer.cheatin():"not_logged_in"===b&&(h.previewer.preview.iframe.hide(),h.previewer.login().done(function(){h.resetChangeset(a),h.previewer.preview.iframe.show()})),api.consoleLog(d+" failed ",f,b),b=api.czr_skopeBase.buildServerResponse(b),api.trigger("error",b),api.czr_serverNotification({message:b,status:"error"}),g.reject(b)}).done(function(a){g.resolve(a)})},0===i()&&!1===api.state("czr-resetting")()?c(k,l):(b=function(){0===i()&&!1===api.state("czr-resetting")()&&(api.state.unbind("change",b),c(k,l))},api.state.bind("change",b)),g.promise()):g.resolve().promise()},resetPublished:function(a){var b,c,d,e,f,g=$.Deferred(),h=this,i=api.state("processing"),j={is_setting:!1,is_skope:!1,skope_id:api.czr_activeSkopeId()||"",setId:""};a=_.extend(j,a);var k=a.skope_id,l=a.setId;return c=function(b,c){if(_.isUndefined(b))throw new Error("RESET: MISSING skope_id");if(api.state("czr-resetting")(!0),e={skope_id:b,action:"reset"},f=$.extend(h.previewer.query(e),{nonce:h.previewer.nonce.save}),a.is_setting)$.extend(f,{setting_id:c}),d="czr_published_setting_reset";else{if(!a.is_skope)return g.reject("reset_ajax_action_not_specified").promise();d="czr_published_skope_reset"}api.consoleLog("in czr_reset submit : ",b,f),wp.ajax.post(d,f).always(function(){api.state("czr-resetting")(!1)}).fail(function(b){"0"===b?b="not_logged_in":"-1"===b&&(b="invalid_nonce"),"invalid_nonce"===b?h.previewer.cheatin():"not_logged_in"===b&&(h.previewer.preview.iframe.hide(),h.previewer.login().done(function(){h.resetChangeset(a),h.previewer.preview.iframe.show()})),api.consoleLog(d+" failed ",f,b),b=api.czr_skopeBase.buildServerResponse(b),api.trigger("error",b),api.czr_serverNotification({message:b,status:"error"}),g.reject(b)}).done(function(a){g.resolve(a)})},0===i()&&!1===api.state("czr-resetting")()?c(k,l):(b=function(){0===i()&&!1===api.state("czr-resetting")()&&(api.state.unbind("change",b),c(k,l))},api.state.bind("change",b)),g.promise()}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{initWidgetSidebarSpecifics:function(){var a=this;a.isExcludedSidebarsWidgets()||api.czr_activeSkopeId.bind(function(b){a.forceSidebarDirtyRefresh(api.czr_activeSectionId(),b)}),$(document).bind("widget-added",function(b,c){if(!a.isExcludedSidebarsWidgets()){var d=c.closest(".customize-control").attr("id"),e=api.czr_skopeBase.widgetIdToSettingId(d,"customize-control-");if(!api.has(e))throw new Error("AN ADDED WIDGET COULD NOT BE BOUND IN SKOPE. "+e);a.listenAPISettings(e)}})},forceSidebarDirtyRefresh:function(a,b){var c=this;if(!c.isExcludedSidebarsWidgets()){var d=api.state("saved")(),e=function(){if(api.section.has(a)&&"sidebar"==api.section(a).params.type){var b=b||api.czr_activeSkopeId(),e="sidebars_widgets["+api.section(a).params.sidebarId+"]",f=c.getSkopeSettingVal(e,b);api.czr_skope(b).updateSkopeDirties(e,f),api.previewer.refresh({the_dirties:api.czr_skope(b).dirtyValues()}).done(function(){api.state("saved")(d)})}};e=_.debounce(e,500),e()}}});var CZRSkopeMths=CZRSkopeMths||{};$.extend(CZRSkopeMths,{initialize:function(a,b){var c=this;api.Value.prototype.initialize.call(c,null,b),c.isReady=$.Deferred(),c.embedded=$.Deferred(),c.el="czr-scope-"+a,$.extend(c,b||{}),c.visible=new api.Value((!0)),c.winner=new api.Value((!1)),c.priority=new api.Value,c.active=new api.Value((!1)),c.dirtyness=new api.Value((!1)),c.skopeResetDialogVisibility=new api.Value((!1)),c.hasDBValues=new api.Value((!1)),c.dirtyValues=new api.Value({}),c.dbValues=new api.Value({}),c.changesetValues=new api.Value({}),c.userEventMap=new api.Value([{trigger:"click keydown",selector:".czr-scope-switch, .czr-skp-switch-link",name:"skope_switch",actions:function(){api.czr_activeSkopeId(c().id)}},{trigger:"click keydown",selector:".czr-scope-reset",name:"skope_reset_warning",actions:"reactOnSkopeResetUserRequest"}]),c.skopeResetDialogVisibility.bind(function(a,b){return c.skopeResetDialogReact(a)},{deferred:!0}),c.dirtyValues.callbacks.add(function(){return c.dirtyValuesReact.apply(c,arguments)}),c.changesetValues.callbacks.add(function(){return c.changesetValuesReact.apply(c,arguments)}),c.dbValues.callbacks.add(function(){return c.dbValuesReact.apply(c,arguments)}),c.callbacks.add(function(){return c.skopeReact.apply(c,arguments)}),c.set(_.omit(b,function(a,b){return _.contains(["db","changeset","has_db_val"],b)})),c.embedded.fail(function(){throw new Error("The container of skope "+c().id+" has not been embededd")}).done(function(){c.setupDOMListeners(c.userEventMap(),{dom_el:c.container}),c.visible.bind(function(a){c.container.toggle(a)}),c.active.callbacks.add(function(){return c.activeStateReact.apply(c,arguments)}),c.dirtyness.callbacks.add(function(){return c.dirtynessReact.apply(c,arguments)}),c.hasDBValues.callbacks.add(function(){return c.hasDBValuesReact.apply(c,arguments)}),c.winner.callbacks.add(function(){return c.winnerReact.apply(c,arguments)}),c.dirtyness(!_.isEmpty(b.changeset)),c.hasDBValues(!_.isEmpty(b.db)),c.winner(b.is_winner),c.isReady.resolve()})},ready:function(){var a=this;$.when(a.embedSkopeDialogBox()).done(function(b){!1!==b.length?(b.css("background-color",a.color),a.container=b,a.embedded.resolve(b)):a.embedded.reject()})},dirtyValuesReact:function(a,b){var c=this;c.dirtyness(!_.isEmpty(a)),api.czr_dirtyness(!_.isEmpty(a));var d=[];_.each(b,function(b,c){_.has(a,c)||d.push(c)}),c().id==api.czr_activeSkopeId()&&(_.each(d,function(a){_.has(api.control(a),"czr_states")&&api.control(a).czr_states("isDirty")(!1)}),_.each(a,function(a,b){_.has(api.control(b),"czr_states")&&api.control(b).czr_states("isDirty")(!0)}))},changesetValuesReact:function(a,b){var c=this,d=$.extend(!0,{},c.dirtyValues());c.dirtyValues($.extend(d,a))},dbValuesReact:function(a,b){var c=this;c.hasDBValues(!_.isEmpty("global"!=c().skope?a:_.omit(a,function(a,b){return!api.czr_skopeBase.isThemeSetting(b)})));var d=[];_.each(b,function(b,c){_.has(a,c)||d.push(c)}),c().id==api.czr_activeSkopeId()&&(_.each(d,function(a){_.has(api.control(a),"czr_states")&&api.control(a).czr_states("hasDBVal")(!1)}),_.each(a,function(a,b){_.has(api.control(b),"czr_states")&&api.control(b).czr_states("hasDBVal")(!0)}))},skopeReact:function(a,b){var c=this,d=[],e=[];api.czr_skopeBase.isSkopeRegisteredInCollection(a.id)?(d=$.extend(!0,[],api.czr_skopeCollection()),e=d,_.each(d,function(b,d){b.id==c().id&&(e[d]=a)}),api.czr_skopeCollection(e)):(d=$.extend(!0,[],api.czr_skopeCollection()),d.push(a),api.czr_skopeCollection(d))},activeStateReact:function(a,b){var c=this;c.container.toggleClass("inactive").toggleClass("active",a),$(".czr-scope-switch",c.container).toggleClass("fa-toggle-on",a).toggleClass("fa-toggle-off",!a)},dirtynessReact:function(a,b){var c=this;$.when(this.container.toggleClass("dirty",a)).done(function(){a?$(".czr-scope-reset",c.container).fadeIn("slow").attr("title",["Reset the current customizations for",c().title].join(" ")):c.hasDBValues()||$(".czr-scope-reset",c.container).fadeOut("fast")})},hasDBValuesReact:function(a,b){var c=this;$.when(c.container.toggleClass("has-db-val",a)).done(function(){a?$(".czr-scope-reset",c.container).fadeIn("slow").attr("title",["global"==c().skope?"Reset the theme options published site wide":"Reset your website published options for","global"==c().skope?"":c().title].join(" ")):c.dirtyness()||$(".czr-scope-reset",c.container).fadeOut("fast")})},winnerReact:function(a){var b=this;this.container.toggleClass("is_winner",a),a&&_.each(api.czr_currentSkopesCollection(),function(a){if(a.id!=b().id){var c=$.extend(!0,{},a);$.extend(c,{is_winner:!1}),api.czr_skope(a.id)(c)}})},updateSkopeDirties:function(a,b){var c=this;api.CZR_Helpers.getOptionName(a);if(!api.czr_skopeBase.isSettingSkopeEligible(a)&&"global"!=c().skope)return api.czr_skope(api.czr_skopeBase.getGlobalSkopeId()).updateSkopeDirties(a,b);var d=$.extend(!0,{},c.dirtyValues()),e={};return e[a]=b,c.dirtyValues.set($.extend(d,e)),c.dirtyValues()},getSkopeSettingDirtyness:function(a){var b=this;return b.getSkopeSettingAPIDirtyness(a)||b.getSkopeSettingChangesetDirtyness(a)},getSkopeSettingAPIDirtyness:function(a){var b=this;return _.has(b.dirtyValues(),api.CZR_Helpers.build_setId(a))},getSkopeSettingChangesetDirtyness:function(a){var b=this;return api.czr_isChangeSetOn()?_.has(b.changesetValues(),api.CZR_Helpers.build_setId(a)):b.getSkopeSettingAPIDirtyness(a)},hasSkopeSettingDBValues:function(a){var b=api.CZR_Helpers.build_setId(a);return!_.isUndefined(api.czr_skope(api.czr_activeSkopeId()).dbValues()[b])}});var CZRSkopeMths=CZRSkopeMths||{};$.extend(CZRSkopeMths,{embedSkopeDialogBox:function(){var a=this,b=$.extend(!0,{},a()),c="";if(!$("#customize-header-actions").find(".czr-scope-switcher").length)throw new Error("The skope switcher wrapper is not printed, the skope can not be embedded.");try{c=wp.template("czr-skope")(_.extend(b,{el:a.el}))}catch(d){throw new Error("Error when parsing the template of a skope"+d)}return $(".czr-skopes-wrapper","#customize-header-actions").append($(c)),$("."+a.el,".czr-skopes-wrapper")},renderResetWarningTmpl:function(){var a,b,c=this,d=$.extend(!0,{},c()),e="";c.dirtyness()?(a=["Please confirm that you want to reset your current customizations for : ",c().title,"."].join(""),b=["Your customizations have been reset for ",c().title,"."].join("")):(a=["Please confirm that you want to reset your published customizations to defaults for : ",c().title,"."].join(""),b=["The options have been reset to defaults for ",c().title,"."].join(""));try{e=wp.template("czr-skope-pane")(_.extend(d,{el:c.el,warning_message:a,success_message:b}))}catch(f){throw new Error("Error when parsing the the reset skope template : "+f)}return $("#customize-preview").after($(e)),$("#czr-skope-pane")},getEl:function(){var a=this;return $(a.el,"#customize-header-actions")}});var CZRSkopeMths=CZRSkopeMths||{};$.extend(CZRSkopeMths,{reactOnSkopeResetUserRequest:function(){var a=this,b=function(){api.state("czr-resetting")(!0),api.czr_activeSkopeId()!=a().id?api.czr_activeSkopeId(a().id).done(function(){a.skopeResetDialogVisibility(!a.skopeResetDialogVisibility()).done(function(){api.state("czr-resetting")(!1)})}):a.skopeResetDialogVisibility(!a.skopeResetDialogVisibility()).done(function(){api.state("czr-resetting")(!1)})};return api.state("czr-resetting")()||0!==api.state("processing")()?void api.czr_serverNotification({message:"Slow down, you move too fast !",status:"success",auto_collapse:!0}):void(api.czr_activeSkopeId()!=a().id&&api.czr_skope(api.czr_activeSkopeId()).skopeResetDialogVisibility()?api.czr_skope(api.czr_activeSkopeId()).skopeResetDialogVisibility(!1).done(function(){b()}):b())},skopeResetDialogReact:function(a){var b=this,c=$.Deferred();return b.userResetEventMap=b.userResetEventMap||new api.Value([{trigger:"click keydown",selector:".czr-scope-reset-cancel",name:"skope_reset_cancel",actions:function(){b.skopeResetDialogVisibility(!b.skopeResetDialogVisibility())}},{trigger:"click keydown",selector:".czr-scope-do-reset",name:"skope_do_reset",actions:"doResetSkopeValues"}]),a?(api.czr_isResettingSkope(b().id),$.when(b.renderResetWarningTmpl()).done(function(a){b.resetPanel=a,b.resetPanel.addClass(b.dirtyness()?"dirty-reset":"db-reset"),b.setupDOMListeners(b.userResetEventMap(),{dom_el:b.resetPanel})}).then(function(){setTimeout(function(){var a=$("#customize-preview").height();b.resetPanel.css("line-height",a+"px").css("height",a+"px"),$("body").addClass("czr-skope-pane-open")},50)})):$.when($("body").removeClass("czr-skope-pane-open")).done(function(){_.has(b,"resetPanel")&&!1!==b.resetPanel.length&&setTimeout(function(){b.resetPanel.remove(),api.czr_isResettingSkope(!1)},300)}),_.delay(function(){c.resolve()},350),c.promise()},doResetSkopeValues:function(){var a=this,b=a().id,c=a.dirtyness()?"_resetSkopeDirties":"_resetSkopeAPIValues",d=function(){var d=function(){api.czr_skopeBase.processSilentUpdates({refresh:!1}).fail(function(){api.consoleLog("Silent update failed after resetting skope : "+b)}).done(function(){$.when($(".czr-reset-warning",a.resetPanel).fadeOut("300")).done(function(){$.when($(".czr-reset-success",a.resetPanel).fadeIn("300")).done(function(){_.delay(function(){api.czr_isResettingSkope(!1),a.skopeResetDialogVisibility(!1)},2e3)})})})};a[c]().done(function(){api.previewer.refresh().fail(function(a){api.consoleLog("SKOPE RESET REFRESH FAILED",a)}).done(function(a){if("global"==api.czr_skope(b)().skope&&"_resetSkopeAPIValues"==c){var e,f={},g=api.czr_skope(b)().opt_name;!_.isUndefined(a.skopesServerData)&&_.has(a.skopesServerData,"czr_skopes")&&(e=a.skopesServerData.czr_skopes,_.isUndefined(_.findWhere(e,{opt_name:g}))&&(f=_.findWhere(e,{opt_name:g}).db||{})),api.czr_skopeBase.maybeSynchronizeGlobalSkope({isGlobalReset:!0,isSkope:!0,skopeIdToReset:b}).done(function(){d()})}else d()})})};$("body").addClass("czr-resetting-skope"),api.czr_skopeReset[a.dirtyness()?"resetChangeset":"resetPublished"]({skope_id:a().id,is_skope:!0}).always(function(){$("body").removeClass("czr-resetting-skope")}).done(function(a){d()}).fail(function(b){a.skopeResetDialogVisibility(!1),api.consoleLog("Skope reset failed",b)})},_resetSkopeDirties:function(){var a=this,b=$.Deferred();return a.dirtyValues({}),a.changesetValues({}),b.resolve().promise()},_resetSkopeAPIValues:function(){var a=this,b=$.Deferred();return a.dbValues({}),b.resolve().promise()}}),function(a,b,c){serverControlParams.isSkopOn&&(a.Value.prototype.set=function(d,e){var f=this._value,g=b.Deferred(),h=this,i=[];return d=this._setter.apply(this,arguments),d=this.validate(d),null===d||c.isEqual(f,d)?this:(this._value=d,this._dirty=!0,this._deferreds?(c.each(h._deferreds,function(a){i.push(a.apply(null,[d,f,e]))}),b.when.apply(null,i).fail(function(){a.consoleLog("A deferred callback failed in api.Value::set()")}).then(function(){h.callbacks.fireWith(h,[d,f,e]),g.resolveWith(h,[d,f,e])}),g.promise(h)):(this.callbacks.fireWith(this,[d,f,e]),g.resolveWith(h,[d,f,e]).promise(h)))},a.Value.prototype.bind=function(){var a=this,d=!1,e=[];return b.each(arguments,function(a,b){d||(d=c.isObject(b)&&b.deferred),c.isFunction(b)&&e.push(b)}),d?(a._deferreds=a._deferreds||[],c.each(e,function(b){c.contains(b,a._deferreds)||a._deferreds.push(b)})):a.callbacks.add.apply(a.callbacks,arguments),this},a.Setting.prototype.silent_set=function(b,d){var e=this._value,f=a.state("saved")();return b=this._setter.apply(this,arguments),b=this.validate(b),null===b||c.isEqual(e,b)?this:(this._value=b,this._dirty=c.isUndefined(d)||!c.isBoolean(d)?this._dirty:d,this.callbacks.fireWith(this,[b,e,{silent:!0}]),a.state("saved")(f),this)})}(wp.customize,jQuery,_),function(a,b,c){a.bind("ready",function(){if(serverControlParams.isSkopOn){var d=a.previewer.query;a.previewer.query=function(e){if(!c.has(a,"czr_skope"))return a.consoleLog("QUERY : SKOPE IS NOT ON. FALLING BACK ON CORE QUERY"),d.apply(this);if("pending"==a.czr_initialSkopeCollectionPopulated.state())return a.consoleLog("QUERY : INITIAL SKOPE COLLECTION NOT POPULATED YET. FALLING BACK ON CORE QUERY"),
12
+ d.apply(this);if("pending"==a.czr_isPreviewerSkopeAware.state()&&a.czr_isPreviewerSkopeAware.resolve(),!c.isObject(e)&&"resolved"==a.czr_initialSkopeCollectionPopulated.state()&&"resolved"==a.czr_initialSkopeCollectionPopulated.state())return d.apply(this);!c.isUndefined(e.skope_id)&&c.isString(e.skope_id)||(e.skope_id=a.czr_activeSkopeId()||a.czr_skopeBase.getGlobalSkopeId());var f,g={},h={},i={skope_id:null,action:null,the_dirties:{},dyn_type:null,opt_name:null};if(e=b.extend(i,e),!c.isObject(e.the_dirties))throw a.consoleLog("QUERY PARAMS : ",e),new Error("QUERY DIRTIES MUST BE AN OBJECT. Requested action : "+e.action);if("pending"!=a.czr_isPreviewerSkopeAware.state()&&c.isNull(e.skope_id))throw a.consoleLog("QUERY PARAMS : ",e),new Error("OVERRIDEN QUERY : NO SKOPE ID. FALLING BACK ON CORE QUERY. Requested action : "+e.action);if(!c.contains([null,"refresh","save","reset","changeset_update"],e.action))throw a.consoleLog("QUERY PARAMS : ",e),new Error("A REQUESTED QUERY HAS NO AUTHORIZED ACTION. Requested action : "+e.action);var j=function(){if("pending"==a.czr_initialSkopeCollectionPopulated.state())return{};var b={};return c.each(a.czr_currentSkopesCollection(),function(c){"global"!=c.skope&&(b[c.id]=a.czr_skopeBase.getSkopeDirties(c.id))}),b};switch(c.isNull(e.the_dirties)||c.isEmpty(e.the_dirties)?(g=a.dirtyValues({unsaved:e.excludeCustomizedSaved||!1}),h=j()):"global"==a.czr_skopeBase.getActiveSkopeName()?g=e.the_dirties:h[a.czr_activeSkopeId()]=e.the_dirties,e.action){case null:case"refresh":break;case"changeset_update":if(c.isUndefined(e.opt_name))throw new Error("Missing opt_name param in the changeset_update query for skope : "+e.skope_id);break;case"save":if(c.isNull(e.dyn_type)&&(e.dyn_type=a.czr_skope(e.skope_id)().dyn_type),c.isNull(e.dyn_type)||c.isUndefined(e.dyn_type))throw new Error("QUERY : A SAVE QUERY MUST HAVE A VALID DYN TYPE."+e.skope_id);break;case"reset":if(c.isNull(e.dyn_type)&&(e.dyn_type=a.czr_skope(e.skope_id)().dyn_type),c.isNull(e.dyn_type)||c.isUndefined(e.dyn_type))throw new Error("QUERY : A RESET QUERY MUST HAVE A VALID DYN TYPE."+e.skope_id)}var k={};return c.each(a.czr_currentSkopesCollection(),function(a){k[a.skope]={id:a.id,opt_name:a.opt_name}}),f={wp_customize:"on",customized:"{}"==JSON.stringify(g)?'{"__not_customized__"}':JSON.stringify(g),skopeCustomized:JSON.stringify(h),nonce:this.nonce.preview,skope:a.czr_skope(e.skope_id)().skope,level_id:a.czr_skope(e.skope_id)().level,skope_id:e.skope_id,dyn_type:e.dyn_type,opt_name:c.isNull(e.opt_name)?a.czr_skope(e.skope_id)().opt_name:e.opt_name,obj_id:a.czr_skope(e.skope_id)().obj_id,current_skopes:JSON.stringify(k)||{},channel:this.channel(),revisionIndex:a._latestRevision},f=a.czr_isChangeSetOn()?b.extend(f,{customize_theme:a.settings.theme.stylesheet,customize_changeset_uuid:a.settings.changeset.uuid}):b.extend(f,{theme:a.settings.theme.stylesheet})}}})}(wp.customize,jQuery,_),function(a,b,c){a.bind("czr-skope-started",function(){a.previewer.save=function(b){return a.czr_skopeSave.save()}})}(wp.customize,jQuery,_),function(a,b,c){if(serverControlParams.isSkopOn){a.Element.synchronizer.checkbox.update=function(a){this.element.prop("checked",a),this.element.iCheck("update")};a.Element.synchronizer.val.update;a.Element.synchronizer.val.update=function(b){var c=this,d=function(){c.element.is("select")?c.element.val(b).trigger("change"):c.element.hasClass("wp-color-picker")?c.element.val(b).trigger("change"):c.element.val(b)};serverControlParams.isSkopOn?a.czr_skopeReady.then(function(){d()}):d()},a.Element.synchronizer.val.refresh=function(){var a=this;return this.element.is("select")&&c.isNull(this.element.val())?c.isArray(a())?[]:c.isObject(a())?{}:"":this.element.val()}}}(wp.customize,jQuery,_),function(a,b,c){var d=a.Previewer.prototype.refresh,e=function(f){f=c.extend({waitSkopeSynced:!0,the_dirties:{}},f),c.has(a,"czr_activeSkopeId")&&!c.isUndefined(a.czr_activeSkopeId())||a.consoleLog("The api.czr_activeSkopeId() is undefined in the api.previewer._new_refresh() method.");var g=this,h=b.Deferred();if(!c.has(a,"czr_activeSkopeId")&&"pending"==a.czr_skopeReady.state())return a.czr_skopeReady.done(function(){e.apply(a.previewer,f)}),d.apply(g),h.resolve().promise();g.send("loading-initiated"),g.abort();var i=a.czr_getSkopeQueryParams({skope_id:a.czr_activeSkopeId(),action:"refresh",the_dirties:f.the_dirties||{}});return g.loading=new a.PreviewFrame({url:g.url(),previewUrl:g.previewUrl(),query:g.query(i)||{},container:g.container,signature:"WP_CUSTOMIZER_SIGNATURE"}),g.settingsModifiedWhileLoading={},onSettingChange=function(a){g.settingsModifiedWhileLoading[a.id]=!0},a.bind("change",onSettingChange),g.loading.always(function(){a.unbind("change",onSettingChange)}),a.czr_isChangeSetOn()||(g._previousPreview=g._previousPreview||g.preview),g.loading.done(function(b){var c,d=this;g.preview=d,g.targetWindow(d.targetWindow()),g.channel(d.channel()),c=function(b){d.unbind("synced",c),d.unbind("czr-skopes-synced",c),g._previousPreview?g._previousPreview.destroy():g.preview&&g.preview.destroy(),g._previousPreview=g.preview,g.deferred.active.resolve(),delete g.loading,a.trigger("pre_refresh_done",{previewer:g,skopesServerData:b||{}}),h.resolve({previewer:g,skopesServerData:b||{}})},a.czr_isChangeSetOn()||g.send("sync",{scroll:g.scroll,settings:a.get()}),f.waitSkopeSynced?d.bind("czr-skopes-synced",c):d.bind("synced",c),g.trigger("ready",b)}),g.loading.fail(function(b,c){a.consoleLog("LOADING FAILED : ",arguments),g.send("loading-failed"),a.czr_isChangeSetOn()||"redirect"===b&&c&&g.previewUrl(c),"logged out"===b&&(g.preview&&(g.preview.destroy(),delete g.preview),g.login().done(g.refresh)),"cheatin"===b&&g.cheatin(),h.reject(b)}),h.promise()};a.Previewer.prototype.refresh=e,a.bind("czr-skope-started",function(){czr_override_refresh_for_skope()}),a.czr_getSkopeQueryParams=function(d){if(!a.czr_isChangeSetOn())return d;d=c.isObject(d)?d:{};var e=d.action||"refresh";switch(e){case"refresh":d=b.extend(d,{excludeCustomizedSaved:!0})}return d},czr_override_refresh_for_skope=function(){serverControlParams.isSkopOn&&(a.previewer.refresh=function(d){var f=b.Deferred(),g=function(b){var c,d=function(){return 0===a.state("processing").get()},g=function(){e.call(a.previewer,b).done(function(a){f.resolve(a)})};d()?g():(c=function(){d()&&(g(),a.state("processing").unbind(c))},a.state("processing").bind(c))};return g=c.debounce(g,a.previewer.refreshBuffer),g(d),f.promise()})}}(wp.customize,jQuery,_),function(a,b,c){serverControlParams.isSkopOn&&(a.dirtyValues=function(b){return a.czr_skopeBase.getSkopeDirties(a.czr_skopeBase.getGlobalSkopeId(),b)})}(wp.customize,jQuery,_),function(a,b,c){if(serverControlParams.isSkopOn&&a.czr_isChangeSetOn()){var d=a.requestChangesetUpdate;a.requestChangesetUpdate=function(e){var f=b.Deferred(),g=[],h=[],i=e||{},j=[],k=[],l=b.Deferred();(0===a._lastSavedRevision||c.isEmpty(a.state("changesetStatus")()))&&(i=c.extend(i,{blogname:{dummy_change:"dummy_change"}})),c.each(a.czr_currentSkopesCollection(),function(a){"global"!=a.skope&&g.push(a.id)});var m=function(d){if(c.isUndefined(g[d+1])&&h.length==g.length){if(c.isEmpty(j))l.resolve(k);else{var e=function(){var d=[];return c.each(j,function(b){d.push(a.czr_skopeBase.buildServerResponse(b))}),b.trim(d.join(" | "))};l.reject(e())}return!0}},n=function(b){return(c.isUndefined(b)||0==b)&&a.state("processing").set(1),b=b||0,c.isUndefined(g[b])?(a.consoleLog("Undefined Skope in changeset recursive call ",b,g,g[b]),l.resolve(k).promise()):(a._requestSkopeChangetsetUpdate(e,g[b]).always(function(){h.push(b)}).fail(function(c){j.push(c),a.consoleLog("CHANGESET UPDATE RECURSIVE FAIL FOR SKOPE : ",g[b]),m(b)||n(b+1)}).done(function(a){k.push(a),m(b)||n(b+1)}),l.promise())},o=a._lastSavedRevision;return d(i).fail(function(b){a.consoleLog("WP requestChangesetUpdateFail",b,a.czr_skopeBase.buildServerResponse(b)),a._lastSavedRevision=Math.max(a._latestRevision,a._lastSavedRevision),a.state("processing").set(0),f.reject(b),b=a.czr_skopeBase.buildServerResponse(b),a.czr_serverNotification({message:b,status:"error"})}).done(function(b){"pending"==a.czr_initialSkopeCollectionPopulated.state()&&f.resolve(b),a._lastSavedRevision=o,n().always(function(){a._lastSavedRevision=Math.max(a._latestRevision,a._lastSavedRevision),a.state("processing").set(0)}).fail(function(b){f.reject(b),a.consoleLog("CHANGESET UPDATE RECURSIVE PUSH FAIL",b,k),a.trigger("changeset-error",b),a.czr_serverNotification({message:b,status:"error"})}).done(function(){f.resolve(b)})}),f.promise()},a._requestSkopeChangetsetUpdate=function(d,e){if(c.isUndefined(e)||!a.czr_skope.has(e))throw new Error("In api._requestSkopeChangetsetUpdate() : a valid and registered skope_id must be provided");var f,g=new b.Deferred,h={};if(e=e||a.czr_activeSkopeId(),d&&c.extend(h,d),c.each(a.czr_skopeBase.getSkopeDirties(e),function(a,b){d&&null===d[b]||(h[b]=c.extend({},h[b]||{},{value:a}))}),c.isEmpty(h))return g.resolve({}),g.promise();if(a._latestRevision<=a._lastSavedRevision)return g.resolve({}),g.promise();a.trigger("skope-changeset-save",h);var i={skope_id:e,action:"changeset_update",opt_name:a.czr_skope(e).opt_name};return f=a.previewer.query(c.extend(i,{excludeCustomizedSaved:!0})),delete f.customized,c.extend(f,{nonce:a.settings.nonce.save,customize_changeset_data:JSON.stringify(h)}),wp.ajax.post("customize_skope_changeset_save",f).done(function(a){g.resolve(a)}).fail(function(b){a.consoleLog("SKOPE CHANGESET FAIL FOR SKOPE "+b.skope_id,b),g.reject(b)}).always(function(b){b.setting_validities&&a._handleSettingValidities({settingValidities:b.setting_validities})}),g.promise()}}}(wp.customize,jQuery,_),function(a,b,c){if(serverControlParams.isSkopOn){var d=a.Setting.prototype.preview;a.Setting.prototype.preview=function(b,e,f){if(c.has(a,"czr_isPreviewerSkopeAware")&&"pending"==a.czr_isPreviewerSkopeAware.state()&&this.previewer.refresh(),!c.has(f,"silent")||!1===f.silent)return d.call(this)}}}(wp.customize,jQuery,_),function(a,b,c){if("function"==typeof a.Section){var d=a.Section.prototype.initialize;a.Section.prototype.initialize=function(a,e){d.apply(this,[a,e]);var f=this;this.expanded.callbacks.add(function(a){if(a){var d=f.container.closest(".wp-full-overlay-sidebar-content"),e=f.container.find(".accordion-section-content");_resizeContentHeight=function(){e.css("height",d.innerHeight())},_resizeContentHeight(),b(window).on("resize.customizer-section",c.debounce(_resizeContentHeight,110))}})}}}(wp.customize,jQuery,_),function(a,b,c){a.CZR_Helpers=a.CZR_Helpers||{},a.CZR_Helpers=b.extend(a.CZR_Helpers,{getControlSettingId:function(b,d){if(d="default",!a.control.has(b))throw new Error("The requested control_id is not registered in the api yet : "+b);if(c.has(a.control(b),"settings")&&!c.isEmpty(a.control(b).settings)){if(!c.has(a.control(b).settings,d))throw new Error("The requested control_id does not have the requested setting type : "+b+" , "+d);if(c.isUndefined(a.control(b).settings[d].id))throw new Error("The requested control_id has no setting id assigned : "+b);return a.control(b).settings[d].id}},getDocSearchLink:function(a){a=c.isString(a)?a:"";var b=a.replace(/ /g,"+"),d=[serverControlParams.docURL,"search?query=",b].join("");return['<a href="'+d+'" title="'+serverControlParams.translatedStrings.readDocumentation+'" target="_blank">'," ",'<span class="fa fa-question-circle-o"></span>'].join("")},build_setId:function(a){return c.contains(serverControlParams.wpBuiltinSettings,a)?a:c.contains(serverControlParams.themeSettingList,a)&&-1==a.indexOf(serverControlParams.themeOptions)?[serverControlParams.themeOptions+"[",a,"]"].join(""):a},getOptionName:function(a){return-1==a.indexOf(serverControlParams.themeOptions)?a:a.replace(/\[|\]/g,"").replace(serverControlParams.themeOptions,"")},has_part_refresh:function(b){if(c.has(a,"czr_partials"))return c.contains(c.map(a.czr_partials(),function(a,d){return c.contains(a.settings,b)}),!0)},getSectionControlIds:function(b){return b=b||a.czr_activeSectionId(),a.section.has(b)?c.map(a.section(b).controls(),function(a){return a.id}):[]},getSectionSettingIds:function(b){if(b=b||a.czr_activeSectionId(),a.section.has(b)){var d=this,e=[],f=d.getSectionControlIds(b);return c.each(f,function(b){c.each(a.control(b).settings,function(a,b){e.push(a.id)})}),e}},capitalize:function(a){return c.isString(a)?a.charAt(0).toUpperCase()+a.slice(1):a},truncate:function(a,b,d){if(c.isUndefined(a))return"";var e=a.length>b,f=e?a.substr(0,b-1):a;return f=d&&e?f.substr(0,f.lastIndexOf(" ")):f,e?f+"...":f},isMultiItemModule:function(b,d){if(!c.isUndefined(b)||c.isObject(d)){if(c.isObject(d)&&c.has(d,"module_type"))b=d.module_type;else if(c.isUndefined(b)||c.isNull(b))return;if(c.has(a.czrModuleMap,b))return a.czrModuleMap[b].crud||a.czrModuleMap[b].multi_item||!1}},isCrudModule:function(b,d){if(!c.isUndefined(b)||c.isObject(d)){if(c.isObject(d)&&c.has(d,"module_type"))b=d.module_type;else if(c.isUndefined(b)||c.isNull(b))return;if(c.has(a.czrModuleMap,b))return a.czrModuleMap[b].crud||!1}}})}(wp.customize,jQuery,_),function(a,b,c){a.CZR_Helpers=a.CZR_Helpers||{},a.CZR_Helpers=b.extend(a.CZR_Helpers,{addActions:function(a,b,d){var e=this;d=d||e,d[a]=d[a]||[],new_event_map=c.clone(d[a]),d[a]=c.union(new_event_map,c.isArray(b)?b:[b])},doActions:function(a,b,c){b.trigger(a,c)},setupDOMListeners:function(d,e,f){var g=this;f=f||g,c.map(d,function(d){if(!c.isString(d.selector)||c.isEmpty(d.selector))throw new Error("setupDOMListeners : selector must be a string not empty. Aborting setup of action(s) : "+d.actions.join(","));e.dom_el.on(d.trigger,d.selector,function(h,i){if(h.stopPropagation(),!a.utils.isKeydownButNotEnterEvent(h)){h.preventDefault();var j=c.clone(e);c.has(j,"model")&&c.has(j.model,"id")&&(c.has(f,"get")?j.model=f():j.model=f.getModel(j.model.id)),b.extend(j,{event:d,dom_event:h}),b.extend(j,i),g.executeEventActionChain(j,f)}})})},executeEventActionChain:function(a,b){var d=this;if(!c.has(a,"event")||!c.has(a.event,"actions"))throw new Error("executeEventActionChain : No obj.event or no obj.event.actions properties found");if("function"==typeof a.event.actions)return a.event.actions(a);c.isArray(a.event.actions)||(a.event.actions=[a.event.actions]);var e=!1;c.map(a.event.actions,function(f){if(!e){if("function"!=typeof b[f])throw new Error("executeEventActionChain : the action : "+f+" has not been found when firing event : "+a.event.selector);var g=c.has(a,"dom_el")&&-1!=a.dom_el.length?a.dom_el:d.container;g.trigger("before_"+f,c.omit(a,"event"));var h=b[f](a);!1===h&&(e=!0),g.trigger("after_"+f,c.omit(a,"event"))}})}})}(wp.customize,jQuery,_),function(a,b,c){a.bind("ready",function(){a.previewer.bind("houston-widget-settings",function(b){var d=c.filter(b.registeredSidebars,function(a){return!c.findWhere(_wpCustomizeWidgetsSettings.registeredSidebars,{id:a.id})}),e=c.filter(b.registeredSidebars,function(a){return!c.has(b.renderedSidebars,a.id)});e=c.map(e,function(a){return a.id});var f=c.map(b.registeredSidebars,function(a){return a.id});a.czr_widgetZoneSettings.set({actives:b.renderedSidebars,inactives:e,registered:f,candidates:d,available_locations:b.availableWidgetLocations})}),a.previewer.bind("czr-wp-conditional-ready",function(b){a.czr_wp_conditionals.set(b)}),a.previewer.bind("czr-partial-refresh",function(b){a.czr_partials.set(b)})})}(wp.customize,jQuery,_);var CZRInputMths=CZRInputMths||{};$.extend(CZRInputMths,{initialize:function(a,b){if(_.isUndefined(b.item)||_.isEmpty(b.item))throw new Error("No item assigned to input "+b.id+". Aborting");if(_.isUndefined(b.module))throw new Error("No module assigned to input "+b.id+". Aborting");api.Value.prototype.initialize.call(this,null,b);var c=this;if($.extend(c,b||{}),c.isReady=$.Deferred(),_.isUndefined(b.input_value)||c.set(b.input_value),c.type_map={text:"",textarea:"",check:"setupIcheck",select:"setupSelect",upload:"setupImageUploader",color:"setupColorPicker",content_picker:"setupContentPicker",text_editor:"setupTextEditor",password:""},_.has(c.type_map,c.type)){var d=c.type_map[c.type];_.isFunction(c[d])&&c[d]()}var e={text:"keyup",textarea:"keyup",password:"keyup",color:"colorpickerchange",range:"input propertychange"};c.input_event_map=[{trigger:$.trim(["change",e[c.type]||""].join(" ")),selector:"input[data-type], select[data-type], textarea[data-type]",name:"set_input_value",actions:function(a){if(!_.has(c.item,"syncElements")||!_.has(c.item.syncElements,c.id))throw new Error("WARNING : THE INPUT "+c.id+" HAS NO SYNCED ELEMENT.")}}]},ready:function(){var a=this;a.setupDOMListeners(a.input_event_map,{dom_el:a.container},a),a.callbacks.add(function(){return a.inputReact.apply(a,arguments)}),$.when(a.setupSynchronizer()).done(function(){a.isReady.resolve(a)})},setupSynchronizer:function(){var a=this,b=a.item,c=a.container.find("[data-type]"),d=a.container.find("[data-type]").is("textarea");if(d)throw new Error("TO DO : THE TEXTAREA INPUT ARE NOT READY IN THE SYNCHRONIZER!");var e=new api.Element(c);b.syncElements=b.syncElements||{},b.syncElements[a.id]=e,e.sync(a),e.set(a())},inputReact:function(a,b){var c=this,d=c.item(),e=_.clone(d);e=!_.isObject(e)||_.isEmpty(e)?{}:e,e[c.id]=a,c.item.set(e),_.has(c,"is_preItemInput")||c.item.trigger(c.id+":changed",a)}});var CZRInputMths=CZRInputMths||{};$.extend(CZRInputMths,{setupImageUploader:function(){var a=this,b=a();return a.attachment={},a.container?(this.contentRendered=$.Deferred(),this.setupContentRendering(b,{}),void this.contentRendered.done(function(){a.czrImgUploaderBinding()})):this},setupContentRendering:function(a,b){var c=this;c.attachment.id!=a&&b!==a?(a||(c.attachment={},c.renderImageUploaderTemplate()),wp.media.attachment(a).fetch().done(function(){c.attachment=this.attributes,c.renderImageUploaderTemplate()})):c.attachment.id&&c.attachment.id!==a||c.renderImageUploaderTemplate()},czrImgUploaderBinding:function(){var a=this;_.bindAll(a,"czrImgUploadRemoveFile","czrImgUploadOpenFrame","czrImgUploadSelect"),a.container.on("click keydown",".upload-button",a.czrImgUploadOpenFrame),a.container.on("click keydown",".thumbnail-image img",a.czrImgUploadOpenFrame),a.container.on("click keydown",".remove-button",a.czrImgUploadRemoveFile),a.bind(a.id+":changed",function(b,c){a.contentRendered=$.Deferred(),a.setupContentRendering(b,c)})},czrImgUploadOpenFrame:function(a){api.utils.isKeydownButNotEnterEvent(a)||(a.preventDefault(),this.frame||this.czrImgUploadInitFrame(),this.frame.open())},czrImgUploadInitFrame:function(){var a=this,b=this.getUploaderLabels();a.frame=wp.media({button:{text:b.frame_button},states:[new wp.media.controller.Library({title:b.frame_title,library:wp.media.query({type:"image"}),multiple:!1,date:!1})]}),a.frame.on("select",a.czrImgUploadSelect)},czrImgUploadRemoveFile:function(a){var b=this;api.utils.isKeydownButNotEnterEvent(a)||(a.preventDefault(),b.attachment={},b.set(""))},czrImgUploadSelect:function(){var a=this,b=a.frame.state().get("selection").first().toJSON();window._wpmejsSettings||{};a.attachment=b,a.set(b.id)},renderImageUploaderTemplate:function(){var a=this;if(0!==$("#tmpl-czr-input-img-uploader-view-content").length){var b=wp.template("czr-input-img-uploader-view-content");if(b&&a.container){var c=a.container.find("."+a.module.control.css_attr.img_upload_container);if(c.length){var d={button_labels:a.getUploaderLabels(),settings:a.id,attachment:a.attachment,canUpload:!0};return c.html(b(d)),a.contentRendered.resolve(),a.container.trigger(a.id+":content_rendered"),!0}}}},getUploaderLabels:function(){var a=serverControlParams.translatedStrings,b={select:a.select_image,change:a.change_image,remove:a.remove_image,"default":a.default_image,placeholder:a.placeholder_image,frame_title:a.frame_title_image,frame_button:a.frame_button_image};return _.each(b,function(a,b){if(_.isUndefined(a)){var c=this;throw new Error("A translated string is missing ( "+b+" ) for the image uploader input in module : "+c.module.id)}}),b}}),$.extend(CZRInputMths,{setupColorPicker:function(){var a=this;a.container.find("input").wpColorPicker({change:function(a,b){$(this).val($(this).wpColorPicker("color")).trigger("colorpickerchange").trigger("change")}})}}),$.extend(CZRInputMths,{setupSelect:function(){var a=this;$("select",a.container).not(".no-selecter-js").each(function(){$(this).selecter({})})}});var CZRInputMths=CZRInputMths||{};$.extend(CZRInputMths,{setupContentPicker:function(){var a=this,b=[];a.object=["post"],a.type="post_type",a.container.find(".czr-input").append('<select data-select-type="content-picker-select" class="js-example-basic-simple"></select>'),b=[{trigger:"change",selector:"select[data-select-type]",name:"set_input_value",actions:"updateContentPickerModel"}],a.setupDOMListeners(b,{dom_el:a.container},a),a.setupContentSelecter()},setupContentSelecter:function(){var a=this;a.container.find("select").select2({placeholder:{id:"-1",title:"Select"},data:a.setupSelectedContents(),ajax:{url:serverControlParams.AjaxUrl,type:"POST",dataType:"json",delay:250,debug:!0,data:function(b){var c=b.page?b.page-1:0;return c=b.term?b.page:c,{action:b.term?"search-available-content-items-customizer":"load-available-content-items-customizer",search:b.term,wp_customize:"on",page:c,type:a.type,object:a.object,CZRCpNonce:serverControlParams.CZRCpNonce}},processResults:function(a,b){if(!a.success)return{results:[]};var c=a.data.items,d=[];return _.each(c,function(a){d.push({id:a.id,title:a.title,type_label:a.type_label,object_type:a.object})}),{results:d,pagination:{more:10==a.data.items.length}}}},templateSelection:a.czrFormatContentSelected,templateResult:a.czrFormatContentSelected,escapeMarkup:function(a){return a}})},czrFormatContentSelected:function(a){if(a.loading)return a.text;var b="<div class='content-picker-item clearfix'><div class='content-item-bar'><span class='item-title'>"+a.title+"</span>";return a.type_label&&(b+="<span class='item-type'>"+a.type_label+"</span>"),b+="</div></div>"},setupSelectedContents:function(){var a=this,b=a();return b},updateContentPickerModel:function(a){var b=this,c=$(a.dom_event.currentTarget,a.dom_el),d=$(c,a.dom_el).select2("data");d.length&&(d=_.map(d,function(a){return{id:a.id,type_label:a.type_label,title:a.title,object_type:a.object_type}})),b.set(d)}});var CZRInputMths=CZRInputMths||{};$.extend(CZRInputMths,{setupTextEditor:function(){var a=this;a();if(!a.container)throw new Error("The input container is not set for WP text editor in module."+a.module.id);a.czrRenderInputTextEditorTemplate()&&(a.editor=tinyMCE("czr-customize-content_editor"),a.textarea=$("#czr-customize-content_editor"),a.editorPane=$("#czr-customize-content_editor-pane"),a.dragbar=$("#czr-customize-content_editor-dragbar"),a.editorFrame=$("#czr-customize-content_editor_ifr"),a.mceTools=$("#wp-czr-customize-content_editor-tools"),a.mceToolbar=a.editorPane.find(".mce-toolbar-grp"),a.mceStatusbar=a.editorPane.find(".mce-statusbar"),a.preview=$("#customize-preview"),a.collapse=$(".collapse-sidebar"),a.textpreview=a.container.find("textarea"),a.toggleButton=a.container.find("button.text_editor-button"),a.editorExpanded=new api.Value((!1)),a.czrUpdateTextPreview(),a.czrSetToggleButtonText(a.editorExpanded()),a.czrTextEditorBinding(),a.czrResizeEditorOnUserRequest())},czrTextEditorBinding:function(){var a=this,b=a.editor,c=a.textarea,d=a.toggleButton,e=(a.editorExpanded,a.editorPane);a.bind(a.id+":changed",a.czrUpdateTextPreview),_.bindAll(a,"czrOnVisualEditorChange","czrOnTextEditorChange","czrResizeEditorOnWindowResize"),d.on("click",function(){a.editorExpanded.set(!a.editorExpanded()),a.editorExpanded()&&b.focus()}),a.module.czr_ModuleState.bind(function(b){"expanded"!=b&&a.editorExpanded.set(!1)}),a.editorExpanded.bind(function(d){api.consoleLog("in input.editorExpanded",d,a()),b.locker&&b.locker!==a&&(b.locker.editorExpanded.set(!1),b.locker=null),b.locker&&b.locker!==a||($(document.body).toggleClass("czr-customize-content_editor-pane-open",d),b.locker=a),a.czrSetToggleButtonText(d),d?(b.setContent(wp.editor.autop(a())),b.on("input change keyup",a.czrOnVisualEditorChange),c.on("input",a.czrOnTextEditorChange),a.czrResizeEditor(window.innerHeight-e.height()),$(window).on("resize",a.czrResizeEditorOnWindowResize)):(b.off("input change keyup",a.czrOnVisualEditorChange),c.off("input",a.czrOnTextEditorChange),$(window).off("resize",a.czrResizeEditorOnWindowResize),a.czrResizeReset())})},czrOnVisualEditorChange:function(){var a,b=this,c=b.editor;a=wp.editor.removep(c.getContent()),b.set(a)},czrOnTextEditorChange:function(){var a,b=this,c=b.textarea;a=c.val(),b.set(a)},czrUpdateTextPreview:function(){var a,b=this,c=b();a=c.replace(/(<([^>]+)>)/gi,""),a.length>30&&(a=a.substring(0,34)+"..."),b.textpreview.val(a)},czrRenderInputTextEditorTemplate:function(){var a=this;if(0===$("#tmpl-czr-input-text_editor-view-content").length)throw new Error("Missing js template for text editor input in module : "+a.module.id);var b=wp.template("czr-input-text_editor-view-content"),c=a.container.find("input");if(b&&a.container)return api.consoleLog("Model injected in text editor tmpl : ",a()),c.after(b(a())),!0},czrIsEditorExpanded:function(){return $(document.body).hasClass("czr-customize-content_editor-pane-open")},czrResizeReset:function(){var a=this,b=a.preview,c=a.collapse,d=a.container.closest("ul.accordion-section-content");d.css("padding-bottom",""),b.css("bottom",""),c.css("bottom","")},czrResizeEditor:function(a){var b=window.innerHeight,c=window.innerWidth,d=40,e=1,f=782,g=56,h=8,i=4,j={},k=this,l=k.container.closest("ul.accordion-section-content"),m=k.mceTools,n=k.mceToolbar,o=k.mceStatusbar,p=k.preview,q=k.collapse,r=k.editorPane,s=k.editorFrame;k.editorExpanded()&&(_.isNaN(a)||(resizeHeight=b-a),j.height=resizeHeight,j.components=m.outerHeight()+n.outerHeight()+o.outerHeight(),resizeHeight<d&&(j.height=d),resizeHeight>b-e&&(j.height=b-e),b<r.outerHeight()&&(j.height=b),p.css("bottom",j.height),r.css("height",j.height),s.css("height",j.height-j.components),q.css("bottom",j.height+h),g>b-j.height&&q.css("bottom",o.outerHeight()+i),c<=f?l.css("padding-bottom",j.height):l.css("padding-bottom",""))},czrResizeEditorOnWindowResize:function(){var a=this,b=50,c=a.editorPane;a.editorExpanded()&&_.delay(function(){a.czrResizeEditor(window.innerHeight-c.height())},b)},czrResizeEditorOnUserRequest:function(){var a=this,b=a.dragbar,c=a.editorFrame;b.on("mousedown",function(){a.editorExpanded()&&$(document).on("mousemove.czr-customize-content_editor",function(b){b.preventDefault(),$(document.body).addClass("czr-customize-content_editor-pane-resize"),c.css("pointer-events","none"),a.czrResizeEditor(b.pageY)})}),b.on("mouseup",function(){a.editorExpanded()&&($(document).off("mousemove.czr-customize-content_editor"),$(document.body).removeClass("czr-customize-content_editor-pane-resize"),c.css("pointer-events",""))})},czrSetToggleButtonText:function(a){var b=this;b.toggleButton.text(serverControlParams.translatedStrings[a?"textEditorClose":"textEditorOpen"])}});var CZRItemMths=CZRItemMths||{};$.extend(CZRItemMths,{initialize:function(a,b){if(_.isUndefined(b.module)||_.isEmpty(b.module))throw new Error("No module assigned to item "+a+". Aborting");var c=this;api.Value.prototype.initialize.call(c,null,b),c.isReady=$.Deferred(),c.embedded=$.Deferred(),c.contentRendered=$.Deferred(),$.extend(c,b||{}),c.defaultItemModel=_.clone(b.defaultItemModel)||{id:"",title:""};var d=$.extend(c.defaultItemModel,b.initial_item_model);c.set(d),c.userEventMap=new api.Value([{trigger:"click keydown",selector:["."+c.module.control.css_attr.display_alert_btn,"."+c.module.control.css_attr.cancel_alert_btn].join(","),name:"toggle_remove_alert",actions:["toggleRemoveAlertVisibility"]},{trigger:"click keydown",selector:"."+c.module.control.css_attr.remove_view_btn,name:"remove_item",actions:["removeItem"]},{trigger:"click keydown",selector:["."+c.module.control.css_attr.edit_view_btn,"."+c.module.control.css_attr.item_title].join(","),name:"edit_view",actions:["setViewVisibility"]}]),c.isReady.done(function(){c.module.updateItemsCollection({item:c()}),c.callbacks.add(function(){return c.itemReact.apply(c,arguments)}),c.mayBeRenderItemWrapper(),c.embedded.done(function(){c.itemWrapperViewSetup(d)}),c.contentRendered.done(function(){_.has(c,"czr_Input")||c.setupInputCollectionFromDOM()})})},ready:function(){this.isReady.resolve()},itemReact:function(a,b){var c=this,d=c.module;d.updateItemsCollection({item:a}),c.writeItemViewTitle(a),_.isEmpty(b)&&_.isUndefined(b)||(api.consoleLog("DO WE REALLY NEED TO SEND THIS TO THE PREVIEW WITH _sendItem(to, from) ?"),c._sendItem(a,b))}});var CZRItemMths=CZRItemMths||{};$.extend(CZRItemMths,{setupInputCollectionFromDOM:function(){var a=this,b=a.module;if(a.czr_Input=new api.Values,a.inputConstructor=b.inputConstructor,_.isEmpty(a.defaultItemModel)||_.isUndefined(a.defaultItemModel))throw new Error("No default model found in item "+a.id+". Aborting");var c=$.extend(!0,{},a());c=_.isObject(c)?$.extend(a.defaultItemModel,c):a.defaultItemModel;var d={};$("."+b.control.css_attr.sub_set_wrapper,a.container).each(function(e){var f=$(this).find("[data-type]").attr("data-type"),g=_.has(c,f)?c[f]:"";if(!_.isUndefined(f)&&!_.isEmpty(f)){if(!_.has(c,f))throw new Error("The item property : "+f+" has been found in the DOM but not in the item model : "+a.id+". The input can not be instantiated.");a.czr_Input.add(f,new a.inputConstructor(f,{id:f,type:$(this).attr("data-input-type"),input_value:g,container:$(this),item:a,module:b})),a.czr_Input(f).ready(),d[f]=g}})},removeInputCollection:function(){var a=this;a.czr_Input.each(function(b){a.czr_Input.remove(b.id)})}});var CZRItemMths=CZRItemMths||{};$.extend(CZRItemMths,{_sendItem:function(a,b){var c=this,d=c.module,e=[];_.each(b,function(b,c){b!=a[c]&&e.push(c)}),_.each(e,function(b){d.control.previewer.send("sub_setting",{set_id:d.control.id,id:a.id,changed_prop:b,value:a[b]}),d.trigger("item_sent",{item:a,dom_el:c.container,changed_prop:b})})},removeItem:function(){var a=this,b=this.module,c=_.clone(b.itemCollection());b.trigger("pre_item_dom_remove",a()),a._destroyView(),c=_.without(c,_.findWhere(c,{id:a.id})),b.itemCollection.set(c),b.trigger("pre_item_api_remove",a()),b.czr_Item.remove(a.id)},getModel:function(a){return this()}});var CZRItemMths=CZRItemMths||{};$.extend(CZRItemMths,{mayBeRenderItemWrapper:function(){var a=this;"pending"==a.embedded.state()&&$.when(a.renderItemWrapper()).done(function(b){if(a.container=b,_.isUndefined(a.container)||!a.container.length)throw new Error("In mayBeRenderItemWrapper the Item view has not been rendered : "+a.id);a.embedded.resolve()})},itemWrapperViewSetup:function(a){var b=this;this.module;a=b()||b.initial_item_model,b.czr_ItemState=new api.Value,b.czr_ItemState.set("closed"),b.writeItemViewTitle();var c=function(a,c,d){if(_.isUndefined(a)||!1===a.length)throw new Error("Module : "+b.module.id+", the item content has not been rendered for "+b.id);b.contentRendered.resolve(),b.toggleItemExpansion(c,d)};b.module.isMultiItem()?b.czr_ItemState.callbacks.add(function(d,e){return"resolved"==b.contentRendered.state()?void b.toggleItemExpansion(d,e):void $.when(b.renderItemContent(a)).done(function(a){(c=_.debounce(c,400))(a,d,e)})}):(b.czr_ItemState.callbacks.add(function(a,c){b.toggleItemExpansion.apply(b,arguments)}),$.when(b.renderItemContent(a)).done(function(a){c(a,!0)})),api.CZR_Helpers.setupDOMListeners(b.userEventMap(),{model:a,dom_el:b.container},b)},renderItemWrapper:function(a){var b=this,c=b.module;if(a=a||b(),$_view_el=$("<li>",{"class":c.control.css_attr.single_item,"data-id":a.id,id:a.id}),c.itemsWrapper.append($_view_el),c.isMultiItem()){var d=c.getTemplateEl("rudItemPart",a);if(0===$("#tmpl-"+d).length)throw new Error("Missing template for item "+b.id+". The provided template script has no been found : #tmpl-"+c.getTemplateEl("rudItemPart",a));$_view_el.append($(wp.template(d)(a)))}return $_view_el.append($("<div/>",{"class":c.control.css_attr.item_content})),$_view_el;
13
+ },renderItemContent:function(a){var b=this,c=this.module;if(a=a||b(),0===$("#tmpl-"+c.getTemplateEl("itemInputList",a)).length)throw new Error("No item content template defined for module "+c.id+". The template script id should be : #tmpl-"+c.getTemplateEl("itemInputList",a));var d=wp.template(c.getTemplateEl("itemInputList",a));return d?($(d(a)).appendTo($("."+c.control.css_attr.item_content,b.container)),$($(d(a)),b.container)):this},writeItemViewTitle:function(a){var b=this,c=b.module,d=a||b(),e=_.has(d,"title")?api.CZR_Helpers.capitalize(d.title):d.id;e=api.CZR_Helpers.truncate(e,20),$("."+c.control.css_attr.item_title,b.container).text(e),api.CZR_Helpers.doActions("after_writeViewTitle",b.container,d,b)},setViewVisibility:function(a,b){var c=this,d=this.module;b?c.czr_ItemState.set("expanded_noscroll"):(d.closeAllItems(c.id),_.has(d,"preItem")&&d.preItemExpanded.set(!1),c.czr_ItemState.set("expanded"==c._getViewState()?"closed":"expanded"))},_getViewState:function(){return-1==this.czr_ItemState().indexOf("expanded")?"closed":"expanded"},toggleItemExpansion:function(a,b,c){var d=this,e=this.module;$("."+e.control.css_attr.item_content,d.container).first().slideToggle({duration:c||200,done:function(){var b="closed"!=a;d.container.toggleClass("open",b),e.closeAllAlerts();var c=$(this).siblings().find("."+e.control.css_attr.edit_view_btn);c.toggleClass("active",b),b?c.removeClass("fa-pencil").addClass("fa-minus-square").attr("title",serverControlParams.translatedStrings.close):c.removeClass("fa-minus-square").addClass("fa-pencil").attr("title",serverControlParams.translatedStrings.edit),"expanded"==a&&e._adjustScrollExpandedBlock(d.container)}})},toggleRemoveAlertVisibility:function(a){var b=this,c=this.module,d=$("."+c.control.css_attr.remove_alert_wrapper,b.container).first();a.dom_event;if(c.closeAllItems(),_.has(c,"preItem")&&c.preItemExpanded.set(!1),$("."+c.control.css_attr.remove_alert_wrapper,b.container).not(d).each(function(){$(this).hasClass("open")&&$(this).slideToggle({duration:200,done:function(){$(this).toggleClass("open",!1),$(this).siblings().find("."+c.control.css_attr.display_alert_btn).toggleClass("active",!1)}})}),!wp.template(c.AlertPart)||!b.container)throw new Error("No removal alert template available for items in module :"+c.id);d.html(wp.template(c.AlertPart)({title:b().title||b.id})),d.slideToggle({duration:200,done:function(){var d=!$(this).hasClass("open")&&$(this).is(":visible");$(this).toggleClass("open",d),$(a.dom_el).find("."+c.control.css_attr.display_alert_btn).toggleClass("active",d),d&&c._adjustScrollExpandedBlock(b.container)}})},_destroyView:function(a){this.container.fadeOut({duration:a||400,done:function(){$(this).remove()}})}});var CZRModuleMths=CZRModuleMths||{};$.extend(CZRModuleMths,{initialize:function(a,b){if(_.isUndefined(b.control)||_.isEmpty(b.control))throw new Error("No control assigned to module "+a);var c=this;api.Value.prototype.initialize.call(this,null,b),c.isReady=$.Deferred(),$.extend(c,b||{}),$.extend(c,{crudModulePart:"czr-crud-module-part",rudItemPart:"czr-rud-item-part",ruItemPart:"czr-ru-item-part",itemInputList:"",AlertPart:"czr-rud-item-alert-part"}),c.embedded=$.Deferred(),c.isInSektion()||(c.container=$(c.control.selector),c.embedded.resolve()),c.embedded.done(function(){$.when(c.renderModuleParts()).done(function(a){if(!1===a.length)throw new Error("The items wrapper has not been rendered for module : "+c.id);c.itemsWrapper=a})}),c.itemCollection=new api.Value,c.itemCollection.set([]),c.defaultAPIitemModel={id:"",initial_item_model:{},defaultItemModel:{},control:{},module:{},is_added_by_user:!1},c.defaultItemModel={id:"",title:""},c.itemConstructor=api.CZRItem,c.czr_Item=new api.Values,c.inputConstructor=api.CZRInput,c.isReady.done(function(){c.isDirty=new api.Value(b.dirty||!1),c.set(c.initializeModuleModel(b)),c.callbacks.add(function(){return c.moduleReact.apply(c,arguments)}),c.control.isModuleRegistered(c.id)||c.control.updateModulesCollection({module:b,is_registered:!1}),c.bind("items-collection-populated",function(a){c.itemCollection.callbacks.add(function(){return c.itemCollectionReact.apply(c,arguments)}),c.isMultiItem()&&c._makeItemsSortable(),api.consoleLog("SAVED ITEM COLLECTION OF MODULE "+c.id+" IS READY")}),c.isInSektion()||c.populateSavedItemCollection()})},ready:function(){var a=this;a.isReady.resolve(),api.consoleLog("MODULE READY IN BASE MODULE CLASS : ",a.id)},initializeModuleModel:function(a){var b=this;if(!b.isMultiItem()&&!b.isCrud()&&_.isEmpty(a.items)){var c=_.clone(b.defaultItemModel);a.items=[$.extend(c,{id:b.id})]}return a},itemCollectionReact:function(a,b,c){var d=this,e=d(),f=$.extend(!0,{},e);f.items=a,d.isDirty.set(!0),d.set(f,c||{})},moduleReact:function(a,b,c){var d=this,e=d.control,f=(_.size(b.items)==_.size(a.items)&&!_.isEmpty(_.difference(a.items,b.items)),a.column_id!=b.column_id,_.has(c,"item_collection_sorted")&&c.item_collection_sorted),g=function(){d.control.previewer.refresh()};f&&(_.has(d,"preItem")&&d.preItemExpanded.set(!1),d.closeAllItems(),d.closeAllAlerts()),"postMessage"==api(d.control.id).transport&&f&&!api.CZR_Helpers.has_part_refresh(d.control.id)&&(g=_.debounce(g,500))(),e.updateModulesCollection({module:$.extend(!0,{},a),data:c})},getModuleSection:function(){return this.section},isInSektion:function(){var a=this;return _.has(a,"sektion_id")},isMultiItem:function(){return api.CZR_Helpers.isMultiItemModule(null,this)},isCrud:function(){return api.CZR_Helpers.isCrudModule(null,this)}});var CZRModuleMths=CZRModuleMths||{};$.extend(CZRModuleMths,{populateSavedItemCollection:function(){var a=this;if(!_.isArray(a().items))throw new Error("The saved items collection must be an array in module :"+a.id);_.each(a().items,function(b,c){a.instantiateItem(b).ready()}),_.each(a().items,function(b){if(_.isUndefined(_.findWhere(a.itemCollection(),b.id)))throw new Error("The saved items have not been properly populated in module : "+a.id)}),a.trigger("items-collection-populated")},instantiateItem:function(a,b){var c=this;if(item_candidate=c.prepareItemForAPI(a),!_.has(item_candidate,"id"))throw new Error("CZRModule::instantiateItem() : an item has no id and could not be added in the collection of : "+this.id);if(c.czr_Item.has(item_candidate.id))throw new Error("CZRModule::instantiateItem() : the following item id "+item_candidate.id+" already exists in module.czr_Item() for module "+this.id);if(c.czr_Item.add(item_candidate.id,new c.itemConstructor(item_candidate.id,item_candidate)),!c.czr_Item.has(item_candidate.id))throw new Error("CZRModule::instantiateItem() : instantiation failed for item id "+item_candidate.id+" for module "+this.id);return c.czr_Item(item_candidate.id)},prepareItemForAPI:function(a){var b=this,c={};return a=_.isObject(a)?a:{},_.each(b.defaultAPIitemModel,function(d,e){var f=a[e];switch(e){case"id":_.isEmpty(f)?c[e]=b.generateItemId(b.module_type):c[e]=f;break;case"initial_item_model":_.each(b.getDefaultModel(),function(b,c){_.has(a,c)||(a[c]=b)}),c[e]=a;break;case"defaultItemModel":c[e]=_.clone(b.defaultItemModel);break;case"control":c[e]=b.control;break;case"module":c[e]=b;break;case"is_added_by_user":c[e]=!!_.isBoolean(f)&&f}}),_.has(c,"id")||(c.id=b.generateItemId(b.module_type)),c.initial_item_model.id=c.id,c},generateItemId:function(a,b,c){if(c=c||1,c>100)throw new Error("Infinite loop when generating of a module id.");var d=this;b=b||d._getNextItemKeyInCollection();var e=a+"_"+b;if(!_.has(d,"itemCollection")||!_.isArray(d.itemCollection()))throw new Error("The item collection does not exist or is not properly set in module : "+d.id);return d.isItemRegistered(e)?(b++,c++,d.generateItemId(a,b,c)):e},_getNextItemKeyInCollection:function(){var a=this,b={},c=0;return _.isEmpty(a.itemCollection())||(b=_.max(a.itemCollection(),function(a){return parseInt(a.id.replace(/[^\/\d]/g,""),10)}),c=parseInt(b.id.replace(/[^\/\d]/g,""),10)+1),c},isItemRegistered:function(a){var b=this;return!_.isUndefined(_.findWhere(b.itemCollection(),{id:a}))},updateItemsCollection:function(a){var b=this,c=b.itemCollection();if(_new_collection=_.clone(c),_.has(a,"collection"))return void b.itemCollection.set(a.collection);if(!_.has(a,"item"))throw new Error("updateItemsCollection, no item provided "+b.control.id+". Aborting");var d=_.clone(a.item);_.findWhere(_new_collection,{id:d.id})?_.each(c,function(a,b){a.id==d.id&&(_new_collection[b]=d)}):_new_collection.push(d),b.itemCollection.set(_new_collection)},_getSortedDOMItemCollection:function(){var a=this,b=_.clone(a.itemCollection()),c=[];if($("."+a.control.css_attr.single_item,a.container).each(function(a){var d=_.findWhere(b,{id:$(this).attr("data-id")});d&&(c[a]=d)}),b.length!=c.length)throw new Error("There was a problem when re-building the item collection from the DOM in module : "+a.id);return c}});var CZRModuleMths=CZRModuleMths||{};$.extend(CZRModuleMths,{getDefaultModel:function(a){var b=this;return $.extend(_.clone(b.defaultItemModel),{id:a||""})},_initNewItem:function(a,b){var c,d=this,e={id:""};return b="undefined"!=typeof b?b:_.size(d.itemCollection()),_.isNumber(b)?c=d.module_type+"_"+b:(c=b,b=0),e=a&&!_.isEmpty(a)?$.extend(a,{id:c}):this.getDefaultModel(c),_.has(e,"id")&&d._isItemIdPossible(c)?(_.map(d.getDefaultModel(),function(a,b){_.has(e,b)||(e[b]=a)}),e):d._initNewItem(e,b+1)}});var CZRModuleMths=CZRModuleMths||{};$.extend(CZRModuleMths,{renderModuleParts:function(){var a=this,b=a.isInSektion()?$(a.container).find(".czr-mod-content"):$(a.container);if(a.isCrud()){if(0===$("#tmpl-"+a.crudModulePart).length)throw new Error("No crud Module Part template for module "+a.id+". The template script id should be : #tmpl-"+a.crudModulePart);b.append($(wp.template(a.crudModulePart)({})))}var c=$("<ul/>",{"class":[a.control.css_attr.items_wrapper,a.module_type,a.isMultiItem()?"multi-item-mod":"mono-item-mod",a.isCrud()?"crud-mod":"not-crud-mod"].join(" ")});return b.append(c),$(c,b)},getTemplateEl:function(a,b){var c,d=this;switch(a){case"rudItemPart":c=d.rudItemPart;break;case"ruItemPart":c=d.ruItemPart;break;case"itemInputList":c=d.itemInputList}if(_.isEmpty(c))throw new Error("No valid template has been found in getTemplateEl() "+d.id+". Aborting");return c},getViewEl:function(a){var b=this;return $('[data-id = "'+a+'"]',b.container)},closeAllItems:function(a){var b=this,c=_.clone(b.itemCollection()),d=_.filter(c,function(b){return b.id!=a});_.each(d,function(a){b.czr_Item.has(a.id)&&"expanded"==b.czr_Item(a.id)._getViewState(a.id)&&b.czr_Item(a.id).czr_ItemState.set("closed")})},_adjustScrollExpandedBlock:function(a,b){if(a.length&&!_.isUndefined(this.getModuleSection())){var c,d=this,e=$(".accordion-section-content",d.section.container),f=e.scrollTop(),g=b||90;setTimeout(function(){a.offset().top+a.height()+g>$(window.top).height()&&(c=a.offset().top+a.height()+g-$(window.top).height(),c>0&&e.animate({scrollTop:f+c},500))},50)}},closeAllAlerts:function(){var a=this;$("."+a.control.css_attr.remove_alert_wrapper,a.container).each(function(){$(this).hasClass("open")&&$(this).slideToggle({duration:100,done:function(){$(this).toggleClass("open",!1),$(this).siblings().find("."+a.control.css_attr.display_alert_btn).toggleClass("active",!1)}})})},_makeItemsSortable:function(a){if(!wp.media.isTouchDevice&&$.fn.sortable){var b=this;$("."+b.control.css_attr.items_wrapper,b.container).sortable({handle:"."+b.control.css_attr.item_sort_handle,start:function(){_.has(api,"czrModulePanelState")&&api.czrModulePanelState.set(!1),_.has(api,"czrSekSettingsPanelState")&&api.czrSekSettingsPanelState.set(!1)},update:function(a,c){b.itemCollection.set(b._getSortedDOMItemCollection(),{item_collection_sorted:!0}),"postMessage"!=api(b.control.id).transport||api.CZR_Helpers.has_part_refresh(b.control.id)||_.delay(function(){api.previewer.refresh()},100)}})}}});var CZRDynModuleMths=CZRDynModuleMths||{};$.extend(CZRDynModuleMths,{initialize:function(a,b){var c=this;api.CZRModule.prototype.initialize.call(c,a,b),$.extend(c,{itemPreAddEl:""}),c.itemAddedMessage=serverControlParams.translatedStrings.successMessage,c.userEventMap=new api.Value([{trigger:"click keydown",selector:["."+c.control.css_attr.open_pre_add_btn,"."+c.control.css_attr.cancel_pre_add_btn].join(","),name:"pre_add_item",actions:["renderPreItemView","setPreItemViewVisibility"]},{trigger:"click keydown",selector:"."+c.control.css_attr.add_new_btn,name:"add_item",actions:["closeAllItems","addItem"]}])},ready:function(){var a=this;api.consoleLog("MODULE READY IN DYN MODULE CLASS : ",a.id),a.setupDOMListeners(a.userEventMap(),{dom_el:a.container}),a.preItem=new api.Value(a.getDefaultModel()),a.preItemEmbedded=$.Deferred(),a.preItemEmbedded.done(function(){a.setupPreItemInputCollection()}),a.preItemExpanded=new api.Value((!1)),a.preItemExpanded.callbacks.add(function(b,c){a._togglePreItemViewExpansion(b)}),api.CZRModule.prototype.ready.call(a)},setupPreItemInputCollection:function(){var a=this;a.preItem.czr_Input=new api.Values,$("."+a.control.css_attr.pre_add_wrapper,a.container).find("."+a.control.css_attr.sub_set_wrapper).each(function(b){var c=$(this).find("[data-type]").attr("data-type")||"sub_set_"+b;a.preItem.czr_Input.add(c,new a.inputConstructor(c,{id:c,type:$(this).attr("data-input-type"),container:$(this),item:a.preItem,module:a,is_preItemInput:!0})),a.preItem.czr_Input(c).ready()})},addItem:function(a){var b=this,c=b.preItem(),d=function(){b.preItemExpanded.set(!1),b._resetPreItemInputs(),b.toggleSuccessMessage("off")};if(_.isEmpty(c)||!_.isObject(c))throw new Error("addItem : an item should be an object and not empty. In : "+b.id+". Aborted.");d=_.debounce(d,2e3),b.instantiateItem(c,!0).ready(),b.czr_Item(c.id).isReady.then(function(){b.toggleSuccessMessage("on"),d(),b.trigger("item_added",c),"postMessage"!=api(b.control.id).transport||!_.has(a,"dom_event")||_.has(a.dom_event,"isTrigger")||api.CZR_Helpers.has_part_refresh(b.control.id)||b.control.previewer.refresh()})},_resetPreItemInputs:function(){var a=this;a.preItem.set(a.getDefaultModel()),a.preItem.czr_Input.each(function(b){var c=b.id;_.has(a.getDefaultModel(),c)&&b.set(a.getDefaultModel()._input_id)})}});var CZRDynModuleMths=CZRDynModuleMths||{};$.extend(CZRDynModuleMths,{renderPreItemView:function(a){var b=this;if("pending"==b.preItemEmbedded.state()){if(!_.has(b,"itemPreAddEl")||0===$("#tmpl-"+b.itemPreAddEl).length)return this;var c=wp.template(b.itemPreAddEl);if(!c||!b.container)return this;var d=$("."+b.control.css_attr.pre_add_item_content,b.container);d.prepend(c()),b.preItemEmbedded.resolve()}},_getPreItemView:function(){var a=this;return $("."+a.control.css_attr.pre_add_item_content,a.container)},setPreItemViewVisibility:function(a){var b=this;b.closeAllItems(),b.preItemExpanded.set(!b.preItemExpanded())},_togglePreItemViewExpansion:function(a){var b=this,c=$("."+b.control.css_attr.pre_add_item_content,b.container);c.slideToggle({duration:200,done:function(){var c=$("."+b.control.css_attr.open_pre_add_btn,b.container);$(this).toggleClass("open",a),a?c.find(".fa").removeClass("fa-plus-square").addClass("fa-minus-square"):c.find(".fa").removeClass("fa-minus-square").addClass("fa-plus-square"),c.toggleClass("active",a),$(b.container).toggleClass(b.control.css_attr.adding_new,a),b._adjustScrollExpandedBlock($(this),120)}})},toggleSuccessMessage:function(a){var b=this,c=b.itemAddedMessage,d=$("."+b.control.css_attr.pre_add_wrapper,b.container);return $_success_wrapper=$("."+b.control.css_attr.pre_add_success,b.container),"on"==a?($_success_wrapper.find("p").text(c),$_success_wrapper.css("z-index",1000001).css("height",d.height()+"px").css("line-height",d.height()+"px")):$_success_wrapper.attr("style",""),b.container.toggleClass("czr-model-added","on"==a),this}});var CZRSektionMths=CZRSektionMths||{};$.extend(CZRSektionMths,{initialize:function(a,b){var c=this;api.CZRDynModule.prototype.initialize.call(c,a,b),$.extend(c,{itemPreAddEl:"czr-module-sektion-pre-add-view-content",rudItemPart:"czr-module-sektion-rud-item-part",itemInputList:"czr-module-sektion-view-content"}),c.defaultItemModel={id:"","sektion-layout":1,columns:[]},c.bind("pre_item_dom_remove",function(a){c.removeSektion(a)}),c.defaultDBColumnModel={id:"",sektion_id:"",modules:[]},c.defaultAPIcolumnModel={id:"",modules:[],sektion:{},module_id:"",control_id:"",is_added_by_user:!1},c.czr_Column=new api.Values,c.czr_columnCollection=new api.Value,c.czr_columnCollection.set([]),c.czr_columnCollection.callbacks.add(function(){return c.columnCollectionReact.apply(c,arguments)}),c.itemConstructor=api.CZRItem.extend(c.CZRSektionItem||{}),_.has(c,"modsDragInstance")||c.initModulesDragula(),api.czrModulePanelState=api.czrModulePanelState||new api.Value((!1)),api.czrModulePanelEmbedded=api.czrModulePanelEmbedded||$.Deferred(),c.userEventMap.set(_.union(c.userEventMap(),[{trigger:"click keydown",selector:".add-new-module",name:"add_new_module",actions:"toggleModuleListPanel"},{trigger:"click keydown",selector:"."+c.control.css_attr.open_pre_add_btn,name:"close_module_panel",actions:function(){api.czrModulePanelState(!1)}}])),api.consoleLog("SEKTION MODULE INIT",c.control.params.czr_skope),_.has(api,"czr_activeSkopeId")&&api.consoleLog("SEKTION MODULE INIT",api.czr_activeSkopeId()),api.czrModulePanelBinded=api.czrModulePanelBinded||$.Deferred(),"pending"==api.czrModulePanelBinded.state()&&(api.czrModulePanelState.bind(function(a){var b=api.CZR_Helpers.build_setId(c.control.params.syncCollection),d=api.control(b).syncSektionModule();if($("body").toggleClass("czr-adding-module",a),a)d.renderModulePanel(),api.consoleLog("REACT TO MODULE PANEL STATE",a,c.control.params.syncCollection,d()),api.consoleLog("WHEN DOES THIS ACTION OCCUR?",api.czrModulePanelBinded.state()),d.modsDragInstance.containers.push($("#czr-available-modules-list")[0]);else{var e=$.extend(!0,[],d.modsDragInstance.containers);e=_.filter(e,function(a){return"czr-available-modules-list"!=$(a).attr("id")}),d.modsDragInstance.containers=e,$("#czr-module-list-panel").remove()}}),api.czrModulePanelBinded.resolve()),api.czrSekSettingsPanelState=api.SekSettingsPanelState||new api.Value((!1)),api.czrSekSettingsPanelEmbedded=api.SekSettingsPanelEmbedded||$.Deferred(),c.userEventMap.set(_.union(c.userEventMap(),[{trigger:"click keydown",selector:".czr-edit-sek-settings",name:"edit_sek_settings",actions:"toggleSekSettingsPanel"},{trigger:"click keydown",selector:"."+c.control.css_attr.open_pre_add_btn,name:"close_sektion_panel",actions:function(){api.czrSekSettingsPanelState.set(!1)}}])),api.czrSekSettingsPanelEmbedded.done(function(){api.czrSekSettingsPanelState.callbacks.add(function(){return c.reactToSekSettingPanelState.apply(c,arguments)})}),api.section(c.control.section()).expanded.bind(function(a){api.consoleLog("FIRE SEKTION MODULE!",c.id),c.fireSektionModule()})},fireSektionModule:function(){var a=this;"resolved"!=a.isReady.state()&&(a.ready(),a.control.getSyncCollectionControl().syncSektionModule.set(a))},removeSektion:function(a){var b=this;_.each(a.columns,function(a){_.each(a.modules,function(a){b.control.getSyncCollectionControl().removeModule(a)}),b.czr_Column.has(a.id)&&"resolved"==b.czr_Column(a.id).embedded.state()&&b.czr_Column(a.id).container.remove(),b.removeColumnFromCollection(a)})},closeAllOtherSektions:function(a){var b=this;_clicked_sektion_id=a.closest(".czr-single-item").attr("data-id"),b.czr_Item.each(function(a){_clicked_sektion_id!=a.id?a.czr_ItemState.set("closed"):a.czr_ItemState.set("expanded"!=a.czr_ItemState()?"expanded_noscroll":"expanded")})}});var CZRSektionMths=CZRSektionMths||{};$.extend(CZRSektionMths,{CZRSektionItem:{initialize:function(a,b){var c=this;api.CZRItem.prototype.initialize.call(c,null,b),c.userEventMap.set(_.union(c.userEventMap(),[{trigger:"click keydown",selector:["."+c.module.control.css_attr.edit_view_btn,"."+c.module.control.css_attr.display_alert_btn,"."+c.module.control.css_attr.item_title].join(","),name:"close_module_panel",actions:function(){api.czrModulePanelState.set(!1)}},{trigger:"mouseenter",selector:".czr-item-header",name:"hovering_sek",actions:function(a){c.module.control.previewer.send("start_hovering_sek",{id:c.id})}},{trigger:"mouseleave",selector:".czr-item-header",name:"hovering_sek",actions:function(a){c.module.control.previewer.send("stop_hovering_sek",{id:c.id})}},{trigger:"click keydown",selector:["."+c.module.control.css_attr.edit_view_btn,"."+c.module.control.css_attr.item_title].join(","),name:"send_edit_view",actions:function(a){c.module.control.previewer.send("edit_sek",{id:c.id})}}]));var d=c(),e=b.module;if(!_.has(d,"sektion-layout"))throw new Error("In Sektion Item initialize, no layout provided for "+c.id+".");c.isReady.done(function(){if(_.isEmpty(c().columns)){var a=parseInt(d["sektion-layout"]||1,10);for(i=1;i<a+1;i++){var b=$.extend(!0,{},e.defaultDBColumnModel),f={id:"",sektion_id:c.id};f=$.extend(b,f),e.instantiateColumn($.extend(f,{sektion:c}))}}else _.each(c().columns,function(a){var b=$.extend(!0,{},a);e.instantiateColumn($.extend(b,{sektion:c}))})})},itemReact:function(a,b){var c=this,d=$.extend(!0,{},a);d=c.prepareSekItemForDB(d),api.CZRItem.prototype.itemReact.call(c,d)},prepareSekItemForDB:function(a){var b=this,c={};return _.each(b.module.defaultItemModel,function(d,e){var f=a[e];switch(e){case"id":if(!_.isString(f)||_.isEmpty(f))throw new Error("The sekItem id property must be a not empty string");c[e]=f;break;case"sektion-layout":if(!_.isNumber(parseInt(f,10))||parseInt(f,10)<1)throw new Error("The sekItem layout property must be an int number > 0");c[e]=f;break;case"columns":if(!_.isArray(f))throw new Error("The sekItem columns property must be an array");var g=[];_.each(f,function(a){var c=b.module.prepareColumnForDB(a);g.push(c)}),c[e]=g}}),c}}});var CZRSektionMths=CZRSektionMths||{};$.extend(CZRSektionMths,{prepareColumnForDB:function(a){var b=this,c={};return _.each(b.defaultDBColumnModel,function(b,d){var e=a[d];switch(d){case"id":if(!_.isString(e)||_.isEmpty(e))throw new Error("The column id property must be a not empty string");c[d]=e;break;case"sektion_id":if(_.isString(e)&&!_.isEmpty(e))c[d]=e;else{if(!_.has(a,"sektion"))throw new Error("The column sektion-id property must be a not empty string");c[d]=a.sektion.id}break;case"modules":if(!_.isArray(e))throw new Error("The column modules property must be an array");c[d]=e}}),c},instantiateColumn:function(a,b){var c=this,d=_.clone(a);if(!_.isEmpty(d.id)&&c.czr_Column.has(d.id))throw new Error("The column id already exists in the collection in module : "+c.id);d=c.prepareColumnForAPI(d),c.czr_Column.add(d.id,new api.CZRColumn(d.id,d)),c.czr_Column(d.id).ready()},prepareColumnForAPI:function(a){var b=this,c={};if(!_.isObject(a))throw new Error("Sektion Module::prepareColumnForAPI : a column must be an object to be instantiated.");return _.each(b.defaultAPIcolumnModel,function(d,e){var f=a[e];switch(e){case"id":_.isEmpty(f)?c[e]=b.generateColId():c[e]=f;break;case"modules":if(!_.isArray(f))throw new Error("Sektion Module::prepareColumnForAPI : a collection of modules must be an array. Error in column "+a.id);c[e]=f;break;case"sektion":if(!_.isObject(f)||_.isEmpty(f))throw new Error("Sektion Module::prepareColumnForAPI : a sektion instance is missing for column "+a.id);c[e]=f;break;case"module_id":c[e]=b.id;break;case"control_id":c[e]=b.control.id;break;case"is_added_by_user":c[e]=!!_.isBoolean(f)&&f}}),c},updateColumnCollection:function(a){var b=this,c=b.czr_columnCollection();if(_new_collection=$.extend(!0,[],c),api.consoleLog("in update column collection",b.id,b.czr_columnCollection()),_.has(a,"collection"))return void b.czr_columnCollection.set(a.collection);if(!_.has(a,"column"))throw new Error("updateColumnCollection, no column provided in module "+b.id+". Aborting");var d=_.clone(a.column);if(!_.has(d,"id"))throw new Error("updateColumnCollection, no id provided for a column in module"+b.id+". Aborting");_.findWhere(_new_collection,{id:d.id})?_.each(c,function(a,b){a.id==d.id&&(_new_collection[b]=d)}):_new_collection.push(d),b.czr_columnCollection.set(_new_collection)},removeColumnFromCollection:function(a){var b=this,c=b.czr_columnCollection(),d=$.extend(!0,[],c);d=_.filter(d,function(b){return b.id!=a.id}),b.czr_columnCollection.set(d)},columnCollectionReact:function(a,b){var c=this,d=_.size(b)<_.size(a),e=_.size(b)>_.size(a),f=_.size(b)==_.size(a),g={},h={};if(f&&_.each(a,function(a,c){_.isEqual(a,b[c])||(g=a.sektion(),h=$.extend(!0,{},g),_.each(g.columns,function(b,c){b.id==a.id&&(h.columns[c]=a)}),a.sektion.set(h))}),d){var i=_.filter(a,function(a){return _.isUndefined(_.findWhere(b,{id:a.id}))});i=i[0],g=i.sektion(),_.isUndefined(_.findWhere(g.columns,{id:i.id}))&&(h=$.extend(!0,{},g),h.columns.push(i),i.sektion.set(h))}if(e){var j=_.filter(b,function(b){return _.isUndefined(_.findWhere(a,{id:b.id}))});j=j[0],g=j.sektion(),h=$.extend(!0,{},g),h.columns=_.filter(h.columns,function(a){return a.id!=j.id}),j.sektion.set(h),c.czr_Column.remove(j.id)}},generateColId:function(a,b){if(b=b||1,b>100)throw new Error("Infinite loop when generating of a column id.");var c=this;a=a||c._getNextColKeyInCollection();var d="col_"+a;if(!_.has(c,"czr_columnCollection")||!_.isArray(c.czr_columnCollection()))throw new Error("The column collection does not exist or is not properly set in module : "+c.id);return c.czr_Column.has(d)?c.generateColId(a++,b++):d},_getNextColKeyInCollection:function(){var a=this,b={},c=0;return _.isEmpty(a.czr_columnCollection())||(b=_.max(a.czr_columnCollection(),function(a){return parseInt(a.id.replace(/[^\/\d]/g,""),10)}),c=parseInt(b.id.replace(/[^\/\d]/g,""),10)+1),c},moduleExistsInOneColumnMax:function(a){return 2>this.getModuleColumn(a).length},getModuleColumn:function(a){var b=this,c=[];return _.each(b.czr_columnCollection(),function(b,d){_.findWhere(b.modules,{id:a})&&c.push(b.id)}),c}});var CZRSektionMths=CZRSektionMths||{};$.extend(CZRSektionMths,{initModulesDragula:function(){var a=this;a.modsDragInstance=dragula({copy:function(a,b){return $(a).hasClass("czr-module-candidate")},moves:function(a,b,c,d){return _.contains(c.className.split(" "),"czr-mod-drag-handler")},accepts:function(a,b,c,d){return!_.isUndefined(b)&&"czr-available-modules-list"!=$(b).attr("id")},isContainer:function(a){return!1}}),a.modsDragInstance.on("drag",function(b,c){a.czr_Item.each(function(a){a.czr_ItemState.set("expanded"!=a.czr_ItemState()?"expanded_noscroll":"expanded")})}).on("dragend",function(a,b){}).on("drop",function(b,c,d,e){var f=$(b).attr("data-module-id"),g=$(b).attr("data-module-type"),h=$(c).closest(".czr-column").attr("data-id"),i=$(d).closest(".czr-column").attr("data-id"),j=h==i,k=$(b).hasClass("czr-module-candidate");if(k){if(_.isUndefined(h)||_.isUndefined(g))return;a.userAddedModule(h,g),a.reorderModulesInColumn(h)}else j?a.reorderModulesInColumn(h):a.control.getSyncCollectionControl().czr_Module(f).modColumn.set(h)});autoScroller([a.control.container.closest(".accordion-section-content")[0]],{direction:"vertical",margin:20,pixels:100,scrollWhenOutside:!0,autoScroll:function(){return a.modsDragInstance.dragging}})},userAddedModule:function(a,b){var c=this,d=c.control.getSyncCollectionControl(),e=_.clone(d.getDefaultModuleApiModel());d.trigger("user-module-candidate",$.extend(e,{module_type:b,column_id:a,sektion:c.czr_Column(a).sektion,sektion_id:c.czr_Column(a).sektion.id,is_added_by_user:!0}))},reorderModulesInColumn:function(a){var b=this,c=b.czr_Column(a).getColumnModuleCollectionFromDom(a);b.czr_Column(a).updateColumnModuleCollection({collection:c})},moveModuleFromTo:function(a,b,c){api.consoleLog("ALORS CE BUG?",this(),this.czr_columnCollection());var d=this,e=d.czr_Column(c).getColumnModuleCollectionFromDom(b);_.has(api,"czrModulePanelState")&&api.czrModulePanelState(!1),d.czr_Column(c).updateColumnModuleCollection({collection:e}),d.czr_Column(b).removeModuleFromColumnCollection(a)}});var CZRSektionMths=CZRSektionMths||{};$.extend(CZRSektionMths,{toggleModuleListPanel:function(a){var b=this;api.czrSekSettingsPanelState.set(!1),api.czrModulePanelState.set(!api.czrModulePanelState()),api.czrModulePanelState()?b.czr_Item.each(function(a){a.czr_ItemState.set("expanded"!=a.czr_ItemState()?"expanded_noscroll":"expanded")}):b.closeAllOtherSektions($(a.dom_event.currentTarget,a.dom_el))},renderModulePanel:function(){if(0===$("#tmpl-czr-available-modules").length)throw new Error("No template found to render the module panel list");$("#widgets-left").after($(wp.template("czr-available-modules")())),_.each(api.czrModuleMap,function(a,b){var c=$("<li/>",{"class":"czr-module-candidate","data-module-type":b,html:'<h3><span class="czr-mod-drag-handler fa fa-arrows-alt"></span>'+a.name+"</h3>"});$("#czr-available-modules-list").append(c)})}});var CZRColumnMths=CZRColumnMths||{};$.extend(CZRColumnMths,{initialize:function(a,b){var c=this;api.Value.prototype.initialize.call(c,null,b),$.extend(c,b||{}),c.isReady=$.Deferred(),c.embedded=$.Deferred(),c.czr_columnModuleCollection=new api.Value,c.czr_columnModuleCollection.set(c.modules),c.set(b),c.defautModuleModelInColumn={id:""},api.consoleLog("column.sektion.contentRendered.state()",c.sektion.contentRendered.state()),c.sektion.contentRendered.done(function(){c.container=c.render(),api.consoleLog("COLUMN CONTAINER?",c.container),c.embedded.resolve()}),c.embedded.done(function(){c.mayBeInstantiateColumnModules(),c.callbacks.add(function(){return c.columnReact.apply(c,arguments)}),c.czr_columnModuleCollection.callbacks.add(function(){return c.columnModuleCollectionReact.apply(c,arguments)}),api.CZR_Helpers.setupDOMListeners(c.column_event_map,{dom_el:c.container},c);var a=api.control(c.control_id).getSyncCollectionControl();api.consoleLog("////////////////////////////////////////////////////"),api.consoleLog("column.container?",c.container),api.consoleLog("syncCollectionControl.syncSektionModule()",a.syncSektionModule()()),api.consoleLog("////////////////////////////////////////////////////"),a.syncSektionModule().modsDragInstance.containers.push($(".czr-module-collection-wrapper",c.container)[0])})},ready:function(){var a=this;a.isReady.resolve(),a.sektion.module.updateColumnCollection({column:a()})},mayBeInstantiateColumnModules:function(){var a=this,b=a.sektion.control.getSyncCollectionControl();$.when(b.moduleCollectionReady.promise()).then(function(){_.each(a.czr_columnModuleCollection(),function(a){b.czr_Module.has(a.id)||$.when(_.findWhere(b.czr_moduleCollection(),{id:a.id})).done(function(c){if(_.isUndefined(c)||_.isEmpty(c))throw new Error("Module "+a.id+" was not found in the module collection.");b.instantiateModule(c,{}).ready()})})},function(){},function(){api.consoleLog("NOT SYNCHRONIZED YET")})},render:function(){var a=this;return $view=$(wp.template("czr-sektion-column")({id:a.id})),$view.appendTo($(".czr-column-wrapper",a.sektion.container)),$view},columnReact:function(a,b){this.sektion.module.updateColumnCollection({column:a})}});var CZRColumnMths=CZRColumnMths||{};$.extend(CZRColumnMths,{updateColumnModuleCollection:function(a){var b=this,c=b.czr_columnModuleCollection();if(_new_collection=$.extend(!0,[],c),api.consoleLog("column.czr_columnModuleCollection()",b.czr_columnModuleCollection()),_.has(a,"collection"))return void b.czr_columnModuleCollection.set(a.collection);if(!_.has(a,"module"))throw new Error("updateColumnModuleCollection, no module provided in column "+b.id+". Aborting");var d=b.prepareModuleForColumnAPI(_.clone(a.module));_.findWhere(_new_collection,{id:d.id})?_.each(c,function(a,b){a.id==d.id&&(_new_collection[b]=d)}):_new_collection.push(d),b.czr_columnModuleCollection.set(_new_collection)},columnModuleCollectionReact:function(a,b){var c=this,d=c(),e=_.clone(d),f=[];_.each(a,function(a,b){f[b]={id:a.id}}),e.modules=f,c.set(e)},removeModuleFromColumnCollection:function(a){var b=this,c=b.czr_columnModuleCollection();_new_collection=$.extend(!0,[],c),_new_collection=_.filter(_new_collection,function(b){return b.id!=a.id}),b.czr_columnModuleCollection.set(_new_collection);
14
+ },prepareModuleForColumnAPI:function(a){if(!_.isObject(a))throw new Error("prepareModuleForColumnAPI : a module must be an object.");var b=this,c={};return _.each(b.defautModuleModelInColumn,function(d,e){var f=a[e];switch(e){case"id":if(!_.isString(f)||_.isEmpty(f))throw new Error("prepareModuleForColumnAPI : a module id must a string not empty");if(!b.sektion.module.moduleExistsInOneColumnMax(a.id))throw new Error("A module can not be embedded in more than one column at a time. Module "+a.id+" exists in several columns : "+b.sektion.module.getModuleColumn(a.id).join(","));c[e]=f}}),c},getColumnModuleCollectionFromDom:function(a){var b=this,c=$(".czr-module-collection-wrapper",b.container),d=b.sektion.module.czr_Column(a).czr_columnModuleCollection(),e=[];if(api.consoleLog("in GET COLUMN MODULE COLLECTION FROM DOM",a,c,b.container),$(".czr-single-module",c).each(function(c){if(!_.isUndefined(_.findWhere(b.czr_columnModuleCollection(),{id:$(this).attr("data-module-id")})))return void(e[c]=_.findWhere(b.czr_columnModuleCollection(),{id:$(this).attr("data-module-id")}));var f=_.findWhere(d,{id:$(this).attr("data-module-id")});if(!f)throw new Error("The module : "+$(this).attr("data-module-id")+" was not found in the collection of its previous column "+a);e[c]=b.prepareModuleForColumnAPI(f)}),_.isEmpty(e))throw new Error("There was a problem when re-building the column module collection from the DOM in column : "+b.id);return e}});var CZRSektionMths=CZRSektionMths||{};$.extend(CZRSektionMths,{toggleSekSettingsPanel:function(a){var b=this;"pending"==api.czrSekSettingsPanelEmbedded.state()&&$.when(b.renderSekSettingsPanel()).done(function(){api.czrSekSettingsPanelEmbedded.resolve()}),api.czrModulePanelState.set(!1),api.czrSekSettingsPanelState.set(!api.czrSekSettingsPanelState()),b.closeAllOtherSektions($(a.dom_event.currentTarget,a.dom_el))},reactToSekSettingPanelState:function(a){$("body").toggleClass("czr-editing-sektion",a)},renderSekSettingsPanel:function(){var a="";if(0===$("#tmpl-czr-sektion-settings-panel").length)throw new Error("No template found to render the sektion setting panel");try{a=wp.template("czr-sektion-settings-panel")()}catch(b){throw new Error("Error when parsing the template of the sektion setting panel"+b)}$("#widgets-left").after($(a))}});var CZRSocialModuleMths=CZRSocialModuleMths||{};$.extend(CZRSocialModuleMths,{initialize:function(a,b){var c=this;api.CZRDynModule.prototype.initialize.call(c,a,b),$.extend(c,{itemPreAddEl:"czr-module-social-pre-add-view-content",itemInputList:"czr-module-social-item-content"}),this.social_icons=["500px","adn","amazon","android","angellist","apple","behance","behance-square","bitbucket","bitbucket-square","black-tie","btc","buysellads","chrome","codepen","codiepie","connectdevelop","contao","dashcube","delicious","delicious","deviantart","digg","dribbble","dropbox","drupal","edge","empire","expeditedssl","facebook","facebook","facebook-f (alias)","facebook-official","facebook-square","firefox","flickr","fonticons","fort-awesome","forumbee","foursquare","get-pocket","gg","gg-circle","git","github","github","github-alt","github-square","git-square","google","google","google-plus","google-plus-circle","google-plus-official","google-plus-square","google-wallet","gratipay","hacker-news","houzz","instagram","internet-explorer","ioxhost","joomla","jsfiddle","lastfm","lastfm-square","leanpub","linkedin","linkedin","linkedin-square","linux","maxcdn","meanpath","medium","mixcloud","modx","odnoklassniki","odnoklassniki-square","opencart","openid","opera","optin-monster","pagelines","paypal","pied-piper","pied-piper-alt","pinterest","pinterest-p","pinterest-square","product-hunt","qq","rebel","reddit","reddit-alien","reddit-square","renren","rss","rss-square","safari","scribd","sellsy","share-alt","share-alt-square","shirtsinbulk","simplybuilt","skyatlas","skype","slack","slideshare","snapchat","soundcloud","spotify","stack-exchange","stack-overflow","steam","steam-square","stumbleupon","stumbleupon","stumbleupon-circle","telegram","tencent-weibo","trello","tripadvisor","tumblr","tumblr-square","twitch","twitter","twitter","twitter-square","usb","viacoin","vimeo","vimeo-square","vine","vk","weibo","weixin","whatsapp","wikipedia-w","windows","wordpress","xing","xing-square","yahoo","yahoo","y-combinator","yelp","youtube","youtube-play","youtube-square"],c.inputConstructor=api.CZRInput.extend(c.CZRSocialsInputMths||{}),c.itemConstructor=api.CZRItem.extend(c.CZRSocialsItem||{}),this.defaultItemModel={id:"",title:"","social-icon":"","social-link":"","social-color":serverControlParams.social_el_params.defaultSocialColor,"social-target":1},this.itemAddedMessage=serverControlParams.translatedStrings.socialLinkAdded,_.has(api,"czr_activeSectionId")&&c.control.section()==api.czr_activeSectionId()&&"resolved"!=c.isReady.state()&&c.ready(),api.section(c.control.section()).expanded.bind(function(a){"resolved"!=c.isReady.state()&&c.ready()}),c.isReady.then(function(){c.preItem.bind(function(a,b){_.has(a,"social-icon")&&(_.isEqual(a["social-icon"],b["social-icon"])||c.updateItemModel(c.preItem,!0))})})},updateItemModel:function(a,b){var c=a;if(b=b||!1,_.has(c(),"social-icon")&&!_.isEmpty(c()["social-icon"])){var d=$.extend(!0,{},c()),e=api.CZR_Helpers.capitalize(d["social-icon"].replace("fa-","")),f=serverControlParams.social_el_params.defaultSocialColor;e=[serverControlParams.translatedStrings.followUs,e].join(" "),b?(d=$.extend(d,{title:e,"social-color":f}),c.set(d)):(c.czr_Input("title").set(e),c.czr_Input("social-link").set(""),c.czr_Input("social-color").set(f))}},CZRSocialsInputMths:{setupSelect:function(){function a(a){if(!a.id)return a.text;var b=$('<span class="fa '+a.element.value.toLowerCase()+'">&nbsp;&nbsp;'+a.text+"</span>");return b}var b=this,c=b.item,d=b.module,e=d.social_icons,f=c();_.isEmpty(f.id)&&(e=_.union([serverControlParams.translatedStrings.selectSocialIcon],e)),_.each(e,function(a,c){var d=0===c?"":"fa-"+a.toLowerCase(),e={value:d,html:api.CZR_Helpers.capitalize(a)};d==f["social-icon"]&&$.extend(e,{selected:"selected"}),$('select[data-type="social-icon"]',b.container).append($("<option>",e))}),$('select[data-type="social-icon"]',b.container).select2({templateResult:a,templateSelection:a})},setupIcheck:function(a){var b=this;$("input[type=checkbox]",b.container).each(function(a){0===$(this).closest('div[class^="icheckbox"]').length&&$(this).iCheck({checkboxClass:"icheckbox_flat-grey",checkedClass:"checked",radioClass:"iradio_flat-grey"}).on("ifChanged",function(a){$(this).val(!1===$(this).is(":checked")?0:1),$(a.currentTarget).trigger("change")})})},setupColorPicker:function(a){var b=this,c=(b.item,b.module);$('input[data-type="social-color"]',b.container).wpColorPicker({defaultColor:"rgba(255,255,255,0.7)",change:function(a,b){_.has(b,"color")&&16777215==b.color._color?$(this).val("rgba(255,255,255,0.7)"):$(this).val(b.color.toString()),$(this).trigger("colorpickerchange").trigger("change")}}),$('input[data-type="social-color"]',b.container).closest("div").on("click keydown",function(){c._adjustScrollExpandedBlock(b.container)})}},CZRSocialsItem:{ready:function(){var a=this;api.CZRItem.prototype.ready.call(a),a.bind("social-icon:changed",function(){a.module.updateItemModel(a)})},_buildTitle:function(a,b,c){var d=this,e=d.module;return a=a||("string"==typeof b?api.CZR_Helpers.capitalize(b.replace("fa-","")):""),a=api.CZR_Helpers.truncate(a,20),b=b||"fa-"+e.social_icons[0],c=c||serverControlParams.social_el_params.defaultSocialColor,'<div><span class="fa '+b+'" style="color:'+c+'"></span> '+a+"</div>"},writeItemViewTitle:function(a){var b=this,c=b.module,d=a||b(),e=api.CZR_Helpers.capitalize(d["social-icon"].replace("fa-",""));$("."+c.control.css_attr.item_title,b.container).html(b._buildTitle(e,d["social-icon"],d["social-color"]))}}});var CZRWidgetAreaModuleMths=CZRWidgetAreaModuleMths||{};$.extend(CZRWidgetAreaModuleMths,{initialize:function(a,b){var c=this;api.CZRDynModule.prototype.initialize.call(this,a,b),$.extend(c,{itemPreAddEl:"czr-module-widgets-pre-add-view-content",itemInputList:"czr-module-widgets-item-input-list",itemInputListReduced:"czr-module-widgets-item-input-list-reduced",ruItemPart:"czr-module-widgets-ru-item-part"}),c.inputConstructor=api.CZRInput.extend(c.CZRWZonesInputMths||{}),c.itemConstructor=api.CZRItem.extend(c.CZRWZonesItem||{}),c.serverParams=serverControlParams.widget_area_el_params||{},c.contexts=_.has(c.serverParams,"sidebar_contexts")?c.serverParams.sidebar_contexts:{},c.context_match_map={is_404:"404",is_category:"archive-category",is_home:"home",is_page:"page",is_search:"search",is_single:"single"},c.locations=_.has(c.serverParams,"sidebar_locations")?c.serverParams.sidebar_locations:{},c.defaultItemModel={id:"",title:serverControlParams.translatedStrings.widgetZone,contexts:_.without(_.keys(c.contexts),"_all_"),locations:[c.serverParams.defaultWidgetLocation],description:""},this.itemAddedMessage=serverControlParams.translatedStrings.widgetZoneAdded,this.listenToSidebarInsights(),api.czr_widgetZoneSettings.bind(function(a,b){c.isReady.then(function(){_.each(a,function(a,b){api.sidebar_insights(b).set(a)})})}),c.preItem_location_alert_view_state=new api.Value("closed"),c.preItem_location_alert_view_state.callbacks.add(function(a,b){c._toggleLocationAlertExpansion(c.container,a)}),c.bind("item_added",function(a){c.addWidgetSidebar(a)}),c.bind("pre_item_api_remove",function(a){c.removeWidgetSidebar(a)});var d=new api.Values;d.create("fixed_for_current_session"),d.create("value"),api.section(c.serverParams.dynWidgetSection).fixTopMargin=d,api.section(c.serverParams.dynWidgetSection).fixTopMargin("fixed_for_current_session").set(!1),api.panel("widgets").expanded.callbacks.add(function(a,b){c.widgetPanelReact(),"resolved"!=c.isReady.state()&&c.ready()})},ready:function(){var a=this;api.CZRDynModule.prototype.ready.call(a),a.preItemExpanded.callbacks.add(function(b,c){b&&(a.preItem.czr_Input("locations")._setupLocationSelect(!0),a.preItem.czr_Input("locations").mayBeDisplayModelAlert())})},initializeModuleModel:function(a){var b=this;return a.items=_.union(_.has(b.serverParams,"default_zones")?b.serverParams.default_zones:[],a.items),a},CZRWZonesInputMths:{ready:function(){var a=this;a.bind("locations:changed",function(){a.mayBeDisplayModelAlert()}),api.CZRInput.prototype.ready.call(a)},setupSelect:function(){"locations"==this.id&&this._setupLocationSelect(),"contexts"==this.id&&this._setupContextSelect()},_setupContextSelect:function(){var a=this,b=a(),c=(a.item,a.module);_.each(c.contexts,function(c,d){var e={value:d,html:c};(d==b||_.contains(b,d))&&$.extend(e,{selected:"selected"}),$('select[data-type="contexts"]',a.container).append($("<option>",e))}),$('select[data-type="contexts"]',a.container).select2()},_setupLocationSelect:function(a){function b(a){if(!a.id)return a.text;if(_.contains(f,a.element.value))return a.text;var b=$('<span class="czr-unavailable-location fa fa-ban" title="'+serverControlParams.translatedStrings.unavailableLocation+'">&nbsp;&nbsp;'+a.text+"</span>");return b}var c=this,d=c(),e=(c.item,c.module),f=api.sidebar_insights("available_locations")();$('select[data-type="locations"]',c.container).children().length||_.each(e.locations,function(a,b){var e={value:b,html:a};(b==d||_.contains(d,b))&&$.extend(e,{selected:"selected"}),$('select[data-type="locations"]',c.container).append($("<option>",e))}),a&&$('select[data-type="locations"]',c.container).select2("destroy"),$('select[data-type="locations"]',c.container).select2({templateResult:b,templateSelection:b})},mayBeDisplayModelAlert:function(){var a=this,b=a.item,c=a.module;if(_.has(b(),"locations")&&!_.isEmpty(b().locations)){var d=$('select[data-type="locations"]',a.container).val(),e=api.sidebar_insights("available_locations")(),f=_.filter(d,function(a){return!_.contains(e,a)});!_.has(b(),"id")||_.isEmpty(b().id)?c.preItem_location_alert_view_state.set(_.isEmpty(f)?"closed":"expanded"):b.czr_itemLocationAlert.set(_.isEmpty(f)?"closed":"expanded")}}},CZRWZonesItem:{initialize:function(a,b){var c=this;c.module;c.czr_itemLocationAlert=new api.Value,api.CZRItem.prototype.initialize.call(c,null,b)},itemWrapperViewSetup:function(){var a=this,b=a.module;api.CZRItem.prototype.itemWrapperViewSetup.call(a),a.czr_itemLocationAlert.set("closed"),a.czr_itemLocationAlert.callbacks.add(function(c,d){b._toggleLocationAlertExpansion(a.container,c)}),a.writeSubtitleInfos(a()),a.czr_ItemState.callbacks.add(function(b,c){-1!=b.indexOf("expanded")&&a.contentRendered.then(function(){a.czr_Input("locations")._setupLocationSelect(!0),a.czr_Input("locations").mayBeDisplayModelAlert()})})},itemReact:function(a,b){var c=this;api.CZRItem.prototype.itemReact.call(c,a,b),c.writeSubtitleInfos(a),c.updateSectionTitle(a).setModelUpdateTimer()},writeSubtitleInfos:function(a){var b=this,c=b.module,d=_.clone(a||b()),e=[],f=[],g="";if(!b.container.length)return this;d.locations=_.isString(d.locations)?[d.locations]:d.locations,_.each(d.locations,function(a){_.has(c.locations,a)?e.push(c.locations[a]):e.push(a)}),d.contexts=_.isString(d.contexts)?[d.contexts]:d.contexts,b._hasModelAllContexts(a)?f.push(c.contexts._all_):_.each(d.contexts,function(a){_.has(c.contexts,a)?f.push(c.contexts[a]):f.push(a)});var h=serverControlParams.translatedStrings.locations,i=serverControlParams.translatedStrings.contexts,j=serverControlParams.translatedStrings.notset;if(e=_.isEmpty(e)?'<span style="font-weight: bold;">'+j+"</span>":e.join(", "),f=_.isEmpty(f)?'<span style="font-weight: bold;">'+j+"</span>":f.join(", "),g="<u>"+h+"</u> : "+e+" <strong>|</strong> <u>"+i+"</u> : "+f,$(".czr-zone-infos",b.container).length)$(".czr-zone-infos",b.container).html(g);else{var k=$("<div/>",{"class":["czr-zone-infos",c.control.css_attr.item_sort_handle].join(" "),html:g});$("."+c.control.css_attr.item_btns,b.container).after(k)}return this},updateSectionTitle:function(a){var b="sidebar-widgets-"+a.id,c=a.title;return api.section.has(b)?($(".accordion-section-title",api.section(b).container).text(c),$(".customize-section-title h3",api.section(b).container).html('<span class="customize-action">'+api.section(b).params.customizeAction+"</span>"+c),this):this},setModelUpdateTimer:function(){var a=this,b=a.module;clearTimeout($.data(this,"modelUpdateTimer")),$.data(this,"modelUpdateTimer",setTimeout(function(){b.control.refreshPreview()},1e3))},_hasModelAllContexts:function(a){var b=this,c=b.module,d=_.keys(c.contexts);if(a=a||this(),_.has(a,"contexts"))return!!_.contains(a.contexts,"_all_")||_.isEmpty(_.difference(_.without(d,"_all_"),a.contexts))},_getMatchingContexts:function(a){var b=this,c=api.czr_wp_conditionals()||{},d=_.filter(b.context_match_map,function(a,b){return!0===c[b]});return _.isEmpty(d)?a:d}},addWidgetSidebar:function(a,b){if(!_.isObject(a)&&_.isEmpty(b))throw new Error("No valid input were provided to add a new Widget Zone.");var c=this,d=_.isEmpty(a)?b:_.clone(a),e=_.isEmpty(a)?b:$.extend(_.clone(_.findWhere(api.Widgets.data.registeredSidebars,{id:c.serverParams.defaultWidgetSidebar})),{name:d.title,id:d.id});api.Widgets.registeredSidebars.add(e);var f=$.extend(_.clone(api.section("sidebar-widgets-"+c.serverParams.defaultWidgetSidebar).params),{id:"sidebar-widgets-"+d.id,instanceNumber:_.max(api.settings.sections,function(a){return a.instanceNumber}).instanceNumber+1,sidebarId:e.id,title:e.name,description:"undefined"!=typeof b?b.description:api.section("sidebar-widgets-"+c.serverParams.defaultWidgetSidebar).params.description,priority:_.max(_.omit(api.settings.sections,c.serverParams.dynWidgetSection),function(a){return a.instanceNumber}).priority+1});api.section.add(f.id,new api.sectionConstructor[f.type](f.id,{params:f})),api.settings.sections[f.id]=f.id;var g="sidebars_widgets["+d.id+"]",h=$.extend(_.clone(api.settings.settings["sidebars_widgets["+c.serverParams.defaultWidgetSidebar+"]"]),{value:[]});api.settings.settings[g]=h,api.create(g,g,h.value,{transport:h.transport,previewer:api.previewer,dirty:!1});var i=$.extend(_.clone(api.settings.controls["sidebars_widgets["+c.serverParams.defaultWidgetSidebar+"]"]),{settings:{"default":g}}),j={};_.each(i,function(a,b){"string"==typeof a&&(a=a.replace(c.serverParams.defaultWidgetSidebar,d.id)),j[b]=a}),j.instanceNumber=_.max(api.settings.controls,function(a){return a.instanceNumber}).instanceNumber+1,api.settings.controls[g]=j,api.control.add(g,new api.controlConstructor[j.type](g,{params:j,previewer:api.previewer})),_.has(this,"container")&&this.container.trigger("widget_zone_created",{model:d,section_id:"sidebar-widgets-"+d.id,setting_id:g})},removeWidgetSidebar:function(a){var b=this;if(!_.isObject(a)||_.isEmpty(a))throw new Error("No valid data were provided to remove a Widget Zone.");api.Widgets.registeredSidebars.remove(a.id),api.section.has("sidebar-widgets-"+a.id)&&(api.section("sidebar-widgets-"+a.id).container.remove(),api.section.remove("sidebar-widgets-"+a.id),delete api.settings.sections["sidebar-widgets-"+a.id]),api.has("sidebars_widgets["+a.id+"]")&&(api.remove("sidebars_widgets["+a.id+"]"),delete api.settings.settings["sidebars_widgets["+a.id+"]"]),api.control.has("sidebars_widgets["+a.id+"]")&&(api.control("sidebars_widgets["+a.id+"]").container.remove(),api.control.remove("sidebars_widgets["+a.id+"]"),delete api.settings.controls["sidebars_widgets["+a.id+"]"]);var c=function(){api.previewer.refresh()};c=_.debounce(c,500),$.when(c()).done(function(){b.trigger("widget_zone_removed",{model:a,section_id:"sidebar-widgets-"+a.id,setting_id:"sidebars_widgets["+a.id+"]"})})},widgetPanelReact:function(){var a=this,b=api.panel("widgets").container.find(".control-panel-content").css("margin-top");api.section(a.serverParams.dynWidgetSection).fixTopMargin("value").set(b);var c=api.section(a.serverParams.dynWidgetSection).container.find(".accordion-section-content"),d=api.panel("widgets").container.find(".control-panel-content"),e=function(){c.css("margin-top",""),d.css("margin-top",api.section(a.serverParams.dynWidgetSection).fixTopMargin("value")())};api.bind("pane-contents-reflowed",_.debounce(function(){e()},150)),a.closeAllItems(),_.has(a,"preItemExpanded")&&a.preItemExpanded.set(!1)},widgetSectionReact:function(a,b){var c=this,d=api.section(c.serverParams.dynWidgetSection),e=d.container.closest(".wp-full-overlay-sidebar-content"),f=d.container.find(".accordion-section-content"),g=d.container.closest(".wp-full-overlay"),h=(d.container.find(".customize-section-back"),d.container.find(".accordion-section-title").first());$("#customize-header-actions").height();a&&(g.removeClass("section-open"),f.css("height","auto"),h.attr("tabindex","0"),f.css("margin-top",""),e.scrollTop(0)),c.closeAllItems(),f.slideToggle()},listenToSidebarInsights:function(){var a=this;api.sidebar_insights("registered").callbacks.add(function(b){var c=_.clone(a.itemCollection());_.map(c,function(c){a.getViewEl(c.id).length&&a.getViewEl(c.id).css("display",_.contains(b,c.id)?"block":"none")})}),api.sidebar_insights("inactives").callbacks.add(function(b){var c=_.clone(a.itemCollection());_.map(c,function(c){a.getViewEl(c.id).length&&(_.contains(b,c.id)?(a.getViewEl(c.id).addClass("inactive"),a.getViewEl(c.id).find(".czr-inactive-alert").length||a.getViewEl(c.id).find(".czr-item-title").append($("<span/>",{"class":"czr-inactive-alert",html:" [ "+serverControlParams.translatedStrings.inactiveWidgetZone+" ]"}))):(a.getViewEl(c.id).removeClass("inactive"),a.getViewEl(c.id).find(".czr-inactive-alert").length&&a.getViewEl(c.id).find(".czr-inactive-alert").remove()))})}),api.sidebar_insights("candidates").callbacks.add(function(b){_.isArray(b)&&_.map(b,function(b){_.isObject(b)&&(api.section.has("sidebar-widgets-"+b.id)||(a.addWidgetSidebar({},b),_.has(api.sidebar_insights("actives")(),b.id)&&api.section.has("sidebar-widgets-"+b.id)&&api.section("sidebar-widgets-"+b.id).activate()))})})},_adjustScrollExpandedBlock:function(a,b){if(a.length){var c,d=$(".wp-full-overlay-sidebar-content").scrollTop(),e=b||90;setTimeout(function(){a.offset().top+a.height()+e>$(window.top).height()&&(c=a.offset().top+a.height()+e-$(window.top).height(),$(".wp-full-overlay-sidebar-content").animate({scrollTop:d+c},600))},50)}},getDefaultModel:function(a){var b=this,c=b.itemCollection(),d=_.clone(b.defaultItemModel);d.contexts;return $.extend(d,{title:"Widget Zone "+(1*_.size(c)+1)})},getTemplateEl:function(a,b){var c,d=this;switch("rudItemPart"==a?a=_.has(b,"is_builtin")&&b.is_builtin?"ruItemPart":a:"itemInputList"==a&&(a=_.has(b,"is_builtin")&&b.is_builtin?"itemInputListReduced":a),a){case"rudItemPart":c=d.rudItemPart;break;case"ruItemPart":c=d.ruItemPart;break;case"itemInputList":c=d.itemInputList;break;case"itemInputListReduced":c=d.itemInputListReduced}if(_.isEmpty(c))throw new Error("No valid template has been found in getTemplateEl()");return c},_toggleLocationAlertExpansion:function(a,b){var c=a.find(".czr-location-alert");if(!c.length){var d=["<span>"+serverControlParams.translatedStrings.locationWarning+"</span>",api.CZR_Helpers.getDocSearchLink(serverControlParams.translatedStrings.locationWarning)].join("");c=$("<div/>",{"class":"czr-location-alert",html:d,style:"display:none"}),$('select[data-type="locations"]',a).closest("div").after(c)}c.toggle("expanded"==b)}});var CZRFeaturedPageModuleMths=CZRFeaturedPageModuleMths||{};$.extend(CZRFeaturedPageModuleMths,{initialize:function(a,b){var c=this;api.CZRDynModule.prototype.initialize.call(c,a,b),$.extend(c,{itemPreAddEl:"czr-module-fp-pre-add-view-content",itemInputList:"czr-module-fp-view-content"}),c.inputConstructor=api.CZRInput.extend(c.CZRFeaturedPagesInputMths||{}),c.itemConstructor=api.CZRItem.extend(c.CZRFeaturedPagesItem||{}),this.defaultItemModel={id:"",title:"","fp-post":"","fp-title":"","fp-text":"","fp-image":""},this.itemAddedMessage=serverControlParams.translatedStrings.featuredPageAdded,api.section(c.control.section()).expanded.bind(function(a){"resolved"!=c.isReady.state()&&c.ready()})},addItem:function(a){var b=this,c=b.preItem,d=c();if(_.isEmpty(d)||!_.isObject(d))throw new Error("addItem : an item should be an object and not empty. In : "+b.id+". Aborted.");var e=d["fp-post"];if("undefined"!=typeof e){e=e[0];var f=function(e){c.set($.extend(d,e)),api.CZRDynModule.prototype.addItem.call(b,a)};b.CZRFeaturedPagesItem.setContentAjaxInfo(e.id,{},f)}},CZRFeaturedPagesInputMths:{ready:function(){var a=this;a.bind("fp-post:changed",function(){a.updateItemModel()}),a.bind("fp-title:changed",function(){a.updateItemTitle()}),api.CZRInput.prototype.ready.call(a)},setupImageUploader:function(){var a=this;a.container.bind("fp-image:content_rendered",function(){a.addResetDefaultButton()}),a.container.on("click keydown",".default-fpimage-button",function(){a.setThumbnailAjax()}),api.CZRInput.prototype.setupImageUploader.call(a)},updateItemModel:function(a){var b=this,c=this.item,d=_.has(b,"is_preItemInput")&&b.is_preItemInput;if(_.has(c(),"fp-post")&&!_.isEmpty(c()["fp-post"])){var e=_.clone(c()),f=e["fp-post"][0],g=f.title;d?b.module.preItemInput:c.czr_Input;if(d)$.extend(e,{title:g,"fp-title":g}),c.set(e);else{var h=function(a){_.each(a,function(a,b){c.czr_Input(b).set(a)})};c.setContentAjaxInfo(f.id,{"fp-title":g},h)}}},updateItemTitle:function(a){var b=this,c=this.item,d=_.has(b,"is_preItemInput")&&b.is_preItemInput;if(!d){var e=_.clone(c()),f="undefined"!=typeof e["fp-title"]?e["fp-title"]:"";$.extend(e,{title:f}),c.set(e)}},setThumbnailAjax:function(){var a,b=this.item,c=b.czr_Input("fp-post")();"undefined"!=typeof c&&(c=c[0],a=c.id,$(".fpimage-reset-messages p").hide(),request=wp.ajax.post("get-fp-post-tb",{wp_customize:"on",id:a,CZRFPNonce:serverControlParams.CZRFPNonce}),request.done(function(a){var c=a,d=b.czr_Input("fp-image");0!==c.length?($(".fpimage-reset-messages .success",d.container).show("fast").fadeOut(),d.set(c)):$(".fpimage-reset-messages .warning",d.container).show("fast").delay(2e3).fadeOut()}),request.fail(function(a){"undefined"!=typeof console&&console.error&&console.error(a)}))},addResetDefaultButton:function(a){var b=this,c=(b.item,serverControlParams.translatedStrings.featuredPageImgReset),d=serverControlParams.translatedStrings.featuredPageResetSucc,e=serverControlParams.translatedStrings.featuredPageResetErr,f='<div class="fpimage-reset-messages" style="clear:both"><p class="success" style="display:none">'+d+'</p><p class="warning" style="display:none">'+e+"</p></div>";$(".actions",b.container).append('<button type="button" class="button default-fpimage-button">'+c+"</button>"),$(".fpimage-reset-messages",b.container).detach(),$(b.container).append(f)}},CZRFeaturedPagesItem:{setContentAjaxInfo:function(a,b,c){var d=b||{};return request=wp.ajax.post("get-fp-post",{wp_customize:"on",id:a,CZRFPNonce:serverControlParams.CZRFPNonce}),request.done(function(a){var b=a.post_info;0!==b.length&&($.extend(d,{"fp-image":b.thumbnail,"fp-text":b.excerpt}),"function"==typeof c&&c(d))}),request.fail(function(a){"undefined"!=typeof console&&console.error&&console.error(a)}),request},writeItemViewTitle:function(a){var b=this,c=b.module,d=a||b(),e=d.title?d.title:serverControlParams.translatedStrings.featuredPageTitle;e=api.CZR_Helpers.truncate(e,25),$("."+c.control.css_attr.item_title,b.container).html(e)}}});var CZRTextModuleMths=CZRTextModuleMths||{};$.extend(CZRTextModuleMths,{initialize:function(a,b){var c=this;api.CZRModule.prototype.initialize.call(c,a,b),$.extend(c,{itemInputList:"czr-module-text-view-content"}),c.defaultItemModel={id:"",text:""}}});var CZRSlideModuleMths=CZRSlideModuleMths||{};$.extend(CZRSlideModuleMths,{initialize:function(a,b){var c=this;api.CZRDynModule.prototype.initialize.call(c,a,b),$.extend(c,{itemPreAddEl:"czr-module-slide-pre-item-input-list",itemInputList:"czr-module-slide-item-input-list"}),c.inputConstructor=api.CZRInput.extend(c.CZRSliderInputMths||{}),c.itemConstructor=api.CZRItem.extend(c.CZRSliderItem||{}),this.defaultItemModel={id:"",title:"","slide-background":"","slide-title":"","slide-subtitle":""},this.itemAddedMessage=serverControlParams.translatedStrings.slideAdded},CZRSliderInputMths:{ready:function(){var a=this;a.bind("slide-title:changed",function(){a.updateItemTitle()}),api.CZRInput.prototype.ready.call(a)},updateItemTitle:function(a){var b=this,c=this.item,d=(_.has(b,"is_preItemInput")&&b.is_preItemInput,_.clone(c())),e=d["slide-title"];$.extend(d,{title:e}),c.set(d)}},CZRSliderItem:{writeItemViewTitle:function(a){var b=this,c=b.module,d=a||b(),e=d.title?d.title:serverControlParams.translatedStrings.slideTitle;e=api.CZR_Helpers.truncate(e,25),$("."+c.control.css_attr.item_title,b.container).html(e)}}});var CZRTextEditorModuleMths=CZRTextEditorModuleMths||{};$.extend(CZRTextEditorModuleMths,{initialize:function(a,b){var c=this;api.CZRModule.prototype.initialize.call(c,a,b),$.extend(c,{itemInputList:"czr-module-text_editor-item-content"}),c.inputConstructor=api.CZRInput.extend(c.CZRTextEditorInputMths||{}),c.itemConstructor=api.CZRItem.extend(c.CZRTextEditorItem||{}),this.defaultItemModel={id:"",text:""}},CZRTextEditorInputMths:{},CZRTextEditorItem:{}});var CZRBodyBgModuleMths=CZRBodyBgModuleMths||{};$.extend(CZRBodyBgModuleMths,{initialize:function(a,b){var c=this;api.CZRModule.prototype.initialize.call(c,a,b),$.extend(c,{itemInputList:"czr-module-bodybg-item-content"}),c.inputConstructor=api.CZRInput.extend(c.CZRBodyBgInputMths||{}),c.itemConstructor=api.CZRItem.extend(c.CZBodyBgItemMths||{}),c.defaultItemModel={"background-color":"#eaeaea","background-image":"","background-repeat":"no-repeat","background-attachment":"fixed","background-position":"center center","background-size":"cover"},api.consoleLog("module ID",c.id),_.has(api,"czr_activeSectionId")&&c.control.section()==api.czr_activeSectionId()&&"resolved"!=c.isReady.state()&&c.ready(),api.section(c.control.section()).expanded.bind(function(a){"resolved"!=c.isReady.state()&&c.ready()})},CZRBodyBgInputMths:{setupSelect:function(){var a=this,b={"background-repeat":"bg_repeat_options","background-attachment":"bg_attachment_options","background-position":"bg_position_options"},c=(a.item,serverControlParams.body_bg_module_params),d={};a.module;_.has(b,a.id)&&(_.isUndefined(c)||_.isUndefined(c[b[a.id]])||(d=c[b[a.id]],_.isEmpty(d)||(_.each(d,function(b,c){var d={value:c,html:b};(c==a()||_.contains(a(),c))&&$.extend(d,{selected:"selected"}),$("select[data-type]",a.container).append($("<option>",d))}),$("select[data-type]",a.container).select2())))}},CZBodyBgItemMths:{ready:function(){var a=this;api.CZRItem.prototype.ready.call(a),a.czr_Input("background-image").isReady.done(function(b){var c=function(b){var c=!_.isEmpty(b)||_.isNumber(b);_.each(["background-repeat","background-attachment","background-position","background-size"],function(b){a.czr_Input(b).container.toggle(c||!1)})};c(b()),a.bind("background-image:changed",function(){c(a.czr_Input("background-image")())})})}}});var CZRBaseControlMths=CZRBaseControlMths||{};$.extend(CZRBaseControlMths,{initialize:function(a,b){var c=this;c.css_attr=_.has(serverControlParams,"css_attr")?serverControlParams.css_attr:{},api.Control.prototype.initialize.call(c,a,b)},refreshPreview:function(a){this.previewer.refresh()}});var CZRBaseModuleControlMths=CZRBaseModuleControlMths||{};$.extend(CZRBaseModuleControlMths,{initialize:function(a,b){var c=this;c.czr_Module=new api.Values,c.czr_moduleCollection=new api.Value,c.czr_moduleCollection.set([]),c.moduleCollectionReady=$.Deferred(),c.moduleCollectionReady.done(function(a){!c.isMultiModuleControl(b.params),c.czr_moduleCollection.callbacks.add(function(){return c.moduleCollectionReact.apply(c,arguments)})}),c.isMultiModuleControl(b.params)&&(c.syncSektionModule=new api.Value),api.CZRBaseControl.prototype.initialize.call(c,a,b)},ready:function(){var a=this;if(a.isMultiModuleControl())a.syncSektionModule.bind(function(b,c){"resolved"!=a.moduleCollectionReady.state()&&(a.registerModulesOnInit(b),a.moduleCollectionReady.resolve())});else{var b={};_.each(a.getSavedModules(),function(c,d){b=c,a.instantiateModule(c,{}),a.container.attr("data-module",c.id)}),a.moduleCollectionReady.resolve(b)}a.bind("user-module-candidate",function(b){a.instantiateModule(b,{}).ready(b.is_added_by_user)})},getDefaultModuleApiModel:function(){var a={id:"",module_type:"",items:[],crud:!1,multi_item:!1,control:{}};return this.isMultiModuleControl()?$.extend(a,{column_id:"",sektion:{},sektion_id:"",is_added_by_user:!1,dirty:!1}):$.extend(a,{section:""})},getDefaultModuleDBModel:function(){var a={items:[]};return this.isMultiModuleControl()?$.extend(a,{id:"",module_type:"",column_id:"",sektion_id:"",dirty:!1}):a},isMultiModuleControl:function(a){return"czr_multi_module"==(a||this.params).type},getSyncCollectionControl:function(){var a=this;if(_.isUndefined(a.params.syncCollection))throw new Error("Control "+a.id+" has no synchronized sektion control defined.");return api.control(api.CZR_Helpers.build_setId(a.params.syncCollection))},getSavedModules:function(){var a=this,b=[],c=a.params.module_type;if(a.isMultiModuleControl())b=$.extend(!0,[],api(a.id)());else{!api.CZR_Helpers.isMultiItemModule(c)||_.isEmpty(api(a.id)())||_.isObject(api(a.id)())||api.consoleLog("Module Control Init for "+a.id+" : a mono item module control value should be an object if not empty.");var d=_.isArray(api(a.id)())?api(a.id)():[api(a.id)()];b.push({id:api.CZR_Helpers.getOptionName(a.id)+"_"+a.params.type,module_type:a.params.module_type,section:a.section(),items:$.extend(!0,[],d)})}return b},isModuleRegistered:function(a){var b=this;return!_.isUndefined(_.findWhere(b.czr_moduleCollection(),{id:a}))}});var CZRBaseModuleControlMths=CZRBaseModuleControlMths||{};$.extend(CZRBaseModuleControlMths,{instantiateModule:function(a,b){if(!_.has(a,"id"))throw new Error("CZRModule::instantiateModule() : a module has no id and could not be added in the collection of : "+this.id+". Aborted.");var c=this;if((_.isUndefined(b)||_.isEmpty(b))&&(b=c.getModuleConstructor(a)),!_.isEmpty(a.id)&&c.czr_Module.has(a.id))throw new Error("The module id already exists in the collection in control : "+c.id);
15
+ var d=c.prepareModuleForAPI(a);if(c.czr_Module.add(d.id,new b(d.id,d)),!c.czr_Module.has(d.id))throw new Error("instantiateModule() : instantiation failed for module id "+d.id+" in control "+c.id);return c.czr_Module(d.id)},getModuleConstructor:function(a){var b=this,c={},d={};if(!_.has(a,"module_type"))throw new Error("CZRModule::getModuleConstructor : no module type found for module "+a.id);if(!_.has(api.czrModuleMap,a.module_type))throw new Error("Module type "+a.module_type+" is not listed in the module map api.czrModuleMap.");var e=api.czrModuleMap[a.module_type].mthds,f=api.czrModuleMap[a.module_type].crud,g=f?api.CZRDynModule:api.CZRModule;if(_.isEmpty(a.sektion_id)?d=g.extend(e):(c=g.extend(e),d=c.extend(b.getMultiModuleExtender(c))),_.isUndefined(d)||_.isEmpty(d)||!d)throw new Error("CZRModule::getModuleConstructor : no constructor found for module type : "+a.module_type+".");return d},prepareModuleForAPI:function(a){if(!_.isObject(a))throw new Error("prepareModuleForAPI : a module must be an object to be instantiated.");var b=this,c={};return _.each(b.getDefaultModuleApiModel(),function(d,e){var f=a[e];switch(e){case"id":_.isEmpty(f)?c[e]=b.generateModuleId(a.module_type):c[e]=f;break;case"module_type":if(!_.isString(f)||_.isEmpty(f))throw new Error("prepareModuleForAPI : a module type must a string not empty");c[e]=f;break;case"items":if(!_.isArray(f))throw new Error("prepareModuleForAPI : a module item list must be an array");c[e]=f;break;case"crud":if(_.has(api.czrModuleMap,a.module_type))f=api.czrModuleMap[a.module_type].crud;else if(!_.isUndefined(f)&&!_.isBoolean(f))throw new Error('prepareModuleForAPI : the module param "crud" must be a boolean');c[e]=f||!1;break;case"multi_item":if(_.has(api.czrModuleMap,a.module_type))f=api.czrModuleMap[a.module_type].crud||api.czrModuleMap[a.module_type].multi_item;else if(!_.isUndefined(f)&&!_.isBoolean(f))throw new Error('prepareModuleForAPI : the module param "multi_item" must be a boolean');c[e]=f||!1;break;case"control":c[e]=b;break;case"section":if(!_.isString(f)||_.isEmpty(f))throw new Error("prepareModuleForAPI : a module section must be a string not empty");c[e]=f;break;case"column_id":if(!_.isString(f)||_.isEmpty(f))throw new Error("prepareModuleForAPI : a module column id must a string not empty");c[e]=f;break;case"sektion":if(!_.isObject(f)||_.isEmpty(f))throw new Error("prepareModuleForAPI : a module sektion must be an object not empty");c[e]=f;break;case"sektion_id":if(!_.isString(f)||_.isEmpty(f))throw new Error("prepareModuleForAPI : a module sektion id must be a string not empty");c[e]=f;break;case"is_added_by_user":if(!_.isUndefined(f)&&!_.isBoolean(f))throw new Error('prepareModuleForAPI : the module param "is_added_by_user" must be a boolean');c[e]=f||!1;break;case"dirty":c[e]=f||!1}}),c},generateModuleId:function(a,b,c){if(c=c||1,c>100)throw new Error("Infinite loop when generating of a module id.");var d=this;b=b||d._getNextModuleKeyInCollection();var e=a+"_"+b;if(!_.has(d,"czr_moduleCollection")||!_.isArray(d.czr_moduleCollection()))throw new Error("The module collection does not exist or is not properly set in control : "+d.id);return d.isModuleRegistered(e)?(b++,c++,d.generateModuleId(a,b,c)):e},_getNextModuleKeyInCollection:function(){var a=this,b={},c=0;return _.isEmpty(a.czr_moduleCollection())||(b=_.max(a.czr_moduleCollection(),function(a){return parseInt(a.id.replace(/[^\/\d]/g,""),10)}),c=parseInt(b.id.replace(/[^\/\d]/g,""),10)+1),c}});var CZRBaseModuleControlMths=CZRBaseModuleControlMths||{};$.extend(CZRBaseModuleControlMths,{registerModulesOnInit:function(a){var b=this,c=[];_.each(b.getSavedModules(),function(d,e){if(!a.czr_Item.has(d.sektion_id))return api.consoleLog("Warning Module "+d.id+" is orphan : it has no sektion to be embedded to. It Must be removed."),void c.push(d);var f=a.czr_Item(d.sektion_id);if(_.isUndefined(f))throw new Error("sektion instance missing. Impossible to instantiate module : "+d.id);$.extend(d,{sektion:f}),b.updateModulesCollection({module:d})}),b.moduleCollectionReady.then(function(){_.isEmpty(c)||b.moduleCollectionReact(b.czr_moduleCollection(),[],{orphans_module_removal:c})})},updateModulesCollection:function(a){var b=this,c=b.czr_moduleCollection(),d=$.extend(!0,[],c);if(_.has(a,"collection"))return void b.czr_moduleCollection.set(a.collection,a.data||{});if(!_.has(a,"module"))throw new Error("updateModulesCollection, no module provided "+b.id+". Aborting");var e=b.prepareModuleForAPI(_.clone(a.module));_.findWhere(d,{id:e.id})?_.each(c,function(a,b){a.id==e.id&&(d[b]=e)}):d.push(e);var f={};_.has(a,"data")&&(f=$.extend(!0,{},a.data),$.extend(f,{module:e})),b.czr_moduleCollection.set(d,f)},moduleCollectionReact:function(a,b,c){var d=this,e=_.size(a)>_.size(b),f=_.size(b)>_.size(a);_.size(b)==_.size(a);if(is_collection_sorted=!1,f){var g=_.filter(b,function(b){return _.isUndefined(_.findWhere(a,{id:b.id}))});g=g[0],d.czr_Module.remove(g.id)}_.isObject(c)&&_.has(c,"module")&&(c.module=d.prepareModuleForDB($.extend(!0,{},c.module))),!d.isMultiModuleControl()&&e||api(this.id).set(d.filterModuleCollectionBeforeAjax(a),c)},filterModuleCollectionBeforeAjax:function(a){var b=this,c=$.extend(!0,[],a);if(_.each(a,function(a,d){var e=$.extend(!0,{},a);c[d]=b.prepareModuleForDB(e)}),b.isMultiModuleControl())return c;if(_.size(a)>1)throw new Error("There should not be several modules in the collection of control : "+b.id);if(!_.isArray(a)||_.isEmpty(a)||!_.has(a[0],"items"))throw new Error("The setting value could not be populated in control : "+b.id);var d=a[0].id;if(!b.czr_Module.has(d))throw new Error("The single module control ("+b.id+") has no module registered with the id "+d);var e=b.czr_Module(d);if(!_.isArray(e().items))throw new Error("The module "+d+" should be an array in control : "+b.id);return e.isMultiItem()?e().items:e().items[0]||[]},prepareModuleForDB:function(a){if(!_.isObject(a))throw new Error("MultiModule Control::prepareModuleForDB : a module must be an object. Aborting.");var b=this,c={};return _.each(b.getDefaultModuleDBModel(),function(d,e){if(!_.has(a,e))throw new Error("MultiModule Control::prepareModuleForDB : a module is missing the property : "+e+" . Aborting.");var f=a[e];switch(e){case"items":if(!_.isArray(f))throw new Error("prepareModuleForDB : a module item list must be an array");c[e]=f;break;case"id":if(!_.isString(f)||_.isEmpty(f))throw new Error("prepareModuleForDB : a module id must a string not empty");c[e]=f;break;case"module_type":if(!_.isString(f)||_.isEmpty(f))throw new Error("prepareModuleForDB : a module type must a string not empty");c[e]=f;break;case"column_id":if(!_.isString(f)||_.isEmpty(f))throw new Error("prepareModuleForDB : a module column id must a string not empty");c[e]=f;break;case"sektion_id":if(!_.isObject(a.sektion)||!_.has(a.sektion,"id"))throw new Error("prepareModuleForDB : a module sektion must be an object with an id.");c[e]=a.sektion.id;break;case"dirty":if(b.czr_Module.has(a.id)?c[e]=b.czr_Module(a.id).isDirty():c[e]=f,!_.isBoolean(c[e]))throw new Error("prepareModuleForDB : a module dirty state must be a boolean.")}}),c}});var CZRMultiModuleControlMths=CZRMultiModuleControlMths||{};$.extend(CZRMultiModuleControlMths,{initialize:function(a,b){var c=this;api.consoleLog("IN MULTI MODULE INITIALIZE ? ",b),api(a).callbacks.add(function(){return c.syncColumn.apply(c,arguments)}),api.CZRBaseModuleControl.prototype.initialize.call(c,a,b)},ready:function(){var a=this;api.consoleLog("MODULE-COLLECTION CONTROL READY",this.id),api.CZRBaseModuleControl.prototype.ready.apply(a,arguments)},syncColumn:function(a,b,c){if(api.consoleLog("IN SYNC COLUMN",a,b,c),(_.isUndefined(c)||!c.silent)&&(api.consoleLog("IN SYNXXX",api.control("hu_theme_options[module-collection]").syncSektionModule()(),this.syncSektionModule()(),this.id),!_.has(c,"orphans_module_removal"))){var d=api.control(this.id),e=_.filter(a,function(a,c){return!_.findWhere(b,{id:a.id})});_.isEmpty(e)||(api.consoleLog("ADDED MODULE?",e),_.each(e,function(a){d.syncSektionModule().czr_Column(a.column_id).updateColumnModuleCollection({module:a})}));var f=_.filter(b,function(b,c){return!_.findWhere(a,{id:b.id})});_.isEmpty(f)||_.each(f,function(a){d.syncSektionModule().czr_Column(a.column_id).removeModuleFromColumnCollection(a)}),_.size(b)==_.size(a)&&_.has(c,"module")&&_.has(c,"source_column")&&_.has(c,"target_column")&&$.when(d.syncSektionModule().moveModuleFromTo(c.module,c.source_column,c.target_column)).done(function(){d.syncSektionModule().control.trigger("module-moved",{module:c.module,source_column:c.source_column,target_column:c.target_column})}),d.trigger("columns-synchronized",a)}},removeModule:function(a){var b=this;b.czr_Module.has(a.id)&&"resolved"==b.czr_Module(a.id).embedded.state()&&b.czr_Module(a.id).container.remove(),b.removeModuleFromCollection(a)},removeModuleFromCollection:function(a){var b=this,c=b.czr_moduleCollection(),d=$.extend(!0,[],c);d=_.filter(d,function(b){return b.id!=a.id}),b.czr_moduleCollection.set(d)}});var CZRMultiModuleControlMths=CZRMultiModuleControlMths||{};$.extend(CZRMultiModuleControlMths,{getMultiModuleExtender:function(a){var b=this;return $.extend(b.CZRModuleExtended,{initialize:function(b,c){var d=this;a.prototype.initialize.call(d,b,c),api.consoleLog("MODULE INSTANTIATED : ",d.id),$.extend(d,{singleModuleWrapper:"czr-single-module-wrapper",sektionModuleTitle:"czr-module-sektion-title-part",ruModuleEl:"czr-ru-module-sektion-content"}),d.czr_ModuleState=new api.Value((!1)),d.isReady.done(function(){d.setupModuleView()}),d.moduleTitleEmbedded=$.Deferred(),d.modColumn=new api.Value,d.modColumn.set(c.column_id),d.modColumn.bind(function(a,b){api.consoleLog("MODULE "+d.id+" HAS BEEN MOVED TO COLUMN",a,d());var c=d(),e=$.extend(!0,{},c);e.column_id=a,d.set(e,{target_column:a,source_column:b})})},ready:function(b){var c=this;api.consoleLog("MODULE READY IN EXTENDED MODULE CLASS : ",c.id),$.when(c.renderModuleWrapper(b)).done(function(a){if(_.isUndefined(a)||!1===a.length)throw new Error("Module container has not been embedded for module :"+c.id);c.container=a,c.embedded.resolve()}),a.prototype.ready.call(c)}}),b.CZRModuleExtended},CZRModuleExtended:{renderModuleWrapper:function(a){var b=this;if("resolved"==b.embedded.state())return b.container;if(0===$("#tmpl-"+b.singleModuleWrapper).length)throw new Error("No template for module "+b.id+". The template script id should be : #tmpl-"+b.singleModuleWrapper);var c=wp.template(b.singleModuleWrapper),d={id:b.id,type:b.module_type},e=$(c(d));return a?$.when($(".czr-module-collection-wrapper",b._getColumn().container).find(".czr-module-candidate").after(e)).done(function(){$(".czr-module-collection-wrapper",b._getColumn().container).find(".czr-module-candidate").remove()}):$(".czr-module-collection-wrapper",b._getColumn().container).append(e),e},setupModuleView:function(){var a=this;a.view_event_map=[{trigger:"click keydown",selector:[".czr-remove-mod","."+a.control.css_attr.cancel_alert_btn].join(","),name:"toggle_remove_alert",actions:["toggleModuleRemoveAlert"]},{trigger:"click keydown",selector:"."+a.control.css_attr.remove_view_btn,name:"remove_module",actions:["removeModule"]},{trigger:"click keydown",selector:".czr-edit-mod",name:"edit_module",actions:["setModuleViewVisibility","sendEditModule"]},{trigger:"click keydown",selector:".czr-module-back",name:"back_to_column",actions:["setModuleViewVisibility"]},{trigger:"mouseenter",selector:".czr-mod-header",name:"hovering_module",actions:function(b){a.control.previewer.send("start_hovering_module",{id:a.id})}},{trigger:"mouseleave",selector:".czr-mod-header",name:"hovering_module",actions:function(b){a.control.previewer.send("stop_hovering_module",{id:a.id})}}],a.embedded.done(function(){a.czr_ModuleState.callbacks.add(function(){return a.setupModuleViewStateListeners.apply(a,arguments)}),api.CZR_Helpers.setupDOMListeners(a.view_event_map,{module:{id:a.id},dom_el:a.container},a)})},setModuleViewVisibility:function(a,b){var c=this;c.czr_ModuleState(!c.czr_ModuleState()),api.czrModulePanelState.set(!1),api.czrSekSettingsPanelState.set(!1),c.control.syncSektionModule().closeAllOtherSektions($(a.dom_event.currentTarget,a.dom_el))},sendEditModule:function(a){var b=this;b.control.previewer.send("edit_module",{id:b.id})},setupModuleViewStateListeners:function(a){var b=this;api.czr_isModuleExpanded=api.czr_isModuleExpanded||new api.Value,a?api.czr_isModuleExpanded(b):api.czr_isModuleExpanded(!1),$.when(b.toggleModuleViewExpansion(a)).done(function(){a?(b.renderModuleTitle(),b.populateSavedItemCollection()):b.czr_Item.each(function(a){a.czr_ItemState.set("closed"),a._destroyView(0),b.czr_Item.remove(a.id)})})},renderModuleTitle:function(){var a=this;if("resolved"!=a.moduleTitleEmbedded.state()){if(0===$("#tmpl-"+a.sektionModuleTitle).length)throw new Error("No sektion title Module Part template for module "+a.id+". The template script id should be : #tmpl-"+a.sektionModuleTitle);$.when($(a.container).find(".czr-mod-content").prepend($(wp.template(a.sektionModuleTitle)({id:a.id})))).done(function(){a.moduleTitleEmbedded.resolve()})}},toggleModuleViewExpansion:function(a,b){var c=this;$(".czr-mod-content",c.container).slideToggle({duration:b||200,done:function(){var b=c.container.closest(".wp-full-overlay"),d=c.container.find(".czr-module-back"),e=c.container.find(".czr-module-title");c.container.toggleClass("open",a),b.toggleClass("czr-module-open",a),e.attr("tabindex",a?"-1":"0"),d.attr("tabindex",a?"0":"-1"),a?d.focus():e.focus(),a&&c._adjustScrollExpandedBlock(c.container)}})},toggleModuleRemoveAlert:function(a){var b=this,c=this.control,d=$("."+b.control.css_attr.remove_alert_wrapper,b.container).first(),e=(a.dom_event,c.syncSektionModule().czr_Column(b.column_id).container);if(_.has(b,"preItem")&&c.syncSektionModule().preItemExpanded.set(!1),$("."+b.control.css_attr.remove_alert_wrapper,e).not(d).each(function(){$(this).hasClass("open")&&$(this).slideToggle({duration:200,done:function(){$(this).toggleClass("open",!1),$(this).siblings().find("."+b.control.css_attr.display_alert_btn).toggleClass("active",!1)}})}),!wp.template(b.AlertPart)||!b.container)throw new Error("No removal alert template available for module :"+b.id);d.html(wp.template(b.AlertPart)({title:b().title||b.id})),d.slideToggle({duration:200,done:function(){var c=!$(this).hasClass("open")&&$(this).is(":visible");$(this).toggleClass("open",c),$(a.dom_el).find("."+b.control.css_attr.display_alert_btn).toggleClass("active",c),c&&b._adjustScrollExpandedBlock(b.container)}})},removeModule:function(a){this.control.removeModule(a.module)},_getColumn:function(){var a=this;return a.control.syncSektionModule().czr_Column(a.modColumn())},_getSektion:function(){}}});var CZRMultiplePickerMths=CZRMultiplePickerMths||{};$.extend(CZRMultiplePickerMths,{ready:function(){var a=this,b=this.container.find("select");b.on("change",function(b){0===$(this).find("option:selected").length&&a.setting.set([])})}});var CZRCroppedImageMths=CZRCroppedImageMths||{};!function(a,b,c){"function"==typeof wp.media.controller.Cropper&&"function"==typeof a.CroppedImageControl&&(wp.media.controller.CZRCustomizeImageCropper=wp.media.controller.Cropper.extend({doCrop:function(a){var b=a.get("cropDetails"),c=this.get("control");return b.dst_width=c.params.dst_width,b.dst_height=c.params.dst_height,wp.ajax.post("crop-image",{wp_customize:"on",nonce:a.get("nonces").edit,id:a.get("id"),context:c.id,cropDetails:b})}}),b.extend(CZRCroppedImageMths,{initFrame:function(){var a=_wpMediaViewsL10n;this.frame=wp.media({button:{text:a.select,close:!1},states:[new wp.media.controller.Library({title:this.params.button_labels.frame_title,library:wp.media.query({type:"image"}),multiple:!1,date:!1,priority:20,suggestedWidth:this.params.width,suggestedHeight:this.params.height}),new wp.media.controller.CZRCustomizeImageCropper({imgSelectOptions:this.calculateImageSelectOptions,control:this})]}),this.frame.on("select",this.onSelect,this),this.frame.on("cropped",this.onCropped,this),this.frame.on("skippedcrop",this.onSkippedCrop,this)},onSelect:function(){var a=this.frame.state().get("selection").first().toJSON();return a.mime&&a.mime.indexOf("image")>-1?void(c.contains(["image/svg+xml","image/gif"],a.mime)||this.params.width===a.width&&this.params.height===a.height&&!this.params.flex_width&&!this.params.flex_height?(this.setImageFromAttachment(a),this.frame.close()):this.frame.setState("cropper")):void this.frame.trigger("content:error")}}))}(wp.customize,jQuery,_);var CZRUploadMths=CZRUploadMths||{};$.extend(CZRUploadMths,{ready:function(){var a=this;this.params.removed=this.params.removed||"",this.success=$.proxy(this.success,this),this.uploader=$.extend({container:this.container,browser:this.container.find(".czr-upload"),success:this.success,plupload:{},params:{}},this.uploader||{}),a.params.extensions&&(a.uploader.plupload.filters=[{title:api.l10n.allowedFiles,extensions:a.params.extensions}]),a.params.context&&(a.uploader.params["post_data[context]"]=this.params.context),api.settings.theme.stylesheet&&(a.uploader.params["post_data[theme]"]=api.settings.theme.stylesheet),this.uploader=new wp.Uploader(this.uploader),this.remover=this.container.find(".remove"),this.remover.on("click keydown",function(b){"keydown"===b.type&&13!==b.which||(a.setting.set(a.params.removed),b.preventDefault())}),this.removerVisibility=$.proxy(this.removerVisibility,this),this.setting.bind(this.removerVisibility),this.removerVisibility(this.setting())},success:function(a){this.setting.set(a.get("id"))},removerVisibility:function(a){this.remover.toggle(a!=this.params.removed)}});var CZRLayoutSelectMths=CZRLayoutSelectMths||{};$.extend(CZRLayoutSelectMths,{ready:function(){this.setupSelect()},setupSelect:function(a){function b(a){if(!a.id)return a.text;if(_.has(c.params.layouts,a.element.value)){var b=c.params.layouts[a.element.value],d=b.src,e=b.label,f=$('<img src="'+d+'" class="czr-layout-img" title="'+e+'" /><span class="czr-layout-title">'+e+"</span>");return f}}var c=this;$_select=this.container.find("select"),$_select.select2({templateResult:b,templateSelection:b,minimumResultsForSearch:1/0})}}),function(a,b,c){b.extend(CZRBaseControlMths,a.Events),b.extend(CZRModuleMths,a.Events),b.extend(CZRItemMths,a.Events),b.extend(CZRSkopeBaseMths,a.Events),b.extend(CZRSkopeMths,a.Events),b.extend(CZRBaseControlMths,a.CZR_Helpers),b.extend(CZRInputMths,a.CZR_Helpers),b.extend(CZRModuleMths,a.CZR_Helpers),b.extend(CZRSkopeMths,a.CZR_Helpers),a.CZR_skopeBase=a.Class.extend(CZRSkopeBaseMths),a.CZR_skopeSave=a.Class.extend(CZRSkopeSaveMths),a.CZR_skopeReset=a.Class.extend(CZRSkopeResetMths),a.CZR_skope=a.Value.extend(CZRSkopeMths),c.has(a,"HeaderTool")&&(a.czr_HeaderTool=b.extend(!0,{},a.HeaderTool)),a.CZRInput=a.Value.extend(CZRInputMths),a.CZRItem=a.Value.extend(CZRItemMths),a.CZRModule=a.Value.extend(CZRModuleMths),a.CZRDynModule=a.CZRModule.extend(CZRDynModuleMths),a.CZRColumn=a.Value.extend(CZRColumnMths),a.CZRBaseControl=a.Control.extend(CZRBaseControlMths),a.CZRBaseModuleControl=a.CZRBaseControl.extend(CZRBaseModuleControlMths),a.CZRMultiModuleControl=a.CZRBaseModuleControl.extend(CZRMultiModuleControlMths),a.CZRUploadControl=a.Control.extend(CZRUploadMths),a.CZRLayoutControl=a.Control.extend(CZRLayoutSelectMths),a.CZRMultiplePickerControl=a.Control.extend(CZRMultiplePickerMths),b.extend(a.controlConstructor,{czr_upload:a.CZRUploadControl,czr_module:a.CZRBaseModuleControl,czr_multi_module:a.CZRMultiModuleControl,czr_multiple_picker:a.CZRMultiplePickerControl,czr_layouts:a.CZRLayoutControl}),a.czrModuleMap=a.czrModuleMap||{},b.extend(a.czrModuleMap,{czr_widget_areas_module:{mthds:CZRWidgetAreaModuleMths,crud:!0,sektion_allowed:!1,name:"Widget Areas"},czr_social_module:{mthds:CZRSocialModuleMths,crud:!0,name:"Social Icons"},czr_sektion_module:{mthds:CZRSektionMths,crud:!0,name:"Sektions"},czr_fp_module:{mthds:CZRFeaturedPageModuleMths,crud:!0,name:"Featured Pages"},czr_slide_module:{mthds:CZRSlideModuleMths,crud:!0,name:"Slider"},czr_text_module:{mthds:CZRTextModuleMths,crud:!1,multi_item:!1,name:"Simple Text"},czr_text_editor_module:{mthds:CZRTextEditorModuleMths,crud:!1,multi_item:!1,name:"WP Text Editor"},czr_background:{mthds:CZRBodyBgModuleMths,crud:!1,multi_item:!1,name:"Slider"}}),"function"==typeof a.CroppedImageControl&&(a.CZRCroppedImageControl=a.CroppedImageControl.extend(CZRCroppedImageMths),b.extend(a.controlConstructor,{czr_cropped_image:a.CZRCroppedImageControl}))}(wp.customize,jQuery,_),function(a,b,c){var d=serverControlParams.translatedStrings||{};a.czr_CrtlDependenciesReady=b.Deferred(),a.bind("ready",function(){c.has(a,"czr_ctrlDependencies")||(serverControlParams.isSkopOn?a.czr_skopeReady.done(function(){a.czr_ctrlDependencies=new a.CZR_ctrlDependencies,a.czr_CrtlDependenciesReady.resolve()}):(a.czr_ctrlDependencies=new a.CZR_ctrlDependencies,a.czr_CrtlDependenciesReady.resolve()))}),a.CZR_ctrlDependencies=a.Class.extend({dominiDeps:[],initialize:function(){var b=this;if(this.defaultDominusParams={dominus:"",servi:[],visibility:null,actions:null,onSectionExpand:!0},this.dominiDeps=c.extend(this.dominiDeps,this._getControlDeps()),!c.isArray(b.dominiDeps))throw new Error("Visibilities : the dominos dependency array is not an array.");a.czr_activeSectionId.bind(function(d){!c.isEmpty(d)&&a.section.has(d)&&b.setServiDependencies(d)}),a.bind("awaken-section",function(d){serverControlParams.isSkopOn&&c.has(a,"czr_skopeBase")?a.czr_skopeBase.processSilentUpdates({candidates:{},section_id:d.target,refresh:!1}).then(function(){b.setServiDependencies(d.target,d.source)}):b.setServiDependencies(d.target,d.source)}),this._handleFaviconNote()},setServiDependencies:function(d,e,f){var g=this,h=b.Deferred();if(f=f||!1,c.isUndefined(d)||!a.section.has(d))throw new Error("Control Dependencies : the targetSectionId is missing or not registered : "+d);if(a.section(d).czr_ctrlDependenciesReady=a.section(d).czr_ctrlDependenciesReady||b.Deferred(),!f&&"resolved"==a.section(d).czr_ctrlDependenciesReady.state())return h.resolve().promise();c.each(g.dominiDeps,function(b){if(!c.has(b,"dominus")||!c.isString(b.dominus)||c.isEmpty(b.dominus))throw new Error("Control Dependencies : a dominus control id must be a not empty string.");var e=a.CZR_Helpers.build_setId(b.dominus);a.control(e).section()==d&&(b=g._prepareDominusParams(b),g._processDominusCallbacks(b.dominus,b,f).fail(function(){a.consoleLog("self._processDominusCallbacks fail for section "+d),h.reject()}).done(function(){h.resolve()}))});var i=a.CZR_Helpers.getSectionControlIds(d),j=function(a){var b=[];return c.each(g.dominiDeps,function(d){if(!c.has(d,"servi")||!c.isArray(d.servi)||!c.has(d,"dominus")||c.isEmpty(d.dominus))throw new Error("Control Dependencies : wrong params in _getServusDomini.");c.contains(d.servi,a)&&!c.contains(b,d.dominus)&&(d=g._prepareDominusParams(d),b.push(d.dominus))}),c.isArray(b)?b:[]},k=[];return c.each(i,function(a){c.isEmpty(j(a))||(k=c.union(k,j(a)))}),c.each(k,function(b){var c=a.CZR_Helpers.build_setId(b);a.control(c).section()!=d&&e!=a.control(c).section()&&a.trigger("awaken-section",{target:a.control(c).section(),source:d})}),h.always(function(){a.section(d).czr_ctrlDependenciesReady.resolve()}),h.promise()},_deferCallbackForControl:function(d,e,f){var g=b.Deferred();if(c.isEmpty(d)||!c.isString(d))throw new Error("_deferCallbackForControl : the control id is missing.");if(!c.isFunction(e))throw new Error("_deferCallbackForControl : callback must be a funtion.");return f=c.isUndefined(f)||!c.isArray(f)?[]:f,a.control.has(d)?"resolved"==a.control(d).deferred.embedded.state()?b.when(e.apply(null,f)).fail(function(){g.reject()}).done(function(){g.resolve()}):a.control(d).deferred.embedded.then(function(){b.when(e.apply(null,f)).fail(function(){g.reject()}).done(function(){g.resolve()})}):a.control.when(d,function(){a.control(d).deferred.embedded.then(function(){b.when(e.apply(null,f)).fail(function(){g.reject()}).done(function(){g.resolve()})})}),g.promise()},_processDominusCallbacks:function(d,e,f){var g=this,h=a.CZR_Helpers.build_setId(d),i=a(h),j=b.Deferred(),k=!1;return c.each(e.servi,function(b){if(a.control.has(a.CZR_Helpers.build_setId(b))){var d=function(a,b,d,e){var f=arguments;c.each(d,function(a,b){switch(b){case"visibility":g._setVisibility.apply(null,f);break;case"actions":c.isFunction(a)&&a.apply(null,f)}})},f=function(c){c=c||i();var f=a.CZR_Helpers.build_setId(b);g._deferCallbackForControl(f,d,[c,b,e]).always(function(){k=!0}).fail(function(){j.reject()}).done(function(){j.resolve()})};f(),c.has(i,"czr_visibilityServi")||(i.czr_visibilityServi=new a.Value([]));var h=i.czr_visibilityServi();c.contains(h,b)||(i.bind(function(a){f(a)}),i.czr_visibilityServi(c.union(h,[b])))}}),k?j.promise():j.resolve().promise()},_setVisibility:function(b,d,e,f){var g=a.CZR_Helpers.build_setId(d),h=e.visibility(b,d,e.dominus);if(f=f||!1,c.isBoolean(h)&&("unchanged"!=h||f)){var i=function(){a.state.has("silent-update-processing")&&!a.state("silent-update-processing")()&&(a.control(g,function(a){var b={duration:"fast",completeCallback:function(){},unchanged:!1};c.has(a,"active")&&(h=h&&a.active()),c.has(a,"defaultActiveArguments")&&(b=control.defaultActiveArguments),a.onChangeActive(h,a.defaultActiveArguments)}),a.state("silent-update-processing").unbind(i))};a.state.has("silent-update-processing")&&a.state("silent-update-processing")()?a.state("silent-update-processing").bind(i):i()}},_getControlDeps:function(){return{}},_prepareDominusParams:function(b){var d=this,e={};if(!c.isObject(b))throw new Error("Visibilities : a dominus param definition must be an object.");if(!c.has(b,"visibility")&&!c.has(b,"actions"))throw new Error("Visibilities : a dominus definition must include a visibility or an actions callback.");if(!c.has(b,"dominus")||!c.isString(b.dominus)||c.isEmpty(b.dominus))throw new Error("Visibilities : a dominus control id must be a not empty string.");var f=a.CZR_Helpers.build_setId(b.dominus);if(!a.control.has(f))throw new Error("Visibilities : a dominus control id is not registered : "+f);if(!c.has(b,"servi")||c.isUndefined(b.servi)||!c.isArray(b.servi)||c.isEmpty(b.servi))throw new Error("Visibilities : servi must be set as an array not empty.");return c.each(d.defaultDominusParams,function(a,d){var f=b[d];switch(d){case"visibility":if(!c.isUndefined(f)&&!c.isEmpty(f)&&!c.isFunction(f))throw new Error("Visibilities : a dominus visibility callback must be a function : "+b.dominus);break;case"actions":if(!c.isUndefined(f)&&!c.isEmpty(f)&&!c.isFunction(f))throw new Error("Visibilities : a dominus actions callback must be a function : "+b.dominus);break;case"onSectionExpand":if(!c.isUndefined(f)&&!c.isEmpty(f)&&!c.isBoolean(f))throw new Error("Visibilities : a dominus onSectionExpand param must be a boolean : "+b.dominus)}e[d]=f}),e},_handleFaviconNote:function(){var b=this,c=a.CZR_Helpers.build_setId(serverControlParams.faviconOptionName);if(!(!a.has("site_icon")||!a.control("site_icon")||a.has(c)&&0===+a(c)()||+a("site_icon")()>0)){var e=a.control("site_icon").params.description;_newDes=["<strong>",d.faviconNote||"","</strong><br/><br/>"].join("")+e,b._printFaviconNote(_newDes),a("site_icon").callbacks.add(function(d){+d>0?(a.control("site_icon").container.find(".description").text(e),a.has(c)&&a(c).set("")):b._printFaviconNote(_newDes)})}},_printFaviconNote:function(b){a.control("site_icon").container.find(".description").html(b)}})}(wp.customize,jQuery,_),function(a,b){b(function(b){function c(a){var c=a.siblings(".open");0!==c.length&&c.offset().top<0&&b(".wp-full-overlay-sidebar-content").animate({scrollTop:-b("#customize-theme-controls").offset().top-c.height()+a.offset().top+b(".wp-full-overlay-sidebar-content").offset().top},700)}var d=a.customize||d;b(".accordion-section").not(".control-panel").click(function(){c(b(this))}),d.czrSetupCheckbox=function(a,c){b("input[type=checkbox]",d.control(a).container).each(function(){0===b(this).val()||"0"==b(this).val()||"off"==b(this).val()||_.isEmpty(b(this).val())?b(this).prop("checked",!1):b(this).prop("checked",!0),0===b(this).closest('div[class^="icheckbox"]').length&&b(this).iCheck({checkboxClass:"icheckbox_flat-grey",radioClass:"iradio_flat-grey"}).on("ifChanged",function(a){b(this).val(!1===b(this).is(":checked")?0:1),b(a.currentTarget).trigger("change")})})},d.czrSetupSelect=function(a,c){b("select[data-customize-setting-link]",d.control(a).container).not(".no-selecter-js").each(function(){b(this).selecter({})})},d.czrSetupStepper=function(a,c){b('input[type="number"]',d.control(a).container).each(function(){b(this).stepper()})},d.control.each(function(a){_.has(a,"id")&&("widget_"!=a.id.substring(0,"widget_".length)&&"nav_menu"!=a.id.substring(0,"nav_menu".length)&&d.czrSetupCheckbox(a.id),"nav_menu_locations"!=a.id.substring(0,"nav_menu_locations".length)&&d.czrSetupSelect(a.id),d.czrSetupStepper(a.id))}),b(".control-panel-widgets").find(".accordion-section-title").first().length&&b(".control-panel-widgets").find(".accordion-section-title").first().prepend(b("<span/>",{"class":"fa fa-magic"}));var e=function(){var a=b("<span/>",{"class":"customize-controls-home fa fa-home",html:'<span class="screen-reader-text">Home</span>'});b.when(b("#customize-header-actions").append(a)).done(function(){a.keydown(function(a){9!==a.which&&(13===a.which&&this.click(),a.preventDefault())}).on("click.customize-controls-home",function(){d.section.has(d.czr_activeSectionId())?d.section(d.czr_activeSectionId()).expanded(!1):d.section.each(function(a){a.expanded(!1)}),d.panel.each(function(a){a.expanded(!1)})})})};e()})}(wp,jQuery);
assets/czr/js/czr-preview.js ADDED
@@ -0,0 +1,275 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Theme Customizer enhancements for a better user experience.
3
+ *
4
+ * Contains handlers to make Theme Customizer preview reload changes asynchronously.
5
+ * Things like site title, description, and background color changes
6
+ */
7
+ ( function( api, $, _ ) {
8
+
9
+ //HOW DOES THE PREVIEW POST MESSAGE REFRESH WORKS ?
10
+ //the control panel sends message with the postMessage jQuery method
11
+ //@see the send method of the Messenger Class
12
+ //this.previewer.send( 'setting', [ this.id, this() ] );
13
+
14
+ //the previewer listens to message send to the preview window
15
+ //@see receive method in the Messenger Class in customize-base
16
+ //$( window ).on( 'message', function(e, o) { console.log(e, o) })
17
+ //$( window ).on( 'message', this.receive );
18
+ //On reception an event is triggered with the setting.id as name and the message.data as args
19
+ //That's why it's possible to use api.bind( setting.id, callback(data) );
20
+
21
+ //TEST
22
+ // $( window ).on( 'message', function(e, o) {
23
+ // console.log('ON MESSAGE', e, o);
24
+ // });
25
+
26
+ //TEST => access any setting change with the setting event
27
+ // wp.customize.bind( 'preview-ready', function() {
28
+ // wp.customize.preview.bind('setting', function(e, o) {
29
+ // console.log('ON SETTING', e, o);
30
+ // });
31
+ // });
32
+
33
+
34
+ /////////////// SEND SKOPES
35
+ $( function() {
36
+ api.preview.bind( 'sync', function( events ) {
37
+ api.preview.send( 'czr-skopes-synced', {
38
+ czr_skopes : _wpCustomizeSettings.czr_skopes || [],
39
+ isChangesetDirty : _wpCustomizeSettings.isChangesetDirty || false,
40
+ skopeGlobalDBOpt : _wpCustomizeSettings.skopeGlobalDBOpt || [],
41
+ } );
42
+ });
43
+ });
44
+
45
+ /////////////// SETUP MODULES ACTIONS ON PREVIEW READY
46
+ wp.customize.bind( 'preview-ready', function() {
47
+ //SEKTIONS
48
+ wp.customize.preview.bind('edit_sek', function(o) {
49
+ if ( ! _.has( o, 'id') || ! $('[data-sek-id="' + o.id +'"]').length )
50
+ return;
51
+ $('html, body').animate({
52
+ scrollTop : $('[data-sek-id="' + o.id +'"]').offset().top - 50
53
+ }, 'slow');
54
+ });
55
+
56
+ wp.customize.preview.bind('start_hovering_sek', function(o) {
57
+ if ( ! _.has( o, 'id') || ! $('[data-sek-id="' + o.id +'"]').length )
58
+ return;
59
+ var $_sek = $('[data-sek-id="' + o.id +'"]'),
60
+ _width = $_sek.outerWidth(),
61
+ _height = $_sek.outerHeight();
62
+
63
+ //remove all previous hover placeholder from sektion
64
+ $_sek.closest('.czr-sektion').find('.czr-hover-placeholder').each( function(){ $(this).remove(); } );
65
+
66
+ //apply placeholder
67
+ $.when( $_sek.append( $( '<div/>', {
68
+ class : 'czr-hover-placeholder',
69
+ style : 'width:' + _width +'px;height:' + _height +'px;line-height:' + _height +'px;',
70
+ html : '<i class="material-icons">create</i>'
71
+ })
72
+ ) ).done( function() {
73
+ $('.czr-hover-placeholder').css('opacity', 1).fitText( 0.3, { minFontSize: '50px', maxFontSize: '100px' } );
74
+ });
75
+ });
76
+
77
+ wp.customize.preview.bind('stop_hovering_sek', function(o) {
78
+ if ( ! _.has( o, 'id') || ! $('[data-sek-id="' + o.id +'"]').length )
79
+ return;
80
+
81
+ var $_sek = $('[data-sek-id="' + o.id +'"]');
82
+ $.when( $_sek.find('.czr-hover-placeholder').fadeOut(200) ).done( function() {$_sek.find('.czr-hover-placeholder').remove(); });
83
+ });
84
+
85
+
86
+
87
+
88
+ //MODULES
89
+ wp.customize.preview.bind('edit_module', function(o) {
90
+ if ( ! _.has( o, 'id') || ! $('[data-module-id="' + o.id +'"]').length )
91
+ return;
92
+ $('html, body').animate({
93
+ scrollTop : $('[data-module-id="' + o.id +'"]').offset().top - 50
94
+ }, 'slow');
95
+ });
96
+
97
+ wp.customize.preview.bind('start_hovering_module', function(o) {
98
+ if ( ! _.has( o, 'id') || ! $('[data-module-id="' + o.id +'"]').length )
99
+ return;
100
+ var $_module = $('[data-module-id="' + o.id +'"]'),
101
+ _width = $_module.outerWidth(),
102
+ _height = $_module.outerHeight();
103
+
104
+ //remove all previous hover placeholder from sektion
105
+ $_module.closest('.czr-sektion').find('.czr-hover-placeholder').each( function(){ $(this).remove(); } );
106
+
107
+ //apply placeholder
108
+ $.when( $_module.append( $( '<div/>', {
109
+ class : 'czr-hover-placeholder',
110
+ style : 'width:' + _width +'px;height:' + _height +'px;line-height:' + _height +'px;',
111
+ html : '<i class="material-icons">create</i>'
112
+ })
113
+ ) ).done( function() {
114
+ $('.czr-hover-placeholder').css('opacity', 1).fitText( 0.3, { minFontSize: '50px', maxFontSize: '100px' } );
115
+ });
116
+ });
117
+
118
+ wp.customize.preview.bind('stop_hovering_module', function(o) {
119
+ if ( ! _.has( o, 'id') || ! $('[data-module-id="' + o.id +'"]').length )
120
+ return;
121
+
122
+ var $_module = $('[data-module-id="' + o.id +'"]');
123
+ $.when( $_module.find('.czr-hover-placeholder').fadeOut(200) ).done( function() {$_module.find('.czr-hover-placeholder').remove(); });
124
+ });
125
+ });
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+ /////////////// SEND UPDATED SERVER SIDE DATA TO THE PANEL
134
+ /////////////// SET REACTIONS ON PANEL SETTING CHANGES
135
+ //////////////////////////////////////////////////////////
136
+ if ( CZRPreviewParams && ! CZRPreviewParams.preview_ready_event_exists ) {
137
+ api.czr_preview = new api.CZR_preview();
138
+ }
139
+ else {
140
+ api.bind( 'preview-ready', function(){
141
+ //Talk with the panel when he informs us that the current preview frame is 'active'.
142
+ //We could also use the 'sync' event, just before 'active'.
143
+ api.preview.bind( 'active', function() {
144
+ api.czr_preview = new api.CZR_preview();
145
+ });
146
+ });
147
+ }
148
+
149
+ //FIRED ON API 'preview-ready'
150
+ api.CZR_preview = api.Class.extend( {
151
+ setting_cbs : {},
152
+ subsetting_cbs : {},//nested sub settings
153
+ _wp_sets : CZRPreviewParams.wpBuiltinSettings || [],
154
+ _theme_options_name : CZRPreviewParams.themeOptions,
155
+ initialize: function() {
156
+ var self = this;
157
+ //store the default control dependencies
158
+ this.setting_cbs = _.extend( self.setting_cbs, self.getSettingCbs() );
159
+ this.subsetting_cbs = _.extend( self.subsetting_cbs, self.getSubSettingCbs() );
160
+ this.syncData();
161
+ //api.trigger('czr-preview-ready');
162
+
163
+ this.addCbs();
164
+ //Remove this class if it's still there
165
+ //=> added since changeset update, WP 4.7
166
+ $( 'body' ).removeClass( 'wp-customizer-unloading' );
167
+ },
168
+ getSettingCbs : function() { return {}; },
169
+ getSubSettingCbs : function() { return {}; },
170
+ syncData : function() {
171
+ //send infos to panel
172
+ api.preview.send( 'czr-wp-conditional-ready', api.settings.czr_wp_conditionals );
173
+ api.preview.send( 'houston-widget-settings',
174
+ _.extend( _wpWidgetCustomizerPreviewSettings,
175
+ {
176
+ availableWidgetLocations : _.values( api.settings.availableWidgetLocations )
177
+ }
178
+ )
179
+ );
180
+ api.preview.send(
181
+ 'czr-partial-refresh',
182
+ typeof( undefined ) === typeof( _customizePartialRefreshExports ) ? {} : _customizePartialRefreshExports.partials
183
+ );
184
+
185
+ //TEST
186
+ //console.log('_wpCustomizeSettings', _wpCustomizeSettings, _wpCustomizeSettings.activeSections );
187
+ //console.log('_wpWidgetCustomizerPreviewSettings', _wpWidgetCustomizerPreviewSettings);
188
+ //console.log(' _customizePartialRefreshExports', _customizePartialRefreshExports);
189
+ //console.log(' IN PREVIEW : ', _wpCustomizeSettings );
190
+ },
191
+
192
+ addCbs : function() {
193
+ var self = this;
194
+ _.each( self.setting_cbs, function( _cb, _setId ) {
195
+ if ( ! api.has( self._build_setId(_setId) ) )
196
+ return;
197
+ api( self._build_setId(_setId) ).bind( self.setting_cbs[_setId] );
198
+ } );
199
+
200
+
201
+ //obj is : {
202
+ // set_id : this.id,
203
+ // model_id : obj.model.id,
204
+ // changed_prop : _changed,
205
+ // value : obj.model[_changed]
206
+ // }
207
+ api.preview.bind( 'sub_setting', function(obj) {
208
+ //first get the "nude" option name
209
+ var _opt_name = self._get_option_name( obj.set_id );
210
+
211
+ //do we have custom callbacks for this subsetting ?
212
+ if ( ! _.has(self.subsetting_cbs, _opt_name) )
213
+ return;
214
+
215
+ //do we have a custom callback for this model id ?
216
+ if ( ! _.has( self.subsetting_cbs[_opt_name], obj.changed_prop ) )
217
+ return;
218
+
219
+ //execute the cb
220
+ self.subsetting_cbs[_opt_name][obj.changed_prop]( obj );
221
+ });
222
+ },
223
+
224
+ /******************************************
225
+ * HELPERS
226
+ ******************************************/
227
+ /*
228
+ * @return string
229
+ * simple helper to build the setting id name if not a builtin wp setting id
230
+ */
231
+ _build_setId : function ( name ) {
232
+ var self = this;
233
+ //is wp built in ?
234
+ if ( _.contains( self._wp_sets, name ) )
235
+ return name;
236
+ //else
237
+ return -1 == name.indexOf( self._theme_options_name) ? [ self._theme_options_name + '[' , name , ']' ].join('') : name;
238
+ },
239
+
240
+ _get_option_name : function(name) {
241
+ var self = this;
242
+ return name.replace(/\[|\]/g, '').replace(self._theme_options_name, '');
243
+ },
244
+
245
+
246
+
247
+ /*
248
+ * @return boolean
249
+ */
250
+ _is_external : function( _href ) {
251
+ //EXT LINKS HELPERS
252
+ // var _url_comp = (location.host).split('.'),
253
+ // _nakedDomain = new RegExp( _url_comp[1] + "." + _url_comp[2] );
254
+ //gets main domain and extension, no matter if it is a n level sub domain
255
+ //works also with localhost or numeric urls
256
+ var _thisHref = $.trim( _href ),
257
+ _main_domain = (location.host).split('.').slice(-2).join('.'),
258
+ _reg = new RegExp( _main_domain );
259
+
260
+ if ( _thisHref !== '' && _thisHref != '#' && _isValidURL( _thisHref ) )
261
+ return ! _reg.test( _thisHref );
262
+ return;
263
+ },
264
+
265
+ /*
266
+ * @return boolean
267
+ */
268
+ _isValidURL : function(_url){
269
+ //var _pattern = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
270
+ var _pattern = /(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
271
+ return _pattern.test( _url );
272
+ }
273
+ });//api.Class.extend
274
+
275
+ } )( wp.customize, jQuery, _ );
assets/czr/js/czr-preview.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(a,b,c){b(function(){a.preview.bind("sync",function(b){a.preview.send("czr-skopes-synced",{czr_skopes:_wpCustomizeSettings.czr_skopes||[],isChangesetDirty:_wpCustomizeSettings.isChangesetDirty||!1,skopeGlobalDBOpt:_wpCustomizeSettings.skopeGlobalDBOpt||[]})})}),wp.customize.bind("preview-ready",function(){wp.customize.preview.bind("edit_sek",function(a){c.has(a,"id")&&b('[data-sek-id="'+a.id+'"]').length&&b("html, body").animate({scrollTop:b('[data-sek-id="'+a.id+'"]').offset().top-50},"slow")}),wp.customize.preview.bind("start_hovering_sek",function(a){if(c.has(a,"id")&&b('[data-sek-id="'+a.id+'"]').length){var d=b('[data-sek-id="'+a.id+'"]'),e=d.outerWidth(),f=d.outerHeight();d.closest(".czr-sektion").find(".czr-hover-placeholder").each(function(){b(this).remove()}),b.when(d.append(b("<div/>",{"class":"czr-hover-placeholder",style:"width:"+e+"px;height:"+f+"px;line-height:"+f+"px;",html:'<i class="material-icons">create</i>'}))).done(function(){b(".czr-hover-placeholder").css("opacity",1).fitText(.3,{minFontSize:"50px",maxFontSize:"100px"})})}}),wp.customize.preview.bind("stop_hovering_sek",function(a){if(c.has(a,"id")&&b('[data-sek-id="'+a.id+'"]').length){var d=b('[data-sek-id="'+a.id+'"]');b.when(d.find(".czr-hover-placeholder").fadeOut(200)).done(function(){d.find(".czr-hover-placeholder").remove()})}}),wp.customize.preview.bind("edit_module",function(a){c.has(a,"id")&&b('[data-module-id="'+a.id+'"]').length&&b("html, body").animate({scrollTop:b('[data-module-id="'+a.id+'"]').offset().top-50},"slow")}),wp.customize.preview.bind("start_hovering_module",function(a){if(c.has(a,"id")&&b('[data-module-id="'+a.id+'"]').length){var d=b('[data-module-id="'+a.id+'"]'),e=d.outerWidth(),f=d.outerHeight();d.closest(".czr-sektion").find(".czr-hover-placeholder").each(function(){b(this).remove()}),b.when(d.append(b("<div/>",{"class":"czr-hover-placeholder",style:"width:"+e+"px;height:"+f+"px;line-height:"+f+"px;",html:'<i class="material-icons">create</i>'}))).done(function(){b(".czr-hover-placeholder").css("opacity",1).fitText(.3,{minFontSize:"50px",maxFontSize:"100px"})})}}),wp.customize.preview.bind("stop_hovering_module",function(a){if(c.has(a,"id")&&b('[data-module-id="'+a.id+'"]').length){var d=b('[data-module-id="'+a.id+'"]');b.when(d.find(".czr-hover-placeholder").fadeOut(200)).done(function(){d.find(".czr-hover-placeholder").remove()})}})}),CZRPreviewParams&&!CZRPreviewParams.preview_ready_event_exists?a.czr_preview=new a.CZR_preview:a.bind("preview-ready",function(){a.preview.bind("active",function(){a.czr_preview=new a.CZR_preview})}),a.CZR_preview=a.Class.extend({setting_cbs:{},subsetting_cbs:{},_wp_sets:CZRPreviewParams.wpBuiltinSettings||[],_theme_options_name:CZRPreviewParams.themeOptions,initialize:function(){var a=this;this.setting_cbs=c.extend(a.setting_cbs,a.getSettingCbs()),this.subsetting_cbs=c.extend(a.subsetting_cbs,a.getSubSettingCbs()),this.syncData(),this.addCbs(),b("body").removeClass("wp-customizer-unloading")},getSettingCbs:function(){return{}},getSubSettingCbs:function(){return{}},syncData:function(){a.preview.send("czr-wp-conditional-ready",a.settings.czr_wp_conditionals),a.preview.send("houston-widget-settings",c.extend(_wpWidgetCustomizerPreviewSettings,{availableWidgetLocations:c.values(a.settings.availableWidgetLocations)})),a.preview.send("czr-partial-refresh","undefined"==typeof _customizePartialRefreshExports?{}:_customizePartialRefreshExports.partials)},addCbs:function(){var b=this;c.each(b.setting_cbs,function(c,d){a.has(b._build_setId(d))&&a(b._build_setId(d)).bind(b.setting_cbs[d])}),a.preview.bind("sub_setting",function(a){var d=b._get_option_name(a.set_id);c.has(b.subsetting_cbs,d)&&c.has(b.subsetting_cbs[d],a.changed_prop)&&b.subsetting_cbs[d][a.changed_prop](a)})},_build_setId:function(a){var b=this;return c.contains(b._wp_sets,a)?a:-1==a.indexOf(b._theme_options_name)?[b._theme_options_name+"[",a,"]"].join(""):a},_get_option_name:function(a){var b=this;return a.replace(/\[|\]/g,"").replace(b._theme_options_name,"")},_is_external:function(a){var c=b.trim(a),d=location.host.split(".").slice(-2).join("."),e=new RegExp(d);if(""!==c&&"#"!=c&&_isValidURL(c))return!e.test(c)},_isValidURL:function(a){var b=/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;return b.test(a)}})}(wp.customize,jQuery,_);
ha-fire.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Hueman Addons
4
  * Plugin URI: http://presscustomizr.com
5
  * Description: Hueman Theme Addons
6
- * Version: 1.0.9
7
  * Text Domain: hueman-addons
8
  * Author: Press Customizr
9
  * Author URI: http://presscustomizr.com
@@ -24,6 +24,8 @@ if ( ! class_exists( 'HU_AD' ) ) :
24
  public static $theme;
25
  public static $theme_name;
26
  public $is_customizing;
 
 
27
 
28
  public static function ha_get_instance() {
29
  if ( ! isset( self::$instance ) && ! ( self::$instance instanceof HU_AD ) )
@@ -35,6 +37,10 @@ if ( ! class_exists( 'HU_AD' ) ) :
35
  function __construct() {
36
  self::$instance =& $this;
37
 
 
 
 
 
38
  //checks if is customizing : two context, admin and front (preview frame)
39
  $this -> is_customizing = $this -> ha_is_customizing();
40
 
@@ -44,11 +50,11 @@ if ( ! class_exists( 'HU_AD' ) ) :
44
  if( ! defined( 'HA_BASE_PATH' ) ) define( 'HA_BASE_PATH' , plugin_dir_path( __FILE__ ) );
45
  if( ! defined( 'HA_BASE_URL' ) ) define( 'HA_BASE_URL' , trailingslashit( plugins_url( basename( __DIR__ ) ) ) );
46
 
47
- if( ! defined( 'HA_SKOP_ON' ) ) define( 'HA_SKOP_ON' , false );
48
  if( ! defined( 'HA_SEK_ON' ) ) define( 'HA_SEK_ON' , false );
49
 
50
- //stop execution if not Hueman
51
- if ( false === strpos( self::$theme_name, 'hueman' ) ) {
52
  add_action( 'admin_notices', array( $this , 'ha_admin_notice' ) );
53
  return;
54
  }
@@ -58,9 +64,9 @@ if ( ! class_exists( 'HU_AD' ) ) :
58
 
59
  //fire
60
  $this -> ha_load();
61
- }//construct
62
-
63
 
 
 
64
 
65
 
66
  function ha_load() {
@@ -81,8 +87,14 @@ if ( ! class_exists( 'HU_AD' ) ) :
81
  /* ------------------------------------------------------------------------- *
82
  * Loads BETAS
83
  /* ------------------------------------------------------------------------- */
84
- if ( HA_SKOP_ON ) {
85
- require_once( HA_BASE_PATH . 'inc/skop/init-skop.php' );
 
 
 
 
 
 
86
  }
87
  if ( HA_SEK_ON ) {
88
  require_once( HA_BASE_PATH . 'inc/sek/init-sektions.php' );
@@ -125,22 +137,25 @@ if ( ! class_exists( 'HU_AD' ) ) :
125
  }
126
 
127
 
128
-
129
  function ha_admin_notice() {
130
- $what = __( 'works only with the Hueman theme', 'hueman-addons' );
131
-
132
- ?>
133
- <div class="error">
134
- <p>
135
- <?php
136
- printf( __( 'The <strong>%1$s</strong> plugin %2$s.' ,'hueman-addons' ),
137
- 'Hueman Addons',
138
- $what
139
- );
140
- ?>
141
- </p>
142
- </div>
143
- <?php
 
 
 
144
  }
145
 
146
 
@@ -161,9 +176,12 @@ if ( ! class_exists( 'HU_AD' ) ) :
161
  * @since 3.3+
162
  */
163
  function ha_is_customize_preview_frame() {
164
- return ! is_admin() && isset($_REQUEST['wp_customize']);
165
  }
166
 
 
 
 
167
 
168
  /**
169
  * Always include wp_customize or customized in the custom ajax action triggered from the customizer
@@ -195,9 +213,89 @@ if ( ! class_exists( 'HU_AD' ) ) :
195
  ) );
196
  }
197
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  } //end of class
199
  endif;
200
 
 
 
 
 
 
 
 
 
201
  //Creates a new instance
202
  function HU_AD() {
203
  return HU_AD::ha_get_instance();
3
  * Plugin Name: Hueman Addons
4
  * Plugin URI: http://presscustomizr.com
5
  * Description: Hueman Theme Addons
6
+ * Version: 2.0.0
7
  * Text Domain: hueman-addons
8
  * Author: Press Customizr
9
  * Author URI: http://presscustomizr.com
24
  public static $theme;
25
  public static $theme_name;
26
  public $is_customizing;
27
+ public $last_theme_version_sync;
28
+ public $minimal_authorized_theme_version;
29
 
30
  public static function ha_get_instance() {
31
  if ( ! isset( self::$instance ) && ! ( self::$instance instanceof HU_AD ) )
37
  function __construct() {
38
  self::$instance =& $this;
39
 
40
+ //last version sync
41
+ $this -> last_theme_version_fmk_sync = '3.3.0';
42
+ $this -> minimal_authorized_theme_version = '3.3.0';
43
+
44
  //checks if is customizing : two context, admin and front (preview frame)
45
  $this -> is_customizing = $this -> ha_is_customizing();
46
 
50
  if( ! defined( 'HA_BASE_PATH' ) ) define( 'HA_BASE_PATH' , plugin_dir_path( __FILE__ ) );
51
  if( ! defined( 'HA_BASE_URL' ) ) define( 'HA_BASE_URL' , trailingslashit( plugins_url( basename( __DIR__ ) ) ) );
52
 
53
+ if( ! defined( 'HA_SKOP_ON' ) ) define( 'HA_SKOP_ON' , true );
54
  if( ! defined( 'HA_SEK_ON' ) ) define( 'HA_SEK_ON' , false );
55
 
56
+ //stop execution if not Hueman or if minimal version of Hueman is not installed
57
+ if ( false === strpos( self::$theme_name, 'hueman' ) || version_compare( self::$theme -> version, $this -> minimal_authorized_theme_version, '<' ) ) {
58
  add_action( 'admin_notices', array( $this , 'ha_admin_notice' ) );
59
  return;
60
  }
64
 
65
  //fire
66
  $this -> ha_load();
 
 
67
 
68
+ add_action('wp_head', array( $this, 'hu_admin_style') );
69
+ }//construct
70
 
71
 
72
  function ha_load() {
87
  /* ------------------------------------------------------------------------- *
88
  * Loads BETAS
89
  /* ------------------------------------------------------------------------- */
90
+ if ( $this -> ha_is_skop_on() ) {
91
+ if ( defined('TC_DEV') && true === TC_DEV ) {
92
+ if ( file_exists( HA_BASE_PATH . 'inc/skop/_dev/skop-x-fire.php' ) ) {
93
+ require_once( HA_BASE_PATH . 'inc/skop/_dev/skop-x-fire.php' );
94
+ }
95
+ } else {
96
+ require_once( HA_BASE_PATH . 'inc/skop/czr-skop.php' );
97
+ }
98
  }
99
  if ( HA_SEK_ON ) {
100
  require_once( HA_BASE_PATH . 'inc/sek/init-sektions.php' );
137
  }
138
 
139
 
140
+ //hook : admin_notices
141
  function ha_admin_notice() {
142
+ if ( version_compare( self::$theme -> version, $this -> minimal_authorized_theme_version, '<' ) ) {
143
+ $message = sprintf( __( 'This version of the <strong>%1$s</strong> plugin requires at least the version %2$s of the Hueman theme.', 'hueman-addons' ),
144
+ 'Hueman Addons',
145
+ $this -> minimal_authorized_theme_version
146
+ );
147
+ } else if ( false === strpos( self::$theme_name, 'hueman' ) ) {
148
+ $message = sprintf( __( 'The <strong>%1$s</strong> plugin %2$s.', 'hueman-addons' ),
149
+ 'Hueman Addons',
150
+ __( 'works only with the Hueman theme', 'hueman-addons' )
151
+ );
152
+ } else {
153
+ return;
154
+ }
155
+
156
+ ?>
157
+ <div class="error"><p><?php echo $message; ?></p></div>
158
+ <?php
159
  }
160
 
161
 
176
  * @since 3.3+
177
  */
178
  function ha_is_customize_preview_frame() {
179
+ return is_customize_preview() || ( ! is_admin() && isset($_REQUEST['customize_messenger_channel']) );
180
  }
181
 
182
+ function ha_is_previewing_live_changeset() {
183
+ return ! isset( $_POST['customize_messenger_channel']) && is_customize_preview();
184
+ }
185
 
186
  /**
187
  * Always include wp_customize or customized in the custom ajax action triggered from the customizer
213
  ) );
214
  }
215
 
216
+ //@return bool
217
+ //skop shall not be activated when previewing the theme from the customizer
218
+
219
+ function ha_is_skop_on() {
220
+ global $wp_version;
221
+ if ( $this -> ha_isprevdem() )
222
+ return;
223
+ return apply_filters( 'ha_is_skop_on', version_compare( $wp_version, '4.7', '>=' ) );
224
+ }
225
+
226
+
227
+ //Check the existence of the 'changeset_uuid' method in the WP_Customize_Manager to state if the changeset feature is
228
+ function ha_is_changeset_enabled( $wp_customize = null ) {
229
+ if ( $this -> ha_is_customizing() && ( is_null( $wp_customize ) || ! is_object( $wp_customize ) ) ) {
230
+ global $wp_customize;
231
+ }
232
+ return $this -> ha_is_customizing() && method_exists( $wp_customize, 'changeset_uuid');
233
+ }
234
+
235
+ //@return an array of unfiltered options
236
+ //=> all options or a single option val
237
+ function ha_get_raw_option( $opt_name = null, $opt_group = null ) {
238
+ $alloptions = wp_cache_get( 'alloptions', 'options' );
239
+ $alloptions = maybe_unserialize($alloptions);
240
+ if ( ! is_null( $opt_group ) && isset($alloptions[$opt_group]) ) {
241
+ $alloptions = maybe_unserialize($alloptions[$opt_group]);
242
+ }
243
+ if ( is_null( $opt_name ) )
244
+ return $alloptions;
245
+ return isset( $alloptions[$opt_name] ) ? maybe_unserialize($alloptions[$opt_name]) : false;
246
+ }
247
+
248
+ function ha_isprevdem() {
249
+ $_active_theme = $this -> ha_get_raw_option( 'template' );
250
+ return ( $_active_theme != strtolower('Hueman') );
251
+ }
252
+
253
+ //hook : wp_head
254
+ //only on front end and if user is logged-in
255
+ function hu_admin_style() {
256
+ ?>
257
+ <script type="text/javascript" id="ha-customize-btn">
258
+ jQuery( function($) {
259
+ $( "#wp-admin-bar-customize").find('a').attr('title', '<?php _e( "Customize this page !", "hueman-addons"); ?>' );
260
+ });
261
+ </script>
262
+ <style type="text/css" id="ha-fun-ab">
263
+ @-webkit-keyframes super-rainbow {
264
+ 0% { text-shadow : 0px 0px 2px;}
265
+ 20% { text-shadow : 0px 0px 5px; }
266
+ 40% { text-shadow : 0px 0px 10px; }
267
+ 60% { text-shadow : 0px 0px 13px }
268
+ 80% { text-shadow : 0px 0px 10px; }
269
+ 100% { text-shadow : 0px 0px 5px; }
270
+ }
271
+ @-moz-keyframes super-rainbow {
272
+ 0% { text-shadow : 0px 0px 2px;}
273
+ 20% { text-shadow : 0px 0px 5px; }
274
+ 40% { text-shadow : 0px 0px 10px; }
275
+ 60% { text-shadow : 0px 0px 13px }
276
+ 80% { text-shadow : 0px 0px 10px; }
277
+ 100% { text-shadow : 0px 0px 5px; }
278
+ }
279
+
280
+ #wp-admin-bar-customize .ab-item:before {
281
+ color:#7ECEFD;
282
+ -webkit-animation: super-rainbow 4s infinite linear;
283
+ -moz-animation: super-rainbow 4s infinite linear;
284
+ }
285
+ </style>
286
+ <?php
287
+ }
288
  } //end of class
289
  endif;
290
 
291
+
292
+ function ha_error_log( $data ) {
293
+ if ( ! defined('TC_DEV') || true !== TC_DEV )
294
+ return;
295
+ error_log( $data );
296
+ }
297
+
298
+
299
  //Creates a new instance
300
  function HU_AD() {
301
  return HU_AD::ha_get_instance();
inc/czr/ha-czr.php CHANGED
@@ -3,15 +3,24 @@ class HA_Czr {
3
  static $instance;
4
  function __construct() {
5
  self::$instance =& $this;
6
-
7
  //CUSTOMIZER PANEL JS
8
- add_action( 'customize_controls_print_footer_scripts', array( $this, 'hu_extend_visibilities' ), 100 );
9
  //Various DOM ready actions + print rate link + template
10
- add_action( 'customize_controls_print_footer_scripts' , array( $this, 'hu_various_dom_ready' ) );
11
  //control style
12
- add_action( 'customize_controls_enqueue_scripts' , array( $this, 'hu_customize_controls_js_css' ) );
 
 
 
 
 
 
 
 
13
  }
14
 
 
15
  /**************************************************************
16
  ** CUSTOMIZER
17
  **************************************************************/
@@ -23,15 +32,27 @@ class HA_Czr {
23
  * @since Hueman 3.3.0
24
  */
25
  function hu_customize_controls_js_css() {
26
-
27
  wp_enqueue_style(
28
- 'hu-czr-addons-controls-style',
29
- sprintf( '%1$sassets/czr/css/czr-control-footer.css', HA_BASE_URL ),
30
- array( 'customize-controls' ),
31
- time(),
32
- $media = 'all'
33
  );
34
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  }
36
 
37
 
@@ -89,7 +110,7 @@ class HA_Czr {
89
  var _is_checked = function( to ) {
90
  return 0 !== to && '0' !== to && false !== to && 'off' !== to;
91
  };
92
- api.CZR_ctrlDependencies.prototype.dominiDeps = _.extend(
93
  api.CZR_ctrlDependencies.prototype.dominiDeps,
94
  [
95
  {
3
  static $instance;
4
  function __construct() {
5
  self::$instance =& $this;
6
+ add_action( 'customize_register' , array( $this, 'ha_augment_customizer_setting') );//extend WP_Customize_Setting
7
  //CUSTOMIZER PANEL JS
8
+ add_action( 'customize_controls_print_footer_scripts' , array( $this, 'hu_extend_visibilities' ), 100 );
9
  //Various DOM ready actions + print rate link + template
10
+ add_action( 'customize_controls_print_footer_scripts' , array( $this, 'hu_various_dom_ready' ) );
11
  //control style
12
+ add_action( 'customize_controls_enqueue_scripts' , array( $this, 'hu_customize_controls_js_css' ), 20 );
13
+ }
14
+
15
+
16
+ //hook : customize_register
17
+ function ha_augment_customizer_setting() {
18
+ if ( ! HU_AD() -> ha_is_skop_on() )
19
+ return;
20
+ require_once( HA_BASE_PATH . 'inc/czr/skop-customizer-augment-setting.php' );
21
  }
22
 
23
+
24
  /**************************************************************
25
  ** CUSTOMIZER
26
  **************************************************************/
32
  * @since Hueman 3.3.0
33
  */
34
  function hu_customize_controls_js_css() {
35
+ //Hueman Addons Specifics
36
  wp_enqueue_style(
37
+ 'ha-czr-addons-controls-style',
38
+ sprintf( '%1$sassets/czr/css/czr-control-footer.css', HA_BASE_URL ),
39
+ array( 'customize-controls' ),
40
+ time(),
41
+ $media = 'all'
42
  );
43
 
44
+ //Enqueue most recent fmk for js and css
45
+ $hu_theme = wp_get_theme();
46
+ if ( true == version_compare( $hu_theme -> version, HU_AD() -> last_theme_version_fmk_sync, '<' ) ) {
47
+ $wp_styles = wp_styles();
48
+ $wp_scripts = wp_scripts();
49
+ if ( isset( $wp_styles->registered['hu-customizer-controls-style'] ) ) {
50
+ $wp_styles->registered['hu-customizer-controls-style'] -> src = sprintf( '%1$s/assets/czr/css/czr-control%2$s.css' , HA_BASE_URL, ( defined('WP_DEBUG') && true === WP_DEBUG ) ? '' : '.min' );
51
+ }
52
+ if ( isset( $wp_scripts->registered['hu-customizer-controls'] ) ) {
53
+ $wp_scripts->registered['hu-customizer-controls'] -> src = sprintf('%1$s/assets/czr/js/czr-control%2$s.js' , HA_BASE_URL, ( defined('WP_DEBUG') && true === WP_DEBUG ) ? '' : '.min' );
54
+ }
55
+ }
56
  }
57
 
58
 
110
  var _is_checked = function( to ) {
111
  return 0 !== to && '0' !== to && false !== to && 'off' !== to;
112
  };
113
+ api.CZR_ctrlDependencies.prototype.dominiDeps = _.union(
114
  api.CZR_ctrlDependencies.prototype.dominiDeps,
115
  [
116
  {
inc/{skop/skop-customizer-augment.php → czr/skop-customizer-augment-setting.php} RENAMED
@@ -88,7 +88,7 @@ final class HA_Customize_Header_Image_Data_Setting extends WP_Customize_Setting
88
  if ( false != $_POST['opt_name'] ) {
89
  $db_option_name = esc_attr( $_POST['opt_name'] );
90
  $obj_id = ( isset( $_POST['obj_id'] ) && false != $_POST['obj_id'] ) ? esc_attr( $_POST['obj_id'] ) : null;
91
- HA_SKOP_OPT() -> ha_set_skope_option_val( 'header_image', $choice['url'], $db_option_name, $this->type, $obj_id );
92
  }
93
  //set_theme_mod( 'header_image', $choice['url'] );
94
  //set_theme_mod( 'header_image_data', $header_image_data );
@@ -99,7 +99,7 @@ final class HA_Customize_Header_Image_Data_Setting extends WP_Customize_Setting
99
  if ( false != $_POST['opt_name'] ) {
100
  $db_option_name = esc_attr( $_POST['opt_name'] );
101
  $obj_id = ( isset( $_POST['obj_id'] ) && false != $_POST['obj_id'] ) ? esc_attr( $_POST['obj_id'] ) : null;
102
- HA_SKOP_OPT() -> ha_set_skope_option_val( 'header_image', $choice, $db_option_name, $this->type, $obj_id );
103
  }
104
  //set_theme_mod( 'header_image', $choice );
105
  //remove_theme_mod( 'header_image_data' );
88
  if ( false != $_POST['opt_name'] ) {
89
  $db_option_name = esc_attr( $_POST['opt_name'] );
90
  $obj_id = ( isset( $_POST['obj_id'] ) && false != $_POST['obj_id'] ) ? esc_attr( $_POST['obj_id'] ) : null;
91
+ HA_SKOP_OPT() -> ha_set_skope_option_val( 'header_image', $choice['url'], $db_option_name );
92
  }
93
  //set_theme_mod( 'header_image', $choice['url'] );
94
  //set_theme_mod( 'header_image_data', $header_image_data );
99
  if ( false != $_POST['opt_name'] ) {
100
  $db_option_name = esc_attr( $_POST['opt_name'] );
101
  $obj_id = ( isset( $_POST['obj_id'] ) && false != $_POST['obj_id'] ) ? esc_attr( $_POST['obj_id'] ) : null;
102
+ HA_SKOP_OPT() -> ha_set_skope_option_val( 'header_image', $choice, $db_option_name );
103
  }
104
  //set_theme_mod( 'header_image', $choice );
105
  //remove_theme_mod( 'header_image_data' );
inc/sek/assets/js/dom-autoscroller.js DELETED
@@ -1,287 +0,0 @@
1
- (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.autoScroller = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
- var createPointCB = require('create-point-cb');
3
-
4
- /*
5
- git remote add origin https://github.com/hollowdoor/dom_autoscroller.git
6
- git push -u origin master
7
- */
8
-
9
-
10
-
11
- function AutoScroller(elements, options){
12
- var self = this, pixels = 2;
13
- options = options || {};
14
-
15
- this.margin = options.margin || -1;
16
- this.scrolling = false;
17
- this.scrollWhenOutside = options.scrollWhenOutside || false;
18
-
19
- var point = {}, pointCB = createPointCB(point), down = false;
20
-
21
- window.addEventListener('mousemove', pointCB, false);
22
- window.addEventListener('touchmove', pointCB, false);
23
-
24
- if(!isNaN(options.pixels)){
25
- pixels = options.pixels;
26
- }
27
-
28
- if(typeof options.autoScroll === 'boolean'){
29
- this.autoScroll = options.autoScroll ? function(){return true;} : function(){return false;};
30
- }else if(typeof options.autoScroll === 'undefined'){
31
- this.autoScroll = function(){return false;};
32
- }else if(typeof options.autoScroll === 'function'){
33
- this.autoScroll = options.autoScroll;
34
- }
35
-
36
- this.destroy = function() {
37
- window.removeEventListener('mousemove', pointCB, false);
38
- window.removeEventListener('touchmove', pointCB, false);
39
- window.removeEventListener('mousedown', onDown, false);
40
- window.removeEventListener('touchstart', onDown, false);
41
- window.removeEventListener('mouseup', onUp, false);
42
- window.removeEventListener('touchend', onUp, false);
43
- };
44
-
45
- var hasWindow = null, temp = [];
46
- for(var i=0; i<elements.length; i++){
47
- if(elements[i] === window){
48
- hasWindow = window;
49
- break;
50
- }else{
51
- temp.push(elements[i])
52
- }
53
- }
54
-
55
- elements = temp;
56
- temp = null;
57
-
58
- Object.defineProperties(this, {
59
- down: {
60
- get: function(){ return down; }
61
- },
62
- interval: {
63
- get: function(){ return 1/pixels * 1000; }
64
- },
65
- pixels: {
66
- set: function(i){ pixels = i; },
67
- get: function(){ return pixels; }
68
- }
69
- });
70
-
71
- window.addEventListener('mousedown', onDown, false);
72
- window.addEventListener('touchstart', onDown, false);
73
- window.addEventListener('mouseup', onUp, false);
74
- window.addEventListener('touchend', onUp, false);
75
-
76
- function onDown(){
77
- down = true;
78
- }
79
-
80
- function onUp(){
81
- down = false;
82
- }
83
-
84
- var n = 0, current;
85
-
86
- window.addEventListener('mousemove', onMove, false);
87
- window.addEventListener('touchmove', onMove, false);
88
-
89
- function onMove(event){
90
-
91
- if(!self.autoScroll()) return;
92
- if(!event.target) return;
93
- var target = event.target, last;
94
-
95
- if(!current || !inside(point, current)){
96
- if(!current && target){
97
- current = null;
98
- while(target = target.parentNode){
99
- for(var i=0; i<elements.length; i++){
100
- if(elements[i] === target && inside(point, elements[i])){
101
- current = elements[i];
102
- break;
103
- }
104
- }
105
- }
106
- }else{
107
- last = current;
108
- current = null;
109
- for(var i=0; i<elements.length; i++){
110
- if(elements[i] !== last && inside(point, elements[i])){
111
- current = elements[i];
112
- }
113
- }
114
- }
115
- }
116
-
117
- if(hasWindow){
118
- autoScroll(hasWindow);
119
- }
120
- if(!current) return;
121
-
122
- autoScroll(current);
123
- }
124
-
125
- function autoScroll(el){
126
- var rect = getRect(el);
127
-
128
- if(point.y < rect.top + self.margin){
129
- autoScrollV(el, -1, rect);
130
- }else if(point.y > rect.bottom - self.margin){
131
- autoScrollV(el, 1, rect);
132
- }
133
-
134
- if(point.x < rect.left + self.margin){
135
- autoScrollH(el, -1, rect);
136
- }else if(point.x > rect.right - self.margin){
137
- autoScrollH(el, 1, rect);
138
- }
139
- }
140
-
141
-
142
-
143
- function autoScrollV(el, amount, rect){
144
- if(!self.autoScroll()) return;
145
- if(!self.scrollWhenOutside && !inside(point, el, rect)) return;
146
-
147
- if(el === window){
148
- window.scrollTo(el.pageXOffset, el.pageYOffset + amount);
149
- }else{
150
-
151
- el.scrollTop = el.scrollTop + amount;
152
- }
153
-
154
- setTimeout(function(){
155
- if(point.y < rect.top + self.margin){
156
- autoScrollV(el, amount, rect);
157
- }else if(point.y > rect.bottom - self.margin){
158
- autoScrollV(el, amount, rect);
159
- }
160
- }, self.interval);
161
- }
162
-
163
- function autoScrollH(el, amount, rect){
164
-
165
- if(!self.autoScroll()) return;
166
- if(!self.scrollWhenOutside && !inside(point, el, rect)) return;
167
-
168
- if(el === window){
169
- window.scrollTo(el.pageXOffset + amount, el.pageYOffset);
170
- }else{
171
- el.scrollLeft = el.scrollLeft + amount;
172
- }
173
-
174
- setTimeout(function(){
175
- if(point.x < rect.left + self.margin){
176
- autoScrollH(el, amount, rect);
177
- }else if(point.x > rect.right - self.margin){
178
- autoScrollH(el, amount, rect);
179
- }
180
- }, self.interval);
181
- }
182
-
183
- }
184
-
185
- module.exports = function AutoScrollerFactory(element, options){
186
- return new AutoScroller(element, options);
187
- };
188
-
189
- function getRect(el){
190
- if(el === window){
191
- return {
192
- top: 0,
193
- left: 0,
194
- right: window.innerWidth,
195
- bottom: window.innerHeight,
196
- width: window.innerWidth,
197
- height: window.innerHeight
198
- };
199
-
200
- }else{
201
- try{
202
- return el.getBoundingClientRect();
203
- }catch(e){
204
- throw new TypeError("Can't call getBoundingClientRect on "+el);
205
- }
206
-
207
- }
208
- }
209
-
210
- function inside(point, el, rect){
211
- rect = rect || getRect(el);
212
- return (point.y > rect.top && point.y < rect.bottom &&
213
- point.x > rect.left && point.x < rect.right);
214
- }
215
-
216
- },{"create-point-cb":2}],2:[function(require,module,exports){
217
- module.exports = function createPointCB(object){
218
-
219
- // A persistent object (as opposed to returned object) is used to save memory
220
- // This is good to prevent layout thrashing, or for games, and such
221
-
222
- // NOTE
223
- // This uses IE fixes which should be OK to remove some day. :)
224
- // Some speed will be gained by removal of these.
225
-
226
- // pointCB should be saved in a variable on return
227
- // This allows the usage of element.removeEventListener
228
-
229
- return function pointCB(event){
230
-
231
- event = event || window.event; // IE-ism
232
- object.target = event.target || event.srcElement || event.originalTarget;
233
- object.element = this;
234
- object.type = event.type;
235
-
236
- // Support touch
237
- // http://www.creativebloq.com/javascript/make-your-site-work-touch-devices-51411644
238
-
239
- if(event.targetTouches){
240
- object.x = event.targetTouches[0].clientX;
241
- object.y = event.targetTouches[0].clientY;
242
- object.pageX = event.pageX;
243
- object.pageY = event.pageY;
244
- }else{
245
-
246
- // If pageX/Y aren't available and clientX/Y are,
247
- // calculate pageX/Y - logic taken from jQuery.
248
- // (This is to support old IE)
249
- // NOTE Hopefully this can be removed soon.
250
-
251
- if (event.pageX === null && event.clientX !== null) {
252
- var eventDoc = (event.target && event.target.ownerDocument) || document;
253
- var doc = eventDoc.documentElement;
254
- var body = eventDoc.body;
255
-
256
- object.pageX = event.clientX +
257
- (doc && doc.scrollLeft || body && body.scrollLeft || 0) -
258
- (doc && doc.clientLeft || body && body.clientLeft || 0);
259
- object.pageY = event.clientY +
260
- (doc && doc.scrollTop || body && body.scrollTop || 0) -
261
- (doc && doc.clientTop || body && body.clientTop || 0 );
262
- }else{
263
- object.pageX = event.pageX;
264
- object.pageY = event.pageY;
265
- }
266
-
267
- // pageX, and pageY change with page scroll
268
- // so we're not going to use those for x, and y.
269
- // NOTE Most browsers also alias clientX/Y with x/y
270
- // so that's something to consider down the road.
271
-
272
- object.x = event.clientX;
273
- object.y = event.clientY;
274
- }
275
-
276
- };
277
-
278
- //NOTE Remember accessibility, Aria roles, and labels.
279
- };
280
-
281
- /*
282
- git remote add origin https://github.com/hollowdoor/create_point_cb.git
283
- git push -u origin master
284
- */
285
-
286
- },{}]},{},[1])(1)
287
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/sek/assets/js/dom-autoscroller.min.js DELETED
@@ -1,6 +0,0 @@
1
- (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.autoScroller = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
- function AutoScroller(e,t){function n(){w=!0}function o(){w=!1}function i(t){if(s.autoScroll()&&t.target){var n,o=t.target;if(!h||!inside(c,h))if(!h&&o){for(h=null;o=o.parentNode;)for(var i=0;i<e.length;i++)if(e[i]===o&&inside(c,e[i])){h=e[i];break}}else{n=h,h=null;for(var i=0;i<e.length;i++)e[i]!==n&&inside(c,e[i])&&(h=e[i])}f&&r(f),h&&r(h)}}function r(e){var t=getRect(e);c.y<t.top+s.margin?l(e,-1,t):c.y>t.bottom-s.margin&&l(e,1,t),c.x<t.left+s.margin?u(e,-1,t):c.x>t.right-s.margin&&u(e,1,t)}function l(e,t,n){s.autoScroll()&&(s.scrollWhenOutside||inside(c,e,n))&&(e===window?window.scrollTo(e.pageXOffset,e.pageYOffset+t):e.scrollTop=e.scrollTop+t,setTimeout(function(){c.y<n.top+s.margin?l(e,t,n):c.y>n.bottom-s.margin&&l(e,t,n)},s.interval))}function u(e,t,n){s.autoScroll()&&(s.scrollWhenOutside||inside(c,e,n))&&(e===window?window.scrollTo(e.pageXOffset+t,e.pageYOffset):e.scrollLeft=e.scrollLeft+t,setTimeout(function(){c.x<n.left+s.margin?u(e,t,n):c.x>n.right-s.margin&&u(e,t,n)},s.interval))}var s=this,d=2;t=t||{},this.margin=t.margin||-1,this.scrolling=!1,this.scrollWhenOutside=t.scrollWhenOutside||!1;var c={},a=createPointCB(c),w=!1;window.addEventListener("mousemove",a,!1),window.addEventListener("touchmove",a,!1),isNaN(t.pixels)||(d=t.pixels),"boolean"==typeof t.autoScroll?this.autoScroll=t.autoScroll?function(){return!0}:function(){return!1}:"undefined"==typeof t.autoScroll?this.autoScroll=function(){return!1}:"function"==typeof t.autoScroll&&(this.autoScroll=t.autoScroll),this.destroy=function(){window.removeEventListener("mousemove",a,!1),window.removeEventListener("touchmove",a,!1),window.removeEventListener("mousedown",n,!1),window.removeEventListener("touchstart",n,!1),window.removeEventListener("mouseup",o,!1),window.removeEventListener("touchend",o,!1)};for(var f=null,v=[],g=0;g<e.length;g++){if(e[g]===window){f=window;break}v.push(e[g])}e=v,v=null,Object.defineProperties(this,{down:{get:function(){return w}},interval:{get:function(){return 1/d*1e3}},pixels:{set:function(e){d=e},get:function(){return d}}}),window.addEventListener("mousedown",n,!1),window.addEventListener("touchstart",n,!1),window.addEventListener("mouseup",o,!1),window.addEventListener("touchend",o,!1);var h;window.addEventListener("mousemove",i,!1),window.addEventListener("touchmove",i,!1)}function getRect(e){if(e===window)return{top:0,left:0,right:window.innerWidth,bottom:window.innerHeight,width:window.innerWidth,height:window.innerHeight};try{return e.getBoundingClientRect()}catch(t){throw new TypeError("Can't call getBoundingClientRect on "+e)}}function inside(e,t,n){return n=n||getRect(t),e.y>n.top&&e.y<n.bottom&&e.x>n.left&&e.x<n.right}var createPointCB=require("create-point-cb");module.exports=function(e,t){return new AutoScroller(e,t)};
3
- },{"create-point-cb":2}],2:[function(require,module,exports){
4
- module.exports=function(e){return function(t){if(t=t||window.event,e.target=t.target||t.srcElement||t.originalTarget,e.element=this,e.type=t.type,t.targetTouches)e.x=t.targetTouches[0].clientX,e.y=t.targetTouches[0].clientY,e.pageX=t.pageX,e.pageY=t.pageY;else{if(null===t.pageX&&null!==t.clientX){var l=t.target&&t.target.ownerDocument||document,n=l.documentElement,c=l.body;e.pageX=t.clientX+(n&&n.scrollLeft||c&&c.scrollLeft||0)-(n&&n.clientLeft||c&&c.clientLeft||0),e.pageY=t.clientY+(n&&n.scrollTop||c&&c.scrollTop||0)-(n&&n.clientTop||c&&c.clientTop||0)}else e.pageX=t.pageX,e.pageY=t.pageY;e.x=t.clientX,e.y=t.clientY}}};
5
- },{}]},{},[1])(1)
6
- });
 
 
 
 
 
 
inc/sek/assets/js/dragula.min.js DELETED
@@ -1,905 +0,0 @@
1
- (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.dragula = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
- 'use strict';
3
-
4
- var cache = {};
5
- var start = '(?:^|\\s)';
6
- var end = '(?:\\s|$)';
7
-
8
- function lookupClass (className) {
9
- var cached = cache[className];
10
- if (cached) {
11
- cached.lastIndex = 0;
12
- } else {
13
- cache[className] = cached = new RegExp(start + className + end, 'g');
14
- }
15
- return cached;
16
- }
17
-
18
- function addClass (el, className) {
19
- var current = el.className;
20
- if (!current.length) {
21
- el.className = className;
22
- } else if (!lookupClass(className).test(current)) {
23
- el.className += ' ' + className;
24
- }
25
- }
26
-
27
- function rmClass (el, className) {
28
- el.className = el.className.replace(lookupClass(className), ' ').trim();
29
- }
30
-
31
- module.exports = {
32
- add: addClass,
33
- rm: rmClass
34
- };
35
-
36
- },{}],2:[function(require,module,exports){
37
- (function (global){
38
- 'use strict';
39
-
40
- var emitter = require('contra/emitter');
41
- var crossvent = require('crossvent');
42
- var classes = require('./classes');
43
- var doc = document;
44
- var documentElement = doc.documentElement;
45
-
46
- function dragula (initialContainers, options) {
47
- var len = arguments.length;
48
- if (len === 1 && Array.isArray(initialContainers) === false) {
49
- options = initialContainers;
50
- initialContainers = [];
51
- }
52
- var _mirror; // mirror image
53
- var _source; // source container
54
- var _item; // item being dragged
55
- var _offsetX; // reference x
56
- var _offsetY; // reference y
57
- var _moveX; // reference move x
58
- var _moveY; // reference move y
59
- var _initialSibling; // reference sibling when grabbed
60
- var _currentSibling; // reference sibling now
61
- var _copy; // item used for copying
62
- var _renderTimer; // timer for setTimeout renderMirrorImage
63
- var _lastDropTarget = null; // last container item was over
64
- var _grabbed; // holds mousedown context until first mousemove
65
-
66
- var o = options || {};
67
- if (o.moves === void 0) { o.moves = always; }
68
- if (o.accepts === void 0) { o.accepts = always; }
69
- if (o.invalid === void 0) { o.invalid = invalidTarget; }
70
- if (o.containers === void 0) { o.containers = initialContainers || []; }
71
- if (o.isContainer === void 0) { o.isContainer = never; }
72
- if (o.copy === void 0) { o.copy = false; }
73
- if (o.copySortSource === void 0) { o.copySortSource = false; }
74
- if (o.revertOnSpill === void 0) { o.revertOnSpill = false; }
75
- if (o.removeOnSpill === void 0) { o.removeOnSpill = false; }
76
- if (o.direction === void 0) { o.direction = 'vertical'; }
77
- if (o.ignoreInputTextSelection === void 0) { o.ignoreInputTextSelection = true; }
78
- if (o.mirrorContainer === void 0) { o.mirrorContainer = doc.body; }
79
-
80
- var drake = emitter({
81
- containers: o.containers,
82
- start: manualStart,
83
- end: end,
84
- cancel: cancel,
85
- remove: remove,
86
- destroy: destroy,
87
- canMove: canMove,
88
- dragging: false
89
- });
90
-
91
- if (o.removeOnSpill === true) {
92
- drake.on('over', spillOver).on('out', spillOut);
93
- }
94
-
95
- events();
96
-
97
- return drake;
98
-
99
- function isContainer (el) {
100
- return drake.containers.indexOf(el) !== -1 || o.isContainer(el);
101
- }
102
-
103
- function events (remove) {
104
- var op = remove ? 'remove' : 'add';
105
- touchy(documentElement, op, 'mousedown', grab);
106
- touchy(documentElement, op, 'mouseup', release);
107
- }
108
-
109
- function eventualMovements (remove) {
110
- var op = remove ? 'remove' : 'add';
111
- touchy(documentElement, op, 'mousemove', startBecauseMouseMoved);
112
- }
113
-
114
- function movements (remove) {
115
- var op = remove ? 'remove' : 'add';
116
- crossvent[op](documentElement, 'selectstart', preventGrabbed); // IE8
117
- crossvent[op](documentElement, 'click', preventGrabbed);
118
- }
119
-
120
- function destroy () {
121
- events(true);
122
- release({});
123
- }
124
-
125
- function preventGrabbed (e) {
126
- if (_grabbed) {
127
- e.preventDefault();
128
- }
129
- }
130
-
131
- function grab (e) {
132
- _moveX = e.clientX;
133
- _moveY = e.clientY;
134
-
135
- var ignore = whichMouseButton(e) !== 1 || e.metaKey || e.ctrlKey;
136
- if (ignore) {
137
- return; // we only care about honest-to-god left clicks and touch events
138
- }
139
- var item = e.target;
140
- var context = canStart(item);
141
- if (!context) {
142
- return;
143
- }
144
- _grabbed = context;
145
- eventualMovements();
146
- if (e.type === 'mousedown') {
147
- if (isInput(item)) { // see also: https://github.com/bevacqua/dragula/issues/208
148
- item.focus(); // fixes https://github.com/bevacqua/dragula/issues/176
149
- } else {
150
- e.preventDefault(); // fixes https://github.com/bevacqua/dragula/issues/155
151
- }
152
- }
153
- }
154
-
155
- function startBecauseMouseMoved (e) {
156
- if (!_grabbed) {
157
- return;
158
- }
159
- if (whichMouseButton(e) === 0) {
160
- release({});
161
- return; // when text is selected on an input and then dragged, mouseup doesn't fire. this is our only hope
162
- }
163
- // truthy check fixes #239, equality fixes #207
164
- if (e.clientX !== void 0 && e.clientX === _moveX && e.clientY !== void 0 && e.clientY === _moveY) {
165
- return;
166
- }
167
- if (o.ignoreInputTextSelection) {
168
- var clientX = getCoord('clientX', e);
169
- var clientY = getCoord('clientY', e);
170
- var elementBehindCursor = doc.elementFromPoint(clientX, clientY);
171
- if (isInput(elementBehindCursor)) {
172
- return;
173
- }
174
- }
175
-
176
- var grabbed = _grabbed; // call to end() unsets _grabbed
177
- eventualMovements(true);
178
- movements();
179
- end();
180
- start(grabbed);
181
-
182
- var offset = getOffset(_item);
183
- _offsetX = getCoord('pageX', e) - offset.left;
184
- _offsetY = getCoord('pageY', e) - offset.top;
185
-
186
- classes.add(_copy || _item, 'gu-transit');
187
- renderMirrorImage();
188
- drag(e);
189
- }
190
-
191
- function canStart (item) {
192
- if (drake.dragging && _mirror) {
193
- return;
194
- }
195
- if (isContainer(item)) {
196
- return; // don't drag container itself
197
- }
198
- var handle = item;
199
- while (getParent(item) && isContainer(getParent(item)) === false) {
200
- if (o.invalid(item, handle)) {
201
- return;
202
- }
203
- item = getParent(item); // drag target should be a top element
204
- if (!item) {
205
- return;
206
- }
207
- }
208
- var source = getParent(item);
209
- if (!source) {
210
- return;
211
- }
212
- if (o.invalid(item, handle)) {
213
- return;
214
- }
215
-
216
- var movable = o.moves(item, source, handle, nextEl(item));
217
- if (!movable) {
218
- return;
219
- }
220
-
221
- return {
222
- item: item,
223
- source: source
224
- };
225
- }
226
-
227
- function canMove (item) {
228
- return !!canStart(item);
229
- }
230
-
231
- function manualStart (item) {
232
- var context = canStart(item);
233
- if (context) {
234
- start(context);
235
- }
236
- }
237
-
238
- function start (context) {
239
- if (isCopy(context.item, context.source)) {
240
- _copy = context.item.cloneNode(true);
241
- drake.emit('cloned', _copy, context.item, 'copy');
242
- }
243
-
244
- _source = context.source;
245
- _item = context.item;
246
- _initialSibling = _currentSibling = nextEl(context.item);
247
-
248
- drake.dragging = true;
249
- drake.emit('drag', _item, _source);
250
- }
251
-
252
- function invalidTarget () {
253
- return false;
254
- }
255
-
256
- function end () {
257
- if (!drake.dragging) {
258
- return;
259
- }
260
- var item = _copy || _item;
261
- drop(item, getParent(item));
262
- }
263
-
264
- function ungrab () {
265
- _grabbed = false;
266
- eventualMovements(true);
267
- movements(true);
268
- }
269
-
270
- function release (e) {
271
- ungrab();
272
-
273
- if (!drake.dragging) {
274
- return;
275
- }
276
- var item = _copy || _item;
277
- var clientX = getCoord('clientX', e);
278
- var clientY = getCoord('clientY', e);
279
- var elementBehindCursor = getElementBehindPoint(_mirror, clientX, clientY);
280
- var dropTarget = findDropTarget(elementBehindCursor, clientX, clientY);
281
- if (dropTarget && ((_copy && o.copySortSource) || (!_copy || dropTarget !== _source))) {
282
- drop(item, dropTarget);
283
- } else if (o.removeOnSpill) {
284
- remove();
285
- } else {
286
- cancel();
287
- }
288
- }
289
-
290
- function drop (item, target) {
291
- var parent = getParent(item);
292
- if (_copy && o.copySortSource && target === _source) {
293
- parent.removeChild(_item);
294
- }
295
- if (isInitialPlacement(target)) {
296
- drake.emit('cancel', item, _source, _source);
297
- } else {
298
- drake.emit('drop', item, target, _source, _currentSibling);
299
- }
300
- cleanup();
301
- }
302
-
303
- function remove () {
304
- if (!drake.dragging) {
305
- return;
306
- }
307
- var item = _copy || _item;
308
- var parent = getParent(item);
309
- if (parent) {
310
- parent.removeChild(item);
311
- }
312
- drake.emit(_copy ? 'cancel' : 'remove', item, parent, _source);
313
- cleanup();
314
- }
315
-
316
- function cancel (revert) {
317
- if (!drake.dragging) {
318
- return;
319
- }
320
- var reverts = arguments.length > 0 ? revert : o.revertOnSpill;
321
- var item = _copy || _item;
322
- var parent = getParent(item);
323
- var initial = isInitialPlacement(parent);
324
- if (initial === false && reverts) {
325
- if (_copy) {
326
- parent.removeChild(_copy);
327
- } else {
328
- _source.insertBefore(item, _initialSibling);
329
- }
330
- }
331
- if (initial || reverts) {
332
- drake.emit('cancel', item, _source, _source);
333
- } else {
334
- drake.emit('drop', item, parent, _source, _currentSibling);
335
- }
336
- cleanup();
337
- }
338
-
339
- function cleanup () {
340
- var item = _copy || _item;
341
- ungrab();
342
- removeMirrorImage();
343
- if (item) {
344
- classes.rm(item, 'gu-transit');
345
- }
346
- if (_renderTimer) {
347
- clearTimeout(_renderTimer);
348
- }
349
- drake.dragging = false;
350
- if (_lastDropTarget) {
351
- drake.emit('out', item, _lastDropTarget, _source);
352
- }
353
- drake.emit('dragend', item);
354
- _source = _item = _copy = _initialSibling = _currentSibling = _renderTimer = _lastDropTarget = null;
355
- }
356
-
357
- function isInitialPlacement (target, s) {
358
- var sibling;
359
- if (s !== void 0) {
360
- sibling = s;
361
- } else if (_mirror) {
362
- sibling = _currentSibling;
363
- } else {
364
- sibling = nextEl(_copy || _item);
365
- }
366
- return target === _source && sibling === _initialSibling;
367
- }
368
-
369
- function findDropTarget (elementBehindCursor, clientX, clientY) {
370
- var target = elementBehindCursor;
371
- while (target && !accepted()) {
372
- target = getParent(target);
373
- }
374
- return target;
375
-
376
- function accepted () {
377
- var droppable = isContainer(target);
378
- if (droppable === false) {
379
- return false;
380
- }
381
-
382
- var immediate = getImmediateChild(target, elementBehindCursor);
383
- var reference = getReference(target, immediate, clientX, clientY);
384
- var initial = isInitialPlacement(target, reference);
385
- if (initial) {
386
- return true; // should always be able to drop it right back where it was
387
- }
388
- return o.accepts(_item, target, _source, reference);
389
- }
390
- }
391
-
392
- function drag (e) {
393
- if (!_mirror) {
394
- return;
395
- }
396
- e.preventDefault();
397
-
398
- var clientX = getCoord('clientX', e);
399
- var clientY = getCoord('clientY', e);
400
- var x = clientX - _offsetX;
401
- var y = clientY - _offsetY;
402
-
403
- _mirror.style.left = x + 'px';
404
- _mirror.style.top = y + 'px';
405
-
406
- var item = _copy || _item;
407
- var elementBehindCursor = getElementBehindPoint(_mirror, clientX, clientY);
408
- var dropTarget = findDropTarget(elementBehindCursor, clientX, clientY);
409
- var changed = dropTarget !== null && dropTarget !== _lastDropTarget;
410
- if (changed || dropTarget === null) {
411
- out();
412
- _lastDropTarget = dropTarget;
413
- over();
414
- }
415
- var parent = getParent(item);
416
- if (dropTarget === _source && _copy && !o.copySortSource) {
417
- if (parent) {
418
- parent.removeChild(item);
419
- }
420
- return;
421
- }
422
- var reference;
423
- var immediate = getImmediateChild(dropTarget, elementBehindCursor);
424
- if (immediate !== null) {
425
- reference = getReference(dropTarget, immediate, clientX, clientY);
426
- } else if (o.revertOnSpill === true && !_copy) {
427
- reference = _initialSibling;
428
- dropTarget = _source;
429
- } else {
430
- if (_copy && parent) {
431
- parent.removeChild(item);
432
- }
433
- return;
434
- }
435
- if (
436
- (reference === null && changed) ||
437
- reference !== item &&
438
- reference !== nextEl(item)
439
- ) {
440
- _currentSibling = reference;
441
- dropTarget.insertBefore(item, reference);
442
- drake.emit('shadow', item, dropTarget, _source);
443
- }
444
- function moved (type) { drake.emit(type, item, _lastDropTarget, _source); }
445
- function over () { if (changed) { moved('over'); } }
446
- function out () { if (_lastDropTarget) { moved('out'); } }
447
- }
448
-
449
- function spillOver (el) {
450
- classes.rm(el, 'gu-hide');
451
- }
452
-
453
- function spillOut (el) {
454
- if (drake.dragging) { classes.add(el, 'gu-hide'); }
455
- }
456
-
457
- function renderMirrorImage () {
458
- if (_mirror) {
459
- return;
460
- }
461
- var rect = _item.getBoundingClientRect();
462
- _mirror = _item.cloneNode(true);
463
- _mirror.style.width = getRectWidth(rect) + 'px';
464
- _mirror.style.height = getRectHeight(rect) + 'px';
465
- classes.rm(_mirror, 'gu-transit');
466
- classes.add(_mirror, 'gu-mirror');
467
- o.mirrorContainer.appendChild(_mirror);
468
- touchy(documentElement, 'add', 'mousemove', drag);
469
- classes.add(o.mirrorContainer, 'gu-unselectable');
470
- drake.emit('cloned', _mirror, _item, 'mirror');
471
- }
472
-
473
- function removeMirrorImage () {
474
- if (_mirror) {
475
- classes.rm(o.mirrorContainer, 'gu-unselectable');
476
- touchy(documentElement, 'remove', 'mousemove', drag);
477
- getParent(_mirror).removeChild(_mirror);
478
- _mirror = null;
479
- }
480
- }
481
-
482
- function getImmediateChild (dropTarget, target) {
483
- var immediate = target;
484
- while (immediate !== dropTarget && getParent(immediate) !== dropTarget) {
485
- immediate = getParent(immediate);
486
- }
487
- if (immediate === documentElement) {
488
- return null;
489
- }
490
- return immediate;
491
- }
492
-
493
- function getReference (dropTarget, target, x, y) {
494
- var horizontal = o.direction === 'horizontal';
495
- var reference = target !== dropTarget ? inside() : outside();
496
- return reference;
497
-
498
- function outside () { // slower, but able to figure out any position
499
- var len = dropTarget.children.length;
500
- var i;
501
- var el;
502
- var rect;
503
- for (i = 0; i < len; i++) {
504
- el = dropTarget.children[i];
505
- rect = el.getBoundingClientRect();
506
- if (horizontal && (rect.left + rect.width / 2) > x) { return el; }
507
- if (!horizontal && (rect.top + rect.height / 2) > y) { return el; }
508
- }
509
- return null;
510
- }
511
-
512
- function inside () { // faster, but only available if dropped inside a c